wangliang 7 ヶ月 前
コミット
bd56c167d3

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

@@ -65,7 +65,6 @@ import java.io.FileInputStream;
 import java.io.InputStream;
 import java.math.BigDecimal;
 import java.util.*;
-import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -199,36 +198,13 @@ public class TRBasicInfoController {
                     ReportCourseEvaluationSpreadDto reportCourseEvaluationSpreadDto = Objects.nonNull(trBasicInfo.getCourseEvaluationSpread()) ?
                             JSONObject.parseObject(trBasicInfo.getCourseEvaluationSpread(), ReportCourseEvaluationSpreadDto.class) :
                             null;
-                    ReportCourseEvaluationResultDetailDto reportCourseEvaluationResultDetailDto = null;
-                    List<TRExamStudent> trExamStudentList = trExamStudentService.list(
-                            new QueryWrapper<TRExamStudent>().lambda().eq(TRExamStudent::getrBasicInfoId, trBasicInfo.getId()));
-                    LinkedMultiValueMap<Long, Map<String, String>> finalScatterYMap = null;
-                    if (!CollectionUtils.isEmpty(trExamStudentList)) {
-                        Map<Long, ConcurrentMap<String, String>> scatterYMap = new LinkedHashMap<>();
-                        List<ReportExamStudentDto> examStudentList = new ArrayList<>(trExamStudentList.size());
-                        for (TRExamStudent trExamStudent : trExamStudentList) {
-                            if (!Objects.equals(trExamStudent.getName(), "各课程目标平均分")
-                                    && !Objects.equals(trExamStudent.getName(), "平均分")
-                                    && !Objects.equals(trExamStudent.getName(), "目标分")) {
-                                List<ReportExamStudentTargetDto> reportExamStudentTargetDtoList = JSONArray.parseArray(trExamStudent.getResultDetail(), ReportExamStudentTargetDto.class);
-                                for (ReportExamStudentTargetDto reportExamStudentTargetDto : reportExamStudentTargetDtoList) {
-                                    if (Objects.nonNull(reportExamStudentTargetDto) && Objects.nonNull(reportExamStudentTargetDto.getMatrixDegree())) {
-                                        trBasicInfoService.getScatterValue(scatterYMap, trExamStudent.getStudentCode(), reportExamStudentTargetDto);
-                                    }
-                                }
-                            }
-                            examStudentList.add(new ReportExamStudentDto(trExamStudent));
-                        }
-                        if (scatterYMap.size() > 0) {
-                            finalScatterYMap = trBasicInfoService.getFinalScatterValue(scatterYMap);
-                        }
-                        reportCourseEvaluationResultDetailDto = new ReportCourseEvaluationResultDetailDto(examStudentList);
-                    }
-                    trBasicInfo.setReportResult(new ReportResult(new ReportCommonDto(null, basicCourse.getCode(), markPaper.getCourseName(), paperNumber),
+                    Map<String, Object> map = trBasicInfoService.queryScatterYMap(trBasicInfo);
+                    LinkedMultiValueMap<Long, Map<String, String>> finalScatterYMap = (LinkedMultiValueMap<Long, Map<String, String>>) map.get("finalScatterYMap");
+                    List<ReportExamStudentDto> examStudentList = (List<ReportExamStudentDto>) map.get("examStudentList");
+                    ReportCourseEvaluationResultDetailDto reportCourseEvaluationResultDetailDto = new ReportCourseEvaluationResultDetailDto(examStudentList);
+                    trBasicInfo.setReportResult(new ReportResult(new ReportCommonDto(examId, basicCourse.getCode(), markPaper.getCourseName(), paperNumber),
                             reportCourseBasicInfoDto, reportCourseEvaluationSpreadDto, reportCourseEvaluationResultDto,
                             reportCourseEvaluationResultDetailDto, trBasicInfo, finalScatterYMap));
-                    trBasicInfo.updateInfo(sysUser.getId());
-                    trBasicInfoService.saveOrUpdateBatch(trBasicInfoList);
                 }
             }
         }
@@ -309,7 +285,7 @@ public class TRBasicInfoController {
             ObeCourseOutline obeCourseOutline = obeCourseOutlineService.findByCultureProgramIdAndCourseId(trBasicInfoDb.getCultureProgramId(), trBasicInfoDb.getCourseId());
             ObeCourseWeightResult obeCourseWeightResult = trBasicInfoService.findCourseWeightResultRmi(obeCourseOutline.getId(), true);
             MarkPaper markPaper = printCommonService.getMarkPaper(trBasicInfoDb.getExamId(), trBasicInfoDb.getPaperNumber(), trBasicInfoDb.getCourseId());
-            List<TRBasicInfo> trBasicInfoList = trBasicInfoService.queryBasicInfo(trBasicInfoDb.getCultureProgramId(), trBasicInfoDb.getCourseId(), trBasicInfoDb.getPaperNumber(), trBasicInfoDb.getExamId());
+            List<TRBasicInfo> trBasicInfoList = trBasicInfoService.queryBasicInfoAll(trBasicInfoDb.getCultureProgramId(), trBasicInfoDb.getCourseId(), trBasicInfoDb.getPaperNumber(), trBasicInfoDb.getExamId());
             for (TRBasicInfo t : trBasicInfoList) {
                 ReportCourseBasicInfoDto reportCourseBasicInfoDto = trBasicInfoService.setBasicInfo(trBasicInfo, obeCourseOutline, markPaper, obeCourseWeightResult);
                 t.updateInfo(trBasicInfo, reportCourseBasicInfoDto, sysUser.getId());

+ 2 - 1
teachcloud-obe/src/main/java/com/qmth/teachcloud/obe/been/result/report/ReportResult.java

@@ -67,9 +67,10 @@ public class ReportResult implements Serializable {
         this.id = trBasicInfo.getId();
     }
 
-    public void updateInfo(String teachClassName, Long id) {
+    public void updateInfo(String teachClassName, Long id, String courseSuggest) {
         this.teachClassName = teachClassName;
         this.id = id;
+        this.courseSuggest = courseSuggest;
     }
 
     public Long getId() {

+ 18 - 0
teachcloud-obe/src/main/java/com/qmth/teachcloud/obe/service/TRBasicInfoService.java

@@ -42,6 +42,17 @@ public interface TRBasicInfoService extends IService<TRBasicInfo> {
      */
     public List<TRBasicInfo> queryBasicInfo(Long cultureProgramId, Long courseId, String paperNumber, Long examId);
 
+    /**
+     * 根据考试id/课程编码/试卷编码查询数据库数据
+     *
+     * @param cultureProgramId cultureProgramId
+     * @param courseId         courseId
+     * @param paperNumber      paperNumber
+     * @param examId
+     * @return
+     */
+    public List<TRBasicInfo> queryBasicInfoAll(Long cultureProgramId, Long courseId, String paperNumber, Long examId);
+
     /**
      * 获取课程目标考核分布-分数图
      *
@@ -308,4 +319,11 @@ public interface TRBasicInfoService extends IService<TRBasicInfo> {
      */
     public TableRenderData buildXagyuWordTable2(Map<String, Object> map);
 
+    /**
+     * 查询散点图值
+     *
+     * @param trBasicInfo
+     * @return
+     */
+    public Map<String, Object> queryScatterYMap(TRBasicInfo trBasicInfo);
 }

+ 53 - 1
teachcloud-obe/src/main/java/com/qmth/teachcloud/obe/service/impl/TRBasicInfoServiceImpl.java

@@ -129,6 +129,20 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
         return this.baseMapper.queryBasicInfo(cultureProgramId, courseId, paperNumber, examId, dpr);
     }
 
+    /**
+     * 根据考试id/课程编码/试卷编码查询数据库数据
+     *
+     * @param cultureProgramId cultureProgramId
+     * @param courseId         courseId
+     * @param paperNumber      paperNumber
+     * @param examId
+     * @return
+     */
+    @Override
+    public List<TRBasicInfo> queryBasicInfoAll(Long cultureProgramId, Long courseId, String paperNumber, Long examId) {
+        return this.baseMapper.queryBasicInfo(cultureProgramId, courseId, paperNumber, examId, null);
+    }
+
     /**
      * 获取课程目标考核分布-分数图
      *
@@ -544,7 +558,10 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
             } else {
                 trBasicInfo.setTeachClassName(s.getTeachClassName());
             }
-            trBasicInfo.getReportResult().updateInfo(trBasicInfo.getTeachClassName(), trBasicInfo.getId());
+            trBasicInfo.getReportResult().updateInfo(trBasicInfo.getTeachClassName(), trBasicInfo.getId(), trBasicInfo.getCourseSuggest());
+            Map<String, Object> map = this.queryScatterYMap(trBasicInfo);
+            LinkedMultiValueMap<Long, Map<String, String>> finalScatterYMap = (LinkedMultiValueMap<Long, Map<String, String>>) map.get("finalScatterYMap");
+            trBasicInfo.getReportResult().setCourseTargetScatterMap(finalScatterYMap);
             trBasicInfoList.add(trBasicInfo);
         }
         //课程目标达成评价明细结果-课程目标达成评价值图
@@ -1845,6 +1862,41 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
         return tableBuilder2.mergeRule(mergeCellRule2).left().create();
     }
 
+    /**
+     * 查询散点图值
+     *
+     * @param trBasicInfo
+     * @return
+     */
+    @Override
+    public Map<String, Object> queryScatterYMap(TRBasicInfo trBasicInfo) {
+        List<TRExamStudent> trExamStudentList = trExamStudentService.list(
+                new QueryWrapper<TRExamStudent>().lambda().eq(TRExamStudent::getrBasicInfoId, trBasicInfo.getId()));
+        LinkedMultiValueMap<Long, Map<String, String>> finalScatterYMap = null;
+        List<ReportExamStudentDto> examStudentList = null;
+        if (!CollectionUtils.isEmpty(trExamStudentList)) {
+            Map<Long, ConcurrentMap<String, String>> scatterYMap = new LinkedHashMap<>();
+            examStudentList = new ArrayList<>(trExamStudentList.size());
+            for (TRExamStudent trExamStudent : trExamStudentList) {
+                if (!Objects.equals(trExamStudent.getName(), "各课程目标平均分")
+                        && !Objects.equals(trExamStudent.getName(), "平均分")
+                        && !Objects.equals(trExamStudent.getName(), "目标分")) {
+                    List<ReportExamStudentTargetDto> reportExamStudentTargetDtoList = JSONArray.parseArray(trExamStudent.getResultDetail(), ReportExamStudentTargetDto.class);
+                    for (ReportExamStudentTargetDto reportExamStudentTargetDto : reportExamStudentTargetDtoList) {
+                        if (Objects.nonNull(reportExamStudentTargetDto) && Objects.nonNull(reportExamStudentTargetDto.getMatrixDegree())) {
+                            trBasicInfoService.getScatterValue(scatterYMap, trExamStudent.getStudentCode(), reportExamStudentTargetDto);
+                        }
+                    }
+                }
+                examStudentList.add(new ReportExamStudentDto(trExamStudent));
+            }
+            if (scatterYMap.size() > 0) {
+                finalScatterYMap = trBasicInfoService.getFinalScatterValue(scatterYMap);
+            }
+        }
+        return ImmutableMap.of("examStudentList", examStudentList, "finalScatterYMap", finalScatterYMap);
+    }
+
     /**
      * 构建散点图
      *