diff --git a/src/main/java/cn/com/tenlion/controller/api/examination/ExaminationController.java b/src/main/java/cn/com/tenlion/controller/api/examination/ExaminationController.java index fb7ebf4..962419d 100644 --- a/src/main/java/cn/com/tenlion/controller/api/examination/ExaminationController.java +++ b/src/main/java/cn/com/tenlion/controller/api/examination/ExaminationController.java @@ -111,7 +111,7 @@ public class ExaminationController extends DefaultBaseController { @ApiOperation(value = "获取随机监考老师", notes = "获取随机监考老师接口") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("sel-exam-user") - public ExaminationDTO selExamUser() { + public ExaminationDTO selExamUser() throws Exception { Map params = requestParams(); return examinationService.selExamUser(params); } diff --git a/src/main/java/cn/com/tenlion/pojo/bos/examapply/ExamApplyBO.java b/src/main/java/cn/com/tenlion/pojo/bos/examapply/ExamApplyBO.java index d44598f..b7fca2e 100644 --- a/src/main/java/cn/com/tenlion/pojo/bos/examapply/ExamApplyBO.java +++ b/src/main/java/cn/com/tenlion/pojo/bos/examapply/ExamApplyBO.java @@ -25,6 +25,7 @@ public class ExamApplyBO { private String paymentVoucherNum; private String examApplyNum; private Integer status; + private Integer userStatus; public String getExamApplyId() { return examApplyId; @@ -129,4 +130,12 @@ public class ExamApplyBO { public void setStatus(Integer status) { this.status = status; } + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } } diff --git a/src/main/java/cn/com/tenlion/pojo/dtos/examapply/ExamApplyDTO.java b/src/main/java/cn/com/tenlion/pojo/dtos/examapply/ExamApplyDTO.java index 08a2157..e50e63f 100644 --- a/src/main/java/cn/com/tenlion/pojo/dtos/examapply/ExamApplyDTO.java +++ b/src/main/java/cn/com/tenlion/pojo/dtos/examapply/ExamApplyDTO.java @@ -40,6 +40,8 @@ public class ExamApplyDTO { private String examApplyNum; @ApiModelProperty(name = "status", value = "考场分配状态。0:未分配,1:已分配") private Integer status; + @ApiModelProperty(name = "userStatus", value = "监考老师分配状态。0:未分配,1:已分配") + private Integer userStatus; public String getExamApplyId() { return examApplyId; @@ -144,4 +146,12 @@ public class ExamApplyDTO { public void setStatus(Integer status) { this.status = status; } + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } } diff --git a/src/main/java/cn/com/tenlion/pojo/pos/examapply/ExamApplyPO.java b/src/main/java/cn/com/tenlion/pojo/pos/examapply/ExamApplyPO.java index 1b9a2bd..6a0cf20 100644 --- a/src/main/java/cn/com/tenlion/pojo/pos/examapply/ExamApplyPO.java +++ b/src/main/java/cn/com/tenlion/pojo/pos/examapply/ExamApplyPO.java @@ -23,6 +23,7 @@ public class ExamApplyPO { private String paymentVoucherNum; private String examApplyNum; private Integer status; + private Integer userStatus; public String getExamApplyId() { return examApplyId; @@ -127,4 +128,12 @@ public class ExamApplyPO { public void setStatus(Integer status) { this.status = status; } + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } } diff --git a/src/main/java/cn/com/tenlion/pojo/vos/examapply/ExamApplyVO.java b/src/main/java/cn/com/tenlion/pojo/vos/examapply/ExamApplyVO.java index 071e4f1..efc2a61 100644 --- a/src/main/java/cn/com/tenlion/pojo/vos/examapply/ExamApplyVO.java +++ b/src/main/java/cn/com/tenlion/pojo/vos/examapply/ExamApplyVO.java @@ -46,6 +46,8 @@ public class ExamApplyVO { private Integer planPersonNum; @ApiModelProperty(name = "status", value = "考场分配状态。0:未分配,1:已分配") private Integer status; + @ApiModelProperty(name = "userStatus", value = "监考老师分配状态。0:未分配,1:已分配") + private Integer userStatus; public String getExamApplyId() { return examApplyId; @@ -166,4 +168,12 @@ public class ExamApplyVO { public void setStatus(Integer status) { this.status = status; } + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } } diff --git a/src/main/java/cn/com/tenlion/service/examapply/impl/ExamApplyServiceImpl.java b/src/main/java/cn/com/tenlion/service/examapply/impl/ExamApplyServiceImpl.java index 114aed3..debe8dc 100644 --- a/src/main/java/cn/com/tenlion/service/examapply/impl/ExamApplyServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/examapply/impl/ExamApplyServiceImpl.java @@ -100,7 +100,7 @@ public class ExamApplyServiceImpl extends DefaultBaseService implements IExamApp } private void updateStatus(String planId, String token, ExamApplyVO examApplyVO) { - Map params = new HashMap<>(1); + Map params = HashMapUtil.beanToMap(examApplyVO); params.put("examId", planId); if (StringUtils.isBlank(token)) { setUpdateInfo(params); diff --git a/src/main/java/cn/com/tenlion/service/examination/IExaminationService.java b/src/main/java/cn/com/tenlion/service/examination/IExaminationService.java index d9fd9c8..850467f 100644 --- a/src/main/java/cn/com/tenlion/service/examination/IExaminationService.java +++ b/src/main/java/cn/com/tenlion/service/examination/IExaminationService.java @@ -192,7 +192,7 @@ public interface IExaminationService { * @return * @throws SearchException */ - ExaminationDTO selExamUser(Map params) throws SearchException; + ExaminationDTO selExamUser(Map params) throws Exception; /** * 获取剩余监考老师列表 diff --git a/src/main/java/cn/com/tenlion/service/examination/impl/ExaminationServiceImpl.java b/src/main/java/cn/com/tenlion/service/examination/impl/ExaminationServiceImpl.java index 3623362..5c7b5f8 100644 --- a/src/main/java/cn/com/tenlion/service/examination/impl/ExaminationServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/examination/impl/ExaminationServiceImpl.java @@ -2,11 +2,17 @@ package cn.com.tenlion.service.examination.impl; import cn.com.tenlion.dao.examination.IExaminationDao; import cn.com.tenlion.pojo.bos.examination.ExaminationBO; +import cn.com.tenlion.pojo.dtos.distribution.DistributionDTO; +import cn.com.tenlion.pojo.dtos.distributionfield.DistributionFieldDTO; import cn.com.tenlion.pojo.dtos.examination.ExaminationDTO; import cn.com.tenlion.pojo.dtos.examinationhis.ExaminationHisDTO; import cn.com.tenlion.pojo.pos.examination.ExaminationPO; +import cn.com.tenlion.pojo.vos.distributionfield.DistributionFieldSaveVO; import cn.com.tenlion.pojo.vos.examination.ExaminationVO; import cn.com.tenlion.service.examination.IExaminationService; +import cn.com.tenlion.service.examination.distribution.IDistributionService; +import cn.com.tenlion.service.examination.distributioncard.impl.DistributionCardServiceImpl; +import cn.com.tenlion.service.examination.distributionfield.IDistributionFieldService; import ink.wgink.common.base.DefaultBaseService; import ink.wgink.exceptions.SearchException; import ink.wgink.pojo.ListPage; @@ -33,6 +39,12 @@ public class ExaminationServiceImpl extends DefaultBaseService implements IExami @Autowired private IExaminationDao examinationDao; + @Autowired + private IDistributionFieldService distributionFieldService; + @Autowired + private IDistributionService distributionService; + @Autowired + private DistributionCardServiceImpl distributionCardService; @Override public void save(ExaminationVO examinationVO) { @@ -170,43 +182,48 @@ public class ExaminationServiceImpl extends DefaultBaseService implements IExami } @Override - public ExaminationDTO selExamUser(Map params) throws SearchException { - if(com.alibaba.excel.util.StringUtils.isEmpty(params.get("startTime"))) { - throw new SearchException("请传入考试开始时间"); - } - if(com.alibaba.excel.util.StringUtils.isEmpty(params.get("endTime"))) { - throw new SearchException("请传入考试结束时间"); - } - if(com.alibaba.excel.util.StringUtils.isEmpty(params.get("examinationRoomId"))) { - throw new SearchException("请传入考场ID"); - } + public ExaminationDTO selExamUser(Map params) throws Exception { if(com.alibaba.excel.util.StringUtils.isEmpty(params.get("examId"))) { throw new SearchException("请传入考试ID"); } - // 判断当前考试是否存在在监考记录表中,存在,获取监考老师信息,后续做修改操作,否则,做新增操作 - ExaminationHisDTO examinationHisDTO = examinationDao.hasExam(params); - // 先获取所有考务人员 - List examinationDTOList = list(params); - if(null != examinationDTOList && examinationDTOList.size() > 0) { - // 获取考试日期(精确到天) - String startDay = params.get("startTime").toString(); - startDay = startDay.substring(0, 10); - params.put("startDay", startDay); - int randomNum = (int)(Math.random() * examinationDTOList.size()); - ExaminationDTO examinationDTO = examinationDTOList.get(randomNum); - params.put("startDay", startDay); - params.put("examinationId", examinationDTO.getExaminationId()); - if(null != examinationHisDTO) { - if(examinationHisDTO.getExaminationId().equals(examinationDTO.getExaminationId())) { - examinationDTO = removeAndReturnUser(randomNum, examinationDTO, examinationDTOList); - params.put("examinationId", examinationDTO.getExaminationId()); - return updateLogic(randomNum, examinationDTO, examinationDTOList, params); + // 获取考场分配信息 + List distributionFieldDTOList = distributionFieldService.listByPlanId(params.get("examId").toString()); + if(null != distributionFieldDTOList && distributionFieldDTOList.size() > 0) { + for(DistributionFieldDTO distributionFieldDTO: distributionFieldDTOList) { + // 获取考场详细信息 + DistributionDTO distributionDTO = distributionService.get(params.get("examId").toString()); + // 判断当前考试是否存在在监考记录表中,存在,获取监考老师信息,后续做修改操作,否则,做新增操作 + ExaminationHisDTO examinationHisDTO = examinationDao.hasExam(params); + // 先获取所有考务人员 + List examinationDTOList = list(params); + if(null != examinationDTOList && examinationDTOList.size() > 0) { + if(null != distributionDTO) { + params.put("startTime", distributionDTO.getDistributionAllotTime()); + params.put("endTime", distributionDTO.getDistributionAllotEndTime()); + params.put("examinationRoomId", distributionFieldDTO.getFieldId()); + // 获取考试日期(精确到天) + String startDay = distributionDTO.getDistributionAllotTime(); + startDay = startDay.substring(0, 10); + params.put("startDay", startDay); + int randomNum = (int)(Math.random() * examinationDTOList.size()); + ExaminationDTO examinationDTO = examinationDTOList.get(randomNum); + params.put("startDay", startDay); + params.put("examinationId", examinationDTO.getExaminationId()); + if(null != examinationHisDTO) { + if(examinationHisDTO.getExaminationId().equals(examinationDTO.getExaminationId())) { + examinationDTO = removeAndReturnUser(randomNum, examinationDTO, examinationDTOList); + params.put("examinationId", examinationDTO.getExaminationId()); + return updateLogic(randomNum, examinationDTO, examinationDTOList, params, distributionFieldDTO); + } + return updateLogic(randomNum, examinationDTO, examinationDTOList, params, distributionFieldDTO); + } + return insertLogic(randomNum, examinationDTO, examinationDTOList, params, distributionFieldDTO); + } } - return updateLogic(randomNum, examinationDTO, examinationDTOList, params); + throw new SearchException("暂无考务人员数据"); } - return insertLogic(randomNum, examinationDTO, examinationDTOList, params); } - throw new SearchException("暂无考务人员数据"); + return null; } @Override @@ -265,32 +282,40 @@ public class ExaminationServiceImpl extends DefaultBaseService implements IExami return examinationDTO; } - private ExaminationDTO updateLogic(Integer randomNum, ExaminationDTO examinationDTO, List examinationDTOList, Map params) { + private ExaminationDTO updateLogic(Integer randomNum, ExaminationDTO examinationDTO, List examinationDTOList, Map params, DistributionFieldDTO distributionFieldDTO) throws Exception { Integer count = hasUser(params); if(count > 0) { examinationDTO = removeAndReturnUser(randomNum, examinationDTO, examinationDTOList); params.put("examinationId", examinationDTO.getExaminationId()); - return updateLogic(randomNum, examinationDTO, examinationDTOList, params); + return updateLogic(randomNum, examinationDTO, examinationDTOList, params, distributionFieldDTO); }else { params.put("examinationId", examinationDTO.getExaminationId()); setUpdateInfo(params); examinationDao.updateExamHis(params); + DistributionFieldSaveVO distributionFieldSaveVO = new DistributionFieldSaveVO(); + distributionFieldSaveVO.setInvigilatorId(examinationDTO.getExaminationId()); + distributionFieldService.update(distributionFieldDTO.getDistributionFieldId(), distributionFieldSaveVO); + distributionCardService.buildingPictures(params.get("examId").toString(), params.get("examId").toString()); return examinationDTO; } } - private ExaminationDTO insertLogic(Integer randomNum, ExaminationDTO examinationDTO, List examinationDTOList, Map params) { + private ExaminationDTO insertLogic(Integer randomNum, ExaminationDTO examinationDTO, List examinationDTOList, Map params, DistributionFieldDTO distributionFieldDTO) throws Exception { Integer count = hasUser(params); if(count > 0) { examinationDTO = removeAndReturnUser(randomNum, examinationDTO, examinationDTOList); params.put("examinationId", examinationDTO.getExaminationId()); - return insertLogic(randomNum, examinationDTO, examinationDTOList, params); + return insertLogic(randomNum, examinationDTO, examinationDTOList, params, distributionFieldDTO); }else { String examinationHisId = UUIDUtil.getUUID(); params.put("examinationHisId", examinationHisId); params.put("examinationId", examinationDTO.getExaminationId()); setSaveInfo(params); examinationDao.saveExamHis(params); + DistributionFieldSaveVO distributionFieldSaveVO = new DistributionFieldSaveVO(); + distributionFieldSaveVO.setInvigilatorId(examinationDTO.getExaminationId()); + distributionFieldService.update(distributionFieldDTO.getDistributionFieldId(), distributionFieldSaveVO); + distributionCardService.buildingPictures(params.get("examId").toString(), params.get("examId").toString()); return examinationDTO; } } diff --git a/src/main/resources/mybatis/mapper/examapply/exam-apply-mapper.xml b/src/main/resources/mybatis/mapper/examapply/exam-apply-mapper.xml index 63b5c39..3dcb48f 100644 --- a/src/main/resources/mybatis/mapper/examapply/exam-apply-mapper.xml +++ b/src/main/resources/mybatis/mapper/examapply/exam-apply-mapper.xml @@ -16,6 +16,7 @@ + @@ -32,6 +33,7 @@ + @@ -48,6 +50,7 @@ + @@ -62,6 +65,7 @@ payment_voucher, payment_voucher_num, status, + user_status, gmt_create, creator, gmt_modified, @@ -77,6 +81,7 @@ #{paymentVoucher}, #{paymentVoucherNum}, #{status}, + #{userStatus}, #{gmtCreate}, #{creator}, #{gmtModified}, @@ -151,6 +156,9 @@ status = #{status}, + + + user_status = #{userStatus}, gmt_modified = #{gmtModified}, modifier = #{modifier}, @@ -177,6 +185,7 @@ t1.payment_voucher_num, t1.exam_apply_num, t1.status, + t1.user_status, t1.exam_apply_id FROM management_exam_apply t1 @@ -203,6 +212,7 @@ t1.payment_voucher, t1.payment_voucher_num, t1.status, + t1.user_status, t1.exam_apply_num FROM management_exam_apply t1 @@ -229,6 +239,7 @@ t1.payment_voucher, t1.payment_voucher_num, t1.status, + t1.user_status, t1.exam_apply_num FROM management_exam_apply t1 @@ -256,6 +267,7 @@ t1.payment_voucher_num, t1.exam_apply_num, t1.status, + t1.user_status, 1 FROM management_exam_apply t1 @@ -299,6 +311,7 @@ t1.payment_voucher, t1.payment_voucher_num, t1.status, + t1.user_status, t1.exam_apply_num FROM management_exam_apply t1 @@ -342,6 +355,7 @@ t1.payment_voucher, t1.payment_voucher_num, t1.status, + t1.user_status, t1.exam_apply_num FROM management_exam_apply t1 diff --git a/src/main/resources/static/route/examapply/list.html b/src/main/resources/static/route/examapply/list.html index 75f0c6e..74c5ccd 100644 --- a/src/main/resources/static/route/examapply/list.html +++ b/src/main/resources/static/route/examapply/list.html @@ -86,24 +86,6 @@ [ {type:'checkbox', fixed: 'left'}, {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, - {field: 'examApplyId', width: 180, title: '考试申请主键UUID', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData; - } - }, - {field: 'examId', width: 180, title: '机构考试申请ID', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData; - } - }, {field: 'certificateOffice', width: 180, title: '发证机关', align:'center', templet: function(row) { var rowData = row[this.field]; @@ -113,15 +95,6 @@ return rowData; } }, - {field: 'examAddressId', width: 180, title: '理论考试地点ID(即考点ID)', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData; - } - }, {field: 'examStartTime', width: 180, title: '考试开始时间', align:'center', templet: function(row) { var rowData = row[this.field]; @@ -165,6 +138,42 @@ } return rowData; } + }, + {field: 'status', width: 150, title: '审批状态', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + if(rowData == '0') { + rowData = '待审批'; + } + if(rowData == '1') { + rowData = '已审批'; + } + return rowData; + } + }, + {field: 'userStatus', width: 150, title: '监考老师分配状态', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + if(rowData == '0') { + rowData = '未分配'; + } + if(rowData == '1') { + rowData = '已分配'; + } + return rowData; + } + }, + {field: 'allocation', fixed: 'right', width: 150, title: '审批状态', align:'center', + templet: function(row) { + var rowData = '分配监考老师'; + return rowData; + } } ] ], @@ -293,6 +302,31 @@ } } }); + + // 分配监考老师 + function allocation(data) { + var loadLayerIndex; + top.restAjax.get(top.restAjax.path('api/examination/sel-exam-user?examId={examId}', + [data.examId]), {}, null, function(code, resultData) { + if(null != resultData && resultData.length > 0) { + + } + }, function(code, data) { + top.dialog.msg(data.msg); + }, function() { + loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3}); + }, function() { + top.dialog.close(loadLayerIndex); + }); + } + + //监听行单击事件 + table.on('tool(dataTable)', function(obj){ + var data = obj.data; + if('allocation' == obj.event) { + allocation(data); + } + }); });