update - 回归测试流程模型,并调整部分 API 参数模型

This commit is contained in:
wangli 2023-07-25 19:03:15 +08:00
parent 9e8f922b9b
commit 99423c1fbd
13 changed files with 240 additions and 147 deletions

View File

@ -17,8 +17,4 @@ public interface BpmFormDefinitionService {
void updateFormDefinition(FormDefinitionUpdateDTO dto);
String deployFormModelById(String formModelId, @Nullable String tenantId);
String deployFormModelByKey(String formModelKey, @Nullable String tenantId);
}

View File

@ -20,9 +20,17 @@ public interface BpmFormModelService {
void updateFormModel(FormModelUpdateDTO dto);
void deleteFormModel(String formModelId, @Nullable String tenantId);
BpmPageResult<BpmModelBaseVO> getModelPage(BpmModelSearchDTO dto);
BpmModelBaseVO get(String formModelId, @Nullable String tenantId);
BpmModelBaseVO getById(String formModelId, @Nullable String tenantId);
BpmModelBaseVO getByKey(String formModelKey, @Nullable String tenantId);
String deployFormModelById(String formModelId, @Nullable String tenantId);
String deployFormModelByKey(String formModelKey, @Nullable String tenantId);
void deleteFormModelById(String formModelId, @Nullable String tenantId);
void deleteFormModelByKey(String formModelKey, @Nullable String tenantId);
}

View File

@ -4,8 +4,8 @@ import cn.axzo.workflow.core.service.dto.request.model.BpmModelCreateDTO;
import cn.axzo.workflow.core.service.dto.request.model.BpmModelSearchDTO;
import cn.axzo.workflow.core.service.dto.request.model.BpmModelUpdateDTO;
import cn.axzo.workflow.core.service.dto.response.BpmPageResult;
import cn.axzo.workflow.core.service.dto.response.form.model.BpmModelBaseVO;
import cn.axzo.workflow.core.service.dto.response.model.BpmModelDetailVO;
import cn.axzo.workflow.core.service.dto.response.model.BpmProcessModelVO;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Nullable;
@ -16,46 +16,48 @@ public interface BpmProcessModelService {
/**
* 获取流程模型的查询结果
*/
BpmPageResult<BpmProcessModelVO> getModelPage(BpmModelSearchDTO modelPageDTO);
BpmPageResult<BpmModelBaseVO> getModelPage(BpmModelSearchDTO dto);
/**
* 创建流程,
* return modelId的主键
*/
String createBpmModel(BpmModelCreateDTO createDTO);
String createBpmModel(BpmModelCreateDTO dto);
String createBpmModelWithXml(String fileUrl);
/**
* 获取模型
*/
BpmModelDetailVO getModelDetailById(String modelId);
BpmModelDetailVO getById(String processModelId, @Nullable String tenantId);
/**
* 获取模型
*/
BpmModelDetailVO getModelDetailByKey(String modelKey);
BpmModelDetailVO getByKey(String processModelKey, @Nullable String tenantId);
/**
* 修改流程信息
*/
void updateBpmModel(BpmModelUpdateDTO updateDTO);
void updateBpmModel(BpmModelUpdateDTO dto);
/**
* 部署模型
* return 部署完成的流程定义Id
*/
String deployBpmModelById(String modelId, @Nullable String tenantId);
String deployBpmModelById(String processModelId, @Nullable String tenantId);
/**
* 部署模型
* return 部署完成的流程定义Id
*/
String deployBpmModelByKey(String modelKey, @Nullable String tenantId);
String deployBpmModelByKey(String processModelKey, @Nullable String tenantId);
/**
* 删除模型
*/
void deleteBpmModel(String modelId, String tenantId);
void deleteBpmModelById(String processModelId, @Nullable String tenantId);
void deleteBpmModelByKey(String processModelKey, @Nullable String tenantId);
}

View File

@ -12,6 +12,7 @@ public class BpmModelConverter {
return null;
}
BpmModelDetailVO detailVO = new BpmModelDetailVO();
detailVO.setId(model.getId());
detailVO.setCreateAt(model.getCreateTime());
detailVO.setKey(model.getKey());
detailVO.setUpdateAt(model.getLastUpdateTime());

View File

@ -15,13 +15,14 @@ import javax.validation.constraints.NotBlank;
@Data
public class FormModelCreateDTO {
@ApiModelProperty(value = "流程表单标识", example = "form_key", hidden = true)
@Length(max = 255, message = "流程表单标识最长只支持255个字符")
@ApiModelProperty(value = "表单标识", example = "form_key", hidden = true)
@Length(max = 255, message = "表单标识最长只支持255个字符")
@NotBlank(message = "流程表单 key 不能为空")
private String key;
@ApiModelProperty(value = "表单名称", example = "第一个表单")
@NotBlank(message = "表单名称不能为空")
@Length(max = 255, message = "表单名称最长只支持255个字符")
private String name;
@ApiModelProperty(value = "表单分类", example = "business_form_key")

View File

@ -20,7 +20,7 @@ public class BpmModelCreateDTO {
*/
@ApiModelProperty(value = "流程名称", required = true, example = "模板流程名称")
@NotBlank(message = "流程名称不能为空")
@Length(max = 20, message = "流程名称最长只支持255个字符")
@Length(max = 255, message = "流程名称最长只支持255个字符")
private String name;
/**
@ -29,7 +29,6 @@ public class BpmModelCreateDTO {
* OA 2
*/
@ApiModelProperty(value = "所属业务", notes = "由业务自定义", example = "1")
@NotBlank(message = "所属业务不能为空")
private String category;
/**

View File

@ -6,11 +6,11 @@ import lombok.Data;
/**
* 修改流程模型的 DTO
* */
*/
@Data
public class BpmModelUpdateDTO extends BpmModelCreateDTO{
public class BpmModelUpdateDTO extends BpmModelCreateDTO {
@ApiModelProperty(value = "ID", required = true)
private String id;
@ApiModelProperty(value = "流程模型 ID", required = true)
private String processModelId;
}

View File

@ -11,8 +11,6 @@ import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.TaskService;
import org.flowable.engine.repository.Model;
import org.flowable.engine.repository.ModelQuery;
import org.flowable.form.api.FormDeployment;
import org.flowable.form.api.FormRepositoryService;
import org.flowable.form.api.FormService;
import org.springframework.stereotype.Service;
@ -93,40 +91,4 @@ public class BpmFormDefinitionServiceImpl implements BpmFormDefinitionService {
repositoryService.saveModel(model);
}
@Override
@Transactional(rollbackFor = Exception.class)
public String deployFormModelById(String formModelId, String tenantId) {
Model model = repositoryService.getModel(formModelId);
if (Objects.isNull(model)) {
throw new WorkflowEngineException("模型不存在");
}
if (StringUtils.hasLength(tenantId) && !Objects.equals(model.getTenantId(), tenantId)) {
throw new WorkflowEngineException("模型不存在");
}
FormDeployment deploy = formRepositoryService.createDeployment()
.addFormDefinition(model.getKey() + ".form",
new String(repositoryService.getModelEditorSource(model.getId())))
.name(model.getName())
.category(model.getCategory())
.tenantId(model.getTenantId())
.deploy();
return deploy.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public String deployFormModelByKey(String formModelKey, String tenantId) {
ModelQuery modelQuery = repositoryService.createModelQuery().modelKey(formModelKey);
if (StringUtils.hasLength(tenantId)) {
modelQuery.modelTenantId(tenantId);
}
Model model = modelQuery.singleResult();
if (Objects.isNull(model)) {
throw new WorkflowEngineException("模型不存在");
}
return deployFormModelById(model.getId(), null);
}
}

View File

@ -12,7 +12,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.flowable.engine.ManagementService;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.repository.Model;
import org.flowable.engine.repository.ModelQuery;
import org.flowable.engine.repository.NativeModelQuery;
import org.flowable.form.api.FormDeployment;
import org.flowable.form.api.FormRepositoryService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -82,19 +84,6 @@ public class BpmFormModelServiceImpl implements BpmFormModelService {
repositoryService.saveModel(model);
}
@Override
public void deleteFormModel(String formModelId, @Nullable String tenantId) {
Model model = repositoryService.getModel(formModelId);
if (Objects.isNull(model)) {
throw new WorkflowEngineException("模型不存在");
}
if (StringUtils.hasLength(tenantId) && !Objects.equals(model.getTenantId(), tenantId)) {
throw new WorkflowEngineException("模型不存在");
}
repositoryService.deleteModel(formModelId);
}
@Override
public BpmPageResult<BpmModelBaseVO> getModelPage(BpmModelSearchDTO dto) {
String tableName = managementService.getTableName(Model.class);
@ -102,7 +91,8 @@ public class BpmFormModelServiceImpl implements BpmFormModelService {
.append(tableName);
NativeModelQuery query = repositoryService.createNativeModelQuery();
if (StringUtils.hasLength(dto.getKey())) {
baseQuerySql.append(" where KEY_ = #{key}");
baseQuerySql.append(sqlConnectors(baseQuerySql))
.append(" KEY_ = #{key}");
query.parameter("key", dto.getKey());
}
if (StringUtils.hasLength(dto.getName())) {
@ -124,8 +114,7 @@ public class BpmFormModelServiceImpl implements BpmFormModelService {
baseQuerySql.append(sqlConnectors(baseQuerySql))
.append(" META_INFO_ = #{metaInfo}");
query.parameter("metaInfo", MODEL_META_INFO_FORM);
NativeModelQuery dateSqlQuery = query //.orderByLastUpdateTime()
.sql(baseQuerySql.append(" order by LAST_UPDATE_TIME_ desc").toString());
NativeModelQuery dateSqlQuery = query.sql(baseQuerySql.append(" order by LAST_UPDATE_TIME_ desc").toString());
List<Model> models = dateSqlQuery
.listPage((dto.getPageNo() - 1) * dto.getPageSize(), dto.getPageSize());
if (CollectionUtils.isEmpty(models)) {
@ -137,7 +126,7 @@ public class BpmFormModelServiceImpl implements BpmFormModelService {
}
@Override
public BpmModelBaseVO get(String formModelId, @Nullable String tenantId) {
public BpmModelBaseVO getById(String formModelId, @Nullable String tenantId) {
Model model = repositoryService.getModel(formModelId);
if (Objects.isNull(model)) {
throw new WorkflowEngineException("模型不存在");
@ -148,6 +137,81 @@ public class BpmFormModelServiceImpl implements BpmFormModelService {
return formModelConverter.toVo(model);
}
@Override
public BpmModelBaseVO getByKey(String formModelKey, @Nullable String tenantId) {
ModelQuery modelQuery = repositoryService.createModelQuery();
if (StringUtils.hasLength(tenantId)) {
modelQuery.modelTenantId(tenantId);
}
Model model = modelQuery.modelKey(formModelKey).singleResult();
if (Objects.isNull(model)) {
throw new WorkflowEngineException("模型不存在");
}
return formModelConverter.toVo(model);
}
@Override
@Transactional(rollbackFor = Exception.class)
public String deployFormModelById(String formModelId, String tenantId) {
Model model = repositoryService.getModel(formModelId);
if (Objects.isNull(model)) {
throw new WorkflowEngineException("模型不存在");
}
if (StringUtils.hasLength(tenantId) && !Objects.equals(model.getTenantId(), tenantId)) {
throw new WorkflowEngineException("模型不存在");
}
FormDeployment deploy = formRepositoryService.createDeployment()
.addFormDefinition(model.getKey() + ".form",
new String(repositoryService.getModelEditorSource(model.getId())))
.name(model.getName())
.category(model.getCategory())
.tenantId(model.getTenantId())
.deploy();
return deploy.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public String deployFormModelByKey(String formModelKey, String tenantId) {
ModelQuery modelQuery = repositoryService.createModelQuery().modelKey(formModelKey);
if (StringUtils.hasLength(tenantId)) {
modelQuery.modelTenantId(tenantId);
}
Model model = modelQuery.singleResult();
if (Objects.isNull(model)) {
throw new WorkflowEngineException("模型不存在");
}
return deployFormModelById(model.getId(), null);
}
@Override
public void deleteFormModelById(String formModelId, @Nullable String tenantId) {
Model model = repositoryService.getModel(formModelId);
if (Objects.isNull(model)) {
throw new WorkflowEngineException("模型不存在");
}
if (StringUtils.hasLength(tenantId) && !Objects.equals(model.getTenantId(), tenantId)) {
throw new WorkflowEngineException("模型不存在");
}
repositoryService.deleteModel(formModelId);
}
@Override
public void deleteFormModelByKey(String formModelKey, @Nullable String tenantId) {
ModelQuery modelQuery = repositoryService.createModelQuery().modelKey(formModelKey);
if (StringUtils.hasLength(tenantId)) {
modelQuery.modelTenantId(tenantId);
}
Model model = modelQuery.singleResult();
if (Objects.isNull(model)) {
throw new WorkflowEngineException("模型不存在");
}
repositoryService.deleteModel(model.getId());
}
public static String sqlConnectors(StringBuilder stringBuilder) {
if (stringBuilder.indexOf("where") < 0) {
return " where";

View File

@ -10,8 +10,8 @@ import cn.axzo.workflow.core.service.dto.request.model.BpmModelCreateDTO;
import cn.axzo.workflow.core.service.dto.request.model.BpmModelSearchDTO;
import cn.axzo.workflow.core.service.dto.request.model.BpmModelUpdateDTO;
import cn.axzo.workflow.core.service.dto.response.BpmPageResult;
import cn.axzo.workflow.core.service.dto.response.form.model.BpmModelBaseVO;
import cn.axzo.workflow.core.service.dto.response.model.BpmModelDetailVO;
import cn.axzo.workflow.core.service.dto.response.model.BpmProcessModelVO;
import org.flowable.common.engine.impl.db.SuspensionState;
import org.flowable.engine.ManagementService;
import org.flowable.engine.RepositoryService;
@ -23,6 +23,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Nullable;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Collections;
@ -31,6 +32,7 @@ import java.util.Objects;
import static cn.axzo.workflow.core.common.BpmConstants.MODEL_META_INFO_PROCESS;
import static cn.axzo.workflow.core.common.enums.BpmErrorCode.*;
import static cn.axzo.workflow.core.service.impl.BpmFormModelServiceImpl.countSql;
import static cn.axzo.workflow.core.service.impl.BpmFormModelServiceImpl.sqlConnectors;
@Service
@ -47,13 +49,14 @@ public class BpmProcessModelServiceImpl implements BpmProcessModelService {
private FormModelConverter formModelConverter;
@Override
public BpmPageResult<BpmProcessModelVO> getModelPage(BpmModelSearchDTO dto) {
public BpmPageResult<BpmModelBaseVO> getModelPage(BpmModelSearchDTO dto) {
String tableName = managementService.getTableName(Model.class);
StringBuilder baseQuerySql = new StringBuilder("SELECT * FROM ")
.append(tableName);
NativeModelQuery query = repositoryService.createNativeModelQuery();
if (StringUtils.hasLength(dto.getKey())) {
baseQuerySql.append(" where KEY_ = #{key}");
baseQuerySql.append(sqlConnectors(baseQuerySql))
.append(" KEY_ = #{key}");
query.parameter("key", dto.getKey());
}
if (StringUtils.hasLength(dto.getName())) {
@ -75,20 +78,18 @@ public class BpmProcessModelServiceImpl implements BpmProcessModelService {
baseQuerySql.append(sqlConnectors(baseQuerySql))
.append(" META_INFO_ = #{metaInfo}");
query.parameter("metaInfo", MODEL_META_INFO_PROCESS);
List<Model> models = query //.orderByLastUpdateTime()
.sql(baseQuerySql.append(" order by LAST_UPDATE_TIME_ desc").toString())
NativeModelQuery dataSqlQuery = query.sql(baseQuerySql.append(" order by LAST_UPDATE_TIME_ desc").toString());
List<Model> models = dataSqlQuery
.listPage((dto.getPageNo() - 1) * dto.getPageSize(), dto.getPageSize());
if (CollectionUtils.isEmpty(models)) {
return new BpmPageResult<>(Collections.emptyList(), query.count());
return new BpmPageResult<>(Collections.emptyList(), 0L);
}
// return new BpmPageResult<>(formModelConverter.toVos(models), query.count());
return null;
NativeModelQuery countSqlQuery = query.sql(countSql(baseQuerySql));
return new BpmPageResult<>(formModelConverter.toVos(models), countSqlQuery.count());
}
@Override
public String createBpmModel(@Valid BpmModelCreateDTO dto) {
Model existModel = repositoryService.createModelQuery()
.modelKey(dto.getKey())
.modelTenantId(dto.getTenantId())
@ -131,10 +132,10 @@ public class BpmProcessModelServiceImpl implements BpmProcessModelService {
* 获取模型
*/
@Override
public BpmModelDetailVO getModelDetailById(String modelId) {
Model model = repositoryService.getModel(modelId);
public BpmModelDetailVO getById(String processModelId, @Nullable String tenantId) {
Model model = repositoryService.getModel(processModelId);
if (Objects.isNull(model)) {
throw new WorkflowEngineException(MODEL_ID_NOT_EXISTS, modelId);
throw new WorkflowEngineException(MODEL_ID_NOT_EXISTS, processModelId);
}
return BpmModelConverter.convert(model);
}
@ -143,10 +144,10 @@ public class BpmProcessModelServiceImpl implements BpmProcessModelService {
* 获取模型
*/
@Override
public BpmModelDetailVO getModelDetailByKey(String modelKey) {
Model model = repositoryService.createModelQuery().modelKey(modelKey).singleResult();
public BpmModelDetailVO getByKey(String processModelKey, @Nullable String tenantId) {
Model model = repositoryService.createModelQuery().modelKey(processModelKey).singleResult();
if (Objects.isNull(model)) {
throw new WorkflowEngineException(MODEL_KEY_NOT_EXISTS, modelKey);
throw new WorkflowEngineException(MODEL_KEY_NOT_EXISTS, processModelKey);
}
return BpmModelConverter.convert(model);
}
@ -154,10 +155,11 @@ public class BpmProcessModelServiceImpl implements BpmProcessModelService {
@Override
public void updateBpmModel(BpmModelUpdateDTO dto) {
Model originModel = repositoryService.createModelQuery()
.modelId(dto.getId())
.modelId(dto.getProcessModelId())
.modelKey(dto.getKey())
.singleResult();
if (ObjectUtils.isEmpty(originModel)) {
throw new WorkflowEngineException(MODEL_ID_NOT_EXISTS, dto.getId());
throw new WorkflowEngineException(MODEL_ID_NOT_EXISTS, dto.getProcessModelId());
}
originModel.setName(dto.getName());
originModel.setMetaInfo(MODEL_META_INFO_PROCESS);
@ -175,8 +177,8 @@ public class BpmProcessModelServiceImpl implements BpmProcessModelService {
@Override
@Transactional(rollbackFor = Exception.class)
public String deployBpmModelById(String modelId, String tenantId) {
Model model = this.repositoryService.getModel(modelId);
public String deployBpmModelById(String processModelId, String tenantId) {
Model model = this.repositoryService.getModel(processModelId);
if (Objects.isNull(model) || Objects.equals(model.getTenantId(), tenantId)) {
throw new WorkflowEngineException(MODEL_ID_NOT_EXISTS);
}
@ -197,28 +199,44 @@ public class BpmProcessModelServiceImpl implements BpmProcessModelService {
@Override
@Transactional(rollbackFor = Exception.class)
public String deployBpmModelByKey(String modelKey, String tenantId) {
public String deployBpmModelByKey(String processModelKey, String tenantId) {
ModelQuery modelQuery = repositoryService.createModelQuery()
.modelKey(modelKey);
.modelKey(processModelKey);
if (StringUtils.hasLength(tenantId)) {
modelQuery.modelTenantId(tenantId);
}
Model model = modelQuery.singleResult();
if (Objects.isNull(model)) {
throw new WorkflowEngineException(MODEL_KEY_NOT_EXISTS, modelKey);
throw new WorkflowEngineException(MODEL_KEY_NOT_EXISTS, processModelKey);
}
return deployBpmModelById(model.getId(), null);
}
@Override
public void deleteBpmModel(String modelId, String tenantId) {
public void deleteBpmModelById(String processModelId, @Nullable String tenantId) {
// 校验流程模型存在
Model model = repositoryService.getModel(modelId);
if (Objects.isNull(model) || !Objects.equals(model.getTenantId(), tenantId)) {
Model model = repositoryService.getModel(processModelId);
if (Objects.isNull(model)) {
throw new WorkflowEngineException(MODEL_ID_NOT_EXISTS);
}
if (StringUtils.hasLength(tenantId) && !Objects.equals(model.getTenantId(), tenantId)) {
throw new WorkflowEngineException(MODEL_ID_NOT_EXISTS);
}
// 执行删除
repositoryService.deleteModel(modelId);
repositoryService.deleteModel(processModelId);
}
@Override
public void deleteBpmModelByKey(String processModelKey, @Nullable String tenantId) {
ModelQuery modelQuery = repositoryService.createModelQuery().modelKey(processModelKey);
if (StringUtils.hasLength(tenantId)) {
modelQuery.modelTenantId(tenantId);
}
Model model = modelQuery.singleResult();
if (Objects.isNull(model)) {
throw new WorkflowEngineException(MODEL_ID_NOT_EXISTS);
}
repositoryService.deleteModel(model.getId());
}
private void saveModelBpmnXml(Model model, String bpmnXml) {

View File

@ -1,15 +1,16 @@
package cn.axzo.workflow.server.controller.web;
import cn.axzo.workflow.core.service.BpmFormDefinitionService;
import cn.axzo.workflow.core.service.BpmFormModelService;
import cn.axzo.workflow.core.service.dto.request.form.definition.FormDefinitionUpdateDTO;
import cn.axzo.workflow.core.service.dto.response.form.definition.FormDefinitionVO;
import cn.azxo.framework.common.model.CommonResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
@ -26,8 +27,10 @@ import javax.validation.constraints.NotBlank;
@RestController
public class BpmFormDefinitionController {
@Autowired
@Resource
private BpmFormDefinitionService bpmFormDefinitionService;
@Resource
private BpmFormModelService bpmFormModelService;
@Operation(summary = "更新表单定义内容")
@PutMapping("/update")
@ -36,19 +39,7 @@ public class BpmFormDefinitionController {
return CommonResponse.success(true);
}
@Operation(summary = "通过表单模型 ID 发布")
@PostMapping("/deploy")
public CommonResponse<String> deployFormModelById(@Valid @NotBlank(message = "模型 ID 不能为空") @RequestParam String formModelId,
@RequestParam(required = false) String tenantId) {
return CommonResponse.success(bpmFormDefinitionService.deployFormModelById(formModelId, tenantId));
}
@Operation(summary = "通过表单模型 KEY 发布")
@PostMapping("/deployByKey")
public CommonResponse<String> deployFormModelByKey(@Valid @NotBlank(message = "模型 KEY 不能为空") @RequestParam String formModelKey,
@RequestParam(required = false) String tenantId) {
return CommonResponse.success(bpmFormDefinitionService.deployFormModelByKey(formModelKey, tenantId));
}
@Operation(summary = "通过表单模型 ID 获取表单定义内容")
@GetMapping("/get")
@ -57,4 +48,5 @@ public class BpmFormDefinitionController {
return CommonResponse.success(bpmFormDefinitionService.get(formModelId, tenantId));
}
}

View File

@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
/**
* TODO
@ -34,30 +35,66 @@ public class BpmFormModelController {
@Operation(summary = "表单模型分页")
@GetMapping("/page")
public CommonResponse<BpmPageResult<BpmModelBaseVO>> modelPage(@Valid @RequestBody BpmModelSearchDTO dto) {
public CommonResponse<BpmPageResult<BpmModelBaseVO>> page(@Valid @RequestBody BpmModelSearchDTO dto) {
return CommonResponse.success(bpmFormModelService.getModelPage(dto));
}
@Operation(summary = "创建表单模型")
@PostMapping("/create")
public CommonResponse<String> createFormModel(@Valid @RequestBody FormModelCreateDTO dto) {
public CommonResponse<String> create(@Valid @RequestBody FormModelCreateDTO dto) {
return CommonResponse.success(bpmFormModelService.createFormModel(dto));
}
@Operation(summary = "修改表单模型")
@PutMapping("/update")
public CommonResponse<Void> updateFormModel(@Valid @RequestBody FormModelUpdateDTO dto) {
public CommonResponse<Void> update(@Valid @RequestBody FormModelUpdateDTO dto) {
bpmFormModelService.updateFormModel(dto);
return CommonResponse.success();
}
@Operation(summary = "删除表单模型")
@Operation(summary = "通过表单模型 ID 删除表单模型")
@DeleteMapping("/delete")
public CommonResponse<Boolean> deleteFormModel(@ApiParam(name = "表单模型 ID") @RequestParam String id,
@RequestParam(required = false) String tenantId) {
bpmFormModelService.deleteFormModel(id, tenantId);
public CommonResponse<Boolean> deleteById(@Valid @ApiParam(name = "表单模型 ID") @NotBlank(message = "表单模型 ID 不能为空") @RequestParam String formModelId,
@RequestParam(required = false) String tenantId) {
bpmFormModelService.deleteFormModelById(formModelId, tenantId);
return CommonResponse.success(true);
}
@Operation(summary = "通过表单模型 KEY 删除表单模型")
@DeleteMapping("/deleteByKey")
public CommonResponse<Boolean> deleteByKey(@Valid @ApiParam(name = "表单模型 KEY") @NotBlank(message = "表单模型 KEY " +
"不能为空") @RequestParam String formModelKey,
@RequestParam(required = false) String tenantId) {
bpmFormModelService.deployFormModelByKey(formModelKey, tenantId);
return CommonResponse.success(true);
}
@Operation(summary = "获取指定表单模型 ID 的内容")
@GetMapping("/get")
public CommonResponse<BpmModelBaseVO> getById(@Valid @NotBlank(message = "表单模型 ID 不能为空") @RequestParam String formModelId,
@RequestParam String tenantId) {
return CommonResponse.success(bpmFormModelService.getById(formModelId, tenantId));
}
@Operation(summary = "获取指定表单模型 KEy 的内容")
@GetMapping("/getByKey")
public CommonResponse<BpmModelBaseVO> getByKey(@Valid @NotBlank(message = "表单模型 KEY 不能为空") @RequestParam String formModelKey,
@RequestParam String tenantId) {
return CommonResponse.success(bpmFormModelService.getByKey(formModelKey, tenantId));
}
@Operation(summary = "通过表单模型 ID 发布")
@PostMapping("/deploy")
public CommonResponse<String> deployById(@Valid @NotBlank(message = "模型 ID 不能为空") @RequestParam String formModelId,
@RequestParam(required = false) String tenantId) {
return CommonResponse.success(bpmFormModelService.deployFormModelById(formModelId, tenantId));
}
@Operation(summary = "通过表单模型 KEY 发布")
@PostMapping("/deployByKey")
public CommonResponse<String> deployByKey(@Valid @NotBlank(message = "模型 KEY 不能为空") @RequestParam String formModelKey,
@RequestParam(required = false) String tenantId) {
return CommonResponse.success(bpmFormModelService.deployFormModelByKey(formModelKey, tenantId));
}
}

View File

@ -5,8 +5,8 @@ import cn.axzo.workflow.core.service.dto.request.model.BpmModelCreateDTO;
import cn.axzo.workflow.core.service.dto.request.model.BpmModelSearchDTO;
import cn.axzo.workflow.core.service.dto.request.model.BpmModelUpdateDTO;
import cn.axzo.workflow.core.service.dto.response.BpmPageResult;
import cn.axzo.workflow.core.service.dto.response.form.model.BpmModelBaseVO;
import cn.axzo.workflow.core.service.dto.response.model.BpmModelDetailVO;
import cn.axzo.workflow.core.service.dto.response.model.BpmProcessModelVO;
import cn.azxo.framework.common.model.CommonResponse;
import com.alibaba.fastjson.JSON;
import io.swagger.v3.oas.annotations.Operation;
@ -34,9 +34,9 @@ public class BpmProcessModelController {
*/
@Operation(summary = "流程模型列表")
@GetMapping("/page")
public CommonResponse<BpmPageResult<BpmProcessModelVO>> modelPage(@Valid @RequestBody BpmModelSearchDTO dto) {
public CommonResponse<BpmPageResult<BpmModelBaseVO>> page(@Valid @RequestBody BpmModelSearchDTO dto) {
log.info("获取流程模型getModelPage===>>>参数:{}", JSON.toJSONString(dto));
BpmPageResult<BpmProcessModelVO> result = bpmProcessModelService.getModelPage(dto);
BpmPageResult<BpmModelBaseVO> result = bpmProcessModelService.getModelPage(dto);
return CommonResponse.success(result);
}
@ -64,9 +64,10 @@ public class BpmProcessModelController {
*/
@Operation(summary = "通过模型ID查询指定流程模型")
@GetMapping("/get")
public CommonResponse<BpmModelDetailVO> getModelDetailById(@RequestParam String modelId) {
log.info("获取模型getModelDetailById===>>>参数:{}", JSON.toJSONString(modelId));
BpmModelDetailVO result = bpmProcessModelService.getModelDetailById(modelId);
public CommonResponse<BpmModelDetailVO> getById(@RequestParam String processModelId,
@RequestParam String tenantId) {
log.info("获取模型getModelDetailById===>>>参数:{}", JSON.toJSONString(processModelId));
BpmModelDetailVO result = bpmProcessModelService.getById(processModelId, tenantId);
return CommonResponse.success(result);
}
@ -76,9 +77,10 @@ public class BpmProcessModelController {
*/
@Operation(summary = "通过模型KEY查询指定流程模型")
@GetMapping("/getByKey")
public CommonResponse<BpmModelDetailVO> getModelDetailByKey(@RequestParam String modelKey) {
log.info("获取模型getModelDetailByKey===>>>参数:{}", JSON.toJSONString(modelKey));
BpmModelDetailVO result = bpmProcessModelService.getModelDetailByKey(modelKey);
public CommonResponse<BpmModelDetailVO> getByKey(@RequestParam String processModelKey,
@RequestParam String tenantId) {
log.info("获取模型getModelDetailByKey===>>>参数:{}", JSON.toJSONString(processModelKey));
BpmModelDetailVO result = bpmProcessModelService.getByKey(processModelKey, tenantId);
return CommonResponse.success(result);
}
@ -88,7 +90,7 @@ public class BpmProcessModelController {
*/
@Operation(summary = "更新流程模型")
@PutMapping("/update")
public CommonResponse<String> updateBpmModel(@Valid @RequestBody BpmModelUpdateDTO dto) {
public CommonResponse<String> update(@Valid @RequestBody BpmModelUpdateDTO dto) {
log.info("修改流程信息updateBpmModel===>>>参数:{}", JSON.toJSONString(dto));
bpmProcessModelService.updateBpmModel(dto);
return CommonResponse.success();
@ -101,9 +103,10 @@ public class BpmProcessModelController {
*/
@Operation(summary = "通过模型 ID 部署流程模型")
@PostMapping("/deploy")
public CommonResponse<String> deployBpmModelById(@Valid @NotBlank(message = "模型 ID 不能为空") @RequestParam String modelId) {
log.info("部署模型deployBpmModelById===>>>参数:{}", JSON.toJSONString(modelId));
String result = bpmProcessModelService.deployBpmModelById(modelId, null);
public CommonResponse<String> deployById(@Valid @NotBlank(message = "模型 ID 不能为空") @RequestParam String processModelId,
@RequestParam(required = false) String tenantId) {
log.info("部署模型deployBpmModelById===>>>参数:{}", JSON.toJSONString(processModelId));
String result = bpmProcessModelService.deployBpmModelById(processModelId, tenantId);
return CommonResponse.success(result);
}
@ -114,10 +117,10 @@ public class BpmProcessModelController {
*/
@Operation(summary = "通过模型 KEY 部署流程模型")
@PostMapping("/deployByKey")
public CommonResponse<String> deployBpmModelByKey(@Valid @NotBlank(message = "模型 KEY 不能为空") @RequestParam String modelKey,
@RequestParam String tenantId) {
log.info("部署模型deployBpmModelByKey===>>>参数:{}", JSON.toJSONString(modelKey));
String result = bpmProcessModelService.deployBpmModelByKey(modelKey, tenantId);
public CommonResponse<String> deployByKey(@Valid @NotBlank(message = "模型 KEY 不能为空") @RequestParam String processModelKey,
@RequestParam(required = false) String tenantId) {
log.info("部署模型deployBpmModelByKey===>>>参数:{}", JSON.toJSONString(processModelKey));
String result = bpmProcessModelService.deployBpmModelByKey(processModelKey, tenantId);
return CommonResponse.success(result);
}
@ -127,9 +130,19 @@ public class BpmProcessModelController {
*/
@Operation(summary = "删除指定模型 ID 的流程模型")
@DeleteMapping("/delete")
public CommonResponse<Void> deleteBpmModel(@RequestParam String id) {
log.info("删除模型deleteBpmModel===>>>参数:{}", JSON.toJSONString(id));
bpmProcessModelService.deleteBpmModel(id, null);
public CommonResponse<Void> deleteById(@RequestParam String processModelId,
@RequestParam(required = false) String tenantId) {
log.info("删除模型deleteBpmModel===>>>参数:{}", JSON.toJSONString(processModelId));
bpmProcessModelService.deleteBpmModelById(processModelId, tenantId);
return CommonResponse.success();
}
@Operation(summary = "删除指定模型 KEY 的流程模型")
@DeleteMapping("/deleteByKey")
public CommonResponse<Void> deleteByKey(@RequestParam String processModelKey,
@RequestParam(required = false) String tenantId) {
log.info("删除模型deleteBpmModel===>>>参数:{}", JSON.toJSONString(processModelKey));
bpmProcessModelService.deleteBpmModelByKey(processModelKey, tenantId);
return CommonResponse.success();
}