浏览代码

考情监控

xiatian 4 年之前
父节点
当前提交
d44a92b307

+ 21 - 0
themis-backend/src/main/java/com/qmth/themis/backend/api/TIeReportController.java

@@ -202,4 +202,25 @@ public class TIeReportController {
         }
         return ResultUtil.ok(reportService.examInvigilateReport(examId, userId));
     }
+    
+    @ApiOperation(value = "考情监控-人数")
+    @RequestMapping(value = "/examination_monitor/count", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "结果信息")})
+    public Result examinationMonitorCount() {
+        return ResultUtil.ok(reportService.examinationMonitorCount());
+    }
+    
+    @ApiOperation(value = "考情监控-预警分布")
+    @RequestMapping(value = "/examination_monitor/warn_distribution", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "结果信息")})
+    public Result warnDistribution() {
+        return ResultUtil.ok(reportService.warnDistribution());
+    }
+    
+    @ApiOperation(value = "考情监控-预警时间趋势")
+    @RequestMapping(value = "/examination_monitor/warn_trend", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "结果信息")})
+    public Result warnTrend() {
+        return ResultUtil.ok(reportService.warnTrend());
+    }
 }

+ 71 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/backend/ExaminationMonitorCountBean.java

@@ -0,0 +1,71 @@
+package com.qmth.themis.business.bean.backend;
+
+import java.util.List;
+import java.util.Map;
+
+import io.swagger.annotations.ApiModelProperty;
+
+public class ExaminationMonitorCountBean {
+	@ApiModelProperty(name = "在线人数")
+	private Long onlineCount;
+	@ApiModelProperty(name = "待考人数")
+	private Long waitingCount;
+	@ApiModelProperty(name = "考试中人数")
+	private Long examingCount;
+	@ApiModelProperty(name = "通讯故障人数")
+	private Long exceptionCount;
+	@ApiModelProperty(name = "预警人数")
+	private Long warnCount;
+
+	@ApiModelProperty(name = "机构在线考试人数")
+	private List<Map<String, Object>> orgExamingCount;
+
+	public Long getOnlineCount() {
+		return onlineCount;
+	}
+
+	public void setOnlineCount(Long onlineCount) {
+		this.onlineCount = onlineCount;
+	}
+
+	public Long getWaitingCount() {
+		return waitingCount;
+	}
+
+	public void setWaitingCount(Long waitingCount) {
+		this.waitingCount = waitingCount;
+	}
+
+	public Long getExamingCount() {
+		return examingCount;
+	}
+
+	public void setExamingCount(Long examingCount) {
+		this.examingCount = examingCount;
+	}
+
+	public Long getExceptionCount() {
+		return exceptionCount;
+	}
+
+	public void setExceptionCount(Long exceptionCount) {
+		this.exceptionCount = exceptionCount;
+	}
+
+	public Long getWarnCount() {
+		return warnCount;
+	}
+
+	public void setWarnCount(Long warnCount) {
+		this.warnCount = warnCount;
+	}
+
+	public List<Map<String, Object>> getOrgExamingCount() {
+		return orgExamingCount;
+	}
+
+	public void setOrgExamingCount(List<Map<String, Object>> orgExamingCount) {
+		this.orgExamingCount = orgExamingCount;
+	}
+
+}

+ 25 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/backend/ExaminationMonitorHourWarnCountBean.java

@@ -0,0 +1,25 @@
+package com.qmth.themis.business.bean.backend;
+
+import io.swagger.annotations.ApiModelProperty;
+
+public class ExaminationMonitorHourWarnCountBean {
+
+	@ApiModelProperty(name = "时间")
+	private String hour;
+	@ApiModelProperty(name = "预警次数")
+	private Long count;
+	public String getHour() {
+		return hour;
+	}
+	public void setHour(String hour) {
+		this.hour = hour;
+	}
+	public Long getCount() {
+		return count;
+	}
+	public void setCount(Long count) {
+		this.count = count;
+	}
+
+	
+}

+ 28 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/backend/ExaminationMonitorWarnDistributionBean.java

@@ -0,0 +1,28 @@
+package com.qmth.themis.business.bean.backend;
+
+import java.util.List;
+import java.util.Map;
+
+import io.swagger.annotations.ApiModelProperty;
+
+public class ExaminationMonitorWarnDistributionBean {
+
+	@ApiModelProperty(name = "机构预警分布")
+	private List<Map<String, Object>> orgDistribution;
+	@ApiModelProperty(name = "预警类型分布")
+	private List<Map<String, Object>> typeDistribution;
+	public List<Map<String, Object>> getOrgDistribution() {
+		return orgDistribution;
+	}
+	public void setOrgDistribution(List<Map<String, Object>> orgDistribution) {
+		this.orgDistribution = orgDistribution;
+	}
+	public List<Map<String, Object>> getTypeDistribution() {
+		return typeDistribution;
+	}
+	public void setTypeDistribution(List<Map<String, Object>> typeDistribution) {
+		this.typeDistribution = typeDistribution;
+	}
+
+	
+}

+ 29 - 6
themis-business/src/main/java/com/qmth/themis/business/dao/TOeExamRecordMapper.java

@@ -1,15 +1,24 @@
 package com.qmth.themis.business.dao;
 
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.qmth.themis.business.bean.backend.*;
+import com.qmth.themis.business.bean.backend.ExaminationMonitorHourWarnCountBean;
+import com.qmth.themis.business.bean.backend.InvigilateListBean;
+import com.qmth.themis.business.bean.backend.InvigilateListHistoryBean;
+import com.qmth.themis.business.bean.backend.InvigilateListPatrolBean;
+import com.qmth.themis.business.bean.backend.InvigilateListPatrolReportBean;
+import com.qmth.themis.business.bean.backend.InvigilateListProgressBean;
+import com.qmth.themis.business.bean.backend.InvigilateListVideoBean;
+import com.qmth.themis.business.bean.backend.InvigilateListWarningBean;
 import com.qmth.themis.business.dto.response.TEExamUnFinishDto;
 import com.qmth.themis.business.entity.TOeExamRecord;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-import java.util.Map;
 
 /**
  * @Description: 考试记录 Mapper 接口
@@ -273,4 +282,18 @@ public interface TOeExamRecordMapper extends BaseMapper<TOeExamRecord> {
     public List<InvigilateListPatrolReportBean> examInvigilateReport(@Param("examId") Long examId, @Param("userId") Long userId);
 
 	public TOeExamRecord findOneByExamId(@Param("examId")Long examId);
+
+	public Long getExamingCount();
+	
+	public Long getExceptionCount();
+	
+	public Long getWarnCount();
+	
+	public List<Map<String,Object>> getOrgExamingCount();
+	
+	public List<Map<String,Object>> getOrgDistribution();
+	
+	public List<Map<String,Object>> getTypeDistribution();
+	
+	public List<ExaminationMonitorHourWarnCountBean> getWarnTrend(@Param("startTime")Date startTime);
 }

+ 15 - 3
themis-business/src/main/java/com/qmth/themis/business/service/TIeReportService.java

@@ -1,14 +1,17 @@
 package com.qmth.themis.business.service;
 
+import java.util.List;
+import java.util.Map;
+
 import com.qmth.themis.business.base.BasePage;
 import com.qmth.themis.business.bean.backend.ExamBreachDetailListBean;
 import com.qmth.themis.business.bean.backend.ExamExceptionDetailListBean;
 import com.qmth.themis.business.bean.backend.ExamStudentLogDetailListBean;
+import com.qmth.themis.business.bean.backend.ExaminationMonitorCountBean;
+import com.qmth.themis.business.bean.backend.ExaminationMonitorHourWarnCountBean;
+import com.qmth.themis.business.bean.backend.ExaminationMonitorWarnDistributionBean;
 import com.qmth.themis.business.bean.backend.InvigilateListPatrolReportBean;
 
-import java.util.List;
-import java.util.Map;
-
 public interface TIeReportService {
     public Map<String, Object> examView(Long examId, Long examActivityId, String roomCode, String courseCode,
                                         String name, String identity);
@@ -59,4 +62,13 @@ public interface TIeReportService {
      * @return
      */
     public List<InvigilateListPatrolReportBean> examInvigilateReport(Long examId, Long userId);
+
+	/**考情监控-人数
+	 * @return
+	 */
+	public ExaminationMonitorCountBean examinationMonitorCount();
+
+	public ExaminationMonitorWarnDistributionBean warnDistribution();
+
+	public List<ExaminationMonitorHourWarnCountBean> warnTrend();
 }

+ 476 - 350
themis-business/src/main/java/com/qmth/themis/business/service/impl/TIeReportServiceImpl.java

@@ -1,371 +1,497 @@
 package com.qmth.themis.business.service.impl;
 
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import javax.annotation.Resource;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateUtils;
+import org.springframework.stereotype.Service;
+
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.OrderItem;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.google.common.collect.Lists;
 import com.qmth.themis.business.base.BasePage;
-import com.qmth.themis.business.bean.backend.*;
+import com.qmth.themis.business.bean.backend.ExamBreachDetailListBean;
+import com.qmth.themis.business.bean.backend.ExamBreachListBean;
+import com.qmth.themis.business.bean.backend.ExamDeficiencyListBean;
+import com.qmth.themis.business.bean.backend.ExamExceptionDetailListBean;
+import com.qmth.themis.business.bean.backend.ExamExceptionListBean;
+import com.qmth.themis.business.bean.backend.ExamReexamListBean;
+import com.qmth.themis.business.bean.backend.ExamStudentLogDetailListBean;
+import com.qmth.themis.business.bean.backend.ExamStudentLogListBean;
+import com.qmth.themis.business.bean.backend.ExamViewCountListBean;
+import com.qmth.themis.business.bean.backend.ExaminationMonitorCountBean;
+import com.qmth.themis.business.bean.backend.ExaminationMonitorHourWarnCountBean;
+import com.qmth.themis.business.bean.backend.ExaminationMonitorWarnDistributionBean;
+import com.qmth.themis.business.bean.backend.InvigilateListPatrolReportBean;
 import com.qmth.themis.business.cache.bean.ExamActivityCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
-import com.qmth.themis.business.dao.*;
+import com.qmth.themis.business.constant.SystemConstant;
+import com.qmth.themis.business.dao.TEExamBreachLogMapper;
+import com.qmth.themis.business.dao.TEExamReexamMapper;
+import com.qmth.themis.business.dao.TEExamStudentLogMapper;
+import com.qmth.themis.business.dao.TEExamStudentMapper;
+import com.qmth.themis.business.dao.TIeInvigilateExceptionInfoMapper;
+import com.qmth.themis.business.dao.TOeExamRecordMapper;
 import com.qmth.themis.business.entity.TEExamActivity;
 import com.qmth.themis.business.enums.BreachTypeEnum;
 import com.qmth.themis.business.enums.ExceptionEnum;
+import com.qmth.themis.business.enums.VerifyExceptionEnum;
 import com.qmth.themis.business.service.TEExamActivityService;
 import com.qmth.themis.business.service.TEExamService;
 import com.qmth.themis.business.service.TIeReportService;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.*;
-import java.util.stream.Collectors;
+import com.qmth.themis.business.util.RedisUtil;
 
 @Service
 public class TIeReportServiceImpl implements TIeReportService {
 
-    @Resource
-    TEExamStudentMapper examStudentMapper;
-
-    @Resource
-    TOeExamRecordMapper examRecordMapper;
-
-    @Resource
-    TEExamActivityService examActivityService;
-
-    @Resource
-    TEExamService examService;
-
-    @Resource
-    TIeInvigilateExceptionInfoMapper invigilateExceptionInfoMapper;
-
-    @Resource
-    TEExamReexamMapper examReexamMapper;
-
-    @Resource
-    TEExamBreachLogMapper examBreachLogMapper;
-
-    @Resource
-    TEExamStudentLogMapper examStudentLogMapper;
-
-    @Resource
-    TOeExamRecordMapper tOeExamRecordMapper;
-
-    @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;
-    }
-
-    @Override
-    public BasePage examViewCount(Long examId, Long examActivityId, String roomCode, String courseCode, String name,
-                                  String identity, int pageNumber, int pageSize) {
-        //应考人数
-        IPage<ExamViewCountListBean> total = examStudentMapper.getTotalCountInfo(new Page<>(pageNumber, pageSize), examId, examActivityId, roomCode, courseCode);
-        List<ExamViewCountListBean> data = total.getRecords();
-        BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
-        if (data == null || data.size() == 0) {
-            return basePage;
-        }
-        List<Long> activityIds = data.stream().map(e -> e.getExamActivityId()).collect(Collectors.toList());
-
-        //实考
-        List<Map<String, Object>> doneCountByDay = examStudentMapper.getDoneCountByActivityIds(examId, activityIds);
-        Map<String, Long> doneMap = new HashMap<String, Long>();
-        for (Map<String, Object> map : doneCountByDay) {
-            Long acId = (Long) map.get("activityId");
-            String roomcode = (String) map.get("roomCode");
-            Long count = (Long) map.get("cc");
-            doneMap.put(acId + "-" + roomcode, count);
-        }
-
-        //缺考
-        List<Long> absentActivityIds = new ArrayList<>();
-        Date now = new Date();
-        for (Long acid : activityIds) {
-            ExamActivityCacheBean ac = examActivityService.getExamActivityCacheBean(acid);
-            Long end = ac.getStartTime().getTime() + (ac.getOpeningSeconds() * 1000);
-            if (now.getTime() > end) {//场次开考时间结束,未开考的都是缺考
-                absentActivityIds.add(acid);
-            }
-        }
-
-        Map<String, Long> absentMap = new HashMap<String, Long>();
-        if (absentActivityIds.size() > 0) {
-            List<Map<String, Object>> absentCountByDay = examStudentMapper.getAbsentCountByActivityIds(examId, absentActivityIds);
-            for (Map<String, Object> map : absentCountByDay) {
-                Long acId = (Long) map.get("activityId");
-                String roomcode = (String) map.get("roomCode");
-                Long count = (Long) map.get("cc");
-                absentMap.put(acId + "-" + roomcode, count);
-            }
-        }
-        ExamCacheBean exam = examService.getExamCacheBean(examId);
-        for (ExamViewCountListBean b : data) {
-            Long done = doneMap.get(b.getExamActivityId() + "-" + b.getRoomCode());
-            if (done == null) {
-                done = 0L;
-            }
-            Long absent = absentMap.get(b.getExamActivityId() + "-" + b.getRoomCode());
-            if (absent == null) {
-                absent = 0L;
-            }
-            b.setActualExamTotal(done);
-            b.setDeficiencyExamTotal(absent);
-            b.setExamName(exam.getName());
-        }
-        basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
-        return basePage;
-    }
-
-    @Override
-    public BasePage examDeficiencyList(Long examId, Long examActivityId, String roomCode, String courseCode,
-                                       String name, String identity, int pageNumber, int pageSize) {
-        Page<ExamDeficiencyListBean> ipage = new Page<>(pageNumber, pageSize);
-        ipage.addOrder(OrderItem.asc("t.exam_activity_id"));
-        ipage.addOrder(OrderItem.asc("t.room_code"));
-        QueryWrapper<TEExamActivity> wp = new QueryWrapper<>();
-        wp.lambda().eq(TEExamActivity::getExamId, examId);
-        List<TEExamActivity> acs = examActivityService.list(wp);
-        List<Long> absentActivityIds = new ArrayList<>();
-        Date now = new Date();
-        for (TEExamActivity ac : acs) {
-            Long end = ac.getStartTime().getTime() + (ac.getOpeningSeconds() * 1000L);
-            if (now.getTime() > end) {//场次开考时间结束,未开考的都是缺考
-                absentActivityIds.add(ac.getId());
-            }
-        }
-        if (absentActivityIds.size() == 0) {
-            BasePage basePage = new BasePage(Lists.newArrayList(), 1, pageSize, 0);
-            return basePage;
-        }
-        IPage<ExamDeficiencyListBean> total = examStudentMapper.getExamDeficiencyPage(ipage, examId, examActivityId, roomCode, courseCode, name, identity, absentActivityIds);
-        List<ExamDeficiencyListBean> data = total.getRecords();
-        if (data == null || data.size() == 0) {
-            BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
-            return basePage;
-        }
-        ExamCacheBean exam = examService.getExamCacheBean(examId);
-        for (ExamDeficiencyListBean b : data) {
-            b.setExamName(exam.getName());
-        }
-        BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
-        return basePage;
-    }
-
-    @Override
-    public BasePage examExceptionList(Long examId, Long examActivityId, String roomCode, String courseCode, String name,
-                                      String identity, int pageNumber, int pageSize) {
-        Page<ExamExceptionListBean> ipage = new Page<>(pageNumber, pageSize);
-        ipage.addOrder(OrderItem.asc("f.exam_student_id"));
-        IPage<ExamExceptionListBean> total = invigilateExceptionInfoMapper.getExamExceptionPage(ipage, examId, examActivityId, roomCode, courseCode, name, identity);
-        List<ExamExceptionListBean> data = total.getRecords();
-        if (data == null || data.size() == 0) {
-            BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
-            return basePage;
-        }
-        ExamCacheBean exam = examService.getExamCacheBean(examId);
-        for (ExamExceptionListBean b : data) {
-            b.setExamName(exam.getName());
-        }
-        BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
-        return basePage;
-    }
-
-    @Override
-    public List<ExamExceptionDetailListBean> examExceptionDetailList(Long examStudentId) {
-        List<ExamExceptionDetailListBean> ret = invigilateExceptionInfoMapper.getExamExceptionDetailList(examStudentId);
-        if (ret != null && ret.size() > 0) {
-            for (ExamExceptionDetailListBean b : ret) {
-                b.setReason(ExceptionEnum.valueOf(b.getReason()).getCode());
-            }
-        }
-        return ret;
-    }
-
-    @Override
-    public BasePage examReexamList(Long examId, Long examActivityId, String roomCode, String courseCode, String name,
-                                   String identity, int pageNumber, int pageSize) {
-        Page<ExamReexamListBean> ipage = new Page<>(pageNumber, pageSize);
-        ipage.addOrder(OrderItem.asc("f.exam_student_id"));
-        IPage<ExamReexamListBean> total = examReexamMapper.getExamReexamPage(ipage, examId, examActivityId, roomCode, courseCode, name, identity);
-        List<ExamReexamListBean> data = total.getRecords();
-        if (data == null || data.size() == 0) {
-            BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
-            return basePage;
-        }
-        ExamCacheBean exam = examService.getExamCacheBean(examId);
-        for (ExamReexamListBean b : data) {
-            b.setExamName(exam.getName());
-        }
-        BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
-        return basePage;
-    }
-
-    @Override
-    public BasePage examBreachList(Long examId, Long examActivityId, String roomCode, String courseCode, String name,
-                                   String identity, int pageNumber, int pageSize) {
-        Page<ExamBreachListBean> ipage = new Page<>(pageNumber, pageSize);
-        ipage.addOrder(OrderItem.asc("f.exam_student_id"));
-        IPage<ExamBreachListBean> total = examBreachLogMapper.getExamBreachPage(ipage, examId, examActivityId, roomCode, courseCode, name, identity);
-        List<ExamBreachListBean> data = total.getRecords();
-        if (data == null || data.size() == 0) {
-            BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
-            return basePage;
-        }
-        ExamCacheBean exam = examService.getExamCacheBean(examId);
-        for (ExamBreachListBean b : data) {
-            b.setExamName(exam.getName());
-        }
-        BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
-        return basePage;
-    }
-
-    @Override
-    public List<ExamBreachDetailListBean> examBreachListDetail(Long examStudentId) {
-        List<ExamBreachDetailListBean> ret = examBreachLogMapper.getExamBreachDetailList(examStudentId);
-        if (ret != null && ret.size() > 0) {
-            for (ExamBreachDetailListBean b : ret) {
-                if (StringUtils.isNotBlank(b.getType())) {
-                    b.setType(BreachTypeEnum.valueOf(b.getType()).getCode());
-                }
-            }
-        }
-        return ret;
-    }
-
-    @Override
-    public BasePage examRevokeBreachList(Long examId, Long examActivityId, String roomCode, String courseCode,
-                                         String name, String identity, int pageNumber, int pageSize) {
-        Page<ExamBreachListBean> ipage = new Page<>(pageNumber, pageSize);
-        ipage.addOrder(OrderItem.asc("f.exam_student_id"));
-        IPage<ExamBreachListBean> total = examBreachLogMapper.getExamRevokeBreachPage(ipage, examId, examActivityId, roomCode, courseCode, name, identity);
-        List<ExamBreachListBean> data = total.getRecords();
-        if (data == null || data.size() == 0) {
-            BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
-            return basePage;
-        }
-        ExamCacheBean exam = examService.getExamCacheBean(examId);
-        for (ExamBreachListBean b : data) {
-            b.setExamName(exam.getName());
-        }
-        BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
-        return basePage;
-    }
-
-    @Override
-    public List<ExamBreachDetailListBean> examRevokeBreachListDetail(Long examStudentId) {
-        List<ExamBreachDetailListBean> ret = examBreachLogMapper.getExamBreachDetailList(examStudentId);
-        if (ret != null && ret.size() > 0) {
-            for (ExamBreachDetailListBean b : ret) {
-                if (StringUtils.isNotBlank(b.getType())) {
-                    b.setType(BreachTypeEnum.valueOf(b.getType()).getCode());
-                }
-            }
-        }
-        return ret;
-    }
-
-    @Override
-    public BasePage examStudentLogList(Long examId, Long examActivityId, String roomCode, String courseCode,
-                                       String name, String identity, int pageNumber, int pageSize) {
-        Page<ExamStudentLogListBean> ipage = new Page<>(pageNumber, pageSize);
-        ipage.addOrder(OrderItem.asc("t.id"));
-        IPage<ExamStudentLogListBean> total = examStudentMapper.getPageForStudentLog(ipage, examId, examActivityId, roomCode, courseCode, name, identity);
-        List<ExamStudentLogListBean> data = total.getRecords();
-        if (data == null || data.size() == 0) {
-            BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
-            return basePage;
-        }
-        ExamCacheBean exam = examService.getExamCacheBean(examId);
-        for (ExamStudentLogListBean b : data) {
-            b.setExamName(exam.getName());
-        }
-        BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
-        return basePage;
-    }
-
-    @Override
-    public List<ExamStudentLogDetailListBean> examStudentLogListDetail(Long examStudentId) {
-        return examStudentLogMapper.getExamStudentLogList(examStudentId);
-    }
-
-    /**
-     * 在线巡考报表接口
-     *
-     * @param examId
-     * @param userId
-     * @return
-     */
-    @Override
-    public List<InvigilateListPatrolReportBean> patrolReport(Long examId, Long userId) {
-        return tOeExamRecordMapper.patrolReport(examId, userId);
-    }
-
-    /**
-     * 考情监控报表接口
-     *
-     * @param examId
-     * @param userId
-     * @return
-     */
-    @Override
-    public List<InvigilateListPatrolReportBean> examInvigilateReport(Long examId, Long userId) {
-        return tOeExamRecordMapper.examInvigilateReport(examId, userId);
-    }
+	@Resource
+	TEExamStudentMapper examStudentMapper;
+
+	@Resource
+	TOeExamRecordMapper examRecordMapper;
+
+	@Resource
+	TEExamActivityService examActivityService;
+
+	@Resource
+	TEExamService examService;
+
+	@Resource
+	TIeInvigilateExceptionInfoMapper invigilateExceptionInfoMapper;
+
+	@Resource
+	TEExamReexamMapper examReexamMapper;
+
+	@Resource
+	TEExamBreachLogMapper examBreachLogMapper;
+
+	@Resource
+	TEExamStudentLogMapper examStudentLogMapper;
+
+	@Resource
+	TOeExamRecordMapper tOeExamRecordMapper;
+
+	@Resource
+	private RedisUtil redisUtil;
+
+	@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;
+	}
+
+	@Override
+	public BasePage examViewCount(Long examId, Long examActivityId, String roomCode, String courseCode, String name,
+			String identity, int pageNumber, int pageSize) {
+		// 应考人数
+		IPage<ExamViewCountListBean> total = examStudentMapper.getTotalCountInfo(new Page<>(pageNumber, pageSize),
+				examId, examActivityId, roomCode, courseCode);
+		List<ExamViewCountListBean> data = total.getRecords();
+		BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
+		if (data == null || data.size() == 0) {
+			return basePage;
+		}
+		List<Long> activityIds = data.stream().map(e -> e.getExamActivityId()).collect(Collectors.toList());
+
+		// 实考
+		List<Map<String, Object>> doneCountByDay = examStudentMapper.getDoneCountByActivityIds(examId, activityIds);
+		Map<String, Long> doneMap = new HashMap<String, Long>();
+		for (Map<String, Object> map : doneCountByDay) {
+			Long acId = (Long) map.get("activityId");
+			String roomcode = (String) map.get("roomCode");
+			Long count = (Long) map.get("cc");
+			doneMap.put(acId + "-" + roomcode, count);
+		}
+
+		// 缺考
+		List<Long> absentActivityIds = new ArrayList<>();
+		Date now = new Date();
+		for (Long acid : activityIds) {
+			ExamActivityCacheBean ac = examActivityService.getExamActivityCacheBean(acid);
+			Long end = ac.getStartTime().getTime() + (ac.getOpeningSeconds() * 1000);
+			if (now.getTime() > end) {// 场次开考时间结束,未开考的都是缺考
+				absentActivityIds.add(acid);
+			}
+		}
+
+		Map<String, Long> absentMap = new HashMap<String, Long>();
+		if (absentActivityIds.size() > 0) {
+			List<Map<String, Object>> absentCountByDay = examStudentMapper.getAbsentCountByActivityIds(examId,
+					absentActivityIds);
+			for (Map<String, Object> map : absentCountByDay) {
+				Long acId = (Long) map.get("activityId");
+				String roomcode = (String) map.get("roomCode");
+				Long count = (Long) map.get("cc");
+				absentMap.put(acId + "-" + roomcode, count);
+			}
+		}
+		ExamCacheBean exam = examService.getExamCacheBean(examId);
+		for (ExamViewCountListBean b : data) {
+			Long done = doneMap.get(b.getExamActivityId() + "-" + b.getRoomCode());
+			if (done == null) {
+				done = 0L;
+			}
+			Long absent = absentMap.get(b.getExamActivityId() + "-" + b.getRoomCode());
+			if (absent == null) {
+				absent = 0L;
+			}
+			b.setActualExamTotal(done);
+			b.setDeficiencyExamTotal(absent);
+			b.setExamName(exam.getName());
+		}
+		basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
+		return basePage;
+	}
+
+	@Override
+	public BasePage examDeficiencyList(Long examId, Long examActivityId, String roomCode, String courseCode,
+			String name, String identity, int pageNumber, int pageSize) {
+		Page<ExamDeficiencyListBean> ipage = new Page<>(pageNumber, pageSize);
+		ipage.addOrder(OrderItem.asc("t.exam_activity_id"));
+		ipage.addOrder(OrderItem.asc("t.room_code"));
+		QueryWrapper<TEExamActivity> wp = new QueryWrapper<>();
+		wp.lambda().eq(TEExamActivity::getExamId, examId);
+		List<TEExamActivity> acs = examActivityService.list(wp);
+		List<Long> absentActivityIds = new ArrayList<>();
+		Date now = new Date();
+		for (TEExamActivity ac : acs) {
+			Long end = ac.getStartTime().getTime() + (ac.getOpeningSeconds() * 1000L);
+			if (now.getTime() > end) {// 场次开考时间结束,未开考的都是缺考
+				absentActivityIds.add(ac.getId());
+			}
+		}
+		if (absentActivityIds.size() == 0) {
+			BasePage basePage = new BasePage(Lists.newArrayList(), 1, pageSize, 0);
+			return basePage;
+		}
+		IPage<ExamDeficiencyListBean> total = examStudentMapper.getExamDeficiencyPage(ipage, examId, examActivityId,
+				roomCode, courseCode, name, identity, absentActivityIds);
+		List<ExamDeficiencyListBean> data = total.getRecords();
+		if (data == null || data.size() == 0) {
+			BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
+			return basePage;
+		}
+		ExamCacheBean exam = examService.getExamCacheBean(examId);
+		for (ExamDeficiencyListBean b : data) {
+			b.setExamName(exam.getName());
+		}
+		BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
+		return basePage;
+	}
+
+	@Override
+	public BasePage examExceptionList(Long examId, Long examActivityId, String roomCode, String courseCode, String name,
+			String identity, int pageNumber, int pageSize) {
+		Page<ExamExceptionListBean> ipage = new Page<>(pageNumber, pageSize);
+		ipage.addOrder(OrderItem.asc("f.exam_student_id"));
+		IPage<ExamExceptionListBean> total = invigilateExceptionInfoMapper.getExamExceptionPage(ipage, examId,
+				examActivityId, roomCode, courseCode, name, identity);
+		List<ExamExceptionListBean> data = total.getRecords();
+		if (data == null || data.size() == 0) {
+			BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
+			return basePage;
+		}
+		ExamCacheBean exam = examService.getExamCacheBean(examId);
+		for (ExamExceptionListBean b : data) {
+			b.setExamName(exam.getName());
+		}
+		BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
+		return basePage;
+	}
+
+	@Override
+	public List<ExamExceptionDetailListBean> examExceptionDetailList(Long examStudentId) {
+		List<ExamExceptionDetailListBean> ret = invigilateExceptionInfoMapper.getExamExceptionDetailList(examStudentId);
+		if (ret != null && ret.size() > 0) {
+			for (ExamExceptionDetailListBean b : ret) {
+				b.setReason(ExceptionEnum.valueOf(b.getReason()).getCode());
+			}
+		}
+		return ret;
+	}
+
+	@Override
+	public BasePage examReexamList(Long examId, Long examActivityId, String roomCode, String courseCode, String name,
+			String identity, int pageNumber, int pageSize) {
+		Page<ExamReexamListBean> ipage = new Page<>(pageNumber, pageSize);
+		ipage.addOrder(OrderItem.asc("f.exam_student_id"));
+		IPage<ExamReexamListBean> total = examReexamMapper.getExamReexamPage(ipage, examId, examActivityId, roomCode,
+				courseCode, name, identity);
+		List<ExamReexamListBean> data = total.getRecords();
+		if (data == null || data.size() == 0) {
+			BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
+			return basePage;
+		}
+		ExamCacheBean exam = examService.getExamCacheBean(examId);
+		for (ExamReexamListBean b : data) {
+			b.setExamName(exam.getName());
+		}
+		BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
+		return basePage;
+	}
+
+	@Override
+	public BasePage examBreachList(Long examId, Long examActivityId, String roomCode, String courseCode, String name,
+			String identity, int pageNumber, int pageSize) {
+		Page<ExamBreachListBean> ipage = new Page<>(pageNumber, pageSize);
+		ipage.addOrder(OrderItem.asc("f.exam_student_id"));
+		IPage<ExamBreachListBean> total = examBreachLogMapper.getExamBreachPage(ipage, examId, examActivityId, roomCode,
+				courseCode, name, identity);
+		List<ExamBreachListBean> data = total.getRecords();
+		if (data == null || data.size() == 0) {
+			BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
+			return basePage;
+		}
+		ExamCacheBean exam = examService.getExamCacheBean(examId);
+		for (ExamBreachListBean b : data) {
+			b.setExamName(exam.getName());
+		}
+		BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
+		return basePage;
+	}
+
+	@Override
+	public List<ExamBreachDetailListBean> examBreachListDetail(Long examStudentId) {
+		List<ExamBreachDetailListBean> ret = examBreachLogMapper.getExamBreachDetailList(examStudentId);
+		if (ret != null && ret.size() > 0) {
+			for (ExamBreachDetailListBean b : ret) {
+				if (StringUtils.isNotBlank(b.getType())) {
+					b.setType(BreachTypeEnum.valueOf(b.getType()).getCode());
+				}
+			}
+		}
+		return ret;
+	}
+
+	@Override
+	public BasePage examRevokeBreachList(Long examId, Long examActivityId, String roomCode, String courseCode,
+			String name, String identity, int pageNumber, int pageSize) {
+		Page<ExamBreachListBean> ipage = new Page<>(pageNumber, pageSize);
+		ipage.addOrder(OrderItem.asc("f.exam_student_id"));
+		IPage<ExamBreachListBean> total = examBreachLogMapper.getExamRevokeBreachPage(ipage, examId, examActivityId,
+				roomCode, courseCode, name, identity);
+		List<ExamBreachListBean> data = total.getRecords();
+		if (data == null || data.size() == 0) {
+			BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
+			return basePage;
+		}
+		ExamCacheBean exam = examService.getExamCacheBean(examId);
+		for (ExamBreachListBean b : data) {
+			b.setExamName(exam.getName());
+		}
+		BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
+		return basePage;
+	}
+
+	@Override
+	public List<ExamBreachDetailListBean> examRevokeBreachListDetail(Long examStudentId) {
+		List<ExamBreachDetailListBean> ret = examBreachLogMapper.getExamBreachDetailList(examStudentId);
+		if (ret != null && ret.size() > 0) {
+			for (ExamBreachDetailListBean b : ret) {
+				if (StringUtils.isNotBlank(b.getType())) {
+					b.setType(BreachTypeEnum.valueOf(b.getType()).getCode());
+				}
+			}
+		}
+		return ret;
+	}
+
+	@Override
+	public BasePage examStudentLogList(Long examId, Long examActivityId, String roomCode, String courseCode,
+			String name, String identity, int pageNumber, int pageSize) {
+		Page<ExamStudentLogListBean> ipage = new Page<>(pageNumber, pageSize);
+		ipage.addOrder(OrderItem.asc("t.id"));
+		IPage<ExamStudentLogListBean> total = examStudentMapper.getPageForStudentLog(ipage, examId, examActivityId,
+				roomCode, courseCode, name, identity);
+		List<ExamStudentLogListBean> data = total.getRecords();
+		if (data == null || data.size() == 0) {
+			BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
+			return basePage;
+		}
+		ExamCacheBean exam = examService.getExamCacheBean(examId);
+		for (ExamStudentLogListBean b : data) {
+			b.setExamName(exam.getName());
+		}
+		BasePage basePage = new BasePage(total.getRecords(), total.getCurrent(), total.getSize(), total.getTotal());
+		return basePage;
+	}
+
+	@Override
+	public List<ExamStudentLogDetailListBean> examStudentLogListDetail(Long examStudentId) {
+		return examStudentLogMapper.getExamStudentLogList(examStudentId);
+	}
+
+	/**
+	 * 在线巡考报表接口
+	 *
+	 * @param examId
+	 * @param userId
+	 * @return
+	 */
+	@Override
+	public List<InvigilateListPatrolReportBean> patrolReport(Long examId, Long userId) {
+		return tOeExamRecordMapper.patrolReport(examId, userId);
+	}
+
+	/**
+	 * 考情监控报表接口
+	 *
+	 * @param examId
+	 * @param userId
+	 * @return
+	 */
+	@Override
+	public List<InvigilateListPatrolReportBean> examInvigilateReport(Long examId, Long userId) {
+		return tOeExamRecordMapper.examInvigilateReport(examId, userId);
+	}
+
+	/**
+	 * 考情监控-人数
+	 */
+	@Override
+	public ExaminationMonitorCountBean examinationMonitorCount() {
+		ExaminationMonitorCountBean ret = new ExaminationMonitorCountBean();
+		Integer onlineCount = (Integer) redisUtil.get(SystemConstant.WEBSOCKET_OE_ONLINE_COUNT);
+		if (onlineCount == null) {
+			onlineCount = 0;
+		}
+		// 在线人数
+		ret.setOnlineCount(Long.valueOf(onlineCount.toString()));
+		// 考试人数
+		Long examingCount = tOeExamRecordMapper.getExamingCount();
+		if (examingCount == null) {
+			examingCount = 0L;
+		}
+		ret.setExamingCount(examingCount);
+
+		// 待考人数
+		ret.setWaitingCount(onlineCount - examingCount);
+
+		// 通讯故障人数
+		ret.setExceptionCount(tOeExamRecordMapper.getExceptionCount());
+		// 预警人数
+		ret.setWarnCount(tOeExamRecordMapper.getWarnCount());
+		// 机构在考人数
+		ret.setOrgExamingCount(tOeExamRecordMapper.getOrgExamingCount());
+		return ret;
+	}
+
+	/**
+	 * 考情监控-预警分布
+	 */
+	@Override
+	public ExaminationMonitorWarnDistributionBean warnDistribution() {
+		ExaminationMonitorWarnDistributionBean ret = new ExaminationMonitorWarnDistributionBean();
+		ret.setOrgDistribution(tOeExamRecordMapper.getOrgDistribution());
+		List<Map<String, Object>> typeList = tOeExamRecordMapper.getTypeDistribution();
+		if (typeList != null && typeList.size() > 0) {
+			for (Map<String, Object> map : typeList) {
+				map.put("type", VerifyExceptionEnum.valueOf((String) map.get("type")).getCode());
+			}
+		}
+		ret.setTypeDistribution(typeList);
+		return ret;
+	}
+
+	/**
+	 * 考情监控-预警时间趋势
+	 */
+	@Override
+	public List<ExaminationMonitorHourWarnCountBean> warnTrend() {
+		List<ExaminationMonitorHourWarnCountBean> ret = new ArrayList<ExaminationMonitorHourWarnCountBean>();
+		SimpleDateFormat sd = new SimpleDateFormat("HH");
+		Date start = null;
+		Date now = new Date();
+		for (int i = 11; i >= 0; i--) {
+			ExaminationMonitorHourWarnCountBean b = new ExaminationMonitorHourWarnCountBean();
+			Date before = DateUtils.addHours(now, -i);
+			b.setHour(sd.format(before));
+			b.setCount(0L);
+			ret.add(b);
+			if (i == 11) {
+				start = before;
+			}
+		}
+		start = DateUtils.setMinutes(start, 0);
+		start = DateUtils.setSeconds(start, 0);
+		start = DateUtils.setMilliseconds(start, 0);
+		List<ExaminationMonitorHourWarnCountBean> list = tOeExamRecordMapper.getWarnTrend(start);
+		if (list != null && list.size() > 0) {
+			Map<String, Long> map = list.stream().collect(Collectors.toMap(ExaminationMonitorHourWarnCountBean::getHour,
+					ExaminationMonitorHourWarnCountBean::getCount, (key1, key2) -> key2));
+			for(ExaminationMonitorHourWarnCountBean b:ret) {
+				Long c=map.get(b.getHour());
+				if(c!=null) {
+					b.setCount(c);
+				}
+				b.setHour(b.getHour()+":00");
+			}
+		}
+		return ret;
+	}
 }

+ 97 - 0
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -594,4 +594,101 @@
 		t.roomName
 		order by t.roomCode
 	</select>
+	
+	<select id="getExamingCount" resultType="java.lang.Long">
+		select count(1) from t_oe_exam_record f
+		where f.status != 'FINISHED' and f.status != 'PERSISTED'
+	</select>
+	<select id="getExceptionCount" resultType="java.lang.Long">
+			SELECT
+			count(DISTINCT(f.id))
+		FROM
+			t_oe_exam_record f
+		LEFT JOIN t_ie_invigilate_exception_info t ON f.id = t.exam_record_id
+		WHERE
+			f. STATUS != 'FINISHED'
+		AND f. STATUS != 'PERSISTED'
+		AND t.id IS NOT NULL
+	</select>
+	<select id="getWarnCount" resultType="java.lang.Long">
+		SELECT
+			count(DISTINCT(f.id))
+		FROM
+			t_oe_exam_record f
+		LEFT JOIN t_ie_invigilate_warn_info t ON f.id = t.exam_record_id
+		WHERE
+			f. STATUS != 'FINISHED'
+		AND f. STATUS != 'PERSISTED'
+		AND t.type!='NONE'
+		AND t.id IS NOT NULL
+	</select>
+	<select id="getOrgExamingCount" resultType="java.util.Map">
+		SELECT
+		o. NAME orgName,
+		tem.cc count
+	FROM
+		(
+			SELECT
+				h.org_id orgId,
+				count(DISTINCT(h.id)) cc
+			FROM
+				t_oe_exam_record f
+			LEFT JOIN t_e_exam_student t ON f.exam_student_id = t.id
+			LEFT JOIN t_e_student h ON t.student_id = h.id
+			WHERE
+				f. STATUS != 'FINISHED'
+			AND f. STATUS != 'PERSISTED'
+			GROUP BY
+				h.org_id
+		) tem
+	LEFT JOIN t_b_org o ON o.id = tem.orgId
+	</select>
+	<select id="getOrgDistribution" resultType="java.util.Map">
+		SELECT
+		o. NAME orgName,
+		tem.cc count
+		FROM
+			(
+				SELECT
+					h.org_id orgId,
+					count(DISTINCT(w.id)) cc
+				FROM
+					t_oe_exam_record f
+				LEFT JOIN t_ie_invigilate_warn_info w ON f.id = w.exam_record_id
+				LEFT JOIN t_e_exam_student t ON f.exam_student_id = t.id
+				LEFT JOIN t_e_student h ON t.student_id = h.id
+				WHERE
+					f. STATUS != 'FINISHED'
+				AND f. STATUS != 'PERSISTED'
+				AND w.id IS NOT NULL
+				AND w.type!='NONE'
+				GROUP BY
+					h.org_id
+			) tem
+		LEFT JOIN t_b_org o ON o.id = tem.orgId
+	</select>
+	<select id="getTypeDistribution" resultType="java.util.Map">
+		SELECT
+			w.type type,
+			count(DISTINCT(w.id)) count
+		FROM
+			t_oe_exam_record f
+		LEFT JOIN t_ie_invigilate_warn_info w ON f.id = w.exam_record_id
+		WHERE
+			f. STATUS != 'FINISHED'
+		AND f. STATUS != 'PERSISTED'
+		AND w.id IS NOT NULL
+		AND w.type!='NONE'
+		GROUP BY
+			w.type
+	</select>
+	<select id="getWarnTrend" resultType="com.qmth.themis.business.bean.backend.ExaminationMonitorHourWarnCountBean">
+			SELECT
+			DATE_FORMAT(w.create_time,'%H') hour,
+			count(1) count
+		FROM  t_ie_invigilate_warn_info w 
+		WHERE w.type!='NONE' and w.create_time&gt;=#{startTime}
+		GROUP BY
+			DATE_FORMAT(w.create_time,'%H')
+	</select>
 </mapper>