|
@@ -0,0 +1,90 @@
|
|
|
|
+package com.qmth.themis.business.service.impl;
|
|
|
|
+
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import com.qmth.themis.business.cache.bean.ExamActivityCacheBean;
|
|
|
|
+import com.qmth.themis.business.dao.TEExamStudentMapper;
|
|
|
|
+import com.qmth.themis.business.dao.TOeExamRecordMapper;
|
|
|
|
+import com.qmth.themis.business.service.TEExamActivityService;
|
|
|
|
+import com.qmth.themis.business.service.TIeReportService;
|
|
|
|
+
|
|
|
|
+@Service
|
|
|
|
+public class TIeReportServiceImpl implements TIeReportService {
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ TEExamStudentMapper examStudentMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ TOeExamRecordMapper examRecordMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ TEExamActivityService examActivityService;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, Object> examView(Long examId, Long examActivityId, String roomCode, String courseCode,
|
|
|
|
+ String name, String identity) {
|
|
|
|
+ //应考人数
|
|
|
|
+ Long totalNum=0L;
|
|
|
|
+ List<Map<String,Object>> total=examStudentMapper.getTotalCount(examId, examActivityId, roomCode, courseCode);
|
|
|
|
+ Map<Long,Long> totalMap=new HashMap<Long,Long>();
|
|
|
|
+ for(Map<String,Object> map:total) {
|
|
|
|
+ Long acId=(Long)map.get("activityId");
|
|
|
|
+ Long count=(Long)map.get("cc");
|
|
|
|
+ totalMap.put(acId, count);
|
|
|
|
+ totalNum=totalNum+count;
|
|
|
|
+ }
|
|
|
|
+ //实考人数
|
|
|
|
+ Long doneNum=0L;
|
|
|
|
+ List<Map<String,Object>> doneCount=examRecordMapper.getDoneCount(examId, examActivityId, roomCode, courseCode);
|
|
|
|
+ Map<Long,Long> doneMap=new HashMap<Long,Long>();
|
|
|
|
+ for(Map<String,Object> map:doneCount) {
|
|
|
|
+ Long acId=(Long)map.get("activityId");
|
|
|
|
+ if(acId!=null) {
|
|
|
|
+ Long count=(Long)map.get("cc");
|
|
|
|
+ doneMap.put(acId, count);
|
|
|
|
+ doneNum=doneNum+count;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ //缺考人数
|
|
|
|
+ Map<Long,Long> absentMap=new HashMap<Long,Long>();
|
|
|
|
+ Date now = new Date();
|
|
|
|
+ for(Long acId:totalMap.keySet()) {
|
|
|
|
+ ExamActivityCacheBean ac=examActivityService.getExamActivityCacheBean(acId);
|
|
|
|
+ Long end = ac.getStartTime().getTime() + (ac.getOpeningSeconds() * 1000);
|
|
|
|
+ if (now.getTime() > end) {//场次开考时间结束,未开考的都是缺考
|
|
|
|
+ Long done=doneMap.get(acId);
|
|
|
|
+ if(done==null) {
|
|
|
|
+ done=0L;
|
|
|
|
+ }
|
|
|
|
+ absentMap.put(acId, totalMap.get(acId)-done);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Long absentNum=0L;
|
|
|
|
+ if(absentMap.size()>0) {
|
|
|
|
+ for(Long c:absentMap.values()) {
|
|
|
|
+ absentNum=absentNum+c;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //每日已考人数
|
|
|
|
+ List<Map<String,Object>> doneCountByDay=examRecordMapper.getDoneCountByDay(examId, examActivityId, roomCode, courseCode);
|
|
|
|
+
|
|
|
|
+ Map<String, Object> ret=new HashMap<String, Object>();
|
|
|
|
+ ret.put("examTotal", totalNum);
|
|
|
|
+ ret.put("actualExamTotal", doneNum);
|
|
|
|
+ ret.put("deficiencyExamTotal", absentNum);
|
|
|
|
+ ret.put("completeOffExamTotal", totalNum-doneNum-absentNum);
|
|
|
|
+ ret.put("examTotalList", doneCountByDay);
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|