Преглед изворни кода

班级报告优化

背诵优化
作业试题统计注释掉
tags/正式版本
雍文秀 пре 2 година
родитељ
комит
0e161a2a4a

+ 51
- 26
sapi/src/main/java/com/xhkjedu/sapi/service/classreport/ClassReportService.java Прегледај датотеку

@@ -1,8 +1,25 @@
1 1
 package com.xhkjedu.sapi.service.classreport;
2 2
 
3 3
 import com.alibaba.fastjson.JSON;
4
-import com.xhkjedu.sapi.mapper.classreport.*;
5
-import com.xhkjedu.sapi.model.classreport.*;
4
+import com.xhkjedu.sapi.mapper.classreport.ClassReportMapper;
5
+import com.xhkjedu.sapi.mapper.classreport.ReportClassErrorqueMapper;
6
+import com.xhkjedu.sapi.mapper.classreport.ReportClassErrorquefdMapper;
7
+import com.xhkjedu.sapi.mapper.classreport.ReportClassGuideMapper;
8
+import com.xhkjedu.sapi.mapper.classreport.ReportClassLiveMapper;
9
+import com.xhkjedu.sapi.mapper.classreport.ReportClassPaperMapper;
10
+import com.xhkjedu.sapi.mapper.classreport.ReportClassPointMapper;
11
+import com.xhkjedu.sapi.mapper.classreport.ReportClassReciteMapper;
12
+import com.xhkjedu.sapi.mapper.classreport.ReportClassRoomMapper;
13
+import com.xhkjedu.sapi.mapper.classreport.ReportClasstypeMapper;
14
+import com.xhkjedu.sapi.model.classreport.TReportClassErrorque;
15
+import com.xhkjedu.sapi.model.classreport.TReportClassErrorquefd;
16
+import com.xhkjedu.sapi.model.classreport.TReportClassGuide;
17
+import com.xhkjedu.sapi.model.classreport.TReportClassLive;
18
+import com.xhkjedu.sapi.model.classreport.TReportClassPaper;
19
+import com.xhkjedu.sapi.model.classreport.TReportClassPoint;
20
+import com.xhkjedu.sapi.model.classreport.TReportClassRecite;
21
+import com.xhkjedu.sapi.model.classreport.TReportClassRoom;
22
+import com.xhkjedu.sapi.model.classreport.TReportClasstype;
6 23
 import com.xhkjedu.sapi.vo.classreport.CGradeSubjectVo;
7 24
 import com.xhkjedu.sapi.vo.classreport.ReportClasstypeVo;
8 25
 import com.xhkjedu.sapi.vo.classreport.ReportRateVo;
@@ -13,7 +30,14 @@ import lombok.extern.slf4j.Slf4j;
13 30
 import org.springframework.stereotype.Service;
14 31
 
15 32
 import javax.annotation.Resource;
16
-import java.util.*;
33
+import java.util.ArrayList;
34
+import java.util.Comparator;
35
+import java.util.DoubleSummaryStatistics;
36
+import java.util.HashMap;
37
+import java.util.IntSummaryStatistics;
38
+import java.util.LinkedHashMap;
39
+import java.util.List;
40
+import java.util.Map;
17 41
 import java.util.stream.Collectors;
18 42
 
19 43
 /**
@@ -1055,8 +1079,8 @@ public class ClassReportService {
1055 1079
             r.setGuidemaxnum(c.getMaxnum());//发布预习最高次数
1056 1080
             r.setGuideprerate(c.getNumrate());//发布预习次数同比
1057 1081
             r.setGuiderank(c.getRank());//发布预习次数排名
1058
-            r.setPrerate(c.getTjprerate());//平均预习率
1059
-            r.setGuideavgrate(c.getPjtjrate());//预习率同比
1082
+            r.setPrerate(c.getTjprerate());//预习率同比
1083
+            r.setGuideavgrate(c.getPjtjrate());//平均预习率
1060 1084
             list1.add(r);
1061 1085
             return list1;
1062 1086
         }
@@ -1203,35 +1227,36 @@ public class ClassReportService {
1203 1227
 
1204 1228
             Double commitrate = 0.0;//提交率
1205 1229
             Double checkrate = 0.0;//批改率
1206
-            if (module.equals("preview") || module.equals("classroom") || module.equals("paper") || module.equals("recite")) {//预习、课堂、作业、背诵
1207
-                int xsnum = list2.stream().mapToInt(ReportClasstypeVo::getXsnum).sum();
1208
-                int tjnum = list2.stream().mapToInt(ReportClasstypeVo::getTjnum).sum();
1209
-                pjtjrate = N_Utils.formatDouble(list2.stream().mapToDouble(ReportClasstypeVo::getNumrate).summaryStatistics().getAverage(), 2);
1210
-                commitrate = N_Utils.getIntegerDivideAndMulitiply(tjnum, xsnum);
1230
+            gslist.add(gs);
1231
+            if (cid.equals(classid)) {
1232
+                if (module.equals("preview") || module.equals("classroom") || module.equals("paper") || module.equals("recite")) {//预习、课堂、作业、背诵
1233
+                    int xsnum = list2.stream().mapToInt(ReportClasstypeVo::getXsnum).sum();
1234
+                    int tjnum = list2.stream().mapToInt(ReportClasstypeVo::getTjnum).sum();
1235
+                    pjtjrate = N_Utils.formatDouble(list2.stream().mapToDouble(ReportClasstypeVo::getNumrate).summaryStatistics().getAverage(), 2);
1236
+                    commitrate = N_Utils.getIntegerDivideAndMulitiply(tjnum, xsnum);
1211 1237
 
1212
-                if (module.equals("paper")) {//作业
1213
-                    int pgnum = list2.stream().mapToInt(ReportClasstypeVo::getPgnum).sum();
1214
-                    checkrate = N_Utils.getIntegerDivideAndMulitiply(pgnum, tjnum);
1215
-                    pjpgrate = N_Utils.formatDouble(list2.stream().mapToDouble(ReportClasstypeVo::getPgrate).summaryStatistics().getAverage(), 2);
1238
+                    if (module.equals("paper")) {//作业
1239
+                        int pgnum = list2.stream().mapToInt(ReportClasstypeVo::getPgnum).sum();
1240
+                        checkrate = N_Utils.getIntegerDivideAndMulitiply(pgnum, tjnum);
1241
+                        pjpgrate = N_Utils.formatDouble(list2.stream().mapToDouble(ReportClasstypeVo::getPgrate).summaryStatistics().getAverage(), 2);
1242
+                    }
1243
+                } else if (module.equals("live")) {//直播
1244
+                    pjtjrate = N_Utils.formatDouble(list2.stream().mapToDouble(ReportClasstypeVo::getMinutenum).summaryStatistics().getAverage(), 2);
1216 1245
                 }
1217
-            } else if (module.equals("live")) {//直播
1218
-                pjtjrate = N_Utils.formatDouble(list2.stream().mapToDouble(ReportClasstypeVo::getMinutenum).summaryStatistics().getAverage(), 2);
1219
-            }
1220 1246
 
1221
-            Double correctrate = 0.0;//正确率
1222
-            if (module.equals("paper") || module.equals("recite")) {//作业、背诵
1223
-                Double pscore = list2.stream().mapToDouble(ReportClasstypeVo::getPscore).sum();
1224
-                Double uscore = list2.stream().mapToDouble(ReportClasstypeVo::getUscore).sum();
1225
-                correctrate = N_Utils.getDoubleDivideAndMulitiply(uscore, pscore);
1226
-                pjzqrate = N_Utils.formatDouble(list2.stream().mapToDouble(ReportClasstypeVo::getZqrate).summaryStatistics().getAverage(), 2);
1227
-            }
1228
-            gslist.add(gs);
1229
-            if (cid.equals(classid)) {
1247
+                Double correctrate = 0.0;//正确率
1248
+                if (module.equals("paper") || module.equals("recite")) {//作业、背诵
1249
+                    Double pscore = list2.stream().mapToDouble(ReportClasstypeVo::getPscore).sum();
1250
+                    Double uscore = list2.stream().mapToDouble(ReportClasstypeVo::getUscore).sum();
1251
+                    correctrate = N_Utils.getDoubleDivideAndMulitiply(uscore, pscore);
1252
+                    pjzqrate = N_Utils.formatDouble(list2.stream().mapToDouble(ReportClasstypeVo::getZqrate).summaryStatistics().getAverage(), 2);
1253
+                }
1230 1254
                 fbnum = num;
1231 1255
                 if (module.equals("preview")) {//预习
1232 1256
                     YearOnYearVo y = years.stream().filter(v -> v.getClassid().equals(type.getClassid()) && v.getSubjectid().equals(type.getSubjectid())).findFirst().orElse(null);
1233 1257
                     if (y != null) {
1234 1258
                         prerate = N_Utils.getIntegerDivideAndMulitiply(fbnum - y.getFbnum(), fbnum);
1259
+                        tjprerate = N_Utils.formatDouble(commitrate - y.getTjrate(), 2);
1235 1260
                     }
1236 1261
                 } else if (module.equals("paper")) {//作业
1237 1262
                     YearOnYearVo y = years.stream().filter(v -> v.getClassid().equals(type.getClassid()) && v.getSubjectid().equals(type.getSubjectid())).findFirst().orElse(null);

+ 1
- 1
sapi/src/main/resources/application.properties Прегледај датотеку

@@ -100,4 +100,4 @@ cron.syncnum=100
100 100
 #每隔3s清除一下请求地址map
101 101
 cron.deleteUriMap=0/3 * * * * ?
102 102
 #版本号
103
-versionname=Test_v3.4.0
103
+versionname=Test_v3.4.1

+ 8
- 8
sapi/src/main/resources/mapper/classreport/ClassReportMapper.xml Прегледај датотеку

@@ -8,7 +8,7 @@
8 8
         and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=g.schoolid)classnum
9 9
         ,count(ggs.rgsid)xsnum
10 10
         ,sum(case when ggs.costtime!=0 then 1 else 0 end)tjnum
11
-        ,ifnull(round(sum(case when ggs.costtime!=0 then 1 else 0 end)*100/count(ggs.rgsid),2),0)numrate
11
+        ,ifnull(truncate(sum(case when ggs.costtime!=0 then 1 else 0 end)*100/count(ggs.rgsid),2),0)numrate
12 12
         ,from_unixtime(g.createtime,'%Y-%m-%d')begindate,count(distinct g.guideid)fbnum
13 13
         from t_guide g left join t_guide_group gg on g.guideid=gg.guideid
14 14
         left join t_guide_group_student ggs on ggs.guideid=gg.guideid and ggs.classid=gg.classid
@@ -51,7 +51,7 @@
51 51
         and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=r.schoolid)classnum
52 52
         ,r.classnum xsnum
53 53
         ,r.realstunum tjnum
54
-        ,ifnull(round(r.realstunum*100/r.classnum,2),0)numrate
54
+        ,ifnull(truncate(r.realstunum*100/r.classnum,2),0)numrate
55 55
         ,count(distinct case when rt.asktype between 30 and 33 then rt.asktid else null end)twnum
56 56
         ,count(distinct case when rt.asktype =40 then rt.asktid else null end)tcnum
57 57
         ,count(distinct case when rt.asktype =21 then rt.asktid else null end)dmnum
@@ -99,13 +99,13 @@
99 99
         and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=p.schoolid)classnum
100 100
         ,count(distinct case when pg.starttime<=UNIX_TIMESTAMP() then ps.psid else null end)xsnum
101 101
         ,sum(case when ps.psstate!=0 then 1 else 0 end)tjnum
102
-        ,ifnull(round(sum(case when ps.psstate!=0 then 1 else 0 end)*100/
102
+        ,ifnull(truncate(sum(case when ps.psstate!=0 then 1 else 0 end)*100/
103 103
         count(distinct case when pg.starttime<=UNIX_TIMESTAMP() then ps.psid else null end),2),0)numrate
104 104
         ,sum(case when ps.pschecked=1 then 1 else 0 end)pgnum
105
-        ,ifnull(round(sum(case when ps.pschecked=1 then 1 else 0 end)*100/sum(case when ps.psstate!=0 then 1 else 0 end),2),0)pgrate
105
+        ,ifnull(truncate(sum(case when ps.pschecked=1 then 1 else 0 end)*100/sum(case when ps.psstate!=0 then 1 else 0 end),2),0)pgrate
106 106
         ,sum(case when pg.starttime<=UNIX_TIMESTAMP() then ps.paperscore else 0 end)pscore
107 107
         ,sum(ps.userscore)uscore
108
-        ,ifnull(round(sum(ps.userscore)*100/sum(case when pg.starttime<=UNIX_TIMESTAMP() then ps.paperscore else 0 end),2),0)zqrate
108
+        ,ifnull(truncate(sum(ps.userscore)*100/sum(case when pg.starttime<=UNIX_TIMESTAMP() then ps.paperscore else 0 end),2),0)zqrate
109 109
         ,from_unixtime(p.createtime,'%Y-%m-%d')begindate,count(distinct p.paperid)fbnum
110 110
         from t_paper p left join t_paper_group pg on p.paperid=pg.paperid
111 111
         left join t_paper_student ps on ps.paperid=p.paperid and ps.classid=pg.classid
@@ -149,10 +149,10 @@
149 149
         and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=r.schoolid)classnum
150 150
         ,count(rs.rsid)xsnum
151 151
         ,sum(case when rs.rsstate!=0 then 1 else 0 end)tjnum
152
-        ,ifnull(round(sum(case when rs.rsstate!=0 then 1 else 0 end)*100/count(rs.rsid),2),0)numrate
152
+        ,ifnull(truncate(sum(case when rs.rsstate!=0 then 1 else 0 end)*100/count(rs.rsid),2),0)numrate
153 153
         ,sum(case when rs.rsstate!=0 then 1 else 0 end)*100 pscore
154 154
         ,sum(rs.userscore)uscore
155
-        ,ifnull(round(sum(rs.userscore)*100/(sum(case when rs.rsstate!=0 then 1 else 0 end)*100),2),0)zqrate
155
+        ,ifnull(truncate(sum(rs.userscore)*100/(sum(case when rs.rsstate!=0 then 1 else 0 end)*100),2),0)zqrate
156 156
         ,from_unixtime(r.createtime,'%Y-%m-%d')begindate,count(distinct r.reciteid)fbnum
157 157
         from t_recite r left join t_recite_group rg on r.reciteid=rg.reciteid
158 158
         left join t_recite_student rs on rs.reciteid=r.reciteid and rs.classid=rg.classid
@@ -252,7 +252,7 @@
252 252
     <!--错题知识点-->
253 253
     <select id="listErrQuestionPoint" resultType="java.util.Map">
254 254
         select (select tp.pointname from t_point tp where tp.pointid=qp.pointid)pointname
255
-        ,qp.pointid,ifnull(round(sum(psq.stuscore)*100/sum(psq.qscore),2),0)numrate
255
+        ,qp.pointid,ifnull(truncate(sum(psq.stuscore)*100/sum(psq.qscore),2),0)numrate
256 256
         from t_question_class qc left join t_paper p on qc.paperid=p.paperid
257 257
         left join t_paper_student_question psq on psq.paperid=p.paperid and psq.classid=qc.classid
258 258
         left join t_question_point qp on psq.questionid=qp.questionid

+ 1
- 1
sapi/src/main/resources/mapper/region/RegionAnalyzeMapper.xml Прегледај датотеку

@@ -94,7 +94,7 @@
94 94
         count(distinct rs.rsid) stunum,
95 95
         count(distinct case when rs.rsstate!=0 then rs.rsid else null end) commitnum
96 96
         from t_recite_group rg right join t_school s on rg.schoolid=s.schoolid and rg.starttime between #{begintime} and #{endtime}
97
-        left join t_recite_student rs on rs.reciteid=rg.reciteid
97
+        left join t_recite_student rs on rs.reciteid=rg.reciteid and rs.classid=rg.classid
98 98
         left join t_class c on c.classid=rg.classid
99 99
         where s.schoolstate=1 and c.year=s.year
100 100
         group by s.schoolid,rg.reciteid order by s.schoolid

+ 3
- 3
sstudy/src/main/java/com/xhkjedu/sstudy/controller/recite/ReciteStudentController.java Прегледај датотеку

@@ -4,12 +4,11 @@ import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5 5
 import com.xhkjedu.sstudy.model.recite.TReciteStudent;
6 6
 import com.xhkjedu.sstudy.service.recite.ReciteStudentService;
7
+import com.xhkjedu.sstudy.vo.recite.ReciteStudentVo;
7 8
 import com.xhkjedu.utils.N_Utils;
8 9
 import com.xhkjedu.utils.PageUtil;
9 10
 import com.xhkjedu.vo.PageResult;
10 11
 import com.xhkjedu.vo.ResultVo;
11
-import com.xhkjedu.sstudy.vo.recite.ReciteClassAnalyzeVo;
12
-import com.xhkjedu.sstudy.vo.recite.ReciteStudentVo;
13 12
 import org.springframework.beans.factory.annotation.Autowired;
14 13
 import org.springframework.web.bind.annotation.PostMapping;
15 14
 import org.springframework.web.bind.annotation.RequestBody;
@@ -17,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
17 16
 import org.springframework.web.bind.annotation.RestController;
18 17
 
19 18
 import java.util.List;
19
+import java.util.Map;
20 20
 
21 21
 /**
22 22
  * @ClassName ReciteStudentController
@@ -97,7 +97,7 @@ public class ReciteStudentController {
97 97
     @PostMapping("/classanaly")
98 98
     public ResultVo listReciteClass(@RequestBody TReciteStudent reciteStudent){
99 99
         N_Utils.validation(new Object[]{reciteStudent.getReciteid(),"背诵id",1});
100
-        List<ReciteClassAnalyzeVo> list = reciteStudentService.listRecitesClassForAnalyze(reciteStudent.getReciteid(),reciteStudent.getClassid());
100
+        List<Map> list = reciteStudentService.listRecitesClassForAnalyze(reciteStudent.getReciteid(), reciteStudent.getClassid());
101 101
         return new ResultVo(0,"获取班级背诵情况成功",list);
102 102
     }
103 103
 

+ 6
- 5
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/recite/ReciteStudentMapper.java Прегледај датотеку

@@ -2,12 +2,12 @@ package com.xhkjedu.sstudy.mapper.recite;
2 2
 
3 3
 import com.xhkjedu.sstudy.base.TkMapper;
4 4
 import com.xhkjedu.sstudy.model.recite.TReciteStudent;
5
-import com.xhkjedu.sstudy.vo.recite.ReciteClassAnalyzeVo;
6 5
 import com.xhkjedu.sstudy.vo.recite.ReciteStudentVo;
7 6
 import org.apache.ibatis.annotations.Param;
8 7
 import org.springframework.stereotype.Repository;
9 8
 
10 9
 import java.util.List;
10
+import java.util.Map;
11 11
 
12 12
 /**
13 13
  * @ClassName ReciteStudentMapper
@@ -56,13 +56,14 @@ public interface ReciteStudentMapper extends TkMapper<TReciteStudent> {
56 56
     ReciteStudentVo getReciteStuByRsid(@Param("studentid") Integer studentid, @Param("reciteid") Integer reciteid);
57 57
 
58 58
     /**
59
-     *功能描述  获取阅读班级统计
59
+     * 功能描述  获取阅读班级统计
60
+     *
61
+     * @param * @param reciteid
62
+     * @return java.util.List<com.xhkjedu.vo.recite.ReciteClassAnalyzeVo>
60 63
      * @author WN
61 64
      * @date 2020/6/17
62
-     * @param  * @param reciteid
63
-     * @return java.util.List<com.xhkjedu.vo.recite.ReciteClassAnalyzeVo>
64 65
      */
65
-    List<ReciteClassAnalyzeVo> listRecitesClassForAnalyze(Integer reciteid, Integer classid);
66
+    List<Map> listRecitesClassForAnalyze(Integer reciteid, Integer classid);
66 67
 
67 68
     //////////////////////////////////////////////学生WEB端//////////////////////////////////////////////
68 69
     /**

+ 4
- 4
sstudy/src/main/java/com/xhkjedu/sstudy/service/paper/PaperService.java Прегледај датотеку

@@ -111,7 +111,7 @@ public class PaperService {
111 111
                 //保存答题卡信息
112 112
                 savePaperScantronQtype(paper,qtypes);
113 113
                 //保存分析
114
-                savePaperScantronAnalyze(paperid,paper.getSchoolid());
114
+                //savePaperScantronAnalyze(paperid,paper.getSchoolid());
115 115
             }
116 116
 
117 117
         }catch (Exception e){
@@ -160,8 +160,8 @@ public class PaperService {
160 160
                 paperScantronQtypeMapper.deleteByPaperid(paper.getPaperid());   //保存答题卡信息
161 161
                 savePaperScantronQtype(paper, qtypes);
162 162
                 //删除分析信息
163
-                paperAnalyzeMapper.deleteByPaperid(paper.getPaperid());
164
-                savePaperScantronAnalyze(paper.getPaperid(), paper.getSchoolid());  //保存分析
163
+                //paperAnalyzeMapper.deleteByPaperid(paper.getPaperid());
164
+                //savePaperScantronAnalyze(paper.getPaperid(), paper.getSchoolid());  //保存分析
165 165
 
166 166
                 rtn = true;
167 167
             }
@@ -322,7 +322,7 @@ public class PaperService {
322 322
             paperMapper.updatePaper(paper);
323 323
             paperQtypeMapper.deleteByPaperid(paper.getPaperid());//删除作业题型信息
324 324
             savePaperQtype(paper, qtypes);//保存作业题型信息
325
-            paperAnalyzeMapper.deleteByPaperid(paper.getPaperid());//删除分析信息
325
+            //paperAnalyzeMapper.deleteByPaperid(paper.getPaperid());//删除分析信息
326 326
             //generatePaperAnalyze(paper.getPaperid(), paper.getSchoolid());//生成作业分析
327 327
             rtn = true;
328 328
         }catch (Exception e){

+ 45
- 11
sstudy/src/main/java/com/xhkjedu/sstudy/service/recite/ReciteStudentService.java Прегледај датотеку

@@ -4,13 +4,17 @@ import com.xhkjedu.sstudy.mapper.recite.ReciteGroupMapper;
4 4
 import com.xhkjedu.sstudy.mapper.recite.ReciteStudentMapper;
5 5
 import com.xhkjedu.sstudy.model.recite.TReciteGroup;
6 6
 import com.xhkjedu.sstudy.model.recite.TReciteStudent;
7
-import com.xhkjedu.utils.N_Utils;
8
-import com.xhkjedu.sstudy.vo.recite.ReciteClassAnalyzeVo;
9 7
 import com.xhkjedu.sstudy.vo.recite.ReciteStudentVo;
8
+import com.xhkjedu.utils.N_Utils;
10 9
 import org.springframework.beans.factory.annotation.Autowired;
11 10
 import org.springframework.stereotype.Service;
12 11
 
12
+import java.util.ArrayList;
13
+import java.util.HashMap;
14
+import java.util.LinkedHashMap;
13 15
 import java.util.List;
16
+import java.util.Map;
17
+import java.util.stream.Collectors;
14 18
 
15 19
 /**
16 20
  * @ClassName ReciteStudentService
@@ -56,28 +60,58 @@ public class ReciteStudentService {
56 60
     }
57 61
 
58 62
     /**
59
-     *功能描述 详情--根据学生背诵id获取背诵内容
60
-     * @author WN
61
-     * @date 2020/6/10
62
-     * @param  * @param rsid
63
+     * 功能描述 详情--根据学生背诵id获取背诵内容
64
+     *
65
+     * @param *        @param rsid
63 66
      * @param reciteid
64 67
      * @return com.xhkjedu.vo.recite.ReciteStudentVo
68
+     * @author WN
69
+     * @date 2020/6/10
65 70
      */
66
-    public ReciteStudentVo getReciteStuByRsid(Integer studentid, Integer reciteid){
71
+    public ReciteStudentVo getReciteStuByRsid(Integer studentid, Integer reciteid) {
67 72
         return reciteStudentMapper.getReciteStuByRsid(studentid, reciteid);
68 73
     }
69 74
 
70
-    public List<ReciteClassAnalyzeVo> listRecitesClassForAnalyze(Integer reciteid,Integer classid){
71
-        return reciteStudentMapper.listRecitesClassForAnalyze(reciteid,classid);
75
+    public List<Map> listRecitesClassForAnalyze(Integer reciteid, Integer classid) {
76
+        List<Map> list = new ArrayList<>();
77
+        List<Map> students = reciteStudentMapper.listRecitesClassForAnalyze(reciteid, classid);
78
+        if (N_Utils.isListEmpty(students)) return list;
79
+        Map<Object, List<Map>> collect = students.stream().collect(Collectors.groupingBy(m -> m.get("classid")
80
+                , LinkedHashMap::new, Collectors.toList()));
81
+        for (Map.Entry<Object, List<Map>> entry : collect.entrySet()) {
82
+            Map cmap = new HashMap();//班级统计
83
+            List<Map> stulist = new ArrayList<>();//学生列表
84
+            students = entry.getValue();
85
+            for (int i = 0; i < students.size(); i++) {
86
+                Map s = students.get(i);
87
+                if (i == 0) {
88
+                    cmap.put("classid", s.get("classid"));
89
+                    cmap.put("classname", s.get("classname"));
90
+                    cmap.put("gradeid", s.get("gradeid"));
91
+                }
92
+                s.remove("classid");
93
+                s.remove("classname");
94
+                s.remove("gradeid");
95
+                stulist.add(s);
96
+            }
97
+            cmap.put("stunum", students.size());//学生人数
98
+            List<Map> commitStus = students.stream().filter(s -> (int) s.get("rsstate") > 0).collect(Collectors.toList());
99
+            cmap.put("commitnum", commitStus.size());//已提交人数
100
+            double avgscore = commitStus.stream().mapToInt(s -> (int) s.get("userscore")).summaryStatistics().getAverage();
101
+            cmap.put("avgscore", avgscore);//平均分
102
+            cmap.put("stulist", stulist);//学生列表
103
+            list.add(cmap);
104
+        }
105
+        return list;
72 106
     }
73 107
 
74
-
75 108
     /**
76 109
      * 背诵学生--网页--列表
110
+     *
111
+     * @return java.util.List<com.xhkjedu.vo.recite.ReciteStudentVo>
77 112
      * @Param [student]
78 113
      * @Author ywx
79 114
      * @Date 2020/9/4 9:08
80
-     * @return java.util.List<com.xhkjedu.vo.recite.ReciteStudentVo>
81 115
      **/
82 116
     public List<ReciteStudentVo> listReciteStuWeb(TReciteStudent student) {
83 117
         return reciteStudentMapper.listReciteForStuWeb(student);

+ 1
- 1
sstudy/src/main/resources/application.properties Прегледај датотеку

@@ -107,4 +107,4 @@ file.showurl=http://schoolstatictest.xhkjedu.com/static/
107 107
 dbname=xhkjedu_school_test
108 108
 
109 109
 #版本号
110
-versionname=Test_v3.4.0
110
+versionname=Test_v3.4.1

+ 4
- 4
sstudy/src/main/resources/mapper/paper/PaperQtypeQuestionMapper.xml Прегледај датотеку

@@ -3,8 +3,8 @@
3 3
 <mapper namespace="com.xhkjedu.sstudy.mapper.paper.PaperQtypeQuestionMapper">
4 4
     <!--上传试卷按题型统计(只统计母题)-->
5 5
     <select id="paperTypeAnalyze" resultType="java.util.Map">
6
-       SELECT pt.qtypeid,pt.qtypename,COUNT(1) AS num,IFNULL(ROUND(COUNT(1)/p.papernum,2),0) AS numrate,
7
-       SUM(ptq.ptqscore) AS score,IFNULL(ROUND(SUM(ptq.ptqscore)/p.paperscore,2),0) AS scorerate,
6
+       SELECT pt.qtypeid,pt.qtypename,COUNT(1) AS num,IFNULL(truncate(COUNT(1)/p.papernum,2),0) AS numrate,
7
+       SUM(ptq.ptqscore) AS score,IFNULL(truncate(SUM(ptq.ptqscore)/p.paperscore,2),0) AS scorerate,
8 8
        GROUP_CONCAT(ptq.ptqorder) AS orders
9 9
        FROM t_paper_qtype_question ptq LEFT JOIN t_paper_qtype pt ON ptq.ptid = pt.ptid
10 10
        LEFT JOIN t_paper p ON ptq.paperid = p.paperid LEFT JOIN t_question q ON ptq.questionid = q.questionid
@@ -12,7 +12,7 @@
12 12
     </select>
13 13
     <!--上传试卷按难易度统计(只统计母题)-->
14 14
     <select id="complexityRateAnalyze" resultType="java.util.Map">
15
-        SELECT q.complexity,COUNT(1) AS complexitynum,IFNULL(ROUND(COUNT(1)/p.papernum,2),0) AS complexityrate,
15
+        SELECT q.complexity,COUNT(1) AS complexitynum,IFNULL(truncate(COUNT(1)/p.papernum,2),0) AS complexityrate,
16 16
         GROUP_CONCAT(ptq.ptqorder) AS orders ,SUM(ptq.ptqscore) AS scoretotal
17 17
         FROM t_paper_qtype_question ptq
18 18
         LEFT JOIN t_paper p ON ptq.paperid = p.paperid LEFT JOIN t_question q ON ptq.questionid = q.questionid
@@ -21,7 +21,7 @@
21 21
     <!--上传试卷按知识点统计(只统计母题)-->
22 22
     <select id="pointRateAnalyze" resultType="java.util.Map">
23 23
         SELECT qp.pointid,tp.pointname,COUNT(1) AS pointnum,SUM(ptq.ptqscore) AS pointscore,
24
-        IFNULL(ROUND(SUM(ptq.ptqscore)/p.paperscore,2),0) AS pointscorerate,GROUP_CONCAT(ptq.ptqorder) AS orders
24
+        IFNULL(truncate(SUM(ptq.ptqscore)/p.paperscore,2),0) AS pointscorerate,GROUP_CONCAT(ptq.ptqorder) AS orders
25 25
         FROM t_paper_qtype_question ptq
26 26
         LEFT JOIN t_paper p ON ptq.paperid = p.paperid LEFT JOIN t_question q ON ptq.questionid = q.questionid
27 27
         LEFT JOIN t_question_point qp ON q.questionid = qp.questionid LEFT JOIN t_point tp ON qp.pointid = tp.pointid

+ 2
- 2
sstudy/src/main/resources/mapper/paper/PaperScantronMapper.xml Прегледај датотеку

@@ -4,8 +4,8 @@
4 4
 
5 5
     <!-- 答题卡试卷 题型 -->
6 6
     <select id="listQtypeAnalyze" resultType="java.util.Map">
7
-        SELECT psq.qtypeid,psq.qtypename,COUNT(1) AS num,IFNULL(ROUND(COUNT(1)/p.papernum,2),0) AS numrate,
8
-        psq.pstscore AS score,IFNULL(ROUND(SUM(psq.pstscore)/p.paperscore,2),0) AS scorerate,
7
+        SELECT psq.qtypeid,psq.qtypename,COUNT(1) AS num,IFNULL(truncate(COUNT(1)/p.papernum,2),0) AS numrate,
8
+        psq.pstscore AS score,IFNULL(truncate(SUM(psq.pstscore)/p.paperscore,2),0) AS scorerate,
9 9
         GROUP_CONCAT(ps.psorder) AS orders
10 10
         FROM t_paper_scantron_qtype psq LEFT JOIN t_paper_scantron ps ON psq.psqtypeid=ps.psqtypeid
11 11
         LEFT JOIN t_paper p ON  psq.paperid=p.paperid

+ 15
- 2
sstudy/src/main/resources/mapper/question/QuestionExplainMapper.xml Прегледај датотеку

@@ -5,7 +5,13 @@
5 5
     <select id="listByQuestionId" resultType="com.xhkjedu.sstudy.model.question.TQuestionExplain">
6 6
         select qe.*,u.username createname
7 7
         from t_question_explain qe left join t_user u on qe.createid=u.userid
8
-        where qe.questionid=#{questionid} and qe.qctype=#{qctype}
8
+        where qe.questionid=#{questionid}
9
+        <if test="qctype==2">
10
+            and qe.qctype=2
11
+        </if>
12
+        <if test="qctype!=2">
13
+            and qe.qctype!=2
14
+        </if>
9 15
         order by qe.createtime desc
10 16
     </select>
11 17
     <!--更新播放次数-->
@@ -31,7 +37,14 @@
31 37
         from t_question_explain qe left join t_user u on qe.createid=u.userid
32 38
         where
33 39
         <foreach collection="questions" item="question" index="index" separator="or">
34
-            (qe.questionid=#{question.questionid} and qe.qctype=${question.qctype})
40
+            (qe.questionid=#{question.questionid}
41
+            <if test="question.qctype==2">
42
+                and qe.qctype=2
43
+            </if>
44
+            <if test="question.qctype!=2">
45
+                and qe.qctype!=2
46
+            </if>
47
+            )
35 48
         </foreach>
36 49
         order by qe.createtime desc
37 50
     </select>

+ 1
- 2
sstudy/src/main/resources/mapper/recite/ReciteGroupMapper.xml Прегледај датотеку

@@ -4,7 +4,6 @@
4 4
     <!-- 背诵班级信息 -->
5 5
     <select id="findByRsId" resultType="com.xhkjedu.sstudy.model.recite.TReciteGroup">
6 6
         SELECT rg.* FROM t_recite_group rg
7
-        LEFT JOIN t_recite_student rs ON rg.reciteid=rs.reciteid and rg.classid=rs.classid
8
-        where rs.reciteid=#{reciteid} limit 1
7
+        where rg.reciteid=#{reciteid} limit 1
9 8
     </select>
10 9
 </mapper>

+ 1
- 1
sstudy/src/main/resources/mapper/recite/ReciteMapper.xml Прегледај датотеку

@@ -23,7 +23,7 @@
23 23
         ,r.createid,u.username AS createname,r.createtime,rg.starttime,rg.stoptime
24 24
         FROM t_recite r LEFT JOIN t_user u ON r.createid=u.userid
25 25
         LEFT JOIN t_recite_group rg ON rg.reciteid = r.reciteid
26
-        LEFT JOIN t_recite_student rs ON r.reciteid=rg.reciteid
26
+        LEFT JOIN t_recite_student rs ON rg.reciteid=rs.reciteid and rs.classid=rg.classid
27 27
         where r.createid=#{recite.createid}
28 28
         <if test="recite.recitestate==1">
29 29
             AND rg.stoptime<![CDATA[ >= ]]>UNIX_TIMESTAMP()

+ 6
- 35
sstudy/src/main/resources/mapper/recite/ReciteStudentMapper.xml Прегледај датотеку

@@ -47,44 +47,15 @@
47 47
     </select>
48 48
 
49 49
     <!-- 班级背诵统计 -->
50
-    <resultMap id="recitesClass" type="com.xhkjedu.sstudy.vo.recite.ReciteClassAnalyzeVo">
51
-        <result property="classid" column="classid"></result>
52
-        <result property="classname" column="classname"></result>
53
-        <result property="gradeid" column="gradeid"></result>
54
-        <result property="stunum" column="stunum"></result>
55
-        <result property="commitnum" column="commitnum"></result>
56
-        <result property="avgscore" column="avgscore"></result>
57
-        <collection property="stulist" ofType="com.xhkjedu.sstudy.vo.recite.ReciteStudentAnalyzeVo"
58
-                    javaType="java.util.List" select="listStudent" column="{reciteid=reciteid,classid=classid}">
59
-        </collection>
60
-    </resultMap>
61
-    <resultMap id="stuResult" type="com.xhkjedu.sstudy.vo.recite.ReciteStudentAnalyzeVo">
62
-        <result property="rsid" column="rsid"></result>
63
-        <result property="studentid" column="studentid"></result>
64
-        <result property="username" column="username"></result>
65
-        <result property="headpic" column="headpic"></result>
66
-        <result property="userscore" column="userscore"></result>
67
-        <result property="answerpath" column="answerpath"></result>
68
-        <result property="rsstate" column="rsstate"></result>
69
-        <result property="stoptime" column="stoptime"></result>
70
-        <result property="answertxt" column="answertxt"></result>
71
-    </resultMap>
72
-    <select id="listStudent" resultMap="stuResult">
73
-        SELECT rs.rsid,rs.studentid,u.username,u.headpic,rs.userscore,rs.answerpath,rs.rsstate,rs.stoptime,rs.answertxt
74
-        FROM t_recite_student rs LEFT JOIN t_user u ON rs.studentid=u.userid
75
-        WHERE reciteid=#{reciteid} and rs.classid=#{classid}
76
-        order by rs.userscore desc
77
-    </select>
78
-    <select id="listRecitesClassForAnalyze" resultMap="recitesClass">
79
-        SELECT rg.reciteid,rg.classid,c.classname,c.gradeid,
80
-        (SELECT COUNT(*) FROM t_recite_student rs1 WHERE rs1.reciteid=rg.reciteid AND rs1.classid=rg.classid) AS stunum,
81
-        (SELECT COUNT(*) FROM t_recite_student rs1 WHERE rs1.reciteid=rg.reciteid AND rs1.classid=rg.classid AND rs1.rsstate>0) AS commitnum,
82
-        (SELECT truncate(IFNULL(AVG(rs1.userscore),0),2) FROM t_recite_student rs1 WHERE rs1.reciteid=rg.reciteid
83
-        AND rs1.classid=rg.classid AND rs1.rsstate>0) AS avgscore
50
+    <select id="listRecitesClassForAnalyze" resultType="java.util.Map">
51
+        SELECT rg.classid,c.classname,c.gradeid,
52
+        rs.rsid,rs.studentid,u.username,u.headpic,rs.userscore,rs.answerpath,rs.rsstate,rs.stoptime,rs.answertxt
84 53
         FROM t_recite_group rg LEFT JOIN t_class c ON rg.classid=c.classid
54
+        LEFT JOIN t_recite_student rs ON rs.reciteid=rg.reciteid AND rs.classid=rg.classid
55
+        LEFT JOIN t_user u ON rs.studentid=u.userid
85 56
         WHERE rg.reciteid=#{reciteid}
86 57
          <if test="classid!=null"> and rg.classid=#{classid}</if>
87
-         order by c.gradeid,c.classtype,c.classorder
58
+         order by c.classtype,c.classorder,rs.userscore desc
88 59
     </select>
89 60
 
90 61
     <!--//////////////////////////////////////////////学生WEB端//////////////////////////////////////////////-->

Loading…
Откажи
Сачувај