ソースを参照

feat: 众蚁云签约回调回退

李学松 2 年 前
コミット
660affafb4

+ 40 - 8
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/GigThirdApiController.java

@@ -139,16 +139,48 @@ public class GigThirdApiController {
 			return "fail";
 		}
 
-		// 请求记录到数据库
-		ZhongyiyunInputRecord inputRecord = new ZhongyiyunInputRecord();
-		inputRecord.setReqId(reqId);
-		inputRecord.setReqType(ZhongyiyunInputRecord.ReqType.SIGN_NOTIFY.getType());
-		inputRecord.setReqBody(body);
-		inputRecord.setDecryptBody(body);
-		zhongyiyunInputRecordService.save(inputRecord);
+		JSONObject newBodyJson = null;
+		try {
+			String merId = bodyJson.getStr("merId");
+			String bankCard = bodyJson.getStr("bankCard");
+			String idCard = bodyJson.getStr("idCard");
+			String mobile = bodyJson.getStr("mobile");
+			String name = bodyJson.getStr("name");
+			String remark3 = bodyJson.getStr("remark3");
+
+			// 查询deptSub获取desKey
+			SysDeptSub deptSub = sysDeptSubService.getOne(Wrappers.<SysDeptSub>lambdaQuery()
+					.likeRight(SysDeptSub::getAppId, merId)
+					.eq(SysDeptSub::getEnableFlag, "1")
+					.eq(SysDeptSub::getSubjectLocation, SubjectLocation.ZHONG_YI_YUN));
+			if (deptSub == null || StrUtil.isBlank(deptSub.getAppId())) {
+				log.warn("未配置众蚁云deptSub merId={}", merId);
+				return "fail";
+			}
+
+			String desKey = StrUtil.split(deptSub.getAppId(), "|").get(2);
+
+			newBodyJson = BeanUtil.copyProperties(bodyJson, JSONObject.class);
+			newBodyJson.set("bankCard", ZhongyiyunUtils.decrypt(bankCard, desKey));
+			newBodyJson.set("idCard", ZhongyiyunUtils.decrypt(idCard, desKey));
+			newBodyJson.set("mobile", ZhongyiyunUtils.decrypt(mobile, desKey));
+			newBodyJson.set("name", ZhongyiyunUtils.decrypt(name, desKey));
+			newBodyJson.set("remark3", ZhongyiyunUtils.decrypt(remark3, desKey));
+		} catch (Exception e) {
+			log.error("众蚁云签约回调参数异常", e);
+			return "fail";
+		} finally {
+			// 请求记录到数据库
+			ZhongyiyunInputRecord inputRecord = new ZhongyiyunInputRecord();
+			inputRecord.setReqId(reqId);
+			inputRecord.setReqType(ZhongyiyunInputRecord.ReqType.SIGN_NOTIFY.getType());
+			inputRecord.setReqBody(body);
+			inputRecord.setDecryptBody(JSONUtil.toJsonStr(newBodyJson));
+			zhongyiyunInputRecordService.save(inputRecord);
+		}
 
 		// 业务处理
-		gigThirdApiService.zhongYiYunSignNotify(bodyJson);
+		gigThirdApiService.zhongYiYunSignNotify(newBodyJson);
 
 		return "success";
 	}