package cn.com.goldenwater.dcproj.controller.waga; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.model.BisInspWagaProenInfo; import cn.com.goldenwater.dcproj.param.BisInspWagaProenInfoParam; import cn.com.goldenwater.dcproj.service.AttWagaRgstrService; import cn.com.goldenwater.dcproj.service.BisInspWagaProenInfoService; 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.util.Assert; import org.springframework.web.bind.annotation.*; import java.util.Date; /** * @author lune * @date 2019-4-22 */ @Api(value = "WAGA 水闸督查工程实体情况管理", tags = "WAGA 水闸督查工程实体情况管理") @RestController @RequestMapping("/bis/waga/proenInfo") public class BisInspWagaProenInfoController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private BisInspWagaProenInfoService bisInspWagaProenInfoService; @Autowired private AttWagaRgstrService attWagaRgstrService; @ApiOperation(value = "添加水闸督查工程实体情况") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "bisInspWagaProenInfo", value = "BisInspWagaProenInfo", required = true) @RequestBody BisInspWagaProenInfo bisInspWagaProenInfo) { String uuid = UuidUtil.uuid(); Date date=new Date(); if (StringUtils.isBlank(bisInspWagaProenInfo.getId())) { bisInspWagaProenInfo.setId(uuid); bisInspWagaProenInfo.setIntm(date); bisInspWagaProenInfo.setUptm(date); bisInspWagaProenInfoService.insert(bisInspWagaProenInfo); } else { bisInspWagaProenInfo.setUptm(date); bisInspWagaProenInfoService.update(bisInspWagaProenInfo); } attWagaRgstrService.addState(bisInspWagaProenInfo.getRgstrId(), bisInspWagaProenInfo.getDataStat(), "pro"); return buildSuccessResponse(bisInspWagaProenInfo); } @ApiOperation(value = "根据ID删除水闸督查工程实体情况") @RequestMapping(value = "/del/{id}", method = RequestMethod.GET) public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { bisInspWagaProenInfoService.delete(id); return buildSuccessResponse(); } @ApiOperation(value = "更新水闸督查工程实体情况信息") @RequestMapping(value = "/update", method = RequestMethod.POST) public BaseResponse update(@ApiParam(name = "bisInspWagaProenInfo", value = "BisInspWagaProenInfo", required = true) @RequestBody BisInspWagaProenInfo bisInspWagaProenInfo) { Assert.notNull(bisInspWagaProenInfo.getId(), "主键id为必填参数"); bisInspWagaProenInfoService.update(bisInspWagaProenInfo); return buildSuccessResponse(bisInspWagaProenInfo); } @ApiOperation(value = "根据ID获取水闸督查工程实体情况(单表)") @RequestMapping(value = "/{id}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { BisInspWagaProenInfo bisInspWagaProenInfo = bisInspWagaProenInfoService.get(id); return buildSuccessResponse(bisInspWagaProenInfo); } @ApiOperation(value = "根据督查表rgstrId获取水闸督查工程实体情况(单表)") @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET) public BaseResponse getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId) { BisInspWagaProenInfoParam wagaProenInfoParam = new BisInspWagaProenInfoParam(); wagaProenInfoParam.setRgstrId(rgstrId); BisInspWagaProenInfo bisInspWagaProenInfo = bisInspWagaProenInfoService.getBy(wagaProenInfoParam); return buildSuccessResponse(bisInspWagaProenInfo); } }