xiewj 1 rok temu
rodzic
commit
187ba2904f

+ 1 - 0
4dkankan-utils-filestorage/src/main/java/com/fdkankan/filestorage/FileStorageTemplate.java

@@ -92,4 +92,5 @@ public interface FileStorageTemplate {
     String getActive();
     String calculateUrl(String pathKey);
     String calculateUrl(String bucket, String pathKey);
+    String getHostByBucket(String bucket);
 }

+ 6 - 1
4dkankan-utils-filestorage/src/main/java/com/fdkankan/filestorage/aliyun/AliyunOssTemplate.java

@@ -211,7 +211,12 @@ public class AliyunOssTemplate implements FileStorageTemplate {
     @Override
     public String calculateUrl(String bucket, String pathKey) {
         String host = ossProperties.getHostByBucket(bucket);
-        return host + "/" + pathKey;
+        return ossProperties.isFullPath()?host + "/" + pathKey:pathKey;
+    }
+
+
+    public String getHostByBucket(String bucket) {
+        return ossProperties.getHostByBucket(bucket);
     }
 
     public String calculatePathKey(String url) {

+ 5 - 2
4dkankan-utils-filestorage/src/main/java/com/fdkankan/filestorage/aws/AwsTemplate.java

@@ -212,9 +212,12 @@ public class AwsTemplate implements FileStorageTemplate {
 
     public String calculateUrl(String bucket, String pathKey) {
         String host = awsProperties.getHostByBucket(bucket);
-        return host + "/" + pathKey;
+        return awsProperties.isFullPath()?host + "/" + pathKey:pathKey;
+    }
+    @Override
+    public String getHostByBucket(String bucket) {
+        return awsProperties.getHostByBucket(bucket);
     }
-
     public String calculatePathKey(String url) {
         String urlPath = InnerUtils.getUrlPath(url);
         if (urlPath != null && urlPath.startsWith("/")) {

+ 5 - 2
4dkankan-utils-filestorage/src/main/java/com/fdkankan/filestorage/cos/CosTemplate.java

@@ -211,9 +211,12 @@ public class CosTemplate implements FileStorageTemplate {
     @Override
     public String calculateUrl(String bucket, String pathKey) {
         String host = cosProperties.getHostByBucket(bucket);
-        return host + "/" + pathKey;
+        return cosProperties.isFullPath()?host + "/" + pathKey:pathKey;
+    }
+    @Override
+    public String getHostByBucket(String bucket) {
+        return cosProperties.getHostByBucket(bucket);
     }
-
     public String calculatePathKey(String url) {
         String urlPath = InnerUtils.getUrlPath(url);
         if (urlPath != null && urlPath.startsWith("/")) {

+ 5 - 2
4dkankan-utils-filestorage/src/main/java/com/fdkankan/filestorage/minio/MinioTemplate.java

@@ -194,9 +194,12 @@ public class MinioTemplate implements FileStorageTemplate {
 
     public String calculateUrl(String bucket, String pathKey) {
         String host = minioProperties.getHostByBucket(bucket);
-        return host + "/" + bucket + "/" + pathKey;
+        return minioProperties.isFullPath()?host + "/" + pathKey:pathKey;
+    }
+    @Override
+    public String getHostByBucket(String bucket) {
+        return minioProperties.getHostByBucket(bucket);
     }
-
     public String calculatePathKey(String url) {
         String urlPath = InnerUtils.getUrlPath(url);
         if (urlPath != null && urlPath.startsWith("/")) {

+ 4 - 0
4dkankan-utils-filestorage/src/main/java/com/fdkankan/filestorage/properties/AliyunOssProperties.java

@@ -61,6 +61,10 @@ public class AliyunOssProperties implements Serializable, InitializingBean {
      * Client configuration.
      */
     private ClientBuilderConfiguration config = new ClientBuilderConfiguration();
+    /**
+     * return fullPath
+     */
+    private boolean fullPath =true;
 
     @Override
     public void afterPropertiesSet() {

+ 5 - 0
4dkankan-utils-filestorage/src/main/java/com/fdkankan/filestorage/properties/AwsProperties.java

@@ -49,6 +49,11 @@ public class AwsProperties implements Serializable, InitializingBean {
      */
     private String bucket;
 
+    /**
+     * return fullPath
+     */
+    private boolean fullPath =true;
+
     @Override
     public void afterPropertiesSet() {
         InnerUtils.checkArgument(!StringUtils.isEmpty(endpoint), "'endpointUrl' can't be empty");

+ 5 - 0
4dkankan-utils-filestorage/src/main/java/com/fdkankan/filestorage/properties/CosProperties.java

@@ -63,6 +63,11 @@ public class CosProperties implements Serializable, InitializingBean {
      */
     private ClientConfig config = new ClientConfig();
 
+    /**
+     * return fullPath
+     */
+    private boolean fullPath =true;
+
     @Override
     public void afterPropertiesSet() {
         InnerUtils.checkArgument(!StringUtils.isEmpty(bucket), "'bucket' can't be empty");

+ 4 - 0
4dkankan-utils-filestorage/src/main/java/com/fdkankan/filestorage/properties/MinioProperties.java

@@ -55,6 +55,10 @@ public class MinioProperties implements Serializable, InitializingBean {
      * Bucket
      */
     private String bucket;
+    /**
+     * return fullPath
+     */
+    private boolean fullPath =true;
 
     @Override
     public void afterPropertiesSet() {

+ 3 - 3
4dkankan-utils-reg/src/main/java/com/fdkankan/reg/RegCodeUtil.java

@@ -138,7 +138,7 @@ public class RegCodeUtil {
         }
     }
     public static  void main(String[] args) {
-        RegCodeUtil uat = RegCodeUtil.builder().env("UAT").build();
+        RegCodeUtil uat = RegCodeUtil.builder().env("PROD").build();
 
         String machineCode="8CA4224EB41BE3AD8998415EA0460F39845AC74625B3158A84AD18CEAC5FD6F4500CCC34309F7045F726AA6968F908C9";
 
@@ -176,9 +176,9 @@ public class RegCodeUtil {
 
 
         CamRegDto camRegDto1=new CamRegDto();
-        camRegDto1.setSn("902ce60f5");
+        camRegDto1.setSn("dvt600001");
 //        camRegDto1.setToSn("c123456789");
-        camRegDto1.setCameraType(9);
+        camRegDto1.setCameraType(10);
 
         list.add(camRegDto1);