From 8d63dd77b9b3cd9b6d9768f216670fc499a8cab3 Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期四, 23 一月 2025 14:32:16 +0800
Subject: [PATCH] 整合DNC 权限分配 修改为设备车间管理权限

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/WorkStepDepartmentMapper.xml          |   27 +
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessionDepartmentService.java        |   58 ++
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IWorkStepDepartmentService.java          |   59 ++
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/WorkStepDepartment.java                   |   34 +
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProcessInfoCode.java                    |    2 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductDepartmentMapper.xml           |   34 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentDepartmentMapper.xml         |   36 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessStreamMapper.java                  |   10 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentDepartmentService.java         |    5 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java     |   17 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessionDepartmentMapper.xml        |   27 +
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java               |   31 +
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentInfoService.java               |    5 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductDepartmentMapper.java              |    5 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepServiceImpl.java            |  112 ++++
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessionDepartmentService.java    |   94 +++
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java            |   43 +
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsDepartmentService.java             |    5 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java    |   94 +++
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsInfoService.java                   |    5 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepDepartmentService.java      |   97 +++
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java         |  456 ++++++++++++++--
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ComponentDepartmentMapper.java            |    5 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessionDepartment.java                 |   34 +
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductInfoService.java                 |    9 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsDepartmentServiceImpl.java     |    7 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductDepartmentService.java           |    5 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IWorkStepService.java                    |   30 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PartsDepartmentMapper.java                |    5 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java       |   92 +++
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductDepartmentServiceImpl.java   |    5 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessionDepartmentMapper.java           |   28 +
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/WorkStepDepartmentMapper.java             |   27 +
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessStreamMapper.xml               |   34 +
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java           |   19 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsDepartmentMapper.xml             |   36 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java             |    1 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java            |    9 
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentDepartmentServiceImpl.java |    5 
 39 files changed, 1,443 insertions(+), 164 deletions(-)

diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java
index beec47a..2018e31 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java
+++ b/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);
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessionDepartment.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessionDepartment.java
new file mode 100644
index 0000000..92f5cd3
--- /dev/null
+++ b/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;
+    }
+}
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/WorkStepDepartment.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/WorkStepDepartment.java
new file mode 100644
index 0000000..499b748
--- /dev/null
+++ b/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;
+    }
+}
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ComponentDepartmentMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ComponentDepartmentMapper.java
index 9f1803d..d51d0d3 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ComponentDepartmentMapper.java
+++ b/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);
 }
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PartsDepartmentMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PartsDepartmentMapper.java
index 635e016..0522c48 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PartsDepartmentMapper.java
+++ b/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);
 }
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessStreamMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessStreamMapper.java
index bd9945a..c1ece69 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessStreamMapper.java
+++ b/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);
+
 }
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessionDepartmentMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessionDepartmentMapper.java
new file mode 100644
index 0000000..166c0a0
--- /dev/null
+++ b/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);
+
+}
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductDepartmentMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductDepartmentMapper.java
index 1317340..5155420 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductDepartmentMapper.java
+++ b/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);
 }
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/WorkStepDepartmentMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/WorkStepDepartmentMapper.java
new file mode 100644
index 0000000..41b430a
--- /dev/null
+++ b/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);
+
+}
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentDepartmentMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentDepartmentMapper.xml
index 2e30489..a4d8dfd 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentDepartmentMapper.xml
+++ b/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>
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsDepartmentMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsDepartmentMapper.xml
index 07b0e30..ebffdf1 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsDepartmentMapper.xml
+++ b/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>
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessStreamMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessStreamMapper.xml
index bb5aef0..c44d000 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessStreamMapper.xml
+++ b/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>
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessionDepartmentMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessionDepartmentMapper.xml
new file mode 100644
index 0000000..d4c0344
--- /dev/null
+++ b/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>
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductDepartmentMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductDepartmentMapper.xml
index b4e9f99..276521b 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductDepartmentMapper.xml
+++ b/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>
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/WorkStepDepartmentMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/WorkStepDepartmentMapper.xml
new file mode 100644
index 0000000..2cdd892
--- /dev/null
+++ b/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>
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProcessInfoCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProcessInfoCode.java
index 30a36f8..9d953b6 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProcessInfoCode.java
+++ b/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,"宸ュ簭涓嬫湁鍏宠仈鐨勬枃妗o紝鏃犳硶鍒犻櫎锛�"),
     PROCESS_CODE_NONE(false,25407,"璇疯緭鍏ュ伐搴忓彿锛�"),
     PROCESS_IS_EXIST(false,25408,"璇ュ伐搴忓凡瀛樺湪锛�"),
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentDepartmentService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentDepartmentService.java
index 2f43aab..f3046ce 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentDepartmentService.java
+++ b/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);
 
     /**
      * 鑾峰彇鍞竴鐨勯儴闂ㄦ潈闄�
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentInfoService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentInfoService.java
index a6f2e04..9135228 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IComponentInfoService.java
+++ b/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);
 
     /**
      * 鑾峰彇鍞竴 閮ㄤ欢缂栧彿
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsDepartmentService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsDepartmentService.java
index 513373d..8cd7b1d 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsDepartmentService.java
+++ b/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);
 
     /**
      * 鏌ヨ閮ㄩ棬鏉冮檺
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsInfoService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsInfoService.java
index d2f4f2c..1e16569 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPartsInfoService.java
+++ b/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);
 
     /**
      * 鏍规嵁涓�缁勯儴浠舵煡鎵鹃浂浠�
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java
index 0ec693c..10c6f4b 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java
+++ b/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
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java
index 004c9e8..598ba2c 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java
+++ b/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);
 }
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessionDepartmentService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessionDepartmentService.java
new file mode 100644
index 0000000..e6b548d
--- /dev/null
+++ b/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);
+}
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductDepartmentService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductDepartmentService.java
index 4f34d77..201b237 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductDepartmentService.java
+++ b/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);
 
     /**
      * 鍒犻櫎閮ㄩ棬鏉冮檺鏁版嵁
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductInfoService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductInfoService.java
index 9e026c2..2f57b55 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductInfoService.java
+++ b/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);
 
     /**
      * 鑾峰彇鑺傜偣鐨勯儴闂ㄦ潈闄�
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IWorkStepDepartmentService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IWorkStepDepartmentService.java
new file mode 100644
index 0000000..3bc9fef
--- /dev/null
+++ b/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);
+
+}
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IWorkStepService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IWorkStepService.java
index c3bafde..5a20188 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IWorkStepService.java
+++ b/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);
 }
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentDepartmentServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentDepartmentServiceImpl.java
index 62b1ccd..04b7946 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentDepartmentServiceImpl.java
+++ b/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);
     }
 
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java
index b2460cd..1f9d254 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java
@@ -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);
             }
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java
index 383e3e4..7db259e 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java
+++ b/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);
     }
 
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsDepartmentServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsDepartmentServiceImpl.java
index 42512b1..0c6a057 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsDepartmentServiceImpl.java
+++ b/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
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java
index 0921b54..7b67da4 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java
+++ b/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);
             }
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java
index b7e0261..869a95b 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java
+++ b/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();
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java
index e22d52e..6462d98 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java
+++ b/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;
+    }
+
 }
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessionDepartmentService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessionDepartmentService.java
new file mode 100644
index 0000000..d77d2be
--- /dev/null
+++ b/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;
+    }
+}
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductDepartmentServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductDepartmentServiceImpl.java
index 5e7309f..ff7223d 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductDepartmentServiceImpl.java
+++ b/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);
     }
 
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java
index 5d03027..a61862f 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java
+++ b/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 浜у搧鏍戣妭鐐筰d
      * @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 浜у搧鏍戣妭鐐筰d
      * @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);
             }
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepDepartmentService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepDepartmentService.java
new file mode 100644
index 0000000..717bf65
--- /dev/null
+++ b/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;
+    }
+}
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepServiceImpl.java
index 77c0492..e058330 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepServiceImpl.java
+++ b/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;
+    }
+
 }

--
Gitblit v1.9.3