|
|
@@ -15,11 +15,16 @@ import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; |
|
|
|
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; |
|
|
|
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; |
|
|
|
import com.ningdatech.pmapi.common.util.ExcelDownUtil; |
|
|
|
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; |
|
|
|
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; |
|
|
|
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; |
|
|
|
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; |
|
|
|
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
|
import com.ningdatech.pmapi.projectlib.service.IProjectService; |
|
|
|
import com.ningdatech.pmapi.todocenter.bean.entity.ProcessComment; |
|
|
|
import com.ningdatech.pmapi.todocenter.bean.entity.ProgressNode; |
|
|
|
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; |
|
|
|
import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo; |
|
|
|
import com.ningdatech.pmapi.todocenter.bean.vo.ProgressNodeAuditInfoVo; |
|
|
|
import com.ningdatech.pmapi.todocenter.constant.HisProInsEndActId; |
|
|
@@ -31,9 +36,10 @@ import com.ningdatech.pmapi.todocenter.model.dto.req.ReqProcessHandlerDTO; |
|
|
|
import com.ningdatech.pmapi.todocenter.model.dto.req.ReqToBeProcessedDTO; |
|
|
|
import com.ningdatech.pmapi.todocenter.model.dto.req.ReqToBeProcessedExportDTO; |
|
|
|
import com.ningdatech.pmapi.todocenter.model.dto.res.ResToBeProcessedDTO; |
|
|
|
|
|
|
|
import com.ningdatech.pmapi.user.entity.UserInfo; |
|
|
|
import com.ningdatech.pmapi.user.service.IUserInfoService; |
|
|
|
import com.wflow.bean.do_.UserDo; |
|
|
|
import com.ningdatech.zwdd.client.ZwddClient; |
|
|
|
import com.wflow.bean.entity.WflowCcTasks; |
|
|
|
import com.wflow.bean.entity.WflowModelHistorys; |
|
|
|
import com.wflow.bean.entity.WflowModels; |
|
|
@@ -42,7 +48,6 @@ import com.wflow.mapper.WflowCcTasksMapper; |
|
|
|
import com.wflow.mapper.WflowModelHistorysMapper; |
|
|
|
import com.wflow.service.OrgRepositoryService; |
|
|
|
import com.wflow.utils.CodeUtil; |
|
|
|
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; |
|
|
|
import com.wflow.workflow.bean.process.OrgUser; |
|
|
|
import com.wflow.workflow.bean.process.ProcessNode; |
|
|
|
import com.wflow.workflow.bean.process.enums.ApprovalModeEnum; |
|
|
@@ -51,6 +56,7 @@ import com.wflow.workflow.bean.process.form.Form; |
|
|
|
import com.wflow.workflow.bean.process.props.ApprovalProps; |
|
|
|
import com.wflow.workflow.bean.vo.ProcessInstanceVo; |
|
|
|
import com.wflow.workflow.bean.vo.ProcessTaskVo; |
|
|
|
import com.wflow.workflow.bean.vo.UserInfoVO; |
|
|
|
import com.wflow.workflow.config.WflowGlobalVarDef; |
|
|
|
import com.wflow.workflow.enums.ProcessHandlerEnum; |
|
|
|
import com.wflow.workflow.service.FormService; |
|
|
@@ -77,7 +83,6 @@ import org.flowable.task.service.history.NativeHistoricTaskInstanceQuery; |
|
|
|
import org.flowable.variable.api.history.HistoricVariableInstance; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
@@ -112,8 +117,9 @@ public class TodoCenterManage { |
|
|
|
private final IUserInfoService userInfoService; |
|
|
|
private final IProjectService projectService; |
|
|
|
private final StateMachineUtils stateMachineUtils; |
|
|
|
// @Resource(name = "executableClient") |
|
|
|
// private ExecutableClient client; |
|
|
|
private final ZwddClient zwddClient; |
|
|
|
private final IDingEmployeeInfoService dingEmployeeInfoService; |
|
|
|
private final IDingOrganizationService dingOrganizationService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 待办中心待我处理项目列表查询 |
|
|
@@ -171,31 +177,45 @@ public class TodoCenterManage { |
|
|
|
// 从待办任务列表中取出当前登录用户及项目实例对应的任务 |
|
|
|
Task task = taskMap.get(d.getInstCode()); |
|
|
|
HistoricProcessInstance instance = instanceMap.get(task.getProcessInstanceId()); |
|
|
|
//HashSet<String> userSet = new HashSet<>(); |
|
|
|
//userSet.add(instance.getStartUserId()) ; |
|
|
|
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet); |
|
|
|
//res.setOwner(userMap.get(Long.valueOf(instance.getStartUserId()))); |
|
|
|
UserInfoVO owner = new UserInfoVO(); |
|
|
|
owner.setUserId(Long.valueOf(instance.getStartUserId())); |
|
|
|
res.setOwner(owner); |
|
|
|
// 从缓存取 |
|
|
|
staterUsers.add(String.valueOf(userId)); |
|
|
|
ProcessTaskVo processTaskVo = ProcessTaskVo.builder().taskId(task.getId()).taskName(task.getName()) |
|
|
|
.taskDefKey(task.getTaskDefinitionKey()).processDefId(task.getProcessDefinitionId()) |
|
|
|
.executionId(task.getExecutionId()).nodeId(task.getTaskDefinitionKey()) |
|
|
|
.deployId(instance.getDeploymentId()).processDefName(instance.getProcessDefinitionName()) |
|
|
|
.version(instance.getProcessDefinitionVersion()).instanceId(task.getProcessInstanceId()) |
|
|
|
.ownerId(instance.getStartUserId()).createTime(instance.getStartTime()) |
|
|
|
.taskCreateTime(task.getCreateTime()).build(); |
|
|
|
ProcessTaskVo processTaskVo = ProcessTaskVo.builder() |
|
|
|
.taskId(task.getId()) |
|
|
|
.taskName(task.getName()) |
|
|
|
.taskDefKey(task.getTaskDefinitionKey()) |
|
|
|
.processDefId(task.getProcessDefinitionId()) |
|
|
|
.executionId(task.getExecutionId()) |
|
|
|
.nodeId(task.getTaskDefinitionKey()) |
|
|
|
.deployId(instance.getDeploymentId()) |
|
|
|
.processDefName(instance.getProcessDefinitionName()) |
|
|
|
.version(instance.getProcessDefinitionVersion()) |
|
|
|
.instanceId(task.getProcessInstanceId()) |
|
|
|
.ownerId(instance.getStartUserId()) |
|
|
|
.createTime(instance.getStartTime()) |
|
|
|
.taskCreateTime(task.getCreateTime()) |
|
|
|
.build(); |
|
|
|
res.setProcessTaskInfo(processTaskVo); |
|
|
|
return res; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
// 取用户信息,减少数据库查询,一次构建 |
|
|
|
if (isNotEmpty(staterUsers)) { |
|
|
|
Map<String, OrgUser> userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); |
|
|
|
resVos.stream() |
|
|
|
.peek(v -> v.getProcessTaskInfo().setOwner(userMap.get(v.getProcessTaskInfo().getOwnerId()))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
// Map<Long,UserInfo> userMap = userInfoService.getUserMapByIds(staterUsers); |
|
|
|
// result = resVos.stream().peek(v -> v.setOwner(userMap.get(userId))) |
|
|
|
// .collect(Collectors.toList()); |
|
|
|
} |
|
|
|
if (isEmpty(resVos)) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
// 取用户信息,减少数据库查询,一次构建 |
|
|
|
List<ResToBeProcessedDTO> result = null; |
|
|
|
if (isNotEmpty(staterUsers)) { |
|
|
|
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(staterUsers); |
|
|
|
//result = resVos.stream() |
|
|
|
// .peek(v -> v.getProcessTaskInfo().setStartUser(userMap.get(Long.valueOf(v.getProcessTaskInfo().getOwnerId())))) |
|
|
|
// .collect(Collectors.toList()); |
|
|
|
} |
|
|
|
// return PageVo.of(result, total); |
|
|
|
return PageVo.of(resVos, total); |
|
|
|
} |
|
|
|
|
|
|
@@ -359,24 +379,26 @@ public class TodoCenterManage { |
|
|
|
|
|
|
|
Map<String, Object> var = new HashMap<>(16); |
|
|
|
var.put("approve_" + task.getId(), param.getAction()); |
|
|
|
|
|
|
|
// 保存审核意见 |
|
|
|
if (hasComment(param.getAuditInfo())) { |
|
|
|
// 执行自定义的保存评论的功能 |
|
|
|
managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), |
|
|
|
String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); |
|
|
|
} |
|
|
|
|
|
|
|
// TODO 中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被驳回,请及时处理。 |
|
|
|
|
|
|
|
// 获取bpm对象 |
|
|
|
BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); |
|
|
|
// 获取根节点即流程发起节点 |
|
|
|
FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); |
|
|
|
|
|
|
|
// TODO 中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被驳回,请及时处理。 |
|
|
|
// sendWorkNoticeToStartUser(task, projectName, rootNode); |
|
|
|
|
|
|
|
// TODO 中止流程并使项目进入对应状态,给项目创建人、 |
|
|
|
// 流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被驳回,请及时处理。 |
|
|
|
String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); |
|
|
|
// 获取浙政钉用户ID |
|
|
|
UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(startUserId)); |
|
|
|
WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); |
|
|
|
WflowModels wflowModels = getLastWflowModels(task); |
|
|
|
String formName = wflowModels.getFormName(); |
|
|
|
String msg = String.format(REJECT_MSG_TEMPLATE, projectName, formName); |
|
|
|
zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); |
|
|
|
// 更新项目状态和流程状态 |
|
|
|
updateRejectProjectStatus(userId, declaredProject); |
|
|
|
taskService.complete(param.getTaskId(), var); |
|
|
@@ -452,7 +474,6 @@ public class TodoCenterManage { |
|
|
|
|
|
|
|
/** |
|
|
|
* 审批任务:通过 |
|
|
|
* |
|
|
|
* @param task 当前任务 |
|
|
|
* @param userId |
|
|
|
* @param param 参数 |
|
|
@@ -485,26 +506,25 @@ public class TodoCenterManage { |
|
|
|
Task currentTask = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult(); |
|
|
|
// 获取审核人信息,向审核人发送工作通知 |
|
|
|
String currentUserId = currentTask.getAssignee(); |
|
|
|
// UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(currentUserId)); |
|
|
|
// TODO 获取浙政钉用户dingKey,向其发送浙政钉工作通知 |
|
|
|
UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(currentUserId)); |
|
|
|
// 获取发送浙政钉工作通知必要信息 |
|
|
|
WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); |
|
|
|
String msg = String.format(PASS_MSG_TEMPLATE, null, projectName); |
|
|
|
// sendWorkNotice(auditUserInfo,msg); |
|
|
|
zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); |
|
|
|
return; |
|
|
|
} |
|
|
|
// 获取bpm对象 |
|
|
|
BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); |
|
|
|
// 若不是被退回项目,传节点定义key 获取当前节点 |
|
|
|
FlowNode currentNode = (FlowNode) bpmnModel.getFlowElement(task.getTaskDefinitionKey()); |
|
|
|
|
|
|
|
// TODO 若当前流程是预审流程,需要在提交预审申报的时候,调用状态机判断申报后的项目状态, |
|
|
|
// 若是省级部门联审中,要对接外部接口,获取省级部门联审的结果,更新项目状态(预审申报提交的时候处理) |
|
|
|
|
|
|
|
// 需要先通过后才能有下一个节点的信息 |
|
|
|
taskService.complete(param.getTaskId(), var); |
|
|
|
String nextUserId = getNextUserId(currentNode, processInstanceId); |
|
|
|
// 获取当前项目状态 |
|
|
|
Integer status = declaredProject.getStatus(); |
|
|
|
// 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 |
|
|
|
// 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 |
|
|
|
HistoricProcessInstance instance = historyService |
|
|
|
.createHistoricProcessInstanceQuery() |
|
|
|
.processInstanceId(processInstanceId) |
|
|
@@ -527,22 +547,63 @@ public class TodoCenterManage { |
|
|
|
throw new IllegalStateException("Unexpected value: " + status); |
|
|
|
} |
|
|
|
} |
|
|
|
// 若有下一个审核人(当前节点的用户),向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 |
|
|
|
// 若有下一个审核人(当前节点的用户), |
|
|
|
// 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 |
|
|
|
String nextUserId = getNextUserId(currentNode, processInstanceId); |
|
|
|
if (Objects.nonNull(nextUserId)) { |
|
|
|
// UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(nextUserId)); |
|
|
|
// TODO 获取浙政钉用户dingKey,向其发送浙政钉工作通知 |
|
|
|
// 获取浙政钉用户ID |
|
|
|
UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(nextUserId)); |
|
|
|
WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); |
|
|
|
String msg = String.format(PASS_MSG_TEMPLATE, null, projectName); |
|
|
|
// sendWorkNotice(auditUserInfo,msg); |
|
|
|
zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); |
|
|
|
} else { |
|
|
|
// 若没有,向发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 |
|
|
|
// TODO 向其发送浙政钉工作通知 获取根节点的孩子节点(即发起人节点),向其发送浙政钉工作通知 |
|
|
|
// 获取根节点即流程发起节点 |
|
|
|
// FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); |
|
|
|
// sendPassWorkNoticeToStartUser(task, projectName, rootNode); |
|
|
|
FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); |
|
|
|
String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); |
|
|
|
// 获取浙政钉用户ID |
|
|
|
UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(startUserId)); |
|
|
|
WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); |
|
|
|
WflowModels wflowModels = getLastWflowModels(task); |
|
|
|
String formName = wflowModels.getFormName(); |
|
|
|
String msg = String.format(PASS_MSG_TEMPLATE2, projectName, formName); |
|
|
|
zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取发送浙政钉工作通知的信息 |
|
|
|
* @param auditUserInfo |
|
|
|
* @return com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo |
|
|
|
* @author CMM |
|
|
|
* @since 2023/02/15 14:04 |
|
|
|
*/ |
|
|
|
private WorkNoticeInfo getSendWorkNoticeInfo(UserInfo auditUserInfo) { |
|
|
|
WorkNoticeInfo workNoticeInfo = new WorkNoticeInfo(); |
|
|
|
Long accountId = auditUserInfo.getAccountId(); |
|
|
|
if (Objects.isNull(accountId)){ |
|
|
|
throw new BizException("该用户没有录入浙政钉信息!"); |
|
|
|
} |
|
|
|
workNoticeInfo.setAccountId(accountId); |
|
|
|
// 根据浙政钉用户ID获取部门code |
|
|
|
DingEmployeeInfo employeeInfo = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) |
|
|
|
.eq(DingEmployeeInfo::getId, accountId)); |
|
|
|
String organizationCode = employeeInfo.getOrganizationCode(); |
|
|
|
workNoticeInfo.setOrganizationCode(organizationCode); |
|
|
|
// 根据部门code获取部门名称 |
|
|
|
DingOrganization dingOrganization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) |
|
|
|
.eq(DingOrganization::getOrganizationCode, organizationCode)); |
|
|
|
String organizationName = dingOrganization.getOrganizationName(); |
|
|
|
workNoticeInfo.setOrganizationName(organizationName); |
|
|
|
// 构建唯一的消息ID |
|
|
|
String bizMsgId = "ZD_WORK_NOTICE_" + "_" + organizationCode + "_" + organizationName + accountId; |
|
|
|
workNoticeInfo.setBizMsgId(bizMsgId); |
|
|
|
String receiverUserId = String.valueOf(accountId); |
|
|
|
workNoticeInfo.setReceiverUserId(receiverUserId); |
|
|
|
return workNoticeInfo; |
|
|
|
} |
|
|
|
/** |
|
|
|
* 当为通过操作时,更新项目表中项目状态 |
|
|
|
* |
|
|
|
* @param userId |
|
|
@@ -571,26 +632,6 @@ public class TodoCenterManage { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 给流程发起人发送工作通知 |
|
|
|
* |
|
|
|
* @param task 当前任务 |
|
|
|
* @param projectName 项目名称 |
|
|
|
* @param rootNode 流程发起节点 |
|
|
|
* @return void |
|
|
|
* @author CMM |
|
|
|
* @since 2023/02/03 |
|
|
|
*/ |
|
|
|
private void sendPassWorkNoticeToStartUser(Task task, String projectName, FlowNode rootNode) { |
|
|
|
String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); |
|
|
|
UserInfo startUserInfo = userInfoService.getById(Long.valueOf(startUserId)); |
|
|
|
// 从历史表获取最新版本的流程 |
|
|
|
WflowModels wflowModels = getLastWflowModels(task); |
|
|
|
String formName = wflowModels.getFormName(); |
|
|
|
String msg = String.format(PASS_MSG_TEMPLATE2, projectName, formName); |
|
|
|
sendWorkNotice(startUserInfo, msg); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取流程发起节点的用户ID |
|
|
|
* |
|
|
|
* @param rootNode 根节点 |
|
|
@@ -621,7 +662,6 @@ public class TodoCenterManage { |
|
|
|
return rootUserId; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取当前节点的下一个节点的审核用户ID |
|
|
|
* |
|
|
@@ -671,44 +711,6 @@ public class TodoCenterManage { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 发送浙政钉工作通知 |
|
|
|
* |
|
|
|
* @param auditUserInfo 审核人信息 |
|
|
|
* @param msg 要发送的工作通知 |
|
|
|
* @return void |
|
|
|
* @author CMM |
|
|
|
* @since 2023/02/01 |
|
|
|
*/ |
|
|
|
private void sendWorkNotice(UserInfo auditUserInfo, String msg) { |
|
|
|
// TODO 获取浙政钉唯一标识 |
|
|
|
// String dingKey = null; |
|
|
|
// IntelligentGetClient intelligentGetClient = client.newIntelligentGetClient(DingConstant.WORKING_NOTICE); |
|
|
|
// OapiMessageWorkNotificationRequest request = new OapiMessageWorkNotificationRequest(); |
|
|
|
// // 消息体(参考下文示例消息格式) |
|
|
|
// MessageText messageText = new MessageText(); |
|
|
|
// messageText.setMsgType("text"); |
|
|
|
// MessageContent messageContent = new MessageContent(); |
|
|
|
// |
|
|
|
// messageContent.setContent(msg); |
|
|
|
// messageText.setText(messageContent); |
|
|
|
// request.setMsg(JSONUtil.toJsonStr(messageText)); |
|
|
|
// // 构建唯一的消息ID |
|
|
|
// // String bizMsgId = "ZB_URGE_NOTICE_" + "_" + auditUserInfo.getDeptId() + "_" + auditUserInfo.getUserId(); |
|
|
|
// // request.setBizMsgId(bizMsgId); |
|
|
|
// request.setBizMsgId(null); |
|
|
|
// // 租户id |
|
|
|
// // request.setTenantId(GovDingProperties.tenantId.toString()); |
|
|
|
// request.setReceiverIds(dingKey); |
|
|
|
// // 获取结果 |
|
|
|
// OapiMessageWorkNotificationResponse apiResult = intelligentGetClient.get(request); |
|
|
|
// if (!apiResult.getSuccess() || !JSONUtil.parseObj(apiResult.getContent()).getBool("success")) { |
|
|
|
// log.warn("发送工作通知失败: {}", apiResult.getContent()); |
|
|
|
// throw new BizException(Status.BAD_REQUEST.toString()); |
|
|
|
// } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 撤销流程处理 |
|
|
|
* |
|
|
|
* @param handledTaskInstance 已处理的历史任务实例 |
|
|
@@ -813,8 +815,6 @@ public class TodoCenterManage { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 当为撤回操作时,更新项目表中的项目状态为前一个状态 |
|
|
|
* |
|
|
@@ -855,20 +855,18 @@ public class TodoCenterManage { |
|
|
|
Project declaredProject = projectService |
|
|
|
.getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId())); |
|
|
|
String projectName = declaredProject.getProjectName(); |
|
|
|
|
|
|
|
// 保存审核意见 |
|
|
|
if (hasComment(param.getAuditInfo())) { |
|
|
|
// 执行自定义的保存评论的功能 |
|
|
|
managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), |
|
|
|
String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取bpm对象 |
|
|
|
BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); |
|
|
|
// 传节点定义key 获取根节点即流程发起节点 |
|
|
|
FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); |
|
|
|
|
|
|
|
// TODO 流程变成【被退回】状态,待我处理中,为流程发起人增加一条待办记录, |
|
|
|
// 流程变成【被退回】状态,待我处理中,为流程发起人增加一条待办记录, |
|
|
|
// 执行自定义回退逻辑,回退到流程发起人 |
|
|
|
// 注意:因为审核人有执行退回的权限,且是退回到流程发起人,说明是在同一个流程实例中,所以项目状态不需要更新 |
|
|
|
managementService.executeCommand(new BackToHisApprovalNodeCmd(runtimeService, bpmnModel, param.getTaskId(), rootNode.getId())); |
|
|
@@ -883,40 +881,26 @@ public class TodoCenterManage { |
|
|
|
declaredProject.setUpdateBy(userId); |
|
|
|
projectService.updateById(declaredProject); |
|
|
|
// TODO 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 |
|
|
|
// sendBackWorkNoticeToStartUser(task, projectName, rootNode); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 给流程发起人发送流程退回工作通知 |
|
|
|
* |
|
|
|
* @param task |
|
|
|
* @param projectName |
|
|
|
* @param rootNode |
|
|
|
* @return void |
|
|
|
* @author CMM |
|
|
|
* @since 2023/02/14 15:32 |
|
|
|
*/ |
|
|
|
private void sendBackWorkNoticeToStartUser(Task task, String projectName, FlowNode rootNode) { |
|
|
|
String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); |
|
|
|
UserInfo startUserInfo = userInfoService.getById(Long.valueOf(startUserId)); |
|
|
|
// 从历史表获取最新版本的流程 |
|
|
|
UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(startUserId)); |
|
|
|
WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); |
|
|
|
WflowModels wflowModels = getLastWflowModels(task); |
|
|
|
String formName = wflowModels.getFormName(); |
|
|
|
String msg = String.format(PASS_MSG_TEMPLATE3, projectName, formName); |
|
|
|
sendWorkNotice(startUserInfo, msg); |
|
|
|
String msg = String.format(BACK_MSG_TEMPLATE, projectName, formName); |
|
|
|
zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询流程表单数据及审批的进度步骤 |
|
|
|
* |
|
|
|
* @param nodeId 当前获取流程人员关联的流程节点ID |
|
|
|
* @param instanceId 流程实例ID |
|
|
|
* @return 流程进度及表单详情 |
|
|
|
*/ |
|
|
|
public ProcessProgressDetailVo getProcessDetail(String nodeId, String instanceId) { |
|
|
|
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() |
|
|
|
.processInstanceId(instanceId).singleResult(); |
|
|
|
.processInstanceId(instanceId) |
|
|
|
.singleResult(); |
|
|
|
// 取表单及表单数据 |
|
|
|
HistoricVariableInstance forms = historyService.createHistoricVariableInstanceQuery() |
|
|
|
.processInstanceId(instanceId) |
|
|
@@ -927,7 +911,9 @@ public class TodoCenterManage { |
|
|
|
List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery().processInstanceId(instanceId).list(); |
|
|
|
formDatas = historyService |
|
|
|
.createHistoricVariableInstanceQuery() |
|
|
|
.executionIds(historicTaskInstances.stream().map(HistoricTaskInstance::getExecutionId).collect(Collectors.toSet())) |
|
|
|
.executionIds(historicTaskInstances.stream() |
|
|
|
.map(HistoricTaskInstance::getExecutionId) |
|
|
|
.collect(Collectors.toSet())) |
|
|
|
.processInstanceId(instanceId) |
|
|
|
.list(); |
|
|
|
} else { |
|
|
@@ -943,15 +929,17 @@ public class TodoCenterManage { |
|
|
|
ProcessNode<?> currentNode = null; |
|
|
|
if (StrUtil.isNotBlank(nodeId)) { |
|
|
|
// 搜索当前版本流程的配置 |
|
|
|
WflowModelHistorys modelHistory = modelHistorysMapper.selectOne( |
|
|
|
new QueryWrapper<>(WflowModelHistorys.builder().processDefId(instance.getProcessDefinitionId()) |
|
|
|
.version(instance.getProcessDefinitionVersion()).build())); |
|
|
|
WflowModelHistorys modelHistory = modelHistorysMapper.selectOne(new QueryWrapper<>(WflowModelHistorys.builder() |
|
|
|
.processDefId(instance.getProcessDefinitionId()) |
|
|
|
.version(instance.getProcessDefinitionVersion()) |
|
|
|
.build())); |
|
|
|
currentNode = nodeCatchService.reloadProcessByStr(modelHistory.getProcess()).get(nodeId); |
|
|
|
} |
|
|
|
UserDo users = orgRepositoryService.getUserById(instance.getStartUserId()); |
|
|
|
OrgUser startUser = |
|
|
|
OrgUser.builder().id(users.getUserId()).name(users.getUserName()).avatar(users.getAvatar()).build(); |
|
|
|
|
|
|
|
//UserInfo userInfo = userInfoService.getById(Long.valueOf(instance.getStartUserId())); |
|
|
|
//HashSet<String> userSet = new HashSet<>(); |
|
|
|
//userSet.add(String.valueOf(userInfo.getId())); |
|
|
|
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet); |
|
|
|
//UserInfoVO userInfoVO = userMap.get(userInfo.getId()); |
|
|
|
List<ProgressNode> taskRecords = getHisTaskRecords(instanceId, nodePropsValue); |
|
|
|
// 获取添加抄送任务 |
|
|
|
taskRecords.addAll(getCcTaskRecords(instanceId)); |
|
|
@@ -959,27 +947,32 @@ public class TodoCenterManage { |
|
|
|
// TODO 下版实现 获取等待中且还未开始的任务,如果存在条件则需要直接解析条件 |
|
|
|
taskRecords.addAll(getFutureTask(instanceId)); |
|
|
|
} |
|
|
|
taskRecords = |
|
|
|
taskRecords.stream().sorted(Comparator.comparing(ProgressNode::getStartTime)).collect(Collectors.toList()); |
|
|
|
taskRecords.add(0, |
|
|
|
ProgressNode.builder().nodeId("root").name("提交申请").user(startUser).nodeType(NodeTypeEnum.ROOT) |
|
|
|
.startTime(instance.getStartTime()).finishTime(instance.getStartTime()).taskId("root") |
|
|
|
.result(ProcessHandlerEnum.PASS).build()); |
|
|
|
taskRecords = taskRecords.stream() |
|
|
|
.sorted(Comparator.comparing(ProgressNode::getStartTime)) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
taskRecords.add(0, ProgressNode.builder() |
|
|
|
.nodeId("root") |
|
|
|
.name("提交申请") |
|
|
|
//.user(userInfoVO) |
|
|
|
.nodeType(NodeTypeEnum.ROOT) |
|
|
|
.startTime(instance.getStartTime()) |
|
|
|
.finishTime(instance.getStartTime()) |
|
|
|
.taskId("root") |
|
|
|
.result(ProcessHandlerEnum.PASS).build()); |
|
|
|
// 提取全量表单数据 |
|
|
|
Map<String, Object> formData = |
|
|
|
formDatas.stream().filter(CodeUtil.distinctByKey(HistoricVariableInstance::getVariableName)).collect( |
|
|
|
Collectors.toMap(HistoricVariableInstance::getVariableName, HistoricVariableInstance::getValue)); |
|
|
|
HistoricVariableInstance variableInstance = historyService.createHistoricVariableInstanceQuery() |
|
|
|
.processInstanceId(instanceId).variableName("owner").singleResult(); |
|
|
|
ProcessInstanceUserDto owner = (ProcessInstanceUserDto) variableInstance.getValue(); |
|
|
|
ProcessProgressDetailVo res = ProcessProgressDetailVo.builder().instanceId(instanceId) |
|
|
|
Map<String, Object> formData = formDatas.stream() |
|
|
|
.filter(CodeUtil.distinctByKey(HistoricVariableInstance::getVariableName)) |
|
|
|
.collect(Collectors.toMap(HistoricVariableInstance::getVariableName, HistoricVariableInstance::getValue)); |
|
|
|
ProcessProgressDetailVo res = ProcessProgressDetailVo.builder() |
|
|
|
.instanceId(instanceId) |
|
|
|
.version(instance.getProcessDefinitionVersion()) |
|
|
|
.formItems(formService.filterFormAndDataByPermConfig((List<Form>) forms.getValue(), formData, currentNode)) |
|
|
|
.formData(formData).processDefName(instance.getProcessDefinitionName()).startTempUser(startUser) |
|
|
|
.startDept(null == owner ? null : owner.getOrgName()).result(instance.getEndActivityId()) |
|
|
|
.startTime(instance.getStartTime()).progress(taskRecords).build(); |
|
|
|
// UserInfo userInfo = userInfoService.getById(Long.valueOf(instance.getStartUserId())); |
|
|
|
// res.setStartUser(userInfo); |
|
|
|
.formData(formData).processDefName(instance.getProcessDefinitionName()) |
|
|
|
.result(instance.getEndActivityId()) |
|
|
|
.startTime(instance.getStartTime()) |
|
|
|
.progress(taskRecords) |
|
|
|
.build(); |
|
|
|
//res.setStartUser(userInfoVO); |
|
|
|
if (Objects.isNull(instance.getEndActivityId())) { |
|
|
|
res.setStatus(ProcessStatusEnum.UNDER_REVIEW.name()); |
|
|
|
} else if (HisProInsEndActId.BACK.equals(instance.getEndActivityId())) { |
|
|
@@ -1001,16 +994,21 @@ public class TodoCenterManage { |
|
|
|
*/ |
|
|
|
private List<ProgressNode> getCcTaskRecords(String instanceId) { |
|
|
|
Set<String> ccUsers = new HashSet<>(); |
|
|
|
List<ProgressNode> ccList = ccTasksMapper |
|
|
|
.selectList(new QueryWrapper<WflowCcTasks>().eq("instance_id", instanceId)).stream().map(task -> { |
|
|
|
List<ProgressNode> ccList = ccTasksMapper.selectList(new QueryWrapper<WflowCcTasks>() |
|
|
|
.eq("instance_id", instanceId)) |
|
|
|
.stream() |
|
|
|
.map(task -> { |
|
|
|
ccUsers.add(task.getUserId()); |
|
|
|
return ProgressNode.builder().nodeId(task.getNodeId()).nodeType(NodeTypeEnum.CC) |
|
|
|
.name(task.getNodeName()).user(OrgUser.builder().id(task.getUserId()).build()) |
|
|
|
.startTime(task.getCreateTime()).finishTime(task.getCreateTime()).build(); |
|
|
|
.name(task.getNodeName()) |
|
|
|
.user(UserInfoVO.builder().userId(Long.valueOf(task.getUserId())).build()) |
|
|
|
.startTime(task.getCreateTime()) |
|
|
|
.finishTime(task.getCreateTime()) |
|
|
|
.build(); |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
if (isNotEmpty(ccUsers)) { |
|
|
|
Map<String, OrgUser> userMap = userDeptOrLeaderService.getUserMapByIds(ccUsers); |
|
|
|
ccList.stream().peek(v -> v.setUser(userMap.get(v.getUser().getId()))).collect(Collectors.toList()); |
|
|
|
Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(ccUsers); |
|
|
|
ccList.stream().peek(v -> v.setUser(userMap.get(v.getUser().getUserId()))).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
return ccList; |
|
|
|
} |
|
|
@@ -1027,20 +1025,25 @@ public class TodoCenterManage { |
|
|
|
.processInstanceId(instanceId).orderByHistoricActivityInstanceStartTime().asc().list(); |
|
|
|
Set<String> userSet = new HashSet<>(); |
|
|
|
// 获取节点处理结果 |
|
|
|
Map<String, |
|
|
|
ProcessHandlerEnum> varMap = historyService.createHistoricVariableInstanceQuery() |
|
|
|
.processInstanceId(instanceId).variableNameLike("approve_%").list().stream().collect( |
|
|
|
Collectors.toMap(HistoricVariableInstance::getVariableName, v -> (ProcessHandlerEnum) v.getValue())); |
|
|
|
Map<String, ProcessHandlerEnum> varMap = historyService.createHistoricVariableInstanceQuery() |
|
|
|
.processInstanceId(instanceId) |
|
|
|
.variableNameLike("approve_%") |
|
|
|
.list().stream() |
|
|
|
.collect(Collectors.toMap(HistoricVariableInstance::getVariableName, v -> (ProcessHandlerEnum) v.getValue())); |
|
|
|
|
|
|
|
Map<String, List<ProgressNodeAuditInfoVo>> commentMap = new HashMap<>(); |
|
|
|
// 统一处理所有评论数据,省的多次查询 |
|
|
|
List<ProgressNodeAuditInfoVo> cmvos = |
|
|
|
taskService.getProcessInstanceComments(instanceId).stream().map(comment -> { |
|
|
|
List<ProgressNodeAuditInfoVo> cmvos = taskService.getProcessInstanceComments(instanceId).stream() |
|
|
|
.map(comment -> { |
|
|
|
userSet.add(comment.getUserId()); |
|
|
|
ProgressNodeAuditInfoVo progressNodeAuditInfoVo = |
|
|
|
ProgressNodeAuditInfoVo.builder().id(comment.getId()).taskId(comment.getTaskId()) |
|
|
|
.commentType(comment.getType()).type("COMMENT").createTime(comment.getTime()) |
|
|
|
.user(UserInfo.builder().id(Long.valueOf(comment.getUserId())).build()).build(); |
|
|
|
ProgressNodeAuditInfoVo progressNodeAuditInfoVo = ProgressNodeAuditInfoVo.builder() |
|
|
|
.id(comment.getId()) |
|
|
|
.taskId(comment.getTaskId()) |
|
|
|
.commentType(comment.getType()) |
|
|
|
.type("COMMENT") |
|
|
|
.createTime(comment.getTime()) |
|
|
|
.user(UserInfoVO.builder().userId(Long.valueOf(comment.getUserId())).build()) |
|
|
|
.build(); |
|
|
|
ProcessComment processComment = JSONObject.parseObject(comment.getFullMessage(), ProcessComment.class); |
|
|
|
progressNodeAuditInfoVo.setText(processComment.getText()); |
|
|
|
progressNodeAuditInfoVo.setAttachments(processComment.getAttachments()); |
|
|
@@ -1055,23 +1058,29 @@ public class TodoCenterManage { |
|
|
|
// 再将评论按照任务一次构建,方便取出 |
|
|
|
Map<String, ProgressNodeAuditInfoVo> commentsMap = |
|
|
|
cmvos.stream().collect(Collectors.toMap(ProgressNodeAuditInfoVo::getTaskId, c -> c)); |
|
|
|
List<ProgressNode> progressNodes = |
|
|
|
list.stream().filter(his -> ObjectUtil.isNotNull(his.getTaskId())).map(his -> { |
|
|
|
List<ProgressNode> progressNodes = list.stream().filter(his -> ObjectUtil.isNotNull(his.getTaskId())) |
|
|
|
.map(his -> { |
|
|
|
Object props = nodeProps.get(his.getActivityId()); |
|
|
|
ApprovalModeEnum approvalMode = null; |
|
|
|
if (props instanceof ApprovalProps) { |
|
|
|
approvalMode = ((ApprovalProps) props).getMode(); |
|
|
|
} |
|
|
|
userSet.add(his.getAssignee()); |
|
|
|
return ProgressNode.builder().nodeId(his.getActivityId()).name(his.getActivityName()) |
|
|
|
.nodeType(NodeTypeEnum.APPROVAL).user(OrgUser.builder().id(his.getAssignee()).build()) |
|
|
|
.startTime(his.getStartTime()).finishTime(his.getEndTime()).taskId(his.getTaskId()) |
|
|
|
.approvalMode(approvalMode).auditInfo(commentsMap.get(his.getTaskId())) |
|
|
|
return ProgressNode.builder() |
|
|
|
.nodeId(his.getActivityId()) |
|
|
|
.name(his.getActivityName()) |
|
|
|
.nodeType(NodeTypeEnum.APPROVAL) |
|
|
|
.user(UserInfoVO.builder().userId(Long.valueOf(his.getAssignee())).build()) |
|
|
|
.startTime(his.getStartTime()) |
|
|
|
.finishTime(his.getEndTime()) |
|
|
|
.taskId(his.getTaskId()) |
|
|
|
.approvalMode(approvalMode) |
|
|
|
.auditInfo(commentsMap.get(his.getTaskId())) |
|
|
|
.result(varMap.get("approve_" + his.getTaskId())).build(); |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
if (isNotEmpty(userSet)) { |
|
|
|
Map<String, OrgUser> map = userDeptOrLeaderService.getUserMapByIds(userSet); |
|
|
|
progressNodes.forEach(n -> n.setUser(map.get(n.getUser().getId()))); |
|
|
|
Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet); |
|
|
|
progressNodes.stream().peek(v -> v.setUser(userMap.get(v.getUser().getUserId()))).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
return progressNodes; |
|
|
|
} |
|
|
@@ -1152,6 +1161,13 @@ public class TodoCenterManage { |
|
|
|
// 从已处理任务实例列表中取出当前登录用户及项目实例对应的任务实例 |
|
|
|
HistoricTaskInstance task = taskInstanceMap.get(d.getInstCode()); |
|
|
|
HistoricProcessInstance instance = instanceMap.get(task.getProcessInstanceId()); |
|
|
|
//HashSet<String> userSet = new HashSet<>(); |
|
|
|
//userSet.add(instance.getStartUserId()) ; |
|
|
|
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet); |
|
|
|
//res.setOwner(userMap.get(Long.valueOf(instance.getStartUserId()))); |
|
|
|
UserInfoVO owner = new UserInfoVO(); |
|
|
|
owner.setUserId(Long.valueOf(instance.getStartUserId())); |
|
|
|
res.setOwner(owner); |
|
|
|
// 从缓存取 |
|
|
|
staterUsers.add(instance.getStartUserId()); |
|
|
|
ProcessTaskVo processTaskVo = ProcessTaskVo.builder().taskId(task.getId()).taskName(task.getName()) |
|
|
@@ -1164,19 +1180,18 @@ public class TodoCenterManage { |
|
|
|
res.setProcessTaskInfo(processTaskVo); |
|
|
|
return res; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
// 取用户信息,减少数据库查询,一次构建 |
|
|
|
if (isNotEmpty(staterUsers)) { |
|
|
|
Map<String, OrgUser> userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); |
|
|
|
resVos.stream() |
|
|
|
.peek(v -> v.getProcessTaskInfo().setOwner(userMap.get(v.getProcessTaskInfo().getOwnerId()))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
// Map<Long,UserInfo> userMap = userInfoService.getUserMapByIds(staterUsers); |
|
|
|
// result = resVos.stream().peek(v -> v.setOwner(userMap.get(userId))) |
|
|
|
// .collect(Collectors.toList()); |
|
|
|
} |
|
|
|
if (isEmpty(resVos)) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
// 取用户信息,减少数据库查询,一次构建 |
|
|
|
List<ResToBeProcessedDTO> result = null; |
|
|
|
if (isNotEmpty(staterUsers)) { |
|
|
|
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(staterUsers); |
|
|
|
//result = resVos.stream().peek(v -> v.getProcessTaskInfo() |
|
|
|
// .setStartUser(userMap.get(Long.valueOf(v.getProcessTaskInfo().getOwnerId())))) |
|
|
|
// .collect(Collectors.toList()); |
|
|
|
} |
|
|
|
// return PageVo.of(result, total); |
|
|
|
return PageVo.of(resVos, total); |
|
|
|
} |
|
|
|
|
|
|
@@ -1329,24 +1344,30 @@ public class TodoCenterManage { |
|
|
|
res.setProcessLaunchTime(launchTime); |
|
|
|
HistoricProcessInstance ist = instanceMap.get(d.getInstCode()); |
|
|
|
staterUsers.add(ist.getStartUserId()); |
|
|
|
//HashSet<String> userSet = new HashSet<>(); |
|
|
|
//userSet.add(instance.getStartUserId()) ; |
|
|
|
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet); |
|
|
|
//res.setOwner(userMap.get(Long.valueOf(ist.getStartUserId()))); |
|
|
|
UserInfoVO owner = new UserInfoVO(); |
|
|
|
owner.setUserId(Long.valueOf(ist.getStartUserId())); |
|
|
|
res.setOwner(owner); |
|
|
|
ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist); |
|
|
|
res.setProcessInstanceInfo(processInstanceVo); |
|
|
|
return res; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if (isEmpty(resVos)) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
// 取用户信息,减少数据库查询,一次构建 |
|
|
|
List<ResToBeProcessedDTO> result = null; |
|
|
|
if (isNotEmpty(staterUsers)) { |
|
|
|
Map<String, OrgUser> userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); |
|
|
|
resVos.stream().map(v -> { |
|
|
|
v.getProcessInstanceInfo().setStaterUser(userMap.get(v.getProcessInstanceInfo().getStaterUserId())); |
|
|
|
return v; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(staterUsers); |
|
|
|
//result = resVos.stream() |
|
|
|
// .peek(v -> v.getProcessTaskInfo().setStartUser(userMap.get(Long.valueOf(v.getProcessTaskInfo().getOwnerId())))) |
|
|
|
// .collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
// if (CollectionUtil.isNotEmpty(staterUsers)) { |
|
|
|
// Map<Long, UserInfo> userMap = userInfoService.getUserMapByIds(staterUsers); |
|
|
|
// resVos.stream().peek(v -> v.setOwner(userMap.get(startUserId))) |
|
|
|
// .collect(Collectors.toList()); |
|
|
|
// } |
|
|
|
// return PageVo.of(result, total); |
|
|
|
return PageVo.of(resVos, total); |
|
|
|
} |
|
|
|
|
|
|
@@ -1546,24 +1567,29 @@ public class TodoCenterManage { |
|
|
|
res.setProcessLaunchTime(launchTime); |
|
|
|
HistoricProcessInstance ist = instanceMap.get(d.getInstCode()); |
|
|
|
staterUsers.add(ist.getStartUserId()); |
|
|
|
//HashSet<String> userSet = new HashSet<>(); |
|
|
|
//userSet.add(instance.getStartUserId()) ; |
|
|
|
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet); |
|
|
|
//res.setOwner(userMap.get(Long.valueOf(ist.getStartUserId()))); |
|
|
|
UserInfoVO owner = new UserInfoVO(); |
|
|
|
owner.setUserId(Long.valueOf(ist.getStartUserId())); |
|
|
|
res.setOwner(owner); |
|
|
|
ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist); |
|
|
|
res.setProcessInstanceInfo(processInstanceVo); |
|
|
|
return res; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if (isEmpty(resVos)) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
// 取用户信息,减少数据库查询,一次构建 |
|
|
|
List<ResToBeProcessedDTO> result = null; |
|
|
|
if (isNotEmpty(staterUsers)) { |
|
|
|
Map<String, OrgUser> userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); |
|
|
|
resVos.stream().map(v -> { |
|
|
|
v.getProcessInstanceInfo().setStaterUser(userMap.get(v.getProcessInstanceInfo().getStaterUserId())); |
|
|
|
return v; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(staterUsers); |
|
|
|
//result = resVos.stream() |
|
|
|
// .peek(v -> v.getProcessTaskInfo().setStartUser(userMap.get(Long.valueOf(v.getProcessTaskInfo().getOwnerId())))) |
|
|
|
// .collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
// if (CollectionUtil.isNotEmpty(staterUsers)) { |
|
|
|
// Map<Long, UserInfo> userMap = userInfoService.getUserMapByIds(staterUsers); |
|
|
|
// resVos.stream().peek(v -> v.setOwner(userMap.get(startUserId))) |
|
|
|
// .collect(Collectors.toList()); |
|
|
|
// } |
|
|
|
// return PageVo.of(result, total); |
|
|
|
return PageVo.of(resVos, total); |
|
|
|
} |
|
|
|
|
|
|
|