|
@@ -42,7 +42,7 @@ public class StatisticsController extends BaseParameterController {
|
|
|
|
|
|
@RequestMapping
|
|
|
public String list(Model model, HttpServletRequest request, ExamSubjectSearchQuery query,
|
|
|
- @RequestParam(required = false) Boolean upload) {
|
|
|
+ @RequestParam(required = false) Boolean upload,@RequestParam(required = false) Boolean breach) {
|
|
|
int examId = getSessionExamId(request);
|
|
|
if (examId > 0) {
|
|
|
query.setExamId(examId);
|
|
@@ -50,12 +50,13 @@ public class StatisticsController extends BaseParameterController {
|
|
|
List<StatisticsVO> statisticsVOs = new ArrayList<StatisticsVO>();
|
|
|
for (ExamSubject subject : query.getResult()) {
|
|
|
StatisticsVO vo = new StatisticsVO(subject);
|
|
|
- vo = getStatisticsInfo(vo,upload);
|
|
|
+ vo = getStatisticsInfo(vo,upload,breach);
|
|
|
statisticsVOs.add(vo);
|
|
|
}
|
|
|
model.addAttribute("statisticsVOs", statisticsVOs);
|
|
|
model.addAttribute("query", query);
|
|
|
model.addAttribute("upload", upload);
|
|
|
+ model.addAttribute("breach", breach);
|
|
|
model.addAttribute("subjectList", getExamSubject(examId));
|
|
|
model.addAttribute("levelList", subjectService.listLevel(examId));
|
|
|
model.addAttribute("categoryList", subjectService.listCategory(examId));
|
|
@@ -65,22 +66,54 @@ public class StatisticsController extends BaseParameterController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private StatisticsVO getStatisticsInfo(StatisticsVO vo,Boolean upload) {
|
|
|
+ private StatisticsVO getStatisticsInfo(StatisticsVO vo,Boolean upload,Boolean breach) {
|
|
|
List<Object[]> list = null;
|
|
|
- if(upload!=null){
|
|
|
- vo.setStudentCount(examStudentService.countByExamIdAndSubjectCode(vo.getExamId(), vo.getCode(), upload,false));
|
|
|
- list = examStudentService.statisticsByExamIdAndSubjectCode(vo.getExamId(), vo.getCode(),upload,false);
|
|
|
- }else{
|
|
|
- vo.setStudentCount(examStudentService.countByExamIdAndSubjectCode(vo.getExamId(), vo.getCode()));
|
|
|
- list = examStudentService.statisticsByExamIdAndSubjectCode(vo.getExamId(), vo.getCode());
|
|
|
- }
|
|
|
- vo.setCount0_49((long) (list.get(0)[0]==null?0L:list.get(0)[0]));
|
|
|
+ /**
|
|
|
+ * 没有违纪或者缺考的查询条件
|
|
|
+ * 1.先查询不违纪和不缺考的情况下每个阶段分数个数
|
|
|
+ * 2.然后分别查询违纪和缺考的记录个数之和减去同时是违纪和缺考的记录个数,并其个数归属到0-49分数段中
|
|
|
+ * 查询条件:不缺考(上传 不缺考)
|
|
|
+ * 1.先查询不缺考和不违纪的情况下每个阶段分数个数
|
|
|
+ * 2.然后查询不缺考和违纪的记录个数,并其个数归属到0-49分数段中
|
|
|
+ * 查询条件:不违纪
|
|
|
+ * 1.先查询不违纪和不缺考的情况下每个阶段分数个数
|
|
|
+ * 2.然后查询不违纪和缺考的记录个数,并将其个数归属到0-49分数段中
|
|
|
+ * 查询条件:不违纪和不缺考
|
|
|
+ * 1.直接查出不违纪和不缺考的情况下每个阶段分数个数
|
|
|
+ */
|
|
|
+ list = examStudentService.statisticsByAbsentAndBreach(vo.getExamId(),vo.getCode(),true,false,false);
|
|
|
+ if(upload == null && breach == null){
|
|
|
+ vo.setStudentCount(examStudentService.countByExamIdAndSubjectCode(vo.getExamId(), vo.getCode()));
|
|
|
+ //缺考的个数
|
|
|
+ long absentCount = examStudentService.countByAbsentAndBreach(vo.getExamId(),vo.getCode(),true,null);
|
|
|
+ //违纪的个数
|
|
|
+ long breachCount = examStudentService.countByAbsentAndBreach(vo.getExamId(),vo.getCode(),null,true);
|
|
|
+ //即使违纪也是缺考的个数
|
|
|
+ long absentAndBreachCount = examStudentService.countByAbsentAndBreach(vo.getExamId(),vo.getCode(),true,true);
|
|
|
+ vo.setCount0_49((long) (list.get(0)[0]==null?0L:list.get(0)[0])+absentCount+breachCount-absentAndBreachCount);
|
|
|
+ vo.setCount0_60((long) (list.get(0)[6]==null?0L:list.get(0)[6])+absentCount+breachCount-absentAndBreachCount);
|
|
|
+ }else if(upload != null && breach == null){
|
|
|
+ vo.setStudentCount(examStudentService.countByExamIdAndSubjectCode(vo.getExamId(), vo.getCode(), upload,false));
|
|
|
+ //不缺考和违纪的记录个数
|
|
|
+ long noAbsentAndBreachCount = examStudentService.countByNoAbsentAndBreach(vo.getExamId(),vo.getCode(),upload,false,true);
|
|
|
+ vo.setCount0_49((long) (list.get(0)[0]==null?0L:list.get(0)[0])+noAbsentAndBreachCount);
|
|
|
+ vo.setCount0_60((long) (list.get(0)[6]==null?0L:list.get(0)[6])+noAbsentAndBreachCount);
|
|
|
+ }else if(upload == null && breach != null){
|
|
|
+ vo.setStudentCount(examStudentService.countByAbsentAndBreach(vo.getExamId(),vo.getCode(),null,false));
|
|
|
+ //不违纪和缺考的记录个数
|
|
|
+ long noBreachAndAbsent = examStudentService.countByAbsentAndBreach(vo.getExamId(),vo.getCode(),true,false);
|
|
|
+ vo.setCount0_49((long) (list.get(0)[0]==null?0L:list.get(0)[0])+noBreachAndAbsent);
|
|
|
+ vo.setCount0_60((long) (list.get(0)[6]==null?0L:list.get(0)[6])+noBreachAndAbsent);
|
|
|
+ }else {
|
|
|
+ vo.setStudentCount(examStudentService.countByNoAbsentAndBreach(vo.getExamId(),vo.getCode(),true,false,false));
|
|
|
+ vo.setCount0_49((long) (list.get(0)[0]==null?0L:list.get(0)[0]));
|
|
|
+ vo.setCount0_60((long) (list.get(0)[6]==null?0L:list.get(0)[6]));
|
|
|
+ }
|
|
|
vo.setCount50_59((long) (list.get(0)[1]==null?0L:list.get(0)[1]));
|
|
|
vo.setCount60_69((long) (list.get(0)[2]==null?0L:list.get(0)[2]));
|
|
|
vo.setCount70_79((long) (list.get(0)[3]==null?0L:list.get(0)[3]));
|
|
|
vo.setCount80_89((long) (list.get(0)[4]==null?0L:list.get(0)[4]));
|
|
|
vo.setCount90_100((long) (list.get(0)[5]==null?0L:list.get(0)[5]));
|
|
|
- vo.setCount0_60((long) (list.get(0)[6]==null?0L:list.get(0)[6]));
|
|
|
vo.setCount60_100((long) (list.get(0)[7]==null?0L:list.get(0)[7]));
|
|
|
if(vo.getStudentCount()!=0){
|
|
|
vo.setPercent0_49(new BigDecimal(vo.getCount0_49()*100.0/vo.getStudentCount()).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
@@ -97,7 +130,7 @@ public class StatisticsController extends BaseParameterController {
|
|
|
|
|
|
@RequestMapping(value = "/export", method = RequestMethod.POST)
|
|
|
public String exportFile(ExamSubjectSearchQuery query,
|
|
|
- @RequestParam(required = false) Boolean upload,
|
|
|
+ @RequestParam(required = false) Boolean upload,@RequestParam(required = false) Boolean breach,
|
|
|
HttpServletRequest request, HttpServletResponse response,
|
|
|
RedirectAttributes redirectAttributes) {
|
|
|
int examId = getSessionExamId(request);
|
|
@@ -110,7 +143,7 @@ public class StatisticsController extends BaseParameterController {
|
|
|
List<StatisticsVO> statisticsVOs = new ArrayList<StatisticsVO>();
|
|
|
for (ExamSubject subject : query.getResult()) {
|
|
|
StatisticsVO vo = new StatisticsVO(subject);
|
|
|
- vo = getStatisticsInfo(vo, upload);
|
|
|
+ vo = getStatisticsInfo(vo, upload,breach);
|
|
|
statisticsVOs.add(vo);
|
|
|
}
|
|
|
new ExportExcel("分段统计", StatisticsVO.class)
|