|
@@ -1,5 +1,6 @@
|
1
|
1
|
package com.xhkjedu.smarking.service.report.report;
|
2
|
2
|
|
|
3
|
+import com.alibaba.fastjson.JSON;
|
3
|
4
|
import com.xhkjedu.smarking.mapper.exam.MsClassMapper;
|
4
|
5
|
import com.xhkjedu.smarking.mapper.report.reportclass.MsrClassQuestionMapper;
|
5
|
6
|
import com.xhkjedu.smarking.mapper.report.reportclass.MsrClassSubjectGradeMapper;
|
|
@@ -10,13 +11,12 @@ import com.xhkjedu.smarking.model.report.reportclass.MsrClassQuestion;
|
10
|
11
|
import com.xhkjedu.smarking.model.report.reportclass.MsrClassSubjectGrade;
|
11
|
12
|
import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
|
12
|
13
|
import com.xhkjedu.smarking.vo.report.reportother.ExamReportParams;
|
|
14
|
+import com.xhkjedu.smarking.vo.report.reportother.SzJsonVo;
|
|
15
|
+import com.xhkjedu.utils.N_Utils;
|
13
|
16
|
import org.springframework.stereotype.Service;
|
14
|
17
|
|
15
|
18
|
import javax.annotation.Resource;
|
16
|
|
-import java.util.ArrayList;
|
17
|
|
-import java.util.HashMap;
|
18
|
|
-import java.util.List;
|
19
|
|
-import java.util.Map;
|
|
19
|
+import java.util.*;
|
20
|
20
|
import java.util.stream.Collectors;
|
21
|
21
|
|
22
|
22
|
/**
|
|
@@ -112,29 +112,135 @@ public class MsrClassQuestionService {
|
112
|
112
|
}
|
113
|
113
|
|
114
|
114
|
//学科报告-各班学科试题分析-得分率
|
115
|
|
- public void listQuestionForXhScoreRate(ExamReportParams params){
|
|
115
|
+ public Map<String,Object> listQuestionForXhXhstDfl(ExamReportParams params){
|
116
|
116
|
params.setSelclass(3);
|
117
|
117
|
params.setClassids("0," + params.getClassids());//拼上全体
|
118
|
118
|
//获取选定班级的试题分析
|
119
|
119
|
List<MsrClassQuestion> questions = msrClassQuestionMapper.listQuestionForXh(params);
|
|
120
|
+ //获取全体试题情况
|
|
121
|
+ List<MsrClassQuestion> schoolQuestions = questions.stream().filter(m -> m.getClassid() == 0).collect(Collectors.toList());
|
|
122
|
+ List<MsrClassQuestion> classQuestions = questions.stream().filter(m -> m.getClassid() != 0).collect(Collectors.toList());
|
120
|
123
|
//获取所有题号
|
121
|
|
- List<String> qns = questions.stream().map(MsrClassQuestion::getQn).distinct().collect(Collectors.toList());
|
|
124
|
+ List<String> qns = new ArrayList<>();
|
|
125
|
+ //获取全体得分率数据
|
|
126
|
+ List<Map<String,Object>> schoolScoreRate = new ArrayList<>();
|
|
127
|
+ Map<Integer,Object> mptqidScore = new LinkedHashMap<>();//全体各题得分率
|
|
128
|
+ for(MsrClassQuestion q : schoolQuestions){
|
|
129
|
+ Map<String,Object> qMap = new HashMap<>();
|
|
130
|
+ qMap.put("qn",q.getQn());
|
|
131
|
+ qMap.put("mptqid",q.getMptqid());
|
|
132
|
+ qMap.put("qorder",q.getQorder());
|
|
133
|
+ qMap.put("scorerate",q.getScorerate());
|
|
134
|
+ schoolScoreRate.add(qMap);
|
|
135
|
+ mptqidScore.put(q.getMptqid(),q.getScorerate());
|
|
136
|
+ qns.add(q.getQn());
|
|
137
|
+ }
|
|
138
|
+
|
122
|
139
|
//把试题按班级分组
|
123
|
|
- Map<Integer,List<MsrClassQuestion>> classMap = questions.stream().collect(Collectors.groupingBy(MsrClassQuestion::getClassid));
|
124
|
|
- List<Map<String,Object>> classList = new ArrayList<>();//班级试题
|
|
140
|
+ Map<Integer,List<MsrClassQuestion>> classMap = classQuestions.stream().collect(Collectors.groupingBy(MsrClassQuestion::getClassid));
|
|
141
|
+ List<Map<String,Object>> classList = new ArrayList<>();//班级试题得分率差
|
125
|
142
|
for(Map.Entry<Integer,List<MsrClassQuestion>> entry : classMap.entrySet()){
|
|
143
|
+ List<MsrClassQuestion> classQueList = entry.getValue();
|
|
144
|
+ List<Map<String,Object>> queList = new ArrayList<>();
|
|
145
|
+ for(MsrClassQuestion q : classQueList) {
|
|
146
|
+ Map<String, Object> qMap = new HashMap<>();
|
|
147
|
+ qMap.put("qn", q.getQn());
|
|
148
|
+ qMap.put("mptqid", q.getMptqid());
|
|
149
|
+ qMap.put("qorder", q.getQorder());
|
|
150
|
+ qMap.put("scorerate", q.getScorerate());
|
|
151
|
+ qMap.put("scoreratec", q.getScoreratec());
|
|
152
|
+ qMap.put("schoolscorerate", mptqidScore.get(q.getMptqid()));
|
|
153
|
+ queList.add(qMap);
|
|
154
|
+ }
|
|
155
|
+
|
126
|
156
|
Map<String,Object> clMap = new HashMap<>();
|
127
|
157
|
clMap.put("classid",entry.getKey());
|
128
|
|
- clMap.put("classname",entry.getValue().get(0).getClassname());
|
129
|
|
- clMap.put("questions",entry.getValue());
|
|
158
|
+ clMap.put("classname",classQueList.get(0).getClassname());
|
|
159
|
+ clMap.put("questions",queList.stream().sorted(Comparator.comparing(m -> (Integer) m.get("qorder"))).collect(Collectors.toList()));
|
130
|
160
|
classList.add(clMap);
|
131
|
161
|
}
|
|
162
|
+
|
|
163
|
+ //分析诊断-得分率高于全体得分率的班级和试题
|
|
164
|
+ List<MsrClassQuestion> highQuestions = new ArrayList<>();//高于全体得分率的试题情况
|
|
165
|
+ for(MsrClassQuestion q : schoolQuestions){
|
|
166
|
+ List<MsrClassQuestion> hightClass = questions.stream().filter(m -> m.getMptqid().equals(q.getMptqid()) && m.getClassid() != 0 && m.getScorerate() > q.getScorerate()).collect(Collectors.toList());
|
|
167
|
+ if(!hightClass.isEmpty()){
|
|
168
|
+ highQuestions.addAll(hightClass);
|
|
169
|
+ }
|
|
170
|
+ }
|
|
171
|
+ //高分按班级分组,哪个班级试题数量多,则属于高班和试题(统计高于年级平均值的试题数量,看哪个班级最多)
|
|
172
|
+ Map<Integer,List<MsrClassQuestion>> highClassMap = highQuestions.stream().collect(Collectors.groupingBy(MsrClassQuestion::getClassid));
|
|
173
|
+ int maxNum = 0;
|
|
174
|
+ List<MsrClassQuestion> maxClassQuestions = new ArrayList<>();
|
|
175
|
+ for(Map.Entry<Integer,List<MsrClassQuestion>> entry : highClassMap.entrySet()){
|
|
176
|
+ if(entry.getValue().size() > maxNum){
|
|
177
|
+ maxNum = entry.getValue().size();
|
|
178
|
+ maxClassQuestions.addAll(entry.getValue());
|
|
179
|
+ }
|
|
180
|
+ }
|
|
181
|
+ Map<String,Object> highMap = new HashMap<>();//高得分率分析
|
|
182
|
+ if(!maxClassQuestions.isEmpty()){
|
|
183
|
+ highMap.put("classname",maxClassQuestions.get(0).getClassname());
|
|
184
|
+ highMap.put("qnstr",maxClassQuestions.stream().map(MsrClassQuestion::getQn).distinct().collect(Collectors.joining(",")));
|
|
185
|
+ }
|
|
186
|
+ //列出各个难度的试题中,得分率低于60%的试题,用全体试题的得分率进行难度分组
|
|
187
|
+ Map<String,List<MsrClassQuestion>> ndMap = schoolQuestions.stream().collect(Collectors.groupingBy(MsrClassQuestion::getNdms));
|
|
188
|
+ //获取所有试题难度分组参数
|
|
189
|
+ MsrReportparam ndParam = msrReportparamMapper.getReportparamByRpbelongSubjectType(params.getExamid(),"quesummary","all",params.getSubjectid(),1);
|
|
190
|
+ List<SzJsonVo> jsonList = JSON.parseArray(ndParam.getSzjson(), SzJsonVo.class);
|
|
191
|
+ List<Map<String,Object>> ndList = new ArrayList<>();
|
|
192
|
+ for(SzJsonVo szvo : jsonList){
|
|
193
|
+ Map<String,Object> zsndMap = new HashMap<>();
|
|
194
|
+ zsndMap.put("djkey",szvo.getDjkey());
|
|
195
|
+ String qnStr = "";
|
|
196
|
+ if(ndMap.containsKey(szvo.getDjkey())){
|
|
197
|
+ List<MsrClassQuestion> ndQues = ndMap.get(szvo.getDjkey());
|
|
198
|
+ //获取得分率低于60%的试题
|
|
199
|
+ List<MsrClassQuestion> lowQuestions = ndQues.stream().filter(m -> m.getScorerate() < 0.6).collect(Collectors.toList());
|
|
200
|
+ if(!lowQuestions.isEmpty()){
|
|
201
|
+ qnStr = lowQuestions.stream().map(MsrClassQuestion::getQn).distinct().collect(Collectors.joining(","));
|
|
202
|
+ }
|
|
203
|
+ }
|
|
204
|
+ if(N_Utils.isEmpty(qnStr)){
|
|
205
|
+ qnStr = "无";
|
|
206
|
+ }
|
|
207
|
+ zsndMap.put("qnstr",qnStr);
|
|
208
|
+
|
|
209
|
+ ndList.add(zsndMap);
|
|
210
|
+ }
|
|
211
|
+ //计算各个难度的试题得分率
|
|
212
|
+ for(Map<String,Object> nd : ndList) {
|
|
213
|
+ List<MsrClassQuestion> ndQuestions = schoolQuestions.stream().filter(m -> m.getNdms().equals(nd.get("ndms"))).collect(Collectors.toList());
|
|
214
|
+ }
|
|
215
|
+
|
|
216
|
+ Map<String,Object> rtnMap = new LinkedHashMap<>();
|
|
217
|
+ rtnMap.put("qns",qns);
|
|
218
|
+ rtnMap.put("schoolQues",schoolScoreRate);
|
|
219
|
+ rtnMap.put("classQues",classList);
|
|
220
|
+ rtnMap.put("highMap",highMap);
|
|
221
|
+ rtnMap.put("ndList",ndList);
|
|
222
|
+ return rtnMap;
|
132
|
223
|
}
|
133
|
224
|
//学科报告-各班学科试题分析-试题难度和区分度
|
134
|
|
- public void listQuestionForXhNdAndQfd(ExamReportParams params){
|
|
225
|
+ public void listQuestionForXhXhstNdAndQfd(ExamReportParams params){
|
135
|
226
|
params.setSelclass(4);
|
136
|
227
|
//获取选定班级的试题分析
|
137
|
228
|
List<MsrClassQuestion> questions = msrClassQuestionMapper.listQuestionForXh(params);
|
|
229
|
+ //表现较好的题目和表现不足的题目,根据得分率差进行排序
|
|
230
|
+ List<MsrClassQuestion> goodAndBadQues = questions.stream().sorted(Comparator.comparing(MsrClassQuestion::getScoreratec).reversed()).collect(Collectors.toList());
|
|
231
|
+ List<MsrClassQuestion> firstN;
|
|
232
|
+ List<MsrClassQuestion> lastN;
|
|
233
|
+ int n = 5;
|
|
234
|
+ if(goodAndBadQues.size() < n){
|
|
235
|
+ n = goodAndBadQues.size()/2;
|
|
236
|
+ }
|
|
237
|
+ // 获取前N个元素
|
|
238
|
+ firstN = goodAndBadQues.stream().limit(n).collect(Collectors.toList());
|
|
239
|
+ // 获取后N个元素
|
|
240
|
+ lastN = goodAndBadQues.stream().skip(goodAndBadQues.size() - n).collect(Collectors.toList());
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
138
|
244
|
//获取所有题号
|
139
|
245
|
List<String> qns = questions.stream().map(MsrClassQuestion::getQn).distinct().collect(Collectors.toList());
|
140
|
246
|
//把试题按班级分组
|