| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- package cn.com.goldenwater.dcproj.controller.svwt;
- import cn.com.goldenwater.dcproj.model.BisInspSvwtWuntRgstr;
- import cn.com.goldenwater.dcproj.model.BisInspSvwtWuntRgstrWsusw;
- import cn.com.goldenwater.dcproj.param.BisInspSvwtWuntRgstrWsuswParam;
- import cn.com.goldenwater.dcproj.service.BisInspSvwtWuntRgstrService;
- import cn.com.goldenwater.dcproj.service.BisInspSvwtWuntRgstrWsuswService;
- 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.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.RestController;
- import javax.servlet.http.HttpServletRequest;
- import java.util.List;
- /**
- * @author lune
- * @date 2019-9-18
- */
- @Api(value = "BIS 节水型单位节约用水情况管理",tags="BIS 节水型单位节约用水情况管理")
- @RestController
- @RequestMapping("/bis/insp/svwt/wunt/rgstr/wsusw")
- public class BisInspSvwtWuntRgstrWsuswController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspSvwtWuntRgstrWsuswService bisInspSvwtWuntRgstrWsuswService;
- @Autowired
- private BisInspSvwtWuntRgstrService wuntRgstrService;
- @ApiOperation(value = "添加/修改节水型单位节约用水情况")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspSvwtWuntRgstrWsusw> insert(@ApiParam(name = "bisInspSvwtWuntRgstrWsusw", value = "BisInspSvwtWuntRgstrWsusw", required = true) @RequestBody BisInspSvwtWuntRgstrWsusw bisInspSvwtWuntRgstrWsusw) {
- if(StringUtils.isBlank(bisInspSvwtWuntRgstrWsusw.getId())) {
- String uuid = UuidUtil.uuid(); // 生成uuid
- bisInspSvwtWuntRgstrWsusw.setId(uuid);
- BisInspSvwtWuntRgstrWsuswParam param = new BisInspSvwtWuntRgstrWsuswParam();
- param.setRgstrId(bisInspSvwtWuntRgstrWsusw.getRgstrId());
- List<BisInspSvwtWuntRgstrWsusw> list = bisInspSvwtWuntRgstrWsuswService.findList(param);
- if (list.size() > 0) {
- buildFailResponse(10010,"已存在此督查对象的检查清空");
- }
- bisInspSvwtWuntRgstrWsuswService.insert(bisInspSvwtWuntRgstrWsusw);
- }else{
- bisInspSvwtWuntRgstrWsuswService.update(bisInspSvwtWuntRgstrWsusw);
- }
- if (StringUtils.isNotBlank(bisInspSvwtWuntRgstrWsusw.getRgstrId())) {
- BisInspSvwtWuntRgstr rgstr = wuntRgstrService.get(bisInspSvwtWuntRgstrWsusw.getRgstrId());
- if (rgstr != null) {
- rgstr.setWsuswInfoStat(bisInspSvwtWuntRgstrWsusw.getDataStat());
- if (!"2".equals(rgstr.getState())) {
- rgstr.setState("1");
- }
- wuntRgstrService.update(rgstr);
- }
- }
- return buildSuccessResponse(bisInspSvwtWuntRgstrWsusw);
- }
- @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 = bisInspSvwtWuntRgstrWsuswService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据登记表id获获取取水许可审批监管情况")
- @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET)
- public BaseResponse<BisInspSvwtWuntRgstrWsusw> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId,HttpServletRequest request) {
- if(StringUtils.isBlank(rgstrId)) {
- return buildFailResponse();
- }
- BisInspSvwtWuntRgstrWsuswParam param = new BisInspSvwtWuntRgstrWsuswParam();
- param.setRgstrId(rgstrId);
- BisInspSvwtWuntRgstrWsusw info = this.bisInspSvwtWuntRgstrWsuswService.getBy(param);
- return buildSuccessResponse(info);
- }
- @ApiOperation(value = "根据ID获取节水型单位节约用水情况(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspSvwtWuntRgstrWsusw> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspSvwtWuntRgstrWsusw bisInspSvwtWuntRgstrWsusw = bisInspSvwtWuntRgstrWsuswService.get(id);
- return buildSuccessResponse(bisInspSvwtWuntRgstrWsusw);
- }
- @ApiOperation(value = "获取节水型单位节约用水情况(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<BisInspSvwtWuntRgstrWsusw>> list(@ApiParam(name = "bisInspSvwtWuntRgstrWsuswParam", value = "bisInspSvwtWuntRgstrWsuswParam", required = true) @RequestBody BisInspSvwtWuntRgstrWsuswParam bisInspSvwtWuntRgstrWsuswParam) {
- List<BisInspSvwtWuntRgstrWsusw> bisInspSvwtWuntRgstrWsuswList = bisInspSvwtWuntRgstrWsuswService.findList(bisInspSvwtWuntRgstrWsuswParam);
- return buildSuccessResponse(bisInspSvwtWuntRgstrWsuswList);
- }
- @ApiOperation(value = "获取节水型单位节约用水情况(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspSvwtWuntRgstrWsusw>> page(@ApiParam(name = "bisInspSvwtWuntRgstrWsuswParam", value = "bisInspSvwtWuntRgstrWsuswParam", required = true) @RequestBody BisInspSvwtWuntRgstrWsuswParam bisInspSvwtWuntRgstrWsuswParam) {
- PageInfo<BisInspSvwtWuntRgstrWsusw> bisInspSvwtWuntRgstrWsuswList = bisInspSvwtWuntRgstrWsuswService.findPageInfo(bisInspSvwtWuntRgstrWsuswParam);
- return buildSuccessResponse(bisInspSvwtWuntRgstrWsuswList);
- }
- }
|