|
@@ -306,6 +306,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
|
|
} else if (code.length() > 20) {
|
|
} else if (code.length() > 20) {
|
|
msg.append(" 科目代码不能超过20个字符");
|
|
msg.append(" 科目代码不能超过20个字符");
|
|
}
|
|
}
|
|
|
|
+ imp.setCourseCode(code);
|
|
|
|
|
|
String name = trimAndNullIfBlank(line.getValue(1));
|
|
String name = trimAndNullIfBlank(line.getValue(1));
|
|
if (StringUtils.isBlank(name)) {
|
|
if (StringUtils.isBlank(name)) {
|
|
@@ -433,8 +434,12 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
|
|
}
|
|
}
|
|
|
|
|
|
private void saveStruct(List<PaperStructInfoVo> cards, User user, List<String> failRecords) {
|
|
private void saveStruct(List<PaperStructInfoVo> cards, User user, List<String> failRecords) {
|
|
|
|
+ Map<Long,String> map=new HashMap<>();
|
|
|
|
+ for(PaperStructInfoVo vo:cards) {
|
|
|
|
+ map.put(vo.getPaperId(), vo.getCourseCode());
|
|
|
|
+ }
|
|
List<StructDomain> ces = getBeans(cards);
|
|
List<StructDomain> ces = getBeans(cards);
|
|
- checkStruct(ces, failRecords);
|
|
|
|
|
|
+ checkStruct(ces, failRecords,map);
|
|
if (CollectionUtils.isNotEmpty(failRecords)) {
|
|
if (CollectionUtils.isNotEmpty(failRecords)) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -442,27 +447,26 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
|
|
try {
|
|
try {
|
|
paperDetailService.structSubmit(domain, user);
|
|
paperDetailService.structSubmit(domain, user);
|
|
} catch (StatusException e) {
|
|
} catch (StatusException e) {
|
|
- failRecords.add(e.getMessage());
|
|
|
|
|
|
+ failRecords.add("科目:"+map.get(domain.getPaperId())+" "+e.getMessage());
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
throw new RuntimeException("系统错误", e);
|
|
throw new RuntimeException("系统错误", e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private void checkStruct(List<StructDomain> ces, List<String> failRecords) {
|
|
|
|
- Map<Long, String> courseMap = new HashMap<>();
|
|
|
|
|
|
+ private void checkStruct(List<StructDomain> ces, List<String> failRecords,Map<Long,String> courseMap) {
|
|
for (StructDomain card : ces) {
|
|
for (StructDomain card : ces) {
|
|
int lastDetailNum = 0;
|
|
int lastDetailNum = 0;
|
|
for (PaperDetail detail : card.getStructInfo()) {
|
|
for (PaperDetail detail : card.getStructInfo()) {
|
|
if (detail.getNumber() - lastDetailNum != 1) {
|
|
if (detail.getNumber() - lastDetailNum != 1) {
|
|
failRecords.add(
|
|
failRecords.add(
|
|
- "科目:" + getCourseCode(courseMap, card.getPaperId()) + ",大题号" + detail.getNumber() + "错误");
|
|
|
|
|
|
+ "科目:" + courseMap.get(card.getPaperId()) + ",大题号" + detail.getNumber() + "错误");
|
|
}
|
|
}
|
|
lastDetailNum = detail.getNumber();
|
|
lastDetailNum = detail.getNumber();
|
|
int lastUnitNum = 0;
|
|
int lastUnitNum = 0;
|
|
for (PaperDetailUnit unit : detail.getUnits()) {
|
|
for (PaperDetailUnit unit : detail.getUnits()) {
|
|
if (unit.getNumber() - lastUnitNum != 1) {
|
|
if (unit.getNumber() - lastUnitNum != 1) {
|
|
- failRecords.add("科目:" + getCourseCode(courseMap, card.getPaperId()) + ",大题号:"
|
|
|
|
|
|
+ failRecords.add("科目:" + courseMap.get(card.getPaperId()) + ",大题号:"
|
|
+ detail.getNumber() + ",小题号" + unit.getNumber() + "错误");
|
|
+ detail.getNumber() + ",小题号" + unit.getNumber() + "错误");
|
|
}
|
|
}
|
|
lastUnitNum = unit.getNumber();
|
|
lastUnitNum = unit.getNumber();
|
|
@@ -471,15 +475,6 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private String getCourseCode(Map<Long, String> courseMap, Long paperId) {
|
|
|
|
- if (courseMap.get(paperId) != null) {
|
|
|
|
- return courseMap.get(paperId);
|
|
|
|
- }
|
|
|
|
- String code = courseService.getById(this.getById(paperId).getCourseId()).getCode();
|
|
|
|
- courseMap.put(paperId, code);
|
|
|
|
- return code;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private List<StructDomain> getBeans(List<PaperStructInfoVo> cards) {
|
|
private List<StructDomain> getBeans(List<PaperStructInfoVo> cards) {
|
|
cards.sort(new Comparator<PaperStructInfoVo>() {
|
|
cards.sort(new Comparator<PaperStructInfoVo>() {
|
|
@Override
|
|
@Override
|