| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- 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.BpmProcessInstService;
- import com.workflow.bpm.api.bpmservices.co.processinstance.ProcInstIdCO;
- import com.workflow.bpm.api.bpmservices.co.processinstance.ProcessHandleCO;
- import com.workflow.bpm.api.bpmservices.dto.ReqPostProcessHandleDTO;
- import com.workflow.bpm.api.bpmservices.dto.ResGetProcessDiagramDTO;
- import com.workflow.bpm.api.bpmservices.dto.ResGetProcessHandleDTO;
- 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.Result;
- import com.workflow.common.struct.res.impl.APIResult;
- import com.workflow.common.struct.res.impl.APIResultPage;
- import com.workflow.common.util.convert.ConvertBeanUtils;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.apache.commons.lang.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Objects;
- /**
- * @program parent
- * @Description
- * @Author admin
- * @Date 2019/7/10
- **/
- @Api(tags = "流程实例")
- @RestController
- @RequestMapping("/bis/insp/pblm/plist/")
- public class ProcessInstController extends BaseController {
- @Autowired
- private BpmProcessInstService bpmProcessInstService;
- //@RequiresPermissions("base.bpm.operation")
- @ApiOperation(value = "挂起流程")
- @GetMapping("/v1/workflow/suspendProcInst/{procInstId}")
- public Result<?> post_suspendProcInst(@PathVariable String procInstId) {
- if (StringUtils.isEmpty(procInstId)) {
- throw new BusinessException(CommonErrorCode.ParamIsNull);
- }
- ProcInstIdCO procInstIdCO = new ProcInstIdCO();
- procInstIdCO.setProcInstId(procInstId);
- return bpmProcessInstService.suspendProcInst(procInstIdCO);
- }
- //@RequiresPermissions("base.bpm.operation")
- @ApiOperation(value = "重启挂起的流程")
- @GetMapping("/v1/workflow/resumeProcInst/{procInstId}")
- public Result<?> post_resumeProcInst(@PathVariable String procInstId) {
- if (StringUtils.isEmpty(procInstId)) {
- throw new BusinessException(CommonErrorCode.ParamIsNull);
- }
- ProcInstIdCO procInstIdCO = new ProcInstIdCO();
- procInstIdCO.setProcInstId(procInstId);
- return bpmProcessInstService.resumeProcInst(procInstIdCO);
- }
- //@RequiresPermissions("base.bpm.operation")
- @ApiOperation(value = "撤销流程")
- @GetMapping("/v1/workflow/cancelProcInst/{procInstId}")
- public Result<?> post_cancelProcInst(@PathVariable String procInstId) {
- if (StringUtils.isEmpty(procInstId)) {
- throw new BusinessException(CommonErrorCode.ParamIsNull);
- }
- ProcInstIdCO procInstIdCO = new ProcInstIdCO();
- procInstIdCO.setProcInstId(procInstId);
- return bpmProcessInstService.cancelProcInst(procInstIdCO);
- }
- //@RequiresPermissions("base.bpm.operation")
- @ApiOperation(value = "查询流程图")
- @GetMapping("/v1/workflow/qryProcessDiagram/{procInstId}")
- public BaseResponse<ResGetProcessDiagramDTO> post_qryProcessDiagram(@PathVariable String procInstId) {
- ProcInstIdCO procInstIdCO = new ProcInstIdCO();
- procInstIdCO.setProcInstId(procInstId);
- APIResult<String> apiResult = bpmProcessInstService.qryProcessDiagram(procInstIdCO);
- ResGetProcessDiagramDTO resGetProcessDiagramDTO = new ResGetProcessDiagramDTO();
- resGetProcessDiagramDTO.setBase64ImageStr(apiResult.getContent());
- return buildSuccessResponse(resGetProcessDiagramDTO);
- }
- //@RequiresPermissions("base.bpm.operation")
- @ApiOperation(value = "查询经手流程")
- @RequestMapping(value = "/v1/workflow/qryHandleProcess", method = RequestMethod.GET)
- public BaseResponse<PageInfo<ResGetProcessHandleDTO>> post_qryHandleProcess(ReqPostProcessHandleDTO reqPostProcessHandleDTO) {
- if (Objects.isNull(reqPostProcessHandleDTO)) {
- throw new BusinessException(CommonErrorCode.ParamIsNull);
- }
- ProcessHandleCO processHandleCO = new ProcessHandleCO();
- Page page = new Page();
- ConvertBeanUtils.copyPropertiesBySource(reqPostProcessHandleDTO, processHandleCO);
- ConvertBeanUtils.copyPropertiesBySource(reqPostProcessHandleDTO, page);
- APIRequestPage<ProcessHandleCO> requestPage = new APIRequestPage<>();
- requestPage.setContent(processHandleCO);
- if ("jc".equals(reqPostProcessHandleDTO.getQueryType())) {
- processHandleCO.setProcInstName("稽察整改-");
- }
- if (0 != reqPostProcessHandleDTO.getPageNum()) {
- page.setPageNo(reqPostProcessHandleDTO.getPageNum());
- }
- requestPage.setPage(page);
- PageInfo<ResGetProcessHandleDTO> newPage = null;
- try {
- APIResultPage<List<ResGetProcessHandleDTO>> listAPIResultPage = bpmProcessInstService.qryHandleProcess(requestPage, getCurrentPersId(), getCurrentOrgId());
- listAPIResultPage.setPageClass(ResGetProcessHandleDTO.class);
- newPage = new PageInfo();
- newPage.setList(listAPIResultPage.getContent());
- newPage.setPageNum(listAPIResultPage.getPage().getPageNo());
- newPage.setPageSize(listAPIResultPage.getPage().getPageSize());
- newPage.setTotal(listAPIResultPage.getPage().getTotal());
- return buildSuccessResponse(newPage);
- } catch (Exception e) {
- e.printStackTrace();
- }
- newPage = new PageInfo<>();
- newPage.setPageSize(10);
- newPage.setTotal(0);
- newPage.setPageNum(1);
- newPage.setList(new ArrayList<>());
- return buildSuccessResponse(newPage);
- }
- }
|