|
@@ -209,65 +209,66 @@ public class TCPaperStructServiceImpl extends ServiceImpl<TCPaperStructMapper, T
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
StringJoiner errorData = new StringJoiner("");
|
|
|
StringJoiner successData = new StringJoiner("");
|
|
|
- List<PaperStructDimensionResult> paperStructDimensionResultList = courseTargetService.findTikuPaperStruct(teachCourseId,paperNumber);
|
|
|
- if (!CollectionUtils.isEmpty(paperStructDimensionResultList)) {
|
|
|
- List<String> paperStructList = new ArrayList<>(paperStructDimensionResultList.size()), paperStructDbList = new ArrayList<>(paperStructDimensionResultList.size());
|
|
|
- for (PaperStructDimensionResult p : paperStructDimensionResultList) {
|
|
|
- Objects.requireNonNull(p.getMainNumber(), "大题号为空");
|
|
|
- Objects.requireNonNull(p.getSubNumber(), "小题号为空");
|
|
|
- if (!CollectionUtils.isEmpty(p.getTargetList()) && p.getTargetList().size() > 1) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("一个题只能属于一个目标");
|
|
|
- }
|
|
|
- paperStructList.add(p.getMainNumber() + "_" + p.getSubNumber() + "_" + p.getScore());
|
|
|
+ List<PaperStructDimensionResult> paperStructDimensionResultList = courseTargetService.findTikuPaperStruct(teachCourseId, paperNumber);
|
|
|
+ if (CollectionUtils.isEmpty(paperStructDimensionResultList)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未查询到题和知识点对应关系请手动关联");
|
|
|
+ }
|
|
|
+ List<String> paperStructList = new ArrayList<>(paperStructDimensionResultList.size()), paperStructDbList = new ArrayList<>(paperStructDimensionResultList.size());
|
|
|
+ for (PaperStructDimensionResult p : paperStructDimensionResultList) {
|
|
|
+ Objects.requireNonNull(p.getMainNumber(), "大题号为空");
|
|
|
+ Objects.requireNonNull(p.getSubNumber(), "小题号为空");
|
|
|
+ if (!CollectionUtils.isEmpty(p.getTargetList()) && p.getTargetList().size() > 1) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("一个题只能属于一个目标");
|
|
|
}
|
|
|
- successData.add("共同步").add(paperStructDimensionResultList.size() + "").add("条数据");
|
|
|
- TCPaperStruct tcPaperStructDb = tcPaperStructService.queryPaperStruct(examId, courseCode, paperNumber, teachCourseId);
|
|
|
- TCPaperStruct tcPaperStruct = null;
|
|
|
- if (Objects.nonNull(tcPaperStructDb) && Objects.nonNull(tcPaperStructDb.getPaperStructDimension())) {
|
|
|
- tcPaperStruct = new TCPaperStruct();
|
|
|
- BeanUtils.copyProperties(tcPaperStructDb, tcPaperStruct);
|
|
|
- tcPaperStruct.setPaperStructDimension(JacksonUtil.parseJson(paperStructDimensionResultList));
|
|
|
-
|
|
|
- if (Objects.nonNull(tcPaperStructDb.getPaperStruct())) {
|
|
|
- List<PaperStructDto> paperStructDtoList = GsonUtil.fromJson(tcPaperStruct.getPaperStruct(), new TypeToken<List<PaperStructDto>>() {
|
|
|
- }.getType());
|
|
|
- paperStructDbList = paperStructDtoList.stream().map(e -> e.getMainNumber() + "_" + e.getSubNumber() + "_" + e.getScore()).collect(Collectors.toList());
|
|
|
- } else {
|
|
|
- List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
|
|
|
- if (CollectionUtils.isEmpty(markQuestionList)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("未找到试卷结构");
|
|
|
- }
|
|
|
- paperStructDbList = markQuestionList.stream().map(e -> e.getMainNumber() + "_" + e.getSubNumber() + "_" + e.getTotalScore()).collect(Collectors.toList());
|
|
|
- }
|
|
|
- if (!CollectionUtils.isEmpty(paperStructDbList) && !CollectionUtils.isEmpty(paperStructList) && !CollectionUtils.isEqualCollection(paperStructDbList, paperStructList)) {
|
|
|
- Collections.sort(paperStructDbList);
|
|
|
- Collections.sort(paperStructList);
|
|
|
+ paperStructList.add(p.getMainNumber() + "_" + p.getSubNumber() + "_" + p.getScore());
|
|
|
+ }
|
|
|
+ successData.add("共同步").add(paperStructDimensionResultList.size() + "").add("条数据");
|
|
|
+ TCPaperStruct tcPaperStructDb = tcPaperStructService.queryPaperStruct(examId, courseCode, paperNumber, teachCourseId);
|
|
|
+ TCPaperStruct tcPaperStruct = null;
|
|
|
+ if (Objects.nonNull(tcPaperStructDb) && Objects.nonNull(tcPaperStructDb.getPaperStructDimension())) {
|
|
|
+ tcPaperStruct = new TCPaperStruct();
|
|
|
+ BeanUtils.copyProperties(tcPaperStructDb, tcPaperStruct);
|
|
|
+ tcPaperStruct.setPaperStructDimension(JacksonUtil.parseJson(paperStructDimensionResultList));
|
|
|
|
|
|
- tcFinalScoreService.remove(examId, courseCode, paperNumber, teachCourseId);
|
|
|
- trBasicInfoService.clearReportData(examId, courseCode, paperNumber, teachCourseId, false);
|
|
|
- tcPaperStruct.setPaperStruct(null);
|
|
|
- }
|
|
|
- tcPaperStruct.updateInfo(sysUser.getId());
|
|
|
+ if (Objects.nonNull(tcPaperStructDb.getPaperStruct())) {
|
|
|
+ List<PaperStructDto> paperStructDtoList = GsonUtil.fromJson(tcPaperStruct.getPaperStruct(), new TypeToken<List<PaperStructDto>>() {
|
|
|
+ }.getType());
|
|
|
+ paperStructDbList = paperStructDtoList.stream().map(e -> e.getMainNumber() + "_" + e.getSubNumber() + "_" + e.getScore()).collect(Collectors.toList());
|
|
|
} else {
|
|
|
- tcPaperStructService.remove(examId, courseCode, paperNumber, teachCourseId);
|
|
|
- MarkPaper markPaper = printCommonService.getMarkPaper(examId, courseCode, paperNumber);
|
|
|
- CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(teachCourseId);
|
|
|
- tcPaperStruct = new TCPaperStruct(examId, courseCode, markPaper.getCourseName(), paperNumber, teachCourseId, JacksonUtil.parseJson(paperStructDimensionResultList), sysUser.getId(), courseWeightResult.getDimensionSign());
|
|
|
List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
|
|
|
if (CollectionUtils.isEmpty(markQuestionList)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到试卷结构");
|
|
|
}
|
|
|
paperStructDbList = markQuestionList.stream().map(e -> e.getMainNumber() + "_" + e.getSubNumber() + "_" + e.getTotalScore()).collect(Collectors.toList());
|
|
|
- if (!CollectionUtils.isEmpty(paperStructDbList) && !CollectionUtils.isEmpty(paperStructList) && !CollectionUtils.isEqualCollection(paperStructDbList, paperStructList)) {
|
|
|
- Collections.sort(paperStructDbList);
|
|
|
- Collections.sort(paperStructList);
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(paperStructDbList) && !CollectionUtils.isEmpty(paperStructList) && !CollectionUtils.isEqualCollection(paperStructDbList, paperStructList)) {
|
|
|
+ Collections.sort(paperStructDbList);
|
|
|
+ Collections.sort(paperStructList);
|
|
|
|
|
|
- tcFinalScoreService.remove(examId, courseCode, paperNumber, teachCourseId);
|
|
|
- trBasicInfoService.clearReportData(examId, courseCode, paperNumber, teachCourseId, false);
|
|
|
- }
|
|
|
+ tcFinalScoreService.remove(examId, courseCode, paperNumber, teachCourseId);
|
|
|
+ trBasicInfoService.clearReportData(examId, courseCode, paperNumber, teachCourseId, false);
|
|
|
+ tcPaperStruct.setPaperStruct(null);
|
|
|
+ }
|
|
|
+ tcPaperStruct.updateInfo(sysUser.getId());
|
|
|
+ } else {
|
|
|
+ tcPaperStructService.remove(examId, courseCode, paperNumber, teachCourseId);
|
|
|
+ MarkPaper markPaper = printCommonService.getMarkPaper(examId, courseCode, paperNumber);
|
|
|
+ CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(teachCourseId);
|
|
|
+ tcPaperStruct = new TCPaperStruct(examId, courseCode, markPaper.getCourseName(), paperNumber, teachCourseId, JacksonUtil.parseJson(paperStructDimensionResultList), sysUser.getId(), courseWeightResult.getDimensionSign());
|
|
|
+ List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
|
|
|
+ if (CollectionUtils.isEmpty(markQuestionList)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未找到试卷结构");
|
|
|
+ }
|
|
|
+ paperStructDbList = markQuestionList.stream().map(e -> e.getMainNumber() + "_" + e.getSubNumber() + "_" + e.getTotalScore()).collect(Collectors.toList());
|
|
|
+ if (!CollectionUtils.isEmpty(paperStructDbList) && !CollectionUtils.isEmpty(paperStructList) && !CollectionUtils.isEqualCollection(paperStructDbList, paperStructList)) {
|
|
|
+ Collections.sort(paperStructDbList);
|
|
|
+ Collections.sort(paperStructList);
|
|
|
+
|
|
|
+ tcFinalScoreService.remove(examId, courseCode, paperNumber, teachCourseId);
|
|
|
+ trBasicInfoService.clearReportData(examId, courseCode, paperNumber, teachCourseId, false);
|
|
|
}
|
|
|
- tcPaperStructService.saveOrUpdate(tcPaperStruct);
|
|
|
}
|
|
|
+ tcPaperStructService.saveOrUpdate(tcPaperStruct);
|
|
|
messageMap.put(SystemConstant.SUCCESS, successData.length() > 0 ? successData.toString() : "无");
|
|
|
messageMap.put(SystemConstant.EXCEL_ERROR, errorData.length() > 0 ? errorData.toString() : "无");
|
|
|
} catch (Exception e) {
|