清洗流水本方证件号格式
This commit is contained in:
@@ -207,6 +207,7 @@ public class CcdiBankStatement implements Serializable {
|
|||||||
entity.setBatchSequence(item.getUploadSequnceNumber());
|
entity.setBatchSequence(item.getUploadSequnceNumber());
|
||||||
entity.setCustomerCertNo(item.getCustomerCertNo());
|
entity.setCustomerCertNo(item.getCustomerCertNo());
|
||||||
entity.setCustomerSocialCreditCode(item.getCustomerSocialCreditCode());
|
entity.setCustomerSocialCreditCode(item.getCustomerSocialCreditCode());
|
||||||
|
entity.setCretNo(normalizeCertNo(item.getCretNo()));
|
||||||
|
|
||||||
// 5. 特殊字段处理
|
// 5. 特殊字段处理
|
||||||
entity.setMetaJson(null); // 根据文档要求强制设为 null
|
entity.setMetaJson(null); // 根据文档要求强制设为 null
|
||||||
@@ -219,4 +220,19 @@ public class CcdiBankStatement implements Serializable {
|
|||||||
throw new RuntimeException("流水数据转换失败", e);
|
throw new RuntimeException("流水数据转换失败", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String normalizeCertNo(String value) {
|
||||||
|
if (value == null || value.isBlank()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String normalized = value.trim()
|
||||||
|
.replace('-', '-')
|
||||||
|
.replace('—', '-')
|
||||||
|
.replace('–', '-');
|
||||||
|
int separatorIndex = normalized.indexOf('-');
|
||||||
|
if (separatorIndex >= 0) {
|
||||||
|
normalized = normalized.substring(0, separatorIndex).trim();
|
||||||
|
}
|
||||||
|
return normalized.isEmpty() ? null : normalized;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,4 +104,26 @@ class CcdiBankStatementTest {
|
|||||||
assertEquals("330101199001011234", entity.getCustomerCertNo());
|
assertEquals("330101199001011234", entity.getCustomerCertNo());
|
||||||
assertEquals("91330100123456789X", entity.getCustomerSocialCreditCode());
|
assertEquals("91330100123456789X", entity.getCustomerSocialCreditCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testFromResponse_ShouldNormalizeCretNoBeforeDash() {
|
||||||
|
BankStatementItem item = new BankStatementItem();
|
||||||
|
item.setCretNo(" 330100198801010033 - 测试人员 ");
|
||||||
|
|
||||||
|
CcdiBankStatement entity = CcdiBankStatement.fromResponse(item);
|
||||||
|
|
||||||
|
assertNotNull(entity);
|
||||||
|
assertEquals("330100198801010033", entity.getCretNo());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testFromResponse_ShouldNormalizeCretNoWithChineseDash() {
|
||||||
|
BankStatementItem item = new BankStatementItem();
|
||||||
|
item.setCretNo("330100198801010033-测试人员");
|
||||||
|
|
||||||
|
CcdiBankStatement entity = CcdiBankStatement.fromResponse(item);
|
||||||
|
|
||||||
|
assertNotNull(entity);
|
||||||
|
assertEquals("330100198801010033", entity.getCretNo());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# 2026-06-30 流水本方证件号清洗实施记录
|
||||||
|
|
||||||
|
## 背景
|
||||||
|
|
||||||
|
业务核对发现,业务侧上传文件名存在“身份证号-姓名”的不规范写法,流水平台返回的本方证件号也可能沿用该形式,且横线前可能存在空格。该值落库到 `ccdi_bank_statement.cret_no` 后,会导致结果总览按身份证号匹配员工、亲属或外部主体时无法命中。
|
||||||
|
|
||||||
|
## 修改内容
|
||||||
|
|
||||||
|
- 修改 `CcdiBankStatement.fromResponse`,在流水平台响应转换为本地流水实体时清洗 `cretNo`。
|
||||||
|
- 清洗规则:
|
||||||
|
- 先去除首尾空格。
|
||||||
|
- 将全角横线、长横线、短横线统一视为半角横线。
|
||||||
|
- 如存在横线,仅保留横线前的身份证号部分,并再次去除首尾空格。
|
||||||
|
- 新增单元测试覆盖半角横线和全角横线场景。
|
||||||
|
|
||||||
|
## 影响范围
|
||||||
|
|
||||||
|
- 仅影响后续新拉取或新上传后落库的流水。
|
||||||
|
- 不修改表结构、接口协议、打标规则和前端页面。
|
||||||
|
- 改动范围很小,只在流水接口响应转换为本地实体时做字段清洗。
|
||||||
|
- 已经落库的历史脏数据需要单独清洗 `ccdi_bank_statement.cret_no` 后重新打标,才能恢复结果总览命中。
|
||||||
|
|
||||||
|
## 验证
|
||||||
|
|
||||||
|
- 运行 `mvn -pl ccdi-project "-Dtest=CcdiBankStatementTest" test`。
|
||||||
Reference in New Issue
Block a user