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,7 +285,7 @@ public class EBaseController {
285 285
         if (1 == exammode && 2 != vo.getAnswered()) return new ResultVo(1, "还有考试试卷未结束");
286 286
         if (1 != vo.getExamstate()) return new ResultVo(0, "结束成功");
287 287
         try {
288
-            eBaseService.updateExamStateEnd(examid, createid);
288
+            eBaseService.updateExamStateEnd(eBase);
289 289
             return new ResultVo(0, "结束成功");
290 290
         } catch (Exception e) {
291 291
             return new ResultVo(1, "结束失败");
@@ -461,6 +461,7 @@ public class EBaseController {
461 461
         N_Utils.validation(new Object[]{examid, "考试id", 1, createid, "操作人", 1});
462 462
         try {
463 463
             eReportGenerateService.generateExamReport(examid, createid);
464
+            eBaseService.updateExamReport(examid);
464 465
             return new ResultVo(0, "生成成功");
465 466
         } catch (Exception e) {
466 467
             return new ResultVo(1, "生成失败");
@@ -498,4 +499,20 @@ public class EBaseController {
498 499
         Integer examstate = eBaseService.getExamState(examid);
499 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,6 +21,15 @@ public interface EBaseMapper extends TkMapper<EBase> {
21 21
     //修改考试状态
22 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 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,6 +51,12 @@ public class EBase extends BaseBean {
51 51
     //学校id
52 52
     private Integer schoolid;
53 53
 
54
+    private Integer reporttime;//生成报告时间(网页端)
55
+
56
+    private Integer reportneed;//是否需要生成报告(pdf)
57
+
58
+    private String reportpath;//报告地址
59
+
54 60
     @Transient
55 61
     //班级ids
56 62
     private List<Integer> classids;

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

@@ -57,7 +57,7 @@ public class ERclassQuestion extends BaseBean {
57 57
     //班级得分率
58 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 61
     private Integer classratetype;
62 62
 
63 63
     //年级得分

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

@@ -67,6 +67,7 @@ public class EBaseService {
67 67
             //考试
68 68
             model.setExamstate(0);
69 69
             model.setDeleted(1);
70
+            model.setReportneed(0);
70 71
             model.setCreatetime(N_Utils.getSecondTimestamp());
71 72
             eBaseMapper.insertUseGeneratedKeys(model);
72 73
             Integer examid = model.getId();
@@ -259,11 +260,14 @@ public class EBaseService {
259 260
 
260 261
     //结束考试
261 262
     @Transactional(rollbackFor = Exception.class)
262
-    public void updateExamStateEnd(Integer examid, Integer createid) throws Exception {
263
+    public void updateExamStateEnd(EBase eBase) throws Exception {
263 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 271
         } catch (Exception e) {
268 272
             log.error("结束考试失败", e);
269 273
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -395,4 +399,14 @@ public class EBaseService {
395 399
     public EBaseVo getExamStateAnseredById(Integer examid) {
396 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,7 +1397,7 @@ public class EReportGenerateService {
1397 1397
 
1398 1398
         Integer rank = rrank.getLinescore();//年级前rank名
1399 1399
         Double maxscore = rrank.getMaxscore();//年级后rank名最高分
1400
-        System.out.println(classid + ";" + subjectid + ";" + rank + ";" + maxscore);
1400
+
1401 1401
         List<ERstudent> list2 = list.stream().filter(s -> s.getSchoolrank().compareTo(rank) != 1).collect(Collectors.toList());
1402 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,7 +320,7 @@ public class ExamUtil {
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 324
      * @Param [scorerate]
325 325
      * @Return java.lang.Integer
326 326
      * @Author wn
@@ -335,8 +335,10 @@ public class ExamUtil {
335 335
                 ratetype = 2;
336 336
             } else if (scorerate < 70 && scorerate >= 60) {
337 337
                 ratetype = 3;
338
-            } else if (scorerate <= 40) {
338
+            }else if(scorerate < 60 && scorerate > 40){
339 339
                 ratetype = 4;
340
+            } else if (scorerate <= 40) {
341
+                ratetype = 5;
340 342
             }
341 343
         }
342 344
         return ratetype;

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

@@ -40,6 +40,19 @@
40 40
     <update id="updateExamState">
41 41
         update e_base set examstate=#{examstate} where examid=#{examid}
42 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 57
     <update id="postExam">
45 58
         update e_base set examcomm=#{examcomm},examstate=1 where examid=#{examid}

Loading…
Cancel
Save