文件夹整理

This commit is contained in:
wkc
2026-02-09 14:28:25 +08:00
parent 056d239041
commit 02249c402e
2429 changed files with 3159 additions and 239710 deletions

View File

@@ -0,0 +1,226 @@
# EasyExcel字典下拉框使用说明
## 功能概述
本项目实现了EasyExcel自定义WriteHandler拦截器可以在生成Excel模板时自动添加基于若依框架字典数据的下拉框。
## 核心组件
### 1. @DictDropdown 注解
位置:`com.ruoyi.common.annotation.DictDropdown`
用于标注需要添加下拉框的字段。
**属性说明:**
| 属性 | 类型 | 默认值 | 说明 |
|-----|------|--------|------|
| dictType | String | 必填 | 字典类型编码,对应若依字典管理中的字典类型 |
| displayType | DisplayType | LABEL | 下拉框显示内容类型LABEL显示标签VALUE显示值 |
| strict | boolean | true | 是否仅允许选择下拉框中的值 |
| hiddenSheetName | String | "dict_hidden" | 隐藏Sheet名称用于存储大量下拉选项 |
### 2. DictDropdownWriteHandler 处理器
位置:`com.ruoyi.dpc.handler.DictDropdownWriteHandler`
核心功能:
- 解析实体类中的@DictDropdown注解
- 从若依字典缓存获取字典数据
- 为对应列添加下拉框验证
- 自动处理下拉选项超过Excel字符限制的情况使用隐藏Sheet
### 3. EasyExcelUtil 工具类扩展
位置:`com.ruoyi.dpc.utils.EasyExcelUtil`
新增方法:
- `importTemplateWithDictDropdown()` - 下载带字典下拉框的导入模板
- `exportExcelWithDictDropdown()` - 导出带字典下拉框的Excel
## 使用示例
### 步骤1在实体类上添加注解
```java
package com.ruoyi.dpc.domain.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.ruoyi.common.annotation.DictDropdown;
import lombok.Data;
@Data
public class CcdiEmployeeExcel {
@ExcelProperty(value = "姓名", index = 0)
@ColumnWidth(15)
private String name;
@ExcelProperty(value = "柜员号", index = 1)
@ColumnWidth(15)
private String tellerNo;
// 添加字典下拉框注解
@ExcelProperty(value = "状态", index = 6)
@ColumnWidth(10)
@DictDropdown(dictType = "ccdi_employee_status")
private String status;
}
```
### 步骤2在Controller中使用
```java
@RestController
@RequestMapping("/ccdi/employee")
public class CcdiEmployeeController {
/**
* 下载带字典下拉框的导入模板
*/
@PostMapping("/importTemplateWithDropdown")
public void importTemplateWithDropdown(HttpServletResponse response) {
EasyExcelUtil.importTemplateWithDictDropdown(
response,
CcdiEmployeeExcel.class,
"员工信息"
);
}
/**
* 导出带字典下拉框的Excel
*/
@PostMapping("/exportWithDropdown")
public void exportWithDropdown(HttpServletResponse response) {
List<CcdiEmployeeExcel> list = employeeService.selectEmployeeList();
EasyExcelUtil.exportExcelWithDictDropdown(
response,
list,
CcdiEmployeeExcel.class,
"员工信息"
);
}
}
```
## 高级用法
### 1. 显示字典键值而非标签
```java
@DictDropdown(dictType = "ccdi_employee_status", displayType = DisplayType.VALUE)
private String status;
```
### 2. 允许手动输入(非严格模式)
```java
@DictDropdown(dictType = "ccdi_employee_status", strict = false)
private String status;
```
### 3. 自定义隐藏Sheet名称
```java
@DictDropdown(dictType = "ccdi_employee_status", hiddenSheetName = "employee_status_dict")
private String status;
```
## 注意事项
1. **必须指定@ExcelProperty的index属性**
- 字段必须指定@ExcelProperty注解的index值,否则无法正确映射列位置
2. **字典数据必须预先加载到缓存**
- 使用前需要确保字典数据已经加载到Redis缓存中
- 可通过若依系统的字典管理功能预热缓存
3. **下拉选项数量限制**
- 当下拉选项总长度超过255字符时自动使用隐藏Sheet存储
- 隐藏Sheet在Excel中不可见但下拉框功能正常
4. **字段必须标注@ExcelProperty注解**
- 只有同时标注了@ExcelProperty和@DictDropdown的字段才会添加下拉框
## 测试验证
### 接口测试
1. 启动项目后访问Swagger UI`http://localhost:8080/swagger-ui/index.html`
2. 找到员工信息管理相关接口:
- `POST /ccdi/employee/importTemplateWithDropdown` - 下载带字典下拉框的模板
3. 调用接口下载模板检查Excel中的下拉框是否正常
### 手动验证
1. 打开下载的Excel模板
2. 点击标注了下拉框的列(如"状态"列)
3. 检查是否出现下拉箭头和选项列表
4. 尝试选择和输入,验证验证规则是否生效
## 技术实现细节
### Excel下拉列表限制处理
Excel对下拉列表的直接字符数有限制约255字符本项目采用以下策略
1. **选项较少时(<255字符**
- 直接使用 `DataValidationHelper.createExplicitListConstraint()` 创建下拉列表
- 下拉选项内联在单元格验证中
2. **选项较多时≥255字符**
- 创建隐藏Sheet存储所有选项
- 使用 `DataValidationHelper.createFormulaListConstraint()` 通过公式引用
- 自动隐藏Sheet`workbook.setSheetHidden()`
### 字典数据获取
```
┌─────────────┐ 缓存查询 ┌─────────────┐
│ DictDropdown │ ───────────▶ │ DictUtils │
│ 注解 │ │ .getDictCache() │
└─────────────┘ └─────────────┘
┌─────────────┐
│ Redis缓存 │
│ sys_dict:key │
└─────────────┘
```
### 列索引映射
通过反射获取字段的@ExcelProperty注解中的index值,确保下拉框添加到正确的列。
## 常见问题
### Q1下拉框没有显示
**可能原因:**
1. 字典数据未加载到缓存
2. 字段未指定@ExcelProperty的index值
3. 字典类型编码错误
**解决方法:**
1. 在若依系统字典管理中,进入对应字典类型,刷新缓存
2. 检查实体类字段注解是否正确
3. 确认dictType值与字典管理中的字典类型一致
### Q2下拉选项显示不完整
**原因:** 选项字符数超过255字符但隐藏Sheet创建失败
**解决方法:** 检查日志中的错误信息确保有权限创建隐藏Sheet
### Q3可以手动输入非下拉选项的值吗
**答案:** 可以,通过设置 `strict = false` 允许手动输入
## 更新日志
| 版本 | 日期 | 说明 |
|------|------|------|
| 1.0.0 | 2026-01-29 | 初始版本,支持字典下拉框功能 |

View File

@@ -0,0 +1,273 @@
# 中介黑名单管理模块 - 测试与部署文档
## 文件说明
本目录包含中介黑名单管理模块(v2.0)的测试脚本、API文档、菜单配置和测试报告模板。
```
doc/
├── scripts/
│ ├── test-intermediary-api.sh # API自动化测试脚本
│ └── cleanup-intermediary-test-data.sh # 测试数据清理脚本
├── api/
│ └── 中介黑名单管理API文档-v2.0.md # 完整的API接口文档
├── test/
│ └── intermediary-blacklist-test-report.md # 测试报告模板
└── sql/
└── menu-intermediary.sql # 菜单配置SQL
```
---
## 快速开始
### 1. 执行菜单SQL
首先在数据库中执行菜单配置SQL,为系统添加中介黑名单管理菜单:
```bash
mysql -u root -p ruoyi < sql/menu-intermediary.sql
```
或者直接在MySQL客户端中执行:
```sql
source D:/ccdi/ccdi/sql/menu-intermediary.sql;
```
执行后,在角色管理中为相应角色分配权限。
### 2. 运行API测试脚本
确保后端服务已启动(http://localhost:8080),然后执行测试脚本:
```bash
cd D:/ccdi/ccdi/doc/scripts
bash test-intermediary-api.sh
```
测试脚本会自动:
- 获取Token
- 测试查询列表
- 测试新增个人中介
- 测试新增实体中介
- 测试查询详情
- 测试修改操作
- 测试唯一性校验
- 测试条件查询
### 3. 清理测试数据
测试完成后,运行清理脚本删除测试数据:
```bash
cd D:/ccdi/ccdi/doc/scripts
bash cleanup-intermediary-test-data.sh
```
### 4. 查看API文档
参考API文档进行接口对接:
- 文件位置: `doc/api/中介黑名单管理API文档-v2.0.md`
- Swagger UI: http://localhost:8080/swagger-ui/index.html
### 5. 填写测试报告
根据测试结果填写测试报告模板:
- 文件位置: `doc/test/intermediary-blacklist-test-report.md`
---
## API接口列表
### 基础路径
`/ccdi/intermediary`
### 主要接口
| 方法 | 路径 | 说明 | 权限 |
|------|------|------|------|
| GET | /list | 查询中介列表 | ccdi:intermediary:list |
| GET | /person/{bizId} | 查询个人中介详情 | ccdi:intermediary:query |
| GET | /entity/{socialCreditCode} | 查询实体中介详情 | ccdi:intermediary:query |
| POST | /person | 新增个人中介 | ccdi:intermediary:add |
| POST | /entity | 新增实体中介 | ccdi:intermediary:add |
| PUT | /person | 修改个人中介 | ccdi:intermediary:edit |
| PUT | /entity | 修改实体中介 | ccdi:intermediary:edit |
| DELETE | /{ids} | 删除中介 | ccdi:intermediary:remove |
| GET | /checkPersonIdUnique | 校验人员ID唯一性 | 无 |
| GET | /checkSocialCreditCodeUnique | 校验统一社会信用代码唯一性 | 无 |
| POST | /importPersonTemplate | 下载个人中介导入模板 | 无 |
| POST | /importEntityTemplate | 下载实体中介导入模板 | 无 |
| POST | /importPersonData | 导入个人中介数据 | ccdi:intermediary:import |
| POST | /importEntityData | 导入实体中介数据 | ccdi:intermediary:import |
详细接口说明请参考API文档。
---
## 测试账号
- **用户名**: admin
- **密码**: admin123
- **角色**: 管理员
---
## 菜单权限说明
执行menu-intermediary.sql后,系统会创建以下权限:
| 权限标识 | 说明 |
|---------|------|
| ccdi:intermediary:query | 查询中介详情 |
| ccdi:intermediary:list | 查询中介列表 |
| ccdi:intermediary:add | 新增中介 |
| ccdi:intermediary:edit | 修改中介 |
| ccdi:intermediary:remove | 删除中介 |
| ccdi:intermediary:export | 导出中介数据 |
| ccdi:intermediary:import | 导入中介数据 |
在角色管理中为相应角色分配这些权限。
---
## 数据字典说明
模块使用的数据字典类型:
| 字典类型 | 字典名称 | 用途 |
|---------|---------|------|
| ccdi_indiv_gender | 个人中介性别 | 个人中介模板性别下拉框 |
| ccdi_certificate_type | 证件类型 | 个人中介模板证件类型下拉框 |
| ccdi_entity_type | 主体类型 | 机构中介模板主体类型下拉框 |
| ccdi_enterprise_nature | 企业性质 | 机构中介模板企业性质下拉框 |
| ccdi_data_source | 数据来源 | 数据来源字段映射 |
确保这些字典类型在系统中已配置。
---
## 测试用例统计
本模块共包含44个测试用例,涵盖:
1. **列表查询** (7个用例)
- 基础列表查询
- 分页查询
- 按姓名查询
- 按证件号查询
- 按中介类型查询
- 组合条件查询
2. **个人中介管理** (8个用例)
- 新增个人中介
- 字段验证
- 唯一性校验
- 修改个人中介
- 查询详情
3. **实体中介管理** (7个用例)
- 新增实体中介
- 字段验证
- 唯一性校验
- 修改实体中介
- 查询详情
4. **唯一性校验** (2个用例)
- 人员ID唯一性
- 统一社会信用代码唯一性
5. **删除功能** (3个用例)
- 删除单条记录
- 批量删除
- 删除不存在的记录
6. **导入导出** (11个用例)
- 模板下载
- 数据导入
- 数据导出
- 异常处理
7. **权限控制** (6个用例)
- 各功能点的权限验证
---
## 常见问题
### 1. 测试脚本无法执行
**问题**: bash: test-intermediary-api.sh: command not found
**解决**: 使用bash命令执行
```bash
bash test-intermediary-api.sh
```
### 2. jq命令未安装
**问题**: jq: command not found
**解决**: 安装jq命令
```bash
# Ubuntu/Debian
apt-get install jq
# CentOS/RHEL
yum install jq
# Windows (使用Git Bash)
# 下载jq for Windows并添加到PATH
```
### 3. Token获取失败
**问题**: Token获取失败或返回null
**解决**:
- 确保后端服务已启动
- 确认用户名密码正确(admin/admin123)
- 检查/login/test接口是否正常
### 4. 菜单不显示
**问题**: 执行SQL后菜单不显示
**解决**:
- 在角色管理中为当前角色分配权限
- 刷新页面或重新登录
- 检查父级菜单ID(2000)是否存在
### 5. 导入失败
**问题**: 导入数据时报错
**解决**:
- 确认Excel模板格式正确
- 检查必填字段是否为空
- 检查证件号或统一社会信用代码是否重复
---
## 版本历史
| 版本 | 日期 | 说明 |
|------|------|------|
| 2.0.0 | 2026-02-04 | 重构版本:使用MyBatis Plus,分离DTO/VO,统一业务ID |
| 1.3.0 | 2026-01-29 | 新增接口分离:新增个人/机构专用新增接口 |
| 1.2.0 | 2026-01-29 | 修改接口分离:新增个人/机构专用修改接口 |
| 1.1.0 | 2026-01-29 | 添加字典下拉框功能,分离个人/机构模板 |
| 1.0.0 | 2026-01-29 | 初始版本,支持个人和机构分类管理 |
---
## 联系方式
如有问题,请联系开发团队。
---
**最后更新**: 2026-02-04

View File

@@ -0,0 +1,66 @@
# 文档目录结构
本目录包含纪检初核系统的各类文档、测试数据和脚本。
## 目录说明
### 📁 docs/
项目文档目录
- `纪检初核系统功能说明书-V1.0.docx/md` - 系统功能说明书
- `纪检初核系统模块划分方案.md` - 模块划分方案
- `若依环境使用手册.docx` - 若依框架使用手册
- `中介黑名单弹窗优化设计.md` - UI设计文档
- `EasyExcel字典下拉框使用说明.md` - Excel导入使用说明
### 📁 api/
API接口文档目录
- `员工信息管理API文档.md` - 员工信息管理模块API
- `中介黑名单管理API文档.md` - 中介黑名单管理模块API
### 📁 scripts/
测试脚本目录
- `test_import.py` - 导入功能测试脚本
- `test_import_simple.py` - 简单导入测试脚本
- `test_uniqueness_validation.py` - 唯一性校验测试脚本
- `generate_test_data.py` - 测试数据生成脚本
### 📁 test-data/
测试数据目录
- `个人中介黑名单模板_1769667622015.xlsx` - 导入模板
- `个人中介黑名单测试数据_1000条.xlsx` - 测试数据第1批
- `个人中介黑名单测试数据_1000条_第2批.xlsx` - 测试数据第2批
- `中介人员信息表.csv` - 中介人员数据
- `中介主体信息表.csv` - 中介主体数据
### 📁 other/
其他文件目录
- `纪检初核系统-离线演示包/` - 离线演示包(解压版)
- `纪检初核系统-离线演示包.zip` - 离线演示包(压缩版)
- `ScreenShot_*.png` - 截图文件
### 📁 modules/
模块设计文档目录
- `01-项目管理模块/` - 项目管理模块文档
- `02-项目工作台/` - 项目工作台模块文档
- `03-信息维护模块.md` - 信息维护模块文档
- `04-参数配置模块.md` - 参数配置模块文档
- `05-系统管理模块.md` - 系统管理模块文档
## 使用说明
### 生成测试数据
```bash
cd doc/scripts
python generate_test_data.py
```
### 运行测试脚本
```bash
cd doc/scripts
python test_uniqueness_validation.py
```
### 导入测试数据
1.`test-data/` 目录下载对应的Excel文件
2. 在系统页面点击"导入"按钮
3. 选择文件并上传

View File

@@ -0,0 +1,393 @@
# 员工导入服务规范合规审查报告
**审查时间**: 2026-02-09
**审查文件**: `CcdiEmployeeImportServiceImpl.java`
**审查类型**: 规范合规最终审查
---
## 一、审查结果总览
### ✅ 最终评估:**完全合规**
**综合评分**: 100/100
---
## 二、详细审查清单
### 1. 功能完整性检查 (25分)
#### ✅ 批量查询实现 (25/25分)
| 检查项 | 要求 | 实际情况 | 状态 |
|--------|------|----------|------|
| 调用 getExistingIdCards | 批量查询身份证号 | 第50行已调用 | ✅ |
| existingIdCards 集合 | 存储数据库已存在身份证号 | 第50行已创建 | ✅ |
| processedIdCards 集合 | 跟踪Excel内已处理身份证号 | 第54行已创建 | ✅ |
| processedEmployeeIds 集合 | 跟踪Excel内已处理柜员号 | 第53行已创建 | ✅ |
**证据代码**:
```java
// 第49-50行批量查询
Set<Long> existingIds = getExistingEmployeeIds(excelList);
Set<String> existingIdCards = getExistingIdCards(excelList);
// 第53-54行Excel内处理跟踪
Set<Long> processedEmployeeIds = new HashSet<>();
Set<String> processedIdCards = new HashSet<>();
```
---
### 2. 实现正确性检查 (25分)
#### ✅ 检查顺序 (25/25分)
**设计规范要求的检查顺序**:
1. ✅ 数据库重复检查
2. ✅ Excel内柜员号重复检查
3. ✅ Excel内身份证号重复检查
**实际实现顺序**:
**新增分支** (第90-101行):
```java
} else {
// 柜员号不存在,检查Excel内重复
if (processedEmployeeIds.contains(excel.getEmployeeId())) { // 2. 柜员号
throw new RuntimeException(String.format("柜员号[%d]在导入文件中重复,已跳过此条记录", excel.getEmployeeId()));
}
if (StringUtils.isNotEmpty(excel.getIdCard()) &&
processedIdCards.contains(excel.getIdCard())) { // 3. 身份证号
throw new RuntimeException(String.format("身份证号[%s]在导入文件中重复,已跳过此条记录", excel.getIdCard()));
}
newRecords.add(employee);
}
```
**更新分支** (第72-88行):
```java
if (existingIds.contains(excel.getEmployeeId())) {
if (!isUpdateSupport) {
throw new RuntimeException("柜员号已存在且未启用更新支持");
}
// 更新模式: 检查Excel内重复
if (processedEmployeeIds.contains(excel.getEmployeeId())) { // 2. 柜员号
throw new RuntimeException(String.format("柜员号[%d]在导入文件中重复,已跳过此条记录", excel.getEmployeeId()));
}
if (StringUtils.isNotEmpty(excel.getIdCard()) &&
processedIdCards.contains(excel.getIdCard())) { // 3. 身份证号
throw new RuntimeException(String.format("身份证号[%s]在导入文件中重复,已跳过此条记录", excel.getIdCard()));
}
updateRecords.add(employee);
}
```
**评价**: 完全符合设计规范,检查顺序正确。
---
#### ✅ if-else分支结构 (25/25分)
**设计规范**: 完整的双分支结构
- **数据库存在分支**: 处理更新模式
- **数据库不存在分支**: 处理新增模式
**实际实现**:
```java
// 第72-88行数据库存在分支
if (existingIds.contains(excel.getEmployeeId())) {
// 更新模式检查
// ...
updateRecords.add(employee);
} else {
// 第90-101行数据库不存在分支
// 新增模式检查
// ...
newRecords.add(employee);
}
```
**评价**: 分支结构完整,逻辑清晰。
---
#### ✅ 标记时机正确 (25/25分)
**设计规范**: 只在记录成功通过所有验证并确定要插入时,才标记为"已处理"
**实际实现**:
```java
// 第71-110行完整的验证流程
if (existingIds.contains(excel.getEmployeeId())) {
// 验证Excel内重复
// ...
updateRecords.add(employee); // 确定插入
} else {
// 验证Excel内重复
// ...
newRecords.add(employee); // 确定插入
}
// 第104-110行统一标记两个分支后
// 统一标记为已处理(两个分支都会执行到这里)
if (excel.getEmployeeId() != null) {
processedEmployeeIds.add(excel.getEmployeeId());
}
if (StringUtils.isNotEmpty(excel.getIdCard())) {
processedIdCards.add(excel.getIdCard());
}
```
**评价**: 标记时机完全正确,只有成功通过验证的记录才会被标记。
---
#### ✅ 空值处理正确 (25/25分)
**设计规范**: 只有非空的字段才参与重复检测和标记
**实际实现**:
**检测时**:
```java
// 第82-85行身份证号空值检查
if (StringUtils.isNotEmpty(excel.getIdCard()) &&
processedIdCards.contains(excel.getIdCard())) {
throw new RuntimeException(String.format("身份证号[%s]在导入文件中重复,已跳过此条记录", excel.getIdCard()));
}
```
**标记时**:
```java
// 第105-110行空值检查
if (excel.getEmployeeId() != null) {
processedEmployeeIds.add(excel.getEmployeeId());
}
if (StringUtils.isNotEmpty(excel.getIdCard())) {
processedIdCards.add(excel.getIdCard());
}
```
**评价**: 空值处理完全正确,符合设计规范。
---
#### ✅ 更新模式处理 (25/25分)
**设计规范**: 更新模式下也要进行Excel内重复检查
**实际实现**:
```java
// 第72-88行更新模式分支
if (existingIds.contains(excel.getEmployeeId())) {
if (!isUpdateSupport) {
throw new RuntimeException("柜员号已存在且未启用更新支持");
}
// 更新模式: 检查Excel内重复
if (processedEmployeeIds.contains(excel.getEmployeeId())) {
throw new RuntimeException(String.format("柜员号[%d]在导入文件中重复,已跳过此条记录", excel.getEmployeeId()));
}
if (StringUtils.isNotEmpty(excel.getIdCard()) &&
processedIdCards.contains(excel.getIdCard())) {
throw new RuntimeException(String.format("身份证号[%s]在导入文件中重复,已跳过此条记录", excel.getIdCard()));
}
// 通过检查,添加到更新列表
updateRecords.add(employee);
}
```
**评价**: 更新模式下完整实现了Excel内重复检查。
---
### 3. 代码一致性检查 (25分)
#### ✅ 与参考实现风格一致 (25/25分)
**参考实现** (`CcdiIntermediaryEntityImportServiceImpl.java`):
```java
if (existingCreditCodes.contains(excel.getSocialCreditCode())) {
// 数据库存在,直接报错
throw new RuntimeException(String.format("统一社会信用代码[%s]已存在,请勿重复导入", excel.getSocialCreditCode()));
} else if (excelProcessedIds.contains(excel.getSocialCreditCode())) {
// Excel内重复
throw new RuntimeException(String.format("统一社会信用代码[%s]在导入文件中重复,已跳过此条记录", excel.getSocialCreditCode()));
} else {
newRecords.add(entity);
excelProcessedIds.add(excel.getSocialCreditCode()); // 标记为已处理
}
```
**当前实现** (`CcdiEmployeeImportServiceImpl.java`):
```java
if (existingIds.contains(excel.getEmployeeId())) {
// 更新模式检查
updateRecords.add(employee);
} else {
// 新增模式检查
if (processedEmployeeIds.contains(excel.getEmployeeId())) {
throw new RuntimeException(String.format("柜员号[%d]在导入文件中重复,已跳过此条记录", excel.getEmployeeId()));
}
if (StringUtils.isNotEmpty(excel.getIdCard()) &&
processedIdCards.contains(excel.getIdCard())) {
throw new RuntimeException(String.format("身份证号[%s]在导入文件中重复,已跳过此条记录", excel.getIdCard()));
}
newRecords.add(employee);
}
// 统一标记
if (excel.getEmployeeId() != null) {
processedEmployeeIds.add(excel.getEmployeeId());
}
if (StringUtils.isNotEmpty(excel.getIdCard())) {
processedIdCards.add(excel.getIdCard());
}
```
**一致性分析**:
- ✅ 错误消息格式完全一致
- ✅ 使用 String.format 进行消息格式化
- ✅ 异常处理方式一致
- ✅ 批量查询模式一致
- ✅ 标记逻辑清晰易懂
**评价**: 代码风格与参考实现保持高度一致。
---
#### ✅ 错误消息格式符合要求 (25/25分)
**设计规范要求**:
- 柜员号: "柜员号[XXX]在导入文件中重复,已跳过此条记录"
- 身份证号: "身份证号[XXX]在导入文件中重复,已跳过此条记录"
**实际实现**:
```java
// 第80行柜员号错误消息
throw new RuntimeException(String.format("柜员号[%d]在导入文件中重复,已跳过此条记录", excel.getEmployeeId()));
// 第84行身份证号错误消息
throw new RuntimeException(String.format("身份证号[%s]在导入文件中重复,已跳过此条记录", excel.getIdCard()));
// 第93行柜员号错误消息新增分支
throw new RuntimeException(String.format("柜员号[%d]在导入文件中重复,已跳过此条记录", excel.getEmployeeId()));
// 第97行身份证号错误消息新增分支
throw new RuntimeException(String.format("身份证号[%s]在导入文件中重复,已跳过此条记录", excel.getIdCard()));
```
**评价**: 错误消息格式完全符合设计规范要求。
---
### 4. 方法签名更新检查 (25分)
#### ✅ validateEmployeeData 方法签名更新 (25/25分)
**设计规范**: 添加 existingIdCards 参数
**实际实现** (第280行):
```java
/**
* 验证员工数据
*
* @param addDTO 新增DTO
* @param isUpdateSupport 是否支持更新
* @param existingIds 已存在的员工ID集合(导入场景使用,传null表示单条新增)
* @param existingIdCards 已存在的身份证号集合(导入场景使用,传null表示单条新增)
*/
public void validateEmployeeData(CcdiEmployeeAddDTO addDTO, Boolean isUpdateSupport, Set<Long> existingIds, Set<String> existingIdCards) {
// ...
}
```
**方法调用** (第66行):
```java
validateEmployeeData(addDTO, isUpdateSupport, existingIds, existingIdCards);
```
**批量查询结果使用** (第324行):
```java
// 使用批量查询的结果检查身份证号唯一性
if (existingIdCards != null && existingIdCards.contains(addDTO.getIdCard())) {
throw new RuntimeException("该身份证号已存在");
}
```
**评价**: 方法签名更新完整,参数传递正确,批量查询结果正确使用。
---
## 三、代码质量评价
### 优点总结
1. **性能优化**: 使用批量查询替代单条查询,显著提升性能
2. **逻辑清晰**: 双分支结构清晰,易于理解和维护
3. **错误处理完善**: 所有异常情况都有明确的错误消息
4. **空值安全**: 正确处理空值情况,避免空指针异常
5. **注释清晰**: 关键步骤都有清晰的注释说明
6. **符合规范**: 完全符合设计规范和参考实现风格
### 与参考实现的差异说明
**差异点**: 当前实现使用了双分支结构(更新/新增),而参考实现使用单分支结构
**原因分析**:
- 参考实现是纯新增模式(不支持更新)
- 当前实现支持更新模式,需要区分更新和新增两种场景
**评价**: 这是合理的差异,双分支结构更适合支持更新模式的场景。
---
## 四、测试建议
### 建议测试场景
1. **Excel内柜员号重复测试**
- 准备3条相同柜员号的记录
- 验证只有第一条成功后2条失败
- 验证错误消息格式正确
2. **Excel内身份证号重复测试**
- 准备3条相同身份证号的记录
- 验证只有第一条成功后2条失败
- 验证错误消息格式正确
3. **数据库重复 + Excel内重复测试**
- 准备柜员号在数据库存在且在Excel内重复的记录
- 验证更新模式下Excel内重复检查生效
4. **空值处理测试**
- 准备身份证号为空的记录
- 验证空值不参与重复检测
5. **更新模式测试**
- 启用更新支持
- 验证Excel内重复检查在更新模式下生效
---
## 五、最终结论
### ✅ 完全合规
**评分**: 100/100
**合规要点**:
- ✅ 功能完整性: 25/25分
- ✅ 实现正确性: 25/25分
- ✅ 代码一致性: 25/25分
- ✅ 方法签名更新: 25/25分
**审批意见**: 该实现完全符合设计规范要求,可以进行代码合并。
---
**审查人**: Claude
**审查日期**: 2026-02-09

View File

@@ -0,0 +1,262 @@
# 员工导入Excel内双字段重复检测功能实现报告
## 功能概述
为员工导入模块添加Excel内双字段(柜员号和身份证号)重复检测功能,防止同一Excel文件中出现重复数据导入到数据库。
## 实现时间
2026-02-09
## 实现位置
- 文件: `D:\ccdi\ccdi\ruoyi-ccdi\src\main\java\com\ruoyi\ccdi\service\impl\CcdiEmployeeImportServiceImpl.java`
- 方法: `importEmployeeAsync` (第43-126行)
## 核心功能
### 1. 批量查询已存在的身份证号
在数据分类前,批量查询数据库中已存在的身份证号:
```java
Set<Long> existingIds = getExistingEmployeeIds(excelList);
Set<String> existingIdCards = getExistingIdCards(excelList);
```
**优点**:
- 减少数据库查询次数,提高性能
- 避免逐条查询导致的N+1问题
### 2. 添加Excel内处理跟踪集合
```java
Set<Long> processedEmployeeIds = new HashSet<>();
Set<String> processedIdCards = new HashSet<>();
```
**作用**:
- 跟踪Excel文件中已处理的柜员号
- 跟踪Excel文件中已处理的身份证号
- 用于检测Excel内部的重复数据
### 3. 双字段重复检测逻辑
在逐条处理时,按以下顺序检查:
```java
if (existingIds.contains(excel.getEmployeeId())) {
// 柜员号在数据库中已存在
if (isUpdateSupport) {
updateRecords.add(employee);
} else {
throw new RuntimeException("柜员号已存在且未启用更新支持");
}
} else if (processedEmployeeIds.contains(excel.getEmployeeId())) {
// 柜员号在Excel文件中重复
throw new RuntimeException(String.format("柜员号[%d]在导入文件中重复,已跳过此条记录", excel.getEmployeeId()));
} else if (StringUtils.isNotEmpty(excel.getIdCard()) &&
processedIdCards.contains(excel.getIdCard())) {
// 身份证号在Excel文件中重复
throw new RuntimeException(String.format("身份证号[%s]在导入文件中重复,已跳过此条记录", excel.getIdCard()));
} else {
// 无重复,添加到新记录
newRecords.add(employee);
// 只在成功时标记
if (excel.getEmployeeId() != null) {
processedEmployeeIds.add(excel.getEmployeeId());
}
if (StringUtils.isNotEmpty(excel.getIdCard())) {
processedIdCards.add(excel.getIdCard());
}
}
```
**检查顺序**:
1. 先检查柜员号是否在数据库中存在
2. 再检查柜员号是否在Excel文件内重复
3. 最后检查身份证号是否在Excel文件内重复
4. 只在记录成功添加到newRecords后才标记为已处理
### 4. 更新validateEmployeeData方法
**修改前**:
```java
public void validateEmployeeData(CcdiEmployeeAddDTO addDTO, Boolean isUpdateSupport, Set<Long> existingIds)
```
**修改后**:
```java
public void validateEmployeeData(CcdiEmployeeAddDTO addDTO, Boolean isUpdateSupport, Set<Long> existingIds, Set<String> existingIdCards)
```
**身份证号唯一性检查优化**:
```java
// 导入场景:如果柜员号不存在,才检查身份证号唯一性
if (!existingIds.contains(addDTO.getEmployeeId())) {
// 使用批量查询的结果检查身份证号唯一性
if (existingIdCards != null && existingIdCards.contains(addDTO.getIdCard())) {
throw new RuntimeException("该身份证号已存在");
}
}
```
**优点**:
- 使用批量查询结果,避免逐条查询
- 提高导入性能
## 技术特点
### 1. 双字段同时检测
同时检测柜员号(Long类型)和身份证号(String类型)的Excel内重复
### 2. 检查顺序合理
- 先检查数据库重复(避免无效数据处理)
- 再检查Excel内重复(防止重复导入)
- 最后标记已处理(只在成功后标记)
### 3. 空值处理
使用`StringUtils.isNotEmpty``Objects::nonNull`进行空值检查,避免空指针异常
### 4. 错误消息明确
- 柜员号重复: "柜员号[XXX]在导入文件中重复,已跳过此条记录"
- 身份证号重复: "身份证号[XXX]在导入文件中重复,已跳过此条记录"
### 5. 性能优化
- 批量查询数据库中已存在的柜员号和身份证号
- 使用HashSet进行O(1)复杂度的重复检测
- 减少数据库查询次数
## 测试场景
### 场景1: 柜员号在Excel内重复
**输入**:
```
柜员号 姓名 身份证号
1001 张三 110101199001011234
1001 李四 110101199001011235
```
**期望结果**:
- 第一条记录成功导入
- 第二条记录失败,错误信息: "柜员号[1001]在导入文件中重复,已跳过此条记录"
### 场景2: 身份证号在Excel内重复
**输入**:
```
柜员号 姓名 身份证号
1001 张三 110101199001011234
1002 李四 110101199001011234
```
**期望结果**:
- 第一条记录成功导入
- 第二条记录失败,错误信息: "身份证号[110101199001011234]在导入文件中重复,已跳过此条记录"
### 场景3: 柜员号和身份证号同时重复
**输入**:
```
柜员号 姓名 身份证号
1001 张三 110101199001011234
1001 张三 110101199001011234
```
**期望结果**:
- 第一条记录成功导入
- 第二条记录失败,错误信息: "柜员号[1001]在导入文件中重复,已跳过此条记录"
### 场景4: 正常导入(无重复)
**输入**:
```
柜员号 姓名 身份证号
1001 张三 110101199001011234
1002 李四 110101199001011235
1003 王五 110101199001011236
```
**期望结果**:
- 所有记录都成功导入
## 代码对比
### 修改前
```java
// 批量查询已存在的柜员号
Set<Long> existingIds = getExistingEmployeeIds(excelList);
// 分类数据
for (int i = 0; i < excelList.size(); i++) {
// ...
validateEmployeeData(addDTO, isUpdateSupport, existingIds);
if (existingIds.contains(excel.getEmployeeId())) {
if (isUpdateSupport) {
updateRecords.add(employee);
} else {
throw new RuntimeException("柜员号已存在且未启用更新支持");
}
} else {
newRecords.add(employee);
}
}
```
### 修改后
```java
// 批量查询已存在的柜员号和身份证号
Set<Long> existingIds = getExistingEmployeeIds(excelList);
Set<String> existingIdCards = getExistingIdCards(excelList);
// 用于跟踪Excel文件内已处理的主键
Set<Long> processedEmployeeIds = new HashSet<>();
Set<String> processedIdCards = new HashSet<>();
// 分类数据
for (int i = 0; i < excelList.size(); i++) {
// ...
validateEmployeeData(addDTO, isUpdateSupport, existingIds, existingIdCards);
if (existingIds.contains(excel.getEmployeeId())) {
if (isUpdateSupport) {
updateRecords.add(employee);
} else {
throw new RuntimeException("柜员号已存在且未启用更新支持");
}
} else if (processedEmployeeIds.contains(excel.getEmployeeId())) {
throw new RuntimeException(String.format("柜员号[%d]在导入文件中重复,已跳过此条记录", excel.getEmployeeId()));
} else if (StringUtils.isNotEmpty(excel.getIdCard()) &&
processedIdCards.contains(excel.getIdCard())) {
throw new RuntimeException(String.format("身份证号[%s]在导入文件中重复,已跳过此条记录", excel.getIdCard()));
} else {
newRecords.add(employee);
// 只在成功时标记
if (excel.getEmployeeId() != null) {
processedEmployeeIds.add(excel.getEmployeeId());
}
if (StringUtils.isNotEmpty(excel.getIdCard())) {
processedIdCards.add(excel.getIdCard());
}
}
}
```
## 参考实现
本功能参考了中介人员导入模块的双字段重复检测实现:
- 文件: `CcdiIntermediaryEntityImportServiceImpl.java`
- 关键方法: `importEntityAsync`
## 编译验证
已通过Maven编译验证,无语法错误:
```bash
mvn clean compile -DskipTests
```
编译结果: BUILD SUCCESS
## 测试脚本
测试脚本位置: `D:\ccdi\ccdi\doc\test-scripts\test_employee_duplicate_detection.py`
## 总结
本次实现成功为员工导入模块添加了Excel内双字段重复检测功能,主要改进包括:
1. **批量查询优化**: 添加`getExistingIdCards`方法批量查询已存在的身份证号
2. **双字段检测**: 同时检测柜员号和身份证号的Excel内重复
3. **性能优化**: 使用批量查询减少数据库访问次数
4. **错误处理**: 提供明确的错误提示信息
5. **代码规范**: 遵循若依框架编码规范,使用MyBatis Plus进行数据操作
该功能可以有效防止Excel文件内部的重复数据导入到数据库,提高数据质量和导入可靠性。

View File

@@ -0,0 +1,303 @@
# 员工导入Excel内双字段重复检测 - 代码流程说明
## 方法签名
```java
public void importEmployeeAsync(List<CcdiEmployeeExcel> excelList, Boolean isUpdateSupport, String taskId)
```
## 完整流程图
```
开始
├─ 1. 初始化集合
│ ├─ newRecords = new ArrayList<>() // 新增记录
│ ├─ updateRecords = new ArrayList<>() // 更新记录
│ └─ failures = new ArrayList<>() // 失败记录
├─ 2. 批量查询数据库
│ ├─ getExistingEmployeeIds(excelList)
│ │ └─ 返回: Set<Long> existingIds // 数据库中已存在的柜员号
│ │
│ └─ getExistingIdCards(excelList)
│ └─ 返回: Set<String> existingIdCards // 数据库中已存在的身份证号
├─ 3. 初始化Excel内跟踪集合
│ ├─ processedEmployeeIds = new HashSet<>() // Excel内已处理的柜员号
│ └─ processedIdCards = new HashSet<>() // Excel内已处理的身份证号
├─ 4. 遍历Excel数据
│ │
│ └─ FOR EACH excel IN excelList
│ │
│ ├─ 4.1 数据转换
│ │ ├─ addDTO = new CcdiEmployeeAddDTO()
│ │ ├─ BeanUtils.copyProperties(excel, addDTO)
│ │ └─ employee = new CcdiEmployee()
│ │ └─ BeanUtils.copyProperties(excel, employee)
│ │
│ ├─ 4.2 数据验证
│ │ └─ validateEmployeeData(addDTO, isUpdateSupport, existingIds, existingIdCards)
│ │ ├─ 验证必填字段(姓名、柜员号、部门、身份证号、电话、状态)
│ │ ├─ 验证身份证号格式
│ │ └─ 验证柜员号和身份证号唯一性
│ │
│ ├─ 4.3 重复检测与分类
│ │ │
│ │ ├─ IF existingIds.contains(excel.getEmployeeId())
│ │ │ ├─ 柜员号在数据库中已存在
│ │ │ ├─ IF isUpdateSupport
│ │ │ │ └─ updateRecords.add(employee) // 添加到更新列表
│ │ │ └─ ELSE
│ │ │ └─ throw RuntimeException("柜员号已存在且未启用更新支持")
│ │ │
│ │ ├─ ELSE IF processedEmployeeIds.contains(excel.getEmployeeId())
│ │ │ └─ throw RuntimeException("柜员号[XXX]在导入文件中重复,已跳过此条记录")
│ │ │
│ │ ├─ ELSE IF processedIdCards.contains(excel.getIdCard())
│ │ │ └─ throw RuntimeException("身份证号[XXX]在导入文件中重复,已跳过此条记录")
│ │ │
│ │ └─ ELSE
│ │ ├─ newRecords.add(employee) // 添加到新增列表
│ │ ├─ IF excel.getEmployeeId() != null
│ │ │ └─ processedEmployeeIds.add(excel.getEmployeeId()) // 标记柜员号
│ │ └─ IF StringUtils.isNotEmpty(excel.getIdCard())
│ │ └─ processedIdCards.add(excel.getIdCard()) // 标记身份证号
│ │
│ └─ 4.4 异常处理
│ └─ CATCH Exception
│ ├─ failure = new ImportFailureVO()
│ ├─ BeanUtils.copyProperties(excel, failure)
│ ├─ failure.setErrorMessage(e.getMessage())
│ └─ failures.add(failure)
├─ 5. 批量操作数据库
│ ├─ IF !newRecords.isEmpty()
│ │ └─ saveBatch(newRecords, 500) // 批量插入新数据
│ │
│ └─ IF !updateRecords.isEmpty() && isUpdateSupport
│ └─ employeeMapper.insertOrUpdateBatch(updateRecords) // 批量更新已有数据
├─ 6. 保存失败记录到Redis
│ └─ IF !failures.isEmpty()
│ └─ redisTemplate.opsForValue().set("import:employee:" + taskId + ":failures", failures, 7, TimeUnit.DAYS)
├─ 7. 生成导入结果
│ ├─ result = new ImportResult()
│ ├─ result.setTotalCount(excelList.size())
│ ├─ result.setSuccessCount(newRecords.size() + updateRecords.size())
│ └─ result.setFailureCount(failures.size())
└─ 8. 更新导入状态
└─ updateImportStatus("employee", taskId, finalStatus, result)
└─ IF result.getFailureCount() == 0
└─ finalStatus = "SUCCESS"
└─ ELSE
└─ finalStatus = "PARTIAL_SUCCESS"
结束
```
## 关键逻辑说明
### 1. 重复检测优先级
```
数据库柜员号重复 > Excel内柜员号重复 > Excel内身份证号重复
```
**原因**:
- 数据库检查优先: 避免处理已经存在且不允许更新的数据
- Excel内柜员号检查: 柜员号是主键,优先检查
- Excel内身份证号检查: 身份证号也需要唯一性
### 2. 标记时机
```
只在记录成功添加到newRecords后才标记为已处理
```
**原因**:
- 避免将验证失败的记录标记为已处理
- 确保只有成功插入数据库的记录才会占用柜员号和身份证号
- 防止因前一条记录失败导致后一条有效记录被误判为重复
### 3. 空值处理
```java
// 柜员号空值检查
if (excel.getEmployeeId() != null) {
processedEmployeeIds.add(excel.getEmployeeId());
}
// 身份证号空值检查
if (StringUtils.isNotEmpty(excel.getIdCard())) {
processedIdCards.add(excel.getIdCard());
}
```
**原因**:
- 防止空指针异常
- 确保只有有效的柜员号和身份证号才会被检查重复
### 4. 批量查询优化
```java
// 批量查询柜员号
Set<Long> existingIds = getExistingEmployeeIds(excelList);
// 批量查询身份证号
Set<String> existingIdCards = getExistingIdCards(excelList);
```
**优点**:
- 一次性查询所有需要的数据
- 避免逐条查询导致的N+1问题
- 使用HashSet实现O(1)复杂度的查找
## 错误消息说明
### 1. 柜员号在数据库中已存在
```java
"柜员号已存在且未启用更新支持"
```
### 2. 柜员号在Excel内重复
```java
String.format("柜员号[%d]在导入文件中重复,已跳过此条记录", excel.getEmployeeId())
```
**示例**: "柜员号[1001]在导入文件中重复,已跳过此条记录"
### 3. 身份证号在Excel内重复
```java
String.format("身份证号[%s]在导入文件中重复,已跳过此条记录", excel.getIdCard())
```
**示例**: "身份证号[110101199001011234]在导入文件中重复,已跳过此条记录"
## validateEmployeeData方法说明
### 方法签名
```java
public void validateEmployeeData(CcdiEmployeeAddDTO addDTO,
Boolean isUpdateSupport,
Set<Long> existingIds,
Set<String> existingIdCards)
```
### 验证流程
```
1. 验证必填字段
├─ 姓名不能为空
├─ 柜员号不能为空
├─ 所属部门不能为空
├─ 身份证号不能为空
├─ 电话不能为空
└─ 状态不能为空
2. 验证身份证号格式
└─ IdCardUtil.getErrorMessage(addDTO.getIdCard())
3. 验证唯一性
├─ IF existingIds == null (单条新增场景)
│ ├─ 检查柜员号唯一性(数据库查询)
│ └─ 检查身份证号唯一性(数据库查询)
└─ ELSE (导入场景)
├─ IF 柜员号不存在于数据库
│ └─ 检查身份证号唯一性(使用批量查询结果)
└─ ELSE (柜员号已存在,允许更新)
└─ 跳过身份证号检查(更新模式下不检查身份证号重复)
4. 验证状态
└─ 状态只能填写'0'(在职)或'1'(离职)
```
### 导入场景的身份证号唯一性检查优化
```java
// 导入场景:如果柜员号不存在,才检查身份证号唯一性
if (!existingIds.contains(addDTO.getEmployeeId())) {
// 使用批量查询的结果检查身份证号唯一性
if (existingIdCards != null && existingIdCards.contains(addDTO.getIdCard())) {
throw new RuntimeException("该身份证号已存在");
}
}
```
**优化点**:
- 使用批量查询结果`existingIdCards`,避免逐条查询数据库
- 只在柜员号不存在时才检查身份证号(因为柜员号存在时是更新模式)
## 批量查询方法说明
### getExistingEmployeeIds
```java
private Set<Long> getExistingEmployeeIds(List<CcdiEmployeeExcel> excelList) {
List<Long> employeeIds = excelList.stream()
.map(CcdiEmployeeExcel::getEmployeeId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (employeeIds.isEmpty()) {
return Collections.emptySet();
}
List<CcdiEmployee> existingEmployees = employeeMapper.selectBatchIds(employeeIds);
return existingEmployees.stream()
.map(CcdiEmployee::getEmployeeId)
.collect(Collectors.toSet());
}
```
### getExistingIdCards
```java
private Set<String> getExistingIdCards(List<CcdiEmployeeExcel> excelList) {
List<String> idCards = excelList.stream()
.map(CcdiEmployeeExcel::getIdCard)
.filter(StringUtils::isNotEmpty)
.collect(Collectors.toList());
if (idCards.isEmpty()) {
return Collections.emptySet();
}
LambdaQueryWrapper<CcdiEmployee> wrapper = new LambdaQueryWrapper<>();
wrapper.in(CcdiEmployee::getIdCard, idCards);
List<CcdiEmployee> existingEmployees = employeeMapper.selectList(wrapper);
return existingEmployees.stream()
.map(CcdiEmployee::getIdCard)
.collect(Collectors.toSet());
}
```
**特点**:
- 使用Stream API进行数据提取和过滤
- 过滤空值,避免无效查询
- 使用MyBatis Plus的批量查询方法
- 返回Set集合,实现O(1)复杂度的查找
## 性能分析
### 时间复杂度
- 批量查询: O(n), n为Excel记录数
- 重复检测: O(1), 使用HashSet
- 总体复杂度: O(n)
### 空间复杂度
- existingIds: O(m), m为数据库中已存在的柜员号数量
- existingIdCards: O(k), k为数据库中已存在的身份证号数量
- processedEmployeeIds: O(n), n为Excel记录数
- processedIdCards: O(n), n为Excel记录数
- 总体空间复杂度: O(m + k + n)
### 数据库查询次数
- 修改前: 1次(批量查询柜员号) + n次(逐条查询身份证号) = O(n)
- 修改后: 2次(批量查询柜员号 + 批量查询身份证号) = O(1)
**性能提升**: 减少n-1次数据库查询
## 总结
本实现通过以下技术手段实现了Excel内双字段重复检测:
1. 批量查询优化,减少数据库访问
2. 使用HashSet进行O(1)复杂度的重复检测
3. 合理的检查顺序和标记时机
4. 完善的空值处理和错误提示
5. 遵循若依框架编码规范,使用MyBatis Plus进行数据操作

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 KiB

View File

@@ -0,0 +1,162 @@
# 中介黑名单导入功能修复说明
## 问题描述
在导入机构中介黑名单数据时,出现以下错误:
```
Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: Column 'certificate_no' cannot be null
```
## 问题原因
1. **数据库约束**`ccdi_intermediary_blacklist` 表的 `certificate_no` 字段设置为 `NOT NULL`,不允许存储 null 值。
2. **代码缺陷**:在 `CcdiIntermediaryBlacklistServiceImpl.java``importEntityIntermediary` 方法中,导入机构中介时只设置了 `corpCreditCode`(统一社会信用代码),但没有设置 `certificateNo` 字段,导致该字段为 null。
3. **批量插入失败**`batchInsert` 方法明确插入 `certificate_no` 字段,当值为 null 时违反数据库约束。
## 解决方案
### 1. 代码修改
**文件**[CcdiIntermediaryBlacklistServiceImpl.java](d:\discipline-prelim-check\discipline-prelim-check\ruoyi-ccdi\src\main\java\com\ruoyi\dpc\service\impl\CcdiIntermediaryBlacklistServiceImpl.java)
**修改位置**:第 390-394 行
**修改前**
```java
// 转换为实体
CcdiIntermediaryBlacklist intermediary = new CcdiIntermediaryBlacklist();
intermediary.setName(excel.getName());
intermediary.setIntermediaryType("2");
```
**修改后**
```java
// 转换为实体
CcdiIntermediaryBlacklist intermediary = new CcdiIntermediaryBlacklist();
intermediary.setName(excel.getName());
// 对于机构中介,使用统一社会信用代码作为证件号
intermediary.setCertificateNo(excel.getCorpCreditCode());
intermediary.setIntermediaryType("2");
```
### 2. 验证逻辑增强
**文件**[CcdiIntermediaryBlacklistServiceImpl.java](d:\discipline-prelim-check\discipline-prelim-check\ruoyi-ccdi\src\main\java\com\ruoyi\dpc\service\impl\CcdiIntermediaryBlacklistServiceImpl.java)
**修改位置**:第 484-488 行
**修改前**
```java
private void validateEntityIntermediaryData(CcdiIntermediaryEntityExcel excel) {
if (StringUtils.isEmpty(excel.getName())) {
throw new RuntimeException("机构名称不能为空");
}
}
```
**修改后**
```java
private void validateEntityIntermediaryData(CcdiIntermediaryEntityExcel excel) {
if (StringUtils.isEmpty(excel.getName())) {
throw new RuntimeException("机构名称不能为空");
}
// 验证统一社会信用代码不能为空(因为会用作 certificate_no 字段)
if (StringUtils.isEmpty(excel.getCorpCreditCode())) {
throw new RuntimeException("统一社会信用代码不能为空");
}
}
```
### 3. 批量更新 XML 配置优化
**文件**[CcdiIntermediaryBlacklistMapper.xml](d:\discipline-prelim-check\discipline-prelim-check\ruoyi-ccdi\src\main\resources\mapper\dpc\CcdiIntermediaryBlacklistMapper.xml)
**修改位置**:第 125-127 行
**修改前**
```xml
<if test="item.dataSource != null">data_source = #{item.dataSource},</if>
update_by = #{item.updateBy},
update_time = #{item.updateTime}
```
**修改后**
```xml
<if test="item.dataSource != null">data_source = #{item.dataSource},</if>
<if test="item.certificateNo != null">certificate_no = #{item.certificateNo},</if>
update_by = #{item.updateBy},
update_time = #{item.updateTime}
```
## 设计说明
### 为什么使用统一社会信用代码作为证件号?
1. **数据一致性**:统一社会信用代码本身就是机构的法定证件号,将其同时存储在 `certificate_no` 字段中可以保持数据的一致性。
2. **查询便利**`certificate_no` 字段有索引,设置后可以快速查询机构中介。
3. **兼容性好**:个人中介和机构中介都使用 `certificate_no` 字段,查询逻辑更统一。
4. **不破坏现有结构**:不需要修改数据库表结构,只修改代码逻辑。
## 测试验证
### 测试用例
1. **个人中介导入**:正常导入个人中介数据,验证 `certificate_no` 字段正确存储身份证号。
2. **机构中介导入**:导入机构中介数据,验证 `certificate_no` 字段正确存储统一社会信用代码。
3. **统一社会信用代码为空**:验证当统一社会信用代码为空时,导入被正确拒绝并给出错误提示。
4. **批量更新**:验证批量更新时 `certificate_no` 字段能够正确更新。
### 测试脚本
测试脚本位于:[doc/test-data/test_import_fix.py](d:\discipline-prelim-check\discipline-prelim-check\doc\test-data\test_import_fix.py)
运行测试:
```bash
python doc/test-data/test_import_fix.py
```
## 影响范围
### 已影响的功能
- 机构中介批量导入功能
### 不影响的功能
- 个人中介导入功能
- 手动新增中介功能
- 中介查询功能
- 中介导出功能
## 注意事项
1. **数据迁移**:如果数据库中已存在机构中介数据且 `certificate_no` 为 null需要执行以下 SQL 进行数据修复:
```sql
UPDATE ccdi_intermediary_blacklist
SET certificate_no = corp_credit_code
WHERE intermediary_type = '2' AND certificate_no IS NULL AND corp_credit_code IS NOT NULL;
```
2. **Excel 模板**:确保导入模板中统一社会信用代码字段设置为必填项。
3. **前端验证**:建议在前端表单中也添加统一社会信用代码的必填验证。
## 修改文件列表
1. [CcdiIntermediaryBlacklistServiceImpl.java](d:\discipline-prelim-check\discipline-prelim-check\ruoyi-ccdi\src\main\java\com\ruoyi\dpc\service\impl\CcdiIntermediaryBlacklistServiceImpl.java) - 服务层实现
2. [CcdiIntermediaryBlacklistMapper.xml](d:\discipline-prelim-check\discipline-prelim-check\ruoyi-ccdi\src\main\resources\mapper\dpc\CcdiIntermediaryBlacklistMapper.xml) - MyBatis 映射文件
3. [test_import_fix.py](d:\discipline-prelim-check\discipline-prelim-check\doc\test-data\test_import_fix.py) - 测试脚本
## 版本历史
| 版本 | 日期 | 作者 | 说明 |
|------|------|------|------|
| 1.0 | 2026-01-29 | ruoyi | 初始版本,修复机构中介导入时 certificate_no 为 null 的问题 |

View File

@@ -0,0 +1 @@
window.ENV = {"IS_FEAT_FLPAK4GB":true,"IS_FEAT_ABOARD":true,"IS_FEAT_SIGMA":true,"IS_LEGACY_V7":true,"BOMX_API_SDK_URL":"https://sdk.boardmix.cn/bmsdk","BOMX_API_CLIENT_ID":"IpfSMaEsOHWu7cg7","AIPPT_CLIENT_ID":"0ePnORDMD6KJSIIB","AIPPT_API_SDK_URL":"https://sdk.pptgo.cn/pptsdk","PIXSO_API_URL":"https://ps.modao.cc","PIXSO_USER_CLIENT_ID":"pixso_design_online"}

View File

@@ -0,0 +1 @@
TAG_V++3NXya0fYxmDs8mWSM69pSHMU=|2026-01-27T00_2026-01-27T00:11:10.126Z

View File

@@ -0,0 +1 @@
window["hzv5"] = window["hzv5"] || {};window["hzv5"]["init"] = {"MBServer":"modao.cc","MBClientDownloadURL":"https://cdn-release.modao.cc/desktop/Mockitt-darwin-x64-zh-1.2.5.dmg","MBChromeDownloadURL":"https://www.google.cn/chrome/","MBSketchPluginDownloadURL":"https://cdn-release.modao.cc/sketch/MockingBot.zh.sketchplugin.zip","isOnPremises":false,"isWonderShare":false,"projectUpper":{"owner_id":2209883,"owner_name":"谢小涵","owner_email":"153276082@qq.com","owner_avatar":"https://oss-mb-fog.modao.cc/uploads4/avatars/220/2209883/forum_132.jpeg","id":33418631,"limitation":{"storage":5000,"exportable":["png","pngs","htmlzip"],"encryptable":true,"inspectable":true,"slices":true,"projects":65535,"screens":65535,"commentable":true},"screens_count":5,"cid":"pb2mk0rvsqu5j6763","team_cid":"temk0rv8qmsbc9ft","space_cid":"splopmenp3ricy1f","space_name":"默认空间","name":"纪检初核系统","type":"proto2","attr":{"export_settings":[{"affix":"suffix","scale":"1","format":"png"}],"export_with_device_frame":false},"created_at":1767594090000,"updated_at":1768285464000,"timestamp":"1768285464","access":"public","access_token":"WEvGV4cIt8dobuo9KjUF","version":"v3","icon":null,"cover":"/uploads7/covers/3341/33418631/cover_1769473447.png","custom_cover":null,"is_custom_cover":false,"splash":null,"width":1440,"height":1024,"device":"web","model":"desktop","scale":100,"archived":false,"is_sclib":false,"parent_cid":"pb2m9uxlouyf4dwms","source_upper_cid":null,"clones":11,"shell_type":"device","password":"","wechat":false,"highlight":true,"preview_option":1,"expired":false,"deleted":false,"duplicating":false,"permissions":[{"user_id":2209883,"role":"project_owner"}],"is_org_project":false,"is_sub_project":false,"runner_mode":"preview","comment_permission":"org_member","tabs":null,"visibility":"open","building":"view_sticky","scene_tag":"PC-web","is_solo_lifetime":true,"is_first_canvas_open":null},"projectMeta":{"cid":"pm2mk0rvsquvpcjcs","mtime":1767594090054,"name":"","type":"proto2","ttag":"flat","upper_cid":"pb2mk0rvsqu5j6763","upper_type":"project-basic","is_flat_meta":true}}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
window["hzv5"] = window["hzv5"] || {};window["hzv5"]["mktc"] = {"md_vip_mkt_list":[],"mt_vip_mkt_list":[],"no_wm_mkt_list":["igk8iirffgi4hpfx","igk8iisxdk72zt9","igk8iiv3qpgl3lsx","igk8iiw2zlastfks","igk8ij5zxd43jlud","igk8ijdjkayrsvvz","igk8ijgosea1iye0","igkszmzkoc8bv5fq","igkw1wjh6762ojwr","igkwotlxrcwn19vd"]}

View File

@@ -0,0 +1,44 @@
<!doctype html><html translate="no"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="mobile-web-app-capable" content="yes"><meta name="renderer" content="webkit"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>墨刀</title><link rel="icon" id="icon" href="mb-proto2/vis/modao/favicon_home_screen_new.ico"><link rel="apple-touch-icon-precomposed" id="apple-touch-icon" href="mb-proto2/vis/modao/favicon_home_screen_new.ico"><link rel="stylesheet" href="mb-proto2/icons/fa5/css/fa5.css"><script>if (
function() { try { eval([
'for (const a of []) {}',
'let b = { fetch, Proxy }',
'let c = (async () => {})()',
'let { d0, ...d1 } = { ...b }'
].join(';')) } catch (e) { console.log('!!', e); return true } }()
) location.href = "https://modao.cc/browser-update"</script><script src="mb-static/2410/echarts-map/loadMap.js"></script><script src="env/2203.js"></script><script>window.ENV.NO_SENTRY = true; window.ENV.NO_TRACK = true</script><script>if (ENV.IS_MO) {
document.title = 'Mockitt';
document.documentElement.classList.add('wonder-share');
document.getElementById('icon').href = '/mb-static/2509/favicon-mo.ico';
document.getElementById('apple-touch-icon').href = '/mb-static/2509/favicon-mo.ico';
}</script><script>window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments) };
ENV.IS_MO && gtag('js', new Date());
ENV.IS_MO && gtag('config', 'UA-4839360-64');
ENV.IS_MO && document.write('<script async src="https://www.googletagmanager.com/gtag/js?id=UA-4839360-64"><'+'/script>')</script><script>window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments) };
ENV.IS_MO && gtag('js', new Date());
ENV.IS_MO && gtag('config', 'G-24WTSJBD5B');
ENV.IS_MO && document.write('<script async src="https://www.googletagmanager.com/gtag/js?id=G-24WTSJBD5B"><'+'/script>')</script><script src="mb-static/2308/core-js-3.32.1/modern.js"></script><script>ENV.NO_TRACK || document.write('<script src="mb-static/2502/sa-1.26.18/_.js"><'+'/script>')</script><script defer="defer" src="mb-proto2/6.3688a-vendor-0d07687f4be09b8b3eca.js"></script><script defer="defer" src="mb-proto2/5.fxqum-vendor-f8aaf1fb2db7ed4b19df.js"></script><script defer="defer" src="mb-proto2/5.7b24m-vendor-c6215ade32c4d6e04f4c.js"></script><script defer="defer" src="mb-proto2/4.ekpaa-vendor-4a8c0d8af0989de4a89f.js"></script><script defer="defer" src="mb-proto2/4.n9fxu-vendor-121f3fbb2320541a30bc.js"></script><script defer="defer" src="mb-proto2/3.h4vam-vendor-5567a1235ac230e00561.js"></script><script defer="defer" src="mb-proto2/preview-html-zip-40b1c65b44de21c4ab8a.js"></script><link href="mb-proto2/6.3688a-vendor-16f3ece222913e7058d1.css" rel="stylesheet"><link href="mb-proto2/preview-html-zip-f0d9de76208db26b1137.css" rel="stylesheet"><script>function loadGTM() {
if (ENV.NO_TRACK) {
return
}
(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({
'gtm.start': new Date().getTime(),
event: 'gtm.js',
});
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l !== 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-TZJK297T');
}
loadGTM()</script></head><body><div id="workspace"></div><script>HZv5_PREVIEW_MODE="device"</script>
<script src="extra/data.0.js"></script>
<script src="extra/data.2.js"></script>
<script src="extra/data.1.js"></script>
</body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Some files were not shown because too many files have changed in this diff Show More