| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- 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.BisInspWtuntRgstrCollege;
- import cn.com.goldenwater.dcproj.param.BisInspWtuntRgstrCollegeParam;
- import cn.com.goldenwater.dcproj.service.BisInspWtuntRgstrCollegeService;
- 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/college")
- public class BisInspWtuntRgstrCollegeController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspWtuntRgstrCollegeService bisInspWtuntRgstrCollegeService;
- @Autowired
- private BisInspWtuntRgstrService bisInspWtuntRgstrService;
- @ApiOperation(value = "添加/修改2020年度用水单位节约用水情况检查表(高校)")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspWtuntRgstrCollege> insert(@ApiParam(name = "bisInspWtuntRgstrCollege", value = "BisInspWtuntRgstrCollege", required = true) @RequestBody BisInspWtuntRgstrCollege bisInspWtuntRgstrCollege) {
- String rgstrId = bisInspWtuntRgstrCollege.getRgstrId();
- bisInspWtuntRgstrCollege.setUptm(new Date());
- if(StringUtils.isBlank(bisInspWtuntRgstrCollege.getId())) {
- BisInspWtuntRgstrCollegeParam collegeParam = new BisInspWtuntRgstrCollegeParam();
- collegeParam.setRgstrId(rgstrId);
- List<BisInspWtuntRgstrCollege> list = bisInspWtuntRgstrCollegeService.findList(collegeParam);
- if(CollectionUtils.isEmpty(list)){
- bisInspWtuntRgstrCollege.setId(UuidUtil.uuid());
- bisInspWtuntRgstrCollege.setIntm(new Date());
- bisInspWtuntRgstrCollegeService.insert(bisInspWtuntRgstrCollege);
- }else{
- bisInspWtuntRgstrCollege.setId(list.get(0).getId());
- bisInspWtuntRgstrCollegeService.update(bisInspWtuntRgstrCollege);
- }
- }else{
- bisInspWtuntRgstrCollegeService.update(bisInspWtuntRgstrCollege);
- }
- //修改登记表督查状态
- 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(bisInspWtuntRgstrCollege.getStatus());
- bisInspWtuntRgstrService.update(wtuntRgstr);
- }
- }
- return buildSuccessResponse(bisInspWtuntRgstrCollege);
- }
- @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 = bisInspWtuntRgstrCollegeService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取2020年度用水单位节约用水情况检查表(高校)(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspWtuntRgstrCollege> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspWtuntRgstrCollege bisInspWtuntRgstrCollege = bisInspWtuntRgstrCollegeService.get(id);
- return buildSuccessResponse(bisInspWtuntRgstrCollege);
- }
- @ApiOperation(value = "获取2020年度用水单位节约用水情况检查表(高校)(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<BisInspWtuntRgstrCollege>> list(@ApiParam(name = "bisInspWtuntRgstrCollegeParam", value = "bisInspWtuntRgstrCollegeParam", required = true) @RequestBody BisInspWtuntRgstrCollegeParam bisInspWtuntRgstrCollegeParam) {
- List<BisInspWtuntRgstrCollege> bisInspWtuntRgstrCollegeList = bisInspWtuntRgstrCollegeService.findList(bisInspWtuntRgstrCollegeParam);
- return buildSuccessResponse(bisInspWtuntRgstrCollegeList);
- }
- @ApiOperation(value = "获取2020年度用水单位节约用水情况检查表(高校)(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspWtuntRgstrCollege>> page(@ApiParam(name = "bisInspWtuntRgstrCollegeParam", value = "bisInspWtuntRgstrCollegeParam", required = true) @RequestBody BisInspWtuntRgstrCollegeParam bisInspWtuntRgstrCollegeParam) {
- PageInfo<BisInspWtuntRgstrCollege> bisInspWtuntRgstrCollegeList = bisInspWtuntRgstrCollegeService.findPageInfo(bisInspWtuntRgstrCollegeParam);
- return buildSuccessResponse(bisInspWtuntRgstrCollegeList);
- }
- @ApiOperation(value = "获取2020年度用水单位节约用水情况检查表(高校)(列表--分页)")
- @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.POST)
- public BaseResponse<BisInspWtuntRgstrCollege> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId) {
- BisInspWtuntRgstrCollegeParam collegeParam = new BisInspWtuntRgstrCollegeParam();
- collegeParam.setRgstrId(rgstrId);
- return buildSuccessResponse(bisInspWtuntRgstrCollegeService.getBy(collegeParam));
- }
- }
|