Browse Source

fix: 福建企赋回调按最新文档调整

lixuesong 1 year ago
parent
commit
f987d77e75

+ 11 - 16
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/GigThirdApiController.java

@@ -140,6 +140,7 @@ public class GigThirdApiController {
 
 		// 请求序号
 		String reqId = bodyJson.getStr("reqId");
+		String data = bodyJson.getStr("data");
 
 		String redisKey = String.format("%s_%s", CacheConstants.QI_FU_SIGN_NOTIFY_KEY, reqId);
 		Boolean absent = redisTemplate.opsForValue().setIfAbsent(redisKey, reqId, 30, TimeUnit.MINUTES);
@@ -148,33 +149,27 @@ public class GigThirdApiController {
 			return "fail";
 		}
 
+		String decryptDataStr = null;
 		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");
+			Boolean encryptedState = bodyJson.getBool("encryptedState");
 
 			// 查询deptSub获取desKey
 			SysDeptSub deptSub = sysDeptSubService.getOne(Wrappers.<SysDeptSub>lambdaQuery()
-					.likeRight(SysDeptSub::getAppId, merId)
 					.eq(SysDeptSub::getEnableFlag, "1")
-					.eq(SysDeptSub::getSubjectLocation, SubjectLocation.QI_FU));
+					.eq(SysDeptSub::getSubjectLocation, SubjectLocation.QI_FU)
+					.last("limit 1"));
 			if (deptSub == null || StrUtil.isBlank(deptSub.getAppId())) {
-				log.warn("未配置福建企赋deptSub merId={}", merId);
+				log.warn("未配置福建企赋deptSub reqId={}", reqId);
 				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));
+			// 验签 略
+			// 解密data
+			decryptDataStr = ZhongyiyunUtils.decrypt(data, desKey);
+			newBodyJson = JSONUtil.parseObj(decryptDataStr);
 		} catch (Exception e) {
 			log.error("福建企赋签约回调参数异常", e);
 			return "fail";
@@ -184,7 +179,7 @@ public class GigThirdApiController {
 			inputRecord.setReqId(reqId);
 			inputRecord.setReqType(QifuInputRecord.ReqType.SIGN_NOTIFY.getType());
 			inputRecord.setReqBody(body);
-			inputRecord.setDecryptBody(JSONUtil.toJsonStr(newBodyJson));
+			inputRecord.setDecryptBody(decryptDataStr);
 			qifuInputRecordMapper.insert(inputRecord);
 		}