add - 为表单模型和定义完善 swagger 注解

This commit is contained in:
wangli 2023-07-25 17:39:39 +08:00
parent d32dfb3b51
commit 9e8f922b9b
3 changed files with 16 additions and 1 deletions

View File

@ -4,6 +4,8 @@ import cn.axzo.workflow.core.service.BpmFormDefinitionService;
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.*;
@ -17,6 +19,8 @@ import javax.validation.constraints.NotBlank;
* @author wangli
* @since 2023/7/19 16:45
*/
@Tag(name = "运维管理 - 表单定义")
@Slf4j
@RequestMapping("/web/v1/api/form/definition")
@RestController
@ -25,24 +29,28 @@ public class BpmFormDefinitionController {
@Autowired
private BpmFormDefinitionService bpmFormDefinitionService;
@Operation(summary = "更新表单定义内容")
@PutMapping("/update")
public CommonResponse<Boolean> updateFormDefinition(@Valid @RequestBody FormDefinitionUpdateDTO dto) {
bpmFormDefinitionService.updateFormDefinition(dto);
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")
public CommonResponse<FormDefinitionVO> get(@Valid @NotBlank(message = "模型 ID 不能为空") @RequestParam String formModelId,
@RequestParam String tenantId) {

View File

@ -8,6 +8,8 @@ import cn.axzo.workflow.core.service.dto.response.BpmPageResult;
import cn.axzo.workflow.core.service.dto.response.form.model.BpmModelBaseVO;
import cn.azxo.framework.common.model.CommonResponse;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@ -20,6 +22,7 @@ import javax.validation.Valid;
* @author wangli
* @since 2023/7/25 10:16
*/
@Tag(name = "运维管理 - 表单模型")
@Slf4j
@RequestMapping("/web/v1/api/form/model")
@RestController
@ -29,22 +32,26 @@ public class BpmFormModelController {
@Resource
private BpmFormModelService bpmFormModelService;
@Operation(summary = "表单模型分页")
@GetMapping("/page")
public CommonResponse<BpmPageResult<BpmModelBaseVO>> modelPage(@Valid @RequestBody BpmModelSearchDTO dto) {
return CommonResponse.success(bpmFormModelService.getModelPage(dto));
}
@Operation(summary = "创建表单模型")
@PostMapping("/create")
public CommonResponse<String> createFormModel(@Valid @RequestBody FormModelCreateDTO dto) {
return CommonResponse.success(bpmFormModelService.createFormModel(dto));
}
@Operation(summary = "修改表单模型")
@PutMapping("/update")
public CommonResponse<Void> updateFormModel(@Valid @RequestBody FormModelUpdateDTO dto) {
bpmFormModelService.updateFormModel(dto);
return CommonResponse.success();
}
@Operation(summary = "删除表单模型")
@DeleteMapping("/delete")
public CommonResponse<Boolean> deleteFormModel(@ApiParam(name = "表单模型 ID") @RequestParam String id,
@RequestParam(required = false) String tenantId) {

View File

@ -40,7 +40,6 @@ public class BpmProcessModelController {
return CommonResponse.success(result);
}
/**
* 创建流程,
* return modelId的主键
@ -56,6 +55,7 @@ public class BpmProcessModelController {
@Operation(summary = "通过 Xml 创建模型", hidden = true)
@PostMapping("/xml/create")
public CommonResponse<String> createWithXml() {
// TODO 不完善的接口
return CommonResponse.success(bpmProcessModelService.createBpmModelWithXml(""));
}