wangwei %!s(int64=6) %!d(string=hai) anos
pai
achega
c0eb983e47

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

@@ -29,10 +29,13 @@ import cn.com.qmth.examcloud.core.basic.api.OrgCloudService;
 import cn.com.qmth.examcloud.core.basic.api.StudentCloudService;
 import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
 import cn.com.qmth.examcloud.core.basic.api.bean.OrgBean;
+import cn.com.qmth.examcloud.core.basic.api.bean.StudentBean;
 import cn.com.qmth.examcloud.core.basic.api.request.GetCourseReq;
 import cn.com.qmth.examcloud.core.basic.api.request.GetOrgReq;
+import cn.com.qmth.examcloud.core.basic.api.request.GetStudentReq;
 import cn.com.qmth.examcloud.core.basic.api.response.GetCourseResp;
 import cn.com.qmth.examcloud.core.basic.api.response.GetOrgResp;
+import cn.com.qmth.examcloud.core.basic.api.response.GetStudentResp;
 import cn.com.qmth.examcloud.core.examwork.dao.ExamCourseRelationRepo;
 import cn.com.qmth.examcloud.core.examwork.dao.ExamPaperTypeRelationRepo;
 import cn.com.qmth.examcloud.core.examwork.dao.ExamRepo;
@@ -54,6 +57,8 @@ import cn.com.qmth.examcloud.examwork.api.response.CopyExamStudentsResp;
 import cn.com.qmth.examcloud.examwork.api.response.GetExamStudentPageResp;
 import cn.com.qmth.examcloud.examwork.api.response.GetExamStudentResp;
 import cn.com.qmth.examcloud.examwork.api.response.SaveExamStudentResp;
+import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
+import cn.com.qmth.examcloud.task.api.request.SyncExamStudentReq;
 import io.swagger.annotations.ApiOperation;
 
 /**
@@ -96,6 +101,9 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
 	@Autowired
 	ExamPaperTypeRelationRepo examPaperTypeRelationRepo;
 
+	@Autowired
+	DataSyncCloudService dataSyncCloudService;
+
 	@ApiOperation(value = "保存考生")
 	@PostMapping("saveExamStudent")
 	@Override
@@ -261,6 +269,41 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport
 				pt.setPageType(saved.getPaperType());
 				examPaperTypeRelationRepo.save(pt);
 
+				GetStudentReq getStudentReq = new GetStudentReq();
+				getStudentReq.setRootOrgId(rootOrgId);
+				getStudentReq.setIdentityNumber(saved.getIdentityNumber());
+				GetStudentResp getStudentResp = studentCloudService.getStudent(getStudentReq);
+
+				StudentBean studentInfo = getStudentResp.getStudentInfo();
+
+				// 同步操作
+				SyncExamStudentReq sync = new SyncExamStudentReq();
+				sync.setSyncType("update");
+				sync.setId(saved.getId());
+
+				sync.setCourseId(saved.getCourseId());
+				sync.setCourseCode(saved.getCourseCode());
+				sync.setCourseLevel(saved.getCourseLevel());
+				sync.setCourseName(saved.getCourseName());
+
+				sync.setExamId(saved.getExamId());
+				sync.setExamName(exam2.getName());
+
+				sync.setRootOrgId(saved.getRootOrgId());
+				sync.setStudentId(studentInfo.getId());
+				sync.setStudentName(studentInfo.getName());
+				sync.setIdentityNumber(saved.getIdentityNumber());
+				sync.setStudentCode(saved.getStudentCode());
+				sync.setOrgId(studentInfo.getOrgId());
+				sync.setOrgName(studentInfo.getOrgName());
+				sync.setOrgCode(studentInfo.getOrgCode());
+
+				sync.setPaperType(saved.getPaperType());
+				sync.setRemark(saved.getRemark());
+				sync.setInfoCollector(saved.getInfoCollector());
+				sync.setExamSite(saved.getExamSite());
+				dataSyncCloudService.syncExamStudent(sync);
+
 				examStudentIds.add(saved.getId());
 			}