考试申请审核功能修改。

This commit is contained in:
Renpc-kilig 2021-05-05 16:30:28 +08:00
parent 839f88e04f
commit 5dfd58f787
10 changed files with 176 additions and 65 deletions

View File

@ -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<String, Object> params = requestParams();
return examinationService.selExamUser(params);
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -100,7 +100,7 @@ public class ExamApplyServiceImpl extends DefaultBaseService implements IExamApp
}
private void updateStatus(String planId, String token, ExamApplyVO examApplyVO) {
Map<String, Object> params = new HashMap<>(1);
Map<String, Object> params = HashMapUtil.beanToMap(examApplyVO);
params.put("examId", planId);
if (StringUtils.isBlank(token)) {
setUpdateInfo(params);

View File

@ -192,7 +192,7 @@ public interface IExaminationService {
* @return
* @throws SearchException
*/
ExaminationDTO selExamUser(Map<String, Object> params) throws SearchException;
ExaminationDTO selExamUser(Map<String, Object> params) throws Exception;
/**
* 获取剩余监考老师列表

View File

@ -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<String, Object> 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<String, Object> params) throws Exception {
if(com.alibaba.excel.util.StringUtils.isEmpty(params.get("examId"))) {
throw new SearchException("请传入考试ID");
}
// 判断当前考试是否存在在监考记录表中存在获取监考老师信息后续做修改操作否则做新增操作
ExaminationHisDTO examinationHisDTO = examinationDao.hasExam(params);
// 先获取所有考务人员
List<ExaminationDTO> 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<DistributionFieldDTO> 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<ExaminationDTO> 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<ExaminationDTO> examinationDTOList, Map<String, Object> params) {
private ExaminationDTO updateLogic(Integer randomNum, ExaminationDTO examinationDTO, List<ExaminationDTO> examinationDTOList, Map<String, Object> 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<ExaminationDTO> examinationDTOList, Map<String, Object> params) {
private ExaminationDTO insertLogic(Integer randomNum, ExaminationDTO examinationDTO, List<ExaminationDTO> examinationDTOList, Map<String, Object> 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;
}
}

View File

@ -16,6 +16,7 @@
<result column="payment_voucher_num" property="paymentVoucherNum"/>
<result column="exam_apply_num" property="examApplyNum"/>
<result column="status" property="status"/>
<result column="user_status" property="userStatus"/>
</resultMap>
<resultMap id="examApplyBO" type="cn.com.tenlion.pojo.bos.examapply.ExamApplyBO">
@ -32,6 +33,7 @@
<result column="payment_voucher_num" property="paymentVoucherNum"/>
<result column="exam_apply_num" property="examApplyNum"/>
<result column="status" property="status"/>
<result column="user_status" property="userStatus"/>
</resultMap>
<resultMap id="examApplyPO" type="cn.com.tenlion.pojo.pos.examapply.ExamApplyPO">
@ -48,6 +50,7 @@
<result column="payment_voucher_num" property="paymentVoucherNum"/>
<result column="exam_apply_num" property="examApplyNum"/>
<result column="status" property="status"/>
<result column="user_status" property="userStatus"/>
</resultMap>
<!-- 新增应急管理局-考试申请表-renpc -->
@ -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 @@
</if>
<if test="status != null and status != ''">
status = #{status},
</if>
<if test="userStatus != null and userStatus != ''">
user_status = #{userStatus},
</if>
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

View File

@ -86,24 +86,6 @@
[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{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 = '<a class="layui-btn layui-btn-xs">待审批</a>';
}
if(rowData == '1') {
rowData = '<a class="layui-btn layui-btn-xs">已审批</a>';
}
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 = '<a class="layui-btn layui-btn-xs">未分配</a>';
}
if(rowData == '1') {
rowData = '<a class="layui-btn layui-btn-xs">已分配</a>';
}
return rowData;
}
},
{field: 'allocation', fixed: 'right', width: 150, title: '审批状态', align:'center',
templet: function(row) {
var rowData = '<a class="layui-btn layui-btn-xs" lay-event="allocation">分配监考老师</a>';
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);
}
});
});
</script>
</body>