Commit d64555697f867a89c88365bc80c3b75c310a47ba
1 parent
b1d6baaa
工作流 Flowable 流程模型, 流程定义 优化
Showing
17 changed files
with
466 additions
and
261 deletions
yudao-module-bpm/yudao-module-bpm-impl-activiti/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmTaskAssignRuleController.http renamed to yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmTaskAssignRuleController.http
yudao-module-bpm/yudao-module-bpm-impl-activiti/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmTaskAssignRuleController.java renamed to yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmTaskAssignRuleController.java
| 1 | package cn.iocoder.yudao.module.bpm.controller.admin.definition; | 1 | package cn.iocoder.yudao.module.bpm.controller.admin.definition; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 3 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleCreateReqVO; | 4 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleCreateReqVO; |
| 4 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleRespVO; | 5 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleRespVO; |
| 5 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleUpdateReqVO; | 6 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleUpdateReqVO; |
| 6 | import cn.iocoder.yudao.module.bpm.service.definition.BpmTaskAssignRuleService; | 7 | import cn.iocoder.yudao.module.bpm.service.definition.BpmTaskAssignRuleService; |
| 7 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 8 | import io.swagger.annotations.Api; | 8 | import io.swagger.annotations.Api; |
| 9 | import io.swagger.annotations.ApiImplicitParam; | 9 | import io.swagger.annotations.ApiImplicitParam; |
| 10 | import io.swagger.annotations.ApiImplicitParams; | 10 | import io.swagger.annotations.ApiImplicitParams; |
| @@ -32,7 +32,7 @@ public class BpmTaskAssignRuleController { | @@ -32,7 +32,7 @@ public class BpmTaskAssignRuleController { | ||
| 32 | @ApiOperation(value = "获得任务分配规则列表") | 32 | @ApiOperation(value = "获得任务分配规则列表") |
| 33 | @ApiImplicitParams({ | 33 | @ApiImplicitParams({ |
| 34 | @ApiImplicitParam(name = "modelId", value = "模型编号", example = "1024", dataTypeClass = String.class), | 34 | @ApiImplicitParam(name = "modelId", value = "模型编号", example = "1024", dataTypeClass = String.class), |
| 35 | - @ApiImplicitParam(name = "processDefinitionId", value = "刘晨定义的编号", example = "2048", dataTypeClass = String.class) | 35 | + @ApiImplicitParam(name = "processDefinitionId", value = "流程定义的编号", example = "2048", dataTypeClass = String.class) |
| 36 | }) | 36 | }) |
| 37 | @PreAuthorize("@ss.hasPermission('bpm:task-assign-rule:query')") | 37 | @PreAuthorize("@ss.hasPermission('bpm:task-assign-rule:query')") |
| 38 | public CommonResult<List<BpmTaskAssignRuleRespVO>> getTaskAssignRuleList( | 38 | public CommonResult<List<BpmTaskAssignRuleRespVO>> getTaskAssignRuleList( |
yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmAbstractModelService.java deleted
| 1 | -package cn.iocoder.yudao.module.bpm.service.definition; | ||
| 2 | - | ||
| 3 | -import cn.hutool.core.collection.CollUtil; | ||
| 4 | -import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | ||
| 5 | -import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; | ||
| 6 | -import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleRespVO; | ||
| 7 | -import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO; | ||
| 8 | -import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum; | ||
| 9 | -import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmModelMetaInfoRespDTO; | ||
| 10 | - | ||
| 11 | -import java.util.List; | ||
| 12 | -import java.util.Objects; | ||
| 13 | - | ||
| 14 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 15 | -import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; | ||
| 16 | -/** | ||
| 17 | - * 流程模型通用抽象类 | ||
| 18 | - * Activiti 和 flowable 通用的流程模型抽象类, Activiti 和 flowable 两边通用的方法 | ||
| 19 | - * | ||
| 20 | - * @author yunlongn | ||
| 21 | - * @author jason | ||
| 22 | - */ | ||
| 23 | -public abstract class BpmAbstractModelService { | ||
| 24 | - | ||
| 25 | - protected final BpmFormService bpmFormService; | ||
| 26 | - | ||
| 27 | - protected final BpmTaskAssignRuleService taskAssignRuleService; | ||
| 28 | - | ||
| 29 | - public BpmAbstractModelService(BpmFormService bpmFormService,BpmTaskAssignRuleService taskAssignRuleService) { | ||
| 30 | - this.bpmFormService = bpmFormService; | ||
| 31 | - this.taskAssignRuleService = taskAssignRuleService; | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | - /** | ||
| 35 | - * 校验流程表单已配置 | ||
| 36 | - * | ||
| 37 | - * @param metaInfoStr 流程模型 metaInfo 字段 | ||
| 38 | - * @return 流程表单 | ||
| 39 | - */ | ||
| 40 | - protected BpmFormDO checkFormConfig(String metaInfoStr) { | ||
| 41 | - BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(metaInfoStr, BpmModelMetaInfoRespDTO.class); | ||
| 42 | - if (metaInfo == null || metaInfo.getFormType() == null) { | ||
| 43 | - throw exception(MODEL_DEPLOY_FAIL_FORM_NOT_CONFIG); | ||
| 44 | - } | ||
| 45 | - // 校验表单存在 | ||
| 46 | - if (Objects.equals(metaInfo.getFormType(), BpmModelFormTypeEnum.NORMAL.getType())) { | ||
| 47 | - BpmFormDO form = bpmFormService.getForm(metaInfo.getFormId()); | ||
| 48 | - if (form == null) { | ||
| 49 | - throw exception(FORM_NOT_EXISTS); | ||
| 50 | - } | ||
| 51 | - return form; | ||
| 52 | - } | ||
| 53 | - return null; | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - /** | ||
| 57 | - * 校验流程模型的任务分配规则全部都配置了 | ||
| 58 | - * 目的:如果有规则未配置,会导致流程任务找不到负责人,进而流程无法进行下去! | ||
| 59 | - * | ||
| 60 | - * @param id 流程模型编号 | ||
| 61 | - */ | ||
| 62 | - protected void checkTaskAssignRuleAllConfig(String id) { | ||
| 63 | - // 一个用户任务都没配置,所以无需配置规则 | ||
| 64 | - List<BpmTaskAssignRuleRespVO> taskAssignRules = taskAssignRuleService.getTaskAssignRuleList(id, null); | ||
| 65 | - if (CollUtil.isEmpty(taskAssignRules)) { | ||
| 66 | - return; | ||
| 67 | - } | ||
| 68 | - // 校验未配置规则的任务 | ||
| 69 | - taskAssignRules.forEach(rule -> { | ||
| 70 | - if (CollUtil.isEmpty(rule.getOptions())) { | ||
| 71 | - throw exception(MODEL_DEPLOY_FAIL_TASK_ASSIGN_RULE_NOT_CONFIG, rule.getTaskDefinitionName()); | ||
| 72 | - } | ||
| 73 | - }); | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - | ||
| 77 | - protected void checkKeyNCName(String key) { | ||
| 78 | - if (!ValidationUtils.isXmlNCName(key)) { | ||
| 79 | - throw exception(MODEL_KEY_VALID); | ||
| 80 | - } | ||
| 81 | - } | ||
| 82 | -} |
yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmFormService.java
| @@ -88,4 +88,12 @@ public interface BpmFormService { | @@ -88,4 +88,12 @@ public interface BpmFormService { | ||
| 88 | */ | 88 | */ |
| 89 | PageResult<BpmFormDO> getFormPage(BpmFormPageReqVO pageReqVO); | 89 | PageResult<BpmFormDO> getFormPage(BpmFormPageReqVO pageReqVO); |
| 90 | 90 | ||
| 91 | + /** | ||
| 92 | + * 校验流程表单已配置 | ||
| 93 | + * | ||
| 94 | + * @param configStr configStr 字段 | ||
| 95 | + * @return 流程表单 | ||
| 96 | + */ | ||
| 97 | + BpmFormDO checkFormConfig(String configStr); | ||
| 98 | + | ||
| 91 | } | 99 | } |
yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmFormServiceImpl.java
| 1 | package cn.iocoder.yudao.module.bpm.service.definition; | 1 | package cn.iocoder.yudao.module.bpm.service.definition; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.lang.Assert; | 3 | import cn.hutool.core.lang.Assert; |
| 4 | +import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; | ||
| 4 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormCreateReqVO; | 5 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormCreateReqVO; |
| 5 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormPageReqVO; | 6 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormPageReqVO; |
| 6 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormUpdateReqVO; | 7 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormUpdateReqVO; |
| @@ -8,18 +9,20 @@ import cn.iocoder.yudao.module.bpm.convert.definition.BpmFormConvert; | @@ -8,18 +9,20 @@ import cn.iocoder.yudao.module.bpm.convert.definition.BpmFormConvert; | ||
| 8 | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO; | 9 | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO; |
| 9 | import cn.iocoder.yudao.module.bpm.dal.mysql.definition.BpmFormMapper; | 10 | import cn.iocoder.yudao.module.bpm.dal.mysql.definition.BpmFormMapper; |
| 10 | import cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants; | 11 | import cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants; |
| 12 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum; | ||
| 11 | import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmFormFieldRespDTO; | 13 | import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmFormFieldRespDTO; |
| 12 | import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; | 14 | import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; |
| 13 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 15 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 14 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | 16 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 17 | +import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmModelMetaInfoRespDTO; | ||
| 15 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
| 16 | import org.springframework.validation.annotation.Validated; | 19 | import org.springframework.validation.annotation.Validated; |
| 17 | 20 | ||
| 18 | import javax.annotation.Resource; | 21 | import javax.annotation.Resource; |
| 19 | -import java.util.Collection; | ||
| 20 | -import java.util.HashMap; | ||
| 21 | -import java.util.List; | ||
| 22 | -import java.util.Map; | 22 | +import java.util.*; |
| 23 | + | ||
| 24 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 25 | +import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; | ||
| 23 | 26 | ||
| 24 | /** | 27 | /** |
| 25 | * 动态表单 Service 实现类 | 28 | * 动态表单 Service 实现类 |
| @@ -87,6 +90,29 @@ public class BpmFormServiceImpl implements BpmFormService { | @@ -87,6 +90,29 @@ public class BpmFormServiceImpl implements BpmFormService { | ||
| 87 | return formMapper.selectPage(pageReqVO); | 90 | return formMapper.selectPage(pageReqVO); |
| 88 | } | 91 | } |
| 89 | 92 | ||
| 93 | + | ||
| 94 | + @Override | ||
| 95 | + public BpmFormDO checkFormConfig(String configStr) { | ||
| 96 | + BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(configStr, BpmModelMetaInfoRespDTO.class); | ||
| 97 | + if (metaInfo == null || metaInfo.getFormType() == null) { | ||
| 98 | + throw exception(MODEL_DEPLOY_FAIL_FORM_NOT_CONFIG); | ||
| 99 | + } | ||
| 100 | + // 校验表单存在 | ||
| 101 | + if (Objects.equals(metaInfo.getFormType(), BpmModelFormTypeEnum.NORMAL.getType())) { | ||
| 102 | + BpmFormDO form = getForm(metaInfo.getFormId()); | ||
| 103 | + if (form == null) { | ||
| 104 | + throw exception(FORM_NOT_EXISTS); | ||
| 105 | + } | ||
| 106 | + return form; | ||
| 107 | + } | ||
| 108 | + return null; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + private void checkKeyNCName(String key) { | ||
| 112 | + if (!ValidationUtils.isXmlNCName(key)) { | ||
| 113 | + throw exception(MODEL_KEY_VALID); | ||
| 114 | + } | ||
| 115 | + } | ||
| 90 | /** | 116 | /** |
| 91 | * 校验 Field,避免 field 重复 | 117 | * 校验 Field,避免 field 重复 |
| 92 | * | 118 | * |
yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelCommonService.java deleted
| 1 | -package cn.iocoder.yudao.module.bpm.service.definition; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | -import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.*; | ||
| 5 | - | ||
| 6 | -import javax.validation.Valid; | ||
| 7 | - | ||
| 8 | -/** | ||
| 9 | - * 流程模型通用接口 | ||
| 10 | - * Activiti 和 flowable 通用的流程模型接口 | ||
| 11 | - * | ||
| 12 | - * @author yunlongn | ||
| 13 | - * @author jason | ||
| 14 | - */ | ||
| 15 | -public interface BpmModelCommonService { | ||
| 16 | - /** | ||
| 17 | - * 获得流程模型分页 | ||
| 18 | - * | ||
| 19 | - * @param pageVO 分页查询 | ||
| 20 | - * @return 流程模型分页 | ||
| 21 | - */ | ||
| 22 | - PageResult<BpmModelPageItemRespVO> getModelPage(BpmModelPageReqVO pageVO); | ||
| 23 | - | ||
| 24 | - /** | ||
| 25 | - * 创建流程模型 | ||
| 26 | - * | ||
| 27 | - * @param modelVO 创建信息 | ||
| 28 | - * @param bpmnXml BPMN XML | ||
| 29 | - * @return 创建的流程模型的编号 | ||
| 30 | - */ | ||
| 31 | - String createModel(@Valid BpmModelCreateReqVO modelVO, String bpmnXml); | ||
| 32 | - | ||
| 33 | - /** | ||
| 34 | - * 获得流程模块 | ||
| 35 | - * | ||
| 36 | - * @param id 编号 | ||
| 37 | - * @return 流程模型 | ||
| 38 | - */ | ||
| 39 | - BpmModelRespVO getModel(String id); | ||
| 40 | - | ||
| 41 | - /** | ||
| 42 | - * 修改流程模型 | ||
| 43 | - * | ||
| 44 | - * @param updateReqVO 更新信息 | ||
| 45 | - */ | ||
| 46 | - void updateModel(@Valid BpmModelUpdateReqVO updateReqVO); | ||
| 47 | - | ||
| 48 | - /** | ||
| 49 | - * 将流程模型,部署成一个流程定义 | ||
| 50 | - * | ||
| 51 | - * @param id 编号 | ||
| 52 | - */ | ||
| 53 | - void deployModel(String id); | ||
| 54 | - | ||
| 55 | - /** | ||
| 56 | - * 删除模型 | ||
| 57 | - * | ||
| 58 | - * @param id 编号 | ||
| 59 | - */ | ||
| 60 | - void deleteModel(String id); | ||
| 61 | - | ||
| 62 | - /** | ||
| 63 | - * 修改模型的状态,实际更新的部署的流程定义的状态 | ||
| 64 | - * | ||
| 65 | - * @param id 编号 | ||
| 66 | - * @param state 状态 | ||
| 67 | - */ | ||
| 68 | - void updateModelState(String id, Integer state); | ||
| 69 | -} |
yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmProcessDefinitionCommonService.java deleted
| 1 | -package cn.iocoder.yudao.module.bpm.service.definition; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | -import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionPageItemRespVO; | ||
| 5 | -import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionPageReqVO; | ||
| 6 | -import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionExtDO; | ||
| 7 | -import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmProcessDefinitionCreateReqDTO; | ||
| 8 | - | ||
| 9 | -import javax.validation.Valid; | ||
| 10 | - | ||
| 11 | -/** | ||
| 12 | - * 流程定义通用接口 | ||
| 13 | - * Activiti 和 flowable 通用的流程定义接口 | ||
| 14 | - * | ||
| 15 | - * @author yunlong.li | ||
| 16 | - * @author ZJQ | ||
| 17 | - * @author 芋道源码 | ||
| 18 | - * @author jason | ||
| 19 | - */ | ||
| 20 | -public interface BpmProcessDefinitionCommonService { | ||
| 21 | - | ||
| 22 | - /** | ||
| 23 | - * 获得流程定义分页 | ||
| 24 | - * | ||
| 25 | - * @param pageReqVO 分页入参 | ||
| 26 | - * @return 流程定义 Page | ||
| 27 | - */ | ||
| 28 | - PageResult<BpmProcessDefinitionPageItemRespVO> getProcessDefinitionPage(BpmProcessDefinitionPageReqVO pageReqVO); | ||
| 29 | - | ||
| 30 | - /** | ||
| 31 | - * 创建流程定义 | ||
| 32 | - * | ||
| 33 | - * @param createReqDTO 创建信息 | ||
| 34 | - * @return 流程编号 | ||
| 35 | - */ | ||
| 36 | - String createProcessDefinition(@Valid BpmProcessDefinitionCreateReqDTO createReqDTO); | ||
| 37 | - | ||
| 38 | - /** | ||
| 39 | - * 更新流程定义状态 | ||
| 40 | - * | ||
| 41 | - * @param id 流程定义的编号 | ||
| 42 | - * @param state 状态 | ||
| 43 | - */ | ||
| 44 | - void updateProcessDefinitionState(String id, Integer state); | ||
| 45 | - | ||
| 46 | - /** | ||
| 47 | - * 获得流程定义对应的 BPMN XML | ||
| 48 | - * | ||
| 49 | - * @param id 流程定义编号 | ||
| 50 | - * @return BPMN XML | ||
| 51 | - */ | ||
| 52 | - String getProcessDefinitionBpmnXML(String id); | ||
| 53 | - | ||
| 54 | - /** | ||
| 55 | - * 获得需要创建的流程定义,是否和当前激活的流程定义相等 | ||
| 56 | - * | ||
| 57 | - * @param createReqDTO 创建信息 | ||
| 58 | - * @return 是否相等 | ||
| 59 | - */ | ||
| 60 | - boolean isProcessDefinitionEquals(@Valid BpmProcessDefinitionCreateReqDTO createReqDTO); | ||
| 61 | - | ||
| 62 | - /** | ||
| 63 | - * 获得编号对应的 BpmProcessDefinitionExtDO | ||
| 64 | - * | ||
| 65 | - * @param id 编号 | ||
| 66 | - * @return 流程定义拓展 | ||
| 67 | - */ | ||
| 68 | - BpmProcessDefinitionExtDO getProcessDefinitionExt(String id); | ||
| 69 | -} |
yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmTaskAssignRuleService.java
| @@ -76,4 +76,12 @@ public interface BpmTaskAssignRuleService { | @@ -76,4 +76,12 @@ public interface BpmTaskAssignRuleService { | ||
| 76 | */ | 76 | */ |
| 77 | void copyTaskAssignRules(String fromModelId, String toProcessDefinitionId); | 77 | void copyTaskAssignRules(String fromModelId, String toProcessDefinitionId); |
| 78 | 78 | ||
| 79 | + /** | ||
| 80 | + * 校验流程模型的任务分配规则全部都配置了 | ||
| 81 | + * 目的:如果有规则未配置,会导致流程任务找不到负责人,进而流程无法进行下去! | ||
| 82 | + * | ||
| 83 | + * @param id 流程模型编号 | ||
| 84 | + */ | ||
| 85 | + void checkTaskAssignRuleAllConfig(String id); | ||
| 86 | + | ||
| 79 | } | 87 | } |
yudao-module-bpm/yudao-module-bpm-impl-activiti/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelService.java
| @@ -11,7 +11,60 @@ import javax.validation.Valid; | @@ -11,7 +11,60 @@ import javax.validation.Valid; | ||
| 11 | * | 11 | * |
| 12 | * @author yunlongn | 12 | * @author yunlongn |
| 13 | */ | 13 | */ |
| 14 | -public interface BpmModelService extends BpmModelCommonService { | 14 | +public interface BpmModelService { |
| 15 | + /** | ||
| 16 | + * 获得流程模型分页 | ||
| 17 | + * | ||
| 18 | + * @param pageVO 分页查询 | ||
| 19 | + * @return 流程模型分页 | ||
| 20 | + */ | ||
| 21 | + PageResult<BpmModelPageItemRespVO> getModelPage(BpmModelPageReqVO pageVO); | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 创建流程模型 | ||
| 25 | + * | ||
| 26 | + * @param modelVO 创建信息 | ||
| 27 | + * @param bpmnXml BPMN XML | ||
| 28 | + * @return 创建的流程模型的编号 | ||
| 29 | + */ | ||
| 30 | + String createModel(@Valid BpmModelCreateReqVO modelVO, String bpmnXml); | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 获得流程模块 | ||
| 34 | + * | ||
| 35 | + * @param id 编号 | ||
| 36 | + * @return 流程模型 | ||
| 37 | + */ | ||
| 38 | + BpmModelRespVO getModel(String id); | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 修改流程模型 | ||
| 42 | + * | ||
| 43 | + * @param updateReqVO 更新信息 | ||
| 44 | + */ | ||
| 45 | + void updateModel(@Valid BpmModelUpdateReqVO updateReqVO); | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 将流程模型,部署成一个流程定义 | ||
| 49 | + * | ||
| 50 | + * @param id 编号 | ||
| 51 | + */ | ||
| 52 | + void deployModel(String id); | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 删除模型 | ||
| 56 | + * | ||
| 57 | + * @param id 编号 | ||
| 58 | + */ | ||
| 59 | + void deleteModel(String id); | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 修改模型的状态,实际更新的部署的流程定义的状态 | ||
| 63 | + * | ||
| 64 | + * @param id 编号 | ||
| 65 | + * @param state 状态 | ||
| 66 | + */ | ||
| 67 | + void updateModelState(String id, Integer state); | ||
| 15 | 68 | ||
| 16 | /** | 69 | /** |
| 17 | * 获得流程模型编号对应的 BPMN Model | 70 | * 获得流程模型编号对应的 BPMN Model |
yudao-module-bpm/yudao-module-bpm-impl-activiti/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelServiceImpl.java
| @@ -3,8 +3,10 @@ package cn.iocoder.yudao.module.bpm.service.definition; | @@ -3,8 +3,10 @@ package cn.iocoder.yudao.module.bpm.service.definition; | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | import cn.hutool.core.util.ArrayUtil; | 4 | import cn.hutool.core.util.ArrayUtil; |
| 5 | import cn.hutool.core.util.StrUtil; | 5 | import cn.hutool.core.util.StrUtil; |
| 6 | +import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; | ||
| 6 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.*; | 7 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.*; |
| 7 | import cn.iocoder.yudao.module.bpm.convert.definition.BpmModelConvert; | 8 | import cn.iocoder.yudao.module.bpm.convert.definition.BpmModelConvert; |
| 9 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum; | ||
| 8 | import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmModelMetaInfoRespDTO; | 10 | import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmModelMetaInfoRespDTO; |
| 9 | import cn.iocoder.yudao.framework.activiti.core.util.ActivitiUtils; | 11 | import cn.iocoder.yudao.framework.activiti.core.util.ActivitiUtils; |
| 10 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 12 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| @@ -45,17 +47,16 @@ import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; | @@ -45,17 +47,16 @@ import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; | ||
| 45 | @Service | 47 | @Service |
| 46 | @Validated | 48 | @Validated |
| 47 | @Slf4j | 49 | @Slf4j |
| 48 | -public class BpmModelServiceImpl extends BpmAbstractModelService implements BpmModelService { | 50 | +public class BpmModelServiceImpl implements BpmModelService { |
| 49 | 51 | ||
| 50 | @Resource | 52 | @Resource |
| 51 | private RepositoryService repositoryService; | 53 | private RepositoryService repositoryService; |
| 52 | - | ||
| 53 | @Resource | 54 | @Resource |
| 54 | private BpmProcessDefinitionService processDefinitionService; | 55 | private BpmProcessDefinitionService processDefinitionService; |
| 55 | - | ||
| 56 | - public BpmModelServiceImpl(BpmFormService bpmFormService,BpmTaskAssignRuleService taskAssignRuleService) { | ||
| 57 | - super(bpmFormService, taskAssignRuleService); | ||
| 58 | - } | 56 | + @Resource |
| 57 | + private BpmFormService bpmFormService; | ||
| 58 | + @Resource | ||
| 59 | + private BpmTaskAssignRuleService taskAssignRuleService; | ||
| 59 | 60 | ||
| 60 | @Override | 61 | @Override |
| 61 | public PageResult<BpmModelPageItemRespVO> getModelPage(BpmModelPageReqVO pageVO) { | 62 | public PageResult<BpmModelPageItemRespVO> getModelPage(BpmModelPageReqVO pageVO) { |
| @@ -167,7 +168,7 @@ public class BpmModelServiceImpl extends BpmAbstractModelService implements BpmM | @@ -167,7 +168,7 @@ public class BpmModelServiceImpl extends BpmAbstractModelService implements BpmM | ||
| 167 | // 校验表单已配 | 168 | // 校验表单已配 |
| 168 | BpmFormDO form = checkFormConfig(model.getMetaInfo()); | 169 | BpmFormDO form = checkFormConfig(model.getMetaInfo()); |
| 169 | // 校验任务分配规则已配置 | 170 | // 校验任务分配规则已配置 |
| 170 | - checkTaskAssignRuleAllConfig(id); | 171 | + taskAssignRuleService.checkTaskAssignRuleAllConfig(id); |
| 171 | 172 | ||
| 172 | // 校验模型是否发生修改。如果未修改,则不允许创建 | 173 | // 校验模型是否发生修改。如果未修改,则不允许创建 |
| 173 | BpmProcessDefinitionCreateReqDTO definitionCreateReqDTO = BpmModelConvert.INSTANCE.convert2(model, form).setBpmnBytes(bpmnBytes); | 174 | BpmProcessDefinitionCreateReqDTO definitionCreateReqDTO = BpmModelConvert.INSTANCE.convert2(model, form).setBpmnBytes(bpmnBytes); |
| @@ -247,4 +248,32 @@ public class BpmModelServiceImpl extends BpmAbstractModelService implements BpmM | @@ -247,4 +248,32 @@ public class BpmModelServiceImpl extends BpmAbstractModelService implements BpmM | ||
| 247 | return repositoryService.createModelQuery().modelKey(key).singleResult(); | 248 | return repositoryService.createModelQuery().modelKey(key).singleResult(); |
| 248 | } | 249 | } |
| 249 | 250 | ||
| 251 | + private void checkKeyNCName(String key) { | ||
| 252 | + if (!ValidationUtils.isXmlNCName(key)) { | ||
| 253 | + throw exception(MODEL_KEY_VALID); | ||
| 254 | + } | ||
| 255 | + } | ||
| 256 | + | ||
| 257 | + /** | ||
| 258 | + * 校验流程表单已配置 | ||
| 259 | + * | ||
| 260 | + * @param metaInfoStr 流程模型 metaInfo 字段 | ||
| 261 | + * @return 流程表单 | ||
| 262 | + */ | ||
| 263 | + private BpmFormDO checkFormConfig(String metaInfoStr) { | ||
| 264 | + BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(metaInfoStr, BpmModelMetaInfoRespDTO.class); | ||
| 265 | + if (metaInfo == null || metaInfo.getFormType() == null) { | ||
| 266 | + throw exception(MODEL_DEPLOY_FAIL_FORM_NOT_CONFIG); | ||
| 267 | + } | ||
| 268 | + // 校验表单存在 | ||
| 269 | + if (Objects.equals(metaInfo.getFormType(), BpmModelFormTypeEnum.NORMAL.getType())) { | ||
| 270 | + BpmFormDO form = bpmFormService.getForm(metaInfo.getFormId()); | ||
| 271 | + if (form == null) { | ||
| 272 | + throw exception(FORM_NOT_EXISTS); | ||
| 273 | + } | ||
| 274 | + return form; | ||
| 275 | + } | ||
| 276 | + return null; | ||
| 277 | + } | ||
| 278 | + | ||
| 250 | } | 279 | } |
yudao-module-bpm/yudao-module-bpm-impl-activiti/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmProcessDefinitionService.java
| @@ -24,7 +24,55 @@ import java.util.Set; | @@ -24,7 +24,55 @@ import java.util.Set; | ||
| 24 | * @author ZJQ | 24 | * @author ZJQ |
| 25 | * @author 芋道源码 | 25 | * @author 芋道源码 |
| 26 | */ | 26 | */ |
| 27 | -public interface BpmProcessDefinitionService extends BpmProcessDefinitionCommonService { | 27 | +public interface BpmProcessDefinitionService { |
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 获得流程定义分页 | ||
| 31 | + * | ||
| 32 | + * @param pageReqVO 分页入参 | ||
| 33 | + * @return 流程定义 Page | ||
| 34 | + */ | ||
| 35 | + PageResult<BpmProcessDefinitionPageItemRespVO> getProcessDefinitionPage(BpmProcessDefinitionPageReqVO pageReqVO); | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 创建流程定义 | ||
| 39 | + * | ||
| 40 | + * @param createReqDTO 创建信息 | ||
| 41 | + * @return 流程编号 | ||
| 42 | + */ | ||
| 43 | + String createProcessDefinition(@Valid BpmProcessDefinitionCreateReqDTO createReqDTO); | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 更新流程定义状态 | ||
| 47 | + * | ||
| 48 | + * @param id 流程定义的编号 | ||
| 49 | + * @param state 状态 | ||
| 50 | + */ | ||
| 51 | + void updateProcessDefinitionState(String id, Integer state); | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 获得流程定义对应的 BPMN XML | ||
| 55 | + * | ||
| 56 | + * @param id 流程定义编号 | ||
| 57 | + * @return BPMN XML | ||
| 58 | + */ | ||
| 59 | + String getProcessDefinitionBpmnXML(String id); | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 获得需要创建的流程定义,是否和当前激活的流程定义相等 | ||
| 63 | + * | ||
| 64 | + * @param createReqDTO 创建信息 | ||
| 65 | + * @return 是否相等 | ||
| 66 | + */ | ||
| 67 | + boolean isProcessDefinitionEquals(@Valid BpmProcessDefinitionCreateReqDTO createReqDTO); | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * 获得编号对应的 BpmProcessDefinitionExtDO | ||
| 71 | + * | ||
| 72 | + * @param id 编号 | ||
| 73 | + * @return 流程定义拓展 | ||
| 74 | + */ | ||
| 75 | + BpmProcessDefinitionExtDO getProcessDefinitionExt(String id); | ||
| 28 | 76 | ||
| 29 | /** | 77 | /** |
| 30 | * 获得流程定义列表 | 78 | * 获得流程定义列表 |
yudao-module-bpm/yudao-module-bpm-impl-activiti/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmTaskAssignRuleServiceImpl.java
| @@ -173,6 +173,21 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService { | @@ -173,6 +173,21 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService { | ||
| 173 | taskRuleMapper.insertBatch(newRules); | 173 | taskRuleMapper.insertBatch(newRules); |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | + @Override | ||
| 177 | + public void checkTaskAssignRuleAllConfig(String id) { | ||
| 178 | + // 一个用户任务都没配置,所以无需配置规则 | ||
| 179 | + List<BpmTaskAssignRuleRespVO> taskAssignRules = getTaskAssignRuleList(id, null); | ||
| 180 | + if (CollUtil.isEmpty(taskAssignRules)) { | ||
| 181 | + return; | ||
| 182 | + } | ||
| 183 | + // 校验未配置规则的任务 | ||
| 184 | + taskAssignRules.forEach(rule -> { | ||
| 185 | + if (CollUtil.isEmpty(rule.getOptions())) { | ||
| 186 | + throw exception(MODEL_DEPLOY_FAIL_TASK_ASSIGN_RULE_NOT_CONFIG, rule.getTaskDefinitionName()); | ||
| 187 | + } | ||
| 188 | + }); | ||
| 189 | + } | ||
| 190 | + | ||
| 176 | private void validTaskAssignRuleOptions(Integer type, Set<Long> options) { | 191 | private void validTaskAssignRuleOptions(Integer type, Set<Long> options) { |
| 177 | if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.ROLE.getType())) { | 192 | if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.ROLE.getType())) { |
| 178 | roleApi.validRoles(options); | 193 | roleApi.validRoles(options); |
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmTaskAssignRuleConvert.java
| 1 | package cn.iocoder.yudao.module.bpm.convert.definition; | 1 | package cn.iocoder.yudao.module.bpm.convert.definition; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 3 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 4 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleCreateReqVO; | ||
| 4 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleRespVO; | 5 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleRespVO; |
| 6 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleUpdateReqVO; | ||
| 5 | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmTaskAssignRuleDO; | 7 | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmTaskAssignRuleDO; |
| 6 | import org.flowable.bpmn.model.UserTask; | 8 | import org.flowable.bpmn.model.UserTask; |
| 7 | import org.mapstruct.Mapper; | 9 | import org.mapstruct.Mapper; |
| @@ -29,4 +31,10 @@ public interface BpmTaskAssignRuleConvert { | @@ -29,4 +31,10 @@ public interface BpmTaskAssignRuleConvert { | ||
| 29 | } | 31 | } |
| 30 | 32 | ||
| 31 | BpmTaskAssignRuleRespVO convert(BpmTaskAssignRuleDO bean); | 33 | BpmTaskAssignRuleRespVO convert(BpmTaskAssignRuleDO bean); |
| 34 | + | ||
| 35 | + BpmTaskAssignRuleDO convert(BpmTaskAssignRuleCreateReqVO bean); | ||
| 36 | + | ||
| 37 | + BpmTaskAssignRuleDO convert(BpmTaskAssignRuleUpdateReqVO bean); | ||
| 38 | + | ||
| 39 | + List<BpmTaskAssignRuleDO> convertList2(List<BpmTaskAssignRuleRespVO> list); | ||
| 32 | } | 40 | } |
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelService.java
| 1 | package cn.iocoder.yudao.module.bpm.service.definition; | 1 | package cn.iocoder.yudao.module.bpm.service.definition; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.*; | ||
| 3 | import org.flowable.bpmn.model.BpmnModel; | 5 | import org.flowable.bpmn.model.BpmnModel; |
| 4 | 6 | ||
| 7 | +import javax.validation.Valid; | ||
| 8 | + | ||
| 5 | /** | 9 | /** |
| 6 | * Flowable流程模型接口 | 10 | * Flowable流程模型接口 |
| 7 | * | 11 | * |
| 8 | * @author yunlongn | 12 | * @author yunlongn |
| 9 | */ | 13 | */ |
| 10 | -public interface BpmModelService extends BpmModelCommonService { | 14 | +public interface BpmModelService { |
| 15 | + /** | ||
| 16 | + * 获得流程模型分页 | ||
| 17 | + * | ||
| 18 | + * @param pageVO 分页查询 | ||
| 19 | + * @return 流程模型分页 | ||
| 20 | + */ | ||
| 21 | + PageResult<BpmModelPageItemRespVO> getModelPage(BpmModelPageReqVO pageVO); | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 创建流程模型 | ||
| 25 | + * | ||
| 26 | + * @param modelVO 创建信息 | ||
| 27 | + * @param bpmnXml BPMN XML | ||
| 28 | + * @return 创建的流程模型的编号 | ||
| 29 | + */ | ||
| 30 | + String createModel(@Valid BpmModelCreateReqVO modelVO, String bpmnXml); | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 获得流程模块 | ||
| 34 | + * | ||
| 35 | + * @param id 编号 | ||
| 36 | + * @return 流程模型 | ||
| 37 | + */ | ||
| 38 | + BpmModelRespVO getModel(String id); | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 修改流程模型 | ||
| 42 | + * | ||
| 43 | + * @param updateReqVO 更新信息 | ||
| 44 | + */ | ||
| 45 | + void updateModel(@Valid BpmModelUpdateReqVO updateReqVO); | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 将流程模型,部署成一个流程定义 | ||
| 49 | + * | ||
| 50 | + * @param id 编号 | ||
| 51 | + */ | ||
| 52 | + void deployModel(String id); | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 删除模型 | ||
| 56 | + * | ||
| 57 | + * @param id 编号 | ||
| 58 | + */ | ||
| 59 | + void deleteModel(String id); | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 修改模型的状态,实际更新的部署的流程定义的状态 | ||
| 63 | + * | ||
| 64 | + * @param id 编号 | ||
| 65 | + * @param state 状态 | ||
| 66 | + */ | ||
| 67 | + void updateModelState(String id, Integer state); | ||
| 11 | 68 | ||
| 12 | /** | 69 | /** |
| 13 | * 获得流程模型编号对应的 BPMN Model | 70 | * 获得流程模型编号对应的 BPMN Model |
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelServiceImpl.java
| @@ -6,9 +6,11 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | @@ -6,9 +6,11 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 6 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 7 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | 7 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 8 | import cn.iocoder.yudao.framework.common.util.object.PageUtils; | 8 | import cn.iocoder.yudao.framework.common.util.object.PageUtils; |
| 9 | +import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; | ||
| 9 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.*; | 10 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.*; |
| 10 | import cn.iocoder.yudao.module.bpm.convert.definition.BpmModelConvert; | 11 | import cn.iocoder.yudao.module.bpm.convert.definition.BpmModelConvert; |
| 11 | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO; | 12 | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO; |
| 13 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum; | ||
| 12 | import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmModelMetaInfoRespDTO; | 14 | import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmModelMetaInfoRespDTO; |
| 13 | import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmProcessDefinitionCreateReqDTO; | 15 | import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmProcessDefinitionCreateReqDTO; |
| 14 | import lombok.extern.slf4j.Slf4j; | 16 | import lombok.extern.slf4j.Slf4j; |
| @@ -45,16 +47,16 @@ import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; | @@ -45,16 +47,16 @@ import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; | ||
| 45 | @Service | 47 | @Service |
| 46 | @Validated | 48 | @Validated |
| 47 | @Slf4j | 49 | @Slf4j |
| 48 | -public class BpmModelServiceImpl extends BpmAbstractModelService implements BpmModelService { | 50 | +public class BpmModelServiceImpl implements BpmModelService { |
| 49 | 51 | ||
| 50 | @Resource | 52 | @Resource |
| 51 | private RepositoryService repositoryService; | 53 | private RepositoryService repositoryService; |
| 52 | @Resource | 54 | @Resource |
| 53 | private BpmProcessDefinitionService processDefinitionService; | 55 | private BpmProcessDefinitionService processDefinitionService; |
| 54 | - | ||
| 55 | - public BpmModelServiceImpl(BpmFormService bpmFormService, BpmTaskAssignRuleService taskAssignRuleService){ | ||
| 56 | - super(bpmFormService, taskAssignRuleService); | ||
| 57 | - } | 56 | + @Resource |
| 57 | + private BpmFormService bpmFormService; | ||
| 58 | + @Resource | ||
| 59 | + private BpmTaskAssignRuleService taskAssignRuleService; | ||
| 58 | 60 | ||
| 59 | @Override | 61 | @Override |
| 60 | public PageResult<BpmModelPageItemRespVO> getModelPage(BpmModelPageReqVO pageVO) { | 62 | public PageResult<BpmModelPageItemRespVO> getModelPage(BpmModelPageReqVO pageVO) { |
| @@ -161,7 +163,7 @@ public class BpmModelServiceImpl extends BpmAbstractModelService implements BpmM | @@ -161,7 +163,7 @@ public class BpmModelServiceImpl extends BpmAbstractModelService implements BpmM | ||
| 161 | // 校验表单已配 | 163 | // 校验表单已配 |
| 162 | BpmFormDO form = checkFormConfig(model.getMetaInfo()); | 164 | BpmFormDO form = checkFormConfig(model.getMetaInfo()); |
| 163 | //校验任务分配规则已配置 | 165 | //校验任务分配规则已配置 |
| 164 | - checkTaskAssignRuleAllConfig(id); | 166 | + taskAssignRuleService.checkTaskAssignRuleAllConfig(id); |
| 165 | 167 | ||
| 166 | BpmProcessDefinitionCreateReqDTO definitionCreateReqDTO = BpmModelConvert.INSTANCE.convert2(model, form).setBpmnBytes(bpmnBytes); | 168 | BpmProcessDefinitionCreateReqDTO definitionCreateReqDTO = BpmModelConvert.INSTANCE.convert2(model, form).setBpmnBytes(bpmnBytes); |
| 167 | //校验模型是否发生修改。如果未修改,则不允许创建 | 169 | //校验模型是否发生修改。如果未修改,则不允许创建 |
| @@ -182,8 +184,8 @@ public class BpmModelServiceImpl extends BpmAbstractModelService implements BpmM | @@ -182,8 +184,8 @@ public class BpmModelServiceImpl extends BpmAbstractModelService implements BpmM | ||
| 182 | model.setDeploymentId(definition.getDeploymentId()); | 184 | model.setDeploymentId(definition.getDeploymentId()); |
| 183 | repositoryService.saveModel(model); | 185 | repositoryService.saveModel(model); |
| 184 | 186 | ||
| 185 | - //TODO 复制任务分配规则 | ||
| 186 | - //taskAssignRuleService.copyTaskAssignRules(id, definition.getId()); | 187 | + //复制任务分配规则 |
| 188 | + taskAssignRuleService.copyTaskAssignRules(id, definition.getId()); | ||
| 187 | } | 189 | } |
| 188 | 190 | ||
| 189 | 191 | ||
| @@ -218,6 +220,44 @@ public class BpmModelServiceImpl extends BpmAbstractModelService implements BpmM | @@ -218,6 +220,44 @@ public class BpmModelServiceImpl extends BpmAbstractModelService implements BpmM | ||
| 218 | processDefinitionService.updateProcessDefinitionState(definition.getId(), state); | 220 | processDefinitionService.updateProcessDefinitionState(definition.getId(), state); |
| 219 | } | 221 | } |
| 220 | 222 | ||
| 223 | + @Override | ||
| 224 | + public BpmnModel getBpmnModel(String id) { | ||
| 225 | + byte[] bpmnBytes = repositoryService.getModelEditorSource(id); | ||
| 226 | + if (ArrayUtil.isEmpty(bpmnBytes)) { | ||
| 227 | + return null; | ||
| 228 | + } | ||
| 229 | + BpmnXMLConverter converter = new BpmnXMLConverter(); | ||
| 230 | + return converter.convertToBpmnModel(new BytesStreamSource(bpmnBytes), true, true); | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + private void checkKeyNCName(String key) { | ||
| 234 | + if (!ValidationUtils.isXmlNCName(key)) { | ||
| 235 | + throw exception(MODEL_KEY_VALID); | ||
| 236 | + } | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + /** | ||
| 240 | + * 校验流程表单已配置 | ||
| 241 | + * | ||
| 242 | + * @param metaInfoStr 流程模型 metaInfo 字段 | ||
| 243 | + * @return 流程表单 | ||
| 244 | + */ | ||
| 245 | + private BpmFormDO checkFormConfig(String metaInfoStr) { | ||
| 246 | + BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(metaInfoStr, BpmModelMetaInfoRespDTO.class); | ||
| 247 | + if (metaInfo == null || metaInfo.getFormType() == null) { | ||
| 248 | + throw exception(MODEL_DEPLOY_FAIL_FORM_NOT_CONFIG); | ||
| 249 | + } | ||
| 250 | + // 校验表单存在 | ||
| 251 | + if (Objects.equals(metaInfo.getFormType(), BpmModelFormTypeEnum.NORMAL.getType())) { | ||
| 252 | + BpmFormDO form = bpmFormService.getForm(metaInfo.getFormId()); | ||
| 253 | + if (form == null) { | ||
| 254 | + throw exception(FORM_NOT_EXISTS); | ||
| 255 | + } | ||
| 256 | + return form; | ||
| 257 | + } | ||
| 258 | + return null; | ||
| 259 | + } | ||
| 260 | + | ||
| 221 | private void saveModelBpmnXml(Model model, String bpmnXml) { | 261 | private void saveModelBpmnXml(Model model, String bpmnXml) { |
| 222 | if (StrUtil.isEmpty(bpmnXml)) { | 262 | if (StrUtil.isEmpty(bpmnXml)) { |
| 223 | return; | 263 | return; |
| @@ -240,13 +280,5 @@ public class BpmModelServiceImpl extends BpmAbstractModelService implements BpmM | @@ -240,13 +280,5 @@ public class BpmModelServiceImpl extends BpmAbstractModelService implements BpmM | ||
| 240 | processDefinitionService.updateProcessDefinitionState(oldDefinition.getId(), SuspensionState.SUSPENDED.getStateCode()); | 280 | processDefinitionService.updateProcessDefinitionState(oldDefinition.getId(), SuspensionState.SUSPENDED.getStateCode()); |
| 241 | } | 281 | } |
| 242 | 282 | ||
| 243 | - @Override | ||
| 244 | - public BpmnModel getBpmnModel(String id) { | ||
| 245 | - byte[] bpmnBytes = repositoryService.getModelEditorSource(id); | ||
| 246 | - if (ArrayUtil.isEmpty(bpmnBytes)) { | ||
| 247 | - return null; | ||
| 248 | - } | ||
| 249 | - BpmnXMLConverter converter = new BpmnXMLConverter(); | ||
| 250 | - return converter.convertToBpmnModel(new BytesStreamSource(bpmnBytes), true, true); | ||
| 251 | - } | 283 | + |
| 252 | } | 284 | } |
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmProcessDefinitionService.java
| 1 | package cn.iocoder.yudao.module.bpm.service.definition; | 1 | package cn.iocoder.yudao.module.bpm.service.definition; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 3 | 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.definition.vo.process.BpmProcessDefinitionPageItemRespVO; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionExtDO; | ||
| 8 | +import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmProcessDefinitionCreateReqDTO; | ||
| 4 | import org.flowable.bpmn.model.BpmnModel; | 9 | import org.flowable.bpmn.model.BpmnModel; |
| 5 | import org.flowable.engine.repository.Deployment; | 10 | import org.flowable.engine.repository.Deployment; |
| 6 | import org.flowable.engine.repository.ProcessDefinition; | 11 | import org.flowable.engine.repository.ProcessDefinition; |
| 7 | 12 | ||
| 13 | +import javax.validation.Valid; | ||
| 8 | import java.util.List; | 14 | import java.util.List; |
| 9 | import java.util.Map; | 15 | import java.util.Map; |
| 10 | import java.util.Set; | 16 | import java.util.Set; |
| @@ -15,7 +21,55 @@ import java.util.Set; | @@ -15,7 +21,55 @@ import java.util.Set; | ||
| 15 | * @author ZJQ | 21 | * @author ZJQ |
| 16 | * @author 芋道源码 | 22 | * @author 芋道源码 |
| 17 | */ | 23 | */ |
| 18 | -public interface BpmProcessDefinitionService extends BpmProcessDefinitionCommonService { | 24 | +public interface BpmProcessDefinitionService { |
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 获得流程定义分页 | ||
| 28 | + * | ||
| 29 | + * @param pageReqVO 分页入参 | ||
| 30 | + * @return 流程定义 Page | ||
| 31 | + */ | ||
| 32 | + PageResult<BpmProcessDefinitionPageItemRespVO> getProcessDefinitionPage(BpmProcessDefinitionPageReqVO pageReqVO); | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 创建流程定义 | ||
| 36 | + * | ||
| 37 | + * @param createReqDTO 创建信息 | ||
| 38 | + * @return 流程编号 | ||
| 39 | + */ | ||
| 40 | + String createProcessDefinition(@Valid BpmProcessDefinitionCreateReqDTO createReqDTO); | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 更新流程定义状态 | ||
| 44 | + * | ||
| 45 | + * @param id 流程定义的编号 | ||
| 46 | + * @param state 状态 | ||
| 47 | + */ | ||
| 48 | + void updateProcessDefinitionState(String id, Integer state); | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * 获得流程定义对应的 BPMN XML | ||
| 52 | + * | ||
| 53 | + * @param id 流程定义编号 | ||
| 54 | + * @return BPMN XML | ||
| 55 | + */ | ||
| 56 | + String getProcessDefinitionBpmnXML(String id); | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * 获得需要创建的流程定义,是否和当前激活的流程定义相等 | ||
| 60 | + * | ||
| 61 | + * @param createReqDTO 创建信息 | ||
| 62 | + * @return 是否相等 | ||
| 63 | + */ | ||
| 64 | + boolean isProcessDefinitionEquals(@Valid BpmProcessDefinitionCreateReqDTO createReqDTO); | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * 获得编号对应的 BpmProcessDefinitionExtDO | ||
| 68 | + * | ||
| 69 | + * @param id 编号 | ||
| 70 | + * @return 流程定义拓展 | ||
| 71 | + */ | ||
| 72 | + BpmProcessDefinitionExtDO getProcessDefinitionExt(String id); | ||
| 19 | 73 | ||
| 20 | /** | 74 | /** |
| 21 | * 获得编号对应的 ProcessDefinition | 75 | * 获得编号对应的 ProcessDefinition |
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmTaskAssignRuleServiceImpl.java
| @@ -4,12 +4,20 @@ import cn.hutool.core.collection.CollUtil; | @@ -4,12 +4,20 @@ import cn.hutool.core.collection.CollUtil; | ||
| 4 | import cn.hutool.core.util.ObjectUtil; | 4 | import cn.hutool.core.util.ObjectUtil; |
| 5 | import cn.hutool.core.util.StrUtil; | 5 | import cn.hutool.core.util.StrUtil; |
| 6 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 6 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 7 | +import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | ||
| 7 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleCreateReqVO; | 8 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleCreateReqVO; |
| 8 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleRespVO; | 9 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleRespVO; |
| 9 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleUpdateReqVO; | 10 | import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleUpdateReqVO; |
| 10 | import cn.iocoder.yudao.module.bpm.convert.definition.BpmTaskAssignRuleConvert; | 11 | import cn.iocoder.yudao.module.bpm.convert.definition.BpmTaskAssignRuleConvert; |
| 11 | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmTaskAssignRuleDO; | 12 | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmTaskAssignRuleDO; |
| 12 | import cn.iocoder.yudao.module.bpm.dal.mysql.definition.BpmTaskAssignRuleMapper; | 13 | import cn.iocoder.yudao.module.bpm.dal.mysql.definition.BpmTaskAssignRuleMapper; |
| 14 | +import cn.iocoder.yudao.module.bpm.enums.DictTypeConstants; | ||
| 15 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmTaskAssignRuleTypeEnum; | ||
| 16 | +import cn.iocoder.yudao.module.system.api.dept.DeptApi; | ||
| 17 | +import cn.iocoder.yudao.module.system.api.dept.PostApi; | ||
| 18 | +import cn.iocoder.yudao.module.system.api.dict.DictDataApi; | ||
| 19 | +import cn.iocoder.yudao.module.system.api.permission.RoleApi; | ||
| 20 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||
| 13 | import lombok.extern.slf4j.Slf4j; | 21 | import lombok.extern.slf4j.Slf4j; |
| 14 | import org.flowable.bpmn.model.BpmnModel; | 22 | import org.flowable.bpmn.model.BpmnModel; |
| 15 | import org.flowable.bpmn.model.FlowElement; | 23 | import org.flowable.bpmn.model.FlowElement; |
| @@ -20,10 +28,10 @@ import org.springframework.validation.annotation.Validated; | @@ -20,10 +28,10 @@ import org.springframework.validation.annotation.Validated; | ||
| 20 | 28 | ||
| 21 | import javax.annotation.Resource; | 29 | import javax.annotation.Resource; |
| 22 | import javax.validation.Valid; | 30 | import javax.validation.Valid; |
| 23 | -import java.util.ArrayList; | ||
| 24 | -import java.util.Collections; | ||
| 25 | -import java.util.List; | ||
| 26 | -import java.util.Map; | 31 | +import java.util.*; |
| 32 | + | ||
| 33 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 34 | +import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; | ||
| 27 | 35 | ||
| 28 | /** | 36 | /** |
| 29 | * BPM 任务分配规则 Service 实现类 | 37 | * BPM 任务分配规则 Service 实现类 |
| @@ -35,13 +43,23 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService{ | @@ -35,13 +43,23 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService{ | ||
| 35 | 43 | ||
| 36 | @Resource | 44 | @Resource |
| 37 | private BpmTaskAssignRuleMapper taskRuleMapper; | 45 | private BpmTaskAssignRuleMapper taskRuleMapper; |
| 38 | - | ||
| 39 | @Resource | 46 | @Resource |
| 40 | @Lazy // 解决循环依赖 | 47 | @Lazy // 解决循环依赖 |
| 41 | private BpmModelService modelService; | 48 | private BpmModelService modelService; |
| 42 | - | ||
| 43 | @Resource | 49 | @Resource |
| 44 | private BpmProcessDefinitionService processDefinitionService; | 50 | private BpmProcessDefinitionService processDefinitionService; |
| 51 | + @Resource | ||
| 52 | + private BpmUserGroupService userGroupService; | ||
| 53 | + @Resource | ||
| 54 | + private RoleApi roleApi; | ||
| 55 | + @Resource | ||
| 56 | + private DeptApi deptApi; | ||
| 57 | + @Resource | ||
| 58 | + private PostApi postApi; | ||
| 59 | + @Resource | ||
| 60 | + private AdminUserApi adminUserApi; | ||
| 61 | + @Resource | ||
| 62 | + private DictDataApi dictDataApi; | ||
| 45 | 63 | ||
| 46 | @Override | 64 | @Override |
| 47 | public List<BpmTaskAssignRuleDO> getTaskAssignRuleListByProcessDefinitionId(String processDefinitionId, String taskDefinitionKey) { | 65 | public List<BpmTaskAssignRuleDO> getTaskAssignRuleListByProcessDefinitionId(String processDefinitionId, String taskDefinitionKey) { |
| @@ -101,12 +119,38 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService{ | @@ -101,12 +119,38 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService{ | ||
| 101 | 119 | ||
| 102 | @Override | 120 | @Override |
| 103 | public Long createTaskAssignRule(@Valid BpmTaskAssignRuleCreateReqVO reqVO) { | 121 | public Long createTaskAssignRule(@Valid BpmTaskAssignRuleCreateReqVO reqVO) { |
| 104 | - return null; | 122 | + // 校验参数 |
| 123 | + validTaskAssignRuleOptions(reqVO.getType(), reqVO.getOptions()); | ||
| 124 | + // 校验是否已经配置 | ||
| 125 | + BpmTaskAssignRuleDO existRule = taskRuleMapper.selectListByModelIdAndTaskDefinitionKey( | ||
| 126 | + reqVO.getModelId(), reqVO.getTaskDefinitionKey()); | ||
| 127 | + if (existRule != null) { | ||
| 128 | + throw exception(TASK_ASSIGN_RULE_EXISTS, reqVO.getModelId(), reqVO.getTaskDefinitionKey()); | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + // 存储 | ||
| 132 | + BpmTaskAssignRuleDO rule = BpmTaskAssignRuleConvert.INSTANCE.convert(reqVO) | ||
| 133 | + .setProcessDefinitionId(BpmTaskAssignRuleDO.PROCESS_DEFINITION_ID_NULL); // 只有流程模型,才允许新建 | ||
| 134 | + taskRuleMapper.insert(rule); | ||
| 135 | + return rule.getId(); | ||
| 105 | } | 136 | } |
| 106 | 137 | ||
| 107 | @Override | 138 | @Override |
| 108 | public void updateTaskAssignRule(@Valid BpmTaskAssignRuleUpdateReqVO reqVO) { | 139 | public void updateTaskAssignRule(@Valid BpmTaskAssignRuleUpdateReqVO reqVO) { |
| 140 | + // 校验参数 | ||
| 141 | + validTaskAssignRuleOptions(reqVO.getType(), reqVO.getOptions()); | ||
| 142 | + // 校验是否存在 | ||
| 143 | + BpmTaskAssignRuleDO existRule = taskRuleMapper.selectById(reqVO.getId()); | ||
| 144 | + if (existRule == null) { | ||
| 145 | + throw exception(TASK_ASSIGN_RULE_NOT_EXISTS); | ||
| 146 | + } | ||
| 147 | + // 只允许修改流程模型的规则 | ||
| 148 | + if (!Objects.equals(BpmTaskAssignRuleDO.PROCESS_DEFINITION_ID_NULL, existRule.getProcessDefinitionId())) { | ||
| 149 | + throw exception(TASK_UPDATE_FAIL_NOT_MODEL); | ||
| 150 | + } | ||
| 109 | 151 | ||
| 152 | + // 执行更新 | ||
| 153 | + taskRuleMapper.updateById(BpmTaskAssignRuleConvert.INSTANCE.convert(reqVO)); | ||
| 110 | } | 154 | } |
| 111 | 155 | ||
| 112 | @Override | 156 | @Override |
| @@ -136,6 +180,49 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService{ | @@ -136,6 +180,49 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService{ | ||
| 136 | 180 | ||
| 137 | @Override | 181 | @Override |
| 138 | public void copyTaskAssignRules(String fromModelId, String toProcessDefinitionId) { | 182 | public void copyTaskAssignRules(String fromModelId, String toProcessDefinitionId) { |
| 183 | + List<BpmTaskAssignRuleRespVO> rules = getTaskAssignRuleList(fromModelId, null); | ||
| 184 | + if (CollUtil.isEmpty(rules)) { | ||
| 185 | + return; | ||
| 186 | + } | ||
| 187 | + // 开始复制 | ||
| 188 | + List<BpmTaskAssignRuleDO> newRules = BpmTaskAssignRuleConvert.INSTANCE.convertList2(rules); | ||
| 189 | + newRules.forEach(rule -> rule.setProcessDefinitionId(toProcessDefinitionId).setId(null) | ||
| 190 | + .setCreateTime(null).setUpdateTime(null)); | ||
| 191 | + taskRuleMapper.insertBatch(newRules); | ||
| 192 | + } | ||
| 139 | 193 | ||
| 194 | + @Override | ||
| 195 | + public void checkTaskAssignRuleAllConfig(String id) { | ||
| 196 | + // 一个用户任务都没配置,所以无需配置规则 | ||
| 197 | + List<BpmTaskAssignRuleRespVO> taskAssignRules = getTaskAssignRuleList(id, null); | ||
| 198 | + if (CollUtil.isEmpty(taskAssignRules)) { | ||
| 199 | + return; | ||
| 200 | + } | ||
| 201 | + // 校验未配置规则的任务 | ||
| 202 | + taskAssignRules.forEach(rule -> { | ||
| 203 | + if (CollUtil.isEmpty(rule.getOptions())) { | ||
| 204 | + throw exception(MODEL_DEPLOY_FAIL_TASK_ASSIGN_RULE_NOT_CONFIG, rule.getTaskDefinitionName()); | ||
| 205 | + } | ||
| 206 | + }); | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + private void validTaskAssignRuleOptions(Integer type, Set<Long> options) { | ||
| 210 | + if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.ROLE.getType())) { | ||
| 211 | + roleApi.validRoles(options); | ||
| 212 | + } else if (ObjectUtils.equalsAny(type, BpmTaskAssignRuleTypeEnum.DEPT_MEMBER.getType(), | ||
| 213 | + BpmTaskAssignRuleTypeEnum.DEPT_LEADER.getType())) { | ||
| 214 | + deptApi.validDepts(options); | ||
| 215 | + } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.POST.getType())) { | ||
| 216 | + postApi.validPosts(options); | ||
| 217 | + } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.USER.getType())) { | ||
| 218 | + adminUserApi.validUsers(options); | ||
| 219 | + } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.USER_GROUP.getType())) { | ||
| 220 | + userGroupService.validUserGroups(options); | ||
| 221 | + } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.SCRIPT.getType())) { | ||
| 222 | + dictDataApi.validDictDatas(DictTypeConstants.TASK_ASSIGN_SCRIPT, | ||
| 223 | + CollectionUtils.convertSet(options, String::valueOf)); | ||
| 224 | + } else { | ||
| 225 | + throw new IllegalArgumentException(StrUtil.format("未知的规则类型({})", type)); | ||
| 226 | + } | ||
| 140 | } | 227 | } |
| 141 | } | 228 | } |