From cc0e9036de6e922e8fe254fef01d8de9996024b7 Mon Sep 17 00:00:00 2001
From: hyingbo <1363390067@qq.com>
Date: 星期四, 17 七月 2025 18:16:03 +0800
Subject: [PATCH] 获取报警描述修改

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java |  268 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 241 insertions(+), 27 deletions(-)

diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java
index 4dffb5e..364bac6 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java
@@ -1,16 +1,24 @@
 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.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 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.dto.ComponentExt;
 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.ProductInfoMapper;
+import org.jeecg.modules.dnc.request.DocInfoQueryRequest;
+import org.jeecg.modules.dnc.request.TreeInfoRequest;
 import org.jeecg.modules.dnc.response.CommonCode;
 import org.jeecg.modules.dnc.response.ComponentInfoCode;
 import org.jeecg.modules.dnc.response.ProductInfoCode;
@@ -24,10 +32,8 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class ComponentInfoSeServiceImpl extends ServiceImpl<ComponentInfoMapper, ComponentInfo> implements IComponentInfoService {
@@ -43,14 +49,22 @@
     @Lazy
     private IPartsInfoService partsInfoService;
     @Autowired
+    private IProcessSpecVersionService processSpecVersionService;
+    @Autowired
     private IProcessStreamService processStreamService;
+    @Autowired
+    private IWorkStepService workStepService;
     @Autowired
     private IProductMixService productMixService;
     @Autowired
     private IDocRelativeService iDocRelativeService;
     @Autowired
     private IProductPermissionService productPermissionService;
-
+    @Autowired
+    @Lazy
+    private IDocInfoService docInfoService;
+    @Autowired
+    private IDocRelativeService docRelativeService;
     @Override
     @Transactional(rollbackFor = {Exception.class})
     public boolean addComponentInfo(ComponentInfo componentInfo) {
@@ -63,7 +77,7 @@
         if(!ValidateUtil.validateString(componentInfo.getComponentCode()))
             ExceptionCast.cast(ComponentInfoCode.COMPONENT_CODE_NONE);
         ComponentInfo en = getByCode(componentInfo.getComponentCode());
-        if(en != null)
+        if(en != null&&componentInfo.getBorrowId()==null)
             ExceptionCast.cast(ComponentInfoCode.COMPONENT_IS_EXIST);
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = user.getId();
@@ -78,10 +92,10 @@
             if(en == null) {
                 ExceptionCast.cast(ComponentInfoCode.COMPONENT_PARENT_NOT_EXIST);
             }
-            oldPermissionList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(en.getComponentId(),"2","1");
+            oldPermissionList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(en.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"1");
             componentInfo.setRankLevel(en.getRankLevel() + 1);
         } else {
-            oldPermissionList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(productInfo.getProductId(),"1","1");
+            oldPermissionList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(productInfo.getProductId(),DocAttributionTypeEnum.PRODUCT.getCode().toString(),"1");
             componentInfo.setParentId(null);
             componentInfo.setRankLevel(1);
         }
@@ -102,7 +116,7 @@
                 PermissionStreamNew permissionStream = new PermissionStreamNew();
                 permissionStream.setBusinessId(componentInfo.getComponentId());
                 permissionStream.setDepartId(item.getDepartId());
-                permissionStream.setBusinessType("2");
+                permissionStream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString());
                 componentDepartPermList.add(permissionStream);
             });
         }
@@ -116,20 +130,41 @@
             if(!b)
                 ExceptionCast.cast(CommonCode.FAIL);
         }
-        b = productPermissionService.add(componentInfo.getComponentId(), userId,"2");
+        b = productPermissionService.add(componentInfo.getComponentId(), userId,DocAttributionTypeEnum.COMPONENT.getCode().toString());
         if (!b) {
             ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR);
         }
         //娣诲姞缁撴瀯鏍�
-        ProductMix productMix = new ProductMix(Long.parseLong(componentInfo.getComponentId()),Long.parseLong(productInfo.getProductId())
-                ,componentInfo.getComponentName(),componentInfo.getComponentCode(),"2");
+        ProductMix productMix=null;
+        if (componentInfo.getParentId() != null) {
+            //瀛愰儴浠�
+            productMix = new ProductMix(Long.parseLong(componentInfo.getComponentId()),Long.parseLong(componentInfo.getParentId())
+                    ,componentInfo.getComponentName(),componentInfo.getComponentCode(),2,new Date());
+        }else {
+            productMix = new ProductMix(Long.parseLong(componentInfo.getComponentId()),Long.parseLong(productInfo.getProductId())
+                    ,componentInfo.getComponentName(),componentInfo.getComponentCode(),2,new Date());
+        }
         productMixService.save(productMix);
+        if (StrUtil.isNotEmpty(componentInfo.getBorrowId())){
+            //鍊熺敤閮ㄤ欢,鍚屾娣诲姞鏂囦欢
+            List<DocRelative> docRelativeList=docRelativeService.
+                    list(new QueryWrapper<DocRelative>().eq("attribution_type",DocAttributionTypeEnum.COMPONENT.getCode().toString()).eq("attribution_id",componentInfo.getBorrowId()));
+            if (!docRelativeList.isEmpty()){
+                docRelativeList.forEach(item -> {
+                    DocRelative docRelative = new DocRelative();
+                    BeanUtil.copyProperties(item,docRelative);
+                    docRelative.setId(null);
+                    docRelative.setAttributionId(componentInfo.getComponentId());
+                    docRelativeService.save(docRelative);
+                });
+            }
+        }
         //娣诲姞鏉冮檺
         PermissionStreamNew stream = new PermissionStreamNew();
         stream.setUserId(userId);
         stream.setBusinessId(componentInfo.getComponentId());
-        stream.setBusinessType("2");
-        return permissionStreamNewService.save(stream);
+        stream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString());
+        return permissionStreamNewService.addPermissionStreamNew(stream);
     }
 
     @Override
@@ -152,6 +187,11 @@
         componentInfo.setRankLevel(null);
         componentInfo.setProductId(null);
         boolean b = super.updateById(componentInfo);
+        //鍚屾淇敼缁撴瀯鏍�
+        ProductMix productMix = productMixService.getById(Long.parseLong(id));
+        productMix.setTreeName(componentInfo.getComponentName());
+        productMix.setTreeCode(componentInfo.getComponentCode());
+        productMixService.updateById(productMix);
         if(!b)
             return false;
         ComponentPermission permission = componentPermissionService.getByComponentIdAndUserId(id, userId);
@@ -163,15 +203,19 @@
             if(!b)
                 return false;
         }
-        PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId,"2");
+        PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId,DocAttributionTypeEnum.COMPONENT.getCode().toString());
         if(stream == null) {
             stream = new PermissionStreamNew();
             stream.setUserId(userId);
             stream.setBusinessId(id);
-            stream.setBusinessType("2");
+            stream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString());
             return permissionStreamNewService.save(stream);
         }
-        return b;
+        List<ComponentInfo> list = super.lambdaQuery().eq(ComponentInfo::getBorrowId,id).list();
+        if (list != null && !list.isEmpty()) {
+            list.forEach(item -> editComponentInfo(item.getComponentId(),componentInfo));
+        }
+        return true;
     }
 
     @Override
@@ -224,10 +268,10 @@
             b = componentDepartmentService.deleteByComponentId(item.getComponentId());
             if(!b)
                 ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE);
-            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getComponentId(),"2","0");
+            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"0");
             if(!b)
                 ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE);
-            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getComponentId(),"2","1");
+            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"1");
             if(!b)
                 ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE);
             b = super.removeById(item.getComponentId());
@@ -249,18 +293,24 @@
         if(childrenList != null && !childrenList.isEmpty()) {
             ExceptionCast.cast(ComponentInfoCode.COMPONENT_CHILD_EXIST);
         }
-        //楠岃瘉浜у搧涓嬫槸鍚︽湁闆朵欢
+        //楠岃瘉閮ㄤ欢涓嬫槸鍚︽湁闆朵欢
         List<PartsInfo> partsInfoList = partsInfoService.getByComponentId(componentInfo.getProductId(), componentInfo.getComponentId());
         if(partsInfoList != null && !partsInfoList.isEmpty()) {
             ExceptionCast.cast(ComponentInfoCode.COMPONENT_PARTS_EXIST);
         }
+        //楠岃瘉閮ㄤ欢涓嬫槸鍚︽湁宸ュ簭淇℃伅
         List<ProcessStream> processStreamList = processStreamService.findByComponentId(id);
         if(processStreamList != null && !processStreamList.isEmpty()) {
             ExceptionCast.cast(ComponentInfoCode.COMPONENT_PROCESS_EXIST);
         }
+        //楠岃瘉閮ㄤ欢鏄惁琚�熺敤
+        List<ComponentInfo> list = super.lambdaQuery().eq(ComponentInfo::getBorrowId,id).list();
+        if (list != null && !list.isEmpty()) {
+            ExceptionCast.cast(ComponentInfoCode.COMPONENT_BORROW_EXIST);
+        }
         boolean b;
         //楠岃瘉鏄惁瀛樺湪鏂囨。
-        List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type","2").eq("attribution_id",id));
+        List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type",DocAttributionTypeEnum.COMPONENT.getCode().toString()).eq("attribution_id",id));
         if (!docRelativeList.isEmpty()){
             ExceptionCast.cast(ComponentInfoCode.COMPONENT_DOC_EXIST);
         }
@@ -270,10 +320,10 @@
         b = componentDepartmentService.deleteByComponentId(id);
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
-        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","0");
+        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"0");
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
-        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","1");
+        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"1");
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
         b = productMixService.removeById(id);
@@ -314,7 +364,7 @@
                 stream = new PermissionStreamNew();
                 stream.setUserId(item.getId());
                 stream.setBusinessId(componentInfo.getComponentId());
-                stream.setBusinessType("2");
+                stream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString());
                 permissionStreamList.add(stream);
             }
         });
@@ -384,12 +434,12 @@
                 en.setComponentId(componentInfo.getComponentId());
                 componentDepartments.add(en);
             }
-            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(),"2");
+            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(),DocAttributionTypeEnum.COMPONENT.getCode().toString());
             if(stream == null) {
                 stream = new PermissionStreamNew();
                 stream.setDepartId(item.getId());
                 stream.setBusinessId(componentInfo.getComponentId());
-                stream.setBusinessType("2");
+                stream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString());
                 permissionStreamList.add(stream);
             }
         });
@@ -420,7 +470,7 @@
             if(en != null) {
                 componentDepartments.add(en);
             }
-            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(),"2");
+            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(),DocAttributionTypeEnum.COMPONENT.getCode().toString());
             if(stream != null) {
                 permissionStreamList.add(stream);
             }
@@ -506,4 +556,168 @@
         queryWrapper.orderByAsc(ComponentInfo::getCreateTime);
         return super.list(queryWrapper);
     }
+
+    /**
+     * 閫氳繃闆朵欢鍙枫�佹潗璐ㄧ瓑鏌ヨ瀵瑰簲鐢靛瓙鏍锋澘
+     * @param treeInfoRequest
+     * @return
+     */
+    @Override
+    public List<DocInfo> getByComponentInfo(TreeInfoRequest treeInfoRequest){
+        LambdaQueryWrapper<ComponentInfo> queryWrapper = new LambdaQueryWrapper<>();
+        if (treeInfoRequest.getProductIds() != null && !treeInfoRequest.getProductIds().isEmpty()) {
+            queryWrapper.in(ComponentInfo::getProductId, treeInfoRequest.getProductIds());
+        }
+        if (treeInfoRequest.getAttributionType()==2){
+            queryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),ComponentInfo::getComponentId,treeInfoRequest.getAttributionId());
+        }
+
+        queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),ComponentInfo::getComponentCode, treeInfoRequest.getTreeCode());
+        queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),ComponentInfo::getComponentName, treeInfoRequest.getTreeName());
+        queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getStructureType()),ComponentInfo::getStructureType, treeInfoRequest.getStructureType());
+        queryWrapper.orderByDesc(ComponentInfo::getCreateTime);
+        List<ComponentInfo> list = super.list(queryWrapper);
+        List<DocInfo> docInfos = new ArrayList<>();
+        if (list != null && !list.isEmpty()) {
+            String ids=list.stream().map(ComponentInfo::getComponentId).collect(Collectors.joining(","));
+            DocInfoQueryRequest docQuery = new DocInfoQueryRequest();
+            BeanUtil.copyProperties(treeInfoRequest,docQuery);
+            docQuery.setAttributionIds(ids);
+            docQuery.setDocClassCode("OTHER");
+            docQuery.setAttributionType(2);
+            docInfos=docInfoService.findListByDocQuery(docQuery);
+        }
+        if (treeInfoRequest.getAttributionType()==2){
+            List<String> id =new ArrayList<>();
+            id.add(treeInfoRequest.getAttributionId());
+            treeInfoRequest.setComponentIds(id);
+            //闆朵欢
+            List<DocInfo> partsInfos = partsInfoService.getByPartsInfo(treeInfoRequest);
+            docInfos.addAll(partsInfos);
+            //宸ヨ壓瑙勭▼鐗堟湰
+            List<DocInfo> processSpecVersions = processSpecVersionService.getByProcessSpecVersion(treeInfoRequest);
+            docInfos.addAll(processSpecVersions);
+            //宸ュ簭
+            List<DocInfo> processStreams = processStreamService.getByProcessStreamOtherFile(treeInfoRequest);
+            docInfos.addAll(processStreams);
+            //宸ユ
+            List<DocInfo> workSteps = workStepService.getByWorkStepOtherFile(treeInfoRequest);
+            docInfos.addAll(workSteps);
+        }
+        return docInfos;
+    }
+
+    /**
+     * 鏌ヨ鍙互琚紩鐢ㄧ殑閮ㄤ欢
+     * @param componentInfo
+     * @param pageNo
+     * @param pageSize
+     * @return
+     */
+    @Override
+    public IPage<ComponentInfo> getByComponentId(ComponentInfo componentInfo, Integer pageNo, Integer pageSize){
+        //鏉冮檺鎺掗櫎,涓嶈兘寮曠敤鑷繁涓婁笅绾ч儴浠�
+        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String productIds = loginUser.getProductionIds();
+        ComponentInfo oldComponentInfo = super.getById(componentInfo.getComponentId());
+        IPage<ComponentInfo> page = new Page<>(pageNo, pageSize);
+        if (productIds != null && !productIds.isEmpty()) {
+            List<String> productIdList = Arrays.asList(productIds.split(","));
+            List<ProductMix> productMixList = permissionStreamNewService.
+                    loadProductMixByBusinessIdAndBusinessType(loginUser.getId(),productIdList,componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString());
+            List<Long> ids = productMixList.stream().map(ProductMix::getId).collect(Collectors.toList());
+            //鑾峰彇宸茬粡鑷韩琚�熺敤鐨勯儴浠�
+            LambdaQueryWrapper<ComponentInfo> borrowQueryWrapper = new LambdaQueryWrapper<>();
+            if (!ids.isEmpty()){
+                borrowQueryWrapper.in(ComponentInfo::getBorrowId,ids);
+            }
+            borrowQueryWrapper.eq(ComponentInfo::getParentId,componentInfo.getComponentId());
+            List<String> borrowIds= super.list(borrowQueryWrapper).stream().map(ComponentInfo::getBorrowId).collect(Collectors.toList());
+            LambdaQueryWrapper<ComponentInfo> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.like(StrUtil.isNotEmpty(componentInfo.getComponentName()),ComponentInfo::getComponentName, componentInfo.getComponentName());
+            queryWrapper.like(StrUtil.isNotEmpty(componentInfo.getComponentCode()),ComponentInfo::getComponentCode, componentInfo.getComponentCode());
+            queryWrapper.isNull(ComponentInfo::getBorrowId);
+            if (!ids.isEmpty()){
+                queryWrapper.in(ComponentInfo::getComponentId,ids);
+            }
+            queryWrapper.ne(StrUtil.isNotEmpty(oldComponentInfo.getBorrowId()),ComponentInfo::getComponentId,oldComponentInfo.getBorrowId());
+            if (!borrowIds.isEmpty()) {
+                queryWrapper.notIn(ComponentInfo::getComponentId,borrowIds);
+            }
+            queryWrapper.orderByDesc(ComponentInfo::getCreateTime);
+            page = super.page(page, queryWrapper);
+        }
+        return page;
+    }
+
+    /**
+     * 鍊熺敤閮ㄤ欢(鍙壒閲�) - 鍘熸湁閮ㄤ欢id锛屾柊閮ㄤ欢ids
+     * @param oldId,newIds
+     * @return
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Result<?> borrowComponent(String oldId, String newIds){
+        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        ComponentInfo componentInfo = super.getById(oldId);
+        if(componentInfo == null) {
+            return Result.error("閮ㄤ欢涓嶅瓨鍦�");
+        }
+        List<String> productIdList = Arrays.asList(loginUser.getProductionIds().split(","));
+        //鑾峰彇鍙互鍊熺敤鐨勯儴浠�
+        List<ProductMix> productMixList = permissionStreamNewService.
+                loadProductMixByBusinessIdAndBusinessType(loginUser.getId(),productIdList,componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString());
+        Set<Long> allowedIds = productMixList.stream()
+                .map(ProductMix::getId)
+                .collect(Collectors.toCollection(HashSet::new));
+        List<String> newIdList = Arrays.asList(newIds.split(","));
+        boolean allAllowed = newIdList.parallelStream()
+                .map(Long::parseLong)
+                .allMatch(allowedIds::contains);
+        if (!allAllowed) {
+            return Result.error("瀛樺湪鏈巿鏉冪殑閮ㄤ欢鍊熺敤");
+        }
+        //鑾峰彇宸茬粡琚�熺敤鐨勯儴浠�
+        LambdaQueryWrapper<ComponentInfo> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.in(ComponentInfo::getBorrowId,newIdList);
+        queryWrapper.eq(ComponentInfo::getParentId,componentInfo.getComponentId());
+        List<ComponentInfo> list = super.list(queryWrapper);
+        //鍒ゆ柇鏄惁宸茬粡琚綋鍓嶉儴浠跺�熺敤
+        if(!list.isEmpty()) {
+            return Result.error("閫夋嫨鐨勯儴浠跺凡琚綋鍓嶉儴浠跺�熺敤");
+        }
+        List<ComponentInfo> componentInfoList=listByIds(newIdList);
+        componentInfoList.forEach(item->{
+            //娣诲姞閮ㄤ欢淇℃伅銆佸眰绾т俊鎭�佹潈闄愪俊鎭�
+            ComponentInfo newComponentInfo=new ComponentInfo();
+            BeanUtil.copyProperties(item,newComponentInfo);
+            newComponentInfo.setComponentId(null);
+            newComponentInfo.setProductId(componentInfo.getProductId());
+            newComponentInfo.setParentId(componentInfo.getComponentId());
+            newComponentInfo.setBorrowId(item.getComponentId());
+            newComponentInfo.setCreateTime(null);
+            newComponentInfo.setCreateBy(null);
+            newComponentInfo.setUpdateTime(null);
+            newComponentInfo.setUpdateBy(null);
+            addComponentInfo(newComponentInfo);
+        });
+        return Result.ok("閮ㄤ欢鍊熺敤鎴愬姛");
+    }
+
+    @Override
+    public boolean assignPermission(Object entity, Collection<SysUser> userList, boolean isAdd){
+        if (isAdd) {
+            return assignAddUser((ComponentInfo) entity, userList);
+        } else {
+            return assignRemoveUser((ComponentInfo) entity, userList);
+        }
+    }
+    @Override
+    public boolean assignDepartPermission(Object entity, Collection<MdcProduction> departments, boolean isAdd) {
+        if (isAdd) {
+            return assignAddDepart((ComponentInfo) entity, departments);
+        } else {
+            return assignRemoveDepart((ComponentInfo) entity, departments);
+        }
+    }
 }

--
Gitblit v1.9.3