mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-03 21:04:06 +08:00
BPM 模型重构 1:新建流程时,只填写 name、description、key
This commit is contained in:
@@ -56,7 +56,7 @@ public class BpmModelController {
|
||||
public CommonResult<String> importModel(@Valid BpmModeImportReqVO importReqVO) throws IOException {
|
||||
BpmModelCreateReqVO createReqVO = BpmModelConvert.INSTANCE.convert(importReqVO);
|
||||
// 读取文件
|
||||
createReqVO.setBpmnXml(IoUtils.readUtf8(importReqVO.getBpmnFile().getInputStream(), false));
|
||||
// createReqVO.setBpmnXml(IoUtils.readUtf8(importReqVO.getBpmnFile().getInputStream(), false));
|
||||
return success(bpmModelService.createModel(createReqVO));
|
||||
}
|
||||
|
||||
|
@@ -10,12 +10,17 @@ import javax.validation.constraints.NotEmpty;
|
||||
|
||||
@ApiModel("流程模型的创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class BpmModelCreateReqVO extends BpmModelBaseVO {
|
||||
public class BpmModelCreateReqVO {
|
||||
|
||||
@ApiModelProperty(value = "BPMN XML", required = true)
|
||||
@NotEmpty(message = "BPMN XML 不能为空")
|
||||
private String bpmnXml;
|
||||
@ApiModelProperty(value = "流程标识", required = true, example = "process_yudao")
|
||||
@NotEmpty(message = "流程标识不能为空")
|
||||
private String key;
|
||||
|
||||
@ApiModelProperty(value = "流程名称", required = true, example = "芋道")
|
||||
@NotEmpty(message = "流程名称不能为空")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "流程描述", example = "我是描述")
|
||||
private String description;
|
||||
|
||||
}
|
||||
|
@@ -18,8 +18,19 @@ public class BpmModelUpdateReqVO extends BpmModelBaseVO {
|
||||
@NotEmpty(message = "编号不能为空")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "流程名称", example = "芋道")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "流程描述", example = "我是描述")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty(value = "流程分类", notes = "参见 bpm_model_category 数据字典", example = "1")
|
||||
private String category;
|
||||
|
||||
@ApiModelProperty(value = "表单编号", example = "1024")
|
||||
private Long formId;
|
||||
|
||||
@ApiModelProperty(value = "BPMN XML", required = true)
|
||||
@NotEmpty(message = "BPMN XML 不能为空")
|
||||
private String bpmnXml;
|
||||
|
||||
}
|
||||
|
@@ -95,8 +95,7 @@ public interface BpmModelConvert {
|
||||
default void copy(Model model, BpmModelCreateReqVO bean) {
|
||||
model.setName(bean.getName());
|
||||
model.setKey(bean.getKey());
|
||||
model.setCategory(bean.getCategory());
|
||||
model.setMetaInfo(JsonUtils.toJsonString(this.buildMetaInfo(bean.getDescription(), bean.getFormId())));
|
||||
model.setMetaInfo(JsonUtils.toJsonString(this.buildMetaInfo(bean.getDescription(), null)));
|
||||
}
|
||||
|
||||
default void copy(Model model, BpmModelUpdateReqVO bean) {
|
||||
|
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.enums.definition;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* BPM 模型的表单类型的枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum BpmModelFormTypeEnum {
|
||||
|
||||
NORMAL(10, "流程表单"), // 对应 BpmFormDO
|
||||
CUSTOM(20, "业务表单") // 业务自己定义的表单,自己进行数据的存储
|
||||
;
|
||||
|
||||
private final Integer type;
|
||||
private final String desc;
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.adminserver.modules.bpm.service.definition.dto;
|
||||
|
||||
import cn.iocoder.yudao.adminserver.modules.bpm.enums.definition.BpmModelFormTypeEnum;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -15,9 +16,24 @@ public class BpmModelMetaInfoRespDTO {
|
||||
* 流程描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 表单类型
|
||||
*/
|
||||
private Long formType;
|
||||
/**
|
||||
* 表单编号
|
||||
* 在表单类型为 {@link BpmModelFormTypeEnum#NORMAL} 时
|
||||
*/
|
||||
private Long formId;
|
||||
/**
|
||||
* 自定义表单的提交路径,使用 Vue 的路由地址
|
||||
* 在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时
|
||||
*/
|
||||
private String formCustomSubmitPath;
|
||||
/**
|
||||
* 自定义表单的查看路径,使用 Vue 的路由地址
|
||||
* 在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时
|
||||
*/
|
||||
private String formCustomViewPath;
|
||||
|
||||
}
|
||||
|
@@ -121,15 +121,12 @@ public class BpmModelServiceImpl implements BpmModelService {
|
||||
BpmModelConvert.INSTANCE.copy(model, createReqVO);
|
||||
// 保存流程定义
|
||||
repositoryService.saveModel(model);
|
||||
// 添加 BPMN XML
|
||||
repositoryService.addModelEditorSource(model.getId(), StrUtil.utf8Bytes(createReqVO.getBpmnXml()));
|
||||
return model.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class) // 因为进行多个 activiti 操作,所以开启事务
|
||||
public void updateModel(BpmModelUpdateReqVO updateReqVO) {
|
||||
checkKeyNCName(updateReqVO.getKey());
|
||||
// 校验流程模型存在
|
||||
Model model = repositoryService.getModel(updateReqVO.getId());
|
||||
if (model == null) {
|
||||
|
Reference in New Issue
Block a user