From 1930b4e59d60c015ffa7bfee92e4bc227b90dcb3 Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期三, 28 五月 2025 15:41:41 +0800 Subject: [PATCH] 1.Dnc产品结构树检索nc文件 2.新增批次功能 3.新增审签查询流程 4.修改刀具系统查询 --- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java | 243 +++++++++++++++++++++++++++++++++++++----------- 1 files changed, 188 insertions(+), 55 deletions(-) diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java index d289e58..0e11f39 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java @@ -11,6 +11,7 @@ import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.dnc.constant.DocAttributionTypeEnum; import org.jeecg.modules.dnc.dto.ComponentExt; import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.dnc.exception.ExceptionCast; @@ -87,6 +88,10 @@ @Autowired @Lazy private IDocInfoService docInfoService; + @Autowired + private IDeviceTypeService deviceTypeService; + @Autowired + private IDeviceManagementService deviceManagementService; @Override @Transactional(rollbackFor = {Exception.class}) @@ -130,7 +135,7 @@ PermissionStreamNew stream = new PermissionStreamNew(); stream.setBusinessId(productInfo.getProductId()); stream.setDepartId(departId); - stream.setBusinessType("1"); + stream.setBusinessType(DocAttributionTypeEnum.PRODUCT.getCode().toString()); permissionStreamNewService.save(stream); } } @@ -138,7 +143,7 @@ PermissionStreamNew stream = new PermissionStreamNew(); stream.setBusinessId(productInfo.getProductId()); stream.setUserId(userId); - stream.setBusinessType("1"); + stream.setBusinessType(DocAttributionTypeEnum.PRODUCT.getCode().toString()); return permissionStreamNewService.addPermissionStreamNew(stream); } @@ -174,12 +179,12 @@ return false; } } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId, "1"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId, DocAttributionTypeEnum.PRODUCT.getCode().toString()); if (stream == null) { stream = new PermissionStreamNew(); stream.setBusinessId(productInfo.getProductId()); stream.setUserId(userId); - stream.setBusinessType("1"); + stream.setBusinessType(DocAttributionTypeEnum.PRODUCT.getCode().toString()); return permissionStreamNewService.save(stream); } return b; @@ -258,7 +263,7 @@ ExceptionCast.cast(ProductInfoCode.PRODUCT_PROCESS_EXIST); boolean b = productPermissionService.deleteByProductId(id); //楠岃瘉鏄惁瀛樺湪鏂囨。 - List<DocRelative> docRelativeList = iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type", "1").eq("attribution_id", id)); + List<DocRelative> docRelativeList = iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type", DocAttributionTypeEnum.PRODUCT.getCode() ).eq("attribution_id", id)); if (!docRelativeList.isEmpty()) { ExceptionCast.cast(ProductInfoCode.PRODUCT_DOC_EXIST); } @@ -267,10 +272,10 @@ b = productDepartmentService.deleteByProductId(id); if (!b) ExceptionCast.cast(CommonCode.FAIL); - b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(id, "1","0"); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(id, DocAttributionTypeEnum.PRODUCT.getCode().toString(),"0"); if (!b) ExceptionCast.cast(CommonCode.FAIL); - b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(id, "1","1"); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(id, DocAttributionTypeEnum.PRODUCT.getCode().toString(),"1"); if (!b) ExceptionCast.cast(CommonCode.FAIL); b = productMixService.removeById(id); @@ -287,37 +292,37 @@ String userId = user.getId(); if (!ValidateUtil.validateString(userId)) ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); - if (nodeType == 1) { + if (nodeType.equals(DocAttributionTypeEnum.PRODUCT.getCode())) { ProductInfo productInfo = super.getById(paramId); if (productInfo == null) ExceptionCast.cast(ProductInfoCode.PRODUCT_NOT_EXIST); PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(paramId, userId,"1"); return permission != null; - } else if (nodeType == 2) { + } else if (nodeType.equals(DocAttributionTypeEnum.COMPONENT.getCode())) { ComponentInfo componentInfo = componentInfoService.getById(paramId); if (componentInfo == null) ExceptionCast.cast(ComponentInfoCode.COMPONENT_NOT_EXIST); PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(componentInfo.getComponentId(), userId,"2"); return permission != null; - } else if (nodeType == 3) { + } else if (nodeType.equals(DocAttributionTypeEnum.PARTS.getCode())) { PartsInfo partsInfo = partsInfoService.getById(paramId); if (partsInfo == null) ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), userId, "3"); return permission != null; - } else if (nodeType == 4) { + } else if (nodeType.equals(DocAttributionTypeEnum.OPERATION.getCode())) { ProcessSpecVersion processSpecVersion = processSpecVersionService.getById(paramId); if (processSpecVersion == null) ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_NOT_EXIST); PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processSpecVersion.getId(),userId,"4"); return permission != null; - } else if (nodeType == 5) { + } else if (nodeType.equals(DocAttributionTypeEnum.PROCESS.getCode())) { ProcessStream processStream = processStreamService.getById(paramId); if (processStream == null) ExceptionCast.cast(ProcessInfoCode.PROCESS_NOT_EXIST); PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), userId,"5"); return permission != null; - } else if (nodeType == 6) { + } else if (nodeType.equals(DocAttributionTypeEnum.WORKSITE.getCode())) { WorkStep workStep = workStepService.getById(paramId); if (workStep == null) ExceptionCast.cast(ProcessInfoCode.WORKSTEP_NOT_EXIST); @@ -331,17 +336,17 @@ public List<UserDepartExt> getUserPermsList(Integer nodeType, String paramId) { if (!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) return null; - if (nodeType == 1) { + if (nodeType.equals(DocAttributionTypeEnum.PRODUCT.getCode())) { return productPermissionService.getUserPermsByProductId(paramId); - } else if (nodeType == 2) { + } else if (nodeType.equals(DocAttributionTypeEnum.COMPONENT.getCode())) { return componentPermissionService.getUserPermsByComponentId(paramId); - } else if (nodeType == 3) { + } else if (nodeType.equals(DocAttributionTypeEnum.PARTS.getCode())) { return partsPermissionService.getUserPermsByProductId(paramId); - } else if (nodeType == 4) { + } else if (nodeType.equals(DocAttributionTypeEnum.OPERATION.getCode())) { return processSpecVersionPermissionService.getUserPermsByProductId(paramId); - } else if (nodeType == 5) { + } else if (nodeType.equals(DocAttributionTypeEnum.PROCESS.getCode())) { return iProcessStreamPermissionService.getUserPermsByProductId(paramId); - } else if (nodeType == 6) { + } else if (nodeType.equals(DocAttributionTypeEnum.WORKSITE.getCode())) { return iWorkStepPermissionService.getUserPermsByProductId(paramId); } else { return null; @@ -352,17 +357,17 @@ public List<SysUser> getUserNonPermsList(Integer nodeType, String paramId) { if (!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) return null; - if (nodeType == 1) { + if (nodeType.equals(DocAttributionTypeEnum.PRODUCT.getCode())) { return productPermissionService.getUserNonPermsByProductId(paramId); - } else if (nodeType == 2) { + } else if (nodeType.equals(DocAttributionTypeEnum.COMPONENT.getCode())){ return componentPermissionService.getUserNonPermsByComponentId(paramId); - } else if (nodeType == 3) { + } else if (nodeType.equals(DocAttributionTypeEnum.PARTS.getCode())) { return partsPermissionService.getUserNonPermsByProductId(paramId); - } else if (nodeType == 4) { + } else if (nodeType.equals(DocAttributionTypeEnum.OPERATION.getCode())) { return processSpecVersionPermissionService.getUserNonPermsByProductId(paramId); - } else if (nodeType == 5) { + } else if (nodeType.equals(DocAttributionTypeEnum.PROCESS.getCode())) { return iProcessStreamPermissionService.getUserNonPermsByProductId(paramId); - } else if (nodeType == 6) { + } else if (nodeType.equals(DocAttributionTypeEnum.WORKSITE.getCode())) { return iWorkStepPermissionService.getUserNonPermsByProductId(paramId); } else { return null; @@ -373,17 +378,17 @@ public List<MdcProduction> getDepartPermsList(Integer nodeType, String paramId) { if (!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) return null; - if (nodeType == 1) { + if (nodeType.equals(DocAttributionTypeEnum.PRODUCT.getCode())) { return productDepartmentService.getDepartPermsByProductId(paramId); - } else if (nodeType == 2) { + } else if (nodeType.equals(DocAttributionTypeEnum.COMPONENT.getCode())){ return componentDepartmentService.getDepartPermsByComponentId(paramId); - } else if (nodeType == 3) { + } else if (nodeType.equals(DocAttributionTypeEnum.PARTS.getCode())) { return partsDepartmentService.getDepartPermsByPartsId(paramId); - } else if (nodeType == 4) { + } else if (nodeType.equals(DocAttributionTypeEnum.OPERATION.getCode())) { return processSpecVersionDepartmentService.getDepartPermsByPsvId(paramId); - }else if (nodeType == 5) { + } else if (nodeType.equals(DocAttributionTypeEnum.PROCESS.getCode())) { return processionDepartmentService.getDepartPermsByProcessId(paramId); - } else if (nodeType == 6) { + } else if (nodeType.equals(DocAttributionTypeEnum.WORKSITE.getCode())) { return workStepDepartmentService.getDepartPermsByStepId(paramId); } else { @@ -395,17 +400,17 @@ public List<MdcProduction> getDepartNonPermsList(Integer nodeType, String paramId) { if (!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) return null; - if (nodeType == 1) { + if (nodeType.equals(DocAttributionTypeEnum.PRODUCT.getCode())) { return productDepartmentService.getDepartNonPermsByProductId(paramId); - } else if (nodeType == 2) { + } else if (nodeType.equals(DocAttributionTypeEnum.COMPONENT.getCode())){ return componentDepartmentService.getDepartNonPermsByComponentId(paramId); - } else if (nodeType == 3) { + } else if (nodeType.equals(DocAttributionTypeEnum.PARTS.getCode())) { return partsDepartmentService.getDepartNonPermsByProductId(paramId); - } else if (nodeType == 4) { + } else if (nodeType.equals(DocAttributionTypeEnum.OPERATION.getCode())) { return processionDepartmentService.getDepartNonPermsByProcessId(paramId); - } else if (nodeType == 5) { + } else if (nodeType.equals(DocAttributionTypeEnum.PROCESS.getCode())) { return processionDepartmentService.getDepartNonPermsByProcessId(paramId); - } else if (nodeType == 6) { + } else if (nodeType.equals(DocAttributionTypeEnum.WORKSITE.getCode())) { return workStepDepartmentService.getDepartNonPermsByStepId(paramId); } else { return null; @@ -570,7 +575,7 @@ stream = new PermissionStreamNew(); stream.setUserId(item.getId()); stream.setBusinessId(productInfo.getProductId()); - stream.setBusinessType("1"); + stream.setBusinessType(DocAttributionTypeEnum.PRODUCT.getCode().toString()); permissionStreamList.add(stream); } }); @@ -645,7 +650,7 @@ stream = new PermissionStreamNew(); stream.setDepartId(item.getId()); stream.setBusinessId(productInfo.getProductId()); - stream.setBusinessType("1"); + stream.setBusinessType(DocAttributionTypeEnum.PRODUCT.getCode().toString()); permissionStreamList.add(stream); } }); @@ -700,7 +705,7 @@ public List<String> getDepartIdsByParams(Integer nodeType, String paramId) { List<String> departIds = new ArrayList<>(); //5-宸ュ簭 - if (nodeType == 5) { + if (Objects.equals(nodeType, DocAttributionTypeEnum.PROCESS.getCode())) { ProcessStream processStream = processStreamService.getById(paramId); if (processStream == null) return null; @@ -711,7 +716,7 @@ departIds.add(item.getDepartId()); }); //6-宸ユ - } else if (nodeType == 6) { + } else if (Objects.equals(nodeType, DocAttributionTypeEnum.WORKSITE.getCode())) { WorkStep workStep = workStepService.getById(paramId); if (workStep == null) return null; @@ -755,7 +760,7 @@ @Override public List<CommonGenericTree> loadTree(String userId, Integer nodeType, String paramId) { - if (nodeType == 1) { + if (Objects.equals(nodeType, DocAttributionTypeEnum.PRODUCT.getCode())) { List<ComponentInfo> componentInfoList = componentInfoService.getByProductIdAndUserId(paramId, userId); if (componentInfoList == null || componentInfoList.isEmpty()) return Collections.emptyList(); @@ -768,13 +773,13 @@ node.setLabel(c.getComponentName()); node.setParentId(c.getProductId()); node.setIconClass(""); - node.setType(2); + node.setType(DocAttributionTypeEnum.COMPONENT.getCode()); node.setRField(c.getProductId()); node.setEntity(c); list.add(node); } return list; - } else if (nodeType == 2) { + } else if (Objects.equals(nodeType, DocAttributionTypeEnum.COMPONENT.getCode())) { List<ComponentInfo> componentInfoList = componentInfoService.getByParentIdAndUserId(paramId, userId); List<CommonGenericTree> list = new ArrayList<>(); CommonGenericTree<ComponentInfo> componentNode; @@ -786,7 +791,7 @@ componentNode.setLabel(c.getComponentName()); componentNode.setParentId(c.getParentId()); componentNode.setIconClass(""); - componentNode.setType(2); + componentNode.setType(DocAttributionTypeEnum.COMPONENT.getCode()); componentNode.setRField(c.getProductId()); componentNode.setEntity(c); list.add(componentNode); @@ -803,7 +808,7 @@ partNode.setLabel(part.getPartsName()); partNode.setParentId(part.getComponentId()); partNode.setIconClass(""); - partNode.setType(3); + partNode.setType(DocAttributionTypeEnum.PARTS.getCode()); partNode.setRField(part.getComponentId()); partNode.setEntity(part); partNode.setLeaf(true); @@ -1071,6 +1076,98 @@ return getByTreeOtherFileInfo(partsInfoService.getByPartsInfo(treeInfoRequest)); case 4: return getByTreeOtherFileInfo(processSpecVersionService.getByProcessSpecVersion(treeInfoRequest)); + case 5: + return getByTreeOtherFileInfo(processStreamService.getByProcessStreamOtherFile(treeInfoRequest)); + case 6: + return getByTreeOtherFileInfo(workStepService.getByWorkStepOtherFile(treeInfoRequest)); + } + return new ArrayList<>(); + } + + /** + * 閫氳繃浠e彿銆佸悕绉般�佹潗璐ㄧ瓑鏌ヨ瀵瑰簲NC鏂囦欢 + * @param treeInfoRequest + * @return + */ + @Override + public List<DocInfo> getByTreeNcFileInfo(TreeInfoRequest treeInfoRequest){ + //浜у搧銆侀儴浠躲�侀浂浠躲�佸伐鑹鸿绋嬬増鏈兘娌℃湁瀵瑰簲鐨凬C鏂囦欢锛岀洿鎺ユ煡璇㈠瓙缁撴瀯 + switch (treeInfoRequest.getAttributionType()){ + case 1: + LambdaQueryWrapper<ProductInfo> queryWrapper = new LambdaQueryWrapper<>(); + // 鏄庣‘鏉′欢锛氫粎褰揳ttributionType涓�1涓攁ttributionId闈炵┖鏃舵坊鍔犳潯浠� + if (StrUtil.isNotBlank(treeInfoRequest.getAttributionId())) { + queryWrapper.eq(ProductInfo::getProductId, treeInfoRequest.getAttributionId()); + } + // 绠�鍖栨潯浠跺垽鏂� + queryWrapper.like(StrUtil.isNotBlank(treeInfoRequest.getTreeCode()), ProductInfo::getProductNo, treeInfoRequest.getTreeCode()) + .like(StrUtil.isNotBlank(treeInfoRequest.getTreeName()), ProductInfo::getProductName, treeInfoRequest.getTreeName()); + List<ProductInfo> productInfoList = super.list(queryWrapper); + if (CollectionUtil.isNotEmpty(productInfoList)) { + treeInfoRequest.setProductIds(productInfoList.stream().map(ProductInfo::getProductId).collect(Collectors.toList())); + } + return getByTreeNcFileInfo(processStreamService.getByProcessStreamNCFile(treeInfoRequest)); + case 2: + LambdaQueryWrapper<ComponentInfo> componentInfoLambdaQueryWrapper = new LambdaQueryWrapper<>(); + // 鏄庣‘鏉′欢锛氫粎褰揳ttributionType涓�1涓攁ttributionId闈炵┖鏃舵坊鍔犳潯浠� + if (StrUtil.isNotBlank(treeInfoRequest.getAttributionId())) { + componentInfoLambdaQueryWrapper.eq(ComponentInfo::getComponentId, treeInfoRequest.getAttributionId()); + } + componentInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),ComponentInfo::getComponentCode, treeInfoRequest.getTreeCode()); + componentInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),ComponentInfo::getComponentName, treeInfoRequest.getTreeName()); + componentInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getStructureType()),ComponentInfo::getStructureType, treeInfoRequest.getStructureType()); + componentInfoLambdaQueryWrapper.orderByDesc(ComponentInfo::getCreateTime); + List<ComponentInfo> componentInfoList = componentInfoService.list(componentInfoLambdaQueryWrapper); + if (CollectionUtil.isNotEmpty(componentInfoList)) { + treeInfoRequest.setComponentIds(componentInfoList.stream().map(ComponentInfo::getComponentId).collect(Collectors.toList())); + } + return getByTreeNcFileInfo(processStreamService.getByProcessStreamNCFile(treeInfoRequest)); + case 3: + LambdaQueryWrapper<PartsInfo> partsInfoLambdaQueryWrapper = new LambdaQueryWrapper<>(); + if (treeInfoRequest.getProductIds() != null && !treeInfoRequest.getProductIds().isEmpty()) { + partsInfoLambdaQueryWrapper.in(PartsInfo::getProductId, treeInfoRequest.getProductIds()); + } + if (treeInfoRequest.getComponentIds() != null && !treeInfoRequest.getComponentIds().isEmpty()) { + partsInfoLambdaQueryWrapper.in(PartsInfo::getComponentId, treeInfoRequest.getComponentIds()); + } + if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.PARTS.getCode())){ + partsInfoLambdaQueryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),PartsInfo::getPartsId,treeInfoRequest.getAttributionId()); + } + partsInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),PartsInfo::getPartsCode, treeInfoRequest.getTreeCode()); + partsInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),PartsInfo::getPartsName, treeInfoRequest.getTreeName()); + partsInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getStructureType()),PartsInfo::getStructureType, treeInfoRequest.getStructureType()); + partsInfoLambdaQueryWrapper.orderByDesc(PartsInfo::getCreateTime); + List<PartsInfo> list = partsInfoService.list(partsInfoLambdaQueryWrapper); + if (CollectionUtil.isNotEmpty(list)) { + treeInfoRequest.setPartsIds(list.stream().map(PartsInfo::getPartsId).collect(Collectors.toList())); + } + return getByTreeNcFileInfo(processStreamService.getByProcessStreamNCFile(treeInfoRequest)); + case 4: + LambdaQueryWrapper<ProcessSpecVersion> processSpecVersionLambdaQueryWrapper = new LambdaQueryWrapper<>(); + if (treeInfoRequest.getProductIds() != null && !treeInfoRequest.getProductIds().isEmpty()) { + processSpecVersionLambdaQueryWrapper.in(ProcessSpecVersion::getProductId, treeInfoRequest.getProductIds()); + } + if (treeInfoRequest.getComponentIds() != null && !treeInfoRequest.getComponentIds().isEmpty()) { + processSpecVersionLambdaQueryWrapper.in(ProcessSpecVersion::getComponentId, treeInfoRequest.getComponentIds()); + } + if (treeInfoRequest.getPartsIds() != null && !treeInfoRequest.getPartsIds().isEmpty()) { + processSpecVersionLambdaQueryWrapper.in(ProcessSpecVersion::getPartsId, treeInfoRequest.getPartsIds()); + } + if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.OPERATION.getCode())){ + processSpecVersionLambdaQueryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),ProcessSpecVersion::getId,treeInfoRequest.getAttributionId()); + } + processSpecVersionLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),ProcessSpecVersion::getProcessSpecVersionName, treeInfoRequest.getTreeName()); + processSpecVersionLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),ProcessSpecVersion::getProcessSpecVersionCode, treeInfoRequest.getTreeName()); + processSpecVersionLambdaQueryWrapper.orderByDesc(ProcessSpecVersion::getCreateTime); + List<ProcessSpecVersion> processSpecVersions = processSpecVersionService.list(processSpecVersionLambdaQueryWrapper); + if (CollectionUtil.isNotEmpty(processSpecVersions)) { + treeInfoRequest.setPsvIds(processSpecVersions.stream().map(ProcessSpecVersion::getId).collect(Collectors.toList())); + } + return getByTreeNcFileInfo(processStreamService.getByProcessStreamNCFile(treeInfoRequest)); + case 5: + return getByTreeNcFileInfo(processStreamService.getByProcessStreamNCFile(treeInfoRequest)); + case 6: + return getByTreeNcFileInfo(workStepService.getByWorkStepNCFile(treeInfoRequest)); } return new ArrayList<>(); } @@ -1099,6 +1196,42 @@ ProcessSpecVersion processSpecVersion=processSpecVersionService.getById(docInfo.getAttributionId()); docInfo.setNodeName(processSpecVersion.getProcessSpecVersionName()); docInfo.setNodeCode(processSpecVersion.getProcessSpecVersionCode()); + break; + case 5: + ProcessStream processStream=processStreamService.getById(docInfo.getAttributionId()); + docInfo.setNodeName(processStream.getProcessName()); + docInfo.setNodeCode(processStream.getProcessCode()); + break; + case 6: + WorkStep workStep=workStepService.getById(docInfo.getAttributionId()); + docInfo.setNodeName(workStep.getStepName()); + docInfo.setNodeCode(workStep.getStepName()); + break; + } + }); + } + return docInfos; + } + + private List<DocInfo> getByTreeNcFileInfo(List<DocInfo> docInfos){ + //瀵规墍灞瀒d杩涜缈昏瘧 + if (docInfos != null && !docInfos.isEmpty()) { + docInfos.forEach(docInfo -> { + //NC鏂囦欢瀛樺湪璁惧绫讳笅 + DeviceType deviceType=deviceTypeService.getById(docInfo.getAttributionId()); + DeviceManagement deviceManagement= deviceManagementService.getById(deviceType.getDeviceManagementId()); + docInfo.setDeviceName(deviceManagement.getDeviceManagementName()); + docInfo.setDeviceCode(deviceManagement.getDeviceManagementCode()); + if (deviceType.getAttributionType().equals(DocAttributionTypeEnum.PROCESS.getCode())){ + //宸ュ簭涓嬬殑璁惧绫� + ProcessStream processStream=processStreamService.getById(deviceType.getAttributionId()); + docInfo.setNodeName(processStream.getProcessName()); + docInfo.setNodeCode(processStream.getProcessCode()); + }else { + //宸ユ涓嬬殑璁惧绫� + WorkStep workStep=workStepService.getById(deviceType.getAttributionId()); + docInfo.setNodeName(workStep.getStepName()); + docInfo.setNodeCode(workStep.getStepName()); } }); } @@ -1256,7 +1389,7 @@ ComponentInfo cpInfo = componentInfoMap.get(cp.getComponentId()); PermissionStreamNew s = new PermissionStreamNew(); s.setBusinessId(cpInfo.getComponentId()); - s.setBusinessType("2"); + s.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString()); s.setUserId(cp.getUserId()); permissionStreamList.add(s); } @@ -1287,7 +1420,7 @@ PartsInfo ptInfo = partsInfoMap.get(pp.getPartsId()); PermissionStreamNew s = new PermissionStreamNew(); s.setBusinessId(ptInfo.getPartsId()); - s.setBusinessType("3"); + s.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString()); s.setUserId(pp.getUserId()); permissionStreamList.add(s); } @@ -1318,7 +1451,7 @@ ProcessSpecVersion processSpecVersion = processStreamMap.get(pp.getPsvId()); PermissionStreamNew s = new PermissionStreamNew(); s.setBusinessId(processSpecVersion.getId()); - s.setBusinessType("4"); + s.setBusinessType(DocAttributionTypeEnum.OPERATION.getCode().toString()); s.setUserId(pp.getUserId()); permissionStreamList.add(s); } @@ -1349,7 +1482,7 @@ ProcessStream processStream = processStreamMap.get(pp.getProcessId()); PermissionStreamNew s = new PermissionStreamNew(); s.setBusinessId(processStream.getProcessId()); - s.setBusinessType("5"); + s.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); s.setUserId(pp.getUserId()); permissionStreamList.add(s); } @@ -1380,7 +1513,7 @@ WorkStep workStep = workStepHashMap.get(ws.getStepId()); PermissionStreamNew s = new PermissionStreamNew(); s.setBusinessId(workStep.getId()); - s.setBusinessType("6"); + s.setBusinessType(DocAttributionTypeEnum.WORKSITE.getCode().toString()); s.setUserId(ws.getUserId()); permissionStreamList.add(s); } @@ -1608,7 +1741,7 @@ WorkStep workStep = workStepMap.get(wsDep.getStepId()); PermissionStreamNew permStream = new PermissionStreamNew(); permStream.setBusinessId(workStep.getId()); - permStream.setBusinessType("6"); + permStream.setBusinessType(DocAttributionTypeEnum.WORKSITE.getCode().toString()); permStream.setDepartId(wsDep.getDepartId()); newPermissionStreams.add(permStream); } @@ -1679,7 +1812,7 @@ ProcessStream processStream = processStreamMap.get(procDep.getProcessId()); PermissionStreamNew permStream = new PermissionStreamNew(); permStream.setBusinessId(processStream.getProcessId()); - permStream.setBusinessType("5"); + permStream.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); permStream.setDepartId(procDep.getDepartId()); newPermissionStreams.add(permStream); } @@ -1752,7 +1885,7 @@ ComponentInfo componentInfo = componentInfoMap.get(compDep.getComponentId()); PermissionStreamNew permStream = new PermissionStreamNew(); permStream.setBusinessId(componentInfo.getComponentId()); - permStream.setBusinessType("2"); + permStream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString()); permStream.setDepartId(compDep.getDepartId()); newPermissionStreams.add(permStream); } @@ -1826,7 +1959,7 @@ childComponent = componentInfoMap.get(compDep.getComponentId()); PermissionStreamNew permStream = new PermissionStreamNew(); permStream.setBusinessId(childComponent.getComponentId()); - permStream.setBusinessType("2"); + permStream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString()); permStream.setDepartId(compDep.getDepartId()); newPermissionStreams.add(permStream); } -- Gitblit v1.9.3