瀏覽代碼

测试报告

wangliang 1 年之前
父節點
當前提交
f8f98343cd

+ 11 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/report/CourseTargetWebDto.java

@@ -55,6 +55,9 @@ public class CourseTargetWebDto implements Serializable, Comparable<CourseTarget
     @ApiModelProperty(value = "知识点集合")
     private String dimensionPoint;
 
+    @ApiModelProperty(value = "小题卷面总分")
+    private Double questionScoreSum = 0.0d;
+
     public CourseTargetWebDto() {
 
     }
@@ -68,6 +71,14 @@ public class CourseTargetWebDto implements Serializable, Comparable<CourseTarget
         this.targetSumScore = courseWeightDto.getTotalScore();
     }
 
+    public Double getQuestionScoreSum() {
+        return questionScoreSum;
+    }
+
+    public void setQuestionScoreSum(Double questionScoreSum) {
+        this.questionScoreSum = questionScoreSum;
+    }
+
     public String getDimensionPoint() {
         return dimensionPoint;
     }

+ 11 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/report/CourseTargetWordDto.java

@@ -57,6 +57,9 @@ public class CourseTargetWordDto implements Serializable, Comparable<CourseTarge
     @ApiModelProperty(value = "知识点集合")
     private String dimensionPoint;
 
+    @ApiModelProperty(value = "小题卷面总分")
+    private Double questionScoreSum = 0.0d;
+
     public CourseTargetWordDto() {
 
     }
@@ -70,6 +73,14 @@ public class CourseTargetWordDto implements Serializable, Comparable<CourseTarge
         this.targetSumWeight = courseWeightDto.getTotalWeight();
     }
 
+    public Double getQuestionScoreSum() {
+        return questionScoreSum;
+    }
+
+    public void setQuestionScoreSum(Double questionScoreSum) {
+        this.questionScoreSum = questionScoreSum;
+    }
+
     public String getDimensionPoint() {
         return dimensionPoint;
     }

+ 9 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/PrintCommonService.java

@@ -301,6 +301,15 @@ public interface PrintCommonService {
      */
     public MarkPaper scoreImportExcelVaild(MultipartFile file, Long examId, String courseCode, String paperNumber) throws IOException;
 
+    /**
+     * 获取阅卷数据
+     *
+     * @param examId
+     * @param paperNumber
+     * @return
+     */
+    public MarkPaper getMarkPaper(Long examId, String paperNumber);
+
     /**
      * 成绩管理动态生成excel
      *

+ 13 - 12
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/PrintCommonServiceImpl.java

@@ -171,10 +171,6 @@ public class PrintCommonServiceImpl implements PrintCommonService {
     @Resource
     BasicRoleDataPermissionService basicRoleDataPermissionService;
 
-    @Resource
-    @Lazy
-    TCPaperStructService tcPaperStructService;
-
     /**
      * 保存附件
      *
@@ -407,14 +403,19 @@ public class PrintCommonServiceImpl implements PrintCommonService {
         if (!Objects.equals(fileMd5, reqFileMd5)) {
             throw ExceptionResultEnum.MD5_EQUALS_FALSE.exception();
         }
-        //优先找本地paperStruct
-        MarkPaper markPaper = null;
-        TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
-        if (Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getPaperStruct()) && Objects.nonNull(tcPaperStruct.getTotalScore())) {
-            markPaper = new MarkPaper(examId, courseCode, paperNumber, tcPaperStruct.getTotalScore(), tcPaperStruct.getPassScore());
-        } else {
-            markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
-        }
+        return this.getMarkPaper(examId, paperNumber);
+    }
+
+    /**
+     * 获取阅卷数据
+     *
+     * @param examId
+     * @param paperNumber
+     * @return
+     */
+    @Override
+    public MarkPaper getMarkPaper(Long examId, String paperNumber) {
+        MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
         Objects.requireNonNull(markPaper, "未找到科目信息");
         return markPaper;
     }

+ 0 - 6
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCFinalScoreServiceImpl.java

@@ -60,9 +60,6 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
     @Resource
     TCFinalScoreService tcFinalScoreService;
 
-    @Resource
-    MarkPaperService markPaperService;
-
     @Resource
     MarkStudentService markStudentService;
 
@@ -255,9 +252,6 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
     public Map<String, String> finalScoreExcelSync(Long examId, String courseCode, String paperNumber) throws IOException {
         Map<String, String> messageMap = new LinkedHashMap<>();
         try {
-            MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
-            Objects.requireNonNull(markPaper, "未找到科目信息");
-
             SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
             StringJoiner errorData = new StringJoiner("");
             StringJoiner successData = new StringJoiner("");

+ 2 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TRBasicInfoServiceImpl.java

@@ -363,7 +363,8 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
 
         //课程目标考核分布-题目信息
         TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(markPaper.getExamId(), markPaper.getCourseCode(), markPaper.getPaperNumber());
-        Objects.requireNonNull(tcPaperStruct, "未找到试卷蓝图信息");
+        Objects.requireNonNull(tcPaperStruct, "未找到试卷信息");
+        Objects.requireNonNull(tcPaperStruct.getPaperStructDimension(), "未找到试卷蓝图信息");
 
         List<PaperStructDimensionResult> paperStructDimensionResultList = GsonUtil.fromJson(tcPaperStruct.getPaperStructDimension(), new TypeToken<List<PaperStructDimensionResult>>() {
         }.getType());

+ 4 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TRExamStudentServiceImpl.java

@@ -186,10 +186,10 @@ public class TRExamStudentServiceImpl extends ServiceImpl<TRExamStudentMapper, T
         reportExamStudentTargetDtoMap.forEach((k, v) -> {
             ReportExamStudentFinalScoreDto reportExamStudentFinalScoreDto = v.getFinalScore();//课程目标考核要素的平均分
             BigDecimal matrixAvgScore = new BigDecimal(reportExamStudentFinalScoreDto.getTargetMatrixSumScore()).divide(size, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
-            //如果换算出来的知识点总分超过了期末考试目标分,则
-            if (reportExamStudentFinalScoreDto.getTargetScore().compareTo(matrixAvgScore) == -1) {
-                throw ExceptionResultEnum.ERROR.exception("[" + v.getTargetName() + "]知识点总平均分超过了期末考试目标分,请重新设置知识点");
-            }
+//            //如果换算出来的知识点总分超过了期末考试目标分,则
+//            if (reportExamStudentFinalScoreDto.getTargetScore().compareTo(matrixAvgScore) == -1) {
+//                throw ExceptionResultEnum.ERROR.exception("[" + v.getTargetName() + "]知识点总平均分超过了期末考试目标分,请重新设置知识点");
+//            }
             reportExamStudentFinalScoreDto.setMatrixAvgScore(matrixAvgScore.doubleValue());
 
             List<DimensionDto> dimensionDtoList = reportExamStudentFinalScoreDto.getDimensionList();

+ 7 - 0
distributed-print/install/mysql/upgrade/3.3.1.sql

@@ -656,3 +656,10 @@ ALTER TABLE t_c_final_score MODIFY COLUMN course_name varchar(100) NULL COMMENT
 ALTER TABLE t_c_usual_score DROP KEY t_c_score_normal_unique;
 ALTER TABLE t_c_usual_score ADD CONSTRAINT t_c_usual_score_unique UNIQUE KEY (exam_id,course_code,paper_number,name,student_code);
 ALTER TABLE t_c_usual_score MODIFY COLUMN course_name varchar(100) NULL COMMENT '课程名称';
+
+-- 2014/03/21
+ALTER TABLE t_r_basic_info MODIFY COLUMN course_name varchar(100) NULL COMMENT '课程名称';
+ALTER TABLE t_c_paper_struct MODIFY COLUMN course_name varchar(100) NOT NULL COMMENT '课程名称';
+ALTER TABLE t_r_basic_info MODIFY COLUMN course_name varchar(100) NOT NULL COMMENT '课程名称';
+ALTER TABLE t_c_final_score MODIFY COLUMN course_name varchar(100) NOT NULL COMMENT '课程名称';
+ALTER TABLE t_c_usual_score MODIFY COLUMN course_name varchar(100) NOT NULL COMMENT '课程名称';

+ 16 - 14
distributed-print/src/main/java/com/qmth/distributed/print/api/TCPaperStructController.java

@@ -9,6 +9,7 @@ import com.qmth.distributed.print.business.bean.result.CourseWeightResult;
 import com.qmth.distributed.print.business.bean.result.EditResult;
 import com.qmth.distributed.print.business.bean.result.report.PaperStructDimensionResult;
 import com.qmth.distributed.print.business.entity.TCPaperStruct;
+import com.qmth.distributed.print.business.service.PrintCommonService;
 import com.qmth.distributed.print.business.service.TCFinalScoreService;
 import com.qmth.distributed.print.business.service.TCPaperStructService;
 import com.qmth.distributed.print.business.service.TRBasicInfoService;
@@ -20,7 +21,6 @@ import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
 import com.qmth.teachcloud.common.util.*;
 import com.qmth.teachcloud.mark.entity.MarkPaper;
-import com.qmth.teachcloud.mark.service.MarkPaperService;
 import com.qmth.teachcloud.mark.service.MarkQuestionService;
 import io.swagger.annotations.*;
 import org.apache.commons.collections4.CollectionUtils;
@@ -39,6 +39,7 @@ import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -64,13 +65,10 @@ public class TCPaperStructController {
     TCPaperStructService tcPaperStructService;
 
     @Resource
-    MarkPaperService markPaperService;
-
-    @Resource
-    RedisUtil redisUtil;
+    TRBasicInfoService trBasicInfoService;
 
     @Resource
-    TRBasicInfoService trBasicInfoService;
+    PrintCommonService printCommonService;
 
     @ApiOperation(value = "导入试卷结构")
     @RequestMapping(value = "/final_score/paper_struct/import", method = RequestMethod.POST)
@@ -103,17 +101,23 @@ public class TCPaperStructController {
                     throw ExceptionResultEnum.ERROR.exception("一个题只能属于一个目标");
                 }
             }
-            Double score = paperStructParams.getPaperStruct().stream().filter(s -> Objects.equals(s.getCourseTargetName(), c.getCourseTargetName())).mapToDouble(PaperStructDimensionResult::getScore).sum();
+            List<PaperStructDimensionResult> paperStructDimensionResultList = paperStructParams.getPaperStruct();
+            Double score = paperStructDimensionResultList.stream().filter(s -> Objects.equals(s.getCourseTargetName(), c.getCourseTargetName())).mapToDouble(PaperStructDimensionResult::getScore).sum();
             if (new BigDecimal(score).compareTo(c.getTotalWeight()) == 1) {
                 throw ExceptionResultEnum.ERROR.exception("[" + c.getCourseTargetName() + "]知识点小题总分大于该课程目标分,请重新设置");
             }
+            paperStructDimensionResultList.stream().filter(s -> {
+                if (Objects.equals(s.getCourseTargetName(), c.getCourseTargetName())) {
+                    s.getTargetList().stream().peek(e -> e.setQuestionScoreSum(score)).collect(Collectors.toList());
+                    return true;
+                }
+                return false;
+            }).collect(Collectors.toList());
         }
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         TCPaperStruct tcPaperStructDb = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(paperStructParams.getExamId(), paperStructParams.getCourseCode(), paperStructParams.getPaperNumber());
         if (Objects.isNull(tcPaperStructDb)) {
-            MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(paperStructParams.getExamId(), paperStructParams.getPaperNumber());
-            Objects.requireNonNull(markPaper, "未找到科目信息");
-
+            MarkPaper markPaper = printCommonService.getMarkPaper(paperStructParams.getExamId(), paperStructParams.getPaperNumber());
             tcPaperStructDb = new TCPaperStruct(paperStructParams.getExamId(), paperStructParams.getCourseCode(), markPaper.getCourseName(), paperStructParams.getPaperNumber(), JacksonUtil.parseJson(paperStructParams.getPaperStruct()), sysUser.getId(), courseWeightResult.getDimensionSign());
             tcPaperStructService.save(tcPaperStructDb);
         } else {
@@ -121,9 +125,7 @@ public class TCPaperStructController {
             BeanUtils.copyProperties(tcPaperStructDb, tcPaperStructSource);
             tcPaperStructDb.updateInfo(JacksonUtil.parseJson(paperStructParams.getPaperStruct()), sysUser.getId());
             if (!tcPaperStructDb.equals(tcPaperStructSource)) {
-                if (Objects.nonNull(tcPaperStructDb.getDimensionSign()) && tcPaperStructDb.getDimensionSign().longValue() != courseWeightResult.getDimensionSign().longValue()) {
-                    trBasicInfoService.clearReportData(tcPaperStructDb.getExamId(), tcPaperStructDb.getCourseCode(), tcPaperStructDb.getPaperNumber(), false);
-                }
+                trBasicInfoService.clearReportData(tcPaperStructDb.getExamId(), tcPaperStructDb.getCourseCode(), tcPaperStructDb.getPaperNumber(), false);
                 tcPaperStructDb.setDimensionSign(courseWeightResult.getDimensionSign());
                 tcPaperStructService.updateById(tcPaperStructDb);
             }
@@ -143,7 +145,7 @@ public class TCPaperStructController {
         TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
         if (Objects.isNull(tcPaperStruct)) {
             List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
-            if (CollectionUtils.isEmpty(markQuestionList)) {
+            if (!CollectionUtils.isEmpty(markQuestionList)) {
                 throw ExceptionResultEnum.ERROR.exception("未找到试卷结构");
             }
             paperStructDimensionResultList = new ArrayList<>(markQuestionList.size());

+ 3 - 12
distributed-print/src/main/java/com/qmth/distributed/print/api/TRBasicInfoController.java

@@ -74,9 +74,6 @@ public class TRBasicInfoController {
     @Resource
     PrintCommonService printCommonService;
 
-    @Resource
-    MarkPaperService markPaperService;
-
     @Resource
     TRBasicInfoService trBasicInfoService;
 
@@ -114,9 +111,7 @@ public class TRBasicInfoController {
     public Result reportView(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
                              @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
                              @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) {
-        MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
-        Objects.requireNonNull(markPaper, "未找到科目信息");
-
+        MarkPaper markPaper = printCommonService.getMarkPaper(examId, paperNumber);
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         TRBasicInfo trBasicInfo = trBasicInfoService.getOne(new QueryWrapper<TRBasicInfo>().lambda().eq(TRBasicInfo::getExamId, examId).eq(TRBasicInfo::getCourseCode, courseCode).eq(TRBasicInfo::getPaperNumber, paperNumber));
 
@@ -163,9 +158,7 @@ public class TRBasicInfoController {
         TRBasicInfo trBasicInfoDb = trBasicInfoService.getOne(new QueryWrapper<TRBasicInfo>().lambda().eq(TRBasicInfo::getExamId, trBasicInfo.getExamId()).eq(TRBasicInfo::getCourseCode, trBasicInfo.getCourseCode()).eq(TRBasicInfo::getPaperNumber, trBasicInfo.getPaperNumber()));
         if (Objects.isNull(trBasicInfoDb)) {
             trBasicInfoDb = new TRBasicInfo(trBasicInfo, sysUser.getId());
-            MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(trBasicInfo.getExamId(), trBasicInfo.getPaperNumber());
-            Objects.requireNonNull(markPaper, "未找到科目信息");
-
+            MarkPaper markPaper = printCommonService.getMarkPaper(trBasicInfo.getExamId(), trBasicInfo.getPaperNumber());
             trBasicInfoDb = trBasicInfoService.getReportView(trBasicInfoDb, markPaper, sysUser.getId());
         } else {
             trBasicInfoDb.updateInfo(trBasicInfo, sysUser.getId());
@@ -194,9 +187,7 @@ public class TRBasicInfoController {
             CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(examId, courseCode);
             ReportCourseEvaluationResultDto reportCourseEvaluationResultDto = JSONObject.parseObject(trBasicInfo.getCourseEvaluationResult(), ReportCourseEvaluationResultDto.class);
             if (Objects.nonNull(reportCourseEvaluationResultDto.getWeightSettingSign()) && reportCourseEvaluationResultDto.getWeightSettingSign().longValue() != courseWeightResult.getWeightSettingSign().longValue()) {
-                MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
-                Objects.requireNonNull(markPaper, "未找到科目信息");
-
+                printCommonService.getMarkPaper(examId, paperNumber);
                 TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
                 trBasicInfoService.clearReportData(examId, courseCode, paperNumber, Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getDimensionSign()) && tcPaperStruct.getDimensionSign().longValue() != courseWeightResult.getDimensionSign().longValue() ? true : false);
                 this.reportView(examId, courseCode, paperNumber);