diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/BpmModelController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/BpmModelController.java index 9da0a7166..ecd1c430c 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/BpmModelController.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/BpmModelController.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.adminserver.modules.bpm.controller.model; import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.*; import cn.iocoder.yudao.adminserver.modules.bpm.convert.model.BpmModelConvert; -import cn.iocoder.yudao.adminserver.modules.bpm.service.model.BpmModelService; +import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmModelService; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.io.IoUtils; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/model/BpmModelConvert.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/model/BpmModelConvert.java index d52118da5..17343f106 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/model/BpmModelConvert.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/model/BpmModelConvert.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.adminserver.modules.bpm.convert.model; import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.*; import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO; import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmDefinitionCreateReqDTO; -import cn.iocoder.yudao.adminserver.modules.bpm.service.model.dto.BpmModelMetaInfoRespDTO; +import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmModelMetaInfoRespDTO; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import org.activiti.engine.impl.persistence.entity.SuspensionState; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/definition/BpmTaskRuleDO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/definition/BpmTaskRuleDO.java new file mode 100644 index 000000000..3494c79b1 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/definition/BpmTaskRuleDO.java @@ -0,0 +1,76 @@ +package cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition; + +import cn.iocoder.yudao.adminserver.modules.bpm.enums.definition.BpmTaskRuleScriptEnum; +import cn.iocoder.yudao.adminserver.modules.bpm.enums.definition.BpmTaskRuleTypeEnum; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; +import lombok.*; +import org.activiti.engine.repository.Model; +import org.activiti.engine.repository.ProcessDefinition; +import org.activiti.engine.task.Task; + +import java.util.List; + +/** + * Bpm 任务规则表 + * + * @author 芋道源码 + */ +@TableName(value = "bpm_task_rule", autoResultMap = true) +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BpmTaskRuleDO extends BaseDO { + + /** + * 编号 + */ + @TableId + private Long id; + + /** + * 流程模型编号 + * + * 关联 {@link Model#getId()} + */ + private String modelId; + /** + * 流程定义编号 + * + * 关联 {@link ProcessDefinition#getId()} + */ + private String processDefinitionId; + /** + * 流程任务的定义 Key + * + * 关联 {@link Task#getTaskDefinitionKey()} + */ + private String taskDefinitionKey; + + /** + * 规则类型 + * + * 枚举 {@link BpmTaskRuleTypeEnum} + */ + private Integer type; + /** + * 规则值数组,一般关联指定表的编号 + * 根据 type 不同,对应的值是不同的: + * + * 1. {@link BpmTaskRuleTypeEnum#ROLE} 时:角色编号 + * 2. {@link BpmTaskRuleTypeEnum#DEPT} 时:部门编号 + * 3. {@link BpmTaskRuleTypeEnum#DEPT_LEADER} 时:部门编号 + * 4. {@link BpmTaskRuleTypeEnum#USER} 时:用户编号 + * 5. {@link BpmTaskRuleTypeEnum#USER_GROUP} 时:用户组编号 + * 6. {@link BpmTaskRuleTypeEnum#SCRIPT} 时:脚本编号,目前通过 {@link BpmTaskRuleScriptEnum#getId()} 标识 + */ + @TableField(typeHandler = JacksonTypeHandler.class) + private List values; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/definition/BpmTaskRuleScriptEnum.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/definition/BpmTaskRuleScriptEnum.java new file mode 100644 index 000000000..0f49d2191 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/definition/BpmTaskRuleScriptEnum.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.adminserver.modules.bpm.enums.definition; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * BPM 任务规则的脚本枚举 + * 目前暂时通过 TODO 硬编码,未来可以考虑 Groovy 动态脚本的方式 + * + * @author 芋道源码 + */ +@Getter +@AllArgsConstructor +public class BpmTaskRuleScriptEnum { + + ; + + /** + * 脚本编号 + */ + private final Long id; + /** + * 脚本描述 + */ + private final String desc; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/definition/BpmTaskRuleTypeEnum.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/definition/BpmTaskRuleTypeEnum.java new file mode 100644 index 000000000..16cf1dc7c --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/definition/BpmTaskRuleTypeEnum.java @@ -0,0 +1,36 @@ +package cn.iocoder.yudao.adminserver.modules.bpm.enums.definition; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * BPM 任务规则的类型枚举 + * + * @author 芋道源码 + */ +@Getter +@AllArgsConstructor +public enum BpmTaskRuleTypeEnum { + + ROLE(10, "指定角色"), + + DEPT(20, "指定部门"), + DEPT_LEADER(21, "指定部门的负责人"), + + USER(30, "指定用户"), + + USER_GROUP(40, "指定用户组"), // TODO 芋艿:预留,暂未实现 + + SCRIPT(50, "指定脚本"), // 例如说,发起人所在部门的领导、发起人所在部门的领导的领导 + ; + + /** + * 类型 + */ + private final Integer type; + /** + * 描述 + */ + private final String desc; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/BpmModelService.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmModelService.java similarity index 95% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/BpmModelService.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmModelService.java index 1d1d2fd1d..48e715458 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/BpmModelService.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/BpmModelService.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.bpm.service.model; +package cn.iocoder.yudao.adminserver.modules.bpm.service.definition; import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.*; import cn.iocoder.yudao.framework.common.pojo.PageResult; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/dto/BpmModelMetaInfoRespDTO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/dto/BpmModelMetaInfoRespDTO.java similarity index 83% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/dto/BpmModelMetaInfoRespDTO.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/dto/BpmModelMetaInfoRespDTO.java index a3f97002c..f52bbb2c3 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/dto/BpmModelMetaInfoRespDTO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/dto/BpmModelMetaInfoRespDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.bpm.service.model.dto; +package cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto; import lombok.Data; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/impl/BpmModelServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmModelServiceImpl.java similarity index 93% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/impl/BpmModelServiceImpl.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmModelServiceImpl.java index 1900457ba..bf0654377 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/impl/BpmModelServiceImpl.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmModelServiceImpl.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.bpm.service.model.impl; +package cn.iocoder.yudao.adminserver.modules.bpm.service.definition.impl; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo.*; @@ -7,8 +7,8 @@ import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO; import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmProcessDefinitionService; import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmDefinitionCreateReqDTO; import cn.iocoder.yudao.adminserver.modules.bpm.service.form.BpmFormService; -import cn.iocoder.yudao.adminserver.modules.bpm.service.model.BpmModelService; -import cn.iocoder.yudao.adminserver.modules.bpm.service.model.dto.BpmModelMetaInfoRespDTO; +import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmModelService; +import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto.BpmModelMetaInfoRespDTO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; @@ -30,8 +30,6 @@ import org.springframework.util.ObjectUtils; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -216,11 +214,11 @@ public class BpmModelServiceImpl implements BpmModelService { } } -// public static void main(String[] args) { -// // 创建转换对象 -// BpmnXMLConverter converter = new BpmnXMLConverter(); -// BpmnModel bpmnModel = converter.convertToBpmnModel(new StringStreamSource(""), true, true); -// bpmnModel.getProcesses() -// } + public static void main(String[] args) { + // 创建转换对象 + BpmnXMLConverter converter = new BpmnXMLConverter(); + BpmnModel bpmnModel = converter.convertToBpmnModel(new StringStreamSource(""), true, true); + bpmnModel.getProcesses().get(0).getId() + } }