| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- package cn.com.goldenwater.dcproj.controller.mend.bpm;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import com.github.pagehelper.PageInfo;
- import com.workflow.bpm.api.bpmservices.FormCfgService;
- import com.workflow.bpm.api.bpmservices.co.fromconfig.AddFormCfgCO;
- import com.workflow.bpm.api.bpmservices.co.fromconfig.QueryFormcfgCO;
- import com.workflow.bpm.api.bpmservices.co.fromconfig.UpdateFormCfgCO;
- import com.workflow.bpm.api.bpmservices.dto.*;
- import com.workflow.common.exception.BusinessException;
- import com.workflow.common.exception.impl.CommonErrorCode;
- import com.workflow.common.struct.head.Page;
- import com.workflow.common.struct.req.impl.APIRequestPage;
- import com.workflow.common.struct.res.ResultPage;
- import com.workflow.common.util.convert.ConvertBeanUtils;
- import io.micrometer.core.instrument.util.StringUtils;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- import java.util.Objects;
- /**
- * Description: 流程表单数据结构定义
- * Author: admin
- */
- @Api(tags = "流程表单定义")
- @RestController
- @RequestMapping("/bis/insp/pblm/plist/bpm/cfg")
- public class FormCfgController extends BaseController {
- @Autowired
- private FormCfgService formCfgService;
- @ApiOperation(value = "查询流程定义",notes = "分页")
- @GetMapping("/v1/form")
- public BaseResponse<PageInfo<ResGetFormcfgDTO>> get_formdef(ReqQueryFormcfgDTO reqQueryFormcfgDTO) {
- if (Objects.isNull(reqQueryFormcfgDTO)) {
- throw new BusinessException(CommonErrorCode.ParamIsNull);
- }
- QueryFormcfgCO queryFormcfgCO = new QueryFormcfgCO();
- Page page = new Page();
- ConvertBeanUtils.copyPropertiesBySource(reqQueryFormcfgDTO,queryFormcfgCO);
- ConvertBeanUtils.copyPropertiesBySource(reqQueryFormcfgDTO,page);
- APIRequestPage<QueryFormcfgCO> requestPage = new APIRequestPage<>();
- requestPage.setContent(queryFormcfgCO);
- requestPage.setPage(page);
- ResultPage<List<ResGetFormcfgDTO>> listResultPage = formCfgService.query(requestPage);
- listResultPage.setPageClass(ResGetFormcfgDTO.class);
- PageInfo<ResGetFormcfgDTO> newPage = new PageInfo<>();
- newPage.setPageSize(listResultPage.getPage().getPageSize());
- newPage.setTotal(listResultPage.getPage().getTotal());
- newPage.setPageNum(listResultPage.getPage().getPageNo());
- newPage.setList(listResultPage.getContent());
- return buildSuccessResponse(newPage);
- }
- @ApiOperation(value = "新增")
- @PostMapping("/v1/form")
- public BaseResponse post_form(@RequestBody ReqPostFormCfgDTO reqPostFormCfgDTO) {
- if (Objects.isNull(reqPostFormCfgDTO)) {
- throw new BusinessException(CommonErrorCode.ParamIsNull);
- }
- AddFormCfgCO addFormCfgCO = new AddFormCfgCO();
- ConvertBeanUtils.copyPropertiesBySource(reqPostFormCfgDTO,addFormCfgCO);
- return buildSuccessResponse(formCfgService.addFormdef(addFormCfgCO).getContent());
- }
- @ApiOperation(value = "删除")
- @DeleteMapping("/v1/form/{bpmFormCfgId}")
- public BaseResponse delete_form(@PathVariable String bpmFormCfgId) {
- if (StringUtils.isEmpty(bpmFormCfgId)) {
- throw new BusinessException(CommonErrorCode.ParamIsNull);
- }
- return buildSuccessResponse(formCfgService.delViaFormCd(bpmFormCfgId));
- }
- @ApiOperation(value = "查询流程表单列表")
- @GetMapping("/v1/form/queryFormCfgLIst")
- public BaseResponse<List<ResGetFormcfgDTO>> get_formList() {
- return buildSuccessResponse(formCfgService.queryFormCfgList().getContent());
- }
- //@RequiresPermissions("base.bpm.operation")
- @ApiOperation(value = "根据id查询流程表单数据")
- @GetMapping("/v1/form/{bpmFormCfgId}")
- public BaseResponse<ResGetFormcfgDTO> get_form(@PathVariable String bpmFormCfgId) {
- if (Objects.isNull(bpmFormCfgId)) {
- throw new BusinessException(CommonErrorCode.ParamIsNull);
- }
- return buildSuccessResponse(formCfgService.queryFormCfgViaId(bpmFormCfgId).getContent());
- }
- @ApiOperation(value = "修改")
- @PutMapping("/v1/form")
- public BaseResponse put_form(@RequestBody ReqPutFormCfgDTO reqPutFormCfgDTO) {
- if (Objects.isNull(reqPutFormCfgDTO)) {
- throw new BusinessException(CommonErrorCode.ParamIsNull);
- }
- UpdateFormCfgCO updateFormCfgCO = new UpdateFormCfgCO();
- ConvertBeanUtils.copyPropertiesBySource(reqPutFormCfgDTO,updateFormCfgCO);
- return buildSuccessResponse(formCfgService.update(updateFormCfgCO));
- }
- }
|