瀏覽代碼

待办添加当前节点耗时

yzc 10 月之前
父節點
當前提交
ab0bfed1e3

+ 5 - 0
hx-flow/src/main/java/com/fjhx/flow/entity/flow/vo/FlowExampleVo.java

@@ -44,5 +44,10 @@ public class FlowExampleVo extends FlowExample {
      */
     private Long handleUserId;
     private String handleUserName;
+    /**
+     * 耗时
+     */
+    private Long duration;
+    private String durationStr;
 
 }

+ 8 - 1
hx-flow/src/main/java/com/fjhx/flow/service/flow/impl/FlowExampleServiceImpl.java

@@ -1,5 +1,7 @@
 package com.fjhx.flow.service.flow.impl;
 
+import cn.hutool.core.date.BetweenFormatter;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
@@ -481,12 +483,17 @@ public class FlowExampleServiceImpl extends ServiceImpl<FlowExampleMapper, FlowE
     private Page<FlowExampleVo> doSelectExample(FlowExampleSelectDto dto, IWrapper<FlowExample> wrapper) {
 
         wrapper.eq("fd", FlowDefinition::getFlowInfoId, dto.getFlowInfoId())
-                .keyword(dto, new SqlField("fe", FlowExample::getTitle),new SqlField("su.nick_name"))
+                .keyword(dto, new SqlField("fe", FlowExample::getTitle), new SqlField("su.nick_name"))
                 .orderByDesc("fe", FlowExample::getId);
 
         Page<FlowExampleVo> page = baseMapper.selectExample(dto.getPage(), wrapper);
         List<FlowExampleVo> records = page.getRecords();
 
+        //赋值节点耗时
+        for (FlowExampleVo record : records) {
+            record.setDurationStr(DateUtil.formatBetween(new Date(), record.getCreateTime(), BetweenFormatter.Level.MINUTE));
+        }
+
         // 赋值流程发起人名称
         UserUtil.assignmentNickName(records, BasePo::getCreateUser, FlowExampleVo::setCreateUserName);
 

+ 3 - 1
hx-flow/src/main/resources/mapper/flow/FlowExampleMapper.xml

@@ -15,7 +15,9 @@
                fdn.node_name,
                fdn.node_handle_type,
                fec.handle_user_id,
-               su.nick_name AS handle_user_name
+               fec.create_time,
+               TIMESTAMPDIFF(MINUTE,fec.create_time, now()) AS duration,
+               su.nick_name                                 AS handle_user_name
         from flow_info fi
                  inner join flow_definition fd on fd.flow_info_id = fi.id
                  inner join flow_example fe on fe.definition_id = fd.id