wangliang 1 năm trước cách đây
mục cha
commit
a58767fb9c

+ 1 - 0
distributed-print/src/main/java/com/qmth/distributed/print/api/TCPaperStructController.java

@@ -151,6 +151,7 @@ public class TCPaperStructController {
             }
             List<PaperStructDimensionResult> paperStructDimensionResultList = paperStructParams.getPaperStruct();
             Double score = paperStructDimensionResultList.stream().filter(s -> Objects.equals(s.getCourseTargetName(), c.getCourseTargetName())).mapToDouble(PaperStructDimensionResult::getScore).sum();
+            Objects.requireNonNull(c.getTotalWeight(), "[" + c.getCourseTargetName() + "]未设置权重");
             if (new BigDecimal(score).compareTo(c.getTotalWeight()) == 1) {
                 throw ExceptionResultEnum.ERROR.exception("[" + c.getCourseTargetName() + "]知识点小题总分大于该课程目标分,请重新设置");
             }

+ 6 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/TRBasicInfoController.java

@@ -122,6 +122,7 @@ public class TRBasicInfoController {
             }.getType());
             for (CourseWeightDto c : courseWeightResult.getSubmitForm()) {
                 Double score = paperStructDimensionResultList.stream().filter(s -> Objects.equals(s.getCourseTargetName(), c.getCourseTargetName())).mapToDouble(PaperStructDimensionResult::getScore).sum();
+                Objects.requireNonNull(c.getTotalWeight(), "[" + c.getCourseTargetName() + "]未设置权重");
                 if (new BigDecimal(score).compareTo(c.getTotalWeight()) == 1) {
                     trBasicInfoService.clearReportData(examId, courseCode, paperNumber, false);
                     throw ExceptionResultEnum.ERROR.exception("[" + c.getCourseTargetName() + "]知识点小题总分大于该课程目标分,请重新设置");
@@ -203,6 +204,7 @@ public class TRBasicInfoController {
                 }.getType());
                 for (CourseWeightDto c : courseWeightResult.getSubmitForm()) {
                     Double score = paperStructDimensionResultList.stream().filter(s -> Objects.equals(s.getCourseTargetName(), c.getCourseTargetName())).mapToDouble(PaperStructDimensionResult::getScore).sum();
+                    Objects.requireNonNull(c.getTotalWeight(), "[" + c.getCourseTargetName() + "]未设置权重");
                     if (new BigDecimal(score).compareTo(c.getTotalWeight()) == 1) {
                         trBasicInfoService.clearReportData(examId, courseCode, paperNumber, false);
                         throw ExceptionResultEnum.ERROR.exception("[" + c.getCourseTargetName() + "]知识点小题总分大于该课程目标分,请重新设置");
@@ -347,7 +349,10 @@ public class TRBasicInfoController {
                     StringJoiner stringJoiner = new StringJoiner("");
                     for (CourseWeightDto c : courseWeightDtoList) {
                         Double score = paperStructDimensionResultList.stream().filter(s -> Objects.equals(s.getCourseTargetName(), c.getCourseTargetName())).mapToDouble(PaperStructDimensionResult::getScore).sum();
-                        if (new BigDecimal(score).compareTo(c.getTotalWeight()) == 1) {
+                        if (Objects.isNull(c.getTotalWeight())) {
+                            reportChangeResult.setTargetScoreChange(true);
+                            stringJoiner.add("[").add(c.getCourseTargetName()).add("]").add("未设置权重").add("\r\n");
+                        } else if (new BigDecimal(score).compareTo(c.getTotalWeight()) == 1) {
                             reportChangeResult.setTargetScoreChange(true);
                             stringJoiner.add("[").add(c.getCourseTargetName()).add("]").add("知识点小题总分大于该课程目标分,请重新设置").add("\r\n");
                         }