//package org.jeecg.modules.eam.tree; // //import org.jeecg.common.util.oConvertUtils; //import org.jeecg.modules.eam.vo.EamEquipmentTree; //import org.jeecg.modules.system.entity.MdcProduction; //import org.jeecg.modules.system.model.MdcProductionTreeModel; // //import java.util.ArrayList; //import java.util.List; // ///** // * 产线设备树 // * @author: LiuS // * @create: 2023-04-03 15:59 // */ //public class FindsEquipmentProductionUtil { // // /** // * 获取 MdcEquipmentTree // */ // public static List wrapEquipmentProductionTreeList(List recordList) { // List idList = new ArrayList<>(); // List records = new ArrayList<>(); // for (MdcProduction mdcProduction : recordList) { // records.add(new MdcProductionTreeModel(mdcProduction)); // } // getChildren(records, idList); // setEmptyChildrenAsNull(idList); // return idList; // } // // /** // * 该方法是找到并封装顶级父类的节点到TreeList集合 // */ // private static void getChildren(List recordList, List idList) { // List treeList = new ArrayList<>(); // for (MdcProductionTreeModel mdcProductionTreeModel : recordList) { // if (oConvertUtils.isEmpty(mdcProductionTreeModel.getParentId())) { // mdcProductionTreeModel.setType(1); // treeList.add(mdcProductionTreeModel); // idList.add(new EamEquipmentTree().convertByProduction(mdcProductionTreeModel)); // } // } // getGrandChildren(treeList, recordList, idList); // } // // /** // *该方法是找到顶级父类下的所有子节点集合并封装到TreeList集合 // */ // private static void getGrandChildren(List treeList, List recordList, List idList) { // for (int i = 0; i < treeList.size(); i++) { // MdcProductionTreeModel model = treeList.get(i); // EamEquipmentTree mdcEquipmentTree = idList.get(i); // for (int i1 = 0; i1 < recordList.size(); i1++) { // MdcProductionTreeModel m = recordList.get(i1); // if (m.getParentId() != null && m.getParentId().equals(model.getId())) { // model.getChildren().add(m); // m.setType(1); // mdcEquipmentTree.getChildren().add(new EamEquipmentTree().convertByProduction(m)); // } // } // getGrandChildren(treeList.get(i).getChildren(), recordList, idList.get(i).getChildren()); // } // } // // /** // * 该方法是将子节点为空的List集合设置为Null值 // */ // private static void setEmptyChildrenAsNull(List idList) { // for (EamEquipmentTree mdcEquipmentTree : idList) { // if (mdcEquipmentTree.getChildren().isEmpty()) { // mdcEquipmentTree.setLeaf(true); // } else { // setEmptyChildrenAsNull(mdcEquipmentTree.getChildren()); // mdcEquipmentTree.setLeaf(false); // } // } // } //}