wangwei 7 年 前
コミット
e86617ba6f

+ 1 - 0
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/controller/ExamStudentController.java

@@ -317,6 +317,7 @@ public class ExamStudentController extends ControllerSupport {
 		ExamStudentBean examStudentBean = saveExamStudentResp.getExamStudentBean();
 
 		ExamStudentDomain ret = new ExamStudentDomain();
+		ret.setId(examStudentBean.getId());
 		ret.setStudentId(studentId);
 		ret.setStudentCode(examStudentBean.getStudentCode());
 		ret.setStudentName(examStudentBean.getStudentName());

+ 7 - 3
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/provider/ExamStudentCloudServiceProvider.java

@@ -135,10 +135,13 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
 
 		ExamStudent examStudent = new ExamStudent();
 
-		// 数据悲观修正 by wangwei
-		if (CollectionUtils.isNotEmpty(examStudentList)) {
+		if (1 < examStudentList.size()) {
+			// 数据需要修正
+			throw new StatusException("E-100008", "考生数据重复. studentId: " + studentInfo.getId());
+		} else if (1 == examStudentList.size()) {
 			examStudent = examStudentList.get(0);
-			examStudentRepo.deleteInBatch(examStudentList);
+		} else {
+			examStudent = new ExamStudent();
 		}
 
 		examStudent.setName(studentInfo.getName());
@@ -155,6 +158,7 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
 		SaveExamStudentResp resp = new SaveExamStudentResp();
 
 		ExamStudentBean examStudentBean = new ExamStudentBean();
+		examStudentBean.setId(saved.getId());
 		examStudentBean.setCourseCode(saved.getCourseCode());
 		examStudentBean.setCourseLevel(saved.getCourseLevel());
 		examStudentBean.setCourseName(saved.getCourseName());

+ 10 - 0
examcloud-core-examwork-api/src/main/java/cn/com/qmth/examcloud/examwork/api/bean/ExamStudentBean.java

@@ -5,6 +5,8 @@ import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
 public class ExamStudentBean implements JsonSerializable {
 	private static final long serialVersionUID = 2079003980099252759L;
 
+	private Long id;
+
 	/**
 	 * 顶级机构ID
 	 */
@@ -55,6 +57,14 @@ public class ExamStudentBean implements JsonSerializable {
 	 */
 	private String paperType;
 
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
 	public Long getRootOrgId() {
 		return rootOrgId;
 	}