package cn.com.goldenwater.dcproj.controller.zhejiang; import cn.com.goldenwater.dcproj.constValue.PlanEnum; import cn.com.goldenwater.dcproj.constValue.SendState; import cn.com.goldenwater.dcproj.model.BisInspAllRlationPers; import cn.com.goldenwater.dcproj.model.BisZhejiangCheckPlan; import cn.com.goldenwater.dcproj.model.BisZhejiangCheckProcess; import cn.com.goldenwater.dcproj.param.BisZhejiangCheckProcessParam; import cn.com.goldenwater.dcproj.service.BisInspAllRlationPersService; import cn.com.goldenwater.dcproj.service.BisZhejiangCheckPlanService; import cn.com.goldenwater.dcproj.service.BisZhejiangCheckProcessService; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.id.util.UuidUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.commons.lang3.StringUtils; import com.github.pagehelper.PageInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import java.util.Date; import java.util.List; /** * @author lune * @date 2020-5-12 */ @Api(value = "BIS 浙江监督检查工作审核表管理",tags="BIS 浙江监督检查工作审核表管理") @RestController @RequestMapping("/bis/zhejiang/check/process") public class BisZhejiangCheckProcessController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private BisZhejiangCheckProcessService bisZhejiangCheckProcessService; @Autowired private BisZhejiangCheckPlanService bisZhejiangCheckPlanService; @Autowired private BisInspAllRlationPersService bisInspAllRlationPersService; @ApiOperation(value = "添加/修改浙江监督检查工作审核表") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "bisZhejiangCheckProcess", value = "BisZhejiangCheckProcess", required = true) @RequestBody BisZhejiangCheckProcess bisZhejiangCheckProcess) { BisInspAllRlationPers bisInspAllRlationPers=bisInspAllRlationPersService.get(getCurrentPersId()); bisZhejiangCheckProcess.setPersName(bisInspAllRlationPers.getPersName()); bisZhejiangCheckProcess.setPersId(getCurrentPersId()); bisZhejiangCheckProcess.setUptm(new Date()); if(PlanEnum.PLAN_SEND.getKey().equals(bisZhejiangCheckProcess.getIsSend())){ BisZhejiangCheckPlan bisZhejiangCheckPlan=new BisZhejiangCheckPlan(); bisZhejiangCheckPlan.setId(bisZhejiangCheckProcess.getPlanId()); bisZhejiangCheckPlan.setIsSend(bisZhejiangCheckProcess.getIsSend()); bisZhejiangCheckPlan.setState(bisZhejiangCheckProcess.getIsSend()); bisZhejiangCheckPlanService.update(bisZhejiangCheckPlan); return buildSuccessResponse(bisZhejiangCheckProcess); }else{ BisZhejiangCheckPlan bisZhejiangCheckPlan=new BisZhejiangCheckPlan(); bisZhejiangCheckPlan.setId(bisZhejiangCheckProcess.getPlanId()); bisZhejiangCheckPlan.setState(bisZhejiangCheckProcess.getWorkStep()); bisZhejiangCheckPlan.setIsSend(SendState.SEND_NO.getKey()); bisZhejiangCheckPlanService.update(bisZhejiangCheckPlan); } if(StringUtils.isBlank(bisZhejiangCheckProcess.getId())) { String uuid = UuidUtil.uuid(); // 生成uuid bisZhejiangCheckProcess.setId(uuid); bisZhejiangCheckProcess.setIntm(new Date()); bisZhejiangCheckProcessService.insert(bisZhejiangCheckProcess); }else{ bisZhejiangCheckProcess.setUptm(new Date()); bisZhejiangCheckProcessService.update(bisZhejiangCheckProcess); } return buildSuccessResponse(bisZhejiangCheckProcess); } @ApiOperation(value = "根据ID删除浙江监督检查工作审核表") @RequestMapping(value = "/del/{id}", method = RequestMethod.GET) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { int ret = bisZhejiangCheckProcessService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "根据ID获取浙江监督检查工作审核表(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { BisZhejiangCheckProcess bisZhejiangCheckProcess = bisZhejiangCheckProcessService.get(id); return buildSuccessResponse(bisZhejiangCheckProcess); } @ApiOperation(value = "获取浙江监督检查工作审核表(列表所有)") @RequestMapping(value = "/list", method = RequestMethod.POST) public BaseResponse> list(@ApiParam(name = "bisZhejiangCheckProcessParam", value = "bisZhejiangCheckProcessParam", required = true) @RequestBody BisZhejiangCheckProcessParam bisZhejiangCheckProcessParam) { List bisZhejiangCheckProcessList = bisZhejiangCheckProcessService.findList(bisZhejiangCheckProcessParam); return buildSuccessResponse(bisZhejiangCheckProcessList); } @ApiOperation(value = "获取浙江监督检查工作审核表(列表--分页)") @RequestMapping(value = "/page", method = RequestMethod.POST) public BaseResponse> page(@ApiParam(name = "bisZhejiangCheckProcessParam", value = "bisZhejiangCheckProcessParam", required = true) @RequestBody BisZhejiangCheckProcessParam bisZhejiangCheckProcessParam) { PageInfo bisZhejiangCheckProcessList = bisZhejiangCheckProcessService.findPageInfo(bisZhejiangCheckProcessParam); return buildSuccessResponse(bisZhejiangCheckProcessList); } }