|
@@ -1,11 +1,15 @@
|
|
package cn.com.qmth.examcloud.exchange.outer.api.provider;
|
|
package cn.com.qmth.examcloud.exchange.outer.api.provider;
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
|
+
|
|
import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
import cn.com.qmth.examcloud.commons.web.support.StatusResponse;
|
|
import cn.com.qmth.examcloud.commons.web.support.StatusResponse;
|
|
@@ -14,6 +18,8 @@ import cn.com.qmth.examcloud.examwork.api.bean.ExamStudentBean;
|
|
import cn.com.qmth.examcloud.examwork.api.request.SaveExamStudentReq;
|
|
import cn.com.qmth.examcloud.examwork.api.request.SaveExamStudentReq;
|
|
import cn.com.qmth.examcloud.examwork.api.response.SaveExamStudentResp;
|
|
import cn.com.qmth.examcloud.examwork.api.response.SaveExamStudentResp;
|
|
import cn.com.qmth.examcloud.exchange.outer.api.ExamStudentOuterService;
|
|
import cn.com.qmth.examcloud.exchange.outer.api.ExamStudentOuterService;
|
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.bean.ExamStudent4BatchBean;
|
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.bean.ExamStudentStatus4BatchBean;
|
|
import cn.com.qmth.examcloud.exchange.outer.api.bean.OuterExamStudentBean;
|
|
import cn.com.qmth.examcloud.exchange.outer.api.bean.OuterExamStudentBean;
|
|
import cn.com.qmth.examcloud.exchange.outer.api.request.OuterBatchSaveExamStudentReq;
|
|
import cn.com.qmth.examcloud.exchange.outer.api.request.OuterBatchSaveExamStudentReq;
|
|
import cn.com.qmth.examcloud.exchange.outer.api.request.OuterSaveExamStudentReq;
|
|
import cn.com.qmth.examcloud.exchange.outer.api.request.OuterSaveExamStudentReq;
|
|
@@ -103,10 +109,83 @@ public class ExamStudentOuterServiceProvider extends ControllerSupport
|
|
return resp;
|
|
return resp;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ApiOperation(value = "批量保存考生信息", httpMethod = "POST")
|
|
|
|
+ @ApiResponses({
|
|
|
|
+ @ApiResponse(code = 200, message = "成功", response = BatchOuterSaveExamStudentResp.class),
|
|
|
|
+ @ApiResponse(code = 500, message = "系统异常(异常信息见响应体)", response = StatusResponse.class)})
|
|
|
|
+ @PostMapping("batchSaveExamStudent")
|
|
@Override
|
|
@Override
|
|
- public BatchOuterSaveExamStudentResp batchSaveExamStudent(OuterBatchSaveExamStudentReq req) {
|
|
|
|
- // TODO Auto-generated method stub
|
|
|
|
- return null;
|
|
|
|
|
|
+ public BatchOuterSaveExamStudentResp batchSaveExamStudent(
|
|
|
|
+ @RequestBody @ApiParam(required = true) OuterBatchSaveExamStudentReq req) {
|
|
|
|
+ if (!getSecurityRootOrgId().equals(req.getRootOrgId())) {
|
|
|
|
+ throw new StatusException("EX-1000001", "rootOrgId is wrong");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<ExamStudent4BatchBean> examStudentList = req.getExamStudentList();
|
|
|
|
+
|
|
|
|
+ List<ExamStudentStatus4BatchBean> successList = Lists.newArrayList();
|
|
|
|
+ List<ExamStudentStatus4BatchBean> failureList = Lists.newArrayList();
|
|
|
|
+
|
|
|
|
+ for (ExamStudent4BatchBean cur : examStudentList) {
|
|
|
|
+ SaveExamStudentReq request = new SaveExamStudentReq();
|
|
|
|
+
|
|
|
|
+ request.setCourseCode(cur.getCourseCode());
|
|
|
|
+ request.setCourseLevel(cur.getCourseLevel());
|
|
|
|
+ request.setCourseName(cur.getCourseName());
|
|
|
|
+ request.setExamId(req.getExamId());
|
|
|
|
+ request.setExamName(req.getExamName());
|
|
|
|
+ request.setIdentityNumber(cur.getIdentityNumber());
|
|
|
|
+ request.setPaperType(cur.getPaperType());
|
|
|
|
+ request.setRootOrgId(req.getRootOrgId());
|
|
|
|
+ request.setStudentCode(cur.getStudentCode());
|
|
|
|
+ request.setStudentName(cur.getStudentName());
|
|
|
|
+ request.setInfoCollector(cur.getInfoCollector());
|
|
|
|
+ request.setSpecialtyName(cur.getSpecialtyName());
|
|
|
|
+ request.setExamSite(cur.getExamSite());
|
|
|
|
+ request.setGrade(cur.getGrade());
|
|
|
|
+ request.setRemark(cur.getRemark());
|
|
|
|
+
|
|
|
|
+ request.setExt1(cur.getExt1());
|
|
|
|
+ request.setExt2(cur.getExt2());
|
|
|
|
+ request.setExt3(cur.getExt3());
|
|
|
|
+ request.setExt4(cur.getExt4());
|
|
|
|
+ request.setExt5(cur.getExt5());
|
|
|
|
+
|
|
|
|
+ ExamStudentStatus4BatchBean bean = new ExamStudentStatus4BatchBean();
|
|
|
|
+ try {
|
|
|
|
+ SaveExamStudentResp response = examStudentCloudService.saveExamStudent(request);
|
|
|
|
+ ExamStudentBean sb = response.getExamStudentBean();
|
|
|
|
+
|
|
|
|
+ bean.setCourseCode(sb.getCourseCode());
|
|
|
|
+ bean.setCourseLevel(sb.getCourseLevel());
|
|
|
|
+ bean.setCourseName(sb.getCourseName());
|
|
|
|
+ bean.setExamId(sb.getExamId());
|
|
|
|
+ bean.setExamName(sb.getExamName());
|
|
|
|
+ bean.setIdentityNumber(sb.getIdentityNumber());
|
|
|
|
+ bean.setStudentCode(sb.getStudentCode());
|
|
|
|
+ bean.setName(sb.getStudentName());
|
|
|
|
+ successList.add(bean);
|
|
|
|
+
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+
|
|
|
|
+ bean.setCourseCode(cur.getCourseCode());
|
|
|
|
+ bean.setCourseLevel(cur.getCourseLevel());
|
|
|
|
+ bean.setCourseName(cur.getCourseName());
|
|
|
|
+ bean.setExamId(req.getExamId());
|
|
|
|
+ bean.setExamName(req.getExamName());
|
|
|
|
+ bean.setIdentityNumber(cur.getIdentityNumber());
|
|
|
|
+ bean.setStudentCode(cur.getStudentCode());
|
|
|
|
+ bean.setName(cur.getStudentName());
|
|
|
|
+ failureList.add(bean);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BatchOuterSaveExamStudentResp resp = new BatchOuterSaveExamStudentResp();
|
|
|
|
+ resp.setSuccessList(successList);
|
|
|
|
+ resp.setFailureList(failureList);
|
|
|
|
+ return resp;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|