Browse Source

学生作业报告作业详情显示答案控制

tags/正式3.10.0
雍文秀 1 year ago
parent
commit
575ea6dffd

+ 4
- 3
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/paperreport/PaperStudentReportMapper.java View File

@@ -24,14 +24,15 @@ public interface PaperStudentReportMapper {
24 24
 
25 25
     //题库作业试题
26 26
     List<Map> listTkSt(@Param("paperid") Integer paperid, @Param("classid") Integer classid
27
-            ,@Param("studentid") Integer studentid);
27
+            , @Param("studentid") Integer studentid,@Param("showanswer") Integer showanswer);
28 28
 
29 29
     //附件作业试题
30 30
     List<Map> listFjSt(@Param("paperid") Integer paperid, @Param("classid") Integer classid
31
-            ,@Param("studentid") Integer studentid);
31
+            ,@Param("studentid") Integer studentid,@Param("showanswer") Integer showanswer);
32 32
 
33 33
     //题库作业子题
34
-    List<Map> listZtQuestion(@Param("questionids") List<String> questionids,@Param("psid") Integer psid);
34
+    List<Map> listZtQuestion(@Param("questionids") List<String> questionids,@Param("psid") Integer psid
35
+            ,@Param("showanswer") Integer showanswer);
35 36
 
36 37
     //优秀作答
37 38
     List<Map> listGoodAnswer(@Param("paperid") Integer paperid, @Param("classid") Integer classid

+ 28
- 21
sstudy/src/main/java/com/xhkjedu/sstudy/service/paperreport/PaperStudentReportService.java View File

@@ -49,9 +49,10 @@ public class PaperStudentReportService {
49 49
     public Map getPaperDetail(Integer paperid, Integer classid, Integer studentid) {
50 50
         Map paper = paperStudentReportMapper.getPaperAnalyze(paperid, classid, studentid);
51 51
         Integer papertype = (Integer) paper.get("papertype");
52
+        Integer showanswer = N_Utils.str2Int(paper.get("showanswer").toString());
52 53
         List<Map> list;
53 54
         if (papertype == 1 || papertype == 3) {// 题库、靶向作业
54
-            list = paperStudentReportMapper.listTkSt(paperid, classid, studentid);
55
+            list = paperStudentReportMapper.listTkSt(paperid, classid, studentid, showanswer);
55 56
             List<Map> questions = new ArrayList<>();// 题库作业子题
56 57
             List<String> questionids = new ArrayList<>();
57 58
             list.forEach(t -> {
@@ -60,45 +61,51 @@ public class PaperStudentReportService {
60 61
                                                .map(q -> q.get("questionid").toString()).collect(Collectors.toList()));
61 62
             });
62 63
 
63
-            if (N_Utils.isListNotEmpty(questionids)) questions = paperStudentReportMapper.listZtQuestion(questionids, (Integer) paper.get("psid"));
64
+            if (N_Utils.isListNotEmpty(questionids)) questions = paperStudentReportMapper.listZtQuestion(questionids, (Integer) paper.get("psid"), showanswer);
64 65
             Object pointjson = paper.get("pointjson");
65 66
             List<Map> points = JSON.parseArray(pointjson.toString(), Map.class);
66 67
             for (Map t : list) {
67 68
                 for (Map q : (List<Map>) t.get("questions")) {
68 69
                     String questionid = q.get("questionid").toString();
69
-                    q.put("pointnames", getQuestionPoint(points, questionid));// 试题知识点
70 70
                     if (q.get("qlevel").equals(2)) {
71 71
                         List<Map> sonques = questions.stream().filter(tq -> questionid.equals(tq.get("questionpid"))).collect(Collectors.toList());
72 72
                         q.put("sonques", sonques);
73
-                        Integer good = 0;
74
-                        long count = sonques.stream().filter(s -> s.get("good").equals(1)).count();
75
-                        if (count != 0) {
76
-                            good = 1;
73
+                        if (showanswer == 1) {
74
+                            Integer good = 0;
75
+                            long count = sonques.stream().filter(s -> s.get("good").equals(1)).count();
76
+                            if (count != 0) {
77
+                                good = 1;
78
+                            }
79
+                            q.put("good", good);
77 80
                         }
78
-                        q.put("good", good);
79 81
                     }
80
-                    if(N_Utils.isEmpty(q.get("classavgscore"))){
81
-                        q.put("classavgscore",0);
82
-                    }
83
-                    if(N_Utils.isEmpty(q.get("classscorerate"))){
84
-                        q.put("classscorerate",0);
82
+                    if (showanswer == 1) {
83
+                        if(N_Utils.isEmpty(q.get("classavgscore"))){
84
+                            q.put("classavgscore",0);
85
+                        }
86
+                        if(N_Utils.isEmpty(q.get("classscorerate"))){
87
+                            q.put("classscorerate",0);
88
+                        }
89
+                        q.put("pointnames", getQuestionPoint(points, questionid));// 试题知识点
90
+                        q.put("ratetype", StudyUtil.getScoreRateType(StudyUtil.objToDouble(q.get("scorerate"))));
85 91
                     }
86
-                    q.put("ratetype", StudyUtil.getScoreRateType(StudyUtil.objToDouble(q.get("scorerate"))));
87 92
                 }
88 93
             }
89 94
         } else {// 附件作业
90 95
             String papername = paper.get("papername").toString();
91
-            list = paperStudentReportMapper.listFjSt(paperid, classid, studentid);
96
+            list = paperStudentReportMapper.listFjSt(paperid, classid, studentid, showanswer);
92 97
             for (Map t : list) {
93 98
                 for (Map q : (List<Map>) t.get("questions")) {
94 99
                     q.put("qstem", papername + "-第" + q.get("qorder") + "题");
95
-                    if(N_Utils.isEmpty(q.get("classavgscore"))){
96
-                        q.put("classavgscore",0);
97
-                    }
98
-                    if(N_Utils.isEmpty(q.get("classscorerate"))){
99
-                        q.put("classscorerate",0);
100
+                    if (showanswer == 1) {
101
+                        if (N_Utils.isEmpty(q.get("classavgscore"))) {
102
+                            q.put("classavgscore", 0);
103
+                        }
104
+                        if (N_Utils.isEmpty(q.get("classscorerate"))) {
105
+                            q.put("classscorerate", 0);
106
+                        }
107
+                        q.put("ratetype", StudyUtil.getScoreRateType(StudyUtil.objToDouble(q.get("scorerate"))));
100 108
                     }
101
-                    q.put("ratetype", StudyUtil.getScoreRateType(StudyUtil.objToDouble(q.get("scorerate"))));
102 109
                 }
103 110
             }
104 111
         }

+ 19
- 12
sstudy/src/main/resources/mapper/paperreport/PaperStudentReportMapper.xml View File

@@ -25,7 +25,7 @@
25 25
     </select>
26 26
     <!--作业分析-->
27 27
     <select id="getPaperAnalyze" resultType="java.util.Map">
28
-        select p.paperid,p.papertype,p.papername,pa.pointjson,ps.showanswer,ps.psid
28
+        select p.paperid,p.papertype,p.papername,pa.pointjson,ifnull(ps.showanswer,0)showanswer,ps.psid
29 29
         ,(select pc.showtype from t_paper_class pc where pc.paperid=ps.paperid and pc.classid=ps.classid)showtype
30 30
         from t_paper p left join t_paper_analyze pa on p.paperid = pa.paperid
31 31
         left join t_paper_student ps on p.paperid = ps.paperid
@@ -69,10 +69,13 @@
69 69
     <select id="listTkSt" resultMap="typeResult">
70 70
         select pq.qtypename,pq.ptid,pq.ptorder,pqq.qn,psq.qorder,sum(psq.qscore)qscore,tq.ctype,
71 71
         pqq.questionpid questionid,tq.qtypename qqtypename
72
-        ,q.classavgscore,q.classscorerate,truncate(sum(psq.stuscore)*100/sum(psq.qscore),2)scorerate
73
-        ,sum(psq.stuscore)stuscore,psq.answertype,psq.useranswer,psq.converted,psq.useranswertxt,psq.good
74
-        ,(case when tq.qlevel=1 then psq.checkcomm else '' end)checkcomm,psq.answered
75
-        ,tq.qstem,tq.qoption,tq.qanswer,tq.qanalyze,tq.hashear,tq.hearfile,tq.qlevel
72
+        <if test="showanswer==1">
73
+            ,q.classavgscore,q.classscorerate,truncate(sum(psq.stuscore)*100/sum(psq.qscore),2)scorerate
74
+            ,sum(psq.stuscore)stuscore,psq.good,tq.qanswer,tq.qanalyze
75
+            ,(case when tq.qlevel=1 then psq.checkcomm else '' end)checkcomm
76
+        </if>
77
+        ,psq.answered,psq.answertype,psq.useranswer,psq.converted,psq.useranswertxt
78
+        ,tq.qstem,tq.qoption,tq.hashear,tq.hearfile,tq.qlevel
76 79
         from t_paper_qtype_question pqq left join t_paper_qtype pq on pqq.ptid=pq.ptid
77 80
         left join t_paper_student_question psq on pqq.paperid=psq.paperid
78 81
         and psq.classid=#{classid} and psq.studentid=#{studentid} and pqq.questionid=psq.questionid
@@ -84,10 +87,12 @@
84 87
     <!--附件作业试题-->
85 88
     <select id="listFjSt" resultMap="typeResult">
86 89
         select pq.qtypename,pq.psqtypeid ptid,pq.pstorder ptorder,ps.qn,ps.psorder qorder,ps.psscore qscore,ps.ctype,
87
-        ps.psanswer qanswer,ps.optionnum,ps.pscaid ptqid,ps.qtypename qqtypename,
88
-        q.classavgscore,q.classscorerate,truncate(pss.stuscore*100/pss.qscore,2)scorerate
89
-        ,pss.stuscore,pss.answertype,pss.useranswer,pss.converted,pss.useranswertxt,pss.good
90
-        ,pss.checkcomm,pss.answered
90
+        ps.optionnum,ps.pscaid ptqid,ps.qtypename qqtypename
91
+        <if test="showanswer==1">
92
+            ,q.classavgscore,q.classscorerate,truncate(pss.stuscore*100/pss.qscore,2)scorerate
93
+            ,pss.stuscore,pss.good,pss.checkcomm,ps.psanswer qanswer
94
+        </if>
95
+        ,pss.answered,pss.answertype,pss.useranswer,pss.converted,pss.useranswertxt
91 96
         from t_paper_scantron ps left join t_paper_student_scantron pss on ps.pscaid=pss.pscaid
92 97
         left join t_paper_scantron_qtype pq on ps.psqtypeid=pq.psqtypeid
93 98
         left join t_paper_rclass_question q
@@ -98,9 +103,11 @@
98 103
     <!--题库作业子题-->
99 104
     <select id="listZtQuestion" resultType="java.util.Map">
100 105
         select q.questionid,q.questionpid,q.qscore,q.qn
101
-        ,q.stuscore,q.answertype,q.useranswer,q.converted,q.useranswertxt,q.good
102
-        ,ifnull(q.checkcomm,'')checkcomm,q.answered
103
-        ,tq.sorder,tq.qstem,tq.qoption,tq.qanswer,tq.qanalyze,tq.ctype,tq.qtypename
106
+        ,q.answered,q.answertype,q.useranswer,q.converted,q.useranswertxt
107
+        <if test="showanswer==1">
108
+            ,q.stuscore,q.good,ifnull(q.checkcomm,'')checkcomm,tq.qanswer,tq.qanalyze
109
+        </if>
110
+        ,tq.sorder,tq.qstem,tq.qoption,tq.ctype,tq.qtypename
104 111
         from t_question tq right join t_paper_student_question q on tq.questionid=q.questionid
105 112
         where q.psid=#{psid} and tq.questionpid in
106 113
         <foreach collection="questionids" item="questionid" open="(" separator="," close=")">#{questionid}</foreach>

Loading…
Cancel
Save