新增层级结构工艺规程版本、结构树表、新权限表
修改原有权限验证
删除原有代码
已重命名1个文件
已添加25个文件
已修改32个文件
已删除50个文件
7062 ■■■■■ 文件已修改
lxzn-module-dnc/pom.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ButtonController.java 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceGroupController.java 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/NcLogInfoController.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ObjectController.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProcessSpecVersionController.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductMixController.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/WorkStepController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Button.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ButtonPermission.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DncPassLog.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Menu.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/NcLogInfo.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectBase.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButton.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButtonPermission.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PermissionStream.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PermissionStreamNew.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersion.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersionDepartment.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersionPermission.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessStream.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductMix.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/WorkStep.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ext/MenuExt.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonMapper.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonPermissionMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DncObjectMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DncPassLogMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuButtonMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuMapper.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/NcLogInfoMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonPermissionMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PermissionStreamMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PermissionStreamNewMapper.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionDepartmentMapper.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionMapper.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionPermissionMapper.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductMixMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ButtonMapper.xml 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DncPassLogMapper.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/MenuMapper.xml 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsInfoMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PermissionStreamNewMapper.xml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionDepartmentMapper.xml 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionMapper.xml 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionPermissionMapper.xml 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessStreamMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductInfoMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/WorkStepMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/PartsInfoCode.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProcessInfoCode.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonPermissionService.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonService.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartApproveUserService.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartmentUserService.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupDepartService.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupService.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDncPassLogService.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IMenuButtonService.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/INcLogInfoService.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonPermissionService.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonService.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectService.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamNewService.java 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java 238 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionDepartmentService.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionPermissionService.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionService.java 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductMixService.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonPermissionServiceImpl.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonServiceImpl.java 209 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java 81 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartApproveUserServiceImpl.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartmentUserServiceImpl.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupDepartServiceImpl.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupServiceImpl.java 331 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DncPassLogServiceImpl.java 289 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/MenuButtonServiceImpl.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/NcLogInfoServiceImpl.java 148 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonPermissionServiceImpl.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonServiceImpl.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectServiceImpl.java 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamNewServiceImpl.java 227 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java 470 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionDepartmentServiceImpl.java 135 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionPermissionServiceImpl.java 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionServiceImpl.java 433 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessionDepartmentService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java 706 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductMixServiceImpl.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductPermissionServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepServiceImpl.java 96 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/ProductTreeWrapper.java 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/flow/service/impl/AssignFileStreamServiceImpl.java 57 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/pom.xml
@@ -52,6 +52,12 @@
            <version>3.4.3</version>
            <scope>compile</scope>
        </dependency>
        <!-- pom.xml æ·»åŠ FastUtil依赖 -->
        <dependency>
            <groupId>it.unimi.dsi</groupId>
            <artifactId>fastutil</artifactId>
            <version>8.5.6</version>
        </dependency>
    </dependencies>
</project>
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ButtonController.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceGroupController.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/NcLogInfoController.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ObjectController.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProcessSpecVersionController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,58 @@
package org.jeecg.modules.dnc.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.dnc.entity.ProcessSpecVersion;
import org.jeecg.modules.dnc.entity.WorkStep;
import org.jeecg.modules.dnc.response.CommonCode;
import org.jeecg.modules.dnc.response.ResponseResult;
import org.jeecg.modules.dnc.service.IProcessSpecVersionService;
import org.jeecg.modules.dnc.service.IWorkStepService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Slf4j
@Api(tags = "工艺规程版本")
@RestController
@RequestMapping("/nc/processSpecVersion")
public class ProcessSpecVersionController extends JeecgController<ProcessSpecVersion, IProcessSpecVersionService> {
    @Autowired
    private IProcessSpecVersionService processSpecVersionService;
    @AutoLog(value = "工艺规程版本表-新增工艺规程版本信息")
    @ApiOperation(value = "工艺规程版本表-新增工艺规程版本信息", notes = "工艺规程版本表-新增工艺规程版本信息")
    @PostMapping("/add")
    public ResponseResult addWorkStep(@RequestBody ProcessSpecVersion processSpecVersion) {
        boolean b = processSpecVersionService.addProcessSpecVersion(processSpecVersion);
        if(b) {
            return new ResponseResult(CommonCode.SUCCESS);
        }
        return new ResponseResult(CommonCode.FAIL);
    }
    @AutoLog(value = "工艺规程版本表-编辑工艺规程版本信息")
    @ApiOperation(value = "工艺规程版本表-编辑工艺规程版本信息", notes = "工艺规程版本表-编辑工艺规程版本信息")
    @PutMapping("/edit/{id}")
    public ResponseResult editWorkStep(@PathVariable("id") String id, @RequestBody ProcessSpecVersion processSpecVersion) {
        boolean b = processSpecVersionService.editProcessSpecVersion(id, processSpecVersion);
        if(b) {
            return new ResponseResult(CommonCode.SUCCESS);
        }
        return new ResponseResult(CommonCode.FAIL);
    }
    @AutoLog(value = "工艺规程版本表-删除工艺规程版本信息")
    @ApiOperation(value = "工艺规程版本表-删除工艺规程版本信息", notes = "工艺规程版本表-删除工艺规程版本信息")
    @DeleteMapping("/delete/{id}")
    public ResponseResult deleteWorkStep(@PathVariable("id") String id) {
        boolean b = processSpecVersionService.deleteProcessSpecVersion(id);
        if(b) {
            return new ResponseResult(CommonCode.SUCCESS);
        }
        return new ResponseResult(CommonCode.FAIL);
    }
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java
@@ -15,6 +15,7 @@
import org.jeecg.modules.dnc.response.QueryListResponseResult;
import org.jeecg.modules.dnc.response.ResponseResult;
import org.jeecg.modules.dnc.service.IProductInfoService;
import org.jeecg.modules.dnc.service.IProductMixService;
import org.jeecg.modules.dnc.ucenter.Department;
import org.jeecg.modules.dnc.ucenter.UserDepartExt;
import org.jeecg.modules.dnc.utils.ValidateUtil;
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductMixController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,35 @@
package org.jeecg.modules.dnc.controller;
import cn.hutool.core.lang.tree.Tree;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.dnc.service.IProductMixService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Slf4j
@Api(tags = "结构树")
@RestController
@RequestMapping("/nc/product")
public class ProductMixController {
    @Autowired
    private IProductMixService iProductMixService;
    /**
     * èŽ·å–äº§å“ç»“æž„æ ‘
     * @return
     */
    @AutoLog(value = "获取产品结构树")
    @ApiOperation(value = "获取产品结构树", notes = "获取产品结构树")
    @GetMapping(value = "/getTree")
    public Result<?> getTree() {
        return Result.OK(iProductMixService.getTree());
    }
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/WorkStepController.java
@@ -8,9 +8,12 @@
import org.jeecg.modules.dnc.entity.WorkStep;
import org.jeecg.modules.dnc.response.CommonCode;
import org.jeecg.modules.dnc.response.ResponseResult;
import org.jeecg.modules.dnc.service.IProductMixService;
import org.jeecg.modules.dnc.service.IWorkStepService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Slf4j
@Api(tags = "工步表")
@@ -19,6 +22,8 @@
public class WorkStepController extends JeecgController<WorkStep, IWorkStepService> {
    @Autowired
    private IWorkStepService iWorkStepService;
    @Autowired
    private IProductMixService iProductMixService;
    @AutoLog(value = "工步表-新增工步信息")
    @ApiOperation(value = "工步表-新增工步信息", notes = "工步表-新增工步信息")
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Button.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ButtonPermission.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DncPassLog.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Menu.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/NcLogInfo.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectBase.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButton.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButtonPermission.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PermissionStream.java
@@ -24,6 +24,9 @@
    //零件id
    @TableField(value = "parts_id")
    private String partsId;
    //工序版本id
    @TableField(value = "process_version_id")
    private String processVersionId;
    //工序id
    @TableField(value = "process_id")
    private String processId;
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PermissionStreamNew.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,46 @@
package org.jeecg.modules.dnc.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.Api;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@NoArgsConstructor
@TableName(value = "nc_permission_stream_new")
@Api(value = "用户权限记录表(新)")
public class PermissionStreamNew {
    @TableId(value = "id")
    private String id;
    //业务id
    @TableField(value = "business_id")
    private String businessId;
    //业务类型
    @TableField(value = "business_type")
    private String businessType;
    //用户id
    @TableField(value = "user_id")
    private String userId;
    //DNC部门id
    @TableField(value = "depart_id")
    private String departId;
    @JsonIgnore
    @TableField(value = "create_time")
    private Date createTime;
    @JsonIgnore
    @TableField(value = "update_time")
    private Date updateTime;
    @JsonIgnore
    @TableField(value = "create_by")
    private String createBy;
    @JsonIgnore
    @TableField(value = "update_by")
    private String updateBy;
    @JsonIgnore
    @TableLogic
    @TableField(value = "delete_flag", select = false)
    private Integer deleteFlag = 0;
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersion.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,67 @@
package org.jeecg.modules.dnc.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.Api;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.jeecg.common.aspect.annotation.Dict;
import java.io.Serializable;
import java.util.Date;
@Data
@NoArgsConstructor
@TableName(value = "nc_process_spec_version")
@Api(value = "工艺规程版本")
public class ProcessSpecVersion implements Serializable {
    private static final long serialVersionUID = 1529244980533421687L;
    //id
    @TableField(value = "id")
    private String id;
    //产品id
    @TableField(value = "product_id")
    private String productId;
    //部件id
    @TableField(value = "component_id")
    private String componentId;
    //零件id
    @TableField(value = "parts_id")
    private String partsId;
    //工艺规程版本号
    @TableField(value = "process_spec_version_code")
    private String processSpecVersionCode;
    //工艺规程名称
    @TableField(value = "process_spec_version_name")
    private String processSpecVersionName;
    //描述
    @TableField(value = "description")
    private String description;
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @TableField(value = "update_time", fill = FieldFill.INSERT)
    private Date updateTime;
    @JsonIgnore
    @TableField(value = "create_by", select = false, fill = FieldFill.INSERT)
    @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname")
    private String createBy;
    @JsonIgnore
    @TableField(value = "update_by", select = false, fill = FieldFill.UPDATE)
    @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname")
    private String updateBy;
    @JsonIgnore
    @TableLogic
    @TableField(value = "delete_flag", select = false)
    private Integer deleteFlag = 0;
    //创建人
    private transient String createName;
    //更新人
    private transient String updateName;
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersionDepartment.java
ÎļþÃû´Ó lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/MenuButton.java ÐÞ¸Ä
@@ -8,24 +8,28 @@
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
@Data
@NoArgsConstructor
@TableName(value = "sys_menu_button")
public class MenuButton implements Serializable {
    @TableId
    private String menuButtonId;
    private String menuId;
    private String buttonId;
    private String buttonAlias;
    private String buttonUrl;
    private String permCode;
@TableName(value = "nc_process_spec_version_department")
public class ProcessSpecVersionDepartment {
    @TableId(value = "id")
    private String id;
    @TableField(value = "psv_id")
    private String psvId;
    @TableField(value = "depart_id")
    private String departId;
    @JsonIgnore
    @TableField(value = "create_time", select = false, fill = FieldFill.INSERT)
    private Date createTime;
    @JsonIgnore
    @TableField(value = "create_by", select = false, fill = FieldFill.INSERT)
    private String createBy;
    public ProcessSpecVersionDepartment(String partsId, String departId){
        this.psvId = partsId;
        this.departId = departId;
    }
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersionPermission.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
package org.jeecg.modules.dnc.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.Api;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@NoArgsConstructor
@TableName(value = "nc_process_spec_version_permission")
@Api(value = "工艺规程版本用户权限")
public class ProcessSpecVersionPermission {
    @TableId(value = "id")
    private String id;
    @TableField(value = "psv_id")
    private String psvId;
    @TableField(value = "user_id")
    private String userId;
    @JsonIgnore
    @TableField(value = "create_time", select = false, fill = FieldFill.INSERT)
    private Date createTime;
    @JsonIgnore
    @TableField(value = "create_by", select = false, fill = FieldFill.INSERT)
    private String createBy;
    public ProcessSpecVersionPermission(String psvId, String userId){
        this.psvId = psvId;
        this.userId = userId;
    }
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessStream.java
@@ -22,6 +22,8 @@
    private String componentId;
    @TableField(value = "parts_id")
    private String partsId;
    @TableField(value = "psv_id")
    private String psvId;
    @TableField(value = "process_name")
    private String processName;
    @TableField(value = "process_code")
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductMix.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,47 @@
package org.jeecg.modules.dnc.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.List;
@Getter
@Data
@NoArgsConstructor
@TableName(value = "nc_product_mix")
public class ProductMix {
    // id
    private long id;
    // çˆ¶çº§ id
    @TableField(value = "parent_id")
    private long parentId;
    // åç§°
    @TableField(value = "name")
    private String name;
    // code
    @TableField(value = "code")
    private String code;
    // ç±»åž‹
    @TableField(value = "type")
    private String type;
    private transient List<ProductMix> children = new ArrayList<>();
    public ProductMix(long id, long parentId, String name, String code, String type) {
        this.id = id;
        this.parentId = parentId;
        this.name = name;
        this.code = code;
        this.type = type;
        this.children = new ArrayList<>();
    }
    public void addChild(ProductMix child) {
        this.children.add(child);
    }
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/WorkStep.java
@@ -32,6 +32,9 @@
    //零件id
    @TableField(value = "parts_id")
    private String partsId;
    //工艺规程id
    @TableField(value = "psv_id")
    private String psvId;
    //工序id
    @TableField(value = "process_id")
    private String processId;
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ext/MenuExt.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonMapper.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonPermissionMapper.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DncObjectMapper.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DncPassLogMapper.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuButtonMapper.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuMapper.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/NcLogInfoMapper.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonMapper.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonPermissionMapper.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PermissionStreamMapper.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PermissionStreamNewMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
package org.jeecg.modules.dnc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.dnc.entity.PermissionStreamNew;
import org.jeecg.modules.dnc.entity.ProductMix;
import java.util.List;
public interface PermissionStreamNewMapper extends BaseMapper<PermissionStreamNew> {
    /**
     * æ ¹æ®ç”¨æˆ·id获取结构树权限
     * @param userId
     * @return
     */
    List<ProductMix> loadProductMix(String userId);
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionDepartmentMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
package org.jeecg.modules.dnc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.dnc.entity.ProcessSpecVersionDepartment;
import org.jeecg.modules.system.entity.MdcProduction;
import java.util.List;
public interface ProcessSpecVersionDepartmentMapper extends BaseMapper<ProcessSpecVersionDepartment> {
    /**
     * èŽ·å–å·²åˆ†é…çš„éƒ¨é—¨
     * @param psvId
     * @return
     */
    List<MdcProduction> getDepartPermsByPsvId(@Param("psvId") String psvId);
    /**
     * èŽ·å–å·²åˆ†é…çš„éƒ¨é—¨
     * @param psvId
     * @return
     */
    List<MdcProduction> getDepartNonPermsByPsvId(@Param("psvId") String psvId);
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
package org.jeecg.modules.dnc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.dnc.entity.ProcessSpecVersion;
import org.jeecg.modules.dnc.entity.WorkStep;
import java.util.List;
public interface ProcessSpecVersionMapper extends BaseMapper<ProcessSpecVersion> {
    /**
     * æŸ¥è¯¢å·¥è‰ºè§„程版本信息
     * @param userId
     * @return
     */
    List<ProcessSpecVersion> getByUserPerms(String userId);
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionPermissionMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
package org.jeecg.modules.dnc.mapper;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.dnc.entity.ProcessSpecVersion;
import org.jeecg.modules.dnc.entity.ProcessSpecVersionPermission;
import org.jeecg.modules.dnc.ucenter.UserDepartExt;
import org.jeecg.modules.system.entity.SysUser;
import java.util.Date;
import java.util.List;
public interface ProcessSpecVersionPermissionMapper extends BaseMapper<ProcessSpecVersionPermission> {
    /**
     * èŽ·å–å·²åˆ†é…çš„ç”¨æˆ·
     * @param psvId
     * @return
     */
    List<UserDepartExt> getUserPermsBypsvId(@Param("psvId") String psvId);
    /**
     * èŽ·å–æœªåˆ†é…çš„ç”¨æˆ·
     * @param psvId
     * @return
     */
    List<SysUser> getUserNonPermsBypsvId(@Param("psvId") String psvId);
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductMixMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
package org.jeecg.modules.dnc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.dnc.entity.ProductMix;
public interface ProductMixMapper  extends BaseMapper<ProductMix> {
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ButtonMapper.xml
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml
@@ -128,8 +128,8 @@
        , (select sys_user.realname from sys_user where comp.update_by=sys_user.username) as updateName
        from nc_component_info comp
        inner join
        (select distinct component_id from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s
        on comp.component_id=s.component_id
             (select business_id,business_type from nc_permission_stream_new where delete_flag = 0 and user_id=#{userId}) s
             on comp.component_id = s.business_id and s.business_type='2'
        where delete_flag = 0
    </select>
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DncPassLogMapper.xml
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/MenuMapper.xml
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsInfoMapper.xml
@@ -26,8 +26,8 @@
        , (select sys_user.realname from sys_user where p.update_by=sys_user.username) as updateName
        from nc_parts_info p
        inner join
        (select distinct parts_id from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s
        on p.parts_id = s.parts_id
             (select business_id,business_type from nc_permission_stream_new where delete_flag = 0 and user_id=#{userId}) s
             on p.parts_id = s.business_id and s.business_type='3'
        where p.delete_flag = 0
    </select>
</mapper>
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PermissionStreamNewMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="org.jeecg.modules.dnc.mapper.PermissionStreamNewMapper">
    <select id="loadProductMix" resultType="org.jeecg.modules.dnc.entity.ProductMix">
        SELECT
            mix.*
        FROM
            nc_product_mix mix
                LEFT JOIN nc_permission_stream_new nps ON mix.id = nps.business_id
                AND nps.user_id = #{userId}
                AND nps.delete_flag = '0'
        WHERE
            nps.business_id IS NOT NULL
           OR nps.business_id IS NULL
    </select>
</mapper>
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionDepartmentMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="org.jeecg.modules.dnc.mapper.ProcessSpecVersionDepartmentMapper">
    <select id="getDepartPermsByPsvId" resultType="org.jeecg.modules.system.entity.MdcProduction">
        select u.id
             , u.production_name
             , u.parent_id
             , u.production_order
             , u.org_type
             , org_code
        from mdc_production u
                 inner join
                 (select depart_id from nc_process_spec_version_department where psv_id=#{psvId}) p
                 on u.id=p.depart_id
    </select>
    <select id="getDepartNonPermsByPsvId" resultType="org.jeecg.modules.system.entity.MdcProduction">
        select u.id
             , u.production_name
             , u.parent_id
             , u.production_order
             , u.org_type
             , org_code
        from mdc_production u
        where u.id not in (select depart_id from nc_process_spec_version_department where psv_id=#{psvId})
    </select>
</mapper>
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="org.jeecg.modules.dnc.mapper.ProcessSpecVersionMapper">
    <select id="getByUserPerms" resultType="org.jeecg.modules.dnc.entity.ProcessSpecVersion">
        select
            p.id
             , p.product_id
             , p.component_id
             , p.parts_id
             , p.process_spec_version_name
             , p.process_spec_version_code
             , p.CREATE_TIME
             , p.create_by
             , p.UPDATE_TIME
             , p.update_by
             , p.description
             , (select sys_user.realname from sys_user where p.create_by=sys_user.username) as createName
             , (select sys_user.realname from sys_user where p.update_by=sys_user.username) as updateName
        from nc_process_spec_version p
                 inner join
             (select business_id,business_type from nc_permission_stream_new where delete_flag = 0 and user_id=#{userId}) s
             on p.id = s.business_id AND s.business_type='4'
        where p.delete_flag = 0
    </select>
</mapper>
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionPermissionMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="org.jeecg.modules.dnc.mapper.ProcessSpecVersionPermissionMapper">
    <select id="getUserPermsBypsvId" resultType="org.jeecg.modules.dnc.ucenter.UserDepartExt">
        select u.id
             , u.username
             , u.realname
             , u.avatar
             , u.phone
             , u.email
        from sys_user u
                 inner join
                 (select user_id from nc_process_spec_version_permission where psv_id=#{psvId}) p
                 on u.id=p.user_id
    </select>
    <select id="getUserNonPermsBypsvId" resultType="org.jeecg.modules.system.entity.SysUser">
        select u.id
             , u.username
             , u.realname
             , u.avatar
             , u.phone
             , u.email
        from sys_user u
        where u.id not in (select user_id from nc_process_spec_version_permission where psv_id=#{psvId})
    </select>
</mapper>
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessStreamMapper.xml
@@ -7,6 +7,7 @@
             , p.product_id
             , p.component_id
             , p.parts_id
             , p.psv_id
             , p.PROCESS_NAME
             , p.PROCESS_CODE
             , p.CRAFT_NO
@@ -24,8 +25,8 @@
             , (select sys_user.realname from sys_user where p.update_by=sys_user.username) as updateName
        from nc_process_stream p
                 inner join
             (select distinct PROCESS_ID from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s
             on p.PROCESS_ID = s.PROCESS_ID
             (select business_id,business_type from nc_permission_stream_new where delete_flag = 0 and user_id=#{userId}) s
             on p.PROCESS_ID = s.business_id and s.business_type='5'
        where p.delete_flag = 0
    </select>
    <select id="findByPartsAndComponents" resultType="org.jeecg.modules.dnc.entity.ProcessStream">
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductInfoMapper.xml
@@ -15,8 +15,8 @@
        , (select sys_user.realname from sys_user where p.update_by=sys_user.username) as updateName
        from nc_product_info p
        inner join
        (select distinct product_id from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s
        on p.product_id = s.product_id
             (select business_id,business_type from nc_permission_stream_new where delete_flag = 0 and user_id=#{userId}) s
             on p.product_id = s.business_id and s.business_type='1'
        where p.delete_flag = 0
        order by p.create_time asc
    </select>
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/WorkStepMapper.xml
@@ -7,6 +7,7 @@
             , p.product_id
             , p.component_id
             , p.parts_id
             , p.psv_id
             , p.PROCESS_ID
             , p.step_name
             , p.step_code
@@ -25,8 +26,8 @@
             , (select sys_user.realname from sys_user where p.update_by=sys_user.username) as updateName
        from nc_work_step p
                 inner join
             (select distinct step_id from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s
             on p.id = s.step_id
             (select business_id,business_type from nc_permission_stream_new where delete_flag = 0 and user_id=#{userId}) s
             on p.id = s.business_id and s.business_type='6'
        where p.delete_flag = 0
    </select>
</mapper>
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/PartsInfoCode.java
@@ -12,11 +12,15 @@
    PARTS_NOT_EXIST(false,25204,"零件不存在!"),
    PARTS_USER_NOT_PERM(false,25205,"没有该零件的权限!"),
    PARTS_DELETE_ERROR(false,25206,"删除零件失败!"),
    PARTS_PROCESS_EXIST(false,25207,"零件有关联的工序信息!"),
    PARTS_PROCESS_EXIST(false,25207,"零件有关联的工艺规程版本信息!"),
    PARTS_DOC_EXIST(false,25208,"零件有关联的文档数据"),
    PARTS_CODE_NONE(false,25208,"请输入零件代号!"),
    PARTS_IS_EXIST(false,25209,"零件已存在!"),
    PARTS_USER_NONE(false,25210,"零件无法清空用户权限,请至少保留一位可操作用户!");
    PARTS_CODE_NONE(false,25209,"请输入零件代号!"),
    PARTS_IS_EXIST(false,25210,"零件已存在!"),
    PROCESSSPECVERSION_NOT_EXIST(false,25211,"工艺规程不存在!"),
    PROCESSSPECVERSION_IS_EXIST(false,25212,"工艺规程已存在!"),
    PROCESSSPECVERSION_CODE_NONE(false,25213,"请输入工艺规程版本号!"),
    PROCESSSPECVERSION_PROCESS_EXIST(false,25214,"工艺规程版本有关联的工序信息!"),
    PARTS_USER_NONE(false,25215,"零件无法清空用户权限,请至少保留一位可操作用户!");
    //操作代码
    @ApiModelProperty(value = "操作是否成功", example = "true", required = true)
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProcessInfoCode.java
@@ -10,6 +10,7 @@
    PROCESS_PRODUCT_NONE(false,25402,"无效的产品!"),
    PROCESS_COMPONENT_NONE(false,25403,"无效的部件!"),
    PROCESS_PARTS_NONE(false,25404,"无效的零件!"),
    PROCESSSPECVERSION_NONE(false,254014,"无效的工艺规程版本!"),
    PROCESS_NOT_EXIST(false,25405,"无效的工序!"),
    PROCESS_HAS_DOC(false,25406,"工序下有关联的文档,无法删除!"),
    PROCESS_CODE_NONE(false,25407,"请输入工序号!"),
@@ -17,7 +18,7 @@
    WORKSTEP_NAME_NONE(false,25409,"请输入工步名称!"),
    WORKSTEP_NOT_EXIST(false,25410,"无效的工步!"),
    WORKSTEP_IS_EXIST(false,25411,"该工步已存在!"),
    WORKSTEP_HAS_DATA(false,25412,"工步下有关联的工序数据"),
    WORKSTEP_HAS_DATA(false,25412,"工序下有关联的工步数据"),
    WORKSTEP_HAS_DOC(false,25413,"工步下有关联的文档数据");
    //操作代码
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonPermissionService.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonService.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartApproveUserService.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartmentUserService.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupDepartService.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupService.java
@@ -10,27 +10,7 @@
import java.util.List;
public interface IDeviceGroupService extends IService<DeviceGroup> {
    /**
     * æ–°å¢žè®¾å¤‡åˆ†ç»„
     * @param deviceGroup
     * @return
     */
    boolean addDeviceGroup(DeviceGroup deviceGroup);
    /**
     * æŒ‰åç§°æŸ¥è¯¢æ•°æ®
     * @param groupName
     * @return
     */
    DeviceGroup findByGroupName(String groupName);
    /**
     * ç¼–辑设备分组
     * @param id
     * @param deviceGroup
     * @return
     */
    boolean editDeviceGroup(String id, DeviceGroup deviceGroup);
    /**
     *  æŸ¥è¯¢æ‰€æœ‰çˆ¶èŠ‚ç‚¹åç§°
     * @param parentId
@@ -38,12 +18,7 @@
     * @return
     */
    List<String> findListParentTree(String parentId,List<String> stringList);
    /**
     * åˆ é™¤è®¾å¤‡åˆ†ç»„
     * @param id
     * @return
     */
    boolean deleteDeviceGroup(String id);
    /**
     * èŽ·å–è®¾å¤‡çˆ¶å­çˆ¶å­ç»“æž„æ•°æ®
@@ -93,54 +68,6 @@
     * @return
     */
    boolean assignRemoveUser(DeviceGroup deviceGroup, Collection<SysUser> userList);
    /**
     * èŽ·å–åˆ†ç»„å·²åˆ†é…çš„éƒ¨é—¨
     * @param groupId
     * @return
     */
    List<Department> getDepartPermsList(String groupId);
    /**
     * èŽ·å–åˆ†ç»„æœªåˆ†é…çš„éƒ¨é—¨
     * @param groupId
     * @return
     */
    List<Department> getDepartNonPermsList(String groupId);
//    /**
//     * ç»™åˆ†ç»„分配部门权限
//     * @param groupId
//     * @param relativeFlag
//     * @param departmentIds
//     * @return
//     */
//    boolean assignAddDepartment(String groupId, Integer relativeFlag, String[] departmentIds);
//
//    /**
//     * ç§»é™¤åˆ†ç»„分配部门权限
//     * @param groupId
//     * @param relativeFlag
//     * @param departmentIds
//     * @return
//     */
//    boolean assignRemoveDepartment(String groupId, Integer relativeFlag, String[] departmentIds);
    /**
     * ç»™åˆ†ç»„分配部门权限
     * @param deviceGroup
     * @param departmentList
     * @return
     */
    boolean assignAddDepartment(DeviceGroup deviceGroup, Collection<Department> departmentList);
    /**
     * ç§»é™¤åˆ†ç»„分配部门权限
     * @param deviceGroup
     * @param departmentList
     * @return
     */
    boolean assignRemoveDepartment(DeviceGroup deviceGroup, Collection<Department> departmentList);
    /**
     *
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDncPassLogService.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IMenuButtonService.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/INcLogInfoService.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonPermissionService.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonService.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectService.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamNewService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,85 @@
package org.jeecg.modules.dnc.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.dnc.entity.PermissionStreamNew;
import org.jeecg.modules.dnc.entity.ProductMix;
import java.util.List;
public interface IPermissionStreamNewService extends IService<PermissionStreamNew> {
    /**
     * æ ¹æ®ç”¨æˆ·id获取结构树权限
     * @param userId
     * @return
     */
    List<ProductMix> loadProductMix(String userId);
    /**
     * é€šè¿‡ä¸šåŠ¡id和业务类型获取权限
     * @param businessId
     * @param businessType
     * @return
     */
    List<PermissionStreamNew> loadPermissionStreamNewByBusinessId(String businessId,String businessType,String type);
    /**
     * é€šè¿‡ä¸šåŠ¡id和业务类型和用户id获取用户权限
     * @param businessId
     * @param businessType
     * @param userId
     * @return
     */
    PermissionStreamNew loadPermissionStreamNewByBusinessIdAndUserId(String businessId, String userId,String businessType);
    /**
     * é€šè¿‡ä¸šåŠ¡id和业务类型和部门id获取部门权限
     * @param businessId
     * @param businessType
     * @param departId
     * @return
     */
    PermissionStreamNew loadPermissionStreamNewByBusinessIdAndDepartId(String businessId, String departId,String businessType);
    /**
     * é€šè¿‡businessId获取权限
     * @param businessId
     * @param businessType
     * @return
     */
    List<PermissionStreamNew> loadProductMixByBusinessId(String businessId,String businessType);
    /**
     * é€šè¿‡ä¸šåŠ¡id与类型删除权限
     * @param businessId
     * @param businessType
     * @return
     */
    boolean deletePermissionStreamNewByBusinessId(String businessId,String businessType,String type);
    /**
     * é€šè¿‡List<PermissionStreamNew>批量删除
     * @param permissionStreamNewList
     * @return
     */
    boolean deletePermissionStreamNewByList(List<PermissionStreamNew> permissionStreamNewList);
    /**
     * é€šè¿‡ä¸€ç»„业务id和用户id和类型查询
     * @param businessIds
     * @param userIds
     * @param businessType
     * @return
     */
    List<PermissionStreamNew> loadPermissionStreamNewByBusinessIdsAndUserIds(List<String> businessIds,List<String> userIds,String businessType);
    /**
     * é€šè¿‡ä¸€ç»„业务id和部门id和类型查询
     * @param businessIds
     * @param departIds
     * @param businessType
     * @return
     */
    List<PermissionStreamNew> loadPermissionStreamNewByBusinessIdsAndDepartIds(List<String> businessIds,List<String> departIds,String businessType);
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionDepartmentService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,57 @@
package org.jeecg.modules.dnc.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.dnc.entity.ComponentDepartment;
import org.jeecg.modules.dnc.entity.PartsDepartment;
import org.jeecg.modules.dnc.entity.ProcessSpecVersion;
import org.jeecg.modules.dnc.entity.ProcessSpecVersionDepartment;
import org.jeecg.modules.system.entity.MdcProduction;
import java.util.List;
public interface IProcessSpecVersionDepartmentService extends IService<ProcessSpecVersionDepartment> {
    /**
     * æ ¹æ®å·¥è‰ºè§„程版本id删除部门权限
     * @param psvId
     * @return
     */
    boolean deleteByPsvId(String psvId);
    /**
     * èŽ·å–å·²åˆ†é…çš„éƒ¨é—¨
     * @param psvId
     * @return
     */
    List<MdcProduction> getDepartPermsByPsvId(String psvId);
    /**
     * èŽ·å–å·²åˆ†é…çš„éƒ¨é—¨
     * @param psvId
     * @return
     */
    List<MdcProduction> getDepartNonPermsByPsvId(String psvId);
    /**
     * æŸ¥è¯¢éƒ¨é—¨æƒé™
     * @param psvId
     * @param departId
     * @return
     */
    ProcessSpecVersionDepartment getByProcessSpecVersionIdAndDepartId(String psvId, String departId);
    /**
     * ç§»é™¤éƒ¨é—¨æƒé™
     * @param processSpecVersionDepartments
     * @return
     */
    boolean removeByCollection(List<ProcessSpecVersionDepartment> processSpecVersionDepartments);
    /**
     * æŸ¥è¯¢ä¸€ç»„部门权限
     * @param psvIds
     * @param ids
     * @return
     */
    List<ProcessSpecVersionDepartment> getByPsvIdsAndDepartIds(List<String> psvIds, List<String> ids);
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionPermissionService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,57 @@
package org.jeecg.modules.dnc.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.dnc.entity.PartsPermission;
import org.jeecg.modules.dnc.entity.ProcessSpecVersionPermission;
import org.jeecg.modules.dnc.entity.ProcessionPermission;
import org.jeecg.modules.dnc.ucenter.UserDepartExt;
import org.jeecg.modules.system.entity.SysUser;
import java.util.List;
public interface IProcessSpecVersionPermissionService extends IService<ProcessSpecVersionPermission> {
    /**
     * æ ¹æ®psvId å’ŒuserId æŸ¥æ‰¾æƒé™
     * @param psvId
     * @param userId
     * @return
     */
    ProcessSpecVersionPermission getByPsvIdAndUserId(String psvId, String userId);
    /**
     * æŸ¥è¯¢ä¸€ç»„权限
     * @param psvIds
     * @param ids
     * @return
     */
    List<ProcessSpecVersionPermission> getByPsvIdsAndUserIds(List<String> psvIds, List<String> ids);
    /**
     * èŽ·å–å·²åˆ†é…çš„ç”¨æˆ·
     * @param psvId
     * @return
     */
    List<UserDepartExt> getUserPermsByProductId(String psvId);
    /**
     * èŽ·å–æœªåˆ†é…çš„ç”¨æˆ·
     * @param psvId
     * @return
     */
    List<SysUser> getUserNonPermsByProductId(String psvId);
    /**
     * æ ¹æ®psvId åˆ é™¤
     * @param psvId
     * @return
     */
    boolean deleteByPsvId(String psvId);
    /**
     * æ ¹æ®ä¸€ç»„数据移除权限
     * @param permissionList
     * @return
     */
    boolean removeByCollection(List<ProcessSpecVersionPermission> permissionList);
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,105 @@
package org.jeecg.modules.dnc.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.dnc.entity.PartsInfo;
import org.jeecg.modules.dnc.entity.ProcessSpecVersion;
import org.jeecg.modules.system.entity.MdcProduction;
import org.jeecg.modules.system.entity.SysUser;
import java.util.Collection;
import java.util.List;
public interface IProcessSpecVersionService extends IService<ProcessSpecVersion> {
    /**
     * æ ¹æ®ç”¨æˆ·id获取授权的工艺规程版本表信息
     * @param userId
     * @return
     */
    List<ProcessSpecVersion> getByUserPerms(String userId);
    /**
     * æ ¹æ®ç”¨æˆ·id获取授权的工艺规程版本表信息
     * @param userId
     * @param queryParam æŸ¥è¯¢æ¡ä»¶
     * @return
     */
    List<ProcessSpecVersion> getByUserPerms(String userId,String queryParam);
    /**
     * æ–°å¢žå·¥è‰ºè§„程版本表信息
     * @param ProcessSpecVersion
     * @return
     */
    boolean addProcessSpecVersion(ProcessSpecVersion ProcessSpecVersion);
    /**
     * ç¼–辑工艺规程版本表信息
     * @param id
     * @param ProcessSpecVersion
     * @return
     */
    boolean editProcessSpecVersion(String id ,ProcessSpecVersion ProcessSpecVersion);
    /**
     * åˆ é™¤å·¥è‰ºè§„程版本表信息
     * @param id
     * @return
     */
    boolean deleteProcessSpecVersion(String id);
    /**
     * èŽ·å–å”¯ä¸€ é›¶ä»¶ç¼–号
     * @param processSpecVersionCode
     * @return
     */
    ProcessSpecVersion getByCode(String processSpecVersionCode);
    /**
     * æ ¹æ®é›¶ä»¶id获取
     * @param partsId
     * @return
     */
    List<ProcessSpecVersion> getByPartsId(String partsId);
    /**
     * æ ¹æ®ä¸€ç»„é›¶ä»¶id获取
     * @param partsIds
     * @return
     */
    List<ProcessSpecVersion> getByPartsIds(List<String> partsIds);
    /**
     * åˆ†é…ç”¨æˆ·æƒé™
     * @param processSpecVersion
     * @param userList
     * @return
     */
    boolean assignAddUser(ProcessSpecVersion processSpecVersion, Collection<SysUser> userList);
    /**
     * ç§»é™¤ç”¨æˆ·æƒé™
     * @param processSpecVersion
     * @param userList
     * @return
     */
    boolean assignRemoveUser(ProcessSpecVersion processSpecVersion, Collection<SysUser> userList);
    /**
     * åˆ†é…éƒ¨é—¨æƒé™
     * @param processSpecVersion
     * @param departmentList
     * @return
     */
    boolean assignAddDepart(ProcessSpecVersion processSpecVersion, Collection<MdcProduction> departmentList);
    /**
     * åˆ†é…éƒ¨é—¨æƒé™
     * @param processSpecVersion
     * @param departmentList
     * @return
     */
    boolean assignRemoveDepart(ProcessSpecVersion processSpecVersion, Collection<MdcProduction> departmentList);
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java
@@ -58,18 +58,18 @@
    /**
     * èŽ·å–é›¶ä»¶å…³è”çš„å·¥åºä¿¡æ¯
     * @param partsId
     * @param psvId
     * @return
     */
    List<ProcessStream> findByPartsId(String partsId);
    List<ProcessStream> findBypsvId(String psvId);
    /**
     * èŽ·å–é›¶ä»¶ä¸‹çš„å·¥åºå·
     * @param processNo
     * @param partsId
     * @param psvsId
     * @return
     */
    ProcessStream findByProcessNoAndPartsId(String processNo, String partsId);
    ProcessStream findByProcessNoAndPartsId(String processNo, String psvsId);
    /**
     * èŽ·å–éƒ¨ä»¶ä¸‹çš„å·¥åºå·
     * @param processNo
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductMixService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
package org.jeecg.modules.dnc.service;
import cn.hutool.core.lang.tree.Tree;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.dnc.entity.ProductMix;
import java.util.List;
public interface IProductMixService extends IService<ProductMix> {
    //获取封装产品结构树
    public List<ProductMix> getTree();
    //模拟生成产品结构树
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonPermissionServiceImpl.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonServiceImpl.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java
@@ -41,7 +41,7 @@
    @Autowired
    public ProductInfoMapper productInfoMapper;
    @Autowired
    private IPermissionStreamService permissionStreamService;
    private IPermissionStreamNewService permissionStreamNewService;
    @Autowired
    private IComponentDepartmentService componentDepartmentService;
    @Autowired
@@ -74,8 +74,7 @@
        String userId = user.getId();
        if(!ValidateUtil.validateString(userId))
            ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST);
        List<PermissionStream> oldPermissionList;
        List<PermissionStreamNew> oldPermissionList;
        ProductInfo productInfo = productInfoMapper.selectById(componentInfo.getProductId());
        if(productInfo == null)
            ExceptionCast.cast(ComponentInfoCode.COMPONENT_PRODUCT_NONE);
@@ -84,10 +83,10 @@
            if(en == null) {
                ExceptionCast.cast(ComponentInfoCode.COMPONENT_PARENT_NOT_EXIST);
            }
            oldPermissionList = permissionStreamService.getByComponentId(en.getProductId(), en.getComponentId());
            oldPermissionList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(en.getComponentId(),"2","1");
            componentInfo.setRankLevel(en.getRankLevel() + 1);
        } else {
            oldPermissionList = permissionStreamService.getByProductId(productInfo.getProductId());
            oldPermissionList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(productInfo.getProductId(),"1","1");
            componentInfo.setParentId(null);
            componentInfo.setRankLevel(1);
        }
@@ -98,17 +97,17 @@
            ExceptionCast.cast(CommonCode.FAIL);
        //部门权限
        List<ComponentDepartment> componentDepartmentList = new ArrayList<>();
        List<PermissionStream> componentDepartPermList = new ArrayList<>();
        List<PermissionStreamNew> componentDepartPermList = new ArrayList<>();
        if(oldPermissionList != null && !oldPermissionList.isEmpty()) {
            oldPermissionList.forEach(item -> {
                ComponentDepartment componentDepartment = new ComponentDepartment();
                componentDepartment.setComponentId(componentInfo.getComponentId());
                componentDepartment.setDepartId(item.getDepartId());
                componentDepartmentList.add(componentDepartment);
                PermissionStream permissionStream = new PermissionStream();
                permissionStream.setProductId(componentInfo.getProductId());
                permissionStream.setComponentId(componentInfo.getComponentId());
                PermissionStreamNew permissionStream = new PermissionStreamNew();
                permissionStream.setBusinessId(componentInfo.getComponentId());
                permissionStream.setDepartId(item.getDepartId());
                permissionStream.setBusinessType("2");
                componentDepartPermList.add(permissionStream);
            });
        }
@@ -118,7 +117,7 @@
                ExceptionCast.cast(CommonCode.FAIL);
        }
        if(!componentDepartPermList.isEmpty()) {
            b = permissionStreamService.saveBatch(componentDepartPermList);
            b = permissionStreamNewService.saveBatch(componentDepartPermList);
            if(!b)
                ExceptionCast.cast(CommonCode.FAIL);
        }
@@ -128,11 +127,11 @@
        }
        //去除默认新增工序,转为手动添加
        //添加权限
        PermissionStream stream = new PermissionStream();
        PermissionStreamNew stream = new PermissionStreamNew();
        stream.setUserId(userId);
        stream.setProductId(componentInfo.getProductId());
        stream.setComponentId(componentInfo.getComponentId());
        return permissionStreamService.save(stream);
        stream.setBusinessId(componentInfo.getComponentId());
        stream.setBusinessType("2");
        return permissionStreamNewService.save(stream);
    }
    @Override
@@ -166,13 +165,13 @@
            if(!b)
                return false;
        }
        PermissionStream stream = permissionStreamService.getByComponentIdAndUserId(en.getProductId(), id, userId);
        PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId,"2");
        if(stream == null) {
            stream = new PermissionStream();
            stream = new PermissionStreamNew();
            stream.setUserId(userId);
            stream.setProductId(en.getProductId());
            stream.setComponentId(id);
            return permissionStreamService.save(stream);
            stream.setBusinessId(id);
            stream.setBusinessType("2");
            return permissionStreamNewService.save(stream);
        }
        return b;
    }
@@ -227,10 +226,10 @@
            b = componentDepartmentService.deleteByComponentId(item.getComponentId());
            if(!b)
                ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE);
            b = permissionStreamService.deleteUserPermsByComponentId(item.getProductId(), item.getComponentId());
            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getComponentId(),"2","0");
            if(!b)
                ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE);
            b = permissionStreamService.deleteDepartPermsByComponentId(item.getProductId(), item.getComponentId());
            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getComponentId(),"2","1");
            if(!b)
                ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE);
            b = super.removeById(item.getComponentId());
@@ -273,10 +272,10 @@
        b = componentDepartmentService.deleteByComponentId(id);
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        b = permissionStreamService.deleteUserPermsByComponentId(componentInfo.getProductId(), componentInfo.getComponentId());
        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","0");
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        b = permissionStreamService.deleteDepartPermsByComponentId(componentInfo.getProductId(), componentInfo.getComponentId());
        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","1");
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        return super.removeById(id);
@@ -300,7 +299,7 @@
        if(componentInfo == null || userList == null || userList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<ComponentPermission> permissionList = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        userList.forEach(item -> {
            ComponentPermission en = componentPermissionService.getByComponentIdAndUserId(componentInfo.getComponentId(), item.getId());
            if(en == null) {
@@ -309,12 +308,12 @@
                en.setComponentId(componentInfo.getComponentId());
                permissionList.add(en);
            }
            PermissionStream stream = permissionStreamService.getByComponentIdAndUserId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(), "2 ");
            if(stream == null) {
                stream = new PermissionStream();
                stream = new PermissionStreamNew();
                stream.setUserId(item.getId());
                stream.setProductId(componentInfo.getProductId());
                stream.setComponentId(componentInfo.getComponentId());
                stream.setBusinessId(componentInfo.getComponentId());
                stream.setBusinessType("2");
                permissionStreamList.add(stream);
            }
        });
@@ -325,7 +324,7 @@
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.saveBatch(permissionStreamList);
            boolean b = permissionStreamNewService.saveBatch(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
@@ -339,13 +338,13 @@
        if(componentInfo == null || userList == null || userList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<ComponentPermission> permissionList = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        userList.forEach(item -> {
            ComponentPermission en = componentPermissionService.getByComponentIdAndUserId(componentInfo.getComponentId(), item.getId());
            if(en != null) {
                permissionList.add(en);
            }
            PermissionStream stream = permissionStreamService.getByComponentIdAndUserId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(), "2 ");
            if(stream != null) {
                permissionStreamList.add(stream);
            }
@@ -361,7 +360,7 @@
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.removeByCollection(permissionStreamList);
            boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
@@ -375,7 +374,7 @@
        if(componentInfo == null || departmentList == null || departmentList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<ComponentDepartment> componentDepartments = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        departmentList.forEach(item -> {
            ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getId());
            if(en == null) {
@@ -384,12 +383,12 @@
                en.setComponentId(componentInfo.getComponentId());
                componentDepartments.add(en);
            }
            PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(),"2");
            if(stream == null) {
                stream = new PermissionStream();
                stream = new PermissionStreamNew();
                stream.setDepartId(item.getId());
                stream.setProductId(componentInfo.getProductId());
                stream.setComponentId(componentInfo.getComponentId());
                stream.setBusinessId(componentInfo.getComponentId());
                stream.setBusinessType("2");
                permissionStreamList.add(stream);
            }
        });
@@ -400,7 +399,7 @@
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.saveBatch(permissionStreamList);
            boolean b = permissionStreamNewService.saveBatch(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
@@ -414,13 +413,13 @@
        if(componentInfo == null || departmentList == null || departmentList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<ComponentDepartment> componentDepartments = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        departmentList.forEach(item -> {
            ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getId());
            if(en != null) {
                componentDepartments.add(en);
            }
            PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(),"2");
            if(stream != null) {
                permissionStreamList.add(stream);
            }
@@ -432,7 +431,7 @@
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.removeByCollection(permissionStreamList);
            boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartApproveUserServiceImpl.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartmentUserServiceImpl.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupDepartServiceImpl.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupServiceImpl.java
@@ -37,145 +37,10 @@
    @Autowired
    private IDevicePermissionStreamService devicePermissionStreamService;
    @Autowired
    private IDeviceGroupDepartService deviceGroupDepartService;
    @Autowired
    @Lazy
    private IDeviceInfoService deviceInfoService;
    @Autowired
    private INcLogInfoService iNcLogInfoService;
    @Override
    @Transactional(rollbackFor = {Exception.class})
    public boolean addDeviceGroup(DeviceGroup deviceGroup) {
        if(deviceGroup == null)
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        if(!ValidateUtil.validateString(deviceGroup.getGroupName()))
            ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NAME);
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        if(!ValidateUtil.validateString(userId))
            ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST);
        DeviceGroup en = findByGroupName(deviceGroup.getGroupName());
        if(en != null) {
            ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_EXIST);
        }
        List<DevicePermissionStream> oldDepartPermList = null;
        if (ValidateUtil.validateString(deviceGroup.getParentId())) {
            en = super.getById(deviceGroup.getParentId());
            if(en == null) {
                ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PARENT_NOT_EXIST);
            }
            deviceGroup.setRankLevel(en.getRankLevel() + 1);
            oldDepartPermList = devicePermissionStreamService.getDepartPermByGroupId(en.getGroupId());
        } else {
            deviceGroup.setParentId(null);
            deviceGroup.setRankLevel(1);
        }
        //添加日志
        NcLogInfo ncLogInfo = new NcLogInfo();
        //模块
        ncLogInfo.setModuleInfo("设备结构树");
        //类型
        ncLogInfo.setOperateType(2);
        //日志内容
        ncLogInfo.setLogContent("分组名称:"+deviceGroup.getGroupName()+",分组描述:"+deviceGroup.getDescription());
        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
        boolean b = super.save(deviceGroup);
        if(!b) {
            ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_SAVE_ERROR);
        }
        if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) {
            List<DeviceGroupDepart> groupDepartList = new ArrayList<>();
            List<DevicePermissionStream> permissionStreamList = new ArrayList<>();
            oldDepartPermList.forEach(item -> {
                DeviceGroupDepart dp = new DeviceGroupDepart();
                dp.setDepartId(item.getDepartId());
                dp.setGroupId(deviceGroup.getGroupId());
                groupDepartList.add(dp);
                DevicePermissionStream stream = new DevicePermissionStream();
                stream.setDepartId(item.getDepartId());
                stream.setGroupId(deviceGroup.getGroupId());
                permissionStreamList.add(stream);
            });
            if(!groupDepartList.isEmpty()) {
                b = deviceGroupDepartService.saveBatch(groupDepartList);
                if(!b)
                    ExceptionCast.cast(CommonCode.FAIL);
            }
            if(!permissionStreamList.isEmpty()) {
                b = devicePermissionStreamService.saveBatch(permissionStreamList);
                if(!b)
                    ExceptionCast.cast(CommonCode.FAIL);
            }
        }
        DeviceGroupPermission permission = new DeviceGroupPermission();
        permission.setGroupId(deviceGroup.getGroupId());
        permission.setUserId(userId);
        b = groupPermissionService.save(permission);
        if(!b) {
            ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_SAVE_ERROR);
        }
        DevicePermissionStream stream = new DevicePermissionStream();
        stream.setGroupId(deviceGroup.getGroupId());
        stream.setUserId(userId);
        if (StringUtils.isNotBlank(deviceGroup.getParentId())) {
            String path = null;
            List<String> strings =  findListParentTree(deviceGroup.getParentId(),null);
            if (strings != null && !strings.isEmpty()) {
                path = StringUtils.join(strings.toArray(), "/");
            }
            FileUtilS.saveFileFromPath(path + "/" + deviceGroup.getGroupName());
        } else {
            FileUtilS.saveFileFromPath(deviceGroup.getGroupName());
        }
        return devicePermissionStreamService.save(stream);
    }
    @Override
    public DeviceGroup findByGroupName(String groupName) {
        if(!ValidateUtil.validateString(groupName))
            return null;
        List<DeviceGroup> list = super.lambdaQuery().eq(DeviceGroup::getGroupName, groupName).list();
        if(list == null || list.isEmpty())
            return null;
        return list.get(0);
    }
    @Override
    @Transactional(rollbackFor = {Exception.class})
    public boolean editDeviceGroup(String id, DeviceGroup deviceGroup) {
        if(!ValidateUtil.validateString(id) || deviceGroup == null)
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        DeviceGroup en = super.getById(id);
        if(en == null)
            ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST);
        deviceGroup.setGroupId(id);
        deviceGroup.setParentId(null);
        deviceGroup.setRankLevel(null);
        if (StringUtils.isNotBlank(en.getParentId())) {
            String path = null;
            List<String> strings =  findListParentTree(en.getParentId(),null);
            if (strings != null && !strings.isEmpty()) {
                path = StringUtils.join(strings.toArray(), "/");
            }
            FileUtilS.updateFileFromPath( path + "/"+ deviceGroup.getGroupName(),
                    path + "/"+ en.getGroupName());
        } else {
            FileUtilS.updateFileFromPath(deviceGroup.getGroupName(),en.getGroupName());
        }
        //添加日志
        NcLogInfo ncLogInfo = new NcLogInfo();
        //模块
        ncLogInfo.setModuleInfo("设备结构树");
        //类型
        ncLogInfo.setOperateType(3);
        //日志内容
        ncLogInfo.setLogContent("分组名称:"+deviceGroup.getGroupName());
        //修改保存备注
        ncLogInfo.setRemark(JSONObject.toJSONString(en));
        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
        return super.updateById(deviceGroup);
    }
    //  æŸ¥è¯¢æ‰€ä»¥çˆ¶èŠ‚ç‚¹
    @Override
    public List<String> findListParentTree(String parentId,List<String> stringList){
@@ -200,44 +65,6 @@
            }
        }
        return stringList;
    }
    @Override
    @Transactional(rollbackFor = {Exception.class})
    public boolean deleteDeviceGroup(String id) {
        if(!ValidateUtil.validateString(id))
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        DeviceGroup en = super.getById(id);
        if(en == null)
            ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST);
        List<DeviceGroup> childList = getChildrenByParentId(id);
        if(childList != null && !childList.isEmpty())
            ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_CHILD_EXIST);
        List<DeviceInfo> deviceInfoList = deviceInfoService.getByGroupId(en.getGroupId());
        if(deviceInfoList != null && !deviceInfoList.isEmpty())
            ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_DEVICE_EXIST);
        boolean b = groupPermissionService.deleteByGroupId(en.getGroupId());
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        b = deviceGroupDepartService.deleteByGroupId(en.getGroupId());
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        b = devicePermissionStreamService.deleteUserByGroupId(en.getGroupId());
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        b = devicePermissionStreamService.deleteDepartByGroupId(en.getGroupId());
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        //删除对应文件
        //添加日志
        NcLogInfo ncLogInfo = new NcLogInfo();
        //模块
        ncLogInfo.setModuleInfo("设备结构树");
        //类型
        ncLogInfo.setOperateType(4);
        //日志内容
        ncLogInfo.setLogContent("分组名称:"+en.getGroupName());
        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
        return super.removeById(en.getGroupId());
    }
    @Override
@@ -350,164 +177,6 @@
            ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_USER_NONE);
        if(!permissionList.isEmpty()) {
            boolean b = groupPermissionService.removeByCollection(permissionList);
            if(!b) {
                ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR);
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = devicePermissionStreamService.removeByCollection(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR);
            }
        }
        return true;
    }
    @Override
    public List<Department> getDepartPermsList(String groupId) {
        return deviceGroupDepartService.getDepartPermsByGroupId(groupId);
    }
    @Override
    public List<Department> getDepartNonPermsList(String groupId) {
        return deviceGroupDepartService.getDepartNonPermsByGroupId(groupId);
    }
//    @Override
//    @Transactional(rollbackFor = {Exception.class})
//    public boolean assignAddDepartment(String groupId, Integer relativeFlag, String[] departmentIds) {
//        if(!ValidateUtil.validateString(groupId) || !ValidateUtil.validateInteger(relativeFlag) || departmentIds == null || departmentIds.length < 1)
//            ExceptionCast.cast(CommonCode.INVALID_PARAM);
//        List<String> ids = new ArrayList<>(departmentIds.length);
//        Collections.addAll(ids, departmentIds);
//        Collection<Department> departmentList = departmentService.listByIds(ids);
//        if(departmentList == null || departmentList.isEmpty() || departmentList.size() != departmentIds.length)
//            ExceptionCast.cast(CommonCode.INVALID_PARAM);
//        DeviceGroup deviceGroup = super.getById(groupId);
//        if(deviceGroup == null)
//            ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST);
//        boolean b1 = deviceInfoService.checkDevicePerm(1, deviceGroup.getGroupId());
//        if(!b1) {
//            ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR);
//        }
//        b1 = assignAddDepartment(deviceGroup, departmentList);
//        if(!b1) {
//            ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR);
//        }
//        if(relativeFlag == 1) {
//            //获取分组下所有的子分组
//            List<DeviceGroup> childrenList = getChildrenByParentId(deviceGroup.getGroupId());
//            if(childrenList != null && !childrenList.isEmpty()) {
//                childrenList.forEach(item -> {
//                    boolean b = deviceInfoService.checkDevicePerm(1, item.getGroupId());
//                    if(b) {
//                        b = assignAddDepartment(item, departmentList);
//                        if(!b) {
//                            ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR);
//                        }
//                    }
//                });
//            }
//        }
//        return true;
//    }
//
//    @Override
//    @Transactional(rollbackFor = {Exception.class})
//    public boolean assignRemoveDepartment(String groupId, Integer relativeFlag, String[] departmentIds) {
//        if(!ValidateUtil.validateString(groupId) || !ValidateUtil.validateInteger(relativeFlag) || departmentIds == null || departmentIds.length < 1)
//            ExceptionCast.cast(CommonCode.INVALID_PARAM);
//        List<String> ids = new ArrayList<>(departmentIds.length);
//        Collections.addAll(ids, departmentIds);
//        Collection<Department> departmentList = departmentService.listByIds(ids);
//        if(departmentList == null || departmentList.isEmpty() || departmentList.size() != departmentIds.length)
//            ExceptionCast.cast(CommonCode.INVALID_PARAM);
//        DeviceGroup deviceGroup = super.getById(groupId);
//        if(deviceGroup == null)
//            ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST);
//        boolean b1 = deviceInfoService.checkDevicePerm(1, deviceGroup.getGroupId());
//        if(!b1) {
//            ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR);
//        }
//        b1 = assignRemoveDepartment(deviceGroup, departmentList);
//        if(!b1) {
//            ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR);
//        }
//        if(relativeFlag == 1) {
//            //获取分组下所有的子分组
//            List<DeviceGroup> childrenList = getChildrenByParentId(deviceGroup.getGroupId());
//            if(childrenList != null && !childrenList.isEmpty()) {
//                childrenList.forEach(item -> {
//                    boolean b = deviceInfoService.checkDevicePerm(1, item.getGroupId());
//                    if(b) {
//                        b = assignRemoveDepartment(item, departmentList);
//                        if(!b) {
//                            ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR);
//                        }
//                    }
//                });
//            }
//        }
//        return true;
//    }
    @Override
    @Transactional(rollbackFor = {Exception.class})
    public boolean assignAddDepartment(DeviceGroup deviceGroup, Collection<Department> departmentList) {
        if(deviceGroup == null || departmentList == null || departmentList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<DeviceGroupDepart> deviceGroupDepartList = new ArrayList<>();
        List<DevicePermissionStream> permissionStreamList = new ArrayList<>();
        departmentList.forEach(item -> {
            DeviceGroupDepart en = deviceGroupDepartService.getDepartByGroupAndDepartId(deviceGroup.getGroupId(), item.getDepartId());
            if(en == null) {
                en = new DeviceGroupDepart();
                en.setDepartId(item.getDepartId());
                en.setGroupId(deviceGroup.getGroupId());
                deviceGroupDepartList.add(en);
            }
            DevicePermissionStream stream = devicePermissionStreamService.getByGroupIdAndDepartId(deviceGroup.getGroupId(), item.getDepartId());
            if(stream == null) {
                stream = new DevicePermissionStream();
                stream.setDepartId(item.getDepartId());
                stream.setGroupId(deviceGroup.getGroupId());
                permissionStreamList.add(stream);
            }
        });
        if(!deviceGroupDepartList.isEmpty()) {
            boolean b = deviceGroupDepartService.saveBatch(deviceGroupDepartList);
            if(!b) {
                ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR);
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = devicePermissionStreamService.saveBatch(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR);
            }
        }
        return true;
    }
    @Override
    @Transactional(rollbackFor = {Exception.class})
    public boolean assignRemoveDepartment(DeviceGroup deviceGroup, Collection<Department> departmentList) {
        if(deviceGroup == null || departmentList == null || departmentList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<DeviceGroupDepart> departList = new ArrayList<>();
        List<DevicePermissionStream> permissionStreamList = new ArrayList<>();
        departmentList.forEach(item -> {
            DeviceGroupDepart en = deviceGroupDepartService.getDepartByGroupAndDepartId(deviceGroup.getGroupId(), item.getDepartId());
            if(en != null) {
                departList.add(en);
            }
            DevicePermissionStream stream = devicePermissionStreamService.getByGroupIdAndDepartId(deviceGroup.getGroupId(), item.getDepartId());
            if(stream != null) {
                permissionStreamList.add(stream);
            }
        });
        if(!departList.isEmpty()) {
            boolean b = deviceGroupDepartService.removeByCollection(departList);
            if(!b) {
                ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR);
            }
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java
@@ -63,8 +63,6 @@
    @Lazy
    private IProductInfoService productInfoService;
    @Autowired
    private INcLogInfoService iNcLogInfoService;
    @Autowired
    private IMdcProductionService mdcProductionService;
    @Autowired
    private IMdcEquipmentService mdcEquipmentService;
@@ -100,15 +98,6 @@
        if(group == null) {
            ExceptionCast.cast(DeviceCode.DEVICE_GROUP_NONE);
        }
        //添加日志
        NcLogInfo ncLogInfo = new NcLogInfo();
        //模块
        ncLogInfo.setModuleInfo("设备结构树");
        //类型
        ncLogInfo.setOperateType(2);
        //日志内容
        ncLogInfo.setLogContent("设备名称:"+deviceInfo.getDeviceName()+",设备编号:"+deviceInfo.getDeviceNo());
        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
        boolean b = super.save(deviceInfo);
        if(!b) {
            ExceptionCast.cast(DeviceCode.DEVICE_SAVE_ERROR);
@@ -151,17 +140,6 @@
            ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST);
        deviceInfo.setDeviceId(id);
        deviceInfo.setGroupId(null);
        //添加日志
        NcLogInfo ncLogInfo = new NcLogInfo();
        //模块
        ncLogInfo.setModuleInfo("设备结构树");
        //类型
        ncLogInfo.setOperateType(3);
        //日志内容
        ncLogInfo.setLogContent("设备名称:"+deviceInfo.getDeviceName());
        //修改保存备注
        ncLogInfo.setRemark(JSONObject.toJSONString(en));
        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
        return super.updateById(deviceInfo);
    }
@@ -185,15 +163,6 @@
        b = devicePermissionStreamService.deleteDepartByDeviceId(en.getGroupId(), en.getDeviceId());
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        //添加日志
        NcLogInfo ncLogInfo = new NcLogInfo();
        //模块
        ncLogInfo.setModuleInfo("设备结构树");
        //类型
        ncLogInfo.setOperateType(4);
        //日志内容
        ncLogInfo.setLogContent("设备名称:"+en.getDeviceName());
        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
        return super.removeById(en.getDeviceId());
    }
@@ -369,6 +338,8 @@
    @Override
    @Transactional(rollbackFor = {Exception.class})
    public boolean assignAddUser(MdcEquipment mdcEquipment, Collection<SysUser> userList) {
        if(mdcEquipment == null || userList == null || userList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        MdcProductionEquipment mdcProductionEquipment=mdcProductionEquipmentService
@@ -387,7 +358,7 @@
            if(stream == null) {
                stream = new DevicePermissionStream();
                stream.setUserId(item.getId());
                stream.setGroupId(mdcProductionEquipment.getId());
                stream.setGroupId(mdcProductionEquipment.getProductionId());
                stream.setDeviceId(mdcEquipment.getId());
                permissionStreamList.add(stream);
            }
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DncPassLogServiceImpl.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java
@@ -59,8 +59,7 @@
    private IDeviceInfoService deviceInfoService;
    @Autowired
    private IDeviceGroupService deviceGroupService;
    @Autowired
    private INcLogInfoService iNcLogInfoService;
    /*备份处理*/
    @Override
@@ -140,15 +139,6 @@
            }
        }
        //添加日志
        NcLogInfo ncLogInfo = new NcLogInfo();
        //模块
        ncLogInfo.setModuleInfo("设备结构树");
        //类型
        ncLogInfo.setOperateType(7);
        //日志内容
        ncLogInfo.setLogContent("导入"+docClass.getClassificationName()+",文档名称:"+(docFile.getFileName()+"."+docFile.getFileSuffix()));
        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
        boolean saveBool = super.save(docInfo);
        return saveBool;
    }
@@ -304,17 +294,6 @@
        docInfo.setClassificationId(null);
        docInfo.setPublishFileId(null);
        docInfo.setPublishVersion(null);
        //添加日志
        NcLogInfo ncLogInfo = new NcLogInfo();
        //模块
        ncLogInfo.setModuleInfo("设备结构树");
        //类型
        ncLogInfo.setOperateType(3);
        //日志内容
        ncLogInfo.setLogContent("文档名称:"+docInfo.getDocName());
        //修改保存备注
        ncLogInfo.setRemark(JSONObject.toJSONString(en));
        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
        return super.updateById(docInfo);
    }
@@ -337,15 +316,6 @@
        b = docRelativeService.deleteByDocId(id);
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        //添加日志
        NcLogInfo ncLogInfo = new NcLogInfo();
        //模块
        ncLogInfo.setModuleInfo("产品结构树");
        //类型
        ncLogInfo.setOperateType(4);
        //日志内容
        ncLogInfo.setLogContent("文档名称:"+en.getDocName());
        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
        return super.removeById(id);
    }
@@ -384,16 +354,6 @@
        docFile.setFilePath(fileUploadResult.getFilePath());
        docFile.setFileSize(fileUploadResult.getFileSize());
        docFile.setFileSuffix(fileUploadResult.getFileSuffix());
        //添加日志
        NcLogInfo ncLogInfo = new NcLogInfo();
        //模块
        ncLogInfo.setModuleInfo("设备结构树");
        //类型
        ncLogInfo.setOperateType(7);
        //日志内容
        ncLogInfo.setLogContent("入库"+docFile.getFileSuffix()+"格式文档,文档名称:"+docFile.getFileName());
        ncLogInfo.setRemark(JSONObject.toJSONString(en));
        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
        boolean b = fileOperateService.deleteByDocId(id);
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
@@ -452,15 +412,6 @@
        DocFile old = docFileService.getDocFileNearest(en.getDocId());
        if(old == null)
            ExceptionCast.cast(DocumentCode.DOC_PUBLISH_FILE_NONE);
        //添加日志
        NcLogInfo ncLogInfo = new NcLogInfo();
        //模块
        ncLogInfo.setModuleInfo("设备结构树");
        //类型
        ncLogInfo.setOperateType(7);
        //日志内容
        ncLogInfo.setLogContent("发布"+en.getDocSuffix()+"格式文档,文档名称:"+en.getDocName());
        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
        if(old.getDocVersion().contains(".")) {
            DocFile docFile = new DocFile();
            BeanUtils.copyProperties(pubFile, docFile);
@@ -487,15 +438,6 @@
            ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST);
        if(en.getDocStatus() != 2)
            ExceptionCast.cast(DocumentCode.DOC_REPUBLISH_ERROR);
        //添加日志
        NcLogInfo ncLogInfo = new NcLogInfo();
        //模块
        ncLogInfo.setModuleInfo("设备结构树");
        //类型
        ncLogInfo.setOperateType(7);
        //日志内容
        ncLogInfo.setLogContent("重新发布"+en.getDocSuffix()+"格式文档,文档名称:"+en.getDocName());
        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
        return super.lambdaUpdate().eq(DocInfo::getDocId, id).set(DocInfo::getDocStatus, 1).update();
    }
@@ -512,15 +454,6 @@
        FileOperate operate = fileOperateService.getByDocId(id);
        if(operate != null)
            ExceptionCast.cast(DocumentCode.DOC_IS_OPERATING);
        //添加日志
        NcLogInfo ncLogInfo = new NcLogInfo();
        //模块
        ncLogInfo.setModuleInfo("设备结构树");
        //类型
        ncLogInfo.setOperateType(7);
        //日志内容
        ncLogInfo.setLogContent("归档"+en.getDocSuffix()+"格式文档,文档名称:"+en.getDocName());
        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
        return super.lambdaUpdate().eq(DocInfo::getDocId, id).set(DocInfo::getDocStatus, 3).update();
    }
@@ -538,15 +471,6 @@
        DocInfo en = super.getById(id);
        if(en == null)
            ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST);
        //添加日志
        NcLogInfo ncLogInfo = new NcLogInfo();
        //模块
        ncLogInfo.setModuleInfo("设备结构树");
        //类型
        ncLogInfo.setOperateType(7);
        //日志内容
        ncLogInfo.setLogContent("取消出库"+en.getDocSuffix()+"格式文档,文档名称:"+en.getDocName());
        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
        return fileOperateService.deleteByDocId(id);
    }
@@ -757,15 +681,6 @@
        String filePath = docFile.getFilePath();
        String fileEncodeName = docFile.getFileEncodeName();
        FileUtilS.downLoadFile(response, fileEncodeName, filePath, fileName);
        //添加日志
        NcLogInfo ncLogInfo = new NcLogInfo();
        //模块
        ncLogInfo.setModuleInfo("设备结构树");
        //类型
        ncLogInfo.setOperateType(7);
        //日志内容
        ncLogInfo.setLogContent("出库"+docFile.getFileSuffix()+"格式文档,文档名称:"+fileName);
        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
        return null;
    }
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java
@@ -3,8 +3,6 @@
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.jeecg.modules.dnc.entity.DeviceInfo;
import org.jeecg.modules.dnc.entity.DncPassLog;
import org.jeecg.modules.dnc.entity.DocInfo;
import org.jeecg.modules.dnc.entity.DocRelative;
import org.jeecg.modules.dnc.exception.ExceptionCast;
@@ -40,8 +38,6 @@
    private IDeviceGroupService deviceGroupService;
    @Value("${securedoc.localFilePath}")
    private String localFilePath;
    @Autowired
    private IDncPassLogService dncPassLogService;
    @Autowired
    private IMdcEquipmentService iMdcEquipmentService;
    @Autowired
@@ -97,30 +93,12 @@
                if (!deleteFile) {
                    return false;
                }
                DncPassLog dncPassLog = dncPassLogService.findDayTime(DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY));
                Integer fileTxt = 0, fileNc =0;
                if (dncPassLog !=null) {
                    fileTxt = dncPassLog.getSequenceNumber() + 1;
                    fileNc = fileTxt + 1;
                } else {
                    fileTxt =  1;
                    fileNc = fileTxt + 1;
                }
                String sequence = String.format("%06d",fileTxt);
                DncPassLog passInfoNc = new DncPassLog();
                passInfoNc.setSequenceNumber(fileNc);
                passInfoNc.setSequenceOrder(sequence);
                passInfoNc.setDayTime(DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY));
                passInfoNc.setPassType("02");
                passInfoNc.setPassName(info.getDocName()+"."+info.getDocSuffix());
                passInfoNc.setCreateTime(DateUtil.getNow());
                dncPassLogService.save(passInfoNc);
                //处理文件名称  æ–‡ä»¶è·¯å¾„
                NcTxtFilePathInfo ncTxt = new NcTxtFilePathInfo();
                ncTxt.setEquipmentId(mdcEquipment.getEquipmentId());
                ncTxt.setFilePath(path + "/"+ mdcEquipment.getEquipmentId() + "/" );
                ncTxt.setFileTxtName("02A"+DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY)+sequence);
                ncTxt.setFileTxtName("02A"+DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY));
                ncTxt.setOrigFileName(info.getDocName());
                ncTxt.setOrigFileSuffix(info.getDocSuffix());
                ncTxt.setFileAddOrDelete(2);
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/MenuButtonServiceImpl.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/NcLogInfoServiceImpl.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonPermissionServiceImpl.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonServiceImpl.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectServiceImpl.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java
@@ -45,16 +45,11 @@
    @Autowired
    private IPartsPermissionService partsPermissionService;
    @Autowired
    private IPermissionStreamService permissionStreamService;
    private IPermissionStreamNewService permissionStreamNewService;
    @Autowired
    private IPartsDepartmentService partsDepartmentService;
    @Autowired
    @Lazy
    private IProcessStreamService processStreamService;
    @Autowired
    private IDocInfoService docInfoService;
    @Autowired
    private INcLogInfoService iNcLogInfoService;
    private IProcessSpecVersionService processSpecVersionService;
    @Autowired
    private IDocRelativeService iDocRelativeService;
    @Autowired
@@ -87,20 +82,19 @@
            ExceptionCast.cast(PartsInfoCode.PARTS_COMPONENT_NONE);
        partsInfo.setPartsStatus(1);
        boolean b = super.save(partsInfo);
        List<PermissionStream> oldDepartPermList = permissionStreamService.getByComponentId(componentInfo.getProductId(), componentInfo.getComponentId());
        List<PermissionStreamNew> oldDepartPermList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","1");
        if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) {
            List<PartsDepartment> partsDepartmentList = new ArrayList<>();
            List<PermissionStream> permissionStreamList = new ArrayList<>();
            List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
            oldDepartPermList.forEach(item -> {
                PartsDepartment pd = new PartsDepartment();
                pd.setDepartId(item.getDepartId());
                pd.setPartsId(partsInfo.getPartsId());
                partsDepartmentList.add(pd);
                PermissionStream perm = new PermissionStream();
                PermissionStreamNew perm = new PermissionStreamNew();
                perm.setDepartId(item.getDepartId());
                perm.setProductId(partsInfo.getProductId());
                perm.setComponentId(partsInfo.getComponentId());
                perm.setPartsId(partsInfo.getPartsId());
                perm.setBusinessId(partsInfo.getPartsId());
                perm.setBusinessType("3");
                permissionStreamList.add(perm);
            });
            if(!partsDepartmentList.isEmpty()) {
@@ -109,7 +103,7 @@
                    ExceptionCast.cast(CommonCode.FAIL);
            }
            if(!permissionStreamList.isEmpty()) {
                b = permissionStreamService.saveBatch(permissionStreamList);
                b = permissionStreamNewService.saveBatch(permissionStreamList);
                if(!b)
                    ExceptionCast.cast(CommonCode.FAIL);
            }
@@ -121,12 +115,11 @@
            ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR);
        }
        //添加用户权限
        PermissionStream stream = new PermissionStream();
        stream.setProductId(partsInfo.getProductId());
        stream.setComponentId(partsInfo.getComponentId());
        stream.setPartsId(partsInfo.getPartsId());
        PermissionStreamNew stream = new PermissionStreamNew();
        stream.setBusinessId(partsInfo.getPartsId());
        stream.setBusinessType("3");
        stream.setUserId(userId);
        return permissionStreamService.save(stream);
        return permissionStreamNewService.save(stream);
    }
    @Override
@@ -157,14 +150,13 @@
            if(!b)
                return false;
        }
        PermissionStream stream = permissionStreamService.getByPartsIdAndUserId(en.getProductId(), en.getComponentId(), id, userId);
        PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId( id, userId,"3");
        if(stream == null) {
            stream = new PermissionStream();
            stream.setProductId(en.getProductId());
            stream.setComponentId(en.getComponentId());
            stream.setPartsId(id);
            stream = new PermissionStreamNew();
            stream.setBusinessId(id);
            stream.setBusinessType("3");
            stream.setUserId(userId);
            return permissionStreamService.save(stream);
            return permissionStreamNewService.save(stream);
        }
        return b;
    }
@@ -220,10 +212,10 @@
            b = partsDepartmentService.deleteByPartsId(item.getPartsId());
            if(!b)
                ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR);
            b = permissionStreamService.deleteUserPermsByPartsId(item.getProductId(), item.getComponentId(), item.getPartsId());
            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getPartsId(),"3","0");
            if(!b)
                ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR);
            b = permissionStreamService.deleteDepartPermsByPartsId(item.getProductId(), item.getComponentId(), item.getPartsId());
            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getPartsId(),"3","1");
            if(!b)
                ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR);
            b = super.removeById(item.getPartsId());
@@ -241,8 +233,8 @@
        PartsInfo partsInfo = super.getById(partsId);
        if(partsInfo == null)
            ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST);
        List<ProcessStream> processStreams = processStreamService.findByPartsId(partsId);
        if(processStreams != null && !processStreams.isEmpty())
        List<ProcessSpecVersion> processSpecVersions = processSpecVersionService.getByPartsId(partsId);
        if(processSpecVersions != null && !processSpecVersions.isEmpty())
            ExceptionCast.cast(PartsInfoCode.PARTS_PROCESS_EXIST);
        boolean b = partsPermissionService.deleteByPartsId(partsInfo.getPartsId());
        //验证是否存在文档
@@ -255,10 +247,10 @@
        b = partsDepartmentService.deleteByPartsId(partsInfo.getPartsId());
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        b = permissionStreamService.deleteUserPermsByPartsId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId());
        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(partsId,"3","0");
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        b = permissionStreamService.deleteDepartPermsByPartsId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId());
        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(partsId,"3","1");
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        return super.removeById(partsInfo.getPartsId());
@@ -270,7 +262,7 @@
        if(partsInfo == null || userList == null || userList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<PartsPermission> permissionList = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        userList.forEach(item -> {
            PartsPermission en = partsPermissionService.getByPartsIdAndUserId(partsInfo.getPartsId(), item.getId());
            if(en == null) {
@@ -279,13 +271,12 @@
                en.setPartsId(partsInfo.getPartsId());
                permissionList.add(en);
            }
            PermissionStream stream = permissionStreamService.getByPartsIdAndUserId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), item.getId(),"3");
            if(stream == null) {
                stream = new PermissionStream();
                stream = new PermissionStreamNew();
                stream.setUserId(item.getId());
                stream.setProductId(partsInfo.getProductId());
                stream.setComponentId(partsInfo.getComponentId());
                stream.setPartsId(partsInfo.getPartsId());
                stream.setBusinessId(partsInfo.getPartsId());
                stream.setBusinessType("3");
                permissionStreamList.add(stream);
            }
        });
@@ -296,7 +287,7 @@
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.saveBatch(permissionStreamList);
            boolean b = permissionStreamNewService.saveBatch(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
@@ -310,21 +301,18 @@
        if(partsInfo == null || userList == null || userList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<PartsPermission> permissionList = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        userList.forEach(item -> {
            PartsPermission en = partsPermissionService.getByPartsIdAndUserId(partsInfo.getPartsId(), item.getId());
            if(en != null) {
                permissionList.add(en);
            }
            PermissionStream stream = permissionStreamService.getByPartsIdAndUserId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), item.getId(),"3");
            if(stream != null) {
                permissionStreamList.add(stream);
            }
        });
        //清空用户权限校验
        /*List<PartsPermission> exitsList = partsPermissionService.getByPartsId(partsInfo.getPartsId());
        if(exitsList.size() <= permissionList.size())
            ExceptionCast.cast(PartsInfoCode.PARTS_USER_NONE);*/
        if(!permissionList.isEmpty()) {
            boolean b = partsPermissionService.removeByCollection(permissionList);
            if(!b) {
@@ -332,7 +320,7 @@
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.removeByCollection(permissionStreamList);
            boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
@@ -346,7 +334,7 @@
        if(partsInfo == null || departmentList == null || departmentList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<PartsDepartment> partsDepartments = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        departmentList.forEach(item -> {
            PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getId());
            if(en == null) {
@@ -355,14 +343,12 @@
                en.setPartsId(partsInfo.getPartsId());
                partsDepartments.add(en);
            }
            PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(),
                    partsInfo.getPartsId(), item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(partsInfo.getPartsId(), item.getId(),"3");
            if(stream == null) {
                stream = new PermissionStream();
                stream = new PermissionStreamNew();
                stream.setDepartId(item.getId());
                stream.setProductId(partsInfo.getProductId());
                stream.setComponentId(partsInfo.getComponentId());
                stream.setPartsId(partsInfo.getPartsId());
                stream.setBusinessId(partsInfo.getPartsId());
                stream.setBusinessType("3");
                permissionStreamList.add(stream);
            }
        });
@@ -373,7 +359,7 @@
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.saveBatch(permissionStreamList);
            boolean b = permissionStreamNewService.saveBatch(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
@@ -387,14 +373,13 @@
        if(partsInfo == null || departmentList == null || departmentList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<PartsDepartment> partsDepartments = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        departmentList.forEach(item -> {
            PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getId());
            if(en != null) {
                partsDepartments.add(en);
            }
            PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(),
                    partsInfo.getPartsId(), item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(partsInfo.getPartsId(), item.getId(),"3");
            if(stream != null) {
                permissionStreamList.add(stream);
            }
@@ -406,7 +391,7 @@
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.removeByCollection(permissionStreamList);
            boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamNewServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,227 @@
package org.jeecg.modules.dnc.service.impl;
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.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections4.ListUtils;
import org.jeecg.modules.dnc.entity.PermissionStream;
import org.jeecg.modules.dnc.entity.PermissionStreamNew;
import org.jeecg.modules.dnc.entity.ProductMix;
import org.jeecg.modules.dnc.mapper.PermissionStreamNewMapper;
import org.jeecg.modules.dnc.service.IPermissionStreamNewService;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class PermissionStreamNewServiceImpl extends ServiceImpl<PermissionStreamNewMapper, PermissionStreamNew> implements IPermissionStreamNewService {
    /**
     * æ ¹æ®ç”¨æˆ·id获取结构树权限
     * @param userId
     * @return
     */
    @Override
    public List<ProductMix> loadProductMix(String userId){
        return baseMapper.loadProductMix(userId);
    }
    /**
     * é€šè¿‡ä¸šåŠ¡id和业务类型获取权限
     * @param businessId
     * @param businessType
     * @return
     */
    @Override
    public  List<PermissionStreamNew> loadPermissionStreamNewByBusinessId(String businessId,String businessType,String type){
        QueryWrapper<PermissionStreamNew> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(StrUtil.isNotEmpty(businessId),"business_id",businessId);
        queryWrapper.eq(StrUtil.isNotEmpty(businessType),"business_type",businessType);
        //用户权限,部门字段为空
        if("0".equals(type)) {
            queryWrapper.isNotNull("user_id");
        }else if("1".equals(type)){
            queryWrapper.isNull("user_id");
        }
        queryWrapper.eq("delete_flag",0);
        return baseMapper.selectList(queryWrapper);
    }
    /**
     * é€šè¿‡ä¸šåŠ¡id和用户id获取权限
     * @param businessId
     * @param userId
     * @return
     */
    @Override
    public PermissionStreamNew loadPermissionStreamNewByBusinessIdAndUserId(String businessId, String userId,String businessType){
        QueryWrapper<PermissionStreamNew> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(StrUtil.isNotEmpty(businessId),"business_id",businessId);
        queryWrapper.eq(StrUtil.isNotEmpty(userId),"user_id",userId);
        queryWrapper.eq(StrUtil.isNotEmpty(businessType),"business_type",businessType);
        queryWrapper.eq("delete_flag",0);
        queryWrapper.isNull("depart_id");
        return baseMapper.selectOne(queryWrapper);
    }
    /**
     * é€šè¿‡ä¸šåŠ¡id和业务类型和部门id获取部门权限
     * @param businessId
     * @param businessType
     * @param departId
     * @return
     */
    @Override
    public  PermissionStreamNew loadPermissionStreamNewByBusinessIdAndDepartId(String businessId, String departId,String businessType){
        QueryWrapper<PermissionStreamNew> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(StrUtil.isNotEmpty(businessId),"business_id",businessId);
        queryWrapper.eq(StrUtil.isNotEmpty(departId),"depart_id",departId);
        queryWrapper.eq(StrUtil.isNotEmpty(businessType),"business_type",businessType);
        queryWrapper.eq("delete_flag",0);
        queryWrapper.isNull("user_id");
        return baseMapper.selectOne(queryWrapper);
    }
    /**
     * é€šè¿‡businessId获取权限
     * @param businessId
     * @return
     */
    @Override
    public List<PermissionStreamNew> loadProductMixByBusinessId(String businessId,String businessType){
        QueryWrapper<PermissionStreamNew> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(StrUtil.isNotEmpty(businessId),"business_id",businessId);
        queryWrapper.eq(StrUtil.isNotEmpty(businessType),"business_type",businessType);
        queryWrapper.eq("delete_flag",0);
        return baseMapper.selectList(queryWrapper);
    }
    /**
     * é€šè¿‡ä¸šåŠ¡id与类型删除权限
     * @param businessId
     * @param businessType
     * @param type 0:用户权限,1:部门权限
     * @return
     */
    @Override
    public boolean deletePermissionStreamNewByBusinessId(String businessId,String businessType,String type){
        QueryWrapper<PermissionStreamNew> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(StrUtil.isNotEmpty(businessId),"business_id",businessId);
        queryWrapper.eq(StrUtil.isNotEmpty(businessType),"business_type",businessType);
        //用户权限,部门字段为空
        if("0".equals(type)){
            queryWrapper.isNotNull("user_id");
            queryWrapper.isNull("depart_id");
        }else if("1".equals(type)){
            queryWrapper.isNull("user_id");
            queryWrapper.isNotNull("depart_id");
        }
        queryWrapper.eq("delete_flag",0);
        return baseMapper.delete(queryWrapper)>0;
    }
    /**
     * é€šè¿‡List<PermissionStreamNew>批量删除
     * @param permissionStreamNewList
     * @return
     */
    @Override
    public boolean deletePermissionStreamNewByList(List<PermissionStreamNew> permissionStreamNewList){
        if(permissionStreamNewList == null || permissionStreamNewList.isEmpty())
            return false;
        if(permissionStreamNewList.size() == 1) {
            return super.removeById(permissionStreamNewList.get(0).getId());
        }
        List<String> ids = new ArrayList<>();
        permissionStreamNewList.forEach(item -> {
            ids.add(item.getId());
        });
        return super.removeByIds(ids);
    }
    /**
     * é€šè¿‡ä¸€ç»„业务id和用户id和类型查询
     * @param businessIds
     * @param userIds
     * @param businessType
     * @return
     */
    @Override
    public List<PermissionStreamNew> loadPermissionStreamNewByBusinessIdsAndUserIds(List<String> businessIds,List<String> userIds,String businessType){
        if(businessIds == null || businessIds.isEmpty() || userIds == null || userIds.isEmpty())
            return null;
        List<PermissionStreamNew> total = new ArrayList<>();
        List<List<String>> compListArr;
        List<List<String>> userIdsArr;
        if(businessIds.size() > 1000){
            compListArr = ListUtils.partition(businessIds, 100);
        }else {
            compListArr = ListUtils.partition(businessIds, 1000);
        }
        if(userIds.size() > 1000){
            userIdsArr = ListUtils.partition(userIds, 100);
        }else {
            userIdsArr = ListUtils.partition(userIds, 1000);
        }
        for(List<String> compList : compListArr) {
            for(List<String> userIdList : userIdsArr){
                LambdaQueryWrapper<PermissionStreamNew> queryWrapper = Wrappers.lambdaQuery();
                queryWrapper.in(PermissionStreamNew::getBusinessId, compList);
                queryWrapper.in(PermissionStreamNew::getUserId, userIdList);
                queryWrapper.eq(PermissionStreamNew::getBusinessType, businessType);
                queryWrapper.isNull(PermissionStreamNew::getDepartId);
                queryWrapper.eq(PermissionStreamNew::getDeleteFlag,0);
                List<PermissionStreamNew> list = super.list(queryWrapper);
                if(list != null && !list.isEmpty()){
                    total.addAll(list);
                }
            }
        }
        return total;
    }
    /**
     * é€šè¿‡ä¸€ç»„业务id和部门id和类型查询
     * @param businessIds
     * @param departIds
     * @param businessType
     * @return
     */
    @Override
    public List<PermissionStreamNew> loadPermissionStreamNewByBusinessIdsAndDepartIds(List<String> businessIds,List<String> departIds,String businessType){
        if(businessIds == null || businessIds.isEmpty() || departIds == null || departIds.isEmpty())
            return null;
        List<PermissionStreamNew> total = new ArrayList<>();
        List<List<String>> compListArr;
        List<List<String>> departListArr;
        if(businessIds.size() > 1000){
            compListArr = ListUtils.partition(businessIds, 100);
        }else {
            compListArr = ListUtils.partition(businessIds, 1000);
        }
        if(departIds.size() > 1000){
            departListArr = ListUtils.partition(departIds, 100);
        }else {
            departListArr = ListUtils.partition(departIds, 1000);
        }
        for(List<String> compList : compListArr) {
            for(List<String> departList : departListArr){
                LambdaQueryWrapper<PermissionStreamNew> queryWrapper = Wrappers.lambdaQuery();
                queryWrapper.in(PermissionStreamNew::getBusinessId, compList);
                queryWrapper.in(PermissionStreamNew::getDepartId, departList);
                queryWrapper.eq(PermissionStreamNew::getBusinessType, businessType);
                queryWrapper.isNull(PermissionStreamNew::getUserId);
                queryWrapper.eq(PermissionStreamNew::getDeleteFlag,0);
                List<PermissionStreamNew> list = super.list(queryWrapper);
                if(list != null && !list.isEmpty()){
                    total.addAll(list);
                }
            }
        }
        return total;
    }
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java
ÎļþÒÑɾ³ý
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionDepartmentServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,135 @@
package org.jeecg.modules.dnc.service.impl;
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.commons.collections4.ListUtils;
import org.jeecg.modules.dnc.entity.ProcessSpecVersionDepartment;
import org.jeecg.modules.dnc.entity.PartsDepartment;
import org.jeecg.modules.dnc.entity.ProcessSpecVersionDepartment;
import org.jeecg.modules.dnc.mapper.ProcessSpecVersionDepartmentMapper;
import org.jeecg.modules.dnc.service.IProcessSpecVersionDepartmentService;
import org.jeecg.modules.dnc.utils.ValidateUtil;
import org.jeecg.modules.system.entity.MdcProduction;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class ProcessSpecVersionDepartmentServiceImpl extends ServiceImpl<ProcessSpecVersionDepartmentMapper, ProcessSpecVersionDepartment> implements IProcessSpecVersionDepartmentService {
    /**
     * æ ¹æ®å·¥è‰ºè§„程版本id删除部门权限
     * @param psvId
     * @return
     */
    @Override
    public boolean deleteByPsvId(String psvId) {
        if(!ValidateUtil.validateString(psvId))
            return false;
        LambdaQueryWrapper<ProcessSpecVersionDepartment> lambdaQueryWrapper =  Wrappers.lambdaQuery();
        lambdaQueryWrapper.eq(ProcessSpecVersionDepartment::getPsvId, psvId);
        return super.remove(lambdaQueryWrapper);
    }
    /**
     * èŽ·å–å·²åˆ†é…çš„éƒ¨é—¨
     * @param psvId
     * @return
     */
    @Override
    public List<MdcProduction> getDepartPermsByPsvId(String psvId){
        return super.baseMapper.getDepartPermsByPsvId(psvId);
    }
    /**
     * èŽ·å–å·²åˆ†é…çš„éƒ¨é—¨
     * @param psvId
     * @return
     */
    @Override
    public List<MdcProduction> getDepartNonPermsByPsvId(String psvId){
        return super.baseMapper.getDepartNonPermsByPsvId(psvId);
    }
    /**
     * æŸ¥è¯¢éƒ¨é—¨æƒé™
     * @param psvId
     * @param departId
     * @return
     */
    @Override
    public ProcessSpecVersionDepartment getByProcessSpecVersionIdAndDepartId(String psvId, String departId){
        if(!ValidateUtil.validateString(psvId) || !ValidateUtil.validateString(psvId))
            return null;
        List<ProcessSpecVersionDepartment> list = super.lambdaQuery().eq(ProcessSpecVersionDepartment::getPsvId, psvId).eq(ProcessSpecVersionDepartment::getDepartId, departId).list();
        if(list == null || list.isEmpty())
            return null;
        return list.get(0);
    }
    /**
     * ç§»é™¤éƒ¨é—¨æƒé™
     * @param processSpecVersionDepartments
     * @return
     */
    @Override
    public boolean removeByCollection(List<ProcessSpecVersionDepartment> processSpecVersionDepartments){
        if(processSpecVersionDepartments == null || processSpecVersionDepartments.isEmpty())
            return false;
        if(processSpecVersionDepartments.size() == 1)
            return super.removeById(processSpecVersionDepartments.get(0).getId());
        List<String> ids = new ArrayList<>();
        processSpecVersionDepartments.forEach(item -> {
            ids.add(item.getId());
        });
        if(ids.size() > 1000){
            List<List<String>> idsArr = ListUtils.partition(ids, 1000);
            for(List<String> arr : idsArr){
                super.removeByIds(arr);
            }
            return true;
        }else {
            return super.removeByIds(ids);
        }
    }
    /**
     * æŸ¥è¯¢ä¸€ç»„部门权限
     * @param psvIds
     * @param ids
     * @return
     */
    @Override
    public List<ProcessSpecVersionDepartment> getByPsvIdsAndDepartIds(List<String> psvIds, List<String> ids){
        if(psvIds == null || psvIds.isEmpty() || ids == null || ids.isEmpty())
            return null;
        List<ProcessSpecVersionDepartment> total = new ArrayList<>();
        List<List<String>> compListArr;
        List<List<String>> departListArr;
        if(psvIds.size() > 1000){
            compListArr = ListUtils.partition(psvIds, 100);
        }else {
            compListArr = ListUtils.partition(psvIds, 1000);
        }
        if(ids.size() > 1000){
            departListArr = ListUtils.partition(ids, 100);
        }else {
            departListArr = ListUtils.partition(ids, 1000);
        }
        for(List<String> compList : compListArr) {
            for(List<String> departList : departListArr){
                LambdaQueryWrapper<ProcessSpecVersionDepartment> queryWrapper = Wrappers.lambdaQuery();
                queryWrapper.in(ProcessSpecVersionDepartment::getPsvId, compList);
                queryWrapper.in(ProcessSpecVersionDepartment::getDepartId, departList);
                List<ProcessSpecVersionDepartment> list = super.list(queryWrapper);
                if(list != null && !list.isEmpty()){
                    total.addAll(list);
                }
            }
        }
        return total;
    }
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionPermissionServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,128 @@
package org.jeecg.modules.dnc.service.impl;
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.commons.collections4.ListUtils;
import org.jeecg.modules.dnc.entity.PartsPermission;
import org.jeecg.modules.dnc.entity.ProcessSpecVersionPermission;
import org.jeecg.modules.dnc.entity.ProcessionPermission;
import org.jeecg.modules.dnc.entity.WorkStepPermission;
import org.jeecg.modules.dnc.mapper.ProcessSpecVersionPermissionMapper;
import org.jeecg.modules.dnc.service.IProcessSpecVersionPermissionService;
import org.jeecg.modules.dnc.ucenter.UserDepartExt;
import org.jeecg.modules.dnc.utils.ValidateUtil;
import org.jeecg.modules.system.entity.SysUser;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
@Service
public class ProcessSpecVersionPermissionServiceImpl extends ServiceImpl<ProcessSpecVersionPermissionMapper, ProcessSpecVersionPermission> implements IProcessSpecVersionPermissionService {
    /**
     * æ ¹æ®psvId å’ŒuserId æŸ¥æ‰¾æƒé™
     * @param psvId
     * @param userId
     * @return
     */
    @Override
    public ProcessSpecVersionPermission getByPsvIdAndUserId(String psvId, String userId){
        if(!ValidateUtil.validateString(psvId) || !ValidateUtil.validateString(userId))
            return null;
        List<ProcessSpecVersionPermission> permissions = super.lambdaQuery().eq(ProcessSpecVersionPermission::getPsvId, psvId).eq(ProcessSpecVersionPermission::getUserId, userId).list();
        if(permissions == null || permissions.isEmpty())
            return null;
        return permissions.get(0);
    }
    /**
     * æŸ¥è¯¢ä¸€ç»„权限
     * @param psvIds
     * @param ids
     * @return
     */
    @Override
    public List<ProcessSpecVersionPermission> getByPsvIdsAndUserIds(List<String> psvIds, List<String> ids){
        if(psvIds == null || psvIds.isEmpty() || ids == null || ids.isEmpty())
            return null;
        List<ProcessSpecVersionPermission> total = new ArrayList<>();
        List<List<String>> psvsListArr;
        List<List<String>> userListArr;
        if(psvIds.size() > 1000){
            psvsListArr = ListUtils.partition(psvIds, 100);
        }else {
            psvsListArr = ListUtils.partition(psvIds, 1000);
        }
        if(ids.size() > 1000){
            userListArr = ListUtils.partition(ids, 100);
        }else {
            userListArr = ListUtils.partition(ids, 1000);
        }
        for(List<String> compList : psvsListArr) {
            for(List<String> userList : userListArr){
                LambdaQueryWrapper<ProcessSpecVersionPermission> queryWrapper = Wrappers.lambdaQuery();
                queryWrapper.in(ProcessSpecVersionPermission::getPsvId, compList);
                queryWrapper.in(ProcessSpecVersionPermission::getUserId, userList);
                List<ProcessSpecVersionPermission> list = super.list(queryWrapper);
                if(list != null && !list.isEmpty()){
                    total.addAll(list);
                }
            }
        }
        return total;
    }
    /**
     * èŽ·å–å·²åˆ†é…çš„ç”¨æˆ·
     * @param psvId
     * @return
     */
    @Override
    public List<UserDepartExt> getUserPermsByProductId(String psvId){
        return super.baseMapper.getUserPermsBypsvId(psvId);
    }
    /**
     * èŽ·å–æœªåˆ†é…çš„ç”¨æˆ·
     * @param psvId
     * @return
     */
    @Override
    public List<SysUser> getUserNonPermsByProductId(String psvId){
        return super.baseMapper.getUserNonPermsBypsvId(psvId);
    }
    @Override
    @Transactional(rollbackFor = {Exception.class})
    public boolean deleteByPsvId(String psvId) {
        if(!ValidateUtil.validateString(psvId))
            return false;
        LambdaQueryWrapper<ProcessSpecVersionPermission> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.eq(ProcessSpecVersionPermission::getPsvId, psvId);
        return super.remove(lambdaQueryWrapper);
    }
    @Override
    @Transactional(rollbackFor = {Exception.class})
    public boolean removeByCollection(List<ProcessSpecVersionPermission> permissionList) {
        if(permissionList == null || permissionList.isEmpty())
            return false;
        if(permissionList.size() == 1)
            return super.removeById(permissionList.get(0).getId());
        List<String> ids = new ArrayList<>();
        permissionList.forEach(item -> {
            ids.add(item.getId());
        });
        if(ids.size() > 1000){
            List<List<String>> idsArr = ListUtils.partition(ids, 1000);
            for(List<String> arr : idsArr){
                super.removeByIds(arr);
            }
            return true;
        }else {
            return super.removeByIds(ids);
        }
    }
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,433 @@
package org.jeecg.modules.dnc.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
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.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.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@Service
public class ProcessSpecVersionServiceImpl extends ServiceImpl<ProcessSpecVersionMapper, ProcessSpecVersion> implements IProcessSpecVersionService{
    @Autowired
    private ProductInfoMapper productInfoMapper;
    @Autowired
    private ComponentInfoMapper componentInfoMapper;
    @Autowired
    private PartsInfoMapper processSpecVersionMapper;
    @Autowired
    private IPermissionStreamNewService permissionStreamNewService;
    @Autowired
    @Lazy
    private IProcessStreamService processStreamService;
    @Autowired
    private IProcessSpecVersionPermissionService processSpecVersionPermissionService;
    @Autowired
    private IProcessSpecVersionDepartmentService processSpecVersionDepartmentService;
    @Autowired
    private IProductPermissionService productPermissionService;
    /**
     * æ ¹æ®ç”¨æˆ·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.PARTS_NAME_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.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 processSpecVersion = processSpecVersionMapper.selectById(ProcessSpecVersion.getPartsId());
        if(processSpecVersion == null)
            ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST);
        boolean b = super.save(ProcessSpecVersion);
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        //添加部门权限
        List<PermissionStreamNew> oldDepartPermList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(ProcessSpecVersion.getPartsId(),"3","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("4");
                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,"4");
        if (!b) {
            ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR);
        }
        //添加用户权限
        PermissionStreamNew stream = new PermissionStreamNew();
        stream.setBusinessId(ProcessSpecVersion.getId());
        stream.setBusinessType("4");
        stream.setUserId(userId);
        return permissionStreamNewService.save(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);
        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,"4");
        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.PARTS_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(),"4","0");
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(processSpecVersion.getId(),"4","1");
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        return super.removeById(processSpecVersion.getId());
    }
    @Override
    public ProcessSpecVersion getByCode(String processSpecVersionCode) {
        if(ValidateUtil.validateString(processSpecVersionCode)) {
            List<ProcessSpecVersion> list = super.lambdaQuery().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;
    }
    /**
     * æ ¹æ®ä¸€ç»„é›¶ä»¶id获取
     * @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(),"4");
            if(stream == null) {
                stream = new PermissionStreamNew();
                stream.setUserId(item.getId());
                stream.setBusinessId(processSpecVersion.getId());
                stream.setBusinessType("4");
                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(),"4");
            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(),"4");
            if(stream == null) {
                stream = new PermissionStreamNew();
                stream.setDepartId(item.getId());
                stream.setBusinessId(processSpecVersion.getId());
                stream.setBusinessType("4");
                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;
    }
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java
@@ -8,6 +8,7 @@
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import liquibase.pro.packaged.P;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.dnc.exception.ExceptionCast;
@@ -40,14 +41,12 @@
    @Autowired
    private IProcessInfoService processInfoService;
    @Autowired
    private IPartsInfoService partsInfoService;
    @Autowired
    private IDocInfoService docInfoService;
    private IProcessSpecVersionService processSpecVersionService;
    @Autowired
    @Lazy
    private IDeviceInfoService deviceInfoService;
    @Autowired
    private IPermissionStreamService permissionStreamService;
    private IPermissionStreamNewService permissionStreamNewService;
    @Autowired
    private IProcessionDepartmentService processionDepartmentService;
    @Autowired
@@ -62,6 +61,7 @@
    @Override
    @Transactional(rollbackFor = {Exception.class})
    public boolean addProcessStream(ProcessStream stream) {
        List<PermissionStreamNew> oldDepartPermList=new ArrayList<>();
        if(stream == null)
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        if(!ValidateUtil.validateString(stream.getProductId()))
@@ -76,18 +76,19 @@
        String userId = user.getId();
        if(!ValidateUtil.validateString(userId))
            ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST);
        if(ValidateUtil.validateString(stream.getPartsId())) {
            PartsInfo partsInfo = partsInfoService.getById(stream.getPartsId());
            if(partsInfo == null)
                ExceptionCast.cast(ProcessInfoCode.PROCESS_PARTS_NONE);
            if(!stream.getProductId().equals(partsInfo.getProductId()))
        if(ValidateUtil.validateString(stream.getPsvId())) {
            ProcessSpecVersion psv = processSpecVersionService.getById(stream.getPsvId());
            if(psv == null)
                ExceptionCast.cast(ProcessInfoCode.PROCESSSPECVERSION_NONE);
            if(!stream.getProductId().equals(psv.getProductId()))
                ExceptionCast.cast(ProcessInfoCode.PROCESS_PRODUCT_NONE);
            if(!stream.getComponentId().equals(partsInfo.getComponentId()))
            if(!stream.getComponentId().equals(psv.getComponentId()))
                ExceptionCast.cast(ProcessInfoCode.PROCESS_COMPONENT_NONE);
            ProcessStream en = findByProcessNoAndPartsId(stream.getProcessCode(), partsInfo.getPartsId());
            ProcessStream en = findByProcessNoAndPartsId(stream.getProcessCode(), psv.getId());
            if(en != null) {
                ExceptionCast.cast(ProcessInfoCode.PROCESS_IS_EXIST);
            }
            oldDepartPermList=permissionStreamNewService.loadPermissionStreamNewByBusinessId(psv.getId(),"4","1");
        }else {
            ComponentInfo componentInfo = componentInfoService.getById(stream.getComponentId());
            if(componentInfo == null)
@@ -99,25 +100,48 @@
            if(en != null) {
                ExceptionCast.cast(ProcessInfoCode.PROCESS_IS_EXIST);
            }
            oldDepartPermList=permissionStreamNewService.loadPermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","1");
        }
        boolean b = super.save(stream);
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        //添加部门权限
        if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) {
            List<ProcessionDepartment> processionDepartmentList = new ArrayList<>();
            List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
            oldDepartPermList.forEach(item -> {
                ProcessionDepartment pd = new ProcessionDepartment();
                pd.setDepartId(item.getDepartId());
                pd.setProcessId(stream.getProcessId());
                processionDepartmentList.add(pd);
                PermissionStreamNew perm = new PermissionStreamNew();
                perm.setDepartId(item.getDepartId());
                perm.setBusinessId(stream.getProcessId());
                perm.setBusinessType("5");
                permissionStreamList.add(perm);
            });
            if(!processionDepartmentList.isEmpty()) {
                b = processionDepartmentService.saveBatch(processionDepartmentList);
                if(!b)
                    ExceptionCast.cast(CommonCode.FAIL);
            }
            if(!permissionStreamList.isEmpty()) {
                b = permissionStreamNewService.saveBatch(permissionStreamList);
                if(!b)
                    ExceptionCast.cast(CommonCode.FAIL);
            }
        }
        //添加用户权限
        b = productPermissionService.add(stream.getProcessId(), userId,"5");
        if (!b) {
            ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR);
        }
        //添加权限验证
        PermissionStream permissionStream = new PermissionStream();
        PermissionStreamNew permissionStream = new PermissionStreamNew();
        permissionStream.setUserId(userId);
        permissionStream.setProductId(stream.getProductId());
        permissionStream.setComponentId(stream.getComponentId());
        if (StrUtil.isNotEmpty(stream.getPartsId())){
            permissionStream.setPartsId(stream.getPartsId());
        }
        permissionStream.setProcessId(stream.getProcessId());
        return permissionStreamService.save(permissionStream);
        permissionStream.setBusinessId(stream.getProcessId());
        permissionStream.setBusinessType("5");
        return permissionStreamNewService.save(permissionStream);
    }
    @Override
@@ -190,13 +214,13 @@
    }
    @Override
    public List<ProcessStream> findByPartsId(String partsId) {
        return super.lambdaQuery().eq(ProcessStream::getPartsId, partsId).list();
    public List<ProcessStream> findBypsvId(String psvId) {
        return super.lambdaQuery().eq(ProcessStream::getPsvId, psvId).list();
    }
    @Override
    public ProcessStream findByProcessNoAndPartsId(String processNo, String partsId) {
        List<ProcessStream> list = super.lambdaQuery().eq(ProcessStream::getPartsId, partsId).eq(ProcessStream::getProcessCode, processNo).list();
    public ProcessStream findByProcessNoAndPartsId(String processNo, String psvsId) {
        List<ProcessStream> list = super.lambdaQuery().eq(ProcessStream::getPsvId, psvsId).eq(ProcessStream::getProcessCode, processNo).list();
        if(list == null || list.isEmpty())
            return null;
        return list.get(0);
@@ -262,7 +286,7 @@
        if(processStream == null || departmentList == null || departmentList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<ProcessionDepartment> processionDepartmentList = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        departmentList.forEach(item -> {
            ProcessionDepartment en = processionDepartmentService.getByProcessIdAndDepartId(processStream.getProcessId(), item.getId());
            if(en == null) {
@@ -271,14 +295,12 @@
                en.setProcessId(processStream.getProcessId());
                processionDepartmentList.add(en);
            }
            PermissionStream stream = permissionStreamService.getByProcessIdAndDepartId(processStream.getProductId(), processStream.getComponentId(), processStream.getPartsId(),processStream.getProcessId(),item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processStream.getProcessId(),item.getId(),"5");
            if(stream == null) {
                stream = new PermissionStream();
                stream = new PermissionStreamNew();
                stream.setDepartId(item.getId());
                stream.setProductId(processStream.getProductId());
                stream.setComponentId(processStream.getComponentId());
                stream.setPartsId(processStream.getPartsId());
                stream.setProcessId(processStream.getProcessId());
                stream.setBusinessId(processStream.getProcessId());
                stream.setBusinessType("5");
                permissionStreamList.add(stream);
            }
        });
@@ -289,7 +311,7 @@
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.saveBatch(permissionStreamList);
            boolean b = permissionStreamNewService.saveBatch(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
@@ -314,14 +336,13 @@
        if(processStream == null || departmentList == null || departmentList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<ProcessionDepartment> processionDepartmentList = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        departmentList.forEach(item -> {
            ProcessionDepartment en = processionDepartmentService.getByProcessIdAndDepartId(processStream.getProcessId(), item.getId());
            if(en != null) {
                processionDepartmentList.add(en);
            }
            PermissionStream stream = permissionStreamService.getByProcessIdAndDepartId(processStream.getProductId(), processStream.getComponentId(), processStream.getPartsId()
                    ,processStream.getProcessId(), item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processStream.getProcessId(),item.getId(),"5");
            if(stream != null) {
                permissionStreamList.add(stream);
            }
@@ -333,7 +354,7 @@
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.removeByCollection(permissionStreamList);
            boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
@@ -347,7 +368,7 @@
        if(processStream == null || userList == null || userList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<ProcessionPermission> permissionList = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        userList.forEach(item -> {
            ProcessionPermission en = processStreamPermissionService.getByProcessIdAndUserId(processStream.getProcessId(), item.getId());
            if(en == null) {
@@ -356,14 +377,12 @@
                en.setProcessId(processStream.getProcessId());
                permissionList.add(en);
            }
            PermissionStream stream = permissionStreamService.getByProcessIdAndUserId(processStream.getProductId(), processStream.getComponentId(), processStream.getPartsId(),processStream.getProcessId(), item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), item.getId(),"5");
            if(stream == null) {
                stream = new PermissionStream();
                stream = new PermissionStreamNew();
                stream.setUserId(item.getId());
                stream.setProductId(processStream.getProductId());
                stream.setComponentId(processStream.getComponentId());
                stream.setPartsId(processStream.getPartsId());
                stream.setProcessId(processStream.getProcessId());
                stream.setBusinessId(processStream.getProcessId());
                stream.setBusinessType("5");
                permissionStreamList.add(stream);
            }
        });
@@ -374,7 +393,7 @@
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.saveBatch(permissionStreamList);
            boolean b = permissionStreamNewService.saveBatch(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
@@ -388,13 +407,13 @@
        if(processStream == null || userList == null || userList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<ProcessionPermission> permissionList = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        userList.forEach(item -> {
            ProcessionPermission en = processStreamPermissionService.getByProcessIdAndUserId(processStream.getProcessId(), item.getId());
            if(en != null) {
                permissionList.add(en);
            }
            PermissionStream stream = permissionStreamService.getByProcessIdAndUserId(processStream.getProductId(), processStream.getComponentId(), processStream.getPartsId(),processStream.getProcessId(), item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), item.getId(),"5");
            if(stream != null) {
                permissionStreamList.add(stream);
            }
@@ -407,7 +426,7 @@
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.removeByCollection(permissionStreamList);
            boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessionDepartmentService.java
@@ -1,21 +1,16 @@
package org.jeecg.modules.dnc.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
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.commons.collections4.ListUtils;
import org.jeecg.modules.dnc.entity.PartsDepartment;
import org.jeecg.modules.dnc.entity.ProcessStream;
import org.jeecg.modules.dnc.entity.ProcessionDepartment;
import org.jeecg.modules.dnc.mapper.ProcessionDepartmentMapper;
import org.jeecg.modules.dnc.service.IProcessionDepartmentService;
import org.jeecg.modules.dnc.ucenter.Department;
import org.jeecg.modules.system.entity.MdcProduction;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.function.Function;
@Service
public class ProcessionDepartmentService extends ServiceImpl<ProcessionDepartmentMapper, ProcessionDepartment> implements IProcessionDepartmentService {
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java
@@ -1,15 +1,15 @@
package org.jeecg.modules.dnc.service.impl;
import cn.hutool.core.util.StrUtil;
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;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import liquibase.pro.packaged.S;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.dnc.dto.ComponentExt;
import org.jeecg.modules.dnc.exception.ExceptionCast;
import org.jeecg.modules.dnc.mapper.ProcessSpecVersionPermissionMapper;
import org.jeecg.modules.dnc.mapper.ProductInfoMapper;
import org.jeecg.modules.dnc.response.*;
import org.jeecg.modules.dnc.service.*;
@@ -26,6 +26,8 @@
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import redis.clients.jedis.Jedis;
import java.util.*;
import java.util.stream.Collectors;
@@ -39,11 +41,13 @@
    @Lazy
    private IPartsInfoService partsInfoService;
    @Autowired
    private IProcessSpecVersionService processSpecVersionService;
    @Autowired
    private IProductPermissionService productPermissionService;
    @Autowired
    private IProductDepartmentService productDepartmentService;
    @Autowired
    private IPermissionStreamService permissionStreamService;
    private IPermissionStreamNewService permissionStreamNewService;
    @Autowired
    private IComponentDepartmentService componentDepartmentService;
    @Autowired
@@ -52,6 +56,10 @@
    private IPartsDepartmentService partsDepartmentService;
    @Autowired
    private IPartsPermissionService partsPermissionService;
    @Autowired
    private IProcessSpecVersionPermissionService processSpecVersionPermissionService;
    @Autowired
    private IProcessSpecVersionDepartmentService processSpecVersionDepartmentService;
    @Autowired
    private ISysUserService userService;
    @Autowired
@@ -98,10 +106,11 @@
        if (!b) {
            ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR);
        }
        PermissionStream stream = new PermissionStream();
        stream.setProductId(productInfo.getProductId());
        PermissionStreamNew stream = new PermissionStreamNew();
        stream.setBusinessId(productInfo.getProductId());
        stream.setUserId(userId);
        return permissionStreamService.save(stream);
        stream.setBusinessType("1");
        return permissionStreamNewService.save(stream);
    }
    @Override
@@ -131,12 +140,13 @@
                return false;
            }
        }
        PermissionStream stream = permissionStreamService.getByProductIdAndUserId(id, userId);
        PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId, "1");
        if (stream == null) {
            stream = new PermissionStream();
            stream.setProductId(id);
            stream = new PermissionStreamNew();
            stream.setBusinessId(productInfo.getProductId());
            stream.setUserId(userId);
            return permissionStreamService.save(stream);
            stream.setBusinessType("1");
            return permissionStreamNewService.save(stream);
        }
        return b;
    }
@@ -155,6 +165,10 @@
        List<PartsInfo> partsInfos = partsInfoService.getByUserPerms(userId);
        if (partsInfos == null)
            partsInfos = Collections.emptyList();
        //工艺规程版本
        List<ProcessSpecVersion> processSpecVersions = processSpecVersionService.getByUserPerms(userId);
        if (processSpecVersions == null)
            processSpecVersions = Collections.emptyList();
        //工序
        List<ProcessStream> processStreams = processStreamService.getByuserPerms(userId);
        if (processStreams == null)
@@ -163,7 +177,7 @@
        List<WorkStep> workStepList = workStepService.getByUserPerms(userId);
        if (workStepList == null)
            workStepList = Collections.emptyList();
        return ProductTreeWrapper.loadTree(productInfoList, componentInfoList, partsInfos, processStreams, workStepList);
        return ProductTreeWrapper.loadTree(productInfoList, componentInfoList, partsInfos, processSpecVersions,processStreams, workStepList);
    }
    @Override
@@ -219,10 +233,10 @@
        b = productDepartmentService.deleteByProductId(id);
        if (!b)
            ExceptionCast.cast(CommonCode.FAIL);
        b = permissionStreamService.deleteUserPermsByProductId(id);
        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(id, "1","0");
        if (!b)
            ExceptionCast.cast(CommonCode.FAIL);
        b = permissionStreamService.deleteDepartPermsByProductId(id);
        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(id, "1","1");
        if (!b)
            ExceptionCast.cast(CommonCode.FAIL);
        return super.removeById(id);
@@ -240,33 +254,37 @@
            ProductInfo productInfo = super.getById(paramId);
            if (productInfo == null)
                ExceptionCast.cast(ProductInfoCode.PRODUCT_NOT_EXIST);
            PermissionStream permission = permissionStreamService.getByProductIdAndUserId(paramId, userId);
            PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(paramId, userId,"1");
            return permission != null;
        } else if (nodeType == 2) {
            ComponentInfo componentInfo = componentInfoService.getById(paramId);
            if (componentInfo == null)
                ExceptionCast.cast(ComponentInfoCode.COMPONENT_NOT_EXIST);
            PermissionStream permission = permissionStreamService.getByComponentIdAndUserId(componentInfo.getProductId(), paramId, userId);
            PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(componentInfo.getComponentId(), userId,"2");
            return permission != null;
        } else if (nodeType == 3) {
            PartsInfo partsInfo = partsInfoService.getById(paramId);
            if (partsInfo == null)
                ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST);
            PermissionStream permission = permissionStreamService.getByPartsIdAndUserId(partsInfo.getProductId(), partsInfo.getComponentId(), paramId, userId);
            PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), userId, "3");
            return permission != null;
        } else if (nodeType == 4) {
            ProcessSpecVersion processSpecVersion = processSpecVersionService.getById(paramId);
            if (processSpecVersion == null)
                ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_NOT_EXIST);
            PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processSpecVersion.getId(),userId,"4");
            return permission != null;
        } else if (nodeType == 5) {
            ProcessStream processStream = processStreamService.getById(paramId);
            if (processStream == null)
                ExceptionCast.cast(ProcessInfoCode.PROCESS_NOT_EXIST);
            PermissionStream permission = permissionStreamService.getByProcessIdAndUserId(processStream.getProductId(), processStream.getComponentId()
                    , processStream.getPartsId(), processStream.getProcessId(), userId);
            PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), userId,"5");
            return permission != null;
        } else if (nodeType == 6) {
            WorkStep workStep = workStepService.getById(paramId);
            if (workStep == null)
                ExceptionCast.cast(ProcessInfoCode.WORKSTEP_NOT_EXIST);
            PermissionStream permission = permissionStreamService.getByStepIdAndUserId(workStep.getProductId(), workStep.getComponentId()
                    , workStep.getPartsId(), workStep.getProcessId(), workStep.getId(), userId);
            PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(workStep.getId(), userId,"6");
            return permission != null;
        }
        return false;
@@ -282,6 +300,8 @@
            return componentPermissionService.getUserPermsByComponentId(paramId);
        } else if (nodeType == 3) {
            return partsPermissionService.getUserPermsByProductId(paramId);
        } else if (nodeType == 4) {
            return processSpecVersionPermissionService.getUserPermsByProductId(paramId);
        } else if (nodeType == 5) {
            return iProcessStreamPermissionService.getUserPermsByProductId(paramId);
        } else if (nodeType == 6) {
@@ -301,6 +321,8 @@
            return componentPermissionService.getUserNonPermsByComponentId(paramId);
        } else if (nodeType == 3) {
            return partsPermissionService.getUserNonPermsByProductId(paramId);
        } else if (nodeType == 4) {
            return processSpecVersionPermissionService.getUserNonPermsByProductId(paramId);
        } else if (nodeType == 5) {
            return iProcessStreamPermissionService.getUserNonPermsByProductId(paramId);
        } else if (nodeType == 6) {
@@ -320,12 +342,13 @@
            return componentDepartmentService.getDepartPermsByComponentId(paramId);
        } else if (nodeType == 3) {
            return partsDepartmentService.getDepartPermsByPartsId(paramId);
        } else if (nodeType == 5) {
        } else if (nodeType == 4) {
            return processSpecVersionDepartmentService.getDepartPermsByPsvId(paramId);
        }else if (nodeType == 5) {
            return processionDepartmentService.getDepartPermsByProcessId(paramId);
        } else if (nodeType == 6) {
            return workStepDepartmentService.getDepartPermsByStepId(paramId);
        }
        //todo å°è£…树状结构
        else {
            return null;
        }
@@ -341,6 +364,8 @@
            return componentDepartmentService.getDepartNonPermsByComponentId(paramId);
        } else if (nodeType == 3) {
            return partsDepartmentService.getDepartNonPermsByProductId(paramId);
        } else if (nodeType == 4) {
            return processionDepartmentService.getDepartNonPermsByProcessId(paramId);
        } else if (nodeType == 5) {
            return processionDepartmentService.getDepartNonPermsByProcessId(paramId);
        } else if (nodeType == 6) {
@@ -367,16 +392,19 @@
        Collection<SysUser> userList = userService.listByIds(ids);
        validateSysUserList(userList, ids);
        switch (nodeType) {
            case 6:
                return handleWorkStep(paramId, null,userList);
            case 5:
                return handleProcessStream(paramId, relativeFlag, null,userList);
            case 3:
                return handlePartsInfo(paramId, relativeFlag, null,userList);
            case 1:
                return handleProductInfo(paramId, relativeFlag, null,userList);
            case 2:
                return handleComponentInfo(paramId, relativeFlag, null,userList);
            case 3:
                return handlePartsInfo(paramId, relativeFlag, null,userList);
            case 4:
                return handleProcessSpecVersion(paramId, relativeFlag, null,userList);
            case 5:
                return handleProcessStream(paramId, relativeFlag, null,userList);
            case 6:
                return handleWorkStep(paramId, null,userList);
            default:
                return false;
        }
@@ -395,19 +423,23 @@
        validateInputParameters(nodeType, paramId, relativeFlag, "2", departmentIds);
        List<String> ids = new ArrayList<>(departmentIds.length);
        Collections.addAll(ids, departmentIds);
        Collection<MdcProduction> mdcProductionList = mdcProductionService.listByIds(ids);
        validateMdcProductionList(mdcProductionList, ids);
        List<String> deps=mdcProductionService.findAllProductionIds(ids);
        Collection<MdcProduction> mdcProductionList = mdcProductionService.listByIds(deps);
        validateMdcProductionList(mdcProductionList, deps);
        switch (nodeType) {
            case 6:
                return handleWorkStep(paramId, mdcProductionList,null);
            case 5:
                return handleProcessStream(paramId, relativeFlag, mdcProductionList,null);
            case 3:
                return handlePartsInfo(paramId, relativeFlag, mdcProductionList,null);
            case 1:
                return handleProductInfo(paramId, relativeFlag, mdcProductionList,null);
            case 2:
                return handleComponentInfo(paramId, relativeFlag, mdcProductionList,null);
            case 3:
                return handlePartsInfo(paramId, relativeFlag, mdcProductionList,null);
            case 4:
                return handleProcessSpecVersion(paramId, relativeFlag, mdcProductionList,null);
            case 5:
                return handleProcessStream(paramId, relativeFlag, mdcProductionList,null);
            case 6:
                return handleWorkStep(paramId, mdcProductionList,null);
            default:
                return false;
        }
@@ -428,16 +460,18 @@
        Collection<SysUser> userList = userService.listByIds(userIdsList);
        validateSysUserList(userList, userIdsList);
        switch (nodeType) {
            case 6:
                return handleWorkStepRemoval(paramId, userList,null);
            case 5:
                return handleProcessStreamRemoval(paramId, relativeFlag, userList,null);
            case 3:
                return handlePartsInfoRemoval(paramId, relativeFlag, userList,null);
            case 1:
                return handleProductInfoRemoval(paramId, relativeFlag, userList,null);
            case 2:
                return handleComponentInfoRemoval(paramId, relativeFlag, userList,null);
            case 3:
                return handlePartsInfoRemoval(paramId, relativeFlag, userList,null);
            case 4:
                return handleProcessSpecVersionRemoval(paramId, relativeFlag, userList,null);
            case 5:
                return handleProcessStreamRemoval(paramId, relativeFlag, userList,null);
            case 6:
                return handleWorkStepRemoval(paramId, userList,null);
            default:
                return false;
        }
@@ -456,20 +490,24 @@
    @Transactional(rollbackFor = {Exception.class})
    public boolean assignRemoveDepartmentAll(Integer nodeType, String paramId, Integer relativeFlag, String[] departmentIds) {
        validateInputParameters(nodeType, paramId, relativeFlag, "2", departmentIds);
        List<String> departmentIdList = Arrays.asList(departmentIds);
        Collection<MdcProduction> mdcProductionList = mdcProductionService.listByIds(departmentIdList);
        validateMdcProductionList(mdcProductionList, departmentIdList);
        List<String> ids = new ArrayList<>(departmentIds.length);
        Collections.addAll(ids, departmentIds);
        List<String> deps=mdcProductionService.findAllProductionIds(ids);
        Collection<MdcProduction> mdcProductionList = mdcProductionService.listByIds(deps);
        validateMdcProductionList(mdcProductionList, deps);
        switch (nodeType) {
            case 6:
                return handleWorkStepRemoval(paramId,null,mdcProductionList);
            case 5:
                return handleProcessStreamRemoval(paramId, relativeFlag, null,mdcProductionList);
            case 3:
                return handlePartsInfoRemoval(paramId, relativeFlag,null, mdcProductionList);
            case 1:
                return handleProductInfoRemoval(paramId, relativeFlag,null, mdcProductionList);
            case 2:
                return handleComponentInfoRemoval(paramId, relativeFlag, null,mdcProductionList);
            case 3:
                return handlePartsInfoRemoval(paramId, relativeFlag,null, mdcProductionList);
            case 4:
                return handleProcessSpecVersionRemoval(paramId, relativeFlag, null,mdcProductionList);
            case 5:
                return handleProcessStreamRemoval(paramId, relativeFlag, null,mdcProductionList);
            case 6:
                return handleWorkStepRemoval(paramId,null,mdcProductionList);
            default:
                return false;
        }
@@ -481,7 +519,7 @@
        if (productInfo == null || userList == null || userList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<ProductPermission> permissionList = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        userList.forEach(item -> {
            ProductPermission en = productPermissionService.getByProductIdAndUserId(productInfo.getProductId(), item.getId());
            if (en == null) {
@@ -490,11 +528,12 @@
                en.setProductId(productInfo.getProductId());
                permissionList.add(en);
            }
            PermissionStream stream = permissionStreamService.getByProductIdAndUserId(productInfo.getProductId(), item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(productInfo.getProductId(), item.getId(),"1");
            if (stream == null) {
                stream = new PermissionStream();
                stream = new PermissionStreamNew();
                stream.setUserId(item.getId());
                stream.setProductId(productInfo.getProductId());
                stream.setBusinessId(productInfo.getProductId());
                stream.setBusinessType("1");
                permissionStreamList.add(stream);
            }
        });
@@ -505,7 +544,7 @@
            }
        }
        if (!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.saveBatch(permissionStreamList);
            boolean b =permissionStreamNewService.saveBatch(permissionStreamList);
            if (!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
@@ -519,13 +558,13 @@
        if (productInfo == null || userList == null || userList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<ProductPermission> permissionList = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        userList.forEach(item -> {
            ProductPermission en = productPermissionService.getByProductIdAndUserId(productInfo.getProductId(), item.getId());
            if (en != null) {
                permissionList.add(en);
            }
            PermissionStream stream = permissionStreamService.getByProductIdAndUserId(productInfo.getProductId(), item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(productInfo.getProductId(), item.getId(),"1");
            if (stream != null) {
                permissionStreamList.add(stream);
            }
@@ -541,7 +580,7 @@
            }
        }
        if (!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.removeByCollection(permissionStreamList);
            boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList);
            if (!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
@@ -555,7 +594,7 @@
        if (productInfo == null || departmentList == null || departmentList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<ProductDepartment> productDepartmentList = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        departmentList.forEach(item -> {
            ProductDepartment en = productDepartmentService.getByProductIdAndDepartId(productInfo.getProductId(), item.getId());
            if (en == null) {
@@ -564,11 +603,12 @@
                en.setProductId(productInfo.getProductId());
                productDepartmentList.add(en);
            }
            PermissionStream stream = permissionStreamService.getByProductIdAndDepartId(productInfo.getProductId(), item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(productInfo.getProductId(), item.getId(),"1");
            if (stream == null) {
                stream = new PermissionStream();
                stream = new PermissionStreamNew();
                stream.setDepartId(item.getId());
                stream.setProductId(productInfo.getProductId());
                stream.setBusinessId(productInfo.getProductId());
                stream.setBusinessType("1");
                permissionStreamList.add(stream);
            }
        });
@@ -579,7 +619,7 @@
            }
        }
        if (!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.saveBatch(permissionStreamList);
            boolean b = permissionStreamNewService.saveBatch(permissionStreamList);
            if (!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
@@ -593,13 +633,13 @@
        if (productInfo == null || departmentList == null || departmentList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<ProductDepartment> productDepartmentList = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        departmentList.forEach(item -> {
            ProductDepartment en = productDepartmentService.getByProductIdAndDepartId(productInfo.getProductId(), item.getId());
            if (en != null) {
                productDepartmentList.add(en);
            }
            PermissionStream stream = permissionStreamService.getByProductIdAndDepartId(productInfo.getProductId(), item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(productInfo.getProductId(), item.getId(),"1");
            if (stream != null) {
                permissionStreamList.add(stream);
            }
@@ -611,7 +651,7 @@
            }
        }
        if (!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.removeByCollection(permissionStreamList);
            boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList);
            if (!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
@@ -627,11 +667,7 @@
            ProcessStream processStream = processStreamService.getById(paramId);
            if (processStream == null)
                return null;
            List<PermissionStream> permissionStreamList = permissionStreamService.list(new QueryWrapper<PermissionStream>()
                    .eq(StrUtil.isNotEmpty(processStream.getProductId()), "product_id", processStream.getProductId())
                    .eq(StrUtil.isNotEmpty(processStream.getComponentId()), "component_id", processStream.getComponentId())
                    .eq(StrUtil.isNotEmpty(processStream.getPartsId()), "parts_id", processStream.getPartsId())
                    .eq(StrUtil.isNotEmpty(processStream.getProcessId()), "process_id", processStream.getProcessId()));
            List<PermissionStreamNew> permissionStreamList = permissionStreamNewService.loadProductMixByBusinessId(processStream.getProcessId(),"5");
            if (permissionStreamList == null || permissionStreamList.isEmpty())
                return null;
            permissionStreamList.forEach(item -> {
@@ -642,12 +678,7 @@
            WorkStep workStep = workStepService.getById(paramId);
            if (workStep == null)
                return null;
            List<PermissionStream> permissionStreamList = permissionStreamService.list(new QueryWrapper<PermissionStream>()
                    .eq(StrUtil.isNotEmpty(workStep.getProductId()), "product_id", workStep.getProductId())
                    .eq(StrUtil.isNotEmpty(workStep.getComponentId()), "component_id", workStep.getComponentId())
                    .eq(StrUtil.isNotEmpty(workStep.getPartsId()), "parts_id", workStep.getPartsId())
                    .eq(StrUtil.isNotEmpty(workStep.getProcessId()), "process_id", workStep.getProcessId())
                    .eq(StrUtil.isNotEmpty(workStep.getId()), "step_id", workStep.getId()));
            List<PermissionStreamNew> permissionStreamList = permissionStreamNewService.loadProductMixByBusinessId(workStep.getId(),"6");
            if (permissionStreamList == null || permissionStreamList.isEmpty())
                return null;
            permissionStreamList.forEach(item -> {
@@ -752,6 +783,7 @@
        List<ProductInfo> productInfos = this.getByUserPerms(userId, queryParam);
        List<ComponentInfo> componentInfos = componentInfoService.getByUserPerms(userId, queryParam);
        List<PartsInfo> partsInfos = partsInfoService.getByUserPerms(userId, null, queryParam);
        List<ProcessSpecVersion> processSpecVersions = processSpecVersionService.getByUserPerms(userId, queryParam);
        List<ProcessStream> processStreams = processStreamService.getByuserPerms(userId, queryParam);
        List<WorkStep> workSteps = workStepService.getByUserPerms(userId, queryParam);
        List<ComponentInfo> componentInfoList = new ArrayList<>();
@@ -879,7 +911,7 @@
        //转换数据
        List<ComponentExt> componentExtList = ComponentExt.convertToExtList(componentInfoList);
        return ProductTreeWrapper.loadTree(productInfoList, componentExtList, partsInfos, processStreams, workSteps);
        return ProductTreeWrapper.loadTree(productInfoList, componentExtList, partsInfos,processSpecVersions, processStreams, workSteps);
    }
    @Override
@@ -894,6 +926,9 @@
            //零件
            case 3:
                return partsInfoService.deletePartsInfo(id);
            //工艺规程版本
            case 4:
                return processSpecVersionService.deleteProcessSpecVersion(id);
            //工序
            case 5:
                return processStreamService.deleteProcessStream(id);
@@ -940,13 +975,13 @@
        }
    }
    private void handleRelativePermissions(String productId, List<String> componentIds, String processId, String partsId, Collection<SysUser> userList) {
    private void handleRelativePermissions(String productId, List<String> componentIds, String processId, String partsId,String psvId ,Collection<SysUser> userList) {
        List<ComponentPermission> componentPermissionList = new ArrayList<>();
        List<PartsPermission> partsPermissionList = new ArrayList<>();
        List<ProcessSpecVersionPermission> processSpecVersionPermissionList = new ArrayList<>();
        List<ProcessionPermission> processionPermissionList = new ArrayList<>();
        List<WorkStepPermission> workStepPermissionList = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        // å¤„理部件权限
        if (componentIds != null && !componentIds.isEmpty()) {
            handleComponentPermissions(componentIds, userList, componentPermissionList, permissionStreamList);
@@ -956,9 +991,28 @@
                        .map(PartsInfo::getPartsId)
                        .collect(Collectors.toList());
                handlePartsPermissions(partsIds, userList, partsPermissionList, permissionStreamList);
                List<String> psvIds = processSpecVersionService.getByPartsIds(partsIds).stream().map(ProcessSpecVersion::getId).collect(Collectors.toList());
                handlePsvPermissions(psvIds, userList, processSpecVersionPermissionList, permissionStreamList);
                List<ProcessStream> processStreamList = processStreamService.getByComponentIdList(productId, componentIds, partsIds);
                processStreamApi(productId, userList, processionPermissionList, workStepPermissionList, permissionStreamList, processStreamList);
            }
        }
        // å¤„理零件权限
        if (partsId != null) {
            List<ProcessSpecVersion> processStreamList = processSpecVersionService.list(new QueryWrapper<ProcessSpecVersion>().eq("id", psvId));
            if (processStreamList != null && !processStreamList.isEmpty()) {
                List<String> psvIds = processStreamList.stream()
                        .map(ProcessSpecVersion::getId)
                        .collect(Collectors.toList());
                handlePsvPermissions(psvIds,userList,processSpecVersionPermissionList,permissionStreamList);
            }
        }
        // å¤„理工艺规程版本权限
        if (psvId!= null) {
            List<ProcessStream> processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("psv_id", psvId));
            processStreamApi(productId, userList, processionPermissionList, workStepPermissionList, permissionStreamList, processStreamList);
        }
        // å¤„理工序权限
@@ -972,17 +1026,14 @@
            }
        }
        // å¤„理零件权限
        if (partsId != null) {
            List<ProcessStream> processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("parts_id", partsId));
            processStreamApi(productId, userList, processionPermissionList, workStepPermissionList, permissionStreamList, processStreamList);
        }
        if (!componentPermissionList.isEmpty()) {
            componentPermissionService.saveBatch(componentPermissionList);
        }
        if (!partsPermissionList.isEmpty()) {
            partsPermissionService.saveBatch(partsPermissionList);
        }
        if (!processSpecVersionPermissionList.isEmpty()) {
            processSpecVersionPermissionService.saveBatch(processSpecVersionPermissionList);
        }
        if (!processionPermissionList.isEmpty()) {
            iProcessStreamPermissionService.saveBatch(processionPermissionList);
@@ -991,11 +1042,12 @@
            iWorkStepPermissionService.saveBatch(workStepPermissionList);
        }
        if (!permissionStreamList.isEmpty()) {
            permissionStreamService.saveBatch(permissionStreamList);
            permissionStreamNewService.saveBatch(permissionStreamList);
        }
    }
    private void processStreamApi(String productId, Collection<SysUser> userList, List<ProcessionPermission> processionPermissionList, List<WorkStepPermission> workStepPermissionList, List<PermissionStream> permissionStreamList, List<ProcessStream> processStreamList) {
    private void processStreamApi(String productId, Collection<SysUser> userList, List<ProcessionPermission> processionPermissionList,
                                  List<WorkStepPermission> workStepPermissionList, List<PermissionStreamNew> permissionStreamList, List<ProcessStream> processStreamList) {
        if (processStreamList != null && !processStreamList.isEmpty()) {
            List<String> processIds = processStreamList.stream()
                    .map(ProcessStream::getProcessId)
@@ -1012,7 +1064,7 @@
    }
    private void handleComponentPermissions(List<String> componentIds, Collection<SysUser> userList,
                                            List<ComponentPermission> componentPermissionList, List<PermissionStream> permissionStreamList) {
                                            List<ComponentPermission> componentPermissionList, List<PermissionStreamNew> permissionStreamList) {
        Map<String, ComponentPermission> componentPermissionMap = new HashMap<>();
        Map<String, ComponentInfo> componentInfoMap = new HashMap<>();
        String key;
@@ -1034,16 +1086,16 @@
            ComponentPermission cp = entry.getValue();
            componentPermissionList.add(cp);
            ComponentInfo cpInfo = componentInfoMap.get(cp.getComponentId());
            PermissionStream s = new PermissionStream();
            s.setProductId(cpInfo.getProductId());
            s.setComponentId(cpInfo.getComponentId());
            PermissionStreamNew s = new PermissionStreamNew();
            s.setBusinessId(cpInfo.getProductId());
            s.setBusinessType("1");
            s.setUserId(cp.getUserId());
            permissionStreamList.add(s);
        }
    }
    private void handlePartsPermissions(List<String> partsIds, Collection<SysUser> userList,
                                        List<PartsPermission> partsPermissionList, List<PermissionStream> permissionStreamList) {
                                        List<PartsPermission> partsPermissionList, List<PermissionStreamNew> permissionStreamList) {
        Map<String, PartsPermission> partsPermissionHashMap = new HashMap<>();
        Map<String, PartsInfo> partsInfoMap = new HashMap<>();
        String key;
@@ -1065,17 +1117,47 @@
            PartsPermission pp = entry.getValue();
            partsPermissionList.add(pp);
            PartsInfo ptInfo = partsInfoMap.get(pp.getPartsId());
            PermissionStream s = new PermissionStream();
            s.setProductId(ptInfo.getProductId());
            s.setComponentId(ptInfo.getComponentId());
            s.setPartsId(ptInfo.getPartsId());
            PermissionStreamNew s = new PermissionStreamNew();
            s.setBusinessId(ptInfo.getPartsId());
            s.setBusinessType("3");
            s.setUserId(pp.getUserId());
            permissionStreamList.add(s);
        }
    }
    private void handlePsvPermissions(List<String> psvIds, Collection<SysUser> userList,
                                        List<ProcessSpecVersionPermission> processSpecVersionPermissionList, List<PermissionStreamNew> permissionStreamList) {
        Map<String, ProcessSpecVersionPermission> processSpecVersionPermissionMap = new HashMap<>();
        Map<String, ProcessSpecVersion> processStreamMap = new HashMap<>();
        String key;
        for (ProcessSpecVersion p : processSpecVersionService.listByIds(psvIds)) {
            processStreamMap.put(p.getId(), p);
            for (SysUser u : userList) {
                key = p.getId() + "," + u.getId();
                processSpecVersionPermissionMap.put(key, new ProcessSpecVersionPermission(p.getId(), u.getId()));
            }
        }
        List<ProcessSpecVersionPermission> processSpecVersionPermissions = processSpecVersionPermissionService.getByPsvIdsAndUserIds(psvIds, userList.stream().map(SysUser::getId).collect(Collectors.toList()));
        if (processSpecVersionPermissions != null && !processSpecVersionPermissions.isEmpty()) {
            for (ProcessSpecVersionPermission processionPermission : processSpecVersionPermissions) {
                key = processionPermission.getPsvId() + "," + processionPermission.getUserId();
                processSpecVersionPermissionMap.remove(key);
            }
        }
        for (Map.Entry<String, ProcessSpecVersionPermission> entry : processSpecVersionPermissionMap.entrySet()) {
            ProcessSpecVersionPermission pp = entry.getValue();
            processSpecVersionPermissionList.add(pp);
            ProcessSpecVersion processSpecVersion = processStreamMap.get(pp.getPsvId());
            PermissionStreamNew s = new PermissionStreamNew();
            s.setBusinessId(processSpecVersion.getId());
            s.setBusinessType("4");
            s.setUserId(pp.getUserId());
            permissionStreamList.add(s);
        }
    }
    private void handleProcessPermissions(List<String> processIds, Collection<SysUser> userList,
                                          List<ProcessionPermission> processionPermissionList, List<PermissionStream> permissionStreamList) {
                                          List<ProcessionPermission> processionPermissionList, List<PermissionStreamNew> permissionStreamList) {
        Map<String, ProcessionPermission> processionPermissionHashMap = new HashMap<>();
        Map<String, ProcessStream> processStreamMap = new HashMap<>();
        String key;
@@ -1097,18 +1179,16 @@
            ProcessionPermission pp = entry.getValue();
            processionPermissionList.add(pp);
            ProcessStream processStream = processStreamMap.get(pp.getProcessId());
            PermissionStream s = new PermissionStream();
            s.setProductId(processStream.getProductId());
            s.setComponentId(processStream.getComponentId());
            s.setPartsId(processStream.getPartsId());
            s.setProcessId(processStream.getProcessId());
            PermissionStreamNew s = new PermissionStreamNew();
            s.setBusinessId(processStream.getProcessId());
            s.setBusinessType("5");
            s.setUserId(pp.getUserId());
            permissionStreamList.add(s);
        }
    }
    private void handleWorkStepPermissions(List<String> workStepIds, Collection<SysUser> userList,
                                           List<WorkStepPermission> workStepPermissionList, List<PermissionStream> permissionStreamList) {
                                           List<WorkStepPermission> workStepPermissionList, List<PermissionStreamNew> permissionStreamList) {
        Map<String, WorkStepPermission> workStepPermissionHashMap = new HashMap<>();
        Map<String, WorkStep> workStepHashMap = new HashMap<>();
        String key;
@@ -1130,12 +1210,9 @@
            WorkStepPermission ws = entry.getValue();
            workStepPermissionList.add(ws);
            WorkStep workStep = workStepHashMap.get(ws.getStepId());
            PermissionStream s = new PermissionStream();
            s.setProductId(workStep.getProductId());
            s.setComponentId(workStep.getComponentId());
            s.setPartsId(workStep.getPartsId());
            s.setProcessId(workStep.getProcessId());
            s.setStepId(workStep.getId());
            PermissionStreamNew s = new PermissionStreamNew();
            s.setBusinessId(workStep.getId());
            s.setBusinessType("6");
            s.setUserId(ws.getUserId());
            permissionStreamList.add(s);
        }
@@ -1177,7 +1254,7 @@
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
            if (relativeFlag == 1) {
                handleRelativePermissions(processStream.getProductId(), null, processStream.getProcessId(), null, userList);
                handleRelativePermissions(processStream.getProductId(), null, processStream.getProcessId(), null,null, userList);
            }
        }else {
            result = processStreamService.assignAddDepart(processStream, mdcProductionList);
@@ -1185,7 +1262,37 @@
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
            if (relativeFlag == 1) {
                handleRelatedPermissions(processStream, mdcProductionList, workStepService, workStepDepartmentService, permissionStreamService);
                handleRelatedPermissions(processStream, mdcProductionList, workStepService, workStepDepartmentService, permissionStreamNewService);
            }
        }
        return true;
    }
    private boolean handleProcessSpecVersion(String paramId, Integer relativeFlag, Collection<MdcProduction> mdcProductionList,Collection<SysUser> userList) {
        ProcessSpecVersion processSpecVersion = processSpecVersionService.getById(paramId);
        if (processSpecVersion == null) {
            ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_NOT_EXIST);
        }
        boolean hasPerm = checkProductPerm(4, processSpecVersion.getId());
        if (!hasPerm) {
            ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
        }
        boolean result;
        if (userList!=null){
            result = processSpecVersionService.assignAddUser(processSpecVersion, userList);
            if (!result) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
            if (relativeFlag == 1) {
                handleRelativePermissions(processSpecVersion.getProductId(), null, null,null, processSpecVersion.getId(), userList);
            }
        }else {
            result = processSpecVersionService.assignAddDepart(processSpecVersion, mdcProductionList);
            if (!result) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
            if (relativeFlag == 1) {
                handleRelatedPermissionsForProcessSpecVersion(processSpecVersion, mdcProductionList);
            }
        }
        return true;
@@ -1207,7 +1314,7 @@
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
            if (relativeFlag == 1) {
                handleRelativePermissions(partsInfo.getProductId(), null, null, partsInfo.getPartsId(), userList);
                handleRelativePermissions(partsInfo.getProductId(), null, null, partsInfo.getPartsId(),null, userList);
            }
        }else {
            result = partsInfoService.assignAddDepart(partsInfo, mdcProductionList);
@@ -1242,7 +1349,7 @@
                    List<String> componentIds = componentInfoList.stream()
                            .map(ComponentInfo::getComponentId)
                            .collect(Collectors.toList());
                    handleRelativePermissions(productInfo.getProductId(), componentIds, null, null, userList);
                    handleRelativePermissions(productInfo.getProductId(), componentIds, null, null, null,userList);
                }
            }
        }else {
@@ -1281,7 +1388,7 @@
                            .collect(Collectors.toList());
                }
                componentIds.add(componentInfo.getComponentId());
                handleRelativePermissions(componentInfo.getProductId(), componentIds, null, null, userList);
                handleRelativePermissions(componentInfo.getProductId(), componentIds, null, null,null, userList);
            }
        }else {
            result = componentInfoService.assignAddDepart(componentInfo, mdcProductionList);
@@ -1295,7 +1402,8 @@
        return true;
    }
    private void handleRelatedPermissions(Object parentEntity, Collection<MdcProduction> mdcProductionList, IWorkStepService workStepService, IWorkStepDepartmentService workStepDepartmentService, IPermissionStreamService permissionStreamService) {
    private void handleRelatedPermissions(Object parentEntity, Collection<MdcProduction> mdcProductionList, IWorkStepService workStepService,
                                          IWorkStepDepartmentService workStepDepartmentService, IPermissionStreamNewService permissionStreamNewService) {
        String parentId = getParentId(parentEntity);
        List<WorkStep> workStepList = workStepService.list(new QueryWrapper<WorkStep>().eq("process_id", parentId));
        if (workStepList == null || workStepList.isEmpty()) {
@@ -1323,48 +1431,54 @@
        }
        List<WorkStepDepartment> newWorkStepDepartments = new ArrayList<>();
        List<PermissionStream> newPermissionStreams = new ArrayList<>();
        List<PermissionStreamNew> newPermissionStreams = new ArrayList<>();
        for (Map.Entry<String, WorkStepDepartment> entry : allPermissions.entrySet()) {
            WorkStepDepartment wsDep = entry.getValue();
            newWorkStepDepartments.add(wsDep);
            WorkStep workStep = workStepMap.get(wsDep.getStepId());
            PermissionStream permStream = new PermissionStream();
            permStream.setProductId(workStep.getProductId());
            permStream.setComponentId(workStep.getComponentId());
            permStream.setPartsId(workStep.getPartsId());
            permStream.setProcessId(workStep.getProcessId());
            permStream.setStepId(workStep.getId());
            PermissionStreamNew permStream = new PermissionStreamNew();
            permStream.setBusinessId(workStep.getId());
            permStream.setBusinessType("6");
            permStream.setDepartId(wsDep.getDepartId());
            newPermissionStreams.add(permStream);
        }
        if (!newWorkStepDepartments.isEmpty()) {
            workStepDepartmentService.saveBatch(newWorkStepDepartments);
        }
        if (!newPermissionStreams.isEmpty()) {
            permissionStreamService.saveBatch(newPermissionStreams);
            permissionStreamNewService.saveBatch(newPermissionStreams);
        }
    }
    private void handleRelatedPermissionsForParts(PartsInfo partsInfo, Collection<MdcProduction> mdcProductionList) {
        // å¤„理工序权限
        handleProcessPermissions(partsInfo,null, mdcProductionList);
        // å¤„理工步权限
        handleWorkStepPermissions(partsInfo, mdcProductionList);
        // å¤„理工艺规程版本
        List<ProcessSpecVersion> processSpecVersionList = processSpecVersionService.list(new QueryWrapper<ProcessSpecVersion>().eq("parts_id", partsInfo.getPartsId()));
        processSpecVersionList.forEach(item->{
            processSpecVersionService.assignAddDepart(item, mdcProductionList);
            handleRelatedPermissionsForProcessSpecVersion(item, mdcProductionList);
        });
    }
    private void handleProcessPermissions(PartsInfo partsInfo,ComponentInfo componentInfo,Collection<MdcProduction> mdcProductionList) {
    private void handleRelatedPermissionsForProcessSpecVersion(ProcessSpecVersion processSpecVersion, Collection<MdcProduction> mdcProductionList) {
        // å¤„理工序权限
        handleProcessPermissions(processSpecVersion,null, mdcProductionList);
        // å¤„理工步权限
        handleWorkStepPermissions(processSpecVersion, mdcProductionList);
    }
    private void handleProcessPermissions(ProcessSpecVersion processSpecVersion,ComponentInfo componentInfo,Collection<MdcProduction> mdcProductionList) {
        List<ProcessStream> processStreamList=new ArrayList<>();
        if (componentInfo != null) {
            processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("component_id", componentInfo.getComponentId()));
        }else {
            processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("parts_id", partsInfo.getPartsId()));
            processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("psv_id", processSpecVersion.getId()));
        }
        if (processStreamList == null || processStreamList.isEmpty()) {
            return;
        }
        processStreamList.forEach(item->{
            handleRelatedPermissions(item, mdcProductionList, workStepService, workStepDepartmentService, permissionStreamService);
            handleRelatedPermissions(item, mdcProductionList, workStepService, workStepDepartmentService, permissionStreamNewService);
        });
        Map<String, ProcessionDepartment> allProcessPermissions = new HashMap<>();
        Map<String, ProcessStream> processStreamMap = new HashMap<>();
@@ -1388,16 +1502,14 @@
        }
        List<ProcessionDepartment> newProcessPermissions = new ArrayList<>();
        List<PermissionStream> newPermissionStreams = new ArrayList<>();
        List<PermissionStreamNew> newPermissionStreams = new ArrayList<>();
        for (Map.Entry<String, ProcessionDepartment> entry : allProcessPermissions.entrySet()) {
            ProcessionDepartment procDep = entry.getValue();
            newProcessPermissions.add(procDep);
            ProcessStream processStream = processStreamMap.get(procDep.getProcessId());
            PermissionStream permStream = new PermissionStream();
            permStream.setProductId(processStream.getProductId());
            permStream.setComponentId(processStream.getComponentId());
            permStream.setPartsId(processStream.getPartsId());
            permStream.setProcessId(processStream.getProcessId());
            PermissionStreamNew permStream = new PermissionStreamNew();
            permStream.setBusinessId(processStream.getProcessId());
            permStream.setBusinessType("5");
            permStream.setDepartId(procDep.getDepartId());
            newPermissionStreams.add(permStream);
        }
@@ -1406,22 +1518,22 @@
            processionDepartmentService.saveBatch(newProcessPermissions);
        }
        if (!newPermissionStreams.isEmpty()) {
            permissionStreamService.saveBatch(newPermissionStreams);
            permissionStreamNewService.saveBatch(newPermissionStreams);
        }
    }
    private void handleWorkStepPermissions(PartsInfo partsInfo, Collection<MdcProduction> mdcProductionList) {
        List<ProcessStream> processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("parts_id", partsInfo.getPartsId()));
    private void handleWorkStepPermissions(ProcessSpecVersion processSpecVersion, Collection<MdcProduction> mdcProductionList) {
        List<ProcessStream> processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("psv_id", processSpecVersion.getId()));
        if (processStreamList == null || processStreamList.isEmpty()) {
            return;
        }
        List<String> processIds = processStreamList.stream().map(ProcessStream::getProcessId).collect(Collectors.toList());
        List<WorkStep> workStepList = workStepService.getByProcessIds(partsInfo.getProductId(), processIds);
        List<WorkStep> workStepList = workStepService.getByProcessIds(processSpecVersion.getProductId(), processIds);
        if (workStepList == null || workStepList.isEmpty()) {
            return;
        }
        workStepList.forEach(item->{
            handleRelatedPermissions(item, mdcProductionList, workStepService, workStepDepartmentService, permissionStreamService);
            handleRelatedPermissions(item, mdcProductionList, workStepService, workStepDepartmentService, permissionStreamNewService);
        });
    }
@@ -1463,14 +1575,14 @@
        }
        List<ComponentDepartment> newComponentPermissions = new ArrayList<>();
        List<PermissionStream> newPermissionStreams = new ArrayList<>();
        List<PermissionStreamNew> newPermissionStreams = new ArrayList<>();
        for (Map.Entry<String, ComponentDepartment> entry : allComponentPermissions.entrySet()) {
            ComponentDepartment compDep = entry.getValue();
            newComponentPermissions.add(compDep);
            ComponentInfo componentInfo = componentInfoMap.get(compDep.getComponentId());
            PermissionStream permStream = new PermissionStream();
            permStream.setProductId(componentInfo.getProductId());
            permStream.setComponentId(componentInfo.getComponentId());
            PermissionStreamNew permStream = new PermissionStreamNew();
            permStream.setBusinessId(componentInfo.getComponentId());
            permStream.setBusinessType("2");
            permStream.setDepartId(compDep.getDepartId());
            newPermissionStreams.add(permStream);
        }
@@ -1479,7 +1591,7 @@
            componentDepartmentService.saveBatch(newComponentPermissions);
        }
        if (!newPermissionStreams.isEmpty()) {
            permissionStreamService.saveBatch(newPermissionStreams);
            permissionStreamNewService.saveBatch(newPermissionStreams);
        }
    }
@@ -1537,14 +1649,14 @@
            }
            List<ComponentDepartment> newComponentPermissions = new ArrayList<>();
            List<PermissionStream> newPermissionStreams = new ArrayList<>();
            List<PermissionStreamNew> newPermissionStreams = new ArrayList<>();
            for (Map.Entry<String, ComponentDepartment> entry : allComponentPermissions.entrySet()) {
                ComponentDepartment compDep = entry.getValue();
                newComponentPermissions.add(compDep);
                childComponent = componentInfoMap.get(compDep.getComponentId());
                PermissionStream permStream = new PermissionStream();
                permStream.setProductId(childComponent.getProductId());
                permStream.setComponentId(childComponent.getComponentId());
                PermissionStreamNew permStream = new PermissionStreamNew();
                permStream.setBusinessId(childComponent.getComponentId());
                permStream.setBusinessType("2");
                permStream.setDepartId(compDep.getDepartId());
                newPermissionStreams.add(permStream);
            }
@@ -1553,7 +1665,7 @@
                componentDepartmentService.saveBatch(newComponentPermissions);
            }
            if (!newPermissionStreams.isEmpty()) {
                permissionStreamService.saveBatch(newPermissionStreams);
                permissionStreamNewService.saveBatch(newPermissionStreams);
            }
        }
    }
@@ -1564,6 +1676,7 @@
            return;
        }
        for (PartsInfo partsInfo : partsInfoList) {
            partsInfoService.assignAddDepart(partsInfo, mdcProductionList);
            handleRelatedPermissionsForParts(partsInfo, mdcProductionList);
        }
    }
@@ -1579,77 +1692,6 @@
    /**移除权限*/
    private boolean handleWorkStepRemoval(String paramId, Collection<SysUser> userList, Collection<MdcProduction> mdcProductionList) {
        WorkStep workStep = workStepService.getById(paramId);
        if (workStep == null) {
            ExceptionCast.cast(ProcessInfoCode.WORKSTEP_NOT_EXIST);
        }
        checkProductPerm(6, workStep.getId());
        if (userList!=null){
            return workStepService.assignRemoveUser(workStep, userList);
        }else {
            return workStepService.assignRemoveDepart(workStep, mdcProductionList);
        }
    }
    private boolean handleProcessStreamRemoval(String paramId, Integer relativeFlag, Collection<SysUser> userList, Collection<MdcProduction> mdcProductionList) {
        ProcessStream processStream = processStreamService.getById(paramId);
        if (processStream == null) {
            ExceptionCast.cast(ProcessInfoCode.PROCESS_NOT_EXIST);
        }
        checkProductPerm(5, processStream.getProcessId());
        boolean result;
        if (userList!=null){
            result = processStreamService.assignRemoveUser(processStream, userList);
            if (!result) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
            if (relativeFlag == 1) {
                handleRelatedRemovals(processStream.getProcessId(), userList,
                        workStepService, iWorkStepPermissionService, permissionStreamService,
                        "process_id");
            }
        }else {
            result = processStreamService.assignRemoveDepart(processStream, mdcProductionList);
            if (!result) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
            if (relativeFlag == 1) {
                handleRelatedDepartmentRemovals(processStream.getProcessId(), mdcProductionList,
                        workStepService, workStepDepartmentService, permissionStreamService,
                        "process_id");
            }
        }
        return true;
    }
    private boolean handlePartsInfoRemoval(String paramId, Integer relativeFlag, Collection<SysUser> userList, Collection<MdcProduction> mdcProductionList) {
        PartsInfo partsInfo = partsInfoService.getById(paramId);
        if (partsInfo == null) {
            ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST);
        }
        checkProductPerm(3, partsInfo.getPartsId());
        boolean result;
        if (userList!=null){
            result = partsInfoService.assignRemoveUser(partsInfo, userList);
            if (!result) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
            if (relativeFlag == 1) {
                handlePartsRelatedRemovals(null,partsInfo, userList);
            }
        }else {
            result = partsInfoService.assignRemoveDepart(partsInfo, mdcProductionList);
            if (!result) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
            if (relativeFlag == 1) {
                handlePartsRelatedDepartmentRemovals(null,partsInfo, mdcProductionList);
            }
        }
        return true;
    }
    private boolean handleProductInfoRemoval(String paramId, Integer relativeFlag, Collection<SysUser> userList, Collection<MdcProduction> mdcProductionList) {
        ProductInfo productInfo = super.getById(paramId);
@@ -1705,10 +1747,108 @@
        return true;
    }
    private boolean handlePartsInfoRemoval(String paramId, Integer relativeFlag, Collection<SysUser> userList, Collection<MdcProduction> mdcProductionList) {
        PartsInfo partsInfo = partsInfoService.getById(paramId);
        if (partsInfo == null) {
            ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST);
        }
        checkProductPerm(3, partsInfo.getPartsId());
        boolean result;
        if (userList!=null){
            result = partsInfoService.assignRemoveUser(partsInfo, userList);
            if (!result) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
            if (relativeFlag == 1) {
                handlePartRelatedRemovals(partsInfo, userList);
            }
        }else {
            result = partsInfoService.assignRemoveDepart(partsInfo, mdcProductionList);
            if (!result) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
            if (relativeFlag == 1) {
                handlePartRelatedDepartmentRemovals(partsInfo, mdcProductionList);
            }
        }
        return true;
    }
    private boolean handleProcessSpecVersionRemoval(String paramId, Integer relativeFlag, Collection<SysUser> userList, Collection<MdcProduction> mdcProductionList) {
        ProcessSpecVersion processSpecVersion = processSpecVersionService.getById(paramId);
        if (processSpecVersion == null) {
            ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_NOT_EXIST);
        }
        checkProductPerm(4, processSpecVersion.getPartsId());
        boolean result;
        if (userList!=null){
            result = processSpecVersionService.assignRemoveUser(processSpecVersion, userList);
            if (!result) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
            if (relativeFlag == 1) {
                handleProcessSpecVersionRelatedRemovals(null,processSpecVersion, userList);
            }
        }else {
            result = processSpecVersionService.assignRemoveDepart(processSpecVersion, mdcProductionList);
            if (!result) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
            if (relativeFlag == 1) {
                handleProcessSpecVersionRelatedDepartmentRemovals(null,processSpecVersion, mdcProductionList);
            }
        }
        return true;
    }
    private boolean handleProcessStreamRemoval(String paramId, Integer relativeFlag, Collection<SysUser> userList, Collection<MdcProduction> mdcProductionList) {
        ProcessStream processStream = processStreamService.getById(paramId);
        if (processStream == null) {
            ExceptionCast.cast(ProcessInfoCode.PROCESS_NOT_EXIST);
        }
        checkProductPerm(5, processStream.getProcessId());
        boolean result;
        if (userList!=null){
            result = processStreamService.assignRemoveUser(processStream, userList);
            if (!result) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
            if (relativeFlag == 1) {
                handleRelatedRemovals(processStream.getProcessId(), userList,
                        workStepService, iWorkStepPermissionService, permissionStreamNewService,
                        "process_id");
            }
        }else {
            result = processStreamService.assignRemoveDepart(processStream, mdcProductionList);
            if (!result) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
            if (relativeFlag == 1) {
                handleRelatedDepartmentRemovals(processStream.getProcessId(), mdcProductionList,
                        workStepService, workStepDepartmentService, permissionStreamNewService,
                        "process_id");
            }
        }
        return true;
    }
    private boolean handleWorkStepRemoval(String paramId, Collection<SysUser> userList, Collection<MdcProduction> mdcProductionList) {
        WorkStep workStep = workStepService.getById(paramId);
        if (workStep == null) {
            ExceptionCast.cast(ProcessInfoCode.WORKSTEP_NOT_EXIST);
        }
        checkProductPerm(6, workStep.getId());
        if (userList!=null){
            return workStepService.assignRemoveUser(workStep, userList);
        }else {
            return workStepService.assignRemoveDepart(workStep, mdcProductionList);
        }
    }
    private void handleRelatedRemovals(String parentId, Collection<SysUser> userList,
                                       IWorkStepService workStepService,
                                       IWorkStepPermissionService workStepPermissionService,
                                       IPermissionStreamService permissionStreamService,
                                       IPermissionStreamNewService permissionStreamNewService,
                                       String queryField) {
        List<WorkStep> workStepList = workStepService.list(new QueryWrapper<WorkStep>().eq(queryField, parentId));
        if (workStepList.isEmpty()) {
@@ -1717,20 +1857,20 @@
        List<String> workStepIds = workStepList.stream().map(WorkStep::getId).collect(Collectors.toList());
        List<String> userIdList = userList.stream().map(SysUser::getId).collect(Collectors.toList());
        List<WorkStepPermission> workStepPermissions = workStepPermissionService.getByStepIdsAndUserIds(workStepIds, userIdList);
        List<PermissionStream> permissionStreams = permissionStreamService.getByPartsIdsAndDepartIds(workStepIds, userIdList);
        List<PermissionStreamNew> permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdsAndUserIds(workStepIds, userIdList,"6");
        if (!workStepPermissions.isEmpty()) {
            workStepPermissionService.removeByCollection(workStepPermissions);
        }
        if (!permissionStreams.isEmpty()) {
            permissionStreamService.removeByCollection(permissionStreams);
            permissionStreamNewService.deletePermissionStreamNewByList(permissionStreams);
        }
    }
    private void handleRelatedDepartmentRemovals(String parentId, Collection<MdcProduction> mdcProductionList,
                                                 IWorkStepService workStepService,
                                                 IWorkStepDepartmentService workStepDepartmentService,
                                                 IPermissionStreamService permissionStreamService,
                                                 IPermissionStreamNewService permissionStreamNewService,
                                                 String queryField) {
        List<WorkStep> workStepList = workStepService.list(new QueryWrapper<WorkStep>().eq(queryField, parentId));
        if (workStepList.isEmpty()) {
@@ -1739,22 +1879,22 @@
        List<String> workStepIds = workStepList.stream().map(WorkStep::getId).collect(Collectors.toList());
        List<String> departmentIdList = mdcProductionList.stream().map(MdcProduction::getId).collect(Collectors.toList());
        List<WorkStepDepartment> workStepDepartments = workStepDepartmentService.getByPartsIdsAndDepartIds(workStepIds, departmentIdList);
        List<PermissionStream> permissionStreams = permissionStreamService.getByPartsIdsAndDepartIds(workStepIds, departmentIdList);
        List<PermissionStreamNew> permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdsAndDepartIds(workStepIds, departmentIdList,"6");
        if (!workStepDepartments.isEmpty()) {
            workStepDepartmentService.removeByCollection(workStepDepartments);
        }
        if (!permissionStreams.isEmpty()) {
            permissionStreamService.removeByCollection(permissionStreams);
            permissionStreamNewService.deletePermissionStreamNewByList(permissionStreams);
        }
    }
    private void handlePartsRelatedRemovals(ComponentInfo componentInfo,PartsInfo partsInfo,Collection<SysUser> userList) {
    private void handleProcessSpecVersionRelatedRemovals(ComponentInfo componentInfo,ProcessSpecVersion processSpecVersion,Collection<SysUser> userList) {
        List<ProcessStream> processStreamList =new ArrayList<>();
        String productId="";
        if (partsInfo!=null){
            processStreamList= processStreamService.list(new QueryWrapper<ProcessStream>().eq("parts_id", partsInfo.getPartsId()));
            productId=partsInfo.getProductId();
        if (processSpecVersion!=null){
            processStreamList= processStreamService.list(new QueryWrapper<ProcessStream>().eq("psv_id", processSpecVersion.getId()));
            productId=processSpecVersion.getProductId();
        }else {
            processStreamList= processStreamService.list(new QueryWrapper<ProcessStream>().eq("component_id", componentInfo.getComponentId()).isNull("parts_id"));
            productId=componentInfo.getProductId();
@@ -1770,13 +1910,13 @@
        }
        List<String> userIdList = userList.stream().map(SysUser::getId).collect(Collectors.toList());
        List<ProcessionPermission> processionPermissions = iProcessStreamPermissionService.getByProcessIdsAndUserIds(processIds, userIdList);
        List<PermissionStream> permissionStreams = permissionStreamService.getByPartsIdsAndUserIds(processIds, userIdList);
        List<PermissionStreamNew> permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdsAndUserIds(processIds, userIdList,"5");
        if (!processionPermissions.isEmpty()) {
            iProcessStreamPermissionService.removeByCollection(processionPermissions);
        }
        if (!permissionStreams.isEmpty()) {
            permissionStreamService.removeByCollection(permissionStreams);
            permissionStreamNewService.deletePermissionStreamNewByList(permissionStreams);
        }
    }
@@ -1786,13 +1926,13 @@
        }
        List<String> departmentIdList = mdcProductionList.stream().map(MdcProduction::getId).collect(Collectors.toList());
        List<ProcessionDepartment> processionDepartments = processionDepartmentService.getByPartsIdsAndDepartIds(processIds, departmentIdList);
        List<PermissionStream> permissionStreams = permissionStreamService.getByPartsIdsAndDepartIds(processIds, departmentIdList);
        List<PermissionStreamNew> permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdsAndDepartIds(processIds, departmentIdList,"5");
        if (!processionDepartments.isEmpty()) {
            processionDepartmentService.removeByCollection(processionDepartments);
        }
        if (!permissionStreams.isEmpty()) {
            permissionStreamService.removeByCollection(permissionStreams);
            permissionStreamNewService.deletePermissionStreamNewByList(permissionStreams);
        }
    }
@@ -1800,7 +1940,7 @@
        List<WorkStep> workStepList = workStepService.getByProcessIds(productId, processIds);
        if (workStepList!=null){
            workStepList.forEach(item->{
                handleRelatedRemovals(item.getProcessId(), userList, workStepService, iWorkStepPermissionService, permissionStreamService, "process_id");
                handleRelatedRemovals(item.getProcessId(), userList, workStepService, iWorkStepPermissionService, permissionStreamNewService, "process_id");
            });
        }
    }
@@ -1809,7 +1949,7 @@
        List<WorkStep> workStepList = workStepService.getByProcessIds(productId, processIds);
        if (workStepList!=null){
            workStepList.forEach(item->{
                handleRelatedDepartmentRemovals(item.getProcessId(), mdcProductionList, workStepService, workStepDepartmentService, permissionStreamService, "process_id");
                handleRelatedDepartmentRemovals(item.getProcessId(), mdcProductionList, workStepService, workStepDepartmentService, permissionStreamNewService, "process_id");
            });
        }
    }
@@ -1820,8 +1960,30 @@
        handleComponentRemovals(componentIds, userList);
        handlePartsRemovals(productInfo.getProductId(), componentIds, userList);
        componentInfoList.forEach(item->{
            handlePartsRelatedRemovals(item,null, userList);
            handleProcessSpecVersionRelatedRemovals(item,null, userList);
        });
    }
    private void handlePartRelatedRemovals(PartsInfo partsInfo, Collection<SysUser> userList) {
        List<ProcessSpecVersion> processSpecVersions = processSpecVersionService.getByPartsId(partsInfo.getPartsId());
        if (processSpecVersions!=null){
            List<String> psvIds = processSpecVersions.stream().map(ProcessSpecVersion::getId).collect(Collectors.toList());
            handleProcessSpecVersionRemovals(psvIds, userList);
            processSpecVersions.forEach(item->{
                handleProcessSpecVersionRelatedRemovals(null,item, userList);
            });
        }
    }
    private void handlePartRelatedDepartmentRemovals(PartsInfo partsInfo, Collection<MdcProduction> mdcProductionList) {
        List<ProcessSpecVersion> processSpecVersions = processSpecVersionService.getByPartsId(partsInfo.getPartsId());
        if (processSpecVersions!=null){
            List<String> psvIds = processSpecVersions.stream().map(ProcessSpecVersion::getId).collect(Collectors.toList());
            handleProcessSpecVersionDepartmentRemovals(psvIds, mdcProductionList);
            processSpecVersions.forEach(item->{
                handleProcessSpecVersionRelatedDepartmentRemovals(null,item, mdcProductionList);
            });
        }
    }
    private void handleProductRelatedDepartmentRemovals(ProductInfo productInfo, Collection<MdcProduction> mdcProductionList) {
@@ -1830,7 +1992,7 @@
        handleComponentDepartmentRemovals(componentIds, mdcProductionList);
        handlePartsDepartmentRemovals(productInfo.getProductId(), componentIds, mdcProductionList);
        componentInfoList.forEach(item->{
            handlePartsRelatedDepartmentRemovals(item,null, mdcProductionList);
            handleProcessSpecVersionRelatedDepartmentRemovals(item,null, mdcProductionList);
        });
    }
@@ -1840,15 +2002,46 @@
        }
        List<String> userIdList = userList.stream().map(SysUser::getId).collect(Collectors.toList());
        List<ComponentPermission> componentPermissions = componentPermissionService.getByComponentIdsAndUserIds(componentIds, userIdList);
        List<PermissionStream> permissionStreams = permissionStreamService.getByComponentIdsAndUserIds(componentIds, userIdList);
        List<PermissionStreamNew> permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdsAndUserIds(componentIds, userIdList,"2");
        if (!componentPermissions.isEmpty()) {
            componentPermissionService.removeByCollection(componentPermissions);
        }
        if (!permissionStreams.isEmpty()) {
            permissionStreamService.removeByCollection(permissionStreams);
            permissionStreamNewService.deletePermissionStreamNewByList(permissionStreams);
        }
    }
    private void handleProcessSpecVersionRemovals(List<String> psvIds, Collection<SysUser> userList) {
        if (psvIds.isEmpty()) {
            return;
        }
        List<String> userIdList = userList.stream().map(SysUser::getId).collect(Collectors.toList());
        List<ProcessSpecVersionPermission> processSpecVersionPermissions = processSpecVersionPermissionService.getByPsvIdsAndUserIds(psvIds, userIdList);
        List<PermissionStreamNew> permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdsAndUserIds(psvIds, userIdList,"4");
        if (!processSpecVersionPermissions.isEmpty()) {
            processSpecVersionPermissionService.removeByCollection(processSpecVersionPermissions);
        }
        if (!permissionStreams.isEmpty()) {
            permissionStreamNewService.deletePermissionStreamNewByList(permissionStreams);
        }
    }
    private void handleProcessSpecVersionDepartmentRemovals(List<String> psvIds, Collection<MdcProduction> mdcProductionList) {
        if (psvIds.isEmpty()) {
            return;
        }
        List<String> departmentIdList = mdcProductionList.stream().map(MdcProduction::getId).collect(Collectors.toList());
        List<ProcessSpecVersionDepartment> processSpecVersionDepartments =processSpecVersionDepartmentService.getByPsvIdsAndDepartIds(psvIds, departmentIdList);
        List<PermissionStreamNew> permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdsAndDepartIds(psvIds, departmentIdList,"4");
        if (!processSpecVersionDepartments.isEmpty()) {
            processSpecVersionDepartmentService.removeByCollection(processSpecVersionDepartments);
        }
        if (!permissionStreams.isEmpty()) {
            permissionStreamNewService.deletePermissionStreamNewByList(permissionStreams);
        }
    }
    private void handleComponentDepartmentRemovals(List<String> componentIds, Collection<MdcProduction> mdcProductionList) {
        if (componentIds.isEmpty()) {
@@ -1856,28 +2049,29 @@
        }
        List<String> departmentIdList = mdcProductionList.stream().map(MdcProduction::getId).collect(Collectors.toList());
        List<ComponentDepartment> componentDepartments = componentDepartmentService.getByComponentIdsAndDepartIds(componentIds, departmentIdList);
        List<PermissionStream> permissionStreams = permissionStreamService.getByComponentIdsAndDepartIds(componentIds, departmentIdList);
        List<PermissionStreamNew> permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdsAndDepartIds(componentIds, departmentIdList,"2");
        if (!componentDepartments.isEmpty()) {
            componentDepartmentService.removeByCollection(componentDepartments);
        }
        if (!permissionStreams.isEmpty()) {
            permissionStreamService.removeByCollection(permissionStreams);
            permissionStreamNewService.deletePermissionStreamNewByList(permissionStreams);
        }
    }
    private void handlePartsRemovals(String productId, List<String> componentIds, Collection<SysUser> userList) {
    private void handlePartsRemovals(String productId, List<String> componentIds,Collection<SysUser> userList) {
        List<PartsInfo> partsInfoList = partsInfoService.getByComponentIdList(productId, componentIds);
        partsInfoList.forEach(item->{
            partsInfoService.assignRemoveUser(item,userList);
            handlePartsRelatedRemovals(null,item, userList);
            //删除
            handlePartRelatedRemovals(item, userList);
        });
    }
    private void handlePartsDepartmentRemovals(String productId, List<String> componentIds, Collection<MdcProduction> mdcProductionList) {
        List<PartsInfo> partsInfoList = partsInfoService.getByComponentIdList(productId, componentIds);
        partsInfoList.forEach(item->{
            partsInfoService.assignRemoveDepart(item,mdcProductionList);
            handlePartsRelatedDepartmentRemovals(null,item, mdcProductionList);
            handlePartRelatedDepartmentRemovals(item, mdcProductionList);
        });
    }
@@ -1893,7 +2087,7 @@
            handlePartsDepartmentRemovals(componentInfo.getProductId(), componentIds, mdcProductionList);
            if (childrenList != null) {
                childrenList.forEach(item->{
                    handlePartsRelatedDepartmentRemovals(item,null, mdcProductionList);
                    handleProcessSpecVersionRelatedDepartmentRemovals(item,null, mdcProductionList);
                });
            }
        }else {
@@ -1901,21 +2095,21 @@
            handlePartsRemovals(componentInfo.getProductId(), componentIds, userList);
            if (childrenList != null) {
                childrenList.forEach(item->{
                    handlePartsRelatedRemovals(item,null, userList);
                    handleProcessSpecVersionRelatedRemovals(item,null, userList);
                });
            }
        }
    }
    private void handlePartsRelatedDepartmentRemovals(ComponentInfo componentInfo,PartsInfo partsInfo, Collection<MdcProduction> mdcProductionList) {
    private void handleProcessSpecVersionRelatedDepartmentRemovals(ComponentInfo componentInfo,ProcessSpecVersion processSpecVersion, Collection<MdcProduction> mdcProductionList) {
        List<ProcessStream> processStreamList=new ArrayList<>();
        String productId="";
        if (componentInfo!=null){
            processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("component_id", componentInfo.getComponentId()));
            productId=componentInfo.getProductId();
        }else {
            processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("parts_id", partsInfo.getPartsId()));
            productId=partsInfo.getProductId();
            processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("psv_id", processSpecVersion.getId()));
            productId=processSpecVersion.getProductId();
        }
        List<String> processIds = processStreamList.stream().map(ProcessStream::getProcessId).collect(Collectors.toList());
        handleProcessDepartmentRemovals(processIds, mdcProductionList);
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductMixServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,35 @@
package org.jeecg.modules.dnc.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.entity.ProductMix;
import org.jeecg.modules.dnc.mapper.ProductMixMapper;
import org.jeecg.modules.dnc.service.IPermissionStreamNewService;
import org.jeecg.modules.dnc.service.IProductMixService;
import org.jeecg.modules.dnc.utils.TreeBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ProductMixServiceImpl extends ServiceImpl<ProductMixMapper, ProductMix> implements IProductMixService {
    @Autowired
    private IPermissionStreamNewService permissionStreamNewService;
    @Override
    public List<ProductMix> getTree() {
        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        List<ProductMix> rawData = permissionStreamNewService.loadProductMix(loginUser.getId());
        TreeBuilder builder = new TreeBuilder();
        TreeBuilder.CleanResult cleanResult = builder.preprocessData(rawData);
        List<ProductMix> sorted = builder.topologicalSort(
                cleanResult.getValidNodes(),
                cleanResult.getNodeMap()
        );
        return builder.assembleTree(sorted, cleanResult.getNodeMap());
    }
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductPermissionServiceImpl.java
@@ -17,6 +17,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -27,6 +28,8 @@
    private IComponentPermissionService componentPermissionService;
    @Autowired
    private IPartsPermissionService partsPermissionService;
    @Resource
    private IProcessSpecVersionPermissionService processSpecVersionPermissionService;
    @Autowired
    private IProcessStreamPermissionService processStreamPermissionService;
    @Autowired
@@ -127,6 +130,9 @@
                // é›¶ä»¶æƒé™
                partsPermissionService.save(new PartsPermission(id, userId));
                break;
            case "4":
                //工艺规程版本号
                processSpecVersionPermissionService.save(new ProcessSpecVersionPermission(id, userId));
            case "5":
                // å·¥åºæƒé™
                processStreamPermissionService.save(new ProcessionPermission(id, userId));
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepServiceImpl.java
@@ -39,9 +39,8 @@
 */
@Service
public class WorkStepServiceImpl extends ServiceImpl<WorkStepMapper, WorkStep> implements IWorkStepService {
    @Autowired
    private IPermissionStreamService permissionStreamService;
    private IPermissionStreamNewService permissionStreamNewService;
    @Autowired
    private IWorkStepDepartmentService workStepDepartmentService;
@@ -112,23 +111,43 @@
        boolean b =super.save(workStep);
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        //添加用户权限
        //添加部门权限
        List<PermissionStreamNew> oldDepartPermList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(workStep.getProcessId(),"5","1");
        if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) {
            List<WorkStepDepartment> workStepDepartmentList = new ArrayList<>();
            List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
            oldDepartPermList.forEach(item -> {
                WorkStepDepartment pd = new WorkStepDepartment();
                pd.setDepartId(item.getDepartId());
                pd.setStepId(workStep.getId());
                workStepDepartmentList.add(pd);
                PermissionStreamNew perm = new PermissionStreamNew();
                perm.setBusinessId(workStep.getId());
                perm.setBusinessType("6");
                permissionStreamList.add(perm);
            });
            if(!workStepDepartmentList.isEmpty()) {
                b = workStepDepartmentService.saveBatch(workStepDepartmentList);
                if(!b)
                    ExceptionCast.cast(CommonCode.FAIL);
            }
            if(!permissionStreamList.isEmpty()) {
                b = permissionStreamNewService.saveBatch(permissionStreamList);
                if(!b)
                    ExceptionCast.cast(CommonCode.FAIL);
            }
        }
        //添加用户权限
        b = productPermissionService.add(workStep.getId(), userId,"6");
        if (!b) {
            ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR);
        }
        //添加权限验证
        PermissionStream permissionStream = new PermissionStream();
        PermissionStreamNew permissionStream = new PermissionStreamNew();
        permissionStream.setUserId(userId);
        permissionStream.setProductId(workStep.getProductId());
        permissionStream.setComponentId(workStep.getComponentId());
        if (StrUtil.isNotEmpty(workStep.getPartsId())){
            permissionStream.setPartsId(workStep.getPartsId());
        }
        permissionStream.setProcessId(workStep.getProcessId());
        permissionStream.setStepId(workStep.getId());
        return permissionStreamService.save(permissionStream);
        permissionStream.setBusinessId(workStep.getId());
        permissionStream.setBusinessType("6");
        return permissionStreamNewService.save(permissionStream);
    }
    /**
@@ -146,13 +165,6 @@
        WorkStep en = super.getById(id);
        if(en == null)
            ExceptionCast.cast(ProcessInfoCode.WORKSTEP_NOT_EXIST);
//        workStep.setStepId(id);
//        workStep.setProductId(null);
//        workStep.setComponentId(null);
//        workStep.setPartsId(null);
//        workStep.setProcessId(null);
//        workStep.setStepName(workStep.getStepName().toUpperCase());
//        workStep.setStepCode(null);
        return super.updateById(workStep);
    }
@@ -174,7 +186,7 @@
        if(workStep == null || departmentList == null || departmentList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<WorkStepDepartment> workStepDepartmentList = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        departmentList.forEach(item -> {
            WorkStepDepartment en = workStepDepartmentService.getByStepIdAndDepartId(workStep.getId(), item.getId());
            if(en == null) {
@@ -183,16 +195,12 @@
                en.setStepId(workStep.getId());
                workStepDepartmentList.add(en);
            }
            PermissionStream stream = permissionStreamService.getByStepIdAndDepartId(workStep.getProductId(), workStep.getComponentId(), workStep.getPartsId(),workStep.getProcessId(),workStep.getId(),item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(workStep.getId(),item.getId(),"6");
            if(stream == null) {
                stream = new PermissionStream();
                stream = new PermissionStreamNew();
                stream.setDepartId(item.getId());
                stream.setProductId(workStep.getProductId());
                stream.setComponentId(workStep.getComponentId());
                stream.setPartsId(workStep.getPartsId());
                stream.setProcessId(workStep.getProcessId());
                stream.setStepId(workStep.getId());
                stream.setBusinessId(workStep.getId());
                stream.setBusinessType("6");
                permissionStreamList.add(stream);
            }
        });
@@ -203,7 +211,7 @@
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.saveBatch(permissionStreamList);
            boolean b = permissionStreamNewService.saveBatch(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
@@ -243,14 +251,13 @@
        if(workStep == null || departmentList == null || departmentList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<WorkStepDepartment> workStepDepartmentList = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        departmentList.forEach(item -> {
            WorkStepDepartment en = workStepDepartmentService.getByStepIdAndDepartId(workStep.getId(), item.getId());
            if(en != null) {
                workStepDepartmentList.add(en);
            }
            PermissionStream stream = permissionStreamService.getByStepIdAndDepartId(workStep.getProductId(), workStep.getComponentId(), workStep.getPartsId()
                    ,workStep.getProcessId(),workStep.getId(), item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(workStep.getId(),item.getId(),"6");
            if(stream != null) {
                permissionStreamList.add(stream);
            }
@@ -262,7 +269,7 @@
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.removeByCollection(permissionStreamList);
            boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
@@ -295,7 +302,7 @@
        if(workStep == null || userList == null || userList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<WorkStepPermission> permissionList = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        userList.forEach(item -> {
            WorkStepPermission en = workStepPermissionService.getByStepIdAndUserId(workStep.getId(), item.getId());
            if(en == null) {
@@ -304,16 +311,12 @@
                en.setStepId(workStep.getId());
                permissionList.add(en);
            }
            PermissionStream stream = permissionStreamService.getByStepIdAndUserId(workStep.getProductId(), workStep.getComponentId(), workStep.getPartsId()
                    ,workStep.getProcessId(),workStep.getId(), item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(workStep.getId(),item.getId(),"6");
            if(stream == null) {
                stream = new PermissionStream();
                stream = new PermissionStreamNew();
                stream.setUserId(item.getId());
                stream.setProductId(workStep.getProductId());
                stream.setComponentId(workStep.getComponentId());
                stream.setPartsId(workStep.getPartsId());
                stream.setProcessId(workStep.getProcessId());
                stream.setStepId(workStep.getId());
                stream.setBusinessId(workStep.getId());
                stream.setBusinessType("6");
                permissionStreamList.add(stream);
            }
        });
@@ -324,7 +327,7 @@
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.saveBatch(permissionStreamList);
            boolean b = permissionStreamNewService.saveBatch(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
@@ -338,14 +341,13 @@
        if(workStep == null || userList == null || userList.isEmpty())
            ExceptionCast.cast(CommonCode.INVALID_PARAM);
        List<WorkStepPermission> permissionList = new ArrayList<>();
        List<PermissionStream> permissionStreamList = new ArrayList<>();
        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
        userList.forEach(item -> {
            WorkStepPermission en = workStepPermissionService.getByStepIdAndUserId(workStep.getId(), item.getId());
            if(en != null) {
                permissionList.add(en);
            }
            PermissionStream stream = permissionStreamService.getByStepIdAndUserId(workStep.getProductId(), workStep.getComponentId(),
                    workStep.getPartsId(),workStep.getProcessId(), workStep.getId(),item.getId());
            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(workStep.getId(),item.getId(),"6");
            if(stream != null) {
                permissionStreamList.add(stream);
            }
@@ -358,7 +360,7 @@
            }
        }
        if(!permissionStreamList.isEmpty()) {
            boolean b = permissionStreamService.removeByCollection(permissionStreamList);
            boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList);
            if(!b) {
                ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
            }
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/ProductTreeWrapper.java
@@ -14,15 +14,18 @@
public class ProductTreeWrapper {
    public static List<CommonGenericTree> loadTree(List<ProductInfo> productInfoList, List<ComponentExt> componentInfoList,
                                                   List<PartsInfo> partsInfoList,List<ProcessStream> processStreams, List<WorkStep> workStepList) {
                                                   List<PartsInfo> partsInfoList,List<ProcessSpecVersion> processSpecVersionList,
                                                   List<ProcessStream> processStreams, List<WorkStep> workStepList) {
        List<CommonGenericTree> tree = new ArrayList<CommonGenericTree>();// TreeNode集合,存放所有树对象。
        Map<String, CommonGenericTree> productMap = new HashMap<>();
        Map<String, CommonGenericTree> componentMap = new HashMap<>();
        Map<String, CommonGenericTree> partsMap = new HashMap<>();
        Map<String, CommonGenericTree> pvsMap = new HashMap<>();
        Map<String, CommonGenericTree> processMap = new HashMap<>();
        CommonGenericTree<ProductInfo> node;
        CommonGenericTree<ComponentInfo> componentNode;
        CommonGenericTree<PartsInfo> partsNode;
        CommonGenericTree<ProcessSpecVersion> pvsNode;
        CommonGenericTree<ProcessStream> processNode;
        CommonGenericTree<WorkStep> workStepNode;
        for(ProductInfo productInfo : productInfoList) {
@@ -64,7 +67,25 @@
            partsMap.put(parts.getPartsId(), partsNode);
        }
        //工序存在部件或者零件下
        //工艺规程版本存在零件下
        for(ProcessSpecVersion processSpecVersion : processSpecVersionList) {
            pvsNode = new CommonGenericTree();
            pvsNode.setId(processSpecVersion.getId());
            pvsNode.setLabel("[" + processSpecVersion.getProcessSpecVersionCode()+ "]" + processSpecVersion.getProcessSpecVersionName());
            pvsNode.setParentId(null);
            pvsNode.setIconClass("");
            pvsNode.setType(4);
            pvsNode.setRField(processSpecVersion.getPartsId());
            pvsNode.setEntity(processSpecVersion);
            if(partsMap.containsKey(pvsNode.getRField())) {
                partsNode = partsMap.get(pvsNode.getRField());
                pvsNode.setParentId(partsNode.getId());
                partsNode.addChildren(pvsNode);
            }
            pvsMap.put(processSpecVersion.getId(),pvsNode);
        }
        //工序存在部件或者工艺规程版本下
        for(ProcessStream processStream : processStreams) {
            processNode = new CommonGenericTree();
            processNode.setId(processStream.getProcessId());
@@ -72,7 +93,7 @@
            processNode.setParentId(null);
            processNode.setIconClass("");
            processNode.setType(5);
            if (StrUtil.isEmpty(processStream.getPartsId())) {
            if (StrUtil.isEmpty(processStream.getPsvId())) {
                //没有partsId,部件下的工序
                processNode.setRField(processStream.getComponentId());
                processNode.setEntity(processStream);
@@ -82,13 +103,13 @@
                    componentNode.addChildren(processNode);
                }
            }else {
                //有partsId,零件下的工序
                processNode.setRField(processStream.getPartsId());
                //有psvId,零件下的工序
                processNode.setRField(processStream.getPsvId());
                processNode.setEntity(processStream);
                if(partsMap.containsKey(processNode.getRField())) {
                    partsNode = partsMap.get(processNode.getRField());
                    processNode.setParentId(partsNode.getId());
                    partsNode.addChildren(processNode);
                if(pvsMap.containsKey(processNode.getRField())) {
                    pvsNode = pvsMap.get(processNode.getRField());
                    processNode.setParentId(pvsNode.getId());
                    pvsNode.addChildren(processNode);
                }
            }
            processMap.put(processStream.getProcessId(),processNode);
lxzn-module-dnc/src/main/java/org/jeecg/modules/flow/service/impl/AssignFileStreamServiceImpl.java
@@ -75,7 +75,7 @@
    @Autowired
    private IWorkStepService workStepService;
    @Autowired
    private IPermissionStreamService permissionStreamService;
    private IPermissionStreamNewService permissionStreamNewService;
    @Autowired
    private IDocClassificationService classificationService;
    @Autowired
@@ -92,8 +92,6 @@
    private ISynchronizedFlagService synchronizedFlagService;
    @Autowired
    private IDeviceGroupService deviceGroupService;
    @Autowired
    private IDncPassLogService dncPassLogService;
    @Autowired
    private IDeviceCharactersService iDeviceCharactersService;
    @Autowired
@@ -206,7 +204,7 @@
        if (deviceDoc != null) {
            handleExistingDeviceDoc(docFile, mdcEquipment, stream.getDeviceId());
        }
        List<PermissionStream> permissionStreams = getPermissionStreams(stream);
        PermissionStreamNew permissionStreams = getPermissionStreams(stream);
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        saveBusinessObject(stream, userId);
@@ -575,8 +573,9 @@
    }
    //权限校验
    private List<PermissionStream> getPermissionStreams(AssignFileStream stream) {
        List<PermissionStream> permissionStreams = new ArrayList<>();
    private PermissionStreamNew getPermissionStreams(AssignFileStream stream) {
        PermissionStreamNew permissionStreams;
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        if (stream.getAttributionType().equals("5")) {
            // å·¥åº
            ProcessStream processStream = processStreamService.getById(stream.getAttributionId());
@@ -587,8 +586,7 @@
            stream.setComponentId(processStream.getComponentId());
            stream.setPartsId(processStream.getPartsId());
            stream.setProcessId(processStream.getProcessId());
            permissionStreams = permissionStreamService
                    .getByProcessId(processStream.getProductId(), processStream.getComponentId(), processStream.getPartsId(), processStream.getProcessId());
            permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(),user.getId(),"5");
        } else {
            // å·¥æ­¥
            WorkStep workStep = workStepService.getById(stream.getAttributionId());
@@ -600,10 +598,9 @@
            stream.setPartsId(workStep.getPartsId());
            stream.setProcessId(workStep.getProcessId());
            stream.setStepId(workStep.getId());
            permissionStreams = permissionStreamService
                    .getByStepId(workStep.getProductId(), workStep.getComponentId(), workStep.getPartsId(), workStep.getProcessId(), workStep.getId());
            permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(workStep.getId(),user.getId(),"6");
        }
        if (permissionStreams == null || permissionStreams.isEmpty()) {
        if (permissionStreams == null ) {
            ExceptionCast.cast(ActivitiCode.ACT_NODE_DEPART_NONE);
        }
        return permissionStreams;
@@ -713,44 +710,10 @@
            if (strings != null && !strings.isEmpty()) {
                String path = StringUtils.join(strings.toArray(), "/");
                Date dateFirst = DateUtil.getNow();
                DncPassLog passInfoTxt = new DncPassLog();
                passInfoTxt.setDayTime(DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY));
                DncPassLog dncPassLog = dncPassLogService.findDayTime(DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY));
                Integer fileTxt = 0, fileNc = 0;
                if (dncPassLog != null) {
                    fileTxt = dncPassLog.getSequenceNumber() + 1;
                    fileNc = fileTxt + 1;
                } else {
                    fileTxt = 1;
                    fileNc = fileTxt + 1;
                }
                String sequence = String.format("%06d", fileTxt);
                String sequenceNc = String.format("%06d", fileNc);
                passInfoTxt.setSequenceNumber(fileTxt);
                passInfoTxt.setSequenceOrder(sequence);
                passInfoTxt.setCreateTime(dateFirst);
                passInfoTxt.setPassType("02");
                dncPassLogService.save(passInfoTxt);
                DncPassLog passInfoNc = new DncPassLog();
                passInfoNc.setSequenceNumber(fileNc);
                passInfoNc.setSequenceOrder(sequenceNc);
                passInfoNc.setDayTime(DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY));
                passInfoNc.setPassType("02");
                passInfoNc.setPassName(docFile.getFileName());
                try {
                    Thread.sleep(1000);
                    Date date = new Date();
                    passInfoNc.setCreateTime(date);
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                }
                dncPassLogService.save(passInfoNc);
                NcTxtFilePathInfo ncTxt = new NcTxtFilePathInfo();
                ncTxt.setEquipmentId(mdcEquipment.getEquipmentId());
                ncTxt.setFileNcName("02A" + DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY) + sequenceNc);
                ncTxt.setFileTxtName("02A" + DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY) + sequence);
                ncTxt.setFileNcName("02A" + DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY));
                ncTxt.setFileTxtName("02A" + DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY));
                ncTxt.setFilePath(path + "/" + mdcEquipment.getEquipmentId() + "/");
                ncTxt.setOrigFileName(docFile.getFileName());
                ncTxt.setOrigFileSuffix(docFile.getFileSuffix());
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java
@@ -28,6 +28,11 @@
    List<String> recursionChildren(@Param("productionId") String productionId);
    /**
     * ä¸€ç»„id递归所有子节点
     */
    List<String> recursionChildrenByList(@Param("productionIds") List<String> productionIds);
    /**
     * æ ¹æ®ç”¨æˆ·id和车间id获取用户拥有的车间id
     * @param userId
     * @param productionId
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml
@@ -42,4 +42,30 @@
            t3.id = #{userId}
          AND t1.org_type = '3'
    </select>
    <select id="recursionChildrenByList" resultType="java.lang.String">
        WITH temp (id) AS (
            -- åˆå§‹æŸ¥è¯¢ï¼ŒèŽ·å–æŒ‡å®š id çš„记录
            SELECT
                id
            FROM
                mdc_production
            WHERE
                id IN
            <foreach collection = "productionIds" item = "id" index = "index" open = "(" close = ")" separator = ",">
                 #{id}
            </foreach>
            UNION ALL
            -- é€’归查询,查找子节点
            SELECT
                a.id
            FROM
                mdc_production a
                    INNER JOIN temp ON a.parent_id = temp.id
        )
-- æœ€ç»ˆæŸ¥è¯¢ï¼Œä½¿ç”¨ DISTINCT åŽ»é‡
        SELECT DISTINCT
            id
        FROM
            temp;
    </select>
</mapper>
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java
@@ -111,4 +111,11 @@
     * @return
     */
    Map<String, MdcProduction> getUserAssignedDepart(String userId);
    /**
     * é€šè¿‡ä¸€ç»„id获取部门
     * @param ids
     * @return
     */
    List<String> findAllProductionIds(List<String> ids);
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java
@@ -388,4 +388,14 @@
         });
         return map;
    }
    /**
     * é€šè¿‡ä¸€ç»„id获取部门
     * @param ids
     * @return
     */
    @Override
    public List<String> findAllProductionIds(List<String> ids){
        return this.baseMapper.recursionChildrenByList(ids);
    }
}