From 30e775eb9d4b20b6dbb407199f8f4d0729bf7c4e Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期四, 21 八月 2025 15:42:53 +0800 Subject: [PATCH] 工作流修改 --- lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java | 22 ----------- lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml | 31 +++++++-------- lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/mapper/xml/HisWorkTaskMapper.xml | 21 ++++------ lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.java | 3 + 4 files changed, 26 insertions(+), 51 deletions(-) diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml index 2eca38b..b86db31 100644 --- a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml @@ -41,13 +41,14 @@ AND ACT_HI_PROCINST.END_TIME_ <= #{flowMyBusinessDto.endTime} </if> ORDER BY - flow_my_business.create_time desc + flow_my_business.create_time desc </select> <select id="ListMyBusiness" resultType="org.jeecg.modules.flowable.domain.dto.FlowTaskDto"> SELECT - fmb.task_id AS 'taskId', - fmb.process_instance_id AS 'procInsId', + latest_task.ID_ AS 'taskId', + latest_task.PROC_INST_ID_ AS 'procInstId', + latest_task.PROC_DEF_ID_ AS 'processInstanceId', ACT_RE_PROCDEF.CATEGORY_ AS 'category', ACT_RE_PROCDEF.NAME_ AS 'procDefName', fmb.title AS 'Description', @@ -55,16 +56,14 @@ fmb.process_definition_key AS 'processDefinitionKey', fmb.process_definition_id AS 'processDefinitionId', fmb.proposer, - fmb.todo_users, - fmb.task_name, + -- fmb.todo_users, + -- fmb.task_name, latest_task.NAME_ AS taskName, - fmb.create_time AS createTime, - latest_task.END_TIME_ AS finishTime + -- fmb.create_time AS createTime, + latest_task.END_TIME_ AS finishTime, + latest_task.TASK_DEF_KEY_ AS taskDefKey FROM - flow_my_business fmb - LEFT JOIN ACT_RE_PROCDEF ON fmb.process_definition_id = ACT_RE_PROCDEF.ID_ - LEFT JOIN ACT_HI_PROCINST ON fmb.process_instance_id = ACT_HI_PROCINST.ID_ - LEFT JOIN ( + ( SELECT *, ROW_NUMBER() OVER ( @@ -80,13 +79,11 @@ AND END_TIME_ <= #{dto.endTime} </if> ) latest_task - ON fmb.process_instance_id = latest_task.PROC_INST_ID_ - AND latest_task.rn = 1 - WHERE + LEFT JOIN (select DISTINCT process_definition_key, process_definition_id, process_instance_id, title, data_id, proposer from flow_my_business) fmb ON fmb.process_instance_id = latest_task.PROC_INST_ID_ + LEFT JOIN ACT_RE_PROCDEF ON fmb.process_definition_id = ACT_RE_PROCDEF.ID_ + LEFT JOIN ACT_HI_PROCINST ON fmb.process_instance_id = ACT_HI_PROCINST.ID_ + WHERE latest_task.rn = 1 <!-- 鍔ㄦ�佹潯浠剁粺涓�浣跨敤 dto --> - <if test="dto.currentUser != null and dto.currentUser != ''"> - fmb.done_users like concat('%',#{dto.currentUser},'%') - </if> <if test="dto.category != null and dto.category != ''"> AND ACT_RE_PROCDEF.CATEGORY_ = #{dto.category} </if> diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.java index 6775bed..19d0bf7 100644 --- a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.java +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.java @@ -118,4 +118,7 @@ @ApiModelProperty(value = "褰撳墠鐨勮妭鐐瑰彲浠ュ鐞嗙殑鐢ㄦ埛鍚�") @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname") private String todoUsers; + @ApiModelProperty("娴佺▼鍙戣捣浜哄悕绉�") + @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname") + private String proposer; } diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/mapper/xml/HisWorkTaskMapper.xml b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/mapper/xml/HisWorkTaskMapper.xml index edb48a8..89c419e 100644 --- a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/mapper/xml/HisWorkTaskMapper.xml +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/mapper/xml/HisWorkTaskMapper.xml @@ -28,8 +28,7 @@ SELECT p.PROC_INST_ID_ AS procInstId, p.BUSINESS_KEY_ AS businessKey, - p.START_TIME_ AS procStartTime, - p.END_TIME_ AS procEndTime, + a.EXECUTION_ID_ AS executionId, a.ACT_ID_, COALESCE ( a.ACT_NAME_, a.ACT_ID_ ) AS actName, a.ACT_TYPE_ AS actType, @@ -38,10 +37,12 @@ c.NAME_ AS taskName, c.ASSIGNEE_ AS assignee, c.DESCRIPTION_ AS description, --- 浣跨敤 LEAD 鑾峰彇涓嬩竴涓椿鍔ㄤ俊鎭� - LEAD ( COALESCE ( a.ACT_NAME_, a.ACT_ID_ ) ) OVER ( PARTITION BY p.PROC_INST_ID_ ORDER BY a.START_TIME_ ) AS nextActName, - LEAD ( a.ACT_TYPE_ ) OVER ( PARTITION BY p.PROC_INST_ID_ ORDER BY a.START_TIME_ ) AS nextActType, - LEAD ( a.START_TIME_ ) OVER ( PARTITION BY p.PROC_INST_ID_ ORDER BY a.START_TIME_ ) AS nextActStartTime + LEAD ( COALESCE ( a.ACT_NAME_, a.ACT_ID_ ) ) OVER ( PARTITION BY p.PROC_INST_ID_, a.EXECUTION_ID_ + ORDER BY a.END_TIME_ ) AS nextActName, + LEAD ( a.ACT_TYPE_ ) OVER ( PARTITION BY p.PROC_INST_ID_, a.EXECUTION_ID_ + ORDER BY a.START_TIME_ ) AS nextActType, + LEAD ( a.START_TIME_ ) OVER ( PARTITION BY p.PROC_INST_ID_, a.EXECUTION_ID_ + ORDER BY a.START_TIME_ ) AS nextActStartTime FROM act_hi_procinst p LEFT JOIN act_hi_actinst a ON p.PROC_INST_ID_ = a.PROC_INST_ID_ @@ -52,23 +53,19 @@ ) SELECT procInstId, businessKey, --- 褰撳墠娲诲姩锛坲serTask锛変俊鎭� actName AS userTaskName, taskName, assignee, actStartTime, actEndTime, description, --- 涓嬩竴涓椿鍔紙sequenceFlow锛変俊鎭� nextActName AS sequenceFlowName, nextActStartTime AS sequenceFlowStartTime FROM ActivitySequence WHERE - actType = 'userTask' -- 绛涢�夊綋鍓嶆椿鍔ㄤ负 userTask - - AND nextActType = 'sequenceFlow' -- 涓斾笅涓�涓椿鍔ㄤ负 sequenceFlow - + actType = 'userTask' + AND nextActType = 'sequenceFlow' ORDER BY actStartTime; </select> diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java index fb5e489..65db40e 100644 --- a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java @@ -1150,28 +1150,6 @@ String username = iFlowThirdService.getLoginUser().getUsername(); flowMyBusinessDto.setCurrentUser(username); List<FlowTaskDto> list = flowMyBusinessService.ListMyBusiness(flowMyBusinessDto); - list.forEach(flowTaskDto -> { - // 娴佺▼鍙戣捣浜轰俊鎭� - HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() - .processInstanceId(flowTaskDto.getProcInsId()) - .singleResult(); - if (historicProcessInstance != null) { - SysUser startUser = iFlowThirdService.getUserByUsername(historicProcessInstance.getStartUserId()); - if (startUser != null) { - flowTaskDto.setStartUserId(startUser.getUsername()); - flowTaskDto.setStartUserName(startUser.getRealname()); - } - List<String> departNamesByUsername = iFlowThirdService.getDepartNamesByUsername(historicProcessInstance.getStartUserId()); - flowTaskDto.setStartDeptName(CollUtil.join(departNamesByUsername, "锛�")); - if (flowTaskDto.getTodoUsers() == null) { - flowTaskDto.setTodoUsers(""); - } else { - //鍘婚櫎[] - flowTaskDto.setTodoUsers(flowTaskDto.getTodoUsers().replaceAll("\\[", "").replaceAll("\\]", "")); - flowTaskDto.setTodoUsers(flowTaskDto.getTodoUsers().replaceAll("\"", "")); - } - } - }); IPage<FlowTaskDto> flowTaskDtoIPage = new Page<>(); flowTaskDtoIPage.setRecords(list); flowTaskDtoIPage.setTotal(page.getTotal()); -- Gitblit v1.9.3