feat: 注释掉ES同步逻辑 老法规改为覆盖导入

This commit is contained in:
2023-11-28 18:21:15 +08:00
parent 19cc74ae4c
commit df47bb51ad
2 changed files with 27 additions and 25 deletions
@@ -63,7 +63,7 @@ public class LawsEnterpriseStandard implements Serializable {
*/
@ApiModelProperty(value = "0表示未删除,1表示删除")
@TableLogic
private String delFlag;
private Integer delFlag;
/**
* 企标编号
@@ -326,8 +326,7 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
for (LawsDomesticStandard entity : gbList) {
LawsDomesticStandard existingEntity = standardNumberToEntityMap.get(entity.getStandardNumber());
if (existingEntity != null) {
// 如果存在,则先删后增
this.removeById(existingEntity.getId());
// 如果存在,则执行更新操作
// 删除替代
lawsReplacedStandardService.removeRelation(existingEntity.getStandardNumber(), 1);
// 删除文件关联
@@ -336,6 +335,8 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
ossFileService.remove(wrapper);
// 拼接老id
oldIds.append(existingEntity.getId()).append(",");
entity.setId(existingEntity.getId());
}
String tdbzh = entity.getSubstituteStandardNumber();
String btdbzh = entity.getReplacedByStandardNumber();
@@ -352,7 +353,7 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
}
entity.setSubstituteStandardNumber(null);
entity.setReplacedByStandardNumber(null);
domesticStandardService.save(entity);
domesticStandardService.saveOrUpdate(entity);
String standardId = entity.getId();
// 保存文件关联
OSSFile ossFile = standardNumberToFileMap.get(entity.getStandardNumber()).get(0);
@@ -367,15 +368,15 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
long executionTime = endTime - startTime;
log.info("代码执行时间:" + executionTime + " 毫秒");
// es中删除数据
if (oldIds.length() > 0) {
oldIds = new StringBuilder(oldIds.substring(0, oldIds.length() - 1));
lawsHomeSearchService.updateEsData(LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD, oldIds.toString(), LawsHomeSearchCommon.LAWS_ES_DELETE);
}
// 同步es数据库
if (newIds.length() > 0) {
newIds = new StringBuilder(newIds.substring(0, newIds.length() - 1));
lawsHomeSearchService.updateEsData(LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD, newIds.toString(), LawsHomeSearchCommon.LAWS_ES_ADD);
}
// if (oldIds.length() > 0) {
// oldIds = new StringBuilder(oldIds.substring(0, oldIds.length() - 1));
// lawsHomeSearchService.updateEsData(LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD, oldIds.toString(), LawsHomeSearchCommon.LAWS_ES_DELETE);
// }
// // 同步es数据库
// if (newIds.length() > 0) {
// newIds = new StringBuilder(newIds.substring(0, newIds.length() - 1));
// lawsHomeSearchService.updateEsData(LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD, newIds.toString(), LawsHomeSearchCommon.LAWS_ES_ADD);
// }
}
private void oldSysESImport(List<OldSystemImportDTO> esDatalist, List<OldSystemImportDTO> errImportList) {
@@ -478,8 +479,7 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
String curStandardNumber = entity.getStandardNumber();
LawsEnterpriseStandard existingEntity = standardNumberToEntityMap.get(entity.getStandardNumber());
if (existingEntity != null) {
// 如果存在,则先删后增
this.removeById(existingEntity.getId());
// 如果存在执行更新操作
// 代替
lawsReplacedStandardService.removeRelation(existingEntity.getStandardNumber(), 1);
// 删除文件关联
@@ -488,6 +488,8 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
ossFileService.remove(wrapper);
// 拼接老id
oldIds.append(existingEntity.getId()).append(",");
entity.setId(existingEntity.getId());
}
String tdbzh = entity.getSubstituteStandardNumber();
String btdbzh = entity.getReplacedByStandardNumber();
@@ -505,7 +507,7 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
entity.setSubstituteStandardNumber(null);
entity.setReplacedByStandardNumber(null);
// 保存标准
save(entity);
saveOrUpdate(entity);
// 保存文件关联
String standardId = entity.getId();
// 保存文件关联
@@ -526,15 +528,15 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
long executionTime = endTime - startTime;
log.info("代码执行时间:" + executionTime + " 毫秒");
// es中删除数据
if (oldIds.length() > 0) {
oldIds = new StringBuilder(oldIds.substring(0, oldIds.length() - 1));
lawsHomeSearchService.updateEsData(LawsHomeSearchCommon.LAWS_ENTERPRISE_STANDARD, oldIds.toString(), LawsHomeSearchCommon.LAWS_ES_DELETE);
}
// 同步es数据库
if (newIds.length() > 0) {
newIds = new StringBuilder(newIds.substring(0, newIds.length() - 1));
lawsHomeSearchService.updateEsData(LawsHomeSearchCommon.LAWS_ENTERPRISE_STANDARD, newIds.toString(), LawsHomeSearchCommon.LAWS_ES_ADD);
}
// if (oldIds.length() > 0) {
// oldIds = new StringBuilder(oldIds.substring(0, oldIds.length() - 1));
// lawsHomeSearchService.updateEsData(LawsHomeSearchCommon.LAWS_ENTERPRISE_STANDARD, oldIds.toString(), LawsHomeSearchCommon.LAWS_ES_DELETE);
// }
// // 同步es数据库
// if (newIds.length() > 0) {
// newIds = new StringBuilder(newIds.substring(0, newIds.length() - 1));
// lawsHomeSearchService.updateEsData(LawsHomeSearchCommon.LAWS_ENTERPRISE_STANDARD, newIds.toString(), LawsHomeSearchCommon.LAWS_ES_ADD);
// }
}
@Override