|
@@ -1,9 +1,12 @@
|
|
package com.platform.dao.util;
|
|
package com.platform.dao.util;
|
|
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
+import com.platform.common.cache.DictCache;
|
|
import com.platform.common.util.ListUtils;
|
|
import com.platform.common.util.ListUtils;
|
|
import com.platform.common.util.MapUtils;
|
|
import com.platform.common.util.MapUtils;
|
|
import com.platform.common.util.StringUtils;
|
|
import com.platform.common.util.StringUtils;
|
|
|
|
+import com.platform.dao.entity.custom.CustomForm;
|
|
import com.platform.dao.entity.repair.ErrorType;
|
|
import com.platform.dao.entity.repair.ErrorType;
|
|
import com.platform.dao.entity.part.PartType;
|
|
import com.platform.dao.entity.part.PartType;
|
|
import com.platform.dao.entity.sb.SbInfo;
|
|
import com.platform.dao.entity.sb.SbInfo;
|
|
@@ -395,6 +398,46 @@ public class TreeUtil {
|
|
return TreeUtil.buildByLoopWithoutRoot(trees);
|
|
return TreeUtil.buildByLoopWithoutRoot(trees);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public List<CommonTree> buildCustomFormTree(List<CustomForm> forms) {
|
|
|
|
+ List<CommonTree> trees = new ArrayList<>();
|
|
|
|
+ if(CollectionUtil.isNotEmpty(forms)){
|
|
|
|
+ // 按照归属分类
|
|
|
|
+ Map<String,List<CustomForm>> maps = new HashMap<>();
|
|
|
|
+ forms.forEach(form -> {
|
|
|
|
+ String key = form.getCategory();
|
|
|
|
+ List<CustomForm> list = maps.get(key);
|
|
|
|
+ if(list == null){
|
|
|
|
+ list = new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ list.add(form);
|
|
|
|
+ maps.put(key, list);
|
|
|
|
+ });
|
|
|
|
+ for(Map.Entry<String,List<CustomForm>> entry : maps.entrySet()){
|
|
|
|
+ String key = entry.getKey();
|
|
|
|
+ List<CustomForm> list = entry.getValue();
|
|
|
|
+ CommonTree node = new CommonTree();
|
|
|
|
+ node.setId(key);
|
|
|
|
+ node.setKey(key);
|
|
|
|
+ node.setTitle(DictCache.getLabelByValue("CATEGORY_TYPE", key));
|
|
|
|
+ node.setValue(DictCache.getLabelByValue("CATEGORY_TYPE", key));
|
|
|
|
+ // 组装children
|
|
|
|
+ List<TreeNode> children = new ArrayList<>();
|
|
|
|
+ if(CollectionUtil.isNotEmpty(list)){
|
|
|
|
+ list.forEach(item->{
|
|
|
|
+ TreeNode child = new TreeNode();
|
|
|
|
+ child.setId(item.getId());
|
|
|
|
+ child.setParentId(key);
|
|
|
|
+ child.setItem(DictCache.getLabelByValue("CUSTOM_FORM_TYPE",item.getType()));
|
|
|
|
+ children.add(child);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ node.setChildren(children);
|
|
|
|
+ trees.add(node);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return trees;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 通过sysMenu创建树形节点
|
|
* 通过sysMenu创建树形节点
|
|
*
|
|
*
|