Compare commits
56 Commits
dev-ui
...
fc6af5234d
| Author | SHA1 | Date | |
|---|---|---|---|
| fc6af5234d | |||
| 624b51292f | |||
| 6385778e4c | |||
| 60a7906eb3 | |||
| 49118a4418 | |||
| d2d36d75a7 | |||
| bc2a885abf | |||
| 018b085447 | |||
| 55f6eb9129 | |||
| 2b321a8621 | |||
| c278d11390 | |||
| e0629f22e5 | |||
| 03ecbbd204 | |||
| eabd38fa58 | |||
| 03a4acb63a | |||
| 3286795f98 | |||
| 4c6ca52e7e | |||
| cc1a4538af | |||
| 5aaf6c83be | |||
| cb3265e796 | |||
| 8798aa9230 | |||
| 2fdf5f1546 | |||
| a32be65bf1 | |||
| 51810a325e | |||
| 6b24e02ba9 | |||
| d831edcaa4 | |||
| af63607069 | |||
| 0abc84c571 | |||
| 7dafabf7cb | |||
| 4dca2b2b63 | |||
| 001597d5e8 | |||
| 4b5ac7388c | |||
| 1e0813a84c | |||
| c8d45416cf | |||
| 09119a2365 | |||
| 5de46eabc5 | |||
| bcb2e39099 | |||
| 09b4cfe3c4 | |||
| c5a00f26ad | |||
| d4dc66a514 | |||
| 2877e26fa5 | |||
| 1a19dcbc13 | |||
| f981dc9906 | |||
| f0e2595a2b | |||
| 37e0c231a7 | |||
| 1397f12057 | |||
| 46e476e35b | |||
| bfac1f10d2 | |||
| d01362cc72 | |||
| 2aee9ff76e | |||
| 5b91cee935 | |||
| a3f49dc176 | |||
| 127a59bf78 | |||
| 988c2d3572 | |||
| f4a72a6110 | |||
| 3741ef5fe4 |
12
.gitignore
vendored
12
.gitignore
vendored
@@ -79,4 +79,14 @@ output/
|
||||
|
||||
logs/
|
||||
|
||||
.DS_Store
|
||||
.DS_Store
|
||||
|
||||
ruoyi-ui/vue.config.js
|
||||
|
||||
*/src/test/
|
||||
|
||||
.pytest_cache/
|
||||
|
||||
tests/
|
||||
|
||||
tongweb_62318.properties
|
||||
17
.mcp.json
17
.mcp.json
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"mysql": {
|
||||
"command": "node",
|
||||
"args": [
|
||||
"C:/Users/wkc/.codex/mcp-tools/mysql-server/node_modules/@fhuang/mcp-mysql-server/build/index.js"
|
||||
],
|
||||
"env": {
|
||||
"MYSQL_DATABASE": "ccdi",
|
||||
"MYSQL_HOST": "116.62.17.81",
|
||||
"MYSQL_PASSWORD": "Kfcx@1234",
|
||||
"MYSQL_PORT": "3306",
|
||||
"MYSQL_USER": "root"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
24
.opencode
24
.opencode
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"plugin": [
|
||||
"oh-my-opencode@latest"
|
||||
],
|
||||
"agent": {
|
||||
"Sisyphus-Junior": {
|
||||
"mode": "subagent",
|
||||
"model": "glm/glm-5"
|
||||
},
|
||||
"oracle": {
|
||||
"mode": "subagent",
|
||||
"model": "gmn/gpt-5.3-codex"
|
||||
},
|
||||
"Metis (Plan Consultant)": {
|
||||
"mode": "subagent",
|
||||
"model": "gmn/gpt-5.3-codex"
|
||||
},
|
||||
"Momus (Plan Critic)": {
|
||||
"mode": "subagent",
|
||||
"model": "gmn/gpt-5.3-codex"
|
||||
}
|
||||
}
|
||||
}
|
||||
75
AGENTS.md
75
AGENTS.md
@@ -15,19 +15,58 @@
|
||||
|
||||
---
|
||||
|
||||
## 协作约定
|
||||
## 高优先级规则
|
||||
|
||||
- 使用简体中文进行思考和对话
|
||||
- Git 提交说明使用中文
|
||||
- Git 提交前必须检查暂存区,仅允许包含本次任务相关文件
|
||||
- 若暂存区存在无关文件,必须先移出暂存或与用户确认,禁止顺带提交
|
||||
- 根据设计文档产出实施计划时,默认输出两份文档:
|
||||
- 后端实施计划放 `docs/plans/backend/`
|
||||
- 前端实施计划放 `docs/plans/frontend/`
|
||||
- 前端开发直接在当前分支进行,不需要额外创建 git worktree
|
||||
- Git 提交说明必须使用中文
|
||||
- 忽略 `.DS_Store` 文件,不将其视为本次任务需要处理或提交的有效变更
|
||||
- 仅当用户明确声明调用 `using-superpowers` 时才允许启用;未明确声明时按普通流程直接处理需求
|
||||
- Git 提交前必须检查暂存区,仅允许包含本次任务相关文件;若存在无关文件,必须先移出暂存或与用户确认
|
||||
- 每一次改动都需要留下实施文档,记录修改内容、影响范围与验证情况
|
||||
- 功能设计同时涉及前端和后端改动时,必须分别输出后端与前端两份实施计划;若仅涉及单侧,则只输出对应实施计划
|
||||
- 新增或修改设计文档、实施计划、实施记录前,必须先确认保存路径是否正确
|
||||
- 前端相关安装、构建、调试、测试命令执行前,必须先通过 `nvm` 切换并确认 Node 版本
|
||||
- 测试结束后,自动关闭测试过程中启动的前后端进程
|
||||
- 重启后端时,必须优先使用 `bin/restart_java_backend.sh`
|
||||
|
||||
---
|
||||
|
||||
## 协作约定
|
||||
|
||||
### 基础协作
|
||||
|
||||
- 前端开发直接在当前分支进行,不需要额外创建 git worktree
|
||||
- 给出方案时,必须保持最短路径实现,不允许提供兼容性、补丁性或过度设计的方案
|
||||
- 不允许自行扩展出用户需求之外的兜底、降级或变体方案,避免业务逻辑偏移
|
||||
- 输出方案前必须完成全链路逻辑校验,确保方案逻辑正确、链路闭环
|
||||
|
||||
### Git 与变更管理
|
||||
|
||||
- Git 提交前必须检查暂存区,仅保留本次任务相关文件
|
||||
- 若暂存区存在无关文件,必须先移出暂存或与用户确认,禁止顺带提交
|
||||
- `.DS_Store` 默认忽略,不纳入任务变更范围
|
||||
|
||||
### 文档产出
|
||||
|
||||
- 若需求来自设计文档,默认同时沉淀后端与前端两份实施计划
|
||||
- 功能设计同时涉及前端和后端改动时,实施计划分别放在 `docs/plans/backend/` 与 `docs/plans/frontend/`
|
||||
- 功能修改只涉及前端或只涉及后端时,只输出对应的实施计划
|
||||
- 非前后端架构项目不强制拆分两份实施计划
|
||||
- 每一次改动都需要留下实施文档,实施记录优先放在 `docs/reports/implementation/`
|
||||
- 每次新增或修改设计文档、实施计划、实施记录前,都要先确认保存路径是否正确
|
||||
|
||||
### 测试与运行
|
||||
|
||||
- 测试结束后,自动关闭测试过程中启动的前后端进程
|
||||
- 重启后端时,必须优先使用 `bin/restart_java_backend.sh`,不要直接手工执行 `java -jar` 替代正式重启流程
|
||||
- 前端相关安装、构建、调试、测试命令执行前,必须先通过 `nvm` 切换并确认 Node 版本
|
||||
|
||||
### 数据库与编码
|
||||
|
||||
- 遇到 MCP 数据库操作时,使用项目配置文件中的数据库连接信息
|
||||
- 执行包含中文内容的 MySQL SQL 脚本或数据库导入时,禁止直接手写 `mysql -e` 或普通重定向执行;必须优先使用 `bin/mysql_utf8_exec.sh <sql-file>`,确保会话字符集为 `utf8mb4`,避免导入或写入乱码
|
||||
- 执行包含中文内容的 MySQL SQL 脚本或数据库导入时,禁止直接手写 `mysql -e` 或普通重定向执行;必须优先使用 `bin/mysql_utf8_exec.sh <sql-file>`,确保会话字符集为 `utf8mb4`
|
||||
- 所有业务表、系统表新增或修改时,必须显式使用 `utf8mb4` 字符集与 `utf8mb4_general_ci` 排序规则
|
||||
- 禁止引入 `utf8mb4_0900_ai_ci`、`utf8mb4_unicode_ci` 或其他混用排序规则
|
||||
- 银行流水打标相关规则与参数编码需要统一使用全大写;新增或修改 `rule_code`、`indicator_code`、`param_code` 时,禁止混用大小写风格
|
||||
|
||||
---
|
||||
@@ -61,6 +100,9 @@ mvn clean package -DskipTests
|
||||
```bash
|
||||
cd ruoyi-ui
|
||||
|
||||
# 使用 nvm 切换到项目所需 Node 版本
|
||||
nvm use
|
||||
|
||||
# 安装依赖
|
||||
npm install --registry=https://registry.npmmirror.com
|
||||
|
||||
@@ -164,7 +206,10 @@ return AjaxResult.success(result);
|
||||
- 非业务字段如 `create_by`、`create_time` 由后端自动维护
|
||||
- 前端表单不要暴露通用审计字段
|
||||
- 新增菜单、字典、初始化数据时,同步补充 SQL 脚本
|
||||
- 执行数据库脚本或导入数据库前,需确认客户端会话字符集为 `utf8mb4`;涉及中文插入、更新、导入时默认使用 `bin/mysql_utf8_exec.sh`
|
||||
- 执行数据库脚本或导入数据库前,需确认客户端会话字符集为 `utf8mb4`
|
||||
- 涉及中文插入、更新、导入时默认使用 `bin/mysql_utf8_exec.sh`
|
||||
- 所有系统表和业务表的表级、字符字段级排序规则统一为 `utf8mb4_general_ci`
|
||||
- 新增建表 SQL、字段追加 SQL、表结构修复 SQL 必须显式声明字符集与排序规则,避免因默认排序规则漂移导致联表或条件查询报错
|
||||
|
||||
### 前端规范
|
||||
|
||||
@@ -225,15 +270,10 @@ ccdi/
|
||||
### 主要业务代码分布
|
||||
|
||||
- `ccdi-info-collection/src/main/java/com/ruoyi/info/collection/`
|
||||
- 含 `controller`、`domain`、`mapper`、`service`、`annotation`、`validation` 等目录
|
||||
- `ccdi-project/src/main/java/com/ruoyi/ccdi/project/`
|
||||
- 含 `config`、`controller`、`domain`、`mapper`、`service`
|
||||
- `ccdi-lsfx/src/main/java/com/ruoyi/lsfx/`
|
||||
- 含 `client`、`config`、`constants`、`controller`、`domain/request`、`domain/response`
|
||||
- `ruoyi-ui/src/views/`
|
||||
- 当前包含 `ccdi`、`ccdiBaseStaff`、`ccdiProject`、`ccdiPurchaseTransaction`、`ccdiIntermediary`、亲属关系、员工调动、招聘等业务页面
|
||||
- `ruoyi-ui/src/api/ccdi/`
|
||||
- 放置纪检初核业务 API 封装
|
||||
|
||||
### 添加新后端模块时
|
||||
|
||||
@@ -294,6 +334,9 @@ ccdi/
|
||||
- 只有历史资料或外部原始材料才放入 `assets/`
|
||||
- 如果移动了文档,需同步修正文档内引用路径
|
||||
- 若需求来自设计文档,默认同时沉淀后端与前端两份实施计划
|
||||
- 功能设计同时涉及前端和后端改动时,必须分别输出后端与前端两份实施计划;若仅涉及前端或仅涉及后端,则只输出对应实施计划;非前后端架构项目不强制拆分双文档
|
||||
- 每一次改动都需要留下实施文档,记录本次修改内容、影响范围与验证情况,实施记录优先放在 `docs/reports/implementation/`
|
||||
- 每次新增或修改设计文档、实施计划、实施记录前,都要先确认保存路径是否正确
|
||||
|
||||
---
|
||||
|
||||
@@ -304,3 +347,5 @@ ccdi/
|
||||
- `docker/backend`、`docker/frontend`、`docker/mock` 分别对应三类运行时镜像
|
||||
- `sql/migration/` 用于增量迁移脚本,新增修复脚本优先按日期或功能命名
|
||||
- 启动前后端或 Mock 服务做验证后,结束测试时要主动停止进程,避免残留占用端口
|
||||
- 前端相关安装、构建、调试、测试命令执行前,必须先通过 `nvm` 切换并确认 Node 版本
|
||||
|
||||
|
||||
BIN
assets/异常账户.xlsx
Normal file
BIN
assets/异常账户.xlsx
Normal file
Binary file not shown.
@@ -83,7 +83,7 @@ collect_pids() {
|
||||
fi
|
||||
fi
|
||||
|
||||
marker_pids=$(pgrep -f "$APP_MARKER" 2>/dev/null || true)
|
||||
marker_pids=$(pgrep -f -- "$APP_MARKER" 2>/dev/null || true)
|
||||
if [ -n "${marker_pids:-}" ]; then
|
||||
for pid in $marker_pids; do
|
||||
if is_managed_backend_pid "$pid"; then
|
||||
@@ -92,6 +92,15 @@ collect_pids() {
|
||||
done
|
||||
fi
|
||||
|
||||
port_pids=$(lsof -tiTCP:"$SERVER_PORT" -sTCP:LISTEN 2>/dev/null || true)
|
||||
if [ -n "${port_pids:-}" ]; then
|
||||
for pid in $port_pids; do
|
||||
if is_managed_backend_pid "$pid"; then
|
||||
all_pids="$all_pids $pid"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
unique_pids=""
|
||||
for pid in $all_pids; do
|
||||
case " $unique_pids " in
|
||||
|
||||
@@ -57,6 +57,12 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ccdi-lsfx</artifactId>
|
||||
<version>3.9.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.ruoyi.info.collection.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.page.TableSupport;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiEnterpriseBaseInfoAddDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiEnterpriseBaseInfoEditDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiEnterpriseBaseInfoQueryDTO;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiEnterpriseBaseInfoExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiEnterpriseBaseInfoVO;
|
||||
import com.ruoyi.info.collection.domain.vo.EnterpriseBaseInfoImportFailureVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportResultVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportStatusVO;
|
||||
import com.ruoyi.info.collection.service.ICcdiEnterpriseBaseInfoImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiEnterpriseBaseInfoService;
|
||||
import com.ruoyi.info.collection.utils.EasyExcelUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 实体库管理 Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-04-17
|
||||
*/
|
||||
@Tag(name = "实体库管理")
|
||||
@RestController
|
||||
@RequestMapping("/ccdi/enterpriseBaseInfo")
|
||||
public class CcdiEnterpriseBaseInfoController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private ICcdiEnterpriseBaseInfoService enterpriseBaseInfoService;
|
||||
|
||||
@Resource
|
||||
private ICcdiEnterpriseBaseInfoImportService enterpriseBaseInfoImportService;
|
||||
|
||||
@Operation(summary = "查询实体库列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:enterpriseBaseInfo:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CcdiEnterpriseBaseInfoQueryDTO queryDTO) {
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
Page<CcdiEnterpriseBaseInfoVO> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
Page<CcdiEnterpriseBaseInfoVO> result = enterpriseBaseInfoService.selectEnterpriseBaseInfoPage(page, queryDTO);
|
||||
return getDataTable(result.getRecords(), result.getTotal());
|
||||
}
|
||||
|
||||
@Operation(summary = "获取实体库详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:enterpriseBaseInfo:query')")
|
||||
@GetMapping("/{socialCreditCode}")
|
||||
public AjaxResult getInfo(@PathVariable String socialCreditCode) {
|
||||
return success(enterpriseBaseInfoService.selectEnterpriseBaseInfoById(socialCreditCode));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增实体库信息")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:enterpriseBaseInfo:add')")
|
||||
@Log(title = "实体库管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody CcdiEnterpriseBaseInfoAddDTO addDTO) {
|
||||
return toAjax(enterpriseBaseInfoService.insertEnterpriseBaseInfo(addDTO));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改实体库信息")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:enterpriseBaseInfo:edit')")
|
||||
@Log(title = "实体库管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody CcdiEnterpriseBaseInfoEditDTO editDTO) {
|
||||
return toAjax(enterpriseBaseInfoService.updateEnterpriseBaseInfo(editDTO));
|
||||
}
|
||||
|
||||
@Operation(summary = "删除实体库信息")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:enterpriseBaseInfo:remove')")
|
||||
@Log(title = "实体库管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{socialCreditCodes}")
|
||||
public AjaxResult remove(@PathVariable String[] socialCreditCodes) {
|
||||
return toAjax(enterpriseBaseInfoService.deleteEnterpriseBaseInfoByIds(socialCreditCodes));
|
||||
}
|
||||
|
||||
@Operation(summary = "下载导入模板")
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiEnterpriseBaseInfoExcel.class, "实体库管理");
|
||||
}
|
||||
|
||||
@Operation(summary = "导入实体库信息")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:enterpriseBaseInfo:import')")
|
||||
@Log(title = "实体库管理", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file) throws Exception {
|
||||
List<CcdiEnterpriseBaseInfoExcel> list = EasyExcelUtil.importExcel(file.getInputStream(), CcdiEnterpriseBaseInfoExcel.class);
|
||||
if (list == null || list.isEmpty()) {
|
||||
return error("至少需要一条数据");
|
||||
}
|
||||
|
||||
String taskId = enterpriseBaseInfoService.importEnterpriseBaseInfo(list);
|
||||
ImportResultVO result = new ImportResultVO();
|
||||
result.setTaskId(taskId);
|
||||
result.setStatus("PROCESSING");
|
||||
result.setMessage("导入任务已提交,正在后台处理");
|
||||
return AjaxResult.success("导入任务已提交,正在后台处理", result);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询导入状态")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:enterpriseBaseInfo:import')")
|
||||
@GetMapping("/importStatus/{taskId}")
|
||||
public AjaxResult getImportStatus(@PathVariable String taskId) {
|
||||
ImportStatusVO status = enterpriseBaseInfoImportService.getImportStatus(taskId);
|
||||
return success(status);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询导入失败记录")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:enterpriseBaseInfo:import')")
|
||||
@GetMapping("/importFailures/{taskId}")
|
||||
public TableDataInfo getImportFailures(@PathVariable String taskId,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
List<EnterpriseBaseInfoImportFailureVO> failures = enterpriseBaseInfoImportService.getImportFailures(taskId);
|
||||
int fromIndex = (pageNum - 1) * pageSize;
|
||||
if (fromIndex >= failures.size()) {
|
||||
return getDataTable(new ArrayList<>(), failures.size());
|
||||
}
|
||||
int toIndex = Math.min(fromIndex + pageSize, failures.size());
|
||||
return getDataTable(failures.subList(fromIndex, toIndex), failures.size());
|
||||
}
|
||||
}
|
||||
@@ -138,4 +138,30 @@ public class CcdiEnumController {
|
||||
}
|
||||
return AjaxResult.success(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实体风险等级选项
|
||||
*/
|
||||
@Operation(summary = "获取实体风险等级选项")
|
||||
@GetMapping("/enterpriseRiskLevel")
|
||||
public AjaxResult getEnterpriseRiskLevelOptions() {
|
||||
List<EnumOptionVO> options = new ArrayList<>();
|
||||
for (EnterpriseRiskLevel level : EnterpriseRiskLevel.values()) {
|
||||
options.add(new EnumOptionVO(level.getCode(), level.getDesc()));
|
||||
}
|
||||
return AjaxResult.success(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取企业来源选项
|
||||
*/
|
||||
@Operation(summary = "获取企业来源选项")
|
||||
@GetMapping("/enterpriseSource")
|
||||
public AjaxResult getEnterpriseSourceOptions() {
|
||||
List<EnumOptionVO> options = new ArrayList<>();
|
||||
for (EnterpriseSource source : EnterpriseSource.values()) {
|
||||
options.add(new EnumOptionVO(source.getCode(), source.getDesc()));
|
||||
}
|
||||
return AjaxResult.success(options);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@ package com.ruoyi.info.collection.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.info.collection.domain.dto.*;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiIntermediaryEntityExcel;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiIntermediaryEnterpriseRelationExcel;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiIntermediaryPersonExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.*;
|
||||
import com.ruoyi.info.collection.service.ICcdiIntermediaryEntityImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiIntermediaryEnterpriseRelationImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiIntermediaryPersonImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiIntermediaryService;
|
||||
import com.ruoyi.info.collection.utils.EasyExcelUtil;
|
||||
@@ -46,7 +46,7 @@ public class CcdiIntermediaryController extends BaseController {
|
||||
private ICcdiIntermediaryPersonImportService personImportService;
|
||||
|
||||
@Resource
|
||||
private ICcdiIntermediaryEntityImportService entityImportService;
|
||||
private ICcdiIntermediaryEnterpriseRelationImportService enterpriseRelationImportService;
|
||||
|
||||
/**
|
||||
* 查询中介列表
|
||||
@@ -72,6 +72,26 @@ public class CcdiIntermediaryController extends BaseController {
|
||||
return success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询中介亲属列表
|
||||
*/
|
||||
@Operation(summary = "查询中介亲属列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:query')")
|
||||
@GetMapping("/{bizId}/relatives")
|
||||
public AjaxResult getRelativeList(@PathVariable String bizId) {
|
||||
return success(intermediaryService.selectIntermediaryRelativeList(bizId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询中介亲属详情
|
||||
*/
|
||||
@Operation(summary = "查询中介亲属详情")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:query')")
|
||||
@GetMapping("/relative/{relativeBizId}")
|
||||
public AjaxResult getRelativeInfo(@PathVariable String relativeBizId) {
|
||||
return success(intermediaryService.selectIntermediaryRelativeDetail(relativeBizId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询实体中介详情
|
||||
*/
|
||||
@@ -105,6 +125,28 @@ public class CcdiIntermediaryController extends BaseController {
|
||||
return toAjax(intermediaryService.updateIntermediaryPerson(editDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增中介亲属
|
||||
*/
|
||||
@Operation(summary = "新增中介亲属")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:add')")
|
||||
@Log(title = "中介亲属", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/{bizId}/relative")
|
||||
public AjaxResult addRelative(@PathVariable String bizId, @Validated @RequestBody CcdiIntermediaryRelativeAddDTO addDTO) {
|
||||
return toAjax(intermediaryService.insertIntermediaryRelative(bizId, addDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改中介亲属
|
||||
*/
|
||||
@Operation(summary = "修改中介亲属")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:edit')")
|
||||
@Log(title = "中介亲属", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/relative")
|
||||
public AjaxResult editRelative(@Validated @RequestBody CcdiIntermediaryRelativeEditDTO editDTO) {
|
||||
return toAjax(intermediaryService.updateIntermediaryRelative(editDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增实体中介
|
||||
*/
|
||||
@@ -127,6 +169,49 @@ public class CcdiIntermediaryController extends BaseController {
|
||||
return toAjax(intermediaryService.updateIntermediaryEntity(editDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询中介关联机构列表
|
||||
*/
|
||||
@Operation(summary = "查询中介关联机构列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:query')")
|
||||
@GetMapping("/{bizId}/enterprise-relations")
|
||||
public AjaxResult getEnterpriseRelationList(@PathVariable String bizId) {
|
||||
return success(intermediaryService.selectIntermediaryEnterpriseRelationList(bizId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询中介关联机构详情
|
||||
*/
|
||||
@Operation(summary = "查询中介关联机构详情")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:query')")
|
||||
@GetMapping("/enterprise-relation/{id}")
|
||||
public AjaxResult getEnterpriseRelationInfo(@PathVariable Long id) {
|
||||
return success(intermediaryService.selectIntermediaryEnterpriseRelationDetail(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增中介关联机构
|
||||
*/
|
||||
@Operation(summary = "新增中介关联机构")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:add')")
|
||||
@Log(title = "中介关联机构", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/{bizId}/enterprise-relation")
|
||||
public AjaxResult addEnterpriseRelation(@PathVariable String bizId,
|
||||
@Validated @RequestBody CcdiIntermediaryEnterpriseRelationAddDTO addDTO) {
|
||||
return toAjax(intermediaryService.insertIntermediaryEnterpriseRelation(bizId, addDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改中介关联机构
|
||||
*/
|
||||
@Operation(summary = "修改中介关联机构")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:edit')")
|
||||
@Log(title = "中介关联机构", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/enterprise-relation")
|
||||
public AjaxResult editEnterpriseRelation(@Validated @RequestBody CcdiIntermediaryEnterpriseRelationEditDTO editDTO) {
|
||||
return toAjax(intermediaryService.updateIntermediaryEnterpriseRelation(editDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除中介
|
||||
*/
|
||||
@@ -138,6 +223,28 @@ public class CcdiIntermediaryController extends BaseController {
|
||||
return toAjax(intermediaryService.deleteIntermediaryByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除中介亲属
|
||||
*/
|
||||
@Operation(summary = "删除中介亲属")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:remove')")
|
||||
@Log(title = "中介亲属", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/relative/{relativeBizId}")
|
||||
public AjaxResult removeRelative(@PathVariable String relativeBizId) {
|
||||
return toAjax(intermediaryService.deleteIntermediaryRelative(relativeBizId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除中介关联机构
|
||||
*/
|
||||
@Operation(summary = "删除中介关联机构")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:remove')")
|
||||
@Log(title = "中介关联机构", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/enterprise-relation/{id}")
|
||||
public AjaxResult removeEnterpriseRelation(@PathVariable Long id) {
|
||||
return toAjax(intermediaryService.deleteIntermediaryEnterpriseRelation(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验人员ID唯一性
|
||||
*/
|
||||
@@ -170,10 +277,10 @@ public class CcdiIntermediaryController extends BaseController {
|
||||
/**
|
||||
* 下载实体中介导入模板
|
||||
*/
|
||||
@Operation(summary = "下载实体中介导入模板")
|
||||
@PostMapping("/importEntityTemplate")
|
||||
public void importEntityTemplate(HttpServletResponse response) {
|
||||
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiIntermediaryEntityExcel.class, "实体中介信息");
|
||||
@Operation(summary = "下载中介实体关联关系导入模板")
|
||||
@PostMapping("/importEnterpriseRelationTemplate")
|
||||
public void importEnterpriseRelationTemplate(HttpServletResponse response) {
|
||||
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiIntermediaryEnterpriseRelationExcel.class, "中介实体关联关系信息");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,20 +313,19 @@ public class CcdiIntermediaryController extends BaseController {
|
||||
/**
|
||||
* 导入实体中介数据(异步)
|
||||
*/
|
||||
@Operation(summary = "导入实体中介数据")
|
||||
@Operation(summary = "导入中介实体关联关系数据")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:import')")
|
||||
@Log(title = "实体中介", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importEntityData")
|
||||
public AjaxResult importEntityData(MultipartFile file) throws Exception {
|
||||
List<CcdiIntermediaryEntityExcel> list = EasyExcelUtil.importExcel(
|
||||
file.getInputStream(), CcdiIntermediaryEntityExcel.class);
|
||||
@Log(title = "中介实体关联关系", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importEnterpriseRelationData")
|
||||
public AjaxResult importEnterpriseRelationData(MultipartFile file) throws Exception {
|
||||
List<CcdiIntermediaryEnterpriseRelationExcel> list = EasyExcelUtil.importExcel(
|
||||
file.getInputStream(), CcdiIntermediaryEnterpriseRelationExcel.class);
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return error("至少需要一条数据");
|
||||
}
|
||||
|
||||
// 提交异步任务
|
||||
String taskId = intermediaryService.importIntermediaryEntity(list);
|
||||
String taskId = intermediaryService.importIntermediaryEnterpriseRelation(list);
|
||||
|
||||
// 立即返回,不等待后台任务完成
|
||||
ImportResultVO result = new ImportResultVO();
|
||||
@@ -276,12 +382,12 @@ public class CcdiIntermediaryController extends BaseController {
|
||||
/**
|
||||
* 查询实体中介导入状态
|
||||
*/
|
||||
@Operation(summary = "查询实体中介导入状态")
|
||||
@Operation(summary = "查询中介实体关联关系导入状态")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:import')")
|
||||
@GetMapping("/importEntityStatus/{taskId}")
|
||||
public AjaxResult getEntityImportStatus(@PathVariable String taskId) {
|
||||
@GetMapping("/importEnterpriseRelationStatus/{taskId}")
|
||||
public AjaxResult getEnterpriseRelationImportStatus(@PathVariable String taskId) {
|
||||
try {
|
||||
ImportStatusVO status = entityImportService.getImportStatus(taskId);
|
||||
ImportStatusVO status = enterpriseRelationImportService.getImportStatus(taskId);
|
||||
return success(status);
|
||||
} catch (Exception e) {
|
||||
return error(e.getMessage());
|
||||
@@ -289,18 +395,18 @@ public class CcdiIntermediaryController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询实体中介导入失败记录
|
||||
* 查询中介实体关联关系导入失败记录
|
||||
*/
|
||||
@Operation(summary = "查询实体中介导入失败记录")
|
||||
@Operation(summary = "查询中介实体关联关系导入失败记录")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:import')")
|
||||
@GetMapping("/importEntityFailures/{taskId}")
|
||||
public TableDataInfo getEntityImportFailures(
|
||||
@GetMapping("/importEnterpriseRelationFailures/{taskId}")
|
||||
public TableDataInfo getEnterpriseRelationImportFailures(
|
||||
@PathVariable String taskId,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
|
||||
List<IntermediaryEntityImportFailureVO> failures =
|
||||
entityImportService.getImportFailures(taskId);
|
||||
List<IntermediaryEnterpriseRelationImportFailureVO> failures =
|
||||
enterpriseRelationImportService.getImportFailures(taskId);
|
||||
|
||||
// 手动分页
|
||||
int fromIndex = (pageNum - 1) * pageSize;
|
||||
@@ -311,7 +417,7 @@ public class CcdiIntermediaryController extends BaseController {
|
||||
return getDataTable(new ArrayList<>(), failures.size());
|
||||
}
|
||||
|
||||
List<IntermediaryEntityImportFailureVO> pageData = failures.subList(fromIndex, toIndex);
|
||||
List<IntermediaryEnterpriseRelationImportFailureVO> pageData = failures.subList(fromIndex, toIndex);
|
||||
|
||||
return getDataTable(pageData, failures.size());
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -56,6 +57,42 @@ public class CcdiAccountInfo implements Serializable {
|
||||
/** 币种 */
|
||||
private String currency;
|
||||
|
||||
/** 是否实控账户:0-否 1-是 */
|
||||
@TableField("is_self_account")
|
||||
private Integer isActualControl;
|
||||
|
||||
/** 月均交易笔数 */
|
||||
@TableField("monthly_avg_trans_count")
|
||||
private Integer avgMonthTxnCount;
|
||||
|
||||
/** 月均交易金额 */
|
||||
@TableField("monthly_avg_trans_amount")
|
||||
private BigDecimal avgMonthTxnAmount;
|
||||
|
||||
/** 交易频率等级 */
|
||||
@TableField("trans_freq_type")
|
||||
private String txnFrequencyLevel;
|
||||
|
||||
/** 借方单笔最高额 */
|
||||
@TableField("dr_max_single_amount")
|
||||
private BigDecimal debitSingleMaxAmount;
|
||||
|
||||
/** 贷方单笔最高额 */
|
||||
@TableField("cr_max_single_amount")
|
||||
private BigDecimal creditSingleMaxAmount;
|
||||
|
||||
/** 借方日累计最高额 */
|
||||
@TableField("dr_max_daily_amount")
|
||||
private BigDecimal debitDailyMaxAmount;
|
||||
|
||||
/** 贷方日累计最高额 */
|
||||
@TableField("cr_max_daily_amount")
|
||||
private BigDecimal creditDailyMaxAmount;
|
||||
|
||||
/** 风险等级 */
|
||||
@TableField("trans_risk_level")
|
||||
private String txnRiskLevel;
|
||||
|
||||
/** 状态:1-正常 2-已销户 */
|
||||
private Integer status;
|
||||
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
package com.ruoyi.info.collection.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 账户分析结果对象 ccdi_account_result
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-04-13
|
||||
*/
|
||||
@Data
|
||||
@TableName("ccdi_account_result")
|
||||
public class CcdiAccountResult implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
@TableId(value = "result_id", type = IdType.AUTO)
|
||||
private Long resultId;
|
||||
|
||||
/** 账户号码 */
|
||||
private String accountNo;
|
||||
|
||||
/** 是否实控账户:0-否 1-是 */
|
||||
@TableField("is_self_account")
|
||||
private Integer isActualControl;
|
||||
|
||||
/** 月均交易笔数 */
|
||||
@TableField("monthly_avg_trans_count")
|
||||
private Integer avgMonthTxnCount;
|
||||
|
||||
/** 月均交易金额 */
|
||||
@TableField("monthly_avg_trans_amount")
|
||||
private BigDecimal avgMonthTxnAmount;
|
||||
|
||||
/** 交易频率等级 */
|
||||
@TableField("trans_freq_type")
|
||||
private String txnFrequencyLevel;
|
||||
|
||||
/** 借方单笔最高额 */
|
||||
@TableField("dr_max_single_amount")
|
||||
private BigDecimal debitSingleMaxAmount;
|
||||
|
||||
/** 贷方单笔最高额 */
|
||||
@TableField("cr_max_single_amount")
|
||||
private BigDecimal creditSingleMaxAmount;
|
||||
|
||||
/** 借方日累计最高额 */
|
||||
@TableField("dr_max_daily_amount")
|
||||
private BigDecimal debitDailyMaxAmount;
|
||||
|
||||
/** 贷方日累计最高额 */
|
||||
@TableField("cr_max_daily_amount")
|
||||
private BigDecimal creditDailyMaxAmount;
|
||||
|
||||
/** 风险等级 */
|
||||
@TableField("trans_risk_level")
|
||||
private String txnRiskLevel;
|
||||
|
||||
/** 创建者 */
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
/** 更新者 */
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间 */
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -43,6 +43,10 @@ public class CcdiBaseStaff implements Serializable {
|
||||
/** 入职时间 */
|
||||
private Date hireDate;
|
||||
|
||||
/** 是否党员:0-否 1-是 */
|
||||
@TableField("is_party_member")
|
||||
private Integer partyMember;
|
||||
|
||||
/** 状态 */
|
||||
private String status;
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public class CcdiBizIntermediary implements Serializable {
|
||||
/** 职位 */
|
||||
private String position;
|
||||
|
||||
/** 关联人员ID */
|
||||
/** 关联中介本人证件号码 */
|
||||
private String relatedNumId;
|
||||
|
||||
/** 数据来源,MANUAL:手动录入, SYSTEM:系统同步, IMPORT:批量导入, API:接口获取 */
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.ruoyi.info.collection.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 中介关联机构关系对象 ccdi_intermediary_enterprise_relation
|
||||
*/
|
||||
@Data
|
||||
@TableName("ccdi_intermediary_enterprise_relation")
|
||||
public class CcdiIntermediaryEnterpriseRelation implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private String intermediaryBizId;
|
||||
|
||||
private String socialCreditCode;
|
||||
|
||||
private String relationPersonPost;
|
||||
|
||||
private String remark;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createdBy;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String updatedBy;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -53,6 +53,10 @@ public class CcdiBaseStaffAddDTO implements Serializable {
|
||||
/** 入职时间 */
|
||||
private Date hireDate;
|
||||
|
||||
/** 是否党员:0-否 1-是 */
|
||||
@NotNull(message = "是否党员不能为空")
|
||||
private Integer partyMember;
|
||||
|
||||
/** 状态 */
|
||||
@NotBlank(message = "状态不能为空")
|
||||
private String status;
|
||||
|
||||
@@ -52,6 +52,10 @@ public class CcdiBaseStaffEditDTO implements Serializable {
|
||||
/** 入职时间 */
|
||||
private Date hireDate;
|
||||
|
||||
/** 是否党员:0-否 1-是 */
|
||||
@NotNull(message = "是否党员不能为空")
|
||||
private Integer partyMember;
|
||||
|
||||
/** 状态 */
|
||||
private String status;
|
||||
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.ruoyi.info.collection.domain.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 实体库管理新增 DTO
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-04-17
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "实体库管理新增DTO")
|
||||
public class CcdiEnterpriseBaseInfoAddDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "统一社会信用代码")
|
||||
@NotBlank(message = "统一社会信用代码不能为空")
|
||||
@Pattern(regexp = "^[0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}$", message = "统一社会信用代码格式不正确")
|
||||
private String socialCreditCode;
|
||||
|
||||
@Schema(description = "企业名称")
|
||||
@NotBlank(message = "企业名称不能为空")
|
||||
@Size(max = 200, message = "企业名称长度不能超过200个字符")
|
||||
private String enterpriseName;
|
||||
|
||||
@Schema(description = "企业类型")
|
||||
@Size(max = 50, message = "企业类型长度不能超过50个字符")
|
||||
private String enterpriseType;
|
||||
|
||||
@Schema(description = "企业性质")
|
||||
@Size(max = 50, message = "企业性质长度不能超过50个字符")
|
||||
private String enterpriseNature;
|
||||
|
||||
@Schema(description = "行业分类")
|
||||
@Size(max = 100, message = "行业分类长度不能超过100个字符")
|
||||
private String industryClass;
|
||||
|
||||
@Schema(description = "所属行业")
|
||||
@Size(max = 100, message = "所属行业长度不能超过100个字符")
|
||||
private String industryName;
|
||||
|
||||
@Schema(description = "成立日期")
|
||||
private Date establishDate;
|
||||
|
||||
@Schema(description = "注册地址")
|
||||
@Size(max = 500, message = "注册地址长度不能超过500个字符")
|
||||
private String registerAddress;
|
||||
|
||||
@Schema(description = "法定代表人")
|
||||
@Size(max = 100, message = "法定代表人长度不能超过100个字符")
|
||||
private String legalRepresentative;
|
||||
|
||||
@Schema(description = "法定代表人证件类型")
|
||||
@Size(max = 50, message = "法定代表人证件类型长度不能超过50个字符")
|
||||
private String legalCertType;
|
||||
|
||||
@Schema(description = "法定代表人证件号码")
|
||||
@Size(max = 50, message = "法定代表人证件号码长度不能超过50个字符")
|
||||
private String legalCertNo;
|
||||
|
||||
@Schema(description = "股东1")
|
||||
@Size(max = 100, message = "股东1长度不能超过100个字符")
|
||||
private String shareholder1;
|
||||
|
||||
@Schema(description = "股东2")
|
||||
@Size(max = 100, message = "股东2长度不能超过100个字符")
|
||||
private String shareholder2;
|
||||
|
||||
@Schema(description = "股东3")
|
||||
@Size(max = 100, message = "股东3长度不能超过100个字符")
|
||||
private String shareholder3;
|
||||
|
||||
@Schema(description = "股东4")
|
||||
@Size(max = 100, message = "股东4长度不能超过100个字符")
|
||||
private String shareholder4;
|
||||
|
||||
@Schema(description = "股东5")
|
||||
@Size(max = 100, message = "股东5长度不能超过100个字符")
|
||||
private String shareholder5;
|
||||
|
||||
@Schema(description = "经营状态")
|
||||
@NotBlank(message = "经营状态不能为空")
|
||||
@Size(max = 50, message = "经营状态长度不能超过50个字符")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "风险等级")
|
||||
@NotBlank(message = "风险等级不能为空")
|
||||
private String riskLevel;
|
||||
|
||||
@Schema(description = "企业来源")
|
||||
@NotBlank(message = "企业来源不能为空")
|
||||
private String entSource;
|
||||
|
||||
@Schema(description = "数据来源")
|
||||
@NotBlank(message = "数据来源不能为空")
|
||||
private String dataSource;
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.ruoyi.info.collection.domain.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 实体库管理编辑 DTO
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-04-17
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "实体库管理编辑DTO")
|
||||
public class CcdiEnterpriseBaseInfoEditDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "统一社会信用代码")
|
||||
@NotBlank(message = "统一社会信用代码不能为空")
|
||||
@Pattern(regexp = "^[0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}$", message = "统一社会信用代码格式不正确")
|
||||
private String socialCreditCode;
|
||||
|
||||
@Schema(description = "企业名称")
|
||||
@NotBlank(message = "企业名称不能为空")
|
||||
@Size(max = 200, message = "企业名称长度不能超过200个字符")
|
||||
private String enterpriseName;
|
||||
|
||||
@Schema(description = "企业类型")
|
||||
@Size(max = 50, message = "企业类型长度不能超过50个字符")
|
||||
private String enterpriseType;
|
||||
|
||||
@Schema(description = "企业性质")
|
||||
@Size(max = 50, message = "企业性质长度不能超过50个字符")
|
||||
private String enterpriseNature;
|
||||
|
||||
@Schema(description = "行业分类")
|
||||
@Size(max = 100, message = "行业分类长度不能超过100个字符")
|
||||
private String industryClass;
|
||||
|
||||
@Schema(description = "所属行业")
|
||||
@Size(max = 100, message = "所属行业长度不能超过100个字符")
|
||||
private String industryName;
|
||||
|
||||
@Schema(description = "成立日期")
|
||||
private Date establishDate;
|
||||
|
||||
@Schema(description = "注册地址")
|
||||
@Size(max = 500, message = "注册地址长度不能超过500个字符")
|
||||
private String registerAddress;
|
||||
|
||||
@Schema(description = "法定代表人")
|
||||
@Size(max = 100, message = "法定代表人长度不能超过100个字符")
|
||||
private String legalRepresentative;
|
||||
|
||||
@Schema(description = "法定代表人证件类型")
|
||||
@Size(max = 50, message = "法定代表人证件类型长度不能超过50个字符")
|
||||
private String legalCertType;
|
||||
|
||||
@Schema(description = "法定代表人证件号码")
|
||||
@Size(max = 50, message = "法定代表人证件号码长度不能超过50个字符")
|
||||
private String legalCertNo;
|
||||
|
||||
@Schema(description = "股东1")
|
||||
@Size(max = 100, message = "股东1长度不能超过100个字符")
|
||||
private String shareholder1;
|
||||
|
||||
@Schema(description = "股东2")
|
||||
@Size(max = 100, message = "股东2长度不能超过100个字符")
|
||||
private String shareholder2;
|
||||
|
||||
@Schema(description = "股东3")
|
||||
@Size(max = 100, message = "股东3长度不能超过100个字符")
|
||||
private String shareholder3;
|
||||
|
||||
@Schema(description = "股东4")
|
||||
@Size(max = 100, message = "股东4长度不能超过100个字符")
|
||||
private String shareholder4;
|
||||
|
||||
@Schema(description = "股东5")
|
||||
@Size(max = 100, message = "股东5长度不能超过100个字符")
|
||||
private String shareholder5;
|
||||
|
||||
@Schema(description = "经营状态")
|
||||
@NotBlank(message = "经营状态不能为空")
|
||||
@Size(max = 50, message = "经营状态长度不能超过50个字符")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "风险等级")
|
||||
@NotBlank(message = "风险等级不能为空")
|
||||
private String riskLevel;
|
||||
|
||||
@Schema(description = "企业来源")
|
||||
@NotBlank(message = "企业来源不能为空")
|
||||
private String entSource;
|
||||
|
||||
@Schema(description = "数据来源")
|
||||
@NotBlank(message = "数据来源不能为空")
|
||||
private String dataSource;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.ruoyi.info.collection.domain.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 实体库管理查询 DTO
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-04-17
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "实体库管理查询DTO")
|
||||
public class CcdiEnterpriseBaseInfoQueryDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "企业名称")
|
||||
private String enterpriseName;
|
||||
|
||||
@Schema(description = "统一社会信用代码")
|
||||
private String socialCreditCode;
|
||||
|
||||
@Schema(description = "企业类型")
|
||||
private String enterpriseType;
|
||||
|
||||
@Schema(description = "企业性质")
|
||||
private String enterpriseNature;
|
||||
|
||||
@Schema(description = "行业分类")
|
||||
private String industryClass;
|
||||
|
||||
@Schema(description = "经营状态")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "风险等级")
|
||||
private String riskLevel;
|
||||
|
||||
@Schema(description = "企业来源")
|
||||
private String entSource;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.ruoyi.info.collection.domain.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 中介关联机构新增DTO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "中介关联机构新增DTO")
|
||||
public class CcdiIntermediaryEnterpriseRelationAddDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "统一社会信用代码")
|
||||
@NotBlank(message = "统一社会信用代码不能为空")
|
||||
@Size(max = 18, message = "统一社会信用代码长度不能超过18个字符")
|
||||
private String socialCreditCode;
|
||||
|
||||
@Schema(description = "关联角色/职务")
|
||||
@Size(max = 100, message = "关联角色/职务长度不能超过100个字符")
|
||||
private String relationPersonPost;
|
||||
|
||||
@Schema(description = "备注")
|
||||
@Size(max = 500, message = "备注长度不能超过500个字符")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.ruoyi.info.collection.domain.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 中介关联机构编辑DTO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "中介关联机构编辑DTO")
|
||||
public class CcdiIntermediaryEnterpriseRelationEditDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键ID")
|
||||
@NotNull(message = "主键ID不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "统一社会信用代码")
|
||||
@NotBlank(message = "统一社会信用代码不能为空")
|
||||
@Size(max = 18, message = "统一社会信用代码长度不能超过18个字符")
|
||||
private String socialCreditCode;
|
||||
|
||||
@Schema(description = "关联角色/职务")
|
||||
@Size(max = 100, message = "关联角色/职务长度不能超过100个字符")
|
||||
private String relationPersonPost;
|
||||
|
||||
@Schema(description = "备注")
|
||||
@Size(max = 500, message = "备注长度不能超过500个字符")
|
||||
private String remark;
|
||||
}
|
||||
@@ -67,8 +67,8 @@ public class CcdiIntermediaryPersonAddDTO implements Serializable {
|
||||
@Size(max = 100, message = "职位长度不能超过100个字符")
|
||||
private String position;
|
||||
|
||||
@Schema(description = "关联人员ID")
|
||||
@Size(max = 50, message = "关联人员ID长度不能超过50个字符")
|
||||
@Schema(description = "关联中介本人证件号码")
|
||||
@Size(max = 50, message = "关联中介本人证件号码长度不能超过50个字符")
|
||||
private String relatedNumId;
|
||||
|
||||
@Schema(description = "关联关系")
|
||||
|
||||
@@ -70,8 +70,8 @@ public class CcdiIntermediaryPersonEditDTO implements Serializable {
|
||||
@Size(max = 100, message = "职位长度不能超过100个字符")
|
||||
private String position;
|
||||
|
||||
@Schema(description = "关联人员ID")
|
||||
@Size(max = 50, message = "关联人员ID长度不能超过50个字符")
|
||||
@Schema(description = "关联中介本人证件号码")
|
||||
@Size(max = 50, message = "关联中介本人证件号码长度不能超过50个字符")
|
||||
private String relatedNumId;
|
||||
|
||||
@Schema(description = "关联关系")
|
||||
|
||||
@@ -19,12 +19,15 @@ public class CcdiIntermediaryQueryDTO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "姓名/机构名称")
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "证件号/统一社会信用代码")
|
||||
@Schema(description = "证件号")
|
||||
private String certificateNo;
|
||||
|
||||
@Schema(description = "中介类型(1=个人, 2=实体)")
|
||||
private String intermediaryType;
|
||||
@Schema(description = "记录类型(INTERMEDIARY/RELATIVE/ENTERPRISE_RELATION)")
|
||||
private String recordType;
|
||||
|
||||
@Schema(description = "关联中介信息(姓名或证件号)")
|
||||
private String relatedIntermediaryKeyword;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.ruoyi.info.collection.domain.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 中介亲属新增DTO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "中介亲属新增DTO")
|
||||
public class CcdiIntermediaryRelativeAddDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "姓名")
|
||||
@NotBlank(message = "姓名不能为空")
|
||||
@Size(max = 100, message = "姓名长度不能超过100个字符")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "人员类型")
|
||||
private String personType;
|
||||
|
||||
@Schema(description = "亲属关系")
|
||||
@NotBlank(message = "亲属关系不能为空")
|
||||
@Size(max = 50, message = "亲属关系长度不能超过50个字符")
|
||||
private String personSubType;
|
||||
|
||||
@Schema(description = "性别")
|
||||
private String gender;
|
||||
|
||||
@Schema(description = "证件类型")
|
||||
private String idType;
|
||||
|
||||
@Schema(description = "证件号码")
|
||||
@NotBlank(message = "证件号码不能为空")
|
||||
@Size(max = 50, message = "证件号码长度不能超过50个字符")
|
||||
private String personId;
|
||||
|
||||
@Schema(description = "手机号码")
|
||||
@Size(max = 20, message = "手机号码长度不能超过20个字符")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "微信号")
|
||||
@Size(max = 50, message = "微信号长度不能超过50个字符")
|
||||
private String wechatNo;
|
||||
|
||||
@Schema(description = "联系地址")
|
||||
@Size(max = 200, message = "联系地址长度不能超过200个字符")
|
||||
private String contactAddress;
|
||||
|
||||
@Schema(description = "所在公司")
|
||||
@Size(max = 200, message = "所在公司长度不能超过200个字符")
|
||||
private String company;
|
||||
|
||||
@Schema(description = "企业统一信用码")
|
||||
@Size(max = 50, message = "企业统一信用码长度不能超过50个字符")
|
||||
private String socialCreditCode;
|
||||
|
||||
@Schema(description = "职位")
|
||||
@Size(max = 100, message = "职位长度不能超过100个字符")
|
||||
private String position;
|
||||
|
||||
@Schema(description = "备注")
|
||||
@Size(max = 500, message = "备注长度不能超过500个字符")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.ruoyi.info.collection.domain.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 中介亲属编辑DTO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "中介亲属编辑DTO")
|
||||
public class CcdiIntermediaryRelativeEditDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "人员ID")
|
||||
@NotBlank(message = "人员ID不能为空")
|
||||
private String bizId;
|
||||
|
||||
@Schema(description = "姓名")
|
||||
@NotBlank(message = "姓名不能为空")
|
||||
@Size(max = 100, message = "姓名长度不能超过100个字符")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "人员类型")
|
||||
private String personType;
|
||||
|
||||
@Schema(description = "亲属关系")
|
||||
@NotBlank(message = "亲属关系不能为空")
|
||||
@Size(max = 50, message = "亲属关系长度不能超过50个字符")
|
||||
private String personSubType;
|
||||
|
||||
@Schema(description = "性别")
|
||||
private String gender;
|
||||
|
||||
@Schema(description = "证件类型")
|
||||
private String idType;
|
||||
|
||||
@Schema(description = "证件号码")
|
||||
@Size(max = 50, message = "证件号码长度不能超过50个字符")
|
||||
private String personId;
|
||||
|
||||
@Schema(description = "手机号码")
|
||||
@Size(max = 20, message = "手机号码长度不能超过20个字符")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "微信号")
|
||||
@Size(max = 50, message = "微信号长度不能超过50个字符")
|
||||
private String wechatNo;
|
||||
|
||||
@Schema(description = "联系地址")
|
||||
@Size(max = 200, message = "联系地址长度不能超过200个字符")
|
||||
private String contactAddress;
|
||||
|
||||
@Schema(description = "所在公司")
|
||||
@Size(max = 200, message = "所在公司长度不能超过200个字符")
|
||||
private String company;
|
||||
|
||||
@Schema(description = "企业统一信用码")
|
||||
@Size(max = 50, message = "企业统一信用码长度不能超过50个字符")
|
||||
private String socialCreditCode;
|
||||
|
||||
@Schema(description = "职位")
|
||||
@Size(max = 100, message = "职位长度不能超过100个字符")
|
||||
private String position;
|
||||
|
||||
@Schema(description = "备注")
|
||||
@Size(max = 500, message = "备注长度不能超过500个字符")
|
||||
private String remark;
|
||||
}
|
||||
@@ -63,8 +63,15 @@ public class CcdiBaseStaffExcel implements Serializable {
|
||||
@ColumnWidth(15)
|
||||
private Date hireDate;
|
||||
|
||||
/** 是否党员 */
|
||||
@ExcelProperty(value = "是否党员", index = 7)
|
||||
@ColumnWidth(12)
|
||||
@DictDropdown(dictType = "ccdi_yes_no_flag")
|
||||
@Required
|
||||
private Integer partyMember;
|
||||
|
||||
/** 状态 */
|
||||
@ExcelProperty(value = "状态", index = 7)
|
||||
@ExcelProperty(value = "状态", index = 8)
|
||||
@ColumnWidth(10)
|
||||
@DictDropdown(dictType = "ccdi_employee_status")
|
||||
@Required
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.ruoyi.info.collection.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;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 实体库管理 Excel 导入模板对象
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-04-17
|
||||
*/
|
||||
@Data
|
||||
public class CcdiEnterpriseBaseInfoExcel implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelProperty(value = "统一社会信用代码*", index = 0)
|
||||
@ColumnWidth(24)
|
||||
private String socialCreditCode;
|
||||
|
||||
@ExcelProperty(value = "企业名称*", index = 1)
|
||||
@ColumnWidth(30)
|
||||
private String enterpriseName;
|
||||
|
||||
@ExcelProperty(value = "企业类型", index = 2)
|
||||
@ColumnWidth(18)
|
||||
@DictDropdown(dictType = "ccdi_entity_type")
|
||||
private String enterpriseType;
|
||||
|
||||
@ExcelProperty(value = "企业性质", index = 3)
|
||||
@ColumnWidth(18)
|
||||
@DictDropdown(dictType = "ccdi_enterprise_nature")
|
||||
private String enterpriseNature;
|
||||
|
||||
@ExcelProperty(value = "行业分类", index = 4)
|
||||
@ColumnWidth(18)
|
||||
private String industryClass;
|
||||
|
||||
@ExcelProperty(value = "所属行业", index = 5)
|
||||
@ColumnWidth(18)
|
||||
private String industryName;
|
||||
|
||||
@ExcelProperty(value = "成立日期", index = 6)
|
||||
@ColumnWidth(16)
|
||||
private Date establishDate;
|
||||
|
||||
@ExcelProperty(value = "注册地址", index = 7)
|
||||
@ColumnWidth(36)
|
||||
private String registerAddress;
|
||||
|
||||
@ExcelProperty(value = "法定代表人", index = 8)
|
||||
@ColumnWidth(18)
|
||||
private String legalRepresentative;
|
||||
|
||||
@ExcelProperty(value = "法定代表人证件类型", index = 9)
|
||||
@ColumnWidth(22)
|
||||
@DictDropdown(dictType = "ccdi_certificate_type")
|
||||
private String legalCertType;
|
||||
|
||||
@ExcelProperty(value = "法定代表人证件号码", index = 10)
|
||||
@ColumnWidth(24)
|
||||
private String legalCertNo;
|
||||
|
||||
@ExcelProperty(value = "股东1", index = 11)
|
||||
@ColumnWidth(18)
|
||||
private String shareholder1;
|
||||
|
||||
@ExcelProperty(value = "股东2", index = 12)
|
||||
@ColumnWidth(18)
|
||||
private String shareholder2;
|
||||
|
||||
@ExcelProperty(value = "股东3", index = 13)
|
||||
@ColumnWidth(18)
|
||||
private String shareholder3;
|
||||
|
||||
@ExcelProperty(value = "股东4", index = 14)
|
||||
@ColumnWidth(18)
|
||||
private String shareholder4;
|
||||
|
||||
@ExcelProperty(value = "股东5", index = 15)
|
||||
@ColumnWidth(18)
|
||||
private String shareholder5;
|
||||
|
||||
@ExcelProperty(value = "经营状态*", index = 16)
|
||||
@ColumnWidth(16)
|
||||
private String status;
|
||||
|
||||
@ExcelProperty(value = "风险等级*", index = 17)
|
||||
@ColumnWidth(16)
|
||||
private String riskLevel;
|
||||
|
||||
@ExcelProperty(value = "企业来源*", index = 18)
|
||||
@ColumnWidth(18)
|
||||
private String entSource;
|
||||
|
||||
@ExcelProperty(value = "数据来源*", index = 19)
|
||||
@ColumnWidth(18)
|
||||
private String dataSource;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.ruoyi.info.collection.domain.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 中介实体关联关系导入对象
|
||||
*/
|
||||
@Data
|
||||
public class CcdiIntermediaryEnterpriseRelationExcel implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 中介本人证件号码 */
|
||||
@ExcelProperty(value = "中介本人证件号码*", index = 0)
|
||||
@ColumnWidth(24)
|
||||
private String ownerPersonId;
|
||||
|
||||
/** 统一社会信用代码 */
|
||||
@ExcelProperty(value = "统一社会信用代码*", index = 1)
|
||||
@ColumnWidth(24)
|
||||
private String socialCreditCode;
|
||||
|
||||
/** 关联人职务 */
|
||||
@ExcelProperty(value = "关联人职务", index = 2)
|
||||
@ColumnWidth(20)
|
||||
private String relationPersonPost;
|
||||
|
||||
/** 备注 */
|
||||
@ExcelProperty(value = "备注", index = 3)
|
||||
@ColumnWidth(30)
|
||||
private String remark;
|
||||
}
|
||||
@@ -34,6 +34,7 @@ public class CcdiIntermediaryPersonExcel implements Serializable {
|
||||
/** 人员子类型 */
|
||||
@ExcelProperty(value = "人员子类型", index = 2)
|
||||
@ColumnWidth(15)
|
||||
@DictDropdown(dictType = "ccdi_person_sub_type")
|
||||
private String personSubType;
|
||||
|
||||
/** 性别 */
|
||||
@@ -83,19 +84,13 @@ public class CcdiIntermediaryPersonExcel implements Serializable {
|
||||
@ColumnWidth(15)
|
||||
private String position;
|
||||
|
||||
/** 关联人员ID */
|
||||
@ExcelProperty(value = "关联人员ID", index = 12)
|
||||
@ColumnWidth(15)
|
||||
/** 关联中介本人证件号码 */
|
||||
@ExcelProperty(value = "关联中介本人证件号码", index = 12)
|
||||
@ColumnWidth(24)
|
||||
private String relatedNumId;
|
||||
|
||||
/** 关系类型 */
|
||||
@ExcelProperty(value = "关系类型", index = 13)
|
||||
@ColumnWidth(15)
|
||||
@DictDropdown(dictType = "ccdi_relation_type")
|
||||
private String relationType;
|
||||
|
||||
/** 备注 */
|
||||
@ExcelProperty(value = "备注", index = 14)
|
||||
@ExcelProperty(value = "备注", index = 13)
|
||||
@ColumnWidth(30)
|
||||
private String remark;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ public class CcdiBaseStaffVO implements Serializable {
|
||||
/** 入职时间 */
|
||||
private Date hireDate;
|
||||
|
||||
/** 是否党员:0-否 1-是 */
|
||||
private Integer partyMember;
|
||||
|
||||
/** 状态 */
|
||||
private String status;
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.ruoyi.info.collection.domain.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 实体库管理 VO
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-04-17
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "实体库管理VO")
|
||||
public class CcdiEnterpriseBaseInfoVO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "统一社会信用代码")
|
||||
private String socialCreditCode;
|
||||
|
||||
@Schema(description = "企业名称")
|
||||
private String enterpriseName;
|
||||
|
||||
@Schema(description = "企业类型")
|
||||
private String enterpriseType;
|
||||
|
||||
@Schema(description = "企业性质")
|
||||
private String enterpriseNature;
|
||||
|
||||
@Schema(description = "行业分类")
|
||||
private String industryClass;
|
||||
|
||||
@Schema(description = "所属行业")
|
||||
private String industryName;
|
||||
|
||||
@Schema(description = "成立日期")
|
||||
private Date establishDate;
|
||||
|
||||
@Schema(description = "注册地址")
|
||||
private String registerAddress;
|
||||
|
||||
@Schema(description = "法定代表人")
|
||||
private String legalRepresentative;
|
||||
|
||||
@Schema(description = "法定代表人证件类型")
|
||||
private String legalCertType;
|
||||
|
||||
@Schema(description = "法定代表人证件号码")
|
||||
private String legalCertNo;
|
||||
|
||||
@Schema(description = "股东1")
|
||||
private String shareholder1;
|
||||
|
||||
@Schema(description = "股东2")
|
||||
private String shareholder2;
|
||||
|
||||
@Schema(description = "股东3")
|
||||
private String shareholder3;
|
||||
|
||||
@Schema(description = "股东4")
|
||||
private String shareholder4;
|
||||
|
||||
@Schema(description = "股东5")
|
||||
private String shareholder5;
|
||||
|
||||
@Schema(description = "经营状态")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "风险等级")
|
||||
private String riskLevel;
|
||||
|
||||
@Schema(description = "企业来源")
|
||||
private String entSource;
|
||||
|
||||
@Schema(description = "数据来源")
|
||||
private String dataSource;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.ruoyi.info.collection.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 中介关联机构VO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "中介关联机构VO")
|
||||
public class CcdiIntermediaryEnterpriseRelationVO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "所属中介ID")
|
||||
private String intermediaryBizId;
|
||||
|
||||
@Schema(description = "所属中介姓名")
|
||||
private String intermediaryName;
|
||||
|
||||
@Schema(description = "所属中介证件号")
|
||||
private String intermediaryPersonId;
|
||||
|
||||
@Schema(description = "统一社会信用代码")
|
||||
private String socialCreditCode;
|
||||
|
||||
@Schema(description = "机构名称")
|
||||
private String enterpriseName;
|
||||
|
||||
@Schema(description = "关联角色/职务")
|
||||
private String relationPersonPost;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class CcdiIntermediaryPersonDetailVO implements Serializable {
|
||||
@Schema(description = "职位")
|
||||
private String position;
|
||||
|
||||
@Schema(description = "关联人员ID")
|
||||
@Schema(description = "关联中介本人证件号码")
|
||||
private String relatedNumId;
|
||||
|
||||
@Schema(description = "关联关系")
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.ruoyi.info.collection.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 中介亲属VO
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "中介亲属VO")
|
||||
public class CcdiIntermediaryRelativeVO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "人员ID")
|
||||
private String bizId;
|
||||
|
||||
@Schema(description = "关联中介本人证件号码")
|
||||
private String relatedNumId;
|
||||
|
||||
@Schema(description = "姓名")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "人员类型")
|
||||
private String personType;
|
||||
|
||||
@Schema(description = "亲属关系")
|
||||
private String personSubType;
|
||||
|
||||
@Schema(description = "性别")
|
||||
private String gender;
|
||||
|
||||
@Schema(description = "证件类型")
|
||||
private String idType;
|
||||
|
||||
@Schema(description = "证件号码")
|
||||
private String personId;
|
||||
|
||||
@Schema(description = "手机号码")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "微信号")
|
||||
private String wechatNo;
|
||||
|
||||
@Schema(description = "联系地址")
|
||||
private String contactAddress;
|
||||
|
||||
@Schema(description = "所在公司")
|
||||
private String company;
|
||||
|
||||
@Schema(description = "企业统一信用码")
|
||||
private String socialCreditCode;
|
||||
|
||||
@Schema(description = "职位")
|
||||
private String position;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -21,32 +21,25 @@ public class CcdiIntermediaryVO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "ID")
|
||||
private String id;
|
||||
@Schema(description = "记录类型")
|
||||
private String recordType;
|
||||
|
||||
@Schema(description = "姓名/机构名称")
|
||||
@Schema(description = "记录ID")
|
||||
private String recordId;
|
||||
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "证件号/统一社会信用代码")
|
||||
@Schema(description = "证件号")
|
||||
private String certificateNo;
|
||||
|
||||
@Schema(description = "中介类型(1=个人, 2=实体)")
|
||||
private String intermediaryType;
|
||||
@Schema(description = "关联中介姓名")
|
||||
private String relatedIntermediaryName;
|
||||
|
||||
@Schema(description = "人员类型")
|
||||
private String personType;
|
||||
|
||||
@Schema(description = "公司")
|
||||
private String company;
|
||||
|
||||
@Schema(description = "数据来源")
|
||||
private String dataSource;
|
||||
@Schema(description = "关联关系")
|
||||
private String relationText;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.ruoyi.info.collection.domain.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 实体库导入失败记录 VO
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-04-17
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "实体库导入失败记录")
|
||||
public class EnterpriseBaseInfoImportFailureVO {
|
||||
|
||||
@Schema(description = "企业名称")
|
||||
private String enterpriseName;
|
||||
|
||||
@Schema(description = "统一社会信用代码")
|
||||
private String socialCreditCode;
|
||||
|
||||
@Schema(description = "企业类型")
|
||||
private String enterpriseType;
|
||||
|
||||
@Schema(description = "企业性质")
|
||||
private String enterpriseNature;
|
||||
|
||||
@Schema(description = "行业分类")
|
||||
private String industryClass;
|
||||
|
||||
@Schema(description = "所属行业")
|
||||
private String industryName;
|
||||
|
||||
@Schema(description = "法定代表人")
|
||||
private String legalRepresentative;
|
||||
|
||||
@Schema(description = "经营状态")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "风险等级")
|
||||
private String riskLevel;
|
||||
|
||||
@Schema(description = "企业来源")
|
||||
private String entSource;
|
||||
|
||||
@Schema(description = "数据来源")
|
||||
private String dataSource;
|
||||
|
||||
@Schema(description = "错误信息")
|
||||
private String errorMessage;
|
||||
}
|
||||
@@ -32,6 +32,9 @@ public class ImportFailureVO {
|
||||
@Schema(description = "年收入")
|
||||
private BigDecimal annualIncome;
|
||||
|
||||
@Schema(description = "是否党员:0-否 1-是")
|
||||
private Integer partyMember;
|
||||
|
||||
@Schema(description = "状态")
|
||||
private String status;
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.ruoyi.info.collection.domain.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 中介实体关联关系导入失败记录
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "中介实体关联关系导入失败记录")
|
||||
public class IntermediaryEnterpriseRelationImportFailureVO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "中介本人证件号码")
|
||||
private String ownerPersonId;
|
||||
|
||||
@Schema(description = "统一社会信用代码")
|
||||
private String socialCreditCode;
|
||||
|
||||
@Schema(description = "关联人职务")
|
||||
private String relationPersonPost;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "错误信息")
|
||||
private String errorMessage;
|
||||
}
|
||||
@@ -22,21 +22,45 @@ public class IntermediaryPersonImportFailureVO implements Serializable {
|
||||
@Schema(description = "姓名")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "证件号码")
|
||||
private String personId;
|
||||
|
||||
@Schema(description = "人员类型")
|
||||
private String personType;
|
||||
|
||||
@Schema(description = "人员子类型")
|
||||
private String personSubType;
|
||||
|
||||
@Schema(description = "性别")
|
||||
private String gender;
|
||||
|
||||
@Schema(description = "证件类型")
|
||||
private String idType;
|
||||
|
||||
@Schema(description = "证件号码")
|
||||
private String personId;
|
||||
|
||||
@Schema(description = "手机号码")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "微信号")
|
||||
private String wechatNo;
|
||||
|
||||
@Schema(description = "联系地址")
|
||||
private String contactAddress;
|
||||
|
||||
@Schema(description = "所在公司")
|
||||
private String company;
|
||||
|
||||
@Schema(description = "企业统一信用码")
|
||||
private String socialCreditCode;
|
||||
|
||||
@Schema(description = "职位")
|
||||
private String position;
|
||||
|
||||
@Schema(description = "关联中介本人证件号码")
|
||||
private String relatedNumId;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "错误信息")
|
||||
private String errorMessage;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.ruoyi.info.collection.enums;
|
||||
|
||||
/**
|
||||
* 实体风险等级枚举
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum EnterpriseRiskLevel {
|
||||
|
||||
HIGH("1", "高风险"),
|
||||
MEDIUM("2", "中风险"),
|
||||
LOW("3", "低风险");
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
EnterpriseRiskLevel(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public static String getDescByCode(String code) {
|
||||
for (EnterpriseRiskLevel value : values()) {
|
||||
if (value.code.equals(code)) {
|
||||
return value.desc;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean contains(String code) {
|
||||
for (EnterpriseRiskLevel value : values()) {
|
||||
if (value.code.equals(code)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String resolveCode(String value) {
|
||||
for (EnterpriseRiskLevel item : values()) {
|
||||
if (item.code.equals(value) || item.desc.equals(value)) {
|
||||
return item.code;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.ruoyi.info.collection.enums;
|
||||
|
||||
/**
|
||||
* 企业来源枚举
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum EnterpriseSource {
|
||||
|
||||
GENERAL("GENERAL", "一般企业"),
|
||||
EMP_RELATION("EMP_RELATION", "员工关系人"),
|
||||
CREDIT_CUSTOMER("CREDIT_CUSTOMER", "信贷客户"),
|
||||
INTERMEDIARY("INTERMEDIARY", "中介"),
|
||||
BOTH("BOTH", "兼有");
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
EnterpriseSource(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public static String getDescByCode(String code) {
|
||||
for (EnterpriseSource value : values()) {
|
||||
if (value.code.equals(code)) {
|
||||
return value.desc;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean contains(String code) {
|
||||
for (EnterpriseSource value : values()) {
|
||||
if (value.code.equals(code)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String resolveCode(String value) {
|
||||
for (EnterpriseSource item : values()) {
|
||||
if (item.code.equals(value) || item.desc.equals(value)) {
|
||||
return item.code;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.ruoyi.info.collection.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.info.collection.domain.CcdiAccountResult;
|
||||
|
||||
/**
|
||||
* 账户分析结果数据层
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-04-13
|
||||
*/
|
||||
public interface CcdiAccountResultMapper extends BaseMapper<CcdiAccountResult> {
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.ruoyi.info.collection.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.info.collection.domain.CcdiEnterpriseBaseInfo;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiEnterpriseBaseInfoQueryDTO;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiEnterpriseBaseInfoVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -16,6 +19,16 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface CcdiEnterpriseBaseInfoMapper extends BaseMapper<CcdiEnterpriseBaseInfo> {
|
||||
|
||||
/**
|
||||
* 分页查询实体库列表
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param queryDTO 查询条件
|
||||
* @return 分页结果
|
||||
*/
|
||||
Page<CcdiEnterpriseBaseInfoVO> selectEnterpriseBaseInfoPage(Page<CcdiEnterpriseBaseInfoVO> page,
|
||||
@Param("queryDTO") CcdiEnterpriseBaseInfoQueryDTO queryDTO);
|
||||
|
||||
/**
|
||||
* 批量插入实体中介
|
||||
*
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.ruoyi.info.collection.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.info.collection.domain.CcdiIntermediaryEnterpriseRelation;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiIntermediaryEnterpriseRelationVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 中介关联机构关系Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface CcdiIntermediaryEnterpriseRelationMapper extends BaseMapper<CcdiIntermediaryEnterpriseRelation> {
|
||||
|
||||
int insertBatch(@Param("list") List<CcdiIntermediaryEnterpriseRelation> list);
|
||||
|
||||
List<CcdiIntermediaryEnterpriseRelationVO> selectByIntermediaryBizId(@Param("bizId") String bizId);
|
||||
|
||||
CcdiIntermediaryEnterpriseRelationVO selectDetailById(@Param("id") Long id);
|
||||
|
||||
boolean existsByIntermediaryBizIdAndSocialCreditCode(@Param("bizId") String bizId,
|
||||
@Param("socialCreditCode") String socialCreditCode);
|
||||
|
||||
List<String> batchExistsByCombinations(@Param("combinations") List<String> combinations);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.ruoyi.info.collection.service;
|
||||
|
||||
import com.ruoyi.info.collection.domain.CcdiEnterpriseBaseInfo;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiEnterpriseBaseInfoExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.EnterpriseBaseInfoImportFailureVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportStatusVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 实体库管理导入 Service 接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-04-17
|
||||
*/
|
||||
public interface ICcdiEnterpriseBaseInfoImportService {
|
||||
|
||||
void importEnterpriseBaseInfoAsync(List<CcdiEnterpriseBaseInfoExcel> excelList, String taskId, String userName);
|
||||
|
||||
ImportStatusVO getImportStatus(String taskId);
|
||||
|
||||
List<EnterpriseBaseInfoImportFailureVO> getImportFailures(String taskId);
|
||||
|
||||
CcdiEnterpriseBaseInfo validateAndBuildEntity(CcdiEnterpriseBaseInfoExcel excel,
|
||||
Set<String> existingCreditCodes,
|
||||
Set<String> processedCreditCodes,
|
||||
String userName);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.ruoyi.info.collection.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiEnterpriseBaseInfoAddDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiEnterpriseBaseInfoEditDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiEnterpriseBaseInfoQueryDTO;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiEnterpriseBaseInfoExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiEnterpriseBaseInfoVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 实体库管理 Service 接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-04-17
|
||||
*/
|
||||
public interface ICcdiEnterpriseBaseInfoService {
|
||||
|
||||
Page<CcdiEnterpriseBaseInfoVO> selectEnterpriseBaseInfoPage(Page<CcdiEnterpriseBaseInfoVO> page,
|
||||
CcdiEnterpriseBaseInfoQueryDTO queryDTO);
|
||||
|
||||
CcdiEnterpriseBaseInfoVO selectEnterpriseBaseInfoById(String socialCreditCode);
|
||||
|
||||
int insertEnterpriseBaseInfo(CcdiEnterpriseBaseInfoAddDTO addDTO);
|
||||
|
||||
int updateEnterpriseBaseInfo(CcdiEnterpriseBaseInfoEditDTO editDTO);
|
||||
|
||||
int deleteEnterpriseBaseInfoByIds(String[] socialCreditCodes);
|
||||
|
||||
List<CcdiEnterpriseBaseInfoExcel> selectEnterpriseBaseInfoListForExport(CcdiEnterpriseBaseInfoQueryDTO queryDTO);
|
||||
|
||||
String importEnterpriseBaseInfo(List<CcdiEnterpriseBaseInfoExcel> excelList);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.ruoyi.info.collection.service;
|
||||
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiIntermediaryEnterpriseRelationExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportStatusVO;
|
||||
import com.ruoyi.info.collection.domain.vo.IntermediaryEnterpriseRelationImportFailureVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 中介实体关联关系异步导入服务接口
|
||||
*/
|
||||
public interface ICcdiIntermediaryEnterpriseRelationImportService {
|
||||
|
||||
/**
|
||||
* 异步导入中介实体关联关系
|
||||
*
|
||||
* @param excelList Excel数据
|
||||
* @param taskId 任务ID
|
||||
* @param userName 当前用户名
|
||||
*/
|
||||
void importAsync(List<CcdiIntermediaryEnterpriseRelationExcel> excelList, String taskId, String userName);
|
||||
|
||||
/**
|
||||
* 查询导入状态
|
||||
*
|
||||
* @param taskId 任务ID
|
||||
* @return 导入状态
|
||||
*/
|
||||
ImportStatusVO getImportStatus(String taskId);
|
||||
|
||||
/**
|
||||
* 查询导入失败记录
|
||||
*
|
||||
* @param taskId 任务ID
|
||||
* @return 失败记录
|
||||
*/
|
||||
List<IntermediaryEnterpriseRelationImportFailureVO> getImportFailures(String taskId);
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import com.ruoyi.info.collection.domain.vo.IntermediaryPersonImportFailureVO;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 个人中介异步导入Service接口
|
||||
* 中介信息异步导入Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-06
|
||||
@@ -15,7 +15,7 @@ import java.util.List;
|
||||
public interface ICcdiIntermediaryPersonImportService {
|
||||
|
||||
/**
|
||||
* 异步导入个人中介数据
|
||||
* 异步导入中介信息
|
||||
*
|
||||
* @param excelList Excel数据列表
|
||||
* @param taskId 任务ID
|
||||
|
||||
@@ -2,10 +2,13 @@ package com.ruoyi.info.collection.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.info.collection.domain.dto.*;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiIntermediaryEnterpriseRelationExcel;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiIntermediaryEntityExcel;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiIntermediaryPersonExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiIntermediaryEnterpriseRelationVO;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiIntermediaryEntityDetailVO;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiIntermediaryPersonDetailVO;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiIntermediaryRelativeVO;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiIntermediaryVO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -35,6 +38,22 @@ public interface ICcdiIntermediaryService {
|
||||
*/
|
||||
CcdiIntermediaryPersonDetailVO selectIntermediaryPersonDetail(String bizId);
|
||||
|
||||
/**
|
||||
* 查询中介亲属列表
|
||||
*
|
||||
* @param bizId 中介本人ID
|
||||
* @return 亲属列表
|
||||
*/
|
||||
List<CcdiIntermediaryRelativeVO> selectIntermediaryRelativeList(String bizId);
|
||||
|
||||
/**
|
||||
* 查询中介亲属详情
|
||||
*
|
||||
* @param relativeBizId 亲属ID
|
||||
* @return 亲属详情
|
||||
*/
|
||||
CcdiIntermediaryRelativeVO selectIntermediaryRelativeDetail(String relativeBizId);
|
||||
|
||||
/**
|
||||
* 查询实体中介详情
|
||||
*
|
||||
@@ -59,6 +78,31 @@ public interface ICcdiIntermediaryService {
|
||||
*/
|
||||
int updateIntermediaryPerson(CcdiIntermediaryPersonEditDTO editDTO);
|
||||
|
||||
/**
|
||||
* 新增中介亲属
|
||||
*
|
||||
* @param bizId 中介本人ID
|
||||
* @param addDTO 新增DTO
|
||||
* @return 结果
|
||||
*/
|
||||
int insertIntermediaryRelative(String bizId, CcdiIntermediaryRelativeAddDTO addDTO);
|
||||
|
||||
/**
|
||||
* 修改中介亲属
|
||||
*
|
||||
* @param editDTO 编辑DTO
|
||||
* @return 结果
|
||||
*/
|
||||
int updateIntermediaryRelative(CcdiIntermediaryRelativeEditDTO editDTO);
|
||||
|
||||
/**
|
||||
* 删除中介亲属
|
||||
*
|
||||
* @param relativeBizId 亲属ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteIntermediaryRelative(String relativeBizId);
|
||||
|
||||
/**
|
||||
* 新增实体中介
|
||||
*
|
||||
@@ -75,6 +119,47 @@ public interface ICcdiIntermediaryService {
|
||||
*/
|
||||
int updateIntermediaryEntity(CcdiIntermediaryEntityEditDTO editDTO);
|
||||
|
||||
/**
|
||||
* 查询中介关联机构列表
|
||||
*
|
||||
* @param bizId 中介本人ID
|
||||
* @return 关联机构列表
|
||||
*/
|
||||
List<CcdiIntermediaryEnterpriseRelationVO> selectIntermediaryEnterpriseRelationList(String bizId);
|
||||
|
||||
/**
|
||||
* 查询中介关联机构详情
|
||||
*
|
||||
* @param id 主键ID
|
||||
* @return 关联机构详情
|
||||
*/
|
||||
CcdiIntermediaryEnterpriseRelationVO selectIntermediaryEnterpriseRelationDetail(Long id);
|
||||
|
||||
/**
|
||||
* 新增中介关联机构
|
||||
*
|
||||
* @param bizId 中介本人ID
|
||||
* @param addDTO 新增DTO
|
||||
* @return 结果
|
||||
*/
|
||||
int insertIntermediaryEnterpriseRelation(String bizId, CcdiIntermediaryEnterpriseRelationAddDTO addDTO);
|
||||
|
||||
/**
|
||||
* 修改中介关联机构
|
||||
*
|
||||
* @param editDTO 编辑DTO
|
||||
* @return 结果
|
||||
*/
|
||||
int updateIntermediaryEnterpriseRelation(CcdiIntermediaryEnterpriseRelationEditDTO editDTO);
|
||||
|
||||
/**
|
||||
* 删除中介关联机构
|
||||
*
|
||||
* @param id 主键ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteIntermediaryEnterpriseRelation(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除中介
|
||||
*
|
||||
@@ -84,7 +169,7 @@ public interface ICcdiIntermediaryService {
|
||||
int deleteIntermediaryByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 校验人员ID唯一性
|
||||
* 校验中介本人证件号码唯一性
|
||||
*
|
||||
* @param personId 人员ID
|
||||
* @param bizId 排除的人员ID
|
||||
@@ -109,6 +194,14 @@ public interface ICcdiIntermediaryService {
|
||||
*/
|
||||
String importIntermediaryPerson(List<CcdiIntermediaryPersonExcel> list);
|
||||
|
||||
/**
|
||||
* 导入中介实体关联关系
|
||||
*
|
||||
* @param list Excel实体列表
|
||||
* @return 任务ID
|
||||
*/
|
||||
String importIntermediaryEnterpriseRelation(List<CcdiIntermediaryEnterpriseRelationExcel> list);
|
||||
|
||||
/**
|
||||
* 导入实体中介数据
|
||||
*
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.info.collection.domain.CcdiAccountInfo;
|
||||
import com.ruoyi.info.collection.domain.CcdiAccountResult;
|
||||
import com.ruoyi.info.collection.domain.CcdiBaseStaff;
|
||||
import com.ruoyi.info.collection.domain.CcdiStaffFmyRelation;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiAccountInfoAddDTO;
|
||||
@@ -16,7 +15,6 @@ import com.ruoyi.info.collection.domain.vo.CcdiAccountInfoVO;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiAccountRelationOptionVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportResult;
|
||||
import com.ruoyi.info.collection.mapper.CcdiAccountInfoMapper;
|
||||
import com.ruoyi.info.collection.mapper.CcdiAccountResultMapper;
|
||||
import com.ruoyi.info.collection.mapper.CcdiBaseStaffMapper;
|
||||
import com.ruoyi.info.collection.mapper.CcdiStaffFmyRelationMapper;
|
||||
import com.ruoyi.info.collection.service.ICcdiAccountInfoService;
|
||||
@@ -56,9 +54,6 @@ public class CcdiAccountInfoServiceImpl implements ICcdiAccountInfoService {
|
||||
@Resource
|
||||
private CcdiAccountInfoMapper accountInfoMapper;
|
||||
|
||||
@Resource
|
||||
private CcdiAccountResultMapper accountResultMapper;
|
||||
|
||||
@Resource
|
||||
private CcdiBaseStaffMapper baseStaffMapper;
|
||||
|
||||
@@ -87,9 +82,8 @@ public class CcdiAccountInfoServiceImpl implements ICcdiAccountInfoService {
|
||||
|
||||
CcdiAccountInfo accountInfo = new CcdiAccountInfo();
|
||||
BeanUtils.copyProperties(addDTO, accountInfo);
|
||||
int result = accountInfoMapper.insert(accountInfo);
|
||||
syncAccountResult(accountInfo.getBankScope(), null, accountInfo.getAccountNo(), addDTO);
|
||||
return result;
|
||||
prepareAnalysisFields(accountInfo);
|
||||
return accountInfoMapper.insert(accountInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -110,26 +104,13 @@ public class CcdiAccountInfoServiceImpl implements ICcdiAccountInfoService {
|
||||
|
||||
CcdiAccountInfo accountInfo = new CcdiAccountInfo();
|
||||
BeanUtils.copyProperties(editDTO, accountInfo);
|
||||
int result = accountInfoMapper.updateById(accountInfo);
|
||||
syncAccountResult(accountInfo.getBankScope(), existing, accountInfo.getAccountNo(), editDTO);
|
||||
return result;
|
||||
prepareAnalysisFields(accountInfo);
|
||||
return accountInfoMapper.updateById(accountInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int deleteAccountInfoByIds(Long[] ids) {
|
||||
List<CcdiAccountInfo> accountList = accountInfoMapper.selectBatchIds(Arrays.asList(ids));
|
||||
if (!accountList.isEmpty()) {
|
||||
List<String> accountNos = accountList.stream()
|
||||
.map(CcdiAccountInfo::getAccountNo)
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.toList();
|
||||
if (!accountNos.isEmpty()) {
|
||||
LambdaQueryWrapper<CcdiAccountResult> resultWrapper = new LambdaQueryWrapper<>();
|
||||
resultWrapper.in(CcdiAccountResult::getAccountNo, accountNos);
|
||||
accountResultMapper.delete(resultWrapper);
|
||||
}
|
||||
}
|
||||
return accountInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
@@ -250,51 +231,38 @@ public class CcdiAccountInfoServiceImpl implements ICcdiAccountInfoService {
|
||||
}
|
||||
}
|
||||
|
||||
private void syncAccountResult(String newBankScope, CcdiAccountInfo existing, String accountNo, Object dto) {
|
||||
String oldBankScope = existing == null ? null : existing.getBankScope();
|
||||
String oldAccountNo = existing == null ? null : existing.getAccountNo();
|
||||
|
||||
if (existing != null && "EXTERNAL".equals(oldBankScope)
|
||||
&& (!"EXTERNAL".equals(newBankScope) || !StringUtils.equals(oldAccountNo, accountNo))) {
|
||||
LambdaQueryWrapper<CcdiAccountResult> deleteWrapper = new LambdaQueryWrapper<>();
|
||||
deleteWrapper.eq(CcdiAccountResult::getAccountNo, oldAccountNo);
|
||||
accountResultMapper.delete(deleteWrapper);
|
||||
}
|
||||
|
||||
if (!"EXTERNAL".equals(newBankScope)) {
|
||||
private void prepareAnalysisFields(CcdiAccountInfo accountInfo) {
|
||||
if (!"EXTERNAL".equals(accountInfo.getBankScope())) {
|
||||
clearAnalysisFields(accountInfo);
|
||||
return;
|
||||
}
|
||||
if (accountInfo.getIsActualControl() == null) {
|
||||
accountInfo.setIsActualControl(1);
|
||||
}
|
||||
if (accountInfo.getAvgMonthTxnCount() == null) {
|
||||
accountInfo.setAvgMonthTxnCount(0);
|
||||
}
|
||||
if (accountInfo.getAvgMonthTxnAmount() == null) {
|
||||
accountInfo.setAvgMonthTxnAmount(BigDecimal.ZERO);
|
||||
}
|
||||
if (StringUtils.isEmpty(accountInfo.getTxnFrequencyLevel())) {
|
||||
accountInfo.setTxnFrequencyLevel("MEDIUM");
|
||||
}
|
||||
if (StringUtils.isEmpty(accountInfo.getTxnRiskLevel())) {
|
||||
accountInfo.setTxnRiskLevel("LOW");
|
||||
}
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<CcdiAccountResult> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CcdiAccountResult::getAccountNo, accountNo);
|
||||
CcdiAccountResult existingResult = accountResultMapper.selectOne(wrapper);
|
||||
|
||||
CcdiAccountResult accountResult = new CcdiAccountResult();
|
||||
BeanUtils.copyProperties(dto, accountResult);
|
||||
accountResult.setAccountNo(accountNo);
|
||||
if (accountResult.getIsActualControl() == null) {
|
||||
accountResult.setIsActualControl(1);
|
||||
}
|
||||
if (accountResult.getAvgMonthTxnCount() == null) {
|
||||
accountResult.setAvgMonthTxnCount(0);
|
||||
}
|
||||
if (accountResult.getAvgMonthTxnAmount() == null) {
|
||||
accountResult.setAvgMonthTxnAmount(BigDecimal.ZERO);
|
||||
}
|
||||
if (StringUtils.isEmpty(accountResult.getTxnFrequencyLevel())) {
|
||||
accountResult.setTxnFrequencyLevel("MEDIUM");
|
||||
}
|
||||
if (StringUtils.isEmpty(accountResult.getTxnRiskLevel())) {
|
||||
accountResult.setTxnRiskLevel("LOW");
|
||||
}
|
||||
|
||||
if (existingResult == null) {
|
||||
accountResultMapper.insert(accountResult);
|
||||
return;
|
||||
}
|
||||
|
||||
accountResult.setResultId(existingResult.getResultId());
|
||||
accountResultMapper.updateById(accountResult);
|
||||
private void clearAnalysisFields(CcdiAccountInfo accountInfo) {
|
||||
accountInfo.setIsActualControl(null);
|
||||
accountInfo.setAvgMonthTxnCount(null);
|
||||
accountInfo.setAvgMonthTxnAmount(null);
|
||||
accountInfo.setTxnFrequencyLevel(null);
|
||||
accountInfo.setDebitSingleMaxAmount(null);
|
||||
accountInfo.setCreditSingleMaxAmount(null);
|
||||
accountInfo.setDebitDailyMaxAmount(null);
|
||||
accountInfo.setCreditDailyMaxAmount(null);
|
||||
accountInfo.setTxnRiskLevel(null);
|
||||
}
|
||||
|
||||
private void validateAmount(BigDecimal amount, String fieldLabel) {
|
||||
|
||||
@@ -320,6 +320,9 @@ public class CcdiBaseStaffImportServiceImpl implements ICcdiBaseStaffImportServi
|
||||
if (StringUtils.isEmpty(addDTO.getPhone())) {
|
||||
throw new RuntimeException("电话不能为空");
|
||||
}
|
||||
if (addDTO.getPartyMember() == null) {
|
||||
throw new RuntimeException("是否党员不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(addDTO.getStatus())) {
|
||||
throw new RuntimeException("状态不能为空");
|
||||
}
|
||||
@@ -357,6 +360,9 @@ public class CcdiBaseStaffImportServiceImpl implements ICcdiBaseStaffImportServi
|
||||
if (!"0".equals(addDTO.getStatus()) && !"1".equals(addDTO.getStatus())) {
|
||||
throw new RuntimeException("状态只能填写'在职'或'离职'");
|
||||
}
|
||||
if (addDTO.getPartyMember() != 0 && addDTO.getPartyMember() != 1) {
|
||||
throw new RuntimeException("是否党员只能填写'0'或'1'");
|
||||
}
|
||||
|
||||
validateAnnualIncome(addDTO.getAnnualIncome(), "年收入");
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ public class CcdiBaseStaffServiceImpl implements ICcdiBaseStaffService {
|
||||
CcdiBaseStaff staff = baseStaffMapper.selectById(staffId);
|
||||
CcdiBaseStaffVO vo = convertToVO(staff);
|
||||
if (staff != null) {
|
||||
vo.setAssetInfoList(assetInfoService.selectByFamilyId(staff.getIdCard()).stream().map(asset -> {
|
||||
vo.setAssetInfoList(assetInfoService.selectByFamilyIdAndPersonId(staff.getIdCard(), staff.getIdCard()).stream().map(asset -> {
|
||||
CcdiAssetInfoVO assetInfoVO = new CcdiAssetInfoVO();
|
||||
BeanUtils.copyProperties(asset, assetInfoVO);
|
||||
return assetInfoVO;
|
||||
@@ -131,6 +131,7 @@ public class CcdiBaseStaffServiceImpl implements ICcdiBaseStaffService {
|
||||
@Transactional
|
||||
public int insertBaseStaff(CcdiBaseStaffAddDTO addDTO) {
|
||||
validateAnnualIncome(addDTO.getAnnualIncome(), "年收入");
|
||||
validatePartyMember(addDTO.getPartyMember(), "是否党员");
|
||||
// 检查员工ID唯一性
|
||||
if (baseStaffMapper.selectById(addDTO.getStaffId()) != null) {
|
||||
throw new RuntimeException("该员工ID已存在");
|
||||
@@ -161,6 +162,7 @@ public class CcdiBaseStaffServiceImpl implements ICcdiBaseStaffService {
|
||||
@Transactional
|
||||
public int updateBaseStaff(CcdiBaseStaffEditDTO editDTO) {
|
||||
validateAnnualIncome(editDTO.getAnnualIncome(), "年收入");
|
||||
validatePartyMember(editDTO.getPartyMember(), "是否党员");
|
||||
CcdiBaseStaff existing = baseStaffMapper.selectById(editDTO.getStaffId());
|
||||
if (existing == null) {
|
||||
throw new RuntimeException("员工不存在");
|
||||
@@ -291,4 +293,13 @@ public class CcdiBaseStaffServiceImpl implements ICcdiBaseStaffService {
|
||||
}
|
||||
}
|
||||
|
||||
private void validatePartyMember(Integer partyMember, String fieldLabel) {
|
||||
if (partyMember == null) {
|
||||
throw new RuntimeException(fieldLabel + "不能为空");
|
||||
}
|
||||
if (partyMember != 0 && partyMember != 1) {
|
||||
throw new RuntimeException(fieldLabel + "只能填写'0'或'1'");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
package com.ruoyi.info.collection.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.info.collection.domain.CcdiEnterpriseBaseInfo;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiEnterpriseBaseInfoExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.EnterpriseBaseInfoImportFailureVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportResult;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportStatusVO;
|
||||
import com.ruoyi.info.collection.enums.DataSource;
|
||||
import com.ruoyi.info.collection.enums.EnterpriseRiskLevel;
|
||||
import com.ruoyi.info.collection.enums.EnterpriseSource;
|
||||
import com.ruoyi.info.collection.mapper.CcdiEnterpriseBaseInfoMapper;
|
||||
import com.ruoyi.info.collection.service.ICcdiEnterpriseBaseInfoImportService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 实体库管理导入 Service 实现
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-04-17
|
||||
*/
|
||||
@Service
|
||||
@EnableAsync
|
||||
public class CcdiEnterpriseBaseInfoImportServiceImpl implements ICcdiEnterpriseBaseInfoImportService {
|
||||
|
||||
@Resource
|
||||
private CcdiEnterpriseBaseInfoMapper enterpriseBaseInfoMapper;
|
||||
|
||||
@Resource
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public void importEnterpriseBaseInfoAsync(List<CcdiEnterpriseBaseInfoExcel> excelList, String taskId, String userName) {
|
||||
List<CcdiEnterpriseBaseInfo> successRecords = new ArrayList<>();
|
||||
List<EnterpriseBaseInfoImportFailureVO> failures = new ArrayList<>();
|
||||
Set<String> existingCreditCodes = getExistingCreditCodes(excelList);
|
||||
Set<String> processedCreditCodes = new HashSet<>();
|
||||
|
||||
for (CcdiEnterpriseBaseInfoExcel excel : excelList) {
|
||||
try {
|
||||
CcdiEnterpriseBaseInfo entity = validateAndBuildEntity(excel, existingCreditCodes, processedCreditCodes, userName);
|
||||
successRecords.add(entity);
|
||||
processedCreditCodes.add(entity.getSocialCreditCode());
|
||||
} catch (Exception e) {
|
||||
EnterpriseBaseInfoImportFailureVO failureVO = new EnterpriseBaseInfoImportFailureVO();
|
||||
BeanUtils.copyProperties(excel, failureVO);
|
||||
failureVO.setErrorMessage(e.getMessage());
|
||||
failures.add(failureVO);
|
||||
}
|
||||
}
|
||||
|
||||
if (!successRecords.isEmpty()) {
|
||||
saveBatch(successRecords, 500);
|
||||
}
|
||||
|
||||
if (!failures.isEmpty()) {
|
||||
redisTemplate.opsForValue().set(buildFailuresKey(taskId), failures, 7, TimeUnit.DAYS);
|
||||
}
|
||||
|
||||
ImportResult result = new ImportResult();
|
||||
result.setTotalCount(excelList.size());
|
||||
result.setSuccessCount(successRecords.size());
|
||||
result.setFailureCount(failures.size());
|
||||
updateImportStatus(taskId, failures.isEmpty() ? "SUCCESS" : "PARTIAL_SUCCESS", result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImportStatusVO getImportStatus(String taskId) {
|
||||
String key = buildStatusKey(taskId);
|
||||
Boolean exists = redisTemplate.hasKey(key);
|
||||
if (Boolean.FALSE.equals(exists)) {
|
||||
throw new RuntimeException("任务不存在或已过期");
|
||||
}
|
||||
|
||||
Map<Object, Object> statusMap = redisTemplate.opsForHash().entries(key);
|
||||
ImportStatusVO statusVO = new ImportStatusVO();
|
||||
statusVO.setTaskId((String) statusMap.get("taskId"));
|
||||
statusVO.setStatus((String) statusMap.get("status"));
|
||||
statusVO.setTotalCount((Integer) statusMap.get("totalCount"));
|
||||
statusVO.setSuccessCount((Integer) statusMap.get("successCount"));
|
||||
statusVO.setFailureCount((Integer) statusMap.get("failureCount"));
|
||||
statusVO.setProgress((Integer) statusMap.get("progress"));
|
||||
statusVO.setStartTime((Long) statusMap.get("startTime"));
|
||||
statusVO.setEndTime((Long) statusMap.get("endTime"));
|
||||
statusVO.setMessage((String) statusMap.get("message"));
|
||||
return statusVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnterpriseBaseInfoImportFailureVO> getImportFailures(String taskId) {
|
||||
Object failuresObj = redisTemplate.opsForValue().get(buildFailuresKey(taskId));
|
||||
if (failuresObj == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return JSON.parseArray(JSON.toJSONString(failuresObj), EnterpriseBaseInfoImportFailureVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CcdiEnterpriseBaseInfo validateAndBuildEntity(CcdiEnterpriseBaseInfoExcel excel,
|
||||
Set<String> existingCreditCodes,
|
||||
Set<String> processedCreditCodes,
|
||||
String userName) {
|
||||
if (excel == null) {
|
||||
throw new RuntimeException("导入数据不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(excel.getEnterpriseName())) {
|
||||
throw new RuntimeException("企业名称不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(excel.getSocialCreditCode())) {
|
||||
throw new RuntimeException("统一社会信用代码不能为空");
|
||||
}
|
||||
if (!excel.getSocialCreditCode().matches("^[0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}$")) {
|
||||
throw new RuntimeException("统一社会信用代码格式不正确");
|
||||
}
|
||||
if (StringUtils.isEmpty(excel.getStatus())) {
|
||||
throw new RuntimeException("经营状态不能为空");
|
||||
}
|
||||
|
||||
String riskLevel = EnterpriseRiskLevel.resolveCode(StringUtils.trim(excel.getRiskLevel()));
|
||||
if (riskLevel == null) {
|
||||
throw new RuntimeException("风险等级不在允许范围内");
|
||||
}
|
||||
String entSource = EnterpriseSource.resolveCode(StringUtils.trim(excel.getEntSource()));
|
||||
if (entSource == null) {
|
||||
throw new RuntimeException("企业来源不在允许范围内");
|
||||
}
|
||||
String dataSource = resolveDataSourceCode(StringUtils.trim(excel.getDataSource()));
|
||||
if (dataSource == null) {
|
||||
throw new RuntimeException("数据来源不在允许范围内");
|
||||
}
|
||||
|
||||
if (existingCreditCodes.contains(excel.getSocialCreditCode())) {
|
||||
throw new RuntimeException(String.format("统一社会信用代码[%s]已存在,请勿重复导入", excel.getSocialCreditCode()));
|
||||
}
|
||||
if (processedCreditCodes.contains(excel.getSocialCreditCode())) {
|
||||
throw new RuntimeException(String.format("统一社会信用代码[%s]在导入文件中重复,已跳过此条记录", excel.getSocialCreditCode()));
|
||||
}
|
||||
|
||||
CcdiEnterpriseBaseInfo entity = new CcdiEnterpriseBaseInfo();
|
||||
BeanUtils.copyProperties(excel, entity);
|
||||
entity.setRiskLevel(riskLevel);
|
||||
entity.setEntSource(entSource);
|
||||
entity.setDataSource(dataSource);
|
||||
entity.setStatus(StringUtils.trim(excel.getStatus()));
|
||||
entity.setCreatedBy(userName);
|
||||
entity.setUpdatedBy(userName);
|
||||
return entity;
|
||||
}
|
||||
|
||||
private Set<String> getExistingCreditCodes(List<CcdiEnterpriseBaseInfoExcel> excelList) {
|
||||
List<String> creditCodes = excelList.stream()
|
||||
.map(CcdiEnterpriseBaseInfoExcel::getSocialCreditCode)
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.collect(Collectors.toList());
|
||||
if (creditCodes.isEmpty()) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
LambdaQueryWrapper<CcdiEnterpriseBaseInfo> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(CcdiEnterpriseBaseInfo::getSocialCreditCode, creditCodes);
|
||||
return enterpriseBaseInfoMapper.selectList(wrapper).stream()
|
||||
.map(CcdiEnterpriseBaseInfo::getSocialCreditCode)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
private int saveBatch(List<CcdiEnterpriseBaseInfo> list, int batchSize) {
|
||||
int total = 0;
|
||||
for (int i = 0; i < list.size(); i += batchSize) {
|
||||
int end = Math.min(i + batchSize, list.size());
|
||||
total += enterpriseBaseInfoMapper.insertBatch(list.subList(i, end));
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
private void updateImportStatus(String taskId, String status, ImportResult result) {
|
||||
Map<String, Object> statusData = new HashMap<>();
|
||||
statusData.put("status", status);
|
||||
statusData.put("successCount", result.getSuccessCount());
|
||||
statusData.put("failureCount", result.getFailureCount());
|
||||
statusData.put("progress", 100);
|
||||
statusData.put("endTime", System.currentTimeMillis());
|
||||
if ("SUCCESS".equals(status)) {
|
||||
statusData.put("message", "全部成功!共导入" + result.getTotalCount() + "条数据");
|
||||
} else {
|
||||
statusData.put("message", "成功" + result.getSuccessCount() + "条,失败" + result.getFailureCount() + "条");
|
||||
}
|
||||
redisTemplate.opsForHash().putAll(buildStatusKey(taskId), statusData);
|
||||
}
|
||||
|
||||
private String resolveDataSourceCode(String value) {
|
||||
for (DataSource source : DataSource.values()) {
|
||||
if (source.getCode().equals(value) || source.getDesc().equals(value)) {
|
||||
return source.getCode();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String buildStatusKey(String taskId) {
|
||||
return "import:enterpriseBaseInfo:" + taskId;
|
||||
}
|
||||
|
||||
private String buildFailuresKey(String taskId) {
|
||||
return "import:enterpriseBaseInfo:" + taskId + ":failures";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
package com.ruoyi.info.collection.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.info.collection.domain.CcdiCustEnterpriseRelation;
|
||||
import com.ruoyi.info.collection.domain.CcdiEnterpriseBaseInfo;
|
||||
import com.ruoyi.info.collection.domain.CcdiIntermediaryEnterpriseRelation;
|
||||
import com.ruoyi.info.collection.domain.CcdiStaffEnterpriseRelation;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiEnterpriseBaseInfoAddDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiEnterpriseBaseInfoEditDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiEnterpriseBaseInfoQueryDTO;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiEnterpriseBaseInfoExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiEnterpriseBaseInfoVO;
|
||||
import com.ruoyi.info.collection.enums.DataSource;
|
||||
import com.ruoyi.info.collection.enums.EnterpriseRiskLevel;
|
||||
import com.ruoyi.info.collection.enums.EnterpriseSource;
|
||||
import com.ruoyi.info.collection.mapper.CcdiEnterpriseBaseInfoMapper;
|
||||
import com.ruoyi.info.collection.mapper.CcdiCustEnterpriseRelationMapper;
|
||||
import com.ruoyi.info.collection.mapper.CcdiIntermediaryEnterpriseRelationMapper;
|
||||
import com.ruoyi.info.collection.mapper.CcdiStaffEnterpriseRelationMapper;
|
||||
import com.ruoyi.info.collection.service.ICcdiEnterpriseBaseInfoImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiEnterpriseBaseInfoService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 实体库管理 Service 实现
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-04-17
|
||||
*/
|
||||
@Service
|
||||
public class CcdiEnterpriseBaseInfoServiceImpl implements ICcdiEnterpriseBaseInfoService {
|
||||
|
||||
@Resource
|
||||
private CcdiEnterpriseBaseInfoMapper enterpriseBaseInfoMapper;
|
||||
|
||||
@Resource
|
||||
private CcdiStaffEnterpriseRelationMapper staffEnterpriseRelationMapper;
|
||||
|
||||
@Resource
|
||||
private CcdiCustEnterpriseRelationMapper custEnterpriseRelationMapper;
|
||||
|
||||
@Resource
|
||||
private CcdiIntermediaryEnterpriseRelationMapper intermediaryEnterpriseRelationMapper;
|
||||
|
||||
@Resource
|
||||
private ICcdiEnterpriseBaseInfoImportService enterpriseBaseInfoImportService;
|
||||
|
||||
@Resource
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
@Override
|
||||
public Page<CcdiEnterpriseBaseInfoVO> selectEnterpriseBaseInfoPage(Page<CcdiEnterpriseBaseInfoVO> page,
|
||||
CcdiEnterpriseBaseInfoQueryDTO queryDTO) {
|
||||
return enterpriseBaseInfoMapper.selectEnterpriseBaseInfoPage(page, queryDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CcdiEnterpriseBaseInfoVO selectEnterpriseBaseInfoById(String socialCreditCode) {
|
||||
CcdiEnterpriseBaseInfo entity = enterpriseBaseInfoMapper.selectById(socialCreditCode);
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
CcdiEnterpriseBaseInfoVO vo = new CcdiEnterpriseBaseInfoVO();
|
||||
BeanUtils.copyProperties(entity, vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertEnterpriseBaseInfo(CcdiEnterpriseBaseInfoAddDTO addDTO) {
|
||||
if (enterpriseBaseInfoMapper.selectById(addDTO.getSocialCreditCode()) != null) {
|
||||
throw new RuntimeException("该统一社会信用代码已存在");
|
||||
}
|
||||
validateEnumFields(addDTO.getStatus(), addDTO.getRiskLevel(), addDTO.getEntSource(), addDTO.getDataSource());
|
||||
|
||||
CcdiEnterpriseBaseInfo entity = new CcdiEnterpriseBaseInfo();
|
||||
BeanUtils.copyProperties(addDTO, entity);
|
||||
return enterpriseBaseInfoMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int updateEnterpriseBaseInfo(CcdiEnterpriseBaseInfoEditDTO editDTO) {
|
||||
CcdiEnterpriseBaseInfo existing = enterpriseBaseInfoMapper.selectById(editDTO.getSocialCreditCode());
|
||||
if (existing == null) {
|
||||
throw new RuntimeException("实体库记录不存在");
|
||||
}
|
||||
validateEnumFields(editDTO.getStatus(), editDTO.getRiskLevel(), editDTO.getEntSource(), editDTO.getDataSource());
|
||||
|
||||
CcdiEnterpriseBaseInfo entity = new CcdiEnterpriseBaseInfo();
|
||||
BeanUtils.copyProperties(editDTO, entity);
|
||||
return enterpriseBaseInfoMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int deleteEnterpriseBaseInfoByIds(String[] socialCreditCodes) {
|
||||
if (socialCreditCodes == null || socialCreditCodes.length == 0) {
|
||||
return 0;
|
||||
}
|
||||
for (String socialCreditCode : socialCreditCodes) {
|
||||
validateDeleteRelations(socialCreditCode);
|
||||
}
|
||||
return enterpriseBaseInfoMapper.deleteBatchIds(List.of(socialCreditCodes));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CcdiEnterpriseBaseInfoExcel> selectEnterpriseBaseInfoListForExport(CcdiEnterpriseBaseInfoQueryDTO queryDTO) {
|
||||
LambdaQueryWrapper<CcdiEnterpriseBaseInfo> wrapper = buildQueryWrapper(queryDTO);
|
||||
return enterpriseBaseInfoMapper.selectList(wrapper).stream().map(entity -> {
|
||||
CcdiEnterpriseBaseInfoExcel excel = new CcdiEnterpriseBaseInfoExcel();
|
||||
BeanUtils.copyProperties(entity, excel);
|
||||
return excel;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String importEnterpriseBaseInfo(List<CcdiEnterpriseBaseInfoExcel> excelList) {
|
||||
String taskId = UUID.randomUUID().toString();
|
||||
String statusKey = "import:enterpriseBaseInfo:" + taskId;
|
||||
|
||||
Map<String, Object> statusData = new HashMap<>();
|
||||
statusData.put("taskId", taskId);
|
||||
statusData.put("status", "PROCESSING");
|
||||
statusData.put("totalCount", excelList.size());
|
||||
statusData.put("successCount", 0);
|
||||
statusData.put("failureCount", 0);
|
||||
statusData.put("progress", 0);
|
||||
statusData.put("startTime", System.currentTimeMillis());
|
||||
statusData.put("message", "正在处理...");
|
||||
|
||||
redisTemplate.opsForHash().putAll(statusKey, statusData);
|
||||
redisTemplate.expire(statusKey, 7, TimeUnit.DAYS);
|
||||
|
||||
enterpriseBaseInfoImportService.importEnterpriseBaseInfoAsync(excelList, taskId, SecurityUtils.getUsername());
|
||||
return taskId;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<CcdiEnterpriseBaseInfo> buildQueryWrapper(CcdiEnterpriseBaseInfoQueryDTO queryDTO) {
|
||||
LambdaQueryWrapper<CcdiEnterpriseBaseInfo> wrapper = new LambdaQueryWrapper<>();
|
||||
if (queryDTO == null) {
|
||||
return wrapper.orderByDesc(CcdiEnterpriseBaseInfo::getCreateTime);
|
||||
}
|
||||
wrapper.like(StringUtils.isNotEmpty(queryDTO.getEnterpriseName()),
|
||||
CcdiEnterpriseBaseInfo::getEnterpriseName, queryDTO.getEnterpriseName());
|
||||
wrapper.eq(StringUtils.isNotEmpty(queryDTO.getSocialCreditCode()),
|
||||
CcdiEnterpriseBaseInfo::getSocialCreditCode, queryDTO.getSocialCreditCode());
|
||||
wrapper.eq(StringUtils.isNotEmpty(queryDTO.getEnterpriseType()),
|
||||
CcdiEnterpriseBaseInfo::getEnterpriseType, queryDTO.getEnterpriseType());
|
||||
wrapper.eq(StringUtils.isNotEmpty(queryDTO.getEnterpriseNature()),
|
||||
CcdiEnterpriseBaseInfo::getEnterpriseNature, queryDTO.getEnterpriseNature());
|
||||
wrapper.like(StringUtils.isNotEmpty(queryDTO.getIndustryClass()),
|
||||
CcdiEnterpriseBaseInfo::getIndustryClass, queryDTO.getIndustryClass());
|
||||
wrapper.eq(StringUtils.isNotEmpty(queryDTO.getStatus()),
|
||||
CcdiEnterpriseBaseInfo::getStatus, queryDTO.getStatus());
|
||||
wrapper.eq(StringUtils.isNotEmpty(queryDTO.getRiskLevel()),
|
||||
CcdiEnterpriseBaseInfo::getRiskLevel, queryDTO.getRiskLevel());
|
||||
wrapper.eq(StringUtils.isNotEmpty(queryDTO.getEntSource()),
|
||||
CcdiEnterpriseBaseInfo::getEntSource, queryDTO.getEntSource());
|
||||
return wrapper.orderByDesc(CcdiEnterpriseBaseInfo::getCreateTime);
|
||||
}
|
||||
|
||||
private void validateEnumFields(String status, String riskLevel, String entSource, String dataSource) {
|
||||
if (StringUtils.isEmpty(status)) {
|
||||
throw new RuntimeException("经营状态不能为空");
|
||||
}
|
||||
if (!EnterpriseRiskLevel.contains(riskLevel)) {
|
||||
throw new RuntimeException("风险等级不在允许范围内");
|
||||
}
|
||||
if (!EnterpriseSource.contains(entSource)) {
|
||||
throw new RuntimeException("企业来源不在允许范围内");
|
||||
}
|
||||
if (!containsDataSource(dataSource)) {
|
||||
throw new RuntimeException("数据来源不在允许范围内");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean containsDataSource(String code) {
|
||||
for (DataSource source : DataSource.values()) {
|
||||
if (source.getCode().equals(code)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void validateDeleteRelations(String socialCreditCode) {
|
||||
StringJoiner relationTypes = new StringJoiner("、");
|
||||
if (staffEnterpriseRelationMapper.selectCount(new LambdaQueryWrapper<CcdiStaffEnterpriseRelation>()
|
||||
.eq(CcdiStaffEnterpriseRelation::getSocialCreditCode, socialCreditCode)) > 0) {
|
||||
relationTypes.add("员工");
|
||||
}
|
||||
if (custEnterpriseRelationMapper.selectCount(new LambdaQueryWrapper<CcdiCustEnterpriseRelation>()
|
||||
.eq(CcdiCustEnterpriseRelation::getSocialCreditCode, socialCreditCode)) > 0) {
|
||||
relationTypes.add("信贷客户");
|
||||
}
|
||||
if (intermediaryEnterpriseRelationMapper.selectCount(new LambdaQueryWrapper<CcdiIntermediaryEnterpriseRelation>()
|
||||
.eq(CcdiIntermediaryEnterpriseRelation::getSocialCreditCode, socialCreditCode)) > 0) {
|
||||
relationTypes.add("中介");
|
||||
}
|
||||
if (relationTypes.length() > 0) {
|
||||
throw new RuntimeException("统一社会信用代码[" + socialCreditCode + "]已关联" + relationTypes + ",删除失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,266 @@
|
||||
package com.ruoyi.info.collection.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.info.collection.domain.CcdiBizIntermediary;
|
||||
import com.ruoyi.info.collection.domain.CcdiEnterpriseBaseInfo;
|
||||
import com.ruoyi.info.collection.domain.CcdiIntermediaryEnterpriseRelation;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiIntermediaryEnterpriseRelationExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportResult;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportStatusVO;
|
||||
import com.ruoyi.info.collection.domain.vo.IntermediaryEnterpriseRelationImportFailureVO;
|
||||
import com.ruoyi.info.collection.mapper.CcdiBizIntermediaryMapper;
|
||||
import com.ruoyi.info.collection.mapper.CcdiEnterpriseBaseInfoMapper;
|
||||
import com.ruoyi.info.collection.mapper.CcdiIntermediaryEnterpriseRelationMapper;
|
||||
import com.ruoyi.info.collection.service.ICcdiIntermediaryEnterpriseRelationImportService;
|
||||
import com.ruoyi.info.collection.utils.ImportLogUtils;
|
||||
import com.ruoyi.common.utils.IdCardUtil;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 中介实体关联关系异步导入实现
|
||||
*/
|
||||
@Service
|
||||
@EnableAsync
|
||||
public class CcdiIntermediaryEnterpriseRelationImportServiceImpl implements ICcdiIntermediaryEnterpriseRelationImportService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(CcdiIntermediaryEnterpriseRelationImportServiceImpl.class);
|
||||
|
||||
private static final String STATUS_KEY_PREFIX = "import:intermediary-enterprise-relation:";
|
||||
|
||||
@Resource
|
||||
private CcdiIntermediaryEnterpriseRelationMapper relationMapper;
|
||||
|
||||
@Resource
|
||||
private CcdiBizIntermediaryMapper intermediaryMapper;
|
||||
|
||||
@Resource
|
||||
private CcdiEnterpriseBaseInfoMapper enterpriseBaseInfoMapper;
|
||||
|
||||
@Resource
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
@Override
|
||||
@Async
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importAsync(List<CcdiIntermediaryEnterpriseRelationExcel> excelList, String taskId, String userName) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
ImportLogUtils.logImportStart(log, taskId, "中介实体关联关系", excelList.size(), userName);
|
||||
|
||||
Map<String, String> ownerBizIdByPersonId = getOwnerBizIdByPersonId(excelList);
|
||||
Set<String> existingEnterpriseCodes = getExistingEnterpriseCodes(excelList);
|
||||
Set<String> existingCombinations = getExistingRelationCombinations(ownerBizIdByPersonId, excelList);
|
||||
|
||||
List<CcdiIntermediaryEnterpriseRelation> successRecords = new ArrayList<>();
|
||||
List<IntermediaryEnterpriseRelationImportFailureVO> failures = new ArrayList<>();
|
||||
Set<String> processedCombinations = new HashSet<>();
|
||||
|
||||
for (int i = 0; i < excelList.size(); i++) {
|
||||
CcdiIntermediaryEnterpriseRelationExcel excel = excelList.get(i);
|
||||
try {
|
||||
validateExcel(excel);
|
||||
|
||||
String ownerBizId = ownerBizIdByPersonId.get(excel.getOwnerPersonId());
|
||||
if (StringUtils.isEmpty(ownerBizId)) {
|
||||
throw new RuntimeException("中介本人不存在,请先导入或维护中介本人信息");
|
||||
}
|
||||
if (!existingEnterpriseCodes.contains(excel.getSocialCreditCode())) {
|
||||
throw new RuntimeException("统一社会信用代码不存在于系统机构表");
|
||||
}
|
||||
|
||||
String combination = ownerBizId + "|" + excel.getSocialCreditCode();
|
||||
if (existingCombinations.contains(combination)) {
|
||||
throw new RuntimeException("中介实体关联关系已存在,请勿重复导入");
|
||||
}
|
||||
if (!processedCombinations.add(combination)) {
|
||||
throw new RuntimeException("同一中介本人与统一社会信用代码组合在导入文件中重复");
|
||||
}
|
||||
|
||||
CcdiIntermediaryEnterpriseRelation relation = new CcdiIntermediaryEnterpriseRelation();
|
||||
BeanUtils.copyProperties(excel, relation);
|
||||
relation.setIntermediaryBizId(ownerBizId);
|
||||
relation.setCreatedBy(userName);
|
||||
relation.setUpdatedBy(userName);
|
||||
successRecords.add(relation);
|
||||
} catch (Exception e) {
|
||||
failures.add(createFailureVO(excel, e.getMessage()));
|
||||
ImportLogUtils.logValidationError(log, taskId, i + 1, e.getMessage(),
|
||||
String.format("中介本人证件号码=%s, 统一社会信用代码=%s", excel.getOwnerPersonId(), excel.getSocialCreditCode()));
|
||||
}
|
||||
}
|
||||
|
||||
if (!successRecords.isEmpty()) {
|
||||
saveBatch(successRecords, 500);
|
||||
}
|
||||
if (!failures.isEmpty()) {
|
||||
redisTemplate.opsForValue().set(failureKey(taskId), failures, 7, TimeUnit.DAYS);
|
||||
}
|
||||
|
||||
ImportResult result = new ImportResult();
|
||||
result.setTotalCount(excelList.size());
|
||||
result.setSuccessCount(successRecords.size());
|
||||
result.setFailureCount(failures.size());
|
||||
updateImportStatus(taskId, result);
|
||||
|
||||
long duration = System.currentTimeMillis() - startTime;
|
||||
ImportLogUtils.logImportComplete(log, taskId, "中介实体关联关系",
|
||||
excelList.size(), result.getSuccessCount(), result.getFailureCount(), duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImportStatusVO getImportStatus(String taskId) {
|
||||
String key = statusKey(taskId);
|
||||
if (Boolean.FALSE.equals(redisTemplate.hasKey(key))) {
|
||||
throw new RuntimeException("任务不存在或已过期");
|
||||
}
|
||||
|
||||
Map<Object, Object> statusMap = redisTemplate.opsForHash().entries(key);
|
||||
ImportStatusVO statusVO = new ImportStatusVO();
|
||||
statusVO.setTaskId((String) statusMap.get("taskId"));
|
||||
statusVO.setStatus((String) statusMap.get("status"));
|
||||
statusVO.setTotalCount((Integer) statusMap.get("totalCount"));
|
||||
statusVO.setSuccessCount((Integer) statusMap.get("successCount"));
|
||||
statusVO.setFailureCount((Integer) statusMap.get("failureCount"));
|
||||
statusVO.setProgress((Integer) statusMap.get("progress"));
|
||||
statusVO.setStartTime((Long) statusMap.get("startTime"));
|
||||
statusVO.setEndTime((Long) statusMap.get("endTime"));
|
||||
statusVO.setMessage((String) statusMap.get("message"));
|
||||
return statusVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IntermediaryEnterpriseRelationImportFailureVO> getImportFailures(String taskId) {
|
||||
Object failuresObj = redisTemplate.opsForValue().get(failureKey(taskId));
|
||||
if (failuresObj == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return JSON.parseArray(JSON.toJSONString(failuresObj), IntermediaryEnterpriseRelationImportFailureVO.class);
|
||||
}
|
||||
|
||||
private Map<String, String> getOwnerBizIdByPersonId(List<CcdiIntermediaryEnterpriseRelationExcel> excelList) {
|
||||
List<String> ownerPersonIds = excelList.stream()
|
||||
.map(CcdiIntermediaryEnterpriseRelationExcel::getOwnerPersonId)
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (ownerPersonIds.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<CcdiBizIntermediary> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CcdiBizIntermediary::getPersonSubType, "本人")
|
||||
.in(CcdiBizIntermediary::getPersonId, ownerPersonIds);
|
||||
return intermediaryMapper.selectList(wrapper).stream()
|
||||
.collect(Collectors.toMap(CcdiBizIntermediary::getPersonId, CcdiBizIntermediary::getBizId, (left, right) -> left));
|
||||
}
|
||||
|
||||
private Set<String> getExistingEnterpriseCodes(List<CcdiIntermediaryEnterpriseRelationExcel> excelList) {
|
||||
List<String> socialCreditCodes = excelList.stream()
|
||||
.map(CcdiIntermediaryEnterpriseRelationExcel::getSocialCreditCode)
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (socialCreditCodes.isEmpty()) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<CcdiEnterpriseBaseInfo> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(CcdiEnterpriseBaseInfo::getSocialCreditCode, socialCreditCodes);
|
||||
return enterpriseBaseInfoMapper.selectList(wrapper).stream()
|
||||
.map(CcdiEnterpriseBaseInfo::getSocialCreditCode)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
private Set<String> getExistingRelationCombinations(Map<String, String> ownerBizIdByPersonId,
|
||||
List<CcdiIntermediaryEnterpriseRelationExcel> excelList) {
|
||||
List<String> combinations = excelList.stream()
|
||||
.map(excel -> {
|
||||
String ownerBizId = ownerBizIdByPersonId.get(excel.getOwnerPersonId());
|
||||
if (StringUtils.isEmpty(ownerBizId) || StringUtils.isEmpty(excel.getSocialCreditCode())) {
|
||||
return null;
|
||||
}
|
||||
return ownerBizId + "|" + excel.getSocialCreditCode();
|
||||
})
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (combinations.isEmpty()) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
return new HashSet<>(relationMapper.batchExistsByCombinations(combinations));
|
||||
}
|
||||
|
||||
private void validateExcel(CcdiIntermediaryEnterpriseRelationExcel excel) {
|
||||
if (StringUtils.isEmpty(excel.getOwnerPersonId())) {
|
||||
throw new RuntimeException("中介本人证件号码不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(excel.getSocialCreditCode())) {
|
||||
throw new RuntimeException("统一社会信用代码不能为空");
|
||||
}
|
||||
String ownerPersonIdError = IdCardUtil.getErrorMessage(excel.getOwnerPersonId());
|
||||
if (ownerPersonIdError != null) {
|
||||
throw new RuntimeException("中介本人证件号码" + ownerPersonIdError);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(excel.getRelationPersonPost()) && excel.getRelationPersonPost().length() > 100) {
|
||||
throw new RuntimeException("关联人职务长度不能超过100个字符");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(excel.getRemark()) && excel.getRemark().length() > 500) {
|
||||
throw new RuntimeException("备注长度不能超过500个字符");
|
||||
}
|
||||
}
|
||||
|
||||
private IntermediaryEnterpriseRelationImportFailureVO createFailureVO(CcdiIntermediaryEnterpriseRelationExcel excel,
|
||||
String errorMessage) {
|
||||
IntermediaryEnterpriseRelationImportFailureVO failure = new IntermediaryEnterpriseRelationImportFailureVO();
|
||||
BeanUtils.copyProperties(excel, failure);
|
||||
failure.setErrorMessage(errorMessage);
|
||||
return failure;
|
||||
}
|
||||
|
||||
private void saveBatch(List<CcdiIntermediaryEnterpriseRelation> list, int batchSize) {
|
||||
for (int i = 0; i < list.size(); i += batchSize) {
|
||||
int end = Math.min(i + batchSize, list.size());
|
||||
relationMapper.insertBatch(list.subList(i, end));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateImportStatus(String taskId, ImportResult result) {
|
||||
Map<String, Object> statusData = new HashMap<>();
|
||||
statusData.put("status", result.getFailureCount() == 0 ? "SUCCESS" : "PARTIAL_SUCCESS");
|
||||
statusData.put("successCount", result.getSuccessCount());
|
||||
statusData.put("failureCount", result.getFailureCount());
|
||||
statusData.put("progress", 100);
|
||||
statusData.put("endTime", System.currentTimeMillis());
|
||||
statusData.put("message", result.getFailureCount() == 0
|
||||
? "全部成功!共导入" + result.getTotalCount() + "条数据"
|
||||
: "成功" + result.getSuccessCount() + "条,失败" + result.getFailureCount() + "条");
|
||||
redisTemplate.opsForHash().putAll(statusKey(taskId), statusData);
|
||||
}
|
||||
|
||||
private String statusKey(String taskId) {
|
||||
return STATUS_KEY_PREFIX + taskId;
|
||||
}
|
||||
|
||||
private String failureKey(String taskId) {
|
||||
return statusKey(taskId) + ":failures";
|
||||
}
|
||||
}
|
||||
@@ -22,15 +22,18 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 个人中介异步导入Service实现
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-06
|
||||
* 中介信息异步导入实现
|
||||
*/
|
||||
@Service
|
||||
@EnableAsync
|
||||
@@ -38,6 +41,8 @@ public class CcdiIntermediaryPersonImportServiceImpl implements ICcdiIntermediar
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(CcdiIntermediaryPersonImportServiceImpl.class);
|
||||
|
||||
private static final String STATUS_KEY_PREFIX = "import:intermediary:";
|
||||
|
||||
@Resource
|
||||
private CcdiBizIntermediaryMapper intermediaryMapper;
|
||||
|
||||
@@ -47,110 +52,104 @@ public class CcdiIntermediaryPersonImportServiceImpl implements ICcdiIntermediar
|
||||
@Override
|
||||
@Async
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importPersonAsync(List<CcdiIntermediaryPersonExcel> excelList,
|
||||
String taskId,
|
||||
String userName) {
|
||||
public void importPersonAsync(List<CcdiIntermediaryPersonExcel> excelList, String taskId, String userName) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
ImportLogUtils.logImportStart(log, taskId, "中介信息", excelList.size(), userName);
|
||||
|
||||
// 记录导入开始
|
||||
ImportLogUtils.logImportStart(log, taskId, "个人中介", excelList.size(), userName);
|
||||
|
||||
List<CcdiBizIntermediary> newRecords = new ArrayList<>();
|
||||
List<CcdiIntermediaryPersonExcel> ownerRows = new ArrayList<>();
|
||||
List<CcdiIntermediaryPersonExcel> relativeRows = new ArrayList<>();
|
||||
List<IntermediaryPersonImportFailureVO> failures = new ArrayList<>();
|
||||
|
||||
// 批量查询已存在的证件号
|
||||
ImportLogUtils.logBatchQueryStart(log, taskId, "已存在的证件号", excelList.size());
|
||||
Set<String> existingPersonIds = getExistingPersonIds(excelList);
|
||||
ImportLogUtils.logBatchQueryComplete(log, taskId, "证件号", existingPersonIds.size());
|
||||
|
||||
// 用于检测Excel内部的重复ID
|
||||
Set<String> excelProcessedIds = new HashSet<>();
|
||||
|
||||
// 分类数据
|
||||
for (int i = 0; i < excelList.size(); i++) {
|
||||
CcdiIntermediaryPersonExcel excel = excelList.get(i);
|
||||
|
||||
try {
|
||||
// 验证数据
|
||||
validatePersonData(excel, existingPersonIds);
|
||||
|
||||
CcdiBizIntermediary intermediary = new CcdiBizIntermediary();
|
||||
BeanUtils.copyProperties(excel, intermediary);
|
||||
|
||||
// 设置数据来源和审计字段
|
||||
intermediary.setDataSource("IMPORT");
|
||||
intermediary.setCreatedBy(userName);
|
||||
intermediary.setUpdatedBy(userName);
|
||||
|
||||
if (existingPersonIds.contains(excel.getPersonId())) {
|
||||
// 证件号码在数据库中已存在,直接报错
|
||||
throw new RuntimeException(String.format("证件号码[%s]已存在,请勿重复导入", excel.getPersonId()));
|
||||
} else if (excelProcessedIds.contains(excel.getPersonId())) {
|
||||
// 证件号码在Excel文件内部重复
|
||||
throw new RuntimeException(String.format("证件号码[%s]在导入文件中重复,已跳过此条记录", excel.getPersonId()));
|
||||
validateCommonRow(excel);
|
||||
if (isOwnerRow(excel)) {
|
||||
validateOwnerRow(excel);
|
||||
ownerRows.add(excel);
|
||||
} else {
|
||||
newRecords.add(intermediary);
|
||||
excelProcessedIds.add(excel.getPersonId()); // 标记为已处理
|
||||
validateRelativeRow(excel);
|
||||
relativeRows.add(excel);
|
||||
}
|
||||
|
||||
// 记录进度
|
||||
ImportLogUtils.logProgress(log, taskId, i + 1, excelList.size(),
|
||||
newRecords.size(), failures.size());
|
||||
|
||||
} catch (Exception e) {
|
||||
failures.add(createFailureVO(excel, e.getMessage()));
|
||||
|
||||
// 记录验证失败日志
|
||||
String keyData = String.format("姓名=%s, 证件号码=%s",
|
||||
excel.getName(), excel.getPersonId());
|
||||
ImportLogUtils.logValidationError(log, taskId, i + 1, e.getMessage(), keyData);
|
||||
ImportLogUtils.logValidationError(log, taskId, i + 1, e.getMessage(),
|
||||
String.format("姓名=%s, 证件号码=%s", excel.getName(), excel.getPersonId()));
|
||||
}
|
||||
}
|
||||
|
||||
// 批量插入新数据
|
||||
if (!newRecords.isEmpty()) {
|
||||
ImportLogUtils.logBatchOperationStart(log, taskId, "插入",
|
||||
(newRecords.size() + 499) / 500, 500);
|
||||
saveBatch(newRecords, 500);
|
||||
}
|
||||
Set<String> existingOwnerPersonIds = getExistingOwnerPersonIds(ownerRows);
|
||||
Set<String> existingOwnerRefs = getExistingOwnerRefs(relativeRows);
|
||||
Set<String> existingRelativeCombinations = getExistingRelativeCombinations(relativeRows);
|
||||
|
||||
// 保存失败记录到Redis
|
||||
if (!failures.isEmpty()) {
|
||||
List<CcdiBizIntermediary> successRecords = new ArrayList<>();
|
||||
Set<String> importedOwnerPersonIds = new HashSet<>();
|
||||
|
||||
for (CcdiIntermediaryPersonExcel ownerExcel : ownerRows) {
|
||||
try {
|
||||
String failuresKey = "import:intermediary:" + taskId + ":failures";
|
||||
redisTemplate.opsForValue().set(failuresKey, failures, 7, TimeUnit.DAYS);
|
||||
ImportLogUtils.logRedisOperation(log, taskId, "保存失败记录", failures.size());
|
||||
String ownerPersonId = ownerExcel.getPersonId();
|
||||
if (existingOwnerPersonIds.contains(ownerPersonId)) {
|
||||
throw new RuntimeException(String.format("中介本人证件号码[%s]已存在,请勿重复导入", ownerPersonId));
|
||||
}
|
||||
if (!importedOwnerPersonIds.add(ownerPersonId)) {
|
||||
throw new RuntimeException(String.format("中介本人证件号码[%s]在导入文件中重复", ownerPersonId));
|
||||
}
|
||||
successRecords.add(buildRecord(ownerExcel, userName, null));
|
||||
} catch (Exception e) {
|
||||
ImportLogUtils.logRedisError(log, taskId, "保存失败记录", e);
|
||||
failures.add(createFailureVO(ownerExcel, e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
Set<String> validOwnerRefs = new HashSet<>(existingOwnerRefs);
|
||||
validOwnerRefs.addAll(importedOwnerPersonIds);
|
||||
Set<String> processedRelativeCombinations = new HashSet<>();
|
||||
|
||||
for (CcdiIntermediaryPersonExcel relativeExcel : relativeRows) {
|
||||
try {
|
||||
String ownerPersonId = relativeExcel.getRelatedNumId();
|
||||
String combination = ownerPersonId + "|" + relativeExcel.getPersonId();
|
||||
if (!validOwnerRefs.contains(ownerPersonId)) {
|
||||
throw new RuntimeException(String.format("关联中介本人证件号码[%s]不存在", ownerPersonId));
|
||||
}
|
||||
if (existingRelativeCombinations.contains(combination)) {
|
||||
throw new RuntimeException(String.format("同一中介本人名下证件号码[%s]的亲属已存在,请勿重复导入", relativeExcel.getPersonId()));
|
||||
}
|
||||
if (!processedRelativeCombinations.add(combination)) {
|
||||
throw new RuntimeException(String.format("同一中介本人名下证件号码[%s]的亲属在导入文件中重复", relativeExcel.getPersonId()));
|
||||
}
|
||||
successRecords.add(buildRecord(relativeExcel, userName, ownerPersonId));
|
||||
} catch (Exception e) {
|
||||
failures.add(createFailureVO(relativeExcel, e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
if (!successRecords.isEmpty()) {
|
||||
saveBatch(successRecords, 500);
|
||||
}
|
||||
|
||||
if (!failures.isEmpty()) {
|
||||
redisTemplate.opsForValue().set(failureKey(taskId), failures, 7, TimeUnit.DAYS);
|
||||
}
|
||||
|
||||
ImportResult result = new ImportResult();
|
||||
result.setTotalCount(excelList.size());
|
||||
result.setSuccessCount(newRecords.size());
|
||||
result.setSuccessCount(successRecords.size());
|
||||
result.setFailureCount(failures.size());
|
||||
updateImportStatus(taskId, result);
|
||||
|
||||
// 更新最终状态
|
||||
String finalStatus = result.getFailureCount() == 0 ? "SUCCESS" : "PARTIAL_SUCCESS";
|
||||
updateImportStatus(taskId, finalStatus, result);
|
||||
|
||||
// 记录导入完成
|
||||
long duration = System.currentTimeMillis() - startTime;
|
||||
ImportLogUtils.logImportComplete(log, taskId, "个人中介",
|
||||
excelList.size(), result.getSuccessCount(), result.getFailureCount(), duration);
|
||||
ImportLogUtils.logImportComplete(log, taskId, "中介信息",
|
||||
excelList.size(), result.getSuccessCount(), result.getFailureCount(), duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImportStatusVO getImportStatus(String taskId) {
|
||||
String key = "import:intermediary:" + taskId;
|
||||
Boolean hasKey = redisTemplate.hasKey(key);
|
||||
|
||||
if (Boolean.FALSE.equals(hasKey)) {
|
||||
String key = statusKey(taskId);
|
||||
if (Boolean.FALSE.equals(redisTemplate.hasKey(key))) {
|
||||
throw new RuntimeException("任务不存在或已过期");
|
||||
}
|
||||
|
||||
Map<Object, Object> statusMap = redisTemplate.opsForHash().entries(key);
|
||||
|
||||
ImportStatusVO statusVO = new ImportStatusVO();
|
||||
statusVO.setTaskId((String) statusMap.get("taskId"));
|
||||
statusVO.setStatus((String) statusMap.get("status"));
|
||||
@@ -161,83 +160,120 @@ public class CcdiIntermediaryPersonImportServiceImpl implements ICcdiIntermediar
|
||||
statusVO.setStartTime((Long) statusMap.get("startTime"));
|
||||
statusVO.setEndTime((Long) statusMap.get("endTime"));
|
||||
statusVO.setMessage((String) statusMap.get("message"));
|
||||
|
||||
return statusVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IntermediaryPersonImportFailureVO> getImportFailures(String taskId) {
|
||||
String key = "import:intermediary:" + taskId + ":failures";
|
||||
Object failuresObj = redisTemplate.opsForValue().get(key);
|
||||
|
||||
Object failuresObj = redisTemplate.opsForValue().get(failureKey(taskId));
|
||||
if (failuresObj == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return JSON.parseArray(JSON.toJSONString(failuresObj), IntermediaryPersonImportFailureVO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询已存在的证件号
|
||||
*/
|
||||
private Set<String> getExistingPersonIds(List<CcdiIntermediaryPersonExcel> excelList) {
|
||||
List<String> personIds = excelList.stream()
|
||||
.map(CcdiIntermediaryPersonExcel::getPersonId)
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.collect(Collectors.toList());
|
||||
private boolean isOwnerRow(CcdiIntermediaryPersonExcel excel) {
|
||||
return "本人".equals(excel.getPersonSubType());
|
||||
}
|
||||
|
||||
if (personIds.isEmpty()) {
|
||||
private void validateCommonRow(CcdiIntermediaryPersonExcel excel) {
|
||||
if (StringUtils.isEmpty(excel.getName())) {
|
||||
throw new RuntimeException("姓名不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(excel.getPersonSubType())) {
|
||||
throw new RuntimeException("人员子类型不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(excel.getPersonId())) {
|
||||
throw new RuntimeException("证件号码不能为空");
|
||||
}
|
||||
String idCardError = IdCardUtil.getErrorMessage(excel.getPersonId());
|
||||
if (idCardError != null) {
|
||||
throw new RuntimeException("证件号码" + idCardError);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateOwnerRow(CcdiIntermediaryPersonExcel excel) {
|
||||
if (StringUtils.isNotEmpty(excel.getRelatedNumId())) {
|
||||
throw new RuntimeException("本人行关联中介本人证件号码必须为空");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateRelativeRow(CcdiIntermediaryPersonExcel excel) {
|
||||
if (StringUtils.isEmpty(excel.getRelatedNumId())) {
|
||||
throw new RuntimeException("亲属行必须填写关联中介本人证件号码");
|
||||
}
|
||||
}
|
||||
|
||||
private Set<String> getExistingOwnerPersonIds(List<CcdiIntermediaryPersonExcel> ownerRows) {
|
||||
List<String> ownerPersonIds = ownerRows.stream()
|
||||
.map(CcdiIntermediaryPersonExcel::getPersonId)
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (ownerPersonIds.isEmpty()) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<CcdiBizIntermediary> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(CcdiBizIntermediary::getPersonId, personIds);
|
||||
List<CcdiBizIntermediary> existingIntermediaries = intermediaryMapper.selectList(wrapper);
|
||||
|
||||
return existingIntermediaries.stream()
|
||||
.map(CcdiBizIntermediary::getPersonId)
|
||||
.collect(Collectors.toSet());
|
||||
wrapper.eq(CcdiBizIntermediary::getPersonSubType, "本人")
|
||||
.in(CcdiBizIntermediary::getPersonId, ownerPersonIds);
|
||||
return intermediaryMapper.selectList(wrapper).stream()
|
||||
.map(CcdiBizIntermediary::getPersonId)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量保存(使用ON DUPLICATE KEY UPDATE)
|
||||
*/
|
||||
private int saveBatchWithUpsert(List<CcdiBizIntermediary> list, int batchSize) {
|
||||
int totalCount = 0;
|
||||
for (int i = 0; i < list.size(); i += batchSize) {
|
||||
int end = Math.min(i + batchSize, list.size());
|
||||
List<CcdiBizIntermediary> subList = list.subList(i, end);
|
||||
int count = intermediaryMapper.importPersonBatch(subList);
|
||||
totalCount += count;
|
||||
}
|
||||
return totalCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从数据库获取已存在的证件号
|
||||
*/
|
||||
private Set<String> getExistingPersonIdsFromDb(List<CcdiBizIntermediary> records) {
|
||||
List<String> personIds = records.stream()
|
||||
.map(CcdiBizIntermediary::getPersonId)
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (personIds.isEmpty()) {
|
||||
private Set<String> getExistingOwnerRefs(List<CcdiIntermediaryPersonExcel> relativeRows) {
|
||||
List<String> ownerRefs = relativeRows.stream()
|
||||
.map(CcdiIntermediaryPersonExcel::getRelatedNumId)
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (ownerRefs.isEmpty()) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<CcdiBizIntermediary> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(CcdiBizIntermediary::getPersonId, personIds);
|
||||
List<CcdiBizIntermediary> existing = intermediaryMapper.selectList(wrapper);
|
||||
|
||||
return existing.stream()
|
||||
.map(CcdiBizIntermediary::getPersonId)
|
||||
.collect(Collectors.toSet());
|
||||
wrapper.eq(CcdiBizIntermediary::getPersonSubType, "本人")
|
||||
.in(CcdiBizIntermediary::getPersonId, ownerRefs);
|
||||
return intermediaryMapper.selectList(wrapper).stream()
|
||||
.map(CcdiBizIntermediary::getPersonId)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
private Set<String> getExistingRelativeCombinations(List<CcdiIntermediaryPersonExcel> relativeRows) {
|
||||
List<String> ownerRefs = relativeRows.stream()
|
||||
.map(CcdiIntermediaryPersonExcel::getRelatedNumId)
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<String> relativePersonIds = relativeRows.stream()
|
||||
.map(CcdiIntermediaryPersonExcel::getPersonId)
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (ownerRefs.isEmpty() || relativePersonIds.isEmpty()) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<CcdiBizIntermediary> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.ne(CcdiBizIntermediary::getPersonSubType, "本人")
|
||||
.in(CcdiBizIntermediary::getRelatedNumId, ownerRefs)
|
||||
.in(CcdiBizIntermediary::getPersonId, relativePersonIds);
|
||||
return intermediaryMapper.selectList(wrapper).stream()
|
||||
.map(item -> item.getRelatedNumId() + "|" + item.getPersonId())
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
private CcdiBizIntermediary buildRecord(CcdiIntermediaryPersonExcel excel, String userName, String ownerPersonId) {
|
||||
CcdiBizIntermediary intermediary = new CcdiBizIntermediary();
|
||||
BeanUtils.copyProperties(excel, intermediary);
|
||||
intermediary.setRelatedNumId(ownerPersonId);
|
||||
intermediary.setDataSource("IMPORT");
|
||||
intermediary.setCreatedBy(userName);
|
||||
intermediary.setUpdatedBy(userName);
|
||||
return intermediary;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建失败记录VO
|
||||
*/
|
||||
private IntermediaryPersonImportFailureVO createFailureVO(CcdiIntermediaryPersonExcel excel, String errorMsg) {
|
||||
IntermediaryPersonImportFailureVO failure = new IntermediaryPersonImportFailureVO();
|
||||
BeanUtils.copyProperties(excel, failure);
|
||||
@@ -245,73 +281,31 @@ public class CcdiIntermediaryPersonImportServiceImpl implements ICcdiIntermediar
|
||||
return failure;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建失败记录VO(重载方法)
|
||||
*/
|
||||
private IntermediaryPersonImportFailureVO createFailureVO(CcdiBizIntermediary record, String errorMsg) {
|
||||
CcdiIntermediaryPersonExcel excel = new CcdiIntermediaryPersonExcel();
|
||||
BeanUtils.copyProperties(record, excel);
|
||||
return createFailureVO(excel, errorMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量保存
|
||||
*/
|
||||
private int saveBatch(List<CcdiBizIntermediary> list, int batchSize) {
|
||||
// 使用真正的批量插入,分批次执行以提高性能
|
||||
int totalCount = 0;
|
||||
private void saveBatch(List<CcdiBizIntermediary> list, int batchSize) {
|
||||
for (int i = 0; i < list.size(); i += batchSize) {
|
||||
int end = Math.min(i + batchSize, list.size());
|
||||
List<CcdiBizIntermediary> subList = list.subList(i, end);
|
||||
int count = intermediaryMapper.insertBatch(subList);
|
||||
totalCount += count;
|
||||
intermediaryMapper.insertBatch(list.subList(i, end));
|
||||
}
|
||||
return totalCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新导入状态
|
||||
*/
|
||||
private void updateImportStatus(String taskId, String status, ImportResult result) {
|
||||
String key = "import:intermediary:" + taskId;
|
||||
private void updateImportStatus(String taskId, ImportResult result) {
|
||||
Map<String, Object> statusData = new HashMap<>();
|
||||
statusData.put("status", status);
|
||||
statusData.put("status", result.getFailureCount() == 0 ? "SUCCESS" : "PARTIAL_SUCCESS");
|
||||
statusData.put("successCount", result.getSuccessCount());
|
||||
statusData.put("failureCount", result.getFailureCount());
|
||||
statusData.put("progress", 100);
|
||||
statusData.put("endTime", System.currentTimeMillis());
|
||||
|
||||
if ("SUCCESS".equals(status)) {
|
||||
statusData.put("message", "全部成功!共导入" + result.getTotalCount() + "条数据");
|
||||
} else {
|
||||
statusData.put("message", "成功" + result.getSuccessCount() + "条,失败" + result.getFailureCount() + "条");
|
||||
}
|
||||
|
||||
redisTemplate.opsForHash().putAll(key, statusData);
|
||||
statusData.put("message", result.getFailureCount() == 0
|
||||
? "全部成功!共导入" + result.getTotalCount() + "条数据"
|
||||
: "成功" + result.getSuccessCount() + "条,失败" + result.getFailureCount() + "条");
|
||||
redisTemplate.opsForHash().putAll(statusKey(taskId), statusData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证个人中介数据
|
||||
*
|
||||
* @param excel Excel数据
|
||||
* @param existingPersonIds 已存在的证件号集合
|
||||
*/
|
||||
private void validatePersonData(CcdiIntermediaryPersonExcel excel,
|
||||
Set<String> existingPersonIds) {
|
||||
// 验证必填字段:姓名
|
||||
if (StringUtils.isEmpty(excel.getName())) {
|
||||
throw new RuntimeException("姓名不能为空");
|
||||
}
|
||||
private String statusKey(String taskId) {
|
||||
return STATUS_KEY_PREFIX + taskId;
|
||||
}
|
||||
|
||||
// 验证必填字段:证件号码
|
||||
if (StringUtils.isEmpty(excel.getPersonId())) {
|
||||
throw new RuntimeException("证件号码不能为空");
|
||||
}
|
||||
|
||||
// 验证证件号码格式
|
||||
String idCardError = IdCardUtil.getErrorMessage(excel.getPersonId());
|
||||
if (idCardError != null) {
|
||||
throw new RuntimeException("证件号码" + idCardError);
|
||||
}
|
||||
private String failureKey(String taskId) {
|
||||
return statusKey(taskId) + ":failures";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,15 +4,21 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.info.collection.domain.CcdiBizIntermediary;
|
||||
import com.ruoyi.info.collection.domain.CcdiEnterpriseBaseInfo;
|
||||
import com.ruoyi.info.collection.domain.CcdiIntermediaryEnterpriseRelation;
|
||||
import com.ruoyi.info.collection.domain.dto.*;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiIntermediaryEnterpriseRelationExcel;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiIntermediaryEntityExcel;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiIntermediaryPersonExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiIntermediaryEnterpriseRelationVO;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiIntermediaryEntityDetailVO;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiIntermediaryPersonDetailVO;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiIntermediaryRelativeVO;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiIntermediaryVO;
|
||||
import com.ruoyi.info.collection.mapper.CcdiBizIntermediaryMapper;
|
||||
import com.ruoyi.info.collection.mapper.CcdiEnterpriseBaseInfoMapper;
|
||||
import com.ruoyi.info.collection.mapper.CcdiIntermediaryEnterpriseRelationMapper;
|
||||
import com.ruoyi.info.collection.mapper.CcdiIntermediaryMapper;
|
||||
import com.ruoyi.info.collection.service.ICcdiIntermediaryEnterpriseRelationImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiIntermediaryEntityImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiIntermediaryPersonImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiIntermediaryService;
|
||||
@@ -48,12 +54,18 @@ public class CcdiIntermediaryServiceImpl implements ICcdiIntermediaryService {
|
||||
@Resource
|
||||
private CcdiIntermediaryMapper intermediaryMapper;
|
||||
|
||||
@Resource
|
||||
private CcdiIntermediaryEnterpriseRelationMapper enterpriseRelationMapper;
|
||||
|
||||
@Resource
|
||||
private ICcdiIntermediaryPersonImportService personImportService;
|
||||
|
||||
@Resource
|
||||
private ICcdiIntermediaryEntityImportService entityImportService;
|
||||
|
||||
@Resource
|
||||
private ICcdiIntermediaryEnterpriseRelationImportService enterpriseRelationImportService;
|
||||
|
||||
@Resource
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
@@ -81,7 +93,7 @@ public class CcdiIntermediaryServiceImpl implements ICcdiIntermediaryService {
|
||||
@Override
|
||||
public CcdiIntermediaryPersonDetailVO selectIntermediaryPersonDetail(String bizId) {
|
||||
CcdiBizIntermediary person = bizIntermediaryMapper.selectById(bizId);
|
||||
if (person == null) {
|
||||
if (person == null || !isIntermediaryPerson(person)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -92,6 +104,25 @@ public class CcdiIntermediaryServiceImpl implements ICcdiIntermediaryService {
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CcdiIntermediaryRelativeVO> selectIntermediaryRelativeList(String bizId) {
|
||||
CcdiBizIntermediary owner = requireIntermediaryPerson(bizId);
|
||||
LambdaQueryWrapper<CcdiBizIntermediary> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CcdiBizIntermediary::getRelatedNumId, owner.getPersonId())
|
||||
.ne(CcdiBizIntermediary::getPersonSubType, "本人")
|
||||
.orderByDesc(CcdiBizIntermediary::getCreateTime);
|
||||
return bizIntermediaryMapper.selectList(wrapper).stream().map(this::buildRelativeVo).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CcdiIntermediaryRelativeVO selectIntermediaryRelativeDetail(String relativeBizId) {
|
||||
CcdiBizIntermediary relative = bizIntermediaryMapper.selectById(relativeBizId);
|
||||
if (relative == null || isIntermediaryPerson(relative)) {
|
||||
return null;
|
||||
}
|
||||
return buildRelativeVo(relative);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询实体中介详情
|
||||
*
|
||||
@@ -130,6 +161,8 @@ public class CcdiIntermediaryServiceImpl implements ICcdiIntermediaryService {
|
||||
|
||||
CcdiBizIntermediary person = new CcdiBizIntermediary();
|
||||
BeanUtils.copyProperties(addDTO, person);
|
||||
person.setPersonSubType("本人");
|
||||
person.setRelatedNumId(null);
|
||||
person.setDataSource("MANUAL");
|
||||
|
||||
return bizIntermediaryMapper.insert(person);
|
||||
@@ -151,10 +184,63 @@ public class CcdiIntermediaryServiceImpl implements ICcdiIntermediaryService {
|
||||
}
|
||||
}
|
||||
|
||||
CcdiBizIntermediary existing = bizIntermediaryMapper.selectById(editDTO.getBizId());
|
||||
if (existing == null || !isIntermediaryPerson(existing)) {
|
||||
throw new RuntimeException("中介本人不存在");
|
||||
}
|
||||
|
||||
CcdiBizIntermediary person = new CcdiBizIntermediary();
|
||||
BeanUtils.copyProperties(editDTO, person);
|
||||
person.setPersonSubType("本人");
|
||||
person.setRelatedNumId(null);
|
||||
int updated = bizIntermediaryMapper.updateById(person);
|
||||
syncRelativeOwnerPersonId(existing.getPersonId(), editDTO.getPersonId());
|
||||
return updated;
|
||||
}
|
||||
|
||||
return bizIntermediaryMapper.updateById(person);
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertIntermediaryRelative(String bizId, CcdiIntermediaryRelativeAddDTO addDTO) {
|
||||
CcdiBizIntermediary owner = requireIntermediaryPerson(bizId);
|
||||
validateRelativePersonSubType(addDTO.getPersonSubType());
|
||||
if (!checkRelativePersonUnique(owner.getPersonId(), addDTO.getPersonId(), null)) {
|
||||
throw new RuntimeException("该中介本人下已存在相同证件号亲属");
|
||||
}
|
||||
|
||||
CcdiBizIntermediary relative = new CcdiBizIntermediary();
|
||||
BeanUtils.copyProperties(addDTO, relative);
|
||||
relative.setRelatedNumId(owner.getPersonId());
|
||||
relative.setDataSource("MANUAL");
|
||||
return bizIntermediaryMapper.insert(relative);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int updateIntermediaryRelative(CcdiIntermediaryRelativeEditDTO editDTO) {
|
||||
CcdiBizIntermediary existing = bizIntermediaryMapper.selectById(editDTO.getBizId());
|
||||
if (existing == null || isIntermediaryPerson(existing)) {
|
||||
throw new RuntimeException("中介亲属不存在");
|
||||
}
|
||||
validateRelativePersonSubType(editDTO.getPersonSubType());
|
||||
if (StringUtils.isNotEmpty(editDTO.getPersonId())
|
||||
&& !checkRelativePersonUnique(existing.getRelatedNumId(), editDTO.getPersonId(), editDTO.getBizId())) {
|
||||
throw new RuntimeException("该中介本人下已存在相同证件号亲属");
|
||||
}
|
||||
|
||||
CcdiBizIntermediary relative = new CcdiBizIntermediary();
|
||||
BeanUtils.copyProperties(editDTO, relative);
|
||||
relative.setRelatedNumId(existing.getRelatedNumId());
|
||||
return bizIntermediaryMapper.updateById(relative);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int deleteIntermediaryRelative(String relativeBizId) {
|
||||
CcdiBizIntermediary existing = bizIntermediaryMapper.selectById(relativeBizId);
|
||||
if (existing == null || isIntermediaryPerson(existing)) {
|
||||
throw new RuntimeException("中介亲属不存在");
|
||||
}
|
||||
return bizIntermediaryMapper.deleteById(relativeBizId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,6 +283,49 @@ public class CcdiIntermediaryServiceImpl implements ICcdiIntermediaryService {
|
||||
return enterpriseBaseInfoMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CcdiIntermediaryEnterpriseRelationVO> selectIntermediaryEnterpriseRelationList(String bizId) {
|
||||
return enterpriseRelationMapper.selectByIntermediaryBizId(bizId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CcdiIntermediaryEnterpriseRelationVO selectIntermediaryEnterpriseRelationDetail(Long id) {
|
||||
return enterpriseRelationMapper.selectDetailById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertIntermediaryEnterpriseRelation(String bizId, CcdiIntermediaryEnterpriseRelationAddDTO addDTO) {
|
||||
CcdiBizIntermediary owner = requireIntermediaryPerson(bizId);
|
||||
validateEnterpriseRelation(owner.getBizId(), addDTO.getSocialCreditCode(), null);
|
||||
|
||||
CcdiIntermediaryEnterpriseRelation relation = new CcdiIntermediaryEnterpriseRelation();
|
||||
BeanUtils.copyProperties(addDTO, relation);
|
||||
relation.setIntermediaryBizId(owner.getBizId());
|
||||
return enterpriseRelationMapper.insert(relation);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int updateIntermediaryEnterpriseRelation(CcdiIntermediaryEnterpriseRelationEditDTO editDTO) {
|
||||
CcdiIntermediaryEnterpriseRelation existing = enterpriseRelationMapper.selectById(editDTO.getId());
|
||||
if (existing == null) {
|
||||
throw new RuntimeException("中介关联机构不存在");
|
||||
}
|
||||
validateEnterpriseRelation(existing.getIntermediaryBizId(), editDTO.getSocialCreditCode(), existing.getId());
|
||||
|
||||
CcdiIntermediaryEnterpriseRelation relation = new CcdiIntermediaryEnterpriseRelation();
|
||||
BeanUtils.copyProperties(editDTO, relation);
|
||||
relation.setIntermediaryBizId(existing.getIntermediaryBizId());
|
||||
return enterpriseRelationMapper.updateById(relation);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int deleteIntermediaryEnterpriseRelation(Long id) {
|
||||
return enterpriseRelationMapper.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除中介
|
||||
*
|
||||
@@ -208,12 +337,20 @@ public class CcdiIntermediaryServiceImpl implements ICcdiIntermediaryService {
|
||||
public int deleteIntermediaryByIds(String[] ids) {
|
||||
int count = 0;
|
||||
for (String id : ids) {
|
||||
// 判断是个人还是实体(个人ID长度较长,实体统一社会信用代码18位)
|
||||
if (id.length() > 18) {
|
||||
// 个人中介
|
||||
CcdiBizIntermediary intermediary = bizIntermediaryMapper.selectById(id);
|
||||
if (intermediary != null) {
|
||||
if (isIntermediaryPerson(intermediary)) {
|
||||
bizIntermediaryMapper.delete(new LambdaQueryWrapper<CcdiBizIntermediary>()
|
||||
.eq(CcdiBizIntermediary::getRelatedNumId, intermediary.getPersonId())
|
||||
.ne(CcdiBizIntermediary::getPersonSubType, "本人"));
|
||||
enterpriseRelationMapper.delete(new LambdaQueryWrapper<CcdiIntermediaryEnterpriseRelation>()
|
||||
.eq(CcdiIntermediaryEnterpriseRelation::getIntermediaryBizId, id));
|
||||
}
|
||||
count += bizIntermediaryMapper.deleteById(id);
|
||||
} else {
|
||||
// 实体中介
|
||||
continue;
|
||||
}
|
||||
|
||||
if (enterpriseBaseInfoMapper.selectById(id) != null) {
|
||||
count += enterpriseBaseInfoMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
@@ -230,7 +367,8 @@ public class CcdiIntermediaryServiceImpl implements ICcdiIntermediaryService {
|
||||
@Override
|
||||
public boolean checkPersonIdUnique(String personId, String bizId) {
|
||||
LambdaQueryWrapper<CcdiBizIntermediary> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CcdiBizIntermediary::getPersonId, personId);
|
||||
wrapper.eq(CcdiBizIntermediary::getPersonId, personId)
|
||||
.eq(CcdiBizIntermediary::getPersonSubType, "本人");
|
||||
if (StringUtils.isNotEmpty(bizId)) {
|
||||
wrapper.ne(CcdiBizIntermediary::getBizId, bizId);
|
||||
}
|
||||
@@ -290,6 +428,31 @@ public class CcdiIntermediaryServiceImpl implements ICcdiIntermediaryService {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String importIntermediaryEnterpriseRelation(List<CcdiIntermediaryEnterpriseRelationExcel> list) {
|
||||
String taskId = UUID.randomUUID().toString();
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
String statusKey = "import:intermediary-enterprise-relation:" + taskId;
|
||||
Map<String, Object> statusData = new HashMap<>();
|
||||
statusData.put("taskId", taskId);
|
||||
statusData.put("status", "PROCESSING");
|
||||
statusData.put("totalCount", list.size());
|
||||
statusData.put("successCount", 0);
|
||||
statusData.put("failureCount", 0);
|
||||
statusData.put("progress", 0);
|
||||
statusData.put("startTime", startTime);
|
||||
statusData.put("message", "正在处理...");
|
||||
|
||||
redisTemplate.opsForHash().putAll(statusKey, statusData);
|
||||
redisTemplate.expire(statusKey, 7, TimeUnit.DAYS);
|
||||
|
||||
String userName = SecurityUtils.getUsername();
|
||||
enterpriseRelationImportService.importAsync(list, taskId, userName);
|
||||
return taskId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入实体中介数据(异步)
|
||||
*
|
||||
@@ -325,4 +488,70 @@ public class CcdiIntermediaryServiceImpl implements ICcdiIntermediaryService {
|
||||
|
||||
return taskId;
|
||||
}
|
||||
|
||||
private boolean isIntermediaryPerson(CcdiBizIntermediary person) {
|
||||
return "本人".equals(person.getPersonSubType());
|
||||
}
|
||||
|
||||
private CcdiBizIntermediary requireIntermediaryPerson(String bizId) {
|
||||
CcdiBizIntermediary owner = bizIntermediaryMapper.selectById(bizId);
|
||||
if (owner == null || !isIntermediaryPerson(owner)) {
|
||||
throw new RuntimeException("中介本人不存在");
|
||||
}
|
||||
return owner;
|
||||
}
|
||||
|
||||
private void validateRelativePersonSubType(String personSubType) {
|
||||
if ("本人".equals(personSubType)) {
|
||||
throw new RuntimeException("亲属关系不能为本人");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkRelativePersonUnique(String ownerPersonId, String personId, String excludeBizId) {
|
||||
LambdaQueryWrapper<CcdiBizIntermediary> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CcdiBizIntermediary::getRelatedNumId, ownerPersonId)
|
||||
.eq(CcdiBizIntermediary::getPersonId, personId)
|
||||
.ne(CcdiBizIntermediary::getPersonSubType, "本人");
|
||||
if (StringUtils.isNotEmpty(excludeBizId)) {
|
||||
wrapper.ne(CcdiBizIntermediary::getBizId, excludeBizId);
|
||||
}
|
||||
return bizIntermediaryMapper.selectCount(wrapper) == 0;
|
||||
}
|
||||
|
||||
private void validateEnterpriseRelation(String bizId, String socialCreditCode, Long excludeId) {
|
||||
requireIntermediaryPerson(bizId);
|
||||
if (enterpriseBaseInfoMapper.selectById(socialCreditCode) == null) {
|
||||
throw new RuntimeException("关联机构不存在");
|
||||
}
|
||||
boolean exists = enterpriseRelationMapper.existsByIntermediaryBizIdAndSocialCreditCode(bizId, socialCreditCode);
|
||||
if (exists) {
|
||||
if (excludeId == null) {
|
||||
throw new RuntimeException("该中介已关联此机构");
|
||||
}
|
||||
CcdiIntermediaryEnterpriseRelation existing = enterpriseRelationMapper.selectById(excludeId);
|
||||
if (existing == null || !socialCreditCode.equals(existing.getSocialCreditCode())) {
|
||||
throw new RuntimeException("该中介已关联此机构");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void syncRelativeOwnerPersonId(String oldOwnerPersonId, String newOwnerPersonId) {
|
||||
if (StringUtils.isEmpty(oldOwnerPersonId)
|
||||
|| StringUtils.isEmpty(newOwnerPersonId)
|
||||
|| oldOwnerPersonId.equals(newOwnerPersonId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
CcdiBizIntermediary relative = new CcdiBizIntermediary();
|
||||
relative.setRelatedNumId(newOwnerPersonId);
|
||||
bizIntermediaryMapper.update(relative, new LambdaQueryWrapper<CcdiBizIntermediary>()
|
||||
.eq(CcdiBizIntermediary::getRelatedNumId, oldOwnerPersonId)
|
||||
.ne(CcdiBizIntermediary::getPersonSubType, "本人"));
|
||||
}
|
||||
|
||||
private CcdiIntermediaryRelativeVO buildRelativeVo(CcdiBizIntermediary relative) {
|
||||
CcdiIntermediaryRelativeVO vo = new CcdiIntermediaryRelativeVO();
|
||||
BeanUtils.copyProperties(relative, vo);
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,15 +67,15 @@
|
||||
ai.status AS status,
|
||||
ai.effective_date AS effectiveDate,
|
||||
ai.invalid_date AS invalidDate,
|
||||
ar.is_self_account AS isActualControl,
|
||||
ar.monthly_avg_trans_count AS avgMonthTxnCount,
|
||||
ar.monthly_avg_trans_amount AS avgMonthTxnAmount,
|
||||
ar.trans_freq_type AS txnFrequencyLevel,
|
||||
ar.dr_max_single_amount AS debitSingleMaxAmount,
|
||||
ar.cr_max_single_amount AS creditSingleMaxAmount,
|
||||
ar.dr_max_daily_amount AS debitDailyMaxAmount,
|
||||
ar.cr_max_daily_amount AS creditDailyMaxAmount,
|
||||
ar.trans_risk_level AS txnRiskLevel,
|
||||
ai.is_self_account AS isActualControl,
|
||||
ai.monthly_avg_trans_count AS avgMonthTxnCount,
|
||||
ai.monthly_avg_trans_amount AS avgMonthTxnAmount,
|
||||
ai.trans_freq_type AS txnFrequencyLevel,
|
||||
ai.dr_max_single_amount AS debitSingleMaxAmount,
|
||||
ai.cr_max_single_amount AS creditSingleMaxAmount,
|
||||
ai.dr_max_daily_amount AS debitDailyMaxAmount,
|
||||
ai.cr_max_daily_amount AS creditDailyMaxAmount,
|
||||
ai.trans_risk_level AS txnRiskLevel,
|
||||
ai.create_by AS createBy,
|
||||
ai.create_time AS createTime,
|
||||
ai.update_by AS updateBy,
|
||||
@@ -107,10 +107,10 @@
|
||||
AND ai.account_type = #{query.accountType}
|
||||
</if>
|
||||
<if test="query.isActualControl != null">
|
||||
AND ar.is_self_account = #{query.isActualControl}
|
||||
AND ai.is_self_account = #{query.isActualControl}
|
||||
</if>
|
||||
<if test="query.riskLevel != null and query.riskLevel != ''">
|
||||
AND ar.trans_risk_level = #{query.riskLevel}
|
||||
AND ai.trans_risk_level = #{query.riskLevel}
|
||||
</if>
|
||||
<if test="query.status != null">
|
||||
AND ai.status = #{query.status}
|
||||
@@ -121,7 +121,6 @@
|
||||
SELECT
|
||||
<include refid="AccountInfoSelectColumns"/>
|
||||
FROM ccdi_account_info ai
|
||||
LEFT JOIN ccdi_account_result ar ON ai.account_no = ar.account_no
|
||||
LEFT JOIN ccdi_base_staff bs ON ai.owner_type = 'EMPLOYEE' AND ai.owner_id = bs.id_card
|
||||
LEFT JOIN ccdi_staff_fmy_relation fr ON ai.owner_type = 'RELATION' AND ai.owner_id = fr.relation_cert_no
|
||||
LEFT JOIN ccdi_base_staff bsRel ON fr.person_id = bsRel.id_card
|
||||
@@ -133,7 +132,6 @@
|
||||
SELECT
|
||||
<include refid="AccountInfoSelectColumns"/>
|
||||
FROM ccdi_account_info ai
|
||||
LEFT JOIN ccdi_account_result ar ON ai.account_no = ar.account_no
|
||||
LEFT JOIN ccdi_base_staff bs ON ai.owner_type = 'EMPLOYEE' AND ai.owner_id = bs.id_card
|
||||
LEFT JOIN ccdi_staff_fmy_relation fr ON ai.owner_type = 'RELATION' AND ai.owner_id = fr.relation_cert_no
|
||||
LEFT JOIN ccdi_base_staff bsRel ON fr.person_id = bsRel.id_card
|
||||
@@ -145,7 +143,6 @@
|
||||
SELECT
|
||||
<include refid="AccountInfoSelectColumns"/>
|
||||
FROM ccdi_account_info ai
|
||||
LEFT JOIN ccdi_account_result ar ON ai.account_no = ar.account_no
|
||||
LEFT JOIN ccdi_base_staff bs ON ai.owner_type = 'EMPLOYEE' AND ai.owner_id = bs.id_card
|
||||
LEFT JOIN ccdi_staff_fmy_relation fr ON ai.owner_type = 'RELATION' AND ai.owner_id = fr.relation_cert_no
|
||||
LEFT JOIN ccdi_base_staff bsRel ON fr.person_id = bsRel.id_card
|
||||
|
||||
@@ -14,13 +14,14 @@
|
||||
<result property="phone" column="phone"/>
|
||||
<result property="annualIncome" column="annual_income"/>
|
||||
<result property="hireDate" column="hire_date"/>
|
||||
<result property="partyMember" column="is_party_member"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectBaseStaffPageWithDept" resultMap="CcdiBaseStaffVOResult">
|
||||
SELECT
|
||||
e.staff_id, e.name, e.dept_id, e.id_card, e.phone, e.annual_income, e.hire_date, e.status, e.create_time,
|
||||
e.staff_id, e.name, e.dept_id, e.id_card, e.phone, e.annual_income, e.hire_date, e.is_party_member, e.status, e.create_time,
|
||||
d.dept_name
|
||||
FROM ccdi_base_staff e
|
||||
LEFT JOIN sys_dept d ON e.dept_id = d.dept_id
|
||||
@@ -47,12 +48,12 @@
|
||||
<!-- 批量插入或更新员工信息(只更新非null字段) -->
|
||||
<insert id="insertOrUpdateBatch" parameterType="java.util.List">
|
||||
INSERT INTO ccdi_base_staff
|
||||
(staff_id, name, dept_id, id_card, phone, annual_income, hire_date, status,
|
||||
(staff_id, name, dept_id, id_card, phone, annual_income, hire_date, is_party_member, status,
|
||||
create_time, create_by, update_by, update_time)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.staffId}, #{item.name}, #{item.deptId}, #{item.idCard},
|
||||
#{item.phone}, #{item.annualIncome}, #{item.hireDate}, #{item.status}, NOW(),
|
||||
#{item.phone}, #{item.annualIncome}, #{item.hireDate}, #{item.partyMember}, #{item.status}, NOW(),
|
||||
#{item.createBy}, #{item.updateBy}, NOW())
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
@@ -61,6 +62,7 @@
|
||||
phone = COALESCE(VALUES(phone), phone),
|
||||
annual_income = COALESCE(VALUES(annual_income), annual_income),
|
||||
hire_date = COALESCE(VALUES(hire_date), hire_date),
|
||||
is_party_member = COALESCE(VALUES(is_party_member), is_party_member),
|
||||
status = COALESCE(VALUES(status), status),
|
||||
update_by = COALESCE(VALUES(update_by), update_by),
|
||||
update_time = NOW()
|
||||
@@ -69,12 +71,12 @@
|
||||
<!-- 批量插入员工信息 -->
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
INSERT INTO ccdi_base_staff
|
||||
(staff_id, name, dept_id, id_card, phone, annual_income, hire_date, status,
|
||||
(staff_id, name, dept_id, id_card, phone, annual_income, hire_date, is_party_member, status,
|
||||
create_time, create_by, update_by, update_time)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.staffId}, #{item.name}, #{item.deptId}, #{item.idCard},
|
||||
#{item.phone}, #{item.annualIncome}, #{item.hireDate}, #{item.status}, NOW(),
|
||||
#{item.phone}, #{item.annualIncome}, #{item.hireDate}, #{item.partyMember}, #{item.status}, NOW(),
|
||||
#{item.createBy}, #{item.updateBy}, NOW())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
@@ -4,6 +4,83 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.info.collection.mapper.CcdiEnterpriseBaseInfoMapper">
|
||||
|
||||
<resultMap id="CcdiEnterpriseBaseInfoVoResultMap" type="com.ruoyi.info.collection.domain.vo.CcdiEnterpriseBaseInfoVO">
|
||||
<id property="socialCreditCode" column="social_credit_code"/>
|
||||
<result property="enterpriseName" column="enterprise_name"/>
|
||||
<result property="enterpriseType" column="enterprise_type"/>
|
||||
<result property="enterpriseNature" column="enterprise_nature"/>
|
||||
<result property="industryClass" column="industry_class"/>
|
||||
<result property="industryName" column="industry_name"/>
|
||||
<result property="establishDate" column="establish_date"/>
|
||||
<result property="registerAddress" column="register_address"/>
|
||||
<result property="legalRepresentative" column="legal_representative"/>
|
||||
<result property="legalCertType" column="legal_cert_type"/>
|
||||
<result property="legalCertNo" column="legal_cert_no"/>
|
||||
<result property="shareholder1" column="shareholder1"/>
|
||||
<result property="shareholder2" column="shareholder2"/>
|
||||
<result property="shareholder3" column="shareholder3"/>
|
||||
<result property="shareholder4" column="shareholder4"/>
|
||||
<result property="shareholder5" column="shareholder5"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="riskLevel" column="risk_level"/>
|
||||
<result property="entSource" column="ent_source"/>
|
||||
<result property="dataSource" column="data_source"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectEnterpriseBaseInfoPage" resultMap="CcdiEnterpriseBaseInfoVoResultMap">
|
||||
SELECT
|
||||
social_credit_code,
|
||||
enterprise_name,
|
||||
enterprise_type,
|
||||
enterprise_nature,
|
||||
industry_class,
|
||||
industry_name,
|
||||
establish_date,
|
||||
register_address,
|
||||
legal_representative,
|
||||
legal_cert_type,
|
||||
legal_cert_no,
|
||||
shareholder1,
|
||||
shareholder2,
|
||||
shareholder3,
|
||||
shareholder4,
|
||||
shareholder5,
|
||||
status,
|
||||
risk_level,
|
||||
ent_source,
|
||||
data_source,
|
||||
create_time
|
||||
FROM ccdi_enterprise_base_info
|
||||
<where>
|
||||
<if test="queryDTO != null and queryDTO.enterpriseName != null and queryDTO.enterpriseName != ''">
|
||||
AND enterprise_name LIKE CONCAT('%', #{queryDTO.enterpriseName}, '%')
|
||||
</if>
|
||||
<if test="queryDTO != null and queryDTO.socialCreditCode != null and queryDTO.socialCreditCode != ''">
|
||||
AND social_credit_code = #{queryDTO.socialCreditCode}
|
||||
</if>
|
||||
<if test="queryDTO != null and queryDTO.enterpriseType != null and queryDTO.enterpriseType != ''">
|
||||
AND enterprise_type = #{queryDTO.enterpriseType}
|
||||
</if>
|
||||
<if test="queryDTO != null and queryDTO.enterpriseNature != null and queryDTO.enterpriseNature != ''">
|
||||
AND enterprise_nature = #{queryDTO.enterpriseNature}
|
||||
</if>
|
||||
<if test="queryDTO != null and queryDTO.industryClass != null and queryDTO.industryClass != ''">
|
||||
AND industry_class LIKE CONCAT('%', #{queryDTO.industryClass}, '%')
|
||||
</if>
|
||||
<if test="queryDTO != null and queryDTO.status != null and queryDTO.status != ''">
|
||||
AND status = #{queryDTO.status}
|
||||
</if>
|
||||
<if test="queryDTO != null and queryDTO.riskLevel != null and queryDTO.riskLevel != ''">
|
||||
AND risk_level = #{queryDTO.riskLevel}
|
||||
</if>
|
||||
<if test="queryDTO != null and queryDTO.entSource != null and queryDTO.entSource != ''">
|
||||
AND ent_source = #{queryDTO.entSource}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 批量插入实体中介 -->
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
INSERT INTO ccdi_enterprise_base_info (
|
||||
@@ -21,7 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{item.legalRepresentative}, #{item.legalCertType}, #{item.legalCertNo},
|
||||
#{item.shareholder1}, #{item.shareholder2}, #{item.shareholder3}, #{item.shareholder4}, #{item.shareholder5},
|
||||
#{item.status}, #{item.riskLevel}, #{item.entSource}, #{item.dataSource},
|
||||
#{item.createdBy}, #{item.updatedBy}, #{item.createTime}, #{item.updateTime}
|
||||
#{item.createdBy}, #{item.updatedBy}, NOW(), NOW()
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
@@ -43,7 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{item.legalRepresentative}, #{item.legalCertType}, #{item.legalCertNo},
|
||||
#{item.shareholder1}, #{item.shareholder2}, #{item.shareholder3}, #{item.shareholder4}, #{item.shareholder5},
|
||||
#{item.status}, #{item.riskLevel}, #{item.entSource}, #{item.dataSource},
|
||||
#{item.createdBy}, #{item.updatedBy}, #{item.createTime}, #{item.updateTime}
|
||||
#{item.createdBy}, #{item.updatedBy}, NOW(), NOW()
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
@@ -67,7 +144,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ent_source = VALUES(ent_source),
|
||||
data_source = VALUES(data_source),
|
||||
updated_by = VALUES(updated_by),
|
||||
update_time = VALUES(update_time)
|
||||
update_time = NOW()
|
||||
</insert>
|
||||
|
||||
<!-- 批量更新实体中介 -->
|
||||
@@ -95,7 +172,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="item.entSource != null">ent_source = #{item.entSource},</if>
|
||||
<if test="item.dataSource != null">data_source = #{item.dataSource},</if>
|
||||
<if test="item.updatedBy != null">updated_by = #{item.updatedBy},</if>
|
||||
update_time = #{item.updateTime}
|
||||
update_time = NOW()
|
||||
</set>
|
||||
WHERE social_credit_code = #{item.socialCreditCode}
|
||||
</foreach>
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.info.collection.mapper.CcdiIntermediaryEnterpriseRelationMapper">
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
INSERT INTO ccdi_intermediary_enterprise_relation (
|
||||
intermediary_biz_id, social_credit_code, relation_person_post, remark,
|
||||
created_by, updated_by, create_time, update_time
|
||||
) VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.intermediaryBizId}, #{item.socialCreditCode}, #{item.relationPersonPost}, #{item.remark},
|
||||
#{item.createdBy}, #{item.updatedBy}, NOW(), NOW()
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<resultMap id="CcdiIntermediaryEnterpriseRelationVOResult"
|
||||
type="com.ruoyi.info.collection.domain.vo.CcdiIntermediaryEnterpriseRelationVO">
|
||||
<id property="id" column="id"/>
|
||||
<result property="intermediaryBizId" column="intermediary_biz_id"/>
|
||||
<result property="intermediaryName" column="intermediary_name"/>
|
||||
<result property="intermediaryPersonId" column="intermediary_person_id"/>
|
||||
<result property="socialCreditCode" column="social_credit_code"/>
|
||||
<result property="enterpriseName" column="enterprise_name"/>
|
||||
<result property="relationPersonPost" column="relation_person_post"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByIntermediaryBizId" resultMap="CcdiIntermediaryEnterpriseRelationVOResult">
|
||||
SELECT
|
||||
rel.id,
|
||||
rel.intermediary_biz_id,
|
||||
parent.name AS intermediary_name,
|
||||
parent.person_id AS intermediary_person_id,
|
||||
rel.social_credit_code,
|
||||
ent.enterprise_name,
|
||||
rel.relation_person_post,
|
||||
rel.remark,
|
||||
rel.create_time
|
||||
FROM ccdi_intermediary_enterprise_relation rel
|
||||
INNER JOIN ccdi_biz_intermediary parent
|
||||
ON rel.intermediary_biz_id = parent.biz_id
|
||||
LEFT JOIN ccdi_enterprise_base_info ent
|
||||
ON rel.social_credit_code = ent.social_credit_code
|
||||
WHERE rel.intermediary_biz_id = #{bizId}
|
||||
ORDER BY rel.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectDetailById" resultMap="CcdiIntermediaryEnterpriseRelationVOResult">
|
||||
SELECT
|
||||
rel.id,
|
||||
rel.intermediary_biz_id,
|
||||
parent.name AS intermediary_name,
|
||||
parent.person_id AS intermediary_person_id,
|
||||
rel.social_credit_code,
|
||||
ent.enterprise_name,
|
||||
rel.relation_person_post,
|
||||
rel.remark,
|
||||
rel.create_time
|
||||
FROM ccdi_intermediary_enterprise_relation rel
|
||||
INNER JOIN ccdi_biz_intermediary parent
|
||||
ON rel.intermediary_biz_id = parent.biz_id
|
||||
LEFT JOIN ccdi_enterprise_base_info ent
|
||||
ON rel.social_credit_code = ent.social_credit_code
|
||||
WHERE rel.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="existsByIntermediaryBizIdAndSocialCreditCode" resultType="boolean">
|
||||
SELECT COUNT(1) > 0
|
||||
FROM ccdi_intermediary_enterprise_relation
|
||||
WHERE intermediary_biz_id = #{bizId}
|
||||
AND social_credit_code = #{socialCreditCode}
|
||||
</select>
|
||||
|
||||
<select id="batchExistsByCombinations" resultType="string">
|
||||
SELECT CONCAT(intermediary_biz_id, '|', social_credit_code)
|
||||
FROM ccdi_intermediary_enterprise_relation
|
||||
WHERE CONCAT(intermediary_biz_id, '|', social_credit_code) IN
|
||||
<foreach collection="combinations" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -4,57 +4,86 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.info.collection.mapper.CcdiIntermediaryMapper">
|
||||
|
||||
<!--
|
||||
中介黑名单联合查询
|
||||
支持按中介类型筛选: 1=个人中介, 2=实体中介, null=全部
|
||||
使用MyBatis Plus分页插件自动处理分页
|
||||
-->
|
||||
<!-- 中介综合库联合查询 -->
|
||||
<select id="selectIntermediaryList" resultType="com.ruoyi.info.collection.domain.vo.CcdiIntermediaryVO">
|
||||
SELECT * FROM (
|
||||
<!-- 查询个人中介 -->
|
||||
SELECT
|
||||
biz_id as id,
|
||||
name,
|
||||
person_id as certificate_no,
|
||||
'1' as intermediary_type,
|
||||
person_type,
|
||||
company,
|
||||
data_source,
|
||||
create_time,
|
||||
update_time
|
||||
CAST('INTERMEDIARY' AS CHAR CHARACTER SET utf8mb4) COLLATE utf8mb4_general_ci AS record_type,
|
||||
biz_id COLLATE utf8mb4_general_ci AS record_id,
|
||||
name COLLATE utf8mb4_general_ci AS name,
|
||||
person_id COLLATE utf8mb4_general_ci AS certificate_no,
|
||||
name COLLATE utf8mb4_general_ci AS related_intermediary_name,
|
||||
CAST('本人' AS CHAR CHARACTER SET utf8mb4) COLLATE utf8mb4_general_ci AS relation_text,
|
||||
person_id COLLATE utf8mb4_general_ci AS related_intermediary_certificate_no,
|
||||
create_time
|
||||
FROM ccdi_biz_intermediary
|
||||
WHERE person_sub_type COLLATE utf8mb4_general_ci = '本人' COLLATE utf8mb4_general_ci
|
||||
|
||||
UNION ALL
|
||||
|
||||
<!-- 查询实体中介 -->
|
||||
SELECT
|
||||
social_credit_code as id,
|
||||
enterprise_name as name,
|
||||
social_credit_code as certificate_no,
|
||||
'2' as intermediary_type,
|
||||
'实体' as person_type,
|
||||
enterprise_name as company,
|
||||
data_source,
|
||||
create_time,
|
||||
update_time
|
||||
FROM ccdi_enterprise_base_info
|
||||
WHERE risk_level = '1' AND ent_source = 'INTERMEDIARY'
|
||||
CAST('RELATIVE' AS CHAR CHARACTER SET utf8mb4) COLLATE utf8mb4_general_ci AS record_type,
|
||||
child.biz_id COLLATE utf8mb4_general_ci AS record_id,
|
||||
child.name COLLATE utf8mb4_general_ci AS name,
|
||||
child.person_id COLLATE utf8mb4_general_ci AS certificate_no,
|
||||
parent.name COLLATE utf8mb4_general_ci AS related_intermediary_name,
|
||||
child.person_sub_type COLLATE utf8mb4_general_ci AS relation_text,
|
||||
parent.person_id COLLATE utf8mb4_general_ci AS related_intermediary_certificate_no,
|
||||
child.create_time
|
||||
FROM ccdi_biz_intermediary child
|
||||
INNER JOIN ccdi_biz_intermediary parent
|
||||
ON child.related_num_id COLLATE utf8mb4_general_ci = parent.person_id COLLATE utf8mb4_general_ci
|
||||
AND parent.person_sub_type COLLATE utf8mb4_general_ci = '本人' COLLATE utf8mb4_general_ci
|
||||
WHERE child.person_sub_type IS NOT NULL
|
||||
AND child.person_sub_type COLLATE utf8mb4_general_ci != '本人' COLLATE utf8mb4_general_ci
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
CAST('ENTERPRISE_RELATION' AS CHAR CHARACTER SET utf8mb4) COLLATE utf8mb4_general_ci AS record_type,
|
||||
CAST(rel.id AS CHAR CHARACTER SET utf8mb4) COLLATE utf8mb4_general_ci AS record_id,
|
||||
COALESCE(
|
||||
ent.enterprise_name COLLATE utf8mb4_general_ci,
|
||||
rel.social_credit_code COLLATE utf8mb4_general_ci
|
||||
) COLLATE utf8mb4_general_ci AS name,
|
||||
rel.social_credit_code COLLATE utf8mb4_general_ci AS certificate_no,
|
||||
parent.name COLLATE utf8mb4_general_ci AS related_intermediary_name,
|
||||
COALESCE(
|
||||
NULLIF(rel.relation_person_post COLLATE utf8mb4_general_ci, ''),
|
||||
CAST('实体' AS CHAR CHARACTER SET utf8mb4) COLLATE utf8mb4_general_ci
|
||||
) COLLATE utf8mb4_general_ci AS relation_text,
|
||||
parent.person_id COLLATE utf8mb4_general_ci AS related_intermediary_certificate_no,
|
||||
rel.create_time
|
||||
FROM ccdi_intermediary_enterprise_relation rel
|
||||
INNER JOIN ccdi_biz_intermediary parent
|
||||
ON rel.intermediary_biz_id COLLATE utf8mb4_general_ci = parent.biz_id COLLATE utf8mb4_general_ci
|
||||
AND parent.person_sub_type COLLATE utf8mb4_general_ci = '本人' COLLATE utf8mb4_general_ci
|
||||
LEFT JOIN ccdi_enterprise_base_info ent
|
||||
ON rel.social_credit_code COLLATE utf8mb4_general_ci = ent.social_credit_code COLLATE utf8mb4_general_ci
|
||||
) AS combined_result
|
||||
<where>
|
||||
<!-- 按中介类型筛选 -->
|
||||
<if test="query.intermediaryType != null and query.intermediaryType != ''">
|
||||
AND intermediary_type = #{query.intermediaryType}
|
||||
<if test="query.recordType != null and query.recordType != ''">
|
||||
AND record_type COLLATE utf8mb4_general_ci =
|
||||
CONVERT(#{query.recordType} USING utf8mb4) COLLATE utf8mb4_general_ci
|
||||
</if>
|
||||
<!-- 按姓名/机构名称模糊查询 -->
|
||||
<if test="query.name != null and query.name != ''">
|
||||
AND name LIKE CONCAT('%', #{query.name}, '%')
|
||||
AND name COLLATE utf8mb4_general_ci LIKE
|
||||
CONCAT('%', CONVERT(#{query.name} USING utf8mb4), '%') COLLATE utf8mb4_general_ci
|
||||
</if>
|
||||
<!-- 按证件号/统一社会信用代码精确查询 -->
|
||||
<if test="query.certificateNo != null and query.certificateNo != ''">
|
||||
AND certificate_no = #{query.certificateNo}
|
||||
AND certificate_no COLLATE utf8mb4_general_ci =
|
||||
CONVERT(#{query.certificateNo} USING utf8mb4) COLLATE utf8mb4_general_ci
|
||||
</if>
|
||||
<if test="query.relatedIntermediaryKeyword != null and query.relatedIntermediaryKeyword != ''">
|
||||
AND (
|
||||
related_intermediary_name COLLATE utf8mb4_general_ci LIKE
|
||||
CONCAT('%', CONVERT(#{query.relatedIntermediaryKeyword} USING utf8mb4), '%') COLLATE utf8mb4_general_ci
|
||||
OR related_intermediary_certificate_no COLLATE utf8mb4_general_ci LIKE
|
||||
CONCAT('%', CONVERT(#{query.relatedIntermediaryKeyword} USING utf8mb4), '%') COLLATE utf8mb4_general_ci
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY update_time DESC
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
package com.ruoyi.info.collection.controller;
|
||||
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiIntermediaryEnterpriseRelationExcel;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiIntermediaryPersonExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportResultVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportStatusVO;
|
||||
import com.ruoyi.info.collection.domain.vo.IntermediaryEnterpriseRelationImportFailureVO;
|
||||
import com.ruoyi.info.collection.domain.vo.IntermediaryPersonImportFailureVO;
|
||||
import com.ruoyi.info.collection.service.ICcdiIntermediaryEnterpriseRelationImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiIntermediaryPersonImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiIntermediaryService;
|
||||
import com.ruoyi.info.collection.utils.EasyExcelUtil;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockedStatic;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.mockStatic;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class CcdiIntermediaryControllerTest {
|
||||
|
||||
@InjectMocks
|
||||
private CcdiIntermediaryController controller;
|
||||
|
||||
@Mock
|
||||
private ICcdiIntermediaryService intermediaryService;
|
||||
|
||||
@Mock
|
||||
private ICcdiIntermediaryPersonImportService personImportService;
|
||||
|
||||
@Mock
|
||||
private ICcdiIntermediaryEnterpriseRelationImportService enterpriseRelationImportService;
|
||||
|
||||
@Test
|
||||
void importPersonData_shouldReturnWarnWhenExcelHasNoRows() throws Exception {
|
||||
MockMultipartFile file = new MockMultipartFile(
|
||||
"file",
|
||||
"intermediary-empty.xlsx",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"empty".getBytes(StandardCharsets.UTF_8)
|
||||
);
|
||||
|
||||
try (MockedStatic<EasyExcelUtil> mocked = mockStatic(EasyExcelUtil.class)) {
|
||||
mocked.when(() -> EasyExcelUtil.importExcel(any(InputStream.class), eq(CcdiIntermediaryPersonExcel.class)))
|
||||
.thenReturn(List.of());
|
||||
|
||||
AjaxResult result = controller.importPersonData(file);
|
||||
|
||||
assertEquals(HttpStatus.ERROR, result.get(AjaxResult.CODE_TAG));
|
||||
assertEquals("至少需要一条数据", result.get(AjaxResult.MSG_TAG));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void importPersonData_shouldReturnSuccessWhenTaskCreated() throws Exception {
|
||||
MockMultipartFile file = new MockMultipartFile(
|
||||
"file",
|
||||
"intermediary-person.xlsx",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"person".getBytes(StandardCharsets.UTF_8)
|
||||
);
|
||||
CcdiIntermediaryPersonExcel excel = new CcdiIntermediaryPersonExcel();
|
||||
excel.setPersonId("320101199001010011");
|
||||
when(intermediaryService.importIntermediaryPerson(List.of(excel))).thenReturn("task-person");
|
||||
|
||||
try (MockedStatic<EasyExcelUtil> mocked = mockStatic(EasyExcelUtil.class)) {
|
||||
mocked.when(() -> EasyExcelUtil.importExcel(any(InputStream.class), eq(CcdiIntermediaryPersonExcel.class)))
|
||||
.thenReturn(List.of(excel));
|
||||
|
||||
AjaxResult result = controller.importPersonData(file);
|
||||
|
||||
assertEquals(HttpStatus.SUCCESS, result.get(AjaxResult.CODE_TAG));
|
||||
ImportResultVO data = (ImportResultVO) result.get(AjaxResult.DATA_TAG);
|
||||
assertEquals("task-person", data.getTaskId());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void importEnterpriseRelationData_shouldReturnSuccessWhenTaskCreated() throws Exception {
|
||||
MockMultipartFile file = new MockMultipartFile(
|
||||
"file",
|
||||
"intermediary-relation.xlsx",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"relation".getBytes(StandardCharsets.UTF_8)
|
||||
);
|
||||
CcdiIntermediaryEnterpriseRelationExcel excel = new CcdiIntermediaryEnterpriseRelationExcel();
|
||||
excel.setOwnerPersonId("320101199001010011");
|
||||
excel.setSocialCreditCode("91330100MA27X12345");
|
||||
when(intermediaryService.importIntermediaryEnterpriseRelation(List.of(excel))).thenReturn("task-relation");
|
||||
|
||||
try (MockedStatic<EasyExcelUtil> mocked = mockStatic(EasyExcelUtil.class)) {
|
||||
mocked.when(() -> EasyExcelUtil.importExcel(any(InputStream.class), eq(CcdiIntermediaryEnterpriseRelationExcel.class)))
|
||||
.thenReturn(List.of(excel));
|
||||
|
||||
AjaxResult result = controller.importEnterpriseRelationData(file);
|
||||
|
||||
assertEquals(HttpStatus.SUCCESS, result.get(AjaxResult.CODE_TAG));
|
||||
ImportResultVO data = (ImportResultVO) result.get(AjaxResult.DATA_TAG);
|
||||
assertEquals("task-relation", data.getTaskId());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void getEnterpriseRelationImportStatus_shouldDelegateToRelationImportService() {
|
||||
ImportStatusVO statusVO = new ImportStatusVO();
|
||||
statusVO.setTaskId("task-status");
|
||||
when(enterpriseRelationImportService.getImportStatus("task-status")).thenReturn(statusVO);
|
||||
|
||||
AjaxResult result = controller.getEnterpriseRelationImportStatus("task-status");
|
||||
|
||||
assertEquals(HttpStatus.SUCCESS, result.get(AjaxResult.CODE_TAG));
|
||||
assertEquals(statusVO, result.get(AjaxResult.DATA_TAG));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getEnterpriseRelationImportFailures_shouldReturnPagedRows() {
|
||||
IntermediaryEnterpriseRelationImportFailureVO failure1 = new IntermediaryEnterpriseRelationImportFailureVO();
|
||||
failure1.setOwnerPersonId("A1");
|
||||
IntermediaryEnterpriseRelationImportFailureVO failure2 = new IntermediaryEnterpriseRelationImportFailureVO();
|
||||
failure2.setOwnerPersonId("A2");
|
||||
when(enterpriseRelationImportService.getImportFailures("task-failures")).thenReturn(List.of(failure1, failure2));
|
||||
|
||||
TableDataInfo result = controller.getEnterpriseRelationImportFailures("task-failures", 2, 1);
|
||||
|
||||
assertEquals(2, result.getTotal());
|
||||
assertEquals(1, result.getRows().size());
|
||||
assertEquals("A2", ((IntermediaryEnterpriseRelationImportFailureVO) result.getRows().get(0)).getOwnerPersonId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getPersonImportFailures_shouldReturnPagedRows() {
|
||||
IntermediaryPersonImportFailureVO failure1 = new IntermediaryPersonImportFailureVO();
|
||||
failure1.setPersonId("A1");
|
||||
IntermediaryPersonImportFailureVO failure2 = new IntermediaryPersonImportFailureVO();
|
||||
failure2.setPersonId("A2");
|
||||
when(personImportService.getImportFailures("task-person-failures")).thenReturn(List.of(failure1, failure2));
|
||||
|
||||
TableDataInfo result = controller.getPersonImportFailures("task-person-failures", 2, 1);
|
||||
|
||||
assertEquals(2, result.getTotal());
|
||||
assertEquals(1, result.getRows().size());
|
||||
assertEquals("A2", ((IntermediaryPersonImportFailureVO) result.getRows().get(0)).getPersonId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void importEnterpriseRelationTemplate_shouldUseRelationTemplateName() {
|
||||
try (MockedStatic<EasyExcelUtil> mocked = mockStatic(EasyExcelUtil.class)) {
|
||||
controller.importEnterpriseRelationTemplate(null);
|
||||
|
||||
mocked.verify(() -> EasyExcelUtil.importTemplateWithDictDropdown(
|
||||
null,
|
||||
CcdiIntermediaryEnterpriseRelationExcel.class,
|
||||
"中介实体关联关系信息"
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.ruoyi.info.collection.mapper;
|
||||
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiAccountInfoQueryDTO;
|
||||
import org.apache.ibatis.builder.xml.XMLMapperBuilder;
|
||||
import org.apache.ibatis.mapping.BoundSql;
|
||||
import org.apache.ibatis.mapping.Environment;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.scripting.xmltags.XMLLanguageDriver;
|
||||
import org.apache.ibatis.session.Configuration;
|
||||
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
|
||||
import org.apache.ibatis.type.TypeAliasRegistry;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class CcdiAccountInfoMapperTest {
|
||||
|
||||
private static final String RESOURCE = "mapper/info/collection/CcdiAccountInfoMapper.xml";
|
||||
|
||||
@Test
|
||||
void selectAccountInfoPage_shouldReadAnalysisColumnsFromAccountInfoTableOnly() throws Exception {
|
||||
MappedStatement mappedStatement = loadMappedStatement(
|
||||
"com.ruoyi.info.collection.mapper.CcdiAccountInfoMapper.selectAccountInfoPage");
|
||||
|
||||
String sql = renderSql(mappedStatement, Map.of("query", new CcdiAccountInfoQueryDTO())).toLowerCase();
|
||||
|
||||
assertTrue(sql.contains("from ccdi_account_info ai"), sql);
|
||||
assertFalse(sql.contains("ccdi_account_result"), sql);
|
||||
assertTrue(sql.contains("ai.is_self_account as isactualcontrol"), sql);
|
||||
assertTrue(sql.contains("ai.monthly_avg_trans_count as avgmonthtxncount"), sql);
|
||||
assertTrue(sql.contains("ai.trans_risk_level as txnrisklevel"), sql);
|
||||
}
|
||||
|
||||
private MappedStatement loadMappedStatement(String statementId) throws Exception {
|
||||
Configuration configuration = new Configuration();
|
||||
configuration.setEnvironment(new Environment("test", new JdbcTransactionFactory(), new NoOpDataSource()));
|
||||
registerTypeAliases(configuration.getTypeAliasRegistry());
|
||||
configuration.getLanguageRegistry().register(XMLLanguageDriver.class);
|
||||
configuration.addMapper(CcdiAccountInfoMapper.class);
|
||||
|
||||
try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(RESOURCE)) {
|
||||
XMLMapperBuilder xmlMapperBuilder =
|
||||
new XMLMapperBuilder(inputStream, configuration, RESOURCE, configuration.getSqlFragments());
|
||||
xmlMapperBuilder.parse();
|
||||
}
|
||||
return configuration.getMappedStatement(statementId);
|
||||
}
|
||||
|
||||
private String renderSql(MappedStatement mappedStatement, Map<String, Object> params) {
|
||||
BoundSql boundSql = mappedStatement.getBoundSql(new HashMap<>(params));
|
||||
return boundSql.getSql().replaceAll("\\s+", " ").trim();
|
||||
}
|
||||
|
||||
private void registerTypeAliases(TypeAliasRegistry typeAliasRegistry) {
|
||||
typeAliasRegistry.registerAlias("map", Map.class);
|
||||
}
|
||||
|
||||
private static class NoOpDataSource implements DataSource {
|
||||
|
||||
@Override
|
||||
public java.sql.Connection getConnection() {
|
||||
throw new UnsupportedOperationException("Not required for SQL rendering tests");
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.sql.Connection getConnection(String username, String password) {
|
||||
throw new UnsupportedOperationException("Not required for SQL rendering tests");
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.io.PrintWriter getLogWriter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLogWriter(java.io.PrintWriter out) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLoginTimeout(int seconds) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLoginTimeout() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.util.logging.Logger getParentLogger() {
|
||||
return java.util.logging.Logger.getGlobal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T unwrap(Class<T> iface) {
|
||||
throw new UnsupportedOperationException("Not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWrapperFor(Class<?> iface) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,8 @@ class CcdiBaseStaffMapperTest {
|
||||
|
||||
assertTrue(xml.contains("annual_income"), xml);
|
||||
assertTrue(xml.contains("#{item.annualIncome}"), xml);
|
||||
assertTrue(xml.contains("is_party_member"), xml);
|
||||
assertTrue(xml.contains("#{item.partyMember}"), xml);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.ruoyi.info.collection.service;
|
||||
|
||||
import com.ruoyi.info.collection.domain.CcdiAccountInfo;
|
||||
import com.ruoyi.info.collection.domain.CcdiBaseStaff;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiAccountInfoAddDTO;
|
||||
import com.ruoyi.info.collection.mapper.CcdiAccountInfoMapper;
|
||||
import com.ruoyi.info.collection.mapper.CcdiBaseStaffMapper;
|
||||
import com.ruoyi.info.collection.mapper.CcdiStaffFmyRelationMapper;
|
||||
import com.ruoyi.info.collection.service.impl.CcdiAccountInfoServiceImpl;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.beans.BeanWrapperImpl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class CcdiAccountInfoServiceImplTest {
|
||||
|
||||
@InjectMocks
|
||||
private CcdiAccountInfoServiceImpl service;
|
||||
|
||||
@Mock
|
||||
private CcdiAccountInfoMapper accountInfoMapper;
|
||||
|
||||
@Mock
|
||||
private CcdiBaseStaffMapper baseStaffMapper;
|
||||
|
||||
@Mock
|
||||
private CcdiStaffFmyRelationMapper staffFmyRelationMapper;
|
||||
|
||||
@Test
|
||||
void insertExternalAccount_shouldPersistAnalysisFieldsOnAccountInfo() {
|
||||
CcdiAccountInfoAddDTO dto = buildBaseAddDto();
|
||||
dto.setOwnerType("EXTERNAL");
|
||||
dto.setOwnerId("330101199001010011");
|
||||
dto.setBankScope("EXTERNAL");
|
||||
dto.setIsActualControl(0);
|
||||
dto.setAvgMonthTxnCount(6);
|
||||
dto.setAvgMonthTxnAmount(new BigDecimal("1234.56"));
|
||||
dto.setTxnFrequencyLevel("HIGH");
|
||||
dto.setDebitSingleMaxAmount(new BigDecimal("100.00"));
|
||||
dto.setCreditSingleMaxAmount(new BigDecimal("200.00"));
|
||||
dto.setDebitDailyMaxAmount(new BigDecimal("300.00"));
|
||||
dto.setCreditDailyMaxAmount(new BigDecimal("400.00"));
|
||||
dto.setTxnRiskLevel("MEDIUM");
|
||||
|
||||
when(accountInfoMapper.selectCount(any())).thenReturn(0L);
|
||||
when(accountInfoMapper.insert(any(CcdiAccountInfo.class))).thenReturn(1);
|
||||
|
||||
service.insertAccountInfo(dto);
|
||||
|
||||
ArgumentCaptor<CcdiAccountInfo> captor = ArgumentCaptor.forClass(CcdiAccountInfo.class);
|
||||
verify(accountInfoMapper).insert(captor.capture());
|
||||
BeanWrapperImpl wrapper = new BeanWrapperImpl(captor.getValue());
|
||||
assertEquals(0, wrapper.getPropertyValue("isActualControl"));
|
||||
assertEquals(6, wrapper.getPropertyValue("avgMonthTxnCount"));
|
||||
assertEquals(new BigDecimal("1234.56"), wrapper.getPropertyValue("avgMonthTxnAmount"));
|
||||
assertEquals("HIGH", wrapper.getPropertyValue("txnFrequencyLevel"));
|
||||
assertEquals("MEDIUM", wrapper.getPropertyValue("txnRiskLevel"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void insertInternalAccount_shouldClearAnalysisFieldsOnAccountInfo() {
|
||||
CcdiAccountInfoAddDTO dto = buildBaseAddDto();
|
||||
dto.setOwnerType("EMPLOYEE");
|
||||
dto.setOwnerId("330101199001010022");
|
||||
dto.setBankScope("INTERNAL");
|
||||
dto.setIsActualControl(1);
|
||||
dto.setAvgMonthTxnCount(8);
|
||||
dto.setAvgMonthTxnAmount(new BigDecimal("9988.66"));
|
||||
dto.setTxnFrequencyLevel("HIGH");
|
||||
dto.setDebitSingleMaxAmount(new BigDecimal("111.11"));
|
||||
dto.setCreditSingleMaxAmount(new BigDecimal("222.22"));
|
||||
dto.setDebitDailyMaxAmount(new BigDecimal("333.33"));
|
||||
dto.setCreditDailyMaxAmount(new BigDecimal("444.44"));
|
||||
dto.setTxnRiskLevel("HIGH");
|
||||
|
||||
CcdiBaseStaff staff = new CcdiBaseStaff();
|
||||
staff.setIdCard(dto.getOwnerId());
|
||||
|
||||
when(baseStaffMapper.selectOne(any())).thenReturn(staff);
|
||||
when(accountInfoMapper.selectCount(any())).thenReturn(0L);
|
||||
when(accountInfoMapper.insert(any(CcdiAccountInfo.class))).thenReturn(1);
|
||||
|
||||
service.insertAccountInfo(dto);
|
||||
|
||||
ArgumentCaptor<CcdiAccountInfo> captor = ArgumentCaptor.forClass(CcdiAccountInfo.class);
|
||||
verify(accountInfoMapper).insert(captor.capture());
|
||||
BeanWrapperImpl wrapper = new BeanWrapperImpl(captor.getValue());
|
||||
assertNull(wrapper.getPropertyValue("isActualControl"));
|
||||
assertNull(wrapper.getPropertyValue("avgMonthTxnCount"));
|
||||
assertNull(wrapper.getPropertyValue("avgMonthTxnAmount"));
|
||||
assertNull(wrapper.getPropertyValue("txnFrequencyLevel"));
|
||||
assertNull(wrapper.getPropertyValue("debitSingleMaxAmount"));
|
||||
assertNull(wrapper.getPropertyValue("creditSingleMaxAmount"));
|
||||
assertNull(wrapper.getPropertyValue("debitDailyMaxAmount"));
|
||||
assertNull(wrapper.getPropertyValue("creditDailyMaxAmount"));
|
||||
assertNull(wrapper.getPropertyValue("txnRiskLevel"));
|
||||
}
|
||||
|
||||
private CcdiAccountInfoAddDTO buildBaseAddDto() {
|
||||
CcdiAccountInfoAddDTO dto = new CcdiAccountInfoAddDTO();
|
||||
dto.setAccountNo("6222024000000001");
|
||||
dto.setAccountType("BANK");
|
||||
dto.setAccountName("测试账户");
|
||||
dto.setOpenBank("中国银行");
|
||||
dto.setBankCode("BOC");
|
||||
dto.setCurrency("CNY");
|
||||
dto.setStatus(1);
|
||||
dto.setEffectiveDate(new Date());
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,28 @@ class CcdiBaseStaffImportServiceImplTest {
|
||||
assertDoesNotThrow(() -> service.validateStaffData(buildDto(new BigDecimal("12345.67")), false, Collections.emptySet(), Collections.emptySet()));
|
||||
}
|
||||
|
||||
@Test
|
||||
void validateStaffData_shouldAllowPartyMemberValuesZeroAndOne() {
|
||||
CcdiBaseStaffAddDTO nonPartyMember = buildDto(null);
|
||||
nonPartyMember.setPartyMember(0);
|
||||
CcdiBaseStaffAddDTO partyMember = buildDto(null);
|
||||
partyMember.setPartyMember(1);
|
||||
|
||||
assertDoesNotThrow(() -> service.validateStaffData(nonPartyMember, false, Collections.emptySet(), Collections.emptySet()));
|
||||
assertDoesNotThrow(() -> service.validateStaffData(partyMember, false, Collections.emptySet(), Collections.emptySet()));
|
||||
}
|
||||
|
||||
@Test
|
||||
void validateStaffData_shouldRejectInvalidPartyMemberValue() {
|
||||
CcdiBaseStaffAddDTO dto = buildDto(null);
|
||||
dto.setPartyMember(2);
|
||||
|
||||
RuntimeException exception = assertThrows(RuntimeException.class,
|
||||
() -> service.validateStaffData(dto, false, Set.of(), Set.of()));
|
||||
|
||||
assertEquals("是否党员只能填写'0'或'1'", exception.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void validateStaffData_shouldRejectNegativeAnnualIncome() {
|
||||
RuntimeException exception = assertThrows(RuntimeException.class,
|
||||
@@ -51,6 +73,7 @@ class CcdiBaseStaffImportServiceImplTest {
|
||||
dto.setIdCard("320101199001010014");
|
||||
dto.setPhone("13812345678");
|
||||
dto.setStatus("0");
|
||||
dto.setPartyMember(1);
|
||||
dto.setAnnualIncome(annualIncome);
|
||||
return dto;
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ class CcdiBaseStaffServiceImplTest {
|
||||
addDTO.setIdCard("320101199001010011");
|
||||
addDTO.setPhone("13812345678");
|
||||
addDTO.setStatus("0");
|
||||
addDTO.setPartyMember(1);
|
||||
addDTO.setAnnualIncome(new BigDecimal("12345.67"));
|
||||
addDTO.setAssetInfoList(List.of(
|
||||
buildAssetDto("房产"),
|
||||
@@ -70,6 +71,7 @@ class CcdiBaseStaffServiceImplTest {
|
||||
assertEquals(1, result);
|
||||
ArgumentCaptor<CcdiBaseStaff> staffCaptor = ArgumentCaptor.forClass(CcdiBaseStaff.class);
|
||||
verify(baseStaffMapper).insert(staffCaptor.capture());
|
||||
assertEquals(1, staffCaptor.getValue().getPartyMember());
|
||||
assertEquals(new BigDecimal("12345.67"), staffCaptor.getValue().getAnnualIncome());
|
||||
ArgumentCaptor<List<CcdiAssetInfoDTO>> captor = ArgumentCaptor.forClass(List.class);
|
||||
verify(assetInfoService).replaceByFamilyId(eq("320101199001010011"), captor.capture());
|
||||
@@ -92,6 +94,7 @@ class CcdiBaseStaffServiceImplTest {
|
||||
editDTO.setIdCard("320101199001010011");
|
||||
editDTO.setPhone("13812345678");
|
||||
editDTO.setStatus("0");
|
||||
editDTO.setPartyMember(0);
|
||||
editDTO.setAnnualIncome(new BigDecimal("45678.90"));
|
||||
editDTO.setAssetInfoList(List.of(buildAssetDto("车辆")));
|
||||
|
||||
@@ -104,6 +107,7 @@ class CcdiBaseStaffServiceImplTest {
|
||||
assertEquals(1, result);
|
||||
ArgumentCaptor<CcdiBaseStaff> staffCaptor = ArgumentCaptor.forClass(CcdiBaseStaff.class);
|
||||
verify(baseStaffMapper).updateById(staffCaptor.capture());
|
||||
assertEquals(0, staffCaptor.getValue().getPartyMember());
|
||||
assertEquals(new BigDecimal("45678.90"), staffCaptor.getValue().getAnnualIncome());
|
||||
verify(assetInfoService, never()).deleteByFamilyId("320101199001010011");
|
||||
verify(assetInfoService).replaceByFamilyId("320101199001010011", editDTO.getAssetInfoList());
|
||||
@@ -122,6 +126,7 @@ class CcdiBaseStaffServiceImplTest {
|
||||
editDTO.setIdCard("320101199001010011");
|
||||
editDTO.setPhone("13812345678");
|
||||
editDTO.setStatus("0");
|
||||
editDTO.setPartyMember(1);
|
||||
editDTO.setAssetInfoList(List.of(buildAssetDto("车辆")));
|
||||
|
||||
when(baseStaffMapper.selectById(1001L)).thenReturn(existing);
|
||||
@@ -135,17 +140,18 @@ class CcdiBaseStaffServiceImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void selectBaseStaffById_shouldReturnAssetInfoList() {
|
||||
void selectBaseStaffById_shouldReturnSelfOwnedAssetInfoList() {
|
||||
CcdiBaseStaff staff = new CcdiBaseStaff();
|
||||
staff.setStaffId(1001L);
|
||||
staff.setName("张三");
|
||||
staff.setIdCard("320101199001010011");
|
||||
staff.setStatus("0");
|
||||
staff.setPartyMember(1);
|
||||
staff.setAnnualIncome(new BigDecimal("88888.88"));
|
||||
|
||||
CcdiAssetInfo assetInfo = new CcdiAssetInfo();
|
||||
assetInfo.setFamilyId("320101199001010011");
|
||||
assetInfo.setPersonId("320101199201010022");
|
||||
assetInfo.setPersonId("320101199001010011");
|
||||
assetInfo.setAssetMainType("车辆");
|
||||
assetInfo.setAssetSubType("小汽车");
|
||||
assetInfo.setAssetName("家庭车辆");
|
||||
@@ -153,14 +159,16 @@ class CcdiBaseStaffServiceImplTest {
|
||||
assetInfo.setAssetStatus("正常");
|
||||
|
||||
when(baseStaffMapper.selectById(1001L)).thenReturn(staff);
|
||||
when(assetInfoService.selectByFamilyId("320101199001010011")).thenReturn(List.of(assetInfo));
|
||||
when(assetInfoService.selectByFamilyIdAndPersonId("320101199001010011", "320101199001010011"))
|
||||
.thenReturn(List.of(assetInfo));
|
||||
|
||||
CcdiBaseStaffVO result = service.selectBaseStaffById(1001L);
|
||||
|
||||
assertNotNull(result.getAssetInfoList());
|
||||
assertEquals(1, result.getPartyMember());
|
||||
assertEquals(new BigDecimal("88888.88"), result.getAnnualIncome());
|
||||
assertEquals(1, result.getAssetInfoList().size());
|
||||
assertEquals("320101199201010022", result.getAssetInfoList().get(0).getPersonId());
|
||||
assertEquals("320101199001010011", result.getAssetInfoList().get(0).getPersonId());
|
||||
assertEquals("车辆", result.getAssetInfoList().get(0).getAssetMainType());
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
package com.ruoyi.info.collection.service;
|
||||
|
||||
import com.ruoyi.info.collection.domain.CcdiBizIntermediary;
|
||||
import com.ruoyi.info.collection.domain.CcdiEnterpriseBaseInfo;
|
||||
import com.ruoyi.info.collection.domain.CcdiIntermediaryEnterpriseRelation;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiIntermediaryEnterpriseRelationExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.IntermediaryEnterpriseRelationImportFailureVO;
|
||||
import com.ruoyi.info.collection.mapper.CcdiBizIntermediaryMapper;
|
||||
import com.ruoyi.info.collection.mapper.CcdiEnterpriseBaseInfoMapper;
|
||||
import com.ruoyi.info.collection.mapper.CcdiIntermediaryEnterpriseRelationMapper;
|
||||
import com.ruoyi.info.collection.service.impl.CcdiIntermediaryEnterpriseRelationImportServiceImpl;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.data.redis.core.HashOperations;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.ValueOperations;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class CcdiIntermediaryEnterpriseRelationImportServiceImplTest {
|
||||
|
||||
@InjectMocks
|
||||
private CcdiIntermediaryEnterpriseRelationImportServiceImpl service;
|
||||
|
||||
@Mock
|
||||
private CcdiIntermediaryEnterpriseRelationMapper relationMapper;
|
||||
|
||||
@Mock
|
||||
private CcdiBizIntermediaryMapper intermediaryMapper;
|
||||
|
||||
@Mock
|
||||
private CcdiEnterpriseBaseInfoMapper enterpriseBaseInfoMapper;
|
||||
|
||||
@Mock
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
@Mock
|
||||
private HashOperations<String, Object, Object> hashOperations;
|
||||
|
||||
@Mock
|
||||
private ValueOperations<String, Object> valueOperations;
|
||||
|
||||
@Test
|
||||
void importEnterpriseRelationAsync_shouldFailWhenOwnerPersonIdDoesNotExist() {
|
||||
CcdiIntermediaryEnterpriseRelationExcel excel = buildExcel("320101199001010014", "91330100MA27X12345");
|
||||
prepareFailureRedisMocks();
|
||||
when(intermediaryMapper.selectList(any())).thenReturn(List.of());
|
||||
when(enterpriseBaseInfoMapper.selectList(any())).thenReturn(List.of(enterprise("91330100MA27X12345")));
|
||||
|
||||
service.importAsync(List.of(excel), "task-owner-miss", "tester");
|
||||
|
||||
verify(relationMapper, never()).insertBatch(any());
|
||||
IntermediaryEnterpriseRelationImportFailureVO failure =
|
||||
firstFailure("import:intermediary-enterprise-relation:task-owner-miss:failures");
|
||||
assertEquals("320101199001010014", failure.getOwnerPersonId());
|
||||
assertTrue(failure.getErrorMessage().contains("中介本人不存在"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void importEnterpriseRelationAsync_shouldFailWhenEnterpriseDoesNotExist() {
|
||||
CcdiIntermediaryEnterpriseRelationExcel excel = buildExcel("320101199001010014", "91330100MA27X12345");
|
||||
prepareFailureRedisMocks();
|
||||
when(intermediaryMapper.selectList(any())).thenReturn(List.of(owner("owner-biz", "320101199001010014")));
|
||||
when(enterpriseBaseInfoMapper.selectList(any())).thenReturn(List.of());
|
||||
when(relationMapper.batchExistsByCombinations(any())).thenReturn(List.of());
|
||||
|
||||
service.importAsync(List.of(excel), "task-ent-miss", "tester");
|
||||
|
||||
verify(relationMapper, never()).insertBatch(any());
|
||||
IntermediaryEnterpriseRelationImportFailureVO failure =
|
||||
firstFailure("import:intermediary-enterprise-relation:task-ent-miss:failures");
|
||||
assertEquals("91330100MA27X12345", failure.getSocialCreditCode());
|
||||
assertTrue(failure.getErrorMessage().contains("机构表"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void importEnterpriseRelationAsync_shouldRejectFileDuplicateAndDbDuplicate() {
|
||||
CcdiIntermediaryEnterpriseRelationExcel duplicateInDb = buildExcel("320101199001010014", "91330100MA27X12345");
|
||||
CcdiIntermediaryEnterpriseRelationExcel duplicateInFile1 = buildExcel("320101199003030035", "91330100MA27X12346");
|
||||
CcdiIntermediaryEnterpriseRelationExcel duplicateInFile2 = buildExcel("320101199003030035", "91330100MA27X12346");
|
||||
prepareFailureRedisMocks();
|
||||
when(intermediaryMapper.selectList(any())).thenReturn(List.of(
|
||||
owner("owner-biz-1", "320101199001010014"),
|
||||
owner("owner-biz-2", "320101199003030035")
|
||||
));
|
||||
when(enterpriseBaseInfoMapper.selectList(any())).thenReturn(List.of(
|
||||
enterprise("91330100MA27X12345"),
|
||||
enterprise("91330100MA27X12346")
|
||||
));
|
||||
when(relationMapper.batchExistsByCombinations(any())).thenReturn(List.of("owner-biz-1|91330100MA27X12345"));
|
||||
|
||||
service.importAsync(List.of(duplicateInDb, duplicateInFile1, duplicateInFile2), "task-duplicate", "tester");
|
||||
|
||||
ArgumentCaptor<List<CcdiIntermediaryEnterpriseRelation>> captor = ArgumentCaptor.forClass(List.class);
|
||||
verify(relationMapper).insertBatch(captor.capture());
|
||||
assertEquals(1, captor.getValue().size());
|
||||
assertEquals("owner-biz-2", captor.getValue().get(0).getIntermediaryBizId());
|
||||
IntermediaryEnterpriseRelationImportFailureVO failure =
|
||||
firstFailure("import:intermediary-enterprise-relation:task-duplicate:failures");
|
||||
assertTrue(failure.getErrorMessage().contains("重复") || failure.getErrorMessage().contains("已存在"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void importEnterpriseRelationAsync_shouldImportSuccessWhenOwnerAndEnterpriseExist() {
|
||||
CcdiIntermediaryEnterpriseRelationExcel excel = buildExcel("320101199001010014", "91330100MA27X12345");
|
||||
prepareStatusRedisMock();
|
||||
when(intermediaryMapper.selectList(any())).thenReturn(List.of(owner("owner-biz", "320101199001010014")));
|
||||
when(enterpriseBaseInfoMapper.selectList(any())).thenReturn(List.of(enterprise("91330100MA27X12345")));
|
||||
when(relationMapper.batchExistsByCombinations(any())).thenReturn(List.of());
|
||||
|
||||
service.importAsync(List.of(excel), "task-success", "tester");
|
||||
|
||||
ArgumentCaptor<List<CcdiIntermediaryEnterpriseRelation>> captor = ArgumentCaptor.forClass(List.class);
|
||||
verify(relationMapper).insertBatch(captor.capture());
|
||||
assertEquals(1, captor.getValue().size());
|
||||
assertEquals("owner-biz", captor.getValue().get(0).getIntermediaryBizId());
|
||||
verify(valueOperations, never()).set(any(), any(), any(Long.class), any(TimeUnit.class));
|
||||
}
|
||||
|
||||
private void prepareStatusRedisMock() {
|
||||
when(redisTemplate.opsForHash()).thenReturn(hashOperations);
|
||||
}
|
||||
|
||||
private void prepareFailureRedisMocks() {
|
||||
prepareStatusRedisMock();
|
||||
when(redisTemplate.opsForValue()).thenReturn(valueOperations);
|
||||
}
|
||||
|
||||
private IntermediaryEnterpriseRelationImportFailureVO firstFailure(String key) {
|
||||
ArgumentCaptor<Object> failureCaptor = ArgumentCaptor.forClass(Object.class);
|
||||
verify(valueOperations).set(org.mockito.ArgumentMatchers.eq(key), failureCaptor.capture(),
|
||||
org.mockito.ArgumentMatchers.eq(7L), org.mockito.ArgumentMatchers.eq(TimeUnit.DAYS));
|
||||
return (IntermediaryEnterpriseRelationImportFailureVO) ((List<?>) failureCaptor.getValue()).get(0);
|
||||
}
|
||||
|
||||
private CcdiIntermediaryEnterpriseRelationExcel buildExcel(String ownerPersonId, String socialCreditCode) {
|
||||
CcdiIntermediaryEnterpriseRelationExcel excel = new CcdiIntermediaryEnterpriseRelationExcel();
|
||||
excel.setOwnerPersonId(ownerPersonId);
|
||||
excel.setSocialCreditCode(socialCreditCode);
|
||||
excel.setRelationPersonPost("董事");
|
||||
excel.setRemark("备注");
|
||||
return excel;
|
||||
}
|
||||
|
||||
private CcdiBizIntermediary owner(String bizId, String personId) {
|
||||
CcdiBizIntermediary owner = new CcdiBizIntermediary();
|
||||
owner.setBizId(bizId);
|
||||
owner.setPersonId(personId);
|
||||
owner.setPersonSubType("本人");
|
||||
return owner;
|
||||
}
|
||||
|
||||
private CcdiEnterpriseBaseInfo enterprise(String socialCreditCode) {
|
||||
CcdiEnterpriseBaseInfo enterprise = new CcdiEnterpriseBaseInfo();
|
||||
enterprise.setSocialCreditCode(socialCreditCode);
|
||||
enterprise.setEnterpriseName("机构" + socialCreditCode.substring(socialCreditCode.length() - 2));
|
||||
return enterprise;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package com.ruoyi.info.collection.service;
|
||||
|
||||
import com.ruoyi.common.annotation.DictDropdown;
|
||||
import com.ruoyi.info.collection.domain.CcdiBizIntermediary;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiIntermediaryPersonExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.IntermediaryPersonImportFailureVO;
|
||||
import com.ruoyi.info.collection.mapper.CcdiBizIntermediaryMapper;
|
||||
import com.ruoyi.info.collection.service.impl.CcdiIntermediaryPersonImportServiceImpl;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.data.redis.core.HashOperations;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.ValueOperations;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class CcdiIntermediaryPersonImportServiceImplTest {
|
||||
|
||||
@InjectMocks
|
||||
private CcdiIntermediaryPersonImportServiceImpl service;
|
||||
|
||||
@Mock
|
||||
private CcdiBizIntermediaryMapper intermediaryMapper;
|
||||
|
||||
@Mock
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
@Mock
|
||||
private HashOperations<String, Object, Object> hashOperations;
|
||||
|
||||
@Mock
|
||||
private ValueOperations<String, Object> valueOperations;
|
||||
|
||||
@Test
|
||||
void intermediaryPersonExcel_shouldUsePersonSubTypeDropdownAndDropRelationType() throws Exception {
|
||||
Field personSubTypeField = CcdiIntermediaryPersonExcel.class.getDeclaredField("personSubType");
|
||||
DictDropdown dictDropdown = personSubTypeField.getAnnotation(DictDropdown.class);
|
||||
|
||||
assertNotNull(dictDropdown);
|
||||
assertEquals("ccdi_person_sub_type", dictDropdown.dictType());
|
||||
assertThrows(NoSuchFieldException.class, () -> CcdiIntermediaryPersonExcel.class.getDeclaredField("relationType"));
|
||||
assertThrows(NoSuchFieldException.class, () -> IntermediaryPersonImportFailureVO.class.getDeclaredField("relationType"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void importPersonAsync_shouldFailWhenOwnerRowContainsOwnerPersonIdReference() {
|
||||
CcdiIntermediaryPersonExcel owner = buildOwnerExcel("320101199001010014");
|
||||
owner.setRelatedNumId("320101199105050053");
|
||||
prepareFailureRedisMocks();
|
||||
|
||||
service.importPersonAsync(List.of(owner), "task-owner", "tester");
|
||||
|
||||
verify(intermediaryMapper, never()).insertBatch(any());
|
||||
IntermediaryPersonImportFailureVO failure = firstFailure("import:intermediary:task-owner:failures");
|
||||
assertEquals("320101199105050053", failure.getRelatedNumId());
|
||||
assertTrue(failure.getErrorMessage().contains("本人"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void importPersonAsync_shouldFailWhenRelativeRowMissesOwnerPersonId() {
|
||||
CcdiIntermediaryPersonExcel relative = buildRelativeExcel("320101199201010027", "配偶", null);
|
||||
prepareFailureRedisMocks();
|
||||
|
||||
service.importPersonAsync(List.of(relative), "task-relative", "tester");
|
||||
|
||||
verify(intermediaryMapper, never()).insertBatch(any());
|
||||
IntermediaryPersonImportFailureVO failure = firstFailure("import:intermediary:task-relative:failures");
|
||||
assertEquals("320101199201010027", failure.getPersonId());
|
||||
assertTrue(failure.getErrorMessage().contains("关联中介本人证件号码"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void importPersonAsync_shouldAllowRelativeReferencingSuccessfulOwnerInSameFile() {
|
||||
CcdiIntermediaryPersonExcel owner = buildOwnerExcel("320101199001010014");
|
||||
CcdiIntermediaryPersonExcel relative = buildRelativeExcel("320101199201010027", "配偶", "320101199001010014");
|
||||
prepareStatusRedisMock();
|
||||
when(intermediaryMapper.selectList(any())).thenReturn(List.of());
|
||||
|
||||
service.importPersonAsync(List.of(owner, relative), "task-mixed", "tester");
|
||||
|
||||
ArgumentCaptor<List<CcdiBizIntermediary>> captor = ArgumentCaptor.forClass(List.class);
|
||||
verify(intermediaryMapper).insertBatch(captor.capture());
|
||||
assertEquals(2, captor.getValue().size());
|
||||
assertEquals("本人", captor.getValue().get(0).getPersonSubType());
|
||||
assertEquals("320101199001010014", captor.getValue().get(1).getRelatedNumId());
|
||||
verify(valueOperations, never()).set(any(), any(), any(Long.class), any(TimeUnit.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void importPersonAsync_shouldAllowSameRelativePersonIdUnderDifferentOwners() {
|
||||
CcdiIntermediaryPersonExcel owner1 = buildOwnerExcel("320101199001010014");
|
||||
CcdiIntermediaryPersonExcel owner2 = buildOwnerExcel("320101199003030035");
|
||||
CcdiIntermediaryPersonExcel relative1 = buildRelativeExcel("320101199201010027", "配偶", "320101199001010014");
|
||||
CcdiIntermediaryPersonExcel relative2 = buildRelativeExcel("320101199201010027", "配偶", "320101199003030035");
|
||||
prepareStatusRedisMock();
|
||||
when(intermediaryMapper.selectList(any())).thenReturn(List.of());
|
||||
|
||||
service.importPersonAsync(List.of(owner1, owner2, relative1, relative2), "task-owner-scope", "tester");
|
||||
|
||||
ArgumentCaptor<List<CcdiBizIntermediary>> captor = ArgumentCaptor.forClass(List.class);
|
||||
verify(intermediaryMapper).insertBatch(captor.capture());
|
||||
assertEquals(4, captor.getValue().size());
|
||||
verify(valueOperations, never()).set(any(), any(), any(Long.class), any(TimeUnit.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void importPersonAsync_shouldRejectDuplicateRelativeUnderSameOwner() {
|
||||
CcdiIntermediaryPersonExcel owner = buildOwnerExcel("320101199001010014");
|
||||
CcdiIntermediaryPersonExcel relative1 = buildRelativeExcel("320101199201010027", "配偶", "320101199001010014");
|
||||
CcdiIntermediaryPersonExcel relative2 = buildRelativeExcel("320101199201010027", "配偶", "320101199001010014");
|
||||
prepareFailureRedisMocks();
|
||||
when(intermediaryMapper.selectList(any())).thenReturn(List.of());
|
||||
|
||||
service.importPersonAsync(List.of(owner, relative1, relative2), "task-duplicate", "tester");
|
||||
|
||||
ArgumentCaptor<List<CcdiBizIntermediary>> captor = ArgumentCaptor.forClass(List.class);
|
||||
verify(intermediaryMapper).insertBatch(captor.capture());
|
||||
assertEquals(2, captor.getValue().size());
|
||||
IntermediaryPersonImportFailureVO failure = firstFailure("import:intermediary:task-duplicate:failures");
|
||||
assertEquals("320101199201010027", failure.getPersonId());
|
||||
assertTrue(failure.getErrorMessage().contains("重复"));
|
||||
}
|
||||
|
||||
private void prepareStatusRedisMock() {
|
||||
when(redisTemplate.opsForHash()).thenReturn(hashOperations);
|
||||
}
|
||||
|
||||
private void prepareFailureRedisMocks() {
|
||||
prepareStatusRedisMock();
|
||||
when(redisTemplate.opsForValue()).thenReturn(valueOperations);
|
||||
}
|
||||
|
||||
private IntermediaryPersonImportFailureVO firstFailure(String key) {
|
||||
ArgumentCaptor<Object> failureCaptor = ArgumentCaptor.forClass(Object.class);
|
||||
verify(valueOperations).set(org.mockito.ArgumentMatchers.eq(key), failureCaptor.capture(),
|
||||
org.mockito.ArgumentMatchers.eq(7L), org.mockito.ArgumentMatchers.eq(TimeUnit.DAYS));
|
||||
return (IntermediaryPersonImportFailureVO) ((List<?>) failureCaptor.getValue()).get(0);
|
||||
}
|
||||
|
||||
private CcdiIntermediaryPersonExcel buildOwnerExcel(String personId) {
|
||||
CcdiIntermediaryPersonExcel excel = new CcdiIntermediaryPersonExcel();
|
||||
excel.setName("中介本人" + personId.substring(personId.length() - 2));
|
||||
excel.setPersonType("中介");
|
||||
excel.setPersonSubType("本人");
|
||||
excel.setIdType("身份证");
|
||||
excel.setPersonId(personId);
|
||||
return excel;
|
||||
}
|
||||
|
||||
private CcdiIntermediaryPersonExcel buildRelativeExcel(String personId, String personSubType, String ownerPersonId) {
|
||||
CcdiIntermediaryPersonExcel excel = new CcdiIntermediaryPersonExcel();
|
||||
excel.setName("中介亲属" + personId.substring(personId.length() - 2));
|
||||
excel.setPersonType("中介");
|
||||
excel.setPersonSubType(personSubType);
|
||||
excel.setIdType("身份证");
|
||||
excel.setPersonId(personId);
|
||||
excel.setRelatedNumId(ownerPersonId);
|
||||
return excel;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.info.collection.utils;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||
import com.ruoyi.common.utils.DictUtils;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiBaseStaffExcel;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiAssetInfoExcel;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiStaffFmyRelationExcel;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
@@ -72,6 +73,31 @@ class EasyExcelUtilTemplateTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void importTemplateWithDictDropdown_shouldAddPartyMemberDropdownToBaseStaffTemplate() throws Exception {
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
try (MockedStatic<DictUtils> mocked = mockStatic(DictUtils.class)) {
|
||||
mocked.when(() -> DictUtils.getDictCache("ccdi_employee_status"))
|
||||
.thenReturn(List.of(
|
||||
buildDictData("在职", "0"),
|
||||
buildDictData("离职", "1")
|
||||
));
|
||||
mocked.when(() -> DictUtils.getDictCache("ccdi_yes_no_flag"))
|
||||
.thenReturn(List.of(
|
||||
buildDictData("是", "1"),
|
||||
buildDictData("否", "0")
|
||||
));
|
||||
|
||||
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiBaseStaffExcel.class, "员工信息");
|
||||
}
|
||||
|
||||
try (Workbook workbook = WorkbookFactory.create(new ByteArrayInputStream(response.getContentAsByteArray()))) {
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
assertTrue(hasValidationOnColumn(sheet, 7), "是否党员列应包含下拉校验");
|
||||
}
|
||||
}
|
||||
|
||||
private void assertTextColumn(Sheet sheet, int columnIndex) {
|
||||
CellStyle style = sheet.getColumnStyle(columnIndex);
|
||||
assertNotNull(style, "文本列应设置默认样式");
|
||||
@@ -90,9 +116,13 @@ class EasyExcelUtilTemplateTest {
|
||||
}
|
||||
|
||||
private SysDictData buildDictData(String label) {
|
||||
return buildDictData(label, label);
|
||||
}
|
||||
|
||||
private SysDictData buildDictData(String label, String value) {
|
||||
SysDictData dictData = new SysDictData();
|
||||
dictData.setDictLabel(label);
|
||||
dictData.setDictValue(label);
|
||||
dictData.setDictValue(value);
|
||||
return dictData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
package com.ruoyi.lsfx.client;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.ruoyi.lsfx.domain.response.CreditParseResponse;
|
||||
import com.ruoyi.lsfx.exception.LsfxApiException;
|
||||
import com.ruoyi.lsfx.util.HttpUtil;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.anyMap;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.isNull;
|
||||
import static org.mockito.Mockito.argThat;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class CreditParseClientTest {
|
||||
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@Mock
|
||||
private HttpUtil httpUtil;
|
||||
|
||||
@InjectMocks
|
||||
private CreditParseClient client;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
ReflectionTestUtils.setField(client, "creditParseUrl", "http://credit-host/xfeature-mngs/conversation/htmlEval");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldDeserializeCreditParseResponse() throws Exception {
|
||||
String json = """
|
||||
{
|
||||
"message": "成功",
|
||||
"status_code": "0",
|
||||
"payload": {
|
||||
"lx_header": {"query_cert_no": "3301"},
|
||||
"lx_debt": {"uncle_bank_house_bal": "12.00"},
|
||||
"lx_publictype": {"civil_cnt": 1}
|
||||
}
|
||||
}
|
||||
""";
|
||||
|
||||
CreditParseResponse response = objectMapper.readValue(json, CreditParseResponse.class);
|
||||
|
||||
assertEquals("0", response.getStatusCode());
|
||||
assertEquals("3301", response.getPayload().getLxHeader().get("query_cert_no"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldCallConfiguredUrlWithMultipartParams() {
|
||||
File file = new File("sample.html");
|
||||
CreditParseResponse response = new CreditParseResponse();
|
||||
response.setStatusCode("0");
|
||||
|
||||
when(httpUtil.uploadFile(eq("http://credit-host/xfeature-mngs/conversation/htmlEval"), anyMap(), isNull(), eq(CreditParseResponse.class)))
|
||||
.thenReturn(response);
|
||||
|
||||
CreditParseResponse actual = client.parse("LXCUSTALL", "PERSON", file);
|
||||
|
||||
assertEquals("0", actual.getStatusCode());
|
||||
verify(httpUtil).uploadFile(eq("http://credit-host/xfeature-mngs/conversation/htmlEval"), argThat(params ->
|
||||
"LXCUSTALL".equals(params.get("model"))
|
||||
&& "PERSON".equals(params.get("hType"))
|
||||
&& file.equals(params.get("file"))
|
||||
), isNull(), eq(CreditParseResponse.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldWrapHttpErrorsAsLsfxApiException() {
|
||||
when(httpUtil.uploadFile(anyString(), anyMap(), isNull(), eq(CreditParseResponse.class)))
|
||||
.thenThrow(new LsfxApiException("网络失败"));
|
||||
|
||||
assertThrows(LsfxApiException.class,
|
||||
() -> client.parse("LXCUSTALL", "PERSON", new File("sample.html")));
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,12 @@
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- easyexcel工具 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 测试依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.ccdi.project.controller;
|
||||
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectAbnormalAccountQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectEmployeeCreditNegativeQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectPersonAnalysisDetailQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectRiskModelPeopleQueryDTO;
|
||||
@@ -7,6 +8,7 @@ import com.ruoyi.ccdi.project.domain.dto.CcdiProjectRiskPeopleQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectSuspiciousTransactionQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectRiskPeopleOverviewExcel;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectSuspiciousTransactionExcel;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectAbnormalAccountPageVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectEmployeeCreditNegativePageVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectPersonAnalysisDetailVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectOverviewDashboardVO;
|
||||
@@ -130,6 +132,17 @@ public class CcdiProjectOverviewController extends BaseController {
|
||||
return AjaxResult.success(pageVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询异常账户人员信息
|
||||
*/
|
||||
@GetMapping("/abnormal-account-people")
|
||||
@Operation(summary = "查询异常账户人员信息")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:project:query')")
|
||||
public AjaxResult getAbnormalAccountPeople(CcdiProjectAbnormalAccountQueryDTO queryDTO) {
|
||||
CcdiProjectAbnormalAccountPageVO pageVO = overviewService.getAbnormalAccountPeople(queryDTO);
|
||||
return AjaxResult.success(pageVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出涉疑交易明细
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.ccdi.project.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 异常账户人员信息查询 DTO
|
||||
*/
|
||||
@Data
|
||||
public class CcdiProjectAbnormalAccountQueryDTO {
|
||||
|
||||
/** 项目ID */
|
||||
private Long projectId;
|
||||
|
||||
/** 页码 */
|
||||
private Integer pageNum;
|
||||
|
||||
/** 每页数量 */
|
||||
private Integer pageSize;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.ruoyi.ccdi.project.domain.excel;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 异常账户人员信息导出对象
|
||||
*/
|
||||
@Data
|
||||
public class CcdiProjectAbnormalAccountExcel {
|
||||
|
||||
@Excel(name = "账号")
|
||||
private String accountNo;
|
||||
|
||||
@Excel(name = "开户人")
|
||||
private String accountName;
|
||||
|
||||
@Excel(name = "银行")
|
||||
private String bankName;
|
||||
|
||||
@Excel(name = "异常类型")
|
||||
private String abnormalType;
|
||||
|
||||
@Excel(name = "异常发生时间")
|
||||
private String abnormalTime;
|
||||
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ruoyi.ccdi.project.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 异常账户人员信息行对象
|
||||
*/
|
||||
@Data
|
||||
public class CcdiProjectAbnormalAccountItemVO {
|
||||
|
||||
private String accountNo;
|
||||
|
||||
private String accountName;
|
||||
|
||||
private String bankName;
|
||||
|
||||
private String abnormalType;
|
||||
|
||||
private String abnormalTime;
|
||||
|
||||
private String status;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.ccdi.project.domain.vo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 异常账户人员信息分页结果
|
||||
*/
|
||||
@Data
|
||||
public class CcdiProjectAbnormalAccountPageVO {
|
||||
|
||||
private List<CcdiProjectAbnormalAccountItemVO> rows = new ArrayList<>();
|
||||
|
||||
private Long total = 0L;
|
||||
}
|
||||
@@ -292,6 +292,22 @@ public interface CcdiBankTagAnalysisMapper {
|
||||
*/
|
||||
List<BankTagObjectHitVO> selectSalaryUnusedObjects(@Param("projectId") Long projectId);
|
||||
|
||||
/**
|
||||
* 突然销户
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @return 对象命中结果
|
||||
*/
|
||||
List<BankTagObjectHitVO> selectSuddenAccountClosureObjects(@Param("projectId") Long projectId);
|
||||
|
||||
/**
|
||||
* 休眠账户大额启用
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @return 对象命中结果
|
||||
*/
|
||||
List<BankTagObjectHitVO> selectDormantAccountLargeActivationObjects(@Param("projectId") Long projectId);
|
||||
|
||||
/**
|
||||
* 大额炒股
|
||||
*
|
||||
|
||||
@@ -2,10 +2,12 @@ package com.ruoyi.ccdi.project.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.ccdi.project.domain.CcdiProject;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectAbnormalAccountQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectEmployeeCreditNegativeQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectRiskModelPeopleQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectRiskPeopleQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectSuspiciousTransactionQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectAbnormalAccountItemVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiBankStatementListVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectEmployeeCreditNegativeItemVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectEmployeeRiskAggregateVO;
|
||||
@@ -106,6 +108,26 @@ public interface CcdiProjectOverviewMapper {
|
||||
@Param("query") CcdiProjectEmployeeCreditNegativeQueryDTO query
|
||||
);
|
||||
|
||||
/**
|
||||
* 分页查询异常账户人员信息
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param query 查询条件
|
||||
* @return 分页结果
|
||||
*/
|
||||
Page<CcdiProjectAbnormalAccountItemVO> selectAbnormalAccountPage(
|
||||
Page<CcdiProjectAbnormalAccountItemVO> page,
|
||||
@Param("query") CcdiProjectAbnormalAccountQueryDTO query
|
||||
);
|
||||
|
||||
/**
|
||||
* 查询异常账户人员信息导出列表
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @return 导出列表
|
||||
*/
|
||||
List<CcdiProjectAbnormalAccountItemVO> selectAbnormalAccountList(@Param("projectId") Long projectId);
|
||||
|
||||
/**
|
||||
* 查询项目员工负面征信导出列表
|
||||
*
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package com.ruoyi.ccdi.project.service;
|
||||
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectAbnormalAccountQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectEmployeeCreditNegativeQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectPersonAnalysisDetailQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectRiskModelPeopleQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectRiskPeopleQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectSuspiciousTransactionQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectAbnormalAccountExcel;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectEmployeeCreditNegativeExcel;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectRiskPeopleOverviewExcel;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectSuspiciousTransactionExcel;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectAbnormalAccountPageVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectEmployeeCreditNegativePageVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectPersonAnalysisDetailVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectOverviewDashboardVO;
|
||||
@@ -144,6 +147,28 @@ public interface ICcdiProjectOverviewService {
|
||||
return new CcdiProjectEmployeeCreditNegativePageVO();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询异常账户人员信息
|
||||
*
|
||||
* @param queryDTO 查询条件
|
||||
* @return 分页结果
|
||||
*/
|
||||
default CcdiProjectAbnormalAccountPageVO getAbnormalAccountPeople(
|
||||
CcdiProjectAbnormalAccountQueryDTO queryDTO
|
||||
) {
|
||||
return new CcdiProjectAbnormalAccountPageVO();
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出异常账户人员信息
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @return 导出列表
|
||||
*/
|
||||
default List<CcdiProjectAbnormalAccountExcel> exportAbnormalAccountPeople(Long projectId) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重算结果总览员工结果并同步项目风险人数
|
||||
*
|
||||
|
||||
@@ -39,6 +39,7 @@ public class CcdiBankTagServiceImpl implements ICcdiBankTagService {
|
||||
private static final String STATUS_RUNNING = "RUNNING";
|
||||
private static final String STATUS_SUCCESS = "SUCCESS";
|
||||
private static final String STATUS_FAILED = "FAILED";
|
||||
private static final String TASK_ERROR_MESSAGE_FALLBACK = "任务失败,详细异常请查看后端日志";
|
||||
private static final String RESULT_TYPE_STATEMENT = "STATEMENT";
|
||||
private static final String OBJECT_TYPE_STAFF_ID_CARD = "STAFF_ID_CARD";
|
||||
|
||||
@@ -147,12 +148,11 @@ public class CcdiBankTagServiceImpl implements ICcdiBankTagService {
|
||||
return task.getId();
|
||||
} catch (Exception ex) {
|
||||
task.setStatus(STATUS_FAILED);
|
||||
task.setErrorMessage(ex.getMessage());
|
||||
task.setEndTime(new Date());
|
||||
task.setNeedRerun(null);
|
||||
task.setUpdateBy(operator);
|
||||
task.setUpdateTime(new Date());
|
||||
taskMapper.updateTask(task);
|
||||
updateFailedTaskSafely(task, ex);
|
||||
projectService.updateProjectStatus(projectId, CcdiProjectStatusConstants.PROCESSING, operator);
|
||||
log.error("【流水标签】任务执行失败: taskId={}, projectId={}, modelCode={}, triggerType={}, error={}",
|
||||
task.getId(), projectId, modelCode, triggerType, ex.getMessage(), ex);
|
||||
@@ -288,6 +288,8 @@ public class CcdiBankTagServiceImpl implements ICcdiBankTagService {
|
||||
case "WITHDRAW_AMT" -> analysisMapper.selectWithdrawAmtObjects(projectId);
|
||||
case "SALARY_QUICK_TRANSFER" -> analysisMapper.selectSalaryQuickTransferObjects(projectId);
|
||||
case "SALARY_UNUSED" -> analysisMapper.selectSalaryUnusedObjects(projectId);
|
||||
case "SUDDEN_ACCOUNT_CLOSURE" -> analysisMapper.selectSuddenAccountClosureObjects(projectId);
|
||||
case "DORMANT_ACCOUNT_LARGE_ACTIVATION" -> analysisMapper.selectDormantAccountLargeActivationObjects(projectId);
|
||||
case "PROXY_ACCOUNT_OPERATION" -> analysisMapper.selectProxyAccountOperationObjects(projectId);
|
||||
default -> List.of();
|
||||
};
|
||||
@@ -357,4 +359,44 @@ public class CcdiBankTagServiceImpl implements ICcdiBankTagService {
|
||||
}
|
||||
return Integer.parseInt(value);
|
||||
}
|
||||
|
||||
private void updateFailedTaskSafely(CcdiBankTagTask task, Exception ex) {
|
||||
task.setErrorMessage(buildSafeTaskErrorMessage(ex));
|
||||
try {
|
||||
taskMapper.updateTask(task);
|
||||
} catch (Exception updateEx) {
|
||||
log.error("【流水标签】写入任务失败状态异常: taskId={}, error={}",
|
||||
task.getId(), updateEx.getMessage(), updateEx);
|
||||
task.setErrorMessage(TASK_ERROR_MESSAGE_FALLBACK);
|
||||
taskMapper.updateTask(task);
|
||||
}
|
||||
}
|
||||
|
||||
private static String buildSafeTaskErrorMessage(Throwable throwable) {
|
||||
if (throwable == null) {
|
||||
return TASK_ERROR_MESSAGE_FALLBACK;
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if (throwable.getMessage() != null && !throwable.getMessage().isBlank()) {
|
||||
builder.append(throwable.getMessage().trim());
|
||||
}
|
||||
|
||||
Throwable rootCause = throwable;
|
||||
while (rootCause.getCause() != null && rootCause.getCause() != rootCause) {
|
||||
rootCause = rootCause.getCause();
|
||||
}
|
||||
|
||||
if (rootCause != throwable && rootCause.getMessage() != null && !rootCause.getMessage().isBlank()) {
|
||||
String rootMessage = rootCause.getMessage().trim();
|
||||
if (!builder.toString().contains(rootMessage)) {
|
||||
if (!builder.isEmpty()) {
|
||||
builder.append(" | rootCause=");
|
||||
}
|
||||
builder.append(rootMessage);
|
||||
}
|
||||
}
|
||||
|
||||
return builder.isEmpty() ? TASK_ERROR_MESSAGE_FALLBACK : builder.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,19 @@ package com.ruoyi.ccdi.project.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.ccdi.project.domain.CcdiProject;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectAbnormalAccountQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectEmployeeCreditNegativeQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectPersonAnalysisDetailQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectRiskModelPeopleQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectRiskPeopleQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectSuspiciousTransactionQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectAbnormalAccountExcel;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectEmployeeCreditNegativeExcel;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectRiskPeopleOverviewExcel;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectSuspiciousTransactionExcel;
|
||||
import com.ruoyi.ccdi.project.domain.entity.CcdiProjectOverviewEmployeeResult;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectAbnormalAccountItemVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectAbnormalAccountPageVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiBankStatementListVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiBankStatementHitTagVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectEmployeeCreditNegativeItemVO;
|
||||
@@ -258,6 +262,31 @@ public class CcdiProjectOverviewServiceImpl implements ICcdiProjectOverviewServi
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CcdiProjectAbnormalAccountPageVO getAbnormalAccountPeople(CcdiProjectAbnormalAccountQueryDTO queryDTO) {
|
||||
ensureProjectExists(queryDTO.getProjectId());
|
||||
|
||||
Page<CcdiProjectAbnormalAccountItemVO> page = new Page<>(
|
||||
defaultAbnormalAccountPageNum(queryDTO.getPageNum()),
|
||||
defaultAbnormalAccountPageSize(queryDTO.getPageSize())
|
||||
);
|
||||
Page<CcdiProjectAbnormalAccountItemVO> resultPage = overviewMapper.selectAbnormalAccountPage(page, queryDTO);
|
||||
|
||||
CcdiProjectAbnormalAccountPageVO result = new CcdiProjectAbnormalAccountPageVO();
|
||||
result.setRows(defaultList(resultPage == null ? null : resultPage.getRecords()));
|
||||
result.setTotal(resultPage == null ? 0L : resultPage.getTotal());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CcdiProjectAbnormalAccountExcel> exportAbnormalAccountPeople(Long projectId) {
|
||||
ensureProjectExists(projectId);
|
||||
|
||||
return defaultList(overviewMapper.selectAbnormalAccountList(projectId)).stream()
|
||||
.map(this::buildAbnormalAccountExcelRow)
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportRiskDetails(HttpServletResponse response, Long projectId) {
|
||||
CcdiProjectSuspiciousTransactionQueryDTO queryDTO = new CcdiProjectSuspiciousTransactionQueryDTO();
|
||||
@@ -266,8 +295,9 @@ public class CcdiProjectOverviewServiceImpl implements ICcdiProjectOverviewServi
|
||||
|
||||
List<CcdiProjectSuspiciousTransactionExcel> suspiciousRows = exportSuspiciousTransactions(queryDTO);
|
||||
List<CcdiProjectEmployeeCreditNegativeExcel> creditRows = exportEmployeeCreditNegative(projectId);
|
||||
List<CcdiProjectAbnormalAccountExcel> abnormalRows = exportAbnormalAccountPeople(projectId);
|
||||
try {
|
||||
workbookExporter.export(response, projectId, suspiciousRows, creditRows);
|
||||
workbookExporter.export(response, projectId, suspiciousRows, creditRows, abnormalRows);
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException("导出风险明细失败");
|
||||
}
|
||||
@@ -420,6 +450,14 @@ public class CcdiProjectOverviewServiceImpl implements ICcdiProjectOverviewServi
|
||||
return pageSize == null || pageSize <= 0 ? 5L : pageSize.longValue();
|
||||
}
|
||||
|
||||
private long defaultAbnormalAccountPageNum(Integer pageNum) {
|
||||
return pageNum == null || pageNum <= 0 ? 1L : pageNum.longValue();
|
||||
}
|
||||
|
||||
private long defaultAbnormalAccountPageSize(Integer pageSize) {
|
||||
return pageSize == null || pageSize <= 0 ? 5L : pageSize.longValue();
|
||||
}
|
||||
|
||||
private long defaultPageNum(Integer pageNum) {
|
||||
return pageNum == null || pageNum < 1 ? 1L : pageNum.longValue();
|
||||
}
|
||||
@@ -462,6 +500,17 @@ public class CcdiProjectOverviewServiceImpl implements ICcdiProjectOverviewServi
|
||||
return row;
|
||||
}
|
||||
|
||||
private CcdiProjectAbnormalAccountExcel buildAbnormalAccountExcelRow(CcdiProjectAbnormalAccountItemVO item) {
|
||||
CcdiProjectAbnormalAccountExcel row = new CcdiProjectAbnormalAccountExcel();
|
||||
row.setAccountNo(item.getAccountNo());
|
||||
row.setAccountName(item.getAccountName());
|
||||
row.setBankName(item.getBankName());
|
||||
row.setAbnormalType(item.getAbnormalType());
|
||||
row.setAbnormalTime(item.getAbnormalTime());
|
||||
row.setStatus(item.getStatus());
|
||||
return row;
|
||||
}
|
||||
|
||||
private String formatRelatedStaff(String relatedStaffName, String relatedStaffCode) {
|
||||
if (relatedStaffName == null || relatedStaffName.isBlank()) {
|
||||
return null;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.ccdi.project.service.impl;
|
||||
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectAbnormalAccountExcel;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectEmployeeCreditNegativeExcel;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectSuspiciousTransactionExcel;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
@@ -27,7 +28,8 @@ public class CcdiProjectRiskDetailWorkbookExporter {
|
||||
HttpServletResponse response,
|
||||
Long projectId,
|
||||
List<CcdiProjectSuspiciousTransactionExcel> suspiciousRows,
|
||||
List<CcdiProjectEmployeeCreditNegativeExcel> creditRows
|
||||
List<CcdiProjectEmployeeCreditNegativeExcel> creditRows,
|
||||
List<CcdiProjectAbnormalAccountExcel> abnormalRows
|
||||
) throws IOException {
|
||||
response.setContentType(CONTENT_TYPE);
|
||||
FileUtils.setAttachmentResponseHeader(response, "风险明细_" + projectId + ".xlsx");
|
||||
@@ -35,7 +37,7 @@ public class CcdiProjectRiskDetailWorkbookExporter {
|
||||
try (Workbook workbook = new XSSFWorkbook()) {
|
||||
writeSuspiciousSheet(workbook.createSheet("涉疑交易明细"), suspiciousRows);
|
||||
writeCreditSheet(workbook.createSheet("员工负面征信信息"), creditRows);
|
||||
writeAbnormalAccountSheet(workbook.createSheet("异常账户人员信息"));
|
||||
writeAbnormalAccountSheet(workbook.createSheet("异常账户人员信息"), abnormalRows);
|
||||
workbook.write(response.getOutputStream());
|
||||
}
|
||||
}
|
||||
@@ -88,10 +90,21 @@ public class CcdiProjectRiskDetailWorkbookExporter {
|
||||
}
|
||||
}
|
||||
|
||||
private void writeAbnormalAccountSheet(Sheet sheet) {
|
||||
private void writeAbnormalAccountSheet(Sheet sheet, List<CcdiProjectAbnormalAccountExcel> rows) {
|
||||
Row header = sheet.createRow(0);
|
||||
String[] headers = { "账号", "开户人", "银行", "异常类型", "异常发生时间", "状态" };
|
||||
writeHeader(header, headers);
|
||||
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
CcdiProjectAbnormalAccountExcel item = rows.get(i);
|
||||
Row row = sheet.createRow(i + 1);
|
||||
row.createCell(0).setCellValue(safeText(item.getAccountNo()));
|
||||
row.createCell(1).setCellValue(safeText(item.getAccountName()));
|
||||
row.createCell(2).setCellValue(safeText(item.getBankName()));
|
||||
row.createCell(3).setCellValue(safeText(item.getAbnormalType()));
|
||||
row.createCell(4).setCellValue(safeText(item.getAbnormalTime()));
|
||||
row.createCell(5).setCellValue(safeText(item.getStatus()));
|
||||
}
|
||||
}
|
||||
|
||||
private void writeHeader(Row row, String[] headers) {
|
||||
|
||||
@@ -924,7 +924,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
from ccdi_purchase_transaction pt
|
||||
inner join (
|
||||
<include refid="projectScopedDirectStaffSql"/>
|
||||
) project_staff on project_staff.staffId = pt.applicant_id
|
||||
) project_staff on project_staff.staffId COLLATE utf8mb4_general_ci = pt.applicant_id COLLATE utf8mb4_general_ci
|
||||
where IFNULL(pt.actual_amount, 0) > 100000
|
||||
union
|
||||
select distinct
|
||||
@@ -935,7 +935,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
from ccdi_purchase_transaction pt
|
||||
inner join (
|
||||
<include refid="projectScopedDirectStaffSql"/>
|
||||
) project_staff on project_staff.staffId = pt.purchase_leader_id
|
||||
) project_staff on project_staff.staffId COLLATE utf8mb4_general_ci = pt.purchase_leader_id COLLATE utf8mb4_general_ci
|
||||
where pt.purchase_leader_id is not null
|
||||
and IFNULL(pt.actual_amount, 0) > 100000
|
||||
) t
|
||||
@@ -975,7 +975,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
from ccdi_purchase_transaction pt
|
||||
inner join (
|
||||
<include refid="projectScopedDirectStaffSql"/>
|
||||
) project_staff on project_staff.staffId = pt.applicant_id
|
||||
) project_staff on project_staff.staffId COLLATE utf8mb4_general_ci = pt.applicant_id COLLATE utf8mb4_general_ci
|
||||
where IFNULL(pt.actual_amount, 0) > 0
|
||||
and IFNULL(pt.supplier_name, '') <> ''
|
||||
|
||||
@@ -989,7 +989,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
from ccdi_purchase_transaction pt
|
||||
inner join (
|
||||
<include refid="projectScopedDirectStaffSql"/>
|
||||
) project_staff on project_staff.staffId = pt.purchase_leader_id
|
||||
) project_staff on project_staff.staffId COLLATE utf8mb4_general_ci = pt.purchase_leader_id COLLATE utf8mb4_general_ci
|
||||
where pt.purchase_leader_id is not null
|
||||
and IFNULL(pt.actual_amount, 0) > 0
|
||||
and IFNULL(pt.supplier_name, '') <> ''
|
||||
@@ -1006,7 +1006,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
from ccdi_purchase_transaction pt
|
||||
inner join (
|
||||
<include refid="projectScopedDirectStaffSql"/>
|
||||
) project_staff on project_staff.staffId = pt.applicant_id
|
||||
) project_staff on project_staff.staffId COLLATE utf8mb4_general_ci = pt.applicant_id COLLATE utf8mb4_general_ci
|
||||
where IFNULL(pt.actual_amount, 0) > 0
|
||||
|
||||
union
|
||||
@@ -1018,7 +1018,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
from ccdi_purchase_transaction pt
|
||||
inner join (
|
||||
<include refid="projectScopedDirectStaffSql"/>
|
||||
) project_staff on project_staff.staffId = pt.purchase_leader_id
|
||||
) project_staff on project_staff.staffId COLLATE utf8mb4_general_ci = pt.purchase_leader_id COLLATE utf8mb4_general_ci
|
||||
where pt.purchase_leader_id is not null
|
||||
and IFNULL(pt.actual_amount, 0) > 0
|
||||
) source_total
|
||||
@@ -1211,6 +1211,101 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
) t
|
||||
</select>
|
||||
|
||||
<select id="selectSuddenAccountClosureObjects" resultMap="BankTagObjectHitResultMap">
|
||||
select
|
||||
'STAFF_ID_CARD' AS objectType,
|
||||
t.objectKey AS objectKey,
|
||||
CONCAT(
|
||||
'账户', t.accountNo,
|
||||
'于', DATE_FORMAT(t.invalidDate, '%Y-%m-%d'),
|
||||
'销户,销户前30天内最后交易日', DATE_FORMAT(t.lastTxDate, '%Y-%m-%d'),
|
||||
',累计交易金额', CAST(t.windowTotalAmount AS CHAR),
|
||||
'元,单笔最大金额', CAST(t.windowMaxSingleAmount AS CHAR),
|
||||
'元'
|
||||
) AS reasonDetail
|
||||
from (
|
||||
select
|
||||
staff.id_card AS objectKey,
|
||||
ai.account_no AS accountNo,
|
||||
ai.invalid_date AS invalidDate,
|
||||
max(tx.txDate) AS lastTxDate,
|
||||
round(sum(tx.tradeTotalAmount), 2) AS windowTotalAmount,
|
||||
round(max(tx.tradeMaxSingleAmount), 2) AS windowMaxSingleAmount
|
||||
from ccdi_account_info ai
|
||||
inner join ccdi_base_staff staff
|
||||
on staff.id_card = ai.owner_id
|
||||
inner join (
|
||||
select
|
||||
trim(bs.LE_ACCOUNT_NO) AS accountNo,
|
||||
COALESCE(
|
||||
STR_TO_DATE(LEFT(TRIM(bs.TRX_DATE), 19), '%Y-%m-%d %H:%i:%s'),
|
||||
STR_TO_DATE(LEFT(TRIM(bs.TRX_DATE), 10), '%Y-%m-%d')
|
||||
) AS txDate,
|
||||
IFNULL(bs.AMOUNT_DR, 0) + IFNULL(bs.AMOUNT_CR, 0) AS tradeTotalAmount,
|
||||
GREATEST(IFNULL(bs.AMOUNT_DR, 0), IFNULL(bs.AMOUNT_CR, 0)) AS tradeMaxSingleAmount
|
||||
from ccdi_bank_statement bs
|
||||
where bs.project_id = #{projectId}
|
||||
and trim(IFNULL(bs.LE_ACCOUNT_NO, '')) != ''
|
||||
) tx
|
||||
on tx.accountNo = trim(ai.account_no)
|
||||
where ai.owner_type = 'EMPLOYEE'
|
||||
and ai.status = 2
|
||||
and ai.invalid_date is not null
|
||||
and tx.txDate >= DATE_SUB(ai.invalid_date, INTERVAL 30 DAY)
|
||||
and tx.txDate < ai.invalid_date
|
||||
group by staff.id_card, ai.account_no, ai.invalid_date
|
||||
) t
|
||||
</select>
|
||||
|
||||
<select id="selectDormantAccountLargeActivationObjects" resultMap="BankTagObjectHitResultMap">
|
||||
select
|
||||
'STAFF_ID_CARD' AS objectType,
|
||||
t.objectKey AS objectKey,
|
||||
CONCAT(
|
||||
'账户', t.accountNo,
|
||||
'开户于', DATE_FORMAT(t.effectiveDate, '%Y-%m-%d'),
|
||||
',首次交易日期', DATE_FORMAT(t.firstTxDate, '%Y-%m-%d'),
|
||||
',沉睡时长', CAST(t.dormantMonths AS CHAR),
|
||||
'个月,启用后累计交易金额', CAST(t.windowTotalAmount AS CHAR),
|
||||
'元,单笔最大金额', CAST(t.windowMaxSingleAmount AS CHAR),
|
||||
'元'
|
||||
) AS reasonDetail
|
||||
from (
|
||||
select
|
||||
staff.id_card AS objectKey,
|
||||
ai.account_no AS accountNo,
|
||||
ai.effective_date AS effectiveDate,
|
||||
min(tx.txDate) AS firstTxDate,
|
||||
timestampdiff(MONTH, ai.effective_date, min(tx.txDate)) AS dormantMonths,
|
||||
round(sum(tx.tradeTotalAmount), 2) AS windowTotalAmount,
|
||||
round(max(tx.tradeMaxSingleAmount), 2) AS windowMaxSingleAmount
|
||||
from ccdi_account_info ai
|
||||
inner join ccdi_base_staff staff
|
||||
on staff.id_card = ai.owner_id
|
||||
inner join (
|
||||
select
|
||||
trim(bs.LE_ACCOUNT_NO) AS accountNo,
|
||||
COALESCE(
|
||||
STR_TO_DATE(LEFT(TRIM(bs.TRX_DATE), 19), '%Y-%m-%d %H:%i:%s'),
|
||||
STR_TO_DATE(LEFT(TRIM(bs.TRX_DATE), 10), '%Y-%m-%d')
|
||||
) AS txDate,
|
||||
IFNULL(bs.AMOUNT_DR, 0) + IFNULL(bs.AMOUNT_CR, 0) AS tradeTotalAmount,
|
||||
GREATEST(IFNULL(bs.AMOUNT_DR, 0), IFNULL(bs.AMOUNT_CR, 0)) AS tradeMaxSingleAmount
|
||||
from ccdi_bank_statement bs
|
||||
where bs.project_id = #{projectId}
|
||||
and trim(IFNULL(bs.LE_ACCOUNT_NO, '')) != ''
|
||||
) tx
|
||||
on tx.accountNo = trim(ai.account_no)
|
||||
where ai.owner_type = 'EMPLOYEE'
|
||||
and ai.status = 1
|
||||
and ai.effective_date is not null
|
||||
group by staff.id_card, ai.account_no, ai.effective_date
|
||||
having min(tx.txDate) >= DATE_ADD(ai.effective_date, INTERVAL 6 MONTH)
|
||||
) t
|
||||
where t.windowTotalAmount >= 500000
|
||||
or t.windowMaxSingleAmount >= 100000
|
||||
</select>
|
||||
|
||||
<select id="selectLargeStockTradingStatements" resultMap="BankTagStatementHitResultMap">
|
||||
select
|
||||
bs.bank_statement_id AS bankStatementId,
|
||||
|
||||
@@ -48,6 +48,15 @@
|
||||
<result property="hasNameListHit" column="hasNameListHit"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="AbnormalAccountItemResultMap" type="com.ruoyi.ccdi.project.domain.vo.CcdiProjectAbnormalAccountItemVO">
|
||||
<result property="accountNo" column="accountNo"/>
|
||||
<result property="accountName" column="accountName"/>
|
||||
<result property="bankName" column="bankName"/>
|
||||
<result property="abnormalType" column="abnormalType"/>
|
||||
<result property="abnormalTime" column="abnormal_time"/>
|
||||
<result property="status" column="status"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="digitTableSql">
|
||||
select 0 as digit
|
||||
union all select 1
|
||||
@@ -644,6 +653,92 @@
|
||||
order by neg.query_date desc, neg.person_id asc
|
||||
</select>
|
||||
|
||||
<sql id="abnormalAccountBaseSql">
|
||||
select
|
||||
account.account_no as accountNo,
|
||||
account.account_no as account_no,
|
||||
coalesce(nullif(account.account_name, ''), staff.name) as accountName,
|
||||
account.bank as bankName,
|
||||
tr.rule_name as abnormalType,
|
||||
tr.rule_code as rule_code,
|
||||
case
|
||||
when tr.rule_code = 'SUDDEN_ACCOUNT_CLOSURE' then date_format(account.invalid_date, '%Y-%m-%d')
|
||||
when tr.rule_code = 'DORMANT_ACCOUNT_LARGE_ACTIVATION' then substring(
|
||||
substring_index(
|
||||
substring_index(tr.reason_detail, ',', 2),
|
||||
'首次交易日期',
|
||||
-1
|
||||
),
|
||||
1,
|
||||
10
|
||||
)
|
||||
else null
|
||||
end as abnormal_time,
|
||||
case
|
||||
when account.status = 1 then '正常'
|
||||
when account.status = 2 then '已销户'
|
||||
else cast(account.status as char)
|
||||
end as status
|
||||
from ccdi_bank_statement_tag_result tr
|
||||
inner join ccdi_account_info account
|
||||
on account.owner_type = 'EMPLOYEE'
|
||||
and account.owner_id = tr.object_key
|
||||
and instr(tr.reason_detail, account.account_no) > 0
|
||||
left join ccdi_base_staff staff
|
||||
on staff.id_card = tr.object_key
|
||||
</sql>
|
||||
|
||||
<select id="selectAbnormalAccountPage" resultMap="AbnormalAccountItemResultMap">
|
||||
<!-- tr.model_code = 'ABNORMAL_ACCOUNT' -->
|
||||
<!-- tr.bank_statement_id is null -->
|
||||
<!-- account.owner_type = 'EMPLOYEE' -->
|
||||
<!-- tr.reason_detail -->
|
||||
<!-- instr(tr.reason_detail, account.account_no) > 0 -->
|
||||
<!-- when account.status = 1 then '正常' -->
|
||||
<!-- when account.status = 2 then '已销户' -->
|
||||
<!-- when tr.rule_code = 'SUDDEN_ACCOUNT_CLOSURE' -->
|
||||
<!-- when tr.rule_code = 'DORMANT_ACCOUNT_LARGE_ACTIVATION' -->
|
||||
<!-- order by abnormal_time desc, account.account_no asc, tr.rule_code asc -->
|
||||
select
|
||||
abnormal.accountNo,
|
||||
abnormal.accountName,
|
||||
abnormal.bankName,
|
||||
abnormal.abnormalType,
|
||||
abnormal.abnormal_time,
|
||||
abnormal.status
|
||||
from (
|
||||
<include refid="abnormalAccountBaseSql"/>
|
||||
where tr.project_id = #{query.projectId}
|
||||
and tr.model_code = 'ABNORMAL_ACCOUNT'
|
||||
and tr.bank_statement_id is null
|
||||
) abnormal
|
||||
<!-- order by abnormal_time desc, account.account_no asc, tr.rule_code asc -->
|
||||
order by abnormal.abnormal_time desc, abnormal.account_no asc, abnormal.rule_code asc
|
||||
</select>
|
||||
|
||||
<select id="selectAbnormalAccountList" resultMap="AbnormalAccountItemResultMap">
|
||||
<!-- tr.model_code = 'ABNORMAL_ACCOUNT' -->
|
||||
<!-- tr.bank_statement_id is null -->
|
||||
<!-- account.owner_type = 'EMPLOYEE' -->
|
||||
<!-- tr.reason_detail -->
|
||||
<!-- order by abnormal_time desc, account.account_no asc, tr.rule_code asc -->
|
||||
select
|
||||
abnormal.accountNo,
|
||||
abnormal.accountName,
|
||||
abnormal.bankName,
|
||||
abnormal.abnormalType,
|
||||
abnormal.abnormal_time,
|
||||
abnormal.status
|
||||
from (
|
||||
<include refid="abnormalAccountBaseSql"/>
|
||||
where tr.project_id = #{projectId}
|
||||
and tr.model_code = 'ABNORMAL_ACCOUNT'
|
||||
and tr.bank_statement_id is null
|
||||
) abnormal
|
||||
<!-- order by abnormal_time desc, account.account_no asc, tr.rule_code asc -->
|
||||
order by abnormal.abnormal_time desc, abnormal.account_no asc, abnormal.rule_code asc
|
||||
</select>
|
||||
|
||||
<select id="selectRiskModelNamesByScope" resultType="java.lang.String">
|
||||
select
|
||||
json_unquote(json_extract(result.model_hit_summary_json, concat('$[', idx.idx, '].modelName'))) as model_name
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -126,6 +127,26 @@ class CcdiProjectOverviewControllerContractTest {
|
||||
assertEquals(AjaxResult.class, method.getReturnType());
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldExposeAbnormalAccountPeopleEndpointContract() throws Exception {
|
||||
Class<?> controllerClass = Class.forName("com.ruoyi.ccdi.project.controller.CcdiProjectOverviewController");
|
||||
Class<?> queryDtoClass =
|
||||
Class.forName("com.ruoyi.ccdi.project.domain.dto.CcdiProjectAbnormalAccountQueryDTO");
|
||||
|
||||
Method method = controllerClass.getMethod("getAbnormalAccountPeople", queryDtoClass);
|
||||
GetMapping getMapping = method.getAnnotation(GetMapping.class);
|
||||
Operation operation = method.getAnnotation(Operation.class);
|
||||
PreAuthorize preAuthorize = method.getAnnotation(PreAuthorize.class);
|
||||
|
||||
assertNotNull(getMapping);
|
||||
assertEquals("/abnormal-account-people", getMapping.value()[0]);
|
||||
assertNotNull(operation);
|
||||
assertEquals("查询异常账户人员信息", operation.summary());
|
||||
assertNotNull(preAuthorize);
|
||||
assertEquals("@ss.hasPermi('ccdi:project:query')", preAuthorize.value());
|
||||
assertEquals(queryDtoClass, method.getParameterTypes()[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldExposeSuspiciousTransactionsExportEndpointContract() throws Exception {
|
||||
Class<?> controllerClass = Class.forName("com.ruoyi.ccdi.project.controller.CcdiProjectOverviewController");
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.ruoyi.ccdi.project.controller;
|
||||
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectAbnormalAccountQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectEmployeeCreditNegativeQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectPersonAnalysisDetailQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectSuspiciousTransactionQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectAbnormalAccountPageVO;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectRiskPeopleOverviewExcel;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectEmployeeCreditNegativeItemVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectEmployeeCreditNegativePageVO;
|
||||
@@ -244,6 +246,36 @@ class CcdiProjectOverviewControllerTest {
|
||||
assertNotNull(operation);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldExposeAbnormalAccountPeopleEndpoint() throws Exception {
|
||||
CcdiProjectAbnormalAccountQueryDTO queryDTO = new CcdiProjectAbnormalAccountQueryDTO();
|
||||
queryDTO.setProjectId(40L);
|
||||
|
||||
CcdiProjectAbnormalAccountPageVO pageVO = new CcdiProjectAbnormalAccountPageVO();
|
||||
when(overviewService.getAbnormalAccountPeople(queryDTO)).thenReturn(pageVO);
|
||||
|
||||
AjaxResult result = controller.getAbnormalAccountPeople(queryDTO);
|
||||
|
||||
assertEquals(200, result.get("code"));
|
||||
assertEquals(pageVO, result.get("data"));
|
||||
verify(overviewService).getAbnormalAccountPeople(same(queryDTO));
|
||||
|
||||
Method method = CcdiProjectOverviewController.class.getMethod(
|
||||
"getAbnormalAccountPeople",
|
||||
CcdiProjectAbnormalAccountQueryDTO.class
|
||||
);
|
||||
GetMapping getMapping = method.getAnnotation(GetMapping.class);
|
||||
PreAuthorize preAuthorize = method.getAnnotation(PreAuthorize.class);
|
||||
Operation operation = method.getAnnotation(Operation.class);
|
||||
|
||||
assertNotNull(getMapping);
|
||||
assertEquals("/abnormal-account-people", getMapping.value()[0]);
|
||||
assertNotNull(preAuthorize);
|
||||
assertEquals("@ss.hasPermi('ccdi:project:query')", preAuthorize.value());
|
||||
assertNotNull(operation);
|
||||
assertEquals("查询异常账户人员信息", operation.summary());
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldExposeSuspiciousTransactionsExportEndpoint() throws Exception {
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
@@ -148,6 +148,34 @@ class CcdiBankTagAnalysisMapperXmlTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void largePurchaseTransactionRule_shouldAlignCollationForJoinFields() throws Exception {
|
||||
String xml = readXml(RESOURCE);
|
||||
String purchaseSelectSql = extractSelectSql(xml, "selectLargePurchaseTransactionStatements");
|
||||
String supplierSelectSql = extractSelectSql(xml, "selectSupplierConcentrationObjects");
|
||||
|
||||
assertTrue(
|
||||
purchaseSelectSql.contains("project_staff.staffId COLLATE utf8mb4_general_ci = pt.applicant_id COLLATE utf8mb4_general_ci")
|
||||
);
|
||||
assertTrue(
|
||||
purchaseSelectSql.contains("project_staff.staffId COLLATE utf8mb4_general_ci = pt.purchase_leader_id COLLATE utf8mb4_general_ci")
|
||||
);
|
||||
assertTrue(
|
||||
supplierSelectSql.contains("project_staff.staffId COLLATE utf8mb4_general_ci = pt.applicant_id COLLATE utf8mb4_general_ci")
|
||||
);
|
||||
assertTrue(
|
||||
supplierSelectSql.contains("project_staff.staffId COLLATE utf8mb4_general_ci = pt.purchase_leader_id COLLATE utf8mb4_general_ci")
|
||||
);
|
||||
assertTrue(
|
||||
!xml.contains("project_staff.staffId = pt.applicant_id"),
|
||||
"采购交易相关 join 不应再使用未声明 COLLATE 的 applicant_id 比较"
|
||||
);
|
||||
assertTrue(
|
||||
!xml.contains("project_staff.staffId = pt.purchase_leader_id"),
|
||||
"采购交易相关 join 不应再使用未声明 COLLATE 的 purchase_leader_id 比较"
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void assetRegistrationMismatchRules_shouldUseRealSqlAndAssetTable() throws Exception {
|
||||
String xml = readXml(RESOURCE);
|
||||
|
||||
@@ -121,6 +121,36 @@ class CcdiProjectOverviewMapperSqlTest {
|
||||
assertFalse(employeeCreditExportSql.contains("ccdi_debts_info"), employeeCreditExportSql);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldExposeAbnormalAccountQueries() throws Exception {
|
||||
String xml = Files.readString(Path.of("src/main/resources/mapper/ccdi/project/CcdiProjectOverviewMapper.xml"));
|
||||
String abnormalPageSql = extractSelect(xml, "selectAbnormalAccountPage");
|
||||
String abnormalExportSql = extractSelect(xml, "selectAbnormalAccountList");
|
||||
|
||||
assertTrue(abnormalPageSql.contains("tr.model_code = 'ABNORMAL_ACCOUNT'"), abnormalPageSql);
|
||||
assertTrue(abnormalPageSql.contains("tr.bank_statement_id is null"), abnormalPageSql);
|
||||
assertTrue(abnormalPageSql.contains("account.owner_type = 'EMPLOYEE'"), abnormalPageSql);
|
||||
assertTrue(abnormalPageSql.contains("tr.reason_detail"), abnormalPageSql);
|
||||
assertTrue(abnormalPageSql.contains("instr(tr.reason_detail, account.account_no) > 0"), abnormalPageSql);
|
||||
assertTrue(abnormalPageSql.contains("when account.status = 1 then '正常'"), abnormalPageSql);
|
||||
assertTrue(abnormalPageSql.contains("when account.status = 2 then '已销户'"), abnormalPageSql);
|
||||
assertTrue(abnormalPageSql.contains("when tr.rule_code = 'SUDDEN_ACCOUNT_CLOSURE'"), abnormalPageSql);
|
||||
assertTrue(abnormalPageSql.contains("when tr.rule_code = 'DORMANT_ACCOUNT_LARGE_ACTIVATION'"), abnormalPageSql);
|
||||
assertTrue(
|
||||
abnormalPageSql.contains("order by abnormal_time desc, account.account_no asc, tr.rule_code asc"),
|
||||
abnormalPageSql
|
||||
);
|
||||
|
||||
assertTrue(abnormalExportSql.contains("tr.model_code = 'ABNORMAL_ACCOUNT'"), abnormalExportSql);
|
||||
assertTrue(abnormalExportSql.contains("tr.bank_statement_id is null"), abnormalExportSql);
|
||||
assertTrue(abnormalExportSql.contains("account.owner_type = 'EMPLOYEE'"), abnormalExportSql);
|
||||
assertTrue(abnormalExportSql.contains("tr.reason_detail"), abnormalExportSql);
|
||||
assertTrue(
|
||||
abnormalExportSql.contains("order by abnormal_time desc, account.account_no asc, tr.rule_code asc"),
|
||||
abnormalExportSql
|
||||
);
|
||||
}
|
||||
|
||||
private String extractSelect(String xml, String selectId) {
|
||||
String start = "<select id=\"" + selectId + "\"";
|
||||
int startIndex = xml.indexOf(start);
|
||||
|
||||
@@ -28,7 +28,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.math.BigDecimal;
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
@@ -406,6 +410,129 @@ class CcdiBankTagServiceImplTest {
|
||||
verify(analysisMapper).selectSalaryUnusedObjects(40L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void rebuildProject_shouldDispatchSuddenAccountClosureObjectRule() {
|
||||
ReflectionTestUtils.setField(service, "tagRuleExecutor", (Executor) Runnable::run);
|
||||
|
||||
CcdiBankTagRule rule = buildRule("ABNORMAL_ACCOUNT", "异常账户",
|
||||
"SUDDEN_ACCOUNT_CLOSURE", "突然销户", "OBJECT");
|
||||
|
||||
when(ruleMapper.selectEnabledRules("ABNORMAL_ACCOUNT")).thenReturn(List.of(rule));
|
||||
when(configResolver.resolve(40L, rule)).thenReturn(buildConfig(40L, rule));
|
||||
when(analysisMapper.selectSuddenAccountClosureObjects(40L)).thenReturn(List.of());
|
||||
|
||||
service.rebuildProject(40L, "ABNORMAL_ACCOUNT", "admin", TriggerType.MANUAL);
|
||||
|
||||
verify(analysisMapper).selectSuddenAccountClosureObjects(40L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void rebuildProject_shouldDispatchDormantAccountLargeActivationObjectRule() {
|
||||
ReflectionTestUtils.setField(service, "tagRuleExecutor", (Executor) Runnable::run);
|
||||
|
||||
CcdiBankTagRule rule = buildRule("ABNORMAL_ACCOUNT", "异常账户",
|
||||
"DORMANT_ACCOUNT_LARGE_ACTIVATION", "休眠账户大额启用", "OBJECT");
|
||||
|
||||
when(ruleMapper.selectEnabledRules("ABNORMAL_ACCOUNT")).thenReturn(List.of(rule));
|
||||
when(configResolver.resolve(40L, rule)).thenReturn(buildConfig(40L, rule));
|
||||
when(analysisMapper.selectDormantAccountLargeActivationObjects(40L)).thenReturn(List.of());
|
||||
|
||||
service.rebuildProject(40L, "ABNORMAL_ACCOUNT", "admin", TriggerType.MANUAL);
|
||||
|
||||
verify(analysisMapper).selectDormantAccountLargeActivationObjects(40L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void rebuildProject_shouldInsertSuddenAccountClosureObjectResults() {
|
||||
ReflectionTestUtils.setField(service, "tagRuleExecutor", (Executor) Runnable::run);
|
||||
|
||||
CcdiBankTagRule rule = buildRule("ABNORMAL_ACCOUNT", "异常账户",
|
||||
"SUDDEN_ACCOUNT_CLOSURE", "突然销户", "OBJECT");
|
||||
BankTagRuleExecutionConfig config = buildConfig(40L, rule);
|
||||
|
||||
BankTagObjectHitVO hit = new BankTagObjectHitVO();
|
||||
hit.setObjectType("STAFF_ID_CARD");
|
||||
hit.setObjectKey("330101199001011234");
|
||||
hit.setReasonDetail("账户62220001于2026-03-15销户,销户前30天内最后交易日2026-03-10,累计交易金额120000元,单笔最大金额80000元");
|
||||
|
||||
when(ruleMapper.selectEnabledRules("ABNORMAL_ACCOUNT")).thenReturn(List.of(rule));
|
||||
when(configResolver.resolve(40L, rule)).thenReturn(config);
|
||||
when(analysisMapper.selectSuddenAccountClosureObjects(40L)).thenReturn(List.of(hit));
|
||||
|
||||
service.rebuildProject(40L, "ABNORMAL_ACCOUNT", "admin", TriggerType.MANUAL);
|
||||
|
||||
verify(resultMapper).insertBatch(argThat(results -> results.stream().anyMatch(item ->
|
||||
"ABNORMAL_ACCOUNT".equals(item.getModelCode())
|
||||
&& "SUDDEN_ACCOUNT_CLOSURE".equals(item.getRuleCode())
|
||||
&& "OBJECT".equals(item.getResultType())
|
||||
&& "STAFF_ID_CARD".equals(item.getObjectType())
|
||||
)));
|
||||
}
|
||||
|
||||
@Test
|
||||
void rebuildProject_shouldInsertDormantAccountLargeActivationObjectResults() {
|
||||
ReflectionTestUtils.setField(service, "tagRuleExecutor", (Executor) Runnable::run);
|
||||
|
||||
CcdiBankTagRule rule = buildRule("ABNORMAL_ACCOUNT", "异常账户",
|
||||
"DORMANT_ACCOUNT_LARGE_ACTIVATION", "休眠账户大额启用", "OBJECT");
|
||||
BankTagRuleExecutionConfig config = buildConfig(40L, rule);
|
||||
|
||||
BankTagObjectHitVO hit = new BankTagObjectHitVO();
|
||||
hit.setObjectType("STAFF_ID_CARD");
|
||||
hit.setObjectKey("330101199001011235");
|
||||
hit.setReasonDetail("账户62220002开户于2025-01-01,首次交易日期2025-08-01,沉睡时长7个月,启用后累计交易金额500000元,单笔最大金额120000元");
|
||||
|
||||
when(ruleMapper.selectEnabledRules("ABNORMAL_ACCOUNT")).thenReturn(List.of(rule));
|
||||
when(configResolver.resolve(40L, rule)).thenReturn(config);
|
||||
when(analysisMapper.selectDormantAccountLargeActivationObjects(40L)).thenReturn(List.of(hit));
|
||||
|
||||
service.rebuildProject(40L, "ABNORMAL_ACCOUNT", "admin", TriggerType.MANUAL);
|
||||
|
||||
verify(resultMapper).insertBatch(argThat(results -> results.stream().anyMatch(item ->
|
||||
"ABNORMAL_ACCOUNT".equals(item.getModelCode())
|
||||
&& "DORMANT_ACCOUNT_LARGE_ACTIVATION".equals(item.getRuleCode())
|
||||
&& "OBJECT".equals(item.getResultType())
|
||||
&& "STAFF_ID_CARD".equals(item.getObjectType())
|
||||
)));
|
||||
}
|
||||
|
||||
@Test
|
||||
void buildSafeTaskErrorMessage_shouldKeepLongMessageForLongTextColumn() throws Exception {
|
||||
Method method = CcdiBankTagServiceImpl.class.getDeclaredMethod(
|
||||
"buildSafeTaskErrorMessage", Throwable.class
|
||||
);
|
||||
method.setAccessible(true);
|
||||
|
||||
String longMessage = "X".repeat(5000);
|
||||
RuntimeException throwable = new RuntimeException("root-cause:" + longMessage);
|
||||
|
||||
String result = (String) method.invoke(null, throwable);
|
||||
|
||||
assertNotNull(result);
|
||||
assertTrue(result.length() > 2000, "LONGTEXT 方案下不应继续把错误信息截断到 2000");
|
||||
assertTrue(result.contains("root-cause"), "错误信息应保留根因关键字");
|
||||
}
|
||||
|
||||
@Test
|
||||
void abnormalAccountMapperXml_shouldDeclareObjectSelects() throws Exception {
|
||||
String xml = Files.readString(Path.of("src/main/resources/mapper/ccdi/project/CcdiBankTagAnalysisMapper.xml"));
|
||||
|
||||
assertTrue(xml.contains("select id=\"selectSuddenAccountClosureObjects\""));
|
||||
assertTrue(xml.contains("select id=\"selectDormantAccountLargeActivationObjects\""));
|
||||
}
|
||||
|
||||
@Test
|
||||
void dormantAccountLargeActivationMapperXml_shouldContainDormantAccountConditions() throws Exception {
|
||||
String xml = Files.readString(Path.of("src/main/resources/mapper/ccdi/project/CcdiBankTagAnalysisMapper.xml"));
|
||||
|
||||
assertTrue(xml.contains("select id=\"selectDormantAccountLargeActivationObjects\""));
|
||||
assertTrue(xml.contains("ai.owner_type = 'EMPLOYEE'"));
|
||||
assertTrue(xml.contains("ai.status = 1"));
|
||||
assertTrue(xml.contains("ai.effective_date is not null"));
|
||||
assertTrue(xml.contains("DATE_ADD(ai.effective_date, INTERVAL 6 MONTH)"));
|
||||
assertTrue(xml.contains("windowTotalAmount >= 500000") || xml.contains("windowMaxSingleAmount >= 100000"));
|
||||
}
|
||||
|
||||
private CcdiBankTagRule buildRule(String modelCode, String modelName, String ruleCode, String ruleName, String resultType) {
|
||||
CcdiBankTagRule rule = new CcdiBankTagRule();
|
||||
rule.setModelCode(modelCode);
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class CcdiProjectOverviewEmployeeResultBuilderTest {
|
||||
|
||||
@@ -38,7 +39,11 @@ class CcdiProjectOverviewEmployeeResultBuilderTest {
|
||||
buildHitRow(rowClass, "330000000000000001", "李四", "E1001", 12L, "信息二部",
|
||||
"SUSPICIOUS_PART_TIME", "可疑兼职", "MONTHLY_FIXED_INCOME", "疑似兼职", "MEDIUM"),
|
||||
buildHitRow(rowClass, "330000000000000001", "李四", "E1001", 12L, "信息二部",
|
||||
"SUSPICIOUS_PROPERTY", "可疑财产", "HOUSE_REGISTRATION_MISMATCH", "房产登记不匹配", "LOW")
|
||||
"SUSPICIOUS_PROPERTY", "可疑财产", "HOUSE_REGISTRATION_MISMATCH", "房产登记不匹配", "LOW"),
|
||||
buildHitRow(rowClass, "330000000000000001", "李四", "E1001", 12L, "信息二部",
|
||||
"ABNORMAL_ACCOUNT", "异常账户", "SUDDEN_ACCOUNT_CLOSURE", "突然销户", "HIGH"),
|
||||
buildHitRow(rowClass, "330000000000000001", "李四", "E1001", 12L, "信息二部",
|
||||
"ABNORMAL_ACCOUNT", "异常账户", "DORMANT_ACCOUNT_LARGE_ACTIVATION", "休眠账户大额启用", "HIGH")
|
||||
);
|
||||
|
||||
List<CcdiProjectOverviewEmployeeResult> results =
|
||||
@@ -52,20 +57,22 @@ class CcdiProjectOverviewEmployeeResultBuilderTest {
|
||||
assertEquals("E1001", result.getStaffCode());
|
||||
assertEquals(12L, result.getDeptId());
|
||||
assertEquals("信息二部", result.getDeptName());
|
||||
assertEquals(5, result.getRuleCount());
|
||||
assertEquals(4, result.getModelCount());
|
||||
assertEquals(7, result.getHitCount());
|
||||
assertEquals(7, result.getRuleCount());
|
||||
assertEquals(5, result.getModelCount());
|
||||
assertEquals(9, result.getHitCount());
|
||||
assertEquals("HIGH", result.getRiskLevelCode());
|
||||
assertEquals("ABNORMAL_TRANSACTION,LARGE_TRANSACTION,SUSPICIOUS_PART_TIME,SUSPICIOUS_PROPERTY",
|
||||
assertEquals("ABNORMAL_ACCOUNT,ABNORMAL_TRANSACTION,LARGE_TRANSACTION,SUSPICIOUS_PART_TIME,SUSPICIOUS_PROPERTY",
|
||||
result.getModelCodesCsv());
|
||||
assertNotNull(result.getRiskPoint());
|
||||
|
||||
JSONArray modelNames = JSON.parseArray(result.getModelNamesJson());
|
||||
assertEquals(List.of("异常交易", "大额交易", "可疑兼职", "可疑财产"),
|
||||
assertEquals(List.of("异常账户", "异常交易", "大额交易", "可疑兼职", "可疑财产"),
|
||||
modelNames.toList(String.class));
|
||||
|
||||
JSONArray hitRules = JSON.parseArray(result.getHitRulesJson());
|
||||
assertEquals(5, hitRules.size());
|
||||
assertEquals(7, hitRules.size());
|
||||
assertTrue(result.getHitRulesJson().contains("SUDDEN_ACCOUNT_CLOSURE"));
|
||||
assertTrue(result.getHitRulesJson().contains("DORMANT_ACCOUNT_LARGE_ACTIVATION"));
|
||||
JSONObject firstRule = hitRules.getJSONObject(0);
|
||||
assertEquals("ABNORMAL_CUSTOMER_TRANSACTION", firstRule.getString("ruleCode"));
|
||||
assertEquals("异常客户交易", firstRule.getString("ruleName"));
|
||||
@@ -78,6 +85,7 @@ class CcdiProjectOverviewEmployeeResultBuilderTest {
|
||||
item -> item.getString("modelCode"),
|
||||
item -> item.getIntValue("warningCount")
|
||||
));
|
||||
assertEquals(2, warningCountByModel.get("ABNORMAL_ACCOUNT"));
|
||||
assertEquals(2, warningCountByModel.get("ABNORMAL_TRANSACTION"));
|
||||
assertEquals(3, warningCountByModel.get("LARGE_TRANSACTION"));
|
||||
assertEquals(1, warningCountByModel.get("SUSPICIOUS_PROPERTY"));
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
package com.ruoyi.ccdi.project.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.ccdi.project.domain.CcdiProject;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectAbnormalAccountQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectAbnormalAccountExcel;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectAbnormalAccountItemVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectAbnormalAccountPageVO;
|
||||
import com.ruoyi.ccdi.project.mapper.CcdiBankTagResultMapper;
|
||||
import com.ruoyi.ccdi.project.mapper.CcdiProjectMapper;
|
||||
import com.ruoyi.ccdi.project.mapper.CcdiProjectOverviewEmployeeResultMapper;
|
||||
import com.ruoyi.ccdi.project.mapper.CcdiProjectOverviewMapper;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.argThat;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class CcdiProjectOverviewServiceAbnormalAccountTest {
|
||||
|
||||
@InjectMocks
|
||||
private CcdiProjectOverviewServiceImpl service;
|
||||
|
||||
@Mock
|
||||
private CcdiProjectOverviewMapper overviewMapper;
|
||||
|
||||
@Mock
|
||||
private CcdiProjectMapper projectMapper;
|
||||
|
||||
@Mock
|
||||
private CcdiProjectOverviewEmployeeResultMapper overviewEmployeeResultMapper;
|
||||
|
||||
@Mock
|
||||
private CcdiBankTagResultMapper bankTagResultMapper;
|
||||
|
||||
@Mock
|
||||
private CcdiProjectOverviewEmployeeResultBuilder overviewEmployeeResultBuilder;
|
||||
|
||||
@Mock
|
||||
private CcdiProjectRiskDetailWorkbookExporter workbookExporter;
|
||||
|
||||
@Test
|
||||
void shouldMapAbnormalAccountPageRowsAndTotal() {
|
||||
mockProjectExists(40L);
|
||||
|
||||
CcdiProjectAbnormalAccountQueryDTO queryDTO = new CcdiProjectAbnormalAccountQueryDTO();
|
||||
queryDTO.setProjectId(40L);
|
||||
queryDTO.setPageNum(1);
|
||||
queryDTO.setPageSize(5);
|
||||
|
||||
CcdiProjectAbnormalAccountItemVO item = new CcdiProjectAbnormalAccountItemVO();
|
||||
item.setAccountNo("6222000000000001");
|
||||
item.setAccountName("李四");
|
||||
item.setBankName("中国农业银行");
|
||||
item.setAbnormalType("突然销户");
|
||||
item.setAbnormalTime("2026-03-20");
|
||||
item.setStatus("已销户");
|
||||
|
||||
Page<CcdiProjectAbnormalAccountItemVO> resultPage = new Page<>(1, 5);
|
||||
resultPage.setRecords(List.of(item));
|
||||
resultPage.setTotal(1L);
|
||||
when(overviewMapper.selectAbnormalAccountPage(any(Page.class), any(CcdiProjectAbnormalAccountQueryDTO.class)))
|
||||
.thenReturn(resultPage);
|
||||
|
||||
CcdiProjectAbnormalAccountPageVO result = service.getAbnormalAccountPeople(queryDTO);
|
||||
|
||||
assertEquals(1, result.getRows().size());
|
||||
assertEquals(1L, result.getTotal());
|
||||
assertEquals("6222000000000001", result.getRows().getFirst().getAccountNo());
|
||||
assertEquals("突然销户", result.getRows().getFirst().getAbnormalType());
|
||||
verify(overviewMapper).selectAbnormalAccountPage(
|
||||
argThat(page -> page.getCurrent() == 1L && page.getSize() == 5L),
|
||||
argThat(query -> query.getProjectId().equals(40L))
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldDefaultAbnormalAccountPageNumAndPageSizeToOneAndFive() {
|
||||
mockProjectExists(40L);
|
||||
|
||||
Page<CcdiProjectAbnormalAccountItemVO> emptyPage = new Page<>(1, 5);
|
||||
emptyPage.setRecords(List.of());
|
||||
emptyPage.setTotal(0L);
|
||||
when(overviewMapper.selectAbnormalAccountPage(any(Page.class), any(CcdiProjectAbnormalAccountQueryDTO.class)))
|
||||
.thenReturn(emptyPage);
|
||||
|
||||
CcdiProjectAbnormalAccountQueryDTO queryDTO = new CcdiProjectAbnormalAccountQueryDTO();
|
||||
queryDTO.setProjectId(40L);
|
||||
service.getAbnormalAccountPeople(queryDTO);
|
||||
|
||||
verify(overviewMapper).selectAbnormalAccountPage(
|
||||
argThat(page -> page.getCurrent() == 1L && page.getSize() == 5L),
|
||||
any(CcdiProjectAbnormalAccountQueryDTO.class)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldExportAbnormalAccountPeopleRows() {
|
||||
mockProjectExists(40L);
|
||||
|
||||
CcdiProjectAbnormalAccountItemVO item = new CcdiProjectAbnormalAccountItemVO();
|
||||
item.setAccountNo("6222000000000002");
|
||||
item.setAccountName("王五");
|
||||
item.setBankName("中国银行");
|
||||
item.setAbnormalType("休眠账户大额启用");
|
||||
item.setAbnormalTime("2025-08-01");
|
||||
item.setStatus("正常");
|
||||
when(overviewMapper.selectAbnormalAccountList(40L)).thenReturn(List.of(item));
|
||||
|
||||
List<CcdiProjectAbnormalAccountExcel> rows = service.exportAbnormalAccountPeople(40L);
|
||||
|
||||
assertEquals(1, rows.size());
|
||||
assertEquals("6222000000000002", rows.getFirst().getAccountNo());
|
||||
assertEquals("王五", rows.getFirst().getAccountName());
|
||||
assertEquals("中国银行", rows.getFirst().getBankName());
|
||||
assertEquals("休眠账户大额启用", rows.getFirst().getAbnormalType());
|
||||
assertEquals("2025-08-01", rows.getFirst().getAbnormalTime());
|
||||
assertEquals("正常", rows.getFirst().getStatus());
|
||||
verify(overviewMapper).selectAbnormalAccountList(40L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldThrowWhenProjectDoesNotExistForAbnormalAccountQueries() {
|
||||
when(projectMapper.selectById(99L)).thenReturn(null);
|
||||
|
||||
CcdiProjectAbnormalAccountQueryDTO queryDTO = new CcdiProjectAbnormalAccountQueryDTO();
|
||||
queryDTO.setProjectId(99L);
|
||||
|
||||
assertThrows(ServiceException.class, () -> service.getAbnormalAccountPeople(queryDTO));
|
||||
assertThrows(ServiceException.class, () -> service.exportAbnormalAccountPeople(99L));
|
||||
}
|
||||
|
||||
private void mockProjectExists(Long projectId) {
|
||||
CcdiProject project = new CcdiProject();
|
||||
project.setProjectId(projectId);
|
||||
when(projectMapper.selectById(projectId)).thenReturn(project);
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,12 @@ import com.ruoyi.ccdi.project.domain.CcdiProject;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectPersonAnalysisDetailQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectRiskPeopleQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectRiskModelPeopleQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectAbnormalAccountExcel;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectEmployeeCreditNegativeExcel;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectRiskPeopleOverviewExcel;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectSuspiciousTransactionExcel;
|
||||
import com.ruoyi.ccdi.project.domain.entity.CcdiProjectOverviewEmployeeResult;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectAbnormalAccountItemVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectEmployeeCreditNegativeItemVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiBankStatementListVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectEmployeeRiskAggregateVO;
|
||||
@@ -268,6 +270,15 @@ class CcdiProjectOverviewServiceImplTest {
|
||||
creditItem.setCivilLmt(new BigDecimal("20000.00"));
|
||||
when(overviewMapper.selectEmployeeCreditNegativeList(40L)).thenReturn(List.of(creditItem));
|
||||
|
||||
CcdiProjectAbnormalAccountItemVO abnormalItem = new CcdiProjectAbnormalAccountItemVO();
|
||||
abnormalItem.setAccountNo("6222000000000001");
|
||||
abnormalItem.setAccountName("李四");
|
||||
abnormalItem.setBankName("中国农业银行");
|
||||
abnormalItem.setAbnormalType("突然销户");
|
||||
abnormalItem.setAbnormalTime("2026-03-20");
|
||||
abnormalItem.setStatus("已销户");
|
||||
when(overviewMapper.selectAbnormalAccountList(40L)).thenReturn(List.of(abnormalItem));
|
||||
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
service.exportRiskDetails(response, 40L);
|
||||
|
||||
@@ -282,6 +293,9 @@ class CcdiProjectOverviewServiceImplTest {
|
||||
),
|
||||
argThat((List<CcdiProjectEmployeeCreditNegativeExcel> rows) ->
|
||||
rows.size() == 1 && "李四".equals(rows.getFirst().getPersonName())
|
||||
),
|
||||
argThat((List<CcdiProjectAbnormalAccountExcel> rows) ->
|
||||
rows.size() == 1 && "6222000000000001".equals(rows.getFirst().getAccountNo())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.ccdi.project.service.impl;
|
||||
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectAbnormalAccountExcel;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectEmployeeCreditNegativeExcel;
|
||||
import com.ruoyi.ccdi.project.domain.excel.CcdiProjectSuspiciousTransactionExcel;
|
||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||
@@ -36,7 +37,15 @@ class CcdiProjectRiskDetailWorkbookExporterTest {
|
||||
creditRow.setCivilCnt(1);
|
||||
creditRow.setCivilLmt(new BigDecimal("20000.00"));
|
||||
|
||||
exporter.export(response, 40L, List.of(suspiciousRow), List.of(creditRow));
|
||||
CcdiProjectAbnormalAccountExcel abnormalRow = new CcdiProjectAbnormalAccountExcel();
|
||||
abnormalRow.setAccountNo("6222000000000001");
|
||||
abnormalRow.setAccountName("李四");
|
||||
abnormalRow.setBankName("中国农业银行");
|
||||
abnormalRow.setAbnormalType("突然销户");
|
||||
abnormalRow.setAbnormalTime("2026-03-20");
|
||||
abnormalRow.setStatus("已销户");
|
||||
|
||||
exporter.export(response, 40L, List.of(suspiciousRow), List.of(creditRow), List.of(abnormalRow));
|
||||
|
||||
assertTrue(response.getContentType().startsWith(
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
@@ -48,8 +57,18 @@ class CcdiProjectRiskDetailWorkbookExporterTest {
|
||||
assertEquals("员工负面征信信息", workbook.getSheetAt(1).getSheetName());
|
||||
assertEquals("异常账户人员信息", workbook.getSheetAt(2).getSheetName());
|
||||
assertEquals("账号", workbook.getSheetAt(2).getRow(0).getCell(0).getStringCellValue());
|
||||
assertEquals("开户人", workbook.getSheetAt(2).getRow(0).getCell(1).getStringCellValue());
|
||||
assertEquals("银行", workbook.getSheetAt(2).getRow(0).getCell(2).getStringCellValue());
|
||||
assertEquals("异常类型", workbook.getSheetAt(2).getRow(0).getCell(3).getStringCellValue());
|
||||
assertEquals("异常发生时间", workbook.getSheetAt(2).getRow(0).getCell(4).getStringCellValue());
|
||||
assertEquals("状态", workbook.getSheetAt(2).getRow(0).getCell(5).getStringCellValue());
|
||||
assertEquals(1, workbook.getSheetAt(2).getPhysicalNumberOfRows());
|
||||
assertEquals("6222000000000001", workbook.getSheetAt(2).getRow(1).getCell(0).getStringCellValue());
|
||||
assertEquals("李四", workbook.getSheetAt(2).getRow(1).getCell(1).getStringCellValue());
|
||||
assertEquals("中国农业银行", workbook.getSheetAt(2).getRow(1).getCell(2).getStringCellValue());
|
||||
assertEquals("突然销户", workbook.getSheetAt(2).getRow(1).getCell(3).getStringCellValue());
|
||||
assertEquals("2026-03-20", workbook.getSheetAt(2).getRow(1).getCell(4).getStringCellValue());
|
||||
assertEquals("已销户", workbook.getSheetAt(2).getRow(1).getCell(5).getStringCellValue());
|
||||
assertEquals(2, workbook.getSheetAt(2).getPhysicalNumberOfRows());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.ruoyi.ccdi.project.sql;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertAll;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class CcdiAbnormalAccountRuleSqlMetadataTest {
|
||||
|
||||
@Test
|
||||
void abnormalAccountMetadataSql_shouldContainModelAndRuleDefinitions() throws IOException {
|
||||
Path path = Path.of("..", "sql", "migration",
|
||||
"2026-03-31-create-ccdi-account-info-and-abnormal-account-rules.sql");
|
||||
|
||||
assertTrue(Files.exists(path), "异常账户模型迁移脚本应存在");
|
||||
|
||||
String sql = Files.readString(path, StandardCharsets.UTF_8);
|
||||
assertAll(
|
||||
() -> assertTrue(sql.contains("ABNORMAL_ACCOUNT")),
|
||||
() -> assertTrue(sql.contains("SUDDEN_ACCOUNT_CLOSURE")),
|
||||
() -> assertTrue(sql.contains("DORMANT_ACCOUNT_LARGE_ACTIVATION")),
|
||||
() -> assertTrue(sql.contains("'OBJECT'"))
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void abnormalAccountMetadataSql_shouldContainAccountInfoTableDefinition() throws IOException {
|
||||
Path path = Path.of("..", "sql", "migration",
|
||||
"2026-03-31-create-ccdi-account-info-and-abnormal-account-rules.sql");
|
||||
|
||||
assertTrue(Files.exists(path), "异常账户模型迁移脚本应存在");
|
||||
|
||||
String sql = Files.readString(path, StandardCharsets.UTF_8).toLowerCase();
|
||||
assertAll(
|
||||
() -> assertTrue(sql.contains("create table if not exists `ccdi_account_info`")),
|
||||
() -> assertTrue(sql.contains("`account_no`")),
|
||||
() -> assertTrue(sql.contains("`owner_type`")),
|
||||
() -> assertTrue(sql.contains("`effective_date`")),
|
||||
() -> assertTrue(sql.contains("`invalid_date`"))
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.ruoyi.ccdi.project.sql;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertAll;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class CcdiAccountInfoMergeSqlTest {
|
||||
|
||||
@Test
|
||||
void accountInfoMergeSql_shouldAddColumnsMigrateDataAndDropLegacyTable() throws IOException {
|
||||
Path path = Path.of("..", "sql", "migration",
|
||||
"2026-04-16-merge-ccdi-account-result-into-info.sql");
|
||||
|
||||
assertTrue(Files.exists(path), "账户库合表迁移脚本应存在");
|
||||
|
||||
String sql = Files.readString(path, StandardCharsets.UTF_8).toLowerCase();
|
||||
assertAll(
|
||||
() -> assertTrue(sql.contains("bin/mysql_utf8_exec.sh")),
|
||||
() -> assertTrue(sql.contains("ccdi_account_info")),
|
||||
() -> assertTrue(sql.contains("add column `is_self_account`")),
|
||||
() -> assertTrue(sql.contains("monthly_avg_trans_count")),
|
||||
() -> assertTrue(sql.contains("update `ccdi_account_info` ai")),
|
||||
() -> assertTrue(sql.contains("join `ccdi_account_result` ar")),
|
||||
() -> assertTrue(sql.contains("drop table `ccdi_account_result`"))
|
||||
);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user