:feat: HCS合同推送签署方区分甲方inner乙方supplier并新增关联项目传合规项目ID
This commit is contained in:
+5
@@ -167,6 +167,11 @@ public final class HcsContractFieldConstant {
|
||||
*/
|
||||
public static final String FIELD_FD_DESC = "fdDesc";
|
||||
|
||||
/**
|
||||
* 关联项目(选填,对象传值如 {"fdId": "项目id"},传合规项目ID)
|
||||
*/
|
||||
public static final String FIELD_FD_PROJECT = "fdProject";
|
||||
|
||||
/**
|
||||
* 合同结算模式:open=开口合同,close=闭口合同
|
||||
*/
|
||||
|
||||
+39
-19
@@ -32,6 +32,7 @@ import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.tool.jackson.JsonUtil;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
import org.springblade.hcs.config.HcsProperties;
|
||||
import org.springblade.hcs.constant.HcsConstant;
|
||||
import org.springblade.hcs.dto.HcsAttachmentRefDTO;
|
||||
import org.springblade.hcs.dto.HcsContractDraftDTO;
|
||||
import org.springblade.hcs.dto.HcsContractDraftVO;
|
||||
@@ -52,9 +53,11 @@ import org.springblade.transport.constant.HcsSyncConstant;
|
||||
import org.springblade.transport.mapper.ContractManageMapper;
|
||||
import org.springblade.transport.mapper.CustomerArchiveMapper;
|
||||
import org.springblade.transport.mapper.HcsContractCheckLogMapper;
|
||||
import org.springblade.transport.mapper.ProjectApplyMapper;
|
||||
import org.springblade.transport.pojo.entity.ContractManage;
|
||||
import org.springblade.transport.pojo.entity.CustomerArchive;
|
||||
import org.springblade.transport.pojo.entity.HcsContractCheckLog;
|
||||
import org.springblade.transport.pojo.entity.ProjectApply;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -94,15 +97,11 @@ public class HcsContractSyncSupport {
|
||||
*/
|
||||
private static final String BLACK_STATUS_YES = "yes";
|
||||
|
||||
/**
|
||||
* signer 相对方单位类型:暂统一传 customer(客户,2026-10-14 联调确认,§9-U6 后续细化)
|
||||
*/
|
||||
private static final String SIGNER_FD_TYPE_CUSTOMER = "customer";
|
||||
|
||||
private final IHcsClient hcsClient;
|
||||
private final HcsProperties hcsProperties;
|
||||
private final ContractManageMapper contractManageMapper;
|
||||
private final CustomerArchiveMapper customerArchiveMapper;
|
||||
private final ProjectApplyMapper projectApplyMapper;
|
||||
private final HcsContractCheckLogMapper hcsContractCheckLogMapper;
|
||||
private final HcsAttachmentSupport hcsAttachmentSupport;
|
||||
private final HcsExeStageSyncSupport hcsExeStageSyncSupport;
|
||||
@@ -410,28 +409,34 @@ public class HcsContractSyncSupport {
|
||||
fields.add(field(HcsContractFieldConstant.FIELD_FD_SERVINGS, "合同份数", contractManage.getCopyCount() == null ? null : String.valueOf(contractManage.getCopyCount())));
|
||||
// 合同说明:remark(选填)
|
||||
fields.add(field(HcsContractFieldConstant.FIELD_FD_DESC, "合同说明", contractManage.getRemark()));
|
||||
// 关联项目(选填,对象传值):合同所选项目对应合同系统项目ID(blade_project_apply.hcs_fd_id,C102-1 立项同步回填),
|
||||
// 未选择项目或项目未立项同步时不传
|
||||
Map<String, String> fdProject = queryProjectFdId(contractManage.getProjectId());
|
||||
if (fdProject != null) {
|
||||
fields.add(field(HcsContractFieldConstant.FIELD_FD_PROJECT, "关联项目", fdProject));
|
||||
}
|
||||
// TODO 待联调(v4 选填字段,暂不传):fdCoTakers 协办人(TMS 无对应)、fdUnderTaker/fdUnderTakerDept 承办人及部门(组织架构对象传值方式待确认)、
|
||||
// fdRelations 关联合同(数组)、fdProject 关联项目 {"fdId": 合规项目ID}(对象传值方式待确认,TMS projectId 可经立项 hcs_fd_id 关联)、
|
||||
// fdRelations 关联合同(数组)、
|
||||
// fdContractAttribute 合同属性(枚举值文档未给出,TMS 无对应)、fdUrgencyLevel 紧急程度(TMS 无对应)
|
||||
return fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* signer 相对方(签署方):甲/乙双方,fdType 暂统一传 customer(客户,2026-10-14 联调确认)
|
||||
* signer 相对方(签署方):甲/乙双方,甲方 fdType=inner(内部主体),乙方 fdType=supplier(外部相对方)
|
||||
*/
|
||||
private List<HcsSignerDTO> buildSigners(ContractManage contractManage) {
|
||||
List<HcsSignerDTO> signers = new ArrayList<>();
|
||||
// 甲方相对方:fdStanding=甲,编号按名称反查(反查不到留空,§9-U6)
|
||||
signers.add(signer("甲", contractManage.getPartyA()));
|
||||
// 乙方相对方:fdStanding=乙
|
||||
signers.add(signer("乙", contractManage.getPartyB()));
|
||||
// 甲方相对方:fdStanding=甲,内部主体 fdType=inner(编号按名称反查,反查不到留空,§9-U6)
|
||||
signers.add(signer("甲", HcsConstant.SIGNER_FD_TYPE_INNER, contractManage.getPartyA()));
|
||||
// 乙方相对方:fdStanding=乙,外部相对方 fdType=supplier
|
||||
signers.add(signer("乙", HcsConstant.SIGNER_FD_TYPE_SUPPLIER, contractManage.getPartyB()));
|
||||
return signers;
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个相对方
|
||||
* 单个相对方:甲方传 fdType=inner(内部主体),乙方传 fdType=supplier(外部相对方)
|
||||
*/
|
||||
private HcsSignerDTO signer(String fdStanding, String partyName) {
|
||||
private HcsSignerDTO signer(String fdStanding, String fdType, String partyName) {
|
||||
HcsSignerDTO signer = new HcsSignerDTO();
|
||||
// 签署地位:甲 / 乙
|
||||
signer.setFdStanding(fdStanding);
|
||||
@@ -439,8 +444,8 @@ public class HcsContractSyncSupport {
|
||||
signer.setFdName(partyName);
|
||||
// 相对方编号:按名称反查 CustomerArchive 客商编码,反查不到留空(§9-U6)
|
||||
signer.setFdNumber(queryCustomerCode(partyName));
|
||||
// 单位类型:暂统一传 customer(客户),inner/外部判定规则后续联调细化(§9-U6)
|
||||
signer.setFdType(SIGNER_FD_TYPE_CUSTOMER);
|
||||
// 单位类型:甲方 inner 内部主体 / 乙方 supplier 外部相对方
|
||||
signer.setFdType(fdType);
|
||||
return signer;
|
||||
}
|
||||
|
||||
@@ -552,20 +557,35 @@ public class HcsContractSyncSupport {
|
||||
return customerArchive == null ? null : customerArchive.getCustomerCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联项目取值:合同所选项目对应合同系统项目ID(blade_project_apply.hcs_fd_id,C102-1 立项同步回填),
|
||||
* 未选择项目、立项单不存在或未同步合规时返回 null 不传(fdProject 选填)
|
||||
*/
|
||||
private Map<String, String> queryProjectFdId(Long projectId) {
|
||||
if (projectId == null) {
|
||||
return null;
|
||||
}
|
||||
ProjectApply projectApply = projectApplyMapper.selectById(projectId);
|
||||
if (projectApply == null || StringUtil.isBlank(projectApply.getHcsFdId())) {
|
||||
log.warn("HCS合同关联项目缺失合规项目ID:projectId=[{}] 未立项或未同步合规,fdProject 不传", projectId);
|
||||
return null;
|
||||
}
|
||||
return Map.of("fdId", projectApply.getHcsFdId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 币种名称映射:currency-name-mapping 命中取映射值,未命中传原值并告警(§9-U3)
|
||||
*/
|
||||
private String mapCurrencyName(String currency) {
|
||||
if (StringUtil.isBlank(currency)) {
|
||||
private String mapCurrencyName(String currency) { if (StringUtil.isBlank(currency)) {
|
||||
return null;
|
||||
}
|
||||
return hcsProperties.getContract().getCurrencyNameMapping().getOrDefault(currency, currency);
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通模板字段(字符串传值)
|
||||
* 普通模板字段(字符串/对象传值)
|
||||
*/
|
||||
private HcsXformFieldDTO field(String name, String label, String value) {
|
||||
private HcsXformFieldDTO field(String name, String label, Object value) {
|
||||
HcsXformFieldDTO field = new HcsXformFieldDTO();
|
||||
field.setName(name);
|
||||
field.setLabel(label);
|
||||
|
||||
+10
@@ -46,4 +46,14 @@ public class HcsConstant {
|
||||
* 网关 Key-Auth 认证请求头名称(v4 接口说明:所有接口固定携带)
|
||||
*/
|
||||
public static final String HEADER_KEY_AUTH = "Key-Auth";
|
||||
|
||||
/**
|
||||
* signer 相对方单位类型:甲方=inner(内部主体)
|
||||
*/
|
||||
public static final String SIGNER_FD_TYPE_INNER = "inner";
|
||||
|
||||
/**
|
||||
* signer 相对方单位类型:乙方=supplier(外部相对方)
|
||||
*/
|
||||
public static final String SIGNER_FD_TYPE_SUPPLIER = "supplier";
|
||||
}
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ public class HcsSignerDTO implements Serializable {
|
||||
*/
|
||||
private String fdNumber;
|
||||
/**
|
||||
* 单位类型:TMS 暂统一传 customer(客户),inner/外部判定规则联调细化(§9-U6)
|
||||
* 单位类型:甲方=inner(内部主体),乙方=supplier(外部相对方)
|
||||
*/
|
||||
private String fdType;
|
||||
/**
|
||||
|
||||
+2
-2
@@ -54,9 +54,9 @@ public class HcsXformFieldDTO implements Serializable {
|
||||
*/
|
||||
private String label;
|
||||
/**
|
||||
* 字段值(字符串传值)
|
||||
* 字段值(金额/日期等字符串传值;对象类字段如 fdProject 以 JSON 对象传值)
|
||||
*/
|
||||
private String value;
|
||||
private Object value;
|
||||
/**
|
||||
* 字段类型标记:时间字段传 timestamp
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user