update:修改法规释疑库
This commit is contained in:
+32
-3
@@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -73,12 +74,35 @@ public class LawsRegulationsQuestionLibraryServiceImpl extends ServiceImpl<LawsR
|
|||||||
lawsRegulationsQuestionLibrary.setWriter(loginUser.getId());
|
lawsRegulationsQuestionLibrary.setWriter(loginUser.getId());
|
||||||
// 编辑后更新创建时间为最新时间,让其排在最前面
|
// 编辑后更新创建时间为最新时间,让其排在最前面
|
||||||
lawsRegulationsQuestionLibrary.setCreateTime(new Date());
|
lawsRegulationsQuestionLibrary.setCreateTime(new Date());
|
||||||
|
// 校验标准和法规
|
||||||
|
String res = checkStandardAndRegulation(lawsRegulationsQuestionLibrary);
|
||||||
|
if (StringUtils.isNotBlank(res)) {
|
||||||
|
List<String> resList = Arrays.asList(res.split(","));
|
||||||
|
List<String> regulationIdList = StringUtils.isNotBlank(lawsRegulationsQuestionLibrary.getRegulationId())
|
||||||
|
? new ArrayList<>(Arrays.asList(lawsRegulationsQuestionLibrary.getRegulationId().split(",")))
|
||||||
|
: new ArrayList<>();
|
||||||
|
List<String> regulationNumberList = StringUtils.isNotBlank(lawsRegulationsQuestionLibrary.getRegulationNumber())
|
||||||
|
? new ArrayList<>(Arrays.asList(lawsRegulationsQuestionLibrary.getRegulationNumber().split(",")))
|
||||||
|
: new ArrayList<>();
|
||||||
|
// 使用Iterator避免ConcurrentModificationException
|
||||||
|
Iterator<String> numberIterator = regulationNumberList.iterator();
|
||||||
|
Iterator<String> idIterator = regulationIdList.iterator();
|
||||||
|
while (numberIterator.hasNext() && idIterator.hasNext()) {
|
||||||
|
String regulationNumber = numberIterator.next();
|
||||||
|
idIterator.next(); // 移动idIterator,保证同步
|
||||||
|
if (resList.contains(regulationNumber)) {
|
||||||
|
numberIterator.remove();
|
||||||
|
idIterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lawsRegulationsQuestionLibrary.setRegulationId(String.join(",", regulationIdList));
|
||||||
|
lawsRegulationsQuestionLibrary.setRegulationNumber(String.join(",", regulationNumberList));
|
||||||
|
}
|
||||||
saveOrUpdate(lawsRegulationsQuestionLibrary); // 不影响数据的正常保存或更新
|
saveOrUpdate(lawsRegulationsQuestionLibrary); // 不影响数据的正常保存或更新
|
||||||
return Result.OK(ResultCommon.OK);
|
return Result.OK(ResultCommon.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private String checkStandardAndRegulation(LawsRegulationsQuestionLibrary lawsRegulationsQuestionLibrary) {
|
||||||
public Result<?> check(LawsRegulationsQuestionLibrary lawsRegulationsQuestionLibrary) {
|
|
||||||
// 校验标准编号和条款号是否存在,并给出提示信息
|
// 校验标准编号和条款号是否存在,并给出提示信息
|
||||||
List<RegulationVo> regulationList = lawsRegulationsQuestionLibrary.getRegulationList();
|
List<RegulationVo> regulationList = lawsRegulationsQuestionLibrary.getRegulationList();
|
||||||
List<LawsSplitByStandardNumber> lawsSplitByStandardNumbers = new ArrayList<>();
|
List<LawsSplitByStandardNumber> lawsSplitByStandardNumbers = new ArrayList<>();
|
||||||
@@ -89,7 +113,12 @@ public class LawsRegulationsQuestionLibraryServiceImpl extends ServiceImpl<LawsR
|
|||||||
lawsSplitByStandardNumber.setName(regulationVo.getStandardNumber() + " " + regulationVo.getItemNum());
|
lawsSplitByStandardNumber.setName(regulationVo.getStandardNumber() + " " + regulationVo.getItemNum());
|
||||||
lawsSplitByStandardNumbers.add(lawsSplitByStandardNumber);
|
lawsSplitByStandardNumbers.add(lawsSplitByStandardNumber);
|
||||||
}
|
}
|
||||||
String res = documentSplitService.checkStandardSplitInfo(lawsSplitByStandardNumbers);
|
return documentSplitService.checkStandardSplitInfo(lawsSplitByStandardNumbers);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<?> check(LawsRegulationsQuestionLibrary lawsRegulationsQuestionLibrary) {
|
||||||
|
String res = checkStandardAndRegulation(lawsRegulationsQuestionLibrary);
|
||||||
StringBuilder msg = new StringBuilder();
|
StringBuilder msg = new StringBuilder();
|
||||||
if (StringUtils.isNotBlank(res)) {
|
if (StringUtils.isNotBlank(res)) {
|
||||||
List<String> resList = Arrays.asList(res.split(","));
|
List<String> resList = Arrays.asList(res.split(","));
|
||||||
|
|||||||
Reference in New Issue
Block a user