fix: 老法规导入代替标准号数据修复BUG
This commit is contained in:
+31
-8
@@ -25,10 +25,7 @@ import com.jero.modules.laws.home.service.ILawsHomeSearchService;
|
||||
import com.jero.modules.laws.oldSystem.entity.*;
|
||||
import com.jero.modules.laws.oldSystem.service.OldSystemDepartRelationService;
|
||||
import com.jero.modules.laws.oldSystem.service.OldSystemService;
|
||||
import com.jero.modules.laws.standard.entity.LawsDomesticStandard;
|
||||
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
|
||||
import com.jero.modules.laws.standard.entity.LawsOverseasStandard;
|
||||
import com.jero.modules.laws.standard.entity.LawsTreeNode;
|
||||
import com.jero.modules.laws.standard.entity.*;
|
||||
import com.jero.modules.laws.standard.mapper.LawsEnterpriseStandardMapper;
|
||||
import com.jero.modules.laws.standard.service.*;
|
||||
import com.jero.modules.laws.standard.util.StandardSplitUtils;
|
||||
@@ -282,6 +279,16 @@ public class OldSystemServiceImpl implements OldSystemService {
|
||||
List<LawsOverseasStandard> existingEntities = overseasStandardService.list();
|
||||
Map<String, LawsOverseasStandard> dataMap = existingEntities.stream()
|
||||
.collect(Collectors.toMap(LawsOverseasStandard::getStandardNumber, d -> d));
|
||||
// 获取所有相关标准号
|
||||
List<String> replaceStandardNoList = fbList.stream().map(LawsOverseasStandard::getStandardNumber).collect(Collectors.toList());
|
||||
replaceStandardNoList.addAll(fbList.stream().map(LawsOverseasStandard::getSubstituteStandardNumber).collect(Collectors.toList()));
|
||||
replaceStandardNoList.addAll(fbList.stream().map(LawsOverseasStandard::getReplacedByStandardNumber).collect(Collectors.toList()));
|
||||
// 清除所有外标
|
||||
LambdaQueryWrapper<LawsReplacedStandard> replacedStandardWrapper = new LambdaQueryWrapper<>();
|
||||
replacedStandardWrapper
|
||||
.in(LawsReplacedStandard::getReplaced, replaceStandardNoList).or()
|
||||
.in(LawsReplacedStandard::getReplacedBy, replaceStandardNoList);
|
||||
lawsReplacedStandardService.remove(replacedStandardWrapper);
|
||||
for (LawsOverseasStandard fb : fbList) {
|
||||
LawsOverseasStandard dbData = dataMap.get(fb.getStandardNumber());
|
||||
dbData.setStandardState(fb.getStandardState());
|
||||
@@ -290,7 +297,6 @@ public class OldSystemServiceImpl implements OldSystemService {
|
||||
// 代替标准号
|
||||
// 先删除已经存储的关联
|
||||
String standardNumber = dbData.getStandardNumber();
|
||||
lawsReplacedStandardService.removeRelation(standardNumber, 1);
|
||||
if (StringUtils.isNotBlank(tdbzh)) {
|
||||
lawsReplacedStandardService.addRelationOldSystemSync(tdbzh, standardNumber, 1);
|
||||
}
|
||||
@@ -298,7 +304,6 @@ public class OldSystemServiceImpl implements OldSystemService {
|
||||
if (StringUtils.isNotBlank(btdbzh)) {
|
||||
List<String> replaceCodeList = Arrays.asList(btdbzh.split(","));
|
||||
replaceCodeList.forEach(replaceCode -> {
|
||||
lawsReplacedStandardService.removeRelation(replaceCode, 1);
|
||||
lawsReplacedStandardService.addRelationOldSystemSync(standardNumber, replaceCode, 1);
|
||||
});
|
||||
}
|
||||
@@ -365,6 +370,16 @@ public class OldSystemServiceImpl implements OldSystemService {
|
||||
List<LawsDomesticStandard> existingEntities = domesticStandardService.list();
|
||||
Map<String, LawsDomesticStandard> dataMap = existingEntities.stream()
|
||||
.collect(Collectors.toMap(LawsDomesticStandard::getStandardNumber, d -> d));
|
||||
// 获取所有相关标准号
|
||||
List<String> replaceStandardNoList = gbList.stream().map(LawsDomesticStandard::getStandardNumber).collect(Collectors.toList());
|
||||
replaceStandardNoList.addAll(gbList.stream().map(LawsDomesticStandard::getSubstituteStandardNumber).collect(Collectors.toList()));
|
||||
replaceStandardNoList.addAll(gbList.stream().map(LawsDomesticStandard::getReplacedByStandardNumber).collect(Collectors.toList()));
|
||||
// 清除所有国标
|
||||
LambdaQueryWrapper<LawsReplacedStandard> replacedStandardWrapper = new LambdaQueryWrapper<>();
|
||||
replacedStandardWrapper
|
||||
.in(LawsReplacedStandard::getReplaced, replaceStandardNoList).or()
|
||||
.in(LawsReplacedStandard::getReplacedBy, replaceStandardNoList);
|
||||
lawsReplacedStandardService.remove(replacedStandardWrapper);
|
||||
for (LawsDomesticStandard gb : gbList) {
|
||||
LawsDomesticStandard dbData = dataMap.get(gb.getStandardNumber());
|
||||
dbData.setStandardState(gb.getStandardState());
|
||||
@@ -443,6 +458,16 @@ public class OldSystemServiceImpl implements OldSystemService {
|
||||
List<LawsEnterpriseStandard> existingEntities = esService.list();
|
||||
Map<String, LawsEnterpriseStandard> dataMap = existingEntities.stream()
|
||||
.collect(Collectors.toMap(LawsEnterpriseStandard::getOldSystemId, d -> d));
|
||||
// 获取所有相关标准号
|
||||
List<String> replaceStandardNoList = esList.stream().map(LawsEnterpriseStandard::getStandardNumber).collect(Collectors.toList());
|
||||
replaceStandardNoList.addAll(esList.stream().map(LawsEnterpriseStandard::getSubstituteStandardNumber).collect(Collectors.toList()));
|
||||
replaceStandardNoList.addAll(esList.stream().map(LawsEnterpriseStandard::getReplacedByStandardNumber).collect(Collectors.toList()));
|
||||
// 清除所有企标标
|
||||
LambdaQueryWrapper<LawsReplacedStandard> replacedStandardWrapper = new LambdaQueryWrapper<>();
|
||||
replacedStandardWrapper
|
||||
.in(LawsReplacedStandard::getReplaced, replaceStandardNoList).or()
|
||||
.in(LawsReplacedStandard::getReplacedBy, replaceStandardNoList);
|
||||
lawsReplacedStandardService.remove(replacedStandardWrapper);
|
||||
for (LawsEnterpriseStandard es : esList) {
|
||||
LawsEnterpriseStandard dbData = dataMap.get(es.getOldSystemId());
|
||||
dbData.setStandardState(es.getStandardState());
|
||||
@@ -451,7 +476,6 @@ public class OldSystemServiceImpl implements OldSystemService {
|
||||
// 代替标准号
|
||||
// 先删除已经存储的关联
|
||||
String standardNumber = dbData.getStandardNumber();
|
||||
lawsReplacedStandardService.removeRelation(standardNumber, 1);
|
||||
if (StringUtils.isNotBlank(tdbzh)) {
|
||||
lawsReplacedStandardService.addRelationOldSystemSync(tdbzh, standardNumber, 1);
|
||||
}
|
||||
@@ -459,7 +483,6 @@ public class OldSystemServiceImpl implements OldSystemService {
|
||||
if (StringUtils.isNotBlank(btdbzh)) {
|
||||
List<String> replaceCodeList = Arrays.asList(btdbzh.split(","));
|
||||
replaceCodeList.forEach(replaceCode -> {
|
||||
lawsReplacedStandardService.removeRelation(replaceCode, 1);
|
||||
lawsReplacedStandardService.addRelationOldSystemSync(standardNumber, replaceCode, 1);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user