Browse Source

Merge remote-tracking branch 'origin/master' into ywx

tags/正式版本
雍文秀 2 years ago
parent
commit
274762e306

+ 18
- 1
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/EBaseController.java View File

285
         if (1 == exammode && 2 != vo.getAnswered()) return new ResultVo(1, "还有考试试卷未结束");
285
         if (1 == exammode && 2 != vo.getAnswered()) return new ResultVo(1, "还有考试试卷未结束");
286
         if (1 != vo.getExamstate()) return new ResultVo(0, "结束成功");
286
         if (1 != vo.getExamstate()) return new ResultVo(0, "结束成功");
287
         try {
287
         try {
288
-            eBaseService.updateExamStateEnd(examid, createid);
288
+            eBaseService.updateExamStateEnd(eBase);
289
             return new ResultVo(0, "结束成功");
289
             return new ResultVo(0, "结束成功");
290
         } catch (Exception e) {
290
         } catch (Exception e) {
291
             return new ResultVo(1, "结束失败");
291
             return new ResultVo(1, "结束失败");
461
         N_Utils.validation(new Object[]{examid, "考试id", 1, createid, "操作人", 1});
461
         N_Utils.validation(new Object[]{examid, "考试id", 1, createid, "操作人", 1});
462
         try {
462
         try {
463
             eReportGenerateService.generateExamReport(examid, createid);
463
             eReportGenerateService.generateExamReport(examid, createid);
464
+            eBaseService.updateExamReport(examid);
464
             return new ResultVo(0, "生成成功");
465
             return new ResultVo(0, "生成成功");
465
         } catch (Exception e) {
466
         } catch (Exception e) {
466
             return new ResultVo(1, "生成失败");
467
             return new ResultVo(1, "生成失败");
498
         Integer examstate = eBaseService.getExamState(examid);
499
         Integer examstate = eBaseService.getExamState(examid);
499
         return new ResultVo(0, "获取考试状态成功", examstate);
500
         return new ResultVo(0, "获取考试状态成功", examstate);
500
     }
501
     }
502
+
503
+    /**
504
+     * @Description  生成报告pdf
505
+     * @Param [eBase]
506
+     * @Return com.xhkjedu.vo.ResultVo
507
+     * @Author wn
508
+     * @Date 2022/10/8 11:29
509
+     **/
510
+    @PostMapping("/srep")
511
+    public ResultVo saveReportPath(@RequestBody EBase eBase) {
512
+        Integer examid = eBase.getExamid();
513
+        String reportpath = eBase.getReportpath();
514
+        N_Utils.validation(new Object[]{examid, "考试id", 1,reportpath,"报告地址",2});
515
+        eBaseService.updateExamReportPath(examid,reportpath);
516
+        return new ResultVo(0, "保存报告成功");
517
+    }
501
 }
518
 }

+ 9
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/EBaseMapper.java View File

21
     //修改考试状态
21
     //修改考试状态
22
     void updateExamState(@Param("examid") Integer examid, @Param("examstate") int examstate);
22
     void updateExamState(@Param("examid") Integer examid, @Param("examstate") int examstate);
23
 
23
 
24
+    //修改考试状态和报告时间
25
+    void updateExamStateAndReport(@Param("e")EBase e);
26
+
27
+    //修改是否需要生成报告pdf
28
+    void updateExamReport(@Param("examid") Integer examid, @Param("reportneed") int reportneed);
29
+
30
+    //修改生成报告pdf地址
31
+    void updateExamReportPath(@Param("examid") Integer examid, @Param("reportneed") int reportneed,@Param("reportpath") String reportpath);
32
+
24
     //考试基本信息
33
     //考试基本信息
25
     Map findById(@Param("examid") Integer examid);
34
     Map findById(@Param("examid") Integer examid);
26
 
35
 

+ 6
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/exam/EBase.java View File

51
     //学校id
51
     //学校id
52
     private Integer schoolid;
52
     private Integer schoolid;
53
 
53
 
54
+    private Integer reporttime;//生成报告时间(网页端)
55
+
56
+    private Integer reportneed;//是否需要生成报告(pdf)
57
+
58
+    private String reportpath;//报告地址
59
+
54
     @Transient
60
     @Transient
55
     //班级ids
61
     //班级ids
56
     private List<Integer> classids;
62
     private List<Integer> classids;

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/model/reportclass/ERclassQuestion.java View File

57
     //班级得分率
57
     //班级得分率
58
     private Double classsrate;
58
     private Double classsrate;
59
 
59
 
60
-    //得分率分组:1优秀率≥85%2良好率≥70%3合格率≥60%4低分率≥40%
60
+    //得分率分组:1优秀率≥85%2良好率≥70%3合格率≥60%5低分率≥40%
61
     private Integer classratetype;
61
     private Integer classratetype;
62
 
62
 
63
     //年级得分
63
     //年级得分

+ 18
- 4
sexam/src/main/java/com/xhkjedu/sexam/service/exam/EBaseService.java View File

67
             //考试
67
             //考试
68
             model.setExamstate(0);
68
             model.setExamstate(0);
69
             model.setDeleted(1);
69
             model.setDeleted(1);
70
+            model.setReportneed(0);
70
             model.setCreatetime(N_Utils.getSecondTimestamp());
71
             model.setCreatetime(N_Utils.getSecondTimestamp());
71
             eBaseMapper.insertUseGeneratedKeys(model);
72
             eBaseMapper.insertUseGeneratedKeys(model);
72
             Integer examid = model.getId();
73
             Integer examid = model.getId();
259
 
260
 
260
     //结束考试
261
     //结束考试
261
     @Transactional(rollbackFor = Exception.class)
262
     @Transactional(rollbackFor = Exception.class)
262
-    public void updateExamStateEnd(Integer examid, Integer createid) throws Exception {
263
+    public void updateExamStateEnd(EBase eBase) throws Exception {
263
         try {
264
         try {
264
-            ePaperStudentMapper.updateStuscoreByExamId(examid);//更新未已提交未批阅完成学生得分
265
-            eReportGenerateService.generateExamReport(examid, createid);
266
-            eBaseMapper.updateExamState(examid, 2);
265
+            ePaperStudentMapper.updateStuscoreByExamId(eBase.getExamid());//更新未已提交未批阅完成学生得分
266
+            eReportGenerateService.generateExamReport(eBase.getExamid(), eBase.getCreateid());
267
+            eBase.setReporttime(N_Utils.getSecondTimestamp());
268
+            eBase.setReportneed(1);
269
+            eBase.setExamstate(2);
270
+            eBaseMapper.updateExamStateAndReport(eBase);
267
         } catch (Exception e) {
271
         } catch (Exception e) {
268
             log.error("结束考试失败", e);
272
             log.error("结束考试失败", e);
269
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
273
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
395
     public EBaseVo getExamStateAnseredById(Integer examid) {
399
     public EBaseVo getExamStateAnseredById(Integer examid) {
396
         return eBaseMapper.getExamStateAnseredById(examid);
400
         return eBaseMapper.getExamStateAnseredById(examid);
397
     }
401
     }
402
+
403
+    //修改是否需要生成报告pdf
404
+    public void updateExamReport(Integer examid){
405
+        eBaseMapper.updateExamState(examid,1);
406
+    }
407
+
408
+    //修改生成报告pdf地址
409
+    public void updateExamReportPath(Integer examid,String reportpath){
410
+        eBaseMapper.updateExamReportPath(examid,0,reportpath);
411
+    }
398
 }
412
 }

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportGenerateService.java View File

1397
 
1397
 
1398
         Integer rank = rrank.getLinescore();//年级前rank名
1398
         Integer rank = rrank.getLinescore();//年级前rank名
1399
         Double maxscore = rrank.getMaxscore();//年级后rank名最高分
1399
         Double maxscore = rrank.getMaxscore();//年级后rank名最高分
1400
-        System.out.println(classid + ";" + subjectid + ";" + rank + ";" + maxscore);
1400
+
1401
         List<ERstudent> list2 = list.stream().filter(s -> s.getSchoolrank().compareTo(rank) != 1).collect(Collectors.toList());
1401
         List<ERstudent> list2 = list.stream().filter(s -> s.getSchoolrank().compareTo(rank) != 1).collect(Collectors.toList());
1402
         List<ERstudent> list3 = list.stream().filter(s -> s.getScore().compareTo(maxscore) != 1).collect(Collectors.toList());
1402
         List<ERstudent> list3 = list.stream().filter(s -> s.getScore().compareTo(maxscore) != 1).collect(Collectors.toList());
1403
 
1403
 

+ 4
- 2
sexam/src/main/java/com/xhkjedu/sexam/utils/ExamUtil.java View File

320
     }
320
     }
321
 
321
 
322
     /**
322
     /**
323
-     * @Description 得分率分组:1优秀率≥85%2良好率≥70%3合格率≥60%4低分率≥40%
323
+     * @Description 得分率分组:1优秀率≥85%2良好率≥70%3合格率≥60%5低分率≥40%
324
      * @Param [scorerate]
324
      * @Param [scorerate]
325
      * @Return java.lang.Integer
325
      * @Return java.lang.Integer
326
      * @Author wn
326
      * @Author wn
335
                 ratetype = 2;
335
                 ratetype = 2;
336
             } else if (scorerate < 70 && scorerate >= 60) {
336
             } else if (scorerate < 70 && scorerate >= 60) {
337
                 ratetype = 3;
337
                 ratetype = 3;
338
-            } else if (scorerate <= 40) {
338
+            }else if(scorerate < 60 && scorerate > 40){
339
                 ratetype = 4;
339
                 ratetype = 4;
340
+            } else if (scorerate <= 40) {
341
+                ratetype = 5;
340
             }
342
             }
341
         }
343
         }
342
         return ratetype;
344
         return ratetype;

+ 13
- 0
sexam/src/main/resources/mapper/exam/EBaseMapper.xml View File

40
     <update id="updateExamState">
40
     <update id="updateExamState">
41
         update e_base set examstate=#{examstate} where examid=#{examid}
41
         update e_base set examstate=#{examstate} where examid=#{examid}
42
     </update>
42
     </update>
43
+    <!--修改考试状态和报告时间-->
44
+    <update id="updateExamStateAndReport">
45
+        update e_base set examstate=#{e.examstate},reporttime=#{e.reporttime},reportneed=#{e.reportneed} where examid=#{e.examid}
46
+    </update>
47
+    <!--修改是否需要生成报告pdf-->
48
+    <update id="updateExamReport">
49
+        update e_base set reportneed=#{reportneed} where examid=#{examid}
50
+    </update>
51
+    <!--修改生成报告pdf地址-->
52
+    <update id="updateExamReportPath">
53
+        update e_base set reportpath=#{reportpath},reportneed=#{reportneed} where examid=#{examid}
54
+    </update>
55
+
43
     <!--发布考试-->
56
     <!--发布考试-->
44
     <update id="postExam">
57
     <update id="postExam">
45
         update e_base set examcomm=#{examcomm},examstate=1 where examid=#{examid}
58
         update e_base set examcomm=#{examcomm},examstate=1 where examid=#{examid}

Loading…
Cancel
Save