fix: 合同回调相关接口来源系统标识

This commit is contained in:
刘泉佳
2026-10-20 18:21:15 +08:00
parent c2b1e27077
commit e81eba93d0
3 changed files with 15 additions and 20 deletions
@@ -33,12 +33,11 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tenant.annotation.TenantIgnore;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.hcs.dto.HcsAttachmentRefDTO;
import org.springblade.hcs.dto.HcsContractLegalResultDTO;
import org.springblade.hcs.dto.HcsCurrencyVO;
import org.springblade.hcs.dto.HcsLegalResultDTO;
@@ -51,18 +50,18 @@ import org.springblade.transport.support.hcs.HcsContractSpecSyncSupport;
import org.springblade.transport.support.hcs.HcsContractSyncSupport;
import org.springblade.transport.support.hcs.HcsCreditCheckSupport;
import org.springblade.transport.support.hcs.HcsInvoiceRegSyncSupport;
import org.springblade.transport.support.hcs.HcsPaymentSyncSupport;
import org.springblade.transport.support.hcs.HcsReceiptBillSyncSupport;
import org.springblade.transport.support.hcs.HcsMasterDataSupport;
import org.springblade.transport.support.hcs.HcsPaymentSyncSupport;
import org.springblade.transport.support.hcs.HcsProjectSyncSupport;
import org.springblade.transport.support.hcs.HcsReceiptBillSyncSupport;
import org.springblade.transport.task.HcsPushTask;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@@ -72,7 +71,6 @@ import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* HCS 合规推送端点(设计文档 §5.0 手动入口)
@@ -86,6 +84,7 @@ import java.util.Map;
@Slf4j
@RestController
@AllArgsConstructor
@TenantIgnore
@RequestMapping("hcs")
@Tag(name = "HCS合规推送", description = "HCS合规推送端点")
public class HcsSyncController {
@@ -25,6 +25,7 @@
*/
package org.springblade.transport.support.hcs;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
@@ -100,10 +101,7 @@ public class HcsContractSyncSupport {
*/
private static final String BLACK_STATUS_YES = "yes";
/**
* 合同金蝶同步结果回传来源系统标识(D903 约定传 WCCK,非必填,传值时校验)
*/
private static final String KINGDEE_CALLBACK_SRC_SYSTEM = "WCCK";
private final IHcsClient hcsClient;
private final HcsProperties hcsProperties;
@@ -118,7 +116,7 @@ public class HcsContractSyncSupport {
/**
* 合同金蝶同步结果接收处理(合规 contractKingdee/result 推送,D903,投送人/钢厂/结算中心合同共用):
* 合规侧收到金蝶最终同步结果后通知 TMS 更新同步状态,本接口不处理法务审批结论(特批联动走 contractLegal/result + C103-4 兜底);
* contractType(deliverer/gc/sett_center)非必填仅随原文留痕;sourceSystem 非必填,传值时须为 WCCK;
* contractType(deliverer/gc/sett_center)非必填仅随原文留痕;sourceSystem 非必填,传值时须为 ;
* contractCode=TMS 合同编号定位(requestId 仅 X-ERP-Request-Id 回显不可定位);
* success=true 回填金蝶合同ID(kingdeeId),success=false 记录失败原因;均追加变更记录并原文留痕 blade_hcs_check_log
*
@@ -126,9 +124,9 @@ public class HcsContractSyncSupport {
* @return 处理结果描述
*/
public String handleKingdeeResult(HcsContractLegalResultDTO param) {
// sourceSystem 非必填(D903),传值时仅接受合规方约定的 WCCK,防伪造回传
// sourceSystem 非必填(D903),传值时仅接受合规方约定的 ,防伪造回传
String sourceSystem = param == null ? null : param.getSourceSystem();
if (StringUtil.isNotBlank(sourceSystem) && !KINGDEE_CALLBACK_SRC_SYSTEM.equalsIgnoreCase(sourceSystem)) {
if (!StrUtil.equalsIgnoreCase(param == null ? null : param.getSourceSystem(), hcsProperties.getSrcSystem())) {
log.warn("合同金蝶同步结果推送来源系统标识错误:sourceSystem={}", sourceSystem);
throw new ServiceException("来源系统标识错误");
}
@@ -25,6 +25,7 @@
*/
package org.springblade.transport.support.hcs;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
@@ -84,10 +85,7 @@ public class HcsProjectSyncSupport {
*/
private static final BigDecimal WAN_TO_YUAN = BigDecimal.valueOf(10000);
/**
* 项目金蝶同步结果回传来源系统标识(合规方接口文档约定固定传 WCCK)
*/
private static final String LEGAL_CALLBACK_SRC_SYSTEM = "WCCK";
private final IHcsClient hcsClient;
private final HcsProperties hcsProperties;
@@ -273,15 +271,15 @@ public class HcsProjectSyncSupport {
/**
* 项目金蝶同步结果接收处理(合规 projectLegal/result 推送,D902):
* sourceSystem 须为 WCCK(不符抛"来源系统标识错误"异常);projectCode=TMS 项目编号定位(requestId 仅 X-ERP-Request-Id 回显不可定位);
* sourceSystem 须为 (不符抛"来源系统标识错误"异常);projectCode=TMS 项目编号定位(requestId 仅 X-ERP-Request-Id 回显不可定位);
* success=true 回填金蝶项目ID/编号(kingdeeId/kingdeeNumber);success=false 记录失败原因;原文留痕 blade_hcs_check_log
*
* @param param 合规推送报文
* @return 处理结果描述
*/
public String handleLegalResult(HcsProjectLegalResultDTO param) {
// 来源系统校验:仅接受合规方约定的 WCCK,防伪造回传
if (!LEGAL_CALLBACK_SRC_SYSTEM.equalsIgnoreCase(param == null ? null : param.getSourceSystem())) {
// 来源系统校验:仅接受合规方约定的 ,防伪造回传
if (!StrUtil.equalsIgnoreCase(param == null ? null : param.getSourceSystem(), hcsProperties.getSrcSystem())) {
log.warn("项目金蝶同步结果推送来源系统标识错误:sourceSystem={}", param == null ? null : param.getSourceSystem());
throw new ServiceException("来源系统标识错误");
}