Commit 889b9406b89a051b91ad3e4be40261f29d586c8d
1 parent
528a321f
BPM:增加任务监听器、执行监听器的管理
Showing
33 changed files
with
602 additions
and
40 deletions
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/ErrorCodeConstants.java
| @@ -66,4 +66,10 @@ public interface ErrorCodeConstants { | @@ -66,4 +66,10 @@ public interface ErrorCodeConstants { | ||
| 66 | ErrorCode CATEGORY_NAME_DUPLICATE = new ErrorCode(1_009_012_001, "流程分类名字【{}】重复"); | 66 | ErrorCode CATEGORY_NAME_DUPLICATE = new ErrorCode(1_009_012_001, "流程分类名字【{}】重复"); |
| 67 | ErrorCode CATEGORY_CODE_DUPLICATE = new ErrorCode(1_009_012_002, "流程分类编码【{}】重复"); | 67 | ErrorCode CATEGORY_CODE_DUPLICATE = new ErrorCode(1_009_012_002, "流程分类编码【{}】重复"); |
| 68 | 68 | ||
| 69 | + // ========== BPM 流程监听器 1-009-013-000 ========== | ||
| 70 | + ErrorCode PROCESS_LISTENER_NOT_EXISTS = new ErrorCode(1_009_013_000, "流程监听器不存在"); | ||
| 71 | + ErrorCode PROCESS_LISTENER_CLASS_NOT_FOUND = new ErrorCode(1_009_013_001, "流程监听器类({})不存在"); | ||
| 72 | + ErrorCode PROCESS_LISTENER_CLASS_IMPLEMENTS_ERROR = new ErrorCode(1_009_013_002, "流程监听器类({})没有实现接口({})"); | ||
| 73 | + ErrorCode PROCESS_LISTENER_EXPRESSION_INVALID = new ErrorCode(1_009_013_003, "流程监听器表达式({})不合法"); | ||
| 74 | + | ||
| 69 | } | 75 | } |
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmProcessListenerType.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.enums.definition; | ||
| 2 | + | ||
| 3 | +import lombok.AllArgsConstructor; | ||
| 4 | +import lombok.Getter; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * BPM 流程监听器的类型 | ||
| 8 | + * | ||
| 9 | + * @author 芋道源码 | ||
| 10 | + */ | ||
| 11 | +@Getter | ||
| 12 | +@AllArgsConstructor | ||
| 13 | +public enum BpmProcessListenerType { | ||
| 14 | + | ||
| 15 | + EXECUTION("execution", "执行监听器"), | ||
| 16 | + TASK("task", "任务执行器"); | ||
| 17 | + | ||
| 18 | + private final String type; | ||
| 19 | + private final String name; | ||
| 20 | + | ||
| 21 | +} |
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmProcessListenerValueType.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.enums.definition; | ||
| 2 | + | ||
| 3 | +import lombok.AllArgsConstructor; | ||
| 4 | +import lombok.Getter; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * BPM 流程监听器的值类型 | ||
| 8 | + * | ||
| 9 | + * @author 芋道源码 | ||
| 10 | + */ | ||
| 11 | +@Getter | ||
| 12 | +@AllArgsConstructor | ||
| 13 | +public enum BpmProcessListenerValueType { | ||
| 14 | + | ||
| 15 | + CLASS("class", "Java 类"), | ||
| 16 | + DELEGATE_EXPRESSION("delegateExpression", "代理表达式"), | ||
| 17 | + EXPRESSION("expression", "表达式"); | ||
| 18 | + | ||
| 19 | + private final String type; | ||
| 20 | + private final String name; | ||
| 21 | + | ||
| 22 | +} |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessListenerController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.controller.admin.definition; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener.BpmProcessListenerPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener.BpmProcessListenerRespVO; | ||
| 8 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener.BpmProcessListenerSaveReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessListenerDO; | ||
| 10 | +import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessListenerService; | ||
| 11 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 12 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 13 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 14 | +import jakarta.annotation.Resource; | ||
| 15 | +import jakarta.validation.Valid; | ||
| 16 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 17 | +import org.springframework.validation.annotation.Validated; | ||
| 18 | +import org.springframework.web.bind.annotation.*; | ||
| 19 | + | ||
| 20 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 21 | + | ||
| 22 | +@Tag(name = "管理后台 - BPM 流程监听器") | ||
| 23 | +@RestController | ||
| 24 | +@RequestMapping("/bpm/process-listener") | ||
| 25 | +@Validated | ||
| 26 | +public class BpmProcessListenerController { | ||
| 27 | + | ||
| 28 | + @Resource | ||
| 29 | + private BpmProcessListenerService processListenerService; | ||
| 30 | + | ||
| 31 | + @PostMapping("/create") | ||
| 32 | + @Operation(summary = "创建流程监听器") | ||
| 33 | + @PreAuthorize("@ss.hasPermission('bpm:process-listener:create')") | ||
| 34 | + public CommonResult<Long> createProcessListener(@Valid @RequestBody BpmProcessListenerSaveReqVO createReqVO) { | ||
| 35 | + return success(processListenerService.createProcessListener(createReqVO)); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @PutMapping("/update") | ||
| 39 | + @Operation(summary = "更新流程监听器") | ||
| 40 | + @PreAuthorize("@ss.hasPermission('bpm:process-listener:update')") | ||
| 41 | + public CommonResult<Boolean> updateProcessListener(@Valid @RequestBody BpmProcessListenerSaveReqVO updateReqVO) { | ||
| 42 | + processListenerService.updateProcessListener(updateReqVO); | ||
| 43 | + return success(true); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @DeleteMapping("/delete") | ||
| 47 | + @Operation(summary = "删除流程监听器") | ||
| 48 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 49 | + @PreAuthorize("@ss.hasPermission('bpm:process-listener:delete')") | ||
| 50 | + public CommonResult<Boolean> deleteProcessListener(@RequestParam("id") Long id) { | ||
| 51 | + processListenerService.deleteProcessListener(id); | ||
| 52 | + return success(true); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @GetMapping("/get") | ||
| 56 | + @Operation(summary = "获得流程监听器") | ||
| 57 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 58 | + @PreAuthorize("@ss.hasPermission('bpm:process-listener:query')") | ||
| 59 | + public CommonResult<BpmProcessListenerRespVO> getProcessListener(@RequestParam("id") Long id) { | ||
| 60 | + BpmProcessListenerDO processListener = processListenerService.getProcessListener(id); | ||
| 61 | + return success(BeanUtils.toBean(processListener, BpmProcessListenerRespVO.class)); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @GetMapping("/page") | ||
| 65 | + @Operation(summary = "获得流程监听器分页") | ||
| 66 | + @PreAuthorize("@ss.hasPermission('bpm:process-listener:query')") | ||
| 67 | + public CommonResult<PageResult<BpmProcessListenerRespVO>> getProcessListenerPage( | ||
| 68 | + @Valid BpmProcessListenerPageReqVO pageReqVO) { | ||
| 69 | + PageResult<BpmProcessListenerDO> pageResult = processListenerService.getProcessListenerPage(pageReqVO); | ||
| 70 | + return success(BeanUtils.toBean(pageResult, BpmProcessListenerRespVO.class)); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | +} | ||
| 0 | \ No newline at end of file | 74 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/category/BpmCategoryPageReqVO.java
| @@ -15,8 +15,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | @@ -15,8 +15,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | ||
| 15 | 15 | ||
| 16 | @Schema(description = "管理后台 - BPM 流程分类分页 Request VO") | 16 | @Schema(description = "管理后台 - BPM 流程分类分页 Request VO") |
| 17 | @Data | 17 | @Data |
| 18 | -@EqualsAndHashCode(callSuper = true) | ||
| 19 | -@ToString(callSuper = true) | ||
| 20 | public class BpmCategoryPageReqVO extends PageParam { | 18 | public class BpmCategoryPageReqVO extends PageParam { |
| 21 | 19 | ||
| 22 | @Schema(description = "分类名", example = "王五") | 20 | @Schema(description = "分类名", example = "王五") |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormPageReqVO.java
| @@ -8,8 +8,6 @@ import lombok.ToString; | @@ -8,8 +8,6 @@ import lombok.ToString; | ||
| 8 | 8 | ||
| 9 | @Schema(description = "管理后台 - 动态表单分页 Request VO") | 9 | @Schema(description = "管理后台 - 动态表单分页 Request VO") |
| 10 | @Data | 10 | @Data |
| 11 | -@EqualsAndHashCode(callSuper = true) | ||
| 12 | -@ToString(callSuper = true) | ||
| 13 | public class BpmFormPageReqVO extends PageParam { | 11 | public class BpmFormPageReqVO extends PageParam { |
| 14 | 12 | ||
| 15 | @Schema(description = "表单名称", example = "芋道") | 13 | @Schema(description = "表单名称", example = "芋道") |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupPageReqVO.java
| @@ -12,8 +12,6 @@ import java.time.LocalDateTime; | @@ -12,8 +12,6 @@ import java.time.LocalDateTime; | ||
| 12 | 12 | ||
| 13 | @Schema(description = "管理后台 - 用户组分页 Request VO") | 13 | @Schema(description = "管理后台 - 用户组分页 Request VO") |
| 14 | @Data | 14 | @Data |
| 15 | -@EqualsAndHashCode(callSuper = true) | ||
| 16 | -@ToString(callSuper = true) | ||
| 17 | public class BpmUserGroupPageReqVO extends PageParam { | 15 | public class BpmUserGroupPageReqVO extends PageParam { |
| 18 | 16 | ||
| 19 | @Schema(description = "编号", example = "1024") | 17 | @Schema(description = "编号", example = "1024") |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/listener/BpmProcessListenerPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import lombok.EqualsAndHashCode; | ||
| 7 | +import lombok.ToString; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - BPM 流程监听器分页 Request VO") | ||
| 10 | +@Data | ||
| 11 | +@EqualsAndHashCode(callSuper = true) | ||
| 12 | +@ToString(callSuper = true) | ||
| 13 | +public class BpmProcessListenerPageReqVO extends PageParam { | ||
| 14 | + | ||
| 15 | + @Schema(description = "监听器名字", example = "赵六") | ||
| 16 | + private String name; | ||
| 17 | + | ||
| 18 | + @Schema(description = "监听器类型", example = "execution") | ||
| 19 | + private String type; | ||
| 20 | + | ||
| 21 | + @Schema(description = "监听事件", example = "start") | ||
| 22 | + private String event; | ||
| 23 | + | ||
| 24 | +} | ||
| 0 | \ No newline at end of file | 25 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/listener/BpmProcessListenerRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.time.LocalDateTime; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - BPM 流程监听器 Response VO") | ||
| 9 | +@Data | ||
| 10 | +public class BpmProcessListenerRespVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13089") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "监听器名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | ||
| 16 | + private String name; | ||
| 17 | + | ||
| 18 | + @Schema(description = "监听器类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "execution") | ||
| 19 | + private String type; | ||
| 20 | + | ||
| 21 | + @Schema(description = "监听器状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 22 | + private Integer status; | ||
| 23 | + | ||
| 24 | + @Schema(description = "监听事件", requiredMode = Schema.RequiredMode.REQUIRED, example = "start") | ||
| 25 | + private String event; | ||
| 26 | + | ||
| 27 | + @Schema(description = "监听器值类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "class") | ||
| 28 | + private String valueType; | ||
| 29 | + | ||
| 30 | + @Schema(description = "监听器值", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 31 | + private String value; | ||
| 32 | + | ||
| 33 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 34 | + private LocalDateTime createTime; | ||
| 35 | + | ||
| 36 | +} | ||
| 0 | \ No newline at end of file | 37 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/listener/BpmProcessListenerSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotEmpty; | ||
| 5 | +import jakarta.validation.constraints.NotNull; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - BPM 流程监听器新增/修改 Request VO") | ||
| 9 | +@Data | ||
| 10 | +public class BpmProcessListenerSaveReqVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13089") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "监听器名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | ||
| 16 | + @NotEmpty(message = "监听器名字不能为空") | ||
| 17 | + private String name; | ||
| 18 | + | ||
| 19 | + @Schema(description = "监听器类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "execution") | ||
| 20 | + @NotEmpty(message = "监听器类型不能为空") | ||
| 21 | + private String type; | ||
| 22 | + | ||
| 23 | + @Schema(description = "监听器状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 24 | + @NotNull(message = "监听器状态不能为空") | ||
| 25 | + private Integer status; | ||
| 26 | + | ||
| 27 | + @Schema(description = "监听事件", requiredMode = Schema.RequiredMode.REQUIRED, example = "start") | ||
| 28 | + @NotEmpty(message = "监听事件不能为空") | ||
| 29 | + private String event; | ||
| 30 | + | ||
| 31 | + @Schema(description = "监听器值类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "class") | ||
| 32 | + @NotEmpty(message = "监听器值类型不能为空") | ||
| 33 | + private String valueType; | ||
| 34 | + | ||
| 35 | + @Schema(description = "监听器值", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 36 | + @NotEmpty(message = "监听器值不能为空") | ||
| 37 | + private String value; | ||
| 38 | + | ||
| 39 | +} | ||
| 0 | \ No newline at end of file | 40 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModeImportReqVO.java
| @@ -10,8 +10,6 @@ import jakarta.validation.constraints.NotNull; | @@ -10,8 +10,6 @@ import jakarta.validation.constraints.NotNull; | ||
| 10 | 10 | ||
| 11 | @Schema(description = "管理后台 - 流程模型的导入 Request VO 相比流程模型的新建来说,只是多了一个 bpmnFile 文件") | 11 | @Schema(description = "管理后台 - 流程模型的导入 Request VO 相比流程模型的新建来说,只是多了一个 bpmnFile 文件") |
| 12 | @Data | 12 | @Data |
| 13 | -@EqualsAndHashCode(callSuper = true) | ||
| 14 | -@ToString(callSuper = true) | ||
| 15 | public class BpmModeImportReqVO extends BpmModelCreateReqVO { | 13 | public class BpmModeImportReqVO extends BpmModelCreateReqVO { |
| 16 | 14 | ||
| 17 | @Schema(description = "BPMN 文件", requiredMode = Schema.RequiredMode.REQUIRED) | 15 | @Schema(description = "BPMN 文件", requiredMode = Schema.RequiredMode.REQUIRED) |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelPageReqVO.java
| @@ -9,8 +9,6 @@ import lombok.ToString; | @@ -9,8 +9,6 @@ import lombok.ToString; | ||
| 9 | 9 | ||
| 10 | @Schema(description = "管理后台 - 流程模型分页 Request VO") | 10 | @Schema(description = "管理后台 - 流程模型分页 Request VO") |
| 11 | @Data | 11 | @Data |
| 12 | -@EqualsAndHashCode(callSuper = true) | ||
| 13 | -@ToString(callSuper = true) | ||
| 14 | public class BpmModelPageReqVO extends PageParam { | 12 | public class BpmModelPageReqVO extends PageParam { |
| 15 | 13 | ||
| 16 | @Schema(description = "标识,精准匹配", example = "process1641042089407") | 14 | @Schema(description = "标识,精准匹配", example = "process1641042089407") |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionPageReqVO.java
| @@ -8,8 +8,6 @@ import lombok.ToString; | @@ -8,8 +8,6 @@ import lombok.ToString; | ||
| 8 | 8 | ||
| 9 | @Schema(description = "管理后台 - 流程定义分页 Request VO") | 9 | @Schema(description = "管理后台 - 流程定义分页 Request VO") |
| 10 | @Data | 10 | @Data |
| 11 | -@ToString(callSuper = true) | ||
| 12 | -@EqualsAndHashCode(callSuper = true) | ||
| 13 | public class BpmProcessDefinitionPageReqVO extends PageParam { | 11 | public class BpmProcessDefinitionPageReqVO extends PageParam { |
| 14 | 12 | ||
| 15 | @Schema(description = "标识-精准匹配", example = "process1641042089407") | 13 | @Schema(description = "标识-精准匹配", example = "process1641042089407") |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeavePageReqVO.java
| @@ -13,8 +13,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | @@ -13,8 +13,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | ||
| 13 | 13 | ||
| 14 | @Schema(description = "管理后台 - 请假申请分页 Request VO") | 14 | @Schema(description = "管理后台 - 请假申请分页 Request VO") |
| 15 | @Data | 15 | @Data |
| 16 | -@EqualsAndHashCode(callSuper = true) | ||
| 17 | -@ToString(callSuper = true) | ||
| 18 | public class BpmOALeavePageReqVO extends PageParam { | 16 | public class BpmOALeavePageReqVO extends PageParam { |
| 19 | 17 | ||
| 20 | @Schema(description = "状态", example = "1") | 18 | @Schema(description = "状态", example = "1") |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceCopyPageReqVO.java
| @@ -3,8 +3,6 @@ package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance; | @@ -3,8 +3,6 @@ package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | import lombok.Data; | 5 | import lombok.Data; |
| 6 | -import lombok.EqualsAndHashCode; | ||
| 7 | -import lombok.ToString; | ||
| 8 | import org.springframework.format.annotation.DateTimeFormat; | 6 | import org.springframework.format.annotation.DateTimeFormat; |
| 9 | 7 | ||
| 10 | import java.time.LocalDateTime; | 8 | import java.time.LocalDateTime; |
| @@ -13,8 +11,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | @@ -13,8 +11,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | ||
| 13 | 11 | ||
| 14 | @Schema(description = "管理后台 - 流程实例抄送的分页 Request VO") | 12 | @Schema(description = "管理后台 - 流程实例抄送的分页 Request VO") |
| 15 | @Data | 13 | @Data |
| 16 | -@EqualsAndHashCode(callSuper = true) | ||
| 17 | -@ToString(callSuper = true) | ||
| 18 | public class BpmProcessInstanceCopyPageReqVO extends PageParam { | 14 | public class BpmProcessInstanceCopyPageReqVO extends PageParam { |
| 19 | 15 | ||
| 20 | @Schema(description = "流程名称", example = "芋道") | 16 | @Schema(description = "流程名称", example = "芋道") |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskPageReqVO.java
| @@ -12,8 +12,6 @@ import java.time.LocalDateTime; | @@ -12,8 +12,6 @@ import java.time.LocalDateTime; | ||
| 12 | 12 | ||
| 13 | @Schema(description = "管理后台 - 流程任务的的分页 Request VO") // 待办、已办,都使用该分页 | 13 | @Schema(description = "管理后台 - 流程任务的的分页 Request VO") // 待办、已办,都使用该分页 |
| 14 | @Data | 14 | @Data |
| 15 | -@EqualsAndHashCode(callSuper = true) | ||
| 16 | -@ToString(callSuper = true) | ||
| 17 | public class BpmTaskPageReqVO extends PageParam { | 15 | public class BpmTaskPageReqVO extends PageParam { |
| 18 | 16 | ||
| 19 | @Schema(description = "流程任务名", example = "芋道") | 17 | @Schema(description = "流程任务名", example = "芋道") |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/definition/BpmCategoryDO.java
| @@ -14,8 +14,6 @@ import lombok.*; | @@ -14,8 +14,6 @@ import lombok.*; | ||
| 14 | @TableName("bpm_category") | 14 | @TableName("bpm_category") |
| 15 | @KeySequence("bpm_category_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | 15 | @KeySequence("bpm_category_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 |
| 16 | @Data | 16 | @Data |
| 17 | -@EqualsAndHashCode(callSuper = true) | ||
| 18 | -@ToString(callSuper = true) | ||
| 19 | @Builder | 17 | @Builder |
| 20 | @NoArgsConstructor | 18 | @NoArgsConstructor |
| 21 | @AllArgsConstructor | 19 | @AllArgsConstructor |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/definition/BpmFormDO.java
| @@ -10,15 +10,13 @@ import lombok.*; | @@ -10,15 +10,13 @@ import lombok.*; | ||
| 10 | import java.util.List; | 10 | import java.util.List; |
| 11 | 11 | ||
| 12 | /** | 12 | /** |
| 13 | - * 工作流的表单定义 | 13 | + * BPM 工作流的表单定义 |
| 14 | * 用于工作流的申请表单,需要动态配置的场景 | 14 | * 用于工作流的申请表单,需要动态配置的场景 |
| 15 | * | 15 | * |
| 16 | * @author 芋道源码 | 16 | * @author 芋道源码 |
| 17 | */ | 17 | */ |
| 18 | @TableName(value = "bpm_form", autoResultMap = true) | 18 | @TableName(value = "bpm_form", autoResultMap = true) |
| 19 | @Data | 19 | @Data |
| 20 | -@EqualsAndHashCode(callSuper = true) | ||
| 21 | -@ToString(callSuper = true) | ||
| 22 | @Builder | 20 | @Builder |
| 23 | @NoArgsConstructor | 21 | @NoArgsConstructor |
| 24 | @AllArgsConstructor | 22 | @AllArgsConstructor |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/definition/BpmProcessDefinitionInfoDO.java
| @@ -11,15 +11,13 @@ import lombok.*; | @@ -11,15 +11,13 @@ import lombok.*; | ||
| 11 | import java.util.List; | 11 | import java.util.List; |
| 12 | 12 | ||
| 13 | /** | 13 | /** |
| 14 | - * Bpm 流程定义的拓信息 | 14 | + * BPM 流程定义的拓信息 |
| 15 | * 主要解决 Flowable {@link org.flowable.engine.repository.ProcessDefinition} 不支持拓展字段,所以新建该表 | 15 | * 主要解决 Flowable {@link org.flowable.engine.repository.ProcessDefinition} 不支持拓展字段,所以新建该表 |
| 16 | * | 16 | * |
| 17 | * @author 芋道源码 | 17 | * @author 芋道源码 |
| 18 | */ | 18 | */ |
| 19 | @TableName(value = "bpm_process_definition_info", autoResultMap = true) | 19 | @TableName(value = "bpm_process_definition_info", autoResultMap = true) |
| 20 | @Data | 20 | @Data |
| 21 | -@EqualsAndHashCode(callSuper = true) | ||
| 22 | -@ToString(callSuper = true) | ||
| 23 | @Builder | 21 | @Builder |
| 24 | @NoArgsConstructor | 22 | @NoArgsConstructor |
| 25 | @AllArgsConstructor | 23 | @AllArgsConstructor |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/definition/BpmProcessListenerDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.dal.dataobject.definition; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import lombok.AllArgsConstructor; | ||
| 7 | +import lombok.Builder; | ||
| 8 | +import lombok.Data; | ||
| 9 | +import lombok.NoArgsConstructor; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * BPM 流程监听器 DO | ||
| 13 | + * | ||
| 14 | + * 目的:本质上它是流程监听器的模版,用于 BPMN 在设计时,直接选择这些模版 | ||
| 15 | + * | ||
| 16 | + * @author 芋道源码 | ||
| 17 | + */ | ||
| 18 | +@TableName(value = "bpm_process_listener") | ||
| 19 | +@Data | ||
| 20 | +@Builder | ||
| 21 | +@NoArgsConstructor | ||
| 22 | +@AllArgsConstructor | ||
| 23 | +public class BpmProcessListenerDO extends BaseDO { | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 主键 ID,自增 | ||
| 27 | + */ | ||
| 28 | + @TableId | ||
| 29 | + private Long id; | ||
| 30 | + /** | ||
| 31 | + * 监听器名字 | ||
| 32 | + */ | ||
| 33 | + private String name; | ||
| 34 | + /** | ||
| 35 | + * 状态 | ||
| 36 | + * | ||
| 37 | + * 枚举 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum} | ||
| 38 | + */ | ||
| 39 | + private Integer status; | ||
| 40 | + /** | ||
| 41 | + * 监听类型 | ||
| 42 | + * | ||
| 43 | + * 枚举 {@link cn.iocoder.yudao.module.bpm.enums.definition.BpmProcessListenerType} | ||
| 44 | + * | ||
| 45 | + * 1. execution:ExecutionListener <a href="https://tkjohn.github.io/flowable-userguide/#executionListeners">执行监听器</a> | ||
| 46 | + * 2. task:TaskListener <a href="https://tkjohn.github.io/flowable-userguide/#taskListeners">任务监听器</a> | ||
| 47 | + */ | ||
| 48 | + private String type; | ||
| 49 | + /** | ||
| 50 | + * 监听事件 | ||
| 51 | + * | ||
| 52 | + * execution 时:start、end | ||
| 53 | + * task 时:create 创建、assignment 指派、complete 完成、delete 删除、update 更新、timeout 超时 | ||
| 54 | + */ | ||
| 55 | + private String event; | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 值类型 | ||
| 59 | + * | ||
| 60 | + * 1. class:Java 类,ExecutionListener 需要 {@link org.flowable.engine.delegate.JavaDelegate},TaskListener 需要 {@link org.flowable.engine.delegate.TaskListener} | ||
| 61 | + * 2. delegateExpression:委托表达式,在 class 的基础上,需要注册到 Spring 容器里,后续表达式通过 Spring Bean 名称即可 | ||
| 62 | + * 3. expression:表达式,一个普通类的普通方法,将这个普通类注册到 Spring 容器中,然后表达式中还可以执行这个类中的方法 | ||
| 63 | + */ | ||
| 64 | + private String valueType; | ||
| 65 | + /** | ||
| 66 | + * 值 | ||
| 67 | + */ | ||
| 68 | + private String value; | ||
| 69 | + | ||
| 70 | +} |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/definition/BpmTaskMessageRuleDO.java deleted
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/definition/BpmUserGroupDO.java
| @@ -11,14 +11,12 @@ import lombok.*; | @@ -11,14 +11,12 @@ import lombok.*; | ||
| 11 | import java.util.Set; | 11 | import java.util.Set; |
| 12 | 12 | ||
| 13 | /** | 13 | /** |
| 14 | - * Bpm 用户组 | 14 | + * BPM 用户组 |
| 15 | * | 15 | * |
| 16 | * @author 芋道源码 | 16 | * @author 芋道源码 |
| 17 | */ | 17 | */ |
| 18 | @TableName(value = "bpm_user_group", autoResultMap = true) | 18 | @TableName(value = "bpm_user_group", autoResultMap = true) |
| 19 | @Data | 19 | @Data |
| 20 | -@EqualsAndHashCode(callSuper = true) | ||
| 21 | -@ToString(callSuper = true) | ||
| 22 | @Builder | 20 | @Builder |
| 23 | @NoArgsConstructor | 21 | @NoArgsConstructor |
| 24 | @AllArgsConstructor | 22 | @AllArgsConstructor |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/oa/BpmOALeaveDO.java
| @@ -18,8 +18,6 @@ import java.time.LocalDateTime; | @@ -18,8 +18,6 @@ import java.time.LocalDateTime; | ||
| 18 | */ | 18 | */ |
| 19 | @TableName("bpm_oa_leave") | 19 | @TableName("bpm_oa_leave") |
| 20 | @Data | 20 | @Data |
| 21 | -@EqualsAndHashCode(callSuper = true) | ||
| 22 | -@ToString(callSuper = true) | ||
| 23 | @Builder | 21 | @Builder |
| 24 | @NoArgsConstructor | 22 | @NoArgsConstructor |
| 25 | @AllArgsConstructor | 23 | @AllArgsConstructor |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmProcessInstanceCopyDO.java
| @@ -13,8 +13,6 @@ import lombok.*; | @@ -13,8 +13,6 @@ import lombok.*; | ||
| 13 | */ | 13 | */ |
| 14 | @TableName(value = "bpm_process_instance_copy", autoResultMap = true) | 14 | @TableName(value = "bpm_process_instance_copy", autoResultMap = true) |
| 15 | @Data | 15 | @Data |
| 16 | -@EqualsAndHashCode(callSuper = true) | ||
| 17 | -@ToString(callSuper = true) | ||
| 18 | @Builder | 16 | @Builder |
| 19 | @NoArgsConstructor | 17 | @NoArgsConstructor |
| 20 | @AllArgsConstructor | 18 | @AllArgsConstructor |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/definition/BpmProcessListenerMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.dal.mysql.definition; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener.BpmProcessListenerPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessListenerDO; | ||
| 8 | +import org.apache.ibatis.annotations.Mapper; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * BPM 流程监听器 Mapper | ||
| 12 | + * | ||
| 13 | + * @author 芋道源码 | ||
| 14 | + */ | ||
| 15 | +@Mapper | ||
| 16 | +public interface BpmProcessListenerMapper extends BaseMapperX<BpmProcessListenerDO> { | ||
| 17 | + | ||
| 18 | + default PageResult<BpmProcessListenerDO> selectPage(BpmProcessListenerPageReqVO reqVO) { | ||
| 19 | + return selectPage(reqVO, new LambdaQueryWrapperX<BpmProcessListenerDO>() | ||
| 20 | + .likeIfPresent(BpmProcessListenerDO::getName, reqVO.getName()) | ||
| 21 | + .eqIfPresent(BpmProcessListenerDO::getType, reqVO.getType()) | ||
| 22 | + .eqIfPresent(BpmProcessListenerDO::getEvent, reqVO.getEvent()) | ||
| 23 | + .orderByDesc(BpmProcessListenerDO::getId)); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | +} | ||
| 0 | \ No newline at end of file | 27 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/listener/demo/exection/DemoDelegateClassExecutionListener.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.framework.flowable.core.listener.demo.exection; | ||
| 2 | + | ||
| 3 | +import lombok.extern.slf4j.Slf4j; | ||
| 4 | +import org.flowable.engine.delegate.DelegateExecution; | ||
| 5 | +import org.flowable.engine.delegate.JavaDelegate; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 类型为 class 的 ExecutionListener 监听器示例 | ||
| 9 | + * | ||
| 10 | + * @author 芋道源码 | ||
| 11 | + */ | ||
| 12 | +@Slf4j | ||
| 13 | +public class DemoDelegateClassExecutionListener implements JavaDelegate { | ||
| 14 | + | ||
| 15 | + @Override | ||
| 16 | + public void execute(DelegateExecution execution) { | ||
| 17 | + log.info("[execute][execution({}) 被调用!变量有:{}]", execution.getId(), | ||
| 18 | + execution.getCurrentFlowableListener().getFieldExtensions()); | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | +} | ||
| 0 | \ No newline at end of file | 22 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/listener/demo/exection/DemoDelegateExpressionExecutionListener.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.framework.flowable.core.listener.demo.exection; | ||
| 2 | + | ||
| 3 | +import lombok.extern.slf4j.Slf4j; | ||
| 4 | +import org.flowable.engine.delegate.DelegateExecution; | ||
| 5 | +import org.flowable.engine.delegate.JavaDelegate; | ||
| 6 | +import org.springframework.stereotype.Component; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 类型为 delegateExpression 的 ExecutionListener 监听器示例 | ||
| 10 | + * | ||
| 11 | + * 和 {@link DemoDelegateClassExecutionListener} 的差异是,需要注册到 Spring 中 | ||
| 12 | + */ | ||
| 13 | +@Component | ||
| 14 | +@Slf4j | ||
| 15 | +public class DemoDelegateExpressionExecutionListener implements JavaDelegate { | ||
| 16 | + | ||
| 17 | + @Override | ||
| 18 | + public void execute(DelegateExecution execution) { | ||
| 19 | + log.info("[execute][execution({}) 被调用!变量有:{}]", execution.getId(), | ||
| 20 | + execution.getCurrentFlowableListener().getFieldExtensions()); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | +} | ||
| 0 | \ No newline at end of file | 24 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/listener/demo/exection/DemoSpringExpressionExecutionListener.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.framework.flowable.core.listener.demo.exection; | ||
| 2 | + | ||
| 3 | +import lombok.extern.slf4j.Slf4j; | ||
| 4 | +import org.flowable.engine.delegate.DelegateExecution; | ||
| 5 | +import org.springframework.stereotype.Component; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 类型为 expression 的 ExecutionListener 监听器示例 | ||
| 9 | + * | ||
| 10 | + * 和 {@link DemoDelegateClassExecutionListener} 的差异是,需要注册到 Spring 中,但不用实现 {@link org.flowable.engine.delegate.JavaDelegate} 接口 | ||
| 11 | + */ | ||
| 12 | +@Component | ||
| 13 | +@Slf4j | ||
| 14 | +public class DemoSpringExpressionExecutionListener { | ||
| 15 | + | ||
| 16 | + public void execute(DelegateExecution execution) { | ||
| 17 | + log.info("[execute][execution({}) 被调用!变量有:{}]", execution.getId(), | ||
| 18 | + execution.getCurrentFlowableListener().getFieldExtensions()); | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | +} | ||
| 0 | \ No newline at end of file | 22 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/listener/demo/task/DemoDelegateClassExecutionListener.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.framework.flowable.core.listener.demo.task; | ||
| 2 | + | ||
| 3 | +import lombok.extern.slf4j.Slf4j; | ||
| 4 | +import org.flowable.engine.delegate.TaskListener; | ||
| 5 | +import org.flowable.task.service.delegate.DelegateTask; | ||
| 6 | +import org.springframework.stereotype.Component; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 类型为 class 的 TaskListener 监听器示例 | ||
| 10 | + * | ||
| 11 | + * @author 芋道源码 | ||
| 12 | + */ | ||
| 13 | +@Component | ||
| 14 | +@Slf4j | ||
| 15 | +public class DemoDelegateClassExecutionListener implements TaskListener { | ||
| 16 | + | ||
| 17 | + @Override | ||
| 18 | + public void notify(DelegateTask delegateTask) { | ||
| 19 | + log.info("[execute][task({}) 被调用]", delegateTask.getId()); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | +} | ||
| 0 | \ No newline at end of file | 23 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/listener/demo/task/DemoDelegateExpressionExecutionListener.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.framework.flowable.core.listener.demo.task; | ||
| 2 | + | ||
| 3 | +import lombok.extern.slf4j.Slf4j; | ||
| 4 | +import org.flowable.engine.delegate.TaskListener; | ||
| 5 | +import org.flowable.task.service.delegate.DelegateTask; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 类型为 delegateExpression 的 TaskListener 监听器示例 | ||
| 9 | + * | ||
| 10 | + * @author 芋道源码 | ||
| 11 | + */ | ||
| 12 | +@Slf4j | ||
| 13 | +public class DemoDelegateExpressionExecutionListener implements TaskListener { | ||
| 14 | + | ||
| 15 | + @Override | ||
| 16 | + public void notify(DelegateTask delegateTask) { | ||
| 17 | + log.info("[execute][task({}) 被调用]", delegateTask.getId()); | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | +} | ||
| 0 | \ No newline at end of file | 21 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/listener/demo/task/DemoSpringExpressionExecutionListener.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.framework.flowable.core.listener.demo.task; | ||
| 2 | + | ||
| 3 | +import lombok.extern.slf4j.Slf4j; | ||
| 4 | +import org.flowable.engine.delegate.TaskListener; | ||
| 5 | +import org.flowable.task.service.delegate.DelegateTask; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 类型为 expression 的 TaskListener 监听器示例 | ||
| 9 | + * | ||
| 10 | + * @author 芋道源码 | ||
| 11 | + */ | ||
| 12 | +@Slf4j | ||
| 13 | +public class DemoSpringExpressionExecutionListener { | ||
| 14 | + | ||
| 15 | + public void notify(DelegateTask delegateTask) { | ||
| 16 | + log.info("[execute][task({}) 被调用]", delegateTask.getId()); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | +} | ||
| 0 | \ No newline at end of file | 20 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmProcessListenerService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.definition; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener.BpmProcessListenerPageReqVO; | ||
| 4 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener.BpmProcessListenerSaveReqVO; | ||
| 5 | +import jakarta.validation.*; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessListenerDO; | ||
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * BPM 流程监听器 Service 接口 | ||
| 11 | + * | ||
| 12 | + * @author 芋道源码 | ||
| 13 | + */ | ||
| 14 | +public interface BpmProcessListenerService { | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * 创建流程监听器 | ||
| 18 | + * | ||
| 19 | + * @param createReqVO 创建信息 | ||
| 20 | + * @return 编号 | ||
| 21 | + */ | ||
| 22 | + Long createProcessListener(@Valid BpmProcessListenerSaveReqVO createReqVO); | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 更新流程监听器 | ||
| 26 | + * | ||
| 27 | + * @param updateReqVO 更新信息 | ||
| 28 | + */ | ||
| 29 | + void updateProcessListener(@Valid BpmProcessListenerSaveReqVO updateReqVO); | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 删除流程监听器 | ||
| 33 | + * | ||
| 34 | + * @param id 编号 | ||
| 35 | + */ | ||
| 36 | + void deleteProcessListener(Long id); | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 获得流程监听器 | ||
| 40 | + * | ||
| 41 | + * @param id 编号 | ||
| 42 | + * @return 流程监听器 | ||
| 43 | + */ | ||
| 44 | + BpmProcessListenerDO getProcessListener(Long id); | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 获得流程监听器分页 | ||
| 48 | + * | ||
| 49 | + * @param pageReqVO 分页查询 | ||
| 50 | + * @return 流程监听器分页 | ||
| 51 | + */ | ||
| 52 | + PageResult<BpmProcessListenerDO> getProcessListenerPage(BpmProcessListenerPageReqVO pageReqVO); | ||
| 53 | + | ||
| 54 | +} | ||
| 0 | \ No newline at end of file | 55 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmProcessListenerServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.definition; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.util.StrUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener.BpmProcessListenerPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener.BpmProcessListenerSaveReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessListenerDO; | ||
| 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; | ||
| 12 | +import jakarta.annotation.Resource; | ||
| 13 | +import org.flowable.engine.delegate.JavaDelegate; | ||
| 14 | +import org.flowable.engine.delegate.TaskListener; | ||
| 15 | +import org.springframework.stereotype.Service; | ||
| 16 | +import org.springframework.validation.annotation.Validated; | ||
| 17 | + | ||
| 18 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 19 | +import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * BPM 流程监听器 Service 实现类 | ||
| 23 | + * | ||
| 24 | + * @author 芋道源码 | ||
| 25 | + */ | ||
| 26 | +@Service | ||
| 27 | +@Validated | ||
| 28 | +public class BpmProcessListenerServiceImpl implements BpmProcessListenerService { | ||
| 29 | + | ||
| 30 | + @Resource | ||
| 31 | + private BpmProcessListenerMapper processListenerMapper; | ||
| 32 | + | ||
| 33 | + @Override | ||
| 34 | + public Long createProcessListener(BpmProcessListenerSaveReqVO createReqVO) { | ||
| 35 | + // 校验 | ||
| 36 | + validateCreateProcessListenerValue(createReqVO); | ||
| 37 | + // 插入 | ||
| 38 | + BpmProcessListenerDO processListener = BeanUtils.toBean(createReqVO, BpmProcessListenerDO.class); | ||
| 39 | + processListenerMapper.insert(processListener); | ||
| 40 | + return processListener.getId(); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @Override | ||
| 44 | + public void updateProcessListener(BpmProcessListenerSaveReqVO updateReqVO) { | ||
| 45 | + // 校验存在 | ||
| 46 | + validateProcessListenerExists(updateReqVO.getId()); | ||
| 47 | + validateCreateProcessListenerValue(updateReqVO); | ||
| 48 | + // 更新 | ||
| 49 | + BpmProcessListenerDO updateObj = BeanUtils.toBean(updateReqVO, BpmProcessListenerDO.class); | ||
| 50 | + processListenerMapper.updateById(updateObj); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + private void validateCreateProcessListenerValue(BpmProcessListenerSaveReqVO createReqVO) { | ||
| 54 | + // class 类型 | ||
| 55 | + if (createReqVO.getValueType().equals(BpmProcessListenerValueType.CLASS.getType())) { | ||
| 56 | + try { | ||
| 57 | + Class<?> clazz = Class.forName(createReqVO.getValue()); | ||
| 58 | + if (createReqVO.getType().equals(BpmProcessListenerType.EXECUTION.getType()) | ||
| 59 | + && !JavaDelegate.class.isAssignableFrom(clazz)) { | ||
| 60 | + throw exception(PROCESS_LISTENER_CLASS_IMPLEMENTS_ERROR, createReqVO.getValue(), | ||
| 61 | + JavaDelegate.class.getName()); | ||
| 62 | + } else if (createReqVO.getType().equals(BpmProcessListenerType.TASK.getType()) | ||
| 63 | + && !TaskListener.class.isAssignableFrom(clazz)) { | ||
| 64 | + throw exception(PROCESS_LISTENER_CLASS_IMPLEMENTS_ERROR, createReqVO.getValue(), | ||
| 65 | + TaskListener.class.getName()); | ||
| 66 | + } | ||
| 67 | + } catch (ClassNotFoundException e) { | ||
| 68 | + throw exception(PROCESS_LISTENER_CLASS_NOT_FOUND, createReqVO.getValue()); | ||
| 69 | + } | ||
| 70 | + return; | ||
| 71 | + } | ||
| 72 | + // 表达式 | ||
| 73 | + if (!StrUtil.startWith(createReqVO.getValue(), "${") || !StrUtil.endWith(createReqVO.getValue(), "}")) { | ||
| 74 | + throw exception(PROCESS_LISTENER_EXPRESSION_INVALID, createReqVO.getValue()); | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + @Override | ||
| 79 | + public void deleteProcessListener(Long id) { | ||
| 80 | + // 校验存在 | ||
| 81 | + validateProcessListenerExists(id); | ||
| 82 | + // 删除 | ||
| 83 | + processListenerMapper.deleteById(id); | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + private void validateProcessListenerExists(Long id) { | ||
| 87 | + if (processListenerMapper.selectById(id) == null) { | ||
| 88 | + throw exception(PROCESS_LISTENER_NOT_EXISTS); | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + @Override | ||
| 93 | + public BpmProcessListenerDO getProcessListener(Long id) { | ||
| 94 | + return processListenerMapper.selectById(id); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + @Override | ||
| 98 | + public PageResult<BpmProcessListenerDO> getProcessListenerPage(BpmProcessListenerPageReqVO pageReqVO) { | ||
| 99 | + return processListenerMapper.selectPage(pageReqVO); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | +} | ||
| 0 | \ No newline at end of file | 103 | \ No newline at end of file |