From d02056c0e213c562c7d4ce592742797cbf2a96b4 Mon Sep 17 00:00:00 2001 From: bob Date: Tue, 14 Feb 2023 15:04:03 +0800 Subject: [PATCH] fix(projectName) --- .../flowable/domain/dto/FlowTaskDto.java | 5 ++++ .../service/impl/FlowTaskServiceImpl.java | 24 ++++++++++++++----- .../src/views/flowable/task/process/index.vue | 4 ++-- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowTaskDto.java b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowTaskDto.java index ed491a4..1bd7d5b 100644 --- a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowTaskDto.java +++ b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/domain/dto/FlowTaskDto.java @@ -102,4 +102,9 @@ public class FlowTaskDto implements Serializable { @ApiModelProperty("任务状态") private String status; + @ApiModelProperty("工作问题") + private String workIssue; + @ApiModelProperty("项目名称") + private String projectName; + } diff --git a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java index 69ae164..a3d285f 100644 --- a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java +++ b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java @@ -26,6 +26,8 @@ import com.ruoyi.flowable.flow.FindNextNodeUtil; import com.ruoyi.flowable.flow.FlowableUtils; import com.ruoyi.flowable.service.IFlowTaskService; import com.ruoyi.flowable.service.ISysDeployFormService; +import com.ruoyi.system.domain.SysProject; +import com.ruoyi.system.service.ISysProjectService; import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysUserService; import lombok.extern.slf4j.Slf4j; @@ -83,6 +85,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask @Resource private ISysDeployFormService sysInstanceFormService; + @Resource + private ISysProjectService sysProjectService; /** * 完成任务 @@ -448,7 +452,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask public Page buildFlowTask(Integer pageNum, Integer pageSize, HistoricProcessInstanceQuery historicProcessInstanceQuery) { Page page = new Page<>(); - List historicProcessInstances = historicProcessInstanceQuery.listPage(pageSize * (pageNum - 1), pageSize); + List historicProcessInstances = historicProcessInstanceQuery.includeProcessVariables().listPage(pageSize * (pageNum - 1), pageSize); page.setTotal(historicProcessInstanceQuery.count()); List flowList = new ArrayList<>(); for (HistoricProcessInstance hisIns : historicProcessInstances) { @@ -475,11 +479,19 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask flowTask.setCategory(pd.getCategory()); flowTask.setProcDefVersion(pd.getVersion()); flowTask.setStatus(hisIns.getBusinessStatus()); - if (MapUtils.isNotEmpty(hisIns.getProcessVariables()) - && hisIns.getProcessVariables().containsKey("submitDate") - && StringUtils.isNotBlank(MapUtils.getString(hisIns.getProcessVariables(), "submitDate"))) { - String submitDate = MapUtils.getString(hisIns.getProcessVariables(), "submitDate"); - flowTask.setCreateTime(DateUtil.parse(submitDate)); + if (MapUtils.isNotEmpty(hisIns.getProcessVariables())) { + if (hisIns.getProcessVariables().containsKey("submitDate") && StringUtils.isNotBlank(MapUtils.getString(hisIns.getProcessVariables(), "submitDate"))) { + String submitDate = MapUtils.getString(hisIns.getProcessVariables(), "submitDate"); + flowTask.setCreateTime(DateUtil.parse(submitDate)); + } + if (hisIns.getProcessVariables().containsKey("issue") && StringUtils.isNotBlank(MapUtils.getString(hisIns.getProcessVariables(), "issue"))) { + flowTask.setWorkIssue(MapUtils.getString(hisIns.getProcessVariables(), "issue")); + } + if (hisIns.getProcessVariables().containsKey("projectId") && Objects.nonNull(MapUtils.getLong(hisIns.getProcessVariables(), "projectId"))) { + Long projectId = MapUtils.getLong(hisIns.getProcessVariables(), "projectId"); + SysProject project = sysProjectService.selectSysProjectById(projectId); + flowTask.setProjectName(Objects.nonNull(project) ? project.getName() : ""); + } } // 当前所处流程 todo: 本地启动放开以下注释 // List taskList = taskService.createTaskQuery().processInstanceId(hisIns.getId()).list(); diff --git a/ruoyi-ui/src/views/flowable/task/process/index.vue b/ruoyi-ui/src/views/flowable/task/process/index.vue index bd5fbc5..0fd0fd8 100644 --- a/ruoyi-ui/src/views/flowable/task/process/index.vue +++ b/ruoyi-ui/src/views/flowable/task/process/index.vue @@ -61,8 +61,8 @@ - - + +