From 1006ed84660edfabbb5273a523e0c3c5af20a387 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期五, 03 九月 2021 00:29:59 +0800
Subject: [PATCH] 优化代码

---
 java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java b/java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java
index cf48715..812ede4 100755
--- a/java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java
+++ b/java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java
@@ -11,6 +11,8 @@
 import com.auth0.jwt.interfaces.DecodedJWT;
 import com.java110.core.context.ApiDataFlow;
 import com.java110.core.context.DataFlow;
+import com.java110.dto.reportData.ReportDataDto;
+import com.java110.dto.reportData.ReportDataHeaderDto;
 import com.java110.utils.cache.JWTCache;
 import com.java110.utils.cache.MappingCache;
 import com.java110.utils.constant.CommonConstant;
@@ -380,6 +382,31 @@
     }
 
     /**
+     * md5绛惧悕
+     *
+     * @param reportDataDto
+     * @return
+     */
+    public static void authReportDataSign(ReportDataDto reportDataDto, String code) throws NoAuthorityException {
+        ReportDataHeaderDto reportDataHeaderDto = reportDataDto.getReportDataHeaderDto();
+        if (reportDataHeaderDto == null) {
+            throw new IllegalArgumentException("鍙傛暟閿欒");
+        }
+        String newSign = md5(reportDataHeaderDto.getTranId() + reportDataHeaderDto.getReqTime() + reportDataDto.getReportDataBodyDto().toJSONString() + code).toLowerCase();
+        if (!newSign.equals(reportDataHeaderDto.getSign())) {
+            throw new IllegalArgumentException("绛惧悕澶辫触");
+        }
+    }
+
+    public static void generatorReportDataSign(ReportDataDto reportDataDto, String code) {
+        ReportDataHeaderDto reportDataHeaderDto = reportDataDto.getReportDataHeaderDto();
+        if (reportDataHeaderDto == null) {
+            throw new IllegalArgumentException("鍙傛暟閿欒");
+        }
+        String newSign = md5(reportDataHeaderDto.getTranId() + reportDataHeaderDto.getReqTime() + reportDataDto.getReportDataBodyDto().toJSONString() + code).toLowerCase();
+        reportDataHeaderDto.setSign(newSign);
+    }
+    /**
      * 鍔犺浇鍏挜
      *
      * @param publicPemData
@@ -536,7 +563,7 @@
 //        PrivateKey privateKey = keyPair.getPrivate();
 //        System.out.println("绉侀挜锛�" + new String(Base64.getEncoder().encode(privateKey.getEncoded())));
 
-        System.out.printf("passwdMd5 " + passwdMd5("wuxw2015"));
+        System.out.printf("passwdMd5 " + passwdMd5("397301"));
 
     }
 

--
Gitblit v1.8.0