Commit 58a2e3d5d42a8f89c9f3497b0a89ca1cc6eada8f
1 parent
40db4cf7
【代码重构】将审批超时的 action 统一换成 handlerType,保持一致
Showing
9 changed files
with
46 additions
and
43 deletions
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmUserTaskAssignStartUserHandlerTypeEnum.java
| @@ -15,7 +15,7 @@ public enum BpmUserTaskAssignStartUserHandlerTypeEnum implements IntArrayValuabl | @@ -15,7 +15,7 @@ public enum BpmUserTaskAssignStartUserHandlerTypeEnum implements IntArrayValuabl | ||
| 15 | 15 | ||
| 16 | START_USER_AUDIT(1), // 由发起人对自己审批 | 16 | START_USER_AUDIT(1), // 由发起人对自己审批 |
| 17 | SKIP(2), // 自动跳过【参考飞书】:1)如果当前节点还有其他审批人,则交由其他审批人进行审批;2)如果当前节点没有其他审批人,则该节点自动通过 | 17 | SKIP(2), // 自动跳过【参考飞书】:1)如果当前节点还有其他审批人,则交由其他审批人进行审批;2)如果当前节点没有其他审批人,则该节点自动通过 |
| 18 | - ASSIGN_DEPT_LEADER(3); // 转交给部门负责人审批【参考飞书】:若部门负责人为空,则自动通过 | 18 | + TRANSFER_DEPT_LEADER(3); // 转交给部门负责人审批【参考飞书】:若部门负责人为空,则自动通过 |
| 19 | 19 | ||
| 20 | private final Integer type; | 20 | private final Integer type; |
| 21 | 21 |
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmUserTaskTimeoutHandlerType.java renamed to yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmUserTaskTimeoutHandlerTypeEnum.java
| 1 | package cn.iocoder.yudao.module.bpm.enums.definition; | 1 | package cn.iocoder.yudao.module.bpm.enums.definition; |
| 2 | 2 | ||
| 3 | -import cn.hutool.core.util.ArrayUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | 3 | import cn.iocoder.yudao.framework.common.core.IntArrayValuable; |
| 5 | import lombok.AllArgsConstructor; | 4 | import lombok.AllArgsConstructor; |
| 6 | import lombok.Getter; | 5 | import lombok.Getter; |
| @@ -14,24 +13,20 @@ import java.util.Arrays; | @@ -14,24 +13,20 @@ import java.util.Arrays; | ||
| 14 | */ | 13 | */ |
| 15 | @Getter | 14 | @Getter |
| 16 | @AllArgsConstructor | 15 | @AllArgsConstructor |
| 17 | -public enum BpmUserTaskTimeoutHandlerType implements IntArrayValuable { | 16 | +public enum BpmUserTaskTimeoutHandlerTypeEnum implements IntArrayValuable { |
| 18 | 17 | ||
| 19 | REMINDER(1,"自动提醒"), | 18 | REMINDER(1,"自动提醒"), |
| 20 | APPROVE(2, "自动同意"), | 19 | APPROVE(2, "自动同意"), |
| 21 | REJECT(3, "自动拒绝"); | 20 | REJECT(3, "自动拒绝"); |
| 22 | 21 | ||
| 23 | - // TODO @jason:type 是不是更合适哈; | ||
| 24 | - private final Integer action; | 22 | + private final Integer type; |
| 25 | private final String name; | 23 | private final String name; |
| 26 | 24 | ||
| 27 | - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmUserTaskTimeoutHandlerType::getAction).toArray(); | ||
| 28 | - | ||
| 29 | - public static BpmUserTaskTimeoutHandlerType typeOf(Integer type) { | ||
| 30 | - return ArrayUtil.firstMatch(item -> item.getAction().equals(type), values()); | ||
| 31 | - } | 25 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmUserTaskTimeoutHandlerTypeEnum::getType).toArray(); |
| 32 | 26 | ||
| 33 | @Override | 27 | @Override |
| 34 | public int[] array() { | 28 | public int[] array() { |
| 35 | return ARRAYS; | 29 | return ARRAYS; |
| 36 | } | 30 | } |
| 31 | + | ||
| 37 | } | 32 | } |
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmReasonEnum.java
| @@ -22,6 +22,12 @@ public enum BpmReasonEnum { | @@ -22,6 +22,12 @@ public enum BpmReasonEnum { | ||
| 22 | // ========== 流程任务的独有原因 ========== | 22 | // ========== 流程任务的独有原因 ========== |
| 23 | 23 | ||
| 24 | CANCEL_BY_SYSTEM("系统自动取消"), // 场景:非常多,比如说:1)多任务审批已经满足条件,无需审批该任务;2)流程实例被取消,无需审批该任务;等等 | 24 | CANCEL_BY_SYSTEM("系统自动取消"), // 场景:非常多,比如说:1)多任务审批已经满足条件,无需审批该任务;2)流程实例被取消,无需审批该任务;等等 |
| 25 | + TIMEOUT_APPROVE("审批超时,系统自动通过"), | ||
| 26 | + TIMEOUT_REJECT("审批超时,系统自动不通过"), | ||
| 27 | + ASSIGN_START_USER_APPROVE("审批人与提交人为同一人时,自动通过"), | ||
| 28 | + ASSIGN_START_USER_APPROVE_WHEN_SKIP("审批人与提交人为同一人时,自动通过"), | ||
| 29 | + ASSIGN_START_USER_APPROVE_WHEN_DEPT_LEADER_NOT_FOUND("审批人与提交人为同一人时,找不到部门负责人,自动通过"), | ||
| 30 | + ASSIGN_START_USER_TRANSFER_DEPT_LEADER("审批人与提交人为同一人时,转交给部门负责人审批"), | ||
| 25 | ; | 31 | ; |
| 26 | 32 | ||
| 27 | private final String reason; | 33 | private final String reason; |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/simple/BpmSimpleModelNodeVO.java
| @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidat | @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidat | ||
| 6 | import com.fasterxml.jackson.annotation.JsonIgnore; | 6 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 7 | import com.fasterxml.jackson.annotation.JsonInclude; | 7 | import com.fasterxml.jackson.annotation.JsonInclude; |
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | +import jakarta.validation.Valid; | ||
| 9 | import jakarta.validation.constraints.NotEmpty; | 10 | import jakarta.validation.constraints.NotEmpty; |
| 10 | import jakarta.validation.constraints.NotNull; | 11 | import jakarta.validation.constraints.NotNull; |
| 11 | import lombok.Data; | 12 | import lombok.Data; |
| @@ -97,20 +98,22 @@ public class BpmSimpleModelNodeVO { | @@ -97,20 +98,22 @@ public class BpmSimpleModelNodeVO { | ||
| 97 | private String returnNodeId; | 98 | private String returnNodeId; |
| 98 | } | 99 | } |
| 99 | 100 | ||
| 100 | - // TODO @芋艿:参数校验 | ||
| 101 | @Data | 101 | @Data |
| 102 | @Schema(description = "审批节点超时处理策略") | 102 | @Schema(description = "审批节点超时处理策略") |
| 103 | + @Valid | ||
| 103 | public static class TimeoutHandler { | 104 | public static class TimeoutHandler { |
| 104 | 105 | ||
| 105 | - @Schema(description = "是否开启超时处理", example = "false") | 106 | + @Schema(description = "是否开启超时处理", requiredMode = Schema.RequiredMode.REQUIRED, example = "false") |
| 107 | + @NotNull(message = "是否开启超时处理不能为空") | ||
| 106 | private Boolean enable; | 108 | private Boolean enable; |
| 107 | 109 | ||
| 108 | - // TODO @jason:type 是不是更合适哈; | ||
| 109 | - @Schema(description = "任务超时未处理的行为", example = "1") | ||
| 110 | - @InEnum(BpmUserTaskTimeoutHandlerType.class) | ||
| 111 | - private Integer action; | 110 | + @Schema(description = "任务超时未处理的行为", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 111 | + @NotNull(message = "任务超时未处理的行为不能为空") | ||
| 112 | + @InEnum(BpmUserTaskTimeoutHandlerTypeEnum.class) | ||
| 113 | + private Integer type; | ||
| 112 | 114 | ||
| 113 | - @Schema(description = "超时时间", example = "PT6H") | 115 | + @Schema(description = "超时时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "PT6H") |
| 116 | + @NotEmpty(message = "超时时间不能为空") | ||
| 114 | private String timeDuration; | 117 | private String timeDuration; |
| 115 | 118 | ||
| 116 | @Schema(description = "最大提醒次数", example = "1") | 119 | @Schema(description = "最大提醒次数", example = "1") |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/enums/BpmnModelConstants.java
| @@ -28,12 +28,10 @@ public interface BpmnModelConstants { | @@ -28,12 +28,10 @@ public interface BpmnModelConstants { | ||
| 28 | */ | 28 | */ |
| 29 | String BOUNDARY_EVENT_TYPE = "boundaryEventType"; | 29 | String BOUNDARY_EVENT_TYPE = "boundaryEventType"; |
| 30 | 30 | ||
| 31 | - // TODO @jason:这个命名,应该也要改哈 | ||
| 32 | - // TODO @jason:1)是不是上面的 timeoutAction 改成 timeoutHandler; | ||
| 33 | /** | 31 | /** |
| 34 | * BPMN ExtensionElement 的扩展属性,用于标记用户任务超时执行动作 | 32 | * BPMN ExtensionElement 的扩展属性,用于标记用户任务超时执行动作 |
| 35 | */ | 33 | */ |
| 36 | - String USER_TASK_TIMEOUT_HANDLER_ACTION = "timeoutAction"; | 34 | + String USER_TASK_TIMEOUT_HANDLER_TYPE = "timeoutHandlerType"; |
| 37 | 35 | ||
| 38 | /** | 36 | /** |
| 39 | * BPMN ExtensionElement 的扩展属性,用于标记用户任务的审批人与发起人相同时,对应的处理类型 | 37 | * BPMN ExtensionElement 的扩展属性,用于标记用户任务的审批人与发起人相同时,对应的处理类型 |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/listener/BpmTaskEventListener.java
| @@ -106,10 +106,10 @@ public class BpmTaskEventListener extends AbstractFlowableEngineEventListener { | @@ -106,10 +106,10 @@ public class BpmTaskEventListener extends AbstractFlowableEngineEventListener { | ||
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | // 2. 处理超时 | 108 | // 2. 处理超时 |
| 109 | - String timeoutAction = BpmnModelUtils.parseBoundaryEventExtensionElement(boundaryEvent, | ||
| 110 | - BpmnModelConstants.USER_TASK_TIMEOUT_HANDLER_ACTION); | 109 | + String timeoutHandlerType = BpmnModelUtils.parseBoundaryEventExtensionElement(boundaryEvent, |
| 110 | + BpmnModelConstants.USER_TASK_TIMEOUT_HANDLER_TYPE); | ||
| 111 | String taskKey = boundaryEvent.getAttachedToRefId(); | 111 | String taskKey = boundaryEvent.getAttachedToRefId(); |
| 112 | - taskService.processTaskTimeout(event.getProcessInstanceId(), taskKey, NumberUtils.parseInt(timeoutAction)); | 112 | + taskService.processTaskTimeout(event.getProcessInstanceId(), taskKey, NumberUtils.parseInt(timeoutHandlerType)); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | } | 115 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java
| @@ -27,7 +27,7 @@ import java.util.Objects; | @@ -27,7 +27,7 @@ import java.util.Objects; | ||
| 27 | import static cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO.OperationButtonSetting; | 27 | import static cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO.OperationButtonSetting; |
| 28 | import static cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO.TimeoutHandler; | 28 | import static cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO.TimeoutHandler; |
| 29 | import static cn.iocoder.yudao.module.bpm.enums.definition.BpmSimpleModelNodeType.*; | 29 | import static cn.iocoder.yudao.module.bpm.enums.definition.BpmSimpleModelNodeType.*; |
| 30 | -import static cn.iocoder.yudao.module.bpm.enums.definition.BpmUserTaskTimeoutHandlerType.REMINDER; | 30 | +import static cn.iocoder.yudao.module.bpm.enums.definition.BpmUserTaskTimeoutHandlerTypeEnum.REMINDER; |
| 31 | import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.*; | 31 | import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.*; |
| 32 | import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.SimpleModelConstants.*; | 32 | import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.SimpleModelConstants.*; |
| 33 | import static org.flowable.bpmn.constants.BpmnXMLConstants.*; | 33 | import static org.flowable.bpmn.constants.BpmnXMLConstants.*; |
| @@ -341,7 +341,7 @@ public class SimpleModelUtils { | @@ -341,7 +341,7 @@ public class SimpleModelUtils { | ||
| 341 | 341 | ||
| 342 | // 添加用户任务的 Timer Boundary Event, 用于任务的审批超时处理 | 342 | // 添加用户任务的 Timer Boundary Event, 用于任务的审批超时处理 |
| 343 | if (node.getTimeoutHandler() != null && node.getTimeoutHandler().getEnable()) { | 343 | if (node.getTimeoutHandler() != null && node.getTimeoutHandler().getEnable()) { |
| 344 | - BoundaryEvent boundaryEvent = buildUserTaskTimerBoundaryEvent(userTask, node.getTimeoutHandler()); | 344 | + BoundaryEvent boundaryEvent = buildUserTaskTimeoutBoundaryEvent(userTask, node.getTimeoutHandler()); |
| 345 | flowElements.add(boundaryEvent); | 345 | flowElements.add(boundaryEvent); |
| 346 | } | 346 | } |
| 347 | return flowElements; | 347 | return flowElements; |
| @@ -354,7 +354,7 @@ public class SimpleModelUtils { | @@ -354,7 +354,7 @@ public class SimpleModelUtils { | ||
| 354 | * @param timeoutHandler 超时处理器 | 354 | * @param timeoutHandler 超时处理器 |
| 355 | * @return BoundaryEvent 超时事件 | 355 | * @return BoundaryEvent 超时事件 |
| 356 | */ | 356 | */ |
| 357 | - private static BoundaryEvent buildUserTaskTimerBoundaryEvent(UserTask userTask, TimeoutHandler timeoutHandler) { | 357 | + private static BoundaryEvent buildUserTaskTimeoutBoundaryEvent(UserTask userTask, TimeoutHandler timeoutHandler) { |
| 358 | // 1.1 定时器边界事件 | 358 | // 1.1 定时器边界事件 |
| 359 | BoundaryEvent boundaryEvent = new BoundaryEvent(); | 359 | BoundaryEvent boundaryEvent = new BoundaryEvent(); |
| 360 | boundaryEvent.setId("Event-" + IdUtil.fastUUID()); | 360 | boundaryEvent.setId("Event-" + IdUtil.fastUUID()); |
| @@ -363,7 +363,7 @@ public class SimpleModelUtils { | @@ -363,7 +363,7 @@ public class SimpleModelUtils { | ||
| 363 | // 1.2 定义超时时间、最大提醒次数 | 363 | // 1.2 定义超时时间、最大提醒次数 |
| 364 | TimerEventDefinition eventDefinition = new TimerEventDefinition(); | 364 | TimerEventDefinition eventDefinition = new TimerEventDefinition(); |
| 365 | eventDefinition.setTimeDuration(timeoutHandler.getTimeDuration()); | 365 | eventDefinition.setTimeDuration(timeoutHandler.getTimeDuration()); |
| 366 | - if (Objects.equals(REMINDER.getAction(), timeoutHandler.getAction()) && | 366 | + if (Objects.equals(REMINDER.getType(), timeoutHandler.getType()) && |
| 367 | timeoutHandler.getMaxRemindCount() != null && timeoutHandler.getMaxRemindCount() > 1) { | 367 | timeoutHandler.getMaxRemindCount() != null && timeoutHandler.getMaxRemindCount() > 1) { |
| 368 | eventDefinition.setTimeCycle(String.format("R%d/%s", | 368 | eventDefinition.setTimeCycle(String.format("R%d/%s", |
| 369 | timeoutHandler.getMaxRemindCount(), timeoutHandler.getTimeDuration())); | 369 | timeoutHandler.getMaxRemindCount(), timeoutHandler.getTimeDuration())); |
| @@ -373,7 +373,7 @@ public class SimpleModelUtils { | @@ -373,7 +373,7 @@ public class SimpleModelUtils { | ||
| 373 | // 2.1 添加定时器边界事件类型 | 373 | // 2.1 添加定时器边界事件类型 |
| 374 | addExtensionElement(boundaryEvent, BOUNDARY_EVENT_TYPE, BpmBoundaryEventType.USER_TASK_TIMEOUT.getType().toString()); | 374 | addExtensionElement(boundaryEvent, BOUNDARY_EVENT_TYPE, BpmBoundaryEventType.USER_TASK_TIMEOUT.getType().toString()); |
| 375 | // 2.2 添加超时执行动作元素 | 375 | // 2.2 添加超时执行动作元素 |
| 376 | - addExtensionElement(boundaryEvent, USER_TASK_TIMEOUT_HANDLER_ACTION, StrUtil.toStringOrNull(timeoutHandler.getAction())); | 376 | + addExtensionElement(boundaryEvent, USER_TASK_TIMEOUT_HANDLER_TYPE, StrUtil.toStringOrNull(timeoutHandler.getType())); |
| 377 | return boundaryEvent; | 377 | return boundaryEvent; |
| 378 | } | 378 | } |
| 379 | 379 |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskService.java
| @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.bpm.service.task; | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.bpm.service.task; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 4 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 5 | import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*; | 5 | import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*; |
| 6 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmUserTaskTimeoutHandlerTypeEnum; | ||
| 6 | import jakarta.validation.Valid; | 7 | import jakarta.validation.Valid; |
| 7 | import org.flowable.bpmn.model.UserTask; | 8 | import org.flowable.bpmn.model.UserTask; |
| 8 | import org.flowable.task.api.Task; | 9 | import org.flowable.task.api.Task; |
| @@ -212,8 +213,8 @@ public interface BpmTaskService { | @@ -212,8 +213,8 @@ public interface BpmTaskService { | ||
| 212 | * | 213 | * |
| 213 | * @param processInstanceId 流程示例编号 | 214 | * @param processInstanceId 流程示例编号 |
| 214 | * @param taskDefineKey 任务 Key | 215 | * @param taskDefineKey 任务 Key |
| 215 | - * @param taskAction 处理类型 | 216 | + * @param handlerType 处理类型,参见 {@link BpmUserTaskTimeoutHandlerTypeEnum} |
| 216 | */ | 217 | */ |
| 217 | - void processTaskTimeout(String processInstanceId, String taskDefineKey, Integer taskAction); | 218 | + void processTaskTimeout(String processInstanceId, String taskDefineKey, Integer handlerType); |
| 218 | 219 | ||
| 219 | } | 220 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
| @@ -14,7 +14,7 @@ import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*; | @@ -14,7 +14,7 @@ import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*; | ||
| 14 | import cn.iocoder.yudao.module.bpm.convert.task.BpmTaskConvert; | 14 | import cn.iocoder.yudao.module.bpm.convert.task.BpmTaskConvert; |
| 15 | import cn.iocoder.yudao.module.bpm.enums.definition.BpmUserTaskAssignStartUserHandlerTypeEnum; | 15 | import cn.iocoder.yudao.module.bpm.enums.definition.BpmUserTaskAssignStartUserHandlerTypeEnum; |
| 16 | import cn.iocoder.yudao.module.bpm.enums.definition.BpmUserTaskRejectHandlerType; | 16 | import cn.iocoder.yudao.module.bpm.enums.definition.BpmUserTaskRejectHandlerType; |
| 17 | -import cn.iocoder.yudao.module.bpm.enums.definition.BpmUserTaskTimeoutHandlerType; | 17 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmUserTaskTimeoutHandlerTypeEnum; |
| 18 | import cn.iocoder.yudao.module.bpm.enums.task.BpmCommentTypeEnum; | 18 | import cn.iocoder.yudao.module.bpm.enums.task.BpmCommentTypeEnum; |
| 19 | import cn.iocoder.yudao.module.bpm.enums.task.BpmReasonEnum; | 19 | import cn.iocoder.yudao.module.bpm.enums.task.BpmReasonEnum; |
| 20 | import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskSignTypeEnum; | 20 | import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskSignTypeEnum; |
| @@ -944,13 +944,13 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -944,13 +944,13 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 944 | // 情况一:自动跳过 | 944 | // 情况一:自动跳过 |
| 945 | if (ObjectUtils.equalsAny(assignStartUserHandlerType, | 945 | if (ObjectUtils.equalsAny(assignStartUserHandlerType, |
| 946 | BpmUserTaskAssignStartUserHandlerTypeEnum.SKIP.getType())) { | 946 | BpmUserTaskAssignStartUserHandlerTypeEnum.SKIP.getType())) { |
| 947 | - getSelf().approveTask(Long.valueOf(task.getAssignee()), new BpmTaskApproveReqVO() | ||
| 948 | - .setId(task.getId()).setReason("审批人与提交人为同一人时,自动通过")); | 947 | + getSelf().approveTask(Long.valueOf(task.getAssignee()), new BpmTaskApproveReqVO().setId(task.getId()) |
| 948 | + .setReason(BpmReasonEnum.ASSIGN_START_USER_APPROVE_WHEN_SKIP.getReason())); | ||
| 949 | return; | 949 | return; |
| 950 | } | 950 | } |
| 951 | // 情况二:转交给部门负责人审批 | 951 | // 情况二:转交给部门负责人审批 |
| 952 | if (ObjectUtils.equalsAny(assignStartUserHandlerType, | 952 | if (ObjectUtils.equalsAny(assignStartUserHandlerType, |
| 953 | - BpmUserTaskAssignStartUserHandlerTypeEnum.ASSIGN_DEPT_LEADER.getType())) { | 953 | + BpmUserTaskAssignStartUserHandlerTypeEnum.TRANSFER_DEPT_LEADER.getType())) { |
| 954 | AdminUserRespDTO startUser = adminUserApi.getUser(Long.valueOf(processInstance.getStartUserId())); | 954 | AdminUserRespDTO startUser = adminUserApi.getUser(Long.valueOf(processInstance.getStartUserId())); |
| 955 | Assert.notNull(startUser, "提交人({})信息为空", processInstance.getStartUserId()); | 955 | Assert.notNull(startUser, "提交人({})信息为空", processInstance.getStartUserId()); |
| 956 | DeptRespDTO dept = startUser.getDeptId() != null ? deptApi.getDept(startUser.getDeptId()) : null; | 956 | DeptRespDTO dept = startUser.getDeptId() != null ? deptApi.getDept(startUser.getDeptId()) : null; |
| @@ -958,15 +958,15 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -958,15 +958,15 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 958 | // 找不到部门负责人的情况下,自动审批通过 | 958 | // 找不到部门负责人的情况下,自动审批通过 |
| 959 | // noinspection DataFlowIssue | 959 | // noinspection DataFlowIssue |
| 960 | if (dept.getLeaderUserId() == null) { | 960 | if (dept.getLeaderUserId() == null) { |
| 961 | - getSelf().approveTask(Long.valueOf(task.getAssignee()), new BpmTaskApproveReqVO() | ||
| 962 | - .setId(task.getId()).setReason("审批人与提交人为同一人时,找不到部门负责人,自动通过")); | 961 | + getSelf().approveTask(Long.valueOf(task.getAssignee()), new BpmTaskApproveReqVO().setId(task.getId()) |
| 962 | + .setReason(BpmReasonEnum.ASSIGN_START_USER_APPROVE_WHEN_DEPT_LEADER_NOT_FOUND.getReason())); | ||
| 963 | return; | 963 | return; |
| 964 | } | 964 | } |
| 965 | // 找得到部门负责人的情况下,修改负责人 | 965 | // 找得到部门负责人的情况下,修改负责人 |
| 966 | if (ObjectUtil.notEqual(dept.getLeaderUserId(), startUser.getId())) { | 966 | if (ObjectUtil.notEqual(dept.getLeaderUserId(), startUser.getId())) { |
| 967 | getSelf().transferTask(Long.valueOf(task.getAssignee()), new BpmTaskTransferReqVO() | 967 | getSelf().transferTask(Long.valueOf(task.getAssignee()), new BpmTaskTransferReqVO() |
| 968 | .setId(task.getId()).setAssigneeUserId(dept.getLeaderUserId()) | 968 | .setId(task.getId()).setAssigneeUserId(dept.getLeaderUserId()) |
| 969 | - .setReason("审批人与提交人为同一人时,转交给部门负责人审批")); | 969 | + .setReason(BpmReasonEnum.ASSIGN_START_USER_TRANSFER_DEPT_LEADER.getReason())); |
| 970 | return; | 970 | return; |
| 971 | } | 971 | } |
| 972 | // 如果部门负责人是自己,还是自己审批吧~ | 972 | // 如果部门负责人是自己,还是自己审批吧~ |
| @@ -982,7 +982,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -982,7 +982,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 982 | 982 | ||
| 983 | @Override | 983 | @Override |
| 984 | @Transactional(rollbackFor = Exception.class) | 984 | @Transactional(rollbackFor = Exception.class) |
| 985 | - public void processTaskTimeout(String processInstanceId, String taskDefineKey, Integer taskAction) { | 985 | + public void processTaskTimeout(String processInstanceId, String taskDefineKey, Integer handlerType) { |
| 986 | ProcessInstance processInstance = processInstanceService.getProcessInstance(processInstanceId); | 986 | ProcessInstance processInstance = processInstanceService.getProcessInstance(processInstanceId); |
| 987 | if (processInstance == null) { | 987 | if (processInstance == null) { |
| 988 | log.error("[processTaskTimeout][processInstanceId({}) 没有找到流程实例]", processInstanceId); | 988 | log.error("[processTaskTimeout][processInstanceId({}) 没有找到流程实例]", processInstanceId); |
| @@ -997,7 +997,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -997,7 +997,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 997 | 997 | ||
| 998 | taskList.forEach(task -> FlowableUtils.execute(task.getTenantId(), () -> { | 998 | taskList.forEach(task -> FlowableUtils.execute(task.getTenantId(), () -> { |
| 999 | // 情况一:自动提醒 | 999 | // 情况一:自动提醒 |
| 1000 | - if (Objects.equals(taskAction, BpmUserTaskTimeoutHandlerType.REMINDER.getAction())) { | 1000 | + if (Objects.equals(handlerType, BpmUserTaskTimeoutHandlerTypeEnum.REMINDER.getType())) { |
| 1001 | messageService.sendMessageWhenTaskTimeout(new BpmMessageSendWhenTaskTimeoutReqDTO() | 1001 | messageService.sendMessageWhenTaskTimeout(new BpmMessageSendWhenTaskTimeoutReqDTO() |
| 1002 | .setProcessInstanceId(processInstanceId).setProcessInstanceName(processInstance.getName()) | 1002 | .setProcessInstanceId(processInstanceId).setProcessInstanceName(processInstance.getName()) |
| 1003 | .setTaskId(task.getId()).setTaskName(task.getName()).setAssigneeUserId(Long.parseLong(task.getAssignee()))); | 1003 | .setTaskId(task.getId()).setTaskName(task.getName()).setAssigneeUserId(Long.parseLong(task.getAssignee()))); |
| @@ -1005,16 +1005,16 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -1005,16 +1005,16 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 1005 | } | 1005 | } |
| 1006 | 1006 | ||
| 1007 | // 情况二:自动同意 | 1007 | // 情况二:自动同意 |
| 1008 | - if (Objects.equals(taskAction, BpmUserTaskTimeoutHandlerType.APPROVE.getAction())) { | 1008 | + if (Objects.equals(handlerType, BpmUserTaskTimeoutHandlerTypeEnum.APPROVE.getType())) { |
| 1009 | approveTask(Long.parseLong(task.getAssignee()), | 1009 | approveTask(Long.parseLong(task.getAssignee()), |
| 1010 | - new BpmTaskApproveReqVO().setId(task.getId()).setReason("超时系统自动同意")); | 1010 | + new BpmTaskApproveReqVO().setId(task.getId()).setReason(BpmReasonEnum.TIMEOUT_APPROVE.getReason())); |
| 1011 | return; | 1011 | return; |
| 1012 | } | 1012 | } |
| 1013 | 1013 | ||
| 1014 | // 情况三:自动拒绝 | 1014 | // 情况三:自动拒绝 |
| 1015 | - if (Objects.equals(taskAction, BpmUserTaskTimeoutHandlerType.REJECT.getAction())) { | 1015 | + if (Objects.equals(handlerType, BpmUserTaskTimeoutHandlerTypeEnum.REJECT.getType())) { |
| 1016 | rejectTask(Long.parseLong(task.getAssignee()), | 1016 | rejectTask(Long.parseLong(task.getAssignee()), |
| 1017 | - new BpmTaskRejectReqVO().setId(task.getId()).setReason("超时系统自动拒绝")); | 1017 | + new BpmTaskRejectReqVO().setId(task.getId()).setReason(BpmReasonEnum.REJECT_TASK.getReason())); |
| 1018 | } | 1018 | } |
| 1019 | })); | 1019 | })); |
| 1020 | } | 1020 | } |