| | |
| | | package org.jeecg.modules.dnc.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.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.shiro.SecurityUtils; |
| | |
| | | @Autowired |
| | | @Lazy |
| | | private IProcessStreamService processStreamService; |
| | | @Autowired |
| | | private IWorkStepService workStepService; |
| | | @Autowired |
| | | private IDocInfoService docInfoService; |
| | | @Autowired |
| | |
| | | |
| | | @Override |
| | | public List<CommonGenericTree> loadProductTree(String userId) { |
| | | //产品 |
| | | List<ProductInfo> productInfoList = getByUserPerms(userId); |
| | | if(productInfoList == null || productInfoList.isEmpty()) |
| | | return Collections.emptyList(); |
| | | //部件 |
| | | List<ComponentExt> componentInfoList = componentInfoService.getByUserPermsAs(userId); |
| | | if(componentInfoList == null) |
| | | componentInfoList = Collections.emptyList(); |
| | | //零件 |
| | | List<PartsInfo> partsInfos = partsInfoService.getByUserPerms(userId); |
| | | if(partsInfos == null) |
| | | partsInfos = Collections.emptyList(); |
| | | return ProductTreeWrapper.loadTree(productInfoList, componentInfoList, partsInfos); |
| | | //工序 |
| | | List<ProcessStream> processStreams=processStreamService.getByuserPerms(userId); |
| | | if(processStreams==null) |
| | | processStreams = Collections.emptyList(); |
| | | //工步 |
| | | List<WorkStep> workStepList=workStepService.getByUserPerms(userId); |
| | | if(workStepList==null) |
| | | workStepList = Collections.emptyList(); |
| | | return ProductTreeWrapper.loadTree(productInfoList, componentInfoList, partsInfos,processStreams,workStepList); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public List<String> getDepartIdsByParams(Integer nodeType, String paramId) { |
| | | List<String> departIds = new ArrayList<>(); |
| | | if(nodeType == 2) { |
| | | ComponentInfo en = componentInfoService.getById(paramId); |
| | | if(en == null) |
| | | //5-工序 |
| | | if(nodeType == 5) { |
| | | ProcessStream processStream= processStreamService.getById(paramId); |
| | | if(processStream == null) |
| | | return null; |
| | | List<PermissionStream> permissionStreamList = permissionStreamService.getByComponentId(en.getProductId(), en.getComponentId()); |
| | | List<PermissionStream> permissionStreamList = permissionStreamService.list(new QueryWrapper<PermissionStream>() |
| | | .eq(StrUtil.isNotEmpty(processStream.getProductId()),"product_id", processStream.getProductId()) |
| | | .eq(StrUtil.isNotEmpty(processStream.getComponentId()),"component_id",processStream.getComponentId()) |
| | | .eq(StrUtil.isNotEmpty(processStream.getPartsId()),"parts_id", processStream.getPartsId()) |
| | | .eq(StrUtil.isNotEmpty(processStream.getProcessId()),"process_id",processStream.getProcessId())); |
| | | if(permissionStreamList == null || permissionStreamList.isEmpty()) |
| | | return null; |
| | | permissionStreamList.forEach(item -> { |
| | | departIds.add(item.getDepartId()); |
| | | }); |
| | | }else if(nodeType == 3) { |
| | | PartsInfo en = partsInfoService.getById(paramId); |
| | | if(en == null) |
| | | //6-工步 |
| | | }else if(nodeType == 6) { |
| | | WorkStep workStep = workStepService.getById(paramId); |
| | | if(workStep == null) |
| | | return null; |
| | | List<PermissionStream> permissionStreamList = permissionStreamService.getByPartsId(en.getProductId(), en.getComponentId(), en.getPartsId()); |
| | | List<PermissionStream> permissionStreamList = permissionStreamService.list(new QueryWrapper<PermissionStream>() |
| | | .eq(StrUtil.isNotEmpty(workStep.getProductId()),"product_id", workStep.getProductId()) |
| | | .eq(StrUtil.isNotEmpty(workStep.getComponentId()),"component_id",workStep.getComponentId()) |
| | | .eq(StrUtil.isNotEmpty(workStep.getPartsId()),"parts_id", workStep.getPartsId()) |
| | | .eq(StrUtil.isNotEmpty(workStep.getProcessId()),"process_id",workStep.getProcessId()) |
| | | .eq(StrUtil.isNotEmpty(workStep.getId()),"step_id", workStep.getId())); |
| | | if(permissionStreamList == null || permissionStreamList.isEmpty()) |
| | | return null; |
| | | permissionStreamList.forEach(item -> { |
| | |
| | | }else { |
| | | return null; |
| | | } |
| | | //去重 |
| | | Set<String> set = new HashSet<>(departIds); |
| | | departIds.clear(); |
| | | departIds.addAll(set); |
| | | return departIds; |
| | | } |
| | | |
| | |
| | | List<ProductInfo> productInfos = this.getByUserPerms(userId, queryParam); |
| | | List<ComponentInfo> componentInfos = componentInfoService.getByUserPerms(userId, queryParam); |
| | | List<PartsInfo> partsInfos = partsInfoService.getByUserPerms(userId, null, queryParam); |
| | | |
| | | List<ProcessStream> processStreams=processStreamService.getByuserPerms(userId, queryParam); |
| | | List<WorkStep> workSteps=workStepService.getByUserPerms(userId, queryParam); |
| | | List<ComponentInfo> componentInfoList = new ArrayList<>(); |
| | | List<ProductInfo> productInfoList = new ArrayList<>(); |
| | | |
| | |
| | | |
| | | if(!componentInfoMap.containsKey(p.getComponentId())) { |
| | | component = componentInfoService.getById(p.getComponentId()); |
| | | if(component != null) { |
| | | componentInfoMap.put(component.getComponentId(), component); |
| | | componentInfoList.add(component); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | for (ProcessStream processStream : processStreams) { |
| | | if (!productInfoMap.containsKey(processStream.getProductId())) { |
| | | product = super.getById(processStream.getProductId()); |
| | | if(product != null) { |
| | | productInfoMap.put(product.getProductId(), product); |
| | | productInfoList.add(product); |
| | | } |
| | | } |
| | | |
| | | if(!componentInfoMap.containsKey(processStream.getComponentId())) { |
| | | component = componentInfoService.getById(processStream.getComponentId()); |
| | | if(component != null) { |
| | | componentInfoMap.put(component.getComponentId(), component); |
| | | componentInfoList.add(component); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | for (WorkStep workStep :workSteps){ |
| | | if (!productInfoMap.containsKey(workStep.getProductId())) { |
| | | product = super.getById(workStep.getProductId()); |
| | | if(product != null) { |
| | | productInfoMap.put(product.getProductId(), product); |
| | | productInfoList.add(product); |
| | | } |
| | | } |
| | | |
| | | if(!componentInfoMap.containsKey(workStep.getComponentId())) { |
| | | component = componentInfoService.getById(workStep.getComponentId()); |
| | | if(component != null) { |
| | | componentInfoMap.put(component.getComponentId(), component); |
| | | componentInfoList.add(component); |
| | |
| | | //转换数据 |
| | | List<ComponentExt> componentExtList = ComponentExt.convertToExtList(componentInfoList); |
| | | |
| | | return ProductTreeWrapper.loadTree(productInfoList, componentExtList, partsInfos); |
| | | return ProductTreeWrapper.loadTree(productInfoList, componentExtList, partsInfos,processStreams,workSteps); |
| | | } |
| | | } |