18a79d66e83cb8a06e2432d8e673cc0bba197481.svn-base 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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.BpmProcessInstService;
  6. import com.workflow.bpm.api.bpmservices.co.processinstance.ProcInstIdCO;
  7. import com.workflow.bpm.api.bpmservices.co.processinstance.ProcessHandleCO;
  8. import com.workflow.bpm.api.bpmservices.dto.ReqPostProcessHandleDTO;
  9. import com.workflow.bpm.api.bpmservices.dto.ResGetProcessDiagramDTO;
  10. import com.workflow.bpm.api.bpmservices.dto.ResGetProcessHandleDTO;
  11. import com.workflow.common.exception.BusinessException;
  12. import com.workflow.common.exception.impl.CommonErrorCode;
  13. import com.workflow.common.struct.head.Page;
  14. import com.workflow.common.struct.req.impl.APIRequestPage;
  15. import com.workflow.common.struct.res.Result;
  16. import com.workflow.common.struct.res.impl.APIResult;
  17. import com.workflow.common.struct.res.impl.APIResultPage;
  18. import com.workflow.common.util.convert.ConvertBeanUtils;
  19. import io.swagger.annotations.Api;
  20. import io.swagger.annotations.ApiOperation;
  21. import org.apache.commons.lang.StringUtils;
  22. import org.springframework.beans.factory.annotation.Autowired;
  23. import org.springframework.web.bind.annotation.GetMapping;
  24. import org.springframework.web.bind.annotation.PathVariable;
  25. import org.springframework.web.bind.annotation.RequestMapping;
  26. import org.springframework.web.bind.annotation.RequestMethod;
  27. import org.springframework.web.bind.annotation.RestController;
  28. import java.util.ArrayList;
  29. import java.util.List;
  30. import java.util.Objects;
  31. /**
  32. * @program parent
  33. * @Description
  34. * @Author admin
  35. * @Date 2019/7/10
  36. **/
  37. @Api(tags = "流程实例")
  38. @RestController
  39. @RequestMapping("/bis/insp/pblm/plist/")
  40. public class ProcessInstController extends BaseController {
  41. @Autowired
  42. private BpmProcessInstService bpmProcessInstService;
  43. //@RequiresPermissions("base.bpm.operation")
  44. @ApiOperation(value = "挂起流程")
  45. @GetMapping("/v1/workflow/suspendProcInst/{procInstId}")
  46. public Result<?> post_suspendProcInst(@PathVariable String procInstId) {
  47. if (StringUtils.isEmpty(procInstId)) {
  48. throw new BusinessException(CommonErrorCode.ParamIsNull);
  49. }
  50. ProcInstIdCO procInstIdCO = new ProcInstIdCO();
  51. procInstIdCO.setProcInstId(procInstId);
  52. return bpmProcessInstService.suspendProcInst(procInstIdCO);
  53. }
  54. //@RequiresPermissions("base.bpm.operation")
  55. @ApiOperation(value = "重启挂起的流程")
  56. @GetMapping("/v1/workflow/resumeProcInst/{procInstId}")
  57. public Result<?> post_resumeProcInst(@PathVariable String procInstId) {
  58. if (StringUtils.isEmpty(procInstId)) {
  59. throw new BusinessException(CommonErrorCode.ParamIsNull);
  60. }
  61. ProcInstIdCO procInstIdCO = new ProcInstIdCO();
  62. procInstIdCO.setProcInstId(procInstId);
  63. return bpmProcessInstService.resumeProcInst(procInstIdCO);
  64. }
  65. //@RequiresPermissions("base.bpm.operation")
  66. @ApiOperation(value = "撤销流程")
  67. @GetMapping("/v1/workflow/cancelProcInst/{procInstId}")
  68. public Result<?> post_cancelProcInst(@PathVariable String procInstId) {
  69. if (StringUtils.isEmpty(procInstId)) {
  70. throw new BusinessException(CommonErrorCode.ParamIsNull);
  71. }
  72. ProcInstIdCO procInstIdCO = new ProcInstIdCO();
  73. procInstIdCO.setProcInstId(procInstId);
  74. return bpmProcessInstService.cancelProcInst(procInstIdCO);
  75. }
  76. //@RequiresPermissions("base.bpm.operation")
  77. @ApiOperation(value = "查询流程图")
  78. @GetMapping("/v1/workflow/qryProcessDiagram/{procInstId}")
  79. public BaseResponse<ResGetProcessDiagramDTO> post_qryProcessDiagram(@PathVariable String procInstId) {
  80. ProcInstIdCO procInstIdCO = new ProcInstIdCO();
  81. procInstIdCO.setProcInstId(procInstId);
  82. APIResult<String> apiResult = bpmProcessInstService.qryProcessDiagram(procInstIdCO);
  83. ResGetProcessDiagramDTO resGetProcessDiagramDTO = new ResGetProcessDiagramDTO();
  84. resGetProcessDiagramDTO.setBase64ImageStr(apiResult.getContent());
  85. return buildSuccessResponse(resGetProcessDiagramDTO);
  86. }
  87. //@RequiresPermissions("base.bpm.operation")
  88. @ApiOperation(value = "查询经手流程")
  89. @RequestMapping(value = "/v1/workflow/qryHandleProcess", method = RequestMethod.GET)
  90. public BaseResponse<PageInfo<ResGetProcessHandleDTO>> post_qryHandleProcess(ReqPostProcessHandleDTO reqPostProcessHandleDTO) {
  91. if (Objects.isNull(reqPostProcessHandleDTO)) {
  92. throw new BusinessException(CommonErrorCode.ParamIsNull);
  93. }
  94. ProcessHandleCO processHandleCO = new ProcessHandleCO();
  95. Page page = new Page();
  96. ConvertBeanUtils.copyPropertiesBySource(reqPostProcessHandleDTO, processHandleCO);
  97. ConvertBeanUtils.copyPropertiesBySource(reqPostProcessHandleDTO, page);
  98. APIRequestPage<ProcessHandleCO> requestPage = new APIRequestPage<>();
  99. requestPage.setContent(processHandleCO);
  100. if ("jc".equals(reqPostProcessHandleDTO.getQueryType())) {
  101. processHandleCO.setProcInstName("稽察整改-");
  102. }
  103. if (0 != reqPostProcessHandleDTO.getPageNum()) {
  104. page.setPageNo(reqPostProcessHandleDTO.getPageNum());
  105. }
  106. requestPage.setPage(page);
  107. PageInfo<ResGetProcessHandleDTO> newPage = null;
  108. try {
  109. APIResultPage<List<ResGetProcessHandleDTO>> listAPIResultPage = bpmProcessInstService.qryHandleProcess(requestPage, getCurrentPersId(), getCurrentOrgId());
  110. listAPIResultPage.setPageClass(ResGetProcessHandleDTO.class);
  111. newPage = new PageInfo();
  112. newPage.setList(listAPIResultPage.getContent());
  113. newPage.setPageNum(listAPIResultPage.getPage().getPageNo());
  114. newPage.setPageSize(listAPIResultPage.getPage().getPageSize());
  115. newPage.setTotal(listAPIResultPage.getPage().getTotal());
  116. return buildSuccessResponse(newPage);
  117. } catch (Exception e) {
  118. e.printStackTrace();
  119. }
  120. newPage = new PageInfo<>();
  121. newPage.setPageSize(10);
  122. newPage.setTotal(0);
  123. newPage.setPageNum(1);
  124. newPage.setList(new ArrayList<>());
  125. return buildSuccessResponse(newPage);
  126. }
  127. }