|
|
@@ -316,10 +316,6 @@ public class TodoCenterManage { |
|
|
|
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() |
|
|
|
.processInstanceId(processInstanceId) |
|
|
|
.singleResult(); |
|
|
|
// 获取流程发起人信息 |
|
|
|
String startUserId = instance.getStartUserId(); |
|
|
|
UserInfo startUserInfo = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) |
|
|
|
.eq(UserInfo::getEmployeeCode, startUserId)); |
|
|
|
// 获取流程定义名称 |
|
|
|
String processDefinitionName = instance.getProcessDefinitionName(); |
|
|
|
|
|
|
@@ -339,15 +335,15 @@ public class TodoCenterManage { |
|
|
|
// 获取流程通过后当前审核人信息,向其发送工作通知 |
|
|
|
List<ProgressNode> newProgressInfo = newInstanceDetail.getProgressInfo(); |
|
|
|
ProgressNode currentNode = newProgressInfo.get(newProgressInfo.size() - 1); |
|
|
|
UserInfo auditUserInfo; |
|
|
|
String currentEmployeeCode; |
|
|
|
// 说明当前节点是子流程节点 |
|
|
|
if (currentNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) { |
|
|
|
List<ProgressNode> children = currentNode.getChildren(); |
|
|
|
// 获取子流程当前审核人节点 |
|
|
|
ProgressNode subCurrentNode = children.get(children.size() - 1); |
|
|
|
auditUserInfo = userInfoService.getById(Long.valueOf(subCurrentNode.getUserId())); |
|
|
|
currentEmployeeCode = subCurrentNode.getUserId(); |
|
|
|
} else { |
|
|
|
auditUserInfo = userInfoService.getById(Long.valueOf(currentNode.getUserId())); |
|
|
|
currentEmployeeCode = currentNode.getUserId(); |
|
|
|
} |
|
|
|
|
|
|
|
// 流程通过后,判断当前登录用户是不是最后一个审核人 |
|
|
@@ -376,7 +372,7 @@ public class TodoCenterManage { |
|
|
|
throw new IllegalStateException("Unexpected value: " + projectStatus); |
|
|
|
} |
|
|
|
// 获取发送浙政钉工作通知必要信息 |
|
|
|
WorkNoticeInfo passWorkNoticeInfo2 = getSendWorkNoticeInfo(startUserInfo); |
|
|
|
WorkNoticeInfo passWorkNoticeInfo2 = getSendWorkNoticeInfo(currentEmployeeCode); |
|
|
|
String passMsg2 = String.format(PASS_MSG_TEMPLATE2, projectName, processDefinitionName); |
|
|
|
passWorkNoticeInfo2.setMsg(passMsg2); |
|
|
|
// 放入系统通知表中,保存记录 |
|
|
@@ -387,10 +383,10 @@ public class TodoCenterManage { |
|
|
|
// 若有下一个审核人(当前节点的用户), |
|
|
|
// 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 |
|
|
|
// 获取发送浙政钉工作通知必要信息 |
|
|
|
if (Objects.isNull(auditUserInfo)) { |
|
|
|
if (Objects.isNull(currentEmployeeCode)) { |
|
|
|
throw new BizException("审核人信息不存在!"); |
|
|
|
} |
|
|
|
WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); |
|
|
|
WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(currentEmployeeCode); |
|
|
|
String msg = String.format(PASS_MSG_TEMPLATE, sendWorkNoticeInfo.getOrganizationName(), projectName); |
|
|
|
sendWorkNoticeInfo.setMsg(msg); |
|
|
|
// 放入系统通知表中,保存记录 |
|
|
@@ -407,7 +403,7 @@ public class TodoCenterManage { |
|
|
|
// 更新项目状态和流程状态 |
|
|
|
updateRejectProjectStatus(userId, declaredProject); |
|
|
|
// 获取发送浙政钉工作通知必要信息 |
|
|
|
WorkNoticeInfo rejectWorkNoticeInfo = getSendWorkNoticeInfo(startUserInfo); |
|
|
|
WorkNoticeInfo rejectWorkNoticeInfo = getSendWorkNoticeInfo(instance.getStartUserId()); |
|
|
|
String rejectMsg = String.format(REJECT_MSG_TEMPLATE, projectName, processDefinitionName); |
|
|
|
rejectWorkNoticeInfo.setMsg(rejectMsg); |
|
|
|
// 放入系统通知表中,保存记录 |
|
|
@@ -421,7 +417,7 @@ public class TodoCenterManage { |
|
|
|
processTaskService.handleTask(param, employeeCode); |
|
|
|
// 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 |
|
|
|
// 获取发送浙政钉工作通知必要信息 |
|
|
|
WorkNoticeInfo backWorkNoticeInfo = getSendWorkNoticeInfo(startUserInfo); |
|
|
|
WorkNoticeInfo backWorkNoticeInfo = getSendWorkNoticeInfo(instance.getStartUserId()); |
|
|
|
String backMsg = String.format(BACK_MSG_TEMPLATE, projectName, processDefinitionName); |
|
|
|
backWorkNoticeInfo.setMsg(backMsg); |
|
|
|
// 放入系统通知表中,保存记录 |
|
|
@@ -432,7 +428,7 @@ public class TodoCenterManage { |
|
|
|
// 撤回(流程发起人和当前流程审核人的前一个审核人操作) |
|
|
|
case WITHDRAW: |
|
|
|
// 登录用户是流程发起人,且是流程发起人撤回 |
|
|
|
if (employeeCode.equals(startUserId) |
|
|
|
if (employeeCode.equals(instance.getStartUserId()) |
|
|
|
&& ProcessConstant.Field.ROOT.equals(param.getTaskId())) { |
|
|
|
processTaskService.handleTask(param, employeeCode); |
|
|
|
// 若是流程发起人点击撤回,项目回到上一个状态,需调用状态机更新项目状态,流程状态更新为审核通过 |
|
|
@@ -589,12 +585,16 @@ public class TodoCenterManage { |
|
|
|
/** |
|
|
|
* 获取发送浙政钉工作通知的信息 |
|
|
|
* |
|
|
|
* @param auditUserInfo |
|
|
|
* @param currentEmployeeCode |
|
|
|
* @return com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo |
|
|
|
* @author CMM |
|
|
|
* @since 2023/02/15 14:04 |
|
|
|
*/ |
|
|
|
public WorkNoticeInfo getSendWorkNoticeInfo(UserInfo auditUserInfo) { |
|
|
|
public WorkNoticeInfo getSendWorkNoticeInfo(String currentEmployeeCode) { |
|
|
|
UserInfo auditUserInfo = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class).eq(UserInfo::getEmployeeCode,currentEmployeeCode).last("limit 1")); |
|
|
|
if (Objects.isNull(auditUserInfo)) { |
|
|
|
throw new BizException("该用户不存在!"); |
|
|
|
} |
|
|
|
WorkNoticeInfo workNoticeInfo = new WorkNoticeInfo(); |
|
|
|
Long accountId = auditUserInfo.getAccountId(); |
|
|
|
if (Objects.isNull(accountId)) { |
|
|
|