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 | 1 | package cn.iocoder.yudao.module.bpm.enums.definition; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | |
| 3 | 4 | import lombok.AllArgsConstructor; |
| 4 | 5 | import lombok.Getter; |
| 5 | 6 | |
| 7 | +import java.util.Arrays; | |
| 8 | + | |
| 6 | 9 | /** |
| 7 | 10 | * BPM 模型的表单类型的枚举 |
| 8 | 11 | * |
| ... | ... | @@ -10,12 +13,20 @@ import lombok.Getter; |
| 10 | 13 | */ |
| 11 | 14 | @Getter |
| 12 | 15 | @AllArgsConstructor |
| 13 | -public enum BpmModelFormTypeEnum { | |
| 16 | +public enum BpmModelFormTypeEnum implements IntArrayValuable { | |
| 14 | 17 | |
| 15 | 18 | NORMAL(10, "流程表单"), // 对应 BpmFormDO |
| 16 | 19 | CUSTOM(20, "业务表单") // 业务自己定义的表单,自己进行数据的存储 |
| 17 | 20 | ; |
| 18 | 21 | |
| 22 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmModelFormTypeEnum::getType).toArray(); | |
| 23 | + | |
| 19 | 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 | 19 | @Schema(description = "流程名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") |
| 20 | 20 | private String name; |
| 21 | 21 | |
| 22 | + @Schema(description = "流程图标", example = "https://www.iocoder.cn/yudao.jpg") | |
| 23 | + private String icon; | |
| 24 | + | |
| 22 | 25 | @Schema(description = "流程描述", example = "我是描述") |
| 23 | 26 | private String description; |
| 24 | 27 | |
| ... | ... | @@ -30,17 +33,15 @@ public class BpmModelRespVO { |
| 30 | 33 | @Schema(description = "表单类型-参见 bpm_model_form_type 数据字典", example = "1") |
| 31 | 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 | 38 | @Schema(description = "表单名字", example = "请假表单") |
| 36 | 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 | 46 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 46 | 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 | 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 | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | -import lombok.Data; | |
| 5 | - | |
| 6 | 6 | import jakarta.validation.constraints.NotEmpty; |
| 7 | +import lombok.Data; | |
| 8 | +import org.hibernate.validator.constraints.URL; | |
| 7 | 9 | |
| 8 | 10 | @Schema(description = "管理后台 - 流程模型的更新 Request VO") |
| 9 | 11 | @Data |
| ... | ... | @@ -16,6 +18,10 @@ public class BpmModelUpdateReqVO { |
| 16 | 18 | @Schema(description = "流程名称", example = "芋道") |
| 17 | 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 | 25 | @Schema(description = "流程描述", example = "我是描述") |
| 20 | 26 | private String description; |
| 21 | 27 | |
| ... | ... | @@ -26,6 +32,7 @@ public class BpmModelUpdateReqVO { |
| 26 | 32 | private String bpmnXml; |
| 27 | 33 | |
| 28 | 34 | @Schema(description = "表单类型-参见 bpm_model_form_type 数据字典", example = "1") |
| 35 | + @InEnum(BpmModelFormTypeEnum.class) | |
| 29 | 36 | private Integer formType; |
| 30 | 37 | @Schema(description = "表单编号-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", example = "1024") |
| 31 | 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 | 22 | @Schema(description = "流程标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao") |
| 23 | 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 | 28 | @Schema(description = "流程描述", example = "我是描述") |
| 26 | 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 | 71 | modelRespVO.setFormType(metaInfo.getFormType()).setFormId(metaInfo.getFormId()) |
| 72 | 72 | .setFormCustomCreatePath(metaInfo.getFormCustomCreatePath()) |
| 73 | 73 | .setFormCustomViewPath(metaInfo.getFormCustomViewPath()); |
| 74 | - modelRespVO.setDescription(metaInfo.getDescription()); | |
| 74 | + modelRespVO.setIcon(metaInfo.getIcon()).setDescription(metaInfo.getDescription()); | |
| 75 | 75 | } |
| 76 | 76 | if (form != null) { |
| 77 | 77 | modelRespVO.setFormId(form.getId()).setFormName(form.getName()); |
| ... | ... | @@ -95,24 +95,29 @@ public interface BpmModelConvert { |
| 95 | 95 | default void copyToCreateModel(Model model, BpmModelCreateReqVO bean) { |
| 96 | 96 | model.setName(bean.getName()); |
| 97 | 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 | 103 | default void copyToUpdateModel(Model model, BpmModelUpdateReqVO bean) { |
| 103 | 104 | model.setName(bean.getName()); |
| 104 | 105 | model.setCategory(bean.getCategory()); |
| 105 | 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 | 114 | if (metaInfo == null) { |
| 113 | 115 | metaInfo = new BpmModelMetaInfoRespDTO(); |
| 114 | 116 | } |
| 115 | 117 | // 只有非空,才进行设置,避免更新时的覆盖 |
| 118 | + if (StrUtil.isNotEmpty(icon)) { | |
| 119 | + metaInfo.setIcon(icon); | |
| 120 | + } | |
| 116 | 121 | if (StrUtil.isNotEmpty(description)) { |
| 117 | 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 | 33 | |
| 34 | 34 | BpmProcessDefinitionConvert INSTANCE = Mappers.getMapper(BpmProcessDefinitionConvert.class); |
| 35 | 35 | |
| 36 | - | |
| 37 | 36 | default PageResult<BpmProcessDefinitionRespVO> buildProcessDefinitionPage(PageResult<ProcessDefinition> page, |
| 38 | 37 | Map<String, Deployment> deploymentMap, |
| 39 | 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
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/dto/BpmModelMetaInfoRespDTO.java