Browse Source

生产任务显示产线,租户菜单数据过滤

xuezizhuo 1 năm trước cách đây
mục cha
commit
1c2417460d

+ 11 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/controller/BpmExecuteProcessController.java

@@ -126,4 +126,15 @@ public class BpmExecuteProcessController extends BaseController {
         return AjaxResult.success(PreExecutionToolClass.getNodeFormInfos(nodeForm));
     }
 
+
+    /**
+     * 化纤项目查询流程执行任务列表
+     */
+    // @PreAuthorize("@ss.hasPermi('system:process:list')")
+    @GetMapping("/chemicalFibreList")
+    public TableDataInfo ChemicalFibreList(BpmExecuteProcess bpmExecuteProcess) throws Exception {
+        startPage();
+        return getDataTable(bpmExecuteProcessService.selectChemicalFibreBpmExecuteProcessList(bpmExecuteProcess));
+    }
+
 }

+ 11 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/entity/BpmExecuteProcess.java

@@ -89,6 +89,9 @@ public class BpmExecuteProcess extends BaseEntityPlus implements Serializable {
     @Excel(name = "流程类型")
     private String taskProcessType;
 
+    /** 产线编号 */
+    private String taskProductionLineNo;
+
     public Long getId() {
         return id;
     }
@@ -193,6 +196,14 @@ public class BpmExecuteProcess extends BaseEntityPlus implements Serializable {
         this.taskProcessName = taskProcessName;
     }
 
+    public String getTaskProductionLineNo() {
+        return taskProductionLineNo;
+    }
+
+    public void setTaskProductionLineNo(String taskProductionLineNo) {
+        this.taskProductionLineNo = taskProductionLineNo;
+    }
+
     @Override
     public String toString() {
         final StringBuilder sb = new StringBuilder("BpmExecuteProcess{");

+ 11 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/mapper/BpmExecuteProcessMapper.java

@@ -196,4 +196,15 @@ public interface BpmExecuteProcessMapper {
      * @return
      */
     public int updateProcessStateByKey(String taskKey);
+
+    /**
+     * (化纤项目)根据当前用户登陆信息得到当前可执行流程
+     */
+    List<CommonEntity> queryChemicalFibreExecuteProcessEnd(@Param("objectMap") Map<String, Object> objectMap);
+
+    /**
+     * (化纤项目)根据当前用户登陆信息得到当前可执行流程
+     */
+    List<CommonEntity> queryChemicalFibreExecuteProcess(@Param("objectMap") Map<String, Object> objectMap);
+
 }

+ 10 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/IBpmExecuteProcessService.java

@@ -120,6 +120,7 @@ public interface IBpmExecuteProcessService {
      * 通过formKeys查询表单信息
      *
      * @param
+     * @param formKeys
      * @return
      */
     List<CommonEntity> getFromInfoByFormKeys(String[] formKeys);
@@ -137,4 +138,13 @@ public interface IBpmExecuteProcessService {
      * @return
      */
     public int updateProcessStateByKey(String taskProcessState, String taskKey);
+
+    /**
+     * 查询流程执行任务列表
+     *
+     * @param bpmExecuteProcess 流程执行任务
+     * @return 流程执行任务集合
+     */
+    List<CommonEntity> selectChemicalFibreBpmExecuteProcessList(BpmExecuteProcess bpmExecuteProcess) throws Exception;
+
 }

+ 89 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/impl/BpmExecuteProcessServiceImpl.java

@@ -371,6 +371,95 @@ public class BpmExecuteProcessServiceImpl implements IBpmExecuteProcessService {
         return runBpmExecuteProcessMapper.updateProcessStateByKey(taskKey);
     }
 
+    @Override
+    public List<CommonEntity> selectChemicalFibreBpmExecuteProcessList(BpmExecuteProcess bpmExecuteProcess) throws Exception {
+        // 得到当前执行管道的列表关联信息
+        //Map<String, Object> params = new HashMap<>();
+        //params.put("isEnablePaging", "false");  // 不弃启用分页
+        //params.put("dictType", "plan_execution_data"); // 排需要的必要参数
+        //ResponseEntity tenantDict = sending.sendGetTenantDict(params);
+        SysDictData dictData = new SysDictData();
+        dictData.setDictType("plan_execution_data");
+        List<SysDictData> dictDataList = sending.sendGetTenantDict(dictData);
+        //if (tenantDict.getStatusCodeValue() == 200) {
+        if (StringUtils.isNotEmpty(dictDataList)) {
+            Map<String, Object> objectMap = new HashMap<>();  // 查询执行管道的参数
+            objectMap.putAll(convertEntityToMap(bpmExecuteProcess));
+
+            if (!bpmExecuteProcess.getTaskProcessType().equals("1")) {  // 审批类型
+                dictDataList.forEach(item -> {
+                    objectMap.put(item.getDictLabel(), item.getDictValue());
+                });
+            }
+            if (bpmExecuteProcess.getTaskProcessState() == 3L) {
+                // 首先根据当前登陆用户得到他可以执行的所有节点
+                List<CommonEntity> commonEntities;
+                if (bpmExecuteProcess.getTaskProcessType().equals("1")) {  //审批类型
+                    commonEntities = runBpmExecuteProcessMapper.queryExecuteProcessApprovalEnd(objectMap);
+                } else {
+                    // 完成展示数据
+                    System.err.println("数据:"+objectMap.toString());
+                    commonEntities = runBpmExecuteProcessMapper.queryChemicalFibreExecuteProcessEnd(objectMap);
+                }
+
+
+                if (bpmExecuteProcess.getTaskProcessType().equals("1")) {
+                    // 审批类型得到当前节点前所执行过的日志
+                    commonEntities.forEach(item -> {
+                        List<BpmExecuteNodeLog> bpmExecuteNodeLogList = iBpmExecuteNodeLogService.selectBpmExecuteNodeLogList(new BpmExecuteNodeLog(item.getResultMap().get("bepTaskKey").toString()));
+                        item.getResultMap().put("nodeLog", bpmExecuteNodeLogList);
+                    });
+                }
+                return commonEntities;
+                // 进行中展示数据列表
+            } else {
+                List<SysRole> sysRoles = SecurityUtils.getLoginUser().getUser().getRoles();
+                List<String> roles = new ArrayList<>();
+                if (sysRoles.size() != 0) {
+                    roles.addAll(sysRoles.stream().map(SysRole::getRoleKey).collect(Collectors.toList()));
+                }
+                // 根据当前的用户id得到可以执行的流程节点
+                objectMap.put("userId", SecurityUtils.getUserId());
+                // 得到当前发起请求的用户角色列表
+                objectMap.put("taskRealRoleList", roles);
+                // 首先根据当前登陆用户得到他可以执行的所有节点
+                List<CommonEntity> commonEntities;
+                if (bpmExecuteProcess.getTaskProcessType().equals("1")) {
+                    commonEntities = runBpmExecuteProcessMapper.queryExecuteApproveProcess(objectMap);
+                } else {
+                    // 进行中展示数据列表
+                    commonEntities = runBpmExecuteProcessMapper.queryChemicalFibreExecuteProcess(objectMap);
+                }
+                // 0 工业类型 1 审批类型
+                if (bpmExecuteProcess.getTaskProcessType().equals("1")) {
+                    // 审批类型得到当前节点前所执行过的日志
+                    commonEntities.forEach(item -> {
+                        List<BpmExecuteNodeLog> bpmExecuteNodeLogList = iBpmExecuteNodeLogService.selectBpmExecuteNodeLogList(new BpmExecuteNodeLog(item.getResultMap().get("bepTaskKey").toString()));
+                        item.getResultMap().put("nodeLog", bpmExecuteNodeLogList);
+                    });
+                } else if (bpmExecuteProcess.getTaskProcessType().equals("0")) {
+                    // 查询异常脚本信息
+                    List<CommonEntity> commonEntities1 = bpmExecuteNodeMiddleService.addExceptionScript(commonEntities);
+                    commonEntities.forEach(item -> {
+                        String keyName = item.getResultMap().get("benTaskNodeKey").toString();
+                        String taskKey = item.getResultMap().get("bepTaskKey").toString();
+                        item.getResultMap().putAll(
+                                commonEntities1.stream()
+                                        .filter(ctem ->
+                                                ctem.getResultMap().get("benTaskNodeKey").equals(keyName)
+                                                        && ctem.getResultMap().get("bepTaskKey").equals(taskKey))
+                                        .findFirst()
+                                        .get()
+                                        .getResultMap()
+                        );
+                    });
+                }
+                return commonEntities;
+            }
+        }
+        return null;
+    }
+
     // 将实体对象转换为Map的方法
     public static Map<String, Object> convertEntityToMap(Object entity) {
         Map<String, Object> map = new HashMap<>();

+ 168 - 0
zkqy-process-execution/src/main/resources/mapper/bpm/dispersed/BpmExecuteProcessMapper.xml

@@ -667,5 +667,173 @@
     </update>
 
 
+    <select id="queryChemicalFibreExecuteProcessEnd" resultMap="retMap">
+        select
+        bep.id as bep_id,
+        bep.task_key as bep_task_key,
+        bep.task_key as bpm_execute_process_task_key,
+        plan.${planName} as bep_task_name,
+        plan.production_line_no as bep_task_production_line_no,
+        bep.task_plan_key as bep_task_plan_key,
+        bep.task_plan_key as bpm_execute_process_task_plan_key,
+        bep.task_node_key as bep_task_node_key,
+        bep.task_node_next_key as bep_task_node_next_key,
+        bep.task_node_next_key as bpm_execute_process_task_node_next_key,
+        bep.task_process_type as bep_task_process_type,
+        bep.task_process_key as bep_task_process_key,
+        bep.task_process_xml_content as bep_task_process_xml_content,
+        bep.task_process_state as bep_task_process_state,
+        bep.task_process_note as bep_task_process_note,
+        bep.del_flag as bep_del_flag,
+        bep.remark as bep_remark,
+        ben.id as ben_id,
+        ben.task_process_key as ben_task_process_key,
+        ben.task_node_key as ben_task_node_key,
+        ben.task_node_name as ben_task_node_name,
+        ben.task_node_form_key as ben_task_node_form_key,
+        ben.task_node_form_type as ben_task_node_form_type,
+        ben.task_node_type as ben_task_node_type,
+        ben.task_node_before as ben_task_node_before,
+        ben.task_node_after as ben_task_node_after,
+        ben.task_node_role_permission as ben_task_node_role_permission,
+        ben.task_remark as ben_task_remark,
+        ben.task_node_number as ben_task_node_number,
+        ben.task_node_weight as ben_task_node_weight,
+        ben.task_node_state as ben_task_node_state,
+        ben.task_priority as ben_task_priority,
+        ben.task1 as ben_task1,
+        ben.task2 as ben_task2,
+        ben.task3 as ben_task3,
+        ben.task4 as ben_task4,
+        ben.task5 as ben_task5,
+        ben.del_flag as ben_del_flag,
+        ben.create_by_id as ben_create_by_id,
+        ben.create_by as ben_create_by,
+        ben.create_time as ben_create_time,
+        benm.id as benm_id,
+        benm.task_node_key as benm_task_node_key,
+        benm.task_virtually_role as benm_task_virtually_role,
+        benm.task_real_role as benm_task_real_role,
+        benm.task_execute_user_no as benm_task_execute_user_no,
+        benm.task_artificial_script_key as benm_task_artificial_script_key,
+        benm.task_automatic_script_trigger_type as benm_task_automatic_script_trigger_type
+        from
+        {DBNAME}.bpm_execute_process as bep
+        inner join {DBNAME}.bpm_execute_node as ben on
+        ben.task_process_key = bep.task_key
+        and ben.task_node_key = bep.task_node_next_key
+        join {DBNAME}.bpm_execute_node_middle as benm on
+        benm.task_node_key = ben.task_node_key
+        and benm.task_process_key = bep.task_key
+        join {DBNAME}.${planTableName} as plan on
+        plan.${planID} = bep.task_plan_key
+        where bep.task_process_state = 3
+        <if test="taskProcessType != null">and bep.task_process_type = #{taskProcessType}</if>
+        <if test="taskProductionLineNo != null and taskProductionLineNo != ''">and plan.production_line_no = #{taskProductionLineNo} </if>
+        <if test="taskName != null  and taskName != ''">
+            and CONCAT(
+            IFNULL( bep.task_key, '' ),
+            IFNULL( bep.task_name, '' ),
+            IFNULL( bep.task_node_key, '' ),
+            IFNULL( bep.task_node_next_key, '' ),
+            IFNULL( bep.task_process_key, '' ),
+            IFNULL( bep.task_process_note, '' ),
+            IFNULL( plan.${planName}, '' ),
+            IFNULL( PLAN.production_line_no,'')) LIKE concat('%', #{taskName}, '%')
+        </if>
+        order by ben.create_time desc
+    </select>
+
+    <select id="queryChemicalFibreExecuteProcess" resultMap="retMap">
+        select
+        bep.id as bep_id,
+        bep.task_key as bep_task_key,
+        bep.task_key as bpm_execute_process_task_key,
+        plan.${planName} as bep_task_name,
+        plan.production_line_no as bep_task_production_line_no,
+        bep.task_plan_key as bep_task_plan_key,
+        bep.task_plan_key as bpm_execute_process_task_plan_key,
+        bep.task_node_key as bep_task_node_key,
+        bep.task_node_next_key as bep_task_node_next_key,
+        bep.task_node_next_key as bpm_execute_process_task_node_next_key,
+        bep.task_process_type as bep_task_process_type,
+        bep.task_process_key as bep_task_process_key,
+        bep.task_process_xml_content as bep_task_process_xml_content,
+        bep.task_process_state as bep_task_process_state,
+        bep.task_process_note as bep_task_process_note,
+        bep.del_flag as bep_del_flag,
+        bep.remark as bep_remark,
+        ben.id as ben_id,
+        ben.task_process_key as ben_task_process_key,
+        ben.task_node_key as ben_task_node_key,
+        ben.task_node_name as ben_task_node_name,
+        ben.task_node_form_key as ben_task_node_form_key,
+        ben.task_node_form_type as ben_task_node_form_type,
+        ben.task_node_type as ben_task_node_type,
+        ben.task_node_before as ben_task_node_before,
+        ben.task_node_after as ben_task_node_after,
+        ben.task_node_role_permission as ben_task_node_role_permission,
+        ben.task_remark as ben_task_remark,
+        ben.task_node_number as ben_task_node_number,
+        ben.task_node_weight as ben_task_node_weight,
+        ben.task_node_state as ben_task_node_state,
+        ben.task_priority as ben_task_priority,
+        ben.task1 as ben_task1,
+        ben.task2 as ben_task2,
+        ben.task3 as ben_task3,
+        ben.task4 as ben_task4,
+        ben.task5 as ben_task5,
+        ben.del_flag as ben_del_flag,
+        ben.create_by_id as ben_create_by_id,
+        ben.create_by as ben_create_by,
+        ben.create_time as ben_create_time,
+        benm.id as benm_id,
+        benm.task_node_key as benm_task_node_key,
+        benm.task_virtually_role as benm_task_virtually_role,
+        benm.task_real_role as benm_task_real_role,
+        benm.task_execute_user_no as benm_task_execute_user_no,
+        benm.task_artificial_script_key as benm_task_artificial_script_key,
+        benm.task_automatic_script_trigger_type as benm_task_automatic_script_trigger_type
+        from
+        {DBNAME}.bpm_execute_process as bep
+        inner join {DBNAME}.bpm_execute_node as ben on
+        ben.task_process_key = bep.task_key
+        and ben.task_node_key = bep.task_node_next_key
+        join {DBNAME}.bpm_execute_node_middle as benm on
+        benm.task_node_key = ben.task_node_key
+        and benm.task_process_key = bep.task_key
+        join {DBNAME}.${planTableName} as plan on
+        plan.${planID} = bep.task_plan_key
+        where
+        bep.task_node_next_key in (select task_node_key
+        from {DBNAME}.bpm_execute_node_middle
+        where
+        FIND_IN_SET(#{userId}, task_execute_user_no) > 0
+        <if test="taskRealRoleList != null and taskRealRoleList.size() > 0">
+            OR
+            <foreach collection="taskRealRoleList" item="role" separator=" OR ">
+                FIND_IN_SET(#{role}, task_real_role) > 0
+            </foreach>
+        </if>
+        )
+        <if test="taskProcessState != null">and bep.task_process_state = #{taskProcessState}</if>
+        <if test="taskProcessType != null">and bep.task_process_type = #{taskProcessType}</if>
+        <if test="taskProductionLineNo != null and taskProductionLineNo != ''">and plan.production_line_no = #{taskProductionLineNo}</if>
+        <if test="taskName != null  and taskName != ''">
+            and CONCAT(
+            IFNULL( bep.task_key, '' ),
+            IFNULL( bep.task_name, '' ),
+            IFNULL( bep.task_node_key, '' ),
+            IFNULL( bep.task_node_next_key, '' ),
+            IFNULL( bep.task_process_key, '' ),
+            IFNULL( bep.task_process_note, '' ),
+            IFNULL( plan.${planName}, '' ),
+            IFNULL( plan.production_line_no,'')) LIKE concat('%', #{taskName}, '%')
+        </if>
+        order by ben.create_time desc
+    </select>
+
+
+
 </mapper>
 

+ 4 - 4
zkqy-system/src/main/resources/mapper/system/SysMenuMapper.xml

@@ -77,8 +77,8 @@
 		from sys_menu m
 		left join sys_tenant_menu tm on tm.menu_id = m.menu_id
 		where tm.tenant_id = #{tenantId}
-		and m.menu_name not in ('数据引擎','流程引擎','表单引擎','移动端引擎')
-		and parent_id not in (select menu_id from  sys_menu where menu_name in ('数据引擎','流程引擎','表单引擎','移动端引擎'))
+		and m.menu_name not in ('数据引擎','流程引擎','表单引擎','移动端引擎','后台管理')
+		and parent_id not in (select menu_id from  sys_menu where menu_name in ('数据引擎','流程引擎','表单引擎','移动端引擎','后台管理'))
 		<if test="menu.menuName != null and menu.menuName != ''">
 			AND m.menu_name like concat('%', #{menu.menuName}, '%')
 		</if>
@@ -100,8 +100,8 @@
 		from sys_tenant_menu tm
 		left join sys_menu m on tm.menu_id = m.menu_id
 		where m.menu_type in ('M', 'C') and m.status = 0 and tm.tenant_id = #{tenantId}
-		and m.menu_name not in ('数据引擎','流程引擎','表单引擎','移动端引擎')
-		and parent_id not in (select menu_id from  sys_menu where menu_name in ('数据引擎','流程引擎','表单引擎','移动端引擎'))
+		and m.menu_name not in ('数据引擎','流程引擎','表单引擎','移动端引擎','后台管理')
+		and parent_id not in (select menu_id from  sys_menu where menu_name in ('数据引擎','流程引擎','表单引擎','移动端引擎','后台管理'))
 		order by m.parent_id, m.order_num
 	</select>