From 41d5af89f7de2961e03b2f630fbd0da6abef8566 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期一, 03 三月 2025 10:00:32 +0800
Subject: [PATCH] 流程推进详情bug
---
business/src/main/java/com/ycl/service/impl/FlowableTypeServiceImpl.java | 73 ++++++++++++++++++++++++++++++++++--
1 files changed, 68 insertions(+), 5 deletions(-)
diff --git a/business/src/main/java/com/ycl/service/impl/FlowableTypeServiceImpl.java b/business/src/main/java/com/ycl/service/impl/FlowableTypeServiceImpl.java
index c871d79..63aaca0 100644
--- a/business/src/main/java/com/ycl/service/impl/FlowableTypeServiceImpl.java
+++ b/business/src/main/java/com/ycl/service/impl/FlowableTypeServiceImpl.java
@@ -1,17 +1,14 @@
package com.ycl.service.impl;
-import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ycl.common.base.Result;
import com.ycl.domain.entity.FlowableType;
-import com.ycl.framework.utils.PageUtil;
import com.ycl.mapper.FlowableTypeMapper;
import com.ycl.service.FlowableTypeService;
import lombok.RequiredArgsConstructor;
-import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
-import org.springframework.util.Assert;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
@@ -20,4 +17,70 @@
@RequiredArgsConstructor
public class FlowableTypeServiceImpl extends ServiceImpl<FlowableTypeMapper, FlowableType> implements FlowableTypeService {
+ @Override
+ public List<FlowableType> selectTypeList(FlowableType flowableType) {
+ return baseMapper.selectTypeList(flowableType);
+ }
+
+ @Override
+ public List<FlowableType> buildTreeSelect(List<FlowableType> list) {
+ List<FlowableType> returnList = new ArrayList<FlowableType>();
+ List<Integer> tempList = list.stream().map(FlowableType::getId).collect(Collectors.toList());
+ for (Iterator<FlowableType> iterator = list.iterator(); iterator.hasNext();)
+ {
+ FlowableType type = (FlowableType) iterator.next();
+ // 濡傛灉鏄《绾ц妭鐐�, 閬嶅巻璇ョ埗鑺傜偣鐨勬墍鏈夊瓙鑺傜偣
+ if (!tempList.contains(type.getParentId()))
+ {
+ recursionFn(list, type);
+ returnList.add(type);
+ }
+ }
+ if (returnList.isEmpty())
+ {
+ returnList = list;
+ }
+ return returnList;
+ }
+
+ private void recursionFn(List<FlowableType> list, FlowableType t)
+ {
+ // 寰楀埌瀛愯妭鐐瑰垪琛�
+ List<FlowableType> childList = getChildList(list, t);
+ t.setChildren(childList);
+ for (FlowableType tChild : childList)
+ {
+ if (hasChild(list, tChild))
+ {
+ recursionFn(list, tChild);
+ }
+ }
+ }
+
+ /**
+ * 寰楀埌瀛愯妭鐐瑰垪琛�
+ */
+ private List<FlowableType> getChildList(List<FlowableType> list, FlowableType t)
+ {
+ List<FlowableType> tlist = new ArrayList<FlowableType>();
+ Iterator<FlowableType> it = list.iterator();
+ while (it.hasNext())
+ {
+ FlowableType n = (FlowableType) it.next();
+ if (n.getParentId().longValue() == t.getId().longValue())
+ {
+ tlist.add(n);
+ }
+ }
+ return tlist;
+ }
+
+ /**
+ * 鍒ゆ柇鏄惁鏈夊瓙鑺傜偣
+ */
+ private boolean hasChild(List<FlowableType> list, FlowableType t)
+ {
+ return getChildList(list, t).size() > 0;
+ }
+
}
--
Gitblit v1.8.0