Commit e07fb6c8fe31e9cde0fd8a1cf46a5db3e1b01f55

Authored by YunaiV
1 parent 1e271f52

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

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 { @@ -171,15 +171,15 @@ public class GlobalExceptionHandler {
171 /** 171 /**
172 * 处理 SpringMVC 请求参数类型错误 172 * 处理 SpringMVC 请求参数类型错误
173 * 173 *
174 - * 例如说,接口上设置了 @RequestBody实体中 xx 属性类型为 Integer,结果传递 xx 参数类型为 String 174 + * 例如说,接口上设置了 @RequestBody 实体中 xx 属性类型为 Integer,结果传递 xx 参数类型为 String
175 */ 175 */
176 @ExceptionHandler(HttpMessageNotReadableException.class) 176 @ExceptionHandler(HttpMessageNotReadableException.class)
177 public CommonResult<?> methodArgumentTypeInvalidFormatExceptionHandler(HttpMessageNotReadableException ex) { 177 public CommonResult<?> methodArgumentTypeInvalidFormatExceptionHandler(HttpMessageNotReadableException ex) {
178 log.warn("[methodArgumentTypeInvalidFormatExceptionHandler]", ex); 178 log.warn("[methodArgumentTypeInvalidFormatExceptionHandler]", ex);
179 - if(ex.getCause() instanceof InvalidFormatException) { 179 + if (ex.getCause() instanceof InvalidFormatException) {
180 InvalidFormatException invalidFormatException = (InvalidFormatException) ex.getCause(); 180 InvalidFormatException invalidFormatException = (InvalidFormatException) ex.getCause();
181 return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数类型错误:%s", invalidFormatException.getValue())); 181 return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数类型错误:%s", invalidFormatException.getValue()));
182 - }else { 182 + } else {
183 return defaultExceptionHandler(ServletUtils.getRequest(), ex); 183 return defaultExceptionHandler(ServletUtils.getRequest(), ex);
184 } 184 }
185 } 185 }
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmTaskStatusEnum.java
@@ -13,6 +13,7 @@ import lombok.Getter; @@ -13,6 +13,7 @@ import lombok.Getter;
13 @Getter 13 @Getter
14 @AllArgsConstructor 14 @AllArgsConstructor
15 public enum BpmTaskStatusEnum { 15 public enum BpmTaskStatusEnum {
  16 +
16 SKIP(-2, "跳过"), 17 SKIP(-2, "跳过"),
17 NOT_START(-1, "未开始"), 18 NOT_START(-1, "未开始"),
18 RUNNING(1, "审批中"), 19 RUNNING(1, "审批中"),
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java
@@ -471,8 +471,6 @@ public class SimpleModelUtils { @@ -471,8 +471,6 @@ public class SimpleModelUtils {
471 return userTask; 471 return userTask;
472 } 472 }
473 473
474 -  
475 -  
476 private void addUserTaskListener(BpmSimpleModelNodeVO node, UserTask userTask) { 474 private void addUserTaskListener(BpmSimpleModelNodeVO node, UserTask userTask) {
477 List<FlowableListener> flowableListeners = new ArrayList<>(3); 475 List<FlowableListener> flowableListeners = new ArrayList<>(3);
478 if (node.getTaskCreateListener() != null 476 if (node.getTaskCreateListener() != null
@@ -1021,7 +1019,7 @@ public class SimpleModelUtils { @@ -1021,7 +1019,7 @@ public class SimpleModelUtils {
1021 } 1019 }
1022 1020
1023 /** 1021 /**
1024 - * 根据跳过表达式,判断是否跳过此节点。 1022 + * 根据跳过表达式,判断是否跳过此节点
1025 */ 1023 */
1026 public static boolean isSkipNode(BpmSimpleModelNodeVO currentNode, Map<String, Object> variables) { 1024 public static boolean isSkipNode(BpmSimpleModelNodeVO currentNode, Map<String, Object> variables) {
1027 if (StrUtil.isEmpty(currentNode.getSkipExpression())) { 1025 if (StrUtil.isEmpty(currentNode.getSkipExpression())) {
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java
@@ -462,13 +462,16 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -462,13 +462,16 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
462 return approvalNodes; 462 return approvalNodes;
463 } 463 }
464 464
465 -  
466 /** 465 /**
467 * 获取结束节点的状态 466 * 获取结束节点的状态
468 */ 467 */
469 private Integer getEndActivityNodeStatus(HistoricTaskInstance task) { 468 private Integer getEndActivityNodeStatus(HistoricTaskInstance task) {
470 Integer status = FlowableUtils.getTaskStatus(task); 469 Integer status = FlowableUtils.getTaskStatus(task);
471 - return status == null ? BpmTaskStatusEnum.SKIP.getStatus() : status; // 结束节点未获取到状态,为跳过状态 470 + if (status != null) {
  471 + return status;
  472 + }
  473 + // 结束节点未获取到状态,为跳过状态。可见 bpmn 或者 simple 的 skipExpression
  474 + return BpmTaskStatusEnum.SKIP.getStatus();
472 } 475 }
473 476
474 /** 477 /**