fix: 老法规导入接口 状态代替被代替问题修复
This commit is contained in:
+69
-14
@@ -179,6 +179,8 @@ public class OldSystemServiceImpl implements OldSystemService {
|
|||||||
this.oldSysFBImport(allDatalist, errImportList);
|
this.oldSysFBImport(allDatalist, errImportList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// 统一清理代替被代替重复数据
|
||||||
|
lawsReplacedStandardService.clearRepeatData();
|
||||||
if (!errImportList.isEmpty()) {
|
if (!errImportList.isEmpty()) {
|
||||||
this.exportWithExcel(response, errImportList, "OldSystemStandardErrorData.xls");
|
this.exportWithExcel(response, errImportList, "OldSystemStandardErrorData.xls");
|
||||||
}
|
}
|
||||||
@@ -591,7 +593,14 @@ public class OldSystemServiceImpl implements OldSystemService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String standardState = dto.getBzzt();
|
String standardState = dto.getBzzt();
|
||||||
fb.setStandardState(standardState.equals("现行有效") ? "6" : "7");
|
switch (standardState) {
|
||||||
|
case "现行有效":
|
||||||
|
fb.setStandardState("6");
|
||||||
|
break;
|
||||||
|
case "作废":
|
||||||
|
fb.setStandardState("7");
|
||||||
|
break;
|
||||||
|
}
|
||||||
// 代替被代替特殊逻辑
|
// 代替被代替特殊逻辑
|
||||||
fb.setSubstituteStandardNumber(dto.getTdbzh());
|
fb.setSubstituteStandardNumber(dto.getTdbzh());
|
||||||
fb.setReplacedByStandardNumber(dto.getBtdbzh());
|
fb.setReplacedByStandardNumber(dto.getBtdbzh());
|
||||||
@@ -677,6 +686,16 @@ public class OldSystemServiceImpl implements OldSystemService {
|
|||||||
// 4. 遍历待保存或更新的列表,设置ID
|
// 4. 遍历待保存或更新的列表,设置ID
|
||||||
StringBuilder oldIds = new StringBuilder();
|
StringBuilder oldIds = new StringBuilder();
|
||||||
StringBuilder newIds = new StringBuilder();
|
StringBuilder newIds = new StringBuilder();
|
||||||
|
// 获取所有相关标准号
|
||||||
|
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 entity : fbList) {
|
for (LawsOverseasStandard entity : fbList) {
|
||||||
LawsOverseasStandard existingEntity = standardNumberToEntityMap.get(entity.getStandardNumber());
|
LawsOverseasStandard existingEntity = standardNumberToEntityMap.get(entity.getStandardNumber());
|
||||||
if (existingEntity != null) {
|
if (existingEntity != null) {
|
||||||
@@ -692,20 +711,18 @@ public class OldSystemServiceImpl implements OldSystemService {
|
|||||||
|
|
||||||
entity.setId(existingEntity.getId());
|
entity.setId(existingEntity.getId());
|
||||||
}
|
}
|
||||||
|
String standardNumber = entity.getStandardNumber();
|
||||||
String tdbzh = entity.getSubstituteStandardNumber();
|
String tdbzh = entity.getSubstituteStandardNumber();
|
||||||
String btdbzh = entity.getReplacedByStandardNumber();
|
String btdbzh = entity.getReplacedByStandardNumber();
|
||||||
// 代替标准号
|
// 代替标准号
|
||||||
// 先删除已经存储的关联
|
// 先删除已经存储的关联
|
||||||
String standardNumber = entity.getStandardNumber();
|
|
||||||
if (StringUtils.isNotBlank(tdbzh)) {
|
if (StringUtils.isNotBlank(tdbzh)) {
|
||||||
lawsReplacedStandardService.removeRelation(standardNumber, 1);
|
|
||||||
lawsReplacedStandardService.addRelationOldSystemSync(tdbzh, standardNumber, 1);
|
lawsReplacedStandardService.addRelationOldSystemSync(tdbzh, standardNumber, 1);
|
||||||
}
|
}
|
||||||
// 被代替标准号
|
// 被代替标准号
|
||||||
if (StringUtils.isNotBlank(btdbzh)) {
|
if (StringUtils.isNotBlank(btdbzh)) {
|
||||||
List<String> replaceCodeList = Arrays.asList(btdbzh.split(","));
|
List<String> replaceCodeList = Arrays.asList(btdbzh.split(","));
|
||||||
replaceCodeList.forEach(replaceCode -> {
|
replaceCodeList.forEach(replaceCode -> {
|
||||||
lawsReplacedStandardService.removeRelation(replaceCode, 1);
|
|
||||||
lawsReplacedStandardService.addRelationOldSystemSync(standardNumber, replaceCode, 1);
|
lawsReplacedStandardService.addRelationOldSystemSync(standardNumber, replaceCode, 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1292,7 +1309,6 @@ public class OldSystemServiceImpl implements OldSystemService {
|
|||||||
log.info("企标体系导入结束");
|
log.info("企标体系导入结束");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 在您的类中添加这个方法
|
|
||||||
private String buildPathToRoot(String nodeId, Map<String, LawsTreeNode> nodeIdMap) {
|
private String buildPathToRoot(String nodeId, Map<String, LawsTreeNode> nodeIdMap) {
|
||||||
// 获取当前节点
|
// 获取当前节点
|
||||||
LawsTreeNode currentNode = nodeIdMap.get(nodeId);
|
LawsTreeNode currentNode = nodeIdMap.get(nodeId);
|
||||||
@@ -1536,7 +1552,17 @@ public class OldSystemServiceImpl implements OldSystemService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String standardState = dto.getBzzt();
|
String standardState = dto.getBzzt();
|
||||||
gb.setStandardState(standardState.equals("现行有效") ? "6" : "7");
|
switch (standardState) {
|
||||||
|
case "现行有效":
|
||||||
|
gb.setStandardState("6");
|
||||||
|
break;
|
||||||
|
case "作废":
|
||||||
|
gb.setStandardState("7");
|
||||||
|
break;
|
||||||
|
case "预发布":
|
||||||
|
gb.setStandardState("4");
|
||||||
|
break;
|
||||||
|
}
|
||||||
// 代替被代替特殊逻辑
|
// 代替被代替特殊逻辑
|
||||||
gb.setSubstituteStandardNumber(dto.getTdbzh());
|
gb.setSubstituteStandardNumber(dto.getTdbzh());
|
||||||
gb.setReplacedByStandardNumber(dto.getBtdbzh());
|
gb.setReplacedByStandardNumber(dto.getBtdbzh());
|
||||||
@@ -1618,6 +1644,17 @@ public class OldSystemServiceImpl implements OldSystemService {
|
|||||||
// 4. 遍历待保存或更新的列表,设置ID
|
// 4. 遍历待保存或更新的列表,设置ID
|
||||||
StringBuilder oldIds = new StringBuilder();
|
StringBuilder oldIds = new StringBuilder();
|
||||||
StringBuilder newIds = new StringBuilder();
|
StringBuilder newIds = new StringBuilder();
|
||||||
|
|
||||||
|
// 获取所有相关标准号
|
||||||
|
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 entity : gbList) {
|
for (LawsDomesticStandard entity : gbList) {
|
||||||
LawsDomesticStandard existingEntity = standardNumberToEntityMap.get(entity.getStandardNumber());
|
LawsDomesticStandard existingEntity = standardNumberToEntityMap.get(entity.getStandardNumber());
|
||||||
if (existingEntity != null) {
|
if (existingEntity != null) {
|
||||||
@@ -1639,14 +1676,12 @@ public class OldSystemServiceImpl implements OldSystemService {
|
|||||||
// 先删除已经存储的关联
|
// 先删除已经存储的关联
|
||||||
String standardNumber = entity.getStandardNumber();
|
String standardNumber = entity.getStandardNumber();
|
||||||
if (StringUtils.isNotBlank(tdbzh)) {
|
if (StringUtils.isNotBlank(tdbzh)) {
|
||||||
lawsReplacedStandardService.removeRelation(standardNumber, 1);
|
|
||||||
lawsReplacedStandardService.addRelationOldSystemSync(tdbzh, standardNumber, 1);
|
lawsReplacedStandardService.addRelationOldSystemSync(tdbzh, standardNumber, 1);
|
||||||
}
|
}
|
||||||
// 被代替标准号
|
// 被代替标准号
|
||||||
if (StringUtils.isNotBlank(btdbzh)) {
|
if (StringUtils.isNotBlank(btdbzh)) {
|
||||||
List<String> replaceCodeList = Arrays.asList(btdbzh.split(","));
|
List<String> replaceCodeList = Arrays.asList(btdbzh.split(","));
|
||||||
replaceCodeList.forEach(replaceCode -> {
|
replaceCodeList.forEach(replaceCode -> {
|
||||||
lawsReplacedStandardService.removeRelation(replaceCode, 1);
|
|
||||||
lawsReplacedStandardService.addRelationOldSystemSync(standardNumber, replaceCode, 1);
|
lawsReplacedStandardService.addRelationOldSystemSync(standardNumber, replaceCode, 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1750,7 +1785,20 @@ public class OldSystemServiceImpl implements OldSystemService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String standardState = dto.getBzzt();
|
String standardState = dto.getBzzt();
|
||||||
es.setStandardState(standardState.equals("现行有效") ? "6" : "7");
|
switch (standardState) {
|
||||||
|
case "现行有效":
|
||||||
|
es.setStandardState("8");
|
||||||
|
break;
|
||||||
|
case "作废":
|
||||||
|
es.setStandardState("9");
|
||||||
|
break;
|
||||||
|
case "封存":
|
||||||
|
es.setStandardState("A");
|
||||||
|
break;
|
||||||
|
case "预发布":
|
||||||
|
es.setStandardState("5");
|
||||||
|
break;
|
||||||
|
}
|
||||||
es.setGradeClassification(null);
|
es.setGradeClassification(null);
|
||||||
// 代替被代替特殊逻辑
|
// 代替被代替特殊逻辑
|
||||||
es.setSubstituteStandardNumber(dto.getTdbzh());
|
es.setSubstituteStandardNumber(dto.getTdbzh());
|
||||||
@@ -1828,8 +1876,18 @@ public class OldSystemServiceImpl implements OldSystemService {
|
|||||||
// 4. 遍历待保存或更新的列表,设置ID
|
// 4. 遍历待保存或更新的列表,设置ID
|
||||||
StringBuilder oldIds = new StringBuilder();
|
StringBuilder oldIds = new StringBuilder();
|
||||||
StringBuilder newIds = new StringBuilder();
|
StringBuilder newIds = new StringBuilder();
|
||||||
|
|
||||||
|
// 获取所有相关标准号
|
||||||
|
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 entity : esList) {
|
for (LawsEnterpriseStandard entity : esList) {
|
||||||
String curStandardNumber = entity.getStandardNumber();
|
|
||||||
LawsEnterpriseStandard existingEntity = standardNumberToEntityMap.get(entity.getStandardNumber());
|
LawsEnterpriseStandard existingEntity = standardNumberToEntityMap.get(entity.getStandardNumber());
|
||||||
if (existingEntity != null) {
|
if (existingEntity != null) {
|
||||||
// 如果存在执行更新操作
|
// 如果存在执行更新操作
|
||||||
@@ -1844,20 +1902,17 @@ public class OldSystemServiceImpl implements OldSystemService {
|
|||||||
|
|
||||||
entity.setId(existingEntity.getId());
|
entity.setId(existingEntity.getId());
|
||||||
}
|
}
|
||||||
|
String standardNumber = entity.getStandardNumber();
|
||||||
String tdbzh = entity.getSubstituteStandardNumber();
|
String tdbzh = entity.getSubstituteStandardNumber();
|
||||||
String btdbzh = entity.getReplacedByStandardNumber();
|
String btdbzh = entity.getReplacedByStandardNumber();
|
||||||
// 代替标准号
|
// 代替标准号
|
||||||
// 先删除已经存储的关联
|
|
||||||
String standardNumber = entity.getStandardNumber();
|
|
||||||
if (StringUtils.isNotBlank(tdbzh)) {
|
if (StringUtils.isNotBlank(tdbzh)) {
|
||||||
lawsReplacedStandardService.removeRelation(standardNumber, 1);
|
|
||||||
lawsReplacedStandardService.addRelationOldSystemSync(tdbzh, standardNumber, 1);
|
lawsReplacedStandardService.addRelationOldSystemSync(tdbzh, standardNumber, 1);
|
||||||
}
|
}
|
||||||
// 被代替标准号
|
// 被代替标准号
|
||||||
if (StringUtils.isNotBlank(btdbzh)) {
|
if (StringUtils.isNotBlank(btdbzh)) {
|
||||||
List<String> replaceCodeList = Arrays.asList(btdbzh.split(","));
|
List<String> replaceCodeList = Arrays.asList(btdbzh.split(","));
|
||||||
replaceCodeList.forEach(replaceCode -> {
|
replaceCodeList.forEach(replaceCode -> {
|
||||||
lawsReplacedStandardService.removeRelation(replaceCode, 1);
|
|
||||||
lawsReplacedStandardService.addRelationOldSystemSync(standardNumber, replaceCode, 1);
|
lawsReplacedStandardService.addRelationOldSystemSync(standardNumber, replaceCode, 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user