|
@@ -288,9 +288,6 @@ public class PreparationServiceImpl extends BaseServiceImpl<PreparationMapper, P
|
|
|
statusList.add(PreparationStatusEnum.FIRST_PROCESSING_VERIFYING.getValue());
|
|
|
statusList.add(PreparationStatusEnum.SECOND_PROCESSING_VERIFYING.getValue());
|
|
|
} else if (record.getSearchType() == 3) { // 我的工单
|
|
|
- statusList.add(PreparationStatusEnum.NOT_ALLOCATED.getValue());
|
|
|
- statusList.add(PreparationStatusEnum.PROCESSING.getValue());
|
|
|
- statusList.add(PreparationStatusEnum.FINISHED.getValue());
|
|
|
}
|
|
|
// 超级管理员可以看到各个状态下的所有数据 相关领导,可以在这里进行设置
|
|
|
if (userInfo.getSuperAdmin() == 1 || record.getSearchType() == -1) {
|
|
@@ -429,11 +426,15 @@ public class PreparationServiceImpl extends BaseServiceImpl<PreparationMapper, P
|
|
|
updPre.setRepairEndTime(LocalDateTime.now());
|
|
|
updPre.setRepairMinutes(DateUtils.getDurationHours(preparation.getRepairStartTime(), updPre.getRepairEndTime()));
|
|
|
updPre.setStatus(PreparationStatusEnum.SECOND_PROCESSING_VERIFYING.getValue());
|
|
|
- updPre.setFee(model.getFee());
|
|
|
- // 保存文件图片
|
|
|
- sysFileService.saveFile(model.getId(), SysFileTypeEnum.PREPARATION_APPLICATION_IMGS.getValue(), model.getImageList());
|
|
|
- sysFileService.saveFile(model.getId(), SysFileTypeEnum.PREPARATION_APPLICATION_FILES.getValue(), model.getFileList());
|
|
|
mapper.updateByPrimaryKeySelective(updPre);
|
|
|
+ // 添加状态记录
|
|
|
+ addRecord(updPre,PreparationRecordTypeEnum.FLOW.getValue(), "");
|
|
|
+ // 给申请人发消息
|
|
|
+ SysUserDTO sendDTO = new SysUserDTO();
|
|
|
+ sendDTO.setUserId(preparation.getUserId());
|
|
|
+ List<SysUserVO> sendUsers = sysUserMapper.getSysUserVO(sendDTO);
|
|
|
+ updPre.setNo(preparation.getNo());
|
|
|
+ sendMessageToApplyLeader(sendUsers, updPre);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -515,7 +516,6 @@ public class PreparationServiceImpl extends BaseServiceImpl<PreparationMapper, P
|
|
|
Preparation updPre = new Preparation();
|
|
|
updPre.setId(preparation.getId());
|
|
|
SysUserDTO queryDTO = new SysUserDTO();
|
|
|
- List<SysUserVO> userVOS = ListUtils.newArrayList();
|
|
|
// 根据当前状态来区分审核权限
|
|
|
switch (preparation.getStatus()) {
|
|
|
case CommonConstants.PREPARATION_NOT_ALLOCATED:
|
|
@@ -533,8 +533,6 @@ public class PreparationServiceImpl extends BaseServiceImpl<PreparationMapper, P
|
|
|
updPre.setStatus(PreparationStatusEnum.CLOSE.getValue());
|
|
|
queryDTO.setUserId(preparation.getUserId());
|
|
|
}
|
|
|
- // 给部门负责人发送消息
|
|
|
- sysUserMapper.getSysUserVO(queryDTO);
|
|
|
break;
|
|
|
case CommonConstants.APPLY_MANAGER_VERIFY_SUCCESS:
|
|
|
// 负责人审批
|
|
@@ -551,8 +549,6 @@ public class PreparationServiceImpl extends BaseServiceImpl<PreparationMapper, P
|
|
|
updPre.setStatus(PreparationStatusEnum.CLOSE.getValue());
|
|
|
queryDTO.setUserId(preparation.getApplyVerifyUserId());
|
|
|
}
|
|
|
- // 给收件部门负责人发送消息
|
|
|
- sysUserMapper.getSysUserVO(queryDTO);
|
|
|
break;
|
|
|
case CommonConstants.FIRST_PROCESSING_VERIFYING:
|
|
|
// 申请人费用审批
|
|
@@ -568,7 +564,6 @@ public class PreparationServiceImpl extends BaseServiceImpl<PreparationMapper, P
|
|
|
}
|
|
|
// 给执行人发送消息
|
|
|
queryDTO.setUserId(preparation.getRepairUserId());
|
|
|
- sysUserMapper.getSysUserVO(queryDTO);
|
|
|
break;
|
|
|
case CommonConstants.SECOND_PROCESSING_VERIFYING:
|
|
|
// 申请人验收审批
|
|
@@ -584,8 +579,6 @@ public class PreparationServiceImpl extends BaseServiceImpl<PreparationMapper, P
|
|
|
updPre.setStatus(PreparationStatusEnum.CLOSE.getValue());
|
|
|
queryDTO.setUserId(preparation.getRepairUserId());
|
|
|
}
|
|
|
- // 给执行人发送消息
|
|
|
- sysUserMapper.getSysUserVO(queryDTO);
|
|
|
break;
|
|
|
|
|
|
}
|
|
@@ -597,9 +590,159 @@ public class PreparationServiceImpl extends BaseServiceImpl<PreparationMapper, P
|
|
|
// 修改进度状态
|
|
|
mapper.updateByPrimaryKeySelective(updPre);
|
|
|
// 发送消息
|
|
|
+ List<SysUserVO> userVOS = sysUserMapper.getSysUserVO(queryDTO);
|
|
|
sendMessageToApplyLeader(userVOS, preparation);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void pushVerify(PreparationDTO model) {
|
|
|
+ if(StringUtils.isEmpty(model.getId())){
|
|
|
+ throw new DeniedException("工单ID未携带");
|
|
|
+ }
|
|
|
+ // 获取信息,根据状态判断,提交到哪个节点
|
|
|
+ Preparation preparation = mapper.selectByPrimaryKey(model.getId());
|
|
|
+ Preparation updPre = new Preparation();
|
|
|
+ updPre.setId(preparation.getId());
|
|
|
+ updPre.setName(model.getName());
|
|
|
+ updPre.setParentPositionId(model.getParentPositionId());
|
|
|
+ updPre.setPositionId(model.getPositionId());
|
|
|
+ updPre.setApplyTime(model.getApplyTime());
|
|
|
+ updPre.setLimitHours(model.getLimitHours());
|
|
|
+ // 审批主管变更-特殊处理
|
|
|
+ updPre.setApplyVerifyUserId(model.getApplyVerifyUserId());
|
|
|
+ // 收件部门变更-特殊处理
|
|
|
+ updPre.setReceiveDept(model.getReceiveDept());
|
|
|
+ updPre.setApplyReason(model.getApplyReason());
|
|
|
+ updPre.setContent(model.getContent());
|
|
|
+ SysUserDTO queryUserDTO = new SysUserDTO();
|
|
|
+ List<SysUserVO> userVOS = null;
|
|
|
+ // 查询发送消息用户
|
|
|
+ SysUserDTO sendUserDTO = new SysUserDTO();
|
|
|
+ switch (preparation.getStatus()){
|
|
|
+ case CommonConstants.APPLY_MANAGER_VERIFY_BACK:
|
|
|
+ // 审批主管回退
|
|
|
+ updPre.setStatus(PreparationStatusEnum.NOT_ALLOCATED.getValue());
|
|
|
+ // 收件部门变更
|
|
|
+ if(!updPre.getReceiveDept().equals(preparation.getReceiveDept())){
|
|
|
+ queryUserDTO.setRoleCode(SysRoleCodeEnum.DEPT_LEADER.name());
|
|
|
+ queryUserDTO.setDeptId(updPre.getReceiveDept());
|
|
|
+ userVOS = sysUserMapper.selectDeptRoleUser(queryUserDTO);
|
|
|
+ // 判断收件部门是否有负责人
|
|
|
+ if (userVOS == null || userVOS.size() != 1) {
|
|
|
+ throw new DeniedException("选择的收件部门,无负责人或存在多个");
|
|
|
+ }
|
|
|
+ updPre.setReceiveVerifyLeader(userVOS.get(0).getUserId());
|
|
|
+ }
|
|
|
+ // 给审批主管发信息
|
|
|
+ sendUserDTO.setUserId(updPre.getApplyVerifyUserId());
|
|
|
+ break;
|
|
|
+ case CommonConstants.APPLY_LEADER_VERIFY_BACK:
|
|
|
+ // 部门负责人回退
|
|
|
+ updPre.setStatus(PreparationStatusEnum.APPLY_MANAGER_VERIFY_SUCCESS.getValue());
|
|
|
+ // 审批主管变更
|
|
|
+ if(!updPre.getApplyVerifyUserId().equals(preparation.getApplyVerifyUserId())){
|
|
|
+ throw new DeniedException("部门主管审批通过,不可以修改审批主管人选");
|
|
|
+ }
|
|
|
+ // 收件部门变更
|
|
|
+ if(!updPre.getReceiveDept().equals(preparation.getReceiveDept())){
|
|
|
+ queryUserDTO.setRoleCode(SysRoleCodeEnum.DEPT_LEADER.name());
|
|
|
+ queryUserDTO.setDeptId(updPre.getReceiveDept());
|
|
|
+ userVOS = sysUserMapper.selectDeptRoleUser(queryUserDTO);
|
|
|
+ // 判断收件部门是否有负责人
|
|
|
+ if (userVOS == null || userVOS.size() != 1) {
|
|
|
+ throw new DeniedException("选择的收件部门,无负责人或存在多个");
|
|
|
+ }
|
|
|
+ updPre.setReceiveVerifyLeader(userVOS.get(0).getUserId());
|
|
|
+ }
|
|
|
+ // 给部门负责人发信息
|
|
|
+ sendUserDTO.setUserId(updPre.getApplyVerifyLeader());
|
|
|
+ break;
|
|
|
+ case CommonConstants.RECEIVE_VERIFY_BACK:
|
|
|
+ // 收件部门回退
|
|
|
+ updPre.setStatus(PreparationStatusEnum.APPLY_LEADER_VERIFY_SUCCESS.getValue());
|
|
|
+ // 审批主管变更
|
|
|
+ if(!updPre.getApplyVerifyUserId().equals(preparation.getApplyVerifyUserId())){
|
|
|
+ throw new DeniedException("单据已流转到收件部门,不可以修改审批主管人选");
|
|
|
+ }
|
|
|
+ // 收件部门变更
|
|
|
+ if(!updPre.getReceiveDept().equals(preparation.getReceiveDept())){
|
|
|
+ queryUserDTO.setRoleCode(SysRoleCodeEnum.DEPT_LEADER.name());
|
|
|
+ queryUserDTO.setDeptId(updPre.getReceiveDept());
|
|
|
+ userVOS = sysUserMapper.selectDeptRoleUser(queryUserDTO);
|
|
|
+ // 判断收件部门是否有负责人
|
|
|
+ if (userVOS == null || userVOS.size() != 1) {
|
|
|
+ throw new DeniedException("选择的收件部门,无负责人或存在多个");
|
|
|
+ }
|
|
|
+ updPre.setReceiveVerifyLeader(userVOS.get(0).getUserId());
|
|
|
+ }
|
|
|
+ // 给收件部门负责人发信息
|
|
|
+ sendUserDTO.setUserId(updPre.getReceiveVerifyLeader());
|
|
|
+ break;
|
|
|
+ case CommonConstants.FIRST_PROCESSING_VERIFY_BACK:
|
|
|
+ // 申请费用回退
|
|
|
+ updPre.setStatus(PreparationStatusEnum.FIRST_PROCESSING_VERIFYING.getValue());
|
|
|
+ // 审批主管变更
|
|
|
+ if(!updPre.getApplyVerifyUserId().equals(preparation.getApplyVerifyUserId())){
|
|
|
+ throw new DeniedException("单据已流转到费用审核流程,不可以修改审批主管人选");
|
|
|
+ }
|
|
|
+ // 收件部门变更
|
|
|
+ if(!updPre.getReceiveDept().equals(preparation.getReceiveDept())){
|
|
|
+ throw new DeniedException("单据已流转到费用审核流程,不可以修改收件部门");
|
|
|
+ }
|
|
|
+ // 给申请人发信息
|
|
|
+ sendUserDTO.setUserId(updPre.getUserId());
|
|
|
+ break;
|
|
|
+ case CommonConstants.SECOND_PROCESSING_BACK:
|
|
|
+ // 验收回退
|
|
|
+ updPre.setStatus(PreparationStatusEnum.SECOND_PROCESSING_VERIFYING.getValue());
|
|
|
+ // 审批主管变更
|
|
|
+ if(!updPre.getApplyVerifyUserId().equals(preparation.getApplyVerifyUserId())){
|
|
|
+ throw new DeniedException("单据已流转到验收审核流程,不可以修改审批主管人选");
|
|
|
+ }
|
|
|
+ // 收件部门变更
|
|
|
+ if(!updPre.getReceiveDept().equals(preparation.getReceiveDept())){
|
|
|
+ throw new DeniedException("单据已流转到验收审核流程,不可以修改收件部门");
|
|
|
+ }
|
|
|
+ // 给申请人发信息
|
|
|
+ sendUserDTO.setUserId(updPre.getUserId());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ // 添加状态记录
|
|
|
+ addRecord(updPre, PreparationRecordTypeEnum.FLOW.getValue(), "");
|
|
|
+ // 修改信息表
|
|
|
+ mapper.updateByPrimaryKeySelective(updPre);
|
|
|
+ // 发送消息
|
|
|
+ List<SysUserVO> sendUsers = sysUserMapper.getSysUserVO(sendUserDTO);
|
|
|
+ sendMessageToApplyLeader(sendUsers, updPre);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void fillFee(PreparationDTO model) {
|
|
|
+ Preparation preparation = mapper.selectByPrimaryKey(model.getId());
|
|
|
+ String currentUserId = SecurityUtils.getUserInfo().getUserId();
|
|
|
+ if (!currentUserId.equals(preparation.getRepairUserId())) {
|
|
|
+ throw new DeniedException("不是该工单执行人,不可以填报费用");
|
|
|
+ }
|
|
|
+ Preparation updPre = new Preparation();
|
|
|
+ updPre.setId(model.getId());
|
|
|
+ updPre.setStatus(PreparationStatusEnum.FIRST_PROCESSING_VERIFYING.getValue());
|
|
|
+ updPre.setFee(model.getFee());
|
|
|
+ // 保存文件图片
|
|
|
+ sysFileService.saveFile(model.getId(), SysFileTypeEnum.PREPARATION_APPLICATION_IMGS.getValue(), model.getImageList());
|
|
|
+ sysFileService.saveFile(model.getId(), SysFileTypeEnum.PREPARATION_APPLICATION_FILES.getValue(), model.getFileList());
|
|
|
+ mapper.updateByPrimaryKeySelective(updPre);
|
|
|
+ // 添加状态记录
|
|
|
+ addRecord(updPre,PreparationRecordTypeEnum.FLOW.getValue(), "");
|
|
|
+ // 添加审核记录
|
|
|
+ addRecord(updPre,PreparationRecordTypeEnum.VERIFY.getValue(), "同意");
|
|
|
+ // 给申请人发消息
|
|
|
+ SysUserDTO sendDTO = new SysUserDTO();
|
|
|
+ sendDTO.setUserId(preparation.getUserId());
|
|
|
+ List<SysUserVO> sendUsers = sysUserMapper.getSysUserVO(sendDTO);
|
|
|
+ updPre.setNo(preparation.getNo());
|
|
|
+ sendMessageToApplyLeader(sendUsers, updPre);
|
|
|
+ }
|
|
|
+
|
|
|
private String getParentPositionId(String positionId) {
|
|
|
SbPosition sbPosition = sbPositionMapper.selectByPrimaryKey(positionId);
|
|
|
while (!StringUtils.isEmpty(sbPosition.getParentId())) {
|