Forráskód Böngészése

Merge branch 'dev_v2.1.0' into release_v2.1.0
merge

wangliang 4 éve
szülő
commit
4c91df7281

+ 12 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/TBPaperStructResult.java

@@ -3,6 +3,7 @@ package com.qmth.teachcloud.report.business.bean.result;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.report.business.entity.TBPaperStruct;
+import com.qmth.teachcloud.report.business.enums.PaperStructJudgeEnum;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
@@ -37,6 +38,9 @@ public class TBPaperStructResult extends TBPaperStruct implements Serializable {
     @ApiModelProperty(value = "效度")
     private BigDecimal validity;
 
+    @ApiModelProperty(value = "试卷结构每道题目正确(全对),错误枚举")
+    private PaperStructJudgeEnum paperStructJudge;
+
     public String getMainNumber() {
         return mainNumber;
     }
@@ -92,4 +96,12 @@ public class TBPaperStructResult extends TBPaperStruct implements Serializable {
     public void setValidity(BigDecimal validity) {
         this.validity = validity;
     }
+
+    public PaperStructJudgeEnum getPaperStructJudge() {
+        return paperStructJudge;
+    }
+
+    public void setPaperStructJudge(PaperStructJudgeEnum paperStructJudge) {
+        this.paperStructJudge = paperStructJudge;
+    }
 }

+ 41 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/entity/TAPaperStruct.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.report.business.enums.PaperStructJudgeEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -58,6 +59,10 @@ public class TAPaperStruct implements Serializable {
     @TableField(value = "paper_id")
     private Long paperId;
 
+    @ApiModelProperty(value = "试卷类型")
+    @TableField(value = "paper_type")
+    private String paperType;
+
     @ApiModelProperty(value = "大题名称")
     @TableField(value = "question_name")
     private String questionName;
@@ -102,6 +107,10 @@ public class TAPaperStruct implements Serializable {
     @TableField(value = "literacy_dimension")
     private String literacyDimension;
 
+    @ApiModelProperty(value = "标准难度系数")
+    @TableField(value = "standard_score_rate")
+    private BigDecimal standardScoreRate;
+
     @ApiModelProperty(value = "得分率")
     @TableField(value = "score_rate")
     private BigDecimal scoreRate;
@@ -114,6 +123,10 @@ public class TAPaperStruct implements Serializable {
     @TableField(value = "validity")
     private BigDecimal validity;
 
+    @ApiModelProperty(value = "试卷结构每道题目正确(全对),错误枚举")
+    @TableField(value = "paper_struct_judge")
+    private PaperStructJudgeEnum paperStructJudge;
+
     public static long getSerialVersionUID() {
         return serialVersionUID;
     }
@@ -297,4 +310,32 @@ public class TAPaperStruct implements Serializable {
     public void setValidity(BigDecimal validity) {
         this.validity = validity;
     }
+
+    public PaperStructJudgeEnum getPaperStructJudge() {
+        return paperStructJudge;
+    }
+
+    public void setPaperStructJudge(PaperStructJudgeEnum paperStructJudge) {
+        this.paperStructJudge = paperStructJudge;
+    }
+
+    public String getPaperType() {
+        return paperType;
+    }
+
+    public void setPaperType(String paperType) {
+        this.paperType = paperType;
+    }
+
+    public BigDecimal getStandardScoreRate() {
+        if (Objects.nonNull(standardScoreRate)) {
+            return standardScoreRate.setScale(SystemConstant.CALCULATE_SCALE, BigDecimal.ROUND_HALF_UP);
+        } else {
+            return standardScoreRate;
+        }
+    }
+
+    public void setStandardScoreRate(BigDecimal standardScoreRate) {
+        this.standardScoreRate = standardScoreRate;
+    }
 }

+ 22 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/enums/PaperStructJudgeEnum.java

@@ -0,0 +1,22 @@
+package com.qmth.teachcloud.report.business.enums;
+
+/**
+ * @Description: 试卷结构每道题目正确(全对),错误枚举
+ * @Author: CaoZixuan
+ * @Date: 2021-07-19
+ */
+public enum PaperStructJudgeEnum {
+    ALL_CORRECT("全对"),
+    NOT_QUITE_RIGHT("不完全正确的"),
+    ;
+
+    PaperStructJudgeEnum(String title) {
+        this.title = title;
+    }
+
+    private final String title;
+
+    public String getTitle() {
+        return title;
+    }
+}

+ 13 - 5
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/AnalyzeForReportServiceImpl.java

@@ -893,13 +893,20 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
                     if (oneQuestionAnswerDetailList.size() == 0){
                         System.out.println("异常");
                     }
+                    BigDecimal fullScore = paperStruct.getFullScore();
+                    PaperStructJudgeEnum paperStructJudgeEnum;
+                    if (oneQuestionAnswerDetailList.stream().anyMatch(e -> fullScore.compareTo(e.getScore()) != 0)){
+                        paperStructJudgeEnum = PaperStructJudgeEnum.NOT_QUITE_RIGHT;
+                    }else {
+                        paperStructJudgeEnum = PaperStructJudgeEnum.ALL_CORRECT;
+                    }
 
                     DoubleSummaryStatistics descriptiveStatistics = oneQuestionAnswerDetailList.stream()
                             .collect(Collectors.summarizingDouble(e -> e.getScore().doubleValue()));
-                    BigDecimal fullScore = paperStruct.getFullScore();
+
                     double scoreAvg = descriptiveStatistics.getAverage();
-                    BigDecimal scoreRate = BigDecimal.valueOf(scoreAvg).divide(fullScore, 4, BigDecimal.ROUND_HALF_UP);
-                    scoreRate = scoreRate.setScale(1, BigDecimal.ROUND_HALF_UP);
+                    BigDecimal standardScoreRate = BigDecimal.valueOf(scoreAvg).divide(fullScore, 4, BigDecimal.ROUND_HALF_UP);
+                    BigDecimal scoreRate = standardScoreRate.setScale(1, BigDecimal.ROUND_HALF_UP);
                     String difficult = this.analyzeDifficult(examId, effectiveCourseCode, scoreRate.doubleValue());
 
                     double validity = this.calculateValidity(oneQuestionAnswerDetailList, fullScore.doubleValue());
@@ -912,6 +919,7 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
                     taPaperStruct.setCourseCode(effectiveCourseCode);
                     taPaperStruct.setCourseName(basicCourseService.findByCourseCode(effectiveCourseCode).getName());
                     taPaperStruct.setPaperId(paperId);
+                    taPaperStruct.setPaperType(paperType);
                     taPaperStruct.setQuestionName(paperStruct.getQuestionName());
                     taPaperStruct.setNumberType(paperStruct.getNumberType());
                     taPaperStruct.setBigQuestionNumber(paperStruct.getBigQuestionNumber());
@@ -923,16 +931,16 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
                     taPaperStruct.setKnowledgeDimension(paperStruct.getKnowledgeDimension());
                     taPaperStruct.setAbilityDimension(paperStruct.getAbilityDimension());
                     taPaperStruct.setLiteracyDimension(paperStruct.getLiteracyDimension());
-
+                    taPaperStruct.setStandardScoreRate(standardScoreRate);
                     taPaperStruct.setScoreRate(scoreRate);
                     taPaperStruct.setDifficult(difficult);
                     taPaperStruct.setValidity(BigDecimal.valueOf(validity));
+                    taPaperStruct.setPaperStructJudge(paperStructJudgeEnum);
                     taPaperStructList.add(taPaperStruct);
                 }
             }
             taPaperStructService.saveBatch(taPaperStructList);
         }
-        // TODO: 2021/6/8 部分效度有问题 
         return " 't_a_paper_struct'表构建成功 ";
     }
 

+ 13 - 11
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/ReportCommonServiceImpl.java

@@ -12,6 +12,7 @@ import com.qmth.teachcloud.report.business.entity.TBDimension;
 import com.qmth.teachcloud.report.business.entity.TBExamCourse;
 import com.qmth.teachcloud.report.business.entity.TBPaper;
 import com.qmth.teachcloud.report.business.enums.GradeScopeEnum;
+import com.qmth.teachcloud.report.business.enums.PaperStructJudgeEnum;
 import com.qmth.teachcloud.report.business.enums.PiecewiseScopeEnum;
 import com.qmth.teachcloud.report.business.enums.PublishStatusEnum;
 import com.qmth.teachcloud.report.business.service.*;
@@ -432,18 +433,19 @@ public class ReportCommonServiceImpl implements ReportCommonService {
                 .eq(TBDimension::getCourseCode, courseCode);
         List<TBDimension> dimensionDataSource = tbDimensionService.list(tbDimensionQueryWrapper);
 
-        Set<String> paperTypeSet = questionDatasource.stream().map(e -> e.getPaperType()).collect(Collectors.toSet());
+        Set<String> paperTypeSet = questionDatasource.stream().map(TBPaperStructResult::getPaperType).collect(Collectors.toSet());
         List<QuestionResult> questionList = new ArrayList<>();
         for (String paperType : paperTypeSet) {
-            List<TBPaperStructResult> cellList = questionDatasource.stream()
-                    .filter(e -> paperType.equals(e.getPaperType())).collect(Collectors.toList());
+            List<TBPaperStructResult> errorCellList = questionDatasource.stream()
+                    .filter(e -> paperType.equals(e.getPaperType()) && PaperStructJudgeEnum.NOT_QUITE_RIGHT.equals(e.getPaperStructJudge())).collect(Collectors.toList());
 
-            for (TBPaperStructResult cell : cellList) {
+            for (TBPaperStructResult cell : errorCellList) {
                 cell.setPaperType(null);
             }
-
             Set<String> knowledgeDimensionSet = new HashSet<>(), abilityDimensionSet = new HashSet<>();
-            for (TBPaperStructResult cell : cellList) {
+
+            // 获取考察点集合
+            for (TBPaperStructResult cell : errorCellList) {
                 String knowledgeDimension = cell.getKnowledgeDimension();
                 String[] arr = knowledgeDimension.split(",");
                 knowledgeDimensionSet.addAll(Arrays.asList(arr));
@@ -462,11 +464,11 @@ public class ReportCommonServiceImpl implements ReportCommonService {
                 String dimensionName = "";
                 List<String> nameTwoList = dimensionDataSource.stream()
                         .filter(e -> dimensionCode.equals(e.getCodeSecond()))
-                        .map(e -> e.getNameSecond()).collect(Collectors.toList());
+                        .map(TBDimension::getNameSecond).collect(Collectors.toList());
                 if (nameTwoList.size() < 1) {
                     List<String> tmpList = dimensionDataSource.stream()
                             .filter(e -> dimensionCode.equals(e.getCodePrimary()))
-                            .map(e -> e.getNamePrimary()).collect(Collectors.toList());
+                            .map(TBDimension::getNamePrimary).collect(Collectors.toList());
                     if (tmpList.size() == 0) {
                         continue;
                     }
@@ -482,11 +484,11 @@ public class ReportCommonServiceImpl implements ReportCommonService {
                 String dimensionName = "";
                 List<String> nameTwoList = dimensionDataSource.stream()
                         .filter(e -> dimensionCode.equals(e.getCodeSecond()))
-                        .map(e -> e.getNameSecond()).collect(Collectors.toList());
+                        .map(TBDimension::getNameSecond).collect(Collectors.toList());
                 if (nameTwoList.size() < 1) {
                     List<String> tmpList = dimensionDataSource.stream()
                             .filter(e -> dimensionCode.equals(e.getCodePrimary()))
-                            .map(e -> e.getNamePrimary()).collect(Collectors.toList());
+                            .map(TBDimension::getNamePrimary).collect(Collectors.toList());
                     if (tmpList.size() == 0) {
                         continue;
                     }
@@ -496,7 +498,7 @@ public class ReportCommonServiceImpl implements ReportCommonService {
                 }
                 abilityDimensionList.add(new DimensionInfoResult(dimensionCode, dimensionName));
             }
-            questionList.add(new QuestionResult(paperType, cellList, dimensionList, abilityDimensionList));
+            questionList.add(new QuestionResult(paperType, errorCellList, dimensionList, abilityDimensionList));
         }
         return new QuestionListResult(questionList);
     }

+ 14 - 16
teachcloud-report-business/src/main/resources/mapper/TBPaperStructMapper.xml

@@ -4,27 +4,25 @@
 
     <select id="findQuestionInfo" resultType="com.qmth.teachcloud.report.business.bean.result.TBPaperStructResult">
         SELECT
-            tbp.paper_type AS paperType,
-            tbps.big_question_number AS mainNumber,
-            tbps.small_question_number AS subNumber,
-            tbps.full_score AS fullScore,
-            tbps.knowledge_dimension AS knowledgeDimension,
-            tbps.ability_dimension AS abilityDimension,
-            round(convert(taps.score_rate * 100,decimal(10,4)),2) AS scoreRate,
-            taps.difficult,
-            convert(taps.validity,decimal(10,4)) AS validity
+            paper_type AS paperType,
+            big_question_number AS mainNumber,
+            small_question_number AS subNumber,
+            full_score AS fullScore,
+            knowledge_dimension AS knowledgeDimension,
+            ability_dimension AS abilityDimension,
+            ROUND(CONVERT( score_rate * 100 , DECIMAL (10 , 4 )),
+            2) AS scoreRate,
+            difficult,
+            CONVERT( validity , DECIMAL (10 , 4 )) AS validity,
+            paper_struct_judge AS paperStructJudge
         FROM
-            t_b_paper_struct tbps
-            join t_a_paper_struct taps
-            on taps.paper_struct_id = tbps.id
-            join t_b_paper tbp
-            on tbp.id = tbps.paper_id
+            t_a_paper_struct
         <where>
             <if test="examId != null and examId != ''">
-                and tbp.exam_id = #{examId}
+                and exam_id = #{examId}
             </if>
             <if test="courseCode != null and courseCode != ''">
-                and tbp.course_code = #{courseCode}
+                and course_code = #{courseCode}
             </if>
         </where>
     </select>

+ 2 - 1
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/BasicDatasourceController.java

@@ -563,6 +563,7 @@ public class BasicDatasourceController {
             String college = (String) map.get(ExamCloudDataEnum.COLLEGE.getName()); //学院
             String className = (String) map.get(ExamCloudDataEnum.CLASS_NAME.getName()); //班级名称
             String teacher = (String) map.get(ExamCloudDataEnum.TEACHER.getName()); //教师
+            // 缺考状态 2 -> 缺考 ; 3 -> 违纪
             int status = (int) map.get(ExamCloudDataEnum.STATUS.getName()); //学生考试状态
             String totalScore = (String) map.get(ExamCloudDataEnum.TOTAL_SCORE.getName()); //考生总分
             String objectiveScore = (String) map.get(ExamCloudDataEnum.OBJECTIVE_SCORE.getName()); //客观题总分
@@ -638,7 +639,7 @@ public class BasicDatasourceController {
                     tbExamStudent.setTeacherId(0L);
                 }
                 tbExamStudent.setTicketNumber(examNumber);
-                tbExamStudent.setAbsent(status == 2);
+                tbExamStudent.setAbsent(status == 2 || status == 3);
                 // 全部设置为本届
                 tbExamStudent.setStudentCurrent(true);
                 tbExamStudentList.add(tbExamStudent);

+ 1 - 1
teachcloud-report/src/test/java/com/qmth/teachcloud/report/AnalyzeForStudentServiceTest.java

@@ -65,7 +65,7 @@ public class AnalyzeForStudentServiceTest {
     @Test
     public void buildAnalyzePaperStruct() {
         Long examId = 1L;
-        String courseCode = "1013";
+        String courseCode = null;
         System.out.println(analyzeForReportService.buildAnalyzePaperStruct(examId,courseCode));
     }