package cn.com.goldenwater.dcproj.controller.hyst; import cn.com.goldenwater.dcproj.model.BisInspHystInfo; import cn.com.goldenwater.dcproj.model.BisInspHystRectInfo; import cn.com.goldenwater.dcproj.param.BisInspHystRectInfoParam; import cn.com.goldenwater.dcproj.service.BisInspHystInfoService; import cn.com.goldenwater.dcproj.service.BisInspHystRectInfoService; 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.util.Assert; 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.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.Date; import java.util.List; /** * @author lune * @date 2021-3-2 */ @Api(value = "BIS 小水电清理整改情况管理",tags="BIS 小水电清理整改情况管理") @RestController @RequestMapping("/bis/insp/hyst/rect/info") public class BisInspHystRectInfoController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private BisInspHystRectInfoService bisInspHystRectInfoService; @Autowired private BisInspHystInfoService bisInspHystInfoService; @ApiOperation(value = "添加/修改小水电清理整改情况") @RequestMapping(value = "", method = RequestMethod.POST) public BaseResponse insert(@ApiParam(name = "bisInspHystRectInfo", value = "BisInspHystRectInfo", required = true) @RequestBody BisInspHystRectInfo bisInspHystRectInfo) { if(StringUtils.isBlank(bisInspHystRectInfo.getId())) { // 生成uuid String uuid = UuidUtil.uuid(); bisInspHystRectInfo.setId(uuid); bisInspHystRectInfo.setIntm(new Date()); bisInspHystRectInfoService.insert(bisInspHystRectInfo); }else{ bisInspHystRectInfo.setUptm(new Date()); bisInspHystRectInfoService.update(bisInspHystRectInfo); } //更新小水电填报状态 String rgstrId = bisInspHystRectInfo.getRgstrId(); BisInspHystInfo bisInspHystInfo = new BisInspHystInfo(); bisInspHystInfo.setId(rgstrId); bisInspHystInfo.setRectState(bisInspHystRectInfo.getStatus()); bisInspHystInfoService.update(bisInspHystInfo); return buildSuccessResponse(bisInspHystRectInfo); } @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 = bisInspHystRectInfoService.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) { BisInspHystRectInfo bisInspHystRectInfo = bisInspHystRectInfoService.get(id); return buildSuccessResponse(bisInspHystRectInfo); } @ApiOperation(value = "根据rgstrId获取小水电清理整改情况(单表)") @RequestMapping(value = "/getBy/{id}", method = RequestMethod.GET) public BaseResponse getBy(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) { BisInspHystRectInfoParam bisInspHystRectInfoParam = new BisInspHystRectInfoParam(); bisInspHystRectInfoParam.setRgstrId(id); BisInspHystRectInfo by = bisInspHystRectInfoService.getBy(bisInspHystRectInfoParam); return buildSuccessResponse(by); } @ApiOperation(value = "获取小水电清理整改情况(列表所有)") @RequestMapping(value = "/list", method = RequestMethod.POST) public BaseResponse> list(@ApiParam(name = "bisInspHystRectInfoParam", value = "bisInspHystRectInfoParam", required = true) @RequestBody BisInspHystRectInfoParam bisInspHystRectInfoParam) { List bisInspHystRectInfoList = bisInspHystRectInfoService.findList(bisInspHystRectInfoParam); return buildSuccessResponse(bisInspHystRectInfoList); } @ApiOperation(value = "获取小水电清理整改情况(列表--分页)") @RequestMapping(value = "/page", method = RequestMethod.POST) public BaseResponse> page(@ApiParam(name = "bisInspHystRectInfoParam", value = "bisInspHystRectInfoParam", required = true) @RequestBody BisInspHystRectInfoParam bisInspHystRectInfoParam) { PageInfo bisInspHystRectInfoList = bisInspHystRectInfoService.findPageInfo(bisInspHystRectInfoParam); return buildSuccessResponse(bisInspHystRectInfoList); } }