瀏覽代碼

BOSS对接代码调整

linhuili 2 年之前
父節點
當前提交
227f39a203

+ 4 - 7
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/interceptor/StewardInterceptor.java

@@ -1,8 +1,5 @@
 package com.persagy.adm.server.custom.interceptor;
-import com.persagy.adm.steward.basic.utils.RSAUtils;
-import com.persagy.dmp.common.helper.SpringHelper;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
 
@@ -23,10 +20,10 @@ public class StewardInterceptor extends HandlerInterceptorAdapter {
 
     @Override
     public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
-        String body = getBody(request);
-        log.info("BOSS交付范围加密请求参数:{}"+body);
-        String string = SpringHelper.getString("boss.rsa.publicKey");
-        RSAUtils.decode(body,string);
+        // 不再在此处进行修改request请求参数
+        //String body = getBody(request);
+        //log.info("BOSS交付范围加密请求参数:{}"+body);
+        //RSAUtils.decode(body,SpringHelper.getString("boss.rsa.publicKey"));
         return super.preHandle(request, response, handler);
     }
 

+ 8 - 5
adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/controller/AdmDeliverPlanController.java

@@ -8,6 +8,7 @@ import com.persagy.adm.steward.basic.utils.RSAUtils;
 import com.persagy.adm.steward.entity.ProductFinishNumReq;
 import com.persagy.adm.steward.entity.ProjectDeliverReq;
 import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
 import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.common.utils.ResultHelper;
 import lombok.RequiredArgsConstructor;
@@ -35,19 +36,21 @@ public class AdmDeliverPlanController {
 
     private final AdmDeliverPlanService admDeliverPlanService;
 
+    @Value("${boss.rsa.privateKey}")
+    private String bossRsaPrivateKey;
+
     /**
      * 020101-交付计划-处理BOSS产生的交付计划
-     * @param projectDeliverReqStr : 交付计划信息
+     * @param requestStr : 交付计划信息
      * @return : com.persagy.dmp.common.model.response.CommonResult<java.util.List<java.lang.Void>>
      * @author : lijie
      * Update By 2022/1/14 17:22
      */
     @PostMapping(value = "/relayDeliverPlan")
-    public CommonResult<List<Void>> relayDeliverPlan(@RequestBody String projectDeliverReqStr) {
-     /*   log.info("未解密参数:{}"+projectDeliverReqStr);
-        String decode = RSAUtils.decode(projectDeliverReqStr, publicKey);*/
-        log.info("接收BOSS交付计划入参:{}"+projectDeliverReqStr);
+    public CommonResult<List<Void>> relayDeliverPlan(@RequestBody String requestStr) {
+        String projectDeliverReqStr = RSAUtils.decode(requestStr, bossRsaPrivateKey);
         ProjectDeliverReq projectDeliverReq = JSONObject.parseObject(projectDeliverReqStr, ProjectDeliverReq.class);
+        log.info("接收BOSS交付计划入参:{}"+projectDeliverReq);
         admDeliverPlanService.relayDeliverPlan(projectDeliverReq);
         return ResultHelper.multi(new ArrayList<>());
     }

+ 1 - 1
adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/basic/config/StewardEncodeInterceptor.java

@@ -27,7 +27,7 @@ public class StewardEncodeInterceptor implements RequestInterceptor {
         }
         // 更改请求体中的content的值
         Request.Body body = template.requestBody();
-        template.body(RSAUtils.encode(body.asString(), SpringHelper.getString("boss.rsa.privateKey")));
+        template.body(RSAUtils.encode(body.asString(), SpringHelper.getString("bdtp.rsa.publicKey")));
         log.info("template:{}",template);
         log.info("body.asString():{}",body.asString());
     }

File diff suppressed because it is too large
+ 0 - 4
adm-comp/adm-steward-starter/src/main/resources/application.yml