Commit 5c5bd0e5dab432d53128fb2c3909f710614de530
1 parent
727faac8
BPM:流程模型的 icon 维护
Showing
8 changed files
with
56 additions
and
20 deletions
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmModelFormTypeEnum.java
| 1 | package cn.iocoder.yudao.module.bpm.enums.definition; | 1 | package cn.iocoder.yudao.module.bpm.enums.definition; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | ||
| 3 | import lombok.AllArgsConstructor; | 4 | import lombok.AllArgsConstructor; |
| 4 | import lombok.Getter; | 5 | import lombok.Getter; |
| 5 | 6 | ||
| 7 | +import java.util.Arrays; | ||
| 8 | + | ||
| 6 | /** | 9 | /** |
| 7 | * BPM 模型的表单类型的枚举 | 10 | * BPM 模型的表单类型的枚举 |
| 8 | * | 11 | * |
| @@ -10,12 +13,20 @@ import lombok.Getter; | @@ -10,12 +13,20 @@ import lombok.Getter; | ||
| 10 | */ | 13 | */ |
| 11 | @Getter | 14 | @Getter |
| 12 | @AllArgsConstructor | 15 | @AllArgsConstructor |
| 13 | -public enum BpmModelFormTypeEnum { | 16 | +public enum BpmModelFormTypeEnum implements IntArrayValuable { |
| 14 | 17 | ||
| 15 | NORMAL(10, "流程表单"), // 对应 BpmFormDO | 18 | NORMAL(10, "流程表单"), // 对应 BpmFormDO |
| 16 | CUSTOM(20, "业务表单") // 业务自己定义的表单,自己进行数据的存储 | 19 | CUSTOM(20, "业务表单") // 业务自己定义的表单,自己进行数据的存储 |
| 17 | ; | 20 | ; |
| 18 | 21 | ||
| 22 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmModelFormTypeEnum::getType).toArray(); | ||
| 23 | + | ||
| 19 | private final Integer type; | 24 | private final Integer type; |
| 20 | - private final String desc; | 25 | + private final String name; |
| 26 | + | ||
| 27 | + @Override | ||
| 28 | + public int[] array() { | ||
| 29 | + return ARRAYS; | ||
| 30 | + } | ||
| 31 | + | ||
| 21 | } | 32 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelRespVO.java
| @@ -19,6 +19,9 @@ public class BpmModelRespVO { | @@ -19,6 +19,9 @@ public class BpmModelRespVO { | ||
| 19 | @Schema(description = "流程名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") | 19 | @Schema(description = "流程名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") |
| 20 | private String name; | 20 | private String name; |
| 21 | 21 | ||
| 22 | + @Schema(description = "流程图标", example = "https://www.iocoder.cn/yudao.jpg") | ||
| 23 | + private String icon; | ||
| 24 | + | ||
| 22 | @Schema(description = "流程描述", example = "我是描述") | 25 | @Schema(description = "流程描述", example = "我是描述") |
| 23 | private String description; | 26 | private String description; |
| 24 | 27 | ||
| @@ -30,17 +33,15 @@ public class BpmModelRespVO { | @@ -30,17 +33,15 @@ public class BpmModelRespVO { | ||
| 30 | @Schema(description = "表单类型-参见 bpm_model_form_type 数据字典", example = "1") | 33 | @Schema(description = "表单类型-参见 bpm_model_form_type 数据字典", example = "1") |
| 31 | private Integer formType; | 34 | private Integer formType; |
| 32 | 35 | ||
| 33 | - @Schema(description = "表单编号-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", example = "1024") | ||
| 34 | - private Long formId; | 36 | + @Schema(description = "表单编号", example = "1024") |
| 37 | + private Long formId; // 在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空 | ||
| 35 | @Schema(description = "表单名字", example = "请假表单") | 38 | @Schema(description = "表单名字", example = "请假表单") |
| 36 | private String formName; | 39 | private String formName; |
| 37 | 40 | ||
| 38 | - @Schema(description = "自定义表单的提交路径,使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", | ||
| 39 | - example = "/bpm/oa/leave/create") | ||
| 40 | - private String formCustomCreatePath; | ||
| 41 | - @Schema(description = "自定义表单的查看路径,使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", | ||
| 42 | - example = "/bpm/oa/leave/view") | ||
| 43 | - private String formCustomViewPath; | 41 | + @Schema(description = "自定义表单的提交路径", example = "/bpm/oa/leave/create") |
| 42 | + private String formCustomCreatePath; // 使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空 | ||
| 43 | + @Schema(description = "自定义表单的查看路径", example = "/bpm/oa/leave/view") | ||
| 44 | + private String formCustomViewPath; // ,使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空 | ||
| 44 | 45 | ||
| 45 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | 46 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 46 | private LocalDateTime createTime; | 47 | private LocalDateTime createTime; |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelUpdateReqVO.java
| 1 | package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model; | 1 | package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 4 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum; | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | -import lombok.Data; | ||
| 5 | - | ||
| 6 | import jakarta.validation.constraints.NotEmpty; | 6 | import jakarta.validation.constraints.NotEmpty; |
| 7 | +import lombok.Data; | ||
| 8 | +import org.hibernate.validator.constraints.URL; | ||
| 7 | 9 | ||
| 8 | @Schema(description = "管理后台 - 流程模型的更新 Request VO") | 10 | @Schema(description = "管理后台 - 流程模型的更新 Request VO") |
| 9 | @Data | 11 | @Data |
| @@ -16,6 +18,10 @@ public class BpmModelUpdateReqVO { | @@ -16,6 +18,10 @@ public class BpmModelUpdateReqVO { | ||
| 16 | @Schema(description = "流程名称", example = "芋道") | 18 | @Schema(description = "流程名称", example = "芋道") |
| 17 | private String name; | 19 | private String name; |
| 18 | 20 | ||
| 21 | + @Schema(description = "流程图标", example = "https://www.iocoder.cn/yudao.jpg") | ||
| 22 | + @URL(message = "流程图标格式不正确") | ||
| 23 | + private String icon; | ||
| 24 | + | ||
| 19 | @Schema(description = "流程描述", example = "我是描述") | 25 | @Schema(description = "流程描述", example = "我是描述") |
| 20 | private String description; | 26 | private String description; |
| 21 | 27 | ||
| @@ -26,6 +32,7 @@ public class BpmModelUpdateReqVO { | @@ -26,6 +32,7 @@ public class BpmModelUpdateReqVO { | ||
| 26 | private String bpmnXml; | 32 | private String bpmnXml; |
| 27 | 33 | ||
| 28 | @Schema(description = "表单类型-参见 bpm_model_form_type 数据字典", example = "1") | 34 | @Schema(description = "表单类型-参见 bpm_model_form_type 数据字典", example = "1") |
| 35 | + @InEnum(BpmModelFormTypeEnum.class) | ||
| 29 | private Integer formType; | 36 | private Integer formType; |
| 30 | @Schema(description = "表单编号-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", example = "1024") | 37 | @Schema(description = "表单编号-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", example = "1024") |
| 31 | private Long formId; | 38 | private Long formId; |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionRespVO.java
| @@ -22,6 +22,9 @@ public class BpmProcessDefinitionRespVO { | @@ -22,6 +22,9 @@ public class BpmProcessDefinitionRespVO { | ||
| 22 | @Schema(description = "流程标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao") | 22 | @Schema(description = "流程标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao") |
| 23 | private String key; | 23 | private String key; |
| 24 | 24 | ||
| 25 | + @Schema(description = "流程图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/yudao.jpg") | ||
| 26 | + private String icon; | ||
| 27 | + | ||
| 25 | @Schema(description = "流程描述", example = "我是描述") | 28 | @Schema(description = "流程描述", example = "我是描述") |
| 26 | private String description; | 29 | private String description; |
| 27 | 30 |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmModelConvert.java
| @@ -71,7 +71,7 @@ public interface BpmModelConvert { | @@ -71,7 +71,7 @@ public interface BpmModelConvert { | ||
| 71 | modelRespVO.setFormType(metaInfo.getFormType()).setFormId(metaInfo.getFormId()) | 71 | modelRespVO.setFormType(metaInfo.getFormType()).setFormId(metaInfo.getFormId()) |
| 72 | .setFormCustomCreatePath(metaInfo.getFormCustomCreatePath()) | 72 | .setFormCustomCreatePath(metaInfo.getFormCustomCreatePath()) |
| 73 | .setFormCustomViewPath(metaInfo.getFormCustomViewPath()); | 73 | .setFormCustomViewPath(metaInfo.getFormCustomViewPath()); |
| 74 | - modelRespVO.setDescription(metaInfo.getDescription()); | 74 | + modelRespVO.setIcon(metaInfo.getIcon()).setDescription(metaInfo.getDescription()); |
| 75 | } | 75 | } |
| 76 | if (form != null) { | 76 | if (form != null) { |
| 77 | modelRespVO.setFormId(form.getId()).setFormName(form.getName()); | 77 | modelRespVO.setFormId(form.getId()).setFormName(form.getName()); |
| @@ -95,24 +95,29 @@ public interface BpmModelConvert { | @@ -95,24 +95,29 @@ public interface BpmModelConvert { | ||
| 95 | default void copyToCreateModel(Model model, BpmModelCreateReqVO bean) { | 95 | default void copyToCreateModel(Model model, BpmModelCreateReqVO bean) { |
| 96 | model.setName(bean.getName()); | 96 | model.setName(bean.getName()); |
| 97 | model.setKey(bean.getKey()); | 97 | model.setKey(bean.getKey()); |
| 98 | - model.setMetaInfo(buildMetaInfoStr(null, bean.getDescription(), null, null, | ||
| 99 | - null, null)); | 98 | + model.setMetaInfo(buildMetaInfoStr(null, |
| 99 | + null, bean.getDescription(), | ||
| 100 | + null, null, null, null)); | ||
| 100 | } | 101 | } |
| 101 | 102 | ||
| 102 | default void copyToUpdateModel(Model model, BpmModelUpdateReqVO bean) { | 103 | default void copyToUpdateModel(Model model, BpmModelUpdateReqVO bean) { |
| 103 | model.setName(bean.getName()); | 104 | model.setName(bean.getName()); |
| 104 | model.setCategory(bean.getCategory()); | 105 | model.setCategory(bean.getCategory()); |
| 105 | model.setMetaInfo(buildMetaInfoStr(buildMetaInfo(model), | 106 | model.setMetaInfo(buildMetaInfoStr(buildMetaInfo(model), |
| 106 | - bean.getDescription(), bean.getFormType(), bean.getFormId(), | ||
| 107 | - bean.getFormCustomCreatePath(), bean.getFormCustomViewPath())); | 107 | + bean.getIcon(), bean.getDescription(), |
| 108 | + bean.getFormType(), bean.getFormId(), bean.getFormCustomCreatePath(), bean.getFormCustomViewPath())); | ||
| 108 | } | 109 | } |
| 109 | 110 | ||
| 110 | - default String buildMetaInfoStr(BpmModelMetaInfoRespDTO metaInfo, String description, Integer formType, | ||
| 111 | - Long formId, String formCustomCreatePath, String formCustomViewPath) { | 111 | + default String buildMetaInfoStr(BpmModelMetaInfoRespDTO metaInfo, |
| 112 | + String icon, String description, | ||
| 113 | + Integer formType, Long formId, String formCustomCreatePath, String formCustomViewPath) { | ||
| 112 | if (metaInfo == null) { | 114 | if (metaInfo == null) { |
| 113 | metaInfo = new BpmModelMetaInfoRespDTO(); | 115 | metaInfo = new BpmModelMetaInfoRespDTO(); |
| 114 | } | 116 | } |
| 115 | // 只有非空,才进行设置,避免更新时的覆盖 | 117 | // 只有非空,才进行设置,避免更新时的覆盖 |
| 118 | + if (StrUtil.isNotEmpty(icon)) { | ||
| 119 | + metaInfo.setIcon(icon); | ||
| 120 | + } | ||
| 116 | if (StrUtil.isNotEmpty(description)) { | 121 | if (StrUtil.isNotEmpty(description)) { |
| 117 | metaInfo.setDescription(description); | 122 | metaInfo.setDescription(description); |
| 118 | } | 123 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmProcessDefinitionConvert.java
| @@ -33,7 +33,6 @@ public interface BpmProcessDefinitionConvert { | @@ -33,7 +33,6 @@ public interface BpmProcessDefinitionConvert { | ||
| 33 | 33 | ||
| 34 | BpmProcessDefinitionConvert INSTANCE = Mappers.getMapper(BpmProcessDefinitionConvert.class); | 34 | BpmProcessDefinitionConvert INSTANCE = Mappers.getMapper(BpmProcessDefinitionConvert.class); |
| 35 | 35 | ||
| 36 | - | ||
| 37 | default PageResult<BpmProcessDefinitionRespVO> buildProcessDefinitionPage(PageResult<ProcessDefinition> page, | 36 | default PageResult<BpmProcessDefinitionRespVO> buildProcessDefinitionPage(PageResult<ProcessDefinition> page, |
| 38 | Map<String, Deployment> deploymentMap, | 37 | Map<String, Deployment> deploymentMap, |
| 39 | Map<String, BpmProcessDefinitionInfoDO> processDefinitionInfoMap, | 38 | Map<String, BpmProcessDefinitionInfoDO> processDefinitionInfoMap, |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/definition/BpmProcessDefinitionInfoDO.java
| @@ -40,6 +40,11 @@ public class BpmProcessDefinitionInfoDO extends BaseDO { | @@ -40,6 +40,11 @@ public class BpmProcessDefinitionInfoDO extends BaseDO { | ||
| 40 | * 关联 Model 的 id 属性 | 40 | * 关联 Model 的 id 属性 |
| 41 | */ | 41 | */ |
| 42 | private String modelId; | 42 | private String modelId; |
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 图标 | ||
| 46 | + */ | ||
| 47 | + private String icon; | ||
| 43 | /** | 48 | /** |
| 44 | * 描述 | 49 | * 描述 |
| 45 | */ | 50 | */ |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/dto/BpmModelMetaInfoRespDTO.java
| @@ -15,9 +15,14 @@ import lombok.Data; | @@ -15,9 +15,14 @@ import lombok.Data; | ||
| 15 | public class BpmModelMetaInfoRespDTO { | 15 | public class BpmModelMetaInfoRespDTO { |
| 16 | 16 | ||
| 17 | /** | 17 | /** |
| 18 | + * 流程图标 | ||
| 19 | + */ | ||
| 20 | + private String icon; | ||
| 21 | + /** | ||
| 18 | * 流程描述 | 22 | * 流程描述 |
| 19 | */ | 23 | */ |
| 20 | private String description; | 24 | private String description; |
| 25 | + | ||
| 21 | /** | 26 | /** |
| 22 | * 表单类型 | 27 | * 表单类型 |
| 23 | */ | 28 | */ |