From cc9e01cff498367b62a78b3189e15239f549094f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B3=89=E4=BD=B3?= <1107186916@qq.com> Date: Sun, 27 Sep 2026 22:41:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20HCS=E7=AB=8B=E9=A1=B9=E4=B8=8E=E5=90=88?= =?UTF-8?q?=E5=90=8C=E6=95=B0=E6=8D=AE=E5=B1=82=EF=BC=88=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E5=90=88=E8=A7=84=E5=AD=97=E6=AE=B5=E7=BB=84/=E5=90=88?= =?UTF-8?q?=E5=90=8C=E9=A3=8E=E9=99=A9=E7=95=99=E7=97=95=E5=AD=97=E6=AE=B5?= =?UTF-8?q?/=E6=A0=A1=E9=AA=8C=E7=95=99=E7=97=95=E8=A1=A8/transport?= =?UTF-8?q?=E6=8E=A5=E5=85=A5hcs-api=E4=BE=9D=E8=B5=96=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../transport/pojo/entity/ContractManage.java | 29 +++++ .../pojo/entity/HcsContractCheckLog.java | 79 ++++++++++++ .../transport/pojo/entity/ProjectApply.java | 17 +++ blade-service/blade-transport/pom.xml | 4 + .../transport/constant/HcsSyncConstant.java | 121 ++++++++++++++++++ .../mapper/HcsContractCheckLogMapper.java | 40 ++++++ .../blade_hcs_contract_fields_20260927.sql | 55 ++++++++ pom.xml | 5 + 8 files changed, 350 insertions(+) create mode 100644 blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/HcsContractCheckLog.java create mode 100644 blade-service/blade-transport/src/main/java/org/springblade/transport/constant/HcsSyncConstant.java create mode 100644 blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/HcsContractCheckLogMapper.java create mode 100644 doc/sql/transport/blade_hcs_contract_fields_20260927.sql diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/ContractManage.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/ContractManage.java index d56fec74..7398b13f 100644 --- a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/ContractManage.java +++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/ContractManage.java @@ -209,4 +209,33 @@ public class ContractManage extends TenantEntity { @Schema(description = "备注") private String remark; + @Schema(description = "合规系统单据ID(fdContractId)") + private String hcsFdId; + + @Schema(description = "合规同步状态 unsynced/synced/failed") + private String hcsSyncStatus; + + @Schema(description = "合规推送失败重试次数") + @TableField(insertStrategy = FieldStrategy.ALWAYS, updateStrategy = FieldStrategy.ALWAYS) + private Integer hcsRetryCount; + + @Schema(description = "合规最近同步时间") + private LocalDateTime hcsSyncTime; + + @Schema(description = "合规最近同步结果信息/失败原因") + @TableField(insertStrategy = FieldStrategy.ALWAYS, updateStrategy = FieldStrategy.ALWAYS) + private String hcsSyncMsg; + + @Schema(description = "合规履约计划ID(C103-9 返回 fdExeplanId)") + private String hcsExeplanId; + + @Schema(description = "合规客商风险等级(C101-1,甲方/乙方取高)") + private String hcsRiskLevel; + + @Schema(description = "合规客商黑名单状态(C101-1,甲方/乙方取是)") + private String hcsBlackStatus; + + @Schema(description = "合规风险校验时间") + private LocalDateTime hcsRiskTime; + } diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/HcsContractCheckLog.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/HcsContractCheckLog.java new file mode 100644 index 00000000..f7815ad9 --- /dev/null +++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/HcsContractCheckLog.java @@ -0,0 +1,79 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *
+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *
+ * 1. This software is for development use only under a valid license + * from BladeX. + *
+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *
+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *
+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * HCS 风险/额度校验留痕实体类(照 ops 日志惯例,仅插入不改)
+ *
+ * @author Chill
+ */
+@Data
+@TableName("blade_hcs_check_log")
+@Schema(description = "HCS 风险/额度校验留痕")
+public class HcsContractCheckLog implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.ASSIGN_ID)
+ @Schema(description = "主键")
+ private Long id;
+
+ @Schema(description = "租户ID")
+ private String tenantId;
+
+ @Schema(description = "业务类型 project/contract/payment")
+ private String bizType;
+
+ @Schema(description = "业务单据ID")
+ private Long bizId;
+
+ @Schema(description = "校验类型 risk=客商风险/credit=额度")
+ private String checkType;
+
+ @Schema(description = "校验结果 pass=通过/fail=不通过/skip=跳过")
+ private String result;
+
+ @Schema(description = "校验说明")
+ private String msg;
+
+ @Schema(description = "合规系统链路追踪ID")
+ private String traceId;
+
+ @Schema(description = "创建时间")
+ private LocalDateTime createTime;
+
+}
diff --git a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/ProjectApply.java b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/ProjectApply.java
index 5526da8e..410884ef 100644
--- a/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/ProjectApply.java
+++ b/blade-service-api/blade-transport-api/src/main/java/org/springblade/transport/pojo/entity/ProjectApply.java
@@ -198,4 +198,21 @@ public class ProjectApply extends TenantEntity {
@Schema(description = "作废原因")
private String voidReason;
+ @Schema(description = "合规系统单据ID(fdId)")
+ private String hcsFdId;
+
+ @Schema(description = "合规同步状态 unsynced/synced/failed")
+ private String hcsSyncStatus;
+
+ @Schema(description = "合规推送失败重试次数")
+ @TableField(insertStrategy = FieldStrategy.ALWAYS, updateStrategy = FieldStrategy.ALWAYS)
+ private Integer hcsRetryCount;
+
+ @Schema(description = "合规最近同步时间")
+ private LocalDateTime hcsSyncTime;
+
+ @Schema(description = "合规最近同步结果信息/失败原因")
+ @TableField(insertStrategy = FieldStrategy.ALWAYS, updateStrategy = FieldStrategy.ALWAYS)
+ private String hcsSyncMsg;
+
}
diff --git a/blade-service/blade-transport/pom.xml b/blade-service/blade-transport/pom.xml
index b9ed58c8..2443ce7a 100644
--- a/blade-service/blade-transport/pom.xml
+++ b/blade-service/blade-transport/pom.xml
@@ -51,6 +51,10 @@
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.constant;
+
+/**
+ * HCS(合同合规系统)同步常量(TMS 业务侧)
+ *
+ * 命名照 {@link KingdeeBfiConstant} 惯例;与客户端模块 org.springblade.hcs.constant.HcsConstant 区分。
+ *
+ * @author Chill
+ */
+public final class HcsSyncConstant {
+
+ /**
+ * 同步状态:待同步
+ */
+ public static final String HCS_STATUS_UNSYNCED = "unsynced";
+
+ /**
+ * 同步状态:已同步
+ */
+ public static final String HCS_STATUS_SYNCED = "synced";
+
+ /**
+ * 同步状态:同步失败
+ */
+ public static final String HCS_STATUS_FAILED = "failed";
+
+ /**
+ * 推送业务类型:项目立项(C102)
+ */
+ public static final String BIZ_TYPE_PROJECT = "project";
+
+ /**
+ * 推送业务类型:合同(C103)
+ */
+ public static final String BIZ_TYPE_CONTRACT = "contract";
+
+ /**
+ * 校验类型:客商风险(C101-1)
+ */
+ public static final String CHECK_TYPE_RISK = "risk";
+
+ /**
+ * 校验类型:额度(C106-1,P3 付款链使用)
+ */
+ public static final String CHECK_TYPE_CREDIT = "credit";
+
+ /**
+ * 校验结果:通过
+ */
+ public static final String CHECK_RESULT_PASS = "pass";
+
+ /**
+ * 校验结果:不通过(黑名单)
+ */
+ public static final String CHECK_RESULT_FAIL = "fail";
+
+ /**
+ * 校验结果:跳过(客商编号反查不到等)
+ */
+ public static final String CHECK_RESULT_SKIP = "skip";
+
+ // ==================== Redis 缓存 key(照 BFI blade:third: 前缀惯例) ====================
+
+ /**
+ * 主数据缓存:合同模板列表
+ */
+ public static final String MASTER_CACHE_TEMPLATES = "blade:third:hcs:master:templates";
+
+ /**
+ * 主数据缓存:合同分类列表
+ */
+ public static final String MASTER_CACHE_CATEGORIES = "blade:third:hcs:master:categories";
+
+ /**
+ * 主数据缓存:币种列表
+ */
+ public static final String MASTER_CACHE_CURRENCIES = "blade:third:hcs:master:currencies";
+
+ /**
+ * 附件映射缓存 key 前缀(hcs:att:{attachmentKey},TMS 附件元数据键 → 合规附件ID)
+ */
+ public static final String ATTACHMENT_CACHE_KEY_PREFIX = "blade:third:hcs:att:";
+
+ /**
+ * 附件映射缓存 TTL(天),重复上传仅浪费存储无业务风险,故不做持久化映射表(设计文档 §6)
+ */
+ public static final long ATTACHMENT_CACHE_TTL_DAYS = 7L;
+
+ /**
+ * 推送任务分布式锁 key(多实例部署防重扫)
+ */
+ public static final String PUSH_TASK_LOCK_KEY = "blade:third:hcs:push:task:lock";
+
+ private HcsSyncConstant() {
+ }
+}
diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/HcsContractCheckLogMapper.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/HcsContractCheckLogMapper.java
new file mode 100644
index 00000000..74bca5c8
--- /dev/null
+++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/mapper/HcsContractCheckLogMapper.java
@@ -0,0 +1,40 @@
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ *
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ *
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ *
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ *
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ *
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ *
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
+package org.springblade.transport.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springblade.transport.pojo.entity.HcsContractCheckLog;
+
+/**
+ * HCS 风险/额度校验留痕 Mapper
+ *
+ * @author Chill
+ */
+@Mapper
+public interface HcsContractCheckLogMapper extends BaseMapper