45af34f068f8caff5941797e22edf1684093445a.svn-base 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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.ProcessTypeService;
  6. import com.workflow.bpm.api.bpmservices.co.processtype.AddProcessTypeCO;
  7. import com.workflow.bpm.api.bpmservices.co.processtype.GetProcTypeCO;
  8. import com.workflow.bpm.api.bpmservices.co.processtype.UpdateProcessTypeCO;
  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.swagger.annotations.Api;
  17. import io.swagger.annotations.ApiOperation;
  18. import org.springframework.beans.factory.annotation.Autowired;
  19. import org.springframework.util.StringUtils;
  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 ProcessTypeController extends BaseController {
  31. @Autowired
  32. private ProcessTypeService processTypeService;
  33. //@RequiresPermissions("bmpc.type.query.add")
  34. @ApiOperation(value = "新增")
  35. @PostMapping("/v1/workflow/procType")
  36. public BaseResponse post_procType(@RequestBody ReqPostProcTypeDTO reqPostProcTypeDTO) {
  37. if (Objects.isNull(reqPostProcTypeDTO)) {
  38. throw new BusinessException(CommonErrorCode.ParamIsNull);
  39. }
  40. AddProcessTypeCO addProcessTypeCO = new AddProcessTypeCO();
  41. ConvertBeanUtils.copyPropertiesBySource(reqPostProcTypeDTO,addProcessTypeCO);
  42. return buildSuccessResponse(processTypeService.add(addProcessTypeCO).getContent());
  43. }
  44. //@RequiresPermissions("bmpc.type.query.delete")
  45. @ApiOperation(value = "删除")
  46. @DeleteMapping("/v1/procType/{bpmProcTypeCode}")
  47. public BaseResponse delete_procType(@PathVariable String bpmProcTypeCode) {
  48. if (StringUtils.isEmpty(bpmProcTypeCode)) {
  49. throw new BusinessException(CommonErrorCode.ParamIsNull);
  50. }
  51. return buildSuccessResponse(processTypeService.del(bpmProcTypeCode).getContent());
  52. }
  53. //@RequiresPermissions("bmpc.type.query.edit")
  54. @ApiOperation(value = "修改")
  55. @PutMapping("/v1/procType")
  56. public BaseResponse put_procType(@RequestBody ReqPutProcTypeDTO reqPutProcTypeDTO) {
  57. if (Objects.isNull(reqPutProcTypeDTO)
  58. || StringUtils.isEmpty(reqPutProcTypeDTO.getBpmProcTypeCode())) {
  59. throw new BusinessException(CommonErrorCode.ParamIsNull);
  60. }
  61. UpdateProcessTypeCO updateProcessTypeCO = new UpdateProcessTypeCO();
  62. ConvertBeanUtils.copyPropertiesBySource(reqPutProcTypeDTO,updateProcessTypeCO);
  63. return buildSuccessResponse(processTypeService.update(updateProcessTypeCO).getContent());
  64. }
  65. //@RequiresPermissions("bmpc.type.query.list")
  66. @ApiOperation(value = "查询")
  67. @RequestMapping(value="/v1/workflow/procTypePage",method = RequestMethod.GET)
  68. public BaseResponse<PageInfo<ResGetProcTypeDTO>> get_procType(ReqGetProcTypeDTO reqGetProcTypeDTO ) {
  69. if (Objects.isNull(reqGetProcTypeDTO)) {
  70. throw new BusinessException(CommonErrorCode.ParamIsNull);
  71. }
  72. GetProcTypeCO getProcTypeCO = new GetProcTypeCO();
  73. Page page = new Page();
  74. ConvertBeanUtils.copyPropertiesBySource(reqGetProcTypeDTO,getProcTypeCO);
  75. ConvertBeanUtils.copyPropertiesBySource(reqGetProcTypeDTO,page);
  76. APIRequestPage<GetProcTypeCO> requestPage = new APIRequestPage<>();
  77. requestPage.setContent(getProcTypeCO);
  78. requestPage.setPage(page);
  79. ResultPage<List<ResGetProcTypeDTO>> listResultPage = processTypeService.queryProcType(requestPage);
  80. listResultPage.setPageClass(ResGetProcTypeDTO.class);
  81. PageInfo<ResGetProcTypeDTO> newPage = new PageInfo<>();
  82. newPage.setPageSize(listResultPage.getPage().getPageSize());
  83. newPage.setTotal(listResultPage.getPage().getTotal());
  84. newPage.setPageNum(listResultPage.getPage().getPageNo());
  85. newPage.setList(listResultPage.getContent());
  86. return buildSuccessResponse(newPage);
  87. }
  88. @ApiOperation(value = "查询流程类型集合")
  89. @RequestMapping(value="/v1/workflow/qryProcTypes",method = RequestMethod.GET)
  90. public BaseResponse<List<ResGetProcTypeDTO>> get_qryProcTypes( ReqGetProcTypesDTO reqGetProcTypesDTO ) {
  91. GetProcTypeCO getProcTypeCO = new GetProcTypeCO();
  92. if (reqGetProcTypesDTO!=null){
  93. ConvertBeanUtils.copyPropertiesBySource(reqGetProcTypesDTO,getProcTypeCO);
  94. }
  95. return buildSuccessResponse(processTypeService.qryProcTypeList(getProcTypeCO).getContent());
  96. }
  97. }