Browse Source

考试报告

tags/正式版本
雍文秀 2 years ago
parent
commit
6b497700ad

+ 60
- 0
sexam/src/main/java/com/xhkjedu/sexam/controller/report/EReportSchoolController.java View File

1
 package com.xhkjedu.sexam.controller.report;
1
 package com.xhkjedu.sexam.controller.report;
2
 
2
 
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.sexam.model.report.ERbase;
6
+import com.xhkjedu.sexam.model.reportstu.ERstudent;
7
+import com.xhkjedu.sexam.service.report.EReportSchoolService;
8
+import com.xhkjedu.utils.N_Utils;
9
+import com.xhkjedu.utils.PageUtil;
10
+import com.xhkjedu.vo.PageResult;
11
+import com.xhkjedu.vo.ResultVo;
12
+import org.springframework.web.bind.annotation.PostMapping;
13
+import org.springframework.web.bind.annotation.RequestBody;
3
 import org.springframework.web.bind.annotation.RequestMapping;
14
 import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RestController;
16
+
17
+import javax.annotation.Resource;
18
+import java.util.List;
19
+import java.util.Map;
4
 
20
 
5
 /**
21
 /**
6
  * @author ywx
22
  * @author ywx
8
  * @description 校级报告
24
  * @description 校级报告
9
  * @date 2022/8/8 9:37
25
  * @date 2022/8/8 9:37
10
  **/
26
  **/
27
+@RestController
11
 @RequestMapping("ers")
28
 @RequestMapping("ers")
12
 public class EReportSchoolController {
29
 public class EReportSchoolController {
30
+    @Resource
31
+    private EReportSchoolService eReportSchoolService;
32
+
33
+    /**
34
+     * 考试概况
35
+     *
36
+     * @return com.xhkjedu.vo.ResultVo
37
+     * @Param [rbase]
38
+     * @Author ywx
39
+     * @Date 2022/8/25 9:20
40
+     **/
41
+    @PostMapping("/get_ksgk")
42
+    public ResultVo getKsGk(@RequestBody ERbase rbase) {
43
+        Integer examid = rbase.getExamid();
44
+        N_Utils.validation(new Object[]{examid, "考试id", 1});
45
+        Map map = eReportSchoolService.getKsGk(examid);
46
+        return new ResultVo(0, "获取成功", map);
47
+    }
48
+
49
+    /**
50
+     * 成绩单
51
+     *
52
+     * @return com.xhkjedu.vo.ResultVo
53
+     * @Param [stu]
54
+     * @Author ywx
55
+     * @Date 2022/8/25 9:36
56
+     **/
57
+    @PostMapping("/list_cjd")
58
+    public ResultVo listCjd(@RequestBody ERstudent stu) {
59
+        Integer examid = stu.getExamid();
60
+        Integer page = stu.getPage();
61
+        Integer pageSize = stu.getPageSize();
62
+        N_Utils.validation(new Object[]{examid, "考试id", 1});
63
+        if (N_Utils.isEmptyInteger(page)) {
64
+            List<Map> list = eReportSchoolService.listCjd(stu);
65
+            return new ResultVo(0, "获取成功", list);
66
+        } else {
67
+            PageHelper.startPage(page, pageSize);
68
+            List<Map> list = eReportSchoolService.listCjd(stu);
69
+            PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
70
+            return new ResultVo(0, "获取成功", pageResult);
71
+        }
72
+    }
13
 }
73
 }

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/exam/ESubjectBadstudentMapper.java View File

20
 
20
 
21
     //试卷学生异常记录
21
     //试卷学生异常记录
22
     List<Map> listBadStu(@Param("ei") ESubjectInvigilate ei);
22
     List<Map> listBadStu(@Param("ei") ESubjectInvigilate ei);
23
+
24
+    //学生违纪行为分析详情
25
+    List<Map> listBad(@Param("studentid") Integer studentid, @Param("examid") Integer examid);
23
 }
26
 }

+ 5
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/report/ERbaseMapper.java View File

2
 
2
 
3
 import com.xhkjedu.sexam.base.TkMapper;
3
 import com.xhkjedu.sexam.base.TkMapper;
4
 import com.xhkjedu.sexam.model.report.ERbase;
4
 import com.xhkjedu.sexam.model.report.ERbase;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.Map;
5
 
8
 
6
 public interface ERbaseMapper extends TkMapper<ERbase> {
9
 public interface ERbaseMapper extends TkMapper<ERbase> {
10
+    //考试概况
11
+    Map findByExamId(@Param("examid") Integer examid);
7
 }
12
 }

+ 6
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/report/ERsubjectMapper.java View File

2
 
2
 
3
 import com.xhkjedu.sexam.base.TkMapper;
3
 import com.xhkjedu.sexam.base.TkMapper;
4
 import com.xhkjedu.sexam.model.report.ERsubject;
4
 import com.xhkjedu.sexam.model.report.ERsubject;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+import java.util.Map;
5
 
9
 
6
 public interface ERsubjectMapper extends TkMapper<ERsubject> {
10
 public interface ERsubjectMapper extends TkMapper<ERsubject> {
11
+    //校级报告-成绩概况
12
+    List<Map> listByExamId(@Param("examid") Integer examid);
7
 }
13
 }

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

2
 
2
 
3
 import com.xhkjedu.sexam.base.TkMapper;
3
 import com.xhkjedu.sexam.base.TkMapper;
4
 import com.xhkjedu.sexam.model.reportstu.ERstudent;
4
 import com.xhkjedu.sexam.model.reportstu.ERstudent;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+import java.util.Map;
5
 
9
 
6
 public interface ERstudentMapper extends TkMapper<ERstudent> {
10
 public interface ERstudentMapper extends TkMapper<ERstudent> {
11
+    //校级报告-成绩单
12
+    List<Map> listByExamId(@Param("stu") ERstudent stu);
7
 }
13
 }

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

1
 package com.xhkjedu.sexam.service.report;
1
 package com.xhkjedu.sexam.service.report;
2
 
2
 
3
 import com.alibaba.fastjson.JSON;
3
 import com.alibaba.fastjson.JSON;
4
-import com.mysql.cj.x.protobuf.MysqlxDatatypes;
5
 import com.xhkjedu.sexam.mapper.exam.EClassMapper;
4
 import com.xhkjedu.sexam.mapper.exam.EClassMapper;
6
 import com.xhkjedu.sexam.mapper.paper.EPaperAnalyzeMapper;
5
 import com.xhkjedu.sexam.mapper.paper.EPaperAnalyzeMapper;
7
 import com.xhkjedu.sexam.mapper.paper.EPaperQtypeMapper;
6
 import com.xhkjedu.sexam.mapper.paper.EPaperQtypeMapper;
45
 import com.xhkjedu.sexam.vo.report.ExamPaperClassVo;
44
 import com.xhkjedu.sexam.vo.report.ExamPaperClassVo;
46
 import com.xhkjedu.sexam.vo.system.UserVo;
45
 import com.xhkjedu.sexam.vo.system.UserVo;
47
 import com.xhkjedu.utils.N_Utils;
46
 import com.xhkjedu.utils.N_Utils;
47
+import org.springframework.beans.BeanUtils;
48
 import org.springframework.stereotype.Service;
48
 import org.springframework.stereotype.Service;
49
 import org.springframework.transaction.annotation.Transactional;
49
 import org.springframework.transaction.annotation.Transactional;
50
 
50
 
178
         DoubleSummaryStatistics classStatistics = classStudents.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
178
         DoubleSummaryStatistics classStatistics = classStudents.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
179
         DoubleSummaryStatistics cSStatistics = classSubjectStudents.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
179
         DoubleSummaryStatistics cSStatistics = classSubjectStudents.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
180
         double schoolStatisticsMax = schoolStatistics.getMax();
180
         double schoolStatisticsMax = schoolStatistics.getMax();
181
-        double schoolStatisticsAverage = schoolStatistics.getAverage();
181
+        double schoolStatisticsAverage = N_Utils.formatDouble(schoolStatistics.getAverage(), 2);
182
         double schoolStatisticsMin = schoolStatistics.getMin();
182
         double schoolStatisticsMin = schoolStatistics.getMin();
183
 
183
 
184
         ERbase rbase = new ERbase();
184
         ERbase rbase = new ERbase();
212
             }
212
             }
213
             ERPaperVo rp = paperMap.get(subjectid);
213
             ERPaperVo rp = paperMap.get(subjectid);
214
             Double allscore = rp.getPscore();//满分
214
             Double allscore = rp.getPscore();//满分
215
-            double yxscore = allscore * 0.85;//优秀分
216
-            double lhscore = allscore * 0.7;//良好分
217
-            double jgscore = allscore * 0.6;//及格分
218
-            double dfscore = allscore * 0.4;//低分
215
+            double yxscore = ExamUtil.mul(allscore, 0.85);//优秀分
216
+            double lhscore = ExamUtil.mul(allscore, 0.7);//良好分
217
+            double jgscore = ExamUtil.mul(allscore, 0.6);//及格分
218
+            double dfscore = ExamUtil.mul(allscore, 0.4);//低分
219
 
219
 
220
             DoubleSummaryStatistics statistics = list.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
220
             DoubleSummaryStatistics statistics = list.stream().mapToDouble(s -> s.getScore()).summaryStatistics();
221
             ERsubject rs = new ERsubject();
221
             ERsubject rs = new ERsubject();
225
             rs.setScore(allscore);
225
             rs.setScore(allscore);
226
             rs.setMaxscore(statistics.getMax());
226
             rs.setMaxscore(statistics.getMax());
227
             rs.setMinscore(statistics.getMin());
227
             rs.setMinscore(statistics.getMin());
228
-            rs.setAvgscore(statistics.getAverage());
228
+            rs.setAvgscore(N_Utils.formatDouble(statistics.getAverage(), 2));
229
             int yxnum = list.stream().filter(l -> l.getScore().compareTo(yxscore) != -1)
229
             int yxnum = list.stream().filter(l -> l.getScore().compareTo(yxscore) != -1)
230
                             .collect(Collectors.toList()).size();
230
                             .collect(Collectors.toList()).size();
231
             int lhnum = list.stream().filter(l -> l.getScore().compareTo(lhscore) != -1)
231
             int lhnum = list.stream().filter(l -> l.getScore().compareTo(lhscore) != -1)
258
                 rc.setAllscore(allscore);
258
                 rc.setAllscore(allscore);
259
                 rc.setClassmaxscore(claStatistics.getMax());
259
                 rc.setClassmaxscore(claStatistics.getMax());
260
                 rc.setClassminscore(claStatistics.getMin());
260
                 rc.setClassminscore(claStatistics.getMin());
261
-                rc.setClassavgscore(claStatistics.getAverage());
261
+                rc.setClassavgscore(N_Utils.formatDouble(claStatistics.getAverage(), 2));
262
                 rc.setSchoolmaxscore(statistics.getMax());
262
                 rc.setSchoolmaxscore(statistics.getMax());
263
-                rc.setSchoolavgscore(statistics.getAverage());
263
+                rc.setSchoolavgscore(N_Utils.formatDouble(statistics.getAverage(), 2));
264
                 sknum = rstudentList.size();
264
                 sknum = rstudentList.size();
265
                 rc.setStunum(sknum);//实考人数
265
                 rc.setStunum(sknum);//实考人数
266
                 rc.setMissnum(stunum - sknum);//缺考人数=计划人数-实考人数
266
                 rc.setMissnum(stunum - sknum);//缺考人数=计划人数-实考人数
294
             Integer studentid = cs.getStudentid();
294
             Integer studentid = cs.getStudentid();
295
             cs.setClassrank(classStuRank.get(cs.getClassid() + "_" + studentid));
295
             cs.setClassrank(classStuRank.get(cs.getClassid() + "_" + studentid));
296
             cs.setClassmaxscore(classStatistics.getMax());
296
             cs.setClassmaxscore(classStatistics.getMax());
297
-            cs.setClassavgscore(classStatistics.getAverage());
298
-            Integer schoolrank = schoolStuRank.get(studentid);
297
+            cs.setClassavgscore(N_Utils.formatDouble(classStatistics.getAverage(), 2));
298
+            Integer schoolrank = schoolStuRank.get(studentid.toString());
299
             cs.setSchoolrank(schoolrank);
299
             cs.setSchoolrank(schoolrank);
300
             cs.setSchoolmaxscore(schoolStatisticsMax);
300
             cs.setSchoolmaxscore(schoolStatisticsMax);
301
             cs.setSchoolavgscore(schoolStatisticsAverage);
301
             cs.setSchoolavgscore(schoolStatisticsAverage);
310
             subjectid = cs.getSubjectid();
310
             subjectid = cs.getSubjectid();
311
             cs.setClassrank(classSubStuRank.get(classid + "_" + subjectid + "_" + studentid));
311
             cs.setClassrank(classSubStuRank.get(classid + "_" + subjectid + "_" + studentid));
312
             cs.setClassmaxscore(cSStatistics.getMax());
312
             cs.setClassmaxscore(cSStatistics.getMax());
313
-            cs.setClassavgscore(cSStatistics.getAverage());
313
+            cs.setClassavgscore(N_Utils.formatDouble(cSStatistics.getAverage(), 2));
314
             Integer schoolrank = schoolSubStuRank.get(subjectid + "_" + studentid);
314
             Integer schoolrank = schoolSubStuRank.get(subjectid + "_" + studentid);
315
             cs.setSchoolrank(schoolrank);
315
             cs.setSchoolrank(schoolrank);
316
-            cs.setZfSchoolRank(schoolStuRank.get(studentid));
316
+            cs.setZfSchoolRank(schoolStuRank.get(studentid.toString()));
317
             cs.setSchoolmaxscore(sSStatistics.getMax());
317
             cs.setSchoolmaxscore(sSStatistics.getMax());
318
-            cs.setSchoolavgscore(sSStatistics.getAverage());
318
+            cs.setSchoolavgscore(N_Utils.formatDouble(sSStatistics.getAverage(), 2));
319
             setStuGoal(stuRankGoals, cs, schoolrank);//设置学生目标
319
             setStuGoal(stuRankGoals, cs, schoolrank);//设置学生目标
320
         }
320
         }
321
         eRstudentMapper.insertList(classSubjectStudents);
321
         eRstudentMapper.insertList(classSubjectStudents);
434
         Integer ranktype = eRrank.getRanktype();
434
         Integer ranktype = eRrank.getRanktype();
435
         if (ranktype == 1) {//等级(A[85%~100%],B[70%~85%),C[60%~70%),D[40%~60%),E[0%~40%))
435
         if (ranktype == 1) {//等级(A[85%~100%],B[70%~85%),C[60%~70%),D[40%~60%),E[0%~40%))
436
             for (ERrank rrank : rranks) {
436
             for (ERrank rrank : rranks) {
437
+                Double maxrate = rrank.getMaxscore();
438
+                Double minrate = rrank.getMinscore();
437
                 //总分统计
439
                 //总分统计
438
-                double maxscore = rrank.getMaxscore() * zfscore;
439
-                double minscore = rrank.getMinscore() * zfscore;
440
+                double maxscore = ExamUtil.mul(maxrate, zfscore);
441
+                double minscore = ExamUtil.mul(minrate, zfscore);
440
                 rrank.setMaxscore(maxscore);
442
                 rrank.setMaxscore(maxscore);
441
                 rrank.setMinscore(minscore);
443
                 rrank.setMinscore(minscore);
442
                 rrankList.add(rrank);
444
                 rrankList.add(rrank);
458
                 for (ERPaperVo paper : papers) {
460
                 for (ERPaperVo paper : papers) {
459
                     String subjectid = paper.getSubjectid();
461
                     String subjectid = paper.getSubjectid();
460
                     pscore = scoreMap.get(subjectid);
462
                     pscore = scoreMap.get(subjectid);
461
-                    maxscore = rrank.getMaxscore() * pscore;
462
-                    minscore = rrank.getMinscore() * pscore;
463
+                    maxscore = ExamUtil.mul(maxrate, pscore);
464
+                    minscore = ExamUtil.mul(minrate, pscore);
463
                     rrank.setMaxscore(maxscore);
465
                     rrank.setMaxscore(maxscore);
464
                     rrank.setMinscore(minscore);
466
                     rrank.setMinscore(minscore);
465
-                    rrankList.add(rrank);
467
+                    ERrank rrank1 = new ERrank();
468
+                    BeanUtils.copyProperties(rrank, rrank1);
469
+                    rrankList.add(rrank1);
466
                     rankrange = "[" + minscore + "," + maxscore;
470
                     rankrange = "[" + minscore + "," + maxscore;
467
                     if (rankname.equals("A")) {
471
                     if (rankname.equals("A")) {
468
                         rankrange = rankrange + "]";
472
                         rankrange = rankrange + "]";
494
             for (Integer i = 1; i <= gnum; i++) {
498
             for (Integer i = 1; i <= gnum; i++) {
495
                 ERrank rrank = new ERrank();
499
                 ERrank rrank = new ERrank();
496
                 rrank.setRanktype(ranktype);
500
                 rrank.setRanktype(ranktype);
497
-                double maxscore = i * linescore;
498
-                double minscore = (i - 1) * linescore;
501
+                double maxscore = ExamUtil.mul(i, linescore);
502
+                double minscore = ExamUtil.mul(i - 1, linescore);
499
                 if (maxscore > zfscore) {
503
                 if (maxscore > zfscore) {
500
                     maxscore = zfscore;
504
                     maxscore = zfscore;
501
                 }
505
                 }
526
                 for (Integer i = 1; i <= cnum; i++) {
530
                 for (Integer i = 1; i <= cnum; i++) {
527
                     ERrank rrank = new ERrank();
531
                     ERrank rrank = new ERrank();
528
                     rrank.setRanktype(ranktype);
532
                     rrank.setRanktype(ranktype);
529
-                    double maxscore = i * linescore;
530
-                    double minscore = (i - 1) * linescore;
533
+                    double maxscore = ExamUtil.mul(i, linescore);
534
+                    double minscore = ExamUtil.mul(i - 1, linescore);
531
                     if (maxscore > zfscore) {
535
                     if (maxscore > zfscore) {
532
                         maxscore = zfscore;
536
                         maxscore = zfscore;
533
                     }
537
                     }
534
-                    maxscore = rrank.getMaxscore() * pscore;
535
-                    minscore = rrank.getMinscore() * pscore;
536
                     rrank.setMaxscore(maxscore);
538
                     rrank.setMaxscore(maxscore);
537
                     rrank.setMinscore(minscore);
539
                     rrank.setMinscore(minscore);
538
                     String rankrange = "[" + minscore + "," + maxscore;
540
                     String rankrange = "[" + minscore + "," + maxscore;
542
                         rankrange = rankrange + ")";
544
                         rankrange = rankrange + ")";
543
                     }
545
                     }
544
                     rrank.setRankname(rankrange);
546
                     rrank.setRankname(rankrange);
545
-                    rrankList.add(rrank);
547
+                    ERrank rrank1 = new ERrank();
548
+                    BeanUtils.copyProperties(rrank, rrank1);
549
+                    rrankList.add(rrank1);
546
 
550
 
547
                     //全部班级统计
551
                     //全部班级统计
548
                     for (Map.Entry<String, List<ERstudent>> entry : qbbjcollect.entrySet()) {
552
                     for (Map.Entry<String, List<ERstudent>> entry : qbbjcollect.entrySet()) {
562
                 }
566
                 }
563
             }
567
             }
564
         } else if (ranktype == 3) {//临界分(临界分:总分*80%,浮动分:5分)
568
         } else if (ranktype == 3) {//临界分(临界分:总分*80%,浮动分:5分)
565
-            Integer linescore = eRrank.getLinescore();
569
+            Integer linescore1 = eRrank.getLinescore();
570
+            Integer linescore = linescore1;
566
             Integer floatscore = eRrank.getFloatscore();
571
             Integer floatscore = eRrank.getFloatscore();
567
-            if (N_Utils.isEmptyInteger(linescore)) linescore = (int) (zfscore * 0.8);
572
+            if (N_Utils.isEmptyInteger(linescore)) linescore = (int) (ExamUtil.mul(zfscore, 0.8));
568
             //总分统计
573
             //总分统计
569
             ERrank rrank = new ERrank();
574
             ERrank rrank = new ERrank();
570
             rrank.setRanktype(ranktype);
575
             rrank.setRanktype(ranktype);
571
-            double maxscore = linescore + floatscore;
572
-            double minscore = linescore - floatscore;
576
+            double maxscore = ExamUtil.add(linescore, floatscore);
577
+            double minscore = ExamUtil.sub(linescore, floatscore);
573
             if (maxscore > zfscore) maxscore = zfscore;
578
             if (maxscore > zfscore) maxscore = zfscore;
574
             if (minscore < 0) minscore = 0;
579
             if (minscore < 0) minscore = 0;
575
             rrank.setMaxscore(maxscore);
580
             rrank.setMaxscore(maxscore);
591
             for (ERPaperVo paper : papers) {
596
             for (ERPaperVo paper : papers) {
592
                 String subjectid = paper.getSubjectid();
597
                 String subjectid = paper.getSubjectid();
593
                 pscore = scoreMap.get(subjectid);
598
                 pscore = scoreMap.get(subjectid);
594
-                if (N_Utils.isEmptyInteger(linescore)) linescore = (int) (pscore * 0.8);
595
-                maxscore = linescore + floatscore;
596
-                minscore = linescore - floatscore;
599
+                linescore = linescore1;
600
+                if (N_Utils.isEmptyInteger(linescore)) linescore = (int) (ExamUtil.mul(pscore, 0.8));
601
+                maxscore = ExamUtil.add(linescore, floatscore);
602
+                minscore = ExamUtil.sub(linescore, floatscore);
597
                 if (maxscore > pscore) maxscore = pscore;
603
                 if (maxscore > pscore) maxscore = pscore;
598
                 if (minscore < 0) minscore = 0;
604
                 if (minscore < 0) minscore = 0;
599
                 rrank.setMaxscore(maxscore);
605
                 rrank.setMaxscore(maxscore);
602
                 rrank.setFloatscore(floatscore);
608
                 rrank.setFloatscore(floatscore);
603
                 rankrange = "[" + minscore + "," + maxscore + "]";
609
                 rankrange = "[" + minscore + "," + maxscore + "]";
604
                 rrank.setRankname(rankrange);
610
                 rrank.setRankname(rankrange);
605
-                rrankList.add(rrank);
611
+                ERrank rrank1 = new ERrank();
612
+                BeanUtils.copyProperties(rrank, rrank1);
613
+                rrankList.add(rrank1);
606
 
614
 
607
                 //全部班级统计
615
                 //全部班级统计
608
                 for (Map.Entry<String, List<ERstudent>> entry : qbbjcollect.entrySet()) {
616
                 for (Map.Entry<String, List<ERstudent>> entry : qbbjcollect.entrySet()) {
626
             //总分统计
634
             //总分统计
627
             ERrank rrank = new ERrank();
635
             ERrank rrank = new ERrank();
628
             rrank.setRanktype(ranktype);
636
             rrank.setRanktype(ranktype);
629
-            double maxscore = linescore - floatscore;//最高名次
630
-            double minscore = linescore + floatscore;//最低名次
637
+            double maxscore = ExamUtil.sub(linescore, floatscore);//最高名次
638
+            double minscore = ExamUtil.add(linescore, floatscore);//最低名次
631
             if (maxscore < 1) maxscore = 1;//最高名次为1
639
             if (maxscore < 1) maxscore = 1;//最高名次为1
632
             int stunum = (int) students.stream().map(s -> s.getStudentid()).distinct().count();//学生数量
640
             int stunum = (int) students.stream().map(s -> s.getStudentid()).distinct().count();//学生数量
633
             if (minscore > stunum) minscore = stunum;//最低名次=学生数量
641
             if (minscore > stunum) minscore = stunum;//最低名次=学生数量
649
             //分科统计
657
             //分科统计
650
             for (ERPaperVo paper : papers) {
658
             for (ERPaperVo paper : papers) {
651
                 String subjectid = paper.getSubjectid();
659
                 String subjectid = paper.getSubjectid();
652
-                maxscore = linescore - floatscore;//最高名次
653
-                minscore = linescore + floatscore;//最低名次
660
+                maxscore = ExamUtil.sub(linescore, floatscore);//最高名次
661
+                minscore = ExamUtil.add(linescore, floatscore);//最低名次
654
                 if (maxscore < 1) maxscore = 1;//最高名次为1
662
                 if (maxscore < 1) maxscore = 1;//最高名次为1
655
                 stunum = students.size();//学生数量
663
                 stunum = students.size();//学生数量
656
                 if (minscore > stunum) minscore = stunum;//最低名次=学生数量
664
                 if (minscore > stunum) minscore = stunum;//最低名次=学生数量
660
                 rrank.setFloatscore(floatscore);
668
                 rrank.setFloatscore(floatscore);
661
                 rankrange = "[" + minscore + "," + maxscore + "]";
669
                 rankrange = "[" + minscore + "," + maxscore + "]";
662
                 rrank.setRankname(rankrange);
670
                 rrank.setRankname(rankrange);
663
-                rrankList.add(rrank);
671
+                ERrank rrank1 = new ERrank();
672
+                BeanUtils.copyProperties(rrank, rrank1);
673
+                rrankList.add(rrank1);
664
 
674
 
665
                 //全部班级统计
675
                 //全部班级统计
666
                 for (Map.Entry<String, List<ERstudent>> entry : qbbjcollect.entrySet()) {
676
                 for (Map.Entry<String, List<ERstudent>> entry : qbbjcollect.entrySet()) {

+ 31
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportSchoolService.java View File

1
 package com.xhkjedu.sexam.service.report;
1
 package com.xhkjedu.sexam.service.report;
2
 
2
 
3
+import com.xhkjedu.sexam.mapper.report.ERbaseMapper;
4
+import com.xhkjedu.sexam.mapper.report.ERsubjectMapper;
5
+import com.xhkjedu.sexam.mapper.reportstu.ERstudentMapper;
6
+import com.xhkjedu.sexam.model.reportstu.ERstudent;
7
+import org.springframework.stereotype.Service;
8
+
9
+import javax.annotation.Resource;
10
+import java.util.List;
11
+import java.util.Map;
12
+
3
 /**
13
 /**
4
  * @author ywx
14
  * @author ywx
5
  * @className EReportSchoolService
15
  * @className EReportSchoolService
6
  * @description 校级报告
16
  * @description 校级报告
7
  * @date 2022/8/8 9:46
17
  * @date 2022/8/8 9:46
8
  **/
18
  **/
19
+@Service
9
 public class EReportSchoolService {
20
 public class EReportSchoolService {
21
+    @Resource
22
+    private ERbaseMapper eRbaseMapper;
23
+    @Resource
24
+    private ERsubjectMapper eRsubjectMapper;
25
+    @Resource
26
+    private ERstudentMapper eRstudentMapper;
27
+
28
+    //考试概况
29
+    public Map getKsGk(Integer examid) {
30
+        Map map = eRbaseMapper.findByExamId(examid);
31
+        //成绩概况
32
+        List<Map> subjects = eRsubjectMapper.listByExamId(examid);
33
+        map.put("subjects", subjects);
34
+        return map;
35
+    }
36
+
37
+    //成绩单
38
+    public List<Map> listCjd(ERstudent stu) {
39
+        return eRstudentMapper.listByExamId(stu);
40
+    }
10
 }
41
 }

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

175
 
175
 
176
     //标准差σ=sqrt(s^2)
176
     //标准差σ=sqrt(s^2)
177
     public static double standardDiviation(List<Double> x) {
177
     public static double standardDiviation(List<Double> x) {
178
-        return Math.sqrt(variance(x));
178
+        return N_Utils.formatDouble(Math.sqrt(variance(x)), 2);
179
     }
179
     }
180
 
180
 
181
     /**
181
     /**

+ 8
- 0
sexam/src/main/resources/mapper/report/ERbaseMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sexam.mapper.report.ERbaseMapper">
4
+    <!--考试概况-->
5
+    <select id="findByExamId" resultType="java.util.Map">
6
+        select * from e_rbase where examid=#{examid} limit 1
7
+    </select>
8
+</mapper>

+ 6
- 2
sexam/src/main/resources/mapper/report/EReportGenerateMapper.xml View File

14
     <delete id="deleteExamReport">
14
     <delete id="deleteExamReport">
15
         delete from e_rbase where examid=#{examid};
15
         delete from e_rbase where examid=#{examid};
16
         delete from e_rclass where examid=#{examid};
16
         delete from e_rclass where examid=#{examid};
17
+        delete from e_rclass_complexity where examid=#{examid};
18
+        delete from e_rclass_point where examid=#{examid};
17
         delete from e_rclass_qtype where examid=#{examid};
19
         delete from e_rclass_qtype where examid=#{examid};
18
         delete from e_rclass_question where examid=#{examid};
20
         delete from e_rclass_question where examid=#{examid};
19
-        delete from e_rclass_question_point where examid=#{examid};
20
         delete from e_rclass_rank where examid=#{examid};
21
         delete from e_rclass_rank where examid=#{examid};
21
         delete from e_rrank where examid=#{examid};
22
         delete from e_rrank where examid=#{examid};
22
         delete from e_rstudent where examid=#{examid};
23
         delete from e_rstudent where examid=#{examid};
24
+        delete from e_rstudent_complexity where examid=#{examid};
23
         delete from e_rstudent_point where examid=#{examid};
25
         delete from e_rstudent_point where examid=#{examid};
26
+        delete from e_rstudent_qtype where examid=#{examid};
24
         delete from e_rsubject where examid=#{examid};
27
         delete from e_rsubject where examid=#{examid};
25
     </delete>
28
     </delete>
26
     <!--学生上次考试排名及目标-->
29
     <!--学生上次考试排名及目标-->
27
     <select id="listStuRankAndGoal" resultType="com.xhkjedu.sexam.model.reportstu.ERstudent">
30
     <select id="listStuRankAndGoal" resultType="com.xhkjedu.sexam.model.reportstu.ERstudent">
28
         select er.studentid,er.subjectid,er.schoolrank,er.nextgoal
31
         select er.studentid,er.subjectid,er.schoolrank,er.nextgoal
29
         from(select max(er.rsid)rsid from e_class_student ecs left join e_rstudent er on ecs.studentid = er.studentid
32
         from(select max(er.rsid)rsid from e_class_student ecs left join e_rstudent er on ecs.studentid = er.studentid
30
-        where ecs.examid=#{examid} group by er.studentid,er.subjectid)a left join e_rstudent er on a.rsid=er.rsid
33
+        where ecs.examid=#{examid} and ecs.examid!=er.examid and er.rsid is not null group by er.studentid,er.subjectid)a
34
+        left join e_rstudent er on a.rsid=er.rsid
31
     </select>
35
     </select>
32
 </mapper>
36
 </mapper>

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

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sexam.mapper.reportstu.ERstudentMapper">
4
+    <!--校级报告-成绩单-->
5
+    <resultMap id="stuResult" type="java.util.Map">
6
+        <collection property="subjects" ofType="java.util.Map" javaType="java.util.List"
7
+                    select="listSubject" column="{examid=examid,studentid=studentid,subjectid=subjectid}">
8
+        </collection>
9
+    </resultMap>
10
+    <select id="listSubject" resultType="java.util.Map">
11
+        select s.score,s.classrank,s.classrankpre,s.classmaxscore,s.classavgscore
12
+        ,s.schoolrank,s.schoolmaxscore,s.schoolavgscore,s.goal,s.nextgoal,s.subjectname
13
+        from e_rstudent s where s.examid=#{examid} and s.studentid=#{studentid}
14
+        <if test="subjectid!=null and subjectid!=''">
15
+            and s.subjectid=#{subjectid}
16
+        </if>
17
+    </select>
18
+    <select id="listByExamId" resultMap="stuResult">
19
+        select s.examid,s.classid,s.studentid,c.classname,u.username,u.loginname,#{stu.subjectid} subjectid
20
+        from e_class_student s left join t_user u on s.studentid=u.userid
21
+        left join e_class c on s.classid=c.classid
22
+        where s.examid=#{stu.examid}
23
+        <if test="stu.classid!=null and stu.classid!=0">
24
+            and s.classid=#{stu.classid}
25
+        </if>
26
+        <if test="stu.createname!=null and stu.createname!=''">
27
+            and (u.username like '%${stu.createname}%' or u.loginname like '%${stu.createname}%')
28
+        </if>
29
+        group by s.studentid
30
+    </select>
31
+</mapper>

+ 8
- 0
sexam/src/main/resources/mapper/report/ERsubjectMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sexam.mapper.report.ERsubjectMapper">
4
+    <!--校级报告-成绩概况-->
5
+    <select id="listByExamId" resultType="java.util.Map">
6
+        select * from e_rsubject where examid=#{examid}
7
+    </select>
8
+</mapper>

+ 13
- 4
suser/src/main/java/com/xhkjedu/suser/service/system/UserService.java View File

1
 package com.xhkjedu.suser.service.system;
1
 package com.xhkjedu.suser.service.system;
2
 
2
 
3
-import com.alibaba.fastjson.JSON;
4
 import com.github.pagehelper.PageHelper;
3
 import com.github.pagehelper.PageHelper;
5
 import com.github.pagehelper.PageInfo;
4
 import com.github.pagehelper.PageInfo;
6
 import com.xhkjedu.suser.config.ConfigKey;
5
 import com.xhkjedu.suser.config.ConfigKey;
23
 import com.xhkjedu.suser.vo.assess.AssessParams;
22
 import com.xhkjedu.suser.vo.assess.AssessParams;
24
 import com.xhkjedu.suser.vo.system.UserVo;
23
 import com.xhkjedu.suser.vo.system.UserVo;
25
 import com.xhkjedu.suser.vo.system.ZtMsgVo;
24
 import com.xhkjedu.suser.vo.system.ZtMsgVo;
26
-import com.xhkjedu.utils.*;
25
+import com.xhkjedu.utils.DESUtils;
26
+import com.xhkjedu.utils.DatesUtil;
27
+import com.xhkjedu.utils.MD5;
28
+import com.xhkjedu.utils.N_Utils;
29
+import com.xhkjedu.utils.PageUtil;
27
 import com.xhkjedu.vo.PageResult;
30
 import com.xhkjedu.vo.PageResult;
28
 import com.xhkjedu.vo.ResultVo;
31
 import com.xhkjedu.vo.ResultVo;
29
 import lombok.extern.slf4j.Slf4j;
32
 import lombok.extern.slf4j.Slf4j;
34
 
37
 
35
 import javax.annotation.Resource;
38
 import javax.annotation.Resource;
36
 import javax.servlet.http.HttpServletRequest;
39
 import javax.servlet.http.HttpServletRequest;
37
-import java.util.*;
40
+import java.util.ArrayList;
41
+import java.util.HashMap;
42
+import java.util.List;
43
+import java.util.Map;
44
+import java.util.UUID;
38
 import java.util.stream.Collectors;
45
 import java.util.stream.Collectors;
39
 
46
 
40
 /**
47
 /**
694
             for (TUser user : teachers) {
701
             for (TUser user : teachers) {
695
                 String loginname = user.getLoginname();
702
                 String loginname = user.getLoginname();
696
                 String userphone = user.getUserphone();
703
                 String userphone = user.getUserphone();
697
-                if (N_Utils.isNotEmpty(userphone) && !phoneMap.get(userphone).equals(loginname)) {//绑定的手机号和登录名不一致,则手机号被其他用户绑定
704
+                String phone = phoneMap.get(userphone);
705
+                if (N_Utils.isNotEmpty(userphone) && N_Utils.isNotEmpty(phone) && !phone.equals(loginname)) {
706
+                    //绑定的手机号和登录名不一致,则手机号被其他用户绑定
698
                     return new ResultVo(1, "手机号【" + userphone + "】已被绑定");
707
                     return new ResultVo(1, "手机号【" + userphone + "】已被绑定");
699
                 }
708
                 }
700
                 TUser u = getObjByLoginName(loginname);
709
                 TUser u = getObjByLoginName(loginname);

Loading…
Cancel
Save