BPM:流程模型的 icon 维护

This commit is contained in:
YunaiV 2024-03-24 10:08:51 +08:00
parent 727faac8d8
commit 5c5bd0e5da
8 changed files with 56 additions and 20 deletions

View File

@ -1,8 +1,11 @@
package cn.iocoder.yudao.module.bpm.enums.definition; package cn.iocoder.yudao.module.bpm.enums.definition;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import java.util.Arrays;
/** /**
* BPM 模型的表单类型的枚举 * BPM 模型的表单类型的枚举
* *
@ -10,12 +13,20 @@ import lombok.Getter;
*/ */
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum BpmModelFormTypeEnum { public enum BpmModelFormTypeEnum implements IntArrayValuable {
NORMAL(10, "流程表单"), // 对应 BpmFormDO NORMAL(10, "流程表单"), // 对应 BpmFormDO
CUSTOM(20, "业务表单") // 业务自己定义的表单自己进行数据的存储 CUSTOM(20, "业务表单") // 业务自己定义的表单自己进行数据的存储
; ;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmModelFormTypeEnum::getType).toArray();
private final Integer type; private final Integer type;
private final String desc; private final String name;
@Override
public int[] array() {
return ARRAYS;
}
} }

View File

@ -19,6 +19,9 @@ public class BpmModelRespVO {
@Schema(description = "流程名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") @Schema(description = "流程名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
private String name; private String name;
@Schema(description = "流程图标", example = "https://www.iocoder.cn/yudao.jpg")
private String icon;
@Schema(description = "流程描述", example = "我是描述") @Schema(description = "流程描述", example = "我是描述")
private String description; private String description;
@ -30,17 +33,15 @@ public class BpmModelRespVO {
@Schema(description = "表单类型-参见 bpm_model_form_type 数据字典", example = "1") @Schema(description = "表单类型-参见 bpm_model_form_type 数据字典", example = "1")
private Integer formType; private Integer formType;
@Schema(description = "表单编号-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", example = "1024") @Schema(description = "表单编号", example = "1024")
private Long formId; private Long formId; // 在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 必须非空
@Schema(description = "表单名字", example = "请假表单") @Schema(description = "表单名字", example = "请假表单")
private String formName; private String formName;
@Schema(description = "自定义表单的提交路径,使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", @Schema(description = "自定义表单的提交路径", example = "/bpm/oa/leave/create")
example = "/bpm/oa/leave/create") private String formCustomCreatePath; // 使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 必须非空
private String formCustomCreatePath; @Schema(description = "自定义表单的查看路径", example = "/bpm/oa/leave/view")
@Schema(description = "自定义表单的查看路径,使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", private String formCustomViewPath; // 使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 必须非空
example = "/bpm/oa/leave/view")
private String formCustomViewPath;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime; private LocalDateTime createTime;

View File

@ -1,9 +1,11 @@
package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model; 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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import org.hibernate.validator.constraints.URL;
@Schema(description = "管理后台 - 流程模型的更新 Request VO") @Schema(description = "管理后台 - 流程模型的更新 Request VO")
@Data @Data
@ -16,6 +18,10 @@ public class BpmModelUpdateReqVO {
@Schema(description = "流程名称", example = "芋道") @Schema(description = "流程名称", example = "芋道")
private String name; private String name;
@Schema(description = "流程图标", example = "https://www.iocoder.cn/yudao.jpg")
@URL(message = "流程图标格式不正确")
private String icon;
@Schema(description = "流程描述", example = "我是描述") @Schema(description = "流程描述", example = "我是描述")
private String description; private String description;
@ -26,6 +32,7 @@ public class BpmModelUpdateReqVO {
private String bpmnXml; private String bpmnXml;
@Schema(description = "表单类型-参见 bpm_model_form_type 数据字典", example = "1") @Schema(description = "表单类型-参见 bpm_model_form_type 数据字典", example = "1")
@InEnum(BpmModelFormTypeEnum.class)
private Integer formType; private Integer formType;
@Schema(description = "表单编号-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", example = "1024") @Schema(description = "表单编号-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", example = "1024")
private Long formId; private Long formId;

View File

@ -22,6 +22,9 @@ public class BpmProcessDefinitionRespVO {
@Schema(description = "流程标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao") @Schema(description = "流程标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao")
private String key; private String key;
@Schema(description = "流程图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/yudao.jpg")
private String icon;
@Schema(description = "流程描述", example = "我是描述") @Schema(description = "流程描述", example = "我是描述")
private String description; private String description;

View File

@ -71,7 +71,7 @@ public interface BpmModelConvert {
modelRespVO.setFormType(metaInfo.getFormType()).setFormId(metaInfo.getFormId()) modelRespVO.setFormType(metaInfo.getFormType()).setFormId(metaInfo.getFormId())
.setFormCustomCreatePath(metaInfo.getFormCustomCreatePath()) .setFormCustomCreatePath(metaInfo.getFormCustomCreatePath())
.setFormCustomViewPath(metaInfo.getFormCustomViewPath()); .setFormCustomViewPath(metaInfo.getFormCustomViewPath());
modelRespVO.setDescription(metaInfo.getDescription()); modelRespVO.setIcon(metaInfo.getIcon()).setDescription(metaInfo.getDescription());
} }
if (form != null) { if (form != null) {
modelRespVO.setFormId(form.getId()).setFormName(form.getName()); modelRespVO.setFormId(form.getId()).setFormName(form.getName());
@ -95,24 +95,29 @@ public interface BpmModelConvert {
default void copyToCreateModel(Model model, BpmModelCreateReqVO bean) { default void copyToCreateModel(Model model, BpmModelCreateReqVO bean) {
model.setName(bean.getName()); model.setName(bean.getName());
model.setKey(bean.getKey()); model.setKey(bean.getKey());
model.setMetaInfo(buildMetaInfoStr(null, bean.getDescription(), null, null, model.setMetaInfo(buildMetaInfoStr(null,
null, null)); null, bean.getDescription(),
null, null, null, null));
} }
default void copyToUpdateModel(Model model, BpmModelUpdateReqVO bean) { default void copyToUpdateModel(Model model, BpmModelUpdateReqVO bean) {
model.setName(bean.getName()); model.setName(bean.getName());
model.setCategory(bean.getCategory()); model.setCategory(bean.getCategory());
model.setMetaInfo(buildMetaInfoStr(buildMetaInfo(model), model.setMetaInfo(buildMetaInfoStr(buildMetaInfo(model),
bean.getDescription(), bean.getFormType(), bean.getFormId(), bean.getIcon(), bean.getDescription(),
bean.getFormCustomCreatePath(), bean.getFormCustomViewPath())); bean.getFormType(), bean.getFormId(), bean.getFormCustomCreatePath(), bean.getFormCustomViewPath()));
} }
default String buildMetaInfoStr(BpmModelMetaInfoRespDTO metaInfo, String description, Integer formType, default String buildMetaInfoStr(BpmModelMetaInfoRespDTO metaInfo,
Long formId, String formCustomCreatePath, String formCustomViewPath) { String icon, String description,
Integer formType, Long formId, String formCustomCreatePath, String formCustomViewPath) {
if (metaInfo == null) { if (metaInfo == null) {
metaInfo = new BpmModelMetaInfoRespDTO(); metaInfo = new BpmModelMetaInfoRespDTO();
} }
// 只有非空才进行设置避免更新时的覆盖 // 只有非空才进行设置避免更新时的覆盖
if (StrUtil.isNotEmpty(icon)) {
metaInfo.setIcon(icon);
}
if (StrUtil.isNotEmpty(description)) { if (StrUtil.isNotEmpty(description)) {
metaInfo.setDescription(description); metaInfo.setDescription(description);
} }

View File

@ -33,7 +33,6 @@ public interface BpmProcessDefinitionConvert {
BpmProcessDefinitionConvert INSTANCE = Mappers.getMapper(BpmProcessDefinitionConvert.class); BpmProcessDefinitionConvert INSTANCE = Mappers.getMapper(BpmProcessDefinitionConvert.class);
default PageResult<BpmProcessDefinitionRespVO> buildProcessDefinitionPage(PageResult<ProcessDefinition> page, default PageResult<BpmProcessDefinitionRespVO> buildProcessDefinitionPage(PageResult<ProcessDefinition> page,
Map<String, Deployment> deploymentMap, Map<String, Deployment> deploymentMap,
Map<String, BpmProcessDefinitionInfoDO> processDefinitionInfoMap, Map<String, BpmProcessDefinitionInfoDO> processDefinitionInfoMap,

View File

@ -40,6 +40,11 @@ public class BpmProcessDefinitionInfoDO extends BaseDO {
* 关联 Model id 属性 * 关联 Model id 属性
*/ */
private String modelId; private String modelId;
/**
* 图标
*/
private String icon;
/** /**
* 描述 * 描述
*/ */

View File

@ -14,10 +14,15 @@ import lombok.Data;
@Data @Data
public class BpmModelMetaInfoRespDTO { public class BpmModelMetaInfoRespDTO {
/**
* 流程图标
*/
private String icon;
/** /**
* 流程描述 * 流程描述
*/ */
private String description; private String description;
/** /**
* 表单类型 * 表单类型
*/ */