diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditCompetitorController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditCompetitorController.java index d45e03f..2a73a74 100644 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditCompetitorController.java +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditCompetitorController.java @@ -6,6 +6,7 @@ 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.CreditCompetitor; import com.gxwebsoft.credit.param.CreditCompetitorImportParam; import com.gxwebsoft.credit.param.CreditCompetitorParam; @@ -170,6 +171,7 @@ public class CreditCompetitorController extends BaseController { CreditCompetitor::getName, CreditCompetitor::getCompanyId, CreditCompetitor::setCompanyId, + CreditCompetitor::setCompanyName, CreditCompetitor::getHasData, CreditCompetitor::setHasData, CreditCompetitor::getTenantId, @@ -212,6 +214,11 @@ public class CreditCompetitorController extends BaseController { Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; Map urlByName = ExcelImportSupport.readUrlByKey( 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 mpBatchSize = 500; @@ -222,7 +229,7 @@ public class CreditCompetitorController extends BaseController { CreditCompetitorImportParam param = list.get(i); try { CreditCompetitor item = convertImportParamToEntity(param); - // name 才是持久化字段;companyName 为关联查询的临时字段(exist=false),导入时不应使用。 + // name 为竞争对手企业名称;companyName 为主体企业名称。 if (!ImportHelper.isBlank(item.getName())) { String link = urlByName.get(item.getName().trim()); if (!ImportHelper.isBlank(link)) { @@ -232,6 +239,9 @@ public class CreditCompetitorController extends BaseController { if (item.getCompanyId() == null && companyId != null) { item.setCompanyId(companyId); + if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { + item.setCompanyName(fixedCompanyName); + } } if (item.getUserId() == null && currentUserId != null) { item.setUserId(currentUserId); diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditCustomerController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditCustomerController.java index a6df9d3..e16c950 100644 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditCustomerController.java +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditCustomerController.java @@ -6,6 +6,7 @@ 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.CreditCustomer; import com.gxwebsoft.credit.param.CreditCustomerImportParam; import com.gxwebsoft.credit.param.CreditCustomerParam; @@ -167,6 +168,7 @@ public class CreditCustomerController extends BaseController { CreditCustomer::getName, CreditCustomer::getCompanyId, CreditCustomer::setCompanyId, + CreditCustomer::setCompanyName, CreditCustomer::getHasData, CreditCustomer::setHasData, CreditCustomer::getTenantId, @@ -208,6 +210,11 @@ public class CreditCustomerController extends BaseController { Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; Map urlByName = ExcelImportSupport.readUrlByKey(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 mpBatchSize = 500; @@ -229,6 +236,9 @@ public class CreditCustomerController extends BaseController { if (item.getCompanyId() == null && companyId != null) { item.setCompanyId(companyId); + if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { + item.setCompanyName(fixedCompanyName); + } } if (item.getUserId() == null && currentUserId != null) { item.setUserId(currentUserId); diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditExternalController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditExternalController.java index 9bdbf95..85e1bd6 100644 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditExternalController.java +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditExternalController.java @@ -6,6 +6,7 @@ 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.CreditExternal; import com.gxwebsoft.credit.param.CreditExternalImportParam; import com.gxwebsoft.credit.param.CreditExternalParam; @@ -170,6 +171,7 @@ public class CreditExternalController extends BaseController { CreditExternal::getName, CreditExternal::getCompanyId, CreditExternal::setCompanyId, + CreditExternal::setCompanyName, CreditExternal::getHasData, CreditExternal::setHasData, CreditExternal::getTenantId, @@ -211,6 +213,11 @@ public class CreditExternalController extends BaseController { Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; Map urlByName = ExcelImportSupport.readUrlByKey(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 mpBatchSize = 500; @@ -230,6 +237,9 @@ public class CreditExternalController extends BaseController { if (item.getCompanyId() == null && companyId != null) { item.setCompanyId(companyId); + if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { + item.setCompanyName(fixedCompanyName); + } } if (item.getUserId() == null && currentUserId != null) { item.setUserId(currentUserId); diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditRiskRelationController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditRiskRelationController.java index 80a497f..ae6cfcf 100644 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditRiskRelationController.java +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditRiskRelationController.java @@ -6,6 +6,7 @@ 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.CreditRiskRelation; import com.gxwebsoft.credit.param.CreditRiskRelationImportParam; import com.gxwebsoft.credit.param.CreditRiskRelationParam; @@ -170,6 +171,7 @@ public class CreditRiskRelationController extends BaseController { CreditRiskRelation::getMainBodyName, CreditRiskRelation::getCompanyId, CreditRiskRelation::setCompanyId, + CreditRiskRelation::setCompanyName, CreditRiskRelation::getHasData, CreditRiskRelation::setHasData, CreditRiskRelation::getTenantId, @@ -209,6 +211,11 @@ public class CreditRiskRelationController extends BaseController { User loginUser = getLoginUser(); Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + 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 mpBatchSize = 500; @@ -222,6 +229,9 @@ public class CreditRiskRelationController extends BaseController { if (item.getCompanyId() == null && companyId != null) { item.setCompanyId(companyId); + if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { + item.setCompanyName(fixedCompanyName); + } } if (item.getUserId() == null && currentUserId != null) { item.setUserId(currentUserId); diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditSupplierController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditSupplierController.java index 7a41953..30073af 100644 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditSupplierController.java +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditSupplierController.java @@ -6,6 +6,7 @@ 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.CreditSupplier; import com.gxwebsoft.credit.param.CreditSupplierImportParam; import com.gxwebsoft.credit.param.CreditSupplierParam; @@ -170,6 +171,7 @@ public class CreditSupplierController extends BaseController { CreditSupplier::getSupplier, CreditSupplier::getCompanyId, CreditSupplier::setCompanyId, + CreditSupplier::setCompanyName, CreditSupplier::getHasData, CreditSupplier::setHasData, CreditSupplier::getTenantId, @@ -211,6 +213,11 @@ public class CreditSupplierController extends BaseController { Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; Map urlBySupplier = ExcelImportSupport.readUrlByKey(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 mpBatchSize = 500; @@ -230,6 +237,9 @@ public class CreditSupplierController extends BaseController { if (item.getCompanyId() == null && companyId != null) { item.setCompanyId(companyId); + if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { + item.setCompanyName(fixedCompanyName); + } } if (item.getUserId() == null && currentUserId != null) { item.setUserId(currentUserId); diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditUserController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditUserController.java index fef2a57..cef616e 100644 --- a/src/main/java/com/gxwebsoft/credit/controller/CreditUserController.java +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditUserController.java @@ -8,6 +8,7 @@ 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.CreditUser; import com.gxwebsoft.credit.param.CreditUserImportParam; import com.gxwebsoft.credit.param.CreditUserParam; @@ -176,6 +177,7 @@ public class CreditUserController extends BaseController { CreditUser::getWinningName, CreditUser::getCompanyId, CreditUser::setCompanyId, + CreditUser::setCompanyName, CreditUser::getHasData, CreditUser::setHasData, CreditUser::getTenantId, @@ -216,6 +218,11 @@ public class CreditUserController extends BaseController { Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; Map urlMap = readNameHyperlinks(file, sheetIndex, 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 mpBatchSize = 500; @@ -233,6 +240,9 @@ public class CreditUserController extends BaseController { } if (item.getCompanyId() == null && companyId != null) { item.setCompanyId(companyId); + if (ImportHelper.isBlank(item.getCompanyName()) && !ImportHelper.isBlank(fixedCompanyName)) { + item.setCompanyName(fixedCompanyName); + } } if (item.getCompanyId() != null && item.getCompanyId() > 0) { touchedCompanyIds.add(item.getCompanyId()); diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditCompetitor.java b/src/main/java/com/gxwebsoft/credit/entity/CreditCompetitor.java index bf1f4d0..45c901a 100644 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditCompetitor.java +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditCompetitor.java @@ -61,7 +61,6 @@ public class CreditCompetitor implements Serializable { private String companyAlias; @Schema(description = "企业名称") - @TableField(exist = false) private String companyName; @Schema(description = "所属企业名称") diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditCustomer.java b/src/main/java/com/gxwebsoft/credit/entity/CreditCustomer.java index f2040a3..bcf6009 100644 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditCustomer.java +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditCustomer.java @@ -55,7 +55,6 @@ public class CreditCustomer implements Serializable { private String companyAlias; @Schema(description = "企业名称") - @TableField(exist = false) private String companyName; @Schema(description = "是否有数据") diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditExternal.java b/src/main/java/com/gxwebsoft/credit/entity/CreditExternal.java index 6a755e6..8cd59c2 100644 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditExternal.java +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditExternal.java @@ -82,7 +82,6 @@ public class CreditExternal implements Serializable { private String companyAlias; @Schema(description = "企业名称") - @TableField(exist = false) private String companyName; @Schema(description = "是否有数据") diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditRiskRelation.java b/src/main/java/com/gxwebsoft/credit/entity/CreditRiskRelation.java index 7b4396e..a26ab97 100644 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditRiskRelation.java +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditRiskRelation.java @@ -54,7 +54,6 @@ public class CreditRiskRelation implements Serializable { private String companyAlias; @Schema(description = "企业名称") - @TableField(exist = false) private String companyName; @Schema(description = "是否有数据") diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditSupplier.java b/src/main/java/com/gxwebsoft/credit/entity/CreditSupplier.java index 86e306a..1838547 100644 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditSupplier.java +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditSupplier.java @@ -55,7 +55,6 @@ public class CreditSupplier implements Serializable { private String companyAlias; @Schema(description = "企业名称") - @TableField(exist = false) private String companyName; @Schema(description = "是否有数据") diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditUser.java b/src/main/java/com/gxwebsoft/credit/entity/CreditUser.java index 87c31cd..6eb943f 100644 --- a/src/main/java/com/gxwebsoft/credit/entity/CreditUser.java +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditUser.java @@ -85,7 +85,6 @@ public class CreditUser implements Serializable { private String companyAlias; @Schema(description = "企业名称") - @TableField(exist = false) private String companyName; @Schema(description = "是否有数据")