| | |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | |
| | | import com.ycl.domain.entity.*; |
| | | import com.ycl.domain.form.*; |
| | | import com.ycl.domain.json.*; |
| | | import com.ycl.domain.vo.CustomerTaskVO; |
| | | import com.ycl.domain.vo.IndexCustomerTaskVO; |
| | | import com.ycl.domain.vo.ProjectProcessDetailVO; |
| | | import com.ycl.domain.vo.*; |
| | | import com.ycl.event.event.TaskLogEvent; |
| | | import com.ycl.mapper.ProjectEngineeringMapper; |
| | | import com.ycl.mapper.ProjectInfoMapper; |
| | | import com.ycl.mapper.ProjectProcessMapper; |
| | | import com.ycl.service.*; |
| | | import com.ycl.common.base.Result; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.domain.vo.ProjectProcessVO; |
| | | import com.ycl.domain.query.ProjectProcessQuery; |
| | | import com.ycl.service.common.TaskCommonService; |
| | | import com.ycl.system.service.ISysDeptService; |
| | | import com.ycl.system.service.ISysDictTypeService; |
| | | import com.ycl.system.service.ISysRoleService; |
| | | import com.ycl.system.service.ISysUserService; |
| | | import com.ycl.utils.TreeUtil; |
| | | import lombok.Synchronized; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.flowable.bpmn.model.*; |
| | |
| | | private final IdentityService identityService; |
| | | private final RepositoryService repositoryService; |
| | | private final ProjectInfoMapper projectInfoMapper; |
| | | private final ProjectEngineeringMapper projectEngineeringMapper; |
| | | private final HistoryService historyService; |
| | | private final ISysUserService sysUserService; |
| | | private final ISysRoleService sysRoleService; |
| | |
| | | private final ISysDeptService deptService; |
| | | private final ProcessLogService processLogService; |
| | | private final ISysDictTypeService dictTypeService; |
| | | private final ProcessConfigInfoService processConfigInfoService; |
| | | |
| | | /** |
| | | * 分页查询 |
| | |
| | | IPage<ProjectProcessVO> page = PageUtil.getPage(query, ProjectProcessVO.class); |
| | | baseMapper.getPage(query, page); |
| | | for (ProjectProcessVO vo : page.getRecords()) { |
| | | if (Objects.nonNull(vo.getProcessDefId())) { |
| | | List<ProjectEngineeringVO> childList = baseMapper.getEngineeringList(vo.getId()); |
| | | childList.stream().forEach(child -> { |
| | | if (StringUtils.isNotBlank(child.getProcessDefId())) { |
| | | ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(child.getProcessDefId()).singleResult(); |
| | | if (Objects.nonNull(processDefinition)) { |
| | | child.setSuspended(processDefinition.isSuspended()); |
| | | child.setFlowableProcessName(processDefinition.getName() + "(v" + processDefinition.getVersion() + ")"); |
| | | child.setDeployId(processDefinition.getDeploymentId()); |
| | | } |
| | | } |
| | | }); |
| | | vo.setChildren(TreeUtil.treeForProjectEng(childList)); |
| | | vo.setStatus(vo.getProjectStatus()); |
| | | if (StringUtils.isNotBlank(vo.getProcessDefId())) { |
| | | ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(vo.getProcessDefId()).singleResult(); |
| | | if (Objects.nonNull(processDefinition)) { |
| | | vo.setSuspended(processDefinition.isSuspended()); |
| | |
| | | // 查询该项目是否已经绑定过流程了,检查绑定的流程是否在运行,在运行就删了 |
| | | ProjectProcess pp = new LambdaQueryChainWrapper<>(baseMapper) |
| | | .eq(ProjectProcess::getProjectId, form.getProjectId()) |
| | | .eq(ProjectProcess::getProjectType, form.getProjectType()) |
| | | .one(); |
| | | if (Objects.isNull(pp)) { |
| | | throw new RuntimeException("该项目未绑定流程"); |
| | |
| | | } |
| | | } |
| | | } |
| | | ProjectInfo project = new LambdaQueryChainWrapper<>(projectInfoMapper) |
| | | .select(ProjectInfo::getCreateBy) |
| | | .eq(ProjectInfo::getId, form.getProjectId()) |
| | | .one(); |
| | | if (Objects.isNull(project)) { |
| | | throw new RuntimeException("项目不存在"); |
| | | Long unitId = null; |
| | | if (ProjectProcessTypeEnum.PROJECT.equals(form.getProjectType())) { |
| | | ProjectInfo project = new LambdaQueryChainWrapper<>(projectInfoMapper) |
| | | .eq(ProjectInfo::getId, form.getProjectId()) |
| | | .one(); |
| | | if (Objects.isNull(project)) { |
| | | throw new RuntimeException("项目不存在"); |
| | | } |
| | | unitId = project.getProjectOwnerUnit(); |
| | | } else if (ProjectProcessTypeEnum.ENGINEERING.equals(form.getProjectType())) { |
| | | ProjectEngineering projectEngineering = new LambdaQueryChainWrapper<>(projectEngineeringMapper) |
| | | .eq(ProjectEngineering::getId, form.getProjectId()) |
| | | .one(); |
| | | if (Objects.isNull(projectEngineering)) { |
| | | throw new RuntimeException("工程不存在"); |
| | | } |
| | | unitId = projectEngineering.getUnit(); |
| | | } |
| | | SysDept dept = deptService.selectDeptById(project.getProjectOwnerUnit()); |
| | | |
| | | SysDept dept = deptService.selectDeptById(unitId); |
| | | if (Objects.isNull(dept)) { |
| | | throw new RuntimeException("项目业主单位不存在"); |
| | | throw new RuntimeException("业主单位不存在"); |
| | | } |
| | | String processInsId = this.startPro(form.getProjectId(), form.getProcessDefId(), dept.getDeptId()); |
| | | new LambdaUpdateChainWrapper<>(baseMapper) |
| | | .eq(ProjectProcess::getProjectId, form.getProjectId()) |
| | | .eq(ProjectProcess::getProjectType, form.getProjectType()) |
| | | .set(ProjectProcess::getProcessDefId, form.getProcessDefId()) |
| | | .set(ProjectProcess::getProcessInsId, processInsId) |
| | | .set(ProjectProcess::getDataLaunch, project.getProjectOwnerUnit()) |
| | | .set(ProjectProcess::getDataLaunch, unitId) |
| | | .update(); |
| | | |
| | | return Result.ok("流程变更成功"); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Result startProcess(Long projectId, String processDefId) { |
| | | ProjectInfo project = projectInfoMapper.selectById(projectId); |
| | | if (Objects.isNull(project)) { |
| | | throw new RuntimeException("项目不存在"); |
| | | public Result startProcess(ProjectProcessForm form) { |
| | | Long unitId = null; |
| | | if (ProjectProcessTypeEnum.PROJECT.equals(form.getProjectType())) { |
| | | ProjectInfo project = new LambdaQueryChainWrapper<>(projectInfoMapper) |
| | | .eq(ProjectInfo::getId, form.getProjectId()) |
| | | .one(); |
| | | if (Objects.isNull(project)) { |
| | | throw new RuntimeException("项目不存在"); |
| | | } |
| | | unitId = project.getProjectOwnerUnit(); |
| | | } else if (ProjectProcessTypeEnum.ENGINEERING.equals(form.getProjectType())) { |
| | | ProjectEngineering projectEngineering = new LambdaQueryChainWrapper<>(projectEngineeringMapper) |
| | | .eq(ProjectEngineering::getId, form.getProjectId()) |
| | | .one(); |
| | | if (Objects.isNull(projectEngineering)) { |
| | | throw new RuntimeException("工程不存在"); |
| | | } |
| | | unitId = projectEngineering.getUnit(); |
| | | } |
| | | SysDept dept = deptService.selectDeptById(project.getProjectOwnerUnit()); |
| | | SysDept dept = deptService.selectDeptById(unitId); |
| | | if (Objects.isNull(dept)) { |
| | | throw new RuntimeException("项目业主单位不存在"); |
| | | throw new RuntimeException("业主单位不存在"); |
| | | } |
| | | String processInsId = this.startPro(projectId, processDefId, dept.getDeptId()); |
| | | String processInsId = this.startPro(form.getProjectId(), form.getProcessDefId(), dept.getDeptId()); |
| | | ProjectProcess entity = new ProjectProcess(); |
| | | entity.setProjectId(projectId); |
| | | entity.setProcessDefId(processDefId); |
| | | entity.setProjectId(form.getProjectId()); |
| | | entity.setProcessDefId(form.getProcessDefId()); |
| | | entity.setProcessInsId(processInsId); |
| | | entity.setDataLaunch(project.getProjectOwnerUnit()); |
| | | entity.setDataLaunch(unitId); |
| | | entity.setProjectType(form.getProjectType()); |
| | | baseMapper.insert(entity); |
| | | |
| | | return Result.ok("流程启动成功"); |
| | |
| | | * @param processDefId |
| | | * @return |
| | | */ |
| | | private String startPro(Long projectId, String processDefId, Long createBy) { |
| | | private String startPro(String projectId, String processDefId, Long createBy) { |
| | | |
| | | |
| | | ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefId) |
| | |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | identityService.setAuthenticatedUserId(sysUser.getUserId().toString()); |
| | | variables.put(ProcessConstants.PROCESS_INITIATOR, sysUser.getUserId()); |
| | | //测试容缺 |
| | | variables.put("miss", true); |
| | | // 将该项目的申请人(业主方)作为流程中某些环节的处理人 |
| | | variables.put(ProcessConstants.DATA_LAUNCH, "dept:" + createBy); |
| | | variables.put("a", 1); |
| | | ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefId, projectId + "", variables); |
| | | return processInstance.getId(); |
| | | } |
| | |
| | | /** |
| | | * 获取流程详情 |
| | | * |
| | | * @param projectId |
| | | * @param form |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result detail(Long projectId, String processDefId) { |
| | | // 项目信息 |
| | | ProjectInfo projectInfo = new LambdaQueryChainWrapper<>(projectInfoMapper) |
| | | .select(ProjectInfo::getId, ProjectInfo::getProjectName, ProjectInfo::getProjectCode) |
| | | .eq(ProjectInfo::getId, projectId) |
| | | .one(); |
| | | public Result detail(ProjectProcessForm form) { |
| | | |
| | | if (Objects.isNull(projectInfo)) { |
| | | return Result.error("该项目不存在"); |
| | | String projectName = ""; |
| | | String projectCode = ""; |
| | | if (ProjectProcessTypeEnum.PROJECT.equals(form.getProjectType())) { |
| | | ProjectInfo projectInfo = projectInfoMapper.selectById(form.getProjectId()); |
| | | if (Objects.isNull(projectInfo)) { |
| | | throw new RuntimeException("项目不存在"); |
| | | } |
| | | projectName = projectInfo.getProjectName(); |
| | | projectCode = projectInfo.getProjectCode(); |
| | | } else if (ProjectProcessTypeEnum.ENGINEERING.equals(form.getProjectType())) { |
| | | ProjectEngineering projectEngineering = projectEngineeringMapper.selectById(form.getProjectId()); |
| | | if (Objects.isNull(projectEngineering)) { |
| | | throw new RuntimeException("工程不存在"); |
| | | } |
| | | projectName = projectEngineering.getProjectName(); |
| | | } |
| | | |
| | | ProjectProcess projectProcess = new LambdaQueryChainWrapper<>(baseMapper) |
| | | .eq(ProjectProcess::getProjectId, projectId) |
| | | .eq(ProjectProcess::getProcessDefId, processDefId) |
| | | .eq(ProjectProcess::getProjectId, form.getProjectId()) |
| | | .eq(ProjectProcess::getProcessDefId, form.getProcessDefId()) |
| | | .eq(ProjectProcess::getProjectType, form.getProjectType()) |
| | | .one(); |
| | | if (Objects.isNull(projectProcess)) { |
| | | return Result.error("该项目未设置流程"); |
| | | return Result.error("未设置流程"); |
| | | } |
| | | |
| | | ProjectProcessDetailVO detail = new ProjectProcessDetailVO(); |
| | | detail.setProjectId(projectId); |
| | | detail.setProjectName(projectInfo.getProjectName()); |
| | | detail.setProjectCode(projectInfo.getProjectCode()); |
| | | detail.setProjectType(form.getProjectType().getValue()); |
| | | detail.setProjectId(form.getProjectId()); |
| | | |
| | | |
| | | detail.setProjectName(projectName); |
| | | detail.setProjectCode(projectCode); |
| | | |
| | | ProjectProcessDetailVO.TaskStatistics taskStatistics = new ProjectProcessDetailVO.TaskStatistics(); |
| | | // 状态统计 |
| | | taskStatistics.setTotalTaskNum(this.getTotalTaskNum(processDefId)); |
| | | taskStatistics.setTotalTaskNum(this.getTotalTaskNum(form.getProcessDefId())); |
| | | taskStatistics.setTodoTaskNum(this.getTodoTaskNum(projectProcess.getProcessInsId())); |
| | | taskStatistics.setRemainingTaskNum(this.getRemainingTaskNum(processDefId, projectProcess.getProcessInsId(), taskStatistics.getTotalTaskNum())); |
| | | taskStatistics.setRemainingTaskNum(this.getRemainingTaskNum(form.getProcessDefId(), projectProcess.getProcessInsId(), taskStatistics.getTotalTaskNum())); |
| | | taskStatistics.setTimelyFinishedTaskNum(this.getTimelyTaskNum(projectProcess.getProcessInsId())); |
| | | taskStatistics.setOvertimeTaskNum(this.getOvertimeTaskNum(projectProcess.getProcessInsId())); |
| | | taskStatistics.setWillOvertimeTaskNum(this.getWillOvertimeTaskNum(projectProcess.getProcessInsId())); |
| | |
| | | this.getTodoTaskList(query.getProjectId(), projectProcess.getProcessInsId(), query.getTaskName(), (int) query.getPageSize(), (int) query.getCurrentPage(), ok); |
| | | ok.data(ok.get("taskList")); |
| | | break; |
| | | case TaskTypeConstant.CURRENT: |
| | | case TaskTypeConstant.WAIT: |
| | | this.getWaitTask(query.getProjectId(), query.getProcessDefId(), projectProcess.getProcessInsId(), query.getTaskName(), (int) query.getCurrentPage(), (int) query.getPageSize(), ok); |
| | | break; |
| | | case TaskTypeConstant.REMAINING: |
| | | this.getRemainingTask(query.getProjectId(), query.getProcessDefId(), projectProcess.getProcessInsId(), query.getTaskName(), (int) query.getCurrentPage(), (int) query.getPageSize(), ok); |
| | | break; |
| | | case TaskTypeConstant.TIMELY: |
| | | this.getTimelyTask(query.getProcessDefId(), projectProcess.getProcessInsId(), query.getTaskName(), (int) query.getCurrentPage(), (int) query.getPageSize(), ok); |
| | | this.getTimelyTask(query.getProjectId(), query.getProcessDefId(), projectProcess.getProcessInsId(), query.getTaskName(), (int) query.getCurrentPage(), (int) query.getPageSize(), ok); |
| | | break; |
| | | case TaskTypeConstant.OVERTIME: |
| | | this.getOvertimeTask(query.getProjectId(), query.getProcessDefId(), projectProcess.getProcessInsId(), query.getTaskName(), (int) query.getCurrentPage(), (int) query.getPageSize(), ok); |
| | |
| | | .active() |
| | | .includeProcessVariables() |
| | | .orderByTaskCreateTime().desc(); |
| | | |
| | | List<String> insIds = baseMapper.getNormalInsIds(); |
| | | if (CollectionUtils.isEmpty(insIds)) { |
| | | result.data(new ArrayList<>()).total(0L); |
| | | return; |
| | | } else { |
| | | taskQuery.processInstanceIdIn(insIds); |
| | | } |
| | | if (StringUtils.isNotBlank(taskName)) { |
| | | taskQuery.processDefinitionNameLike(taskName); |
| | | taskQuery.taskNameLike(taskName); |
| | | } |
| | | if (!SecurityUtils.getLoginUser().getUser().isAdmin()) { |
| | | taskQuery |
| | |
| | | taskVO.setTaskDefinitionKey(task.getTaskDefinitionKey()); |
| | | |
| | | // 流程项目信息 |
| | | ProjectInfo project = baseMapper.getProjectInfo(task.getProcessInstanceId()); |
| | | if (Objects.nonNull(project)) { |
| | | taskVO.setProjectId(project.getId()); |
| | | taskVO.setProjectName(project.getProjectName()); |
| | | } else { |
| | | continue; |
| | | ProjectProcess projectProcess = new LambdaQueryChainWrapper<>(baseMapper) |
| | | .eq(ProjectProcess::getProcessInsId, task.getProcessInstanceId()) |
| | | .one(); |
| | | String projectId = ""; |
| | | String projectName = ""; |
| | | if (Objects.nonNull(projectProcess)) { |
| | | if (projectProcess.getProjectType().equals(ProjectProcessTypeEnum.PROJECT)) { |
| | | ProjectInfo project = projectInfoMapper.selectById(projectProcess.getProjectId()); |
| | | if (Objects.nonNull(project)) { |
| | | projectId = projectProcess.getProjectId(); |
| | | projectName = project.getProjectName(); |
| | | } |
| | | } else if (projectProcess.getProjectType().equals(ProjectProcessTypeEnum.ENGINEERING)) { |
| | | ProjectEngineering engineering = projectEngineeringMapper.selectById(projectProcess.getProjectId()); |
| | | if (Objects.nonNull(engineering)) { |
| | | projectId = projectProcess.getProjectId(); |
| | | projectName = engineering.getProjectName(); |
| | | } |
| | | } |
| | | } |
| | | taskVO.setProjectId(projectId); |
| | | taskVO.setProjectName(projectName); |
| | | |
| | | // 流程发起人信息 |
| | | this.setPromoterInfo(taskVO); |
| | |
| | | if (processLogService.taskIsHangup(task.getId(), task.getProcessInstanceId())) { |
| | | taskVO.setTaskStatus(TaskStatusEnum.HANGUP); |
| | | } |
| | | |
| | | // 计算办理时间 |
| | | ProcessCoding processCoding = processCodingService.getByTaskId(task.getId(), task.getProcessInstanceId()); |
| | | if (Objects.nonNull(processCoding)) { |
| | | if (StringUtils.isNotBlank(processCoding.getRedTime())) { |
| | | Long overtime = getTime(processCoding.getRedTime()); |
| | | long durationTime = 0l; |
| | | if (Objects.nonNull(processCoding.getStartTaskTime())) { |
| | | durationTime = ((new Date()).getTime() - processCoding.getStartTaskTime().getTime()) / 1000; |
| | | } |
| | | if (overtime > durationTime) { |
| | | taskVO.setRemainingTime((overtime - durationTime) / 3600 + "小时"); |
| | | } else { |
| | | taskVO.setRemainingTime("已超时"); |
| | | } |
| | | } else { |
| | | taskVO.setRemainingTime("-"); |
| | | } |
| | | } else { |
| | | taskVO.setRemainingTime("-"); |
| | | } |
| | | this.distinctVo(taskVO); |
| | | vos.add(taskVO); |
| | | } |
| | | if (vos.size() < pageSize) { |
| | | result.total(vos.size()); |
| | | } |
| | | result.put("taskList", vos); |
| | | } |
| | | |
| | | private Long getTime(String timeStr) { |
| | | Long time = null; |
| | | if (StringUtils.isNotBlank(timeStr)) { |
| | | String[] timeArr = timeStr.split("-"); |
| | | // 解析天数和小时数 |
| | | int days = Integer.parseInt(timeArr[0]); |
| | | int hours = 0; |
| | | if (timeArr.length > 1) { |
| | | hours = Integer.parseInt(timeArr[1]); |
| | | } |
| | | time = (days * 24L + hours) * 3600L; |
| | | // //分-秒 |
| | | // time= (days * 60L) + hours; |
| | | } |
| | | return time; |
| | | } |
| | | |
| | | @Override |
| | |
| | | jsonData.setAfterHandlerIds(afterHandlerIds); |
| | | jsonData.setAfterHandlerType(form.getPeopleType()); |
| | | // 发布转办事件 |
| | | publisher.publishEvent(new TaskLogEvent(this, null,SecurityUtils.getUserId(), form.getProjectId(), form.getProcessInsId(), task.getId(), task.getName(),ProcessLogEventTypeEnum.DELEGATE, jsonData)); |
| | | publisher.publishEvent(new TaskLogEvent(this, null, SecurityUtils.getUserId(), form.getProjectId(), form.getProcessInsId(), task.getId(), task.getTaskDefinitionKey(), task.getName(), ProcessLogEventTypeEnum.DELEGATE, jsonData)); |
| | | |
| | | return Result.ok("转办成功"); |
| | | } |
| | |
| | | Task task = taskService.createTaskQuery().taskId(form.getTaskId()).processInstanceId(form.getProcessInsId()).singleResult(); |
| | | if (Objects.nonNull(task)) { |
| | | // 添加跳过日志 |
| | | publisher.publishEvent(new TaskLogEvent(this, null,SecurityUtils.getUserId(), form.getProjectId(), form.getProcessInsId(), form.getTaskId(), task.getName(),ProcessLogEventTypeEnum.JUMP, new JumpData(form.getDesc()))); |
| | | publisher.publishEvent(new TaskLogEvent(this, null, SecurityUtils.getUserId(), form.getProjectId(), form.getProcessInsId(), task.getId(), task.getTaskDefinitionKey(), task.getName(), ProcessLogEventTypeEnum.JUMP, new JumpData(form.getDesc()))); |
| | | // 查出该任务绑定的表单 |
| | | |
| | | Map<String, Object> data = new HashMap<>(1); |
| | |
| | | } |
| | | } |
| | | // 完成任务 |
| | | flowTaskService.completeSubmitForm(form.getTaskId(), data); |
| | | flowTaskService.completeSubmitForm(form.getTaskId(), data, Boolean.FALSE); |
| | | } |
| | | return Result.ok("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public Result taskWait(TaskWaitForm form) { |
| | | Task task = taskService.createTaskQuery().taskId(form.getTaskId()).processInstanceId(form.getProcessInsId()).singleResult(); |
| | | if (Objects.nonNull(task)) { |
| | | // 添加容缺日志 |
| | | publisher.publishEvent(new TaskLogEvent(this, |
| | | null, |
| | | SecurityUtils.getUserId(), |
| | | form.getProjectId(), |
| | | form.getProcessInsId(), |
| | | task.getId(), |
| | | task.getTaskDefinitionKey(), |
| | | task.getName(), |
| | | ProcessLogEventTypeEnum.WAIT, |
| | | new WaitData(form.getDesc()))); |
| | | // 查出该任务绑定的表单 |
| | | Map<String, Object> data = new HashMap<>(1); |
| | | if (StringUtils.isNotBlank(task.getFormKey())) { |
| | | SysForm sysForm = formService.selectSysFormById(Long.parseLong(task.getFormKey())); |
| | | if (Objects.nonNull(sysForm)) { |
| | | data.put(ProcessConstants.TASK_FORM_KEY, JSONObject.parseObject(sysForm.getFormContent())); |
| | | } |
| | | } |
| | | // 完成任务 |
| | | flowTaskService.completeSubmitForm(form.getTaskId(), data, Boolean.FALSE); |
| | | } |
| | | return Result.ok("操作成功"); |
| | | } |
| | |
| | | @Override |
| | | public Result taskSupervise(TaskSuperviseForm form) { |
| | | Task task = taskService.createTaskQuery().taskId(form.getTaskId()).singleResult(); |
| | | if (Objects.isNull(task)) { |
| | | throw new RuntimeException("任务不存在"); |
| | | } |
| | | SuperviseData jsonData = new SuperviseData(); |
| | | jsonData.setCreateTime(new Date()); |
| | | jsonData.setContent(form.getContent()); |
| | |
| | | jsonData.setReceiverIds(form.getReceiverIds()); |
| | | jsonData.setReceiverType(form.getReceiverType()); |
| | | jsonData.setSuperviseType(form.getSuperviseType()); |
| | | QueryWrapper<ProcessLog> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("task_id", form.getTaskId()); |
| | | queryWrapper.eq("event_type", ProcessLogEventTypeEnum.SUPERVISE); |
| | | queryWrapper.eq("process_ins_id", form.getProcessInsId()); |
| | | //查询督办日志 |
| | | ProcessLog processLog = processLogService.getOne(queryWrapper); |
| | | |
| | | ProcessLog processLog = new LambdaQueryChainWrapper<>(processLogService.getBaseMapper()) |
| | | .eq(ProcessLog::getTaskId, form.getTaskId()) |
| | | .eq(ProcessLog::getEventType, ProcessLogEventTypeEnum.SUPERVISE) |
| | | .eq(ProcessLog::getProcessInsId, task.getProcessInstanceId()) |
| | | .one(); |
| | | List<SuperviseData> dataList; |
| | | if (processLog != null) { |
| | | String eventDataJson = processLog.getEventDataJson(); |
| | |
| | | } |
| | | dataList.add(jsonData); |
| | | //添加督办日志 |
| | | publisher.publishEvent(new TaskLogEvent(this, processLog.getId(), processLog.getUserId(), form.getProjectId(), form.getProcessInsId(), form.getTaskId(), task.getName(),ProcessLogEventTypeEnum.SUPERVISE, dataList)); |
| | | publisher.publishEvent(new TaskLogEvent(this, |
| | | processLog.getId(), |
| | | processLog.getUserId(), |
| | | form.getProjectId(), |
| | | task.getProcessInstanceId(), |
| | | form.getTaskId(), |
| | | task.getTaskDefinitionKey(), |
| | | task.getName(), |
| | | ProcessLogEventTypeEnum.SUPERVISE, |
| | | dataList)); |
| | | return Result.ok("操作成功"); |
| | | } |
| | | |
| | |
| | | form.getProjectId(), |
| | | form.getProcessInsId(), |
| | | form.getTaskId(), |
| | | task.getTaskDefinitionKey(), |
| | | task.getName(), |
| | | ProcessLogEventTypeEnum.HANGUP, |
| | | new HangupData(form.getReason()) |
| | | )); |
| | | )); |
| | | return Result.ok("操作成功"); |
| | | } |
| | | |
| | |
| | | form.getProjectId(), |
| | | form.getProcessInsId(), |
| | | form.getTaskId(), |
| | | task.getTaskDefinitionKey(), |
| | | task.getName(), |
| | | ProcessLogEventTypeEnum.CANCEL_HANGUP, |
| | | new HangupData(form.getReason()) |
| | |
| | | newV.put(task.getTaskDefinitionKey() + "&" + key, form.getVariables().get(key)); |
| | | //字典里有就放入流程变量中 |
| | | if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(dictList) && dictList.contains(key)) { |
| | | processVariables.put(key,form.getVariables().get(key)); |
| | | processVariables.put(key, form.getVariables().get(key)); |
| | | } |
| | | } |
| | | } |
| | | if( !processVariables.isEmpty() ) { |
| | | if (!processVariables.isEmpty()) { |
| | | taskService.setVariables(form.getTaskId(), processVariables); |
| | | } |
| | | |
| | |
| | | form.getProjectId(), |
| | | form.getProcessInsId(), |
| | | form.getTaskId(), |
| | | task.getTaskDefinitionKey(), |
| | | task.getName(), |
| | | ProcessLogEventTypeEnum.TEAM_WORK, |
| | | new TeamWorkData(form.getHandlerType(), form.getHandlerIds(), TeamWorkStatusEnum.NOT_FINISHED) |
| | |
| | | * @param pageNum |
| | | * @param result |
| | | */ |
| | | public void getTodoTaskList(Long projectId, String processInsId, String taskName, int pageSize, int pageNum, Result result) { |
| | | public void getTodoTaskList(String projectId, String processInsId, String taskName, int pageSize, int pageNum, Result result) { |
| | | |
| | | TaskQuery taskQuery = taskService.createTaskQuery() |
| | | .active() |
| | | .processInstanceId(processInsId) |
| | |
| | | .desc(); |
| | | |
| | | if (StringUtils.isNotBlank(taskName)) { |
| | | taskQuery.processDefinitionNameLike(taskName); |
| | | taskQuery.taskNameLike(taskName); |
| | | } |
| | | result.total(taskQuery.count()); |
| | | List<Task> taskList = taskQuery.listPage(pageSize * (pageNum - 1), pageSize); |
| | |
| | | * @param result |
| | | * @return |
| | | */ |
| | | private List<CustomerTaskVO> getAllUserTask(Long projectId, String processDefinitionId, String processInsId, String taskName, Integer pageNum, Integer pageSize, Result result) { |
| | | private List<CustomerTaskVO> getAllUserTask(String projectId, String processDefinitionId, String processInsId, String taskName, Integer pageNum, Integer pageSize, Result result) { |
| | | int startNum = pageSize * (pageNum - 1); |
| | | int endNum = startNum + pageSize; |
| | | List<UserTask> allUserTaskElement = this.getAllUserTaskElement(processDefinitionId); |
| | |
| | | ProcessInstance process = runtimeService.createProcessInstanceQuery().processInstanceId(processInsId).singleResult(); |
| | | if (Objects.isNull(process)) { |
| | | // 如果运行时找不到说明是已完成的流程,直接查历史任务 |
| | | List<CustomerTaskVO> vos = this.getFinishedProcessTaskInfo(userTasks, processInsId, processDefinitionId); |
| | | List<CustomerTaskVO> vos = this.getFinishedProcessTaskInfo(userTasks, projectId, processInsId, processDefinitionId); |
| | | result.data(vos); |
| | | return vos; |
| | | } |
| | |
| | | List<String> handlerNames = new ArrayList<>(2); |
| | | List<Long> handlerUnitIds = new ArrayList<>(2); |
| | | List<String> handlerUnitNames = new ArrayList<>(2); |
| | | List<String> promoterNames = new ArrayList<>(2); |
| | | List<String> promoterUnitNames = new ArrayList<>(2); |
| | | vo.setHandlerId(handlerIds); |
| | | vo.setHandlerName(handlerNames); |
| | | vo.setHandlerUnitId(handlerUnitIds); |
| | | vo.setHandlerUnitName(handlerUnitNames); |
| | | vo.setPromoterName(promoterNames); |
| | | vo.setPromoterUnitName(promoterUnitNames); |
| | | |
| | | this.setCandidateInfo(userTask, vo, projectId, processInsId); |
| | | |
| | | if (Objects.isNull(task)) { |
| | | // 如果任务在运行时没找到,那么可能为未开始或者已完成,需要从历史任务中再找一下 |
| | |
| | | .desc() |
| | | .list(); |
| | | if (CollectionUtils.isEmpty(historicTasks)) { |
| | | vo.setPromoterName("暂无"); |
| | | vo.setPromoterUnitName("暂无"); |
| | | // 未开始的任务,其关联的用户组这些都可以从UserTask中拿到,因为本身未开始的任务是没有task的,所以这里直接查 |
| | | if (StringUtils.isNotBlank(userTask.getAssignee())) { |
| | | vo.setHandlerType(HandlerTypeEnum.USER); |
| | | SysUser sysUser = sysUserService.selectUserById(Long.parseLong(userTask.getAssignee())); |
| | | if (Objects.nonNull(sysUser)) { |
| | | handlerIds.add(sysUser.getUserId()); |
| | | handlerNames.add(sysUser.getNickName()); |
| | | vo.getHandlerId().add(sysUser.getUserId()); |
| | | vo.getHandlerName().add(this.getUserShowName(sysUser)); |
| | | if (Objects.nonNull(sysUser.getDept())) { |
| | | handlerUnitIds.add(sysUser.getDept().getDeptId()); |
| | | handlerUnitNames.add(sysUser.getDept().getDeptName()); |
| | | vo.getHandlerUnitId().add(sysUser.getDept().getDeptId()); |
| | | vo.getHandlerUnitName().add(sysUser.getDept().getDeptName()); |
| | | } |
| | | } |
| | | |
| | | } else if (CollectionUtil.isNotEmpty(userTask.getCandidateGroups())) { |
| | | List<String> groupIds = userTask.getCandidateGroups(); |
| | | for (String groupId : groupIds) { |
| | | // 处理变量表达式,DATA_LAUNCH只可能是部门不会是角色,因为代表的是业主部门 |
| | | if (groupId.contains(ProcessConstants.DATA_LAUNCH)) { |
| | | vo.setHandlerType(HandlerTypeEnum.DEPT); |
| | | this.varYzReview(vo, projectId, processInsId, HandlerTypeEnum.DEPT); |
| | | this.varYzReview(vo, projectId, processInsId, HandlerTypeEnum.DEPT, 1); |
| | | } else if (groupId.startsWith("dept")) { // 部门的id是加了前缀的如:dept:1 |
| | | vo.setHandlerType(HandlerTypeEnum.DEPT); |
| | | String[] split = groupId.split(":"); |
| | |
| | | // 部门 |
| | | SysDept dept = sysDeptService.selectDeptById(Long.parseLong(split[1])); |
| | | if (Objects.nonNull(dept)) { |
| | | handlerUnitIds.add(dept.getDeptId()); |
| | | handlerUnitNames.add(dept.getDeptName()); |
| | | vo.getHandlerUnitId().add(dept.getDeptId()); |
| | | vo.getHandlerUnitName().add(dept.getDeptName()); |
| | | vo.getHandlerName().add(this.getDeptLeaderShowName(dept)); |
| | | } |
| | | } |
| | | } else { |
| | | vo.setHandlerType(HandlerTypeEnum.ROLE); |
| | | SysRole role = sysRoleService.selectRoleById(Long.parseLong(groupId)); |
| | | if (Objects.nonNull(role)) { |
| | | handlerUnitIds.add(role.getRoleId()); |
| | | handlerUnitNames.add(role.getRoleName()); |
| | | vo.getHandlerUnitId().add(role.getRoleId()); |
| | | vo.getHandlerUnitName().add(role.getRoleName()); |
| | | } |
| | | } |
| | | } |
| | |
| | | vo.setCreateTime(historicTasks.get(0).getStartTime()); |
| | | |
| | | // 查询实际处理人 |
| | | long handlerUserId = Long.parseLong(historicTasks.get(0).getAssignee()); |
| | | SysUser handlerUser = sysUserService.selectUserById(handlerUserId); |
| | | if (Objects.nonNull(handlerUser)) { |
| | | handlerIds.add(handlerUserId); |
| | | handlerNames.add(handlerUser.getNickName()); |
| | | vo.setActualHandlerUserId(historicTasks.get(0).getAssignee()); |
| | | vo.setActualHandlerUserName(handlerUser.getNickName()); |
| | | if (StringUtils.isNotBlank(historicTasks.get(0).getAssignee())) { |
| | | long handlerUserId = Long.parseLong(historicTasks.get(0).getAssignee()); |
| | | SysUser handlerUser = sysUserService.selectUserById(handlerUserId); |
| | | if (Objects.nonNull(handlerUser)) { |
| | | vo.getHandlerId().add(handlerUserId); |
| | | vo.getHandlerName().add(this.getUserShowName(handlerUser)); |
| | | if (Objects.nonNull(handlerUser.getDept())) { |
| | | vo.getHandlerUnitName().add(handlerUser.getDept().getDeptName()); |
| | | vo.getHandlerUnitId().add(handlerUser.getDept().getDeptId()); |
| | | } |
| | | } |
| | | } |
| | | vo.setTaskDefinitionKey(historicTasks.get(0).getTaskDefinitionKey()); |
| | | this.setPromoterAndHandler(vo, historicTasks.get(0).getIdentityLinks()); |
| | | } |
| | | } else { |
| | | vo.setTaskStatus(TaskStatusEnum.TODO); |
| | |
| | | vo.setCreateTime(task.getCreateTime()); |
| | | vo.setTaskDefinitionKey(task.getTaskDefinitionKey()); |
| | | |
| | | this.setPromoterAndHandler(vo, null); |
| | | this.setHandler(vo, null); |
| | | this.setRuntimeTaskInfo(task, vo, projectId); |
| | | } |
| | | this.distinctVo(vo); |
| | |
| | | * @param processDefId 流程定义id |
| | | * @return |
| | | */ |
| | | private List<CustomerTaskVO> getFinishedProcessTaskInfo(List<UserTask> userTasks, String processInsId, String processDefId) { |
| | | private List<CustomerTaskVO> getFinishedProcessTaskInfo(List<UserTask> userTasks, String projectId, String processInsId, String processDefId) { |
| | | HistoricProcessInstance hisProcess = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInsId).singleResult(); |
| | | if (Objects.isNull(hisProcess)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | List<CustomerTaskVO> vos = userTasks.stream().map(userTask -> { |
| | | CustomerTaskVO vo = new CustomerTaskVO(); |
| | | vo.setProcessInsId(hisProcess.getId()); |
| | |
| | | vo.setTaskName(userTask.getName()); |
| | | vo.setProcessName(hisProcess.getProcessDefinitionName()); |
| | | |
| | | // 一个任务可能有多个候选人/组,所以需要使用list |
| | | List<Long> handlerIds = new ArrayList<>(2); |
| | | List<String> handlerNames = new ArrayList<>(2); |
| | | List<Long> handlerUnitIds = new ArrayList<>(2); |
| | | List<String> handlerUnitNames = new ArrayList<>(2); |
| | | List<String> promoterNames = new ArrayList<>(2); |
| | | List<String> promoterUnitNames = new ArrayList<>(2); |
| | | vo.setHandlerId(handlerIds); |
| | | vo.setHandlerName(handlerNames); |
| | | vo.setHandlerUnitId(handlerUnitIds); |
| | | vo.setHandlerUnitName(handlerUnitNames); |
| | | vo.setPromoterName(promoterNames); |
| | | vo.setPromoterUnitName(promoterUnitNames); |
| | | |
| | | |
| | | this.setCandidateInfo(userTask, vo, projectId, processInsId); |
| | | |
| | | // 查多个是因为驳回后会查出两条及以上,取最新一条 |
| | | List<HistoricTaskInstance> hisTaskList = historyService.createHistoricTaskInstanceQuery() |
| | | .processInstanceId(hisProcess.getId()) |
| | |
| | | .orderByHistoricTaskInstanceStartTime() |
| | | .desc() |
| | | .list(); |
| | | |
| | | vo.setTaskStatus(TaskStatusEnum.FINISHED); |
| | | // 如果是已完成的,信息需要单独赋值 |
| | | vo.setTaskId(hisTaskList.get(0).getId()); |
| | | vo.setExecutionId(hisTaskList.get(0).getExecutionId()); |
| | | vo.setCreateTime(hisTaskList.get(0).getStartTime()); |
| | | // 查询实际处理人 |
| | | long handlerUserId = Long.parseLong(hisTaskList.get(0).getAssignee()); |
| | | SysUser handlerUser = sysUserService.selectUserById(handlerUserId); |
| | | if (Objects.nonNull(handlerUser)) { |
| | | |
| | | vo.setActualHandlerUserId(hisTaskList.get(0).getAssignee()); |
| | | vo.setActualHandlerUserName(handlerUser.getNickName()); |
| | | // 如果未找到历史任务,说明这个任务可能处于某个互斥网关下,实际并未执行 |
| | | if (CollectionUtils.isEmpty(hisTaskList)) { |
| | | vo.setTaskStatus(TaskStatusEnum.NOT_START); |
| | | } else { |
| | | vo.setTaskStatus(TaskStatusEnum.FINISHED); |
| | | // 如果是已完成的,信息需要单独赋值 |
| | | vo.setTaskId(hisTaskList.get(0).getId()); |
| | | vo.setExecutionId(hisTaskList.get(0).getExecutionId()); |
| | | vo.setCreateTime(hisTaskList.get(0).getStartTime()); |
| | | // 查询实际处理人 |
| | | long handlerUserId = Long.parseLong(hisTaskList.get(0).getAssignee()); |
| | | SysUser handlerUser = sysUserService.selectUserById(handlerUserId); |
| | | if (Objects.nonNull(handlerUser)) { |
| | | vo.setActualHandlerUserId(hisTaskList.get(0).getAssignee()); |
| | | vo.setActualHandlerUserName(handlerUser.getNickName()); |
| | | } |
| | | vo.setTaskDefinitionKey(hisTaskList.get(0).getTaskDefinitionKey()); |
| | | this.setHandler(vo, hisTaskList.get(0).getIdentityLinks()); |
| | | } |
| | | vo.setTaskDefinitionKey(hisTaskList.get(0).getTaskDefinitionKey()); |
| | | this.setPromoterAndHandler(vo, hisTaskList.get(0).getIdentityLinks()); |
| | | |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | }).filter(Objects::nonNull).collect(Collectors.toList()); |
| | | return vos; |
| | | } |
| | | |
| | |
| | | * @param taskVO 任务vo |
| | | * @param projectId 项目id |
| | | */ |
| | | private void setRuntimeTaskInfo(Task task, CustomerTaskVO taskVO, Long projectId) { |
| | | private void setRuntimeTaskInfo(Task task, CustomerTaskVO taskVO, String projectId) { |
| | | // 当前流程信息 |
| | | taskVO.setTaskId(task.getId()); |
| | | taskVO.setCreateTime(task.getCreateTime()); |
| | |
| | | taskVO.setProcessInsId(task.getProcessInstanceId()); |
| | | taskVO.setTaskDefinitionKey(task.getTaskDefinitionKey()); |
| | | |
| | | // 流程发起人信息 |
| | | this.setPromoterInfo(taskVO); |
| | | |
| | | // 一个任务可能有多个候选人/组,所以需要使用list |
| | | List<Long> handlerIds = new ArrayList<>(2); |
| | | List<String> handlerNames = new ArrayList<>(2); |
| | | List<Long> handlerUnitIds = new ArrayList<>(2); |
| | | List<String> handlerUnitNames = new ArrayList<>(2); |
| | | List<String> promoterNames = new ArrayList<>(2); |
| | | List<String> promoterUnitNames = new ArrayList<>(2); |
| | | taskVO.setHandlerId(handlerIds); |
| | | taskVO.setHandlerName(handlerNames); |
| | | taskVO.setHandlerUnitId(handlerUnitIds); |
| | | taskVO.setHandlerUnitName(handlerUnitNames); |
| | | taskVO.setPromoterName(promoterNames); |
| | | taskVO.setPromoterUnitName(promoterUnitNames); |
| | | |
| | | // 流程处理人信息 |
| | | List<IdentityLink> identityLinksForTask = taskService.getIdentityLinksForTask(task.getId()); |
| | |
| | | SysUser sysUser = sysUserService.selectUserById(Long.parseLong(identityLink.getUserId())); |
| | | if (Objects.nonNull(sysUser)) { |
| | | taskVO.getHandlerId().add(sysUser.getUserId()); |
| | | taskVO.getHandlerName().add(sysUser.getNickName()); |
| | | taskVO.getHandlerName().add(this.getUserShowName(sysUser)); |
| | | if (Objects.nonNull(sysUser.getDept())) { |
| | | taskVO.getHandlerUnitId().add(sysUser.getDept().getDeptId()); |
| | | taskVO.getHandlerUnitName().add(sysUser.getDept().getDeptName()); |
| | | taskVO.getPromoterName().add(this.getUserShowName(sysUser)); |
| | | // if (sysUser.getDept().getAncestors()) |
| | | String[] str = sysUser.getDept().getAncestors().split(","); |
| | | if (str.length >= 4){ |
| | | taskVO.getPromoterUnitName().add(sysUser.getDept().getParentName() +"-"+sysUser.getDept().getDeptName()); |
| | | }else { |
| | | taskVO.getPromoterUnitName().add(sysUser.getDept().getDeptName()); |
| | | } |
| | | |
| | | } |
| | | } |
| | | // 绑定的是角色或者部门 |
| | |
| | | if (Objects.nonNull(dept)) { |
| | | taskVO.getHandlerUnitId().add(dept.getDeptId()); |
| | | taskVO.getHandlerUnitName().add(dept.getDeptName()); |
| | | taskVO.getPromoterName().add(this.getDeptLeaderShowName(dept)); |
| | | String[] str = dept.getAncestors().split(","); |
| | | if (str.length >= 4){ |
| | | taskVO.getPromoterUnitName().add(dept.getParentName() +"-"+dept.getDeptName()); |
| | | }else { |
| | | taskVO.getPromoterUnitName().add(dept.getDeptName()); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } else { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.distinctVo(taskVO); |
| | | } |
| | | } |
| | |
| | | * @param result |
| | | * @return |
| | | */ |
| | | private List<CustomerTaskVO> getTimelyTask(String processDefinitionId, String processInsId, String taskName, Integer pageNum, Integer pageSize, Result result) { |
| | | private List<CustomerTaskVO> getTimelyTask(String projectId, String processDefinitionId, String processInsId, String taskName, Integer pageNum, Integer pageSize, Result result) { |
| | | int startNum = pageSize * (pageNum - 1); |
| | | int endNum = startNum + pageSize; |
| | | |
| | |
| | | List<String> handlerNames = new ArrayList<>(2); |
| | | List<Long> handlerUnitIds = new ArrayList<>(2); |
| | | List<String> handlerUnitNames = new ArrayList<>(2); |
| | | List<String> promoterNames = new ArrayList<>(2); |
| | | List<String> promoterUnitNames = new ArrayList<>(2); |
| | | vo.setHandlerId(handlerIds); |
| | | vo.setHandlerName(handlerNames); |
| | | vo.setHandlerUnitId(handlerUnitIds); |
| | | vo.setHandlerUnitName(handlerUnitNames); |
| | | vo.setPromoterName(promoterNames); |
| | | vo.setPromoterUnitName(promoterUnitNames); |
| | | |
| | | this.setCandidateInfo(userTask, vo, projectId, processInsId); |
| | | HistoricTaskInstance hisTask = keyMap.get(userTask.getId()); |
| | | if (Objects.nonNull(hisTask)) { |
| | | vo.setTaskStatus(TaskStatusEnum.FINISHED); |
| | |
| | | SysUser handlerUser = sysUserService.selectUserById(handlerUserId); |
| | | if (Objects.nonNull(handlerUser)) { |
| | | vo.getHandlerId().add(handlerUserId); |
| | | vo.getHandlerName().add(handlerUser.getNickName()); |
| | | vo.setActualHandlerUserId(hisTask.getAssignee()); |
| | | vo.setActualHandlerUserName(handlerUser.getNickName()); |
| | | vo.getHandlerName().add(this.getUserShowName(handlerUser)); |
| | | if (Objects.nonNull(handlerUser.getDept())) { |
| | | vo.getHandlerUnitId().add(handlerUser.getDept().getDeptId()); |
| | | vo.getHandlerUnitName().add(handlerUser.getDept().getDeptName()); |
| | | } |
| | | } |
| | | vo.setTaskDefinitionKey(hisTask.getTaskDefinitionKey()); |
| | | this.setPromoterAndHandler(vo, hisTask.getIdentityLinks()); |
| | | } |
| | | |
| | | this.distinctVo(vo); |
| | |
| | | }).collect(Collectors.toList()); |
| | | result.data(vos); |
| | | return vos; |
| | | } |
| | | |
| | | /** |
| | | * 用户名称后面跟电话号码 |
| | | * |
| | | * @param user |
| | | * @return |
| | | */ |
| | | private String getUserShowName(SysUser user) { |
| | | return user.getNickName() + (StringUtils.isNotBlank(user.getPhonenumber()) ? "(" + user.getPhonenumber() + ")" : ""); |
| | | } |
| | | |
| | | /** |
| | | * 部门负责人名称后面跟电话号码 |
| | | * |
| | | * @param dept |
| | | * @return |
| | | */ |
| | | private String getDeptLeaderShowName(SysDept dept) { |
| | | return dept.getLeader() + (StringUtils.isNotBlank(dept.getPhone()) ? "(" + dept.getPhone() + ")" : ""); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param result |
| | | * @return |
| | | */ |
| | | private List<CustomerTaskVO> getOvertimeTask(Long projectId, String processDefinitionId, String processInsId, String taskName, Integer pageNum, Integer pageSize, Result result) { |
| | | private List<CustomerTaskVO> getOvertimeTask(String projectId, String processDefinitionId, String processInsId, String taskName, Integer pageNum, Integer pageSize, Result result) { |
| | | int startNum = pageSize * (pageNum - 1); |
| | | int endNum = startNum + pageSize; |
| | | |
| | |
| | | * @param result |
| | | * @return |
| | | */ |
| | | private List<CustomerTaskVO> getWillOvertimeTask(Long projectId, String processDefinitionId, String processInsId, String taskName, Integer pageNum, Integer pageSize, Result result) { |
| | | private List<CustomerTaskVO> getWillOvertimeTask(String projectId, String processDefinitionId, String processInsId, String taskName, Integer pageNum, Integer pageSize, Result result) { |
| | | int startNum = pageSize * (pageNum - 1); |
| | | int endNum = startNum + pageSize; |
| | | |
| | |
| | | return vos; |
| | | } |
| | | |
| | | private List<CustomerTaskVO> getWaitTask(String projectId, |
| | | String processDefinitionId, |
| | | String processInsId, |
| | | String taskName, |
| | | Integer pageNum, |
| | | Integer pageSize, |
| | | Result result) { |
| | | // 查出容缺过的任务 |
| | | List<ProcessLog> allWaitTaskList = new LambdaQueryChainWrapper<>(processLogService.getBaseMapper()) |
| | | .eq(ProcessLog::getProcessInsId, processInsId) |
| | | .eq(ProcessLog::getEventType, ProcessLogEventTypeEnum.WAIT) |
| | | .like(StringUtils.isNotBlank(taskName), ProcessLog::getTaskName, taskName) |
| | | .orderByDesc(ProcessLog::getGmtCreate) |
| | | .list(); |
| | | // 排除容缺后又完成的任务 |
| | | List<ProcessLog> finishedTaskList = new LambdaQueryChainWrapper<>(processLogService.getBaseMapper()) |
| | | .eq(ProcessLog::getProcessInsId, processInsId) |
| | | .eq(ProcessLog::getEventType, ProcessLogEventTypeEnum.FINISHED) |
| | | .list(); |
| | | List<String> finishedTaskIds = finishedTaskList.stream().map(ProcessLog::getTaskId).distinct().collect(Collectors.toList()); |
| | | // 得到未完成的容缺任务 |
| | | List<String> waitTaskIds = allWaitTaskList.stream().filter(log -> !finishedTaskIds.contains(log.getTaskId())).map(ProcessLog::getTaskId).collect(Collectors.toList()); |
| | | if (CollectionUtils.isEmpty(waitTaskIds)) { |
| | | result.total(0l); |
| | | return new ArrayList<>(); |
| | | } |
| | | // 容缺的任务都属于历史任务,只是需要补表单数据 |
| | | List<HistoricTaskInstance> hisTaskList = historyService.createHistoricTaskInstanceQuery() |
| | | .processInstanceId(processInsId) |
| | | .taskIds(waitTaskIds) |
| | | .includeIdentityLinks() |
| | | .orderByHistoricTaskInstanceStartTime() |
| | | .desc() |
| | | .list(); |
| | | hisTaskList = this.distinctHisTask(hisTaskList); |
| | | |
| | | if (CollectionUtils.isEmpty(hisTaskList)) { |
| | | result.total(0l); |
| | | return new ArrayList<>(); |
| | | } |
| | | int startNum = pageSize * (pageNum - 1); |
| | | int endNum = startNum + pageSize; |
| | | if (startNum >= hisTaskList.size()) { |
| | | result.total(0l); |
| | | // 如果起始索引超出了列表的大小,返回一个空列表 |
| | | return new ArrayList<>(); |
| | | } |
| | | result.total(hisTaskList.size()); |
| | | int end = Math.min(endNum, hisTaskList.size()); |
| | | List<HistoricTaskInstance> targetTask = hisTaskList.subList(startNum, end); |
| | | |
| | | // 转换成VO |
| | | // 得到目标任务对应的定义 |
| | | List<String> taskDefs = targetTask.stream().map(HistoricTaskInstance::getTaskDefinitionKey).collect(Collectors.toList()); |
| | | Map<String, HistoricTaskInstance> keyMap = targetTask.stream().collect(Collectors.toMap(HistoricTaskInstance::getTaskDefinitionKey, his -> his)); |
| | | List<UserTask> finishedUserTaskElement = this.getAllUserTaskElement(processDefinitionId).stream().filter(el -> taskDefs.contains(el.getId())).collect(Collectors.toList()); |
| | | // 查出流程 |
| | | ProcessInstance process = runtimeService.createProcessInstanceQuery().processInstanceId(processInsId).singleResult(); |
| | | String deployId = ""; |
| | | String processName = ""; |
| | | if (Objects.nonNull(process)) { |
| | | deployId = process.getDeploymentId(); |
| | | processName = process.getProcessDefinitionName(); |
| | | } else { |
| | | HistoricProcessInstance hisProcess = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInsId).singleResult(); |
| | | deployId = hisProcess.getDeploymentId(); |
| | | processName = hisProcess.getProcessDefinitionName(); |
| | | } |
| | | |
| | | String finalDeployId = deployId; |
| | | String finalProcessName = processName; |
| | | List<CustomerTaskVO> vos = finishedUserTaskElement.stream().map(userTask -> { |
| | | CustomerTaskVO vo = new CustomerTaskVO(); |
| | | vo.setProcessInsId(processInsId); |
| | | vo.setProcessDefId(processDefinitionId); |
| | | vo.setDeployId(finalDeployId); |
| | | vo.setTaskName(userTask.getName()); |
| | | vo.setProcessName(finalProcessName); |
| | | |
| | | // 一个任务可能有多个候选人/组,所以需要使用list |
| | | List<Long> handlerIds = new ArrayList<>(2); |
| | | List<String> handlerNames = new ArrayList<>(2); |
| | | List<Long> handlerUnitIds = new ArrayList<>(2); |
| | | List<String> handlerUnitNames = new ArrayList<>(2); |
| | | List<String> promoterNames = new ArrayList<>(2); |
| | | List<String> promoterUnitNames = new ArrayList<>(2); |
| | | vo.setHandlerId(handlerIds); |
| | | vo.setHandlerName(handlerNames); |
| | | vo.setHandlerUnitId(handlerUnitIds); |
| | | vo.setHandlerUnitName(handlerUnitNames); |
| | | vo.setPromoterName(promoterNames); |
| | | vo.setPromoterUnitName(promoterUnitNames); |
| | | |
| | | this.setCandidateInfo(userTask, vo, projectId, processInsId); |
| | | HistoricTaskInstance hisTask = keyMap.get(userTask.getId()); |
| | | if (Objects.nonNull(hisTask)) { |
| | | vo.setTaskStatus(TaskStatusEnum.WAIT); |
| | | // 如果是已完成的,信息需要单独赋值 |
| | | vo.setTaskId(hisTask.getId()); |
| | | vo.setExecutionId(hisTask.getExecutionId()); |
| | | vo.setCreateTime(hisTask.getStartTime()); |
| | | |
| | | // 查询实际处理人 |
| | | long handlerUserId = Long.parseLong(hisTask.getAssignee()); |
| | | SysUser handlerUser = sysUserService.selectUserById(handlerUserId); |
| | | if (Objects.nonNull(handlerUser)) { |
| | | vo.getHandlerId().add(handlerUserId); |
| | | if (Objects.nonNull(handlerUser.getDept())) { |
| | | vo.getHandlerUnitId().add(handlerUser.getDept().getDeptId()); |
| | | } |
| | | } |
| | | this.setHandler(vo, hisTask.getIdentityLinks()); |
| | | vo.setTaskDefinitionKey(hisTask.getTaskDefinitionKey()); |
| | | } |
| | | this.distinctVo(vo); |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | result.data(vos); |
| | | return vos; |
| | | } |
| | | |
| | | /** |
| | | * 查询剩余事项(未开始的任务) |
| | | * |
| | |
| | | * @param result |
| | | * @return |
| | | */ |
| | | private List<CustomerTaskVO> getRemainingTask(Long projectId, |
| | | private List<CustomerTaskVO> getRemainingTask(String projectId, |
| | | String processDefinitionId, |
| | | String processInsId, |
| | | String taskName, |
| | |
| | | List<String> handlerNames = new ArrayList<>(2); |
| | | List<Long> handlerUnitIds = new ArrayList<>(2); |
| | | List<String> handlerUnitNames = new ArrayList<>(2); |
| | | List<String> promoterNames = new ArrayList<>(2); |
| | | List<String> promoterUnitNames = new ArrayList<>(2); |
| | | vo.setHandlerId(handlerIds); |
| | | vo.setHandlerName(handlerNames); |
| | | vo.setHandlerUnitId(handlerUnitIds); |
| | | vo.setHandlerUnitName(handlerUnitNames); |
| | | vo.setPromoterName(promoterNames); |
| | | vo.setPromoterUnitName(promoterUnitNames); |
| | | |
| | | vo.setProcessInsId(process.getId()); |
| | | vo.setProcessDefId(processDefinitionId); |
| | |
| | | vo.setTaskName(userTask.getName()); |
| | | vo.setProcessName(process.getProcessDefinitionName()); |
| | | vo.setTaskStatus(TaskStatusEnum.NOT_START); |
| | | |
| | | this.setCandidateInfo(userTask, vo, projectId, processInsId); |
| | | |
| | | // 未开始的任务,其关联的用户组这些都可以从UserTask中拿到,因为本身未开始的任务是没有task的,所以这里直接查 |
| | | if (StringUtils.isNotBlank(userTask.getAssignee())) { |
| | | vo.setHandlerType(HandlerTypeEnum.USER); |
| | |
| | | // 处理变量表达式,DATA_LAUNCH只可能是部门不会是角色,因为代表的是业主部门 |
| | | if (groupId.contains(ProcessConstants.DATA_LAUNCH)) { |
| | | vo.setHandlerType(HandlerTypeEnum.DEPT); |
| | | this.varYzReview(vo, projectId, processInsId, HandlerTypeEnum.DEPT); |
| | | this.varYzReview(vo, projectId, processInsId, HandlerTypeEnum.DEPT, 1); |
| | | } else if (groupId.startsWith("dept")) { // 部门的id是加了前缀的如:dept:1 |
| | | vo.setHandlerType(HandlerTypeEnum.DEPT); |
| | | String[] split = groupId.split(":"); |
| | |
| | | |
| | | /** |
| | | * 处理流程变量-业主单位 |
| | | * |
| | | * @param setType 0 设置责任单位 1 设置办理单位 |
| | | * @param vo |
| | | */ |
| | | private void varYzReview(CustomerTaskVO vo, Long projectId, String processInsId, HandlerTypeEnum type) { |
| | | private void varYzReview(CustomerTaskVO vo, String projectId, String processInsId, HandlerTypeEnum type, Integer setType) { |
| | | ProjectProcess projectProcess = new LambdaQueryChainWrapper<>(projectProcessMapper) |
| | | .eq(ProjectProcess::getProjectId, projectId) |
| | | .eq(ProjectProcess::getProcessInsId, processInsId) |
| | |
| | | } else if (HandlerTypeEnum.DEPT.equals(type)) { |
| | | SysDept dept = deptService.selectDeptById(projectProcess.getDataLaunch()); |
| | | if (Objects.nonNull(dept)) { |
| | | vo.getHandlerUnitId().add(dept.getDeptId()); |
| | | vo.getHandlerUnitName().add(dept.getDeptName()); |
| | | if (setType == 1) { |
| | | vo.getHandlerUnitId().add(dept.getDeptId()); |
| | | vo.getHandlerUnitName().add(dept.getDeptName()); |
| | | vo.getHandlerName().add(this.getDeptLeaderShowName(dept)); |
| | | } else { |
| | | vo.getPromoterUnitName().add(dept.getDeptName()); |
| | | vo.getPromoterName().add(this.getDeptLeaderShowName(dept)); |
| | | } |
| | | } |
| | | } else if (HandlerTypeEnum.ROLE.equals(type)) { |
| | | SysRole role = sysRoleService.selectRoleById(projectProcess.getDataLaunch()); |
| | |
| | | return totalNum - num; |
| | | } |
| | | |
| | | /** |
| | | * 设置候选人信息/责任单位 |
| | | * |
| | | * @param userTask |
| | | * @param vo |
| | | * @param projectId |
| | | * @param processInsId |
| | | */ |
| | | private void setCandidateInfo(UserTask userTask, CustomerTaskVO vo, String projectId, String processInsId) { |
| | | if (StringUtils.isNotBlank(userTask.getAssignee())) { |
| | | SysUser sysUser = sysUserService.selectUserById(Long.parseLong(userTask.getAssignee())); |
| | | if (Objects.nonNull(sysUser)) { |
| | | if (Objects.nonNull(sysUser.getDept())) { |
| | | // 如果是指定的某个人,那么责任单位是这个人所在的部门 |
| | | vo.getPromoterUnitName().add(sysUser.getDept().getDeptName()); |
| | | vo.getPromoterName().add(this.getUserShowName(sysUser)); |
| | | } |
| | | } |
| | | } else if (CollectionUtil.isNotEmpty(userTask.getCandidateGroups())) { |
| | | List<String> groupIds = userTask.getCandidateGroups(); |
| | | for (String groupId : groupIds) { |
| | | // 处理变量表达式,DATA_LAUNCH只可能是部门不会是角色,因为代表的是业主部门 |
| | | if (groupId.contains(ProcessConstants.DATA_LAUNCH)) { |
| | | vo.setHandlerType(HandlerTypeEnum.DEPT); |
| | | this.varYzReview(vo, projectId, processInsId, HandlerTypeEnum.DEPT, 0); |
| | | } else if (groupId.startsWith("dept")) { // 部门的id是加了前缀的如:dept:1 |
| | | vo.setHandlerType(HandlerTypeEnum.DEPT); |
| | | String[] split = groupId.split(":"); |
| | | if (split.length > 1) { |
| | | // 部门 |
| | | SysDept dept = sysDeptService.selectDeptById(Long.parseLong(split[1])); |
| | | if (Objects.nonNull(dept)) { |
| | | vo.getPromoterUnitName().add(dept.getDeptName()); |
| | | vo.getPromoterName().add(this.getDeptLeaderShowName(dept)); |
| | | } |
| | | } |
| | | } else { |
| | | vo.setHandlerType(HandlerTypeEnum.ROLE); |
| | | SysRole role = sysRoleService.selectRoleById(Long.parseLong(groupId)); |
| | | if (Objects.nonNull(role)) { |
| | | vo.getPromoterUnitName().add(role.getRoleName()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置任务的发起人&处理人 只有待办任务和已完成任务才会掉这个方法 |
| | |
| | | * @param taskVO |
| | | * @param identityLinkInfos 如果是已完成的任务,用这个去取关联的用户/用户组 |
| | | */ |
| | | private void setPromoterAndHandler(CustomerTaskVO taskVO, List<? extends IdentityLinkInfo> identityLinkInfos) { |
| | | this.setPromoterInfo(taskVO); |
| | | |
| | | // 一个任务可能有多个候选人/组,所以需要使用list |
| | | List<Long> handlerIds = new ArrayList<>(2); |
| | | List<String> handlerNames = new ArrayList<>(2); |
| | | List<Long> handlerUnitIds = new ArrayList<>(2); |
| | | List<String> handlerUnitNames = new ArrayList<>(2); |
| | | taskVO.setHandlerId(handlerIds); |
| | | taskVO.setHandlerName(handlerNames); |
| | | taskVO.setHandlerUnitId(handlerUnitIds); |
| | | taskVO.setHandlerUnitName(handlerUnitNames); |
| | | private void setHandler(CustomerTaskVO taskVO, List<? extends IdentityLinkInfo> identityLinkInfos) { |
| | | |
| | | // 流程处理人信息 |
| | | if (TaskStatusEnum.TODO.equals(taskVO.getTaskStatus())) { |
| | |
| | | SysUser sysUser = sysUserService.selectUserById(Long.parseLong(identityLink.getUserId())); |
| | | if (Objects.nonNull(sysUser)) { |
| | | taskVO.setHandlerType(HandlerTypeEnum.USER); |
| | | handlerIds.add(sysUser.getUserId()); |
| | | handlerNames.add(sysUser.getNickName()); |
| | | taskVO.getHandlerId().add(sysUser.getUserId()); |
| | | taskVO.getHandlerName().add(this.getUserShowName(sysUser)); |
| | | if (Objects.nonNull(sysUser.getDept())) { |
| | | handlerUnitIds.add(sysUser.getDept().getDeptId()); |
| | | handlerUnitNames.add(sysUser.getDept().getDeptName()); |
| | | taskVO.getHandlerUnitId().add(sysUser.getDept().getDeptId()); |
| | | taskVO.getHandlerUnitName().add(sysUser.getDept().getDeptName()); |
| | | } |
| | | } |
| | | // 绑定的是角色或者是部门,需要根据id判断 |
| | |
| | | // 部门 |
| | | SysDept dept = sysDeptService.selectDeptById(Long.parseLong(split[1])); |
| | | if (Objects.nonNull(dept)) { |
| | | handlerUnitIds.add(dept.getDeptId()); |
| | | handlerUnitNames.add(dept.getDeptName()); |
| | | taskVO.getHandlerUnitId().add(dept.getDeptId()); |
| | | taskVO.getHandlerUnitName().add(dept.getDeptName()); |
| | | } |
| | | } |
| | | } else { |
| | | taskVO.setHandlerType(HandlerTypeEnum.ROLE); |
| | | SysRole role = sysRoleService.selectRoleById(Long.parseLong(identityLink.getGroupId())); |
| | | if (Objects.nonNull(role)) { |
| | | handlerUnitIds.add(role.getRoleId()); |
| | | handlerUnitNames.add(role.getRoleName()); |
| | | taskVO.getHandlerUnitId().add(role.getRoleId()); |
| | | taskVO.getHandlerUnitName().add(role.getRoleName()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } else if (TaskStatusEnum.FINISHED.equals(taskVO.getTaskStatus())) { |
| | | } else if (TaskStatusEnum.FINISHED.equals(taskVO.getTaskStatus()) || TaskStatusEnum.WAIT.equals(taskVO.getTaskStatus())) { |
| | | for (IdentityLinkInfo identityLink : identityLinkInfos) { |
| | | // 绑定的是用户,查出用户姓名、部门 |
| | | if (StringUtils.isNotBlank(identityLink.getUserId())) { |
| | | taskVO.setHandlerType(HandlerTypeEnum.USER); |
| | | SysUser sysUser = sysUserService.selectUserById(Long.parseLong(identityLink.getUserId())); |
| | | if (Objects.nonNull(sysUser)) { |
| | | handlerIds.add(sysUser.getUserId()); |
| | | handlerNames.add(sysUser.getNickName()); |
| | | taskVO.getHandlerId().add(sysUser.getUserId()); |
| | | taskVO.getHandlerName().add(this.getUserShowName(sysUser)); |
| | | if (Objects.nonNull(sysUser.getDept())) { |
| | | handlerUnitIds.add(sysUser.getDept().getDeptId()); |
| | | handlerUnitNames.add(sysUser.getDept().getDeptName()); |
| | | taskVO.getHandlerUnitId().add(sysUser.getDept().getDeptId()); |
| | | taskVO.getHandlerUnitName().add(sysUser.getDept().getDeptName()); |
| | | } |
| | | } |
| | | // 绑定的是角色,查出角色名称 |
| | |
| | | // 部门 |
| | | SysDept dept = sysDeptService.selectDeptById(Long.parseLong(split[1])); |
| | | if (Objects.nonNull(dept)) { |
| | | handlerUnitIds.add(dept.getDeptId()); |
| | | handlerUnitNames.add(dept.getDeptName()); |
| | | taskVO.getHandlerUnitId().add(dept.getDeptId()); |
| | | taskVO.getHandlerUnitName().add(dept.getDeptName()); |
| | | } |
| | | } |
| | | } else { |
| | | taskVO.setHandlerType(HandlerTypeEnum.ROLE); |
| | | SysRole role = sysRoleService.selectRoleById(Long.parseLong(identityLink.getGroupId())); |
| | | if (Objects.nonNull(role)) { |
| | | handlerUnitIds.add(role.getRoleId()); |
| | | handlerUnitNames.add(role.getRoleName()); |
| | | taskVO.getHandlerUnitId().add(role.getRoleId()); |
| | | taskVO.getHandlerUnitName().add(role.getRoleName()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.distinctVo(taskVO); |
| | | } |
| | | |
| | |
| | | * @param taskVO |
| | | */ |
| | | private void setPromoterInfo(CustomerTaskVO taskVO) { |
| | | // 发起人应为上一节点的处理人 |
| | | List<String> beforeNodeKey = taskCommonService.getBeforeNodeInfo(taskVO.getProcessDefId(), taskVO.getTaskDefinitionKey()); |
| | | List<SysUser> userList = beforeNodeKey.stream().map(key -> { |
| | | List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery() |
| | | .processInstanceId(taskVO.getProcessInsId()) |
| | | .taskDefinitionKey(key) |
| | | .orderByHistoricTaskInstanceStartTime() |
| | | .desc() |
| | | .list(); // 之所以用list是因为如果某个任务被驳回过,且如果该任务再次执行时会有多条数据,取最新的一条 |
| | | if (!CollectionUtils.isEmpty(historicTaskInstances)) { |
| | | // 实际领取这个任务的人,也就是处理人 |
| | | String assignee = historicTaskInstances.get(0).getAssignee(); |
| | | SysUser startUser = sysUserService.selectUserById(Long.parseLong(assignee)); |
| | | return startUser; |
| | | } else { |
| | | return null; |
| | | } |
| | | }).filter(user -> Objects.nonNull(user)).collect(Collectors.toList()); |
| | | if (CollectionUtils.isEmpty(userList)) { |
| | | taskVO.setPromoterName("暂无"); |
| | | taskVO.setPromoterUnitName("暂无"); |
| | | } else { |
| | | taskVO.setPromoterId(userList.stream().map(user -> { |
| | | return user.getUserId() + ""; |
| | | }).collect(Collectors.joining("、"))); |
| | | taskVO.setPromoterName(userList.stream().map(user -> { |
| | | return user.getNickName(); |
| | | }).collect(Collectors.joining("、"))); |
| | | taskVO.setPromoterUnitId(userList.stream().filter(user -> Objects.nonNull(user.getDept())).map(user -> { |
| | | return user.getDept().getDeptId() + ""; |
| | | }).collect(Collectors.joining("、"))); |
| | | taskVO.setPromoterUnitName(userList.stream().filter(user -> Objects.nonNull(user.getDept())).map(user -> { |
| | | return user.getDept().getDeptName() + ""; |
| | | }).collect(Collectors.joining("、"))); |
| | | } |
| | | // // 发起人应为上一节点的处理人 |
| | | // List<String> beforeNodeKey = taskCommonService.getBeforeNodeInfo(taskVO.getProcessDefId(), taskVO.getTaskDefinitionKey()); |
| | | // List<SysUser> userList = beforeNodeKey.stream().map(key -> { |
| | | // List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery() |
| | | // .processInstanceId(taskVO.getProcessInsId()) |
| | | // .taskDefinitionKey(key) |
| | | // .orderByHistoricTaskInstanceStartTime() |
| | | // .desc() |
| | | // .list(); // 之所以用list是因为如果某个任务被驳回过,且如果该任务再次执行时会有多条数据,取最新的一条 |
| | | // if (!CollectionUtils.isEmpty(historicTaskInstances)) { |
| | | // // 实际领取这个任务的人,也就是处理人 |
| | | // String assignee = historicTaskInstances.get(0).getAssignee(); |
| | | // SysUser startUser = sysUserService.selectUserById(Long.parseLong(assignee)); |
| | | // return startUser; |
| | | // } else { |
| | | // return null; |
| | | // } |
| | | // }).filter(user -> Objects.nonNull(user)).collect(Collectors.toList()); |
| | | // if (CollectionUtils.isEmpty(userList)) { |
| | | // taskVO.setPromoterName("暂无"); |
| | | // taskVO.setPromoterUnitName("暂无"); |
| | | // } else { |
| | | // taskVO.setPromoterId(userList.stream().map(user -> { |
| | | // return user.getUserId() + ""; |
| | | // }).collect(Collectors.joining("、"))); |
| | | // taskVO.setPromoterName(userList.stream().map(user -> { |
| | | // return this.getUserShowName(user); |
| | | // }).collect(Collectors.joining("、"))); |
| | | // taskVO.setPromoterUnitId(userList.stream().filter(user -> Objects.nonNull(user.getDept())).map(user -> { |
| | | // return user.getDept().getDeptId() + ""; |
| | | // }).collect(Collectors.joining("、"))); |
| | | // taskVO.setPromoterUnitName(userList.stream().filter(user -> Objects.nonNull(user.getDept())).map(user -> { |
| | | // return user.getDept().getDeptName() + ""; |
| | | // }).collect(Collectors.joining("、"))); |
| | | // } |
| | | } |
| | | |
| | | /** |