9338b563
孙向锦
添加报表
|
1
2
|
package com.fh.controller.sunvote.report;
|
066f7673
孙向锦
修复bug
|
3
4
5
|
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
|
9338b563
孙向锦
添加报表
|
6
7
8
9
10
11
12
13
14
15
16
|
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.fh.controller.api.ResponseGson;
import com.fh.controller.base.BaseController;
|
eca4feb5
孙向锦
管理员功能完善
|
17
|
import com.fh.service.api.V1Manager;
|
9338b563
孙向锦
添加报表
|
18
19
20
|
import com.fh.service.sunvote.sclass.SClassManager;
import com.fh.service.sunvote.student.StudentManager;
import com.fh.service.sunvote.studenttest.StudentTestManager;
|
705eb8ca
孙向锦
报表添加教师名称及科目信息
|
21
22
23
|
import com.fh.service.sunvote.subject.SubjectManager;
import com.fh.service.sunvote.teacher.TeacherManager;
import com.fh.service.sunvote.teacher.impl.TeacherService;
|
9338b563
孙向锦
添加报表
|
24
|
import com.fh.service.sunvote.testpaper.TestPaperManager;
|
066f7673
孙向锦
修复bug
|
25
|
import com.fh.service.sunvote.testpaperinfo.TestPaperInfoManager;
|
9338b563
孙向锦
添加报表
|
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
import com.fh.util.Jurisdiction;
import com.fh.util.PageData;
@Controller
@RequestMapping(value="/report")
public class ReportController extends BaseController {
@Resource(name="sclassService")
private SClassManager sclassService;
@Resource(name="studentService")
private StudentManager studentService;
@Resource(name="testpaperService")
private TestPaperManager testpaperService;
@Resource(name="studenttestService")
private StudentTestManager studenttestService;
|
066f7673
孙向锦
修复bug
|
45
46
47
|
@Resource(name="testpaperinfoService")
private TestPaperInfoManager testpaperinfoService;
|
eca4feb5
孙向锦
管理员功能完善
|
48
49
50
|
@Resource(name = "v1Service")
private V1Manager v1Service;
|
705eb8ca
孙向锦
报表添加教师名称及科目信息
|
51
52
53
54
55
56
|
@Resource(name = "teacherService")
private TeacherManager teacherService;
@Resource(name="subjectService")
private SubjectManager subjectService;
|
9338b563
孙向锦
添加报表
|
57
58
59
60
61
62
63
64
65
|
@RequestMapping(value="/report")
public ModelAndView report() throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"班级报表");
ModelAndView mv = this.getModelAndView();
PageData pd = getPageData();
pd.put("SCLASS_ID", pd.get("CLASSID"));
pd.put("ID", pd.get("CLASSID"));
|
757dfed6
孙向锦
样例报表
|
66
|
pd.put("TEST_TYPE", "1");
|
eca4feb5
孙向锦
管理员功能完善
|
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
String role = pd.getString("ROLE");
if( role != null && "admin".equals(role)){
PageData tpd = new PageData();
tpd.put("ID", getUserID());
List<PageData> adminInfos = v1Service.getAdminInfo(tpd);
List<PageData> subjectInfos = new ArrayList<PageData>();
for(PageData pad : adminInfos){
PageData tmpd = new PageData();
Object gradeId = pad.get("GRADE_ID");
tmpd.put("SNAME", pad.get("SNAME"));// 学校名称
tmpd.put("SCHOOL_ID", pad.get("SCHOOL_ID"));//学校ID
tmpd.put("GRADE_ID", pad.get("GRADE_ID"));//年级id
tmpd.put("GNAME", pad.get("GNAME"));//年级名称
tmpd.put("SUBJECT_ID", pad.get("SUBJECT_ID"));// 科目id
tmpd.put("SCNAME", pad.get("SCNAME"));// 科目名称
if(gradeId != null && !"".equals(gradeId)){
}else{
subjectInfos.add(tmpd);
}
}
mv.addObject("subjectInfos", subjectInfos);
}else{
pd.put("TEACHER_ID", getUserID());
}
|
9338b563
孙向锦
添加报表
|
91
92
93
94
95
96
97
98
|
// 1 查询班级信息
PageData classPageData = sclassService.findById(pd);
PageData info = new PageData();
info.put("CLASS_NAME", classPageData.getString("CLASS_NAME"));
info.put("CLASS_CODE", classPageData.getString("CLASS_CODE"));
info.put("CLASS_ID", classPageData.getString("ID"));
pd.put("CLASS_ID", pd.get("CLASSID"));
List<PageData> studentList = studentService.listAllClass(pd);
|
eca4feb5
孙向锦
管理员功能完善
|
99
100
101
|
|
9338b563
孙向锦
添加报表
|
102
|
// 2查询班级考试
|
ddbc622f
孙向锦
0829版本
|
103
|
pd.put("TEST_TYPE", "1");
|
9338b563
孙向锦
添加报表
|
104
105
106
107
108
109
110
111
112
|
List<PageData> testpaperList = testpaperService.listAll(pd);
mv.addObject("testpaperList", testpaperList);
info.put("testsize", testpaperList != null ? testpaperList.size() : 0);
// 查询学生名单及人数
if(studentList != null && studentList.size() > 0){
for(PageData studentPageData : studentList){
studentPageData.put("STUDENT_ID", studentPageData.getString("ID"));
List<PageData> studentTestList = studenttestService.listAll(studentPageData);
for(PageData studentTestPageData :studentTestList){
|
02f157fa
孙向锦
修复2个bug
|
113
114
115
116
117
118
|
String score = studentTestPageData.getString("SCORE");
if(!"0".equals(score)){
studentPageData.put(studentTestPageData.getString("TEST_ID"), studentTestPageData.getString("SCORE"));
}else{
studentPageData.put(studentTestPageData.getString("TEST_ID"), "--");
}
|
9338b563
孙向锦
添加报表
|
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
}
int totalScore = 0 ;
int getScore = 0 ;
for(PageData testPaperPageData:testpaperList){
String totalScoreStr = testPaperPageData.getString("TOTAL_SCORE");
if(totalScoreStr != null){
try{
totalScore += Integer.parseInt(totalScoreStr);
}catch(Exception ex){
logger.info(ex);
}
}
String getScoreStr = studentPageData.getString(testPaperPageData.getString("TESTPAPER_ID"));
if(getScoreStr != null){
try{
getScore += Integer.parseInt(getScoreStr);
}catch(Exception ex){
logger.info(ex);
}
}
}
studentPageData.put("TOTALSCORE", totalScore);
studentPageData.put("GETSCORE", getScore);
}
}
// 课程平均得分率
// 课程总分
mv.addObject("studentList", studentList);
info.put("STUDENT_NUM", studentList != null ? studentList.size() : 0);
mv.addObject("info", info);
|
ffe4d02a
孙向锦
修改报表时间传递
|
150
151
|
mv.addObject("start_date", pd.get("START_DATE"));
mv.addObject("end_date", pd.get("END_DATE"));
|
eca4feb5
孙向锦
管理员功能完善
|
152
|
mv.addObject("pd", pd);
|
9338b563
孙向锦
添加报表
|
153
154
155
156
157
158
159
160
|
mv.setViewName("sunvote/teacher/teacher_report_1");
return mv;
}
@RequestMapping(value="/teacher_report")
public ModelAndView teacher_report() throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"教师报表");
ModelAndView mv = this.getModelAndView();
|
ffe4d02a
孙向锦
修改报表时间传递
|
161
162
163
|
PageData pd = this.getPageData();
mv.addObject("start_date", pd.get("START_DATE"));
mv.addObject("end_date", pd.get("END_DATE"));
|
9338b563
孙向锦
添加报表
|
164
165
166
167
168
169
170
171
172
|
return mv;
}
@RequestMapping(value="/student_report")
public ModelAndView student_report() throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"学生成绩报表");
ModelAndView mv = this.getModelAndView();
PageData pd = getPageData();
|
b9dc59e6
孙向锦
管理员过滤条件
|
173
174
175
176
177
|
String url = "report/student_report_data?class_id=" +pd.getString("CLASS_ID");
if(pd.getString("SUBJECT_ID") != null){
url += "&SUBJECT_ID=" + pd.getString("SUBJECT_ID");
}
mv.addObject("URL",url);
|
4d39642d
孙向锦
添加学生报表
|
178
|
mv.setViewName("sunvote/teacher/stduent_report");
|
ffe4d02a
孙向锦
修改报表时间传递
|
179
180
|
mv.addObject("start_date", pd.get("START_DATE"));
mv.addObject("end_date", pd.get("END_DATE"));
|
90d4858f
孙向锦
修改管理员界面搜素功能
|
181
|
mv.addObject("pd", pd);
|
9338b563
孙向锦
添加报表
|
182
183
184
185
186
187
188
189
|
return mv;
}
@RequestMapping(value = "/student_report_data", produces = "application/json;charset=UTF-8")
@ResponseBody
public Object student_report_data() throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"学生报表数据");
PageData pd = getPageData();
|
4d39642d
孙向锦
添加学生报表
|
190
|
ResponseGson<PageData> ret = new ResponseGson();
|
03a14c0e
孙向锦
更新报表
|
191
|
// pd.put("CLASS_ID", pd.get("CLASSID"));
|
9338b563
孙向锦
添加报表
|
192
|
List<PageData> studentList = studentService.listAllClass(pd);
|
b9dc59e6
孙向锦
管理员过滤条件
|
193
194
195
|
if ("teacher".equals(getRole())) {
pd.put("TEACHER_ID", getUserID());
}
|
9338b563
孙向锦
添加报表
|
196
|
List<PageData> testpaperList = testpaperService.listAll(pd);
|
4d39642d
孙向锦
添加学生报表
|
197
198
|
pd.put("ID", pd.get("CLASS_ID"));
PageData classPageData = sclassService.findById(pd);
|
066f7673
孙向锦
修复bug
|
199
200
|
float totalScore = 0 ;
float avgScore = 0;
|
9338b563
孙向锦
添加报表
|
201
202
203
204
|
for(PageData testPaperPageData:testpaperList){
String totalScoreStr = testPaperPageData.getString("TOTAL_SCORE");
if(totalScoreStr != null){
try{
|
066f7673
孙向锦
修复bug
|
205
|
totalScore += Float.parseFloat(totalScoreStr);
|
9338b563
孙向锦
添加报表
|
206
207
208
209
|
}catch(Exception ex){
logger.info(ex);
}
}
|
4d39642d
孙向锦
添加学生报表
|
210
211
212
|
String avgScoreStr = testPaperPageData.getString("AVG_SCORE");
if(avgScoreStr != null){
try{
|
066f7673
孙向锦
修复bug
|
213
|
avgScore += Float.parseFloat(avgScoreStr);
|
4d39642d
孙向锦
添加学生报表
|
214
215
216
217
|
}catch(Exception ex){
logger.info(ex);
}
}
|
9338b563
孙向锦
添加报表
|
218
219
|
}
|
066f7673
孙向锦
修复bug
|
220
221
|
float allGetScore = 0;
float maxScore = 0 ;
|
9338b563
孙向锦
添加报表
|
222
223
224
225
226
227
228
229
230
231
232
|
// 查询学生名单及人数
if(studentList != null && studentList.size() > 0){
for(PageData studentPageData : studentList){
PageData search = new PageData();
search.put("STUDENT_ID", studentPageData.getString("ID"));
if(pd.containsKey("START_DATE")){
search.put("START_DATE", pd.getString("START_DATE"));
}
if(pd.containsKey("END_DATE")){
search.put("END_DATE", pd.getString("END_DATE"));
}
|
b9dc59e6
孙向锦
管理员过滤条件
|
233
234
235
236
237
238
|
if("teacher".equals(getRole())){
search.put("TEACHER_ID", getUserID());
}
if(pd.containsKey("SUBJECT_ID")){
search.put("SUBJECT_ID", pd.getString("SUBJECT_ID"));
}
|
9338b563
孙向锦
添加报表
|
239
240
241
|
List<PageData> studentTestList = studenttestService.reportListData(search);
studentPageData.put("testList", studentTestList);
|
066f7673
孙向锦
修复bug
|
242
|
float getScore = 0 ;
|
9338b563
孙向锦
添加报表
|
243
244
245
246
|
for(PageData studentTestPageData:studentTestList){
String getScoreStr = studentTestPageData.getString("SCORE");
if(getScoreStr != null){
try{
|
066f7673
孙向锦
修复bug
|
247
|
getScore += Float.parseFloat(getScoreStr);
|
9338b563
孙向锦
添加报表
|
248
249
250
251
|
}catch(Exception ex){
logger.info(ex);
}
}
|
4d39642d
孙向锦
添加学生报表
|
252
253
254
|
studentTestPageData.getString("TEST_ID");
|
9338b563
孙向锦
添加报表
|
255
|
}
|
4d39642d
孙向锦
添加学生报表
|
256
|
// studentPageData.put("TOTALSCORE", totalScore);
|
9338b563
孙向锦
添加报表
|
257
258
259
260
261
262
263
264
265
|
studentPageData.put("GETSCORE", getScore);
studentPageData.remove("GROUPID");
studentPageData.remove("REMARK");
studentPageData.remove("PARENT_PHONE");
studentPageData.remove("PARENT_NAME");
studentPageData.remove("NUMBER");
studentPageData.remove("SIGN_NO");
studentPageData.remove("KEYPAD_ID");
studentPageData.remove("SNO");
|
4d39642d
孙向锦
添加学生报表
|
266
|
studentPageData.remove("SEX");
|
9338b563
孙向锦
添加报表
|
267
268
|
allGetScore += getScore;
|
4d39642d
孙向锦
添加学生报表
|
269
270
271
|
if(getScore > maxScore){
maxScore = getScore ;
}
|
9338b563
孙向锦
添加报表
|
272
273
274
|
}
}
|
4d39642d
孙向锦
添加学生报表
|
275
276
277
278
279
280
281
282
|
classPageData.remove("SCHOOL_ID");
classPageData.remove("GRADE_ID");
classPageData.remove("BASESTATION_ID");
classPageData.put("studentList", studentList);
classPageData.put("AVG_SCORE", avgScore);
classPageData.put("TOTAL_SCORE", totalScore);
classPageData.put("MAX_SCORE", maxScore);
ret.setData(classPageData);
|
9338b563
孙向锦
添加报表
|
283
284
285
286
287
288
|
return ret.toJson();
}
@RequestMapping(value="/test_report")
public ModelAndView paper_report() throws Exception{
|
9338b563
孙向锦
添加报表
|
289
|
ModelAndView mv = this.getModelAndView();
|
066f7673
孙向锦
修复bug
|
290
291
292
293
294
295
296
297
298
299
|
PageData pd = getPageData();
// 查询班级信息
pd.put("ID", pd.get("CLASS_ID"));
PageData classPageData = sclassService.findById(pd);
// 查询测试试卷信息
pd.put("TESTPAPER_ID", pd.get("TESTID"));
PageData testpaperPd = testpaperService.findById(pd);
|
705eb8ca
孙向锦
报表添加教师名称及科目信息
|
300
301
302
303
304
305
306
307
308
309
|
PageData teacherPd = new PageData();
teacherPd.put("ID", testpaperPd.get("TEACHER_ID"));
teacherPd = teacherService.findById(teacherPd);
PageData subjectPd = new PageData();
subjectPd.put("ID", testpaperPd.get("SUBJECT_ID"));
subjectPd = subjectService.findById(subjectPd);
|
066f7673
孙向锦
修复bug
|
310
311
312
313
314
315
316
317
318
319
|
// 查询班级学生
List<PageData> studentList = studentService.listAllClass(pd);
List<Integer> questionList = new ArrayList<Integer>();
for(PageData studentPd : studentList){
// 查询答题情况
studentPd.put("TEST_ID", pd.getString("TESTID"));
studentPd.put("STUDENT_ID", studentPd.getString("ID"));
List<PageData> detail = testpaperinfoService.reportPaperDetail(studentPd);
studentPd.put("detail", detail);
|
ce1cff6c
孙向锦
报表
|
320
321
322
323
324
|
if(questionList.size() < 1){
for(int i = 0 ; i < detail.size(); i++){
questionList.add(0);
}
}
|
066f7673
孙向锦
修复bug
|
325
326
327
|
float score = 0 ;
for(int i = 0 ; i < detail.size(); i++){
PageData pad = detail.get(i);
|
ce1cff6c
孙向锦
报表
|
328
329
|
if ("1".equals(pad.getString("RIGHT"))) {
questionList.set(i, questionList.get(i) + 1);
|
066f7673
孙向锦
修复bug
|
330
|
}
|
066f7673
孙向锦
修复bug
|
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
|
String scoreStr = pad.getString("SCORE");
try{
score += Float.parseFloat(scoreStr);
}catch(Exception ex){
ex.printStackTrace();
}
}
studentPd.put("GETSCORE", score);
}
Collections.sort(studentList,new Comparator<PageData>(){
@Override
public int compare(PageData o1, PageData o2) {
String o1GetScore = o1.getString("GETSCORE");
String o2GetScore = o2.getString("GETSCORE");
float o1score = 0 ;
float o2score = 0 ;
try{
o1score = Float.parseFloat(o1GetScore);
}catch(Exception e){
o1score = -1 ;
}
try{
o2score = Float.parseFloat(o2GetScore);
}catch(Exception e){
o2score = -1 ;
}
|
d3d7b2ca
孙向锦
修改表格固定
|
362
363
364
365
366
367
368
|
if(o2score - o1score == 0){
String n1 = o1.getString("NUMBER");
String n2 = o2.getString("NUMBER");
if(n1 != null && n2 != null){
return n1.compareToIgnoreCase(n2);
}
}
|
066f7673
孙向锦
修复bug
|
369
370
371
372
|
return o2score - o1score > 0 ? 1 : -1;
}
});
|
f5451f32
孙向锦
分数相同,名词也相同
|
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
|
for(int i = 0 ; i < studentList.size(); i++){
PageData tpd1 = studentList.get(i);
if(i == 0){
tpd1.put("RANK_NUM", (i+1));
}else{
PageData tpd2 = studentList.get(i-1);
String o1GetScore = tpd1.getString("GETSCORE");
String o2GetScore = tpd2.getString("GETSCORE");
float o1score = 0 ;
float o2score = 0 ;
try{
o1score = Float.parseFloat(o1GetScore);
}catch(Exception e){
o1score = -1 ;
}
try{
o2score = Float.parseFloat(o2GetScore);
}catch(Exception e){
o2score = -1 ;
}
if(o2score - o1score == 0){
tpd1.put("RANK_NUM",tpd2.get("RANK_NUM"));
}else{
tpd1.put("RANK_NUM", (i+1));
}
}
}
|
066f7673
孙向锦
修复bug
|
400
401
402
403
404
405
|
classPageData.put("studentNum", studentList.size());
mv.addObject("classInfo", classPageData);
mv.addObject("testpaperInfo", testpaperPd);
mv.addObject("questionInfo", questionList);
mv.addObject("studentInfo", studentList);
|
705eb8ca
孙向锦
报表添加教师名称及科目信息
|
406
407
|
mv.addObject("teacherPd", teacherPd);
mv.addObject("subjectPd", subjectPd);
|
4d39642d
孙向锦
添加学生报表
|
408
409
|
mv.setViewName("sunvote/teacher/teacher_report_test");
|
9338b563
孙向锦
添加报表
|
410
411
412
413
|
return mv;
}
}
|