Преглед на файлове

更新考生重考相关字段定义

lideyin преди 5 години
родител
ревизия
ac496dac59

+ 9 - 12
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/bean/ExamStudentBeanConvert.java

@@ -7,17 +7,16 @@
 
 package cn.com.qmth.examcloud.core.oe.admin.api.bean;
 
-import java.util.List;
-import java.util.stream.Collectors;
-
-import com.google.common.collect.Lists;
-
+import cn.com.qmth.examcloud.api.commons.exchange.JsonSerializable;
 import cn.com.qmth.examcloud.core.oe.admin.api.request.ExamStudentSyncAllDataReq;
 import cn.com.qmth.examcloud.core.oe.admin.api.request.ExamStudentSyncPartDataReq;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentInfo;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentPartInfo;
 import cn.com.qmth.examcloud.global.api.request.SyncExamStudentReq;
-import cn.com.qmth.examcloud.api.commons.exchange.JsonSerializable;
+import com.google.common.collect.Lists;
+
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 类信息转换
@@ -51,9 +50,8 @@ public class ExamStudentBeanConvert implements JsonSerializable {
         info.setPaperType(bean.getPaperType());
         info.setInfoCollector(bean.getInfoCollector());
         info.setFinished(bean.getFinished());
-        info.setNormalExamTimes(bean.getNormalExamTimes());
-        info.setIsReExamine(bean.getReExamine());
-        info.setReExamineCompleted(bean.getReExamineCompleted());
+        info.setUsedNum(0);
+        info.setExtraNum(0);
         return info;
     }
 
@@ -107,9 +105,8 @@ public class ExamStudentBeanConvert implements JsonSerializable {
         info.setGrade(req.getGrade());
         info.setExamSiteName(req.getExamSite());
         info.setFinished(false);
-        info.setNormalExamTimes(0);
-        info.setIsReExamine(false);
-        info.setReExamineCompleted(false);
+        info.setExtraNum(0);
+        info.setUsedNum(0);
         info.setEnable(req.getEnable());
         return info;
     }

+ 0 - 8
examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/ExamStudentRepo.java

@@ -93,14 +93,6 @@ public interface ExamStudentRepo extends JpaRepository<ExamStudentEntity, Long>,
 	@Query(value = "select *  from ec_oe_exam_student where exam_id=?1 and id>=?2 order by id limit ?3",nativeQuery = true)
 	List<ExamStudentEntity> getLimitExamStudentList(Long examId, Long startId, Integer size);
 
-	/**
-	 * 更新考生开考的状态信息
-	 */
-	@Transactional
-	@Modifying
-	@Query(nativeQuery = true, value = "update ec_oe_exam_student set finished=?2,normal_exam_times=?3,is_reexamine=?4,reexamine_completed=?5,update_time=?6 where id=?1")
-	void updateExamStudentStartExamStatusInfo(Long id, Boolean finished, int normalExamTimes, Boolean isReExamine, Boolean reexamineCompleted, Date updateTime);
-
 	ExamStudentEntity findByStudentIdAndExamIdAndCourseId(Long studentId,Long examId,Long courseId);
 
 }

+ 0 - 58
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examrecord/ExamRecordMapper.java

@@ -1,58 +0,0 @@
-/*
- * *************************************************
- * Copyright (c) 2018 QMTH. All Rights Reserved.
- * Created by Deason on 2018-08-24 11:22:55.
- * *************************************************
- */
-
-package cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord;
-
-/**
- * 实体元数据
- *
- * @author: fengdesheng
- * @since: 2018/8/24
- */
-public interface ExamRecordMapper {
-
-    String EXAM_RECORD_DATA_ID = "id";
-    String EXAM_RECORD_ID = "examRecord.id";
-    String EXAM_RECORD_EXAM_ID = "examRecord.examId";
-    String EXAM_RECORD_EXAM_TYPE = "examRecord.examType";
-    String EXAM_RECORD_EXAM_STUDENT_ID = "examRecord.examStudentId";
-    String EXAM_RECORD_STUDENT_ID = "examRecord.studentId";
-    String EXAM_RECORD_STUDENT_CODE = "examRecord.studentCode";
-    String EXAM_RECORD_STUDENT_NAME = "examRecord.studentName";
-    String EXAM_RECORD_IDENTITY_NUMBER = "examRecord.identityNumber";
-    String EXAM_RECORD_COURSE_ID = "examRecord.courseId";
-    String EXAM_RECORD_COURSE_CODE = "examRecord.courseCode";
-    String EXAM_RECORD_COURSE_NAME = "examRecord.courseName";
-    String EXAM_RECORD_COURSE_LEVEL = "examRecord.courseLevel";
-    String EXAM_RECORD_ORG_ID = "examRecord.orgId";
-    String EXAM_RECORD_ROOT_ORG_ID = "examRecord.rootOrgId";
-    String EXAM_RECORD_BASE_PAPER_ID = "examRecord.basePaperId";
-    String EXAM_RECORD_PAPER_STRUCT_ID = "examRecord.paperStructId";
-    String START_TIME = "startTime";
-    String END_TIME = "endTime";
-    String CLEAN_TIME = "cleanTime";
-    String IS_WARN = "isWarn";
-    String IS_AUDIT = "isAudit";
-    String IS_ILLEGALITY = "isIllegality";
-    String INFO_COLLECTOR = "infoCollector";
-    String EXAM_RECORD_STATUS = "examRecordStatus";
-    String USED_EXAM_TIME = "usedExamTime";
-    String EXAM_ORDER = "examOrder";
-    String IS_REEXAMINE = "isReexamine";
-    String IS_CONTINUED = "isContinued";
-    String CONTINUED_COUNT = "continuedCount";
-    String FACE_SUCCESS_COUNT = "faceSuccessCount";
-    String FACE_FAILED_COUNT = "faceFailedCount";
-    String FACE_STRANGER_COUNT = "faceStrangerCount";
-    String FACE_TOTAL_COUNT = "faceTotalCount";
-    String FACE_SUCCESS_PERCENT = "faceSuccessPercent";
-    String FACE_VERIFY_RESULT = "faceVerifyResult";
-    String FACE_LANDMARK_VAL = "faceLandmarkVal";
-    String UPDATE_TIME = "updateTime";
-    String CREATION_TIME = "creationTime";
-
-}

+ 4 - 6
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examstudent/ExamStudentEntityConvert.java

@@ -56,9 +56,8 @@ public class ExamStudentEntityConvert {
         entity.setPaperType(info.getPaperType());
         entity.setInfoCollector(info.getInfoCollector());
         entity.setFinished(info.getFinished());
-        entity.setNormalExamTimes(info.getNormalExamTimes());
-        entity.setIsReExamine(info.getIsReExamine());
-        entity.setReExamineCompleted(info.getReExamineCompleted());
+        entity.setUsedNum(info.getUsedNum());
+        entity.setExtraNum(info.getExtraNum());
         return entity;
     }
 
@@ -84,9 +83,8 @@ public class ExamStudentEntityConvert {
         info.setPaperType(entity.getPaperType());
         info.setInfoCollector(entity.getInfoCollector());
         info.setFinished(entity.getFinished());
-        info.setNormalExamTimes(entity.getNormalExamTimes());
-        info.setIsReExamine(entity.getIsReExamine());
-        info.setReExamineCompleted(entity.getReExamineCompleted());
+        info.setUsedNum(entity.getUsedNum());
+        info.setExtraNum(entity.getExtraNum());
         info.setGrade(entity.getGrade());
         return info;
     }

+ 26 - 38
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examstudent/ExamStudentInfo.java

@@ -112,19 +112,6 @@ public class ExamStudentInfo implements JsonSerializable {
     private String finishedStatus;
     
     private String offlineFileUrl;
-    
-    /**
-     * 正常考试次数
-     */
-    private Integer normalExamTimes;
-    /**
-     * 是否重考
-     */
-    private Boolean isReExamine;
-    /**
-     * 重考是否已完成
-     */
-    private Boolean reExamineCompleted;
     /**
      * 考点
      */
@@ -147,6 +134,16 @@ public class ExamStudentInfo implements JsonSerializable {
 	 */
 	private Boolean enable;
 
+    /**
+     * 已经考试的次数
+     */
+    private Integer usedNum;
+
+    /**
+     * 补加的考试次数
+     */
+    private Integer extraNum;
+
     public Long getId() {
         return id;
     }
@@ -307,22 +304,6 @@ public class ExamStudentInfo implements JsonSerializable {
         this.finished = finished;
     }
 
-    public Integer getNormalExamTimes() {
-        return normalExamTimes;
-    }
-
-    public void setNormalExamTimes(Integer normalExamTimes) {
-        this.normalExamTimes = normalExamTimes;
-    }
-
-    public Boolean getReExamineCompleted() {
-        return reExamineCompleted;
-    }
-
-    public void setReExamineCompleted(Boolean reExamineCompleted) {
-        this.reExamineCompleted = reExamineCompleted;
-    }
-
     public String getExamSiteName() {
         return examSiteName;
     }
@@ -355,14 +336,6 @@ public class ExamStudentInfo implements JsonSerializable {
 		this.examType = examType;
 	}
 
-	public Boolean getIsReExamine() {
-		return isReExamine;
-	}
-
-	public void setIsReExamine(Boolean isReExamine) {
-		this.isReExamine = isReExamine;
-	}
-
 	public Boolean getCanUploadAttachment() {
 		return canUploadAttachment;
 	}
@@ -394,5 +367,20 @@ public class ExamStudentInfo implements JsonSerializable {
 	public void setEnable(Boolean enable) {
 		this.enable = enable;
 	}
-    
+
+    public Integer getUsedNum() {
+        return usedNum;
+    }
+
+    public void setUsedNum(Integer usedNum) {
+        this.usedNum = usedNum;
+    }
+
+    public Integer getExtraNum() {
+        return extraNum;
+    }
+
+    public void setExtraNum(Integer extraNum) {
+        this.extraNum = extraNum;
+    }
 }

+ 0 - 45
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examstudent/ExamStudentMapper.java

@@ -15,51 +15,6 @@ package cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent;
  */
 public class ExamStudentMapper {
 
-    public static final String ID = "id";
-    public static final String EXAM_STUDENT_ID = "examStudentId";
-    public static final String EXAM_ID = "examId";
-    public static final String STUDENT_ID = "studentId";
-    public static final String STUDENT_CODE = "studentCode";
-    public static final String STUDENT_NAME = "studentName";
-    public static final String IDENTITY_NUMBER = "identityNumber";
-    public static final String COURSE_ID = "courseId";
-    public static final String COURSE_CODE = "courseCode";
-    public static final String COURSE_NAME = "courseName";
-    public static final String COURSE_LEVEL = "courseLevel";
-    public static final String ORG_ID = "orgId";
-    public static final String ORG_CODE = "orgCode";
-    public static final String ORG_NAME = "orgName";
-    public static final String ROOT_ORG_ID = "rootOrgId";
-    public static final String SPECIALTY_CODE = "specialtyCode";
-    public static final String SPECIALTY_NAME = "specialtyName";
-    public static final String PAPER_TYPE = "paperType";
-    public static final String INFO_COLLECTOR = "infoCollector";
-    public static final String FINISHED = "finished";
-    public static final String NORMAL_EXAM_TIMES = "normalExamTimes";
-    public static final String IS_RE_EXAMINE = "isReExamine";
-    public static final String RE_EXAMINE_COMPLETED = "reExamineCompleted";
-    public static final String CREATION_TIME = "creationTime";
-    public static final String UPDATE_TIME = "updateTime";
-
-    public static String defaultColumns() {
-        StringBuilder columns = new StringBuilder();
-        columns.append("student.id as id,");
-        columns.append("student.exam_student_id as examStudentId,");
-        columns.append("student.exam_id as examId,");
-        columns.append("student.student_id as studentId,");
-        columns.append("student.student_code as studentCode,");
-        columns.append("student.student_name as studentName,");
-        columns.append("student.identity_number as identityNumber,");
-        columns.append("student.course_id as courseId,");
-        columns.append("student.course_code as courseCode,");
-        columns.append("student.course_level as courseLevel,");
-        columns.append("student.org_id as orgId,");
-        columns.append("student.specialty_name as specialtyName,");
-        columns.append("student.finished as finished,");
-        columns.append("student.normal_exam_times as normalExamTimes");
-        return columns.toString();
-    }
-
     public static String statisticOrgColumns() {
         StringBuilder columns = new StringBuilder();
         columns.append("student.org_id as orgId,");

+ 10 - 6
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamScoreServiceImpl.java

@@ -127,7 +127,9 @@ public class ExamScoreServiceImpl implements ExamScoreService {
         examScore.setGrade(examStudent.getGrade());
         Long examTimes = examBean.getExamTimes();
         if (examTimes != null) {
-            examScore.setLeftExamTimes(examTimes - examStudent.getNormalExamTimes());
+            Integer extraExamNum = examStudent.getExtraNum() == null ? 0 : examStudent.getExtraNum();
+            Integer usedNum = examStudent.getUsedNum() == null ? 0 : examStudent.getUsedNum();
+            examScore.setLeftExamTimes(examTimes + extraExamNum - usedNum);
         }
         return setCommomScoreInfo(examScore, examStudent.getFinished(), examStudent.getExamStudentId(), examBean, markingType);
     }
@@ -160,7 +162,7 @@ public class ExamScoreServiceImpl implements ExamScoreService {
         //查询条件
         StringBuffer sql = new StringBuffer();
         sql.append("select id,exam_student_id,exam_id,course_id,course_code,course_level,finished,student_id,student_code,student_name,identity_number"
-                + ",info_collector,root_org_id,org_id,paper_type,normal_exam_times,is_reexamine,reexamine_completed"
+                + ",info_collector,root_org_id,org_id,paper_type,,used_num,extra_num"
                 + ",specialty_code,specialty_name,grade from ec_oe_exam_student where 1=1 ");
         if (query.getOrgId() != null) {
             sql.append(" and org_id=" + query.getOrgId());
@@ -242,9 +244,12 @@ public class ExamScoreServiceImpl implements ExamScoreService {
         examScore.setSpecialtyName(examStudent.getSpecialtyName());
         examScore.setGrade(examStudent.getGrade());
 
+        //剩余考试次数=可考次数+可重考次数-已考次数
         Long examTimes = examBean.getExamTimes();
         if (examTimes != null) {
-            examScore.setLeftExamTimes(examTimes - examStudent.getNormalExamTimes());
+            Integer extraExamNum = examStudent.getExtraNum() == null ? 0 : examStudent.getExtraNum();
+            Integer usedNum = examStudent.getUsedNum() == null ? 0 : examStudent.getUsedNum();
+            examScore.setLeftExamTimes(examTimes + extraExamNum - usedNum);
         }
 
         return setCommomScoreInfo(examScore, examStudent.getFinished(), examStudent.getExamStudentId(), examBean, markingType);
@@ -378,9 +383,8 @@ public class ExamScoreServiceImpl implements ExamScoreService {
         examStudentEntity.setRootOrgId(rs.getLong("root_org_id"));
         examStudentEntity.setOrgId(rs.getLong("org_id"));
         examStudentEntity.setPaperType(rs.getString("paper_type"));
-        examStudentEntity.setNormalExamTimes(rs.getInt("normal_exam_times"));
-        examStudentEntity.setIsReExamine(rs.getBoolean("is_reexamine"));
-        examStudentEntity.setReExamineCompleted(rs.getBoolean("reexamine_completed"));
+        examStudentEntity.setUsedNum(rs.getInt("used_num"));
+        examStudentEntity.setExtraNum(rs.getInt("extra_num"));
         examStudentEntity.setSpecialtyCode(rs.getString("specialty_code"));
         examStudentEntity.setSpecialtyName(rs.getString("specialty_name"));
         examStudentEntity.setGrade(rs.getString("grade"));

+ 19 - 24
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamStudentServiceImpl.java

@@ -93,14 +93,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
             if (entity == null) {
                 entity = new ExamStudentEntity();
                 entity.setFinished(false);
-                entity.setNormalExamTimes(0);
-                entity.setIsReExamine(false);
-                entity.setReExamineCompleted(false);
+                entity.setUsedNum(0);
+                entity.setExtraNum(0);
                 entity.setCreationTime(new Date());
             }
-            if (entity.getIsReExamine() == null) {
-                entity.setIsReExamine(false);
-            }
+
             entity.setExamStudentId(cur.getExamStudentId());
             entity.setRootOrgId(cur.getRootOrgId());
             entity.setOrgId(cur.getOrgId());
@@ -173,7 +170,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
 
         StringBuffer sql = new StringBuffer();
         sql.append("select id,exam_student_id,exam_id,course_id,course_code,course_level,finished,student_id,student_code,student_name,identity_number"
-                + ",info_collector,root_org_id,org_id,paper_type,normal_exam_times,is_reexamine,reexamine_completed"
+                + ",info_collector,root_org_id,org_id,paper_type,used_num,extra_num"
                 + ",specialty_code,specialty_name,grade from ec_oe_exam_student t1 where 1=1 ");
         sql.append(selectExamStudentConfitionSql(query, examBean.getExamType()));
         sql.append(" order by id desc");
@@ -215,7 +212,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
         //查询条件
         StringBuffer sql = new StringBuffer();
         sql.append("select id,exam_student_id,exam_id,course_id,course_code,course_level,finished,student_id,student_code,student_name,identity_number"
-                + ",info_collector,root_org_id,org_id,paper_type,normal_exam_times,is_reexamine,reexamine_completed"
+                + ",info_collector,root_org_id,org_id,paper_type,used_num,extra_num"
                 + ",specialty_code,specialty_name,grade from ec_oe_exam_student t1 where 1=1 ");
         sql.append(selectExamStudentConfitionSql(query, examBean.getExamType()));
         sql.append(" order by id desc");
@@ -345,9 +342,8 @@ public class ExamStudentServiceImpl implements ExamStudentService {
         examStudentEntity.setRootOrgId(rs.getLong("root_org_id"));
         examStudentEntity.setOrgId(rs.getLong("org_id"));
         examStudentEntity.setPaperType(rs.getString("paper_type"));
-        examStudentEntity.setNormalExamTimes(rs.getInt("normal_exam_times"));
-        examStudentEntity.setIsReExamine(rs.getBoolean("is_reexamine"));
-        examStudentEntity.setReExamineCompleted(rs.getBoolean("reexamine_completed"));
+        examStudentEntity.setUsedNum(rs.getInt("used_num"));
+        examStudentEntity.setExtraNum(rs.getInt("extra_num"));
         examStudentEntity.setSpecialtyCode(rs.getString("specialty_code"));
         examStudentEntity.setSpecialtyName(rs.getString("specialty_name"));
         examStudentEntity.setGrade(rs.getString("grade"));
@@ -377,12 +373,12 @@ public class ExamStudentServiceImpl implements ExamStudentService {
                 "t.root_org_id," +
                 "t.specialty_name," +
                 "t.finished," +
-                "t.normal_exam_times from ( ");
+                "t.used_num," +
+                "t.extra_num from ( ");
         sql.append("SELECT * " +
                 " FROM ec_oe_exam_student student" +
                 " WHERE exam_id = " + examBean.getId() +
-                " AND normal_exam_times >= " + examBean.getExamTimes().longValue() +
-                " AND ((is_reexamine = 0 OR is_reexamine is null) OR ( is_reexamine = 1 AND reexamine_completed = 1))" +
+                " AND used_num = extra_num+" + examBean.getExamTimes().longValue() +
                 " AND NOT EXISTS (" +
                 "	SELECT * FROM ec_oe_exam_record_data t1" +
                 "	WHERE" +
@@ -432,7 +428,8 @@ public class ExamStudentServiceImpl implements ExamStudentService {
                 examStudentEntity.setRootOrgId(rs.getLong("root_org_id"));
                 examStudentEntity.setSpecialtyName(rs.getString("specialty_name"));
                 examStudentEntity.setFinished(rs.getBoolean("finished"));
-                examStudentEntity.setNormalExamTimes(rs.getInt("normal_exam_times"));
+                examStudentEntity.setUsedNum(rs.getInt("used_num"));
+                examStudentEntity.setExtraNum(rs.getInt("extra_num"));
                 return examStudentEntity;
             }
         });
@@ -458,8 +455,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
                 "	ec_oe_exam_student student" +
                 " WHERE" +
                 "	exam_id = " + examBean.getId() +
-                " AND normal_exam_times >= " + examBean.getExamTimes().longValue() +
-                " AND ((is_reexamine = 0 OR is_reexamine is null) OR ( is_reexamine = 1 AND reexamine_completed = 1))" +
+                " AND used_num = extra_num+" + examBean.getExamTimes().longValue() +
                 " AND NOT EXISTS (" +
                 "	SELECT * FROM ec_oe_exam_record_data t1" +
                 "	WHERE t1.exam_id = " + examBean.getId() +
@@ -576,11 +572,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
                 examRecordForMarkingRepo.delete(examRecordForMarking);
             }
         }
-        //在考生信息中设置重考为true
+
+        //考生表重考次数+1
         ExamStudentEntity examStudent = examStudentRepo.findByExamStudentId(examStudentId);
-        examStudent.setIsReExamine(true);
-        //设置了重考,但考生重考未完成,考生开始重考时,该字段改为true
-        examStudent.setReExamineCompleted(false);
+        Integer extraExamNum = examStudent.getExtraNum() == null ? 0 : examStudent.getExtraNum();
+        examStudent.setExtraNum(extraExamNum + 1);
         examStudentRepo.save(examStudent);
     }
 
@@ -640,9 +636,8 @@ public class ExamStudentServiceImpl implements ExamStudentService {
             info.setRootOrgId(se.getRootOrgId());
             info.setOrgId(se.getOrgId());
             info.setPaperType(se.getPaperType());
-            info.setNormalExamTimes(se.getNormalExamTimes());
-            info.setIsReExamine(se.getIsReExamine());
-            info.setReExamineCompleted(se.getReExamineCompleted());
+            info.setUsedNum(se.getUsedNum());
+            info.setExtraNum(se.getExtraNum());
             info.setSpecialtyCode(se.getSpecialtyCode());
             info.setSpecialtyName(se.getSpecialtyName());
             info.setGrade(se.getGrade());