feat: HCS立项与合同数据层(实体合规字段组/合同风险留痕字段/校验留痕表/transport接入hcs-api依赖)

This commit is contained in:
刘泉佳
2026-09-27 22:41:04 +08:00
parent a739211d6f
commit cc9e01cff4
8 changed files with 350 additions and 0 deletions
@@ -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;
}
@@ -0,0 +1,79 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* 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;
}
@@ -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;
}
+4
View File
@@ -51,6 +51,10 @@
<groupId>org.springblade</groupId>
<artifactId>blade-bfi-api</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-hcs-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
@@ -0,0 +1,121 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.transport.constant;
/**
* HCS(合同合规系统)同步常量(TMS 业务侧)
* <p>
* 命名照 {@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() {
}
}
@@ -0,0 +1,40 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* 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<HcsContractCheckLog> {
}
@@ -0,0 +1,55 @@
-- 桂物合同合规系统(HCS)接入:合同扩展字段与校验留痕表(设计文档 §4,P1)。
-- blade_contract_manage 追加履约计划ID与风险留痕字段;新建 blade_hcs_check_log 校验留痕表。
-- 通过 information_schema 判断字段/表是否存在,可重复执行。
SET @db_name = DATABASE();
-- ==================== blade_contract_manage 扩展字段(C103 回填、履约计划ID、风险留痕) ====================
SET @sql = IF(
EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = @db_name AND table_name = 'blade_contract_manage' AND column_name = 'hcs_exeplan_id'),
'SELECT 1',
'ALTER TABLE blade_contract_manage ADD COLUMN hcs_exeplan_id varchar(64) DEFAULT NULL COMMENT ''合规履约计划ID(C103-9 返回 fdExeplanId)'''
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @sql = IF(
EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = @db_name AND table_name = 'blade_contract_manage' AND column_name = 'hcs_risk_level'),
'SELECT 1',
'ALTER TABLE blade_contract_manage ADD COLUMN hcs_risk_level varchar(8) DEFAULT NULL COMMENT ''合规客商风险等级(C101-1,甲方/乙方取高)'''
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @sql = IF(
EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = @db_name AND table_name = 'blade_contract_manage' AND column_name = 'hcs_black_status'),
'SELECT 1',
'ALTER TABLE blade_contract_manage ADD COLUMN hcs_black_status varchar(8) DEFAULT NULL COMMENT ''合规客商黑名单状态(C101-1,甲方/乙方取是)'''
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @sql = IF(
EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = @db_name AND table_name = 'blade_contract_manage' AND column_name = 'hcs_risk_time'),
'SELECT 1',
'ALTER TABLE blade_contract_manage ADD COLUMN hcs_risk_time datetime DEFAULT NULL COMMENT ''合规风险校验时间'''
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
-- ==================== blade_hcs_check_log 校验留痕表(照 ops 日志惯例) ====================
SET @sql = IF(
EXISTS (SELECT 1 FROM information_schema.tables WHERE table_schema = @db_name AND table_name = 'blade_hcs_check_log'),
'SELECT 1',
'CREATE TABLE blade_hcs_check_log (
id bigint NOT NULL COMMENT ''主键'',
tenant_id varchar(12) DEFAULT ''000000'' COMMENT ''租户ID'',
biz_type varchar(32) DEFAULT NULL COMMENT ''业务类型 project/contract/payment'',
biz_id bigint DEFAULT NULL COMMENT ''业务单据ID'',
check_type varchar(16) DEFAULT NULL COMMENT ''校验类型 risk=客商风险/credit=额度'',
result varchar(16) DEFAULT NULL COMMENT ''校验结果 pass=通过/fail=不通过/skip=跳过'',
msg varchar(512) DEFAULT NULL COMMENT ''校验说明'',
trace_id varchar(64) DEFAULT NULL COMMENT ''合规系统链路追踪ID'',
create_time datetime DEFAULT NULL COMMENT ''创建时间'',
PRIMARY KEY (id),
KEY idx_hcs_check_log_biz (biz_type, biz_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT=''HCS 风险/额度校验留痕'''
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
+5
View File
@@ -159,6 +159,11 @@
<artifactId>blade-bfi-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-hcs-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-wechat-api</artifactId>