Sfoglia il codice sorgente

修改重考列表数据不正确的BUG

chenken 7 anni fa
parent
commit
c097eba116

+ 10 - 15
exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/ExamStudentService.java

@@ -359,14 +359,8 @@ public class ExamStudentService {
 				" 	select t2.exam_times from ecs_exam t2 where t2.id = t1.exam_id "+
 				")");
     	sql.append(" and t1.exam_id="+examCriteria.getExamId());
-    	//排除掉设置了重考,但是还没考试的考生
-    	sql.append(" and t1.id not in  ( "
-					+ " select t2.exam_student_id	"
-					+ " from oe_exam_record t2 	"
-					+ " where t2.batch_id = "+examCriteria.getExamId()
-					  + " and t2.is_reexamine = 1	"
-					  + " and t2.`status` = 'EXAM_INVALID' "
-					+") ");
+    	//没设置重考的或者设置了重考,重考已完成的
+    	sql.append(" and (t1.is_reexamine is null OR (t1.is_reexamine = 1 and t1.reexamine_completed = 1)) ");
     	sql.append(getSqlSpecification(examCriteria));
     	sql.append(" limit "+(curPage-1)*pageSize+","+pageSize);
     	
@@ -398,13 +392,8 @@ public class ExamStudentService {
     				" select t2.exam_times from ecs_exam t2 where t2.id = t1.exam_id "+
     			")");
     	sql.append(" and t1.exam_id="+examCriteria.getExamId());
-    	sql.append(" and t1.id not in  ( "
-				+ " select t2.exam_student_id	"
-				+ " from oe_exam_record t2 	"
-				+ " where t2.batch_id = "+examCriteria.getExamId()
-				  + " and t2.is_reexamine = 1	"
-				  + " and t2.`status` = 'EXAM_INVALID' "
-				+") ");
+    	//没设置重考的或者设置了重考,重考已完成的
+    	sql.append(" and (t1.is_reexamine is null OR (t1.is_reexamine = 1 and t1.reexamine_completed = 1)) ");
     	sql.append(getSqlSpecification(examCriteria));
 		return this.jdbcTemplate.queryForObject(sql.toString(), Integer.class);
 	}
@@ -731,6 +720,10 @@ public class ExamStudentService {
 	     if(examTimes > examStudent.getNormalExamTimes()){
 	        examStudent.setNormalExamTimes(examStudent.getNormalExamTimes()+1);
 	     }
+	     //考生开始重考时,将重考已完成设置为true
+	     if(examStudent.getIsReexamine()!=null&&examStudent.getIsReexamine()){
+	    	 examStudent.setReexamineCompleted(true);
+	     }
 	     examStudentRepo.save(examStudent);
 	}
 	
@@ -747,6 +740,8 @@ public class ExamStudentService {
 		ExamStudent examStudent = examStudentRepo.findOne(commonExamStudent.getId());
 		if(examStudent!=null){
 			examStudent.setIsReexamine(true);
+			//设置了重考,但考生重考未完成,考生开始重考时,该字段改为true
+			examStudent.setReexamineCompleted(false);
 			examStudent.setReexamineType(commonExamStudent.getReexamineType());
 			examStudent.setReexamineDetail(commonExamStudent.getReexamineDetail());
 			examStudentRepo.save(examStudent);

+ 12 - 0
exam-work-domain/src/main/java/cn/com/qmth/examcloud/service/examwork/entity/ExamStudent.java

@@ -129,6 +129,10 @@ public class ExamStudent implements Serializable {
 	 * 重考原因详情
 	 */
 	private String reexamineDetail;
+	/**
+	 * 重考已完成  true:是 false:否
+	 */
+	private Boolean reexamineCompleted;
 	
 	public static long getSerialVersionUID() {
 		return serialVersionUID;
@@ -383,5 +387,13 @@ public class ExamStudent implements Serializable {
 	public void setReexamineDetail(String reexamineDetail) {
 		this.reexamineDetail = reexamineDetail;
 	}
+
+	public Boolean getReexamineCompleted() {
+		return reexamineCompleted;
+	}
+
+	public void setReexamineCompleted(Boolean reexamineCompleted) {
+		this.reexamineCompleted = reexamineCompleted;
+	}
 	
 }