|
@@ -1,5 +1,6 @@
|
|
|
package cn.com.qmth.examcloud.core.examwork.api.provider;
|
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -20,6 +21,7 @@ import cn.com.qmth.examcloud.commons.api.response.SyncExamStudentResp;
|
|
|
import cn.com.qmth.examcloud.commons.api.response.SyncOrgResp;
|
|
|
import cn.com.qmth.examcloud.commons.api.response.SyncSpecialtyResp;
|
|
|
import cn.com.qmth.examcloud.commons.api.response.SyncStudentResp;
|
|
|
+import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.ExamStudentRepo;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -47,7 +49,28 @@ public class HandleSyncCloudServiceProvider extends ControllerSupport
|
|
|
@PostMapping("syncCourse")
|
|
|
@Override
|
|
|
public SyncCourseResp syncCourse(@RequestBody SyncCourseReq req) {
|
|
|
- return null;
|
|
|
+ String courseName = req.getName();
|
|
|
+ Long courseId = req.getId();
|
|
|
+ String courseLevel = req.getLevel();
|
|
|
+ Long rootOrgId = req.getRootOrgId();
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(courseName)) {
|
|
|
+ throw new StatusException("B-100001", "courseName is null");
|
|
|
+ }
|
|
|
+ if (null == courseId) {
|
|
|
+ throw new StatusException("B-100002", "courseId is null");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(courseLevel)) {
|
|
|
+ throw new StatusException("B-100003", "courseLevel is null");
|
|
|
+ }
|
|
|
+ if (null == rootOrgId) {
|
|
|
+ throw new StatusException("B-100004", "rootOrgId is null");
|
|
|
+ }
|
|
|
+
|
|
|
+ examStudentRepo.updateCourse(courseName, courseLevel, rootOrgId, courseId);
|
|
|
+
|
|
|
+ SyncCourseResp resp = new SyncCourseResp();
|
|
|
+ return resp;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "同步机构")
|
|
@@ -63,6 +86,14 @@ public class HandleSyncCloudServiceProvider extends ControllerSupport
|
|
|
public SyncStudentResp syncStudent(@RequestBody SyncStudentReq req) {
|
|
|
String name = req.getName();
|
|
|
Long id = req.getId();
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(name)) {
|
|
|
+ throw new StatusException("B-100001", "name is null");
|
|
|
+ }
|
|
|
+ if (null == id) {
|
|
|
+ throw new StatusException("B-100002", "id is null");
|
|
|
+ }
|
|
|
+
|
|
|
examStudentRepo.updateStudent(name, id);
|
|
|
return null;
|
|
|
}
|