xiatian 4 жил өмнө
parent
commit
7b882c58cd

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

@@ -202,4 +202,11 @@ public class TIeReportController {
     public Result warnTrend() {
         return ResultUtil.ok(reportService.warnTrend());
     }
+    
+    @ApiOperation(value = "考情监控-预警消息")
+    @RequestMapping(value = "/examination_monitor/warn_msg", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "结果信息")})
+    public Result warnMsg() {
+        return ResultUtil.ok(reportService.warnMsg());
+    }
 }

+ 131 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/backend/WarningNotifyBean.java

@@ -0,0 +1,131 @@
+package com.qmth.themis.business.bean.backend;
+
+import com.qmth.themis.business.enums.WarningLevelEnum;
+
+import io.swagger.annotations.ApiModelProperty;
+
+public class WarningNotifyBean  {
+
+    @ApiModelProperty(name = "考试批次id")
+    private Long examId;//考试批次id
+
+    @ApiModelProperty(name = "考生id")
+    private Long examStudentId;//考生id
+
+    @ApiModelProperty(name = "考生姓名")
+    private String name;//考生姓名
+    
+    @ApiModelProperty(name = "考生证件号")
+    private String identity;//考生姓名
+
+    @ApiModelProperty(name = "预警内容")
+    private String info;//预警内容
+
+    @ApiModelProperty(name = "预警等级")
+    private WarningLevelEnum level;//预警等级
+
+    @ApiModelProperty(name = "预警id")
+    private Long warningId;//预警id
+
+    @ApiModelProperty(name = "预警备注")
+    private String remark;//预警备注
+
+    @ApiModelProperty(name = "考试记录id")
+    private Long examRecordId;//考试记录id
+    
+    @ApiModelProperty(name = "roomCode")
+    private String roomCode;//考试记录id
+    
+    @ApiModelProperty(name = "时间")
+    private String createTime;
+
+    public Long getExamRecordId() {
+        return examRecordId;
+    }
+
+    public void setExamRecordId(Long examRecordId) {
+        this.examRecordId = examRecordId;
+    }
+
+    public Long getExamId() {
+        return examId;
+    }
+
+    public void setExamId(Long examId) {
+        this.examId = examId;
+    }
+
+    public Long getExamStudentId() {
+        return examStudentId;
+    }
+
+    public void setExamStudentId(Long examStudentId) {
+        this.examStudentId = examStudentId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getInfo() {
+        return info;
+    }
+
+    public void setInfo(String info) {
+        this.info = info;
+    }
+
+    public WarningLevelEnum getLevel() {
+        return level;
+    }
+
+    public void setLevel(WarningLevelEnum level) {
+        this.level = level;
+    }
+
+    public Long getWarningId() {
+        return warningId;
+    }
+
+    public void setWarningId(Long warningId) {
+        this.warningId = warningId;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+	public String getIdentity() {
+		return identity;
+	}
+
+	public void setIdentity(String identity) {
+		this.identity = identity;
+	}
+
+	public String getRoomCode() {
+		return roomCode;
+	}
+
+	public void setRoomCode(String roomCode) {
+		this.roomCode = roomCode;
+	}
+
+	public String getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(String createTime) {
+		this.createTime = createTime;
+	}
+    
+    
+}

+ 2 - 0
themis-business/src/main/java/com/qmth/themis/business/dao/TBExamInvigilateUserMapper.java

@@ -38,4 +38,6 @@ public interface TBExamInvigilateUserMapper extends BaseMapper<TBExamInvigilateU
      * @return
      */
     public List<RoomCodeExportDto> examInvigilateUserExport();
+
+	public List<Map<String, String>> getInvigilateUsers(@Param("examId") Long examId, @Param("roomCode") String roomCode);
 }

+ 8 - 4
themis-business/src/main/java/com/qmth/themis/business/dao/TIeInvigilateWarnInfoMapper.java

@@ -1,12 +1,14 @@
 package com.qmth.themis.business.dao;
 
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.qmth.themis.business.dto.response.TIeWarningNotifyDto;
-import com.qmth.themis.business.entity.TIeInvigilateWarnInfo;
+import java.util.List;
+
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
-import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qmth.themis.business.bean.backend.WarningNotifyBean;
+import com.qmth.themis.business.dto.response.TIeWarningNotifyDto;
+import com.qmth.themis.business.entity.TIeInvigilateWarnInfo;
 
 /**
  * @Description: 监考预警信息 Mapper 接口
@@ -41,4 +43,6 @@ public interface TIeInvigilateWarnInfoMapper extends BaseMapper<TIeInvigilateWar
      * @return
      */
     public List<TIeWarningNotifyDto> warningMessage(@Param("examId") Long examId, @Param("userId") Long userId, @Param("orgId") Long orgId);
+
+	public List<WarningNotifyBean> findLastMsg(@Param("conut")Integer conut);
 }

+ 2 - 0
themis-business/src/main/java/com/qmth/themis/business/service/TIeReportService.java

@@ -62,4 +62,6 @@ public interface TIeReportService {
 	public ExaminationMonitorWarnDistributionBean warnDistribution();
 
 	public List<ExaminationMonitorHourWarnCountBean> warnTrend();
+
+	public List<String> warnMsg();
 }

+ 39 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TIeReportServiceImpl.java

@@ -33,14 +33,17 @@ 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.bean.backend.WarningNotifyBean;
 import com.qmth.themis.business.cache.bean.ExamActivityCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
 import com.qmth.themis.business.constant.SystemConstant;
+import com.qmth.themis.business.dao.TBExamInvigilateUserMapper;
 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.TIeInvigilateWarnInfoMapper;
 import com.qmth.themis.business.dao.TOeExamRecordMapper;
 import com.qmth.themis.business.entity.TEExamActivity;
 import com.qmth.themis.business.enums.BreachTypeEnum;
@@ -68,6 +71,12 @@ public class TIeReportServiceImpl implements TIeReportService {
 
 	@Resource
 	TIeInvigilateExceptionInfoMapper invigilateExceptionInfoMapper;
+	
+	@Resource
+	TBExamInvigilateUserMapper examInvigilateUserMapper;
+	
+	@Resource
+	TIeInvigilateWarnInfoMapper invigilateWarnInfoMapper;
 
 	@Resource
 	TEExamReexamMapper examReexamMapper;
@@ -482,4 +491,34 @@ public class TIeReportServiceImpl implements TIeReportService {
 		}
 		return ret;
 	}
+
+	@Override
+	public List<String> warnMsg() {
+		List<String> ret=new ArrayList<String>();
+		List<WarningNotifyBean> list=invigilateWarnInfoMapper.findLastMsg(6);
+		if(list!=null&&list.size()>0) {
+			for(WarningNotifyBean b:list) {
+				StringBuilder sb=new StringBuilder("* ");
+				sb.append(b.getCreateTime()).append(" ").append(b.getName()).append(" (证件号:").append(b.getIdentity()).append(") ").append(b.getInfo());
+				List<Map<String,String>> users=examInvigilateUserMapper.getInvigilateUsers(b.getExamId(),b.getRoomCode());
+				if(users!=null&&users.size()>0) {
+					StringBuilder usersb=new StringBuilder();
+					for(Map<String,String> map:users) {
+						if(map!=null) {
+							String lname=map.get("loginName");
+							String name=map.get("name");
+							if(StringUtils.isNotBlank(lname)&&StringUtils.isNotBlank(name)) {
+								usersb.append(lname).append("(账号:").append(name).append(") ");
+							}
+						}
+					}
+					if(usersb.length()>0) {
+						sb.append(",系统已提示").append(usersb).append("进行人工干预");
+					}
+				}
+				ret.add(sb.toString());
+			}
+		}
+		return ret;
+	}
 }

+ 5 - 0
themis-business/src/main/resources/mapper/TBExamInvigilateUserMapper.xml

@@ -63,4 +63,9 @@
         t.roomCode,
         t.roomName
     </select>
+    <select id="getInvigilateUsers" resultType="java.util.Map">
+	    select f.login_name loginName,f.`name` from 
+		t_b_exam_invigilate_user t left join t_b_user f on t.user_id=f.id
+		where t.exam_id=#{examId} and t.room_code=#{roomCode}
+    </select>
 </mapper>

+ 25 - 0
themis-business/src/main/resources/mapper/TIeInvigilateWarnInfoMapper.xml

@@ -56,4 +56,29 @@
             and tiiwi.approve_status = 0
         </where>
     </select>
+    <select id="findLastMsg" resultType="com.qmth.themis.business.bean.backend.WarningNotifyBean">
+    	SELECT
+			f.identity,
+			f.name,
+			f.room_code roomCode,
+			tem.*
+		FROM
+			(
+				SELECT
+					t.exam_student_id AS examStudentId,
+					t.info,
+					t.`level`,
+					t.id AS warningId,
+					t.remark,
+					t.exam_id AS examId,
+					t.exam_record_id AS examRecordId,
+					DATE_FORMAT(t.create_time,"%Y-%m-%d %H:%i") createTime
+				FROM
+					t_ie_invigilate_warn_info t
+				ORDER BY
+					t.id DESC
+				limit #{conut}
+			) tem
+		LEFT JOIN t_e_exam_student f ON tem.examStudentId = f.id
+    </select>
 </mapper>