From 23855599412c4d61b38d78f0f3abd3430a48b5b1 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期三, 25 六月 2025 11:51:38 +0800
Subject: [PATCH] Merge branch 'mdc_hyjs_master'

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionServiceImpl.java |  528 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 528 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionServiceImpl.java
new file mode 100644
index 0000000..d0ce204
--- /dev/null
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionServiceImpl.java
@@ -0,0 +1,528 @@
+package org.jeecg.modules.dnc.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+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.entity.*;
+import org.jeecg.modules.dnc.exception.ExceptionCast;
+import org.jeecg.modules.dnc.mapper.ComponentInfoMapper;
+import org.jeecg.modules.dnc.mapper.PartsInfoMapper;
+import org.jeecg.modules.dnc.mapper.ProcessSpecVersionMapper;
+import org.jeecg.modules.dnc.mapper.ProductInfoMapper;
+import org.jeecg.modules.dnc.request.DocInfoQueryRequest;
+import org.jeecg.modules.dnc.request.TreeInfoRequest;
+import org.jeecg.modules.dnc.response.*;
+import org.jeecg.modules.dnc.service.*;
+import org.jeecg.modules.dnc.utils.ValidateUtil;
+import org.jeecg.modules.system.entity.MdcProduction;
+import org.jeecg.modules.system.entity.SysUser;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+public class ProcessSpecVersionServiceImpl extends ServiceImpl<ProcessSpecVersionMapper, ProcessSpecVersion> implements IProcessSpecVersionService{
+    @Autowired
+    private ProductInfoMapper productInfoMapper;
+    @Autowired
+    private ComponentInfoMapper componentInfoMapper;
+    @Autowired
+    private PartsInfoMapper partsInfoMapper;
+    @Autowired
+    private IPermissionStreamNewService permissionStreamNewService;
+    @Autowired
+    @Lazy
+    private IProcessStreamService processStreamService;
+    @Autowired
+    private IProcessSpecVersionPermissionService processSpecVersionPermissionService;
+    @Autowired
+    private IProcessSpecVersionDepartmentService processSpecVersionDepartmentService;
+    @Autowired
+    private IProductMixService productMixService;
+    @Autowired
+    private IWorkStepService workStepService;
+    @Autowired
+    private IProductPermissionService productPermissionService;
+    @Autowired
+    @Lazy
+    private IDocInfoService docInfoService;
+    /**
+     * 鏍规嵁鐢ㄦ埛id鑾峰彇鎺堟潈鐨勫伐鑹鸿绋嬬増鏈〃淇℃伅
+     * @param userId
+     * @return
+     */
+    @Override
+    public List<ProcessSpecVersion> getByUserPerms(String userId){
+        if(!ValidateUtil.validateString(userId))
+            return Collections.emptyList();
+        return super.getBaseMapper().getByUserPerms(userId);
+    }
+
+    /**
+     * 鏍规嵁鐢ㄦ埛id鑾峰彇鎺堟潈鐨勫伐鑹鸿绋嬬増鏈〃淇℃伅
+     * @param userId
+     * @param queryParam 鏌ヨ鏉′欢
+     * @return
+     */
+    @Override
+    public List<ProcessSpecVersion> getByUserPerms(String userId,String queryParam){
+        if(!ValidateUtil.validateString(userId))
+            return Collections.emptyList();
+        if(!ValidateUtil.validateString(queryParam))
+            return Collections.emptyList();
+        LambdaQueryWrapper<ProcessSpecVersion> queryWrapper = Wrappers.lambdaQuery();
+        if(ValidateUtil.validateString(queryParam)) {
+            queryWrapper.and(wrapper->wrapper.like(ProcessSpecVersion::getProcessSpecVersionName, queryParam)
+                    .or()
+                    .like(ProcessSpecVersion::getProcessSpecVersionName, queryParam));
+        }
+        queryWrapper.orderByAsc(ProcessSpecVersion::getCreateTime);
+        return super.list(queryWrapper);
+    }
+
+    /**
+     * 鏂板宸ヨ壓瑙勭▼鐗堟湰琛ㄤ俊鎭�
+     * @param processSpecVersion
+     * @return
+     */
+    @Override
+    public boolean addProcessSpecVersion(ProcessSpecVersion processSpecVersion){
+        if(processSpecVersion == null)
+            ExceptionCast.cast(CommonCode.INVALID_PARAM);
+        if(!ValidateUtil.validateString(processSpecVersion.getProcessSpecVersionName()))
+            ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_NONE);
+        if(!ValidateUtil.validateString(processSpecVersion.getProductId()))
+            ExceptionCast.cast(PartsInfoCode.PARTS_PRODUCT_NONE);
+        if(!ValidateUtil.validateString(processSpecVersion.getComponentId()))
+            ExceptionCast.cast(PartsInfoCode.PARTS_COMPONENT_NONE);
+        if(!ValidateUtil.validateString(processSpecVersion.getPartsId()))
+            ExceptionCast.cast(ProcessInfoCode.PROCESS_PARTS_NONE);
+        if(!ValidateUtil.validateString(processSpecVersion.getProcessSpecVersionCode()))
+            ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_CODE_NONE);
+        ProcessSpecVersion en = getByCode(processSpecVersion.getPartsId(),processSpecVersion.getProcessSpecVersionCode());
+        if(en != null)
+            ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_IS_EXIST);
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = user.getId();
+        if(!ValidateUtil.validateString(userId))
+            ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST);
+        ProductInfo productInfo = productInfoMapper.selectById(processSpecVersion.getProductId());
+        if(productInfo == null)
+            ExceptionCast.cast(PartsInfoCode.PARTS_PRODUCT_NONE);
+        ComponentInfo componentInfo = componentInfoMapper.selectById(processSpecVersion.getComponentId());
+        if(componentInfo == null)
+            ExceptionCast.cast(PartsInfoCode.PARTS_COMPONENT_NONE);
+        PartsInfo partsInfo = partsInfoMapper.selectById(processSpecVersion.getPartsId());
+        if(partsInfo == null)
+            ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST);
+        //鐩稿悓闆朵欢鍙蜂笅闈㈢増鏈彿涓嶈兘閲嶅
+        List<ProcessSpecVersion> list = super.list(new LambdaQueryWrapper<ProcessSpecVersion>().eq(ProcessSpecVersion::getPartsId,partsInfo.getPartsId()));
+        if (list != null && list.size() > 0) {
+            list.forEach(processSpecVersion1 -> {
+                if (processSpecVersion1.getProcessSpecVersionCode().equals(processSpecVersion.getProcessSpecVersionCode())) {
+                    ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_IS_EXIST);
+                }
+            });
+        }
+        boolean b = super.save(processSpecVersion);
+        if(!b)
+            ExceptionCast.cast(CommonCode.FAIL);
+        //娣诲姞閮ㄩ棬鏉冮檺
+        List<PermissionStreamNew> oldDepartPermList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(processSpecVersion.getPartsId(), DocAttributionTypeEnum.PARTS.getCode().toString(),"1");
+        if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) {
+            List<ProcessSpecVersionDepartment> processSpecVersionDepartmentList = new ArrayList<>();
+            List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
+            oldDepartPermList.forEach(item -> {
+                ProcessSpecVersionDepartment pd = new ProcessSpecVersionDepartment();
+                pd.setDepartId(item.getDepartId());
+                pd.setPsvId(processSpecVersion.getId());
+                processSpecVersionDepartmentList.add(pd);
+                PermissionStreamNew perm = new PermissionStreamNew();
+                perm.setDepartId(item.getDepartId());
+                perm.setBusinessId(processSpecVersion.getId());
+                perm.setBusinessType(DocAttributionTypeEnum.OPERATION.getCode().toString());
+                permissionStreamList.add(perm);
+            });
+            if(!processSpecVersionDepartmentList.isEmpty()) {
+                b = processSpecVersionDepartmentService.saveBatch(processSpecVersionDepartmentList);
+                if(!b)
+                    ExceptionCast.cast(CommonCode.FAIL);
+            }
+            if(!permissionStreamList.isEmpty()) {
+                b = permissionStreamNewService.saveBatch(permissionStreamList);
+                if(!b)
+                    ExceptionCast.cast(CommonCode.FAIL);
+            }
+        }
+        //娣诲姞鐢ㄦ埛鏉冮檺
+        b = productPermissionService.add(processSpecVersion.getId(), userId,DocAttributionTypeEnum.OPERATION.getCode().toString());
+        if (!b) {
+            ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR);
+        }
+        //娣诲姞缁撴瀯鏍�
+        ProductMix productMix = new ProductMix(Long.parseLong(processSpecVersion.getId()),Long.parseLong(processSpecVersion.getPartsId())
+                ,processSpecVersion.getProcessSpecVersionName(),
+                processSpecVersion.getProcessSpecVersionCode(),DocAttributionTypeEnum.OPERATION.getCode(),new Date());
+        productMixService.save(productMix);
+        //娣诲姞鐢ㄦ埛鏉冮檺
+        PermissionStreamNew stream = new PermissionStreamNew();
+        stream.setBusinessId(processSpecVersion.getId());
+        stream.setBusinessType(DocAttributionTypeEnum.OPERATION.getCode().toString());
+        stream.setUserId(userId);
+        return permissionStreamNewService.addPermissionStreamNew(stream);
+    }
+
+    /**
+     * 缂栬緫宸ヨ壓瑙勭▼鐗堟湰琛ㄤ俊鎭�
+     * @param id
+     * @param processSpecVersion
+     * @return
+     */
+    @Override
+    public boolean editProcessSpecVersion(String id ,ProcessSpecVersion processSpecVersion){
+        if(!ValidateUtil.validateString(id) || processSpecVersion == null)
+            ExceptionCast.cast(CommonCode.SUCCESS);
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = user.getId();
+        if(!ValidateUtil.validateString(userId))
+            ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST);
+        ProcessSpecVersion en = super.getById(id);
+        if(en == null)
+            ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST);
+        processSpecVersion.setId(id);
+        processSpecVersion.setProductId(null);
+        processSpecVersion.setComponentId(null);
+        processSpecVersion.setPartsId(null);
+        boolean b = super.updateById(processSpecVersion);
+        //鍚屾淇敼缁撴瀯鏍�
+        ProductMix productMix = productMixService.getById(Long.parseLong(id));
+        productMix.setTreeName(processSpecVersion.getProcessSpecVersionName());
+        productMix.setTreeCode(processSpecVersion.getProcessSpecVersionCode());
+        productMixService.updateById(productMix);
+        if(!b)
+            return false;
+        ProcessSpecVersionPermission permission = processSpecVersionPermissionService.getByPsvIdAndUserId(id, userId);
+        if(permission == null) {
+            permission = new ProcessSpecVersionPermission(id,userId);
+            b = processSpecVersionPermissionService.save(permission);
+            if(!b)
+                return false;
+        }
+        PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId,DocAttributionTypeEnum.OPERATION.getCode().toString());
+        if(stream == null) {
+            stream = new PermissionStreamNew();
+            stream.setBusinessId(id);
+            stream.setUserId(userId);
+            return permissionStreamNewService.save(stream);
+        }
+        return b;
+    }
+
+    /**
+     * 鍒犻櫎宸ヨ壓瑙勭▼鐗堟湰琛ㄤ俊鎭�
+     * @param id
+     * @return
+     */
+    @Override
+    public boolean deleteProcessSpecVersion(String id){
+        if(!ValidateUtil.validateString(id))
+            ExceptionCast.cast(CommonCode.INVALID_PARAM);
+        ProcessSpecVersion processSpecVersion = super.getById(id);
+        if(processSpecVersion == null)
+            ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST);
+        List<ProcessStream> processStreams = processStreamService.findBypsvId(id);
+        if(processStreams!= null &&!processStreams.isEmpty())
+            ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_PROCESS_EXIST);
+        boolean b = processSpecVersionPermissionService.deleteByPsvId(processSpecVersion.getId());
+        if(!b)
+            ExceptionCast.cast(CommonCode.FAIL);
+        b = processSpecVersionDepartmentService.deleteByPsvId(processSpecVersion.getId());
+        if(!b)
+            ExceptionCast.cast(CommonCode.FAIL);
+        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(processSpecVersion.getId(),DocAttributionTypeEnum.OPERATION.getCode().toString(),"0");
+        if(!b)
+            ExceptionCast.cast(CommonCode.FAIL);
+        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(processSpecVersion.getId(),DocAttributionTypeEnum.OPERATION.getCode().toString(),"1");
+        if(!b)
+            ExceptionCast.cast(CommonCode.FAIL);
+        b = productMixService.removeById(processSpecVersion.getId());
+        if (!b)
+            ExceptionCast.cast(CommonCode.FAIL);
+        return super.removeById(processSpecVersion.getId());
+    }
+
+    @Override
+    public ProcessSpecVersion getByCode(String partId,String processSpecVersionCode) {
+        if(ValidateUtil.validateString(processSpecVersionCode)) {
+            List<ProcessSpecVersion> list = super.lambdaQuery()
+                    .eq(ProcessSpecVersion::getPartsId, partId)
+                    .eq(ProcessSpecVersion::getProcessSpecVersionCode, processSpecVersionCode).list();
+            if(list == null || list.isEmpty())
+                return null;
+            return list.get(0);
+        }
+        return null;
+    }
+
+    @Override
+    public List<ProcessSpecVersion> getByPartsId(String partsId) {
+        if(ValidateUtil.validateString(partsId)) {
+            List<ProcessSpecVersion> list = super.lambdaQuery().eq(ProcessSpecVersion::getPartsId, partsId).list();
+            if(list == null || list.isEmpty())
+                return null;
+            return list;
+        }
+        return null;
+    }
+
+    /**
+     * 鏍规嵁涓�缁勯浂浠秈d鑾峰彇
+     * @param partsIds
+     * @return
+     */
+    @Override
+    public List<ProcessSpecVersion> getByPartsIds(List<String> partsIds){
+        if(partsIds == null || partsIds.isEmpty())
+            return Collections.emptyList();
+        List<ProcessSpecVersion> list = super.lambdaQuery().in(ProcessSpecVersion::getPartsId, partsIds).list();
+        if(list == null || list.isEmpty())
+            return null;
+        else
+            return list;
+    }
+
+
+    /**
+     * 鍒嗛厤鐢ㄦ埛鏉冮檺
+     * @param processSpecVersion
+     * @param userList
+     * @return
+     */
+    @Override
+    public boolean assignAddUser(ProcessSpecVersion processSpecVersion, Collection<SysUser> userList){
+        if(processSpecVersion == null || userList == null || userList.isEmpty())
+            ExceptionCast.cast(CommonCode.INVALID_PARAM);
+        List<ProcessSpecVersionPermission> permissionList = new ArrayList<>();
+        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
+        userList.forEach(item -> {
+            ProcessSpecVersionPermission en = processSpecVersionPermissionService.getByPsvIdAndUserId(processSpecVersion.getId(), item.getId());
+            if(en == null) {
+                en = new ProcessSpecVersionPermission();
+                en.setUserId(item.getId());
+                en.setPsvId(processSpecVersion.getId());
+                permissionList.add(en);
+            }
+            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processSpecVersion.getId(), item.getId(),DocAttributionTypeEnum.OPERATION.getCode().toString());
+            if(stream == null) {
+                stream = new PermissionStreamNew();
+                stream.setUserId(item.getId());
+                stream.setBusinessId(processSpecVersion.getId());
+                stream.setBusinessType(DocAttributionTypeEnum.OPERATION.getCode().toString());
+                permissionStreamList.add(stream);
+            }
+        });
+        if(!permissionList.isEmpty()) {
+            boolean b = processSpecVersionPermissionService.saveBatch(permissionList);
+            if(!b) {
+                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
+            }
+        }
+        if(!permissionStreamList.isEmpty()) {
+            boolean b = permissionStreamNewService.saveBatch(permissionStreamList);
+            if(!b) {
+                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
+            }
+        }
+        return true;
+    }
+
+
+    /**
+     * 绉婚櫎鐢ㄦ埛鏉冮檺
+     * @param processSpecVersion
+     * @param userList
+     * @return
+     */
+    @Override
+    public boolean assignRemoveUser(ProcessSpecVersion processSpecVersion, Collection<SysUser> userList){
+        if(processSpecVersion == null || userList == null || userList.isEmpty())
+            ExceptionCast.cast(CommonCode.INVALID_PARAM);
+        List<ProcessSpecVersionPermission> permissionList = new ArrayList<>();
+        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
+        userList.forEach(item -> {
+            ProcessSpecVersionPermission en = processSpecVersionPermissionService.getByPsvIdAndUserId(processSpecVersion.getId(), item.getId());
+            if(en != null) {
+                permissionList.add(en);
+            }
+            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processSpecVersion.getId(), item.getId(),DocAttributionTypeEnum.OPERATION.getCode().toString());
+            if(stream != null) {
+                permissionStreamList.add(stream);
+            }
+        });
+        //娓呯┖鐢ㄦ埛鏉冮檺鏍¢獙
+        if(!permissionList.isEmpty()) {
+            boolean b = processSpecVersionPermissionService.removeByCollection(permissionList);
+            if(!b) {
+                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
+            }
+        }
+        if(!permissionStreamList.isEmpty()) {
+            boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList);
+            if(!b) {
+                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
+            }
+        }
+        return true;
+    }
+    /**
+     * 鍒嗛厤閮ㄩ棬鏉冮檺
+     * @param processSpecVersion
+     * @param departmentList
+     * @return
+     */
+    @Override
+    public boolean assignAddDepart(ProcessSpecVersion processSpecVersion, Collection<MdcProduction> departmentList){
+        if(processSpecVersion == null || departmentList == null || departmentList.isEmpty())
+            ExceptionCast.cast(CommonCode.INVALID_PARAM);
+        List<ProcessSpecVersionDepartment> partsDepartments = new ArrayList<>();
+        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
+        departmentList.forEach(item -> {
+            ProcessSpecVersionDepartment en = processSpecVersionDepartmentService.getByProcessSpecVersionIdAndDepartId(processSpecVersion.getId(), item.getId());
+            if(en == null) {
+                en = new ProcessSpecVersionDepartment();
+                en.setDepartId(item.getId());
+                en.setPsvId(processSpecVersion.getId());
+                partsDepartments.add(en);
+            }
+            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processSpecVersion.getId(), item.getId(),DocAttributionTypeEnum.OPERATION.getCode().toString());
+            if(stream == null) {
+                stream = new PermissionStreamNew();
+                stream.setDepartId(item.getId());
+                stream.setBusinessId(processSpecVersion.getId());
+                stream.setBusinessType(DocAttributionTypeEnum.OPERATION.getCode().toString());
+                permissionStreamList.add(stream);
+            }
+        });
+        if(!partsDepartments.isEmpty()) {
+            boolean b = processSpecVersionDepartmentService.saveBatch(partsDepartments);
+            if(!b) {
+                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
+            }
+        }
+        if(!permissionStreamList.isEmpty()) {
+            boolean b = permissionStreamNewService.saveBatch(permissionStreamList);
+            if(!b) {
+                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
+            }
+        }
+        return true;
+    }
+
+    /**
+     * 鍒嗛厤閮ㄩ棬鏉冮檺
+     * @param processSpecVersion
+     * @param departmentList
+     * @return
+     */
+    @Override
+    public boolean assignRemoveDepart(ProcessSpecVersion processSpecVersion, Collection<MdcProduction> departmentList){
+        if(processSpecVersion == null || departmentList == null || departmentList.isEmpty())
+            ExceptionCast.cast(CommonCode.INVALID_PARAM);
+        List<ProcessSpecVersionDepartment> partsDepartments = new ArrayList<>();
+        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
+        departmentList.forEach(item -> {
+            ProcessSpecVersionDepartment en = processSpecVersionDepartmentService.getByProcessSpecVersionIdAndDepartId(processSpecVersion.getId(), item.getId());
+            if(en != null) {
+                partsDepartments.add(en);
+            }
+            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processSpecVersion.getId(), item.getId(),"3");
+            if(stream != null) {
+                permissionStreamList.add(stream);
+            }
+        });
+        if(!partsDepartments.isEmpty()) {
+            boolean b = processSpecVersionDepartmentService.removeByCollection(partsDepartments);
+            if(!b) {
+                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
+            }
+        }
+        if(!permissionStreamList.isEmpty()) {
+            boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList);
+            if(!b) {
+                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
+            }
+        }
+        return true;
+    }
+
+    /**
+     * 鏍规嵁宸ヨ壓瑙勭▼id鏌ヨ,涓嬬骇宸ュ簭宸ユ鏁伴噺
+     * @param processSpecId
+     * @return
+     */
+    @Override
+    public Result<?> getProcessSpecVersionCount(String processSpecId){
+        List<ProcessStream> list = processStreamService.findBypsvId(processSpecId);
+        List<WorkStep> workStepList=workStepService.list(new LambdaQueryWrapper<WorkStep>().eq(WorkStep::getPsvId,processSpecId));
+        return null;
+    }
+
+    /**
+     * 閫氳繃闆朵欢鍙枫�佹潗璐ㄧ瓑鏌ヨ瀵瑰簲鐢靛瓙鏍锋澘
+     * @param treeInfoRequest
+     * @return
+     */
+    @Override
+    public List<DocInfo> getByProcessSpecVersion(TreeInfoRequest treeInfoRequest){
+        LambdaQueryWrapper<ProcessSpecVersion> queryWrapper = new LambdaQueryWrapper<>();
+        if (treeInfoRequest.getProductIds() != null && !treeInfoRequest.getProductIds().isEmpty()) {
+            queryWrapper.in(ProcessSpecVersion::getProductId, treeInfoRequest.getProductIds());
+        }
+        if (treeInfoRequest.getComponentIds() != null && !treeInfoRequest.getComponentIds().isEmpty()) {
+            queryWrapper.in(ProcessSpecVersion::getComponentId, treeInfoRequest.getComponentIds());
+        }
+        if (treeInfoRequest.getPartsIds() != null && !treeInfoRequest.getPartsIds().isEmpty()) {
+            queryWrapper.in(ProcessSpecVersion::getPartsId, treeInfoRequest.getPartsIds());
+        }
+        if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.OPERATION.getCode())){
+            queryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),ProcessSpecVersion::getId,treeInfoRequest.getAttributionId());
+        }
+        queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),ProcessSpecVersion::getProcessSpecVersionName, treeInfoRequest.getTreeName());
+        queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),ProcessSpecVersion::getProcessSpecVersionCode, treeInfoRequest.getTreeName());
+        queryWrapper.orderByDesc(ProcessSpecVersion::getCreateTime);
+        List<ProcessSpecVersion> list = super.list(queryWrapper);
+        List<DocInfo> docInfos;
+        if (list == null || list.isEmpty() || StrUtil.isNotBlank(treeInfoRequest.getStructureType())){
+            return new ArrayList<>();
+        }else {
+            String ids=list.stream().map(ProcessSpecVersion::getId).collect(Collectors.joining(","));
+            DocInfoQueryRequest docQuery = new DocInfoQueryRequest();
+            BeanUtil.copyProperties(treeInfoRequest,docQuery);
+            docQuery.setAttributionIds(ids);
+            docQuery.setDocClassCode("OTHER");
+            docQuery.setAttributionType(DocAttributionTypeEnum.OPERATION.getCode());
+            docInfos=docInfoService.findListByDocQuery(docQuery);
+            if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.OPERATION.getCode())){
+                List<String> id =new ArrayList<>();
+                id.add(treeInfoRequest.getAttributionId());
+                treeInfoRequest.setPsvIds(id);
+                //宸ュ簭
+                List<DocInfo> processStreams = processStreamService.getByProcessStreamOtherFile(treeInfoRequest);
+                docInfos.addAll(processStreams);
+                //宸ユ
+                List<DocInfo> workSteps = workStepService.getByWorkStepOtherFile(treeInfoRequest);
+                docInfos.addAll(workSteps);
+            }
+        }
+        return docInfos;
+    }
+}

--
Gitblit v1.9.3