package cn.com.goldenwater.dcproj.controller.tacplan; import cn.com.goldenwater.dcproj.dao.BisInspAllRlationPersDao; import cn.com.goldenwater.dcproj.model.TacProvincePlanExamRecord; import cn.com.goldenwater.dcproj.model.TacProvincePlanExamine; import cn.com.goldenwater.dcproj.param.TacProvincePlanExamRecordParam; import cn.com.goldenwater.dcproj.param.TacProvincePlanExamineParam; import cn.com.goldenwater.dcproj.service.TacProvincePlanExamRecordService; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.service.TacProvincePlanExamineService; 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 org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; 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 * @date 2021-1-28 */ @Api(value = "工程阶段审定记录管理",tags="工程阶段审定记录管理") @RestController @RequestMapping("/tac/province/examRecord") public class TacProvincePlanExamRecordController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private TacProvincePlanExamRecordService tacProvincePlanExamRecordService; @Autowired private TacProvincePlanExamineService tacProvincePlanExamineService; @Autowired private BisInspAllRlationPersDao bisInspAllRlationPersDao; @ApiOperation(value = "添加工程阶段审定记录/修改工程阶段审定") @RequestMapping(value = "/insertExamine", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "tacProvincePlanExamRecord", value = "TacProvincePlanExamRecord", required = true) @RequestBody TacProvincePlanExamRecord tacProvincePlanExamRecord) { if(StringUtils.isBlank(tacProvincePlanExamRecord.getRgstrId())){ return buildFailResponse("工程参数不能为空"); } if(StringUtils.isBlank(tacProvincePlanExamRecord.getPlanProcessId())){ return buildFailResponse("阶段参数不能为空"); } TacProvincePlanExamineParam tacProvincePlanExamineParam = new TacProvincePlanExamineParam(); tacProvincePlanExamineParam.setRgstrId(tacProvincePlanExamRecord.getRgstrId()); tacProvincePlanExamineParam.setPlanProcessId(tacProvincePlanExamRecord.getPlanProcessId()); TacProvincePlanExamine by = tacProvincePlanExamineService.getBy(tacProvincePlanExamineParam); if(by==null){ return buildFailResponse("无工程阶段审定初始状态"); }else{ //修改工程阶段状态值 by.setStageStatus(tacProvincePlanExamRecord.getStageStatus()); by.setUptm(new Date()); tacProvincePlanExamineService.update(by); //入库工程阶段审定记录 String currentPersId = getCurrentPersId(); tacProvincePlanExamRecord.setId(UuidUtil.uuid()); tacProvincePlanExamRecord.setIntm(new Date()); tacProvincePlanExamRecord.setPersId(currentPersId); tacProvincePlanExamRecord.setPersName(bisInspAllRlationPersDao.get(currentPersId).getPersName()); tacProvincePlanExamRecordService.insert(tacProvincePlanExamRecord); return buildSuccessResponse(); } } @ApiOperation(value = "工程阶段审定记录") @RequestMapping(value = "/list", method = RequestMethod.POST) public BaseResponse> list(@ApiParam(name = "tacProvincePlanProcessParam", value = "tacProvincePlanProcessParam", required = true) @RequestBody TacProvincePlanExamRecordParam tacProvincePlanExamRecordParam) { if(StringUtils.isBlank(tacProvincePlanExamRecordParam.getRgstrId())){ return buildFailResponse("工程参数不能为空"); } if(StringUtils.isBlank(tacProvincePlanExamRecordParam.getPlanProcessId())){ return buildFailResponse("阶段参数不能为空"); } List tacProvincePlanProcessList = tacProvincePlanExamRecordService.findList(tacProvincePlanExamRecordParam); return buildSuccessResponse(tacProvincePlanProcessList); } }