97fed026e2ed716585260cbd166c4bcb1a4c7131.svn-base 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. package cn.com.goldenwater.dcproj.controller.svwt;
  2. import cn.com.goldenwater.dcproj.model.BisInspSvwtWuntRgstr;
  3. import cn.com.goldenwater.dcproj.model.BisInspSvwtWuntRgstrWsusw;
  4. import cn.com.goldenwater.dcproj.param.BisInspSvwtWuntRgstrWsuswParam;
  5. import cn.com.goldenwater.dcproj.service.BisInspSvwtWuntRgstrService;
  6. import cn.com.goldenwater.dcproj.service.BisInspSvwtWuntRgstrWsuswService;
  7. import cn.com.goldenwater.core.web.BaseController;
  8. import cn.com.goldenwater.core.web.BaseResponse;
  9. import cn.com.goldenwater.id.util.UuidUtil;
  10. import io.swagger.annotations.Api;
  11. import io.swagger.annotations.ApiOperation;
  12. import io.swagger.annotations.ApiParam;
  13. import org.apache.commons.lang3.StringUtils;
  14. import com.github.pagehelper.PageInfo;
  15. import org.slf4j.Logger;
  16. import org.slf4j.LoggerFactory;
  17. import org.springframework.beans.factory.annotation.Autowired;
  18. import org.springframework.web.bind.annotation.PathVariable;
  19. import org.springframework.web.bind.annotation.RequestBody;
  20. import org.springframework.web.bind.annotation.RequestMapping;
  21. import org.springframework.web.bind.annotation.RequestMethod;
  22. import org.springframework.web.bind.annotation.RestController;
  23. import javax.servlet.http.HttpServletRequest;
  24. import java.util.List;
  25. /**
  26. * @author lune
  27. * @date 2019-9-18
  28. */
  29. @Api(value = "BIS 节水型单位节约用水情况管理",tags="BIS 节水型单位节约用水情况管理")
  30. @RestController
  31. @RequestMapping("/bis/insp/svwt/wunt/rgstr/wsusw")
  32. public class BisInspSvwtWuntRgstrWsuswController extends BaseController {
  33. private Logger logger = LoggerFactory.getLogger(getClass());
  34. @Autowired
  35. private BisInspSvwtWuntRgstrWsuswService bisInspSvwtWuntRgstrWsuswService;
  36. @Autowired
  37. private BisInspSvwtWuntRgstrService wuntRgstrService;
  38. @ApiOperation(value = "添加/修改节水型单位节约用水情况")
  39. @RequestMapping(value = "", method = RequestMethod.POST)
  40. public BaseResponse<BisInspSvwtWuntRgstrWsusw> insert(@ApiParam(name = "bisInspSvwtWuntRgstrWsusw", value = "BisInspSvwtWuntRgstrWsusw", required = true) @RequestBody BisInspSvwtWuntRgstrWsusw bisInspSvwtWuntRgstrWsusw) {
  41. if(StringUtils.isBlank(bisInspSvwtWuntRgstrWsusw.getId())) {
  42. String uuid = UuidUtil.uuid(); // 生成uuid
  43. bisInspSvwtWuntRgstrWsusw.setId(uuid);
  44. BisInspSvwtWuntRgstrWsuswParam param = new BisInspSvwtWuntRgstrWsuswParam();
  45. param.setRgstrId(bisInspSvwtWuntRgstrWsusw.getRgstrId());
  46. List<BisInspSvwtWuntRgstrWsusw> list = bisInspSvwtWuntRgstrWsuswService.findList(param);
  47. if (list.size() > 0) {
  48. buildFailResponse(10010,"已存在此督查对象的检查清空");
  49. }
  50. bisInspSvwtWuntRgstrWsuswService.insert(bisInspSvwtWuntRgstrWsusw);
  51. }else{
  52. bisInspSvwtWuntRgstrWsuswService.update(bisInspSvwtWuntRgstrWsusw);
  53. }
  54. if (StringUtils.isNotBlank(bisInspSvwtWuntRgstrWsusw.getRgstrId())) {
  55. BisInspSvwtWuntRgstr rgstr = wuntRgstrService.get(bisInspSvwtWuntRgstrWsusw.getRgstrId());
  56. if (rgstr != null) {
  57. rgstr.setWsuswInfoStat(bisInspSvwtWuntRgstrWsusw.getDataStat());
  58. if (!"2".equals(rgstr.getState())) {
  59. rgstr.setState("1");
  60. }
  61. wuntRgstrService.update(rgstr);
  62. }
  63. }
  64. return buildSuccessResponse(bisInspSvwtWuntRgstrWsusw);
  65. }
  66. @ApiOperation(value = "根据ID删除节水型单位节约用水情况")
  67. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  68. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  69. int ret = bisInspSvwtWuntRgstrWsuswService.delete(id);
  70. return buildSuccessResponse();
  71. }
  72. @ApiOperation(value = "根据登记表id获获取取水许可审批监管情况")
  73. @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET)
  74. public BaseResponse<BisInspSvwtWuntRgstrWsusw> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId,HttpServletRequest request) {
  75. if(StringUtils.isBlank(rgstrId)) {
  76. return buildFailResponse();
  77. }
  78. BisInspSvwtWuntRgstrWsuswParam param = new BisInspSvwtWuntRgstrWsuswParam();
  79. param.setRgstrId(rgstrId);
  80. BisInspSvwtWuntRgstrWsusw info = this.bisInspSvwtWuntRgstrWsuswService.getBy(param);
  81. return buildSuccessResponse(info);
  82. }
  83. @ApiOperation(value = "根据ID获取节水型单位节约用水情况(单表)")
  84. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  85. public BaseResponse<BisInspSvwtWuntRgstrWsusw> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  86. BisInspSvwtWuntRgstrWsusw bisInspSvwtWuntRgstrWsusw = bisInspSvwtWuntRgstrWsuswService.get(id);
  87. return buildSuccessResponse(bisInspSvwtWuntRgstrWsusw);
  88. }
  89. @ApiOperation(value = "获取节水型单位节约用水情况(列表所有)")
  90. @RequestMapping(value = "/list", method = RequestMethod.POST)
  91. public BaseResponse<List<BisInspSvwtWuntRgstrWsusw>> list(@ApiParam(name = "bisInspSvwtWuntRgstrWsuswParam", value = "bisInspSvwtWuntRgstrWsuswParam", required = true) @RequestBody BisInspSvwtWuntRgstrWsuswParam bisInspSvwtWuntRgstrWsuswParam) {
  92. List<BisInspSvwtWuntRgstrWsusw> bisInspSvwtWuntRgstrWsuswList = bisInspSvwtWuntRgstrWsuswService.findList(bisInspSvwtWuntRgstrWsuswParam);
  93. return buildSuccessResponse(bisInspSvwtWuntRgstrWsuswList);
  94. }
  95. @ApiOperation(value = "获取节水型单位节约用水情况(列表--分页)")
  96. @RequestMapping(value = "/page", method = RequestMethod.POST)
  97. public BaseResponse<PageInfo<BisInspSvwtWuntRgstrWsusw>> page(@ApiParam(name = "bisInspSvwtWuntRgstrWsuswParam", value = "bisInspSvwtWuntRgstrWsuswParam", required = true) @RequestBody BisInspSvwtWuntRgstrWsuswParam bisInspSvwtWuntRgstrWsuswParam) {
  98. PageInfo<BisInspSvwtWuntRgstrWsusw> bisInspSvwtWuntRgstrWsuswList = bisInspSvwtWuntRgstrWsuswService.findPageInfo(bisInspSvwtWuntRgstrWsuswParam);
  99. return buildSuccessResponse(bisInspSvwtWuntRgstrWsuswList);
  100. }
  101. }