66167bb1c00fdc7292b250c0a213075d997058f7.svn-base 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. package cn.com.goldenwater.dcproj.controller.mend.bpm;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import com.github.pagehelper.PageInfo;
  5. import com.workflow.bpm.api.bpmservices.FormCfgService;
  6. import com.workflow.bpm.api.bpmservices.co.fromconfig.AddFormCfgCO;
  7. import com.workflow.bpm.api.bpmservices.co.fromconfig.QueryFormcfgCO;
  8. import com.workflow.bpm.api.bpmservices.co.fromconfig.UpdateFormCfgCO;
  9. import com.workflow.bpm.api.bpmservices.dto.*;
  10. import com.workflow.common.exception.BusinessException;
  11. import com.workflow.common.exception.impl.CommonErrorCode;
  12. import com.workflow.common.struct.head.Page;
  13. import com.workflow.common.struct.req.impl.APIRequestPage;
  14. import com.workflow.common.struct.res.ResultPage;
  15. import com.workflow.common.util.convert.ConvertBeanUtils;
  16. import io.micrometer.core.instrument.util.StringUtils;
  17. import io.swagger.annotations.Api;
  18. import io.swagger.annotations.ApiOperation;
  19. import org.springframework.beans.factory.annotation.Autowired;
  20. import org.springframework.web.bind.annotation.*;
  21. import java.util.List;
  22. import java.util.Objects;
  23. /**
  24. * Description: 流程表单数据结构定义
  25. * Author: admin
  26. */
  27. @Api(tags = "流程表单定义")
  28. @RestController
  29. @RequestMapping("/bis/insp/pblm/plist/bpm/cfg")
  30. public class FormCfgController extends BaseController {
  31. @Autowired
  32. private FormCfgService formCfgService;
  33. @ApiOperation(value = "查询流程定义",notes = "分页")
  34. @GetMapping("/v1/form")
  35. public BaseResponse<PageInfo<ResGetFormcfgDTO>> get_formdef(ReqQueryFormcfgDTO reqQueryFormcfgDTO) {
  36. if (Objects.isNull(reqQueryFormcfgDTO)) {
  37. throw new BusinessException(CommonErrorCode.ParamIsNull);
  38. }
  39. QueryFormcfgCO queryFormcfgCO = new QueryFormcfgCO();
  40. Page page = new Page();
  41. ConvertBeanUtils.copyPropertiesBySource(reqQueryFormcfgDTO,queryFormcfgCO);
  42. ConvertBeanUtils.copyPropertiesBySource(reqQueryFormcfgDTO,page);
  43. APIRequestPage<QueryFormcfgCO> requestPage = new APIRequestPage<>();
  44. requestPage.setContent(queryFormcfgCO);
  45. requestPage.setPage(page);
  46. ResultPage<List<ResGetFormcfgDTO>> listResultPage = formCfgService.query(requestPage);
  47. listResultPage.setPageClass(ResGetFormcfgDTO.class);
  48. PageInfo<ResGetFormcfgDTO> newPage = new PageInfo<>();
  49. newPage.setPageSize(listResultPage.getPage().getPageSize());
  50. newPage.setTotal(listResultPage.getPage().getTotal());
  51. newPage.setPageNum(listResultPage.getPage().getPageNo());
  52. newPage.setList(listResultPage.getContent());
  53. return buildSuccessResponse(newPage);
  54. }
  55. @ApiOperation(value = "新增")
  56. @PostMapping("/v1/form")
  57. public BaseResponse post_form(@RequestBody ReqPostFormCfgDTO reqPostFormCfgDTO) {
  58. if (Objects.isNull(reqPostFormCfgDTO)) {
  59. throw new BusinessException(CommonErrorCode.ParamIsNull);
  60. }
  61. AddFormCfgCO addFormCfgCO = new AddFormCfgCO();
  62. ConvertBeanUtils.copyPropertiesBySource(reqPostFormCfgDTO,addFormCfgCO);
  63. return buildSuccessResponse(formCfgService.addFormdef(addFormCfgCO).getContent());
  64. }
  65. @ApiOperation(value = "删除")
  66. @DeleteMapping("/v1/form/{bpmFormCfgId}")
  67. public BaseResponse delete_form(@PathVariable String bpmFormCfgId) {
  68. if (StringUtils.isEmpty(bpmFormCfgId)) {
  69. throw new BusinessException(CommonErrorCode.ParamIsNull);
  70. }
  71. return buildSuccessResponse(formCfgService.delViaFormCd(bpmFormCfgId));
  72. }
  73. @ApiOperation(value = "查询流程表单列表")
  74. @GetMapping("/v1/form/queryFormCfgLIst")
  75. public BaseResponse<List<ResGetFormcfgDTO>> get_formList() {
  76. return buildSuccessResponse(formCfgService.queryFormCfgList().getContent());
  77. }
  78. //@RequiresPermissions("base.bpm.operation")
  79. @ApiOperation(value = "根据id查询流程表单数据")
  80. @GetMapping("/v1/form/{bpmFormCfgId}")
  81. public BaseResponse<ResGetFormcfgDTO> get_form(@PathVariable String bpmFormCfgId) {
  82. if (Objects.isNull(bpmFormCfgId)) {
  83. throw new BusinessException(CommonErrorCode.ParamIsNull);
  84. }
  85. return buildSuccessResponse(formCfgService.queryFormCfgViaId(bpmFormCfgId).getContent());
  86. }
  87. @ApiOperation(value = "修改")
  88. @PutMapping("/v1/form")
  89. public BaseResponse put_form(@RequestBody ReqPutFormCfgDTO reqPutFormCfgDTO) {
  90. if (Objects.isNull(reqPutFormCfgDTO)) {
  91. throw new BusinessException(CommonErrorCode.ParamIsNull);
  92. }
  93. UpdateFormCfgCO updateFormCfgCO = new UpdateFormCfgCO();
  94. ConvertBeanUtils.copyPropertiesBySource(reqPutFormCfgDTO,updateFormCfgCO);
  95. return buildSuccessResponse(formCfgService.update(updateFormCfgCO));
  96. }
  97. }