wuxw лет назад: 2
Родитель
Сommit
8245a6ecf8

+ 6 - 6
java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java

@@ -342,17 +342,17 @@ public class AuthenticationFactory {
      * @param param
      */
     public static void createSign(Map<String, String> headers, HttpMethod httpMethod, String url, String param) {
-        String appId = headers.get(CommonConstant.HTTP_APP_ID);
+        String appId = headers.get(CommonConstant.APP_ID);
         if (StringUtil.isEmpty(appId)) {
-            appId = headers.get(CommonConstant.APP_ID);
+            appId = headers.get(CommonConstant.HTTP_APP_ID);
         }
-        String transactionId = headers.get(CommonConstant.HTTP_TRANSACTION_ID);
+        String transactionId = headers.get(CommonConstant.TRANSACTION_ID);
         if (StringUtil.isEmpty(transactionId)) {
-            transactionId = headers.get(CommonConstant.TRANSACTION_ID);
+            transactionId = headers.get(CommonConstant.HTTP_TRANSACTION_ID);
         }
-        String requestTime = headers.get(CommonConstant.HTTP_REQ_TIME);
+        String requestTime = headers.get(CommonConstant.REQUEST_TIME);
         if (StringUtil.isEmpty(transactionId)) {
-            requestTime = headers.get(CommonConstant.REQUEST_TIME);
+            requestTime = headers.get(CommonConstant.HTTP_REQ_TIME);
         }
 
         List<AppRoute> appRoutes = AppRouteCache.getAppRoute(appId);

+ 2 - 3
service-api/src/main/java/com/java110/api/smo/DefaultAbstractComponentSMO.java

@@ -152,9 +152,6 @@ public class DefaultAbstractComponentSMO extends AbstractComponentSMO {
         if (!headers.containsKey(CommonConstant.HTTP_REQ_TIME)) {
             headers.put(CommonConstant.HTTP_REQ_TIME, DateUtil.getNowDefault());
         }
-        if (!headers.containsKey(CommonConstant.HTTP_SIGN)) {
-            headers.put(CommonConstant.HTTP_SIGN, "");
-        }
 
         if (url.indexOf("?") > -1) {
             url = url.substring(0, url.indexOf("?"));
@@ -168,6 +165,8 @@ public class DefaultAbstractComponentSMO extends AbstractComponentSMO {
         if (HttpMethod.GET == httpMethod) {
             headers.put("REQUEST_URL", "http://127.0.0.1:8008/" + url + mapToUrlParam(JSONObject.parseObject(param)));
         }
+        AuthenticationFactory.createSign(headers,httpMethod,headers.get("REQUEST_URL"),param);
+
         try {
             responseEntity = apiServiceSMOImpl.service(param, headers);
         } catch (HttpStatusCodeException e) { //这里spring 框架 在4XX 或 5XX 时抛出 HttpServerErrorException 异常,需要重新封装一下

+ 2 - 3
springboot/src/main/java/com/java110/boot/smo/DefaultAbstractComponentSMO.java

@@ -153,9 +153,6 @@ public class DefaultAbstractComponentSMO extends AbstractComponentSMO {
         if (!headers.containsKey(CommonConstant.HTTP_REQ_TIME)) {
             headers.put(CommonConstant.HTTP_REQ_TIME, DateUtil.getNowDefault());
         }
-        if (!headers.containsKey(CommonConstant.HTTP_SIGN)) {
-            headers.put(CommonConstant.HTTP_SIGN, "");
-        }
 
         if (url.indexOf("?") > -1) {
             url = url.substring(0, url.indexOf("?"));
@@ -169,6 +166,8 @@ public class DefaultAbstractComponentSMO extends AbstractComponentSMO {
         if (HttpMethod.GET == httpMethod) {
             headers.put("REQUEST_URL", "http://127.0.0.1:8008/" + url + mapToUrlParam(JSONObject.parseObject(param)));
         }
+        AuthenticationFactory.createSign(headers,httpMethod,headers.get("REQUEST_URL"),param);
+
         try {
             responseEntity = apiServiceSMOImpl.service(param, headers);
         } catch (HttpStatusCodeException e) { //这里spring 框架 在4XX 或 5XX 时抛出 HttpServerErrorException 异常,需要重新封装一下