9338b563
孙向锦
添加报表
|
1
2
|
package com.fh.controller.sunvote.report;
|
3f6c3003
孙向锦
更新计算方式
|
3
|
import java.math.BigDecimal;
|
066f7673
孙向锦
修复bug
|
4
5
6
|
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
|
739794be
jack
1.bug修复
|
7
|
import java.util.HashMap;
|
9338b563
孙向锦
添加报表
|
8
|
import java.util.List;
|
739794be
jack
1.bug修复
|
9
|
import java.util.Map;
|
9338b563
孙向锦
添加报表
|
10
11
12
13
14
15
16
17
18
19
|
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
孙向锦
管理员功能完善
|
20
|
import com.fh.service.api.V1Manager;
|
9338b563
孙向锦
添加报表
|
21
22
23
|
import com.fh.service.sunvote.sclass.SClassManager;
import com.fh.service.sunvote.student.StudentManager;
import com.fh.service.sunvote.studenttest.StudentTestManager;
|
705eb8ca
孙向锦
报表添加教师名称及科目信息
|
24
25
|
import com.fh.service.sunvote.subject.SubjectManager;
import com.fh.service.sunvote.teacher.TeacherManager;
|
9338b563
孙向锦
添加报表
|
26
|
import com.fh.service.sunvote.testpaper.TestPaperManager;
|
066f7673
孙向锦
修复bug
|
27
|
import com.fh.service.sunvote.testpaperinfo.TestPaperInfoManager;
|
9338b563
孙向锦
添加报表
|
28
|
import com.fh.util.Jurisdiction;
|
739794be
jack
1.bug修复
|
29
|
import com.fh.util.ObjectExcelView;
|
9338b563
孙向锦
添加报表
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
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
|
48
49
50
|
@Resource(name="testpaperinfoService")
private TestPaperInfoManager testpaperinfoService;
|
eca4feb5
孙向锦
管理员功能完善
|
51
52
53
|
@Resource(name = "v1Service")
private V1Manager v1Service;
|
705eb8ca
孙向锦
报表添加教师名称及科目信息
|
54
55
56
57
58
59
|
@Resource(name = "teacherService")
private TeacherManager teacherService;
@Resource(name="subjectService")
private SubjectManager subjectService;
|
9338b563
孙向锦
添加报表
|
60
61
62
63
64
65
66
67
68
|
@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
孙向锦
样例报表
|
69
|
pd.put("TEST_TYPE", "1");
|
eca4feb5
孙向锦
管理员功能完善
|
70
71
72
73
|
String role = pd.getString("ROLE");
if( role != null && "admin".equals(role)){
PageData tpd = new PageData();
tpd.put("ID", getUserID());
|
a479f295
孙向锦
添加了报表逻辑
|
74
|
PageData adminInfos = v1Service.getAdminInfo(tpd);
|
eca4feb5
孙向锦
管理员功能完善
|
75
|
List<PageData> subjectInfos = new ArrayList<PageData>();
|
eca4feb5
孙向锦
管理员功能完善
|
76
77
78
79
|
mv.addObject("subjectInfos", subjectInfos);
}else{
pd.put("TEACHER_ID", getUserID());
}
|
9338b563
孙向锦
添加报表
|
80
81
82
83
84
85
86
|
// 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"));
|
9338b563
孙向锦
添加报表
|
87
|
// 2查询班级考试
|
ddbc622f
孙向锦
0829版本
|
88
|
pd.put("TEST_TYPE", "1");
|
3a163205
孙向锦
报表优化
|
89
90
91
92
|
// modify 根據班級查詢班級報表
List<PageData> reportData = v1Service.classReport(pd);
List<PageData> testpaperList = new ArrayList();
List<PageData> studentList = new ArrayList();
|
78353cf9
jack
1.增加老师端可以看到年级卷
|
93
|
List<String> studentId = new ArrayList();
|
3a163205
孙向锦
报表优化
|
94
|
PageData studentPd = null;
|
3f6c3003
孙向锦
更新计算方式
|
95
96
|
double totalScore = 0 ;
double getScore = 0 ;
|
3a163205
孙向锦
报表优化
|
97
98
99
100
101
102
|
for(PageData item : reportData){
// 学生列表
if(studentPd != null && item.get("STUDENT_ID").equals(studentPd.get("STUDENT_ID"))){
//
String score = item.getString("SCORE");
|
579f3266
jack
1.studenttest增加增加...
|
103
104
|
String lost = item.getString("LOST_TEST");
if(lost.isEmpty()){
|
3a163205
孙向锦
报表优化
|
105
106
107
108
109
110
111
|
studentPd.put(item.get("TEST_ID"), item.get("SCORE"));
}else{
studentPd.put(item.get("TEST_ID"), "--");
}
String totalScoreStr = item.getString("TOTAL_SCORE");
if(totalScoreStr != null){
try{
|
c33910d6
jack
1.bug修复
|
112
113
114
|
if(lost.isEmpty()){
totalScore = new BigDecimal(totalScoreStr).add(new BigDecimal(Double.toString(totalScore))).doubleValue();
}
|
3a163205
孙向锦
报表优化
|
115
116
117
118
119
120
|
}catch(Exception ex){
logger.info(ex);
}
}
if(score != null){
try{
|
3f6c3003
孙向锦
更新计算方式
|
121
|
getScore = new BigDecimal(score).add(new BigDecimal(Double.toString(getScore))).doubleValue();
|
c33910d6
jack
1.bug修复
|
122
|
//getScore += Float.valueOf(score);
|
3a163205
孙向锦
报表优化
|
123
124
125
126
127
128
129
130
131
|
}catch(Exception ex){
logger.info(ex);
}
}
}else{
if(studentPd != null){
studentPd.put("TOTALSCORE", totalScore);
studentPd.put("GETSCORE", getScore);
studentList.add(studentPd);
|
78353cf9
jack
1.增加老师端可以看到年级卷
|
132
|
studentId.add(studentPd.getString("STUDENT_ID"));
|
3a163205
孙向锦
报表优化
|
133
134
135
136
137
138
139
|
totalScore = 0 ;
getScore = 0 ;
}
studentPd = new PageData();
studentPd.put("STUDENT_ID", item.get("STUDENT_ID"));
studentPd.put("NAME", item.get("NAME"));
String score = item.getString("SCORE");
|
579f3266
jack
1.studenttest增加增加...
|
140
141
|
String lost = item.getString("LOST_TEST");
if(lost.isEmpty()){
|
3a163205
孙向锦
报表优化
|
142
143
144
145
146
147
148
|
studentPd.put(item.get("TEST_ID"), item.get("SCORE"));
}else{
studentPd.put(item.get("TEST_ID"), "--");
}
String totalScoreStr = item.getString("TOTAL_SCORE");
if(totalScoreStr != null){
try{
|
c33910d6
jack
1.bug修复
|
149
150
151
|
if(lost.isEmpty()){
totalScore = new BigDecimal(totalScoreStr).add(new BigDecimal(Double.toString(totalScore))).doubleValue();
}
|
3a163205
孙向锦
报表优化
|
152
153
154
155
156
157
|
}catch(Exception ex){
logger.info(ex);
}
}
if(score != null){
try{
|
3f6c3003
孙向锦
更新计算方式
|
158
|
getScore = new BigDecimal(score).add(new BigDecimal(Double.toString(getScore))).doubleValue();
|
3a163205
孙向锦
报表优化
|
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
}catch(Exception ex){
logger.info(ex);
}
}
}
PageData clone = new PageData(item);
// 试卷列表
if(!contain(testpaperList, clone, "TEST_ID")){
clone.put("TESTPAPER_ID", clone.get("TEST_ID"));
clone.put("NAME", clone.get("PAPER_NAME"));
testpaperList.add(clone);
}
}
if(studentPd != null){
studentPd.put("TOTALSCORE", totalScore);
studentPd.put("GETSCORE", getScore);
studentList.add(studentPd);
|
78353cf9
jack
1.增加老师端可以看到年级卷
|
178
|
studentId.add(studentPd.getString("STUDENT_ID"));
|
3a163205
孙向锦
报表优化
|
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
totalScore = 0 ;
getScore = 0 ;
}
Collections.sort(testpaperList,new Comparator<PageData>(){
@Override
public int compare(PageData o1, PageData o2) {
String o1GetScore = o1.getString("CREATE_DATE");
String o2GetScore = o2.getString("CREATE_DATE");
return - o1GetScore.compareToIgnoreCase(o2GetScore);
}
});
|
9338b563
孙向锦
添加报表
|
194
195
|
mv.addObject("testpaperList", testpaperList);
info.put("testsize", testpaperList != null ? testpaperList.size() : 0);
|
78353cf9
jack
1.增加老师端可以看到年级卷
|
196
197
198
199
200
201
202
203
|
List<PageData> student_class = studentService.findByClassId(pd);
for(int x = 0;x<student_class.size();x++){
if(studentId.contains(student_class.get(x).getString("ID"))){
continue;
}else{
studentList.add(student_class.get(x));
}
}
|
9338b563
孙向锦
添加报表
|
204
205
206
|
mv.addObject("studentList", studentList);
info.put("STUDENT_NUM", studentList != null ? studentList.size() : 0);
mv.addObject("info", info);
|
ffe4d02a
孙向锦
修改报表时间传递
|
207
208
|
mv.addObject("start_date", pd.get("START_DATE"));
mv.addObject("end_date", pd.get("END_DATE"));
|
eca4feb5
孙向锦
管理员功能完善
|
209
|
mv.addObject("pd", pd);
|
fd0087a8
孙向锦
添加英语语言
|
210
211
212
213
214
|
if(isChineseLanguageClient()){
mv.setViewName("sunvote/teacher/teacher_report_1");
}else{
mv.setViewName("sunvote/teacher/en_teacher_report_1");
}
|
1c817fc8
孙向锦
修改一些bug信息
|
215
|
|
9338b563
孙向锦
添加报表
|
216
217
218
|
return mv;
}
|
3a163205
孙向锦
报表优化
|
219
220
221
222
223
224
225
226
227
|
private boolean contain(List<PageData> source, PageData aim,String key){
for(PageData tp : source){
if(tp.get(key) != null && tp.get(key).equals(aim.get(key))){
return true;
}
}
return false;
}
|
9338b563
孙向锦
添加报表
|
228
229
230
231
|
@RequestMapping(value="/teacher_report")
public ModelAndView teacher_report() throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"教师报表");
ModelAndView mv = this.getModelAndView();
|
ffe4d02a
孙向锦
修改报表时间传递
|
232
233
234
|
PageData pd = this.getPageData();
mv.addObject("start_date", pd.get("START_DATE"));
mv.addObject("end_date", pd.get("END_DATE"));
|
9338b563
孙向锦
添加报表
|
235
236
237
238
239
240
241
242
243
|
return mv;
}
@RequestMapping(value="/student_report")
public ModelAndView student_report() throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"学生成绩报表");
ModelAndView mv = this.getModelAndView();
PageData pd = getPageData();
|
b9dc59e6
孙向锦
管理员过滤条件
|
244
245
246
247
248
|
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);
|
fd0087a8
孙向锦
添加英语语言
|
249
250
251
252
253
|
if(isChineseLanguageClient()){
mv.setViewName("sunvote/teacher/stduent_report");
}else{
mv.setViewName("sunvote/teacher/en_stduent_report");
}
|
ffe4d02a
孙向锦
修改报表时间传递
|
254
255
|
mv.addObject("start_date", pd.get("START_DATE"));
mv.addObject("end_date", pd.get("END_DATE"));
|
90d4858f
孙向锦
修改管理员界面搜素功能
|
256
|
mv.addObject("pd", pd);
|
9338b563
孙向锦
添加报表
|
257
258
259
260
261
262
263
264
|
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
孙向锦
添加学生报表
|
265
|
ResponseGson<PageData> ret = new ResponseGson();
|
b9dc59e6
孙向锦
管理员过滤条件
|
266
267
268
|
if ("teacher".equals(getRole())) {
pd.put("TEACHER_ID", getUserID());
}
|
e9f47f90
孙向锦
优化个人成绩报表
|
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
pd.put("TEST_TYPE", "1");
List<PageData> dataList = studenttestService.reportClassListData(pd);
List<PageData> studentList = new ArrayList();
List<PageData> studentTestList = new ArrayList();
PageData studentPd = null;
float getScore = 0f ;
float allGetScore = 0;
float maxScore = 0 ;
for(PageData tmp : dataList){
if(studentPd != null && tmp.get("ID").equals(studentPd.get("ID"))){
String getScoreStr = tmp.getString("SCORE");
float score = 0 ;
if(getScoreStr != null){
try{
score = Float.parseFloat(getScoreStr);
}catch(Exception ex){
logger.info(ex);
}
}
getScore += score;
allGetScore += score;
tmp.put("NAME", tmp.get("TNAME"));
studentTestList.add(tmp);
}else{
if(studentPd != null){
|
f447a06e
jack
1.修复bug
|
294
295
296
|
// if(getScore > maxScore){
// maxScore = getScore ;
// }
|
e9f47f90
孙向锦
优化个人成绩报表
|
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
studentPd.put("GETSCORE", getScore);
studentPd.put("testList", studentTestList);
studentList.add(studentPd);
}
studentPd = new PageData();
studentTestList = new ArrayList();
getScore = 0 ;
String getScoreStr = tmp.getString("SCORE");
float score = 0 ;
if(getScoreStr != null){
try{
score = Float.parseFloat(getScoreStr);
}catch(Exception ex){
logger.info(ex);
}
}
getScore += score;
allGetScore += score;
studentPd.put("NAME", tmp.get("NAME"));
studentPd.put("ID", tmp.get("ID"));
tmp.put("NAME", tmp.get("TNAME"));
studentTestList.add(tmp);
}
|
f447a06e
jack
1.修复bug
|
321
322
323
|
if(getScore > maxScore){
maxScore = getScore ;
}
|
e9f47f90
孙向锦
优化个人成绩报表
|
324
325
326
327
328
329
|
}
if(studentPd != null){
studentPd.put("GETSCORE", getScore);
studentPd.put("testList", studentTestList);
studentList.add(studentPd);
}
|
4d39642d
孙向锦
添加学生报表
|
330
331
|
pd.put("ID", pd.get("CLASS_ID"));
PageData classPageData = sclassService.findById(pd);
|
066f7673
孙向锦
修复bug
|
332
333
|
float totalScore = 0 ;
float avgScore = 0;
|
e9f47f90
孙向锦
优化个人成绩报表
|
334
|
for(PageData testPaperPageData:studentTestList){
|
9338b563
孙向锦
添加报表
|
335
336
337
|
String totalScoreStr = testPaperPageData.getString("TOTAL_SCORE");
if(totalScoreStr != null){
try{
|
066f7673
孙向锦
修复bug
|
338
|
totalScore += Float.parseFloat(totalScoreStr);
|
9338b563
孙向锦
添加报表
|
339
340
341
342
|
}catch(Exception ex){
logger.info(ex);
}
}
|
4d39642d
孙向锦
添加学生报表
|
343
344
345
|
String avgScoreStr = testPaperPageData.getString("AVG_SCORE");
if(avgScoreStr != null){
try{
|
066f7673
孙向锦
修复bug
|
346
|
avgScore += Float.parseFloat(avgScoreStr);
|
4d39642d
孙向锦
添加学生报表
|
347
348
349
350
|
}catch(Exception ex){
logger.info(ex);
}
}
|
9338b563
孙向锦
添加报表
|
351
352
|
}
|
e9f47f90
孙向锦
优化个人成绩报表
|
353
|
|
4d39642d
孙向锦
添加学生报表
|
354
355
356
357
358
359
360
361
|
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
孙向锦
添加报表
|
362
363
364
365
366
367
|
return ret.toJson();
}
@RequestMapping(value="/test_report")
public ModelAndView paper_report() throws Exception{
|
9338b563
孙向锦
添加报表
|
368
|
ModelAndView mv = this.getModelAndView();
|
066f7673
孙向锦
修复bug
|
369
370
371
372
373
374
375
376
377
378
|
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
孙向锦
报表添加教师名称及科目信息
|
379
380
381
382
383
384
385
386
|
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);
|
3a163205
孙向锦
报表优化
|
387
388
|
pd.put("TEST_ID", pd.get("TESTID"));
List<PageData> detail = testpaperinfoService.reportTestPaperDetail(pd);
|
705eb8ca
孙向锦
报表添加教师名称及科目信息
|
389
|
|
3a163205
孙向锦
报表优化
|
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
|
List<PageData> studentList = new ArrayList();
// List<Integer> questionList = new ArrayList<Integer>();
PageData questionList = new PageData();
List<PageData> tqList = new ArrayList<PageData>();
PageData tmp = null;
float getScore = 0 ;
for(PageData tpd : detail){
if(tmp != null && tpd.get("ID").equals(tmp.get("ID"))){
try{
getScore += Float.parseFloat(tpd.getString("SCORE"));
}catch(Exception ex){};
tqList.add(tpd);
if(questionList.get(tpd.get("RANK")) != null){
if("1".equals(tpd.get("RIGHT"))){
Integer num = (Integer)questionList.get(tpd.get("RANK"));
questionList.put(tpd.get("RANK"), num+1);
}
}else{
if("1".equals(tpd.get("RIGHT"))){
questionList.put(tpd.get("RANK"), 1);
}else{
questionList.put(tpd.get("RANK"), 0);
}
}
}else{
if(tmp != null){
tmp.put("GETSCORE", getScore);
studentList.add(tmp);
}
getScore = 0 ;
tmp = new PageData();
tqList = new ArrayList<PageData>();
tmp.put("NAME", tpd.get("NAME"));
tmp.put("KEYPAD_ID", tpd.get("KEYPAD_ID"));
tmp.put("NUMBER", tpd.get("NUMBER"));
tmp.put("ID", tpd.get("ID"));
tqList.add(tpd);
tmp.put("detail", tqList);
try{
getScore += Float.parseFloat(tpd.getString("SCORE"));
}catch(Exception ex){};
if(questionList.get(tpd.get("RANK")) != null){
if("1".equals(tpd.get("RIGHT"))){
Integer num = (Integer)questionList.get(tpd.get("RANK"));
questionList.put(tpd.get("RANK"), num+1);
}
}else{
if("1".equals(tpd.get("RIGHT"))){
questionList.put(tpd.get("RANK"), 1);
}else{
questionList.put(tpd.get("RANK"), 0);
}
}
}
}
if(tmp != null){
tmp.put("GETSCORE", getScore);
studentList.add(tmp);
}
|
705eb8ca
孙向锦
报表添加教师名称及科目信息
|
449
|
|
3a163205
孙向锦
报表优化
|
450
|
/*// 查询班级学生
|
066f7673
孙向锦
修复bug
|
451
452
453
454
455
456
457
458
459
|
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
孙向锦
报表
|
460
461
462
463
464
|
if(questionList.size() < 1){
for(int i = 0 ; i < detail.size(); i++){
questionList.add(0);
}
}
|
066f7673
孙向锦
修复bug
|
465
466
467
|
float score = 0 ;
for(int i = 0 ; i < detail.size(); i++){
PageData pad = detail.get(i);
|
ce1cff6c
孙向锦
报表
|
468
469
|
if ("1".equals(pad.getString("RIGHT"))) {
questionList.set(i, questionList.get(i) + 1);
|
066f7673
孙向锦
修复bug
|
470
|
}
|
066f7673
孙向锦
修复bug
|
471
472
473
474
475
476
477
478
479
480
|
String scoreStr = pad.getString("SCORE");
try{
score += Float.parseFloat(scoreStr);
}catch(Exception ex){
ex.printStackTrace();
}
}
studentPd.put("GETSCORE", score);
|
3a163205
孙向锦
报表优化
|
481
|
}*/
|
066f7673
孙向锦
修复bug
|
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
|
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
孙向锦
修改表格固定
|
502
503
504
505
|
if(o2score - o1score == 0){
String n1 = o1.getString("NUMBER");
String n2 = o2.getString("NUMBER");
if(n1 != null && n2 != null){
|
f4b16acc
孙向锦
修改学号排序问题
|
506
507
508
509
510
511
|
try{
Double d= Double.parseDouble(n1) - Double.parseDouble(n2);
return Integer.valueOf(d.intValue());
}catch(Exception ex){
return 0;
}
|
d3d7b2ca
孙向锦
修改表格固定
|
512
513
|
}
}
|
066f7673
孙向锦
修复bug
|
514
515
516
517
|
return o2score - o1score > 0 ? 1 : -1;
}
});
|
f5451f32
孙向锦
分数相同,名词也相同
|
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
|
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
|
545
546
|
classPageData.put("studentNum", studentList.size());
|
3a163205
孙向锦
报表优化
|
547
548
549
550
551
552
553
|
if("teacher".equals(getRole())){
mv.addObject("display", false);
}else{
mv.addObject("display", true);
}
|
066f7673
孙向锦
修复bug
|
554
555
556
557
|
mv.addObject("classInfo", classPageData);
mv.addObject("testpaperInfo", testpaperPd);
mv.addObject("questionInfo", questionList);
mv.addObject("studentInfo", studentList);
|
705eb8ca
孙向锦
报表添加教师名称及科目信息
|
558
559
|
mv.addObject("teacherPd", teacherPd);
mv.addObject("subjectPd", subjectPd);
|
fd0087a8
孙向锦
添加英语语言
|
560
561
562
563
564
|
if(isChineseLanguageClient()){
mv.setViewName("sunvote/teacher/teacher_report_test");
}else{
mv.setViewName("sunvote/teacher/en_teacher_report_test");
}
|
9338b563
孙向锦
添加报表
|
565
566
567
|
return mv;
}
|
739794be
jack
1.bug修复
|
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
|
@RequestMapping(value="/export2")
public ModelAndView export2() 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"));
pd.put("TEST_TYPE", "1");
String role = pd.getString("ROLE");
if( role != null && "admin".equals(role)){
PageData tpd = new PageData();
tpd.put("ID", getUserID());
PageData adminInfos = v1Service.getAdminInfo(tpd);
List<PageData> subjectInfos = new ArrayList<PageData>();
mv.addObject("subjectInfos", subjectInfos);
}else{
pd.put("TEACHER_ID", getUserID());
}
// 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"));
// 2查询班级考试
pd.put("TEST_TYPE", "1");
// modify 根據班級查詢班級報表
List<PageData> reportData = v1Service.classReport(pd);
List<PageData> testpaperList = new ArrayList();
List<PageData> studentList = new ArrayList();
PageData studentPd = null;
double totalScore = 0 ;
double getScore = 0 ;
for(PageData item : reportData){
// 学生列表
if(studentPd != null && item.get("STUDENT_ID").equals(studentPd.get("STUDENT_ID"))){
//
String score = item.getString("SCORE");
if(!"0".equals(score)){
studentPd.put(item.get("TEST_ID"), item.get("SCORE"));
}else{
studentPd.put(item.get("TEST_ID"), "--");
}
String totalScoreStr = item.getString("TOTAL_SCORE");
if(totalScoreStr != null){
try{
totalScore = new BigDecimal(totalScoreStr).add(new BigDecimal(Double.toString(totalScore))).doubleValue();
}catch(Exception ex){
logger.info(ex);
}
}
if(score != null){
try{
getScore = new BigDecimal(score).add(new BigDecimal(Double.toString(getScore))).doubleValue();
}catch(Exception ex){
logger.info(ex);
}
}
}else{
if(studentPd != null){
studentPd.put("TOTALSCORE", totalScore);
studentPd.put("GETSCORE", getScore);
studentList.add(studentPd);
totalScore = 0 ;
getScore = 0 ;
}
studentPd = new PageData();
studentPd.put("STUDENT_ID", item.get("STUDENT_ID"));
studentPd.put("NAME", item.get("NAME"));
String score = item.getString("SCORE");
if(!"0".equals(score)){
studentPd.put(item.get("TEST_ID"), item.get("SCORE"));
}else{
studentPd.put(item.get("TEST_ID"), "--");
}
String totalScoreStr = item.getString("TOTAL_SCORE");
if(totalScoreStr != null){
try{
totalScore = new BigDecimal(totalScoreStr).add(new BigDecimal(Double.toString(totalScore))).doubleValue();
}catch(Exception ex){
logger.info(ex);
}
}
if(score != null){
try{
getScore = new BigDecimal(score).add(new BigDecimal(Double.toString(getScore))).doubleValue();
}catch(Exception ex){
logger.info(ex);
}
}
}
PageData clone = new PageData(item);
// 试卷列表
if(!contain(testpaperList, clone, "TEST_ID")){
clone.put("TESTPAPER_ID", clone.get("TEST_ID"));
clone.put("NAME", clone.get("PAPER_NAME"));
testpaperList.add(clone);
}
}
if(studentPd != null){
studentPd.put("TOTALSCORE", totalScore);
studentPd.put("GETSCORE", getScore);
studentList.add(studentPd);
totalScore = 0 ;
getScore = 0 ;
}
Collections.sort(testpaperList,new Comparator<PageData>(){
@Override
public int compare(PageData o1, PageData o2) {
String o1GetScore = o1.getString("CREATE_DATE");
String o2GetScore = o2.getString("CREATE_DATE");
return - o1GetScore.compareToIgnoreCase(o2GetScore);
}
});
mv.addObject("testpaperList", testpaperList);
info.put("testsize", testpaperList != null ? testpaperList.size() : 0);
mv.addObject("studentList", studentList);
info.put("STUDENT_NUM", studentList != null ? studentList.size() : 0);
mv.addObject("info", info);
mv.addObject("start_date", pd.get("START_DATE"));
mv.addObject("end_date", pd.get("END_DATE"));
mv.addObject("pd", pd);
Map<String,Object> dataMap = new HashMap<String,Object>();
List<String> titles = new ArrayList<String>();
titles.add("姓名"); //1
titles.add("课程平均得分率"); //2
titles.add("课程总分"); //3
for(PageData item : testpaperList){
titles.add(item.get("NAME").toString().concat(item.get("CREATE_DATE").toString()));
}
dataMap.put("titles", titles);
dataMap.put("class",classPageData.get("CLASS_NAME"));
List<PageData> varList = new ArrayList<PageData>();
for(int x= 0 ;x<studentList.size()+3;x++){
PageData vpd = new PageData();
if(x<3){
if(x==0)
vpd.put("var1", "班级课程总分");
else if(x==1)
vpd.put("var1", "班级课程平均分");
else
vpd.put("var1", "班级课程平均得分率");
vpd.put("var2", "");
vpd.put("var3", "");
}else{
vpd.put("var1", studentList.get(x-3).getString("NAME"));
vpd.put("var2", studentList.get(x-3).getString("TOTALSCORE").toString() == "0" ? "0" : ( Float.parseFloat(studentList.get(x-3).getString("GETSCORE")) / Float.parseFloat(studentList.get(x-3).getString("TOTALSCORE")) * 100));
vpd.put("var3", studentList.get(x-3).getString("GETSCORE"));
}
for(int j=0;j<testpaperList.size();j++){
if(x<3){
if(x==0)
vpd.put("var"+(j+4), testpaperList.get(j).getString("TOTAL_SCORE"));
else if(x==1)
vpd.put("var"+(j+4), testpaperList.get(j).getString("AVG_SCORE"));
else
vpd.put("var"+(j+4), testpaperList.get(j).getString("TOTAL_SCORE")=="0"?"0": Float.parseFloat(testpaperList.get(j).getString("AVG_SCORE")) / Float.parseFloat(testpaperList.get(j).getString("TOTAL_SCORE")) * 100);
}else{
vpd.put("var"+(j+4), studentList.get(x-3).getString(testpaperList.get(j).getString("TESTPAPER_ID")));
}
}
varList.add(vpd);
}
dataMap.put("varList", varList);
ObjectExcelView erv = new ObjectExcelView();
mv = new ModelAndView(erv,dataMap);
// if(isChineseLanguageClient()){
// mv.setViewName("sunvote/teacher/teacher_report_1");
// }else{
// mv.setViewName("sunvote/teacher/en_teacher_report_1");
// }
return mv;
}
|
9338b563
孙向锦
添加报表
|
762
|
}
|