feat(batch-import): 批量导入功能支持企业名称回填
- 在 BatchImportSupport 中新增 refreshCompanyIdByCompanyName 方法用于按企业名称匹配并回填 companyId 和 companyName - 在 CreditAdministrativeLicenseController、CreditBranchController、CreditHistoricalLegalPersonController、CreditNearbyCompanyController 和 CreditSuspectedRelationshipController 中添加公司名称回填逻辑 - 修改实体类中 companyName 字段的 TableField 注解从 exist=false 改为 company_name - 更新各个 Mapper XML 文件中的查询 SQL,使用 COALESCE 函数确保当关联企业名称为空时使用本地存储的公司名称 - 在批量导入过程中增加固定公司名称的获取和设置逻辑
This commit is contained in:
@@ -178,6 +178,43 @@ public class BatchImportSupport {
|
|||||||
nameGetter);
|
nameGetter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按企业名称匹配 CreditCompany(name / matchName) 并回填 companyId + companyName。
|
||||||
|
*
|
||||||
|
* <p>companyNameSetter 为空时等价于仅回填 companyId。</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,
|
||||||
|
BiConsumer<T, String> companyNameSetter,
|
||||||
|
SFunction<T, Boolean> hasDataGetter,
|
||||||
|
BiConsumer<T, Boolean> hasDataSetter,
|
||||||
|
SFunction<T, Integer> tenantIdGetter,
|
||||||
|
Supplier<T> patchFactory) {
|
||||||
|
return refreshCompanyIdByCompanyNames(service,
|
||||||
|
creditCompanyService,
|
||||||
|
currentTenantId,
|
||||||
|
onlyNull,
|
||||||
|
limit,
|
||||||
|
idGetter,
|
||||||
|
idSetter,
|
||||||
|
companyIdGetter,
|
||||||
|
companyIdSetter,
|
||||||
|
companyNameSetter,
|
||||||
|
hasDataGetter,
|
||||||
|
hasDataSetter,
|
||||||
|
tenantIdGetter,
|
||||||
|
patchFactory,
|
||||||
|
nameGetter);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按多列“当事人/企业名称”匹配 CreditCompany(name / matchName) 并回填 companyId。
|
* 按多列“当事人/企业名称”匹配 CreditCompany(name / matchName) 并回填 companyId。
|
||||||
*
|
*
|
||||||
@@ -200,6 +237,44 @@ public class BatchImportSupport {
|
|||||||
SFunction<T, Integer> tenantIdGetter,
|
SFunction<T, Integer> tenantIdGetter,
|
||||||
Supplier<T> patchFactory,
|
Supplier<T> patchFactory,
|
||||||
SFunction<T, String>... nameGetters) {
|
SFunction<T, String>... nameGetters) {
|
||||||
|
return refreshCompanyIdByCompanyNames(service,
|
||||||
|
creditCompanyService,
|
||||||
|
currentTenantId,
|
||||||
|
onlyNull,
|
||||||
|
limit,
|
||||||
|
idGetter,
|
||||||
|
idSetter,
|
||||||
|
companyIdGetter,
|
||||||
|
companyIdSetter,
|
||||||
|
null,
|
||||||
|
hasDataGetter,
|
||||||
|
hasDataSetter,
|
||||||
|
tenantIdGetter,
|
||||||
|
patchFactory,
|
||||||
|
nameGetters);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按多列“当事人/企业名称”匹配 CreditCompany(name / matchName) 并回填 companyId + companyName。
|
||||||
|
*
|
||||||
|
* <p>companyNameSetter 为空时等价于仅回填 companyId。</p>
|
||||||
|
*/
|
||||||
|
@SafeVarargs
|
||||||
|
public final <T> CompanyIdRefreshStats refreshCompanyIdByCompanyNames(IService<T> service,
|
||||||
|
CreditCompanyService creditCompanyService,
|
||||||
|
Integer currentTenantId,
|
||||||
|
Boolean onlyNull,
|
||||||
|
Integer limit,
|
||||||
|
SFunction<T, Integer> idGetter,
|
||||||
|
BiConsumer<T, Integer> idSetter,
|
||||||
|
SFunction<T, Integer> companyIdGetter,
|
||||||
|
BiConsumer<T, Integer> companyIdSetter,
|
||||||
|
BiConsumer<T, String> companyNameSetter,
|
||||||
|
SFunction<T, Boolean> hasDataGetter,
|
||||||
|
BiConsumer<T, Boolean> hasDataSetter,
|
||||||
|
SFunction<T, Integer> tenantIdGetter,
|
||||||
|
Supplier<T> patchFactory,
|
||||||
|
SFunction<T, String>... nameGetters) {
|
||||||
boolean onlyNullFlag = (onlyNull == null) || Boolean.TRUE.equals(onlyNull);
|
boolean onlyNullFlag = (onlyNull == null) || Boolean.TRUE.equals(onlyNull);
|
||||||
|
|
||||||
if (nameGetters == null || nameGetters.length == 0) {
|
if (nameGetters == null || nameGetters.length == 0) {
|
||||||
@@ -280,6 +355,7 @@ public class BatchImportSupport {
|
|||||||
// 3.1) 查询当前租户下的 companyId 映射
|
// 3.1) 查询当前租户下的 companyId 映射
|
||||||
LinkedHashMap<String, Integer> companyIdByName = new LinkedHashMap<>();
|
LinkedHashMap<String, Integer> companyIdByName = new LinkedHashMap<>();
|
||||||
LinkedHashMap<String, Integer> ambiguousByName = new LinkedHashMap<>();
|
LinkedHashMap<String, Integer> ambiguousByName = new LinkedHashMap<>();
|
||||||
|
HashMap<Integer, String> companyNameById = new HashMap<>();
|
||||||
LinkedHashSet<String> nameSet = new LinkedHashSet<>();
|
LinkedHashSet<String> nameSet = new LinkedHashSet<>();
|
||||||
for (T row : tenantRows) {
|
for (T row : tenantRows) {
|
||||||
if (row == null) {
|
if (row == null) {
|
||||||
@@ -309,6 +385,9 @@ public class BatchImportSupport {
|
|||||||
if (c == null || c.getId() == null) {
|
if (c == null || c.getId() == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (c.getName() != null && !c.getName().trim().isEmpty()) {
|
||||||
|
companyNameById.putIfAbsent(c.getId(), c.getName().trim());
|
||||||
|
}
|
||||||
addCompanyNameMapping(companyIdByName, ambiguousByName, normalizeCompanyName(c.getName()), c.getId());
|
addCompanyNameMapping(companyIdByName, ambiguousByName, normalizeCompanyName(c.getName()), c.getId());
|
||||||
addCompanyNameMapping(companyIdByName, ambiguousByName, normalizeCompanyName(c.getMatchName()), c.getId());
|
addCompanyNameMapping(companyIdByName, ambiguousByName, normalizeCompanyName(c.getMatchName()), c.getId());
|
||||||
}
|
}
|
||||||
@@ -381,6 +460,12 @@ public class BatchImportSupport {
|
|||||||
T patch = patchFactory.get();
|
T patch = patchFactory.get();
|
||||||
idSetter.accept(patch, id);
|
idSetter.accept(patch, id);
|
||||||
companyIdSetter.accept(patch, companyId);
|
companyIdSetter.accept(patch, companyId);
|
||||||
|
if (companyNameSetter != null) {
|
||||||
|
String companyName = companyNameById.get(companyId);
|
||||||
|
if (companyName != null && !companyName.trim().isEmpty()) {
|
||||||
|
companyNameSetter.accept(patch, companyName.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
hasDataSetter.accept(patch, Boolean.TRUE);
|
hasDataSetter.accept(patch, Boolean.TRUE);
|
||||||
updates.add(patch);
|
updates.add(patch);
|
||||||
if (updates.size() >= batchSize) {
|
if (updates.size() >= batchSize) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.gxwebsoft.common.core.web.BaseController;
|
|||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.credit.entity.CreditCompany;
|
||||||
import com.gxwebsoft.credit.entity.CreditAdministrativeLicense;
|
import com.gxwebsoft.credit.entity.CreditAdministrativeLicense;
|
||||||
import com.gxwebsoft.credit.param.CreditAdministrativeLicenseImportParam;
|
import com.gxwebsoft.credit.param.CreditAdministrativeLicenseImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditAdministrativeLicenseParam;
|
import com.gxwebsoft.credit.param.CreditAdministrativeLicenseParam;
|
||||||
@@ -170,6 +171,7 @@ public class CreditAdministrativeLicenseController extends BaseController {
|
|||||||
CreditAdministrativeLicense::getName,
|
CreditAdministrativeLicense::getName,
|
||||||
CreditAdministrativeLicense::getCompanyId,
|
CreditAdministrativeLicense::getCompanyId,
|
||||||
CreditAdministrativeLicense::setCompanyId,
|
CreditAdministrativeLicense::setCompanyId,
|
||||||
|
CreditAdministrativeLicense::setCompanyName,
|
||||||
CreditAdministrativeLicense::getHasData,
|
CreditAdministrativeLicense::getHasData,
|
||||||
CreditAdministrativeLicense::setHasData,
|
CreditAdministrativeLicense::setHasData,
|
||||||
CreditAdministrativeLicense::getTenantId,
|
CreditAdministrativeLicense::getTenantId,
|
||||||
@@ -211,6 +213,11 @@ public class CreditAdministrativeLicenseController extends BaseController {
|
|||||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||||
Map<String, String> urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可编号");
|
Map<String, String> urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可编号");
|
||||||
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可证名称");
|
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可证名称");
|
||||||
|
String fixedCompanyName = null;
|
||||||
|
if (companyId != null && companyId > 0) {
|
||||||
|
CreditCompany fixedCompany = creditCompanyService.getById(companyId);
|
||||||
|
fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null;
|
||||||
|
}
|
||||||
|
|
||||||
final int chunkSize = 500;
|
final int chunkSize = 500;
|
||||||
final int mpBatchSize = 500;
|
final int mpBatchSize = 500;
|
||||||
@@ -234,6 +241,9 @@ public class CreditAdministrativeLicenseController extends BaseController {
|
|||||||
|
|
||||||
if (item.getCompanyId() == null && companyId != null) {
|
if (item.getCompanyId() == null && companyId != null) {
|
||||||
item.setCompanyId(companyId);
|
item.setCompanyId(companyId);
|
||||||
|
if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) {
|
||||||
|
item.setCompanyName(fixedCompanyName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
touchedCompanyIds.add(item.getCompanyId());
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
@@ -346,6 +356,11 @@ public class CreditAdministrativeLicenseController extends BaseController {
|
|||||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||||
Map<String, String> urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可编号");
|
Map<String, String> urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可编号");
|
||||||
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可证名称");
|
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可证名称");
|
||||||
|
String fixedCompanyName = null;
|
||||||
|
if (companyId != null && companyId > 0) {
|
||||||
|
CreditCompany fixedCompany = creditCompanyService.getById(companyId);
|
||||||
|
fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null;
|
||||||
|
}
|
||||||
|
|
||||||
final int chunkSize = 500;
|
final int chunkSize = 500;
|
||||||
final int mpBatchSize = 500;
|
final int mpBatchSize = 500;
|
||||||
@@ -382,6 +397,9 @@ public class CreditAdministrativeLicenseController extends BaseController {
|
|||||||
|
|
||||||
if (item.getCompanyId() == null && companyId != null) {
|
if (item.getCompanyId() == null && companyId != null) {
|
||||||
item.setCompanyId(companyId);
|
item.setCompanyId(companyId);
|
||||||
|
if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) {
|
||||||
|
item.setCompanyName(fixedCompanyName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (item.getUserId() == null && currentUserId != null) {
|
if (item.getUserId() == null && currentUserId != null) {
|
||||||
item.setUserId(currentUserId);
|
item.setUserId(currentUserId);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.gxwebsoft.common.core.web.BaseController;
|
|||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.credit.entity.CreditCompany;
|
||||||
import com.gxwebsoft.credit.entity.CreditBranch;
|
import com.gxwebsoft.credit.entity.CreditBranch;
|
||||||
import com.gxwebsoft.credit.param.CreditBranchImportParam;
|
import com.gxwebsoft.credit.param.CreditBranchImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditBranchParam;
|
import com.gxwebsoft.credit.param.CreditBranchParam;
|
||||||
@@ -170,6 +171,7 @@ public class CreditBranchController extends BaseController {
|
|||||||
CreditBranch::getName,
|
CreditBranch::getName,
|
||||||
CreditBranch::getCompanyId,
|
CreditBranch::getCompanyId,
|
||||||
CreditBranch::setCompanyId,
|
CreditBranch::setCompanyId,
|
||||||
|
CreditBranch::setCompanyName,
|
||||||
CreditBranch::getHasData,
|
CreditBranch::getHasData,
|
||||||
CreditBranch::setHasData,
|
CreditBranch::setHasData,
|
||||||
CreditBranch::getTenantId,
|
CreditBranch::getTenantId,
|
||||||
@@ -210,6 +212,11 @@ public class CreditBranchController extends BaseController {
|
|||||||
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
|
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
|
||||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||||
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "分支机构名称");
|
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "分支机构名称");
|
||||||
|
String fixedCompanyName = null;
|
||||||
|
if (companyId != null && companyId > 0) {
|
||||||
|
CreditCompany fixedCompany = creditCompanyService.getById(companyId);
|
||||||
|
fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null;
|
||||||
|
}
|
||||||
|
|
||||||
final int chunkSize = 500;
|
final int chunkSize = 500;
|
||||||
final int mpBatchSize = 500;
|
final int mpBatchSize = 500;
|
||||||
@@ -229,6 +236,9 @@ public class CreditBranchController extends BaseController {
|
|||||||
|
|
||||||
if (item.getCompanyId() == null && companyId != null) {
|
if (item.getCompanyId() == null && companyId != null) {
|
||||||
item.setCompanyId(companyId);
|
item.setCompanyId(companyId);
|
||||||
|
if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) {
|
||||||
|
item.setCompanyName(fixedCompanyName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (item.getUserId() == null && currentUserId != null) {
|
if (item.getUserId() == null && currentUserId != null) {
|
||||||
item.setUserId(currentUserId);
|
item.setUserId(currentUserId);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.gxwebsoft.common.core.web.BaseController;
|
|||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.credit.entity.CreditCompany;
|
||||||
import com.gxwebsoft.credit.entity.CreditHistoricalLegalPerson;
|
import com.gxwebsoft.credit.entity.CreditHistoricalLegalPerson;
|
||||||
import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonImportParam;
|
import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonParam;
|
import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonParam;
|
||||||
@@ -170,6 +171,7 @@ public class CreditHistoricalLegalPersonController extends BaseController {
|
|||||||
CreditHistoricalLegalPerson::getName,
|
CreditHistoricalLegalPerson::getName,
|
||||||
CreditHistoricalLegalPerson::getCompanyId,
|
CreditHistoricalLegalPerson::getCompanyId,
|
||||||
CreditHistoricalLegalPerson::setCompanyId,
|
CreditHistoricalLegalPerson::setCompanyId,
|
||||||
|
CreditHistoricalLegalPerson::setCompanyName,
|
||||||
CreditHistoricalLegalPerson::getHasData,
|
CreditHistoricalLegalPerson::getHasData,
|
||||||
CreditHistoricalLegalPerson::setHasData,
|
CreditHistoricalLegalPerson::setHasData,
|
||||||
CreditHistoricalLegalPerson::getTenantId,
|
CreditHistoricalLegalPerson::getTenantId,
|
||||||
@@ -210,6 +212,11 @@ public class CreditHistoricalLegalPersonController extends BaseController {
|
|||||||
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
|
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
|
||||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||||
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "名称");
|
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "名称");
|
||||||
|
String fixedCompanyName = null;
|
||||||
|
if (companyId != null && companyId > 0) {
|
||||||
|
CreditCompany fixedCompany = creditCompanyService.getById(companyId);
|
||||||
|
fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null;
|
||||||
|
}
|
||||||
|
|
||||||
final int chunkSize = 500;
|
final int chunkSize = 500;
|
||||||
final int mpBatchSize = 500;
|
final int mpBatchSize = 500;
|
||||||
@@ -229,6 +236,9 @@ public class CreditHistoricalLegalPersonController extends BaseController {
|
|||||||
|
|
||||||
if (item.getCompanyId() == null && companyId != null) {
|
if (item.getCompanyId() == null && companyId != null) {
|
||||||
item.setCompanyId(companyId);
|
item.setCompanyId(companyId);
|
||||||
|
if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) {
|
||||||
|
item.setCompanyName(fixedCompanyName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (item.getUserId() == null && currentUserId != null) {
|
if (item.getUserId() == null && currentUserId != null) {
|
||||||
item.setUserId(currentUserId);
|
item.setUserId(currentUserId);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.gxwebsoft.common.core.web.BaseController;
|
|||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.credit.entity.CreditCompany;
|
||||||
import com.gxwebsoft.credit.entity.CreditNearbyCompany;
|
import com.gxwebsoft.credit.entity.CreditNearbyCompany;
|
||||||
import com.gxwebsoft.credit.param.CreditNearbyCompanyImportParam;
|
import com.gxwebsoft.credit.param.CreditNearbyCompanyImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditNearbyCompanyParam;
|
import com.gxwebsoft.credit.param.CreditNearbyCompanyParam;
|
||||||
@@ -170,6 +171,7 @@ public class CreditNearbyCompanyController extends BaseController {
|
|||||||
CreditNearbyCompany::getName,
|
CreditNearbyCompany::getName,
|
||||||
CreditNearbyCompany::getCompanyId,
|
CreditNearbyCompany::getCompanyId,
|
||||||
CreditNearbyCompany::setCompanyId,
|
CreditNearbyCompany::setCompanyId,
|
||||||
|
CreditNearbyCompany::setCompanyName,
|
||||||
CreditNearbyCompany::getHasData,
|
CreditNearbyCompany::getHasData,
|
||||||
CreditNearbyCompany::setHasData,
|
CreditNearbyCompany::setHasData,
|
||||||
CreditNearbyCompany::getTenantId,
|
CreditNearbyCompany::getTenantId,
|
||||||
@@ -213,6 +215,11 @@ public class CreditNearbyCompanyController extends BaseController {
|
|||||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||||
Map<String, String> urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "统一社会信用代码");
|
Map<String, String> urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "统一社会信用代码");
|
||||||
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "企业名称");
|
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "企业名称");
|
||||||
|
String fixedCompanyName = null;
|
||||||
|
if (companyId != null && companyId > 0) {
|
||||||
|
CreditCompany fixedCompany = creditCompanyService.getById(companyId);
|
||||||
|
fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null;
|
||||||
|
}
|
||||||
|
|
||||||
// 避免逐行写库:按批处理,显著降低 SQL 次数与事务开销
|
// 避免逐行写库:按批处理,显著降低 SQL 次数与事务开销
|
||||||
final int chunkSize = 500;
|
final int chunkSize = 500;
|
||||||
@@ -243,6 +250,9 @@ public class CreditNearbyCompanyController extends BaseController {
|
|||||||
}
|
}
|
||||||
if (item.getCompanyId() == null && companyId != null) {
|
if (item.getCompanyId() == null && companyId != null) {
|
||||||
item.setCompanyId(companyId);
|
item.setCompanyId(companyId);
|
||||||
|
if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) {
|
||||||
|
item.setCompanyName(fixedCompanyName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
if (item.getCompanyId() != null && item.getCompanyId() > 0) {
|
||||||
touchedCompanyIds.add(item.getCompanyId());
|
touchedCompanyIds.add(item.getCompanyId());
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.gxwebsoft.common.core.web.BaseController;
|
|||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.credit.entity.CreditCompany;
|
||||||
import com.gxwebsoft.credit.entity.CreditSuspectedRelationship;
|
import com.gxwebsoft.credit.entity.CreditSuspectedRelationship;
|
||||||
import com.gxwebsoft.credit.param.CreditSuspectedRelationshipImportParam;
|
import com.gxwebsoft.credit.param.CreditSuspectedRelationshipImportParam;
|
||||||
import com.gxwebsoft.credit.param.CreditSuspectedRelationshipParam;
|
import com.gxwebsoft.credit.param.CreditSuspectedRelationshipParam;
|
||||||
@@ -170,6 +171,7 @@ public class CreditSuspectedRelationshipController extends BaseController {
|
|||||||
CreditSuspectedRelationship::getName,
|
CreditSuspectedRelationship::getName,
|
||||||
CreditSuspectedRelationship::getCompanyId,
|
CreditSuspectedRelationship::getCompanyId,
|
||||||
CreditSuspectedRelationship::setCompanyId,
|
CreditSuspectedRelationship::setCompanyId,
|
||||||
|
CreditSuspectedRelationship::setCompanyName,
|
||||||
CreditSuspectedRelationship::getHasData,
|
CreditSuspectedRelationship::getHasData,
|
||||||
CreditSuspectedRelationship::setHasData,
|
CreditSuspectedRelationship::setHasData,
|
||||||
CreditSuspectedRelationship::getTenantId,
|
CreditSuspectedRelationship::getTenantId,
|
||||||
@@ -210,6 +212,11 @@ public class CreditSuspectedRelationshipController extends BaseController {
|
|||||||
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
|
Integer currentUserId = loginUser != null ? loginUser.getUserId() : null;
|
||||||
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null;
|
||||||
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "企业名称");
|
Map<String, String> urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "企业名称");
|
||||||
|
String fixedCompanyName = null;
|
||||||
|
if (companyId != null && companyId > 0) {
|
||||||
|
CreditCompany fixedCompany = creditCompanyService.getById(companyId);
|
||||||
|
fixedCompanyName = fixedCompany != null ? fixedCompany.getName() : null;
|
||||||
|
}
|
||||||
|
|
||||||
final int chunkSize = 500;
|
final int chunkSize = 500;
|
||||||
final int mpBatchSize = 500;
|
final int mpBatchSize = 500;
|
||||||
@@ -229,6 +236,9 @@ public class CreditSuspectedRelationshipController extends BaseController {
|
|||||||
|
|
||||||
if (item.getCompanyId() == null && companyId != null) {
|
if (item.getCompanyId() == null && companyId != null) {
|
||||||
item.setCompanyId(companyId);
|
item.setCompanyId(companyId);
|
||||||
|
if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) {
|
||||||
|
item.setCompanyName(fixedCompanyName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (item.getUserId() == null && currentUserId != null) {
|
if (item.getUserId() == null && currentUserId != null) {
|
||||||
item.setUserId(currentUserId);
|
item.setUserId(currentUserId);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class CreditAdministrativeLicense implements Serializable {
|
|||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
|
|
||||||
@Schema(description = "主体企业")
|
@Schema(description = "主体企业")
|
||||||
@TableField(exist = false)
|
@TableField("company_name")
|
||||||
private String companyName;
|
private String companyName;
|
||||||
|
|
||||||
@Schema(description = "是否推荐")
|
@Schema(description = "是否推荐")
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class CreditBranch implements Serializable {
|
|||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
|
|
||||||
@Schema(description = "主题企业")
|
@Schema(description = "主题企业")
|
||||||
@TableField(exist = false)
|
@TableField("company_name")
|
||||||
private String companyName;
|
private String companyName;
|
||||||
|
|
||||||
@Schema(description = "是否推荐")
|
@Schema(description = "是否推荐")
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class CreditHistoricalLegalPerson implements Serializable {
|
|||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
|
|
||||||
@Schema(description = "主体企业")
|
@Schema(description = "主体企业")
|
||||||
@TableField(exist = false)
|
@TableField("company_name")
|
||||||
private String companyName;
|
private String companyName;
|
||||||
|
|
||||||
@Schema(description = "是否推荐")
|
@Schema(description = "是否推荐")
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public class CreditNearbyCompany implements Serializable {
|
|||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
|
|
||||||
@Schema(description = "主体企业")
|
@Schema(description = "主体企业")
|
||||||
@TableField(exist = false)
|
@TableField("company_name")
|
||||||
private String companyName;
|
private String companyName;
|
||||||
|
|
||||||
@Schema(description = "纳税人识别号")
|
@Schema(description = "纳税人识别号")
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class CreditSuspectedRelationship implements Serializable {
|
|||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
|
|
||||||
@Schema(description = "主体企业")
|
@Schema(description = "主体企业")
|
||||||
@TableField(exist = false)
|
@TableField("company_name")
|
||||||
private String companyName;
|
private String companyName;
|
||||||
|
|
||||||
@Schema(description = "是否推荐")
|
@Schema(description = "是否推荐")
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<!-- 关联查询sql -->
|
<!-- 关联查询sql -->
|
||||||
<sql id="selectSql">
|
<sql id="selectSql">
|
||||||
SELECT a.*, b.name AS companyName, u.real_name AS realName
|
SELECT a.*, COALESCE(b.name, a.company_name) AS companyName, u.real_name AS realName
|
||||||
FROM credit_administrative_license a
|
FROM credit_administrative_license a
|
||||||
LEFT JOIN credit_company b ON a.company_id = b.id
|
LEFT JOIN credit_company b ON a.company_id = b.id
|
||||||
LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id
|
LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<!-- 关联查询sql -->
|
<!-- 关联查询sql -->
|
||||||
<sql id="selectSql">
|
<sql id="selectSql">
|
||||||
SELECT a.*, b.name AS companyName, u.real_name AS realName
|
SELECT a.*, COALESCE(b.name, a.company_name) AS companyName, u.real_name AS realName
|
||||||
FROM credit_branch a
|
FROM credit_branch a
|
||||||
LEFT JOIN credit_company b ON a.company_id = b.id
|
LEFT JOIN credit_company b ON a.company_id = b.id
|
||||||
LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id
|
LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<!-- 关联查询sql -->
|
<!-- 关联查询sql -->
|
||||||
<sql id="selectSql">
|
<sql id="selectSql">
|
||||||
SELECT a.*, b.name AS companyName, u.real_name AS realName
|
SELECT a.*, COALESCE(b.name, a.company_name) AS companyName, u.real_name AS realName
|
||||||
FROM credit_historical_legal_person a
|
FROM credit_historical_legal_person a
|
||||||
LEFT JOIN credit_company b ON a.company_id = b.id
|
LEFT JOIN credit_company b ON a.company_id = b.id
|
||||||
LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id
|
LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<!-- 关联查询sql -->
|
<!-- 关联查询sql -->
|
||||||
<sql id="selectSql">
|
<sql id="selectSql">
|
||||||
SELECT a.*,b.name AS companyName, u.real_name AS realName
|
SELECT a.*, COALESCE(b.name, a.company_name) AS companyName, u.real_name AS realName
|
||||||
FROM credit_nearby_company a
|
FROM credit_nearby_company a
|
||||||
LEFT JOIN credit_company b ON a.company_id = b.id
|
LEFT JOIN credit_company b ON a.company_id = b.id
|
||||||
LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id
|
LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<!-- 关联查询sql -->
|
<!-- 关联查询sql -->
|
||||||
<sql id="selectSql">
|
<sql id="selectSql">
|
||||||
SELECT a.*, b.name AS companyName, u.real_name AS realName
|
SELECT a.*, COALESCE(b.name, a.company_name) AS companyName, u.real_name AS realName
|
||||||
FROM credit_suspected_relationship a
|
FROM credit_suspected_relationship a
|
||||||
LEFT JOIN credit_company b ON a.company_id = b.id
|
LEFT JOIN credit_company b ON a.company_id = b.id
|
||||||
LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id
|
LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id
|
||||||
|
|||||||
Reference in New Issue
Block a user