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

This commit is contained in:
YunaiV
2025-07-29 13:13:47 +08:00
parent 1e271f5270
commit e07fb6c8fe
4 changed files with 10 additions and 8 deletions

View File

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

View File

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

View File

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

View File

@ -462,13 +462,16 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
return approvalNodes; return approvalNodes;
} }
/** /**
* 获取结束节点的状态 * 获取结束节点的状态
*/ */
private Integer getEndActivityNodeStatus(HistoricTaskInstance task) { private Integer getEndActivityNodeStatus(HistoricTaskInstance task) {
Integer status = FlowableUtils.getTaskStatus(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();
} }
/** /**