Эх сурвалжийг харах

课程目标达成度散点图web

wangliang 8 сар өмнө
parent
commit
d2fcbaa5a4

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

@@ -63,6 +63,7 @@ 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.stream.Collectors;
 
@@ -172,16 +173,31 @@ public class TRBasicInfoController {
                 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, Integer>> 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, 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),
                         reportCourseBasicInfoDto, reportCourseEvaluationSpreadDto, reportCourseEvaluationResultDto,
-                        reportCourseEvaluationResultDetailDto, trBasicInfo));
+                        reportCourseEvaluationResultDetailDto, trBasicInfo, finalScatterYMap));
             }
         }
         trBasicInfo.updateInfo(sysUser.getId());

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

@@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.qmth.teachcloud.obe.been.report.*;
 import com.qmth.teachcloud.obe.entity.TRBasicInfo;
 import io.swagger.annotations.ApiModelProperty;
+import org.springframework.util.LinkedMultiValueMap;
 
 import java.io.Serializable;
+import java.util.Map;
 
 /**
  * @Description: 报告result
@@ -40,6 +42,10 @@ public class ReportResult implements Serializable {
     @TableField(exist = false)
     private String courseSuggest;
 
+    @ApiModelProperty(value = "课程目标达成度散点图")
+    @TableField(exist = false)
+    private LinkedMultiValueMap<Long, Map<String, String>> courseTargetScatterMap;
+
     public ReportResult() {
 
     }
@@ -47,13 +53,23 @@ public class ReportResult implements Serializable {
     public ReportResult(ReportCommonDto commonInfo, ReportCourseBasicInfoDto courseBasicInfo,
                         ReportCourseEvaluationSpreadDto courseEvaluationSpreadInfo,
                         ReportCourseEvaluationResultDto courseEvaluationResultInfo,
-                        ReportCourseEvaluationResultDetailDto courseEvaluationResultDetailInfo, TRBasicInfo trBasicInfo) {
+                        ReportCourseEvaluationResultDetailDto courseEvaluationResultDetailInfo, TRBasicInfo trBasicInfo,
+                        LinkedMultiValueMap<Long, Map<String, String>> courseTargetScatterMap) {
         this.commonInfo = commonInfo;
         this.courseBasicInfo = courseBasicInfo;
         this.courseEvaluationSpreadInfo = courseEvaluationSpreadInfo;
         this.courseEvaluationResultInfo = courseEvaluationResultInfo;
         this.courseEvaluationResultDetailInfo = courseEvaluationResultDetailInfo;
         this.courseSuggest = trBasicInfo.getCourseSuggest();
+        this.courseTargetScatterMap = courseTargetScatterMap;
+    }
+
+    public LinkedMultiValueMap<Long, Map<String, String>> getCourseTargetScatterMap() {
+        return courseTargetScatterMap;
+    }
+
+    public void setCourseTargetScatterMap(LinkedMultiValueMap<Long, Map<String, String>> courseTargetScatterMap) {
+        this.courseTargetScatterMap = courseTargetScatterMap;
     }
 
     public String getCourseSuggest() {

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

@@ -16,6 +16,7 @@ import org.springframework.util.LinkedMultiValueMap;
 
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
 
 /**
  * <p>
@@ -185,4 +186,21 @@ public interface TRBasicInfoService extends IService<TRBasicInfo> {
      * @return
      */
     public ReportCourseBasicInfoDto setBasicInfo(TRBasicInfo trBasicInfo, ObeCourseOutline obeCourseOutline, MarkPaper markPaper, ObeCourseWeightResult obeCourseWeightResult);
+
+    /**
+     * 获取散点图值
+     *
+     * @param scatterYMap
+     * @param reportExamStudentTargetDto
+     * @return
+     */
+    public Map<Long, ConcurrentMap<String, Integer>> getScatterValue(Map<Long, ConcurrentMap<String, Integer>> scatterYMap, ReportExamStudentTargetDto reportExamStudentTargetDto);
+
+    /**
+     * 获取最终散点图值
+     *
+     * @param scatterYMap
+     * @return
+     */
+    public LinkedMultiValueMap<Long, Map<String, String>> getFinalScatterValue(Map<Long, ConcurrentMap<String, Integer>> scatterYMap);
 }

+ 25 - 12
teachcloud-obe/src/main/java/com/qmth/teachcloud/obe/service/impl/TRBasicInfoServiceImpl.java

@@ -791,7 +791,7 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
                             if (!Objects.equals(trExamStudent.getName(), "平均分")
                                     && !Objects.equals(trExamStudent.getName(), "各课程目标平均分")
                                     && Objects.nonNull(matrixDegree)) {
-                                this.getScatterValue(scatterYMap, reportExamStudentTargetDto);
+                                trBasicInfoService.getScatterValue(scatterYMap, reportExamStudentTargetDto);
                             }
                             ReportExamStudentUsualScoreDto reportExamStudentUsualScoreDto = reportExamStudentTargetDto.getUsualScore();
                             //平常作业
@@ -846,16 +846,7 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
                 examStudent_row.setRowStyle(this.getRowStyle());
                 rowRenderDataExamStudent[i + 2] = examStudent_row;
             }
-            LinkedMultiValueMap<Long, Map<String, String>> finalScatterYMap = new LinkedMultiValueMap<>();
-            for (Map.Entry<Long, ConcurrentMap<String, Integer>> entry : scatterYMap.entrySet()) {
-                ConcurrentMap<String, Integer> concurrentMap = entry.getValue();
-                for (Map.Entry<String, Integer> entry1 : concurrentMap.entrySet()) {
-                    Map<String, String> mapNew = new HashMap<>();
-                    mapNew.put(entry1.getKey(), entry1.getValue().toString());
-                    finalScatterYMap.add(entry.getKey(), mapNew);
-                }
-            }
-
+            LinkedMultiValueMap<Long, Map<String, String>> finalScatterYMap = trBasicInfoService.getFinalScatterValue(scatterYMap);
             List<CellRenderData> cellRenderData_last_cell = new ArrayList<>();
             RowRenderData examStudent_last_row = new RowRenderData();
             cellRenderData_last_cell.add(Cells.of("课程达成度").create());
@@ -1424,8 +1415,9 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
      *
      * @param scatterYMap
      * @param reportExamStudentTargetDto
+     * @return
      */
-    protected void getScatterValue(Map<Long, ConcurrentMap<String, Integer>> scatterYMap, ReportExamStudentTargetDto reportExamStudentTargetDto) {
+    public Map<Long, ConcurrentMap<String, Integer>> getScatterValue(Map<Long, ConcurrentMap<String, Integer>> scatterYMap, ReportExamStudentTargetDto reportExamStudentTargetDto) {
         ConcurrentMap<String, Integer> map = null;
         if (!scatterYMap.containsKey(reportExamStudentTargetDto.getTargetId())) {
             map = new ConcurrentHashMap<>();
@@ -1440,5 +1432,26 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
             }
         }
         scatterYMap.put(reportExamStudentTargetDto.getTargetId(), map);
+        return scatterYMap;
+    }
+
+    /**
+     * 获取最终散点图值
+     *
+     * @param scatterYMap
+     * @return
+     */
+    @Override
+    public LinkedMultiValueMap<Long, Map<String, String>> getFinalScatterValue(Map<Long, ConcurrentMap<String, Integer>> scatterYMap) {
+        LinkedMultiValueMap<Long, Map<String, String>> finalScatterYMap = new LinkedMultiValueMap<>();
+        for (Map.Entry<Long, ConcurrentMap<String, Integer>> entry : scatterYMap.entrySet()) {
+            ConcurrentMap<String, Integer> concurrentMap = entry.getValue();
+            for (Map.Entry<String, Integer> entry1 : concurrentMap.entrySet()) {
+                Map<String, String> mapNew = new HashMap<>();
+                mapNew.put(entry1.getKey(), entry1.getValue().toString());
+                finalScatterYMap.add(entry.getKey(), mapNew);
+            }
+        }
+        return finalScatterYMap;
     }
 }