开班计划审核和考试申请审核改为三级审核。

This commit is contained in:
Renpc-kilig 2021-06-19 11:04:08 +08:00
parent bc61ba2b5c
commit 307f89c824
9 changed files with 320 additions and 63 deletions

View File

@ -1,8 +1,11 @@
package cn.com.tenlion.dao.plancheck;
import ink.wgink.exceptions.SaveException;
import ink.wgink.pojo.dtos.position.PositionDTO;
import ink.wgink.pojo.dtos.position.PositionUserDTO;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
@ -23,4 +26,18 @@ public interface IPlanCheckDao {
*/
void save(Map<String, Object> params) throws SaveException;
/**
* 获取职位管理列表
* @return
* @throws SaveException
*/
List<PositionDTO> getPositionList() throws SaveException;
/**
* 通过职位ID获取当前职位下的用户列表
* @param params
* @return
* @throws SaveException
*/
List<String> getPositionUserList(Map<String, Object> params) throws SaveException;
}

View File

@ -8,9 +8,11 @@ import cn.com.tenlion.pojo.dtos.classplan.ClassPlanDTO;
import cn.com.tenlion.pojo.dtos.examapply.ExamApplyDTO;
import cn.com.tenlion.pojo.pos.examapply.ExamApplyPO;
import cn.com.tenlion.pojo.vos.examapply.ExamApplyVO;
import cn.com.tenlion.pojo.vos.plancheck.PlanCheckVO;
import cn.com.tenlion.service.classplan.IClassPlanService;
import cn.com.tenlion.service.examapply.IExamApplyService;
import cn.com.tenlion.service.examination.distribution.IDistributionService;
import cn.com.tenlion.service.plancheck.IPlanCheckService;
import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResultList;
@ -42,6 +44,8 @@ public class ExamApplyServiceImpl extends DefaultBaseService implements IExamApp
private IInstitutionService iInstitutionService;
@Autowired
private IClassPlanService classPlanService;
@Autowired
private IPlanCheckService planCheckService;
@Override
public void save(ExamApplyVO examApplyVO) {
@ -65,7 +69,7 @@ public class ExamApplyServiceImpl extends DefaultBaseService implements IExamApp
examApplyVO.setStatus(0);
// 监考老师分配状态0未分配1已分配
examApplyVO.setUserStatus(0);
// 考试申请审核状态0未审核1审核通过2审核驳回
// 考试申请审核状态0未审核1审核通过-1审核驳回
examApplyVO.setCheckStatus(0);
// 获取当前时间戳
Long startTs = System.currentTimeMillis();
@ -129,6 +133,10 @@ public class ExamApplyServiceImpl extends DefaultBaseService implements IExamApp
@Override
public void update(String token, String examApplyId, ExamApplyVO examApplyVO) {
PlanCheckVO planCheckVO = null;
Boolean canUpdate = planCheckService.canUpdate(null, examApplyVO, planCheckVO);
if(canUpdate) {
planCheckService.save(planCheckVO);
Map<String, Object> params = HashMapUtil.beanToMap(examApplyVO);
params.put("examApplyId", examApplyId);
if (StringUtils.isBlank(token)) {
@ -138,6 +146,7 @@ public class ExamApplyServiceImpl extends DefaultBaseService implements IExamApp
}
examApplyDao.update(params);
}
}
@Override
public ExamApplyDTO get(Map<String, Object> params) {

View File

@ -9,24 +9,33 @@ import cn.com.tenlion.pojo.dtos.examcheck.ExamCheckDTO;
import cn.com.tenlion.pojo.pos.examcheck.ExamCheckPO;
import cn.com.tenlion.pojo.vos.classplan.ClassPlanVO;
import cn.com.tenlion.pojo.vos.examcheck.ExamCheckVO;
import cn.com.tenlion.pojo.vos.plancheck.PlanCheckVO;
import cn.com.tenlion.service.applystudents.IApplyStudentsService;
import cn.com.tenlion.service.classplan.IClassPlanService;
import cn.com.tenlion.service.examapply.IExamApplyService;
import cn.com.tenlion.service.examcheck.IExamCheckService;
import cn.com.tenlion.service.plancheck.IPlanCheckService;
import com.sun.org.apache.xpath.internal.operations.Bool;
import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.exceptions.UpdateException;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.bos.UserInfoBO;
import ink.wgink.pojo.dtos.position.PositionDTO;
import ink.wgink.pojo.dtos.position.PositionUserDTO;
import ink.wgink.pojo.dtos.user.UserDTO;
import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.pojo.vos.IdsVO;
import ink.wgink.service.position.service.IPositionService;
import ink.wgink.service.position.service.IPositionUserService;
import ink.wgink.service.user.service.IUserService;
import ink.wgink.util.date.DateUtil;
import ink.wgink.util.map.HashMapUtil;
import ink.wgink.util.UUIDUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service;
import java.util.*;
@ -44,15 +53,13 @@ public class ExamCheckServiceImpl extends DefaultBaseService implements IExamChe
@Autowired
private IExamCheckDao examCheckDao;
@Autowired
private IExamApplyService examApplyService;
@Autowired
private IClassPlanService classPlanService;
@Autowired
private IInstitutionService iInstitutionService;
@Autowired
private IApplyStudentsService applyStudentsService;
@Autowired
private IPositionService positionService;
private IPlanCheckService planCheckService;
@Override
public void save(ExamCheckVO examCheckVO) {
@ -83,8 +90,6 @@ public class ExamCheckServiceImpl extends DefaultBaseService implements IExamChe
return examCheckId;
}
@Override
public void remove(List<String> ids) {
remove(null, ids);
@ -124,30 +129,10 @@ public class ExamCheckServiceImpl extends DefaultBaseService implements IExamChe
@Override
public void update(String token, String examCheckId, ExamCheckVO examCheckVO) {
String point = examCheckVO.getPoint();
Boolean hasUser = false;
String positionId = null;
if(StringUtils.isEmpty(point)) {
throw new UpdateException("缺少节点信息");
}
List<String> positionIds = new ArrayList<>();
positionIds.add("0");
List<PositionDTO> positionDTOList = positionService.list(positionIds);
if(null != positionDTOList && positionDTOList.size() > 0) {
for(PositionDTO positionDTO: positionDTOList) {
if(point.equals(positionDTO.getPositionName())) {
hasUser = true;
positionId = positionDTO.getPositionId();
}
}
}else {
throw new UpdateException("请先配置职位管理信息");
}
// 如果不存在职位管理信息则抛出异常
/*if() {
}*/
PlanCheckVO planCheckVO = new PlanCheckVO();
Boolean canUpdate = planCheckService.canUpdate(examCheckVO, null, planCheckVO);
if(canUpdate) {
planCheckService.save(planCheckVO);
Map<String, Object> params = HashMapUtil.beanToMap(examCheckVO);
params.put("examCheckId", examCheckId);
if (StringUtils.isBlank(token)) {
@ -171,6 +156,9 @@ public class ExamCheckServiceImpl extends DefaultBaseService implements IExamChe
classPlanVO.setReportType(examCheckVO.getCheckStatus().toString());
classPlanVO.setReportReason(examCheckVO.getReason());
classPlanService.update(classPlanId, classPlanVO);*/
}else {
throw new UpdateException("当前用户暂无审核权限");
}
}
@Override

View File

@ -1,5 +1,8 @@
package cn.com.tenlion.service.plancheck;
import cn.com.tenlion.pojo.dtos.examapply.ExamApplyDTO;
import cn.com.tenlion.pojo.vos.examapply.ExamApplyVO;
import cn.com.tenlion.pojo.vos.examcheck.ExamCheckVO;
import cn.com.tenlion.pojo.vos.plancheck.PlanCheckVO;
/**
@ -19,4 +22,6 @@ public interface IPlanCheckService {
*/
void save(PlanCheckVO planCheckVO);
Boolean canUpdate(ExamCheckVO examCheckVO, ExamApplyVO examApplyVO, PlanCheckVO planCheckVO);
}

View File

@ -1,14 +1,29 @@
package cn.com.tenlion.service.plancheck.impl;
import cn.com.tenlion.dao.plancheck.IPlanCheckDao;
import cn.com.tenlion.pojo.vos.examapply.ExamApplyVO;
import cn.com.tenlion.pojo.vos.examcheck.ExamCheckVO;
import cn.com.tenlion.pojo.vos.plancheck.PlanCheckVO;
import cn.com.tenlion.service.plancheck.IPlanCheckService;
import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.exceptions.UpdateException;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.bos.UserInfoBO;
import ink.wgink.pojo.dtos.ZTreeDTO;
import ink.wgink.pojo.dtos.position.PositionDTO;
import ink.wgink.pojo.dtos.position.PositionUserDTO;
import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.service.position.service.IPositionService;
import ink.wgink.service.position.service.IPositionUserService;
import ink.wgink.util.UUIDUtil;
import ink.wgink.util.date.DateUtil;
import ink.wgink.util.map.HashMapUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@ -16,6 +31,10 @@ public class PlanCheckServiceImpl extends DefaultBaseService implements IPlanChe
@Autowired
private IPlanCheckDao planCheckDao;
@Autowired
private IPositionService positionService;
@Autowired
private IPositionUserService positionUserService;
@Override
public void save(PlanCheckVO planCheckVO) {
@ -25,4 +44,191 @@ public class PlanCheckServiceImpl extends DefaultBaseService implements IPlanChe
setSaveInfo(params);
planCheckDao.save(params);
}
@Override
public Boolean canUpdate(ExamCheckVO examCheckVO, ExamApplyVO examApplyVO, PlanCheckVO planCheckVO) {
// 用于最后的结果返回
Boolean can = false;
// 当前审核节点的对象角色
String point = null;
if(null != examCheckVO) {
point = examCheckVO.getPoint();
planCheckVO.setPlanId(examCheckVO.getPlanId());
}
if(null != examApplyVO) {
point = examApplyVO.getPoint();
planCheckVO.setPlanId(examApplyVO.getExamId());
}
if(StringUtils.isEmpty(point)) {
throw new UpdateException("缺少节点信息");
}
// 查找职位信息
List<PositionDTO> positionDTOList = getPositionList();
// 获取职位ID
String positionId = hasPointMsg(positionDTOList, point);
// 通过职位ID获取档前职位下的用户列表并判断当前登录用户是否有审核权限
// 获取当前登录i用户的userId
String userId = getUserMsg(planCheckVO);
Boolean hasUser = getPositionUserList(positionId, userId);
if(hasUser) {
can = true;
}
planCheckVO.setCheckTime(DateUtil.getTime());
if(can) {
setCheckMsg(point, examCheckVO, examApplyVO, planCheckVO);
}
return can;
}
/**
* 获取当前角色下的所有用户信息
* @return
*/
private List<PositionDTO> getPositionList() {
List<PositionDTO> positionList = planCheckDao.getPositionList();
if(null == positionList || positionList.size() == 0) {
throw new UpdateException("请先配置职位信息");
}
return positionList;
}
/**
* 判断是否存在职位信息
* @param positionDTOList
* @param point
* @return
*/
private String hasPointMsg(List<PositionDTO> positionDTOList, String point) {
Boolean hasPoint = false;
String pointId = null;
for(PositionDTO positionDTO: positionDTOList) {
if(point.equals(positionDTO.getPositionName())) {
hasPoint = true;
pointId = positionDTO.getPositionId();
}
}
if(!hasPoint) {
throw new UpdateException("暂无" + point + "的职位信息,请添加");
}
return pointId;
}
/**
* 通过职位ID获取当前职位下的用户列表
* @param positionId
* @return
*/
private Boolean getPositionUserList(String positionId, String userId) {
Map<String, Object> params = new HashMap<>();
Boolean hasUser = false;
params.put("positionId", positionId);
List<String> positionUserDTOList = planCheckDao.getPositionUserList(params);
if(null != positionUserDTOList && positionUserDTOList.size() > 0) {
for(String s: positionUserDTOList) {
if(s.equals(userId)) {
hasUser = true;
}
}
}
if(!hasUser) {
throw new UpdateException("当前用户暂无审核权限");
}
return true;
}
/**
* 获取当前登陆人的用户信息
* @param planCheckVO
*/
private String getUserMsg(PlanCheckVO planCheckVO) {
UserInfoBO userInfoBO = securityComponent.getCurrentUser();
String userId = null;
if(null != userInfoBO) {
userId = userInfoBO.getUserId();
planCheckVO.setUserId(userId);
planCheckVO.setUserName(userInfoBO.getUserUsername());
}else {
throw new UpdateException("系统错误");
}
return userId;
}
/**
* 三级审核逻辑方法
* @param point
* @param examCheckVO
* @param examApplyVO
* @param planCheckVO
*/
private void setCheckMsg(String point, ExamCheckVO examCheckVO, ExamApplyVO examApplyVO, PlanCheckVO planCheckVO) {
Integer checkStatus = null;
String reason = null;
if(null != examCheckVO) {
checkStatus = examCheckVO.getCheckStatus();
reason = examCheckVO.getReason();
examCheckVO.setPoint(point);
examCheckVO.setCheckStatus(checkStatus);
examCheckVO.setReason(reason);
}
if(null != examApplyVO) {
checkStatus = examApplyVO.getCheckStatus();
reason = examApplyVO.getReason();
examApplyVO.setPoint(point);
examApplyVO.setCheckStatus(checkStatus);
examApplyVO.setReason(reason);
}
// 保存节点信息
planCheckVO.setCheckStatus(checkStatus.toString());
planCheckVO.setReason(reason);
/**
* 如果当前审核节点角色为科员
* 审核通过则到下一节点科长审核
* 审核退回则审核失败
*/
if(1 == checkStatus && "科员".equals(point)) {
checkStatus = 0;
point = "科长";
}
/**
* 如果当前审核节点角色为科长
* 审核通过则到下一节点分管领导审核
* 审核退回则审核节点退回到科员审核
*/
if(1 == checkStatus && "科长".equals(point)) {
checkStatus = 0;
reason = "";
point = "分管领导";
}
if(-1 == checkStatus && "科长".equals(point)) {
checkStatus = 0;
reason = "";
point = "科员";
}
/**
* 如果当前审核节点角色为分管领导
* 审核通过则审核流程结束设置审核状态为通过
* 审核退回则审核节点退回到科员审核
*/
if(1 == checkStatus && "分管领导".equals(point)) {
checkStatus = 1;
reason = "";
point = "分管领导";
}
if(-1 == checkStatus && "分管领导".equals(point)) {
checkStatus = 0;
reason = "";
point = "科员";
}
if(null != examCheckVO) {
examCheckVO.setPoint(point);
examCheckVO.setCheckStatus(checkStatus);
examCheckVO.setReason(reason);
}
if(null != examApplyVO) {
examApplyVO.setPoint(point);
examApplyVO.setCheckStatus(checkStatus);
examApplyVO.setReason(reason);
}
}
}

View File

@ -12,6 +12,16 @@
<result column="check_time" property="checkTime"/>
</resultMap>
<resultMap id="positionDTO" type="ink.wgink.pojo.dtos.position.PositionDTO">
<id property="positionId" column="position_id"/>
<result property="positionParentId" column="position_parent_id"/>
<result property="positionParentName" column="position_parent_name"/>
<result property="positionName" column="position_name"/>
<result property="positionSummary" column="position_summary"/>
<result property="positionCode" column="position_code"/>
<result property="positionNameEn" column="position_name_en"/>
</resultMap>
<!-- 新增计划审核内容 -->
<insert id="save" parameterType="map">
INSERT INTO e_exam_check(
@ -43,4 +53,27 @@
)
</insert>
<select id="getPositionList" parameterType="map" resultMap="positionDTO">
SELECT
t1.position_id,
t1.position_parent_id,
t1.position_name,
t1.position_summary,
t1.position_code,
t1.position_name_en
FROM
sys_position t1
WHERE
t1.is_delete = 0
</select>
<select id="getPositionUserList" parameterType="map" resultType="java.lang.String">
SELECT
t1.user_id
FROM
sys_position_user t1
WHERE
t1.position_id = #{positionId}
</select>
</mapper>

View File

@ -143,7 +143,7 @@
var nextTime = new Date();
nextTime.setDate(nextTime.getDate() + $('#nextCommitTime').val());
formData.field.nextCommitTime = nextTime.format("yyyy-MM-dd hh:mm:ss");
formData.field.checkStatus = '2';
formData.field.checkStatus = '-1';
top.restAjax.put(top.restAjax.path('api/examapply/update-more/{examApplyId}', [ids]), formData.field, null, function(code, data) {
if('200' == code) {
top.dialog.msg('退回成功');

View File

@ -129,7 +129,7 @@
var ids = $('#examIds').val();
var nextTime = new Date();
nextTime.setDate(nextTime.getDate() + $('#nextCommitTime').val());
formData.field.checkStatus = '3';
formData.field.checkStatus = '-1';
formData.field.nextCommitTime = nextTime.format("yyyy-MM-dd hh:mm:ss");
top.restAjax.put(top.restAjax.path('api/examcheck/update-more/{ids}', [ids]), formData.field, null, function(code, data) {
if('200' == code) {
@ -277,10 +277,10 @@
if('0' == rowData) {
rowData = '<a class="layui-btn layui-btn-warm layui-btn-xs">待审核</a>';
}
if('2' == rowData) {
if('1' == rowData) {
rowData = '<a class="layui-btn layui-btn-xs">审核通过</a>';
}
if('3' == rowData) {
if('-1' == rowData) {
rowData = '<a class="layui-btn layui-btn-danger layui-btn-xs">审核驳回</a>';
}
return rowData;

View File

@ -143,8 +143,8 @@
<div class="layui-form-item" pane>
<label class="layui-form-label">审核状态</label>
<div class="layui-input-block layui-form">
<input type="radio" lay-filter="checkStatus" name="checkStatus" value="2" title="审核通过" checked>
<input type="radio" lay-filter="checkStatus" name="checkStatus" value="3" title="退回">
<input type="radio" lay-filter="checkStatus" name="checkStatus" value="1" title="审核通过" checked>
<input type="radio" lay-filter="checkStatus" name="checkStatus" value="-1" title="退回">
</div>
</div>
<div class="layui-form-item" style="display: none;" id="nextTimeDiv">
@ -209,7 +209,6 @@
// 初始化图片上传
function initPlanImagesUploadFile() {
var files = $('#planImages').val();
debugger
initFileList('planImages', files, function(fileName) {
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
planImagesViewerObj[fileName] = viewer;