浏览代码

del jetcache 依赖

GITZYY 9 月之前
父节点
当前提交
7b45f4423f

+ 3 - 3
egress-gateway-service-client/src/main/java/com/hrsk/cloud/eg/constant/ResultCodeEnum.java

@@ -26,9 +26,9 @@ public enum ResultCodeEnum {
     GLOBAL_GO_VERIFYSMS_LOGIN(205,"短信验证登录","短信验证登录"),
     GLOBAL_INTERFACE_LIMIT(206,"接口访问频繁","接口访问太过频繁,请稍后再试")
     ;
-    private int code;
-    private String description;
-    private String msg;
+    private final int code;
+    private final String description;
+    private final String msg;
 
     ResultCodeEnum(int code, String description, String msg) {
         this.code = code;

+ 1 - 1
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/HttpApi.java

@@ -63,7 +63,7 @@ public class HttpApi implements Api {
      * header数据
      */
     @Getter
-    private Map<String,Object> header = new HashMap<>();
+    private final Map<String,Object> header = new HashMap<>();
     /**
      * 请求payload数据
      */

+ 1 - 1
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/common/ApiPayloadTypeEnum.java

@@ -19,7 +19,7 @@ public enum ApiPayloadTypeEnum {
      * @return 编码
 
      */
-    private String code;
+    private final String code;
 
     /**
      * 构造函数

+ 2 - 2
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/common/ValueObjectTypeEnum.java

@@ -14,12 +14,12 @@ public enum ValueObjectTypeEnum {
      * 类型
      */
     @Getter
-    private String type;
+    private final String type;
     /**
      * 描述
      */
     @Getter
-    private String memo;
+    private final String memo;
 
     /**
      * 构造函数

+ 2 - 2
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/func/EncryptionFunction.java

@@ -20,7 +20,7 @@ public class EncryptionFunction {
     public static String md5(FunctionParam functionParam){
         String input = Objects.toString(functionParam.getInput(),null);
         //用于加密的字符
-        char md5String[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+        char[] md5String = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
                 'A', 'B', 'C', 'D', 'E', 'F' };
         try {
             //使用平台的默认字符集将此 String 编码为 byte序列,并将结果存储到一个新的 byte数组中
@@ -33,7 +33,7 @@ public class EncryptionFunction {
             byte[] md = mdInst.digest();
             // 把密文转换成十六进制的字符串形式
             int j = md.length;
-            char str[] = new char[j * 2];
+            char[] str = new char[j * 2];
             int k = 0;
             for (int i = 0; i < j; i++) {   //  i = 0
                 byte byte0 = md[i];  //95

+ 1 - 1
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/resolver/vo/ValueObjectResolverManager.java

@@ -33,7 +33,7 @@ public class ValueObjectResolverManager {
     /**
      * 构造函数
      */
-    private ValueObjectResolverManager(){};
+    private ValueObjectResolverManager(){}
 
     /**
      * 获取实例

+ 3 - 3
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/constant/ResultCode.java

@@ -26,9 +26,9 @@ public enum ResultCode {
     GLOBAL_GO_VERIFYSMS_LOGIN(205,"短信验证登录","短信验证登录"),
     GLOBAL_INTERFACE_LIMIT(206,"接口访问频繁","接口访问太过频繁,请稍后再试")
     ;
-    private int code;
-    private String description;
-    private String msg;
+    private final int code;
+    private final String description;
+    private final String msg;
 
     ResultCode(int code, String description, String msg) {
         this.code = code;

+ 7 - 6
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/utils/PrivacyAesUtil.java

@@ -7,6 +7,7 @@ import org.slf4j.LoggerFactory;
 import javax.crypto.Cipher;
 import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -19,7 +20,7 @@ import java.util.Map;
 public class PrivacyAesUtil {
 
     private static final Logger log = LoggerFactory.getLogger(PrivacyAesUtil.class);
-    private static byte[] Keys = {0x41, 0x72, 0x65, 0x79, 0x6F, 0x75, 0x6D, 0x79, 0x53, 0x6E, 0x6F, 0x77, 0x6D, 0x61, 0x6E, 0x3F};
+    private static final byte[] Keys = {0x41, 0x72, 0x65, 0x79, 0x6F, 0x75, 0x6D, 0x79, 0x53, 0x6E, 0x6F, 0x77, 0x6D, 0x61, 0x6E, 0x3F};
 
     private final static String AesDecKey = "47FC4124CF94E070";
 
@@ -46,7 +47,7 @@ public class PrivacyAesUtil {
             System.out.print("Key长度不是16位");
             return null;
         }
-        byte[] raw = sKey.getBytes("utf-8");
+        byte[] raw = sKey.getBytes(StandardCharsets.UTF_8);
         SecretKeySpec keySpec = new SecretKeySpec(raw, "AES");
         Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");//"算法/模式/补码方式"
         IvParameterSpec iv = new IvParameterSpec(ivKey.getBytes());//使用CBC模式,需要一个向量iv,可增加加密算法的强度
@@ -180,7 +181,7 @@ public class PrivacyAesUtil {
             resultMap.put(PrivacyAesUtil.RESULT, encryptSortNum(sourceStr));
             return resultMap;
         }
-        String subStr = sourceStr.substring(sourceStr.length()-4,sourceStr.length());
+        String subStr = sourceStr.substring(sourceStr.length()-4);
         subStr = subStr.replaceAll("(x|X)", "A").replaceAll("[^0-9aA]", "B");
 
         key += subStr;
@@ -300,11 +301,11 @@ public class PrivacyAesUtil {
             }
         }
         try {
-            byte[] raw = sKey.getBytes("utf-8");
+            byte[] raw = sKey.getBytes(StandardCharsets.UTF_8);
             SecretKeySpec skySpec = new SecretKeySpec(raw, "AES"); // "算法/模式/补码方式"
             Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
             cipher.init(Cipher.ENCRYPT_MODE, skySpec);
-            byte[] encrypted = cipher.doFinal(sSrc.getBytes("utf-8")); // 此处使用 BASE64 做转码功能,同时能起到 2 次加密的作用。
+            byte[] encrypted = cipher.doFinal(sSrc.getBytes(StandardCharsets.UTF_8)); // 此处使用 BASE64 做转码功能,同时能起到 2 次加密的作用。
             return Base64.encodeBase64String(encrypted);
         } catch (Exception e) {
             e.printStackTrace();
@@ -322,7 +323,7 @@ public class PrivacyAesUtil {
                 return null;
             }
         }
-        byte[] raw = sKey.getBytes("utf-8");
+        byte[] raw = sKey.getBytes(StandardCharsets.UTF_8);
         SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); // "算法/模式/补码方式"
         Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
         cipher.init(Cipher.DECRYPT_MODE, skeySpec);

+ 4 - 6
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/config/client/config/RetryRestTemplate.java

@@ -25,6 +25,7 @@ import org.springframework.web.client.RestTemplate;
 import java.io.IOException;
 import java.net.ConnectException;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
@@ -52,7 +53,7 @@ public class RetryRestTemplate {
         List<HttpMessageConverter<?>> newMessageConverters = new ArrayList<>();
         for(HttpMessageConverter<?> converter : restTemplate.getMessageConverters()){
             if(converter instanceof StringHttpMessageConverter){
-                StringHttpMessageConverter messageConverter = new StringHttpMessageConverter(Charset.forName("UTF-8"));
+                StringHttpMessageConverter messageConverter = new StringHttpMessageConverter(StandardCharsets.UTF_8);
                 newMessageConverters.add(messageConverter);
             }else {
                 newMessageConverters.add(converter);
@@ -83,11 +84,8 @@ public class RetryRestTemplate {
                 HttpClientContext clientContext = HttpClientContext.adapt(context);
                 org.apache.http.HttpRequest request = clientContext.getRequest();
                 boolean idempotent = !(request instanceof HttpEntityEnclosingRequest);
-                if (idempotent) {
-                    // 如果请求被认为是幂等的,那么就重试。即重复执行不影响程序其他效果的
-                    return true;
-                }
-                return false;
+                // 如果请求被认为是幂等的,那么就重试。即重复执行不影响程序其他效果的
+                return idempotent;
             }
         };