소스 검색

review:【bpm 工作流】usertask 的跳过表达式

YunaiV 1 년 전
부모
커밋
e07fb6c8fe

+ 3 - 3
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java

@@ -171,15 +171,15 @@ public class GlobalExceptionHandler {
     /**
      * 处理 SpringMVC 请求参数类型错误
      *
-     * 例如说,接口上设置了 @RequestBody实体中 xx 属性类型为 Integer,结果传递 xx 参数类型为 String
+     * 例如说,接口上设置了 @RequestBody 实体中 xx 属性类型为 Integer,结果传递 xx 参数类型为 String
      */
     @ExceptionHandler(HttpMessageNotReadableException.class)
     public CommonResult<?> methodArgumentTypeInvalidFormatExceptionHandler(HttpMessageNotReadableException ex) {
         log.warn("[methodArgumentTypeInvalidFormatExceptionHandler]", ex);
-        if(ex.getCause() instanceof InvalidFormatException) {
+        if (ex.getCause() instanceof InvalidFormatException) {
             InvalidFormatException invalidFormatException = (InvalidFormatException) ex.getCause();
             return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数类型错误:%s", invalidFormatException.getValue()));
-        }else {
+        } else {
             return defaultExceptionHandler(ServletUtils.getRequest(), ex);
         }
     }

+ 1 - 0
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmTaskStatusEnum.java

@@ -13,6 +13,7 @@ import lombok.Getter;
 @Getter
 @AllArgsConstructor
 public enum BpmTaskStatusEnum {
+
     SKIP(-2, "跳过"),
     NOT_START(-1, "未开始"),
     RUNNING(1, "审批中"),

+ 1 - 3
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java

@@ -471,8 +471,6 @@ public class SimpleModelUtils {
             return userTask;
         }
 
-
-
         private void addUserTaskListener(BpmSimpleModelNodeVO node, UserTask userTask) {
             List<FlowableListener> flowableListeners = new ArrayList<>(3);
             if (node.getTaskCreateListener() != null
@@ -1021,7 +1019,7 @@ public class SimpleModelUtils {
     }
 
     /**
-     * 根据跳过表达式,判断是否跳过此节点
+     * 根据跳过表达式,判断是否跳过此节点
      */
     public static boolean isSkipNode(BpmSimpleModelNodeVO currentNode, Map<String, Object> variables) {
         if (StrUtil.isEmpty(currentNode.getSkipExpression())) {

+ 5 - 2
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java

@@ -462,13 +462,16 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
         return approvalNodes;
     }
 
-
     /**
      *  获取结束节点的状态
      */
     private Integer getEndActivityNodeStatus(HistoricTaskInstance task) {
         Integer status = FlowableUtils.getTaskStatus(task);
-        return status == null ? BpmTaskStatusEnum.SKIP.getStatus() : status;  // 结束节点未获取到状态,为跳过状态
+        if (status != null) {
+            return status;
+        }
+        // 结束节点未获取到状态,为跳过状态。可见 bpmn 或者 simple 的 skipExpression
+        return BpmTaskStatusEnum.SKIP.getStatus();
     }
 
     /**