|
|
@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.google.common.collect.Sets; |
|
|
|
import com.ningdatech.basic.exception.BizException; |
|
|
|
import com.ningdatech.basic.function.VUtils; |
|
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
|
import com.ningdatech.basic.util.CollUtils; |
|
|
|
import com.ningdatech.pmapi.common.constant.CommonConst; |
|
|
@@ -201,11 +202,13 @@ public class TodoCenterManage { |
|
|
|
// 获取入参 |
|
|
|
String processInstanceId = param.getInstanceId(); |
|
|
|
Long projectId = param.getProjectId(); |
|
|
|
|
|
|
|
VUtils.isTrue(Objects.isNull(processInstanceId)).throwMessage("获取流程实例ID失败!"); |
|
|
|
VUtils.isTrue(Objects.isNull(projectId)).throwMessage("获取项目ID失败!"); |
|
|
|
// 获取当前申报项目 |
|
|
|
Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) |
|
|
|
.eq(Project::getInstCode, processInstanceId) |
|
|
|
.eq(Project::getId,projectId)); |
|
|
|
VUtils.isTrue(Objects.isNull(projectId)).throwMessage("获取项目ID失败!"); |
|
|
|
// 获取当前项目名称 |
|
|
|
String projectName = declaredProject.getProjectName(); |
|
|
|
// 获取当前项目状态 |
|
|
@@ -253,11 +256,6 @@ public class TodoCenterManage { |
|
|
|
// 如果流程状态是被退回状态,流程通过后,进入下一个审核人, |
|
|
|
// 当前通过审核人一定不是最后一个审核人(下一个审核人至多是最后一个),更新流程状态为审核中 |
|
|
|
if (ProcessStatusEnum.BE_BACKED.getDesc().equals(currentProcessStatus)) { |
|
|
|
// 更新流程状态为审核中 |
|
|
|
declaredProject.setProcessStatus(ProcessStatusEnum.UNDER_REVIEW.getCode()); |
|
|
|
declaredProject.setUpdateOn(LocalDateTime.now()); |
|
|
|
declaredProject.setUpdateBy(userId); |
|
|
|
projectService.updateById(declaredProject); |
|
|
|
// 获取发送浙政钉工作通知必要信息 |
|
|
|
WorkNoticeInfo passWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); |
|
|
|
String passMsg = String.format(PASS_MSG_TEMPLATE, passWorkNoticeInfo.getOrganizationName(), projectName); |
|
|
@@ -296,6 +294,9 @@ public class TodoCenterManage { |
|
|
|
// 若有下一个审核人(当前节点的用户), |
|
|
|
// 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 |
|
|
|
// 获取发送浙政钉工作通知必要信息 |
|
|
|
if (Objects.isNull(auditUserInfo)){ |
|
|
|
throw new BizException("审核人信息不存在!"); |
|
|
|
} |
|
|
|
WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); |
|
|
|
String msg = String.format(PASS_MSG_TEMPLATE, sendWorkNoticeInfo.getOrganizationName(), projectName); |
|
|
|
sendWorkNoticeInfo.setMsg(msg); |
|
|
@@ -327,11 +328,6 @@ public class TodoCenterManage { |
|
|
|
case BACK: |
|
|
|
// 退回该任务 |
|
|
|
processTaskService.handleTask(param, userId); |
|
|
|
// 更新申报项目表中的流程状态为被退回 |
|
|
|
declaredProject.setProcessStatus(ProcessStatusEnum.BE_BACKED.getCode()); |
|
|
|
declaredProject.setUpdateOn(LocalDateTime.now()); |
|
|
|
declaredProject.setUpdateBy(userId); |
|
|
|
projectService.updateById(declaredProject); |
|
|
|
// 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 |
|
|
|
// 获取发送浙政钉工作通知必要信息 |
|
|
|
WorkNoticeInfo backWorkNoticeInfo = getSendWorkNoticeInfo(startUserInfo); |
|
|
@@ -410,10 +406,6 @@ public class TodoCenterManage { |
|
|
|
} catch (Exception e) { |
|
|
|
throw new BizException("状态机执行失败!"); |
|
|
|
} |
|
|
|
// 更新流程状态、项目状态到下一个状态 |
|
|
|
declaredProject.setProcessStatus(ProcessStatusEnum.BE_REJECTED.getCode()); |
|
|
|
declaredProject.setUpdateOn(LocalDateTime.now()); |
|
|
|
declaredProject.setUpdateBy(userId); |
|
|
|
projectService.updateById(declaredProject); |
|
|
|
} |
|
|
|
|
|
|
@@ -471,10 +463,6 @@ public class TodoCenterManage { |
|
|
|
} catch (Exception e) { |
|
|
|
throw new BizException("状态机执行失败!"); |
|
|
|
} |
|
|
|
// 更新流程状态、项目状态到下一个状态 |
|
|
|
declaredProject.setProcessStatus(ProcessStatusEnum.APPROVED.getCode()); |
|
|
|
declaredProject.setUpdateOn(LocalDateTime.now()); |
|
|
|
declaredProject.setUpdateBy(userId); |
|
|
|
projectService.updateById(declaredProject); |
|
|
|
} |
|
|
|
|
|
|
@@ -565,11 +553,6 @@ public class TodoCenterManage { |
|
|
|
} catch (Exception e) { |
|
|
|
throw new BizException("状态机执行失败!"); |
|
|
|
} |
|
|
|
// 更新项目状态 |
|
|
|
declaredProject.setProcessStatus(ProcessStatusEnum.APPROVED.getCode()); |
|
|
|
declaredProject.setUpdateOn(LocalDateTime.now()); |
|
|
|
declaredProject.setUpdateBy(userId); |
|
|
|
projectService.updateById(declaredProject); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -724,6 +707,8 @@ public class TodoCenterManage { |
|
|
|
Long startUserId = LoginUserUtil.getUserId(); |
|
|
|
// 查出登录用户已提交工作流 |
|
|
|
List<ProcessInstanceVo> userSubmittedList = processInstanceService.getUserSubmittedList(String.valueOf(startUserId), param.getProcessDefId(), null); |
|
|
|
Map<String, ProcessInstanceVo> instanceVoMap = userSubmittedList.stream() |
|
|
|
.collect(Collectors.toMap(ProcessInstanceVo::getInstanceId, v -> v)); |
|
|
|
if(CollUtil.isEmpty(userSubmittedList)){ |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
@@ -743,7 +728,8 @@ public class TodoCenterManage { |
|
|
|
ResToBeProcessedVO res = new ResToBeProcessedVO(); |
|
|
|
BeanUtils.copyProperties(d, res); |
|
|
|
res.setProjectId(d.getId()); |
|
|
|
res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus())); |
|
|
|
ProcessInstanceVo instanceVo = instanceVoMap.get(d.getInstCode()); |
|
|
|
res.setProcessStatusName(instanceVo.getStatus()); |
|
|
|
res.setProcessLaunchTime(d.getCreateOn()); |
|
|
|
return res; |
|
|
|
}).collect(Collectors.toList()); |
|
|
@@ -840,7 +826,7 @@ public class TodoCenterManage { |
|
|
|
ProcessInstanceVo instanceVo = instanceVoMap.get(d.getInstCode()); |
|
|
|
res.setNodeId(instanceVo.getNodeId()); |
|
|
|
res.setProjectId(d.getId()); |
|
|
|
res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus())); |
|
|
|
res.setProcessStatusName(instanceVo.getStatus()); |
|
|
|
res.setProcessLaunchTime(d.getCreateOn()); |
|
|
|
return res; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|