wangliang před 4 roky
rodič
revize
cae1311d8c
15 změnil soubory, kde provedl 734 přidání a 132 odebrání
  1. 260 4
      themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamReexamController.java
  2. 10 65
      themis-backend/src/main/java/com/qmth/themis/backend/api/TIeInvigilateController.java
  3. 91 2
      themis-backend/src/main/java/com/qmth/themis/backend/api/TIeInvigilateWarnInfoController.java
  4. 138 0
      themis-business/src/main/java/com/qmth/themis/business/bean/backend/ReexamListRequestBean.java
  5. 2 0
      themis-business/src/main/java/com/qmth/themis/business/constant/SystemConstant.java
  6. 11 0
      themis-business/src/main/java/com/qmth/themis/business/dao/TBUserRoleMapper.java
  7. 25 0
      themis-business/src/main/java/com/qmth/themis/business/dao/TEExamReexamMapper.java
  8. 32 61
      themis-business/src/main/java/com/qmth/themis/business/entity/TEExamReexam.java
  9. 27 0
      themis-business/src/main/java/com/qmth/themis/business/enums/ReexamReasonEnum.java
  10. 11 0
      themis-business/src/main/java/com/qmth/themis/business/service/TBUserRoleService.java
  11. 24 0
      themis-business/src/main/java/com/qmth/themis/business/service/TEExamReexamService.java
  12. 18 0
      themis-business/src/main/java/com/qmth/themis/business/service/impl/TBUserRoleServiceImpl.java
  13. 25 0
      themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamReexamServiceImpl.java
  14. 16 0
      themis-business/src/main/resources/mapper/TBUserRoleMapper.xml
  15. 44 0
      themis-business/src/main/resources/mapper/TEExamReexamMapper.xml

+ 260 - 4
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamReexamController.java

@@ -1,8 +1,38 @@
 package com.qmth.themis.backend.api;
 
-import io.swagger.annotations.Api;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.themis.business.annotation.ApiJsonObject;
+import com.qmth.themis.business.annotation.ApiJsonProperty;
+import com.qmth.themis.business.base.BasePage;
+import com.qmth.themis.business.bean.backend.ReexamListRequestBean;
+import com.qmth.themis.business.cache.RedisKeyHelper;
+import com.qmth.themis.business.cache.bean.ExamCacheBean;
+import com.qmth.themis.business.constant.SystemConstant;
+import com.qmth.themis.business.dto.AuthDto;
+import com.qmth.themis.business.entity.TBUser;
+import com.qmth.themis.business.entity.TEExamReexam;
+import com.qmth.themis.business.entity.TOeExamRecord;
+import com.qmth.themis.business.enums.ReexamReasonEnum;
+import com.qmth.themis.business.enums.RoleEnum;
+import com.qmth.themis.business.service.TBUserRoleService;
+import com.qmth.themis.business.service.TEExamReexamService;
+import com.qmth.themis.business.service.TEExamService;
+import com.qmth.themis.business.service.TOeExamRecordService;
+import com.qmth.themis.business.util.JacksonUtil;
+import com.qmth.themis.business.util.RedisUtil;
+import com.qmth.themis.business.util.ServletUtil;
+import com.qmth.themis.common.enums.ExceptionResultEnum;
+import com.qmth.themis.common.exception.BusinessException;
+import com.qmth.themis.common.util.Result;
+import com.qmth.themis.common.util.ResultUtil;
+import io.swagger.annotations.*;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.*;
 
 /**
  * @Description: 考生重考处理 前端控制器
@@ -13,7 +43,233 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @Api(tags = "考生重考处理Controller")
 @RestController
-@RequestMapping("/${prefix.url.admin}/examReexam")
+@RequestMapping("/${prefix.url.admin}/invigilate/reexam")
 public class TEExamReexamController {
 
+    @Resource
+    TEExamReexamService teExamReexamService;
+
+    @Resource
+    RedisUtil redisUtil;
+
+    @Resource
+    TOeExamRecordService tOeExamRecordService;
+
+    @Resource
+    TEExamService teExamService;
+
+    @Resource
+    TBUserRoleService tbUserRoleService;
+
+    @ApiOperation(value = "重考申请接口")
+    @RequestMapping(value = "/apply", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
+    @Transactional
+    public Result apply(@ApiJsonObject(name = "reexamApply", value = {
+            @ApiJsonProperty(key = "examRecordId", type = "long", example = "1", description = "考试记录id", required = true),
+            @ApiJsonProperty(key = "model", type = "int", example = "1", description = "重考方式", required = true),
+            @ApiJsonProperty(key = "reason", description = "重考原因", required = true),
+            @ApiJsonProperty(key = "remark", description = "备注")
+    }) @ApiParam(value = "重考信息", required = true) @RequestBody Map<String, Object> mapParameter) {
+        if (Objects.isNull(mapParameter.get("examRecordId")) || Objects.equals(mapParameter.get("examRecordId"), "")) {
+            throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
+        }
+        List<Long> recordIdList = (List<Long>) mapParameter.get("examRecordId");
+        if (Objects.isNull(mapParameter.get("model")) || Objects.equals(mapParameter.get("model"), "")) {
+            throw new BusinessException("重考方式不能为空");
+        }
+        Integer model = Integer.parseInt(String.valueOf(mapParameter.get("model")));
+        if (Objects.isNull(mapParameter.get("reason")) || Objects.equals(mapParameter.get("reason"), "")) {
+            throw new BusinessException("重考原因不能为空");
+        }
+        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
+        ReexamReasonEnum reason = ReexamReasonEnum.valueOf(String.valueOf(mapParameter.get("reason")));
+        List<TEExamReexam> teExamReexamList = new ArrayList<>();
+        Long examId = null, examStudentId = null, examActivityId = null;
+        Integer reexamAuditing = null, status;
+        for (Long s : recordIdList) {
+            //获取考试记录缓存
+            Map<String, Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examRecordCacheKey(s));
+            if (Objects.isNull(objectMap) || objectMap.size() == 0) {
+                TOeExamRecord tOeExamRecord = tOeExamRecordService.getById(s);
+                if (Objects.isNull(tOeExamRecord)) {
+                    throw new BusinessException("考试记录[" + s + "]不存在");
+                }
+                examId = tOeExamRecord.getExamId();
+                examStudentId = tOeExamRecord.getExamStudentId();
+                examActivityId = tOeExamRecord.getExamActivityId();
+            } else {
+                examId = Long.parseLong(String.valueOf(objectMap.get("examId")));
+                examStudentId = Long.parseLong(String.valueOf(objectMap.get("examStudentId")));
+                examActivityId = Long.parseLong(String.valueOf(objectMap.get("examActivityId")));
+            }
+            ExamCacheBean examCacheBean = teExamService.getExamCacheBean(examId);//考试缓存
+            if (Objects.isNull(examCacheBean)) {
+                throw new BusinessException("考试批次[" + examCacheBean + "]不存在");
+            }
+            reexamAuditing = examCacheBean.getReexamAuditing();
+            status = Objects.isNull(reexamAuditing) || reexamAuditing.intValue() == 0 ? 0 : 1;
+            TEExamReexam teExamReexam = new TEExamReexam(examId, examActivityId, s, examStudentId, model, reason, status, Objects.isNull(mapParameter.get("remark")) ? null : String.valueOf(mapParameter.get("remark")));
+            teExamReexam.setCreateId(tbUser.getId());
+            if (Objects.nonNull(status) && status.intValue() == 1) {
+                //这里查询该机构下所有为管理员角色的账号
+                List<TBUser> tbUserList = tbUserRoleService.userQueryByRole(tbUser.getOrgId(), RoleEnum.ADMIN.name());
+                JSONObject jsonObject = null;
+                if (Objects.nonNull(tbUserList) && tbUserList.size() > 0) {
+                    jsonObject = new JSONObject();
+                    for (int i = 0; i < tbUserList.size(); i++) {
+                        TBUser t = tbUserList.get(i);
+                        jsonObject.put(String.valueOf(t.getId()), t.getId());
+                    }
+                }
+                if (Objects.nonNull(jsonObject)) {
+                    teExamReexam.setAuditingId(JacksonUtil.parseJson(jsonObject));
+                }
+            }
+            teExamReexamList.add(teExamReexam);
+        }
+        teExamReexamService.saveBatch(teExamReexamList);
+        return ResultUtil.ok(SystemConstant.SUCCESS);
+    }
+
+    @ApiOperation(value = "重考审核接口")
+    @RequestMapping(value = "/auditing", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
+    @Transactional
+    public Result auditing(@ApiJsonObject(name = "reexamAuditing", value = {
+            @ApiJsonProperty(key = "reexamId", type = "long", example = "1", description = "重考id", required = true),
+            @ApiJsonProperty(key = "auditingSuggest", description = "审批意见"),
+            @ApiJsonProperty(key = "auditingStatus", type = "long", example = "1", description = "审批状态", required = true)
+    }) @ApiParam(value = "重考信息", required = true) @RequestBody Map<String, Object> mapParameter) {
+        if (Objects.isNull(mapParameter.get("reexamId")) || Objects.equals(mapParameter.get("reexamId"), "")) {
+            throw new BusinessException("重考id不能为空");
+        }
+        Long reexamId = null;
+        try {
+            reexamId = Long.parseLong(String.valueOf(mapParameter.get("reexamId")));
+            if (Objects.isNull(mapParameter.get("auditingStatus")) || Objects.equals(mapParameter.get("auditingStatus"), "")) {
+                throw new BusinessException("审批状态不能为空");
+            }
+            Integer auditingStatus = Integer.parseInt(String.valueOf(mapParameter.get("auditingStatus")));
+            TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
+            if (redisUtil.lock(SystemConstant.REDIS_LOCK_REEXAM_AUDITING + reexamId, SystemConstant.REDIS_LOCK_REEXAM_TIME_OUT)) {
+                TEExamReexam teExamReexam = teExamReexamService.getById(reexamId);
+                if (Objects.isNull(teExamReexam.getUpdateId())) {
+                    teExamReexam.setAuditingStatus(auditingStatus);
+                    teExamReexam.setAuditingTime(new Date());
+                    teExamReexam.setAuditingSuggest(Objects.isNull(mapParameter.get("auditingSuggest")) ? null : String.valueOf(mapParameter.get("auditingSuggest")));
+                    teExamReexam.setUpdateId(tbUser.getId());
+                    teExamReexamService.updateById(teExamReexam);
+                } else {
+                    throw new BusinessException("重考id[" + reexamId + "]已经审核");
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            if (e instanceof BusinessException) {
+                throw new BusinessException(e.getMessage());
+            } else {
+                throw new RuntimeException(e);
+            }
+        } finally {
+            if (Objects.nonNull(reexamId)) {
+                redisUtil.releaseLock(SystemConstant.REDIS_LOCK_REEXAM_AUDITING + reexamId);
+            }
+        }
+        return ResultUtil.ok(SystemConstant.SUCCESS);
+    }
+
+    @ApiOperation(value = "重考审核明细接口")
+    @RequestMapping(value = "/detail", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = TEExamReexam.class)})
+    public Result detail(@ApiParam(value = "重考id") @RequestParam Long reexamId) {
+        if (Objects.isNull(reexamId) || Objects.equals(reexamId, "")) {
+            throw new BusinessException("重考id不能为空");
+        }
+        return ResultUtil.ok(teExamReexamService.getById(reexamId));
+    }
+
+    @ApiOperation(value = "重考申请列表接口")
+    @RequestMapping(value = "/list", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = ReexamListRequestBean.class)})
+    public Result list(@ApiParam(value = "考试批次id") @RequestParam Long examId,
+                       @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long examActivityId,
+                       @ApiParam(value = "虚拟考场代码", required = false) @RequestParam(required = false) String roomCode,
+                       @ApiParam(value = "科目代码", required = false) @RequestParam(required = false) String courseCode,
+                       @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
+                       @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
+                       @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber,
+                       @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
+        if (Objects.isNull(examId) || Objects.equals(examId, "")) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
+        }
+        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
+        AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.userOauth + "::" + tbUser.getId());
+        //如果有监考员角色,只能查看自己所监考的考场,巡考员和管理员则可以查看全部考场
+        Long userId = null;
+        if (authDto.getRoleCodes().toString().contains(RoleEnum.INVIGILATE.name())) {
+            userId = tbUser.getId();
+        }
+        IPage<ReexamListRequestBean> reexamListRequestBeanIPage = teExamReexamService.reexamPageRequestList(new Page<>(pageNumber, pageSize), examId, examActivityId, roomCode, courseCode, name, identity, userId);
+        BasePage basePage = new BasePage(reexamListRequestBeanIPage.getRecords(), reexamListRequestBeanIPage.getCurrent(), reexamListRequestBeanIPage.getSize(), reexamListRequestBeanIPage.getTotal());
+        Map map = new HashMap<>();
+        map.put(SystemConstant.RECORDS, basePage);
+        return ResultUtil.ok(map);
+    }
+
+    @ApiOperation(value = "重考待审列表接口")
+    @RequestMapping(value = "/list_not_done", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = ReexamListRequestBean.class)})
+    public Result listNotDone(@ApiParam(value = "考试批次id") @RequestParam Long examId,
+                       @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long examActivityId,
+                       @ApiParam(value = "虚拟考场代码", required = false) @RequestParam(required = false) String roomCode,
+                       @ApiParam(value = "科目代码", required = false) @RequestParam(required = false) String courseCode,
+                       @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
+                       @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
+                       @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber,
+                       @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
+        if (Objects.isNull(examId) || Objects.equals(examId, "")) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
+        }
+        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
+        AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.userOauth + "::" + tbUser.getId());
+        //如果有监考员角色,只能查看自己所监考的考场,巡考员和管理员则可以查看全部考场
+        Long userId = null;
+        if (authDto.getRoleCodes().toString().contains(RoleEnum.INVIGILATE.name())) {
+            userId = tbUser.getId();
+        }
+        IPage<ReexamListRequestBean> reexamListRequestBeanIPage = teExamReexamService.reexamPageRequestList(new Page<>(pageNumber, pageSize), examId, examActivityId, roomCode, courseCode, name, identity, userId);
+        BasePage basePage = new BasePage(reexamListRequestBeanIPage.getRecords(), reexamListRequestBeanIPage.getCurrent(), reexamListRequestBeanIPage.getSize(), reexamListRequestBeanIPage.getTotal());
+        Map map = new HashMap<>();
+        map.put(SystemConstant.RECORDS, basePage);
+        return ResultUtil.ok(map);
+    }
+
+    @ApiOperation(value = "重考已审列表接口")
+    @RequestMapping(value = "/list_done", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = ReexamListRequestBean.class)})
+    public Result listDone(@ApiParam(value = "考试批次id") @RequestParam Long examId,
+                              @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long examActivityId,
+                              @ApiParam(value = "虚拟考场代码", required = false) @RequestParam(required = false) String roomCode,
+                              @ApiParam(value = "科目代码", required = false) @RequestParam(required = false) String courseCode,
+                              @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
+                              @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
+                              @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber,
+                              @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
+        if (Objects.isNull(examId) || Objects.equals(examId, "")) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
+        }
+        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
+        AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.userOauth + "::" + tbUser.getId());
+        //如果有监考员角色,只能查看自己所监考的考场,巡考员和管理员则可以查看全部考场
+        Long userId = null;
+        if (authDto.getRoleCodes().toString().contains(RoleEnum.INVIGILATE.name())) {
+            userId = tbUser.getId();
+        }
+        IPage<ReexamListRequestBean> reexamListRequestBeanIPage = teExamReexamService.reexamPageRequestList(new Page<>(pageNumber, pageSize), examId, examActivityId, roomCode, courseCode, name, identity, userId);
+        BasePage basePage = new BasePage(reexamListRequestBeanIPage.getRecords(), reexamListRequestBeanIPage.getCurrent(), reexamListRequestBeanIPage.getSize(), reexamListRequestBeanIPage.getTotal());
+        Map map = new HashMap<>();
+        map.put(SystemConstant.RECORDS, basePage);
+        return ResultUtil.ok(map);
+    }
 }

+ 10 - 65
themis-backend/src/main/java/com/qmth/themis/backend/api/TIeInvigilateController.java

@@ -1,5 +1,6 @@
 package com.qmth.themis.backend.api;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -10,6 +11,7 @@ import com.qmth.themis.business.annotation.ApiJsonProperty;
 import com.qmth.themis.business.base.BasePage;
 import com.qmth.themis.business.bean.backend.*;
 import com.qmth.themis.business.cache.RedisKeyHelper;
+import com.qmth.themis.business.cache.bean.ExamCacheBean;
 import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.AuthDto;
@@ -27,6 +29,7 @@ import com.qmth.themis.common.util.ResultUtil;
 import io.swagger.annotations.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
@@ -273,64 +276,6 @@ public class TIeInvigilateController {
         return ResultUtil.ok(map);
     }
 
-    @ApiOperation(value = "预警提醒接口")
-    @RequestMapping(value = "/warn/notify", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "{\"count\":1}", response = Result.class)})
-    public Result warnNotify(@ApiParam(value = "考试批次id") @RequestParam Long examId,
-                             @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long examActivityId,
-                             @ApiParam(value = "虚拟考场代码", required = false) @RequestParam(required = false) String roomCode) {
-        if (Objects.isNull(examId) || Objects.equals(examId, "")) {
-            throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
-        }
-        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
-        AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.userOauth + "::" + tbUser.getId());
-        //如果有监考员角色,只能查看自己所监考的考场,巡考员和管理员则可以查看全部考场
-        Long userId = null;
-        if (authDto.getRoleCodes().toString().contains(RoleEnum.INVIGILATE.name())) {
-            userId = tbUser.getId();
-        }
-        Integer count = tIeInvigilateWarnInfoService.warningCount(examId, examActivityId, roomCode, userId);
-        Map map = new HashMap<>();
-        map.put(SystemConstant.COUNT, count);
-        return ResultUtil.ok(map);
-    }
-
-    @ApiOperation(value = "预警提醒列表接口")
-    @RequestMapping(value = "/warn/list", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "监考预警信息", response = InvigilateListWarningBean.class)})
-    public Result warnList(@ApiParam(value = "考试批次id") @RequestParam Long examId,
-                           @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long examActivityId,
-                           @ApiParam(value = "虚拟考场代码", required = false) @RequestParam(required = false) String roomCode,
-                           @ApiParam(value = "审阅状态", required = false) @RequestParam(required = false) Integer approveStatus,
-                           @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
-                           @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
-                           @ApiParam(value = "陌生人脸min", required = false) @RequestParam(required = false) Integer minMultipleFaceCount,
-                           @ApiParam(value = "陌生人脸max", required = false) @RequestParam(required = false) Integer maxMultipleFaceCount,
-                           @ApiParam(value = "异常处理min", required = false) @RequestParam(required = false) Integer minExceptionCount,
-                           @ApiParam(value = "异常处理max", required = false) @RequestParam(required = false) Integer maxExceptionCount,
-                           @ApiParam(value = "预警量min", required = false) @RequestParam(required = false) Integer minWarningCount,
-                           @ApiParam(value = "预警量max", required = false) @RequestParam(required = false) Integer maxWarningCount,
-                           @ApiParam(value = "客户端网络通信状态", required = false) @RequestParam(required = false) String clientWebsocketStatus,
-                           @ApiParam(value = "监控设备通信状态", required = false) @RequestParam(required = false) String monitorStatusSource,
-                           @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber,
-                           @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
-        if (Objects.isNull(examId) || Objects.equals(examId, "")) {
-            throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
-        }
-        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
-        AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.userOauth + "::" + tbUser.getId());
-        //如果有监考员角色,只能查看自己所监考的考场,巡考员和管理员则可以查看全部考场
-        Long userId = null;
-        if (authDto.getRoleCodes().toString().contains(RoleEnum.INVIGILATE.name())) {
-            userId = tbUser.getId();
-        }
-        IPage<InvigilateListWarningBean> invigilateListWarningBeanIPage = tOeExamRecordService.invigilatePageWarningList(new Page<>(pageNumber, pageSize), examId, examActivityId, roomCode, approveStatus, name, identity, minMultipleFaceCount, maxMultipleFaceCount, minExceptionCount, maxExceptionCount, minWarningCount, maxWarningCount, clientWebsocketStatus, monitorStatusSource, userId);
-        BasePage basePage = new BasePage(invigilateListWarningBeanIPage.getRecords(), invigilateListWarningBeanIPage.getCurrent(), invigilateListWarningBeanIPage.getSize(), invigilateListWarningBeanIPage.getTotal());
-        Map map = new HashMap<>();
-        map.put(SystemConstant.RECORDS, basePage);
-        return ResultUtil.ok(map);
-    }
-
     @ApiOperation(value = "进度查询列表接口")
     @RequestMapping(value = "/progress/list", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "监考进度信息", response = InvigilateListProgressBean.class)})
@@ -363,10 +308,10 @@ public class TIeInvigilateController {
     @RequestMapping(value = "/breach", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     public Result breach(@ApiJsonObject(name = "invigilateBreach", value = {
-            @ApiJsonProperty(key = "examRecordId", type = "long", example = "1", description = "考试记录id"),
-            @ApiJsonProperty(key = "type", description = "违规类型"),
-            @ApiJsonProperty(key = "description", description = "描述"),
-            @ApiJsonProperty(key = "status", type = "int", example = "1", description = "新建/撤销")
+            @ApiJsonProperty(key = "examRecordId", type = "long", example = "1", description = "考试记录id", required = true),
+            @ApiJsonProperty(key = "type", description = "违规类型", required = true),
+            @ApiJsonProperty(key = "description", description = "描述", required = true),
+            @ApiJsonProperty(key = "status", type = "int", example = "1", description = "新建/撤销", required = true)
     }) @ApiParam(value = "考试记录信息", required = true) @RequestBody Map<String, Object> mapParameter) {
         if (Objects.isNull(mapParameter.get("examRecordId")) || Objects.equals(mapParameter.get("examRecordId"), "")) {
             throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
@@ -428,9 +373,9 @@ public class TIeInvigilateController {
     @RequestMapping(value = "/notice", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     public Result notice(@ApiJsonObject(name = "invigilateNotice", value = {
-            @ApiJsonProperty(key = "examRecordId", type = "long", example = "1", description = "考试记录id"),
-            @ApiJsonProperty(key = "type", description = "消息类型,text/audio"),
-            @ApiJsonProperty(key = "content", description = "消息内容")
+            @ApiJsonProperty(key = "examRecordId", type = "long", example = "1", description = "考试记录id", required = true),
+            @ApiJsonProperty(key = "type", description = "消息类型,text/audio", required = true),
+            @ApiJsonProperty(key = "content", description = "消息内容", required = true)
     }) @ApiParam(value = "考试记录信息", required = true) @RequestBody Map<String, Object> mapParameter) {
         if (Objects.isNull(mapParameter.get("examRecordId")) || Objects.equals(mapParameter.get("examRecordId"), "")) {
             throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);

+ 91 - 2
themis-backend/src/main/java/com/qmth/themis/backend/api/TIeInvigilateWarnInfoController.java

@@ -1,9 +1,32 @@
 package com.qmth.themis.backend.api;
 
-import io.swagger.annotations.Api;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.themis.business.base.BasePage;
+import com.qmth.themis.business.bean.backend.InvigilateListWarningBean;
+import com.qmth.themis.business.constant.SystemConstant;
+import com.qmth.themis.business.dto.AuthDto;
+import com.qmth.themis.business.entity.TBUser;
+import com.qmth.themis.business.enums.RoleEnum;
+import com.qmth.themis.business.service.TIeInvigilateWarnInfoService;
+import com.qmth.themis.business.service.TOeExamRecordService;
+import com.qmth.themis.business.util.RedisUtil;
+import com.qmth.themis.business.util.ServletUtil;
+import com.qmth.themis.common.enums.ExceptionResultEnum;
+import com.qmth.themis.common.exception.BusinessException;
+import com.qmth.themis.common.util.Result;
+import com.qmth.themis.common.util.ResultUtil;
+import io.swagger.annotations.*;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
 /**
  * @Description: 监考预警信息 前端控制器
  * @Param:
@@ -13,7 +36,73 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @Api(tags = "监考预警信息Controller")
 @RestController
-@RequestMapping("/${prefix.url.admin}/invigilateWarnInfo")
+@RequestMapping("/${prefix.url.admin}/invigilate/warn")
 public class TIeInvigilateWarnInfoController {
 
+    @Resource
+    RedisUtil redisUtil;
+
+    @Resource
+    TIeInvigilateWarnInfoService tIeInvigilateWarnInfoService;
+
+    @Resource
+    TOeExamRecordService tOeExamRecordService;
+
+    @ApiOperation(value = "预警提醒接口")
+    @RequestMapping(value = "/notify", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "{\"count\":1}", response = Result.class)})
+    public Result notify(@ApiParam(value = "考试批次id") @RequestParam Long examId,
+                             @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long examActivityId,
+                             @ApiParam(value = "虚拟考场代码", required = false) @RequestParam(required = false) String roomCode) {
+        if (Objects.isNull(examId) || Objects.equals(examId, "")) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
+        }
+        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
+        AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.userOauth + "::" + tbUser.getId());
+        //如果有监考员角色,只能查看自己所监考的考场,巡考员和管理员则可以查看全部考场
+        Long userId = null;
+        if (authDto.getRoleCodes().toString().contains(RoleEnum.INVIGILATE.name())) {
+            userId = tbUser.getId();
+        }
+        Integer count = tIeInvigilateWarnInfoService.warningCount(examId, examActivityId, roomCode, userId);
+        Map map = new HashMap<>();
+        map.put(SystemConstant.COUNT, count);
+        return ResultUtil.ok(map);
+    }
+
+    @ApiOperation(value = "预警提醒列表接口")
+    @RequestMapping(value = "/list", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "监考预警信息", response = InvigilateListWarningBean.class)})
+    public Result list(@ApiParam(value = "考试批次id") @RequestParam Long examId,
+                           @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long examActivityId,
+                           @ApiParam(value = "虚拟考场代码", required = false) @RequestParam(required = false) String roomCode,
+                           @ApiParam(value = "审阅状态", required = false) @RequestParam(required = false) Integer approveStatus,
+                           @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
+                           @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
+                           @ApiParam(value = "陌生人脸min", required = false) @RequestParam(required = false) Integer minMultipleFaceCount,
+                           @ApiParam(value = "陌生人脸max", required = false) @RequestParam(required = false) Integer maxMultipleFaceCount,
+                           @ApiParam(value = "异常处理min", required = false) @RequestParam(required = false) Integer minExceptionCount,
+                           @ApiParam(value = "异常处理max", required = false) @RequestParam(required = false) Integer maxExceptionCount,
+                           @ApiParam(value = "预警量min", required = false) @RequestParam(required = false) Integer minWarningCount,
+                           @ApiParam(value = "预警量max", required = false) @RequestParam(required = false) Integer maxWarningCount,
+                           @ApiParam(value = "客户端网络通信状态", required = false) @RequestParam(required = false) String clientWebsocketStatus,
+                           @ApiParam(value = "监控设备通信状态", required = false) @RequestParam(required = false) String monitorStatusSource,
+                           @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber,
+                           @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
+        if (Objects.isNull(examId) || Objects.equals(examId, "")) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
+        }
+        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
+        AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.userOauth + "::" + tbUser.getId());
+        //如果有监考员角色,只能查看自己所监考的考场,巡考员和管理员则可以查看全部考场
+        Long userId = null;
+        if (authDto.getRoleCodes().toString().contains(RoleEnum.INVIGILATE.name())) {
+            userId = tbUser.getId();
+        }
+        IPage<InvigilateListWarningBean> invigilateListWarningBeanIPage = tOeExamRecordService.invigilatePageWarningList(new Page<>(pageNumber, pageSize), examId, examActivityId, roomCode, approveStatus, name, identity, minMultipleFaceCount, maxMultipleFaceCount, minExceptionCount, maxExceptionCount, minWarningCount, maxWarningCount, clientWebsocketStatus, monitorStatusSource, userId);
+        BasePage basePage = new BasePage(invigilateListWarningBeanIPage.getRecords(), invigilateListWarningBeanIPage.getCurrent(), invigilateListWarningBeanIPage.getSize(), invigilateListWarningBeanIPage.getTotal());
+        Map map = new HashMap<>();
+        map.put(SystemConstant.RECORDS, basePage);
+        return ResultUtil.ok(map);
+    }
 }

+ 138 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/backend/ReexamListRequestBean.java

@@ -0,0 +1,138 @@
+package com.qmth.themis.business.bean.backend;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 重考申请列表返回对象
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/8/22
+ */
+@ApiModel("重考申请列表返回对象")
+public class ReexamListRequestBean implements Serializable {
+
+    @ApiModelProperty(name = "重考id")
+    private Long reexamId;
+
+    @ApiModelProperty(name = "考试id")
+    private Long examId;
+
+    @ApiModelProperty(name = "场次id")
+    private Long examActivityId;
+
+    @ApiModelProperty(name = "考生id")
+    private Long examStudentId;
+
+    @ApiModelProperty(name = "考试记录id")
+    private Long examRecordId;
+
+    @ApiModelProperty(name = "证件号")
+    private String identity;
+
+    @ApiModelProperty(name = "虚拟考场代码")
+    private String roomCode;
+
+    @ApiModelProperty(name = "虚拟考场名称")
+    private String roomName;
+
+    @ApiModelProperty(name = "姓名")
+    private String name;
+
+    @ApiModelProperty(name = "科目名称")
+    private String courseName;
+
+    @ApiModelProperty(name = "科目编码")
+    private String courseCode;
+
+    public Long getReexamId() {
+        return reexamId;
+    }
+
+    public void setReexamId(Long reexamId) {
+        this.reexamId = reexamId;
+    }
+
+    public String getRoomName() {
+        return roomName;
+    }
+
+    public void setRoomName(String roomName) {
+        this.roomName = roomName;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public String getCourseCode() {
+        return courseCode;
+    }
+
+    public void setCourseCode(String courseCode) {
+        this.courseCode = courseCode;
+    }
+
+    public Long getExamId() {
+        return examId;
+    }
+
+    public void setExamId(Long examId) {
+        this.examId = examId;
+    }
+
+    public Long getExamActivityId() {
+        return examActivityId;
+    }
+
+    public void setExamActivityId(Long examActivityId) {
+        this.examActivityId = examActivityId;
+    }
+
+    public Long getExamStudentId() {
+        return examStudentId;
+    }
+
+    public void setExamStudentId(Long examStudentId) {
+        this.examStudentId = examStudentId;
+    }
+
+    public Long getExamRecordId() {
+        return examRecordId;
+    }
+
+    public void setExamRecordId(Long examRecordId) {
+        this.examRecordId = examRecordId;
+    }
+
+    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 getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

+ 2 - 0
themis-business/src/main/java/com/qmth/themis/business/constant/SystemConstant.java

@@ -96,8 +96,10 @@ public class SystemConstant {
      */
     public static final String REDIS_LOCK_MQ_PREFIX = "lock:mq:";
     public static final String REDIS_LOCK_WEBSOCKET_PREFIX = "lock:websocket:";
+    public static final String REDIS_LOCK_REEXAM_AUDITING = "lock:reexam:";
     public static final long REDIS_LOCK_MQ_TIME_OUT = 1L;
     public static final long REDIS_LOCK_WEBSOCKET_TIME_OUT = 1L;
+    public static final long REDIS_LOCK_REEXAM_TIME_OUT = 1L;
     public static final long REDIS_CACHE_TIME_OUT = 30L;
     //学生锁
     public static final String REDIS_LOCK_STUDENT_PREFIX = "lock:student:student_id_";

+ 11 - 0
themis-business/src/main/java/com/qmth/themis/business/dao/TBUserRoleMapper.java

@@ -1,8 +1,12 @@
 package com.qmth.themis.business.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qmth.themis.business.entity.TBUser;
 import com.qmth.themis.business.entity.TBUserRole;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * @Description: 用户角色 Mapper 接口
@@ -14,4 +18,11 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface TBUserRoleMapper extends BaseMapper<TBUserRole> {
 
+    /**
+     * 根据机构id+角色查询用户
+     *
+     * @param orgId
+     * @return
+     */
+    public List<TBUser> userQueryByRole(@Param("orgId") Long orgId, @Param("roleCode") String roleCode);
 }

+ 25 - 0
themis-business/src/main/java/com/qmth/themis/business/dao/TEExamReexamMapper.java

@@ -1,8 +1,13 @@
 package com.qmth.themis.business.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.themis.business.bean.backend.ReexamListRequestBean;
 import com.qmth.themis.business.entity.TEExamReexam;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Map;
 
 /**
  * @Description: 考生重考处理 Mapper 接口
@@ -14,4 +19,24 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface TEExamReexamMapper extends BaseMapper<TEExamReexam> {
 
+    /**
+     * 重考申请列表
+     *
+     * @param iPage
+     * @param examId
+     * @param examActivityId
+     * @param roomCode
+     * @param courseCode
+     * @param name
+     * @param identity
+     * @param userId
+     * @return
+     */
+    public IPage<ReexamListRequestBean> reexamPageRequestList(IPage<Map> iPage, @Param("examId") Long examId,
+                                                              @Param("examActivityId") Long examActivityId,
+                                                              @Param("roomCode") String roomCode,
+                                                              @Param("courseCode") String courseCode,
+                                                              @Param("name") String name,
+                                                              @Param("identity") String identity,
+                                                              @Param("userId") Long userId);
 }

+ 32 - 61
themis-business/src/main/java/com/qmth/themis/business/entity/TEExamReexam.java

@@ -3,6 +3,9 @@ package com.qmth.themis.business.entity;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.qmth.themis.business.base.BaseEntity;
+import com.qmth.themis.business.enums.ReexamReasonEnum;
+import com.qmth.themis.common.contanst.Constants;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -17,14 +20,10 @@ import java.util.Date;
  * @Date: 2020/6/25
  */
 @ApiModel(value = "t_e_exam_reexam", description = "考生重考处理")
-public class TEExamReexam implements Serializable {
+public class TEExamReexam extends BaseEntity {
 
     private static final long serialVersionUID = 1L;
 
-    @ApiModelProperty(value = "主键")
-    @TableId(value = "id")
-    private Long id;
-
     @ApiModelProperty(value = "考试ID")
     @TableField(value = "exam_id")
     private Long examId;
@@ -42,12 +41,12 @@ public class TEExamReexam implements Serializable {
     private Long examStudentId;
 
     @ApiModelProperty(value = "重考方式,0:批次内,1:换批次")
-    @TableField(value = "apply_model")
-    private Integer applyModel;
+    @TableField(value = "model")
+    private Integer model;
 
     @ApiModelProperty(value = "重考原因")
-    @TableField(value = "apply_reason")
-    private Integer applyReason;
+    @TableField(value = "reason")
+    private ReexamReasonEnum reason;
 
     @ApiModelProperty(value = "状态,0:无需审核,1:待审核,2:已审核")
     @TableField(value = "status")
@@ -55,7 +54,7 @@ public class TEExamReexam implements Serializable {
 
     @ApiModelProperty(value = "待审核人id")
     @TableField(value = "auditing_id")
-    private Long auditingId;
+    private String auditingId;
 
     @ApiModelProperty(value = "审核状态,0:通过,1:不通过")
     @TableField(value = "auditing_status")
@@ -73,28 +72,24 @@ public class TEExamReexam implements Serializable {
     @TableField(value = "remark")
     private String remark;
 
-    @ApiModelProperty(value = "创建时间")
-    @TableField(value = "create_time", fill = FieldFill.INSERT)
-    private Date createTime;
-
-    @ApiModelProperty(value = "创建人id")
-    @TableField(value = "create_id")
-    private Long createId;
+    public TEExamReexam() {
 
-    @ApiModelProperty(value = "更新时间")
-    @TableField(value = "update_time", fill = FieldFill.UPDATE)
-    private Date updateTime;
-
-    public static long getSerialVersionUID() {
-        return serialVersionUID;
     }
 
-    public Long getId() {
-        return id;
+    public TEExamReexam(Long examId, Long examActivityId, Long examRecordId, Long examStudentId, Integer model, ReexamReasonEnum reason, Integer status, String remark) {
+        setId(Constants.idGen.next());
+        this.examId = examId;
+        this.examActivityId = examActivityId;
+        this.examRecordId = examRecordId;
+        this.examStudentId = examStudentId;
+        this.model = model;
+        this.reason = reason;
+        this.status = status;
+        this.remark = remark;
     }
 
-    public void setId(Long id) {
-        this.id = id;
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
     }
 
     public Long getExamId() {
@@ -129,20 +124,20 @@ public class TEExamReexam implements Serializable {
         this.examStudentId = examStudentId;
     }
 
-    public Integer getApplyModel() {
-        return applyModel;
+    public Integer getModel() {
+        return model;
     }
 
-    public void setApplyModel(Integer applyModel) {
-        this.applyModel = applyModel;
+    public void setModel(Integer model) {
+        this.model = model;
     }
 
-    public Integer getApplyReason() {
-        return applyReason;
+    public ReexamReasonEnum getReason() {
+        return reason;
     }
 
-    public void setApplyReason(Integer applyReason) {
-        this.applyReason = applyReason;
+    public void setReason(ReexamReasonEnum reason) {
+        this.reason = reason;
     }
 
     public Integer getStatus() {
@@ -153,11 +148,11 @@ public class TEExamReexam implements Serializable {
         this.status = status;
     }
 
-    public Long getAuditingId() {
+    public String getAuditingId() {
         return auditingId;
     }
 
-    public void setAuditingId(Long auditingId) {
+    public void setAuditingId(String auditingId) {
         this.auditingId = auditingId;
     }
 
@@ -192,28 +187,4 @@ public class TEExamReexam implements Serializable {
     public void setRemark(String remark) {
         this.remark = remark;
     }
-
-    public Date getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(Date createTime) {
-        this.createTime = createTime;
-    }
-
-    public Long getCreateId() {
-        return createId;
-    }
-
-    public void setCreateId(Long createId) {
-        this.createId = createId;
-    }
-
-    public Date getUpdateTime() {
-        return updateTime;
-    }
-
-    public void setUpdateTime(Date updateTime) {
-        this.updateTime = updateTime;
-    }
 }

+ 27 - 0
themis-business/src/main/java/com/qmth/themis/business/enums/ReexamReasonEnum.java

@@ -0,0 +1,27 @@
+package com.qmth.themis.business.enums;
+
+/** 
+* @Description: 重考原因 enum
+* @Param:  
+* @return:  
+* @Author: wangliang
+* @Date: 2020/8/26 
+*/ 
+public enum ReexamReasonEnum {
+
+    EXCEPTION_TIME_OUT("异常处理时效过期"),
+
+    BREAK_TIME_OUT("断点续考次数用完"),
+
+    INVIGILATE_MISS("监考人员误操作");
+
+    private String code;
+
+    private ReexamReasonEnum(String code){
+        this.code = code;
+    }
+
+    public String getCode() {
+        return code;
+    }
+}

+ 11 - 0
themis-business/src/main/java/com/qmth/themis/business/service/TBUserRoleService.java

@@ -1,8 +1,11 @@
 package com.qmth.themis.business.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.themis.business.entity.TBUser;
 import com.qmth.themis.business.entity.TBUserRole;
 
+import java.util.List;
+
 /**
  * @Description: 用户角色 服务类
  * @Param:
@@ -12,4 +15,12 @@ import com.qmth.themis.business.entity.TBUserRole;
  */
 public interface TBUserRoleService extends IService<TBUserRole> {
 
+    /**
+     * 根据机构id+角色查询用户
+     *
+     * @param orgId
+     * @param roleCode
+     * @return
+     */
+    public List<TBUser> userQueryByRole(Long orgId, String roleCode);
 }

+ 24 - 0
themis-business/src/main/java/com/qmth/themis/business/service/TEExamReexamService.java

@@ -1,8 +1,12 @@
 package com.qmth.themis.business.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.themis.business.bean.backend.ReexamListRequestBean;
 import com.qmth.themis.business.entity.TEExamReexam;
 
+import java.util.Map;
+
 /**
  * @Description: 考生重考处理 服务类
  * @Param:
@@ -12,4 +16,24 @@ import com.qmth.themis.business.entity.TEExamReexam;
  */
 public interface TEExamReexamService extends IService<TEExamReexam> {
 
+    /**
+     * 重考申请列表
+     *
+     * @param iPage
+     * @param examId
+     * @param examActivityId
+     * @param roomCode
+     * @param courseCode
+     * @param name
+     * @param identity
+     * @param userId
+     * @return
+     */
+    public IPage<ReexamListRequestBean> reexamPageRequestList(IPage<Map> iPage, Long examId,
+                                                              Long examActivityId,
+                                                              String roomCode,
+                                                              String courseCode,
+                                                              String name,
+                                                              String identity,
+                                                              Long userId);
 }

+ 18 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TBUserRoleServiceImpl.java

@@ -2,10 +2,14 @@ package com.qmth.themis.business.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.themis.business.dao.TBUserRoleMapper;
+import com.qmth.themis.business.entity.TBUser;
 import com.qmth.themis.business.entity.TBUserRole;
 import com.qmth.themis.business.service.TBUserRoleService;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.List;
+
 /**
  * @Description: 用户角色 服务实现类
  * @Param:
@@ -16,4 +20,18 @@ import org.springframework.stereotype.Service;
 @Service
 public class TBUserRoleServiceImpl extends ServiceImpl<TBUserRoleMapper, TBUserRole> implements TBUserRoleService {
 
+    @Resource
+    TBUserRoleMapper tbUserRoleMapper;
+
+    /**
+     * 根据机构id+角色查询用户
+     *
+     * @param orgId
+     * @param roleCode
+     * @return
+     */
+    @Override
+    public List<TBUser> userQueryByRole(Long orgId, String roleCode) {
+        return tbUserRoleMapper.userQueryByRole(orgId, roleCode);
+    }
 }

+ 25 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamReexamServiceImpl.java

@@ -1,11 +1,16 @@
 package com.qmth.themis.business.service.impl;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.themis.business.bean.backend.ReexamListRequestBean;
 import com.qmth.themis.business.dao.TEExamReexamMapper;
 import com.qmth.themis.business.entity.TEExamReexam;
 import com.qmth.themis.business.service.TEExamReexamService;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.Map;
+
 /**
  * @Description: 考生重考处理 服务实现类
  * @Param:
@@ -16,4 +21,24 @@ import org.springframework.stereotype.Service;
 @Service
 public class TEExamReexamServiceImpl extends ServiceImpl<TEExamReexamMapper, TEExamReexam> implements TEExamReexamService {
 
+    @Resource
+    TEExamReexamMapper teExamReexamMapper;
+
+    /**
+     * 重考申请列表
+     *
+     * @param iPage
+     * @param examId
+     * @param examActivityId
+     * @param roomCode
+     * @param courseCode
+     * @param name
+     * @param identity
+     * @param userId
+     * @return
+     */
+    @Override
+    public IPage<ReexamListRequestBean> reexamPageRequestList(IPage<Map> iPage, Long examId, Long examActivityId, String roomCode, String courseCode, String name, String identity, Long userId) {
+        return teExamReexamMapper.reexamPageRequestList(iPage, examId, examActivityId, roomCode, courseCode, name, identity, userId);
+    }
 }

+ 16 - 0
themis-business/src/main/resources/mapper/TBUserRoleMapper.xml

@@ -2,4 +2,20 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.themis.business.dao.TBUserRoleMapper">
 
+    <select id="userQueryByRole" resultType="com.qmth.themis.business.entity.TBUser">
+        select
+            tbu.id
+        from
+            t_b_user tbu
+        left join t_b_user_role tbur on
+            tbur.user_id = tbu.id
+        <where>
+            <if test="orgId != null and orgId != ''">
+                and tbu.org_id = #{orgId}
+            </if>
+            <if test="roleCode != null and roleCode != ''">
+                and tbur.role_code = #{roleCode}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 44 - 0
themis-business/src/main/resources/mapper/TEExamReexamMapper.xml

@@ -2,4 +2,48 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.themis.business.dao.TEExamReexamMapper">
 
+    <select id="reexamPageRequestList" resultType="com.qmth.themis.business.bean.backend.ReexamListRequestBean">
+    select
+        teer.id as reexamId,
+        tees.room_code as roomCode,
+        tees.room_name as roomName,
+        tees.`identity`,
+        tees.name,
+        teer.exam_activity_id as examActivityId,
+        teer.exam_student_id as examStudentId,
+        teer.exam_record_id as examRecordId,
+        tees.course_code as courseCode,
+        tees.course_name as courseName
+    from
+        t_e_exam_reexam teer
+        left join t_e_exam_student tees on
+            tees.id = teer.exam_student_id
+        inner join (select distinct tbeiu.room_code from t_b_exam_invigilate_user tbeiu
+        <if test="userId != null and userId != ''">
+            where tbeiu.user_id = #{userId}
+        </if>
+        ) t on t.room_code = tees.room_code
+        <where>
+            <if test="examId != null and examId != ''">
+                and tees.exam_id = #{examId}
+            </if>
+            <if test="examActivityId != null and examActivityId != ''">
+                and tees.exam_activity_id = #{examActivityId}
+            </if>
+            <if test="roomCode != null and roomCode != ''">
+                and tees.room_code = #{roomCode}
+            </if>
+            <if test="courseCode != null and courseCode != ''">
+                and tees.course_code like CONCAT(#{courseCode},'%')
+            </if>
+            <if test="name != null and name !=''">
+                and tees.name like CONCAT(#{name},'%')
+            </if>
+            <if test="identity != null and identity !=''">
+                and tees.identity like CONCAT(#{identity},'%')
+            </if>
+            and tees.enable = 1
+        </where>
+        order by tees.room_code
+    </select>
 </mapper>