diff --git a/doc/epmet-cloud.md b/doc/epmet-cloud.md index 43cd0d2f63..28dfe7ff08 100644 --- a/doc/epmet-cloud.md +++ b/doc/epmet-cloud.md @@ -10,4 +10,7 @@ 例如:有A、B2个服务,并且A调用B,如果我们只需要开发A服务,那本地只启动A服务即可,A调用B的时候,会调用服务器的B服务。 如果需要开发AB2个服务,那么将A中的FeignClient的url属性指向localhost。 PS:目前正在测试通过负载均衡器和本地环境变量实现动态修改目标服务IP,成功之后就不需要再修改FeignClient的url,配置一下环境变量即可,到时候具体说 -``` \ No newline at end of file +``` + +如何安装本地jar到本地仓库: +mvn install:install-file -DgroupId=com.inspurcloud -DartifactId=oss -D version=1.1.8 -Dpackaging=jar -Dfile=inspur-cloud-oss-sdk-1.1.8.jar \ No newline at end of file diff --git a/epmet-commons/epmet-commons-mybatis/pom.xml b/epmet-commons/epmet-commons-mybatis/pom.xml index db396c4042..62c677e014 100644 --- a/epmet-commons/epmet-commons-mybatis/pom.xml +++ b/epmet-commons/epmet-commons-mybatis/pom.xml @@ -47,22 +47,22 @@ mysql-connector-java - + - + - + diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/RedissonConfig.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/RedissonConfig.java index ad02d71365..747deb0b2d 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/RedissonConfig.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/RedissonConfig.java @@ -21,10 +21,10 @@ public class RedissonConfig { @Value("${spring.redis.cluster-enabled}") private Boolean clusterEnabled; - @Value("${spring.redis.host}") - private String host; - @Value("${spring.redis.port}") - private String port; + //@Value("${spring.redis.host}") + //private String host; + //@Value("${spring.redis.port}") + //private String port; @Value("${spring.redis.password}") private String password; @Value("${spring.redis.cluster.nodes}") @@ -35,10 +35,10 @@ public class RedissonConfig { @Bean public RedissonClient getRedisson() { - if (StringUtils.isBlank(host)) { - log.warn("getRedisson redis param is null,don't need to init redissonClient"); - return null; - } + //if (StringUtils.isBlank(host)) { + // log.warn("getRedisson redis param is null,don't need to init redissonClient"); + // return null; + //} try { Config config = new Config(); @@ -50,10 +50,10 @@ public class RedissonConfig { if (clusterEnabled == null || !clusterEnabled) { //单机模式 - config.useSingleServer().setAddress("redis://".concat(host).concat(StrConstant.COLON).concat(port)); - config.useSingleServer().setPassword(password); - config.useSingleServer().setConnectTimeout(NumConstant.ONE_THOUSAND * NumConstant.FIVE); - config.useSingleServer().setDatabase(NumConstant.TEN); + //config.useSingleServer().setAddress("redis://".concat(host).concat(StrConstant.COLON).concat(port)); + //config.useSingleServer().setPassword(password); + //config.useSingleServer().setConnectTimeout(NumConstant.ONE_THOUSAND * NumConstant.FIVE); + //config.useSingleServer().setDatabase(NumConstant.TEN); } else { //集群模式 config.useClusterServers().addNodeAddress(getClusterNodes()); diff --git a/epmet-module/epmet-oss/epmet-oss-server/pom.xml b/epmet-module/epmet-oss/epmet-oss-server/pom.xml index 4b6b580481..ea22b95498 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/pom.xml +++ b/epmet-module/epmet-oss/epmet-oss-server/pom.xml @@ -97,8 +97,8 @@ 8.4.2 - com.inspur - oss-sdk + com.inspurcloud + oss diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/InspurStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/InspurStorageService.java index 8f6862e6a3..5ede13d22a 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/InspurStorageService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/InspurStorageService.java @@ -22,10 +22,14 @@ public class InspurStorageService extends AbstractCloudStorageService { public InspurStorageService(CloudStorageConfig config) { inspurProps = config.getInspur(); - //ossClient = new OSSClientImpl("oss.yantai-zww.inspurcloudoss.com", - // "OWVmNWZkZDUtMjgzNi00ZDcyLTk5MGUtMmJhNzcxNzE2ZmEx", - // "OTQwNGZlZTAtM2RkMS00NTRhLWI5NDYtNTQ4MzJhMDk3YWQ0"); ossClient = new OSSClientImpl(inspurProps.getEndPoint(), inspurProps.getAccessKey(), inspurProps.getSecretKey()); + + // 设置公共读权限 + //CannedAccessControlList currentAcl = ossClient.getBucketAcl(inspurProps.getBucketName()); + //if (CannedAccessControlList.PublicRead != currentAcl) { + // log.info("set inspur oss acl:::::public read"); + // ossClient.setBucketAcl(inspurProps.getBucketName(), CannedAccessControlList.PublicRead); + //} } @Override @@ -52,7 +56,11 @@ public class InspurStorageService extends AbstractCloudStorageService { public String upload(InputStream inputStream, String path, String privacyType) { try { ossClient.putObject(inspurProps.getBucketName(), path, inputStream); - return inspurProps.getDomain() + "/" + inspurProps.getBucketName() + "/" + path; + + // /oss统一前缀,是为了nginx做代理,识别用的。因为烟台的oss域名,需要dns,这个dns只能在服务器内网配置,政务外配置了不能用,所以需要一层代理 + // "http://172.20.46.177" + "/oss" + "/oss-202212261434580001" + String url = inspurProps.getDomain() + "/oss" + "/" + path; + return url; } catch (Exception e) { String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); log.error("浪潮云oss文件上传:{}", errorStackTrace); diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/TestController.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/TestController.java index a57082c6b7..041d419ce2 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/TestController.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/TestController.java @@ -37,7 +37,7 @@ public class TestController { @PostMapping("upload2aliyun") public Result upload2aliyun() { try (final FileInputStream fis = new FileInputStream("C:\\Users\\wxz\\Documents\\微信截图_20230101224521.png")) { - final MockMultipartFile mockMultipartFile = new MockMultipartFile("微信截图_20230101224521.png", fis); + final MockMultipartFile mockMultipartFile = new MockMultipartFile("1.png", fis); return ossService.uploadImg(mockMultipartFile, null); } catch (FileNotFoundException e) { log.error("method exception", e); diff --git a/pom.xml b/pom.xml index c5724eaf0b..ee9542c342 100644 --- a/pom.xml +++ b/pom.xml @@ -95,8 +95,8 @@ 1.3.70 - com.inspur - oss-sdk + com.inspurcloud + oss 1.1.8