feat(REQ-3004) - 测试表单引擎

This commit is contained in:
wangli 2024-11-05 18:25:42 +08:00
parent 896d635bb1
commit df6861fbb1
13 changed files with 204 additions and 136 deletions

View File

@ -33,12 +33,12 @@ public class BpmnModelCreateDTO implements Serializable {
@Length(max = 32, message = "流程名称最长只支持32个字符")
private String name;
/**
* 自定义分类
*/
@ApiModelProperty(value = "自定义分类", notes = "由业务自定义")
@NotBlank(message = "自定义分类不能为空")
private String category;
// /**
// * 自定义分类
// */
// @ApiModelProperty(value = "自定义分类", notes = "由业务自定义")
// @NotBlank(message = "自定义分类不能为空")
// private String category;
/**
* 描述

View File

@ -20,19 +20,21 @@ public class FormDefinitionDTO {
* 表单名称
*/
@ApiModelProperty(value = "表单定义的名称")
@NotBlank(message = "表单名称不能为空")
@NotBlank(message = "表单定义名称不能为空")
private String name;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "表单定义的标识")
@NotBlank(message = "表单定义标识不能为空")
private String key;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "表单的版本")
private int version;
@ApiModelProperty(value = "表单定义的具体字段项", example = "[{'': '''}]")
@Valid
private List<FormFieldsDTO> fields;
// private String description;
@ApiModelProperty(value = "描述")
private String description;
}

View File

@ -32,8 +32,8 @@ public class FormModelCreateDTO {
@Length(max = 255, message = "表单名称最长只支持255个字符")
private String name;
@ApiModelProperty(value = "表单分类", example = "business_form_key")
private String category;
// @ApiModelProperty(value = "表单分类", example = "business_form_key")
// private String category;
@ApiModelProperty(value = "表单模型的 Json 结构")
@Valid

View File

@ -0,0 +1,22 @@
package cn.axzo.workflow.core.service;
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelCreateDTO;
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelUpdateDTO;
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskDelegateAssigner;
import javax.annotation.Nullable;
/**
* 聚合审批模型和表单模型的操作服务
*
* @author wangli
* @since 2024-11-05 16:37
*/
public interface AggregateModelService {
String createModel(BpmnModelCreateDTO dto);
String updateModel(BpmnModelUpdateDTO dto);
String deployModel(String processModelId, @Nullable String tenantId, BpmnTaskDelegateAssigner operator);
}

View File

@ -0,0 +1,85 @@
package cn.axzo.workflow.core.service.impl;
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelCreateDTO;
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelUpdateDTO;
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskDelegateAssigner;
import cn.axzo.workflow.common.model.request.form.model.FormModelUpdateDTO;
import cn.axzo.workflow.core.service.AggregateModelService;
import cn.axzo.workflow.core.service.BpmnProcessModelService;
import cn.axzo.workflow.core.service.FormModelService;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.repository.Model;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Nullable;
import javax.annotation.Resource;
import java.util.Objects;
import static cn.axzo.workflow.common.constant.BpmnConstants.FORM_FILE_SUFFIX;
/**
* 聚合审批模型和表单模型的操作服务
*
* @author wangli
* @since 2024-11-05 16:38
*/
@Slf4j
@Service
public class AggregateModelServiceImpl implements AggregateModelService {
@Resource
private BpmnProcessModelService bpmnProcessModelService;
@Resource
private FormModelService formModelService;
@Resource
private RepositoryService repositoryService;
@Transactional(rollbackFor = Exception.class)
public String createModel(BpmnModelCreateDTO dto) {
String bpmModelId = bpmnProcessModelService.createBpmModel(dto);
Model formModel = repositoryService.createModelQuery().modelKey(dto.getKey()).modelCategory(FORM_FILE_SUFFIX).singleResult();
FormModelUpdateDTO formModelDto = new FormModelUpdateDTO();
formModelDto.setKey(dto.getKey());
formModelDto.setName(dto.getName());
formModelDto.setFormFields(dto.getFormFields());
if (Objects.isNull(formModel)) {
formModelService.createFormModel(formModelDto);
} else {
formModelDto.setFormModelId(formModel.getId());
formModelService.updateFormModel(formModelDto);
}
return bpmModelId;
}
@Override
@Transactional(rollbackFor = Exception.class)
public String updateModel(BpmnModelUpdateDTO dto) {
bpmnProcessModelService.updateBpmModel(dto);
FormModelUpdateDTO formModel = new FormModelUpdateDTO();
formModel.setKey(dto.getKey());
formModel.setName(dto.getName());
formModel.setFormFields(dto.getFormFields());
formModelService.updateFormModel(formModel);
return dto.getProcessModelId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public String deployModel(String processModelId, @Nullable String tenantId, BpmnTaskDelegateAssigner operator) {
String definitionId = bpmnProcessModelService.deployBpmModelById(processModelId, tenantId, operator);
Model model = this.repositoryService.getModel(processModelId);
Model formModel = repositoryService.createModelQuery().modelKey(model.getKey())
.modelCategory(FORM_FILE_SUFFIX)
.singleResult();
if (Objects.isNull(formModel)) {
return definitionId;
}
formModelService.deployFormModelById(formModel.getId(), tenantId);
return definitionId;
}
}

View File

@ -48,6 +48,7 @@ import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import static cn.axzo.workflow.common.constant.BpmnConstants.BPMN_FILE_SUFFIX;
import static cn.axzo.workflow.common.constant.BpmnConstants.DISABLED;
import static cn.axzo.workflow.common.constant.BpmnConstants.ENABLED;
import static cn.axzo.workflow.common.constant.MetaInfoConstants.MODEL_DESCRIPTION;
@ -213,11 +214,11 @@ public class BpmnProcessModelServiceImpl implements BpmnProcessModelService {
public String createBpmModel(@Valid BpmnModelCreateDTO dto) {
ModelQuery modelQuery = repositoryService.createModelQuery()
.modelTenantId(dto.getTenantId())
.modelKey(dto.getCategory());
.modelKey(dto.getKey());
Model existModel = modelQuery.singleResult();
if (!ObjectUtils.isEmpty(existModel)) {
throw new WorkflowEngineException(MODEL_KEY_EXISTS, dto.getCategory());
throw new WorkflowEngineException(MODEL_KEY_EXISTS, dto.getKey());
}
Map<String, String> metaInfoMap = new HashMap<>();
@ -227,14 +228,14 @@ public class BpmnProcessModelServiceImpl implements BpmnProcessModelService {
Model model = repositoryService.newModel();
model.setName(dto.getName());
model.setMetaInfo(JSONUtil.toJsonStr(metaInfoMap));
model.setCategory(dto.getCategory());
model.setKey(StringUtils.hasLength(dto.getKey()) ? dto.getKey() : dto.getCategory());
model.setCategory(BPMN_FILE_SUFFIX);
model.setKey(dto.getKey());
model.setTenantId(dto.getTenantId());
repositoryService.saveModel(model);
//存储Bpmn协议
if (Objects.nonNull(dto.getJsonModel())) {
BpmnModel bpmnModel = BpmnJsonConverterUtil.convertToBpmn(dto.getJsonModel().getNode(),
StringUtils.hasLength(dto.getKey()) ? dto.getKey() : dto.getCategory(),
dto.getKey(),
dto.getName(),
dto.getDescription(),
dto.getJsonModel().getApproveConf(),
@ -242,7 +243,7 @@ public class BpmnProcessModelServiceImpl implements BpmnProcessModelService {
dto.getJsonModel().getButtonConf(),
dto.getJsonModel().getFieldConf(),
serviceVersion);
BpmnJsonConverterUtil.setCategory(bpmnModel, dto.getCategory());
BpmnJsonConverterUtil.setCategory(bpmnModel, dto.getKey());
byte[] bpmn = BpmnJsonConverterUtil.transformBytes(bpmnModel);
processDefinitionService.updateProcessDefinition(model.getId(), bpmn);
}
@ -303,7 +304,7 @@ public class BpmnProcessModelServiceImpl implements BpmnProcessModelService {
ModelQuery query = repositoryService.createModelQuery()
.modelId(dto.getProcessModelId())
.modelTenantId(dto.getTenantId())
.modelKey(dto.getCategory());
.modelKey(dto.getKey());
Model originModel = query.singleResult();
if (ObjectUtils.isEmpty(originModel)) {
@ -315,15 +316,15 @@ public class BpmnProcessModelServiceImpl implements BpmnProcessModelService {
originModel.setName(dto.getName());
originModel.setMetaInfo(JSONUtil.toJsonStr(metaInfoMap));
originModel.setCategory(dto.getCategory());
originModel.setKey(StringUtils.hasLength(dto.getKey()) ? dto.getKey() : dto.getCategory());
originModel.setCategory(BPMN_FILE_SUFFIX);
originModel.setKey(dto.getKey());
originModel.setTenantId(dto.getTenantId());
repositoryService.saveModel(originModel);
//存储Bpmn协议
if (Objects.nonNull(dto.getJsonModel())) {
BpmnModel bpmnModel = BpmnJsonConverterUtil.convertToBpmn(dto.getJsonModel().getNode(),
StringUtils.hasLength(dto.getKey()) ? dto.getKey() : dto.getCategory(),
dto.getKey(),
dto.getName(),
dto.getDescription(),
dto.getJsonModel().getApproveConf(),
@ -331,7 +332,7 @@ public class BpmnProcessModelServiceImpl implements BpmnProcessModelService {
dto.getJsonModel().getButtonConf(),
dto.getJsonModel().getFieldConf(),
serviceVersion);
BpmnJsonConverterUtil.setCategory(bpmnModel, dto.getCategory());
BpmnJsonConverterUtil.setCategory(bpmnModel, dto.getKey());
byte[] bpmn = BpmnJsonConverterUtil.transformBytes(bpmnModel);
processDefinitionService.updateProcessDefinition(originModel.getId(), bpmn);
}

View File

@ -5,6 +5,7 @@ import cn.axzo.workflow.common.model.request.form.definition.FormDefinitionUpdat
import cn.axzo.workflow.common.model.response.form.definition.FormDefinitionVO;
import javax.annotation.Nullable;
import javax.validation.constraints.NotBlank;
/**
* 表单定义相关服务接口
@ -14,8 +15,7 @@ import javax.annotation.Nullable;
*/
public interface FormDefinitionService {
FormDefinitionVO getDraft(String formModelId, @Nullable String tenantId);
FormDefinitionVO get(String formModeId, @Nullable String tenantId);
void updateFormDefinition(FormDefinitionUpdateDTO dto);
}

View File

@ -1,27 +1,22 @@
package cn.axzo.workflow.form.service.impl;
import cn.axzo.workflow.common.exception.WorkflowEngineException;
import cn.axzo.workflow.common.model.request.form.definition.FormDefinitionCreateDTO;
import cn.axzo.workflow.common.model.request.form.definition.FormDefinitionDTO;
import cn.axzo.workflow.common.model.request.form.definition.FormDefinitionUpdateDTO;
import cn.axzo.framework.jackson.utility.JSON;
import cn.axzo.workflow.common.model.response.form.definition.FormDefinitionVO;
import cn.axzo.workflow.form.service.FormDefinitionService;
import cn.hutool.core.bean.BeanUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.flowable.common.engine.impl.util.IoUtil;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.repository.Model;
import org.flowable.form.api.FormDefinition;
import org.flowable.form.api.FormRepositoryService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Nullable;
import javax.annotation.Resource;
import java.util.Objects;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import static cn.axzo.workflow.common.code.FormDefinitionRespCode.FORM_DEFINITION_EXISTS;
import static cn.axzo.workflow.common.code.FormModelRespCode.FORM_MODEL_ID_NOT_EXISTS;
import static cn.axzo.workflow.common.code.FormModelRespCode.FORM_MODEL_NOT_EXISTS;
import static cn.axzo.workflow.common.constant.BpmnConstants.FORM_FILE_SUFFIX;
/**
@ -34,56 +29,27 @@ import static cn.axzo.workflow.common.code.FormModelRespCode.FORM_MODEL_NOT_EXIS
@Service
@RequiredArgsConstructor
public class FormDefinitionServiceImpl implements FormDefinitionService {
@Resource
private FormRepositoryService formRepositoryService;
@Resource
private RepositoryService repositoryService;
@Resource
private ObjectMapper objectMapper;
@Override
public FormDefinitionVO get(String formModelId, @Nullable String tenantId) {
Model model = repositoryService.getModel(formModelId);
public FormDefinitionVO getDraft(String formModelId, @Nullable String tenantId) {
if (Objects.isNull(model)) {
throw new WorkflowEngineException(FORM_MODEL_ID_NOT_EXISTS, formModelId);
}
if (Objects.nonNull(tenantId) && !Objects.equals(model.getTenantId(), tenantId)) {
throw new WorkflowEngineException(FORM_MODEL_NOT_EXISTS);
}
FormDefinitionVO vo = null;
try {
vo = objectMapper.readValue(repositoryService.getModelEditorSource(model.getId()),
FormDefinitionVO.class);
} catch (Exception e) {
throw new WorkflowEngineException(FORM_DEFINITION_EXISTS);
}
vo.setKey(model.getKey());
vo.setName(model.getName());
vo.setCategory(model.getCategory());
vo.setVersion(model.getVersion());
vo.setTenantId(model.getTenantId());
return vo;
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateFormDefinition(FormDefinitionUpdateDTO dto) {
Model model = repositoryService.getModel(dto.getFormModelId());
if (Objects.isNull(model)) {
throw new WorkflowEngineException(FORM_MODEL_ID_NOT_EXISTS, dto.getFormModelId());
}
// if (Objects.nonNull(dto.getTenantId()) && !Objects.equals(model.getTenantId(), dto.getTenantId())) {
// throw new WorkflowEngineException(FORM_MODEL_ID_NOT_EXISTS, dto.getFormModelId());
// }
try {
repositoryService.addModelEditorSource(model.getId(),
objectMapper.writeValueAsString(dto.getFormDefinition()).getBytes());
} catch (Exception e) {
throw new WorkflowEngineException(FORM_DEFINITION_EXISTS);
}
repositoryService.saveModel(model);
public FormDefinitionVO get(String key, @Nullable String tenantId) {
FormDefinition formDefinition = formRepositoryService.createFormDefinitionQuery()
.formDefinitionKey(key)
.formTenantId(tenantId)
.singleResult();
InputStream formDefinitionResource = formRepositoryService.getFormDefinitionResource(formDefinition.getId());
byte[] bytes = IoUtil.readInputStream(formDefinitionResource, key + FORM_FILE_SUFFIX);
IoUtil.closeSilently(formDefinitionResource);
return JSON.parseObject(new String(bytes, StandardCharsets.UTF_8), FormDefinitionVO.class);
}
}

View File

@ -3,6 +3,7 @@ package cn.axzo.workflow.form.service.impl;
import cn.axzo.framework.jackson.utility.JSON;
import cn.axzo.workflow.common.exception.WorkflowEngineException;
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelSearchDTO;
import cn.axzo.workflow.common.model.request.form.definition.FormDefinitionDTO;
import cn.axzo.workflow.common.model.request.form.model.FormModelCreateDTO;
import cn.axzo.workflow.common.model.request.form.model.FormModelUpdateDTO;
import cn.axzo.workflow.common.model.response.BpmPageResult;
@ -30,6 +31,7 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import static cn.axzo.workflow.common.code.FormModelRespCode.FORM_MODEL_EXISTS;
import static cn.axzo.workflow.common.code.FormModelRespCode.FORM_MODEL_NOT_EXISTS;
import static cn.axzo.workflow.common.constant.BpmnConstants.FORM_FILE_SUFFIX;
import static cn.axzo.workflow.common.constant.MetaInfoConstants.MODEL_TYPE;
@ -59,24 +61,30 @@ public class FormModelServiceImpl implements FormModelService {
public String createFormModel(FormModelCreateDTO dto) {
Model persistModel = repositoryService.createModelQuery()
.modelKey(dto.getKey())
.modelCategory(FORM_FILE_SUFFIX)
.modelTenantId(dto.getTenantId())
.singleResult();
if (Objects.nonNull(persistModel)) {
throw new WorkflowEngineException(FORM_MODEL_NOT_EXISTS);
throw new WorkflowEngineException(FORM_MODEL_EXISTS);
}
Map<String, String> metaInfoMap = new HashMap<>();
metaInfoMap.put(MODEL_TYPE, MODEL_TYPE_FORM);
Model model = repositoryService.newModel();
model.setKey(dto.getKey());
model.setCategory(dto.getCategory());
model.setCategory(FORM_FILE_SUFFIX);
model.setName(dto.getName());
model.setTenantId(dto.getTenantId());
model.setMetaInfo(JSONUtil.toJsonStr(metaInfoMap));
repositoryService.saveModel(model);
FormDefinitionDTO formDefinition = new FormDefinitionDTO();
formDefinition.setKey(dto.getKey());
formDefinition.setName(dto.getName());
formDefinition.setVersion(model.getVersion());
formDefinition.setFields(dto.getFormFields());
repositoryService.addModelEditorSource(model.getId(), JSON.toJSONString(dto.getFormFields()).getBytes(StandardCharsets.UTF_8));
repositoryService.addModelEditorSource(model.getId(), JSON.toJSONString(formDefinition).getBytes(StandardCharsets.UTF_8));
return model.getId();
}
@ -86,14 +94,23 @@ public class FormModelServiceImpl implements FormModelService {
Model model = repositoryService.createModelQuery()
.modelId(dto.getFormModelId())
.modelKey(dto.getKey())
.modelCategory(FORM_FILE_SUFFIX)
.modelTenantId(dto.getTenantId())
.singleResult();
if (Objects.isNull(model)) {
throw new WorkflowEngineException(FORM_MODEL_NOT_EXISTS);
}
model.setName(dto.getName());
model.setCategory(dto.getCategory());
model.setCategory(FORM_FILE_SUFFIX);
repositoryService.saveModel(model);
FormDefinitionDTO formDefinition = new FormDefinitionDTO();
formDefinition.setKey(model.getKey());
formDefinition.setName(dto.getName());
formDefinition.setVersion(model.getVersion());
formDefinition.setFields(dto.getFormFields());
repositoryService.addModelEditorSource(model.getId(), JSON.toJSONString(formDefinition).getBytes(StandardCharsets.UTF_8));
}
@Override

View File

@ -201,7 +201,7 @@ public class BpmnProcessDefinitionController implements ProcessDefinitionApi {
updateDTO.setProcessModelId(modelDetail.getId());
updateDTO.setKey(modelDetail.getKey());
updateDTO.setName(modelDetail.getName());
updateDTO.setCategory(modelDetail.getCategory());
// updateDTO.setCategory(modelDetail.getCategory());
updateDTO.setTenantId(modelDetail.getTenantId());
updateDTO.setJsonModel(processDefinition.getJsonModel());

View File

@ -5,15 +5,12 @@ import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelCreateDTO;
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelSearchDTO;
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelUpdateDTO;
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskDelegateAssigner;
import cn.axzo.workflow.common.model.request.form.definition.FormDefinitionCreateDTO;
import cn.axzo.workflow.common.model.request.form.definition.FormDefinitionDTO;
import cn.axzo.workflow.common.model.response.BpmPageResult;
import cn.axzo.workflow.common.model.response.bpmn.model.BpmnModelDetailVO;
import cn.axzo.workflow.common.model.response.bpmn.model.BpmnModelExtVO;
import cn.axzo.workflow.core.service.AggregateModelService;
import cn.axzo.workflow.core.service.BpmnProcessModelService;
import cn.axzo.workflow.core.service.ExtAxBpmnFormRelationService;
import cn.axzo.workflow.core.service.ExtAxReModelService;
import cn.axzo.workflow.form.service.FormDefinitionService;
import cn.axzo.workflow.server.common.annotation.ErrorReporter;
import cn.axzo.workflow.server.common.annotation.RepeatSubmit;
import cn.azxo.framework.common.model.CommonResponse;
@ -22,6 +19,7 @@ import com.alibaba.fastjson.JSON;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
@ -52,9 +50,7 @@ public class BpmnProcessModelController implements ProcessModelApi {
@Resource
private BpmnProcessModelService bpmnProcessModelService;
@Resource
private FormDefinitionService formDefinitionService;
@Resource
private ExtAxBpmnFormRelationService bpmnFormRelationService;
private AggregateModelService aggregateModelService;
@Resource
private ExtAxReModelService reModelService;
@ -80,21 +76,13 @@ public class BpmnProcessModelController implements ProcessModelApi {
@RepeatSubmit
public CommonResponse<String> create(@Validated @RequestBody BpmnModelCreateDTO dto) {
log.info("创建流程createBpmModel===>>>参数:{}", JSONUtil.toJsonStr(dto));
String bpmnModelId = bpmnProcessModelService.createBpmModel(dto);
// FormDefinitionCreateDTO createDto = new FormDefinitionCreateDTO();
// createDto.setKey(dto.getKey());
// createDto.setName(dto.getName());
// createDto.setCategory(dto.getCategory());
// FormDefinitionDTO formDefinitionDTO = new FormDefinitionDTO();
// formDefinitionDTO.setName(dto.getName());
// formDefinitionDTO.setFields(dto.getFormFields());
// createDto.setFormDefinition(formDefinitionDTO);
// createDto.setTenantId(dto.getTenantId());
//
// String formDefinitionId = formDefinitionService.createFormDefinition(createDto);
//
// bpmnFormRelationService.insert(bpmnModelId, formDefinitionId);
String bpmnModelId;
if (CollectionUtils.isEmpty(dto.getFormFields())) {
// 无表单的模型
bpmnModelId = bpmnProcessModelService.createBpmModel(dto);
} else {
bpmnModelId = aggregateModelService.createModel(dto);
}
return success(bpmnModelId);
}
@ -158,22 +146,11 @@ public class BpmnProcessModelController implements ProcessModelApi {
@Override
public CommonResponse<String> update(@Validated @RequestBody BpmnModelUpdateDTO dto) {
log.info("修改流程信息updateBpmModel===>>> 模型 ID: {}", dto.getProcessModelId());
bpmnProcessModelService.updateBpmModel(dto);
// FormDefinitionCreateDTO formDefinitionDto = new FormDefinitionCreateDTO();
// formDefinitionDto.setName(dto.getName());
// formDefinitionDto.setKey(dto.getKey());
// formDefinitionDto.setCategory(dto.getCategory());
// formDefinitionDto.setTenantId(dto.getTenantId());
//
// FormDefinitionDTO definition = new FormDefinitionDTO();
// definition.setName(dto.getName());
// definition.setFields(dto.getFormFields());
// formDefinitionDto.setFormDefinition(definition);
//
// String formDefinitionId = formDefinitionService.createFormDefinition(formDefinitionDto);
//
// bpmnFormRelationService.insert(dto.getProcessModelId(), formDefinitionId);
if(CollectionUtils.isEmpty(dto.getFormFields())) {
bpmnProcessModelService.updateBpmModel(dto);
} else {
aggregateModelService.updateModel(dto);
}
return success(dto.getProcessModelId());
}
@ -193,9 +170,9 @@ public class BpmnProcessModelController implements ProcessModelApi {
log.info("部署模型deployBpmModelById===>>>参数:{}, 租户 ID: {}, operator: {}", JSONUtil.toJsonStr(processModelId),
modelTenantId, operator);
BpmnTaskDelegateAssigner assignee = JSON.parseObject(operator, BpmnTaskDelegateAssigner.class);
String result = bpmnProcessModelService.deployBpmModelById(processModelId, modelTenantId, assignee);
// String formModelId = bpmnFormRelationService.getFormModelId(processModelId);
// formModelService.deployFormModelById(formModelId, modelTenantId);
String result = aggregateModelService.deployModel(processModelId, modelTenantId, assignee);
// 审批模型的发布
// String result = bpmnProcessModelService.deployBpmModelById(processModelId, modelTenantId, assignee);
return success(result);
}

View File

@ -42,20 +42,18 @@ public class FormDefinitionController {
@Resource
private FormModelService formModelService;
@Operation(summary = "更新表单定义内容")
@PutMapping("/update")
public CommonResponse<Boolean> updateFormDefinition(@Validated @RequestBody FormDefinitionUpdateDTO dto) {
formDefinitionService.updateFormDefinition(dto);
return success(true);
@Operation(summary = "通过指定表单模型 ID 获取表单定义草稿内容")
@GetMapping()
public CommonResponse<FormDefinitionVO> getDraft(@NotBlank(message = "表单模型ID不能为空") @RequestParam String formModelId,
@RequestParam(required = false, defaultValue = "") String tenantId) {
return success(formDefinitionService.getDraft(formModelId, tenantId));
}
@Operation(summary = "通过表单模型 ID 获取表单定义内容")
@GetMapping("/get")
public CommonResponse<FormDefinitionVO> get(@NotBlank(message = "模型 ID 不能为空") @RequestParam String formModelId,
@NotBlank(message = "租户不能为空") @RequestParam String tenantId) {
public CommonResponse<FormDefinitionVO> get(@NotBlank(message = "表单模型ID不能为空") @RequestParam String formModelId,
@RequestParam(required = false, defaultValue = "") String tenantId) {
return success(formDefinitionService.get(formModelId, tenantId));
}
}

View File

@ -84,7 +84,7 @@ public class FormModelController {
@Operation(summary = "获取指定表单模型 ID 的内容")
@GetMapping("/get")
public CommonResponse<FormModelBaseVO> getById(@NotBlank(message = "表单模型 ID 不能为空") @RequestParam String formModelId,
@NotBlank(message = "租户不能为空") @RequestParam String tenantId) {
@RequestParam(required = false, defaultValue = "") String tenantId) {
return success(formModelService.getById(formModelId, tenantId));
}