lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java
@@ -17,6 +17,7 @@ import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.dnc.ucenter.UserDepartExt; 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.web.bind.annotation.*; @@ -142,8 +143,8 @@ @AutoLog(value = "产å表-è·åå·²åé çé¨é¨") @ApiOperation(value = "产å表-è·åå·²åé çé¨é¨", notes = "产å表-è·åå·²åé çé¨é¨") @GetMapping("/get/perm/depart/{nodeType}/{paramId}") public QueryListResponseResult<Department> getDepartPermsList(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId) { List<Department> list = productInfoService.getDepartPermsList(nodeType, paramId); public QueryListResponseResult<MdcProduction> getDepartPermsList(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId) { List<MdcProduction> list = productInfoService.getDepartPermsList(nodeType, paramId); if(list == null) list = Collections.emptyList(); return new QueryListResponseResult(CommonCode.SUCCESS, list); @@ -152,8 +153,8 @@ @AutoLog(value = "产å表-è·åæªåé çé¨é¨") @ApiOperation(value = "产å表-è·åæªåé çé¨é¨", notes = "产å表-è·åæªåé çé¨é¨") @GetMapping("/get/non/perm/depart/{nodeType}/{paramId}") public QueryListResponseResult<Department> getDepartNonPermsList(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId) { List<Department> list = productInfoService.getDepartNonPermsList(nodeType, paramId); public QueryListResponseResult<MdcProduction> getDepartNonPermsList(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId) { List<MdcProduction> list = productInfoService.getDepartNonPermsList(nodeType, paramId); if(list == null) list = Collections.emptyList(); return new QueryListResponseResult(CommonCode.SUCCESS, list); lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessionDepartment.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,34 @@ 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 lombok.Data; import lombok.NoArgsConstructor; import java.util.Date; @Data @NoArgsConstructor @TableName(value = "nc_process_department") public class ProcessionDepartment { @TableId(value = "id") private String id; @TableField(value = "process_id") private String processId; @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 ProcessionDepartment(String processId, String departId){ this.processId = processId; this.departId = departId; } } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/WorkStepDepartment.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,34 @@ 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 lombok.Data; import lombok.NoArgsConstructor; import java.util.Date; @Data @NoArgsConstructor @TableName(value = "nc_work_step_department") public class WorkStepDepartment { @TableId(value = "id") private String id; @TableField(value = "step_id") private String stepId; @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 WorkStepDepartment(String stepId, String departId){ this.stepId = stepId; this.departId = departId; } } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ComponentDepartmentMapper.java
@@ -4,6 +4,7 @@ import org.jeecg.modules.dnc.entity.ComponentDepartment; import org.jeecg.modules.dnc.ucenter.Department; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.system.entity.MdcProduction; import java.util.List; @@ -14,12 +15,12 @@ * @param componentId * @return */ List<Department> getDepartPermsByComponentId(@Param("componentId") String componentId); List<MdcProduction> getDepartPermsByComponentId(@Param("componentId") String componentId); /** * è·åæªåé çé¨é¨ * @param componentId * @return */ List<Department> getDepartNonPermsByComponentId(@Param("componentId") String componentId); List<MdcProduction> getDepartNonPermsByComponentId(@Param("componentId") String componentId); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PartsDepartmentMapper.java
@@ -4,6 +4,7 @@ import org.jeecg.modules.dnc.entity.PartsDepartment; import org.jeecg.modules.dnc.ucenter.Department; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.system.entity.MdcProduction; import java.util.List; @@ -14,12 +15,12 @@ * @param partsId * @return */ List<Department> getDepartPermsByPartsId(@Param("partsId") String partsId); List<MdcProduction> getDepartPermsByPartsId(@Param("partsId") String partsId); /** * è·åå·²åé çé¨é¨ * @param partsId * @return */ List<Department> getDepartNonPermsByProductId(@Param("partsId") String partsId); List<MdcProduction> getDepartNonPermsByPartsId(@Param("partsId") String partsId); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessStreamMapper.java
@@ -12,4 +12,14 @@ * @return */ List<ProcessStream> getByUserPerms(String userId); /** * æ ¹æ®ä¸ç»é¨ä»¶åé¶ä»¶æ¥æ¾å·¥åº * @param productId * @param componentIds * @param partsIds * @return */ List<ProcessStream> findByPartsAndComponents(String productId, List<String> componentIds, List<String> partsIds); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessionDepartmentMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,28 @@ 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.ProcessionDepartment; import org.jeecg.modules.dnc.entity.WorkStep; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.system.entity.MdcProduction; import java.util.List; public interface ProcessionDepartmentMapper extends BaseMapper<ProcessionDepartment> { /** * è·åå·²åé çé¨é¨å表 * @param processionId * @return */ List<MdcProduction> getDepartPermsByProcessId(@Param("procession") String processionId); /** * è·åæªåé çé¨é¨å表 * @param processionId * @return */ List<MdcProduction> getDepartNonPermsByProcessId(@Param("procession") String processionId); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductDepartmentMapper.java
@@ -4,6 +4,7 @@ import org.jeecg.modules.dnc.entity.ProductDepartment; import org.jeecg.modules.dnc.ucenter.Department; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.system.entity.MdcProduction; import java.util.List; @@ -13,12 +14,12 @@ * @param productId * @return */ List<Department> getDepartPermsByProductId(@Param("productId") String productId); List<MdcProduction> getDepartPermsByProductId(@Param("productId") String productId); /** * è·åæªåé çé¨é¨å表 * @param productId * @return */ List<Department> getDepartNonPermsByProductId(@Param("productId") String productId); List<MdcProduction> getDepartNonPermsByProductId(@Param("productId") String productId); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/WorkStepDepartmentMapper.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.WorkStepDepartment; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.system.entity.MdcProduction; import java.util.List; public interface WorkStepDepartmentMapper extends BaseMapper<WorkStepDepartment> { /** * è·åå·²åé çé¨é¨å表 * @param id * @return */ List<MdcProduction> getDepartPermsByStepId(@Param("id") String id); /** * è·åæªåé çé¨é¨å表 * @param id * @return */ List<MdcProduction> getDepartNonPermsByStepId(@Param("id") String id); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentDepartmentMapper.xml
@@ -1,27 +1,27 @@ <?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.ComponentDepartmentMapper"> <select id="getDepartPermsByComponentId" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String"> select u.depart_id , u.depart_name , u.depart_code , u.parent_id , u.rank_level , u.priority from sys_department u <select id="getDepartPermsByComponentId" resultType="org.jeecg.modules.system.entity.MdcProduction" parameterType="String"> 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_component_department where component_id=#{componentId}) p on u.depart_id=p.depart_id on u.id=p.depart_id </select> <select id="getDepartNonPermsByComponentId" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String"> select u.depart_id , u.depart_name , u.depart_code , u.parent_id , u.rank_level , u.priority from sys_department u where u.depart_id not in (select depart_id from nc_component_department where component_id=#{componentId}) <select id="getDepartNonPermsByComponentId" resultType="org.jeecg.modules.system.entity.MdcProduction" parameterType="String"> 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_component_department where component_id=#{componentId}) </select> </mapper> lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsDepartmentMapper.xml
@@ -1,27 +1,27 @@ <?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.PartsDepartmentMapper"> <select id="getDepartPermsByPartsId" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String"> select u.depart_id , u.depart_name , u.depart_code , u.parent_id , u.rank_level , u.priority from sys_department u <select id="getDepartPermsByPartsId" resultType="org.jeecg.modules.system.entity.MdcProduction" parameterType="String"> 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_parts_department where parts_id=#{partsId}) p on u.depart_id=p.depart_id on u.id=p.depart_id </select> <select id="getDepartNonPermsByProductId" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String"> select u.depart_id , u.depart_name , u.depart_code , u.parent_id , u.rank_level , u.priority from sys_department u where u.depart_id not in (select depart_id from nc_parts_department where parts_id=#{partsId}) <select id="getDepartNonPermsByPartsId" resultType="org.jeecg.modules.system.entity.MdcProduction" parameterType="String"> 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_parts_department where parts_id=#{partsId}) </select> </mapper> lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessStreamMapper.xml
@@ -28,4 +28,38 @@ on p.PROCESS_ID = s.PROCESS_ID where p.delete_flag = 0 </select> <select id="findByPartsAndComponents" resultType="org.jeecg.modules.dnc.entity.ProcessStream"> SELECT * FROM nc_process_stream ps WHERE ps.PROCESS_ID IN ( SELECT pss.PROCESS_ID FROM nc_process_stream pss WHERE 1=1 <if test="productId != null and productId != ''"> AND pss.PRODUCT_ID = #{productId} </if> <if test="componentIds != null and componentIds.size() > 0"> AND pss.COMPONENT_ID IN <foreach collection = "componentIds" item = "componentId" index = "index" open = "(" close= ")" separator = ","> #{ componentId } </foreach> </if> AND ( pss.PARTS_ID IS NULL <if test="partsIds != null and partsIds.size() > 0"> OR pss.PARTS_ID IN <foreach collection = "partsIds" item = "partsId" index = "index" open = "(" close = ")" separator = ","> #{ partsId } </foreach> </if> ) ); </select> </mapper> lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessionDepartmentMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,27 @@ <?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.ProcessionDepartmentMapper"> <select id="getDepartPermsByProcessId" resultType="org.jeecg.modules.system.entity.MdcProduction" parameterType="String"> 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_department where process_id=#{c}) p on u.id=p.depart_id </select> <select id="getDepartNonPermsByProcessId" resultType="org.jeecg.modules.system.entity.MdcProduction" parameterType="String"> 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_department where process_id=#{process_id}) </select> </mapper> lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductDepartmentMapper.xml
@@ -1,27 +1,27 @@ <?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.ProductDepartmentMapper"> <select id="getDepartPermsByProductId" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String"> select u.depart_id , u.depart_name , u.depart_code <select id="getDepartPermsByProductId" resultType="org.jeecg.modules.system.entity.MdcProduction" parameterType="String"> select u.id , u.production_name , u.parent_id , u.rank_level , u.priority from sys_department u , u.production_order , u.org_type , org_code from mdc_production u inner join (select depart_id from nc_product_department where product_id=#{productId}) p on u.depart_id=p.depart_id on u.id=p.depart_id </select> <select id="getDepartNonPermsByProductId" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String"> select u.depart_id , u.depart_name , u.depart_code , u.parent_id , u.rank_level , u.priority from sys_department u where u.depart_id not in (select depart_id from nc_product_department where product_id=#{productId}) <select id="getDepartNonPermsByProductId" resultType="org.jeecg.modules.system.entity.MdcProduction" parameterType="String"> 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_product_department where product_id=#{productId}) </select> </mapper> lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/WorkStepDepartmentMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,27 @@ <?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.WorkStepDepartmentMapper"> <select id="getDepartPermsByStepId" resultType="org.jeecg.modules.system.entity.MdcProduction" parameterType="String"> 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_work_step_department where step_id=#{id}) p on u.id=p.depart_id </select> <select id="getDepartNonPermsByStepId" resultType="org.jeecg.modules.system.entity.MdcProduction" parameterType="String"> 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_work_step_department where step_id=#{id}) </select> </mapper> lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProcessInfoCode.java
@@ -10,7 +10,7 @@ PROCESS_PRODUCT_NONE(false,25402,"æ æç产åï¼"), PROCESS_COMPONENT_NONE(false,25403,"æ æçé¨ä»¶ï¼"), PROCESS_PARTS_NONE(false,25404,"æ æçé¶ä»¶ï¼"), PROCESS_NOT_EXIST(false,25405,"æ æçé¶ä»¶ï¼"), PROCESS_NOT_EXIST(false,25405,"æ æçå·¥åºï¼"), PROCESS_HAS_DOC(false,25406,"å·¥åºä¸æå ³èçææ¡£ï¼æ æ³å é¤ï¼"), PROCESS_CODE_NONE(false,25407,"请è¾å ¥å·¥åºå·ï¼"), PROCESS_IS_EXIST(false,25408,"该工åºå·²åå¨ï¼"), lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentDepartmentService.java
@@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.dnc.entity.ComponentDepartment; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.system.entity.MdcProduction; import org.springframework.stereotype.Service; import java.util.List; @@ -20,14 +21,14 @@ * @param componentId * @return */ List<Department> getDepartPermsByComponentId(String componentId); List<MdcProduction> getDepartPermsByComponentId(String componentId); /** * è·åæªåé çé¨é¨ * @param componentId * @return */ List<Department> getDepartNonPermsByComponentId(String componentId); List<MdcProduction> getDepartNonPermsByComponentId(String componentId); /** * è·åå¯ä¸çé¨é¨æé lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentInfoService.java
@@ -5,6 +5,7 @@ import org.jeecg.modules.dnc.entity.ComponentInfo; import org.jeecg.modules.dnc.entity.PermissionStream; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.SysUser; import org.springframework.stereotype.Service; @@ -104,7 +105,7 @@ * @param departmentList * @return */ boolean assignAddDepart(ComponentInfo componentInfo, Collection<Department> departmentList); boolean assignAddDepart(ComponentInfo componentInfo, Collection<MdcProduction> departmentList); /** * ç§»é¤é¨é¨æé @@ -112,7 +113,7 @@ * @param departmentList * @return */ boolean assignRemoveDepart(ComponentInfo componentInfo, Collection<Department> departmentList); boolean assignRemoveDepart(ComponentInfo componentInfo, Collection<MdcProduction> departmentList); /** * è·åå¯ä¸ é¨ä»¶ç¼å· lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsDepartmentService.java
@@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.dnc.entity.PartsDepartment; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.system.entity.MdcProduction; import java.util.List; @@ -19,14 +20,14 @@ * @param partsId * @return */ List<Department> getDepartPermsByPartsId(String partsId); List<MdcProduction> getDepartPermsByPartsId(String partsId); /** * è·åå·²åé çé¨é¨ * @param partsId * @return */ List<Department> getDepartNonPermsByProductId(String partsId); List<MdcProduction> getDepartNonPermsByProductId(String partsId); /** * æ¥è¯¢é¨é¨æé lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsInfoService.java
@@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.dnc.entity.PartsInfo; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.SysUser; import java.util.Collection; @@ -90,7 +91,7 @@ * @param departmentList * @return */ boolean assignAddDepart(PartsInfo partsInfo, Collection<Department> departmentList); boolean assignAddDepart(PartsInfo partsInfo, Collection<MdcProduction> departmentList); /** * åé é¨é¨æé @@ -98,7 +99,7 @@ * @param departmentList * @return */ boolean assignRemoveDepart(PartsInfo partsInfo, Collection<Department> departmentList); boolean assignRemoveDepart(PartsInfo partsInfo, Collection<MdcProduction> departmentList); /** * æ ¹æ®ä¸ç»é¨ä»¶æ¥æ¾é¶ä»¶ lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java
@@ -33,6 +33,26 @@ PermissionStream getByPartsIdAndUserId(String productId, String componentId, String partsId, String userId); /** * æ ¹æ®é¶ä»¶ç¼å·ï¼ç¨æ·ç¼å·æ¥æ¾æé * @param productId * @param componentId * @param userId * @param partsId * @return */ PermissionStream getByProcessIdAndUserId(String productId, String componentId, String partsId,String processId,String userId); /** * æ ¹æ®é¶ä»¶ç¼å·ï¼ç¨æ·ç¼å·æ¥æ¾æé * @param productId * @param componentId * @param userId * @param partsId * @return */ PermissionStream getByStepIdAndUserId(String productId, String componentId, String partsId,String processId,String stepId, String userId); /** * æ ¹æ®äº§åç¼å·æ¥æ¾é¨é¨æé * @param productId * @return @@ -128,6 +148,29 @@ PermissionStream getByPartsIdAndDepartId(String productId, String componentId, String partsId, String departId); /** * æ ¹æ®å·¥åºç¼å·ï¼ç¨æ·ç¼å·æ¥æ¾æé * @param productId * @param componentId * @param departId * @param partsId * @param processId * @return */ PermissionStream getByProcessIdAndDepartId(String productId, String componentId, String partsId,String processId, String departId); /** * æ ¹æ®å·¥æ¥ç¼å·ï¼ç¨æ·ç¼å·æ¥æ¾æé * @param productId * @param componentId * @param departId * @param partsId * @param processId * @param stepId * @return */ PermissionStream getByStepIdAndDepartId(String productId, String componentId, String partsId,String processId,String stepId, String departId); /** * è·åé¨é¨å ³èçæéä¿¡æ¯ * @param departId * @return lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java
@@ -1,9 +1,14 @@ 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.ProcessStream; import org.jeecg.modules.dnc.entity.WorkStep; import org.jeecg.modules.dnc.request.ProcessStreamRequest; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.system.entity.MdcProduction; import java.util.Collection; import java.util.List; public interface IProcessStreamService extends IService<ProcessStream> { @@ -94,4 +99,30 @@ * @return */ List<ProcessStream> getByuserPerms(String userId,String queryParam); /** * åé é¨é¨æé * @param processStream * @param departmentList * @return */ boolean assignAddDepart(ProcessStream processStream, Collection<MdcProduction> departmentList); /** * æ ¹æ®ä¸ç»é¨ä»¶åé¶ä»¶æ¥æ¾å·¥åº * @param productId * @param componentIds * @param partsIds * @return */ List<ProcessStream> getByComponentIdList(String productId, List<String> componentIds,List<String> partsIds); /** * åé é¨é¨æé * @param processStream * @param departmentList * @return */ boolean assignRemoveDepart(ProcessStream processStream, Collection<MdcProduction> departmentList); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessionDepartmentService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,58 @@ package org.jeecg.modules.dnc.service; import com.baomidou.mybatisplus.extension.service.IService; 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.entity.ProductDepartment; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.system.entity.MdcProduction; import java.util.List; public interface IProcessionDepartmentService extends IService<ProcessionDepartment> { /** * æ ¹æ®äº§åidå é¤é¨é¨æé * @param processId * @return */ boolean deleteByProcessId(String processId); /** * è·åå·²åé çé¨é¨å表 * @param processId * @return */ List<MdcProduction> getDepartPermsByProcessId(String processId); /** * è·åæªåé çé¨é¨å表 * @param processId * @return */ List<MdcProduction> getDepartNonPermsByProcessId(String processId); /** * å é¤é¨é¨æéæ°æ® * @param processionDepartmentList * @return */ boolean removeByCollection(List<ProcessionDepartment> processionDepartmentList); /** * æ¥è¯¢å¯ä¸çé¨é¨æé * @param processId * @param departId * @return */ ProcessionDepartment getByProcessIdAndDepartId(String processId, String departId); /** * æ¥è¯¢ä¸ç»é¨é¨æé * @param processId * @param departIds * @return */ List<ProcessionDepartment> getByPartsIdsAndDepartIds(List<String> processId, List<String> departIds); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductDepartmentService.java
@@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.dnc.entity.ProductDepartment; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.system.entity.MdcProduction; import java.util.List; @@ -20,14 +21,14 @@ * @param productId * @return */ List<Department> getDepartPermsByProductId(String productId); List<MdcProduction> getDepartPermsByProductId(String productId); /** * è·åæªåé çé¨é¨å表 * @param productId * @return */ List<Department> getDepartNonPermsByProductId(String productId); List<MdcProduction> getDepartNonPermsByProductId(String productId); /** * å é¤é¨é¨æéæ°æ® lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductInfoService.java
@@ -5,6 +5,7 @@ import org.jeecg.modules.dnc.response.CommonGenericTree; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.dnc.ucenter.UserDepartExt; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.SysUser; import java.util.Collection; @@ -84,7 +85,7 @@ * @param paramId * @return */ List<Department> getDepartPermsList(Integer nodeType, String paramId); List<MdcProduction> getDepartPermsList(Integer nodeType, String paramId); /** * è·åæªåé çé¨é¨ @@ -92,7 +93,7 @@ * @param paramId * @return */ List<Department> getDepartNonPermsList(Integer nodeType, String paramId); List<MdcProduction> getDepartNonPermsList(Integer nodeType, String paramId); /** * ææ´¾äº§åæ èç¹çç¨æ·æé @@ -158,7 +159,7 @@ * @param departmentList * @return */ boolean assignAddDepartment(ProductInfo productInfo, Collection<Department> departmentList); boolean assignAddDepartment(ProductInfo productInfo, Collection<MdcProduction> departmentList); /** @@ -167,7 +168,7 @@ * @param departmentList * @return */ boolean assignRemoveDepartment(ProductInfo productInfo, Collection<Department> departmentList); boolean assignRemoveDepartment(ProductInfo productInfo, Collection<MdcProduction> departmentList); /** * è·åèç¹çé¨é¨æé lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IWorkStepDepartmentService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,59 @@ package org.jeecg.modules.dnc.service; import com.baomidou.mybatisplus.extension.service.IService; 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.entity.WorkStepDepartment; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.system.entity.MdcProduction; import java.util.List; public interface IWorkStepDepartmentService extends IService<WorkStepDepartment> { /** * æ ¹æ®äº§åidå é¤é¨é¨æé * @param stepId * @return */ boolean deleteByStepId(String stepId); /** * è·åå·²åé çé¨é¨å表 * @param stepId * @return */ List<MdcProduction> getDepartPermsByStepId(String stepId); /** * è·åæªåé çé¨é¨å表 * @param stepId * @return */ List<MdcProduction> getDepartNonPermsByStepId(String stepId); /** * å é¤é¨é¨æéæ°æ® * @param workStepDepartmentList * @return */ boolean removeByCollection(List<WorkStepDepartment> workStepDepartmentList); /** * æ¥è¯¢å¯ä¸çé¨é¨æé * @param stepId * @param departId * @return */ WorkStepDepartment getByStepIdAndDepartId(String stepId, String departId); /** * æ¥è¯¢ä¸ç»é¨é¨æé * @param stepId * @param departIds * @return */ List<WorkStepDepartment> getByPartsIdsAndDepartIds(List<String> stepId, List<String> departIds); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IWorkStepService.java
@@ -1,11 +1,11 @@ package org.jeecg.modules.dnc.service; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.dnc.entity.ProcessStream; import org.jeecg.modules.dnc.entity.ProductInfo; import org.jeecg.modules.dnc.entity.SynchronizedFlag; import org.jeecg.modules.dnc.entity.WorkStep; import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.system.entity.MdcProduction; import java.util.Collection; import java.util.List; /** @@ -53,4 +53,26 @@ */ WorkStep getByWorkStepNo(String processId,String craftNo); /** * åé é¨é¨æé * @param workStep * @param departmentList * @return */ boolean assignAddDepart(WorkStep workStep, Collection<MdcProduction> departmentList); /** * éè¿ä¸ç»å·¥åºå·è·åå·¥æ¥ * @param processIds * @return */ List<WorkStep> getByProcessIds(String productId,List<String> processIds); /** * åé é¨é¨æé * @param workStep * @param departmentList * @return */ boolean assignRemoveDepart(WorkStep workStep, Collection<MdcProduction> departmentList); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentDepartmentServiceImpl.java
@@ -9,6 +9,7 @@ import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.dnc.utils.ValidateUtil; import org.apache.commons.collections4.ListUtils; import org.jeecg.modules.system.entity.MdcProduction; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; @@ -27,12 +28,12 @@ } @Override public List<Department> getDepartPermsByComponentId(String componentId) { public List<MdcProduction> getDepartPermsByComponentId(String componentId) { return super.getBaseMapper().getDepartPermsByComponentId(componentId); } @Override public List<Department> getDepartNonPermsByComponentId(String componentId) { public List<MdcProduction> getDepartNonPermsByComponentId(String componentId) { return super.getBaseMapper().getDepartNonPermsByComponentId(componentId); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java
@@ -20,6 +20,7 @@ import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.dnc.utils.ValidateUtil; import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.dnc.entity.ComponentInfo; import org.springframework.beans.factory.annotation.Autowired; @@ -412,23 +413,23 @@ @Override @Transactional(rollbackFor = {Exception.class}) public boolean assignAddDepart(ComponentInfo componentInfo, Collection<Department> departmentList) { public boolean assignAddDepart(ComponentInfo componentInfo, Collection<MdcProduction> departmentList) { if(componentInfo == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ComponentDepartment> componentDepartments = new ArrayList<>(); List<PermissionStream> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getDepartId()); ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getId()); if(en == null) { en = new ComponentDepartment(); en.setDepartId(item.getDepartId()); en.setDepartId(item.getId()); en.setComponentId(componentInfo.getComponentId()); componentDepartments.add(en); } PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getDepartId()); PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getId()); if(stream == null) { stream = new PermissionStream(); stream.setDepartId(item.getDepartId()); stream.setDepartId(item.getId()); stream.setProductId(componentInfo.getProductId()); stream.setComponentId(componentInfo.getComponentId()); permissionStreamList.add(stream); @@ -451,17 +452,17 @@ @Override @Transactional(rollbackFor = {Exception.class}) public boolean assignRemoveDepart(ComponentInfo componentInfo, Collection<Department> departmentList) { public boolean assignRemoveDepart(ComponentInfo componentInfo, Collection<MdcProduction> departmentList) { if(componentInfo == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ComponentDepartment> componentDepartments = new ArrayList<>(); List<PermissionStream> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getDepartId()); ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getId()); if(en != null) { componentDepartments.add(en); } PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getDepartId()); PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getId()); if(stream != null) { permissionStreamList.add(stream); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java
@@ -816,6 +816,7 @@ } queryWrapper.ge(StrUtil.isNotEmpty(docQuery.getStartTime()),"date_format(u.create_time,'%Y-%m-%d %H:%i:%s')",docQuery.getStartTime()); queryWrapper.le(StrUtil.isNotEmpty(docQuery.getEndTime()),"date_format(u.create_time,'%Y-%m-%d %H:%i:%s')",docQuery.getEndTime()); queryWrapper.orderByDesc("u.create_time"); return super.getBaseMapper().findDocExtList(queryWrapper); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsDepartmentServiceImpl.java
@@ -9,6 +9,7 @@ import org.jeecg.modules.dnc.utils.ValidateUtil; import org.jeecg.modules.dnc.service.IPartsDepartmentService; import org.apache.commons.collections4.ListUtils; import org.jeecg.modules.system.entity.MdcProduction; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -28,13 +29,13 @@ } @Override public List<Department> getDepartPermsByPartsId(String partsId) { public List<MdcProduction> getDepartPermsByPartsId(String partsId) { return super.getBaseMapper().getDepartPermsByPartsId(partsId); } @Override public List<Department> getDepartNonPermsByProductId(String partsId) { return super.getBaseMapper().getDepartNonPermsByProductId(partsId); public List<MdcProduction> getDepartNonPermsByProductId(String partsId) { return super.getBaseMapper().getDepartNonPermsByPartsId(partsId); } @Override lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java
@@ -21,6 +21,7 @@ import org.jeecg.modules.dnc.utils.ValidateUtil; import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.SysUser; import org.apache.commons.collections4.ListUtils; @@ -376,23 +377,24 @@ @Override @Transactional(rollbackFor = {Exception.class}) public boolean assignAddDepart(PartsInfo partsInfo, Collection<Department> departmentList) { public boolean assignAddDepart(PartsInfo partsInfo, Collection<MdcProduction> departmentList) { if(partsInfo == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<PartsDepartment> partsDepartments = new ArrayList<>(); List<PermissionStream> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getDepartId()); PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getId()); if(en == null) { en = new PartsDepartment(); en.setDepartId(item.getDepartId()); en.setDepartId(item.getId()); en.setPartsId(partsInfo.getPartsId()); partsDepartments.add(en); } PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getDepartId()); PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getId()); if(stream == null) { stream = new PermissionStream(); stream.setDepartId(item.getDepartId()); stream.setDepartId(item.getId()); stream.setProductId(partsInfo.getProductId()); stream.setComponentId(partsInfo.getComponentId()); stream.setPartsId(partsInfo.getPartsId()); @@ -416,17 +418,18 @@ @Override @Transactional(rollbackFor = {Exception.class}) public boolean assignRemoveDepart(PartsInfo partsInfo, Collection<Department> departmentList) { public boolean assignRemoveDepart(PartsInfo partsInfo, Collection<MdcProduction> departmentList) { if(partsInfo == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<PartsDepartment> partsDepartments = new ArrayList<>(); List<PermissionStream> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getDepartId()); 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.getDepartId()); PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getId()); if(stream != null) { permissionStreamList.add(stream); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java
@@ -1,5 +1,6 @@ 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.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -48,6 +49,52 @@ List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). eq(PermissionStream::getUserId, userId).eq(PermissionStream::getComponentId, componentId) .eq(PermissionStream::getPartsId, partsId).list(); if(list == null || list.isEmpty()) return null; return list.get(0); } /** * æ ¹æ®é¶ä»¶ç¼å·ï¼ç¨æ·ç¼å·æ¥æ¾æé-å·¥åº * @param productId * @param componentId * @param userId * @param partsId * @return */ @Override public PermissionStream getByProcessIdAndUserId(String productId, String componentId, String partsId,String processId,String userId){ if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(userId) || !ValidateUtil.validateString(componentId) || !ValidateUtil.validateString(processId)) return null; List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). eq(PermissionStream::getUserId, userId).eq(PermissionStream::getComponentId, componentId) .eq(StrUtil.isNotEmpty(partsId),PermissionStream::getPartsId, partsId) .eq(PermissionStream::getProcessId, processId).list(); if(list == null || list.isEmpty()) return null; return list.get(0); } /** * æ ¹æ®é¶ä»¶ç¼å·ï¼ç¨æ·ç¼å·æ¥æ¾æé-å·¥æ¥ * @param productId * @param componentId * @param userId * @param partsId * @return */ @Override public PermissionStream getByStepIdAndUserId(String productId, String componentId, String partsId,String processId,String stepId, String userId){ if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(userId) || !ValidateUtil.validateString(componentId) || !ValidateUtil.validateString(processId) || !ValidateUtil.validateString(stepId)) return null; List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). eq(PermissionStream::getUserId, userId).eq(PermissionStream::getComponentId, componentId) .eq(StrUtil.isNotEmpty(partsId),PermissionStream::getPartsId, partsId) .eq(PermissionStream::getProcessId, processId) .eq(PermissionStream::getStepId, stepId).list(); if(list == null || list.isEmpty()) return null; return list.get(0); @@ -209,6 +256,53 @@ return list.get(0); } /** * æ ¹æ®å·¥åºç¼å·ï¼ç¨æ·ç¼å·æ¥æ¾æé * @param productId * @param componentId * @param departId * @param partsId * @param processId * @return */ @Override public PermissionStream getByProcessIdAndDepartId(String productId, String componentId, String partsId,String processId, String departId){ if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(departId) || !ValidateUtil.validateString(componentId) || !ValidateUtil.validateString(processId)) return null; List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId).eq(PermissionStream::getDepartId, departId) .eq(PermissionStream::getComponentId, componentId).eq(StrUtil.isNotEmpty(partsId),PermissionStream::getPartsId, partsId).eq(PermissionStream::getProcessId,processId) .isNull(PermissionStream::getUserId).list(); if(list == null || list.isEmpty()) return null; return list.get(0); } /** * æ ¹æ®å·¥æ¥ç¼å·ï¼ç¨æ·ç¼å·æ¥æ¾æé * @param productId * @param componentId * @param departId * @param partsId * @param processId * @param stepId * @return */ @Override public PermissionStream getByStepIdAndDepartId(String productId, String componentId, String partsId,String processId,String stepId, String departId){ if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(departId) || !ValidateUtil.validateString(componentId) || !ValidateUtil.validateString(processId) || !ValidateUtil.validateString(stepId)) return null; List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId).eq(PermissionStream::getDepartId, departId) .eq(PermissionStream::getComponentId, componentId).eq(StrUtil.isNotEmpty(partsId),PermissionStream::getPartsId, partsId).eq(PermissionStream::getProcessId,processId) .eq(PermissionStream::getStepId,stepId) .isNull(PermissionStream::getUserId).list(); if(list == null || list.isEmpty()) return null; return list.get(0); } @Override public List<PermissionStream> findByDepartId(String departId) { return super.lambdaQuery().eq(PermissionStream::getDepartId, departId).list(); lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java
@@ -14,16 +14,20 @@ import org.jeecg.modules.dnc.response.*; import org.jeecg.modules.dnc.service.*; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.dnc.utils.ValidateUtil; import org.jeecg.modules.dnc.request.ProcessStreamRequest; import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.system.entity.MdcProduction; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -45,6 +49,8 @@ private INcLogInfoService iNcLogInfoService; @Autowired private IPermissionStreamService permissionStreamService; @Autowired private IProcessionDepartmentService processionDepartmentService; @Override @Transactional(rollbackFor = {Exception.class}) @@ -264,4 +270,90 @@ queryWrapper.orderByAsc(ProcessStream::getCreateTime); return super.list(queryWrapper); } @Override @Transactional(rollbackFor = {Exception.class}) public boolean assignAddDepart(ProcessStream processStream, Collection<MdcProduction> departmentList) { if(processStream == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ProcessionDepartment> processionDepartmentList = new ArrayList<>(); List<PermissionStream> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { ProcessionDepartment en = processionDepartmentService.getByProcessIdAndDepartId(processStream.getProcessId(), item.getId()); if(en == null) { en = new ProcessionDepartment(); en.setDepartId(item.getId()); en.setProcessId(processStream.getProcessId()); processionDepartmentList.add(en); } PermissionStream stream = permissionStreamService.getByProcessIdAndDepartId(processStream.getProductId(), processStream.getComponentId(), processStream.getPartsId(),processStream.getProcessId(),item.getId()); if(stream == null) { stream = new PermissionStream(); stream.setDepartId(item.getId()); stream.setProductId(processStream.getProductId()); stream.setComponentId(processStream.getComponentId()); stream.setPartsId(processStream.getPartsId()); stream.setProcessId(processStream.getProcessId()); permissionStreamList.add(stream); } }); if(!processionDepartmentList.isEmpty()) { boolean b = processionDepartmentService.saveBatch(processionDepartmentList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } } if(!permissionStreamList.isEmpty()) { boolean b = permissionStreamService.saveBatch(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } } return true; } @Override public List<ProcessStream> getByComponentIdList(String productId, List<String> componentIds, List<String> partsIds) { return super.baseMapper.findByPartsAndComponents(productId,componentIds,partsIds); } /** * åé é¨é¨æé * @param processStream * @param departmentList * @return */ @Override public boolean assignRemoveDepart(ProcessStream processStream, Collection<MdcProduction> departmentList){ if(processStream == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ProcessionDepartment> processionDepartmentList = new ArrayList<>(); List<PermissionStream> 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()); if(stream != null) { permissionStreamList.add(stream); } }); if(!processionDepartmentList.isEmpty()) { boolean b = processionDepartmentService.removeByCollection(processionDepartmentList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } } if(!permissionStreamList.isEmpty()) { boolean b = permissionStreamService.removeByCollection(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } } return true; } } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessionDepartmentService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,94 @@ 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 { @Override public boolean deleteByProcessId(String processId) { return false; } @Override public List<MdcProduction> getDepartPermsByProcessId(String processId) { return super.baseMapper.getDepartPermsByProcessId(processId); } @Override public List<MdcProduction> getDepartNonPermsByProcessId(String processId) { return super.baseMapper.getDepartNonPermsByProcessId(processId); } @Override public boolean removeByCollection(List<ProcessionDepartment> processionDepartmentList) { if(processionDepartmentList == null || processionDepartmentList.isEmpty()) return false; if(processionDepartmentList.size() == 1) return super.removeById(processionDepartmentList.get(0).getId()); List<String> ids = new ArrayList<>(); processionDepartmentList.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); } } @Override public ProcessionDepartment getByProcessIdAndDepartId(String processId, String departId) { return null; } @Override public List<ProcessionDepartment> getByPartsIdsAndDepartIds(List<String> processId, List<String> departIds) { if(processId == null || processId.isEmpty() || departIds == null || departIds.isEmpty()) return null; List<ProcessionDepartment> total = new ArrayList<>(); List<List<String>> processListArr; List<List<String>> departListArr; if(processId.size() > 1000){ processListArr = ListUtils.partition(processId, 100); }else { processListArr = ListUtils.partition(processId, 1000); } if(departIds.size() > 1000){ departListArr = ListUtils.partition(departIds, 100); }else { departListArr = ListUtils.partition(departIds, 1000); } for(List<String> processList : processListArr) { for(List<String> departList : departListArr){ LambdaQueryWrapper<ProcessionDepartment> queryWrapper = Wrappers.lambdaQuery(); queryWrapper.in(ProcessionDepartment::getProcessId, processList); queryWrapper.in(ProcessionDepartment::getDepartId, departList); List<ProcessionDepartment> 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/ProductDepartmentServiceImpl.java
@@ -8,6 +8,7 @@ import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.dnc.utils.ValidateUtil; import org.jeecg.modules.dnc.service.IProductDepartmentService; import org.jeecg.modules.system.entity.MdcProduction; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -27,12 +28,12 @@ } @Override public List<Department> getDepartPermsByProductId(String productId) { public List<MdcProduction> getDepartPermsByProductId(String productId) { return super.getBaseMapper().getDepartPermsByProductId(productId); } @Override public List<Department> getDepartNonPermsByProductId(String productId) { public List<MdcProduction> getDepartNonPermsByProductId(String productId) { return super.getBaseMapper().getDepartNonPermsByProductId(productId); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java
@@ -13,6 +13,7 @@ import org.jeecg.modules.dnc.exception.ExceptionCast; import org.jeecg.modules.dnc.mapper.ProductInfoMapper; import org.jeecg.modules.dnc.response.*; import org.jeecg.modules.dnc.service.*; import org.jeecg.modules.dnc.service.support.ProductTreeWrapper; import org.jeecg.modules.dnc.ucenter.Department; @@ -20,15 +21,11 @@ import org.jeecg.modules.dnc.utils.ValidateUtil; import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.service.IMdcProductionService; import org.jeecg.modules.system.service.ISysUserService; import org.jeecg.modules.dnc.response.ComponentInfoCode; import org.jeecg.modules.dnc.response.PartsInfoCode; import org.jeecg.modules.dnc.response.ProductInfoCode; import org.jeecg.modules.dnc.response.UcenterCode; import org.jeecg.modules.dnc.response.CommonCode; import org.jeecg.modules.dnc.response.CommonGenericTree; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; @@ -73,6 +70,12 @@ private IDocInfoService docInfoService; @Autowired private INcLogInfoService iNcLogInfoService; @Autowired private IWorkStepDepartmentService workStepDepartmentService; @Autowired private IProcessionDepartmentService processionDepartmentService; @Autowired private IMdcProductionService mdcProductionService; @Override @Transactional(rollbackFor = {Exception.class}) @@ -272,25 +275,33 @@ if(productInfo == null) ExceptionCast.cast(ProductInfoCode.PRODUCT_NOT_EXIST); PermissionStream permission = permissionStreamService.getByProductIdAndUserId(paramId, userId); if(permission == null) return false; return true; 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); if(permission == null) return false; return true; 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); if(permission == null) return false; return true; 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.getProcessId(),processStream.getComponentId() ,processStream.getPartsId(),processStream.getProcessId(),userId); 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.getProcessId(),workStep.getComponentId() ,workStep.getPartsId(),workStep.getProcessId(),workStep.getId(),userId); return permission != null; } return false; } @@ -326,7 +337,7 @@ } @Override public List<Department> getDepartPermsList(Integer nodeType, String paramId) { public List<MdcProduction> getDepartPermsList(Integer nodeType, String paramId) { if(!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) return null; if(nodeType == 1) { @@ -335,13 +346,19 @@ return componentDepartmentService.getDepartPermsByComponentId(paramId); }else if(nodeType == 3) { return partsDepartmentService.getDepartPermsByPartsId(paramId); }else { }else if(nodeType == 5) { return processionDepartmentService.getDepartPermsByProcessId(paramId); }else if(nodeType == 6) { return workStepDepartmentService.getDepartPermsByStepId(paramId); } //todo å°è£ æ ç¶ç»æ else { return null; } } @Override public List<Department> getDepartNonPermsList(Integer nodeType, String paramId) { public List<MdcProduction> getDepartNonPermsList(Integer nodeType, String paramId) { if(!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) return null; if(nodeType == 1) { @@ -350,7 +367,13 @@ return componentDepartmentService.getDepartNonPermsByComponentId(paramId); }else if(nodeType == 3) { return partsDepartmentService.getDepartNonPermsByProductId(paramId); }else { }else if(nodeType == 5) { return processionDepartmentService.getDepartNonPermsByProcessId(paramId); }else if(nodeType == 6) { return workStepDepartmentService.getDepartNonPermsByStepId(paramId); } //todo å°è£ æ ç¶ç»æ else { return null; } } @@ -774,7 +797,7 @@ /** * å¾ ä¼å TODO * @param nodeType 1 产å 2 é¨ä»¶ 3 é¶ä»¶ * @param nodeType 1 产å 2 é¨ä»¶ 3 é¶ä»¶ 5 å·¥åº 6 å·¥æ¥ * @param paramId äº§åæ èç¹id * @param relativeFlag 1 æ¯ 2 å¦ * @param departmentIds æ·»å é¨é¨ids @@ -790,10 +813,30 @@ ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_NONE); List<String> ids = new ArrayList<>(departmentIds.length); Collections.addAll(ids, departmentIds); Collection<Department> departList = departmentService.listByIds(ids); if(departList == null || departList.isEmpty() || departList.size() != departmentIds.length) Collection<MdcProduction> mdcProductionList=mdcProductionService.listByIds(ids); if(mdcProductionList == null || mdcProductionList.isEmpty() || mdcProductionList.size() != departmentIds.length) ExceptionCast.cast(CommonCode.INVALID_PARAM); if(nodeType == 3) { if(nodeType == 6) { //å¤çå·¥æ¥ WorkStep workStep=workStepService.getById(paramId); if (workStep == null) ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); boolean b = checkProductPerm(6, workStep.getId()); if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } return workStepService.assignAddDepart(workStep, mdcProductionList); }else if(nodeType == 5) { //å¤çå·¥åº ProcessStream processStream = processStreamService.getById(paramId); if (processStream == null) ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); boolean b = checkProductPerm(5, processStream.getProcessId()); if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } return processStreamService.assignAddDepart(processStream, mdcProductionList); }else if(nodeType == 3) { //å¤çé¶ä»¶ PartsInfo partsInfo = partsInfoService.getById(paramId); if(partsInfo == null) @@ -802,7 +845,7 @@ if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } return partsInfoService.assignAddDepart(partsInfo, departList); return partsInfoService.assignAddDepart(partsInfo, mdcProductionList); }else if(nodeType == 1) { //å¤ç产å ProductInfo productInfo = super.getById(paramId); @@ -811,7 +854,7 @@ boolean b1 = checkProductPerm(1, productInfo.getProductId()); if(!b1) ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); b1 = this.assignAddDepartment(productInfo, departList); b1 = this.assignAddDepartment(productInfo, mdcProductionList); if(!b1) ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); if(relativeFlag == 1) { @@ -820,9 +863,14 @@ //æç»ä¿åæéæ°æ®åå§å List<ComponentDepartment> componentPermissionList = new ArrayList<>(); List<PartsDepartment> partsPermissionList = new ArrayList<>(); List<ProcessionDepartment> processionPermissionList = new ArrayList<>(); List<WorkStepDepartment> workStepDepartmentList=new ArrayList<>(); List<PermissionStream> permissionStreamList = new ArrayList<>(); //å¤çåé¨ä»¶ List<String> componentIds = new ArrayList<>(); List<String> partsIds= new ArrayList<>(); List<String> ProcessionIds= new ArrayList<>(); List<String> workStepIds= new ArrayList<>(); PermissionStream s; Map<String, ComponentDepartment> componentPermissionMap = new HashMap<>(); @@ -835,9 +883,9 @@ for(ComponentInfo c : componentInfoList){ componentIds.add(c.getComponentId()); componentInfoMap.put(c.getComponentId(), c); for(Department u : departList){ key = c.getComponentId() + "," + u.getDepartId(); cp = new ComponentDepartment(c.getComponentId(), u.getDepartId()); for(MdcProduction mdcProduction : mdcProductionList){ key = c.getComponentId() + "," + mdcProduction.getId(); cp = new ComponentDepartment(c.getComponentId(), mdcProduction.getId()); componentPermissionMap.put(key, cp); } } @@ -868,15 +916,15 @@ if(partsInfoList != null && !partsInfoList.isEmpty()) { Map<String, PartsDepartment> partsPermissionHashMap = new HashMap<>(); Map<String, PartsInfo> partsInfoMap = new HashMap<>(); List<String> partsIds = new ArrayList<>(); partsIds = new ArrayList<>(); PartsDepartment pp; PartsInfo ptInfo; for(PartsInfo p : partsInfoList){ partsIds.add(p.getPartsId()); partsInfoMap.put(p.getPartsId(), p); for(Department u : departList){ key = p.getPartsId() + "," + u.getDepartId(); pp = new PartsDepartment(p.getPartsId(), u.getDepartId()); for(MdcProduction mdcProduction : mdcProductionList){ key = p.getPartsId() + "," + mdcProduction.getId(); pp = new PartsDepartment(p.getPartsId(), mdcProduction.getId()); partsPermissionHashMap.put(key, pp); } } @@ -906,11 +954,105 @@ } } //æ¥è¯¢å·¥åºå·²åå¨çæéæ°æ® List<ProcessStream> processStreamList = processStreamService.getByComponentIdList(productInfo.getProductId(),componentIds,partsIds); if(processStreamList != null && !processStreamList.isEmpty()) { Map<String, ProcessionDepartment> processionDepartmentHashMap = new HashMap<>(); Map<String, ProcessStream> processStreamMap = new HashMap<>(); ProcessionIds = new ArrayList<>(); ProcessionDepartment pp; ProcessStream processStream; for(ProcessStream p : processStreamList){ ProcessionIds.add(p.getProcessId()); processStreamMap.put(p.getProcessId(), p); for(MdcProduction mdcProduction : mdcProductionList){ key = p.getPartsId() + "," + mdcProduction.getId(); pp = new ProcessionDepartment(p.getProcessId(), mdcProduction.getId()); processionDepartmentHashMap.put(key, pp); } } //æ¥è¯¢å·²åå¨çæéæ°æ® List<ProcessionDepartment> processionDepartmentList = processionDepartmentService.getByPartsIdsAndDepartIds(ProcessionIds, ids); if(processionDepartmentList != null && !processionDepartmentList.isEmpty()){ //è¸¢åºæéæ°æ® for(ProcessionDepartment processionDepartment : processionDepartmentList){ key = processionDepartment.getProcessId() + "," + processionDepartment.getDepartId(); if(processionDepartmentHashMap.containsKey(key)){ processionDepartmentHashMap.remove(key); } } } for(Map.Entry<String, ProcessionDepartment> entry : processionDepartmentHashMap.entrySet()){ pp = entry.getValue(); processionPermissionList.add(pp); processStream = processStreamMap.get(pp.getProcessId()); s = new PermissionStream(); s.setProductId(processStream.getProductId()); s.setComponentId(processStream.getComponentId()); s.setPartsId(processStream.getPartsId()); s.setProcessId(processStream.getProcessId()); s.setDepartId(pp.getDepartId()); permissionStreamList.add(s); } } //æ¥è¯¢å·¥æ¥å·²åå¨çæéæ°æ® List<WorkStep> workStepList = workStepService.getByProcessIds(productInfo.getProductId(),ProcessionIds); if(workStepList != null && !workStepList.isEmpty()) { Map<String, WorkStepDepartment> workStepDepartmentHashMap = new HashMap<>(); Map<String, WorkStep> workStepHashMap = new HashMap<>(); workStepIds = new ArrayList<>(); WorkStepDepartment ws; WorkStep workStep; for(WorkStep w : workStepList){ workStepIds.add(w.getId()); workStepHashMap.put(w.getId(), w); for(MdcProduction mdcProduction : mdcProductionList){ key = w.getId() + "," + mdcProduction.getId(); ws = new WorkStepDepartment(w.getId(), mdcProduction.getId()); workStepDepartmentHashMap.put(key, ws); } } //æ¥è¯¢å·²åå¨çæéæ°æ® List<WorkStepDepartment> workStepDepartments = workStepDepartmentService.getByPartsIdsAndDepartIds(workStepIds, ids); if(workStepDepartments != null && !workStepDepartments.isEmpty()){ //è¸¢åºæéæ°æ® for(WorkStepDepartment workStepDepartment : workStepDepartments){ key = workStepDepartment.getStepId() + "," + workStepDepartment.getDepartId(); if(workStepDepartmentHashMap.containsKey(key)){ workStepDepartmentHashMap.remove(key); } } } for(Map.Entry<String, WorkStepDepartment> entry : workStepDepartmentHashMap.entrySet()){ ws = entry.getValue(); workStepDepartmentList.add(ws); workStep = workStepHashMap.get(ws.getStepId()); s = new PermissionStream(); s.setProductId(workStep.getProductId()); s.setComponentId(workStep.getComponentId()); s.setPartsId(workStep.getPartsId()); s.setProcessId(workStep.getProcessId()); s.setStepId(workStep.getId()); s.setDepartId(ws.getDepartId()); permissionStreamList.add(s); } } if(!componentPermissionList.isEmpty()){ componentDepartmentService.saveBatch(componentPermissionList); } if(!partsPermissionList.isEmpty()){ partsDepartmentService.saveBatch(partsPermissionList); } if(!processionPermissionList.isEmpty()){ processionDepartmentService.saveBatch(processionPermissionList); } if (!workStepDepartmentList.isEmpty()) { workStepDepartmentService.saveBatch(workStepDepartmentList); } if(!permissionStreamList.isEmpty()){ permissionStreamService.saveBatch(permissionStreamList); @@ -924,7 +1066,7 @@ boolean b1 = checkProductPerm(2, componentInfo.getComponentId()); if(!b1) ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); b1 = componentInfoService.assignAddDepart(componentInfo, departList); b1 = componentInfoService.assignAddDepart(componentInfo, mdcProductionList); if(!b1) ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); if(relativeFlag == 1) { @@ -934,10 +1076,15 @@ //æç»ä¿åæéæ°æ®åå§å List<ComponentDepartment> componentPermissionList = new ArrayList<>(); List<PartsDepartment> partsPermissionList = new ArrayList<>(); List<ProcessionDepartment> processionPermissionList = new ArrayList<>(); List<WorkStepDepartment> workStepDepartmentList=new ArrayList<>(); List<PermissionStream> permissionStreamList = new ArrayList<>(); //å¤çåé¨ä»¶ PermissionStream s; List<String> componentIds = new ArrayList<>(); List<String> partsIds= new ArrayList<>(); List<String> ProcessionIds= new ArrayList<>(); List<String> workStepIds= new ArrayList<>(); Map<String, ComponentDepartment> componentPermissionMap = new HashMap<>(); Map<String, ComponentInfo> componentInfoMap = new HashMap<>(); @@ -948,9 +1095,9 @@ for(ComponentInfo c : childrenList){ componentIdList.add(c.getComponentId()); componentInfoMap.put(c.getComponentId(), c); for(Department u : departList){ key = c.getComponentId() + "," + u.getDepartId(); cp = new ComponentDepartment(c.getComponentId(), u.getDepartId()); for(MdcProduction mdcProduction : mdcProductionList){ key = c.getComponentId() + "," + mdcProduction.getId(); cp = new ComponentDepartment(c.getComponentId(), mdcProduction.getId()); componentPermissionMap.put(key, cp); } } @@ -982,15 +1129,15 @@ if(partsInfoList != null && !partsInfoList.isEmpty()) { Map<String, PartsDepartment> partsPermissionHashMap = new HashMap<>(); Map<String, PartsInfo> partsInfoMap = new HashMap<>(); List<String> partsIds = new ArrayList<>(); partsIds = new ArrayList<>(); PartsDepartment pp; PartsInfo ptInfo; for(PartsInfo p : partsInfoList){ partsIds.add(p.getPartsId()); partsInfoMap.put(p.getPartsId(), p); for(Department u : departList){ key = p.getPartsId() + "," + u.getDepartId(); pp = new PartsDepartment(p.getPartsId(), u.getDepartId()); for(MdcProduction mdcProduction : mdcProductionList){ key = p.getPartsId() + "," + mdcProduction.getId(); pp = new PartsDepartment(p.getPartsId(), mdcProduction.getId()); partsPermissionHashMap.put(key, pp); } } @@ -1020,11 +1167,105 @@ } } //æ¥è¯¢å·¥åºå·²åå¨çæéæ°æ® List<ProcessStream> processStreamList = processStreamService.getByComponentIdList(componentInfo.getProductId(),componentIds,partsIds); if(processStreamList != null && !processStreamList.isEmpty()) { Map<String, ProcessionDepartment> processionDepartmentHashMap = new HashMap<>(); Map<String, ProcessStream> processStreamMap = new HashMap<>(); ProcessionIds = new ArrayList<>(); ProcessionDepartment pp; ProcessStream processStream; for(ProcessStream p : processStreamList){ ProcessionIds.add(p.getProcessId()); processStreamMap.put(p.getProcessId(), p); for(MdcProduction mdcProduction : mdcProductionList){ key = p.getPartsId() + "," + mdcProduction.getId(); pp = new ProcessionDepartment(p.getProcessId(), mdcProduction.getId()); processionDepartmentHashMap.put(key, pp); } } //æ¥è¯¢å·²åå¨çæéæ°æ® List<ProcessionDepartment> processionDepartmentList = processionDepartmentService.getByPartsIdsAndDepartIds(ProcessionIds, ids); if(processionDepartmentList != null && !processionDepartmentList.isEmpty()){ //è¸¢åºæéæ°æ® for(ProcessionDepartment processionDepartment : processionDepartmentList){ key = processionDepartment.getProcessId() + "," + processionDepartment.getDepartId(); if(processionDepartmentHashMap.containsKey(key)){ processionDepartmentHashMap.remove(key); } } } for(Map.Entry<String, ProcessionDepartment> entry : processionDepartmentHashMap.entrySet()){ pp = entry.getValue(); processionPermissionList.add(pp); processStream = processStreamMap.get(pp.getProcessId()); s = new PermissionStream(); s.setProductId(processStream.getProductId()); s.setComponentId(processStream.getComponentId()); s.setPartsId(processStream.getPartsId()); s.setProcessId(processStream.getProcessId()); s.setDepartId(pp.getDepartId()); permissionStreamList.add(s); } } //æ¥è¯¢å·¥æ¥å·²åå¨çæéæ°æ® List<WorkStep> workStepList = workStepService.getByProcessIds(componentInfo.getProductId(),ProcessionIds); if(workStepList != null && !workStepList.isEmpty()) { Map<String, WorkStepDepartment> workStepDepartmentHashMap = new HashMap<>(); Map<String, WorkStep> workStepHashMap = new HashMap<>(); workStepIds = new ArrayList<>(); WorkStepDepartment ws; WorkStep workStep; for(WorkStep w : workStepList){ workStepIds.add(w.getId()); workStepHashMap.put(w.getId(), w); for(MdcProduction mdcProduction : mdcProductionList){ key = w.getId() + "," + mdcProduction.getId(); ws = new WorkStepDepartment(w.getId(), mdcProduction.getId()); workStepDepartmentHashMap.put(key, ws); } } //æ¥è¯¢å·²åå¨çæéæ°æ® List<WorkStepDepartment> workStepDepartments = workStepDepartmentService.getByPartsIdsAndDepartIds(workStepIds, ids); if(workStepDepartments != null && !workStepDepartments.isEmpty()){ //è¸¢åºæéæ°æ® for(WorkStepDepartment workStepDepartment : workStepDepartments){ key = workStepDepartment.getStepId() + "," + workStepDepartment.getDepartId(); if(workStepDepartmentHashMap.containsKey(key)){ workStepDepartmentHashMap.remove(key); } } } for(Map.Entry<String, WorkStepDepartment> entry : workStepDepartmentHashMap.entrySet()){ ws = entry.getValue(); workStepDepartmentList.add(ws); workStep = workStepHashMap.get(ws.getStepId()); s = new PermissionStream(); s.setProductId(workStep.getProductId()); s.setComponentId(workStep.getComponentId()); s.setPartsId(workStep.getPartsId()); s.setProcessId(workStep.getProcessId()); s.setStepId(workStep.getId()); s.setDepartId(ws.getDepartId()); permissionStreamList.add(s); } } if(!componentPermissionList.isEmpty()){ componentDepartmentService.saveBatch(componentPermissionList); } if(!partsPermissionList.isEmpty()){ partsDepartmentService.saveBatch(partsPermissionList); } if(!processionPermissionList.isEmpty()){ processionDepartmentService.saveBatch(processionPermissionList); } if (!workStepDepartmentList.isEmpty()) { workStepDepartmentService.saveBatch(workStepDepartmentList); } if(!permissionStreamList.isEmpty()){ permissionStreamService.saveBatch(permissionStreamList); @@ -1037,7 +1278,7 @@ /** * å¾ ä¼å TODO * @param nodeType 1 产å 2 é¨ä»¶ 3 é¶ä»¶ * @param nodeType 1 产å 2 é¨ä»¶ 3 é¶ä»¶ 5 å·¥åº 6 å·¥æ¥ * @param paramId äº§åæ èç¹id * @param relativeFlag 1 æ¯ 2 å¦ * @param departmentIds ç§»é¤é¨é¨ids @@ -1053,10 +1294,30 @@ ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_NONE); List<String> ids = new ArrayList<>(departmentIds.length); Collections.addAll(ids, departmentIds); Collection<Department> departList = departmentService.listByIds(ids); if(departList == null || departList.isEmpty() || departList.size() != departmentIds.length) Collection<MdcProduction> mdcProductionList=mdcProductionService.listByIds(ids); if(mdcProductionList == null || mdcProductionList.isEmpty() || mdcProductionList.size() != departmentIds.length) ExceptionCast.cast(CommonCode.INVALID_PARAM); if(nodeType == 3) { if(nodeType == 6) { //å¤çå·¥æ¥ WorkStep workStep=workStepService.getById(paramId); if (workStep == null) ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); boolean b = checkProductPerm(6, workStep.getId()); if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } return workStepService.assignRemoveDepart(workStep, mdcProductionList); }else if(nodeType == 5) { //å¤çå·¥åº ProcessStream processStream = processStreamService.getById(paramId); if (processStream == null) ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); boolean b = checkProductPerm(5, processStream.getProcessId()); if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } return processStreamService.assignRemoveDepart(processStream, mdcProductionList); }else if(nodeType == 3) { //å¤çé¶ä»¶ PartsInfo partsInfo = partsInfoService.getById(paramId); if(partsInfo == null) @@ -1065,7 +1326,7 @@ if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } return partsInfoService.assignRemoveDepart(partsInfo, departList); return partsInfoService.assignRemoveDepart(partsInfo, mdcProductionList); }else if(nodeType == 1) { //å¤ç产å ProductInfo productInfo = super.getById(paramId); @@ -1074,7 +1335,7 @@ boolean b1 = checkProductPerm(1, productInfo.getProductId()); if(!b1) ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); b1 = this.assignRemoveDepartment(productInfo, departList); b1 = this.assignRemoveDepartment(productInfo, mdcProductionList); if(!b1) ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); if(relativeFlag == 1) { @@ -1083,8 +1344,13 @@ //æ»è®¡éè¦å é¤çæ°æ®ä¿¡æ¯ List<ComponentDepartment> componentPermissionList = new ArrayList<>(); List<PartsDepartment> partsPermissionList = new ArrayList<>(); List<ProcessionDepartment> processionPermissionList = new ArrayList<>(); List<WorkStepDepartment> workStepDepartmentList=new ArrayList<>(); List<PermissionStream> permissionStreamList = new ArrayList<>(); List<ComponentInfo> componentInfoList = componentInfoService.getByProductId(productInfo.getProductId()); List<String> partsIds= new ArrayList<>(); List<String> ProcessionIds= new ArrayList<>(); List<String> workStepIds= new ArrayList<>(); if(componentInfoList != null && !componentInfoList.isEmpty()) { for(ComponentInfo componentInfo : componentInfoList){ componentIds.add(componentInfo.getComponentId()); @@ -1098,7 +1364,7 @@ //å¤ç产å ä¸çé¶ä»¶ List<PartsInfo> partsInfoList = partsInfoService.getByComponentIdList(productInfo.getProductId(), componentIds); List<String> partsIds = new ArrayList<>(); partsIds = new ArrayList<>(); if(partsInfoList != null && !partsInfoList.isEmpty()) { for(PartsInfo partsInfo : partsInfoList){ partsIds.add(partsInfo.getPartsId()); @@ -1110,11 +1376,45 @@ } } //å¤çå·¥åº List<ProcessStream> processStreamList=processStreamService.getByComponentIdList(productInfo.getProductId(), componentIds,partsIds); ProcessionIds = new ArrayList<>(); if(processStreamList != null && !processStreamList.isEmpty()) { for(ProcessStream processStream : processStreamList){ ProcessionIds.add(processStream.getProcessId()); } processionPermissionList = processionDepartmentService.getByPartsIdsAndDepartIds(ProcessionIds, ids); List<PermissionStream> existPermissionList = permissionStreamService.getByPartsIdsAndDepartIds(ProcessionIds, ids); if(existPermissionList != null && !existPermissionList.isEmpty()){ permissionStreamList.addAll(existPermissionList); } } //å¤çå·¥æ¥ List<WorkStep> workStepList=workStepService.getByProcessIds(productInfo.getProductId(), ProcessionIds); workStepIds = new ArrayList<>(); if(workStepList != null && !workStepList.isEmpty()) { for(WorkStep workStep : workStepList){ workStepIds.add(workStep.getId()); } workStepDepartmentList = workStepDepartmentService.getByPartsIdsAndDepartIds(workStepIds, ids); List<PermissionStream> existPermissionList = permissionStreamService.getByPartsIdsAndDepartIds(workStepIds, ids); if(existPermissionList != null && !existPermissionList.isEmpty()){ permissionStreamList.addAll(existPermissionList); } } if(componentPermissionList != null && !componentPermissionList.isEmpty()){ componentDepartmentService.removeByCollection(componentPermissionList); } if(partsPermissionList != null && !partsPermissionList.isEmpty()){ partsDepartmentService.removeByCollection(partsPermissionList); } if(processionPermissionList != null && !processionPermissionList.isEmpty()){ processionDepartmentService.removeByCollection(processionPermissionList); } if(workStepDepartmentList != null && !workStepDepartmentList.isEmpty()){ workStepDepartmentService.removeByCollection(workStepDepartmentList); } if(permissionStreamList != null && !permissionStreamList.isEmpty()){ permissionStreamService.removeByCollection(permissionStreamList); @@ -1128,7 +1428,7 @@ boolean b1 = checkProductPerm(2, componentInfo.getComponentId()); if(!b1) ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); b1 = componentInfoService.assignRemoveDepart(componentInfo, departList); b1 = componentInfoService.assignRemoveDepart(componentInfo, mdcProductionList); if(!b1) ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); if(relativeFlag == 1) { @@ -1136,8 +1436,12 @@ //æ»è®¡éè¦å é¤çæ°æ®ä¿¡æ¯ List<ComponentDepartment> componentPermissionList = new ArrayList<>(); List<PartsDepartment> partsPermissionList = new ArrayList<>(); List<ProcessionDepartment> processionPermissionList = new ArrayList<>(); List<WorkStepDepartment> workStepDepartmentList=new ArrayList<>(); List<PermissionStream> permissionStreamList = new ArrayList<>(); List<String> partsIds= new ArrayList<>(); List<String> ProcessionIds= new ArrayList<>(); List<String> workStepIds= new ArrayList<>(); List<ComponentInfo> childrenList = componentInfoService.getByParentId(componentInfo.getComponentId()); if(childrenList != null && !childrenList.isEmpty()) { for(ComponentInfo cpn : childrenList){ @@ -1153,7 +1457,7 @@ //å¤ç产å ä¸çé¶ä»¶ componentIdList.add(componentInfo.getComponentId()); List<PartsInfo> partsInfoList = partsInfoService.getByComponentIdList(componentInfo.getProductId(), componentIdList); List<String> partsIds = new ArrayList<>(); partsIds = new ArrayList<>(); if(partsInfoList != null && !partsInfoList.isEmpty()) { for(PartsInfo partsInfo : partsInfoList){ partsIds.add(partsInfo.getPartsId()); @@ -1165,11 +1469,45 @@ } } //å¤çå·¥åº List<ProcessStream> processStreamList=processStreamService.getByComponentIdList(componentInfo.getProductId(), componentIdList,partsIds); ProcessionIds = new ArrayList<>(); if(processStreamList != null && !processStreamList.isEmpty()) { for(ProcessStream processStream : processStreamList){ ProcessionIds.add(processStream.getProcessId()); } processionPermissionList = processionDepartmentService.getByPartsIdsAndDepartIds(ProcessionIds, ids); List<PermissionStream> existPermissionList = permissionStreamService.getByPartsIdsAndDepartIds(ProcessionIds, ids); if(existPermissionList != null && !existPermissionList.isEmpty()){ permissionStreamList.addAll(existPermissionList); } } //å¤çå·¥æ¥ List<WorkStep> workStepList=workStepService.getByProcessIds(componentInfo.getProductId(), ProcessionIds); workStepIds = new ArrayList<>(); if(workStepList != null && !workStepList.isEmpty()) { for(WorkStep workStep : workStepList){ workStepIds.add(workStep.getId()); } workStepDepartmentList = workStepDepartmentService.getByPartsIdsAndDepartIds(workStepIds, ids); List<PermissionStream> existPermissionList = permissionStreamService.getByPartsIdsAndDepartIds(workStepIds, ids); if(existPermissionList != null && !existPermissionList.isEmpty()){ permissionStreamList.addAll(existPermissionList); } } if(componentPermissionList != null && !componentPermissionList.isEmpty()){ componentDepartmentService.removeByCollection(componentPermissionList); } if(partsPermissionList != null && !partsPermissionList.isEmpty()){ partsDepartmentService.removeByCollection(partsPermissionList); } if(processionPermissionList != null && !processionPermissionList.isEmpty()){ processionDepartmentService.removeByCollection(processionPermissionList); } if(workStepDepartmentList != null && !workStepDepartmentList.isEmpty()){ workStepDepartmentService.removeByCollection(workStepDepartmentList); } if(permissionStreamList != null && !permissionStreamList.isEmpty()){ permissionStreamService.removeByCollection(permissionStreamList); @@ -1256,23 +1594,23 @@ @Override @Transactional(rollbackFor = {Exception.class}) public boolean assignAddDepartment(ProductInfo productInfo, Collection<Department> departmentList) { public boolean assignAddDepartment(ProductInfo productInfo, Collection<MdcProduction> departmentList) { if(productInfo == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ProductDepartment> productDepartmentList = new ArrayList<>(); List<PermissionStream> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { ProductDepartment en = productDepartmentService.getByProductIdAndDepartId(productInfo.getProductId(), item.getDepartId()); ProductDepartment en = productDepartmentService.getByProductIdAndDepartId(productInfo.getProductId(), item.getId()); if(en == null) { en = new ProductDepartment(); en.setDepartId(item.getDepartId()); en.setDepartId(item.getId()); en.setProductId(productInfo.getProductId()); productDepartmentList.add(en); } PermissionStream stream = permissionStreamService.getByProductIdAndDepartId(productInfo.getProductId(), item.getDepartId()); PermissionStream stream = permissionStreamService.getByProductIdAndDepartId(productInfo.getProductId(), item.getId()); if(stream == null) { stream = new PermissionStream(); stream.setDepartId(item.getDepartId()); stream.setDepartId(item.getId()); stream.setProductId(productInfo.getProductId()); permissionStreamList.add(stream); } @@ -1294,17 +1632,17 @@ @Override @Transactional(rollbackFor = {Exception.class}) public boolean assignRemoveDepartment(ProductInfo productInfo, Collection<Department> departmentList) { public boolean assignRemoveDepartment(ProductInfo productInfo, Collection<MdcProduction> departmentList) { if(productInfo == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ProductDepartment> productDepartmentList = new ArrayList<>(); List<PermissionStream> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { ProductDepartment en = productDepartmentService.getByProductIdAndDepartId(productInfo.getProductId(), item.getDepartId()); ProductDepartment en = productDepartmentService.getByProductIdAndDepartId(productInfo.getProductId(), item.getId()); if(en != null) { productDepartmentList.add(en); } PermissionStream stream = permissionStreamService.getByProductIdAndDepartId(productInfo.getProductId(), item.getDepartId()); PermissionStream stream = permissionStreamService.getByProductIdAndDepartId(productInfo.getProductId(), item.getId()); if(stream != null) { permissionStreamList.add(stream); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepDepartmentService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,97 @@ 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.ProcessionDepartment; import org.jeecg.modules.dnc.entity.WorkStepDepartment; import org.jeecg.modules.dnc.mapper.WorkStepDepartmentMapper; import org.jeecg.modules.dnc.service.IWorkStepDepartmentService; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.system.entity.MdcProduction; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Collections; import java.util.List; @Service public class WorkStepDepartmentService extends ServiceImpl<WorkStepDepartmentMapper, WorkStepDepartment> implements IWorkStepDepartmentService { @Override public boolean deleteByStepId(String stepId) { return false; } @Override public List<MdcProduction> getDepartPermsByStepId(String stepId) { return super.getBaseMapper().getDepartPermsByStepId(stepId); } @Override public List<MdcProduction> getDepartNonPermsByStepId(String stepId) { return super.getBaseMapper().getDepartNonPermsByStepId(stepId); } @Override public boolean removeByCollection(List<WorkStepDepartment> workStepDepartmentList) { if(workStepDepartmentList == null || workStepDepartmentList.isEmpty()) return false; if(workStepDepartmentList.size() == 1) return super.removeById(workStepDepartmentList.get(0).getId()); List<String> ids = new ArrayList<>(); workStepDepartmentList.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); } } @Override public WorkStepDepartment getByStepIdAndDepartId(String stepId, String departId) { return null; } /** * æ¥è¯¢ä¸ç»é¨é¨æé * @param stepIds * @param departIds * @return */ public List<WorkStepDepartment> getByPartsIdsAndDepartIds(List<String> stepIds, List<String> departIds){ if(stepIds == null || stepIds.isEmpty() || departIds == null || departIds.isEmpty()) return null; List<WorkStepDepartment> total = new ArrayList<>(); List<List<String>> stepListArr; List<List<String>> departListArr; if(stepIds.size() > 1000){ stepListArr = ListUtils.partition(stepIds, 100); }else { stepListArr = ListUtils.partition(stepIds, 1000); } if(departIds.size() > 1000){ departListArr = ListUtils.partition(departIds, 100); }else { departListArr = ListUtils.partition(departIds, 1000); } for(List<String> stringList : stepListArr) { for(List<String> departList : departListArr){ LambdaQueryWrapper<WorkStepDepartment> queryWrapper = Wrappers.lambdaQuery(); queryWrapper.in(WorkStepDepartment::getStepId, stringList); queryWrapper.in(WorkStepDepartment::getDepartId, departList); List<WorkStepDepartment> 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/WorkStepServiceImpl.java
@@ -6,6 +6,7 @@ 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.apache.shiro.SecurityUtils; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.dnc.entity.*; @@ -18,11 +19,17 @@ import org.jeecg.modules.dnc.response.UcenterCode; import org.jeecg.modules.dnc.service.IPartsInfoService; import org.jeecg.modules.dnc.service.IPermissionStreamService; import org.jeecg.modules.dnc.service.IWorkStepDepartmentService; import org.jeecg.modules.dnc.service.IWorkStepService; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.dnc.utils.ValidateUtil; import org.jeecg.modules.system.entity.MdcProduction; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -38,6 +45,9 @@ @Autowired private IPermissionStreamService permissionStreamService; @Autowired private IWorkStepDepartmentService workStepDepartmentService; @Override public List<WorkStep> getByUserPerms(String userId) { @@ -146,4 +156,106 @@ } @Override @Transactional(rollbackFor = {Exception.class}) public boolean assignAddDepart(WorkStep workStep, Collection<MdcProduction> departmentList) { if(workStep == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<WorkStepDepartment> workStepDepartmentList = new ArrayList<>(); List<PermissionStream> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { WorkStepDepartment en = workStepDepartmentService.getByStepIdAndDepartId(workStep.getId(), item.getId()); if(en == null) { en = new WorkStepDepartment(); en.setDepartId(item.getId()); en.setStepId(workStep.getId()); workStepDepartmentList.add(en); } PermissionStream stream = permissionStreamService.getByStepIdAndDepartId(workStep.getProductId(), workStep.getComponentId(), workStep.getPartsId(),workStep.getProcessId(),workStep.getId(),item.getId()); if(stream == null) { stream = new PermissionStream(); stream.setDepartId(item.getId()); stream.setProductId(workStep.getProductId()); stream.setComponentId(workStep.getComponentId()); stream.setPartsId(workStep.getPartsId()); stream.setProcessId(workStep.getProcessId()); stream.setStepId(workStep.getId()); permissionStreamList.add(stream); } }); if(!workStepDepartmentList.isEmpty()) { boolean b = workStepDepartmentService.saveBatch(workStepDepartmentList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } } if(!permissionStreamList.isEmpty()) { boolean b = permissionStreamService.saveBatch(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } } return true; } @Override public List<WorkStep> getByProcessIds(String productId,List<String> processIds) { if(!ValidateUtil.validateString(productId) || processIds == null || processIds.isEmpty()) return null; List<WorkStep> list = new ArrayList<>(); if(processIds.size() > 1000){ List<List<String>> processListArr = ListUtils.partition(processIds, 100); for(List<String> processList : processListArr){ List<WorkStep> workStepList = super.lambdaQuery().eq(WorkStep::getProductId, productId).in(WorkStep::getProcessId, processList).list(); if(workStepList != null && !workStepList.isEmpty()){ list.addAll(workStepList); } } }else { list = super.lambdaQuery().eq(WorkStep::getProductId, productId).in(WorkStep::getProcessId, processIds).list(); } if(list == null || list.isEmpty()) return null; return list; } /** * åé é¨é¨æé * @param workStep * @param departmentList * @return */ @Override public boolean assignRemoveDepart(WorkStep workStep, Collection<MdcProduction> departmentList){ if(workStep == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<WorkStepDepartment> workStepDepartmentList = new ArrayList<>(); List<PermissionStream> 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()); if(stream != null) { permissionStreamList.add(stream); } }); if(!workStepDepartmentList.isEmpty()) { boolean b = workStepDepartmentService.removeByCollection(workStepDepartmentList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } } if(!permissionStreamList.isEmpty()) { boolean b = permissionStreamService.removeByCollection(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } } return true; } }