浏览代码

错题展示

caozixuan 4 年之前
父节点
当前提交
e859c009b3

+ 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;
+    }
 }

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

@@ -59,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;
@@ -103,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;
@@ -310,4 +318,24 @@ public class TAPaperStruct implements Serializable {
     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;
+    }
 }

+ 4 - 3
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/AnalyzeForReportServiceImpl.java

@@ -905,8 +905,8 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
                             .collect(Collectors.summarizingDouble(e -> e.getScore().doubleValue()));
 
                     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());
@@ -919,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());
@@ -930,6 +931,7 @@ 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));
@@ -939,7 +941,6 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
             }
             taPaperStructService.saveBatch(taPaperStructList);
         }
-        // TODO: 2021/6/8 部分效度有问题 
         return " 't_a_paper_struct'表构建成功 ";
     }
 

+ 10 - 7
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,7 +433,7 @@ 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()
@@ -441,9 +442,11 @@ public class ReportCommonServiceImpl implements ReportCommonService {
             for (TBPaperStructResult cell : cellList) {
                 cell.setPaperType(null);
             }
-
+            List<TBPaperStructResult> errorCellList = cellList.stream().filter(e -> PaperStructJudgeEnum.NOT_QUITE_RIGHT.equals(e.getPaperStructJudge())).collect(Collectors.toList());
             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 +465,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 +485,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;
                     }

+ 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>

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

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