Browse Source

作业按题统计

tags/正式版本
雍文秀 2 years ago
parent
commit
0a71ccb3e8

+ 2
- 2
sstudy/src/main/java/com/xhkjedu/sstudy/controller/paper/PaperAnalyzeController.java View File

@@ -84,12 +84,12 @@ public class PaperAnalyzeController {
84 84
     }
85 85
 
86 86
     @PostMapping("/question_detail")
87
-    public ResultVo questionDetailAnalyze(@RequestBody TPaperStudentQuestion paper){
87
+    public ResultVo questionDetailAnalyze(@RequestBody AnalyzeQuestionVo paper){
88 88
         Integer paperid = paper.getPaperid();
89 89
         String questionid = paper.getQuestionid();
90 90
         Integer classid=paper.getClassid();
91 91
         N_Utils.validation(new Object[]{paperid,"作业id",1,questionid,"试题id",2,classid,"班级id",1});
92
-        QuestionAnalyzeVo analyze = paperAnalyzeService.getQuestionDetailAnalyze(paperid, questionid,classid);
92
+        QuestionAnalyzeVo analyze = paperAnalyzeService.getQuestionDetailAnalyze(paper);
93 93
         return new ResultVo(0,"获取作业统计--按题详情成功",analyze);
94 94
     }
95 95
 

+ 1
- 1
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/paper/PaperAnalyzeMapper.java View File

@@ -97,7 +97,7 @@ public interface PaperAnalyzeMapper extends TkMapper<TPaperAnalyze> {
97 97
      * @Date 2020/6/24 15:37
98 98
      * @return com.xhkjedu.vo.paper.QuestionAnalyzeVo
99 99
      **/
100
-    QuestionAnalyzeVo getQuestionDetailAnalyze(Integer paperid, String questionid, Integer classid);
100
+    QuestionAnalyzeVo getQuestionDetailAnalyze(@Param("question") AnalyzeQuestionVo question);
101 101
 
102 102
     //作业统计--按题详情--学生列表
103 103
     List<AnalyzeStudentVo> listQuestionStu(Integer paperid, String questionid, Integer classid, Integer od);

+ 13
- 2
sstudy/src/main/java/com/xhkjedu/sstudy/service/paper/PaperAnalyzeService.java View File

@@ -3,6 +3,7 @@ package com.xhkjedu.sstudy.service.paper;
3 3
 import com.xhkjedu.sstudy.mapper.gradeclass.ClassMapper;
4 4
 import com.xhkjedu.sstudy.mapper.paper.PaperAnalyzeMapper;
5 5
 import com.xhkjedu.sstudy.mapper.paper.PaperMapper;
6
+import com.xhkjedu.sstudy.mapper.question.QuestionMapper;
6 7
 import com.xhkjedu.sstudy.mapper.subjectbook.SubjectMapper;
7 8
 import com.xhkjedu.sstudy.mapper.system.SchoolMapper;
8 9
 import com.xhkjedu.sstudy.model.paper.TPaper;
@@ -40,6 +41,8 @@ public class PaperAnalyzeService {
40 41
     private SchoolMapper schoolMapper;
41 42
     @Resource
42 43
     private SubjectMapper subjectMapper;
44
+    @Resource
45
+    private QuestionMapper questionMapper;
43 46
 
44 47
     /**
45 48
      * 作业分析
@@ -133,8 +136,16 @@ public class PaperAnalyzeService {
133 136
      * @Date 2020/6/24 15:37
134 137
      * @return com.xhkjedu.sstudy.vo.paper.QuestionAnalyzeVo
135 138
      **/
136
-    public QuestionAnalyzeVo getQuestionDetailAnalyze(Integer paperid, String questionid,Integer classid) {
137
-        return paperAnalyzeMapper.getQuestionDetailAnalyze(paperid, questionid,classid);
139
+    public QuestionAnalyzeVo getQuestionDetailAnalyze(AnalyzeQuestionVo question) {
140
+        QuestionAnalyzeVo analyze = paperAnalyzeMapper.getQuestionDetailAnalyze(question);
141
+        String questionpid = question.getQuestionpid();
142
+        String questionid = question.getQuestionid();
143
+        if(N_Utils.isEmpty(questionpid)) question.setQuestionpid(questionid);
144
+        if (!questionpid.equals(questionid)) {
145
+            List<Map> sonqlist = questionMapper.listSonQuestionsForDetail(questionpid);
146
+            analyze.setSonqlist(sonqlist);
147
+        }
148
+        return analyze;
138 149
     }
139 150
 
140 151
     //作业统计--按题详情--学生列表

+ 2
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/paper/AnalyzeQuestionVo.java View File

@@ -53,4 +53,6 @@ public class AnalyzeQuestionVo {
53 53
 
54 54
     //学生人数
55 55
     private Integer stunum;
56
+    private String questionpid;//复合题对应母题id
57
+    private String qns;//显示题号
56 58
 }

+ 2
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/paper/QuestionAnalyzeVo.java View File

@@ -4,6 +4,7 @@ import com.xhkjedu.sstudy.model.paper.TPaperFile;
4 4
 import lombok.Data;
5 5
 
6 6
 import java.util.List;
7
+import java.util.Map;
7 8
 
8 9
 @Data
9 10
 public class QuestionAnalyzeVo {
@@ -36,4 +37,5 @@ public class QuestionAnalyzeVo {
36 37
 
37 38
     //知识点名称
38 39
     private String pointname;
40
+    private List<Map> sonqlist;//子题
39 41
 }

+ 7
- 5
sstudy/src/main/resources/mapper/paper/PaperAnalyzeMapper.xml View File

@@ -84,7 +84,9 @@
84 84
     </select>
85 85
     <!--作业统计按题-->
86 86
     <select id="getQuestionAnalyze" resultType="com.xhkjedu.sstudy.vo.paper.AnalyzeQuestionVo">
87
-        select ptq.paperid,ptq.questionid,ptq.ptqorder,q.qtypename,ptq.ptqscore totalscore,q.qanswer,truncate(avg(psq.stuscore),2)avgscore
87
+        select ptq.paperid,ptq.questionid,ptq.ptqorder,ptq.questionpid
88
+        ,group_concat(distinct concat(ptq.qn,'_',ptq.questionid))qns
89
+        ,ptq.mqtypename qtypename,ptq.mscore totalscore,truncate(avg(psq.stuscore),2)avgscore
88 90
         ,truncate(avg(psq.costtime),2)avgtime,min(psq.costtime)mintime,count(ps.psid)stunum
89 91
         ,truncate(sum(case when psq.answered=1 then 1 else 0 end)*100/count(ps.psid),2)commitrate
90 92
         ,truncate(SUM(IFNULL(psq.stuscore,0))*100/(ptq.ptqscore*count(ps.psid)),2)scorerate
@@ -95,7 +97,7 @@
95 97
         <if test="papertype==3">
96 98
             and locate(concat('"',ptq.questionid,'"'),ps.questionids)>0
97 99
         </if>
98
-        group by ptq.questionid order by ptq.ptqorder
100
+        group by ptq.ptqorder order by ptq.ptqorder
99 101
     </select>
100 102
     <!--答题卡作业统计按题-->
101 103
     <select id="getSQuestionAnalyze" resultType="com.xhkjedu.sstudy.vo.paper.AnalyzeQuestionVo">
@@ -116,11 +118,11 @@
116 118
 
117 119
     <select id="getQuestionDetailAnalyze" resultType="com.xhkjedu.sstudy.vo.paper.QuestionAnalyzeVo">
118 120
         select q.qtypename,q.qstem,q.qoption,q.qanswer,q.qanalyze,q.ctype
119
-        ,(select ptq.ptqscore from t_paper_qtype_question ptq
120
-        where ptq.paperid=#{paperid} and ptq.questionid=#{questionid}) score
121
+        ,(select ptq.mscore from t_paper_qtype_question ptq
122
+        where ptq.paperid=#{question.paperid} and ptq.questionpid=#{question.questionpid} limit 1) score
121 123
         ,(select group_concat(p.pointname separator '  ') from t_question_point qp
122 124
         left join t_point p on qp.pointid=p.pointid where qp.questionid=q.questionid)pointname
123
-        from t_question q where q.questionid=#{questionid}
125
+        from t_question q where q.questionid=#{question.questionpid}
124 126
     </select>
125 127
     <!--作业统计-按题详情-学生列表-->
126 128
     <select id="listQuestionStu" resultType="com.xhkjedu.sstudy.vo.paper.AnalyzeStudentVo">

Loading…
Cancel
Save