lyh
2025-06-12 77eff86ec113e5dc86c9e1433e52bd8a67865340
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java
@@ -422,6 +422,7 @@
     * @param paramId      产品树节点id
     * @param relativeFlag 1 是 2 否
     * @param userIds      添加用户ids
     * todo优化结构,采用mix表进行父子递归查询,分类进行权限分配(单表查询)
     * @return
     */
    @Override
@@ -457,6 +458,7 @@
     * @param paramId       产品树节点id
     * @param relativeFlag  1 是 2 否
     * @param departmentIds 添加部门ids
     * todo优化结构,采用mix表进行父子递归查询,分类进行权限分配(单表查询)
     * @return
     */
    @Override
@@ -492,6 +494,7 @@
     * @param paramId      产品树节点id
     * @param relativeFlag 1 是 2 否
     * @param userIds      移除用户ids
     * todo优化结构,采用mix表进行父子递归查询,分类进行权限分配(单表查询)
     * @return
     */
    @Override
@@ -526,6 +529,7 @@
     * @param paramId       产品树节点id
     * @param relativeFlag  1 是 2 否
     * @param departmentIds 移除部门ids
     * todo优化结构,采用mix表进行父子递归查询,分类进行权限分配(单表查询)
     * @return
     */
    @Override
@@ -1041,7 +1045,6 @@
                if (treeInfoRequest.getAttributionType() == 1 && 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);
@@ -1050,15 +1053,12 @@
                    productInfoList=new ArrayList<>();
                }
                if (CollectionUtil.isNotEmpty(productInfoList)) {
                    // 使用ID列表而非拼接字符串
                    List<String> productIds = productInfoList.stream()
                            .map(ProductInfo::getProductId)
                            .collect(Collectors.toList());
                    String ids=productInfoList.stream().map(ProductInfo::getProductId).collect(Collectors.joining(","));
                    DocInfoQueryRequest docQuery = new DocInfoQueryRequest();
                    BeanUtil.copyProperties(treeInfoRequest, docQuery);
                    docQuery.setAttributionIds(productIds.toString()); // 假设setAttributionIds接受List<String>
                    docQuery.setAttributionIds(ids);
                    docQuery.setDocClassCode("OTHER");
                    docQuery.setAttributionType(1);
                    docQuery.setAttributionType(DocAttributionTypeEnum.PRODUCT.getCode());
                    docInfos = docInfoService.findListByDocQuery(docQuery);
                }
                // 创建新请求对象避免污染原参数
@@ -1069,6 +1069,8 @@
                docInfos.addAll(componentInfoService.getByComponentInfo(componentRequest));
                docInfos.addAll(partsInfoService.getByPartsInfo(componentRequest));
                docInfos.addAll(processSpecVersionService.getByProcessSpecVersion(componentRequest));
                docInfos.addAll(processStreamService.getByProcessStreamOtherFile(componentRequest));
                docInfos.addAll(workStepService.getByWorkStepOtherFile(componentRequest));
                return getByTreeOtherFileInfo(docInfos);
            case 2:
                return getByTreeOtherFileInfo(componentInfoService.getByComponentInfo(treeInfoRequest));
@@ -1181,31 +1183,37 @@
                        ProductInfo productInfo=this.getById(docInfo.getAttributionId());
                        docInfo.setNodeName(productInfo.getProductName());
                        docInfo.setNodeCode(productInfo.getProductNo());
                        docInfo.setNodeId(productInfo.getProductId());
                        break;
                    case 2:
                        ComponentInfo componentInfo=componentInfoService.getById(docInfo.getAttributionId());
                        docInfo.setNodeName(componentInfo.getComponentName());
                        docInfo.setNodeCode(componentInfo.getComponentCode());
                        docInfo.setNodeId(componentInfo.getComponentId());
                        break;
                    case 3:
                        PartsInfo partsInfo=partsInfoService.getById(docInfo.getAttributionId());
                        docInfo.setNodeCode(partsInfo.getPartsCode());
                        docInfo.setNodeName(partsInfo.getPartsName());
                        docInfo.setNodeId(partsInfo.getPartsId());
                        break;
                    case 4:
                        ProcessSpecVersion processSpecVersion=processSpecVersionService.getById(docInfo.getAttributionId());
                        docInfo.setNodeName(processSpecVersion.getProcessSpecVersionName());
                        docInfo.setNodeCode(processSpecVersion.getProcessSpecVersionCode());
                        docInfo.setNodeId(processSpecVersion.getId());
                        break;
                    case 5:
                        ProcessStream processStream=processStreamService.getById(docInfo.getAttributionId());
                        docInfo.setNodeName(processStream.getProcessName());
                        docInfo.setNodeCode(processStream.getProcessCode());
                        docInfo.setNodeId(processStream.getProcessId());
                        break;
                    case 6:
                        WorkStep workStep=workStepService.getById(docInfo.getAttributionId());
                        docInfo.setNodeName(workStep.getStepName());
                        docInfo.setNodeCode(workStep.getStepName());
                        docInfo.setNodeId(workStep.getId());
                        break;
                }
            });
@@ -1227,11 +1235,13 @@
                    ProcessStream processStream=processStreamService.getById(deviceType.getAttributionId());
                    docInfo.setNodeName(processStream.getProcessName());
                    docInfo.setNodeCode(processStream.getProcessCode());
                    docInfo.setNodeId(processStream.getProcessId());
                }else {
                    //工步下的设备类
                    WorkStep workStep=workStepService.getById(deviceType.getAttributionId());
                    docInfo.setNodeName(workStep.getStepName());
                    docInfo.setNodeCode(workStep.getStepName());
                    docInfo.setNodeId(workStep.getId());
                }
            });
        }