feat: 【工作流】--任务列表只返回顶级任务,拼装成父子关系并返回
This commit is contained in:
parent
d7ae944438
commit
10af05066c
|
@ -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<BpmTaskRespVO> children;
|
||||
|
||||
@Schema(description = "用户信息")
|
||||
@Data
|
||||
public static class User {
|
||||
|
|
|
@ -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<BpmTaskRespVO> convertChildrenList(List<BpmTaskRespVO> result){
|
||||
List<BpmTaskRespVO> childrenTaskList = CollectionUtils.filterList(result, r -> StrUtil.isNotEmpty(r.getParentTaskId()));
|
||||
Map<String, List<BpmTaskRespVO>> 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()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,7 +193,8 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
|
||||
|
||||
// 拼接数据
|
||||
return BpmTaskConvert.INSTANCE.convertList3(tasks, bpmTaskExtDOMap, processInstance, userMap, deptMap);
|
||||
List<BpmTaskRespVO> result = BpmTaskConvert.INSTANCE.convertList3(tasks, bpmTaskExtDOMap, processInstance, userMap, deptMap);
|
||||
return BpmTaskConvert.INSTANCE.convertChildrenList(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue