From 5c5bd0e5dab432d53128fb2c3909f710614de530 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 24 Mar 2024 10:08:51 +0800 Subject: [PATCH] =?UTF-8?q?BPM=EF=BC=9A=E6=B5=81=E7=A8=8B=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E7=9A=84=20icon=20=E7=BB=B4=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../definition/BpmModelFormTypeEnum.java | 15 +++++++++++++-- .../definition/vo/model/BpmModelRespVO.java | 17 +++++++++-------- .../vo/model/BpmModelUpdateReqVO.java | 11 +++++++++-- .../process/BpmProcessDefinitionRespVO.java | 3 +++ .../convert/definition/BpmModelConvert.java | 19 ++++++++++++------- .../BpmProcessDefinitionConvert.java | 1 - .../BpmProcessDefinitionInfoDO.java | 5 +++++ .../dto/BpmModelMetaInfoRespDTO.java | 5 +++++ 8 files changed, 56 insertions(+), 20 deletions(-) diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmModelFormTypeEnum.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmModelFormTypeEnum.java index c21d6f999..3bca6c82b 100644 --- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmModelFormTypeEnum.java +++ b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmModelFormTypeEnum.java @@ -1,8 +1,11 @@ package cn.iocoder.yudao.module.bpm.enums.definition; +import cn.iocoder.yudao.framework.common.core.IntArrayValuable; import lombok.AllArgsConstructor; import lombok.Getter; +import java.util.Arrays; + /** * BPM 模型的表单类型的枚举 * @@ -10,12 +13,20 @@ import lombok.Getter; */ @Getter @AllArgsConstructor -public enum BpmModelFormTypeEnum { +public enum BpmModelFormTypeEnum implements IntArrayValuable { NORMAL(10, "流程表单"), // 对应 BpmFormDO CUSTOM(20, "业务表单") // 业务自己定义的表单,自己进行数据的存储 ; + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmModelFormTypeEnum::getType).toArray(); + private final Integer type; - private final String desc; + private final String name; + + @Override + public int[] array() { + return ARRAYS; + } + } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelRespVO.java index c08393359..aad2015c7 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelRespVO.java +++ b/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 { @Schema(description = "流程名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") private String name; + @Schema(description = "流程图标", example = "https://www.iocoder.cn/yudao.jpg") + private String icon; + @Schema(description = "流程描述", example = "我是描述") private String description; @@ -30,17 +33,15 @@ public class BpmModelRespVO { @Schema(description = "表单类型-参见 bpm_model_form_type 数据字典", example = "1") private Integer formType; - @Schema(description = "表单编号-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", example = "1024") - private Long formId; + @Schema(description = "表单编号", example = "1024") + private Long formId; // 在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空 @Schema(description = "表单名字", example = "请假表单") private String formName; - @Schema(description = "自定义表单的提交路径,使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", - example = "/bpm/oa/leave/create") - private String formCustomCreatePath; - @Schema(description = "自定义表单的查看路径,使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", - example = "/bpm/oa/leave/view") - private String formCustomViewPath; + @Schema(description = "自定义表单的提交路径", example = "/bpm/oa/leave/create") + private String formCustomCreatePath; // 使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空 + @Schema(description = "自定义表单的查看路径", example = "/bpm/oa/leave/view") + private String formCustomViewPath; // ,使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) private LocalDateTime createTime; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelUpdateReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelUpdateReqVO.java index cc2420b28..94585af3d 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelUpdateReqVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelUpdateReqVO.java @@ -1,9 +1,11 @@ package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model; +import cn.iocoder.yudao.framework.common.validation.InEnum; +import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - import jakarta.validation.constraints.NotEmpty; +import lombok.Data; +import org.hibernate.validator.constraints.URL; @Schema(description = "管理后台 - 流程模型的更新 Request VO") @Data @@ -16,6 +18,10 @@ public class BpmModelUpdateReqVO { @Schema(description = "流程名称", example = "芋道") private String name; + @Schema(description = "流程图标", example = "https://www.iocoder.cn/yudao.jpg") + @URL(message = "流程图标格式不正确") + private String icon; + @Schema(description = "流程描述", example = "我是描述") private String description; @@ -26,6 +32,7 @@ public class BpmModelUpdateReqVO { private String bpmnXml; @Schema(description = "表单类型-参见 bpm_model_form_type 数据字典", example = "1") + @InEnum(BpmModelFormTypeEnum.class) private Integer formType; @Schema(description = "表单编号-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", example = "1024") private Long formId; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionRespVO.java index f54e31803..2fb8dd4dc 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionRespVO.java +++ b/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 { @Schema(description = "流程标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao") private String key; + @Schema(description = "流程图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/yudao.jpg") + private String icon; + @Schema(description = "流程描述", example = "我是描述") private String description; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmModelConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmModelConvert.java index 373e71bf3..3fe5cc068 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmModelConvert.java +++ b/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 { modelRespVO.setFormType(metaInfo.getFormType()).setFormId(metaInfo.getFormId()) .setFormCustomCreatePath(metaInfo.getFormCustomCreatePath()) .setFormCustomViewPath(metaInfo.getFormCustomViewPath()); - modelRespVO.setDescription(metaInfo.getDescription()); + modelRespVO.setIcon(metaInfo.getIcon()).setDescription(metaInfo.getDescription()); } if (form != null) { modelRespVO.setFormId(form.getId()).setFormName(form.getName()); @@ -95,24 +95,29 @@ public interface BpmModelConvert { default void copyToCreateModel(Model model, BpmModelCreateReqVO bean) { model.setName(bean.getName()); model.setKey(bean.getKey()); - model.setMetaInfo(buildMetaInfoStr(null, bean.getDescription(), null, null, - null, null)); + model.setMetaInfo(buildMetaInfoStr(null, + null, bean.getDescription(), + null, null, null, null)); } default void copyToUpdateModel(Model model, BpmModelUpdateReqVO bean) { model.setName(bean.getName()); model.setCategory(bean.getCategory()); model.setMetaInfo(buildMetaInfoStr(buildMetaInfo(model), - bean.getDescription(), bean.getFormType(), bean.getFormId(), - bean.getFormCustomCreatePath(), bean.getFormCustomViewPath())); + bean.getIcon(), bean.getDescription(), + bean.getFormType(), bean.getFormId(), bean.getFormCustomCreatePath(), bean.getFormCustomViewPath())); } - default String buildMetaInfoStr(BpmModelMetaInfoRespDTO metaInfo, String description, Integer formType, - Long formId, String formCustomCreatePath, String formCustomViewPath) { + default String buildMetaInfoStr(BpmModelMetaInfoRespDTO metaInfo, + String icon, String description, + Integer formType, Long formId, String formCustomCreatePath, String formCustomViewPath) { if (metaInfo == null) { metaInfo = new BpmModelMetaInfoRespDTO(); } // 只有非空,才进行设置,避免更新时的覆盖 + if (StrUtil.isNotEmpty(icon)) { + metaInfo.setIcon(icon); + } if (StrUtil.isNotEmpty(description)) { metaInfo.setDescription(description); } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmProcessDefinitionConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmProcessDefinitionConvert.java index 61187424b..0e767d787 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmProcessDefinitionConvert.java +++ b/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 { BpmProcessDefinitionConvert INSTANCE = Mappers.getMapper(BpmProcessDefinitionConvert.class); - default PageResult buildProcessDefinitionPage(PageResult page, Map deploymentMap, Map processDefinitionInfoMap, diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/definition/BpmProcessDefinitionInfoDO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/definition/BpmProcessDefinitionInfoDO.java index 436476b27..9ac9252d5 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/definition/BpmProcessDefinitionInfoDO.java +++ b/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 { * 关联 Model 的 id 属性 */ private String modelId; + + /** + * 图标 + */ + private String icon; /** * 描述 */ diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/dto/BpmModelMetaInfoRespDTO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/dto/BpmModelMetaInfoRespDTO.java index 5b4ef3da5..8ec9dc64b 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/dto/BpmModelMetaInfoRespDTO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/dto/BpmModelMetaInfoRespDTO.java @@ -14,10 +14,15 @@ import lombok.Data; @Data public class BpmModelMetaInfoRespDTO { + /** + * 流程图标 + */ + private String icon; /** * 流程描述 */ private String description; + /** * 表单类型 */