refactor(credit): 重构竞争对手实体的公司名称字段
- 将 CreditCompetitor 实体中的 companyName 字段重命名为 name - 保留 companyName 字段作为关联查询的临时字段(exist=false) - 更新控制器中导入逻辑,使用 name 字段进行数据处理 - 修改 XML 映射文件中的查询条件,使用 name 替代 companyName - 更新导入参数和查询参数类中的字段映射 - 修复专利控制器中的导入验证逻辑 - 调整外部投资企业实体的字段描述文案
This commit is contained in:
@@ -160,7 +160,8 @@ public class CreditCompetitorController extends BaseController {
|
|||||||
User loginUser = getLoginUser();
|
User loginUser = getLoginUser();
|
||||||
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> urlByCompanyName = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "企业名称");
|
Map<String, String> urlByName = ExcelImportSupport.readUrlByKey(
|
||||||
|
file, usedSheetIndex, usedTitleRows, usedHeadRows, "企业名称");
|
||||||
|
|
||||||
final int chunkSize = 500;
|
final int chunkSize = 500;
|
||||||
final int mpBatchSize = 500;
|
final int mpBatchSize = 500;
|
||||||
@@ -171,8 +172,9 @@ public class CreditCompetitorController extends BaseController {
|
|||||||
CreditCompetitorImportParam param = list.get(i);
|
CreditCompetitorImportParam param = list.get(i);
|
||||||
try {
|
try {
|
||||||
CreditCompetitor item = convertImportParamToEntity(param);
|
CreditCompetitor item = convertImportParamToEntity(param);
|
||||||
if (!ImportHelper.isBlank(item.getCompanyName())) {
|
// name 才是持久化字段;companyName 为关联查询的临时字段(exist=false),导入时不应使用。
|
||||||
String link = urlByCompanyName.get(item.getCompanyName().trim());
|
if (!ImportHelper.isBlank(item.getName())) {
|
||||||
|
String link = urlByName.get(item.getName().trim());
|
||||||
if (!ImportHelper.isBlank(link)) {
|
if (!ImportHelper.isBlank(link)) {
|
||||||
item.setUrl(link.trim());
|
item.setUrl(link.trim());
|
||||||
}
|
}
|
||||||
@@ -198,7 +200,7 @@ public class CreditCompetitorController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows;
|
int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows;
|
||||||
if (ImportHelper.isBlank(item.getCompanyName())) {
|
if (ImportHelper.isBlank(item.getName())) {
|
||||||
errorMessages.add("第" + excelRowNumber + "行:企业名称不能为空");
|
errorMessages.add("第" + excelRowNumber + "行:企业名称不能为空");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -214,8 +216,8 @@ public class CreditCompetitorController extends BaseController {
|
|||||||
chunkItems,
|
chunkItems,
|
||||||
CreditCompetitor::getId,
|
CreditCompetitor::getId,
|
||||||
CreditCompetitor::setId,
|
CreditCompetitor::setId,
|
||||||
CreditCompetitor::getCompanyName,
|
CreditCompetitor::getName,
|
||||||
CreditCompetitor::getCompanyName,
|
CreditCompetitor::getName,
|
||||||
null,
|
null,
|
||||||
mpBatchSize
|
mpBatchSize
|
||||||
),
|
),
|
||||||
@@ -223,7 +225,7 @@ public class CreditCompetitorController extends BaseController {
|
|||||||
boolean saved = creditCompetitorService.save(rowItem);
|
boolean saved = creditCompetitorService.save(rowItem);
|
||||||
if (!saved) {
|
if (!saved) {
|
||||||
CreditCompetitor existing = creditCompetitorService.lambdaQuery()
|
CreditCompetitor existing = creditCompetitorService.lambdaQuery()
|
||||||
.eq(CreditCompetitor::getCompanyName, rowItem.getCompanyName())
|
.eq(CreditCompetitor::getName, rowItem.getName())
|
||||||
.one();
|
.one();
|
||||||
if (existing != null) {
|
if (existing != null) {
|
||||||
rowItem.setId(existing.getId());
|
rowItem.setId(existing.getId());
|
||||||
@@ -259,8 +261,8 @@ public class CreditCompetitorController extends BaseController {
|
|||||||
chunkItems,
|
chunkItems,
|
||||||
CreditCompetitor::getId,
|
CreditCompetitor::getId,
|
||||||
CreditCompetitor::setId,
|
CreditCompetitor::setId,
|
||||||
CreditCompetitor::getCompanyName,
|
CreditCompetitor::getName,
|
||||||
CreditCompetitor::getCompanyName,
|
CreditCompetitor::getName,
|
||||||
null,
|
null,
|
||||||
mpBatchSize
|
mpBatchSize
|
||||||
),
|
),
|
||||||
@@ -268,7 +270,7 @@ public class CreditCompetitorController extends BaseController {
|
|||||||
boolean saved = creditCompetitorService.save(rowItem);
|
boolean saved = creditCompetitorService.save(rowItem);
|
||||||
if (!saved) {
|
if (!saved) {
|
||||||
CreditCompetitor existing = creditCompetitorService.lambdaQuery()
|
CreditCompetitor existing = creditCompetitorService.lambdaQuery()
|
||||||
.eq(CreditCompetitor::getCompanyName, rowItem.getCompanyName())
|
.eq(CreditCompetitor::getName, rowItem.getName())
|
||||||
.one();
|
.one();
|
||||||
if (existing != null) {
|
if (existing != null) {
|
||||||
rowItem.setId(existing.getId());
|
rowItem.setId(existing.getId());
|
||||||
@@ -307,7 +309,7 @@ public class CreditCompetitorController extends BaseController {
|
|||||||
List<CreditCompetitorImportParam> templateList = new ArrayList<>();
|
List<CreditCompetitorImportParam> templateList = new ArrayList<>();
|
||||||
|
|
||||||
CreditCompetitorImportParam example = new CreditCompetitorImportParam();
|
CreditCompetitorImportParam example = new CreditCompetitorImportParam();
|
||||||
example.setCompanyName("示例科技有限公司");
|
example.setName("示例科技有限公司");
|
||||||
example.setLegalRepresentative("张三");
|
example.setLegalRepresentative("张三");
|
||||||
example.setRegisteredCapital("5000");
|
example.setRegisteredCapital("5000");
|
||||||
example.setEstablishmentDate("2015-01-01");
|
example.setEstablishmentDate("2015-01-01");
|
||||||
@@ -330,7 +332,7 @@ public class CreditCompetitorController extends BaseController {
|
|||||||
if (param == null) {
|
if (param == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return ImportHelper.isBlank(param.getCompanyName())
|
return ImportHelper.isBlank(param.getName())
|
||||||
&& ImportHelper.isBlank(param.getLegalRepresentative())
|
&& ImportHelper.isBlank(param.getLegalRepresentative())
|
||||||
&& ImportHelper.isBlank(param.getRegisteredCapital())
|
&& ImportHelper.isBlank(param.getRegisteredCapital())
|
||||||
&& ImportHelper.isBlank(param.getEstablishmentDate());
|
&& ImportHelper.isBlank(param.getEstablishmentDate());
|
||||||
@@ -339,7 +341,7 @@ public class CreditCompetitorController extends BaseController {
|
|||||||
private CreditCompetitor convertImportParamToEntity(CreditCompetitorImportParam param) {
|
private CreditCompetitor convertImportParamToEntity(CreditCompetitorImportParam param) {
|
||||||
CreditCompetitor entity = new CreditCompetitor();
|
CreditCompetitor entity = new CreditCompetitor();
|
||||||
|
|
||||||
entity.setCompanyName(param.getCompanyName());
|
entity.setName(param.getName());
|
||||||
entity.setLegalRepresentative(param.getLegalRepresentative());
|
entity.setLegalRepresentative(param.getLegalRepresentative());
|
||||||
entity.setRegisteredCapital(param.getRegisteredCapital());
|
entity.setRegisteredCapital(param.getRegisteredCapital());
|
||||||
entity.setEstablishmentDate(param.getEstablishmentDate());
|
entity.setEstablishmentDate(param.getEstablishmentDate());
|
||||||
|
|||||||
@@ -339,9 +339,7 @@ public class CreditPatentController extends BaseController {
|
|||||||
if (isImportHeaderRow(param)) {
|
if (isImportHeaderRow(param)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return ImportHelper.isBlank(param.getRegisterNo())
|
return ImportHelper.isBlank(param.getPublicNo());
|
||||||
&& ImportHelper.isBlank(param.getName())
|
|
||||||
&& ImportHelper.isBlank(param.getPatentApplicant());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isImportHeaderRow(CreditPatentImportParam param) {
|
private boolean isImportHeaderRow(CreditPatentImportParam param) {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class CreditCompetitor implements Serializable {
|
|||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@Schema(description = "企业名称")
|
@Schema(description = "企业名称")
|
||||||
private String companyName;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "链接地址")
|
@Schema(description = "链接地址")
|
||||||
private String url;
|
private String url;
|
||||||
@@ -55,7 +55,11 @@ public class CreditCompetitor implements Serializable {
|
|||||||
private String province;
|
private String province;
|
||||||
|
|
||||||
@Schema(description = "企业ID")
|
@Schema(description = "企业ID")
|
||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
|
|
||||||
|
@Schema(description = "企业名称")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String companyName;
|
||||||
|
|
||||||
@Schema(description = "所属企业名称")
|
@Schema(description = "所属企业名称")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
|
|||||||
@@ -33,13 +33,13 @@ public class CreditExternal implements Serializable {
|
|||||||
@Schema(description = "被投资企业名称")
|
@Schema(description = "被投资企业名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "企业状态(如存续、注销等)")
|
@Schema(description = "状态")
|
||||||
private String statusTxt;
|
private String statusTxt;
|
||||||
|
|
||||||
@Schema(description = "链接地址")
|
@Schema(description = "链接地址")
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
@Schema(description = "法定代表人姓名")
|
@Schema(description = "法定代表人")
|
||||||
private String legalRepresentative;
|
private String legalRepresentative;
|
||||||
|
|
||||||
@Schema(description = "注册资本(金额)")
|
@Schema(description = "注册资本(金额)")
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
<if test="param.companyId != null">
|
<if test="param.companyId != null">
|
||||||
AND a.company_id = #{param.companyId}
|
AND a.company_id = #{param.companyId}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.companyName != null">
|
<if test="param.name != null">
|
||||||
AND a.company_name LIKE CONCAT('%', #{param.companyName}, '%')
|
AND a.name LIKE CONCAT('%', #{param.name}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="param.legalRepresentative != null">
|
<if test="param.legalRepresentative != null">
|
||||||
AND a.legal_representative LIKE CONCAT('%', #{param.legalRepresentative}, '%')
|
AND a.legal_representative LIKE CONCAT('%', #{param.legalRepresentative}, '%')
|
||||||
@@ -64,6 +64,7 @@
|
|||||||
</if>
|
</if>
|
||||||
<if test="param.keywords != null">
|
<if test="param.keywords != null">
|
||||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
OR a.name = #{param.keywords}
|
||||||
OR b.name = #{param.keywords}
|
OR b.name = #{param.keywords}
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class CreditCompetitorImportParam implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Excel(name = "企业名称")
|
@Excel(name = "企业名称")
|
||||||
private String companyName;
|
private String name;
|
||||||
|
|
||||||
@Excel(name = "法定代表人")
|
@Excel(name = "法定代表人")
|
||||||
private String legalRepresentative;
|
private String legalRepresentative;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class CreditCompetitorParam extends BaseParam {
|
|||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@Schema(description = "企业名称")
|
@Schema(description = "企业名称")
|
||||||
private String companyName;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "法定代表人")
|
@Schema(description = "法定代表人")
|
||||||
private String legalRepresentative;
|
private String legalRepresentative;
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ public class CreditExternalImportParam implements Serializable {
|
|||||||
@Excel(name = "被投资企业名称")
|
@Excel(name = "被投资企业名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Excel(name = "企业状态")
|
@Excel(name = "状态")
|
||||||
private String statusTxt;
|
private String statusTxt;
|
||||||
|
|
||||||
@Excel(name = "法定代表人姓名")
|
@Excel(name = "法定代表人")
|
||||||
private String legalRepresentative;
|
private String legalRepresentative;
|
||||||
|
|
||||||
@Excel(name = "注册资本")
|
@Excel(name = "注册资本")
|
||||||
|
|||||||
Reference in New Issue
Block a user