From 24c03cf1767c62b3aa2bcb3886c79635e45cc51e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 11 Jan 2022 22:15:48 +0800 Subject: [PATCH] =?UTF-8?q?BPM=20=E6=A8=A1=E5=9E=8B=E9=87=8D=E6=9E=84=203?= =?UTF-8?q?=EF=BC=9A=E8=AE=BE=E7=BD=AE=E6=B5=81=E7=A8=8B=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=20formId=E3=80=81description=20=E7=AD=89?= =?UTF-8?q?=E7=9A=84=E4=BC=A0=E9=80=92=EF=BC=8C=E4=B8=93=E6=B3=A8=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E6=9C=AC=E8=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/vo/BpmModelUpdateReqVO.java | 19 +++++++---- .../bpm/convert/model/BpmModelConvert.java | 32 ++++++++++++++----- .../dto/BpmModelMetaInfoRespDTO.java | 4 +-- .../definition/impl/BpmModelServiceImpl.java | 2 +- .../package/penal/base/ElementBaseInfo.vue | 23 ------------- yudao-admin-ui/src/router/index.js | 4 +-- 6 files changed, 42 insertions(+), 42 deletions(-) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/vo/BpmModelUpdateReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/vo/BpmModelUpdateReqVO.java index 5cc6f03ec..5b467bbd9 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/vo/BpmModelUpdateReqVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/vo/BpmModelUpdateReqVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.adminserver.modules.bpm.controller.model.vo; +import cn.iocoder.yudao.adminserver.modules.bpm.enums.definition.BpmModelFormTypeEnum; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -10,9 +11,7 @@ import javax.validation.constraints.NotEmpty; @ApiModel("流程模型的更新 Request VO") @Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class BpmModelUpdateReqVO extends BpmModelBaseVO { +public class BpmModelUpdateReqVO { @ApiModelProperty(value = "编号", required = true, example = "1024") @NotEmpty(message = "编号不能为空") @@ -27,10 +26,18 @@ public class BpmModelUpdateReqVO extends BpmModelBaseVO { @ApiModelProperty(value = "流程分类", notes = "参见 bpm_model_category 数据字典", example = "1") private String category; - @ApiModelProperty(value = "表单编号", example = "1024") - private Long formId; - @ApiModelProperty(value = "BPMN XML", required = true) private String bpmnXml; + @ApiModelProperty(value = "表单类型", notes = "参见 bpm_model_form_type 数据字典", example = "1") + private Integer formType; + @ApiModelProperty(value = "表单编号", example = "1024", notes = "在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空") + private Long formId; + @ApiModelProperty(value = "自定义表单的提交路径,使用 Vue 的路由地址", example = "/bpm/oa/leave/create", + notes = "在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空") + private String formCustomCreatePath; + @ApiModelProperty(value = "自定义表单的查看路径,使用 Vue 的路由地址", example = "/bpm/oa/leave/view", + notes = "在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空") + private String formCustomViewPath; + } 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 aacf1e17a..e2470f520 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 @@ -1,5 +1,6 @@ package cn.iocoder.yudao.adminserver.modules.bpm.convert.model; +import cn.hutool.core.util.StrUtil; 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; @@ -15,10 +16,11 @@ import org.mapstruct.factory.Mappers; import java.util.List; import java.util.Map; +import java.util.Objects; /** - * 流程定义 Convert + * 流程模型 Convert * * @author yunlongn */ @@ -95,20 +97,34 @@ public interface BpmModelConvert { default void copy(Model model, BpmModelCreateReqVO bean) { model.setName(bean.getName()); model.setKey(bean.getKey()); - model.setMetaInfo(JsonUtils.toJsonString(this.buildMetaInfo(bean.getDescription(), null))); + model.setMetaInfo(buildMetaInfoStr(null, bean.getDescription(), null, null, + null, null)); } default void copy(Model model, BpmModelUpdateReqVO bean) { model.setName(bean.getName()); model.setCategory(bean.getCategory()); - model.setMetaInfo(JsonUtils.toJsonString(this.buildMetaInfo(bean.getDescription(), bean.getFormId()))); + model.setMetaInfo(buildMetaInfoStr(JsonUtils.parseObject(model.getMetaInfo(), BpmModelMetaInfoRespDTO.class), + bean.getDescription(), bean.getFormType(), bean.getFormId(), + bean.getFormCustomCreatePath(), bean.getFormCustomViewPath())); } - default BpmModelMetaInfoRespDTO buildMetaInfo(String description, Long formId) { - BpmModelMetaInfoRespDTO metaInfo = new BpmModelMetaInfoRespDTO(); - metaInfo.setDescription(description); - metaInfo.setFormId(formId); - return metaInfo; + default String buildMetaInfoStr(BpmModelMetaInfoRespDTO metaInfo, String description, Integer formType, + Long formId, String formCustomCreatePath, String formCustomViewPath) { + if (metaInfo == null) { + metaInfo = new BpmModelMetaInfoRespDTO(); + } + // 只有非空,才进行设置,避免更新时的覆盖 + if (StrUtil.isNotEmpty(description)) { + metaInfo.setDescription(description); + } + if (Objects.nonNull(formType)) { + metaInfo.setFormType(formType); + metaInfo.setFormId(formId); + metaInfo.setFormCustomCreatePath(formCustomCreatePath); + metaInfo.setFormCustomViewPath(formCustomViewPath); + } + return JsonUtils.toJsonString(metaInfo); } BpmModelPageItemRespVO.ProcessDefinition convert(ProcessDefinition bean); diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/dto/BpmModelMetaInfoRespDTO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/dto/BpmModelMetaInfoRespDTO.java index 651fbf9ca..5ff8f1815 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/dto/BpmModelMetaInfoRespDTO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/dto/BpmModelMetaInfoRespDTO.java @@ -19,7 +19,7 @@ public class BpmModelMetaInfoRespDTO { /** * 表单类型 */ - private Long formType; + private Integer formType; /** * 表单编号 * 在表单类型为 {@link BpmModelFormTypeEnum#NORMAL} 时 @@ -29,7 +29,7 @@ public class BpmModelMetaInfoRespDTO { * 自定义表单的提交路径,使用 Vue 的路由地址 * 在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时 */ - private String formCustomSubmitPath; + private String formCustomCreatePath; /** * 自定义表单的查看路径,使用 Vue 的路由地址 * 在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时 diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmModelServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmModelServiceImpl.java index 32a82461b..110a7430d 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmModelServiceImpl.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmModelServiceImpl.java @@ -149,7 +149,7 @@ public class BpmModelServiceImpl implements BpmModelService { if (StrUtil.isEmpty(bpmnXml)) { return; } - repositoryService.addModelEditorSource(model.getId(), bpmnXml.getBytes(StandardCharsets.UTF_8)); + repositoryService.addModelEditorSource(model.getId(), StrUtil.utf8Bytes(bpmnXml)); } @Override diff --git a/yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue b/yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue index 41af1c445..6c5edb88c 100644 --- a/yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue +++ b/yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue @@ -9,19 +9,6 @@ - - - - - - - - - - - - -
@@ -35,9 +22,6 @@