Prechádzať zdrojové kódy

审批人是发起人处理优化

caixiaofeng 5 mesiacov pred
rodič
commit
f73c62a0b1

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

@@ -32,6 +32,9 @@
             INNER JOIN ACT_HI_PROCINST AS HP ON RE.id = HP.ID_
     </sql>
     <sql id="instanceWheres">
+        <if test="query.id != null and query.id != ''">
+            AND RE.id = #{query.id}
+        </if>
         <if test="query.startUserId != null and query.startUserId != ''">
             AND HP.START_USER_ID_ = #{query.startUserId}
         </if>

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

@@ -70,6 +70,7 @@ public class GlobalActivityEventListener extends AbstractFlowableEngineEventList
         FlowElement currentFlowElement = execution.getCurrentFlowElement();
         String nobody = ProcessElementUtil.getExtensionElementValue(currentFlowElement, "nobody");
         String assigneeType = ProcessElementUtil.getExtensionElementValue(currentFlowElement, "assigneeType");
+        String same = ProcessElementUtil.getExtensionElementValue(currentFlowElement, "same");
 
         if (StringUtils.isNotBlank(assigneeType)) {
             if (assigneeType.equals(AssigneeTypeEnum.AUTO_PASS.getType())) {
@@ -97,6 +98,15 @@ public class GlobalActivityEventListener extends AbstractFlowableEngineEventList
             }
         }
 
+        // 审批人与发起人是同一人时
+        String initiator = execution.getVariable("initiator", String.class);
+        if (entity.getAssignee().equals(initiator)) {
+            if ("skip".equals(same)) {
+                flowTaskService.autoComplete(entity.getId(), " 审批人是发起人");
+                return;
+            }
+        }
+
         // 审批人重复处理
         String duplicate = execution.getVariable("_DUPLICATE_APPROVAL", String.class);
         if (StringUtils.isNotBlank(duplicate)) {

+ 1 - 1
flow-workflow/flow-workflow-entity/src/main/java/com/flow/entity/node/ApprovalNode.java

@@ -149,7 +149,7 @@ public class ApprovalNode extends AssigneeNode {
         int indexOf = assignees.indexOf(userId);
         if (indexOf != -1) {
             if (same == ApprovalSameEnum.SKIP) {
-                assignees.remove(userId);
+                // assignees.remove(userId);
             } else if (same == ApprovalSameEnum.LEADER) {
                 User leader = userService.getLeader(userId);
                 Optional<User> optional = Optional.ofNullable(leader);