Browse Source

Merge remote-tracking branch 'origin/feature-v4-20220801' into feature-v4-20220801

lyhzzz 2 năm trước cách đây
mục cha
commit
a5567bb848

+ 10 - 0
4dkankan-common-web/src/main/java/com/fdkankan/web/annotation/NotResponseAdvice.java

@@ -0,0 +1,10 @@
+package com.fdkankan.web.annotation;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.PARAMETER, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface NotResponseAdvice {
+    String description() default "";
+}

+ 7 - 0
4dkankan-common-web/src/main/java/com/fdkankan/web/response/BaseResponseAdvice.java

@@ -3,6 +3,7 @@ package com.fdkankan.web.response;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.web.annotation.NotResponseAdvice;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 import org.springframework.core.MethodParameter;
@@ -13,12 +14,18 @@ import org.springframework.http.server.ServerHttpResponse;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
 
+import java.util.Objects;
+
 @ConditionalOnMissingBean(name = "customResponseAdvice")
 @RestControllerAdvice
 @Slf4j
 public class BaseResponseAdvice implements ResponseBodyAdvice<Object> {
     @Override
     public boolean supports(MethodParameter methodParameter, Class<? extends HttpMessageConverter<?>> aClass) {
+        NotResponseAdvice methodAnnotation = methodParameter.getMethodAnnotation(NotResponseAdvice.class);
+        if(Objects.nonNull(methodAnnotation)){
+            return false;
+        }
         return true;
     }
 

+ 10 - 0
4dkankan-utils-fyun-local/src/main/java/com/fdkankan/fyun/local/LocalFileService.java

@@ -177,6 +177,16 @@ public class LocalFileService extends AbstractFYunFileService {
         return FileUtils.getSubFileNums(new File(getOssPath(bucket, url)));
     }
 
+    @Override
+    public void restoreFolder(String bucket, String folderName, Integer priority) {
+
+    }
+
+    @Override
+    public void restoreFile(String bucket, String objectName, Integer priority) {
+
+    }
+
     private String getOssPath(String bucket, String filePath) {
         return LocalConstants.BASE_PATH.concat(bucket).concat(File.separator).concat(filePath);
     }

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

@@ -25,7 +25,7 @@ public class RegCodeUtil {
      * @return:
      **/
     public static String GenRegeditCode(String machineCode){
-        String s = Crypt.encryptAES(machineCode, true);
+        String s = Crypt.encryptAES(machineCode.trim(), true);
         log.info("安装注册码:{}",s);
         return s;
     }
@@ -38,7 +38,7 @@ public class RegCodeUtil {
      * @return:
      **/
     public static String GenRegeditCamCode(String plaintext){
-            String s = Crypt.encryptAES(plaintext, true);
+            String s = Crypt.encryptAES(plaintext.trim(), true);
         log.info("相机注册码:{}",s);
         log.info("相机注册码原始长度:{}",s.length());
         String code = DeflaterUtil.zipString(s);
@@ -56,7 +56,7 @@ public class RegCodeUtil {
      **/
     public static MachineRegDto ParseMachineCode(String plaintext){
         try {
-            String source = Crypt.decryptAES(plaintext, true);
+            String source = Crypt.decryptAES(plaintext.trim(), true);
             log.info("相机注册码解密:{}",source);
             MachineRegDto t = JSON.toJavaObject(JSONObject.parseObject(source) , MachineRegDto.class);
             return t;
@@ -65,30 +65,30 @@ public class RegCodeUtil {
             return null;
         }
     }
-    /***
-     * @description 获取激活数据
-     * @author: Xiewj
-     * @date: 2023/7/6 15:01
-     * @param:  plaintext 需要转换成对象的字符串
-     * @return:
-     **/
-    public static CamRegDto ParseRegeditCamCode(String machineCode , String plaintext){
-        try {
-            //解压
-            String code = DeflaterUtil.unzipString(plaintext);
-            log.info("相机注册码解压:{}",code);
-            String source = Crypt.decryptAES(code, true);
-            log.info("相机注册码解密:{}",source);
-            CamRegDto t = JSON.toJavaObject(JSONObject.parseObject(source) , CamRegDto.class);
-            if (ObjUtil.isNull(t.getMachineCode()) && !t.getMachineCode().equals(machineCode)){
-                throw new RuntimeException("校验失败");
-            }
-            return t;
-        }catch (Exception e){
-            e.printStackTrace();
-            return null;
-        }
-    }
+//    /***
+//     * @description 获取激活数据
+//     * @author: Xiewj
+//     * @date: 2023/7/6 15:01
+//     * @param:  plaintext 需要转换成对象的字符串
+//     * @return:
+//     **/
+//    public static CamRegDto ParseRegeditCamCode(String machineCode , String plaintext){
+//        try {
+//            //解压
+//            String code = DeflaterUtil.unzipString(plaintext);
+//            log.info("相机注册码解压:{}",code);
+//            String source = Crypt.decryptAES(code, true);
+//            log.info("相机注册码解密:{}",source);
+//            CamRegDto t = JSON.toJavaObject(JSONObject.parseObject(source) , CamRegDto.class);
+//            if (ObjUtil.isNull(t.getMachineCode()) && !t.getMachineCode().equals(machineCode)){
+//                throw new RuntimeException("校验失败");
+//            }
+//            return t;
+//        }catch (Exception e){
+//            e.printStackTrace();
+//            return null;
+//        }
+//    }
 
     /***
      * @description:生成相机激活码多个
@@ -111,11 +111,11 @@ public class RegCodeUtil {
     public static CamRegSDto BatchParseRegeditCamCode(String machineCode,String plaintext){
         try {
             //解压
-            String code = DeflaterUtil.unzipString(plaintext);
+            String code = DeflaterUtil.unzipString(plaintext.trim());
             log.info("批量生成相机码解压:{}",code);
             String source = Crypt.decryptAES(code, true);
             CamRegSDto t = JSON.toJavaObject(JSONObject.parseObject(source) , CamRegSDto.class);
-            if (ObjUtil.isNull(t.getMachineCode()) && !t.getMachineCode().equals(machineCode)){
+            if (ObjUtil.isNull(t.getMachineCode()) && !t.getMachineCode().equals(machineCode.trim())){
                 throw new RuntimeException("校验失败");
             }
             return t;
@@ -134,13 +134,13 @@ public class RegCodeUtil {
         //生成安装注册码
         String s = GenRegeditCode(machineCode);
 
-        CamRegDto camRegDto1=new CamRegDto();
-        camRegDto1.setSn("00000001");
-        camRegDto1.setMachineCode(machineCode);
-        //生成相机注册码
-        String camCode = GenRegeditCamCode( JSON.toJSONString(camRegDto1));
-        //校验相机注册码
-        CamRegDto camRegDto3 = ParseRegeditCamCode(machineCode,camCode);
+//        CamRegDto camRegDto1=new CamRegDto();
+//        camRegDto1.setSn("00000001");
+//        camRegDto1.setMachineCode(machineCode);
+//        //生成相机注册码
+//        String camCode = GenRegeditCamCode( JSON.toJSONString(camRegDto1));
+//        //校验相机注册码
+//        CamRegDto camRegDto3 = ParseRegeditCamCode(machineCode,camCode);
 
 
         List<CamRegDto> list=new ArrayList<>();

+ 0 - 1
4dkankan-utils-reg/src/main/java/com/fdkankan/reg/dto/CamRegDto.java

@@ -7,7 +7,6 @@ import lombok.Data;
  */
 @Data
 public class CamRegDto {
-    private String machineCode;
      /**
      * {"SN": "SN000001", "TOSN": "", "OPTION": "ADD"}
      **/