补充历史导入文件记录字段
This commit is contained in:
@@ -44,6 +44,15 @@ public class CcdiFileUploadRecord implements Serializable {
|
|||||||
/** 文件状态:uploading-上传中,parsing-解析中,parsed_success-解析成功,parsed_failed-解析失败 */
|
/** 文件状态:uploading-上传中,parsing-解析中,parsed_success-解析成功,parsed_failed-解析失败 */
|
||||||
private String fileStatus;
|
private String fileStatus;
|
||||||
|
|
||||||
|
/** 来源类型 */
|
||||||
|
private String sourceType;
|
||||||
|
|
||||||
|
/** 来源项目ID */
|
||||||
|
private Long sourceProjectId;
|
||||||
|
|
||||||
|
/** 来源项目名称 */
|
||||||
|
private String sourceProjectName;
|
||||||
|
|
||||||
/** 主体名称(多个用逗号分隔) */
|
/** 主体名称(多个用逗号分隔) */
|
||||||
private String enterpriseNames;
|
private String enterpriseNames;
|
||||||
|
|
||||||
|
|||||||
@@ -328,10 +328,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
bs.cret_no AS cretNo,
|
bs.cret_no AS cretNo,
|
||||||
bs.CREATE_DATE AS createDate,
|
bs.CREATE_DATE AS createDate,
|
||||||
fur.file_name AS originalFileName,
|
fur.file_name AS originalFileName,
|
||||||
fur.upload_time AS uploadTime
|
fur.upload_time AS uploadTime,
|
||||||
|
fur.source_project_name AS sourceProjectName
|
||||||
FROM ccdi_bank_statement bs
|
FROM ccdi_bank_statement bs
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT latest_record.project_id, latest_record.log_id, latest_record.file_name, latest_record.upload_time
|
SELECT latest_record.project_id, latest_record.log_id, latest_record.file_name, latest_record.upload_time,
|
||||||
|
latest_record.source_project_name
|
||||||
FROM ccdi_file_upload_record latest_record
|
FROM ccdi_file_upload_record latest_record
|
||||||
INNER JOIN (
|
INNER JOIN (
|
||||||
SELECT project_id, log_id, MAX(id) AS max_id
|
SELECT project_id, log_id, MAX(id) AS max_id
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="fileName" column="file_name" />
|
<result property="fileName" column="file_name" />
|
||||||
<result property="fileSize" column="file_size" />
|
<result property="fileSize" column="file_size" />
|
||||||
<result property="fileStatus" column="file_status" />
|
<result property="fileStatus" column="file_status" />
|
||||||
|
<result property="sourceType" column="source_type" />
|
||||||
|
<result property="sourceProjectId" column="source_project_id" />
|
||||||
|
<result property="sourceProjectName" column="source_project_name" />
|
||||||
<result property="enterpriseNames" column="enterprise_names" />
|
<result property="enterpriseNames" column="enterprise_names" />
|
||||||
<result property="accountNos" column="account_nos" />
|
<result property="accountNos" column="account_nos" />
|
||||||
<result property="errorMessage" column="error_message" />
|
<result property="errorMessage" column="error_message" />
|
||||||
@@ -21,8 +24,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<sql id="selectCcdiFileUploadRecordVo">
|
<sql id="selectCcdiFileUploadRecordVo">
|
||||||
select id, project_id, lsfx_project_id, log_id, file_name, file_size,
|
select id, project_id, lsfx_project_id, log_id, file_name, file_size,
|
||||||
file_status, enterprise_names, account_nos, error_message,
|
file_status, source_type, source_project_id, source_project_name,
|
||||||
upload_time, upload_user
|
enterprise_names, account_nos, error_message, upload_time, upload_user
|
||||||
from ccdi_file_upload_record
|
from ccdi_file_upload_record
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
@@ -30,13 +33,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into ccdi_file_upload_record (
|
insert into ccdi_file_upload_record (
|
||||||
project_id, lsfx_project_id, file_name, file_size, file_status,
|
project_id, lsfx_project_id, file_name, file_size, file_status,
|
||||||
|
source_type, source_project_id, source_project_name,
|
||||||
enterprise_names, account_nos, upload_time, upload_user
|
enterprise_names, account_nos, upload_time, upload_user
|
||||||
) values
|
) values
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(
|
(
|
||||||
#{item.projectId}, #{item.lsfxProjectId}, #{item.fileName},
|
#{item.projectId}, #{item.lsfxProjectId}, #{item.fileName},
|
||||||
#{item.fileSize}, #{item.fileStatus}, #{item.enterpriseNames},
|
#{item.fileSize}, #{item.fileStatus}, #{item.sourceType},
|
||||||
#{item.accountNos}, #{item.uploadTime}, #{item.uploadUser}
|
#{item.sourceProjectId}, #{item.sourceProjectName},
|
||||||
|
#{item.enterpriseNames}, #{item.accountNos}, #{item.uploadTime}, #{item.uploadUser}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|||||||
@@ -132,6 +132,24 @@ class CcdiBankStatementMapperXmlTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void fileUploadRecordMapper_shouldContainHistoryImportSourceFields() throws Exception {
|
||||||
|
try (InputStream inputStream = getClass().getClassLoader()
|
||||||
|
.getResourceAsStream("mapper/ccdi/project/CcdiFileUploadRecordMapper.xml")) {
|
||||||
|
String xml = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
assertTrue(xml.contains("source_type"), xml);
|
||||||
|
assertTrue(xml.contains("source_project_id"), xml);
|
||||||
|
assertTrue(xml.contains("source_project_name"), xml);
|
||||||
|
}
|
||||||
|
|
||||||
|
try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(RESOURCE)) {
|
||||||
|
String xml = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
assertTrue(xml.contains("fur.source_project_name"), xml);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void insertBatch_shouldAvoidUpdatingAutoIncrementPrimaryKeyInDuplicateBranch() throws Exception {
|
void insertBatch_shouldAvoidUpdatingAutoIncrementPrimaryKeyInDuplicateBranch() throws Exception {
|
||||||
try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(RESOURCE)) {
|
try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(RESOURCE)) {
|
||||||
|
|||||||
@@ -17,3 +17,13 @@
|
|||||||
|
|
||||||
- 按仓库约束,本次未启用 subagent
|
- 按仓库约束,本次未启用 subagent
|
||||||
- 已人工检查计划与设计文档的一致性,确认未引入未被批准的新方案
|
- 已人工检查计划与设计文档的一致性,确认未引入未被批准的新方案
|
||||||
|
|
||||||
|
## 执行记录
|
||||||
|
|
||||||
|
### 2026-03-29 Task 1 后端数据结构预置
|
||||||
|
|
||||||
|
- 新增迁移脚本 `sql/migration/2026-03-29-add-file-upload-history-import-source-fields.sql`,为 `ccdi_file_upload_record` 增加 `source_type`、`source_project_id`、`source_project_name`
|
||||||
|
- 扩展 `CcdiFileUploadRecord` 实体与 `CcdiFileUploadRecordMapper.xml`,补齐来源字段映射、查询列和批量插入列
|
||||||
|
- 调整 `CcdiBankStatementMapper.xml` 详情查询,补充 `fur.source_project_name` 查询痕迹,为后续历史导入来源展示预留字段
|
||||||
|
- 新增 `CcdiBankStatementMapperXmlTest` 断言,先验证缺少来源字段时失败,再验证补齐后通过
|
||||||
|
- 验证命令:`mvn -pl ccdi-project -am -Dtest=CcdiBankStatementMapperXmlTest -Dsurefire.failIfNoSpecifiedTests=false test`
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
ALTER TABLE ccdi_file_upload_record
|
||||||
|
ADD COLUMN source_type varchar(32) DEFAULT 'UPLOAD' COMMENT '来源类型',
|
||||||
|
ADD COLUMN source_project_id bigint NULL COMMENT '来源项目ID',
|
||||||
|
ADD COLUMN source_project_name varchar(100) NULL COMMENT '来源项目名称';
|
||||||
Reference in New Issue
Block a user