From 65b9b81171843545bc17a8e7167ff06c3d80e73d Mon Sep 17 00:00:00 2001 From: CZT <czt18638530771@163.com> Date: 星期一, 18 九月 2023 16:00:54 +0800 Subject: [PATCH] 调整上海接口加密问题 --- src/main/java/com/fzzy/push/sh2023/SH2023ApiRemoteService.java | 23 ++++++++++++++--------- 1 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/fzzy/push/sh2023/SH2023ApiRemoteService.java b/src/main/java/com/fzzy/push/sh2023/SH2023ApiRemoteService.java index 0dc1763..e1abe87 100644 --- a/src/main/java/com/fzzy/push/sh2023/SH2023ApiRemoteService.java +++ b/src/main/java/com/fzzy/push/sh2023/SH2023ApiRemoteService.java @@ -11,6 +11,7 @@ import com.fzzy.api.service.ApiTriggerService; import com.fzzy.api.utils.*; import com.fzzy.api.view.repository.*; +import com.fzzy.order.data.OrderData; import com.fzzy.push.sh2023.dto.*; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -74,7 +75,7 @@ String inteId = param.getInteId(); String kqdm = param.getKqdm(); //鏌ヨ搴撳尯淇℃伅琛屾斂鍖哄垝鐮� - List<Api1102> api1102List = api1102Rep.findPushData(conf.getKqdm()); + List<Api1102> api1102List = api1102Rep.findPushData(kqdm); try { if (null == conf) { conf = apiCommonService.getConf(kqdm); @@ -108,8 +109,9 @@ //鑾峰彇鎸囦护id String key = RedisConst.buildKey(RedisConst.KYE_ORDER, conf.getKqdm()); - String orderId = (String)redisUtil.get(key); - if(StringUtils.isEmpty(orderId)){ + OrderData orderData = (OrderData)redisUtil.get(key); + if(StringUtils.isEmpty(orderData.getOrderid())){ + log.error("鎸囦护id澶辨晥=" + jsonData); ResponseDto responseDto = new ResponseDto(99, "鎸囦护id澶辨晥"); apiLog.setStatus(99); apiLog.setResult("鎸囦护id澶辨晥"); @@ -123,18 +125,21 @@ //鑾峰彇韬唤ID锛屽嵆琛屾斂鍖哄垝鐮� reqData.setUid(conf.getUserName()); //鎸囦护id - reqData.setOrderid(orderId); + reqData.setOrderid(orderData.getOrderid()); + //韬唤绛惧悕锛屼娇鐢ㄨ嚜鏈塕SA绉侀挜杩涜鍔犲瘑(鍦板尯琛屾斂鍖哄垝浠g爜_褰撳ぉ鏃ユ湡) reqData.setAccess_token(RSAUtils.encryptData(reqData.getUid() + "_" + DateFormatUtils.format(new Date(), "yyyy-MM-dd"), conf.getPassword())); //鏁版嵁鎬绘潯鏁� List<Object> list = (List<Object>) data; reqData.setDatalength(list.size()); + //浣跨敤鍖虹骇骞冲彴鍏挜瀵规暟鎹繘琛孯SA鍔犲瘑 reqData.setData(RSAUtils.encrypt(jsonData, conf.getPublicKey())); //鎽樿锛屾暟鎹富浣撶殑MD5鍊� reqData.setDigst(MyMD5Util.encrypt(jsonData)); - SH2023RespDto responseDto = SH2023HttpClientUtil.postPushData(conf.getApiUrl() + inteId, reqData, conf); + SH2023RespDto responseDto = SH2023HttpClientUtil.postPushData(conf.getApiUrl() + inteId, JSON.toJSONString(reqData), conf); + apiLog.setStatus(responseDto.getCode() == 200 ? 0 : responseDto.getCode()); apiLog.setResult(responseDto.getResult()); apiLogRep.save(apiLog); @@ -195,8 +200,8 @@ //鑾峰彇鎸囦护id String key = RedisConst.buildKey(RedisConst.KYE_ORDER, conf.getKqdm()); - String orderId = (String)redisUtil.get(key); - if(StringUtils.isEmpty(orderId)){ + OrderData orderData = (OrderData)redisUtil.get(key); + if(StringUtils.isEmpty(orderData.getOrderid())){ ResponseDto responseDto = new ResponseDto(99, "鎸囦护id澶辨晥"); apiLog.setStatus(99); apiLog.setResult("鎸囦护id澶辨晥"); @@ -210,7 +215,7 @@ //鑾峰彇韬唤ID锛屽嵆琛屾斂鍖哄垝鐮� reqData.setUid(conf.getUserName()); //鎸囦护id - reqData.setOrderid(orderId); + reqData.setOrderid(orderData.getOrderid()); //韬唤绛惧悕锛屼娇鐢ㄨ嚜鏈塕SA绉侀挜杩涜鍔犲瘑(鍦板尯琛屾斂鍖哄垝浠g爜_褰撳ぉ鏃ユ湡) reqData.setAccess_token(RSAUtils.encryptData(reqData.getUid() + "_" + DateFormatUtils.format(new Date(), "yyyy-MM-dd"), conf.getPassword())); //鏁版嵁鎬绘潯鏁� @@ -221,7 +226,7 @@ //鎽樿锛屾暟鎹富浣撶殑MD5鍊� reqData.setDigst(MyMD5Util.encrypt(jsonData)); - SH2023RespDto responseDto = SH2023HttpClientUtil.postPushData(conf.getApiUrl() + inteId, reqData, conf); + SH2023RespDto responseDto = SH2023HttpClientUtil.postPushData(conf.getApiUrl() + inteId, JSON.toJSONString(reqData), conf); apiLog.setStatus(responseDto.getCode() == 200 ? 0 : responseDto.getCode()); apiLog.setResult(responseDto.getResult()); apiLogRep.save(apiLog); -- Gitblit v1.9.3