Browse Source

班级报告优化

背诵优化
作业试题统计注释掉
tags/正式版本
雍文秀 2 years ago
parent
commit
0e161a2a4a

+ 51
- 26
sapi/src/main/java/com/xhkjedu/sapi/service/classreport/ClassReportService.java View File

1
 package com.xhkjedu.sapi.service.classreport;
1
 package com.xhkjedu.sapi.service.classreport;
2
 
2
 
3
 import com.alibaba.fastjson.JSON;
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
 import com.xhkjedu.sapi.vo.classreport.CGradeSubjectVo;
23
 import com.xhkjedu.sapi.vo.classreport.CGradeSubjectVo;
7
 import com.xhkjedu.sapi.vo.classreport.ReportClasstypeVo;
24
 import com.xhkjedu.sapi.vo.classreport.ReportClasstypeVo;
8
 import com.xhkjedu.sapi.vo.classreport.ReportRateVo;
25
 import com.xhkjedu.sapi.vo.classreport.ReportRateVo;
13
 import org.springframework.stereotype.Service;
30
 import org.springframework.stereotype.Service;
14
 
31
 
15
 import javax.annotation.Resource;
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
 import java.util.stream.Collectors;
41
 import java.util.stream.Collectors;
18
 
42
 
19
 /**
43
 /**
1055
             r.setGuidemaxnum(c.getMaxnum());//发布预习最高次数
1079
             r.setGuidemaxnum(c.getMaxnum());//发布预习最高次数
1056
             r.setGuideprerate(c.getNumrate());//发布预习次数同比
1080
             r.setGuideprerate(c.getNumrate());//发布预习次数同比
1057
             r.setGuiderank(c.getRank());//发布预习次数排名
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
             list1.add(r);
1084
             list1.add(r);
1061
             return list1;
1085
             return list1;
1062
         }
1086
         }
1203
 
1227
 
1204
             Double commitrate = 0.0;//提交率
1228
             Double commitrate = 0.0;//提交率
1205
             Double checkrate = 0.0;//批改率
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
                 fbnum = num;
1254
                 fbnum = num;
1231
                 if (module.equals("preview")) {//预习
1255
                 if (module.equals("preview")) {//预习
1232
                     YearOnYearVo y = years.stream().filter(v -> v.getClassid().equals(type.getClassid()) && v.getSubjectid().equals(type.getSubjectid())).findFirst().orElse(null);
1256
                     YearOnYearVo y = years.stream().filter(v -> v.getClassid().equals(type.getClassid()) && v.getSubjectid().equals(type.getSubjectid())).findFirst().orElse(null);
1233
                     if (y != null) {
1257
                     if (y != null) {
1234
                         prerate = N_Utils.getIntegerDivideAndMulitiply(fbnum - y.getFbnum(), fbnum);
1258
                         prerate = N_Utils.getIntegerDivideAndMulitiply(fbnum - y.getFbnum(), fbnum);
1259
+                        tjprerate = N_Utils.formatDouble(commitrate - y.getTjrate(), 2);
1235
                     }
1260
                     }
1236
                 } else if (module.equals("paper")) {//作业
1261
                 } else if (module.equals("paper")) {//作业
1237
                     YearOnYearVo y = years.stream().filter(v -> v.getClassid().equals(type.getClassid()) && v.getSubjectid().equals(type.getSubjectid())).findFirst().orElse(null);
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 View File

100
 #每隔3s清除一下请求地址map
100
 #每隔3s清除一下请求地址map
101
 cron.deleteUriMap=0/3 * * * * ?
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 View File

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

+ 1
- 1
sapi/src/main/resources/mapper/region/RegionAnalyzeMapper.xml View File

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

+ 3
- 3
sstudy/src/main/java/com/xhkjedu/sstudy/controller/recite/ReciteStudentController.java View File

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

+ 6
- 5
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/recite/ReciteStudentMapper.java View File

2
 
2
 
3
 import com.xhkjedu.sstudy.base.TkMapper;
3
 import com.xhkjedu.sstudy.base.TkMapper;
4
 import com.xhkjedu.sstudy.model.recite.TReciteStudent;
4
 import com.xhkjedu.sstudy.model.recite.TReciteStudent;
5
-import com.xhkjedu.sstudy.vo.recite.ReciteClassAnalyzeVo;
6
 import com.xhkjedu.sstudy.vo.recite.ReciteStudentVo;
5
 import com.xhkjedu.sstudy.vo.recite.ReciteStudentVo;
7
 import org.apache.ibatis.annotations.Param;
6
 import org.apache.ibatis.annotations.Param;
8
 import org.springframework.stereotype.Repository;
7
 import org.springframework.stereotype.Repository;
9
 
8
 
10
 import java.util.List;
9
 import java.util.List;
10
+import java.util.Map;
11
 
11
 
12
 /**
12
 /**
13
  * @ClassName ReciteStudentMapper
13
  * @ClassName ReciteStudentMapper
56
     ReciteStudentVo getReciteStuByRsid(@Param("studentid") Integer studentid, @Param("reciteid") Integer reciteid);
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
      * @author WN
63
      * @author WN
61
      * @date 2020/6/17
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
     //////////////////////////////////////////////学生WEB端//////////////////////////////////////////////
68
     //////////////////////////////////////////////学生WEB端//////////////////////////////////////////////
68
     /**
69
     /**

+ 4
- 4
sstudy/src/main/java/com/xhkjedu/sstudy/service/paper/PaperService.java View File

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

+ 45
- 11
sstudy/src/main/java/com/xhkjedu/sstudy/service/recite/ReciteStudentService.java View File

4
 import com.xhkjedu.sstudy.mapper.recite.ReciteStudentMapper;
4
 import com.xhkjedu.sstudy.mapper.recite.ReciteStudentMapper;
5
 import com.xhkjedu.sstudy.model.recite.TReciteGroup;
5
 import com.xhkjedu.sstudy.model.recite.TReciteGroup;
6
 import com.xhkjedu.sstudy.model.recite.TReciteStudent;
6
 import com.xhkjedu.sstudy.model.recite.TReciteStudent;
7
-import com.xhkjedu.utils.N_Utils;
8
-import com.xhkjedu.sstudy.vo.recite.ReciteClassAnalyzeVo;
9
 import com.xhkjedu.sstudy.vo.recite.ReciteStudentVo;
7
 import com.xhkjedu.sstudy.vo.recite.ReciteStudentVo;
8
+import com.xhkjedu.utils.N_Utils;
10
 import org.springframework.beans.factory.annotation.Autowired;
9
 import org.springframework.beans.factory.annotation.Autowired;
11
 import org.springframework.stereotype.Service;
10
 import org.springframework.stereotype.Service;
12
 
11
 
12
+import java.util.ArrayList;
13
+import java.util.HashMap;
14
+import java.util.LinkedHashMap;
13
 import java.util.List;
15
 import java.util.List;
16
+import java.util.Map;
17
+import java.util.stream.Collectors;
14
 
18
 
15
 /**
19
 /**
16
  * @ClassName ReciteStudentService
20
  * @ClassName 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
      * @param reciteid
66
      * @param reciteid
64
      * @return com.xhkjedu.vo.recite.ReciteStudentVo
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
         return reciteStudentMapper.getReciteStuByRsid(studentid, reciteid);
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
      * @Param [student]
112
      * @Param [student]
78
      * @Author ywx
113
      * @Author ywx
79
      * @Date 2020/9/4 9:08
114
      * @Date 2020/9/4 9:08
80
-     * @return java.util.List<com.xhkjedu.vo.recite.ReciteStudentVo>
81
      **/
115
      **/
82
     public List<ReciteStudentVo> listReciteStuWeb(TReciteStudent student) {
116
     public List<ReciteStudentVo> listReciteStuWeb(TReciteStudent student) {
83
         return reciteStudentMapper.listReciteForStuWeb(student);
117
         return reciteStudentMapper.listReciteForStuWeb(student);

+ 1
- 1
sstudy/src/main/resources/application.properties View File

107
 dbname=xhkjedu_school_test
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 View File

3
 <mapper namespace="com.xhkjedu.sstudy.mapper.paper.PaperQtypeQuestionMapper">
3
 <mapper namespace="com.xhkjedu.sstudy.mapper.paper.PaperQtypeQuestionMapper">
4
     <!--上传试卷按题型统计(只统计母题)-->
4
     <!--上传试卷按题型统计(只统计母题)-->
5
     <select id="paperTypeAnalyze" resultType="java.util.Map">
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
        GROUP_CONCAT(ptq.ptqorder) AS orders
8
        GROUP_CONCAT(ptq.ptqorder) AS orders
9
        FROM t_paper_qtype_question ptq LEFT JOIN t_paper_qtype pt ON ptq.ptid = pt.ptid
9
        FROM t_paper_qtype_question ptq LEFT JOIN t_paper_qtype pt ON ptq.ptid = pt.ptid
10
        LEFT JOIN t_paper p ON ptq.paperid = p.paperid LEFT JOIN t_question q ON ptq.questionid = q.questionid
10
        LEFT JOIN t_paper p ON ptq.paperid = p.paperid LEFT JOIN t_question q ON ptq.questionid = q.questionid
12
     </select>
12
     </select>
13
     <!--上传试卷按难易度统计(只统计母题)-->
13
     <!--上传试卷按难易度统计(只统计母题)-->
14
     <select id="complexityRateAnalyze" resultType="java.util.Map">
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
         GROUP_CONCAT(ptq.ptqorder) AS orders ,SUM(ptq.ptqscore) AS scoretotal
16
         GROUP_CONCAT(ptq.ptqorder) AS orders ,SUM(ptq.ptqscore) AS scoretotal
17
         FROM t_paper_qtype_question ptq
17
         FROM t_paper_qtype_question ptq
18
         LEFT JOIN t_paper p ON ptq.paperid = p.paperid LEFT JOIN t_question q ON ptq.questionid = q.questionid
18
         LEFT JOIN t_paper p ON ptq.paperid = p.paperid LEFT JOIN t_question q ON ptq.questionid = q.questionid
21
     <!--上传试卷按知识点统计(只统计母题)-->
21
     <!--上传试卷按知识点统计(只统计母题)-->
22
     <select id="pointRateAnalyze" resultType="java.util.Map">
22
     <select id="pointRateAnalyze" resultType="java.util.Map">
23
         SELECT qp.pointid,tp.pointname,COUNT(1) AS pointnum,SUM(ptq.ptqscore) AS pointscore,
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
         FROM t_paper_qtype_question ptq
25
         FROM t_paper_qtype_question ptq
26
         LEFT JOIN t_paper p ON ptq.paperid = p.paperid LEFT JOIN t_question q ON ptq.questionid = q.questionid
26
         LEFT JOIN t_paper p ON ptq.paperid = p.paperid LEFT JOIN t_question q ON ptq.questionid = q.questionid
27
         LEFT JOIN t_question_point qp ON q.questionid = qp.questionid LEFT JOIN t_point tp ON qp.pointid = tp.pointid
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 View File

4
 
4
 
5
     <!-- 答题卡试卷 题型 -->
5
     <!-- 答题卡试卷 题型 -->
6
     <select id="listQtypeAnalyze" resultType="java.util.Map">
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
         GROUP_CONCAT(ps.psorder) AS orders
9
         GROUP_CONCAT(ps.psorder) AS orders
10
         FROM t_paper_scantron_qtype psq LEFT JOIN t_paper_scantron ps ON psq.psqtypeid=ps.psqtypeid
10
         FROM t_paper_scantron_qtype psq LEFT JOIN t_paper_scantron ps ON psq.psqtypeid=ps.psqtypeid
11
         LEFT JOIN t_paper p ON  psq.paperid=p.paperid
11
         LEFT JOIN t_paper p ON  psq.paperid=p.paperid

+ 15
- 2
sstudy/src/main/resources/mapper/question/QuestionExplainMapper.xml View File

5
     <select id="listByQuestionId" resultType="com.xhkjedu.sstudy.model.question.TQuestionExplain">
5
     <select id="listByQuestionId" resultType="com.xhkjedu.sstudy.model.question.TQuestionExplain">
6
         select qe.*,u.username createname
6
         select qe.*,u.username createname
7
         from t_question_explain qe left join t_user u on qe.createid=u.userid
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
         order by qe.createtime desc
15
         order by qe.createtime desc
10
     </select>
16
     </select>
11
     <!--更新播放次数-->
17
     <!--更新播放次数-->
31
         from t_question_explain qe left join t_user u on qe.createid=u.userid
37
         from t_question_explain qe left join t_user u on qe.createid=u.userid
32
         where
38
         where
33
         <foreach collection="questions" item="question" index="index" separator="or">
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
         </foreach>
48
         </foreach>
36
         order by qe.createtime desc
49
         order by qe.createtime desc
37
     </select>
50
     </select>

+ 1
- 2
sstudy/src/main/resources/mapper/recite/ReciteGroupMapper.xml View File

4
     <!-- 背诵班级信息 -->
4
     <!-- 背诵班级信息 -->
5
     <select id="findByRsId" resultType="com.xhkjedu.sstudy.model.recite.TReciteGroup">
5
     <select id="findByRsId" resultType="com.xhkjedu.sstudy.model.recite.TReciteGroup">
6
         SELECT rg.* FROM t_recite_group rg
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
     </select>
8
     </select>
10
 </mapper>
9
 </mapper>

+ 1
- 1
sstudy/src/main/resources/mapper/recite/ReciteMapper.xml View File

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

+ 6
- 35
sstudy/src/main/resources/mapper/recite/ReciteStudentMapper.xml View File

47
     </select>
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
         FROM t_recite_group rg LEFT JOIN t_class c ON rg.classid=c.classid
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
         WHERE rg.reciteid=#{reciteid}
56
         WHERE rg.reciteid=#{reciteid}
86
          <if test="classid!=null"> and rg.classid=#{classid}</if>
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
     </select>
59
     </select>
89
 
60
 
90
     <!--//////////////////////////////////////////////学生WEB端//////////////////////////////////////////////-->
61
     <!--//////////////////////////////////////////////学生WEB端//////////////////////////////////////////////-->

Loading…
Cancel
Save