:feat: 特批结果回传校验来源系统标识,不符抛出来源系统标识错误异常

This commit is contained in:
刘泉佳
2026-10-12 11:48:13 +08:00
parent e44270e6f0
commit b8d93bc921
4 changed files with 19 additions and 3 deletions
@@ -25,11 +25,13 @@
*/
package org.springblade.transport.support.hcs;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.hcs.config.HcsProperties;
import org.springblade.hcs.dto.HcsAttachmentRefDTO;
import org.springblade.hcs.dto.HcsLegalResultDTO;
import org.springblade.hcs.dto.HcsMechanismsDTO;
@@ -77,6 +79,7 @@ public class HcsContractSpecSyncSupport {
private static final int CALLBACK_MSG_MAX_LENGTH = 500;
private final IHcsClient hcsClient;
private final HcsProperties hcsProperties;
private final ContractManageMapper contractManageMapper;
private final HcsContractCheckLogMapper hcsContractCheckLogMapper;
@@ -157,6 +160,7 @@ public class HcsContractSpecSyncSupport {
/**
* 合同特批结果接收处理(合规 contractLegal/result 推送,替代未建设的 B103,D15 回传机制):
* sourceSystem 须与 third-party.hcs.src-system 配置一致(不符抛出"来源系统标识错误"异常),
* requestId=TMS 合同ID、status=APPROVED/REJECTED,
* approved 恢复合同"审批通过"展示;rejected 联动合同审批驳回;原文全量留痕
*
@@ -164,6 +168,11 @@ public class HcsContractSpecSyncSupport {
* @return 处理结果描述
*/
public String handleLegalResult(HcsLegalResultDTO param) {
// 来源系统校验:仅接受 third-party.hcs.src-system 配置的来源,防伪造回传
if (!StrUtil.equalsIgnoreCase(param == null ? null : param.getSourceSystem(), hcsProperties.getSrcSystem())) {
log.warn("合同特批结果推送来源系统标识错误:sourceSystem={}", param == null ? null : param.getSourceSystem());
throw new ServiceException("来源系统标识错误");
}
String raw = param == null ? "" : JSONUtil.toJsonStr(param);
String requestId = param == null ? null : param.getRequestId();
ContractManage contractManage = locateContract(requestId);
@@ -25,6 +25,7 @@
*/
package org.springblade.transport.support.hcs;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
@@ -139,6 +140,7 @@ public class HcsPaymentSyncSupport {
/**
* 付款特批结果接收处理(合规 paymentLegal/result 推送,替代未建设的 B103,D15 回传机制):
* sourceSystem 须与 third-party.hcs.src-system 配置一致(不符抛出"来源系统标识错误"异常),
* requestId=TMS 付款申请ID、status=APPROVED/REJECTED;
* 付款特批结果不联动付款审批状态(§4.4),仅回写 hcs_spec_status
*
@@ -146,6 +148,11 @@ public class HcsPaymentSyncSupport {
* @return 处理结果描述
*/
public String handleLegalResult(HcsLegalResultDTO param) {
// 来源系统校验:仅接受 third-party.hcs.src-system 配置的来源,防伪造回传
if (!StrUtil.equalsIgnoreCase(param == null ? null : param.getSourceSystem(), hcsProperties.getSrcSystem())) {
log.warn("付款特批结果推送来源系统标识错误:sourceSystem={}", param == null ? null : param.getSourceSystem());
throw new ServiceException("来源系统标识错误");
}
String requestId = param == null ? null : param.getRequestId();
PaymentApplication payment = locatePayment(requestId);
if (payment == null) {