| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- package cn.com.goldenwater.dcproj.controller.wtunt;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.model.BisInspWtuntRgstr;
- import cn.com.goldenwater.dcproj.model.BisInspWtuntRgstrHotel;
- import cn.com.goldenwater.dcproj.param.BisInspWtuntRgstrHotelParam;
- import cn.com.goldenwater.dcproj.service.BisInspWtuntRgstrHotelService;
- import cn.com.goldenwater.dcproj.service.BisInspWtuntRgstrService;
- import cn.com.goldenwater.dcproj.utils.Constant;
- import cn.com.goldenwater.id.util.UuidUtil;
- import com.github.pagehelper.PageInfo;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.apache.commons.collections.CollectionUtils;
- 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.*;
- import java.util.Date;
- import java.util.List;
- /**
- * @author lune
- * @date 2020-8-17
- */
- @Api(value = "BIS 2020年度用水单位节约用水情况检查表(宾馆)管理",tags="BIS 2020年度用水单位节约用水情况检查表(宾馆)管理")
- @RestController
- @RequestMapping("/bis/insp/wtunt/rgstr/hotel")
- public class BisInspWtuntRgstrHotelController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspWtuntRgstrHotelService bisInspWtuntRgstrHotelService;
- @Autowired
- private BisInspWtuntRgstrService bisInspWtuntRgstrService;
- @ApiOperation(value = "添加/修改2020年度用水单位节约用水情况检查表(宾馆)")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspWtuntRgstrHotel> insert(@ApiParam(name = "bisInspWtuntRgstrHotel", value = "BisInspWtuntRgstrHotel", required = true) @RequestBody BisInspWtuntRgstrHotel bisInspWtuntRgstrHotel) {
- String rgstrId = bisInspWtuntRgstrHotel.getRgstrId();
- bisInspWtuntRgstrHotel.setUptm(new Date());
- if(StringUtils.isBlank(bisInspWtuntRgstrHotel.getId())) {
- BisInspWtuntRgstrHotelParam hotelParam = new BisInspWtuntRgstrHotelParam();
- hotelParam.setRgstrId(rgstrId);
- List<BisInspWtuntRgstrHotel> list = bisInspWtuntRgstrHotelService.findList(hotelParam);
- if(CollectionUtils.isEmpty(list)){
- bisInspWtuntRgstrHotel.setId(UuidUtil.uuid());
- bisInspWtuntRgstrHotel.setIntm(new Date());
- bisInspWtuntRgstrHotelService.insert(bisInspWtuntRgstrHotel);
- }else{
- bisInspWtuntRgstrHotel.setId(list.get(0).getId());
- bisInspWtuntRgstrHotelService.update(bisInspWtuntRgstrHotel);
- }
- }else{
- bisInspWtuntRgstrHotelService.update(bisInspWtuntRgstrHotel);
- }
- //修改登记表督查状态
- if(StringUtils.isNotBlank(rgstrId)) {
- BisInspWtuntRgstr wtuntRgstr = bisInspWtuntRgstrService.get(rgstrId);
- if (!Constant.STRING_TWO.equals(wtuntRgstr.getState())) {
- wtuntRgstr.setUptm(new Date());
- wtuntRgstr.setState(Constant.STRING_ONE);
- wtuntRgstr.setWtuntStat(bisInspWtuntRgstrHotel.getStatus());
- bisInspWtuntRgstrService.update(wtuntRgstr);
- }
- }
- return buildSuccessResponse(bisInspWtuntRgstrHotel);
- }
- @ApiOperation(value = "根据ID删除2020年度用水单位节约用水情况检查表(宾馆)")
- @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
- public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- int ret = bisInspWtuntRgstrHotelService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取2020年度用水单位节约用水情况检查表(宾馆)(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspWtuntRgstrHotel> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspWtuntRgstrHotel bisInspWtuntRgstrHotel = bisInspWtuntRgstrHotelService.get(id);
- return buildSuccessResponse(bisInspWtuntRgstrHotel);
- }
- @ApiOperation(value = "获取2020年度用水单位节约用水情况检查表(宾馆)(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<BisInspWtuntRgstrHotel>> list(@ApiParam(name = "bisInspWtuntRgstrHotelParam", value = "bisInspWtuntRgstrHotelParam", required = true) @RequestBody BisInspWtuntRgstrHotelParam bisInspWtuntRgstrHotelParam) {
- List<BisInspWtuntRgstrHotel> bisInspWtuntRgstrHotelList = bisInspWtuntRgstrHotelService.findList(bisInspWtuntRgstrHotelParam);
- return buildSuccessResponse(bisInspWtuntRgstrHotelList);
- }
- @ApiOperation(value = "获取2020年度用水单位节约用水情况检查表(宾馆)(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspWtuntRgstrHotel>> page(@ApiParam(name = "bisInspWtuntRgstrHotelParam", value = "bisInspWtuntRgstrHotelParam", required = true) @RequestBody BisInspWtuntRgstrHotelParam bisInspWtuntRgstrHotelParam) {
- PageInfo<BisInspWtuntRgstrHotel> bisInspWtuntRgstrHotelList = bisInspWtuntRgstrHotelService.findPageInfo(bisInspWtuntRgstrHotelParam);
- return buildSuccessResponse(bisInspWtuntRgstrHotelList);
- }
- @ApiOperation(value = "获取2020年度用水单位节约用水情况检查表(宾馆)")
- @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.POST)
- public BaseResponse<BisInspWtuntRgstrHotel> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId) {
- BisInspWtuntRgstrHotelParam hotelParam = new BisInspWtuntRgstrHotelParam();
- hotelParam.setRgstrId(rgstrId);
- return buildSuccessResponse(bisInspWtuntRgstrHotelService.getBy(hotelParam));
- }
- }
|