WANG před 6 roky
rodič
revize
0f26ee6af8

+ 151 - 168
examcloud-task-api-provider/src/main/java/cn/com/qmth/examcloud/task/api/provider/DataSyncCloudServiceProvider.java

@@ -1,9 +1,5 @@
 package cn.com.qmth.examcloud.task.api.provider;
 
-import cn.com.qmth.examcloud.commons.exception.StatusException;
-import cn.com.qmth.examcloud.core.oe.admin.api.OeExamStudentCloudService;
-import cn.com.qmth.examcloud.core.oe.admin.api.request.UnbindExamStudentReq;
-import cn.com.qmth.examcloud.core.oe.admin.api.response.UnbindExamStudentResp;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -39,169 +35,156 @@ import cn.com.qmth.examcloud.web.support.ControllerSupport;
 @RestController
 @RequestMapping("${$rmp.cloud.task}" + "dataSync")
 public class DataSyncCloudServiceProvider extends ControllerSupport
-        implements
-        DataSyncCloudService {
-
-    private static final long serialVersionUID = -2880611326177571371L;
-
-    @Autowired
-    DataSyncService dataSyncService;
-    @Autowired
-    OeExamStudentCloudService oeExamStudentCloudService;
-
-    private Boolean async() {
-        boolean async = PropertyHolder.getBoolean("$sync.async", true);
-        return async;
-    }
-
-    @PostMapping("syncCourse")
-    @Override
-    public SyncCourseResp syncCourse(@RequestBody SyncCourseReq req) {
-        cn.com.qmth.examcloud.global.api.request.SyncCourseReq r = new cn.com.qmth.examcloud.global.api.request.SyncCourseReq();
-        r.setCode(req.getCode());
-        r.setEnable(req.getEnable());
-        r.setId(req.getId());
-        r.setLevel(req.getLevel());
-        r.setName(req.getName());
-        r.setRootOrgId(req.getRootOrgId());
-        r.setSyncType(req.getSyncType());
-        dataSyncService.sync("syncCourse", r, async(), true);
-
-        SyncCourseResp resp = new SyncCourseResp();
-        return resp;
-    }
-
-    @PostMapping("syncOrg")
-    @Override
-    public SyncOrgResp syncOrg(@RequestBody SyncOrgReq req) {
-        cn.com.qmth.examcloud.global.api.request.SyncOrgReq r = new cn.com.qmth.examcloud.global.api.request.SyncOrgReq();
-        r.setEnable(req.getEnable());
-        r.setId(req.getId());
-        r.setName(req.getName());
-        r.setParentId(req.getParentId());
-        r.setRootId(req.getRootId());
-        r.setSyncType(req.getSyncType());
-        dataSyncService.sync("syncOrg", r, async(), true);
-
-        SyncOrgResp resp = new SyncOrgResp();
-        return resp;
-    }
-
-    @PostMapping("syncStudent")
-    @Override
-    public SyncStudentResp syncStudent(@RequestBody SyncStudentReq req) {
-
-        cn.com.qmth.examcloud.global.api.request.SyncStudentReq r = new cn.com.qmth.examcloud.global.api.request.SyncStudentReq();
-        r.setEnable(req.getEnable());
-        r.setId(req.getId());
-        r.setIdentityNumber(req.getIdentityNumber());
-        r.setName(req.getName());
-        r.setOrgCode(req.getOrgCode());
-        r.setOrgId(req.getOrgId());
-        r.setOrgName(req.getOrgName());
-        r.setPhoneNumber(req.getPhoneNumber());
-        r.setPhotoPath(req.getPhotoPath());
-        r.setRootOrgId(req.getRootOrgId());
-        r.setSecurityPhone(req.getSecurityPhone());
-        r.setStudentCodeList(req.getStudentCodeList());
-        r.setUnboundStudentCodeList(req.getUnboundStudentCodeList());
-        r.setSyncType(req.getSyncType());
-
-        dataSyncService.sync("syncStudent", r, async(), true);
-
-        //如果有需要解绑的学号信息,需要对学号进行解绑
-        if (null != r.getUnboundStudentCodeList() && !r.getUnboundStudentCodeList().isEmpty()) {
-            UnbindExamStudentReq unbindExamStudentReq = new UnbindExamStudentReq();
-            unbindExamStudentReq.setIdentityNumber(r.getIdentityNumber());
-            unbindExamStudentReq.setStudentCodeList(r.getStudentCodeList());
-            UnbindExamStudentResp unbindExamStudentResp = oeExamStudentCloudService.unbindExamStudent(unbindExamStudentReq);
-            if (!unbindExamStudentResp.getSuccess()) {
-                throw new StatusException("100001", unbindExamStudentResp.getMsg());
-            }
-        }
-        SyncStudentResp resp = new SyncStudentResp();
-        return resp;
-    }
-
-    @PostMapping("syncSpecialty")
-    @Override
-    public SyncSpecialtyResp syncSpecialty(@RequestBody SyncSpecialtyReq req) {
-
-        return null;
-    }
-
-    @PostMapping("syncExam")
-    @Override
-    public SyncExamResp syncExam(@RequestBody SyncExamReq req) {
-        cn.com.qmth.examcloud.global.api.request.SyncExamReq r = new cn.com.qmth.examcloud.global.api.request.SyncExamReq();
-        r.setId(req.getId());
-        r.setBeginTime(req.getBeginTime());
-        r.setDuration(req.getDuration());
-        r.setEnable(req.getEnable());
-        r.setEndTime(req.getEndTime());
-        r.setExamTimes(req.getExamTimes());
-        r.setExamType(req.getExamType());
-        r.setName(req.getName());
-        r.setRemark(req.getRemark());
-        r.setRootOrgId(req.getRootOrgId());
-        r.setRootOrgName(req.getRootOrgName());
-        r.setSyncType(req.getSyncType());
-
-        dataSyncService.sync("syncExam", r, async(), true);
-        SyncExamResp resp = new SyncExamResp();
-        return resp;
-    }
-
-    @PostMapping("syncExamStudent")
-    @Override
-    public SyncExamStudentResp syncExamStudent(@RequestBody SyncExamStudentReq req) {
-        cn.com.qmth.examcloud.global.api.request.SyncExamStudentReq r = new cn.com.qmth.examcloud.global.api.request.SyncExamStudentReq();
-        r.setSyncType(req.getSyncType());
-        r.setCourseCode(req.getCourseCode());
-        r.setCourseLevel(req.getCourseLevel());
-        r.setCourseName(req.getCourseName());
-        r.setExamId(req.getExamId());
-        r.setExamName(req.getExamName());
-        r.setId(req.getId());
-        r.setEnable(req.getEnable());
-        r.setIdentityNumber(req.getIdentityNumber());
-        r.setPaperType(req.getPaperType());
-        r.setRootOrgId(req.getRootOrgId());
-        r.setStudentCode(req.getStudentCode());
-        r.setStudentName(req.getStudentName());
-        r.setStudentId(req.getStudentId());
-        r.setOrgId(req.getOrgId());
-        r.setOrgName(req.getOrgName());
-        r.setOrgCode(req.getOrgCode());
-        r.setCourseId(req.getCourseId());
-        r.setSpecialtyName(req.getSpecialtyName());
-        r.setGrade(req.getGrade());
-        r.setRemark(req.getRemark());
-        r.setInfoCollector(req.getInfoCollector());
-        r.setExamSite(req.getExamSite());
-
-        dataSyncService.sync("syncExamStudent", r, async(), true);
-        SyncExamStudentResp resp = new SyncExamStudentResp();
-        return resp;
-    }
-
-    @PostMapping("syncUser")
-    @Override
-    public SyncUserResp syncUser(@RequestBody SyncUserReq req) {
-        cn.com.qmth.examcloud.global.api.request.SyncUserReq r = new cn.com.qmth.examcloud.global.api.request.SyncUserReq();
-        r.setEnable(req.getEnable());
-        r.setId(req.getId());
-        r.setLoginName(req.getLoginName());
-        r.setName(req.getName());
-        r.setOrgId(req.getOrgId());
-        r.setPassword(req.getPassword());
-        r.setPhoneNumber(req.getPhoneNumber());
-        r.setRootOrgId(req.getRootOrgId());
-        r.setSyncType(req.getSyncType());
-
-        dataSyncService.sync("syncUser", r, async(), true);
-        SyncUserResp resp = new SyncUserResp();
-        return resp;
-    }
+		implements
+			DataSyncCloudService {
+
+	private static final long serialVersionUID = -2880611326177571371L;
+
+	@Autowired
+	DataSyncService dataSyncService;
+
+	private Boolean async() {
+		boolean async = PropertyHolder.getBoolean("$sync.async", true);
+		return async;
+	}
+
+	@PostMapping("syncCourse")
+	@Override
+	public SyncCourseResp syncCourse(@RequestBody SyncCourseReq req) {
+		cn.com.qmth.examcloud.global.api.request.SyncCourseReq r = new cn.com.qmth.examcloud.global.api.request.SyncCourseReq();
+		r.setCode(req.getCode());
+		r.setEnable(req.getEnable());
+		r.setId(req.getId());
+		r.setLevel(req.getLevel());
+		r.setName(req.getName());
+		r.setRootOrgId(req.getRootOrgId());
+		r.setSyncType(req.getSyncType());
+		dataSyncService.sync("syncCourse", r, async(), true);
+
+		SyncCourseResp resp = new SyncCourseResp();
+		return resp;
+	}
+
+	@PostMapping("syncOrg")
+	@Override
+	public SyncOrgResp syncOrg(@RequestBody SyncOrgReq req) {
+		cn.com.qmth.examcloud.global.api.request.SyncOrgReq r = new cn.com.qmth.examcloud.global.api.request.SyncOrgReq();
+		r.setEnable(req.getEnable());
+		r.setId(req.getId());
+		r.setName(req.getName());
+		r.setParentId(req.getParentId());
+		r.setRootId(req.getRootId());
+		r.setSyncType(req.getSyncType());
+		dataSyncService.sync("syncOrg", r, async(), true);
+
+		SyncOrgResp resp = new SyncOrgResp();
+		return resp;
+	}
+
+	@PostMapping("syncStudent")
+	@Override
+	public SyncStudentResp syncStudent(@RequestBody SyncStudentReq req) {
+
+		cn.com.qmth.examcloud.global.api.request.SyncStudentReq r = new cn.com.qmth.examcloud.global.api.request.SyncStudentReq();
+		r.setEnable(req.getEnable());
+		r.setId(req.getId());
+		r.setIdentityNumber(req.getIdentityNumber());
+		r.setName(req.getName());
+		r.setOrgCode(req.getOrgCode());
+		r.setOrgId(req.getOrgId());
+		r.setOrgName(req.getOrgName());
+		r.setPhoneNumber(req.getPhoneNumber());
+		r.setPhotoPath(req.getPhotoPath());
+		r.setRootOrgId(req.getRootOrgId());
+		r.setSecurityPhone(req.getSecurityPhone());
+		r.setStudentCodeList(req.getStudentCodeList());
+		r.setUnboundStudentCodeList(req.getUnboundStudentCodeList());
+		r.setSyncType(req.getSyncType());
+
+		dataSyncService.sync("syncStudent", r, async(), true);
+		SyncStudentResp resp = new SyncStudentResp();
+		return resp;
+	}
+
+	@PostMapping("syncSpecialty")
+	@Override
+	public SyncSpecialtyResp syncSpecialty(@RequestBody SyncSpecialtyReq req) {
+
+		return null;
+	}
+
+	@PostMapping("syncExam")
+	@Override
+	public SyncExamResp syncExam(@RequestBody SyncExamReq req) {
+		cn.com.qmth.examcloud.global.api.request.SyncExamReq r = new cn.com.qmth.examcloud.global.api.request.SyncExamReq();
+		r.setId(req.getId());
+		r.setBeginTime(req.getBeginTime());
+		r.setDuration(req.getDuration());
+		r.setEnable(req.getEnable());
+		r.setEndTime(req.getEndTime());
+		r.setExamTimes(req.getExamTimes());
+		r.setExamType(req.getExamType());
+		r.setName(req.getName());
+		r.setRemark(req.getRemark());
+		r.setRootOrgId(req.getRootOrgId());
+		r.setRootOrgName(req.getRootOrgName());
+		r.setSyncType(req.getSyncType());
+
+		dataSyncService.sync("syncExam", r, async(), true);
+		SyncExamResp resp = new SyncExamResp();
+		return resp;
+	}
+
+	@PostMapping("syncExamStudent")
+	@Override
+	public SyncExamStudentResp syncExamStudent(@RequestBody SyncExamStudentReq req) {
+		cn.com.qmth.examcloud.global.api.request.SyncExamStudentReq r = new cn.com.qmth.examcloud.global.api.request.SyncExamStudentReq();
+		r.setSyncType(req.getSyncType());
+		r.setCourseCode(req.getCourseCode());
+		r.setCourseLevel(req.getCourseLevel());
+		r.setCourseName(req.getCourseName());
+		r.setExamId(req.getExamId());
+		r.setExamName(req.getExamName());
+		r.setId(req.getId());
+		r.setEnable(req.getEnable());
+		r.setIdentityNumber(req.getIdentityNumber());
+		r.setPaperType(req.getPaperType());
+		r.setRootOrgId(req.getRootOrgId());
+		r.setStudentCode(req.getStudentCode());
+		r.setStudentName(req.getStudentName());
+		r.setStudentId(req.getStudentId());
+		r.setOrgId(req.getOrgId());
+		r.setOrgName(req.getOrgName());
+		r.setOrgCode(req.getOrgCode());
+		r.setCourseId(req.getCourseId());
+		r.setSpecialtyName(req.getSpecialtyName());
+		r.setGrade(req.getGrade());
+		r.setRemark(req.getRemark());
+		r.setInfoCollector(req.getInfoCollector());
+		r.setExamSite(req.getExamSite());
+
+		dataSyncService.sync("syncExamStudent", r, async(), true);
+		SyncExamStudentResp resp = new SyncExamStudentResp();
+		return resp;
+	}
+
+	@PostMapping("syncUser")
+	@Override
+	public SyncUserResp syncUser(@RequestBody SyncUserReq req) {
+		cn.com.qmth.examcloud.global.api.request.SyncUserReq r = new cn.com.qmth.examcloud.global.api.request.SyncUserReq();
+		r.setEnable(req.getEnable());
+		r.setId(req.getId());
+		r.setLoginName(req.getLoginName());
+		r.setName(req.getName());
+		r.setOrgId(req.getOrgId());
+		r.setPassword(req.getPassword());
+		r.setPhoneNumber(req.getPhoneNumber());
+		r.setRootOrgId(req.getRootOrgId());
+		r.setSyncType(req.getSyncType());
+
+		dataSyncService.sync("syncUser", r, async(), true);
+		SyncUserResp resp = new SyncUserResp();
+		return resp;
+	}
 
 }