Commit 61e32752310fbb813adaaa1edac3404618548813
1 parent
808f23ec
【代码评审】Bpm:触发器的实现
Showing
24 changed files
with
165 additions
and
155 deletions
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmAutoApproveType.java renamed to yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmAutoApproveTypeEnum.java
| ... | ... | @@ -13,13 +13,13 @@ import java.util.Arrays; |
| 13 | 13 | */ |
| 14 | 14 | @Getter |
| 15 | 15 | @AllArgsConstructor |
| 16 | -public enum BpmAutoApproveType implements IntArrayValuable { | |
| 16 | +public enum BpmAutoApproveTypeEnum implements IntArrayValuable { | |
| 17 | 17 | |
| 18 | 18 | NONE(0, "不自动通过"), |
| 19 | 19 | APPROVE_ALL(1, "仅审批一次,后续重复的审批节点均自动通过"), |
| 20 | 20 | APPROVE_SEQUENT(2, "仅针对连续审批的节点自动通过"); |
| 21 | 21 | |
| 22 | - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmAutoApproveType::getType).toArray(); | |
| 22 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmAutoApproveTypeEnum::getType).toArray(); | |
| 23 | 23 | |
| 24 | 24 | private final Integer type; |
| 25 | 25 | private final String name; | ... | ... |
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmBoundaryEventType.java renamed to yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmBoundaryEventTypeEnum.java
| ... | ... | @@ -11,7 +11,7 @@ import lombok.Getter; |
| 11 | 11 | */ |
| 12 | 12 | @Getter |
| 13 | 13 | @AllArgsConstructor |
| 14 | -public enum BpmBoundaryEventType { | |
| 14 | +public enum BpmBoundaryEventTypeEnum { | |
| 15 | 15 | |
| 16 | 16 | USER_TASK_TIMEOUT(1, "用户任务超时"), |
| 17 | 17 | DELAY_TIMER_TIMEOUT(2, "延迟器超时"); |
| ... | ... | @@ -19,7 +19,7 @@ public enum BpmBoundaryEventType { |
| 19 | 19 | private final Integer type; |
| 20 | 20 | private final String name; |
| 21 | 21 | |
| 22 | - public static BpmBoundaryEventType typeOf(Integer type) { | |
| 22 | + public static BpmBoundaryEventTypeEnum typeOf(Integer type) { | |
| 23 | 23 | return ArrayUtil.firstMatch(eventType -> eventType.getType().equals(type), values()); |
| 24 | 24 | } |
| 25 | 25 | ... | ... |
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmDelayTimerType.java renamed to yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmDelayTimerTypeEnum.java
| ... | ... | @@ -13,7 +13,7 @@ import java.util.Arrays; |
| 13 | 13 | */ |
| 14 | 14 | @Getter |
| 15 | 15 | @AllArgsConstructor |
| 16 | -public enum BpmDelayTimerType implements IntArrayValuable { | |
| 16 | +public enum BpmDelayTimerTypeEnum implements IntArrayValuable { | |
| 17 | 17 | |
| 18 | 18 | FIXED_TIME_DURATION(1, "固定时长"), |
| 19 | 19 | FIXED_DATE_TIME(2, "固定日期"); |
| ... | ... | @@ -21,7 +21,7 @@ public enum BpmDelayTimerType implements IntArrayValuable { |
| 21 | 21 | private final Integer type; |
| 22 | 22 | private final String name; |
| 23 | 23 | |
| 24 | - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmDelayTimerType::getType).toArray(); | |
| 24 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmDelayTimerTypeEnum::getType).toArray(); | |
| 25 | 25 | |
| 26 | 26 | @Override |
| 27 | 27 | public int[] array() { | ... | ... |
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmHttpRequestParamSettingType.java renamed to yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmHttpRequestParamTypeEnum.java
| ... | ... | @@ -13,7 +13,7 @@ import java.util.Arrays; |
| 13 | 13 | */ |
| 14 | 14 | @Getter |
| 15 | 15 | @AllArgsConstructor |
| 16 | -public enum BpmHttpRequestParamSettingType implements IntArrayValuable { | |
| 16 | +public enum BpmHttpRequestParamTypeEnum implements IntArrayValuable { | |
| 17 | 17 | |
| 18 | 18 | FIXED_VALUE(1, "固定值"), |
| 19 | 19 | FROM_FORM(2, "表单"); |
| ... | ... | @@ -21,7 +21,7 @@ public enum BpmHttpRequestParamSettingType implements IntArrayValuable { |
| 21 | 21 | private final Integer type; |
| 22 | 22 | private final String name; |
| 23 | 23 | |
| 24 | - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmHttpRequestParamSettingType::getType).toArray(); | |
| 24 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmHttpRequestParamTypeEnum::getType).toArray(); | |
| 25 | 25 | |
| 26 | 26 | @Override |
| 27 | 27 | public int[] array() { | ... | ... |
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmProcessListenerType.java renamed to yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmProcessListenerTypeEnum.java
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmProcessListenerValueType.java renamed to yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmProcessListenerValueTypeEnum.java
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmSimpleModeConditionType.java renamed to yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmSimpleModeConditionTypeEnum.java
| ... | ... | @@ -14,18 +14,18 @@ import java.util.Arrays; |
| 14 | 14 | */ |
| 15 | 15 | @Getter |
| 16 | 16 | @AllArgsConstructor |
| 17 | -public enum BpmSimpleModeConditionType implements IntArrayValuable { | |
| 17 | +public enum BpmSimpleModeConditionTypeEnum implements IntArrayValuable { | |
| 18 | 18 | |
| 19 | 19 | EXPRESSION(1, "条件表达式"), |
| 20 | 20 | RULE(2, "条件规则"); |
| 21 | 21 | |
| 22 | - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmSimpleModeConditionType::getType).toArray(); | |
| 22 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmSimpleModeConditionTypeEnum::getType).toArray(); | |
| 23 | 23 | |
| 24 | 24 | private final Integer type; |
| 25 | 25 | |
| 26 | 26 | private final String name; |
| 27 | 27 | |
| 28 | - public static BpmSimpleModeConditionType valueOf(Integer type) { | |
| 28 | + public static BpmSimpleModeConditionTypeEnum valueOf(Integer type) { | |
| 29 | 29 | return ArrayUtil.firstMatch(nodeType -> nodeType.getType().equals(type), values()); |
| 30 | 30 | } |
| 31 | 31 | ... | ... |
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmSimpleModelNodeType.java renamed to yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmSimpleModelNodeTypeEnum.java
| ... | ... | @@ -15,7 +15,7 @@ import java.util.Objects; |
| 15 | 15 | */ |
| 16 | 16 | @Getter |
| 17 | 17 | @AllArgsConstructor |
| 18 | -public enum BpmSimpleModelNodeType implements IntArrayValuable { | |
| 18 | +public enum BpmSimpleModelNodeTypeEnum implements IntArrayValuable { | |
| 19 | 19 | |
| 20 | 20 | // 0 ~ 1 开始和结束 |
| 21 | 21 | START_NODE(0, "开始", "startEvent"), |
| ... | ... | @@ -37,7 +37,7 @@ public enum BpmSimpleModelNodeType implements IntArrayValuable { |
| 37 | 37 | ROUTER_BRANCH_NODE(54, "路由分支", "exclusiveGateway") |
| 38 | 38 | ; |
| 39 | 39 | |
| 40 | - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmSimpleModelNodeType::getType).toArray(); | |
| 40 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmSimpleModelNodeTypeEnum::getType).toArray(); | |
| 41 | 41 | |
| 42 | 42 | private final Integer type; |
| 43 | 43 | private final String name; |
| ... | ... | @@ -55,7 +55,7 @@ public enum BpmSimpleModelNodeType implements IntArrayValuable { |
| 55 | 55 | || Objects.equals(ROUTER_BRANCH_NODE.getType(), type); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public static BpmSimpleModelNodeType valueOf(Integer type) { | |
| 58 | + public static BpmSimpleModelNodeTypeEnum valueOf(Integer type) { | |
| 59 | 59 | return ArrayUtil.firstMatch(nodeType -> nodeType.getType().equals(type), values()); |
| 60 | 60 | } |
| 61 | 61 | ... | ... |
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmTriggerType.java renamed to yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmTriggerTypeEnum.java
| ... | ... | @@ -14,7 +14,7 @@ import java.util.Arrays; |
| 14 | 14 | */ |
| 15 | 15 | @Getter |
| 16 | 16 | @AllArgsConstructor |
| 17 | -public enum BpmTriggerType implements IntArrayValuable { | |
| 17 | +public enum BpmTriggerTypeEnum implements IntArrayValuable { | |
| 18 | 18 | |
| 19 | 19 | HTTP_REQUEST(1, "发起 HTTP 请求"); |
| 20 | 20 | |
| ... | ... | @@ -28,14 +28,14 @@ public enum BpmTriggerType implements IntArrayValuable { |
| 28 | 28 | */ |
| 29 | 29 | private final String desc; |
| 30 | 30 | |
| 31 | - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmTriggerType::getType).toArray(); | |
| 31 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmTriggerTypeEnum::getType).toArray(); | |
| 32 | 32 | |
| 33 | 33 | @Override |
| 34 | 34 | public int[] array() { |
| 35 | 35 | return ARRAYS; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public static BpmTriggerType typeOf(Integer type) { | |
| 38 | + public static BpmTriggerTypeEnum typeOf(Integer type) { | |
| 39 | 39 | return ArrayUtil.firstMatch(item -> item.getType().equals(type), values()); |
| 40 | 40 | } |
| 41 | 41 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmUserTaskRejectHandlerType.java renamed to yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmUserTaskRejectHandlerTypeEnum.java
| ... | ... | @@ -14,7 +14,7 @@ import java.util.Arrays; |
| 14 | 14 | */ |
| 15 | 15 | @Getter |
| 16 | 16 | @AllArgsConstructor |
| 17 | -public enum BpmUserTaskRejectHandlerType implements IntArrayValuable { | |
| 17 | +public enum BpmUserTaskRejectHandlerTypeEnum implements IntArrayValuable { | |
| 18 | 18 | |
| 19 | 19 | FINISH_PROCESS_INSTANCE(1, "终止流程"), |
| 20 | 20 | RETURN_USER_TASK(2, "驳回到指定任务节点"); |
| ... | ... | @@ -22,9 +22,9 @@ public enum BpmUserTaskRejectHandlerType implements IntArrayValuable { |
| 22 | 22 | private final Integer type; |
| 23 | 23 | private final String name; |
| 24 | 24 | |
| 25 | - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmUserTaskRejectHandlerType::getType).toArray(); | |
| 25 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmUserTaskRejectHandlerTypeEnum::getType).toArray(); | |
| 26 | 26 | |
| 27 | - public static BpmUserTaskRejectHandlerType typeOf(Integer type) { | |
| 27 | + public static BpmUserTaskRejectHandlerTypeEnum typeOf(Integer type) { | |
| 28 | 28 | return ArrayUtil.firstMatch(item -> item.getType().equals(type), values()); |
| 29 | 29 | } |
| 30 | 30 | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelMetaInfoVO.java
| 1 | 1 | package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 4 | -import cn.iocoder.yudao.module.bpm.enums.definition.BpmAutoApproveType; | |
| 4 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmAutoApproveTypeEnum; | |
| 5 | 5 | import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum; |
| 6 | 6 | import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelTypeEnum; |
| 7 | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| ... | ... | @@ -71,7 +71,7 @@ public class BpmModelMetaInfoVO { |
| 71 | 71 | private ProcessIdRule processIdRule; |
| 72 | 72 | |
| 73 | 73 | @Schema(description = "自动去重类型", example = "1") |
| 74 | - @InEnum(BpmAutoApproveType.class) | |
| 74 | + @InEnum(BpmAutoApproveTypeEnum.class) | |
| 75 | 75 | private Integer autoApprovalType; |
| 76 | 76 | |
| 77 | 77 | @Schema(description = "流程 ID 规则") | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/simple/BpmSimpleModelNodeVO.java
| ... | ... | @@ -25,7 +25,7 @@ public class BpmSimpleModelNodeVO { |
| 25 | 25 | |
| 26 | 26 | @Schema(description = "模型节点类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 27 | 27 | @NotNull(message = "模型节点类型不能为空") |
| 28 | - @InEnum(BpmSimpleModelNodeType.class) | |
| 28 | + @InEnum(BpmSimpleModelNodeTypeEnum.class) | |
| 29 | 29 | private Integer type; |
| 30 | 30 | |
| 31 | 31 | @Schema(description = "模型节点名称", example = "领导审批") |
| ... | ... | @@ -134,18 +134,19 @@ public class BpmSimpleModelNodeVO { |
| 134 | 134 | private String path; |
| 135 | 135 | |
| 136 | 136 | @Schema(description = "请求头", example = "[]") |
| 137 | - private List<HttpRequestParamSetting> header; | |
| 137 | + private List<HttpRequestParam> header; | |
| 138 | 138 | |
| 139 | 139 | @Schema(description = "请求体", example = "[]") |
| 140 | - private List<HttpRequestParamSetting> body; | |
| 140 | + private List<HttpRequestParam> body; | |
| 141 | + | |
| 141 | 142 | } |
| 142 | 143 | |
| 143 | 144 | @Schema(description = "HTTP 请求参数设置") |
| 144 | 145 | @Data |
| 145 | - public static class HttpRequestParamSetting { | |
| 146 | + public static class HttpRequestParam { | |
| 146 | 147 | |
| 147 | 148 | @Schema(description = "值类型", example = "1") |
| 148 | - @InEnum(BpmHttpRequestParamSettingType.class) | |
| 149 | + @InEnum(BpmHttpRequestParamTypeEnum.class) | |
| 149 | 150 | @NotNull(message = "值类型不能为空") |
| 150 | 151 | private Integer type; |
| 151 | 152 | |
| ... | ... | @@ -163,7 +164,7 @@ public class BpmSimpleModelNodeVO { |
| 163 | 164 | public static class RejectHandler { |
| 164 | 165 | |
| 165 | 166 | @Schema(description = "拒绝处理类型", example = "1") |
| 166 | - @InEnum(BpmUserTaskRejectHandlerType.class) | |
| 167 | + @InEnum(BpmUserTaskRejectHandlerTypeEnum.class) | |
| 167 | 168 | private Integer type; |
| 168 | 169 | |
| 169 | 170 | @Schema(description = "任务拒绝后驳回的节点 Id", example = "Activity_1") |
| ... | ... | @@ -229,7 +230,7 @@ public class BpmSimpleModelNodeVO { |
| 229 | 230 | public static class ConditionSetting { |
| 230 | 231 | |
| 231 | 232 | @Schema(description = "条件类型", example = "1") |
| 232 | - @InEnum(BpmSimpleModeConditionType.class) | |
| 233 | + @InEnum(BpmSimpleModeConditionTypeEnum.class) | |
| 233 | 234 | private Integer conditionType; |
| 234 | 235 | |
| 235 | 236 | @Schema(description = "条件表达式", example = "${day>3}") |
| ... | ... | @@ -297,7 +298,7 @@ public class BpmSimpleModelNodeVO { |
| 297 | 298 | |
| 298 | 299 | @Schema(description = "延迟时间类型", example = "1") |
| 299 | 300 | @NotNull(message = "延迟时间类型不能为空") |
| 300 | - @InEnum(BpmDelayTimerType.class) | |
| 301 | + @InEnum(BpmDelayTimerTypeEnum.class) | |
| 301 | 302 | private Integer delayType; |
| 302 | 303 | |
| 303 | 304 | @Schema(description = "延迟时间表达式", example = "PT1H,2025-01-01T00:00:00") |
| ... | ... | @@ -315,7 +316,7 @@ public class BpmSimpleModelNodeVO { |
| 315 | 316 | private String nodeId; |
| 316 | 317 | |
| 317 | 318 | @Schema(description = "条件类型", example = "1") |
| 318 | - @InEnum(BpmSimpleModeConditionType.class) | |
| 319 | + @InEnum(BpmSimpleModeConditionTypeEnum.class) | |
| 319 | 320 | @NotNull(message = "条件类型不能为空") |
| 320 | 321 | private Integer conditionType; |
| 321 | 322 | |
| ... | ... | @@ -332,7 +333,7 @@ public class BpmSimpleModelNodeVO { |
| 332 | 333 | public static class TriggerSetting { |
| 333 | 334 | |
| 334 | 335 | @Schema(description = "触发器类型", example = "1") |
| 335 | - @InEnum(BpmTriggerType.class) | |
| 336 | + @InEnum(BpmTriggerTypeEnum.class) | |
| 336 | 337 | @NotNull(message = "触发器类型不能为空") |
| 337 | 338 | private Integer type; |
| 338 | 339 | |
| ... | ... | @@ -353,11 +354,12 @@ public class BpmSimpleModelNodeVO { |
| 353 | 354 | |
| 354 | 355 | @Schema(description = "请求头参数设置", example = "[]") |
| 355 | 356 | @Valid |
| 356 | - private List<HttpRequestParamSetting> header; | |
| 357 | + private List<HttpRequestParam> header; | |
| 357 | 358 | |
| 358 | 359 | @Schema(description = "请求头参数设置", example = "[]") |
| 359 | 360 | @Valid |
| 360 | - private List<HttpRequestParamSetting> body; | |
| 361 | + private List<HttpRequestParam> body; | |
| 361 | 362 | } |
| 363 | + | |
| 362 | 364 | } |
| 363 | 365 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/definition/BpmProcessDefinitionInfoDO.java
| ... | ... | @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.type.StringListTypeHandler; |
| 6 | 6 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelMetaInfoVO; |
| 7 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmAutoApproveTypeEnum; | |
| 7 | 8 | import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum; |
| 8 | 9 | import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelTypeEnum; |
| 9 | 10 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| ... | ... | @@ -165,7 +166,7 @@ public class BpmProcessDefinitionInfoDO extends BaseDO { |
| 165 | 166 | /** |
| 166 | 167 | * 自动去重类型 |
| 167 | 168 | * |
| 168 | - * 枚举 {@link cn.iocoder.yudao.module.bpm.enums.definition.BpmAutoApproveType} | |
| 169 | + * 枚举 {@link BpmAutoApproveTypeEnum} | |
| 169 | 170 | */ |
| 170 | 171 | private Integer autoApprovalType; |
| 171 | 172 | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/definition/BpmProcessListenerDO.java
| 1 | 1 | package cn.iocoder.yudao.module.bpm.dal.dataobject.definition; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmProcessListenerTypeEnum; | |
| 4 | 5 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 5 | 6 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | 7 | import com.baomidou.mybatisplus.annotation.TableName; |
| ... | ... | @@ -42,7 +43,7 @@ public class BpmProcessListenerDO extends BaseDO { |
| 42 | 43 | /** |
| 43 | 44 | * 监听类型 |
| 44 | 45 | * |
| 45 | - * 枚举 {@link cn.iocoder.yudao.module.bpm.enums.definition.BpmProcessListenerType} | |
| 46 | + * 枚举 {@link BpmProcessListenerTypeEnum} | |
| 46 | 47 | * |
| 47 | 48 | * 1. execution:ExecutionListener <a href="https://tkjohn.github.io/flowable-userguide/#executionListeners">执行监听器</a> |
| 48 | 49 | * 2. task:TaskListener <a href="https://tkjohn.github.io/flowable-userguide/#taskListeners">任务监听器</a> | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/enums/BpmnModelConstants.java
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/listener/BpmTaskEventListener.java
| ... | ... | @@ -4,7 +4,7 @@ import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.util.ObjectUtil; |
| 5 | 5 | import cn.hutool.core.util.StrUtil; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.util.number.NumberUtils; |
| 7 | -import cn.iocoder.yudao.module.bpm.enums.definition.BpmBoundaryEventType; | |
| 7 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmBoundaryEventTypeEnum; | |
| 8 | 8 | import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants; |
| 9 | 9 | import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils; |
| 10 | 10 | import cn.iocoder.yudao.module.bpm.service.definition.BpmModelService; |
| ... | ... | @@ -97,17 +97,17 @@ public class BpmTaskEventListener extends AbstractFlowableEngineEventListener { |
| 97 | 97 | BoundaryEvent boundaryEvent = (BoundaryEvent) element; |
| 98 | 98 | String boundaryEventType = BpmnModelUtils.parseBoundaryEventExtensionElement(boundaryEvent, |
| 99 | 99 | BpmnModelConstants.BOUNDARY_EVENT_TYPE); |
| 100 | - BpmBoundaryEventType bpmTimerBoundaryEventType = BpmBoundaryEventType.typeOf(NumberUtils.parseInt(boundaryEventType)); | |
| 100 | + BpmBoundaryEventTypeEnum bpmTimerBoundaryEventType = BpmBoundaryEventTypeEnum.typeOf(NumberUtils.parseInt(boundaryEventType)); | |
| 101 | 101 | |
| 102 | 102 | // 2. 处理超时 |
| 103 | - if (ObjectUtil.equal(bpmTimerBoundaryEventType, BpmBoundaryEventType.USER_TASK_TIMEOUT)) { | |
| 103 | + if (ObjectUtil.equal(bpmTimerBoundaryEventType, BpmBoundaryEventTypeEnum.USER_TASK_TIMEOUT)) { | |
| 104 | 104 | // 2.1 用户任务超时处理 |
| 105 | 105 | String timeoutHandlerType = BpmnModelUtils.parseBoundaryEventExtensionElement(boundaryEvent, |
| 106 | 106 | BpmnModelConstants.USER_TASK_TIMEOUT_HANDLER_TYPE); |
| 107 | 107 | String taskKey = boundaryEvent.getAttachedToRefId(); |
| 108 | 108 | taskService.processTaskTimeout(event.getProcessInstanceId(), taskKey, NumberUtils.parseInt(timeoutHandlerType)); |
| 109 | 109 | // 2.2 延迟器超时处理 |
| 110 | - } else if (ObjectUtil.equal(bpmTimerBoundaryEventType, BpmBoundaryEventType.DELAY_TIMER_TIMEOUT)) { | |
| 110 | + } else if (ObjectUtil.equal(bpmTimerBoundaryEventType, BpmBoundaryEventTypeEnum.DELAY_TIMER_TIMEOUT)) { | |
| 111 | 111 | String taskKey = boundaryEvent.getAttachedToRefId(); |
| 112 | 112 | taskService.processDelayTimerTimeout(event.getProcessInstanceId(), taskKey); |
| 113 | 113 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/listener/BpmTriggerTaskDelegate.java
| 1 | 1 | package cn.iocoder.yudao.module.bpm.framework.flowable.core.listener; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.bpm.enums.definition.BpmTriggerType; | |
| 3 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmTriggerTypeEnum; | |
| 4 | 4 | import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils; |
| 5 | 5 | import cn.iocoder.yudao.module.bpm.service.task.trigger.BpmTrigger; |
| 6 | 6 | import jakarta.annotation.PostConstruct; |
| ... | ... | @@ -33,7 +33,7 @@ public class BpmTriggerTaskDelegate implements JavaDelegate { |
| 33 | 33 | @Resource |
| 34 | 34 | private List<BpmTrigger> triggers; |
| 35 | 35 | |
| 36 | - private final EnumMap<BpmTriggerType, BpmTrigger> triggerMap = new EnumMap<>(BpmTriggerType.class); | |
| 36 | + private final EnumMap<BpmTriggerTypeEnum, BpmTrigger> triggerMap = new EnumMap<>(BpmTriggerTypeEnum.class); | |
| 37 | 37 | |
| 38 | 38 | @PostConstruct |
| 39 | 39 | private void init() { |
| ... | ... | @@ -43,12 +43,13 @@ public class BpmTriggerTaskDelegate implements JavaDelegate { |
| 43 | 43 | @Override |
| 44 | 44 | public void execute(DelegateExecution execution) { |
| 45 | 45 | FlowElement flowElement = execution.getCurrentFlowElement(); |
| 46 | - BpmTriggerType bpmTriggerType = BpmnModelUtils.parserTriggerType(flowElement); | |
| 46 | + BpmTriggerTypeEnum bpmTriggerType = BpmnModelUtils.parserTriggerType(flowElement); | |
| 47 | 47 | BpmTrigger bpmTrigger = triggerMap.get(bpmTriggerType); |
| 48 | 48 | if (bpmTrigger == null) { |
| 49 | - log.error("[execute], FlowElement[{}], {} 找不到匹配的 BpmTrigger", execution.getCurrentActivityId(), flowElement); | |
| 49 | + log.error("[execute][FlowElement({}), {} 找不到匹配的触发器]", execution.getCurrentActivityId(), flowElement); | |
| 50 | 50 | return; |
| 51 | 51 | } |
| 52 | 52 | bpmTrigger.execute(execution.getProcessInstanceId(), BpmnModelUtils.parserTriggerParam(flowElement)); |
| 53 | 53 | } |
| 54 | + | |
| 54 | 55 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmnModelUtils.java
| ... | ... | @@ -171,9 +171,9 @@ public class BpmnModelUtils { |
| 171 | 171 | * @param userTask 任务节点 |
| 172 | 172 | * @return 任务拒绝处理类型 |
| 173 | 173 | */ |
| 174 | - public static BpmUserTaskRejectHandlerType parseRejectHandlerType(FlowElement userTask) { | |
| 174 | + public static BpmUserTaskRejectHandlerTypeEnum parseRejectHandlerType(FlowElement userTask) { | |
| 175 | 175 | Integer rejectHandlerType = NumberUtils.parseInt(parseExtensionElement(userTask, USER_TASK_REJECT_HANDLER_TYPE)); |
| 176 | - return BpmUserTaskRejectHandlerType.typeOf(rejectHandlerType); | |
| 176 | + return BpmUserTaskRejectHandlerTypeEnum.typeOf(rejectHandlerType); | |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
| ... | ... | @@ -394,9 +394,9 @@ public class BpmnModelUtils { |
| 394 | 394 | return JsonUtils.parseObject(expressionText, BpmSimpleModelNodeVO.ListenerHandler.class); |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - public static BpmTriggerType parserTriggerType(FlowElement flowElement) { | |
| 397 | + public static BpmTriggerTypeEnum parserTriggerType(FlowElement flowElement) { | |
| 398 | 398 | Integer triggerType = NumberUtils.parseInt(parseExtensionElement(flowElement, TRIGGER_TYPE)); |
| 399 | - return BpmTriggerType.typeOf(triggerType); | |
| 399 | + return BpmTriggerTypeEnum.typeOf(triggerType); | |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | public static String parserTriggerParam(FlowElement flowElement) { |
| ... | ... | @@ -834,7 +834,7 @@ public class BpmnModelUtils { |
| 834 | 834 | Object result = FlowableUtils.getExpressionValue(variables, express); |
| 835 | 835 | return Boolean.TRUE.equals(result); |
| 836 | 836 | } catch (FlowableException ex) { |
| 837 | - log.error("[evalConditionExpress][条件表达式({}) 变量({}) 解析报错", express, variables, ex); | |
| 837 | + log.error("[evalConditionExpress][条件表达式({}) 变量({}) 解析报错]", express, variables, ex); | |
| 838 | 838 | return Boolean.FALSE; |
| 839 | 839 | } |
| 840 | 840 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java
| ... | ... | @@ -37,7 +37,7 @@ import static java.util.Arrays.asList; |
| 37 | 37 | */ |
| 38 | 38 | public class SimpleModelUtils { |
| 39 | 39 | |
| 40 | - private static final Map<BpmSimpleModelNodeType, NodeConvert> NODE_CONVERTS = MapUtil.newHashMap(); | |
| 40 | + private static final Map<BpmSimpleModelNodeTypeEnum, NodeConvert> NODE_CONVERTS = MapUtil.newHashMap(); | |
| 41 | 41 | |
| 42 | 42 | static { |
| 43 | 43 | List<NodeConvert> converts = asList(new StartNodeConvert(), new EndNodeConvert(), |
| ... | ... | @@ -89,8 +89,8 @@ public class SimpleModelUtils { |
| 89 | 89 | |
| 90 | 90 | private static BpmSimpleModelNodeVO buildStartNode() { |
| 91 | 91 | return new BpmSimpleModelNodeVO().setId(START_EVENT_NODE_ID) |
| 92 | - .setName(BpmSimpleModelNodeType.START_NODE.getName()) | |
| 93 | - .setType(BpmSimpleModelNodeType.START_NODE.getType()); | |
| 92 | + .setName(BpmSimpleModelNodeTypeEnum.START_NODE.getName()) | |
| 93 | + .setType(BpmSimpleModelNodeTypeEnum.START_NODE.getType()); | |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
| ... | ... | @@ -104,7 +104,7 @@ public class SimpleModelUtils { |
| 104 | 104 | if (!isValidNode(node)) { |
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | - BpmSimpleModelNodeType nodeType = BpmSimpleModelNodeType.valueOf(node.getType()); | |
| 107 | + BpmSimpleModelNodeTypeEnum nodeType = BpmSimpleModelNodeTypeEnum.valueOf(node.getType()); | |
| 108 | 108 | Assert.notNull(nodeType, "模型节点类型({})不支持", node.getType()); |
| 109 | 109 | |
| 110 | 110 | // 2. 处理当前节点 |
| ... | ... | @@ -114,7 +114,7 @@ public class SimpleModelUtils { |
| 114 | 114 | flowElements.forEach(process::addFlowElement); |
| 115 | 115 | |
| 116 | 116 | // 3.1 情况一:如果当前是分支节点,并且存在条件节点,则处理每个条件的子节点 |
| 117 | - if (BpmSimpleModelNodeType.isBranchNode(node.getType()) | |
| 117 | + if (BpmSimpleModelNodeTypeEnum.isBranchNode(node.getType()) | |
| 118 | 118 | && CollUtil.isNotEmpty(node.getConditionNodes())) { |
| 119 | 119 | // 注意:这里的 item.getChildNode() 处理的是每个条件的子节点,不是处理条件 |
| 120 | 120 | node.getConditionNodes().forEach(item -> traverseNodeToBuildFlowNode(item.getChildNode(), process)); |
| ... | ... | @@ -137,14 +137,14 @@ public class SimpleModelUtils { |
| 137 | 137 | return; |
| 138 | 138 | } |
| 139 | 139 | // 1.2 END_NODE 直接返回 |
| 140 | - BpmSimpleModelNodeType nodeType = BpmSimpleModelNodeType.valueOf(node.getType()); | |
| 140 | + BpmSimpleModelNodeTypeEnum nodeType = BpmSimpleModelNodeTypeEnum.valueOf(node.getType()); | |
| 141 | 141 | Assert.notNull(nodeType, "模型节点类型不支持"); |
| 142 | - if (nodeType == BpmSimpleModelNodeType.END_NODE) { | |
| 142 | + if (nodeType == BpmSimpleModelNodeTypeEnum.END_NODE) { | |
| 143 | 143 | return; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // 2.1 情况一:普通节点 |
| 147 | - if (!BpmSimpleModelNodeType.isBranchNode(node.getType())) { | |
| 147 | + if (!BpmSimpleModelNodeTypeEnum.isBranchNode(node.getType())) { | |
| 148 | 148 | traverseNormalNodeToBuildSequenceFlow(process, node, targetNodeId); |
| 149 | 149 | } else { |
| 150 | 150 | // 2.2 情况二:分支节点 |
| ... | ... | @@ -182,26 +182,26 @@ public class SimpleModelUtils { |
| 182 | 182 | * @param targetNodeId 目标节点 ID |
| 183 | 183 | */ |
| 184 | 184 | private static void traverseBranchNodeToBuildSequenceFlow(Process process, BpmSimpleModelNodeVO node, String targetNodeId) { |
| 185 | - BpmSimpleModelNodeType nodeType = BpmSimpleModelNodeType.valueOf(node.getType()); | |
| 185 | + BpmSimpleModelNodeTypeEnum nodeType = BpmSimpleModelNodeTypeEnum.valueOf(node.getType()); | |
| 186 | 186 | BpmSimpleModelNodeVO childNode = node.getChildNode(); |
| 187 | 187 | List<BpmSimpleModelNodeVO> conditionNodes = node.getConditionNodes(); |
| 188 | 188 | // TODO @芋艿 路由分支没有conditionNodes 这里注释会影响吗?@jason:一起帮忙瞅瞅! |
| 189 | 189 | // Assert.notEmpty(conditionNodes, "分支节点的条件节点不能为空"); |
| 190 | 190 | // 分支终点节点 ID |
| 191 | 191 | String branchEndNodeId = null; |
| 192 | - if (nodeType == BpmSimpleModelNodeType.CONDITION_BRANCH_NODE | |
| 193 | - || nodeType == BpmSimpleModelNodeType.ROUTER_BRANCH_NODE) { // 条件分支或路由分支 | |
| 192 | + if (nodeType == BpmSimpleModelNodeTypeEnum.CONDITION_BRANCH_NODE | |
| 193 | + || nodeType == BpmSimpleModelNodeTypeEnum.ROUTER_BRANCH_NODE) { // 条件分支或路由分支 | |
| 194 | 194 | // 分两种情况 1. 分支节点有孩子节点为孩子节点 Id 2. 分支节点孩子为无效节点时 (分支嵌套且为分支最后一个节点) 为分支终点节点 ID |
| 195 | 195 | branchEndNodeId = isValidNode(childNode) ? childNode.getId() : targetNodeId; |
| 196 | - } else if (nodeType == BpmSimpleModelNodeType.PARALLEL_BRANCH_NODE | |
| 197 | - || nodeType == BpmSimpleModelNodeType.INCLUSIVE_BRANCH_NODE) { // 并行分支或包容分支 | |
| 196 | + } else if (nodeType == BpmSimpleModelNodeTypeEnum.PARALLEL_BRANCH_NODE | |
| 197 | + || nodeType == BpmSimpleModelNodeTypeEnum.INCLUSIVE_BRANCH_NODE) { // 并行分支或包容分支 | |
| 198 | 198 | // 分支节点:分支终点节点 Id 为程序创建的网关集合节点。目前不会从前端传入。 |
| 199 | 199 | branchEndNodeId = buildGatewayJoinId(node.getId()); |
| 200 | 200 | } |
| 201 | 201 | Assert.notEmpty(branchEndNodeId, "分支终点节点 Id 不能为空"); |
| 202 | 202 | |
| 203 | 203 | // 3. 遍历分支节点 |
| 204 | - if (nodeType == BpmSimpleModelNodeType.ROUTER_BRANCH_NODE) { | |
| 204 | + if (nodeType == BpmSimpleModelNodeTypeEnum.ROUTER_BRANCH_NODE) { | |
| 205 | 205 | // 路由分支遍历 |
| 206 | 206 | for (BpmSimpleModelNodeVO.RouterSetting router : node.getRouterGroups()) { |
| 207 | 207 | SequenceFlow sequenceFlow = RouteBranchNodeConvert.buildSequenceFlow(node.getId(), router); |
| ... | ... | @@ -210,7 +210,7 @@ public class SimpleModelUtils { |
| 210 | 210 | } else { |
| 211 | 211 | // 下面的注释,以如下情况举例子。分支 1:A->B->C->D->E,分支 2:A->D->E。其中,A 为分支节点, D 为 A 孩子节点 |
| 212 | 212 | for (BpmSimpleModelNodeVO item : conditionNodes) { |
| 213 | - Assert.isTrue(Objects.equals(item.getType(), BpmSimpleModelNodeType.CONDITION_NODE.getType()), | |
| 213 | + Assert.isTrue(Objects.equals(item.getType(), BpmSimpleModelNodeTypeEnum.CONDITION_NODE.getType()), | |
| 214 | 214 | "条件节点类型({})不符合", item.getType()); |
| 215 | 215 | BpmSimpleModelNodeVO conditionChildNode = item.getChildNode(); |
| 216 | 216 | // 3.1 分支有后续节点。即分支 1: A->B->C->D 的情况 |
| ... | ... | @@ -229,13 +229,13 @@ public class SimpleModelUtils { |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | // 4.1 如果是并行分支、包容分支,由于是程序创建的聚合网关,需要手工创建聚合网关和下一个节点的连线 |
| 232 | - if (nodeType == BpmSimpleModelNodeType.PARALLEL_BRANCH_NODE | |
| 233 | - || nodeType == BpmSimpleModelNodeType.INCLUSIVE_BRANCH_NODE) { | |
| 232 | + if (nodeType == BpmSimpleModelNodeTypeEnum.PARALLEL_BRANCH_NODE | |
| 233 | + || nodeType == BpmSimpleModelNodeTypeEnum.INCLUSIVE_BRANCH_NODE) { | |
| 234 | 234 | String nextNodeId = isValidNode(childNode) ? childNode.getId() : targetNodeId; |
| 235 | 235 | SequenceFlow sequenceFlow = buildBpmnSequenceFlow(branchEndNodeId, nextNodeId); |
| 236 | 236 | process.addFlowElement(sequenceFlow); |
| 237 | 237 | // 4.2 如果是路由分支,需要连接后续节点为默认路由 |
| 238 | - } else if (nodeType == BpmSimpleModelNodeType.ROUTER_BRANCH_NODE) { | |
| 238 | + } else if (nodeType == BpmSimpleModelNodeTypeEnum.ROUTER_BRANCH_NODE) { | |
| 239 | 239 | SequenceFlow sequenceFlow = buildBpmnSequenceFlow(node.getId(), branchEndNodeId, node.getRouterDefaultFlowId(), |
| 240 | 240 | null, null); |
| 241 | 241 | process.addFlowElement(sequenceFlow); |
| ... | ... | @@ -274,7 +274,7 @@ public class SimpleModelUtils { |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | public static boolean isSequentialApproveNode(BpmSimpleModelNodeVO node) { |
| 277 | - return BpmSimpleModelNodeType.APPROVE_NODE.getType().equals(node.getType()) | |
| 277 | + return BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType().equals(node.getType()) | |
| 278 | 278 | && BpmUserTaskApproveMethodEnum.SEQUENTIAL.getMethod().equals(node.getApproveMethod()); |
| 279 | 279 | } |
| 280 | 280 | |
| ... | ... | @@ -290,7 +290,7 @@ public class SimpleModelUtils { |
| 290 | 290 | throw new UnsupportedOperationException("请实现该方法"); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - BpmSimpleModelNodeType getType(); | |
| 293 | + BpmSimpleModelNodeTypeEnum getType(); | |
| 294 | 294 | |
| 295 | 295 | } |
| 296 | 296 | |
| ... | ... | @@ -305,8 +305,8 @@ public class SimpleModelUtils { |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | @Override |
| 308 | - public BpmSimpleModelNodeType getType() { | |
| 309 | - return BpmSimpleModelNodeType.START_NODE; | |
| 308 | + public BpmSimpleModelNodeTypeEnum getType() { | |
| 309 | + return BpmSimpleModelNodeTypeEnum.START_NODE; | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | } |
| ... | ... | @@ -323,8 +323,8 @@ public class SimpleModelUtils { |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | @Override |
| 326 | - public BpmSimpleModelNodeType getType() { | |
| 327 | - return BpmSimpleModelNodeType.END_NODE; | |
| 326 | + public BpmSimpleModelNodeTypeEnum getType() { | |
| 327 | + return BpmSimpleModelNodeTypeEnum.END_NODE; | |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | } |
| ... | ... | @@ -352,8 +352,8 @@ public class SimpleModelUtils { |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | @Override |
| 355 | - public BpmSimpleModelNodeType getType() { | |
| 356 | - return BpmSimpleModelNodeType.START_USER_NODE; | |
| 355 | + public BpmSimpleModelNodeTypeEnum getType() { | |
| 356 | + return BpmSimpleModelNodeTypeEnum.START_USER_NODE; | |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | } |
| ... | ... | @@ -376,8 +376,8 @@ public class SimpleModelUtils { |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | @Override |
| 379 | - public BpmSimpleModelNodeType getType() { | |
| 380 | - return BpmSimpleModelNodeType.APPROVE_NODE; | |
| 379 | + public BpmSimpleModelNodeTypeEnum getType() { | |
| 380 | + return BpmSimpleModelNodeTypeEnum.APPROVE_NODE; | |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | /** |
| ... | ... | @@ -405,7 +405,7 @@ public class SimpleModelUtils { |
| 405 | 405 | boundaryEvent.addEventDefinition(eventDefinition); |
| 406 | 406 | |
| 407 | 407 | // 2.1 添加定时器边界事件类型 |
| 408 | - addExtensionElement(boundaryEvent, BOUNDARY_EVENT_TYPE, BpmBoundaryEventType.USER_TASK_TIMEOUT.getType()); | |
| 408 | + addExtensionElement(boundaryEvent, BOUNDARY_EVENT_TYPE, BpmBoundaryEventTypeEnum.USER_TASK_TIMEOUT.getType()); | |
| 409 | 409 | // 2.2 添加超时执行动作元素 |
| 410 | 410 | addExtensionElement(boundaryEvent, USER_TASK_TIMEOUT_HANDLER_TYPE, timeoutHandler.getType()); |
| 411 | 411 | return boundaryEvent; |
| ... | ... | @@ -533,8 +533,8 @@ public class SimpleModelUtils { |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | @Override |
| 536 | - public BpmSimpleModelNodeType getType() { | |
| 537 | - return BpmSimpleModelNodeType.COPY_NODE; | |
| 536 | + public BpmSimpleModelNodeTypeEnum getType() { | |
| 537 | + return BpmSimpleModelNodeTypeEnum.COPY_NODE; | |
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | } |
| ... | ... | @@ -556,8 +556,8 @@ public class SimpleModelUtils { |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | @Override |
| 559 | - public BpmSimpleModelNodeType getType() { | |
| 560 | - return BpmSimpleModelNodeType.CONDITION_BRANCH_NODE; | |
| 559 | + public BpmSimpleModelNodeTypeEnum getType() { | |
| 560 | + return BpmSimpleModelNodeTypeEnum.CONDITION_BRANCH_NODE; | |
| 561 | 561 | } |
| 562 | 562 | |
| 563 | 563 | } |
| ... | ... | @@ -578,8 +578,8 @@ public class SimpleModelUtils { |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | @Override |
| 581 | - public BpmSimpleModelNodeType getType() { | |
| 582 | - return BpmSimpleModelNodeType.PARALLEL_BRANCH_NODE; | |
| 581 | + public BpmSimpleModelNodeTypeEnum getType() { | |
| 582 | + return BpmSimpleModelNodeTypeEnum.PARALLEL_BRANCH_NODE; | |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | } |
| ... | ... | @@ -605,8 +605,8 @@ public class SimpleModelUtils { |
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | @Override |
| 608 | - public BpmSimpleModelNodeType getType() { | |
| 609 | - return BpmSimpleModelNodeType.INCLUSIVE_BRANCH_NODE; | |
| 608 | + public BpmSimpleModelNodeTypeEnum getType() { | |
| 609 | + return BpmSimpleModelNodeTypeEnum.INCLUSIVE_BRANCH_NODE; | |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | } |
| ... | ... | @@ -620,8 +620,8 @@ public class SimpleModelUtils { |
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | @Override |
| 623 | - public BpmSimpleModelNodeType getType() { | |
| 624 | - return BpmSimpleModelNodeType.CONDITION_NODE; | |
| 623 | + public BpmSimpleModelNodeTypeEnum getType() { | |
| 624 | + return BpmSimpleModelNodeTypeEnum.CONDITION_NODE; | |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | public static SequenceFlow buildSequenceFlow(String sourceId, String targetId, |
| ... | ... | @@ -647,11 +647,11 @@ public class SimpleModelUtils { |
| 647 | 647 | |
| 648 | 648 | public static String buildConditionExpression(Integer conditionType, String conditionExpression, |
| 649 | 649 | ConditionGroups conditionGroups) { |
| 650 | - BpmSimpleModeConditionType conditionTypeEnum = BpmSimpleModeConditionType.valueOf(conditionType); | |
| 651 | - if (conditionTypeEnum == BpmSimpleModeConditionType.EXPRESSION) { | |
| 650 | + BpmSimpleModeConditionTypeEnum conditionTypeEnum = BpmSimpleModeConditionTypeEnum.valueOf(conditionType); | |
| 651 | + if (conditionTypeEnum == BpmSimpleModeConditionTypeEnum.EXPRESSION) { | |
| 652 | 652 | return conditionExpression; |
| 653 | 653 | } |
| 654 | - if (conditionTypeEnum == BpmSimpleModeConditionType.RULE) { | |
| 654 | + if (conditionTypeEnum == BpmSimpleModeConditionTypeEnum.RULE) { | |
| 655 | 655 | if (conditionGroups == null || CollUtil.isEmpty(conditionGroups.getConditions())) { |
| 656 | 656 | return null; |
| 657 | 657 | } |
| ... | ... | @@ -696,21 +696,21 @@ public class SimpleModelUtils { |
| 696 | 696 | boundaryEvent.setAttachedToRef(receiveTask); |
| 697 | 697 | // 2.2 定义超时时间 |
| 698 | 698 | TimerEventDefinition eventDefinition = new TimerEventDefinition(); |
| 699 | - if (node.getDelaySetting().getDelayType().equals(BpmDelayTimerType.FIXED_DATE_TIME.getType())) { | |
| 699 | + if (node.getDelaySetting().getDelayType().equals(BpmDelayTimerTypeEnum.FIXED_DATE_TIME.getType())) { | |
| 700 | 700 | eventDefinition.setTimeDuration(node.getDelaySetting().getDelayTime()); |
| 701 | - } else if (node.getDelaySetting().getDelayType().equals(BpmDelayTimerType.FIXED_TIME_DURATION.getType())) { | |
| 701 | + } else if (node.getDelaySetting().getDelayType().equals(BpmDelayTimerTypeEnum.FIXED_TIME_DURATION.getType())) { | |
| 702 | 702 | eventDefinition.setTimeDate(node.getDelaySetting().getDelayTime()); |
| 703 | 703 | } |
| 704 | 704 | boundaryEvent.addEventDefinition(eventDefinition); |
| 705 | - addExtensionElement(boundaryEvent, BOUNDARY_EVENT_TYPE, BpmBoundaryEventType.DELAY_TIMER_TIMEOUT.getType()); | |
| 705 | + addExtensionElement(boundaryEvent, BOUNDARY_EVENT_TYPE, BpmBoundaryEventTypeEnum.DELAY_TIMER_TIMEOUT.getType()); | |
| 706 | 706 | flowElements.add(boundaryEvent); |
| 707 | 707 | } |
| 708 | 708 | return flowElements; |
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | @Override |
| 712 | - public BpmSimpleModelNodeType getType() { | |
| 713 | - return BpmSimpleModelNodeType.DELAY_TIMER_NODE; | |
| 712 | + public BpmSimpleModelNodeTypeEnum getType() { | |
| 713 | + return BpmSimpleModelNodeTypeEnum.DELAY_TIMER_NODE; | |
| 714 | 714 | } |
| 715 | 715 | } |
| 716 | 716 | |
| ... | ... | @@ -727,6 +727,7 @@ public class SimpleModelUtils { |
| 727 | 727 | if (node.getTriggerSetting() != null) { |
| 728 | 728 | addExtensionElement(serviceTask, TRIGGER_TYPE, node.getTriggerSetting().getType()); |
| 729 | 729 | if (node.getTriggerSetting().getHttpRequestSetting() != null) { |
| 730 | + // TODO @jason:加个 addExtensionElementJson 方法,方便设置 JSON 类型的属性 | |
| 730 | 731 | addExtensionElement(serviceTask, TRIGGER_PARAM, |
| 731 | 732 | JsonUtils.toJsonString(node.getTriggerSetting().getHttpRequestSetting())); |
| 732 | 733 | } |
| ... | ... | @@ -735,8 +736,8 @@ public class SimpleModelUtils { |
| 735 | 736 | } |
| 736 | 737 | |
| 737 | 738 | @Override |
| 738 | - public BpmSimpleModelNodeType getType() { | |
| 739 | - return BpmSimpleModelNodeType.TRIGGER_NODE; | |
| 739 | + public BpmSimpleModelNodeTypeEnum getType() { | |
| 740 | + return BpmSimpleModelNodeTypeEnum.TRIGGER_NODE; | |
| 740 | 741 | } |
| 741 | 742 | } |
| 742 | 743 | |
| ... | ... | @@ -754,8 +755,8 @@ public class SimpleModelUtils { |
| 754 | 755 | } |
| 755 | 756 | |
| 756 | 757 | @Override |
| 757 | - public BpmSimpleModelNodeType getType() { | |
| 758 | - return BpmSimpleModelNodeType.ROUTER_BRANCH_NODE; | |
| 758 | + public BpmSimpleModelNodeTypeEnum getType() { | |
| 759 | + return BpmSimpleModelNodeTypeEnum.ROUTER_BRANCH_NODE; | |
| 759 | 760 | } |
| 760 | 761 | |
| 761 | 762 | public static SequenceFlow buildSequenceFlow(String nodeId, BpmSimpleModelNodeVO.RouterSetting router) { |
| ... | ... | @@ -785,21 +786,21 @@ public class SimpleModelUtils { |
| 785 | 786 | if (!isValidNode(currentNode)) { |
| 786 | 787 | return; |
| 787 | 788 | } |
| 788 | - BpmSimpleModelNodeType nodeType = BpmSimpleModelNodeType.valueOf(currentNode.getType()); | |
| 789 | + BpmSimpleModelNodeTypeEnum nodeType = BpmSimpleModelNodeTypeEnum.valueOf(currentNode.getType()); | |
| 789 | 790 | Assert.notNull(nodeType, "模型节点类型不支持"); |
| 790 | 791 | |
| 791 | 792 | // 情况:START_NODE/START_USER_NODE/APPROVE_NODE/COPY_NODE/END_NODE |
| 792 | - if (nodeType == BpmSimpleModelNodeType.START_NODE | |
| 793 | - || nodeType == BpmSimpleModelNodeType.START_USER_NODE | |
| 794 | - || nodeType == BpmSimpleModelNodeType.APPROVE_NODE | |
| 795 | - || nodeType == BpmSimpleModelNodeType.COPY_NODE | |
| 796 | - || nodeType == BpmSimpleModelNodeType.END_NODE) { | |
| 793 | + if (nodeType == BpmSimpleModelNodeTypeEnum.START_NODE | |
| 794 | + || nodeType == BpmSimpleModelNodeTypeEnum.START_USER_NODE | |
| 795 | + || nodeType == BpmSimpleModelNodeTypeEnum.APPROVE_NODE | |
| 796 | + || nodeType == BpmSimpleModelNodeTypeEnum.COPY_NODE | |
| 797 | + || nodeType == BpmSimpleModelNodeTypeEnum.END_NODE) { | |
| 797 | 798 | // 添加元素 |
| 798 | 799 | resultNodes.add(currentNode); |
| 799 | 800 | } |
| 800 | 801 | |
| 801 | 802 | // 情况:CONDITION_BRANCH_NODE 排它,只有一个满足条件的。如果没有,就走默认的 |
| 802 | - if (nodeType == BpmSimpleModelNodeType.CONDITION_BRANCH_NODE) { | |
| 803 | + if (nodeType == BpmSimpleModelNodeTypeEnum.CONDITION_BRANCH_NODE) { | |
| 803 | 804 | // 查找满足条件的 BpmSimpleModelNodeVO 节点 |
| 804 | 805 | BpmSimpleModelNodeVO matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(), |
| 805 | 806 | conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()) |
| ... | ... | @@ -814,7 +815,7 @@ public class SimpleModelUtils { |
| 814 | 815 | } |
| 815 | 816 | |
| 816 | 817 | // 情况:INCLUSIVE_BRANCH_NODE 包容,多个满足条件的。如果没有,就走默认的 |
| 817 | - if (nodeType == BpmSimpleModelNodeType.INCLUSIVE_BRANCH_NODE) { | |
| 818 | + if (nodeType == BpmSimpleModelNodeTypeEnum.INCLUSIVE_BRANCH_NODE) { | |
| 818 | 819 | // 查找满足条件的 BpmSimpleModelNodeVO 节点 |
| 819 | 820 | Collection<BpmSimpleModelNodeVO> matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(), |
| 820 | 821 | conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()) |
| ... | ... | @@ -830,7 +831,7 @@ public class SimpleModelUtils { |
| 830 | 831 | } |
| 831 | 832 | |
| 832 | 833 | // 情况:PARALLEL_BRANCH_NODE 并行,都满足,都走 |
| 833 | - if (nodeType == BpmSimpleModelNodeType.PARALLEL_BRANCH_NODE) { | |
| 834 | + if (nodeType == BpmSimpleModelNodeTypeEnum.PARALLEL_BRANCH_NODE) { | |
| 834 | 835 | // 遍历所有 BpmSimpleModelNodeVO 节点 |
| 835 | 836 | currentNode.getConditionNodes().forEach(matchConditionNode -> |
| 836 | 837 | simulateNextNode(matchConditionNode.getChildNode(), variables, resultNodes)); |
| ... | ... | @@ -844,6 +845,7 @@ public class SimpleModelUtils { |
| 844 | 845 | return BpmnModelUtils.evalConditionExpress(variables, ConditionNodeConvert.buildConditionExpression(conditionNode)); |
| 845 | 846 | } |
| 846 | 847 | |
| 848 | + // TODO @芋艿:【高】要不要优化下,抽个 HttpUtils | |
| 847 | 849 | /** |
| 848 | 850 | * 添加 HTTP 请求参数。请求头或者请求体 |
| 849 | 851 | * |
| ... | ... | @@ -852,15 +854,15 @@ public class SimpleModelUtils { |
| 852 | 854 | * @param processVariables 流程变量 |
| 853 | 855 | */ |
| 854 | 856 | public static void addHttpRequestParam(MultiValueMap<String, String> params, |
| 855 | - List<BpmSimpleModelNodeVO.HttpRequestParamSetting> paramSettings, | |
| 857 | + List<BpmSimpleModelNodeVO.HttpRequestParam> paramSettings, | |
| 856 | 858 | Map<String, Object> processVariables) { |
| 857 | 859 | if (CollUtil.isEmpty(paramSettings)) { |
| 858 | 860 | return; |
| 859 | 861 | } |
| 860 | 862 | paramSettings.forEach(item -> { |
| 861 | - if (item.getType().equals(BpmHttpRequestParamSettingType.FIXED_VALUE.getType())) { | |
| 863 | + if (item.getType().equals(BpmHttpRequestParamTypeEnum.FIXED_VALUE.getType())) { | |
| 862 | 864 | params.add(item.getKey(), item.getValue()); |
| 863 | - } else if (item.getType().equals(BpmHttpRequestParamSettingType.FROM_FORM.getType())) { | |
| 865 | + } else if (item.getType().equals(BpmHttpRequestParamTypeEnum.FROM_FORM.getType())) { | |
| 864 | 866 | params.add(item.getKey(), processVariables.get(item.getValue()).toString()); |
| 865 | 867 | } |
| 866 | 868 | }); | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmProcessListenerServiceImpl.java
| ... | ... | @@ -7,8 +7,8 @@ import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener.BpmPr |
| 7 | 7 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener.BpmProcessListenerSaveReqVO; |
| 8 | 8 | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessListenerDO; |
| 9 | 9 | import cn.iocoder.yudao.module.bpm.dal.mysql.definition.BpmProcessListenerMapper; |
| 10 | -import cn.iocoder.yudao.module.bpm.enums.definition.BpmProcessListenerType; | |
| 11 | -import cn.iocoder.yudao.module.bpm.enums.definition.BpmProcessListenerValueType; | |
| 10 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmProcessListenerTypeEnum; | |
| 11 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmProcessListenerValueTypeEnum; | |
| 12 | 12 | import jakarta.annotation.Resource; |
| 13 | 13 | import org.flowable.engine.delegate.JavaDelegate; |
| 14 | 14 | import org.flowable.engine.delegate.TaskListener; |
| ... | ... | @@ -52,14 +52,14 @@ public class BpmProcessListenerServiceImpl implements BpmProcessListenerService |
| 52 | 52 | |
| 53 | 53 | private void validateCreateProcessListenerValue(BpmProcessListenerSaveReqVO createReqVO) { |
| 54 | 54 | // class 类型 |
| 55 | - if (createReqVO.getValueType().equals(BpmProcessListenerValueType.CLASS.getType())) { | |
| 55 | + if (createReqVO.getValueType().equals(BpmProcessListenerValueTypeEnum.CLASS.getType())) { | |
| 56 | 56 | try { |
| 57 | 57 | Class<?> clazz = Class.forName(createReqVO.getValue()); |
| 58 | - if (createReqVO.getType().equals(BpmProcessListenerType.EXECUTION.getType()) | |
| 58 | + if (createReqVO.getType().equals(BpmProcessListenerTypeEnum.EXECUTION.getType()) | |
| 59 | 59 | && !JavaDelegate.class.isAssignableFrom(clazz)) { |
| 60 | 60 | throw exception(PROCESS_LISTENER_CLASS_IMPLEMENTS_ERROR, createReqVO.getValue(), |
| 61 | 61 | JavaDelegate.class.getName()); |
| 62 | - } else if (createReqVO.getType().equals(BpmProcessListenerType.TASK.getType()) | |
| 62 | + } else if (createReqVO.getType().equals(BpmProcessListenerTypeEnum.TASK.getType()) | |
| 63 | 63 | && !TaskListener.class.isAssignableFrom(clazz)) { |
| 64 | 64 | throw exception(PROCESS_LISTENER_CLASS_IMPLEMENTS_ERROR, createReqVO.getValue(), |
| 65 | 65 | TaskListener.class.getName()); | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java
| ... | ... | @@ -22,7 +22,7 @@ import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitio |
| 22 | 22 | import cn.iocoder.yudao.module.bpm.dal.redis.BpmProcessIdRedisDAO; |
| 23 | 23 | import cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants; |
| 24 | 24 | import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelTypeEnum; |
| 25 | -import cn.iocoder.yudao.module.bpm.enums.definition.BpmSimpleModelNodeType; | |
| 25 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmSimpleModelNodeTypeEnum; | |
| 26 | 26 | import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceStatusEnum; |
| 27 | 27 | import cn.iocoder.yudao.module.bpm.enums.task.BpmReasonEnum; |
| 28 | 28 | import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum; |
| ... | ... | @@ -294,7 +294,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService |
| 294 | 294 | FlowElement flowNode = BpmnModelUtils.getFlowElementById(bpmnModel, task.getTaskDefinitionKey()); |
| 295 | 295 | ActivityNode activityNode = new ActivityNode().setId(task.getTaskDefinitionKey()).setName(task.getName()) |
| 296 | 296 | .setNodeType(START_USER_NODE_ID.equals(task.getTaskDefinitionKey()) ? |
| 297 | - BpmSimpleModelNodeType.START_USER_NODE.getType() : BpmSimpleModelNodeType.APPROVE_NODE.getType()) | |
| 297 | + BpmSimpleModelNodeTypeEnum.START_USER_NODE.getType() : BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType()) | |
| 298 | 298 | .setStatus(FlowableUtils.getTaskStatus(task)) |
| 299 | 299 | .setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode)) |
| 300 | 300 | .setStartTime(DateUtils.of(task.getCreateTime())).setEndTime(DateUtils.of(task.getEndTime())) |
| ... | ... | @@ -316,8 +316,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService |
| 316 | 316 | ActivityNodeTask startTask = new ActivityNodeTask().setId(BpmnModelConstants.START_USER_NODE_ID) |
| 317 | 317 | .setAssignee(startUserId).setStatus(BpmTaskStatusEnum.APPROVE.getStatus()); |
| 318 | 318 | ActivityNode startNode = new ActivityNode().setId(startTask.getId()) |
| 319 | - .setName(BpmSimpleModelNodeType.START_USER_NODE.getName()) | |
| 320 | - .setNodeType(BpmSimpleModelNodeType.START_USER_NODE.getType()) | |
| 319 | + .setName(BpmSimpleModelNodeTypeEnum.START_USER_NODE.getName()) | |
| 320 | + .setNodeType(BpmSimpleModelNodeTypeEnum.START_USER_NODE.getType()) | |
| 321 | 321 | .setStatus(startTask.getStatus()).setTasks(ListUtil.of(startTask)) |
| 322 | 322 | .setStartTime(DateUtils.of(activity.getStartTime())).setEndTime(DateUtils.of(activity.getEndTime())); |
| 323 | 323 | approvalNodes.add(0, startNode); |
| ... | ... | @@ -330,8 +330,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService |
| 330 | 330 | return; |
| 331 | 331 | } |
| 332 | 332 | ActivityNode endNode = new ActivityNode().setId(activity.getId()) |
| 333 | - .setName(BpmSimpleModelNodeType.END_NODE.getName()) | |
| 334 | - .setNodeType(BpmSimpleModelNodeType.END_NODE.getType()).setStatus(processInstanceStatus) | |
| 333 | + .setName(BpmSimpleModelNodeTypeEnum.END_NODE.getName()) | |
| 334 | + .setNodeType(BpmSimpleModelNodeTypeEnum.END_NODE.getType()).setStatus(processInstanceStatus) | |
| 335 | 335 | .setStartTime(DateUtils.of(activity.getStartTime())).setEndTime(DateUtils.of(activity.getEndTime())); |
| 336 | 336 | String reason = FlowableUtils.getProcessInstanceReason(historicProcessInstance); |
| 337 | 337 | if (StrUtil.isNotEmpty(reason)) { |
| ... | ... | @@ -367,7 +367,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService |
| 367 | 367 | FlowElement flowNode = BpmnModelUtils.getFlowElementById(bpmnModel, activityId); |
| 368 | 368 | HistoricActivityInstance firstActivity = CollUtil.getFirst(taskActivities); // 取第一个任务,会签/或签的任务,开始时间相同 |
| 369 | 369 | ActivityNode activityNode = new ActivityNode().setId(firstActivity.getActivityId()).setName(firstActivity.getActivityName()) |
| 370 | - .setNodeType(BpmSimpleModelNodeType.APPROVE_NODE.getType()).setStatus(BpmTaskStatusEnum.RUNNING.getStatus()) | |
| 370 | + .setNodeType(BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType()).setStatus(BpmTaskStatusEnum.RUNNING.getStatus()) | |
| 371 | 371 | .setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode)) |
| 372 | 372 | .setStartTime(DateUtils.of(CollUtil.getFirst(taskActivities).getStartTime())) |
| 373 | 373 | .setTasks(new ArrayList<>()); |
| ... | ... | @@ -437,8 +437,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService |
| 437 | 437 | |
| 438 | 438 | // 1. 开始节点/审批节点 |
| 439 | 439 | if (ObjectUtils.equalsAny(node.getType(), |
| 440 | - BpmSimpleModelNodeType.START_USER_NODE.getType(), | |
| 441 | - BpmSimpleModelNodeType.APPROVE_NODE.getType())) { | |
| 440 | + BpmSimpleModelNodeTypeEnum.START_USER_NODE.getType(), | |
| 441 | + BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType())) { | |
| 442 | 442 | List<Long> candidateUserIds = getTaskCandidateUserList(bpmnModel, node.getId(), |
| 443 | 443 | startUserId, processDefinitionInfo.getProcessDefinitionId(), processVariables); |
| 444 | 444 | activityNode.setCandidateUserIds(candidateUserIds); |
| ... | ... | @@ -446,13 +446,13 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | // 2. 结束节点 |
| 449 | - if (BpmSimpleModelNodeType.END_NODE.getType().equals(node.getType())) { | |
| 449 | + if (BpmSimpleModelNodeTypeEnum.END_NODE.getType().equals(node.getType())) { | |
| 450 | 450 | return activityNode; |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | // 3. 抄送节点 |
| 454 | 454 | if (CollUtil.isEmpty(runActivityIds) && // 流程发起时:需要展示抄送节点,用于选择抄送人 |
| 455 | - BpmSimpleModelNodeType.COPY_NODE.getType().equals(node.getType())) { | |
| 455 | + BpmSimpleModelNodeTypeEnum.COPY_NODE.getType().equals(node.getType())) { | |
| 456 | 456 | return activityNode; |
| 457 | 457 | } |
| 458 | 458 | return null; |
| ... | ... | @@ -468,23 +468,23 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService |
| 468 | 468 | |
| 469 | 469 | // 1. 开始节点 |
| 470 | 470 | if (node instanceof StartEvent) { |
| 471 | - return activityNode.setName(BpmSimpleModelNodeType.START_USER_NODE.getName()) | |
| 472 | - .setNodeType(BpmSimpleModelNodeType.START_USER_NODE.getType()); | |
| 471 | + return activityNode.setName(BpmSimpleModelNodeTypeEnum.START_USER_NODE.getName()) | |
| 472 | + .setNodeType(BpmSimpleModelNodeTypeEnum.START_USER_NODE.getType()); | |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | // 2. 审批节点 |
| 476 | 476 | if (node instanceof UserTask) { |
| 477 | 477 | List<Long> candidateUserIds = getTaskCandidateUserList(bpmnModel, node.getId(), |
| 478 | 478 | startUserId, processDefinitionInfo.getProcessDefinitionId(), processVariables); |
| 479 | - return activityNode.setName(node.getName()).setNodeType(BpmSimpleModelNodeType.APPROVE_NODE.getType()) | |
| 479 | + return activityNode.setName(node.getName()).setNodeType(BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType()) | |
| 480 | 480 | .setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(node)) |
| 481 | 481 | .setCandidateUserIds(candidateUserIds); |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | // 3. 结束节点 |
| 485 | 485 | if (node instanceof EndEvent) { |
| 486 | - return activityNode.setName(BpmSimpleModelNodeType.END_NODE.getName()) | |
| 487 | - .setNodeType(BpmSimpleModelNodeType.END_NODE.getType()); | |
| 486 | + return activityNode.setName(BpmSimpleModelNodeTypeEnum.END_NODE.getName()) | |
| 487 | + .setNodeType(BpmSimpleModelNodeTypeEnum.END_NODE.getType()); | |
| 488 | 488 | } |
| 489 | 489 | return null; |
| 490 | 490 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
| ... | ... | @@ -656,8 +656,8 @@ public class BpmTaskServiceImpl implements BpmTaskService { |
| 656 | 656 | BpmnModel bpmnModel = modelService.getBpmnModelByDefinitionId(task.getProcessDefinitionId()); |
| 657 | 657 | FlowElement userTaskElement = BpmnModelUtils.getFlowElementById(bpmnModel, task.getTaskDefinitionKey()); |
| 658 | 658 | // 3.1 情况一:驳回到指定的任务节点 |
| 659 | - BpmUserTaskRejectHandlerType userTaskRejectHandlerType = BpmnModelUtils.parseRejectHandlerType(userTaskElement); | |
| 660 | - if (userTaskRejectHandlerType == BpmUserTaskRejectHandlerType.RETURN_USER_TASK) { | |
| 659 | + BpmUserTaskRejectHandlerTypeEnum userTaskRejectHandlerType = BpmnModelUtils.parseRejectHandlerType(userTaskElement); | |
| 660 | + if (userTaskRejectHandlerType == BpmUserTaskRejectHandlerTypeEnum.RETURN_USER_TASK) { | |
| 661 | 661 | String returnTaskId = BpmnModelUtils.parseReturnTaskId(userTaskElement); |
| 662 | 662 | Assert.notNull(returnTaskId, "退回的节点不能为空"); |
| 663 | 663 | returnTask(userId, new BpmTaskReturnReqVO().setId(task.getId()) |
| ... | ... | @@ -1184,23 +1184,24 @@ public class BpmTaskServiceImpl implements BpmTaskService { |
| 1184 | 1184 | .taskAssignee(task.getAssignee()) // 相同审批人 |
| 1185 | 1185 | .taskVariableValueEquals(BpmnVariableConstants.TASK_VARIABLE_STATUS, BpmTaskStatusEnum.APPROVE.getStatus()) |
| 1186 | 1186 | .finished(); |
| 1187 | - if (BpmAutoApproveType.APPROVE_ALL.getType().equals(processDefinitionInfo.getAutoApprovalType()) | |
| 1187 | + if (BpmAutoApproveTypeEnum.APPROVE_ALL.getType().equals(processDefinitionInfo.getAutoApprovalType()) | |
| 1188 | 1188 | && sameAssigneeQuery.count() > 0) { |
| 1189 | 1189 | getSelf().approveTask(Long.valueOf(task.getAssignee()), new BpmTaskApproveReqVO().setId(task.getId()) |
| 1190 | - .setReason(BpmAutoApproveType.APPROVE_ALL.getName())); | |
| 1190 | + .setReason(BpmAutoApproveTypeEnum.APPROVE_ALL.getName())); | |
| 1191 | 1191 | return; |
| 1192 | 1192 | } |
| 1193 | - if (BpmAutoApproveType.APPROVE_SEQUENT.getType().equals(processDefinitionInfo.getAutoApprovalType())) { | |
| 1193 | + if (BpmAutoApproveTypeEnum.APPROVE_SEQUENT.getType().equals(processDefinitionInfo.getAutoApprovalType())) { | |
| 1194 | 1194 | BpmnModel bpmnModel = modelService.getBpmnModelByDefinitionId(processInstance.getProcessDefinitionId()); |
| 1195 | 1195 | if (bpmnModel == null) { |
| 1196 | 1196 | log.error("[processTaskAssigned][taskId({}) 没有找到流程模型({})]", task.getId(), task.getProcessDefinitionId()); |
| 1197 | 1197 | return; |
| 1198 | 1198 | } |
| 1199 | - List<String> sourceTaskIds = getElementIncomingFlows(getFlowElementById(bpmnModel, task.getTaskDefinitionKey())) | |
| 1200 | - .stream().map(SequenceFlow::getSourceRef).toList(); | |
| 1199 | + List<String> sourceTaskIds = convertList(BpmnModelUtils.getElementIncomingFlows( // 获取所有上一个节点 | |
| 1200 | + BpmnModelUtils.getFlowElementById(bpmnModel, task.getTaskDefinitionKey())), | |
| 1201 | + SequenceFlow::getSourceRef); | |
| 1201 | 1202 | if (sameAssigneeQuery.taskDefinitionKeys(sourceTaskIds).count() > 0) { |
| 1202 | 1203 | getSelf().approveTask(Long.valueOf(task.getAssignee()), new BpmTaskApproveReqVO().setId(task.getId()) |
| 1203 | - .setReason(BpmAutoApproveType.APPROVE_SEQUENT.getName())); | |
| 1204 | + .setReason(BpmAutoApproveTypeEnum.APPROVE_SEQUENT.getName())); | |
| 1204 | 1205 | return; |
| 1205 | 1206 | } |
| 1206 | 1207 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/trigger/BpmHttpRequestTrigger.java
| ... | ... | @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.bpm.service.task.trigger; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 4 | 4 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO.TriggerSetting.HttpRequestTriggerSetting; |
| 5 | -import cn.iocoder.yudao.module.bpm.enums.definition.BpmTriggerType; | |
| 5 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmTriggerTypeEnum; | |
| 6 | 6 | import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.SimpleModelUtils; |
| 7 | 7 | import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService; |
| 8 | 8 | import jakarta.annotation.Resource; |
| ... | ... | @@ -37,16 +37,16 @@ public class BpmHttpRequestTrigger implements BpmTrigger { |
| 37 | 37 | private RestTemplate restTemplate; |
| 38 | 38 | |
| 39 | 39 | @Override |
| 40 | - public BpmTriggerType getType() { | |
| 41 | - return BpmTriggerType.HTTP_REQUEST; | |
| 40 | + public BpmTriggerTypeEnum getType() { | |
| 41 | + return BpmTriggerTypeEnum.HTTP_REQUEST; | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | @Override |
| 45 | 45 | public void execute(String processInstanceId, String param) { |
| 46 | 46 | // 1. 解析 http 请求配置 |
| 47 | - HttpRequestTriggerSetting httpRequestSetting = JsonUtils.parseObject(param, HttpRequestTriggerSetting.class); | |
| 48 | - if (httpRequestSetting == null) { | |
| 49 | - log.error("[execute] HTTP 触发器请求配置为空"); | |
| 47 | + HttpRequestTriggerSetting setting = JsonUtils.parseObject(param, HttpRequestTriggerSetting.class); | |
| 48 | + if (setting == null) { | |
| 49 | + log.error("[execute][流程({}) HTTP 触发器请求配置为空]", processInstanceId); | |
| 50 | 50 | return; |
| 51 | 51 | } |
| 52 | 52 | // 2.1 设置请求头 |
| ... | ... | @@ -54,20 +54,22 @@ public class BpmHttpRequestTrigger implements BpmTrigger { |
| 54 | 54 | Map<String, Object> processVariables = processInstance.getProcessVariables(); |
| 55 | 55 | MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); |
| 56 | 56 | headers.add(HEADER_TENANT_ID, processInstance.getTenantId()); |
| 57 | - SimpleModelUtils.addHttpRequestParam(headers, httpRequestSetting.getHeader(), processVariables); | |
| 57 | + SimpleModelUtils.addHttpRequestParam(headers, setting.getHeader(), processVariables); | |
| 58 | 58 | // 2.2 设置请求体 |
| 59 | 59 | MultiValueMap<String, String> body = new LinkedMultiValueMap<>(); |
| 60 | - SimpleModelUtils.addHttpRequestParam(body, httpRequestSetting.getBody(), processVariables); | |
| 60 | + SimpleModelUtils.addHttpRequestParam(body, setting.getBody(), processVariables); | |
| 61 | 61 | body.add("processInstanceId", processInstanceId); |
| 62 | 62 | |
| 63 | + // TODO @芋艿:要不要抽象一个 Http 请求的工具类,方便复用呢? | |
| 63 | 64 | // 3. 发起请求 |
| 64 | 65 | HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(body, headers); |
| 65 | 66 | try { |
| 66 | - ResponseEntity<String> responseEntity = restTemplate.exchange(httpRequestSetting.getUrl(), HttpMethod.POST, | |
| 67 | + ResponseEntity<String> responseEntity = restTemplate.exchange(setting.getUrl(), HttpMethod.POST, | |
| 67 | 68 | requestEntity, String.class); |
| 68 | 69 | log.info("[execute][HTTP 触发器,请求头:{},请求体:{},响应结果:{}]", headers, body, responseEntity); |
| 69 | 70 | } catch (RestClientException e) { |
| 70 | 71 | log.error("[execute][HTTP 触发器,请求头:{},请求体:{},请求出错:{}]", headers, body, e.getMessage()); |
| 71 | 72 | } |
| 72 | 73 | } |
| 74 | + | |
| 73 | 75 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/trigger/BpmTrigger.java
| 1 | 1 | package cn.iocoder.yudao.module.bpm.service.task.trigger; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.bpm.enums.definition.BpmTriggerType; | |
| 3 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmTriggerTypeEnum; | |
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * BPM 触发器接口 |
| ... | ... | @@ -16,7 +16,7 @@ public interface BpmTrigger { |
| 16 | 16 | * |
| 17 | 17 | * @return 触发器类型 |
| 18 | 18 | */ |
| 19 | - BpmTriggerType getType(); | |
| 19 | + BpmTriggerTypeEnum getType(); | |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * 触发器执行 |
| ... | ... | @@ -25,4 +25,5 @@ public interface BpmTrigger { |
| 25 | 25 | * @param param 触发器参数 |
| 26 | 26 | */ |
| 27 | 27 | void execute(String processInstanceId, String param); |
| 28 | + | |
| 28 | 29 | } | ... | ... |