Browse Source

添加允许撤回天数

caixiaofeng 10 tháng trước cách đây
mục cha
commit
279bbb29fb

+ 3 - 1
flow-app/src/main/resources/mapper/workflow/FlowInstanceDao.xml

@@ -12,6 +12,7 @@
         <result property="endTime" column="END_TIME_" jdbcType="TIMESTAMP"/>
         <result property="duration" column="DURATION_" jdbcType="INTEGER"/>
         <result property="status" column="status" jdbcType="INTEGER"/>
+        <result property="cancelDays" column="cancel_days" jdbcType="INTEGER"/>
         <association property="currentNodes" column="id" select="getCurrentNodes"/>
     </resultMap>
 
@@ -24,7 +25,8 @@
             HP.START_TIME_,
             HP.END_TIME_,
             HP.DURATION_,
-            RE.status
+            RE.status,
+            RE.cancel_days
         FROM
             ACT_HI_PROCINST HP
                 LEFT JOIN flow_instance RE ON HP.ID_ = RE.id

+ 10 - 0
flow-workflow/flow-workflow-biz/src/main/java/com/flow/listener/GlobalActivityEventListener.java

@@ -5,6 +5,8 @@ import com.flow.common.oauth2.utils.SecurityContextUtil;
 import com.flow.constant.NodeTypeConstant;
 import com.flow.entity.*;
 import com.flow.entity.node.ApprovalNode;
+import com.flow.entity.settings.CancelConfig;
+import com.flow.entity.settings.Settings;
 import com.flow.enums.ApprovalNobodyEnum;
 import com.flow.enums.AssigneeTypeEnum;
 import com.flow.enums.NotifyEnum;
@@ -124,7 +126,15 @@ public class GlobalActivityEventListener extends AbstractFlowableEngineEventList
     protected void processStarted(FlowableProcessStartedEvent event) {
         ExecutionEntityImpl entity = (ExecutionEntityImpl) event.getEntity();
         // 更新流程实例状态
+        FlowDefine define = flowDefineService.getDefine(entity.getProcessDefinitionId());
         FlowInstance flowInstance = FlowInstance.buildStatus(entity.getProcessInstanceId(), ProcessStatus.RUNNING);
+        Settings settings = define.getSettings();
+        CancelConfig cancel = settings.getCancel();
+        if (cancel.getEnable()) {
+            flowInstance.setCancelDays(cancel.getDays());
+        } else {
+            flowInstance.setCancelDays(0);
+        }
         flowInstanceService.save(flowInstance);
         // 记录日志
         FlowActivity flowActivity = flowActivityService.build(entity);

+ 1 - 0
flow-workflow/flow-workflow-entity/src/main/java/com/flow/entity/FlowInstance.java

@@ -15,6 +15,7 @@ import java.util.List;
 public class FlowInstance {
     private String id;
     private ProcessStatus status;
+    private Integer cancelDays;
     @TableField(exist = false)
     private String name;
     @TableField(exist = false)