Jelajahi Sumber

数据调整

caozixuan 4 tahun lalu
induk
melakukan
696235c58c

+ 92 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/dto/AnswerDetailBean.java

@@ -0,0 +1,92 @@
+package com.qmth.teachcloud.report.business.bean.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: answerDetailBean
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/1/14
+ */
+public class AnswerDetailBean implements Serializable {
+    @ApiModelProperty(value = "试卷id")
+    private Long paperId;
+
+    @ApiModelProperty(value = "试卷类型")
+    private String paperType;
+
+    @ApiModelProperty(value = "得分率")
+    private Double scoreRate;
+
+    @ApiModelProperty(value = "难度")
+    private String difficult;
+
+    @ApiModelProperty(value = "学院名称")
+    private String collegeName;
+
+    @ApiModelProperty(value = "学院id")
+    private Long collegeId;
+
+    public AnswerDetailBean(Long paperId, String paperType, Double scoreRate, String difficult, String collegeName, Long collegeId) {
+        this.paperId = paperId;
+        this.paperType = paperType;
+        this.scoreRate = scoreRate;
+        this.difficult = difficult;
+        this.collegeName = collegeName;
+        this.collegeId = collegeId;
+    }
+
+    public AnswerDetailBean() {
+    }
+
+    public Long getPaperId() {
+        return paperId;
+    }
+
+    public void setPaperId(Long paperId) {
+        this.paperId = paperId;
+    }
+
+    public String getPaperType() {
+        return paperType;
+    }
+
+    public void setPaperType(String paperType) {
+        this.paperType = paperType;
+    }
+
+    public Double getScoreRate() {
+        return scoreRate;
+    }
+
+    public void setScoreRate(Double scoreRate) {
+        this.scoreRate = scoreRate;
+    }
+
+    public String getDifficult() {
+        return difficult;
+    }
+
+    public void setDifficult(String difficult) {
+        this.difficult = difficult;
+    }
+
+    public String getCollegeName() {
+        return collegeName;
+    }
+
+    public void setCollegeName(String collegeName) {
+        this.collegeName = collegeName;
+    }
+
+    public Long getCollegeId() {
+        return collegeId;
+    }
+
+    public void setCollegeId(Long collegeId) {
+        this.collegeId = collegeId;
+    }
+}

+ 13 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/entity/TAExamCourseRecordDio.java

@@ -60,6 +60,11 @@ public class TAExamCourseRecordDio implements Serializable {
     @TableField(value = "course_name")
     private String courseName;
 
+    @ApiModelProperty(value = "学生id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    @TableField(value = "student_id")
+    private Long studentId;
+
     @ApiModelProperty(value = "考号")
     @TableField(value = "student_code")
     private String studentCode;
@@ -212,4 +217,12 @@ public class TAExamCourseRecordDio implements Serializable {
     public void setSchoolId(Long schoolId) {
         this.schoolId = schoolId;
     }
+
+    public Long getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Long studentId) {
+        this.studentId = studentId;
+    }
 }

+ 13 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/entity/TAExamCourseRecordMod.java

@@ -56,6 +56,11 @@ public class TAExamCourseRecordMod implements Serializable {
     @TableField(value = "course_name")
     private String courseName;
 
+    @ApiModelProperty(value = "考生id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    @TableField(value = "student_id")
+    private Long studentId;
+
     @ApiModelProperty(value = "考号")
     @TableField(value = "student_code")
     private String studentCode;
@@ -248,4 +253,12 @@ public class TAExamCourseRecordMod implements Serializable {
     public void setStudentCode(String studentCode) {
         this.studentCode = studentCode;
     }
+
+    public Long getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Long studentId) {
+        this.studentId = studentId;
+    }
 }

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

@@ -51,6 +51,55 @@ public class TAPaperStruct implements Serializable {
     @TableField(value = "course_name")
     private String courseName;
 
+    @ApiModelProperty(value = "基础试卷id(冗余)")
+    @JsonSerialize(using = ToStringSerializer.class)
+    @TableField(value = "paper_id")
+    private Long paperId;
+
+    @ApiModelProperty(value = "大题名称")
+    @TableField(value = "question_name")
+    private String questionName;
+
+    @ApiModelProperty(value = "题号类型(客观题、主观题)")
+    @TableField(value = "number_type")
+    private String numberType;
+
+    @ApiModelProperty(value = "大题号")
+    @TableField(value = "big_question_number")
+    private String bigQuestionNumber;
+
+    @ApiModelProperty(value = "小题号(每一课程试卷的唯一标识)")
+    @TableField(value = "small_question_number")
+    private String smallQuestionNumber;
+
+    @ApiModelProperty(value = "题目类型")
+    @TableField(value = "question_type")
+    private String questionType;
+
+    @ApiModelProperty(value = "满分")
+    @TableField(value = "full_score")
+    private BigDecimal fullScore;
+
+    @ApiModelProperty(value = "计分规则")
+    @TableField(value = "score_rules")
+    private String scoreRules;
+
+    @ApiModelProperty(value = "规则说明")
+    @TableField(value = "rules_desc")
+    private String rulesDesc;
+
+    @ApiModelProperty(value = "知识维度")
+    @TableField(value = "knowledge_dimension")
+    private String knowledgeDimension;
+
+    @ApiModelProperty(value = "能力维度")
+    @TableField(value = "ability_dimension")
+    private String abilityDimension;
+
+    @ApiModelProperty(value = "素养维度")
+    @TableField(value = "literacy_dimension")
+    private String literacyDimension;
+
     @ApiModelProperty(value = "得分率")
     @TableField(value = "score_rate")
     private BigDecimal scoreRate;
@@ -83,30 +132,6 @@ public class TAPaperStruct implements Serializable {
         this.paperStructId = paperStructId;
     }
 
-    public BigDecimal getScoreRate() {
-        return scoreRate;
-    }
-
-    public void setScoreRate(BigDecimal scoreRate) {
-        this.scoreRate = scoreRate;
-    }
-
-    public String getDifficult() {
-        return difficult;
-    }
-
-    public void setDifficult(String difficult) {
-        this.difficult = difficult;
-    }
-
-    public BigDecimal getValidity() {
-        return validity;
-    }
-
-    public void setValidity(BigDecimal validity) {
-        this.validity = validity;
-    }
-
     public Long getExamId() {
         return examId;
     }
@@ -115,6 +140,14 @@ public class TAPaperStruct implements Serializable {
         this.examId = examId;
     }
 
+    public Long getSchoolId() {
+        return schoolId;
+    }
+
+    public void setSchoolId(Long schoolId) {
+        this.schoolId = schoolId;
+    }
+
     public String getCourseCode() {
         return courseCode;
     }
@@ -131,11 +164,123 @@ public class TAPaperStruct implements Serializable {
         this.courseName = courseName;
     }
 
-    public Long getSchoolId() {
-        return schoolId;
+    public Long getPaperId() {
+        return paperId;
     }
 
-    public void setSchoolId(Long schoolId) {
-        this.schoolId = schoolId;
+    public void setPaperId(Long paperId) {
+        this.paperId = paperId;
+    }
+
+    public String getQuestionName() {
+        return questionName;
+    }
+
+    public void setQuestionName(String questionName) {
+        this.questionName = questionName;
+    }
+
+    public String getNumberType() {
+        return numberType;
+    }
+
+    public void setNumberType(String numberType) {
+        this.numberType = numberType;
+    }
+
+    public String getBigQuestionNumber() {
+        return bigQuestionNumber;
+    }
+
+    public void setBigQuestionNumber(String bigQuestionNumber) {
+        this.bigQuestionNumber = bigQuestionNumber;
+    }
+
+    public String getSmallQuestionNumber() {
+        return smallQuestionNumber;
+    }
+
+    public void setSmallQuestionNumber(String smallQuestionNumber) {
+        this.smallQuestionNumber = smallQuestionNumber;
+    }
+
+    public String getQuestionType() {
+        return questionType;
+    }
+
+    public void setQuestionType(String questionType) {
+        this.questionType = questionType;
+    }
+
+    public BigDecimal getFullScore() {
+        return fullScore;
+    }
+
+    public void setFullScore(BigDecimal fullScore) {
+        this.fullScore = fullScore;
+    }
+
+    public String getScoreRules() {
+        return scoreRules;
+    }
+
+    public void setScoreRules(String scoreRules) {
+        this.scoreRules = scoreRules;
+    }
+
+    public String getRulesDesc() {
+        return rulesDesc;
+    }
+
+    public void setRulesDesc(String rulesDesc) {
+        this.rulesDesc = rulesDesc;
+    }
+
+    public String getKnowledgeDimension() {
+        return knowledgeDimension;
+    }
+
+    public void setKnowledgeDimension(String knowledgeDimension) {
+        this.knowledgeDimension = knowledgeDimension;
+    }
+
+    public String getAbilityDimension() {
+        return abilityDimension;
+    }
+
+    public void setAbilityDimension(String abilityDimension) {
+        this.abilityDimension = abilityDimension;
+    }
+
+    public String getLiteracyDimension() {
+        return literacyDimension;
+    }
+
+    public void setLiteracyDimension(String literacyDimension) {
+        this.literacyDimension = literacyDimension;
+    }
+
+    public BigDecimal getScoreRate() {
+        return scoreRate;
+    }
+
+    public void setScoreRate(BigDecimal scoreRate) {
+        this.scoreRate = scoreRate;
+    }
+
+    public String getDifficult() {
+        return difficult;
+    }
+
+    public void setDifficult(String difficult) {
+        this.difficult = difficult;
+    }
+
+    public BigDecimal getValidity() {
+        return validity;
+    }
+
+    public void setValidity(BigDecimal validity) {
+        this.validity = validity;
     }
 }

+ 11 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/mapper/TBAnswerMapper.java

@@ -1,12 +1,14 @@
 package com.qmth.teachcloud.report.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qmth.teachcloud.report.business.bean.dto.AnswerDetailBean;
 import com.qmth.teachcloud.report.business.bean.dto.query.BasicAnswerDto;
 import com.qmth.teachcloud.report.business.bean.dto.query.ValidAnswerDetailDto;
 import com.qmth.teachcloud.report.business.bean.result.TBAnswerResult;
 import com.qmth.teachcloud.report.business.entity.TBAnswer;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.LinkedList;
 import java.util.List;
 
 /**
@@ -44,4 +46,13 @@ public interface TBAnswerMapper extends BaseMapper<TBAnswer> {
      * @return
      */
     List<TBAnswerResult> findValidAnswerDetail(@Param("examId") Long examId, @Param("courseCode") String courseCode);
+
+    /**
+     * 查找实际参加考试的详细作答记录
+     *
+     * @param examId  考试id
+     * @param courseCode  课程编号
+     * @return 键值对
+     */
+    LinkedList<AnswerDetailBean> findValidAnswerDetailWithPap(@Param("examId") Long examId, @Param("courseCode") String courseCode);
 }

+ 8 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/AnalyzeForStudentService.java

@@ -80,6 +80,14 @@ public interface AnalyzeForStudentService {
      */
     String buildAnalyzePaperStruct(Long examId,String courseCode);
 
+    /**
+     * 构建科目题目难度分类得分率表
+     * @param examId 考试id
+     * @param courseCode 课程编号
+     * @return 结果
+     */
+    String buildExamPaperDifficult(Long examId,String courseCode);
+
     /**
      * 构建表 ‘t_a_exam_total’
      * @param examId 考试id

+ 11 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/TBAnswerService.java

@@ -1,11 +1,13 @@
 package com.qmth.teachcloud.report.business.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.teachcloud.report.business.bean.dto.AnswerDetailBean;
 import com.qmth.teachcloud.report.business.bean.dto.query.BasicAnswerDto;
 import com.qmth.teachcloud.report.business.bean.dto.query.ValidAnswerDetailDto;
 import com.qmth.teachcloud.report.business.bean.result.TBAnswerResult;
 import com.qmth.teachcloud.report.business.entity.TBAnswer;
 
+import java.util.LinkedList;
 import java.util.List;
 
 /**
@@ -43,4 +45,13 @@ public interface TBAnswerService extends IService<TBAnswer> {
      * @return
      */
     List<TBAnswerResult> findValidAnswerDetail(Long examId, String courseCode);
+
+    /**
+     * 查找实际参加考试的详细作答记录
+     *
+     * @param examId  考试id
+     * @param courseCode  课程编号
+     * @return 键值对
+     */
+    LinkedList<AnswerDetailBean> findValidAnswerDetailWithPap(Long examId, String courseCode);
 }

+ 105 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/AnalyzeForStudentServiceImpl.java

@@ -7,6 +7,7 @@ import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.service.BasicCourseService;
 import com.qmth.teachcloud.common.service.SysOrgService;
 import com.qmth.teachcloud.common.service.SysUserService;
+import com.qmth.teachcloud.report.business.bean.dto.AnswerDetailBean;
 import com.qmth.teachcloud.report.business.bean.dto.query.BasicAnswerDto;
 import com.qmth.teachcloud.report.business.bean.dto.query.ValidAnswerDetailDto;
 import com.qmth.teachcloud.report.business.entity.*;
@@ -87,6 +88,8 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
     private TAExamCourseTeacherService taExamCourseTeacherService;
     @Resource
     private SysUserService sysUserService;
+    @Resource
+    private TAExamCourseDifficultService taExamCourseDifficultService;
 
 
     @Transactional(rollbackFor = Exception.class)
@@ -624,6 +627,8 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
                         taExamCourseRecordDio.setExamRecordId(taExamCourseRecord.getExamRecordId());
                         taExamCourseRecordDio.setPaperId(taExamCourseRecord.getPaperId());
                         taExamCourseRecordDio.setExamId(taExamCourseRecord.getExamId());
+                        taExamCourseRecordDio.setStudentId(taExamCourseRecord.getStudentId());
+                        taExamCourseRecordDio.setStudentCode(taExamCourseRecord.getStudentCode());
                         taExamCourseRecordDio.setCourseCode(effectiveCourseCode);
                         taExamCourseRecordDio.setCourseName(basicCourseService.findByCourseCode(effectiveCourseCode).getName());
                         String[] dimCodeArr = s.split("-");
@@ -684,6 +689,8 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
                         taExamCourseRecordMod.setProficiency(this.handleModuleProficiency(examId,effectiveCourseCode,s,rate));
                         taExamCourseRecordMod.setInspectCollegeId(inspectCollegeId);
                         taExamCourseRecordMod.setInspectCollegeName(inspectCollegeName);
+                        taExamCourseRecordMod.setStudentId(taExamCourseRecord.getStudentId());
+                        taExamCourseRecordMod.setStudentCode(taExamCourseRecord.getStudentCode());
                         taExamCourseRecordModList.add(taExamCourseRecordMod);
                     }
                 }
@@ -854,6 +861,19 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
                     taPaperStruct.setSchoolId(tbExamService.getById(examId).getSchoolId());
                     taPaperStruct.setCourseCode(courseCode);
                     taPaperStruct.setCourseName(basicCourseService.findByCourseCode(courseCode).getName());
+                    taPaperStruct.setPaperId(paperId);
+                    taPaperStruct.setQuestionName(paperStruct.getQuestionName());
+                    taPaperStruct.setNumberType(paperStruct.getNumberType());
+                    taPaperStruct.setBigQuestionNumber(paperStruct.getBigQuestionNumber());
+                    taPaperStruct.setSmallQuestionNumber(paperStruct.getSmallQuestionNumber());
+                    taPaperStruct.setQuestionType(paperStruct.getQuestionType());
+                    taPaperStruct.setFullScore(paperStruct.getFullScore());
+                    taPaperStruct.setScoreRules(paperStruct.getScoreRules());
+                    taPaperStruct.setRulesDesc(paperStruct.getRulesDesc());
+                    taPaperStruct.setKnowledgeDimension(paperStruct.getKnowledgeDimension());
+                    taPaperStruct.setAbilityDimension(paperStruct.getAbilityDimension());
+                    taPaperStruct.setLiteracyDimension(paperStruct.getLiteracyDimension());
+
                     taPaperStruct.setScoreRate(scoreRate);
                     taPaperStruct.setDifficult(difficult);
                     taPaperStruct.setValidity(BigDecimal.valueOf(validity));
@@ -866,6 +886,91 @@ public class AnalyzeForStudentServiceImpl implements AnalyzeForStudentService {
         return " 't_a_paper_struct'表构建成功 ";
     }
 
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public String buildExamPaperDifficult(Long examId, String courseCode) {
+        // 可分析有效课程信息
+        List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId,courseCode);
+
+        for (String effectiveCourseCode : effectiveCourseCodeList) {
+            taExamCourseDifficultService.remove(new QueryWrapper<TAExamCourseDifficult>().lambda()
+                    .eq(TAExamCourseDifficult::getExamId,examId)
+                    .eq(TAExamCourseDifficult::getCourseCode,courseCode));
+
+            List<TAExamCourseDifficult> taExamCourseDifficultList = new ArrayList<>();
+
+            List<TBCommonLevelConfig> configLevelDatasource = tbCommonLevelConfigService.list(new QueryWrapper<TBCommonLevelConfig>().lambda()
+                    .eq(TBCommonLevelConfig::getExamId,examId).eq(TBCommonLevelConfig::getCourseCode,effectiveCourseCode));// 该科目试题难度情况数据源
+
+            List<TAPaperStruct> questionDatasource = taPaperStructService.list(new QueryWrapper<TAPaperStruct>().lambda()
+                    .eq(TAPaperStruct::getExamId,examId).eq(TAPaperStruct::getCourseCode,effectiveCourseCode));// 该科目试题情况数据源
+
+            LinkedList<AnswerDetailBean> answerDetailDatasource = tbAnswerService.findValidAnswerDetailWithPap(examId,courseCode);
+            Set<Long> paperTypeList = questionDatasource.stream().map(TAPaperStruct::getPaperId).collect(Collectors.toSet());
+
+            for (Long paperId : paperTypeList) {
+                for (TBCommonLevelConfig levelTemp : configLevelDatasource) {
+                    String interpret = levelTemp.getInterpret();
+                    String scope = levelTemp.getScope();
+
+                    List<TAPaperStruct> questionList = questionDatasource.stream()
+                            .filter(e -> paperId.equals(e.getPaperId()) && interpret.equals(e.getDifficult()))
+                            .collect(Collectors.toList()); // 题目信息
+
+                    List<AnswerDetailBean> answerDetailForSch = answerDetailDatasource.stream()
+                            .filter(e -> paperId.equals(e.getPaperId()) && interpret.equals(e.getDifficult()))
+                            .collect(Collectors.toList());
+
+                    double schAvgScoreRate = answerDetailForSch.stream()
+                            .collect(Collectors.summarizingDouble(AnswerDetailBean::getScoreRate))
+                            .getAverage();
+
+                    // 学院id集合
+                    List<Long> collegeIdList = taExamCourseRecordService.list(new QueryWrapper<TAExamCourseRecord>().lambda()
+                            .eq(TAExamCourseRecord::getExamId,examId)
+                            .eq(TAExamCourseRecord::getCourseCode,courseCode)
+                            .eq(TAExamCourseRecord::getPaperId,paperId)
+                            .eq(TAExamCourseRecord::getAbsent,false)
+                            .eq(TAExamCourseRecord::getStudentCurrent,true))
+                            .stream()
+                            .map(TAExamCourseRecord::getInspectCollegeId).distinct()
+                            .collect(Collectors.toList());
+
+                    for (Long collegeId : collegeIdList) {
+                        List<AnswerDetailBean> answerDetailForCol = answerDetailForSch.stream()
+                                .filter(e -> collegeId.equals(e.getCollegeId())).collect(Collectors.toList());
+
+                        double colAvgScoreRate = answerDetailForCol.stream()
+                                .collect(Collectors.summarizingDouble(AnswerDetailBean::getScoreRate))
+                                .getAverage();
+
+                        // 得分率保留2位小数处理
+                        Integer count = questionList.size();
+
+                        TAExamCourseDifficult taExamCourseDifficult = new TAExamCourseDifficult();
+                        taExamCourseDifficult.setId(SystemConstant.getDbUuid());
+                        taExamCourseDifficult.setExamId(examId);
+                        taExamCourseDifficult.setCourseCode(effectiveCourseCode);
+                        taExamCourseDifficult.setCourseName(basicCourseService.findByCourseCode(effectiveCourseCode).getName());
+                        taExamCourseDifficult.setCollegeId(collegeId);
+                        taExamCourseDifficult.setSchoolId(tbExamService.getById(examId).getSchoolId());
+                        taExamCourseDifficult.setInterpret(interpret);
+                        taExamCourseDifficult.setCount(count);
+                        taExamCourseDifficult.setScope(scope);
+                        taExamCourseDifficult.setSchAvgScoreRate(BigDecimal.valueOf(schAvgScoreRate));
+                        taExamCourseDifficult.setColAvgScoreRate(BigDecimal.valueOf(colAvgScoreRate));
+
+                        taExamCourseDifficultList.add(taExamCourseDifficult);
+                    }
+                }
+            }
+
+            taExamCourseDifficultService.saveBatch(taExamCourseDifficultList);
+        }
+
+        return "'t_a_exam_course_difficult' 表构建完成";
+    }
+
     @Transactional(rollbackFor = Exception.class)
     @Override
     public String buildAnalyzeExamTotal(Long examId) {

+ 7 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TBAnswerServiceImpl.java

@@ -1,6 +1,7 @@
 package com.qmth.teachcloud.report.business.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.teachcloud.report.business.bean.dto.AnswerDetailBean;
 import com.qmth.teachcloud.report.business.bean.dto.query.BasicAnswerDto;
 import com.qmth.teachcloud.report.business.bean.dto.query.ValidAnswerDetailDto;
 import com.qmth.teachcloud.report.business.bean.result.TBAnswerResult;
@@ -10,6 +11,7 @@ import com.qmth.teachcloud.report.business.service.TBAnswerService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.LinkedList;
 import java.util.List;
 
 /**
@@ -47,4 +49,9 @@ public class TBAnswerServiceImpl extends ServiceImpl<TBAnswerMapper, TBAnswer> i
     public List<TBAnswerResult> findValidAnswerDetail(Long examId, String courseCode) {
         return tbAnswerMapper.findValidAnswerDetail(examId, courseCode);
     }
+
+    @Override
+    public LinkedList<AnswerDetailBean> findValidAnswerDetailWithPap(Long examId, String courseCode) {
+        return tbAnswerMapper.findValidAnswerDetailWithPap(examId, courseCode);
+    }
 }

+ 23 - 0
teachcloud-report-business/src/main/resources/mapper/TBAnswerMapper.xml

@@ -77,4 +77,27 @@
             and tik.absent = 0
         </where>
     </select>
+
+    <select id="findValidAnswerDetailWithPap"
+            resultType="com.qmth.teachcloud.report.business.bean.dto.AnswerDetailBean">
+        SELECT
+            college.id AS collegeId,
+            struct.paper_id AS paperId,
+            record.paper_type AS paperType,
+            answer.score / struct.full_score AS scoreRate,
+            struct.difficult AS difficult,
+            college.name AS collegeName
+        FROM
+            t_b_answer answer
+                INNER JOIN t_a_exam_course_record record ON answer.exam_record_id = record.exam_record_id
+                INNER JOIN t_a_paper_struct struct ON record.paper_id = struct.paper_id
+                INNER JOIN sys_org college ON record.inspect_college_id = college.id
+                AND answer.number_type = struct.number_type
+                AND answer.main_number = struct.big_question_number
+                AND answer.sub_number = struct.small_question_number
+        WHERE
+            record.exam_id = #{examId}
+          AND record.course_code = #{courseCode}
+          AND record.absent = 0 ;
+    </select>
 </mapper>

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

@@ -68,6 +68,13 @@ public class AnalyzeForStudentServiceTest {
         System.out.println(analyzeForStudentService.buildAnalyzePaperStruct(examId,courseCode));
     }
 
+    @Test
+    public void buildExamPaperDifficult(){
+        Long examId = 1L;
+        String courseCode = "1013";
+        System.out.println(analyzeForStudentService.buildExamPaperDifficult(examId,courseCode));
+    }
+
     @Test
     public void buildAnalyzeExamTotal() {
         Long examId = 1L;