|
@@ -1,380 +0,0 @@
|
|
|
-package cn.com.qmth.examcloud.exchange.outer.api.provider;
|
|
|
-
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
-import com.google.common.collect.Lists;
|
|
|
-
|
|
|
-import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
-import cn.com.qmth.examcloud.examwork.api.ExamCloudService;
|
|
|
-import cn.com.qmth.examcloud.examwork.api.ExamStudentCloudService;
|
|
|
-import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
|
|
|
-import cn.com.qmth.examcloud.examwork.api.bean.ExamStudentBean;
|
|
|
-import cn.com.qmth.examcloud.examwork.api.bean.ExamStudentBean4Reset;
|
|
|
-import cn.com.qmth.examcloud.examwork.api.request.GetExamReq;
|
|
|
-import cn.com.qmth.examcloud.examwork.api.request.ResetExamStudentReq;
|
|
|
-import cn.com.qmth.examcloud.examwork.api.request.SaveExamStudentReq;
|
|
|
-import cn.com.qmth.examcloud.examwork.api.request.UpdateExamStudentStatusReq;
|
|
|
-import cn.com.qmth.examcloud.examwork.api.response.GetExamResp;
|
|
|
-import cn.com.qmth.examcloud.examwork.api.response.ResetExamStudentResp;
|
|
|
-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.bean.ExamStudent4BatchBean;
|
|
|
-import cn.com.qmth.examcloud.exchange.outer.api.bean.ExamStudentStatus4BatchBean;
|
|
|
-import cn.com.qmth.examcloud.exchange.outer.api.bean.OuterExamStudent4ResetReqBean;
|
|
|
-import cn.com.qmth.examcloud.exchange.outer.api.bean.OuterExamStudent4ResetRespBean;
|
|
|
-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.OuterResetExamStudentReq;
|
|
|
-import cn.com.qmth.examcloud.exchange.outer.api.request.OuterSaveExamStudentReq;
|
|
|
-import cn.com.qmth.examcloud.exchange.outer.api.request.OuterUpdateExamStudentStatusReq;
|
|
|
-import cn.com.qmth.examcloud.exchange.outer.api.response.OuterBatchSaveExamStudentResp;
|
|
|
-import cn.com.qmth.examcloud.exchange.outer.api.response.OuterResetExamStudentResp;
|
|
|
-import cn.com.qmth.examcloud.exchange.outer.api.response.OuterSaveExamStudentResp;
|
|
|
-import cn.com.qmth.examcloud.exchange.outer.api.response.OuterUpdateExamStudentStatusResp;
|
|
|
-import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
|
-import cn.com.qmth.examcloud.web.support.StatusResponse;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import io.swagger.annotations.ApiParam;
|
|
|
-import io.swagger.annotations.ApiResponse;
|
|
|
-import io.swagger.annotations.ApiResponses;
|
|
|
-
|
|
|
-/**
|
|
|
- * 考生服务
|
|
|
- *
|
|
|
- * @author WANGWEI
|
|
|
- * @date 2018年7月2日
|
|
|
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
|
|
|
- */
|
|
|
-@Api(tags = "考生相关接口")
|
|
|
-@RestController
|
|
|
-@RequestMapping("${$rmp.cloud.exchange.outer}/examStudent")
|
|
|
-public class ExamStudentOuterServiceProvider extends ControllerSupport
|
|
|
- implements
|
|
|
- ExamStudentOuterService {
|
|
|
-
|
|
|
- private static final long serialVersionUID = -8252740695302763716L;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- ExamStudentCloudService examStudentCloudService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- ExamCloudService examCloudService;
|
|
|
-
|
|
|
- @ApiOperation(value = "保存考生信息")
|
|
|
- @ApiResponses({
|
|
|
- @ApiResponse(code = 200, message = "成功", response = OuterSaveExamStudentResp.class),
|
|
|
- @ApiResponse(code = 500, message = "系统异常(异常信息见响应体)", response = StatusResponse.class)})
|
|
|
- @PostMapping("saveExamStudent")
|
|
|
- @Override
|
|
|
- public OuterSaveExamStudentResp saveExamStudent(
|
|
|
- @RequestBody @ApiParam(required = true) OuterSaveExamStudentReq req) {
|
|
|
-
|
|
|
- if (!getEnterpriseRootOrgId().equals(req.getRootOrgId())) {
|
|
|
- throw new StatusException("1000001", "rootOrgId is wrong");
|
|
|
- }
|
|
|
-
|
|
|
- Long examId = req.getExamId();
|
|
|
- String examCode = req.getExamCode();
|
|
|
- String examName = req.getExamName();
|
|
|
- if (StringUtils.isNotBlank(examName)) {
|
|
|
- examCode = examName;
|
|
|
- }
|
|
|
-
|
|
|
- GetExamReq getExamReq = new GetExamReq();
|
|
|
- getExamReq.setId(examId);
|
|
|
- getExamReq.setCode(examCode);
|
|
|
- getExamReq.setRootOrgId(req.getRootOrgId());
|
|
|
- GetExamResp r = examCloudService.getExam(getExamReq);
|
|
|
- ExamBean examBean = r.getExamBean();
|
|
|
-
|
|
|
- SaveExamStudentReq request = new SaveExamStudentReq();
|
|
|
-
|
|
|
- request.setCourseCode(req.getCourseCode());
|
|
|
- request.setCourseLevel(req.getCourseLevel());
|
|
|
- request.setCourseName(req.getCourseName());
|
|
|
- request.setExamId(req.getExamId());
|
|
|
- request.setExamName(examBean.getName());
|
|
|
- request.setIdentityNumber(req.getIdentityNumber());
|
|
|
- request.setPaperType(req.getPaperType());
|
|
|
- request.setRootOrgId(req.getRootOrgId());
|
|
|
- request.setStudentCode(req.getStudentCode());
|
|
|
- request.setStudentName(req.getStudentName());
|
|
|
- request.setInfoCollector(req.getInfoCollector());
|
|
|
- request.setSpecialtyName(req.getSpecialtyName());
|
|
|
- request.setExamSite(req.getExamSite());
|
|
|
- request.setGrade(req.getGrade());
|
|
|
- request.setRemark(req.getRemark());
|
|
|
-
|
|
|
- request.setExt1(req.getExt1());
|
|
|
- request.setExt2(req.getExt2());
|
|
|
- request.setExt3(req.getExt3());
|
|
|
- request.setExt4(req.getExt4());
|
|
|
- request.setExt5(req.getExt5());
|
|
|
-
|
|
|
- SaveExamStudentResp response = examStudentCloudService.saveExamStudent(request);
|
|
|
-
|
|
|
- ExamStudentBean sb = response.getExamStudentBean();
|
|
|
-
|
|
|
- OuterSaveExamStudentResp resp = new OuterSaveExamStudentResp();
|
|
|
- OuterExamStudentBean bean = new OuterExamStudentBean();
|
|
|
- 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.setPaperType(sb.getPaperType());
|
|
|
- bean.setRootOrgId(sb.getRootOrgId());
|
|
|
- bean.setStudentCode(sb.getStudentCode());
|
|
|
- bean.setStudentName(sb.getStudentName());
|
|
|
-
|
|
|
- resp.setExamStudentBean(bean);
|
|
|
-
|
|
|
- return resp;
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "批量保存考生信息")
|
|
|
- @ApiResponses({
|
|
|
- @ApiResponse(code = 200, message = "成功", response = OuterBatchSaveExamStudentResp.class),
|
|
|
- @ApiResponse(code = 500, message = "系统异常(异常信息见响应体)", response = StatusResponse.class)})
|
|
|
- @PostMapping("batchSaveExamStudent")
|
|
|
- @Override
|
|
|
- public OuterBatchSaveExamStudentResp batchSaveExamStudent(
|
|
|
- @RequestBody @ApiParam(required = true) OuterBatchSaveExamStudentReq req) {
|
|
|
-
|
|
|
- if (!getEnterpriseRootOrgId().equals(req.getRootOrgId())) {
|
|
|
- throw new StatusException("1000001", "rootOrgId is wrong");
|
|
|
- }
|
|
|
-
|
|
|
- Long examId = req.getExamId();
|
|
|
- String examCode = req.getExamCode();
|
|
|
- String examName = req.getExamName();
|
|
|
- if (StringUtils.isNotBlank(examName)) {
|
|
|
- examCode = examName;
|
|
|
- }
|
|
|
-
|
|
|
- GetExamReq getExamReq = new GetExamReq();
|
|
|
- getExamReq.setId(examId);
|
|
|
- getExamReq.setCode(examCode);
|
|
|
- getExamReq.setRootOrgId(req.getRootOrgId());
|
|
|
- GetExamResp r = examCloudService.getExam(getExamReq);
|
|
|
- ExamBean examBean = r.getExamBean();
|
|
|
-
|
|
|
- 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(examBean.getName());
|
|
|
- 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);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- OuterBatchSaveExamStudentResp resp = new OuterBatchSaveExamStudentResp();
|
|
|
- resp.setSuccessList(successList);
|
|
|
- resp.setFailureList(failureList);
|
|
|
- return resp;
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "更新考生状态", hidden = true)
|
|
|
- @ApiResponses({
|
|
|
- @ApiResponse(code = 200, message = "成功", response = OuterBatchSaveExamStudentResp.class),
|
|
|
- @ApiResponse(code = 500, message = "系统异常(异常信息见响应体)", response = StatusResponse.class)})
|
|
|
- @PostMapping("updateExamStudentStatus")
|
|
|
- @Override
|
|
|
- public OuterUpdateExamStudentStatusResp updateExamStudentStatus(
|
|
|
- @RequestBody @ApiParam(required = true) OuterUpdateExamStudentStatusReq req) {
|
|
|
-
|
|
|
- if (!getEnterpriseRootOrgId().equals(req.getRootOrgId())) {
|
|
|
- throw new StatusException("1000001", "rootOrgId is wrong");
|
|
|
- }
|
|
|
-
|
|
|
- Long examId = req.getExamId();
|
|
|
- String examCode = req.getExamCode();
|
|
|
- String examName = req.getExamName();
|
|
|
- if (StringUtils.isNotBlank(examName)) {
|
|
|
- examCode = examName;
|
|
|
- }
|
|
|
-
|
|
|
- GetExamReq getExamReq = new GetExamReq();
|
|
|
- getExamReq.setId(examId);
|
|
|
- getExamReq.setCode(examCode);
|
|
|
- getExamReq.setRootOrgId(req.getRootOrgId());
|
|
|
- GetExamResp r = examCloudService.getExam(getExamReq);
|
|
|
- ExamBean examBean = r.getExamBean();
|
|
|
-
|
|
|
- UpdateExamStudentStatusReq uessReq = new UpdateExamStudentStatusReq();
|
|
|
- uessReq.setCourseCode(req.getCourseCode());
|
|
|
- uessReq.setCourseId(req.getCourseId());
|
|
|
- uessReq.setEnable(req.getEnable());
|
|
|
- uessReq.setExamName(examBean.getName());
|
|
|
- uessReq.setExamCode(req.getExamCode());
|
|
|
- uessReq.setExamId(req.getExamId());
|
|
|
- uessReq.setIdentityNumber(req.getIdentityNumber());
|
|
|
- uessReq.setRootOrgId(req.getRootOrgId());
|
|
|
- uessReq.setStudentId(req.getStudentId());
|
|
|
-
|
|
|
- examStudentCloudService.updateExamStudentStatus(uessReq);
|
|
|
-
|
|
|
- OuterUpdateExamStudentStatusResp resp = new OuterUpdateExamStudentStatusResp();
|
|
|
- return resp;
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "重置考生", hidden = true)
|
|
|
- @ApiResponses({
|
|
|
- @ApiResponse(code = 200, message = "成功", response = OuterResetExamStudentResp.class),
|
|
|
- @ApiResponse(code = 500, message = "系统异常(异常信息见响应体)", response = StatusResponse.class)})
|
|
|
- @PostMapping("resetExamStudent")
|
|
|
- @Override
|
|
|
- public OuterResetExamStudentResp resetExamStudent(
|
|
|
- @RequestBody @ApiParam(required = true) OuterResetExamStudentReq req) {
|
|
|
-
|
|
|
- if (!getEnterpriseRootOrgId().equals(req.getRootOrgId())) {
|
|
|
- throw new StatusException("1000001", "rootOrgId is wrong");
|
|
|
- }
|
|
|
-
|
|
|
- Long examId = req.getExamId();
|
|
|
- String examCode = req.getExamCode();
|
|
|
- String examName = req.getExamName();
|
|
|
- if (StringUtils.isNotBlank(examName)) {
|
|
|
- examCode = examName;
|
|
|
- }
|
|
|
-
|
|
|
- GetExamReq getExamReq = new GetExamReq();
|
|
|
- getExamReq.setId(examId);
|
|
|
- getExamReq.setCode(examCode);
|
|
|
- getExamReq.setRootOrgId(req.getRootOrgId());
|
|
|
- GetExamResp r = examCloudService.getExam(getExamReq);
|
|
|
- ExamBean examBean = r.getExamBean();
|
|
|
-
|
|
|
- ResetExamStudentReq resReq = new ResetExamStudentReq();
|
|
|
- resReq.setExamName(examBean.getName());
|
|
|
- resReq.setExamCode(req.getExamCode());
|
|
|
- resReq.setExamId(req.getExamId());
|
|
|
- resReq.setIdentityNumber(req.getIdentityNumber());
|
|
|
- resReq.setRootOrgId(req.getRootOrgId());
|
|
|
- resReq.setStudentCode(req.getStudentCode());
|
|
|
- resReq.setStudentName(req.getStudentName());
|
|
|
-
|
|
|
- List<ExamStudentBean4Reset> examStudentList = Lists.newArrayList();
|
|
|
- resReq.setExamStudentList(examStudentList);
|
|
|
-
|
|
|
- List<OuterExamStudent4ResetReqBean> outerExamStudentList = req.getExamStudentList();
|
|
|
- for (OuterExamStudent4ResetReqBean cur : outerExamStudentList) {
|
|
|
- ExamStudentBean4Reset b = new ExamStudentBean4Reset();
|
|
|
- examStudentList.add(b);
|
|
|
-
|
|
|
- b.setCourseCode(cur.getCourseCode());
|
|
|
- b.setCourseLevel(cur.getCourseLevel());
|
|
|
- b.setCourseName(cur.getCourseName());
|
|
|
- b.setExamSite(cur.getExamSite());
|
|
|
- b.setExt1(cur.getExt1());
|
|
|
- b.setExt2(cur.getExt2());
|
|
|
- b.setExt3(cur.getExt3());
|
|
|
- b.setExt4(cur.getExt4());
|
|
|
- b.setExt5(cur.getExt5());
|
|
|
- b.setGrade(cur.getGrade());
|
|
|
- b.setInfoCollector(cur.getInfoCollector());
|
|
|
- b.setPaperType(cur.getPaperType());
|
|
|
- b.setRemark(cur.getRemark());
|
|
|
- b.setSpecialtyName(cur.getSpecialtyName());
|
|
|
- }
|
|
|
-
|
|
|
- ResetExamStudentResp resResp = examStudentCloudService.resetExamStudent(resReq);
|
|
|
-
|
|
|
- List<ExamStudentBean> savedExamStudentList = resResp.getExamStudentList();
|
|
|
-
|
|
|
- List<OuterExamStudent4ResetRespBean> outerList = Lists.newArrayList();
|
|
|
-
|
|
|
- for (ExamStudentBean cur : savedExamStudentList) {
|
|
|
- OuterExamStudent4ResetRespBean b = new OuterExamStudent4ResetRespBean();
|
|
|
- outerList.add(b);
|
|
|
-
|
|
|
- b.setCourseCode(cur.getCourseCode());
|
|
|
- b.setCourseId(cur.getCourseId());
|
|
|
- b.setCourseLevel(cur.getCourseLevel());
|
|
|
- b.setCourseName(cur.getCourseName());
|
|
|
- b.setExamId(cur.getExamId());
|
|
|
- b.setExamName(cur.getExamName());
|
|
|
- b.setExamSite(cur.getExamSite());
|
|
|
- b.setGrade(cur.getGrade());
|
|
|
- b.setId(cur.getId());
|
|
|
- b.setIdentityNumber(cur.getIdentityNumber());
|
|
|
- b.setInfoCollector(cur.getInfoCollector());
|
|
|
- b.setOrgCode(cur.getOrgCode());
|
|
|
- b.setOrgId(cur.getOrgId());
|
|
|
- b.setOrgName(cur.getOrgName());
|
|
|
- b.setPaperType(cur.getPaperType());
|
|
|
- b.setRemark(cur.getRemark());
|
|
|
- b.setRootOrgId(cur.getRootOrgId());
|
|
|
- b.setSpecialtyName(cur.getSpecialtyName());
|
|
|
- b.setStudentCode(cur.getStudentCode());
|
|
|
- b.setStudentId(cur.getStudentId());
|
|
|
- b.setStudentName(cur.getStudentName());
|
|
|
-
|
|
|
- }
|
|
|
- OuterResetExamStudentResp resp = new OuterResetExamStudentResp();
|
|
|
- resp.setExamStudentList(outerList);
|
|
|
- return resp;
|
|
|
- }
|
|
|
-
|
|
|
-}
|