Pārlūkot izejas kodu

Merge branch 'dev'
1

wangliang 4 gadi atpakaļ
vecāks
revīzija
a33d61ba7a

+ 19 - 32
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamReexamController.java

@@ -5,12 +5,14 @@ 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.bean.backend.ReexamListRequestBean;
-import com.qmth.themis.business.cache.ExamRecordCacheUtil;
 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;
-import com.qmth.themis.business.entity.*;
+import com.qmth.themis.business.entity.TBUser;
+import com.qmth.themis.business.entity.TEExamReexam;
+import com.qmth.themis.business.entity.TEExamReexamAuditing;
+import com.qmth.themis.business.entity.TEExamStudent;
 import com.qmth.themis.business.enums.ReexamReasonEnum;
 import com.qmth.themis.business.enums.RoleEnum;
 import com.qmth.themis.business.service.*;
@@ -48,9 +50,6 @@ public class TEExamReexamController {
     @Resource
     RedisUtil redisUtil;
 
-    @Resource
-    TOeExamRecordService tOeExamRecordService;
-
     @Resource
     TEExamService teExamService;
 
@@ -68,15 +67,15 @@ public class TEExamReexamController {
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     @Transactional
     public Result apply(@ApiJsonObject(name = "reexamApply", value = {
-            @ApiJsonProperty(key = "examRecordId", description = "考试记录id数组", required = true),
+            @ApiJsonProperty(key = "examStudentId", 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);
+        if (Objects.isNull(mapParameter.get("examStudentId")) || Objects.equals(mapParameter.get("examStudentId"), "")) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_STUDENT_ID_IS_NULL);
         }
-        List<String> recordIdList = (List<String>) mapParameter.get("examRecordId");
+        List<String> examStudentIdList = (List<String>) mapParameter.get("examStudentId");
         if (Objects.isNull(mapParameter.get("model")) || Objects.equals(mapParameter.get("model"), "")) {
             throw new BusinessException("重考方式不能为空");
         }
@@ -84,35 +83,23 @@ public class TEExamReexamController {
         if (Objects.isNull(mapParameter.get("reason")) || Objects.equals(mapParameter.get("reason"), "")) {
             throw new BusinessException("重考原因不能为空");
         }
-        if (recordIdList.size() > 0) {
+        List<Long> examStudentIdNotAuditingList = null;
+        if (examStudentIdList.size() > 0) {
+            examStudentIdNotAuditingList = new ArrayList<>();
             TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
             ReexamReasonEnum reason = ReexamReasonEnum.valueOf(String.valueOf(mapParameter.get("reason")));
-            Long examId = null, examStudentId = null, examActivityId = null;
             Integer reexamAuditing = null, status;
             List<TEExamReexamAuditing> teExamReexamAuditingList = new ArrayList<>();
-            Set<Long> examStudentIdList = new HashSet<>();
-            for (String s : recordIdList) {
-                //获取考试记录缓存
-                Long recordId = Long.parseLong(s);
-                examId = ExamRecordCacheUtil.getExamId(recordId);
-                if (Objects.isNull(examId)) {
-                    TOeExamRecord tOeExamRecord = tOeExamRecordService.getById(Long.parseLong(s));
-                    examId = tOeExamRecord.getExamId();
-                    examStudentId = tOeExamRecord.getExamStudentId();
-                    examActivityId = tOeExamRecord.getExamActivityId();
-                } else {
-                    examId = ExamRecordCacheUtil.getExamId(recordId);
-                    examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
-                    examActivityId = ExamRecordCacheUtil.getExamActivityId(recordId);
-                }
-                if (redisUtil.lock(SystemConstant.REDIS_LOCK_EXAM_STUDENT_PREFIX + examStudentId, SystemConstant.REDIS_LOCK_REEXAM_EXAM_STUDENT_TIME_OUT)) {
-                    ExamCacheBean examCacheBean = teExamService.getExamCacheBean(examId);//考试缓存
+            List<TEExamStudent> teExamStudentList = teExamStudentService.listByIds(examStudentIdList);
+            for (TEExamStudent teExamStudent : teExamStudentList) {
+                if (redisUtil.lock(SystemConstant.REDIS_LOCK_EXAM_STUDENT_PREFIX + teExamStudent.getId(), SystemConstant.REDIS_LOCK_REEXAM_EXAM_STUDENT_TIME_OUT)) {
+                    ExamCacheBean examCacheBean = teExamService.getExamCacheBean(teExamStudent.getExamId());//考试缓存
                     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, Long.parseLong(s), examStudentId, model, reason, status, Objects.isNull(mapParameter.get("remark")) ? null : String.valueOf(mapParameter.get("remark")));
+                    TEExamReexam teExamReexam = new TEExamReexam(teExamStudent.getExamId(), teExamStudent.getExamActivityId(), teExamStudent.getId(), model, reason, status, Objects.isNull(mapParameter.get("remark")) ? null : String.valueOf(mapParameter.get("remark")));
                     teExamReexam.setCreateId(tbUser.getId());
                     teExamReexamService.save(teExamReexam);
                     if (Objects.nonNull(status) && status.intValue() == 1) {
@@ -125,15 +112,15 @@ public class TEExamReexamController {
                             }
                         }
                     } else if (Objects.nonNull(status) && status.intValue() == 0) {//无需审核时考生已考次数-1
-                        examStudentIdList.add(examStudentId);
+                        examStudentIdNotAuditingList.add(teExamStudent.getId());
                     }
                 }
             }
             if (Objects.nonNull(teExamReexamAuditingList) && teExamReexamAuditingList.size() > 0) {
                 teExamReexamAuditingService.saveBatch(teExamReexamAuditingList);
             }
-            if (Objects.nonNull(examStudentIdList) && examStudentIdList.size() > 0) {
-                examStudentIdList.forEach(s -> {
+            if (Objects.nonNull(examStudentIdNotAuditingList) && examStudentIdNotAuditingList.size() > 0) {
+                examStudentIdNotAuditingList.forEach(s -> {
                     ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(s);
                     if (Objects.nonNull(examStudentCacheBean)) {
                         Integer alreadyExamCount = Objects.nonNull(examStudentCacheBean.getAlreadyExamCount()) ? examStudentCacheBean.getAlreadyExamCount() : 0;

+ 3 - 3
themis-business/src/main/java/com/qmth/themis/business/bean/backend/ReexamListBean.java

@@ -66,7 +66,7 @@ public class ReexamListBean implements Serializable {
     private String reason;
 
     @ApiModelProperty(name = "申请时间")
-    private String applyTime;
+    private Long applyTime;
 
     @ApiModelProperty(name = "申请人")
     private String applyName;
@@ -95,11 +95,11 @@ public class ReexamListBean implements Serializable {
         this.reason = reason;
     }
 
-    public String getApplyTime() {
+    public Long getApplyTime() {
         return applyTime;
     }
 
-    public void setApplyTime(String applyTime) {
+    public void setApplyTime(Long applyTime) {
         this.applyTime = applyTime;
     }
 

+ 3 - 3
themis-business/src/main/java/com/qmth/themis/business/bean/backend/ReexamListDoneBean.java

@@ -16,7 +16,7 @@ import java.util.Objects;
 public class ReexamListDoneBean extends ReexamListBean {
 
     @ApiModelProperty(name = "审核时间")
-    private String auditingTime;
+    private Long auditingTime;
 
     @ApiModelProperty(name = "审核结果")
     private Integer auditingStatus;
@@ -27,11 +27,11 @@ public class ReexamListDoneBean extends ReexamListBean {
     @ApiModelProperty(name = "审核人")
     private String auditingName;
 
-    public String getAuditingTime() {
+    public Long getAuditingTime() {
         return auditingTime;
     }
 
-    public void setAuditingTime(String auditingTime) {
+    public void setAuditingTime(Long auditingTime) {
         this.auditingTime = auditingTime;
     }
 

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

@@ -33,10 +33,6 @@ public class ReexamListRequestBean implements Serializable {
     @ApiModelProperty(name = "考生id")
     private Long examStudentId;
 
-    @JsonSerialize(using = ToStringSerializer.class)
-    @ApiModelProperty(name = "考试记录id")
-    private Long examRecordId;
-
     @ApiModelProperty(name = "证件号")
     private String identity;
 
@@ -111,14 +107,6 @@ public class ReexamListRequestBean implements Serializable {
         this.examStudentId = examStudentId;
     }
 
-    public Long getExamRecordId() {
-        return examRecordId;
-    }
-
-    public void setExamRecordId(Long examRecordId) {
-        this.examRecordId = examRecordId;
-    }
-
     public String getIdentity() {
         return identity;
     }

+ 1 - 20
themis-business/src/main/java/com/qmth/themis/business/entity/TEExamReexam.java

@@ -1,8 +1,6 @@
 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.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.themis.business.base.BaseEntity;
@@ -11,9 +9,6 @@ import com.qmth.themis.common.contanst.Constants;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
-import java.io.Serializable;
-import java.util.Date;
-
 /**
  * @Description: 考生重考处理
  * @Param:
@@ -36,11 +31,6 @@ public class TEExamReexam extends BaseEntity {
     @TableField(value = "exam_activity_id")
     private Long examActivityId;
 
-    @JsonSerialize(using = ToStringSerializer.class)
-    @ApiModelProperty(value = "考试记录ID")
-    @TableField(value = "exam_record_id")
-    private Long examRecordId;
-
     @JsonSerialize(using = ToStringSerializer.class)
     @ApiModelProperty(value = "考生id")
     @TableField(value = "exam_student_id")
@@ -83,11 +73,10 @@ public class TEExamReexam extends BaseEntity {
 
     }
 
-    public TEExamReexam(Long examId, Long examActivityId, Long examRecordId, Long examStudentId, Integer model, ReexamReasonEnum reason, Integer status, String remark) {
+    public TEExamReexam(Long examId, Long examActivityId, 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;
@@ -115,14 +104,6 @@ public class TEExamReexam extends BaseEntity {
         this.examActivityId = examActivityId;
     }
 
-    public Long getExamRecordId() {
-        return examRecordId;
-    }
-
-    public void setExamRecordId(Long examRecordId) {
-        this.examRecordId = examRecordId;
-    }
-
     public Long getExamStudentId() {
         return examStudentId;
     }

+ 0 - 1
themis-business/src/main/resources/db/init.sql

@@ -1052,7 +1052,6 @@ CREATE TABLE `t_e_exam_reexam` (
   `id` bigint NOT NULL COMMENT '主键',
   `exam_id` bigint NOT NULL COMMENT '考试ID',
   `exam_activity_id` bigint NOT NULL COMMENT '场次ID',
-  `exam_record_id` bigint NOT NULL COMMENT '考试记录ID',
   `exam_student_id` bigint NOT NULL COMMENT '考生id',
   `model` tinyint DEFAULT NULL COMMENT '重考方式,0:批次内,1:换批次',
   `reason` varchar(30) DEFAULT NULL COMMENT '重考原因',

+ 1 - 2
themis-business/src/main/resources/mapper/TEExamReexamMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="com.qmth.themis.business.dao.TEExamReexamMapper">
 
     <select id="reexamPageRequestList" resultType="com.qmth.themis.business.bean.backend.ReexamListRequestBean">
-        select * from(select
+        select * from(select distinct
              tees.room_code as roomCode,
             tees.room_name as roomName,
             tees.`identity`,
@@ -12,7 +12,6 @@
             tees.id as examStudentId,
             tees.course_code as courseCode,
             tees.course_name as courseName,
-            toer.id as examRecordId,
             tees.exam_id as examId,
             tee.exam_count - tees.already_exam_count as examCount,
             toer.status

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

@@ -391,11 +391,11 @@
 				and t.exceptionCount &lt;= #{maxExceptionCount}
 			</if>
 		</where>
-		order by t.roomCode
+		order by t.approveStatus
 	</select>
 
 	<update id="approveStatusListUpdate">
-		update t_ie_invigilate_warn_info tiiwi set tiiwi.approve_status = 0
+		update t_ie_invigilate_warn_info tiiwi set tiiwi.approve_status = 1
 		where exists(
 			select t.warningId from(select
 			tiiwi.id as warningId,