Browse Source

完善接口内容

tags/正式版本
王宁 2 years ago
parent
commit
cc03127cb1

+ 11
- 0
sexam/src/main/java/com/xhkjedu/sexam/controller/report/EReportStudentController.java View File

@@ -117,5 +117,16 @@ public class EReportStudentController {
117 117
         return new ResultVo(0, "获取科目试卷分析成功", map);
118 118
     }
119 119
 
120
+    //错题集--科目错题数量
121
+    @PostMapping("/serrornum")
122
+    public ResultVo listStudentSubjectErrorQues(@RequestBody ReportParamsVo params) {
123
+        Integer studentid = params.getStudentid();
124
+        Integer exmaid = params.getExamid();
125
+        String subjectid = params.getSubjectid();
126
+        N_Utils.validation(new Object[]{exmaid,"考试id",1,studentid,"学生id",1});
127
+        List<Map> map = eReportStudentService.listStudentSubjectErrorQues(exmaid,studentid);
128
+        return new ResultVo(0, "获取科目错题成功", map);
129
+    }
130
+
120 131
 
121 132
 }

+ 2
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/reportstu/ERstudentMapper.java View File

@@ -31,4 +31,6 @@ public interface ERstudentMapper extends TkMapper<ERstudent> {
31 31
     List<Map> listStudentQuestionsTk(@Param("epid")Integer epid,@Param("studentid")Integer studentid);
32 32
     //学生报告-试卷分析(附件)
33 33
     List<Map> listStudentQuestionsFj(@Param("epid")Integer epid,@Param("studentid")Integer studentid);
34
+    //学生报告-错题集-科目下错题
35
+    List<Map> listStudentSubjectErrorQues(@Param("examid")Integer examid,@Param("studentid")Integer studentid);
34 36
 }

+ 6
- 6
sexam/src/main/java/com/xhkjedu/sexam/model/paperstudent/EPaperStudentQuestion.java View File

@@ -20,6 +20,12 @@ public class EPaperStudentQuestion extends BaseBean {
20 20
     //学生id
21 21
     private Integer studentid;
22 22
 
23
+    //考试id
24
+    private Integer examid;
25
+
26
+    //科目id
27
+    private String subjectid;
28
+
23 29
     //试卷id
24 30
     private Integer epid;
25 31
 
@@ -85,12 +91,6 @@ public class EPaperStudentQuestion extends BaseBean {
85 91
     @Transient
86 92
     private String stuname;//学生姓名
87 93
 
88
-    @Transient
89
-    private Integer examid;
90
-
91
-    @Transient
92
-    private String subjectid;
93
-
94 94
     @Transient
95 95
     private String checkname;//批阅人
96 96
 

+ 3
- 1
sexam/src/main/java/com/xhkjedu/sexam/service/exam/EBaseService.java View File

@@ -234,6 +234,8 @@ public class EBaseService {
234 234
                         EPaperStudentQuestion epsq = new EPaperStudentQuestion();
235 235
                         epsq.setClassid(ps.getClassid());
236 236
                         epsq.setStudentid(ps.getStudentid());
237
+                        epsq.setExamid(ps.getExamid());
238
+                        epsq.setSubjectid(ps.getSubjectid());
237 239
                         epsq.setEpid(epid);
238 240
                         epsq.setEpsid(ps.getId());
239 241
                         epsq.setEptqid(q.getEptqid());
@@ -292,10 +294,10 @@ public class EBaseService {
292 294
     @Transactional(rollbackFor = Exception.class)
293 295
     public ResultVo delStu(Integer ecsid) {
294 296
         EClassStudent student = eClassStudentMapper.selectByPrimaryKey(ecsid);
295
-        eClassStudentMapper.deleteByPrimaryKey(ecsid);
296 297
         EBaseVo exam = eBaseMapper.getExamStateById(student.getExamid());
297 298
         int timestamp = N_Utils.getSecondTimestamp() + 30 * 60;
298 299
         if (exam.getBegintime().compareTo(timestamp) != 1) return new ResultVo(1, "开考前30分钟禁止移除学生");
300
+        eClassStudentMapper.deleteByPrimaryKey(ecsid);
299 301
         eClassMapper.updateClassNumByCsId(student.getExamid(), student.getClassid());
300 302
         return new ResultVo(0, "移除考试学生成功");
301 303
     }

+ 2
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/paperstudent/EPaperStudentService.java View File

@@ -145,6 +145,8 @@ public class EPaperStudentService {
145 145
             EPaperStudentQuestion sq = new EPaperStudentQuestion();
146 146
             sq.setClassid(psvo.getClassid());
147 147
             sq.setStudentid(psvo.getStudentid());
148
+            sq.setExamid(psvo.getExamid());
149
+            sq.setSubjectid(psvo.getSubjectid());
148 150
             sq.setEpid(psvo.getEpid());
149 151
             sq.setEpsid(psvo.getEpsid());
150 152
             sq.setEptqid(q.getEptqid());

+ 1
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/paperstudent/EScanbatchService.java View File

@@ -199,6 +199,7 @@ public class EScanbatchService {
199 199
         Map map = new HashMap();
200 200
         map.put("dcllist", dcllist);
201 201
         map.put("ycllist", ycllist);
202
+        map.put("errortype",errortype);
202 203
         return map;
203 204
     }
204 205
 

+ 74
- 40
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportStudentService.java View File

@@ -182,66 +182,100 @@ public class EReportStudentService {
182 182
     }
183 183
 
184 184
     //处理母子题
185
-    private List<Map> setPaperQuestionForTK(List<Map> list){
185
+    private List<Map> setPaperQuestionForTK(List<Map> list) {
186 186
         List<Map> rtnlist = new ArrayList<>();
187 187
         List<String> questiopids = new ArrayList<>();
188
-        for(Map q : list){
188
+        for (Map q : list) {
189 189
             Integer qlevel = Integer.parseInt(q.get("qlevel").toString());
190
-            if(qlevel == 1){
190
+            if (qlevel == 1) {
191 191
                 //代表单题
192 192
                 Map map = new HashMap();
193
-                map.put("epsqid",Integer.parseInt(q.get("epsqid").toString()));
194
-                map.put("eptqid",Integer.parseInt(q.get("eptqid").toString()));
195
-                map.put("ctype",Integer.parseInt(q.get("ctype").toString()));
196
-                map.put("qn",q.get("qn").toString());
197
-                map.put("qorder",Integer.parseInt(q.get("qorder").toString()));
198
-                map.put("qscore",Double.parseDouble(q.get("qscore").toString()));
199
-                map.put("stuscore",Double.parseDouble(q.get("stuscore").toString()));
200
-                map.put("answered",Integer.parseInt(q.get("answered").toString()));
201
-                map.put("answertype",Integer.parseInt(q.get("answertype").toString()));
202
-                map.put("stuanswer",q.get("stuanswer").toString());
203
-                map.put("stuanswertxt",q.get("stuanswertxt").toString());
204
-                map.put("qstem",q.get("qstem").toString());
205
-                map.put("qoption",q.get("qoption").toString());
206
-                map.put("qanswer",q.get("qanswer").toString());
207
-                map.put("qanalyze",q.get("qanalyze").toString());
208
-                map.put("hashear",Integer.parseInt(q.get("hashear").toString()));
209
-                map.put("hearfile",q.get("hearfile").toString());
210
-                map.put("qlevel",qlevel);
211
-                map.put("classavgscore",Integer.parseInt(q.get("classavgscore").toString()));
212
-                map.put("gradeavgscore",Integer.parseInt(q.get("gradeavgscore").toString()));
213
-                if(q.get("points")!=null){
193
+                map.put("epsqid", Integer.parseInt(q.get("epsqid").toString()));
194
+                map.put("eptqid", Integer.parseInt(q.get("eptqid").toString()));
195
+                map.put("ctype", Integer.parseInt(q.get("ctype").toString()));
196
+                map.put("qn", q.get("qn").toString());
197
+                map.put("qorder", Integer.parseInt(q.get("qorder").toString()));
198
+                map.put("qscore", Double.parseDouble(q.get("qscore").toString()));
199
+                map.put("stuscore", Double.parseDouble(q.get("stuscore").toString()));
200
+                map.put("answered", Integer.parseInt(q.get("answered").toString()));
201
+                map.put("answertype", Integer.parseInt(q.get("answertype").toString()));
202
+                map.put("stuanswer", q.get("stuanswer").toString());
203
+                map.put("stuanswertxt", q.get("stuanswertxt").toString());
204
+                map.put("qstem", q.get("qstem").toString());
205
+                map.put("qoption", q.get("qoption").toString());
206
+                map.put("qanswer", q.get("qanswer").toString());
207
+                map.put("qanalyze", q.get("qanalyze").toString());
208
+                map.put("hashear", Integer.parseInt(q.get("hashear").toString()));
209
+                map.put("hearfile", q.get("hearfile").toString());
210
+                map.put("qlevel", qlevel);
211
+                map.put("classavgscore", Integer.parseInt(q.get("classavgscore").toString()));
212
+                map.put("gradeavgscore", Integer.parseInt(q.get("gradeavgscore").toString()));
213
+                if (q.get("points") != null) {
214 214
                     List<Map> points = (List<Map>) q.get("points");
215
-                    map.put("points",points);
215
+                    map.put("points", points);
216 216
                 }
217 217
                 rtnlist.add(map);
218
-            }else{
218
+            } else {
219 219
                 //母题
220 220
                 String questionpid = q.get("questionpid").toString();
221
-                if(!questiopids.contains(questionpid)){
221
+                if (!questiopids.contains(questionpid)) {
222 222
                     questiopids.add(questionpid);
223 223
                     //获取所有试题
224 224
                     List<Map> sonqueslist = list.stream().filter(s -> s.get("questionpid").toString().equals(questionpid)).collect(Collectors.toList());
225 225
                     Map mq = new HashMap();
226
-                    mq.put("questionid",questionpid);
227
-                    mq.put("qlevel",2);
228
-                    mq.put("qorder",Integer.parseInt(q.get("qorder").toString()));
229
-                    mq.put("ctype",Integer.parseInt(q.get("mctype").toString()));
230
-                    mq.put("qstem",q.get("mqstem").toString());
231
-                    mq.put("qoption",q.get("mqoption").toString());
232
-                    mq.put("qanswer",q.get("mqanswer").toString());
233
-                    mq.put("qanalyze",q.get("mqanalyze").toString());
234
-                    mq.put("hashear",Integer.parseInt(q.get("mhashear").toString()));
235
-                    mq.put("hearfile",q.get("mhearfile").toString());
236
-                    if(q.get("points")!=null){
226
+                    mq.put("questionid", questionpid);
227
+                    mq.put("qlevel", 2);
228
+                    mq.put("qorder", Integer.parseInt(q.get("qorder").toString()));
229
+                    mq.put("ctype", Integer.parseInt(q.get("mctype").toString()));
230
+                    mq.put("qstem", q.get("mqstem").toString());
231
+                    mq.put("qoption", q.get("mqoption").toString());
232
+                    mq.put("qanswer", q.get("mqanswer").toString());
233
+                    mq.put("qanalyze", q.get("mqanalyze").toString());
234
+                    mq.put("hashear", Integer.parseInt(q.get("mhashear").toString()));
235
+                    mq.put("hearfile", q.get("mhearfile").toString());
236
+                    if (q.get("points") != null) {
237 237
                         List<Map> points = (List<Map>) q.get("points");
238
-                        mq.put("points",points);
238
+                        mq.put("points", points);
239 239
                     }
240
-                    mq.put("sonques",sonqueslist);
240
+                    mq.put("sonques", sonqueslist);
241 241
                     rtnlist.add(mq);
242 242
                 }
243 243
             }
244 244
         }
245 245
         return rtnlist;
246 246
     }
247
+
248
+    /**
249
+     * @Description 学生报告--错题集
250
+     * @Param [examid, studentid]
251
+     * @Return java.util.List<java.util.Map>
252
+     * @Author wn
253
+     * @Date 2022/8/29 11:39
254
+     **/
255
+    public List<Map> listStudentSubjectErrorQues(Integer examid, Integer studentid) {
256
+        List<Map> list = eRstudentMapper.listStudentSubjectErrorQues(examid, studentid);
257
+        for (Map map : list) {
258
+            List<Map> queslist = (List<Map>) map.get("questions");
259
+            //单题的数量
260
+            List<Map> dtlist = queslist.stream().filter(s -> Integer.parseInt(s.get("qlevel").toString()) == 1).collect(Collectors.toList());
261
+            //子题
262
+            List<Map> sonlist = queslist.stream().filter(s -> Integer.parseInt(s.get("qlevel").toString()) == 3).collect(Collectors.toList());
263
+            Map<String,List<Map>> mtmap = sonlist.stream().collect(Collectors.groupingBy(s -> s.get("questionpid").toString()));
264
+            int num = 0;
265
+            if(N_Utils.isListNotEmpty(dtlist)){
266
+                num = dtlist.size();
267
+            }
268
+            if(mtmap!=null && mtmap.size()>0){
269
+                num = num + mtmap.size();
270
+            }
271
+            map.put("num",num);
272
+            map.remove("questions");
273
+            return list;
274
+        }
275
+        return list;
276
+    }
277
+
278
+    public void listStudentErrorQuestions(Integer examid, Integer studentid,String subjectid){
279
+        
280
+    }
247 281
 }

+ 19
- 0
sexam/src/main/resources/mapper/report/ERstudentMapper.xml View File

@@ -154,4 +154,23 @@
154 154
         where sq.epid=#{epid} and sq.studentid=#{studentid} group by sq.epsqid order by sq.qorder
155 155
     </select>
156 156
 
157
+    <!--学生报告-错题集-科目下错题-->
158
+    <resultMap id="listStudentSubjectErrorQues" type="java.util.Map">
159
+        <result property="subjectid" column="subjectid" />
160
+        <result property="subjectname" column="subjectname" />
161
+        <collection property="questions" ofType="java.util.Map" javaType="java.util.List">
162
+            <result property="questionid" column="questionid" />
163
+            <result property="qlevel" column="qlevel" />
164
+            <result property="questionpid" column="questionpid" />
165
+        </collection>
166
+    </resultMap>
167
+    <select id="listStudentSubjectErrorQues" resultMap="listStudentSubjectErrorQues">
168
+        select sq.subjectid,s.subjectname,q.questionid,q.qlevel,q.questionpid
169
+        from e_paper_student_question sq
170
+                 left join t_question q on q.questionid=sq.questionid
171
+                 left join t_subject s on sq.subjectid=s.subjectid
172
+                 left join t_question mq on q.questionpid=mq.questionid
173
+        where sq.examid=#{examid} and sq.studentid=#{studentid} and sq.stuscore &lt; sq.qscore group by s.subjectid order by s.subjectorder
174
+    </select>
175
+
157 176
 </mapper>

Loading…
Cancel
Save