feat(controller): 新增企业ID批量更新功能
- 在BatchImportSupport中添加CompanyIdRefreshStats统计类 - 实现基于企业名称匹配的companyId批量更新逻辑 - 添加normalizeCompanyName和addCompanyNameMapping辅助方法 - 在各个Credit控制器中注入CreditCompanyService依赖 - 为所有相关控制器添加/company-id/refresh接口端点 - 实现多租户环境下的安全匹配和更新机制 - 支持limit参数控制批量处理数量 - 提供详细的更新统计数据返回
This commit is contained in:
118
cn/afterturn/easypoi/excel/entity/ImportParams.java
Normal file
118
cn/afterturn/easypoi/excel/entity/ImportParams.java
Normal file
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* Copyright 2013-2015 JueYue (qrb.jueyue@gmail.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package cn.afterturn.easypoi.excel.entity;
|
||||
|
||||
import cn.afterturn.easypoi.handler.inter.IExcelVerifyHandler;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 导入参数设置
|
||||
*
|
||||
* @author JueYue
|
||||
* 2013-9-24
|
||||
* @version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class ImportParams extends ExcelBaseParams {
|
||||
|
||||
public static final String SAVE_URL = "/excel/upload/excelUpload";
|
||||
|
||||
/**
|
||||
* 表格标题行数,默认0
|
||||
*/
|
||||
private int titleRows = 0;
|
||||
/**
|
||||
* 表头行数,默认1
|
||||
*/
|
||||
private int headRows = 1;
|
||||
/**
|
||||
* 字段真正值和列标题之间的距离 默认0
|
||||
*/
|
||||
private int startRows = 0;
|
||||
|
||||
/**
|
||||
* 主键设置,如何这个cell没有值,就跳过 或者认为这个是list的下面的值
|
||||
* 大家不理解,去掉这个
|
||||
*/
|
||||
|
||||
private Integer keyIndex = null;
|
||||
/**
|
||||
* 开始读取的sheet位置,默认为0
|
||||
*/
|
||||
private int startSheetIndex = 0;
|
||||
/**
|
||||
* 上传表格需要读取的sheet 数量,默认为1
|
||||
*/
|
||||
private int sheetNum = 1;
|
||||
/**
|
||||
* 是否需要保存上传的Excel,默认为false
|
||||
*/
|
||||
private boolean needSave = false;
|
||||
/**
|
||||
* 校验组
|
||||
*/
|
||||
private Class[] verifyGroup = null;
|
||||
/**
|
||||
* 是否需要校验上传的Excel,默认为false
|
||||
*/
|
||||
private boolean needVerify = false;
|
||||
/**
|
||||
* 返回文件是否分割,默认是分割
|
||||
*/
|
||||
private boolean verifyFileSplit = true;
|
||||
/**
|
||||
* 校验处理接口
|
||||
*/
|
||||
private IExcelVerifyHandler verifyHandler;
|
||||
/**
|
||||
* 保存上传的Excel目录,默认是 如 TestEntity这个类保存路径就是
|
||||
* upload/excelUpload/Test/yyyyMMddHHmss_***** 保存名称上传时间_五位随机数
|
||||
*/
|
||||
private String saveUrl = SAVE_URL;
|
||||
/**
|
||||
* 最后的无效行数
|
||||
*/
|
||||
private int lastOfInvalidRow = 0;
|
||||
/**
|
||||
* 手动控制读取的行数
|
||||
*/
|
||||
private int readRows = 0;
|
||||
/**
|
||||
* 导入时校验数据模板,是不是正确的Excel
|
||||
*/
|
||||
private String[] importFields;
|
||||
/**
|
||||
* 导入时校验excel的标题列顺序。依赖于importFields的配置顺序
|
||||
*/
|
||||
private boolean needCheckOrder = false;
|
||||
/**
|
||||
* Key-Value 读取标记,以这个为Key,后面一个Cell 为Value,多个改为ArrayList
|
||||
*/
|
||||
private String keyMark = ":";
|
||||
/**
|
||||
* 按照Key-Value 规则读取全局扫描Excel,但是跳过List读取范围提升性能
|
||||
* 仅仅支持titleRows + headRows + startRows 以及 lastOfInvalidRow
|
||||
*/
|
||||
private boolean readSingleCell = false;
|
||||
/**
|
||||
* 是否并行计算
|
||||
*/
|
||||
private boolean concurrentTask = false;
|
||||
/**
|
||||
* 最小截取大小
|
||||
*/
|
||||
private Integer critical = 1000;
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package com.gxwebsoft.credit.controller;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.credit.entity.CreditCompany;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
@@ -11,6 +13,8 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
@@ -39,6 +43,194 @@ public class BatchImportSupport {
|
||||
return requiresNewTx.execute(status -> supplier.get());
|
||||
}
|
||||
|
||||
public static final class CompanyIdRefreshStats {
|
||||
public final boolean anyDataRead;
|
||||
public final int updated;
|
||||
public final int matched;
|
||||
public final int notFound;
|
||||
public final int ambiguous;
|
||||
|
||||
private CompanyIdRefreshStats(boolean anyDataRead, int updated, int matched, int notFound, int ambiguous) {
|
||||
this.anyDataRead = anyDataRead;
|
||||
this.updated = updated;
|
||||
this.matched = matched;
|
||||
this.notFound = notFound;
|
||||
this.ambiguous = ambiguous;
|
||||
}
|
||||
|
||||
public Map<String, Object> toMap() {
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("updated", updated);
|
||||
result.put("matched", matched);
|
||||
result.put("notFound", notFound);
|
||||
result.put("ambiguous", ambiguous);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按企业名称匹配 CreditCompany(name / matchName) 并回填 companyId。
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录(onlyNull=true);onlyNull=false 时会覆盖更新(仅当 companyId 不同)。</p>
|
||||
*
|
||||
* <p>注意:为避免跨租户误更新,当 currentTenantId 为空时会按记录自身 tenantId 维度匹配,
|
||||
* tenantId 为空的记录将被跳过并计入 notFound。</p>
|
||||
*/
|
||||
public <T> CompanyIdRefreshStats refreshCompanyIdByCompanyName(IService<T> service,
|
||||
CreditCompanyService creditCompanyService,
|
||||
Integer currentTenantId,
|
||||
Boolean onlyNull,
|
||||
Integer limit,
|
||||
SFunction<T, Integer> idGetter,
|
||||
BiConsumer<T, Integer> idSetter,
|
||||
SFunction<T, String> nameGetter,
|
||||
SFunction<T, Integer> companyIdGetter,
|
||||
BiConsumer<T, Integer> companyIdSetter,
|
||||
SFunction<T, Integer> tenantIdGetter,
|
||||
Supplier<T> patchFactory) {
|
||||
boolean onlyNullFlag = (onlyNull == null) || Boolean.TRUE.equals(onlyNull);
|
||||
|
||||
// 1) 读取待处理数据(仅取必要字段,避免一次性拉全表字段)
|
||||
var query = service.lambdaQuery()
|
||||
.select(idGetter, nameGetter, companyIdGetter, tenantIdGetter)
|
||||
.eq(currentTenantId != null, tenantIdGetter, currentTenantId)
|
||||
.isNotNull(nameGetter);
|
||||
if (onlyNullFlag) {
|
||||
query.eq(companyIdGetter, 0);
|
||||
}
|
||||
if (limit != null && limit > 0) {
|
||||
query.last("limit " + Math.min(limit, 200000));
|
||||
}
|
||||
List<T> rows = query.list();
|
||||
|
||||
if (CollectionUtils.isEmpty(rows)) {
|
||||
return new CompanyIdRefreshStats(false, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
// 2) 按租户维度匹配(避免管理员/跨租户场景误匹配)
|
||||
Map<Integer, List<T>> rowsByTenant = new LinkedHashMap<>();
|
||||
int missingTenant = 0;
|
||||
for (T row : rows) {
|
||||
if (row == null) {
|
||||
continue;
|
||||
}
|
||||
Integer tenantId = currentTenantId != null ? currentTenantId : tenantIdGetter.apply(row);
|
||||
if (tenantId == null) {
|
||||
// 未知租户下不做跨租户匹配,避免误更新
|
||||
missingTenant++;
|
||||
continue;
|
||||
}
|
||||
rowsByTenant.computeIfAbsent(tenantId, k -> new ArrayList<>()).add(row);
|
||||
}
|
||||
|
||||
// 3) 批量更新 companyId
|
||||
int updated = 0;
|
||||
int matched = 0;
|
||||
int notFound = 0;
|
||||
int ambiguous = 0;
|
||||
final int batchSize = 500;
|
||||
List<T> updates = new ArrayList<>(batchSize);
|
||||
|
||||
final int inChunkSize = 900;
|
||||
for (Map.Entry<Integer, List<T>> entry : rowsByTenant.entrySet()) {
|
||||
Integer tenantId = entry.getKey();
|
||||
List<T> tenantRows = entry.getValue();
|
||||
if (tenantId == null || CollectionUtils.isEmpty(tenantRows)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 3.1) 查询当前租户下的 companyId 映射
|
||||
LinkedHashMap<String, Integer> companyIdByName = new LinkedHashMap<>();
|
||||
LinkedHashMap<String, Integer> ambiguousByName = new LinkedHashMap<>();
|
||||
LinkedHashSet<String> nameSet = new LinkedHashSet<>();
|
||||
for (T row : tenantRows) {
|
||||
String name = normalizeCompanyName(row != null ? nameGetter.apply(row) : null);
|
||||
if (name != null) {
|
||||
nameSet.add(name);
|
||||
}
|
||||
}
|
||||
List<String> allNames = new ArrayList<>(nameSet);
|
||||
for (int i = 0; i < allNames.size(); i += inChunkSize) {
|
||||
List<String> chunk = allNames.subList(i, Math.min(allNames.size(), i + inChunkSize));
|
||||
if (CollectionUtils.isEmpty(chunk)) {
|
||||
continue;
|
||||
}
|
||||
List<CreditCompany> companies = creditCompanyService.lambdaQuery()
|
||||
.select(CreditCompany::getId, CreditCompany::getName, CreditCompany::getMatchName, CreditCompany::getTenantId)
|
||||
.eq(CreditCompany::getTenantId, tenantId)
|
||||
.and(w -> w.in(CreditCompany::getName, chunk).or().in(CreditCompany::getMatchName, chunk))
|
||||
.list();
|
||||
|
||||
for (CreditCompany c : companies) {
|
||||
if (c == null || c.getId() == null) {
|
||||
continue;
|
||||
}
|
||||
addCompanyNameMapping(companyIdByName, ambiguousByName, normalizeCompanyName(c.getName()), c.getId());
|
||||
addCompanyNameMapping(companyIdByName, ambiguousByName, normalizeCompanyName(c.getMatchName()), c.getId());
|
||||
}
|
||||
}
|
||||
|
||||
// 3.2) 更新当前租户下的数据 companyId
|
||||
for (T row : tenantRows) {
|
||||
String key = normalizeCompanyName(row != null ? nameGetter.apply(row) : null);
|
||||
if (key == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Integer amb = ambiguousByName.get(key);
|
||||
if (amb != null && amb > 0) {
|
||||
ambiguous++;
|
||||
continue;
|
||||
}
|
||||
|
||||
Integer companyId = companyIdByName.get(key);
|
||||
if (companyId == null) {
|
||||
notFound++;
|
||||
continue;
|
||||
}
|
||||
matched++;
|
||||
|
||||
Integer oldCompanyId = row != null ? companyIdGetter.apply(row) : null;
|
||||
boolean needUpdate;
|
||||
if (onlyNullFlag) {
|
||||
needUpdate = oldCompanyId != null && oldCompanyId == 0;
|
||||
} else {
|
||||
needUpdate = oldCompanyId == null || !companyId.equals(oldCompanyId);
|
||||
}
|
||||
if (!needUpdate) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Integer id = row != null ? idGetter.apply(row) : null;
|
||||
if (id == null) {
|
||||
continue;
|
||||
}
|
||||
T patch = patchFactory.get();
|
||||
idSetter.accept(patch, id);
|
||||
companyIdSetter.accept(patch, companyId);
|
||||
updates.add(patch);
|
||||
if (updates.size() >= batchSize) {
|
||||
List<T> batch = new ArrayList<>(updates);
|
||||
updates.clear();
|
||||
updated += runInNewTx(() -> service.updateBatchById(batch, batchSize) ? batch.size() : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// currentTenantId 为空时,租户缺失的数据不做匹配更新,避免误更新
|
||||
if (currentTenantId == null && missingTenant > 0) {
|
||||
notFound += missingTenant;
|
||||
}
|
||||
|
||||
if (!updates.isEmpty()) {
|
||||
List<T> batch = new ArrayList<>(updates);
|
||||
updates.clear();
|
||||
updated += runInNewTx(() -> service.updateBatchById(batch, batchSize) ? batch.size() : 0);
|
||||
}
|
||||
|
||||
return new CompanyIdRefreshStats(true, updated, matched, notFound, ambiguous);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量 upsert:优先按 code 匹配;code 为空时按 name 匹配。
|
||||
*/
|
||||
@@ -462,6 +654,32 @@ public class BatchImportSupport {
|
||||
return trimmed.isEmpty() ? null : trimmed;
|
||||
}
|
||||
|
||||
private static String normalizeCompanyName(String name) {
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
// 兼容 Excel/网页复制带来的全角空格
|
||||
String v = name.replace(' ', ' ').trim();
|
||||
return v.isEmpty() ? null : v;
|
||||
}
|
||||
|
||||
private static void addCompanyNameMapping(Map<String, Integer> idByName,
|
||||
Map<String, Integer> ambiguousByName,
|
||||
String key,
|
||||
Integer companyId) {
|
||||
if (key == null || companyId == null) {
|
||||
return;
|
||||
}
|
||||
Integer existing = idByName.get(key);
|
||||
if (existing == null) {
|
||||
idByName.put(key, companyId);
|
||||
return;
|
||||
}
|
||||
if (!existing.equals(companyId)) {
|
||||
ambiguousByName.put(key, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> Integer extractId(T entity, SFunction<T, Integer> idColumn) {
|
||||
// SFunction 是 getter method ref,直接调用即可
|
||||
return idColumn.apply(entity);
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditAdministrativeLicense;
|
||||
import com.gxwebsoft.credit.param.CreditAdministrativeLicenseImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditAdministrativeLicenseParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditAdministrativeLicenseService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -42,6 +43,9 @@ public class CreditAdministrativeLicenseController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询行政许可")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditAdministrativeLicense>> page(CreditAdministrativeLicenseParam param) {
|
||||
@@ -134,6 +138,43 @@ public class CreditAdministrativeLicenseController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditAdministrativeLicenseService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditAdministrativeLicense::getId,
|
||||
CreditAdministrativeLicense::setId,
|
||||
CreditAdministrativeLicense::getName,
|
||||
CreditAdministrativeLicense::getCompanyId,
|
||||
CreditAdministrativeLicense::setCompanyId,
|
||||
CreditAdministrativeLicense::getTenantId,
|
||||
CreditAdministrativeLicense::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入行政许可
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditBankruptcy;
|
||||
import com.gxwebsoft.credit.param.CreditBankruptcyImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditBankruptcyParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditBankruptcyService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -42,6 +43,9 @@ public class CreditBankruptcyController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询破产重整")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditBankruptcy>> page(CreditBankruptcyParam param) {
|
||||
@@ -134,6 +138,43 @@ public class CreditBankruptcyController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditBankruptcy:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditBankruptcyService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditBankruptcy::getId,
|
||||
CreditBankruptcy::setId,
|
||||
CreditBankruptcy::getParty,
|
||||
CreditBankruptcy::getCompanyId,
|
||||
CreditBankruptcy::setCompanyId,
|
||||
CreditBankruptcy::getTenantId,
|
||||
CreditBankruptcy::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入破产重整
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditBranch;
|
||||
import com.gxwebsoft.credit.param.CreditBranchImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditBranchParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditBranchService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -41,6 +42,9 @@ public class CreditBranchController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询分支机构")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditBranch>> page(CreditBranchParam param) {
|
||||
@@ -133,6 +137,43 @@ public class CreditBranchController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditBranch:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditBranchService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditBranch::getId,
|
||||
CreditBranch::setId,
|
||||
CreditBranch::getName,
|
||||
CreditBranch::getCompanyId,
|
||||
CreditBranch::setCompanyId,
|
||||
CreditBranch::getTenantId,
|
||||
CreditBranch::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入分支机构
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditBreachOfTrust;
|
||||
import com.gxwebsoft.credit.param.CreditBreachOfTrustImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditBreachOfTrustParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditBreachOfTrustService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -43,6 +44,9 @@ public class CreditBreachOfTrustController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询失信被执行人")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditBreachOfTrust>> page(CreditBreachOfTrustParam param) {
|
||||
@@ -130,6 +134,43 @@ public class CreditBreachOfTrustController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditBreachOfTrust:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditBreachOfTrustService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditBreachOfTrust::getId,
|
||||
CreditBreachOfTrust::setId,
|
||||
CreditBreachOfTrust::getPlaintiffAppellant,
|
||||
CreditBreachOfTrust::getCompanyId,
|
||||
CreditBreachOfTrust::setCompanyId,
|
||||
CreditBreachOfTrust::getTenantId,
|
||||
CreditBreachOfTrust::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入失信被执行人
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditCaseFiling;
|
||||
import com.gxwebsoft.credit.param.CreditCaseFilingImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditCaseFilingParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditCaseFilingService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -41,6 +42,9 @@ public class CreditCaseFilingController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询司法大数据")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditCaseFiling>> page(CreditCaseFilingParam param) {
|
||||
@@ -133,6 +137,43 @@ public class CreditCaseFilingController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditCaseFiling:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditCaseFilingService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditCaseFiling::getId,
|
||||
CreditCaseFiling::setId,
|
||||
CreditCaseFiling::getAppellee,
|
||||
CreditCaseFiling::getCompanyId,
|
||||
CreditCaseFiling::setCompanyId,
|
||||
CreditCaseFiling::getTenantId,
|
||||
CreditCaseFiling::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入立案信息
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditCompetitor;
|
||||
import com.gxwebsoft.credit.param.CreditCompetitorImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditCompetitorParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditCompetitorService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -41,6 +42,9 @@ public class CreditCompetitorController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询竞争对手")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditCompetitor>> page(CreditCompetitorParam param) {
|
||||
@@ -133,6 +137,43 @@ public class CreditCompetitorController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditCompetitor:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditCompetitorService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditCompetitor::getId,
|
||||
CreditCompetitor::setId,
|
||||
CreditCompetitor::getName,
|
||||
CreditCompetitor::getCompanyId,
|
||||
CreditCompetitor::setCompanyId,
|
||||
CreditCompetitor::getTenantId,
|
||||
CreditCompetitor::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入竞争对手
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditCourtAnnouncement;
|
||||
import com.gxwebsoft.credit.param.CreditCourtAnnouncementImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditCourtAnnouncementParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditCourtAnnouncementService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -41,6 +42,9 @@ public class CreditCourtAnnouncementController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询法院公告司法大数据")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditCourtAnnouncement>> page(CreditCourtAnnouncementParam param) {
|
||||
@@ -133,6 +137,43 @@ public class CreditCourtAnnouncementController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditCourtAnnouncementService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditCourtAnnouncement::getId,
|
||||
CreditCourtAnnouncement::setId,
|
||||
CreditCourtAnnouncement::getAppellee,
|
||||
CreditCourtAnnouncement::getCompanyId,
|
||||
CreditCourtAnnouncement::setCompanyId,
|
||||
CreditCourtAnnouncement::getTenantId,
|
||||
CreditCourtAnnouncement::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入法院公告司法大数据
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditCourtSession;
|
||||
import com.gxwebsoft.credit.param.CreditCourtSessionImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditCourtSessionParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditCourtSessionService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -42,6 +43,9 @@ public class CreditCourtSessionController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询开庭公告司法大数据")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditCourtSession>> page(CreditCourtSessionParam param) {
|
||||
@@ -134,6 +138,43 @@ public class CreditCourtSessionController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditCourtSession:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditCourtSessionService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditCourtSession::getId,
|
||||
CreditCourtSession::setId,
|
||||
CreditCourtSession::getAppellee,
|
||||
CreditCourtSession::getCompanyId,
|
||||
CreditCourtSession::setCompanyId,
|
||||
CreditCourtSession::getTenantId,
|
||||
CreditCourtSession::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入开庭公告司法大数据
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditCustomer;
|
||||
import com.gxwebsoft.credit.param.CreditCustomerImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditCustomerParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditCustomerService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -42,6 +43,9 @@ public class CreditCustomerController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询客户")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditCustomer>> page(CreditCustomerParam param) {
|
||||
@@ -129,6 +133,43 @@ public class CreditCustomerController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditCustomer:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditCustomerService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditCustomer::getId,
|
||||
CreditCustomer::setId,
|
||||
CreditCustomer::getName,
|
||||
CreditCustomer::getCompanyId,
|
||||
CreditCustomer::setCompanyId,
|
||||
CreditCustomer::getTenantId,
|
||||
CreditCustomer::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入客户
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditDeliveryNotice;
|
||||
import com.gxwebsoft.credit.param.CreditDeliveryNoticeImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditDeliveryNoticeParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditDeliveryNoticeService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -41,6 +42,9 @@ public class CreditDeliveryNoticeController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询送达公告司法大数据")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditDeliveryNotice>> page(CreditDeliveryNoticeParam param) {
|
||||
@@ -133,6 +137,43 @@ public class CreditDeliveryNoticeController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditDeliveryNotice:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditDeliveryNoticeService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditDeliveryNotice::getId,
|
||||
CreditDeliveryNotice::setId,
|
||||
CreditDeliveryNotice::getOtherPartiesThirdParty,
|
||||
CreditDeliveryNotice::getCompanyId,
|
||||
CreditDeliveryNotice::setCompanyId,
|
||||
CreditDeliveryNotice::getTenantId,
|
||||
CreditDeliveryNotice::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入送达公告司法大数据
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditExternal;
|
||||
import com.gxwebsoft.credit.param.CreditExternalImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditExternalParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditExternalService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -41,6 +42,9 @@ public class CreditExternalController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询对外投资")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditExternal>> page(CreditExternalParam param) {
|
||||
@@ -133,6 +137,43 @@ public class CreditExternalController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditExternal:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditExternalService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditExternal::getId,
|
||||
CreditExternal::setId,
|
||||
CreditExternal::getName,
|
||||
CreditExternal::getCompanyId,
|
||||
CreditExternal::setCompanyId,
|
||||
CreditExternal::getTenantId,
|
||||
CreditExternal::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入对外投资
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditFinalVersion;
|
||||
import com.gxwebsoft.credit.param.CreditFinalVersionImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditFinalVersionParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditFinalVersionService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -42,6 +43,9 @@ public class CreditFinalVersionController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询终本案件")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditFinalVersion>> page(CreditFinalVersionParam param) {
|
||||
@@ -134,6 +138,43 @@ public class CreditFinalVersionController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditFinalVersion:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditFinalVersionService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditFinalVersion::getId,
|
||||
CreditFinalVersion::setId,
|
||||
CreditFinalVersion::getAppellee,
|
||||
CreditFinalVersion::getCompanyId,
|
||||
CreditFinalVersion::setCompanyId,
|
||||
CreditFinalVersion::getTenantId,
|
||||
CreditFinalVersion::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入终本案件
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditGqdj;
|
||||
import com.gxwebsoft.credit.param.CreditGqdjImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditGqdjParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditGqdjService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -42,6 +43,9 @@ public class CreditGqdjController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询股权冻结")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditGqdj>> page(CreditGqdjParam param) {
|
||||
@@ -134,6 +138,43 @@ public class CreditGqdjController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditGqdj:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditGqdjService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditGqdj::getId,
|
||||
CreditGqdj::setId,
|
||||
CreditGqdj::getAppellee,
|
||||
CreditGqdj::getCompanyId,
|
||||
CreditGqdj::setCompanyId,
|
||||
CreditGqdj::getTenantId,
|
||||
CreditGqdj::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入股权冻结司法大数据
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditHistoricalLegalPerson;
|
||||
import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditHistoricalLegalPersonService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -41,6 +42,9 @@ public class CreditHistoricalLegalPersonController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询历史法定代表人")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditHistoricalLegalPerson>> page(CreditHistoricalLegalPersonParam param) {
|
||||
@@ -133,6 +137,43 @@ public class CreditHistoricalLegalPersonController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditHistoricalLegalPersonService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditHistoricalLegalPerson::getId,
|
||||
CreditHistoricalLegalPerson::setId,
|
||||
CreditHistoricalLegalPerson::getName,
|
||||
CreditHistoricalLegalPerson::getCompanyId,
|
||||
CreditHistoricalLegalPerson::setCompanyId,
|
||||
CreditHistoricalLegalPerson::getTenantId,
|
||||
CreditHistoricalLegalPerson::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入历史法定代表人
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditCompany;
|
||||
import com.gxwebsoft.credit.entity.CreditJudgmentDebtor;
|
||||
import com.gxwebsoft.credit.param.CreditJudgmentDebtorImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditJudgmentDebtorParam;
|
||||
@@ -164,153 +163,25 @@ public class CreditJudgmentDebtorController extends BaseController {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
// 1) 读取待处理数据(仅取必要字段,避免一次性拉全表字段)
|
||||
var debtorQuery = creditJudgmentDebtorService.lambdaQuery()
|
||||
.select(CreditJudgmentDebtor::getId, CreditJudgmentDebtor::getName, CreditJudgmentDebtor::getCompanyId, CreditJudgmentDebtor::getTenantId)
|
||||
.eq(currentTenantId != null, CreditJudgmentDebtor::getTenantId, currentTenantId)
|
||||
.isNotNull(CreditJudgmentDebtor::getName);
|
||||
if (Boolean.TRUE.equals(onlyNull)) {
|
||||
debtorQuery.eq(CreditJudgmentDebtor::getCompanyId, 0);
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditJudgmentDebtorService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditJudgmentDebtor::getId,
|
||||
CreditJudgmentDebtor::setId,
|
||||
CreditJudgmentDebtor::getName,
|
||||
CreditJudgmentDebtor::getCompanyId,
|
||||
CreditJudgmentDebtor::setCompanyId,
|
||||
CreditJudgmentDebtor::getTenantId,
|
||||
CreditJudgmentDebtor::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
if (limit != null && limit > 0) {
|
||||
debtorQuery.last("limit " + Math.min(limit, 200000));
|
||||
}
|
||||
List<CreditJudgmentDebtor> debtors = debtorQuery.list();
|
||||
|
||||
if (CollectionUtils.isEmpty(debtors)) {
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("updated", 0);
|
||||
result.put("matched", 0);
|
||||
result.put("notFound", 0);
|
||||
result.put("ambiguous", 0);
|
||||
return success("无可更新数据", result);
|
||||
}
|
||||
|
||||
// 2) 按租户维度匹配(避免管理员/跨租户场景误匹配)
|
||||
Map<Integer, List<CreditJudgmentDebtor>> debtorsByTenant = new LinkedHashMap<>();
|
||||
for (CreditJudgmentDebtor d : debtors) {
|
||||
if (d == null) {
|
||||
continue;
|
||||
}
|
||||
Integer tenantId = currentTenantId != null ? currentTenantId : d.getTenantId();
|
||||
if (tenantId == null) {
|
||||
// 未知租户下不做跨租户匹配,避免误更新
|
||||
continue;
|
||||
}
|
||||
debtorsByTenant.computeIfAbsent(tenantId, k -> new ArrayList<>()).add(d);
|
||||
}
|
||||
|
||||
// 3) 批量更新 companyId
|
||||
int updated = 0;
|
||||
int matched = 0;
|
||||
int notFound = 0;
|
||||
int ambiguous = 0;
|
||||
final int batchSize = 500;
|
||||
List<CreditJudgmentDebtor> updates = new ArrayList<>(batchSize);
|
||||
|
||||
final int inChunkSize = 900;
|
||||
for (Map.Entry<Integer, List<CreditJudgmentDebtor>> entry : debtorsByTenant.entrySet()) {
|
||||
Integer tenantId = entry.getKey();
|
||||
List<CreditJudgmentDebtor> tenantDebtors = entry.getValue();
|
||||
if (tenantId == null || CollectionUtils.isEmpty(tenantDebtors)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 3.1) 查询当前租户下的 companyId 映射
|
||||
LinkedHashMap<String, Integer> companyIdByName = new LinkedHashMap<>();
|
||||
LinkedHashMap<String, Integer> ambiguousByName = new LinkedHashMap<>();
|
||||
java.util.LinkedHashSet<String> nameSet = new java.util.LinkedHashSet<>();
|
||||
for (CreditJudgmentDebtor d : tenantDebtors) {
|
||||
String name = normalizeCompanyName(d != null ? d.getName() : null);
|
||||
if (name != null) {
|
||||
nameSet.add(name);
|
||||
}
|
||||
}
|
||||
List<String> allNames = new ArrayList<>(nameSet);
|
||||
for (int i = 0; i < allNames.size(); i += inChunkSize) {
|
||||
List<String> chunk = allNames.subList(i, Math.min(allNames.size(), i + inChunkSize));
|
||||
if (CollectionUtils.isEmpty(chunk)) {
|
||||
continue;
|
||||
}
|
||||
List<CreditCompany> companies = creditCompanyService.lambdaQuery()
|
||||
.select(CreditCompany::getId, CreditCompany::getName, CreditCompany::getMatchName, CreditCompany::getTenantId)
|
||||
.eq(CreditCompany::getTenantId, tenantId)
|
||||
.and(w -> w.in(CreditCompany::getName, chunk).or().in(CreditCompany::getMatchName, chunk))
|
||||
.list();
|
||||
|
||||
for (CreditCompany c : companies) {
|
||||
if (c == null || c.getId() == null) {
|
||||
continue;
|
||||
}
|
||||
addCompanyNameMapping(companyIdByName, ambiguousByName, normalizeCompanyName(c.getName()), c.getId());
|
||||
addCompanyNameMapping(companyIdByName, ambiguousByName, normalizeCompanyName(c.getMatchName()), c.getId());
|
||||
}
|
||||
}
|
||||
|
||||
// 3.2) 更新当前租户下的被执行人 companyId
|
||||
for (CreditJudgmentDebtor d : tenantDebtors) {
|
||||
String key = normalizeCompanyName(d != null ? d.getName() : null);
|
||||
if (key == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Integer amb = ambiguousByName.get(key);
|
||||
if (amb != null && amb > 0) {
|
||||
ambiguous++;
|
||||
continue;
|
||||
}
|
||||
|
||||
Integer companyId = companyIdByName.get(key);
|
||||
if (companyId == null) {
|
||||
notFound++;
|
||||
continue;
|
||||
}
|
||||
matched++;
|
||||
|
||||
boolean needUpdate = d.getCompanyId() == null || !companyId.equals(d.getCompanyId());
|
||||
if (Boolean.TRUE.equals(onlyNull)) {
|
||||
needUpdate = d.getCompanyId() != null && d.getCompanyId() == 0;
|
||||
}
|
||||
if (!needUpdate) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CreditJudgmentDebtor patch = new CreditJudgmentDebtor();
|
||||
patch.setId(d.getId());
|
||||
patch.setCompanyId(companyId);
|
||||
updates.add(patch);
|
||||
if (updates.size() >= batchSize) {
|
||||
updated += batchImportSupport.runInNewTx(() -> {
|
||||
boolean ok = creditJudgmentDebtorService.updateBatchById(updates, batchSize);
|
||||
return ok ? updates.size() : 0;
|
||||
});
|
||||
updates.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// currentTenantId 为空时,租户缺失的数据不做匹配更新,避免误更新
|
||||
if (currentTenantId == null) {
|
||||
for (CreditJudgmentDebtor d : debtors) {
|
||||
if (d != null && d.getTenantId() == null) {
|
||||
notFound++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!updates.isEmpty()) {
|
||||
updated += batchImportSupport.runInNewTx(() -> {
|
||||
boolean ok = creditJudgmentDebtorService.updateBatchById(updates, batchSize);
|
||||
return ok ? updates.size() : 0;
|
||||
});
|
||||
}
|
||||
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("updated", updated);
|
||||
result.put("matched", matched);
|
||||
result.put("notFound", notFound);
|
||||
result.put("ambiguous", ambiguous);
|
||||
return success("更新完成,更新" + updated + "条", result);
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -417,31 +288,6 @@ public class CreditJudgmentDebtorController extends BaseController {
|
||||
return ImportHelper.isBlank(param.getCaseNumber());
|
||||
}
|
||||
|
||||
private static String normalizeCompanyName(String name) {
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
String v = name.replace(' ', ' ').trim();
|
||||
return v.isEmpty() ? null : v;
|
||||
}
|
||||
|
||||
private static void addCompanyNameMapping(Map<String, Integer> idByName,
|
||||
Map<String, Integer> ambiguousByName,
|
||||
String key,
|
||||
Integer companyId) {
|
||||
if (key == null || companyId == null) {
|
||||
return;
|
||||
}
|
||||
Integer existing = idByName.get(key);
|
||||
if (existing == null) {
|
||||
idByName.put(key, companyId);
|
||||
return;
|
||||
}
|
||||
if (!existing.equals(companyId)) {
|
||||
ambiguousByName.put(key, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isImportHeaderRow(CreditJudgmentDebtorImportParam param) {
|
||||
return isHeaderValue(param.getName(), "序号")
|
||||
|| isHeaderValue(param.getName1(), "序号")
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditJudicialDocument;
|
||||
import com.gxwebsoft.credit.param.CreditJudicialDocumentImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditJudicialDocumentParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditJudicialDocumentService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -42,6 +43,9 @@ public class CreditJudicialDocumentController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询裁判文书司法大数据")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditJudicialDocument>> page(CreditJudicialDocumentParam param) {
|
||||
@@ -134,6 +138,43 @@ public class CreditJudicialDocumentController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditJudicialDocument:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditJudicialDocumentService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditJudicialDocument::getId,
|
||||
CreditJudicialDocument::setId,
|
||||
CreditJudicialDocument::getAppellee,
|
||||
CreditJudicialDocument::getCompanyId,
|
||||
CreditJudicialDocument::setCompanyId,
|
||||
CreditJudicialDocument::getTenantId,
|
||||
CreditJudicialDocument::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入裁判文书司法大数据
|
||||
*/
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditJudiciary;
|
||||
import com.gxwebsoft.credit.param.CreditJudiciaryImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditJudiciaryParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditJudiciaryService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -45,6 +46,9 @@ public class CreditJudiciaryController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询司法案件")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditJudiciary>> page(CreditJudiciaryParam param) {
|
||||
@@ -132,6 +136,43 @@ public class CreditJudiciaryController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditJudiciary:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditJudiciaryService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditJudiciary::getId,
|
||||
CreditJudiciary::setId,
|
||||
CreditJudiciary::getName,
|
||||
CreditJudiciary::getCompanyId,
|
||||
CreditJudiciary::setCompanyId,
|
||||
CreditJudiciary::getTenantId,
|
||||
CreditJudiciary::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入司法案件
|
||||
*/
|
||||
@@ -144,13 +185,16 @@ public class CreditJudiciaryController extends BaseController {
|
||||
int successCount = 0;
|
||||
|
||||
try {
|
||||
// 支持按选项卡名称导入:默认读取“司法案件”sheet(不存在则回退到第 0 个sheet)
|
||||
int sheetIndex = ExcelImportSupport.findSheetIndex(file, "司法案件", 0);
|
||||
|
||||
List<CreditJudiciaryImportParam> list = null;
|
||||
int usedTitleRows = 0;
|
||||
int usedHeadRows = 0;
|
||||
int[][] tryConfigs = new int[][]{{1, 1}, {0, 1}, {0, 2}, {0, 3}};
|
||||
|
||||
for (int[] config : tryConfigs) {
|
||||
list = filterEmptyRows(tryImport(file, config[0], config[1]));
|
||||
list = filterEmptyRows(tryImport(file, config[0], config[1], sheetIndex));
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
usedTitleRows = config[0];
|
||||
usedHeadRows = config[1];
|
||||
@@ -165,18 +209,18 @@ public class CreditJudiciaryController extends BaseController {
|
||||
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
// easypoi 默认不会读取单元格超链接地址;url 可能挂在“案号/案件名称”等列的超链接中,需要额外读取回填。
|
||||
Map<String, String> urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, 0, usedTitleRows, usedHeadRows, "案号");
|
||||
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, 0, usedTitleRows, usedHeadRows, "案件名称");
|
||||
Map<String, String> urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, sheetIndex, usedTitleRows, usedHeadRows, "案号");
|
||||
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, sheetIndex, usedTitleRows, usedHeadRows, "案件名称");
|
||||
// 有些源文件会单独提供“url/网址/链接”等列(可能是纯文本也可能是超链接)
|
||||
Map<String, String> urlByCodeFromUrlCol = ExcelImportSupport.readKeyValueByHeaders(file, 0, usedTitleRows, usedHeadRows, "案号", "url");
|
||||
Map<String, String> urlByCodeFromUrlCol = ExcelImportSupport.readKeyValueByHeaders(file, sheetIndex, usedTitleRows, usedHeadRows, "案号", "url");
|
||||
if (urlByCodeFromUrlCol.isEmpty()) {
|
||||
urlByCodeFromUrlCol = ExcelImportSupport.readKeyValueByHeaders(file, 0, usedTitleRows, usedHeadRows, "案号", "URL");
|
||||
urlByCodeFromUrlCol = ExcelImportSupport.readKeyValueByHeaders(file, sheetIndex, usedTitleRows, usedHeadRows, "案号", "URL");
|
||||
}
|
||||
if (urlByCodeFromUrlCol.isEmpty()) {
|
||||
urlByCodeFromUrlCol = ExcelImportSupport.readKeyValueByHeaders(file, 0, usedTitleRows, usedHeadRows, "案号", "网址");
|
||||
urlByCodeFromUrlCol = ExcelImportSupport.readKeyValueByHeaders(file, sheetIndex, usedTitleRows, usedHeadRows, "案号", "网址");
|
||||
}
|
||||
if (urlByCodeFromUrlCol.isEmpty()) {
|
||||
urlByCodeFromUrlCol = ExcelImportSupport.readKeyValueByHeaders(file, 0, usedTitleRows, usedHeadRows, "案号", "链接");
|
||||
urlByCodeFromUrlCol = ExcelImportSupport.readKeyValueByHeaders(file, sheetIndex, usedTitleRows, usedHeadRows, "案号", "链接");
|
||||
}
|
||||
|
||||
final int chunkSize = 500;
|
||||
@@ -359,11 +403,11 @@ public class CreditJudiciaryController extends BaseController {
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
private List<CreditJudiciaryImportParam> tryImport(MultipartFile file, int titleRows, int headRows) throws Exception {
|
||||
private List<CreditJudiciaryImportParam> tryImport(MultipartFile file, int titleRows, int headRows, int sheetIndex) throws Exception {
|
||||
ImportParams importParams = new ImportParams();
|
||||
importParams.setTitleRows(titleRows);
|
||||
importParams.setHeadRows(headRows);
|
||||
importParams.setStartSheetIndex(0);
|
||||
importParams.setStartSheetIndex(sheetIndex);
|
||||
importParams.setSheetNum(1);
|
||||
return ExcelImportUtil.importExcel(file.getInputStream(), CreditJudiciaryImportParam.class, importParams);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditMediation;
|
||||
import com.gxwebsoft.credit.param.CreditMediationImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditMediationParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditMediationService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -41,6 +42,9 @@ public class CreditMediationController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询诉前调解司法大数据")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditMediation>> page(CreditMediationParam param) {
|
||||
@@ -133,6 +137,43 @@ public class CreditMediationController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditMediation:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditMediationService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditMediation::getId,
|
||||
CreditMediation::setId,
|
||||
CreditMediation::getAppellee,
|
||||
CreditMediation::getCompanyId,
|
||||
CreditMediation::setCompanyId,
|
||||
CreditMediation::getTenantId,
|
||||
CreditMediation::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入诉前调解司法大数据
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditNearbyCompany;
|
||||
import com.gxwebsoft.credit.param.CreditNearbyCompanyImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditNearbyCompanyParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditNearbyCompanyService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -41,6 +42,9 @@ public class CreditNearbyCompanyController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询附近企业")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditNearbyCompany>> page(CreditNearbyCompanyParam param) {
|
||||
@@ -133,6 +137,43 @@ public class CreditNearbyCompanyController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditNearbyCompany:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditNearbyCompanyService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditNearbyCompany::getId,
|
||||
CreditNearbyCompany::setId,
|
||||
CreditNearbyCompany::getName,
|
||||
CreditNearbyCompany::getCompanyId,
|
||||
CreditNearbyCompany::setCompanyId,
|
||||
CreditNearbyCompany::getTenantId,
|
||||
CreditNearbyCompany::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入附近企业
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditPatent;
|
||||
import com.gxwebsoft.credit.param.CreditPatentImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditPatentParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditPatentService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -41,6 +42,9 @@ public class CreditPatentController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询专利")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditPatent>> page(CreditPatentParam param) {
|
||||
@@ -133,6 +137,43 @@ public class CreditPatentController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditPatent:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditPatentService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditPatent::getId,
|
||||
CreditPatent::setId,
|
||||
CreditPatent::getPatentApplicant,
|
||||
CreditPatent::getCompanyId,
|
||||
CreditPatent::setCompanyId,
|
||||
CreditPatent::getTenantId,
|
||||
CreditPatent::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入专利
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditRiskRelation;
|
||||
import com.gxwebsoft.credit.param.CreditRiskRelationImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditRiskRelationParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditRiskRelationService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -23,6 +24,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 风险关系表控制器
|
||||
@@ -40,6 +42,9 @@ public class CreditRiskRelationController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询风险关系表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditRiskRelation>> page(CreditRiskRelationParam param) {
|
||||
@@ -132,6 +137,43 @@ public class CreditRiskRelationController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditRiskRelation:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditRiskRelationService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditRiskRelation::getId,
|
||||
CreditRiskRelation::setId,
|
||||
CreditRiskRelation::getMainBodyName,
|
||||
CreditRiskRelation::getCompanyId,
|
||||
CreditRiskRelation::setCompanyId,
|
||||
CreditRiskRelation::getTenantId,
|
||||
CreditRiskRelation::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入风险关系表
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditSupplier;
|
||||
import com.gxwebsoft.credit.param.CreditSupplierImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditSupplierParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditSupplierService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -41,6 +42,9 @@ public class CreditSupplierController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询供应商")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditSupplier>> page(CreditSupplierParam param) {
|
||||
@@ -133,6 +137,43 @@ public class CreditSupplierController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditSupplier:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditSupplierService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditSupplier::getId,
|
||||
CreditSupplier::setId,
|
||||
CreditSupplier::getSupplier,
|
||||
CreditSupplier::getCompanyId,
|
||||
CreditSupplier::setCompanyId,
|
||||
CreditSupplier::getTenantId,
|
||||
CreditSupplier::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入供应商
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditSuspectedRelationship;
|
||||
import com.gxwebsoft.credit.param.CreditSuspectedRelationshipImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditSuspectedRelationshipParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditSuspectedRelationshipService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -41,6 +42,9 @@ public class CreditSuspectedRelationshipController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询疑似关系")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditSuspectedRelationship>> page(CreditSuspectedRelationshipParam param) {
|
||||
@@ -133,6 +137,43 @@ public class CreditSuspectedRelationshipController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditSuspectedRelationshipService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditSuspectedRelationship::getId,
|
||||
CreditSuspectedRelationship::setId,
|
||||
CreditSuspectedRelationship::getName,
|
||||
CreditSuspectedRelationship::getCompanyId,
|
||||
CreditSuspectedRelationship::setCompanyId,
|
||||
CreditSuspectedRelationship::getTenantId,
|
||||
CreditSuspectedRelationship::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入疑似关系
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditUser;
|
||||
import com.gxwebsoft.credit.param.CreditUserImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditUserParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -57,6 +58,9 @@ public class CreditUserController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询招投标信息表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditUser>> page(CreditUserParam param) {
|
||||
@@ -144,6 +148,43 @@ public class CreditUserController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditUser:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditUserService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditUser::getId,
|
||||
CreditUser::setId,
|
||||
CreditUser::getWinningName,
|
||||
CreditUser::getCompanyId,
|
||||
CreditUser::setCompanyId,
|
||||
CreditUser::getTenantId,
|
||||
CreditUser::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入招投标信息
|
||||
* Excel表头格式:客户名称、唯一标识、类型、企业角色、上级ID、信息类型、所在国家、所在省份、所在城市、所在辖区、街道地址、招采单位名称、中标单位名称、中标金额、备注、是否推荐、到期时间、排序、状态、用户ID、租户ID
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.credit.entity.CreditXgxf;
|
||||
import com.gxwebsoft.credit.param.CreditXgxfImportParam;
|
||||
import com.gxwebsoft.credit.param.CreditXgxfParam;
|
||||
import com.gxwebsoft.credit.service.CreditCompanyService;
|
||||
import com.gxwebsoft.credit.service.CreditXgxfService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -42,6 +43,9 @@ public class CreditXgxfController extends BaseController {
|
||||
@Resource
|
||||
private BatchImportSupport batchImportSupport;
|
||||
|
||||
@Resource
|
||||
private CreditCompanyService creditCompanyService;
|
||||
|
||||
@Operation(summary = "分页查询限制高消费")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CreditXgxf>> page(CreditXgxfParam param) {
|
||||
@@ -134,6 +138,43 @@ public class CreditXgxfController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName)
|
||||
*
|
||||
* <p>默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。</p>
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('credit:creditXgxf:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "根据企业名称匹配并更新companyId")
|
||||
@PostMapping("/company-id/refresh")
|
||||
public ApiResult<Map<String, Object>> refreshCompanyIdByCompanyName(
|
||||
@RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull,
|
||||
@RequestParam(value = "limit", required = false) Integer limit
|
||||
) {
|
||||
User loginUser = getLoginUser();
|
||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||
|
||||
BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName(
|
||||
creditXgxfService,
|
||||
creditCompanyService,
|
||||
currentTenantId,
|
||||
onlyNull,
|
||||
limit,
|
||||
CreditXgxf::getId,
|
||||
CreditXgxf::setId,
|
||||
CreditXgxf::getDataType,
|
||||
CreditXgxf::getCompanyId,
|
||||
CreditXgxf::setCompanyId,
|
||||
CreditXgxf::getTenantId,
|
||||
CreditXgxf::new
|
||||
);
|
||||
|
||||
if (!stats.anyDataRead) {
|
||||
return success("无可更新数据", stats.toMap());
|
||||
}
|
||||
return success("更新完成,更新" + stats.updated + "条", stats.toMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入限制高消费司法大数据
|
||||
*/
|
||||
|
||||
@@ -37,7 +37,6 @@ public class CreditBreachOfTrust implements Serializable {
|
||||
private String plaintiffAppellant;
|
||||
|
||||
@Schema(description = "疑似申请执行人")
|
||||
@TableField("Appellee")
|
||||
private String appellee;
|
||||
|
||||
@Schema(description = "涉案金额(元)")
|
||||
|
||||
@@ -37,7 +37,6 @@ public class CreditCaseFiling implements Serializable {
|
||||
private String plaintiffAppellant;
|
||||
|
||||
@Schema(description = "被告/被上诉人")
|
||||
@TableField("Appellee")
|
||||
private String appellee;
|
||||
|
||||
@Schema(description = "其他当事人/第三人")
|
||||
|
||||
@@ -37,7 +37,6 @@ public class CreditCourtSession implements Serializable {
|
||||
private String plaintiffAppellant;
|
||||
|
||||
@Schema(description = "被告/被上诉人")
|
||||
@TableField("Appellee")
|
||||
private String appellee;
|
||||
|
||||
@Schema(description = "其他当事人/第三人")
|
||||
|
||||
@@ -58,7 +58,6 @@ public class CreditJudicialDocument implements Serializable {
|
||||
private String releaseDate;
|
||||
|
||||
@Schema(description = "被告/被上诉人")
|
||||
@TableField("Appellee")
|
||||
private String appellee;
|
||||
|
||||
@Schema(description = "法院")
|
||||
|
||||
@@ -37,7 +37,6 @@ public class CreditMediation implements Serializable {
|
||||
private String plaintiffAppellant;
|
||||
|
||||
@Schema(description = "被告/被上诉人")
|
||||
@TableField("Appellee")
|
||||
private String appellee;
|
||||
|
||||
@Schema(description = "其他当事人/第三人")
|
||||
|
||||
@@ -22,7 +22,6 @@ public class CreditBreachOfTrustImportParam implements Serializable {
|
||||
private String plaintiffAppellant;
|
||||
|
||||
@Excel(name = "疑似申请执行人")
|
||||
@TableField("Appellee")
|
||||
private String appellee;
|
||||
|
||||
@Excel(name = "涉案金额(元)")
|
||||
|
||||
@@ -35,7 +35,6 @@ public class CreditBreachOfTrustParam extends BaseParam {
|
||||
private String plaintiffAppellant;
|
||||
|
||||
@Schema(description = "疑似申请执行人")
|
||||
@TableField("Appellee")
|
||||
private String appellee;
|
||||
|
||||
@Schema(description = "涉案金额(元)")
|
||||
|
||||
Reference in New Issue
Block a user