From 10af05066c14b82c02ed75d82d27a36709850906 Mon Sep 17 00:00:00 2001 From: kehaiyou Date: Sun, 8 Oct 2023 22:35:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E3=80=90=E5=B7=A5=E4=BD=9C=E6=B5=81?= =?UTF-8?q?=E3=80=91--=E4=BB=BB=E5=8A=A1=E5=88=97=E8=A1=A8=E5=8F=AA?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E9=A1=B6=E7=BA=A7=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E6=8B=BC=E8=A3=85=E6=88=90=E7=88=B6=E5=AD=90=E5=85=B3=E7=B3=BB?= =?UTF-8?q?=E5=B9=B6=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/task/vo/task/BpmTaskRespVO.java | 5 +++++ .../module/bpm/convert/task/BpmTaskConvert.java | 15 +++++++++++++++ .../bpm/service/task/BpmTaskServiceImpl.java | 3 ++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskRespVO.java index 198727dd6..1af839e26 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskRespVO.java @@ -5,6 +5,8 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; +import java.util.List; + @Schema(description = "管理后台 - 流程任务的 Response VO") @Data @EqualsAndHashCode(callSuper = true) @@ -24,6 +26,9 @@ public class BpmTaskRespVO extends BpmTaskDonePageItemRespVO { */ private String parentTaskId; + @Schema(description = "子任务(由加签生成)", requiredMode = Schema.RequiredMode.REQUIRED, example = "childrenTask") + private List children; + @Schema(description = "用户信息") @Data public static class User { diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java index eff2d0a25..05fcb1df4 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.bpm.convert.task; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; @@ -178,4 +179,18 @@ public interface BpmTaskConvert { return bpmTaskSubSignRespVO; }); } + + /** + * 转换任务为父子级 + * @param result + * @return + */ + default List convertChildrenList(List result){ + List childrenTaskList = CollectionUtils.filterList(result, r -> StrUtil.isNotEmpty(r.getParentTaskId())); + Map> parentChildrenTaskListMap = CollectionUtils.convertMultiMap(childrenTaskList, BpmTaskRespVO::getParentTaskId); + for (BpmTaskRespVO bpmTaskRespVO : result) { + bpmTaskRespVO.setChildren(parentChildrenTaskListMap.get(bpmTaskRespVO.getId())); + } + return CollectionUtils.filterList(result, r -> StrUtil.isEmpty(r.getParentTaskId())); + } } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java index ecad585ea..b6a2155dc 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java @@ -193,7 +193,8 @@ public class BpmTaskServiceImpl implements BpmTaskService { Map deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId)); // 拼接数据 - return BpmTaskConvert.INSTANCE.convertList3(tasks, bpmTaskExtDOMap, processInstance, userMap, deptMap); + List result = BpmTaskConvert.INSTANCE.convertList3(tasks, bpmTaskExtDOMap, processInstance, userMap, deptMap); + return BpmTaskConvert.INSTANCE.convertChildrenList(result); } @Override