瀏覽代碼

。。。

wangwei 6 年之前
父節點
當前提交
f03747d68e

+ 6 - 0
examcloud-core-examwork-service/pom.xml

@@ -27,6 +27,12 @@
 			<version>${examcloud.version}</version>
 		</dependency>
 
+		<dependency>
+			<groupId>cn.com.qmth.examcloud.rmi</groupId>
+			<artifactId>examcloud-task-api-client</artifactId>
+			<version>${examcloud.version}</version>
+		</dependency>
+
 	</dependencies>
 
 </project>

+ 34 - 0
examcloud-core-examwork-service/src/main/java/cn/com/qmth/examcloud/core/examwork/service/impl/ExamStudentServiceImpl.java

@@ -31,6 +31,8 @@ import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamEntity;
 import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamStudentEntity;
 import cn.com.qmth.examcloud.core.examwork.service.ExamStudentService;
 import cn.com.qmth.examcloud.core.examwork.service.bean.ExamStudentInfo;
+import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
+import cn.com.qmth.examcloud.task.api.request.SyncExamStudentReq;
 
 /**
  * 考试学生服务类 Created by songyue on 17/1/14.
@@ -64,6 +66,9 @@ public class ExamStudentServiceImpl implements ExamStudentService {
 	@Autowired
 	ExamCourseRelationRepo examCourseRelationRepo;
 
+	@Autowired
+	DataSyncCloudService dataSyncCloudService;
+
 	/**
 	 * 方法注释
 	 *
@@ -172,9 +177,14 @@ public class ExamStudentServiceImpl implements ExamStudentService {
 		ExamStudentEntity examStudent = examStudentRepo.findByExamIdAndStudentIdAndCourseId(
 				exam.getId(), studentInfo.getId(), courseBean.getId());
 
+		long updateTime = 0L;
 		if (null == examStudent) {
 			examStudent = new ExamStudentEntity();
 			examStudent.setEnable(true);
+		} else {
+			if (null != examStudent.getUpdateTime()) {
+				updateTime = examStudent.getUpdateTime().getTime();
+			}
 		}
 
 		examStudent.setInfoCollector(examStudentInfo.getInfoCollector());
@@ -206,6 +216,30 @@ public class ExamStudentServiceImpl implements ExamStudentService {
 		relation.setCourseName(saved.getCourseName());
 		examCourseRelationRepo.save(relation);
 
+		// 同步操作
+		if (updateTime != saved.getUpdateTime().getTime()) {
+			SyncExamStudentReq req = new SyncExamStudentReq();
+			req.setId(saved.getId());
+			req.setCourseCode(courseBean.getCode());
+			req.setCourseLevel(courseBean.getLevel());
+			req.setCourseName(courseBean.getName());
+			req.setExamId(exam.getId());
+			req.setExamName(exam.getName());
+			req.setIdentityNumber(saved.getIdentityNumber());
+			req.setStudentCode(saved.getStudentCode());
+			req.setPaperType(saved.getPaperType());
+			req.setRootOrgId(saved.getRootOrgId());
+			req.setStudentName(studentInfo.getName());
+			req.setOrgId(studentInfo.getOrgId());
+			req.setOrgName(studentInfo.getOrgName());
+			req.setOrgCode(studentInfo.getOrgCode());
+			req.setRemark(saved.getRemark());
+			req.setInfoCollector(saved.getInfoCollector());
+			req.setExamSite(saved.getExamSite());
+
+			dataSyncCloudService.syncExamStudent(req);
+		}
+
 		ExamStudentInfo ret = new ExamStudentInfo();
 		ret.setId(saved.getId());
 		ret.setCourseCode(courseBean.getCode());