lyh
2025-04-17 990ad5f6db0bb3ad5a3795e77c5d6f3971c12ff3
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java
@@ -1,6 +1,5 @@
package org.jeecg.modules.dnc.service.impl;
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;
@@ -8,7 +7,7 @@
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
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;
@@ -16,23 +15,16 @@
import org.jeecg.modules.dnc.response.ComponentInfoCode;
import org.jeecg.modules.dnc.response.ProductInfoCode;
import org.jeecg.modules.dnc.response.UcenterCode;
import org.jeecg.modules.dnc.service.*;
import org.jeecg.modules.dnc.ucenter.Department;
import org.jeecg.modules.dnc.utils.ValidateUtil;
import org.jeecg.modules.dnc.entity.*;
import org.jeecg.modules.system.entity.MdcProduction;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.dnc.entity.ComponentInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
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.*;
@Service
public class ComponentInfoSeServiceImpl extends ServiceImpl<ComponentInfoMapper, ComponentInfo> implements IComponentInfoService {
@@ -50,7 +42,7 @@
    @Autowired
    private IProcessStreamService processStreamService;
    @Autowired
    private IDocInfoService docInfoService;
    private IProductMixService productMixService;
    @Autowired
    private IDocRelativeService iDocRelativeService;
    @Autowired
@@ -125,13 +117,23 @@
        if (!b) {
            ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR);
        }
        //去除默认新增工序,转为手动添加
        //添加结构树
        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);
        //添加权限
        PermissionStreamNew stream = new PermissionStreamNew();
        stream.setUserId(userId);
        stream.setBusinessId(componentInfo.getComponentId());
        stream.setBusinessType("2");
        return permissionStreamNewService.save(stream);
        return permissionStreamNewService.addPermissionStreamNew(stream);
    }
    @Override
@@ -154,6 +156,11 @@
        componentInfo.setRankLevel(null);
        componentInfo.setProductId(null);
        boolean b = super.updateById(componentInfo);
        //同步修改结构树
        ProductMix productMix = productMixService.getById(Long.parseLong(id));
        productMix.setName(componentInfo.getComponentName());
        productMix.setCode(componentInfo.getComponentCode());
        productMixService.updateById(productMix);
        if(!b)
            return false;
        ComponentPermission permission = componentPermissionService.getByComponentIdAndUserId(id, userId);
@@ -278,6 +285,9 @@
        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","1");
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        b = productMixService.removeById(id);
        if (!b)
            ExceptionCast.cast(CommonCode.FAIL);
        return super.removeById(id);
    }