lyh
2025-01-23 8d63dd77b9b3cd9b6d9768f216670fc499a8cab3
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java
@@ -20,6 +20,7 @@
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;
@@ -133,7 +134,8 @@
        b = componentPermissionService.save(permission);
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        //添加默认工序
        //去除默认新增工序,转为手动添加
        /*/添加默认工序
        ProcessStream processStream = new ProcessStream();
        processStream.setProductId(componentInfo.getProductId());
        processStream.setComponentId(componentInfo.getComponentId());
@@ -149,7 +151,7 @@
        iNcLogInfoService.saveLogNcInfos(ncLogInfogx);
        b = processStreamService.save(processStream);
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
            ExceptionCast.cast(CommonCode.FAIL);*/
        //添加权限
        PermissionStream stream = new PermissionStream();
        stream.setUserId(userId);
@@ -411,23 +413,23 @@
    @Override
    @Transactional(rollbackFor = {Exception.class})
    public boolean assignAddDepart(ComponentInfo componentInfo, Collection<Department> departmentList) {
    public boolean assignAddDepart(ComponentInfo componentInfo, Collection<MdcProduction> departmentList) {
        if(componentInfo == null || departmentList == null || departmentList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<ComponentDepartment> componentDepartments = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        departmentList.forEach(item -> {
            ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getDepartId());
            ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getId());
            if(en == null) {
                en = new ComponentDepartment();
                en.setDepartId(item.getDepartId());
                en.setDepartId(item.getId());
                en.setComponentId(componentInfo.getComponentId());
                componentDepartments.add(en);
            }
            PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getDepartId());
            PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getId());
            if(stream == null) {
                stream = new PermissionStream();
                stream.setDepartId(item.getDepartId());
                stream.setDepartId(item.getId());
                stream.setProductId(componentInfo.getProductId());
                stream.setComponentId(componentInfo.getComponentId());
                permissionStreamList.add(stream);
@@ -450,17 +452,17 @@
    @Override
    @Transactional(rollbackFor = {Exception.class})
    public boolean assignRemoveDepart(ComponentInfo componentInfo, Collection<Department> departmentList) {
    public boolean assignRemoveDepart(ComponentInfo componentInfo, Collection<MdcProduction> departmentList) {
        if(componentInfo == null || departmentList == null || departmentList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<ComponentDepartment> componentDepartments = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        departmentList.forEach(item -> {
            ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getDepartId());
            ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getId());
            if(en != null) {
                componentDepartments.add(en);
            }
            PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getDepartId());
            PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getId());
            if(stream != null) {
                permissionStreamList.add(stream);
            }