| | |
| | | package org.jeecg.modules.mdc.service.impl; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | if (equipmentList != null && !equipmentList.isEmpty()) { |
| | | for (MdcEquipment mdcEquipment : equipmentList) { |
| | | MdcEquipmentTree tree = new MdcEquipmentTree().convert(mdcEquipment); |
| | | |
| | | tree.setParentId(mdcEquipmentTree.getKey()); |
| | | mdcEquipmentTree.getChildren().add(tree); |
| | | } |
| | |
| | | |
| | | |
| | | @Override |
| | | public List<MdcEquipmentTree> loadTreeListByProduction(String userId) { |
| | | public List<MdcEquipmentTree> loadTreeListByProduction(String userId,String type) { |
| | | //获取所有产线数据 |
| | | List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder)); |
| | | //根据用户id获取拥有的产线信息集合 |
| | |
| | | //组装产线设备树 |
| | | List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list); |
| | | //填充设备数据 |
| | | FillEquipmentByProduction(treeList); |
| | | FillEquipmentByProduction(treeList,type); |
| | | return treeList; |
| | | } |
| | | |
| | |
| | | /** |
| | | * 产线设备树填充设备数据 |
| | | */ |
| | | private void FillEquipmentByProduction(List<MdcEquipmentTree> treeList) { |
| | | private void FillEquipmentByProduction(List<MdcEquipmentTree> treeList,String type) { |
| | | for (MdcEquipmentTree mdcEquipmentTree : treeList) { |
| | | List<MdcEquipment> equipmentList = this.baseMapper.queryByProductionId(mdcEquipmentTree.getKey()); |
| | | List<MdcEquipment> equipmentList = this.baseMapper.queryByProductionId(mdcEquipmentTree.getKey(),type); |
| | | if (equipmentList != null && !equipmentList.isEmpty()) { |
| | | for (MdcEquipment mdcEquipment : equipmentList) { |
| | | MdcEquipmentTree tree = new MdcEquipmentTree().convert(mdcEquipment); |
| | | tree.setParentId(mdcEquipmentTree.getKey()); |
| | | tree.setEntity(mdcEquipment); |
| | | tree.setType(2); |
| | | mdcEquipmentTree.getChildren().add(tree); |
| | | } |
| | | mdcEquipmentTree.setLeaf(false); |
| | | } |
| | | if (!mdcEquipmentTree.getChildren().isEmpty()) { |
| | | FillEquipmentByProduction(mdcEquipmentTree.getChildren()); |
| | | FillEquipmentByProduction(mdcEquipmentTree.getChildren(),type); |
| | | } |
| | | } |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MdcEquipmentTree> loadTreeListByProductionIds(String ids) { |
| | | public List<MdcEquipmentTree> loadTreeListByProductionIds(String ids,String type) { |
| | | List<String> productionIds = Arrays.asList(ids.split(",")); |
| | | //获取所有产线数据 |
| | | List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder)); |
| | |
| | | //组装产线设备树 |
| | | List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list); |
| | | //填充设备数据 |
| | | FillEquipmentByProduction(treeList); |
| | | FillEquipmentByProduction(treeList,type); |
| | | return treeList; |
| | | } |
| | | |