| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- 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.ProcessTypeService;
- import com.workflow.bpm.api.bpmservices.co.processtype.AddProcessTypeCO;
- import com.workflow.bpm.api.bpmservices.co.processtype.GetProcTypeCO;
- import com.workflow.bpm.api.bpmservices.co.processtype.UpdateProcessTypeCO;
- 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.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.util.StringUtils;
- 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 ProcessTypeController extends BaseController {
- @Autowired
- private ProcessTypeService processTypeService;
- //@RequiresPermissions("bmpc.type.query.add")
- @ApiOperation(value = "新增")
- @PostMapping("/v1/workflow/procType")
- public BaseResponse post_procType(@RequestBody ReqPostProcTypeDTO reqPostProcTypeDTO) {
- if (Objects.isNull(reqPostProcTypeDTO)) {
- throw new BusinessException(CommonErrorCode.ParamIsNull);
- }
- AddProcessTypeCO addProcessTypeCO = new AddProcessTypeCO();
- ConvertBeanUtils.copyPropertiesBySource(reqPostProcTypeDTO,addProcessTypeCO);
- return buildSuccessResponse(processTypeService.add(addProcessTypeCO).getContent());
- }
- //@RequiresPermissions("bmpc.type.query.delete")
- @ApiOperation(value = "删除")
- @DeleteMapping("/v1/procType/{bpmProcTypeCode}")
- public BaseResponse delete_procType(@PathVariable String bpmProcTypeCode) {
- if (StringUtils.isEmpty(bpmProcTypeCode)) {
- throw new BusinessException(CommonErrorCode.ParamIsNull);
- }
- return buildSuccessResponse(processTypeService.del(bpmProcTypeCode).getContent());
- }
- //@RequiresPermissions("bmpc.type.query.edit")
- @ApiOperation(value = "修改")
- @PutMapping("/v1/procType")
- public BaseResponse put_procType(@RequestBody ReqPutProcTypeDTO reqPutProcTypeDTO) {
- if (Objects.isNull(reqPutProcTypeDTO)
- || StringUtils.isEmpty(reqPutProcTypeDTO.getBpmProcTypeCode())) {
- throw new BusinessException(CommonErrorCode.ParamIsNull);
- }
- UpdateProcessTypeCO updateProcessTypeCO = new UpdateProcessTypeCO();
- ConvertBeanUtils.copyPropertiesBySource(reqPutProcTypeDTO,updateProcessTypeCO);
- return buildSuccessResponse(processTypeService.update(updateProcessTypeCO).getContent());
- }
- //@RequiresPermissions("bmpc.type.query.list")
- @ApiOperation(value = "查询")
- @RequestMapping(value="/v1/workflow/procTypePage",method = RequestMethod.GET)
- public BaseResponse<PageInfo<ResGetProcTypeDTO>> get_procType(ReqGetProcTypeDTO reqGetProcTypeDTO ) {
- if (Objects.isNull(reqGetProcTypeDTO)) {
- throw new BusinessException(CommonErrorCode.ParamIsNull);
- }
- GetProcTypeCO getProcTypeCO = new GetProcTypeCO();
- Page page = new Page();
- ConvertBeanUtils.copyPropertiesBySource(reqGetProcTypeDTO,getProcTypeCO);
- ConvertBeanUtils.copyPropertiesBySource(reqGetProcTypeDTO,page);
- APIRequestPage<GetProcTypeCO> requestPage = new APIRequestPage<>();
- requestPage.setContent(getProcTypeCO);
- requestPage.setPage(page);
- ResultPage<List<ResGetProcTypeDTO>> listResultPage = processTypeService.queryProcType(requestPage);
- listResultPage.setPageClass(ResGetProcTypeDTO.class);
- PageInfo<ResGetProcTypeDTO> 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 = "查询流程类型集合")
- @RequestMapping(value="/v1/workflow/qryProcTypes",method = RequestMethod.GET)
- public BaseResponse<List<ResGetProcTypeDTO>> get_qryProcTypes( ReqGetProcTypesDTO reqGetProcTypesDTO ) {
- GetProcTypeCO getProcTypeCO = new GetProcTypeCO();
- if (reqGetProcTypesDTO!=null){
- ConvertBeanUtils.copyPropertiesBySource(reqGetProcTypesDTO,getProcTypeCO);
- }
- return buildSuccessResponse(processTypeService.qryProcTypeList(getProcTypeCO).getContent());
- }
- }
|