123f7066598a11d2a6236af9593af8a70ecc4508.svn-base 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. package cn.com.goldenwater.dcproj.controller.svwt;
  2. import cn.com.goldenwater.dcproj.model.BisInspSvwtAreaRgstr;
  3. import cn.com.goldenwater.dcproj.model.BisInspSvwtAreaRgstrWswm;
  4. import cn.com.goldenwater.dcproj.param.BisInspSvwtAreaRgstrWswmParam;
  5. import cn.com.goldenwater.dcproj.service.BisInspSvwtAreaRgstrService;
  6. import cn.com.goldenwater.dcproj.service.BisInspSvwtAreaRgstrWswmService;
  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.Date;
  25. import java.util.List;
  26. /**
  27. * @author lune
  28. * @date 2019-9-17
  29. */
  30. @Api(value = "BIS 节约用水管理情况检查表管理",tags="BIS 节约用水管理情况检查表管理")
  31. @RestController
  32. @RequestMapping("/bis/insp/svwt/area/rgstr/wswm")
  33. public class BisInspSvwtAreaRgstrWswmController extends BaseController {
  34. private Logger logger = LoggerFactory.getLogger(getClass());
  35. @Autowired
  36. private BisInspSvwtAreaRgstrWswmService bisInspSvwtAreaRgstrWswmService;
  37. @Autowired
  38. private BisInspSvwtAreaRgstrService svwtAreaRgstrService;
  39. @ApiOperation(value = "添加/修改节约用水管理情况检查表")
  40. @RequestMapping(value = "", method = RequestMethod.POST)
  41. public BaseResponse<BisInspSvwtAreaRgstrWswm> insert(@ApiParam(name = "bisInspSvwtAreaRgstrWswm", value = "BisInspSvwtAreaRgstrWswm", required = true) @RequestBody BisInspSvwtAreaRgstrWswm bisInspSvwtAreaRgstrWswm) {
  42. if(StringUtils.isBlank(bisInspSvwtAreaRgstrWswm.getId())) {
  43. String uuid = UuidUtil.uuid(); // 生成uuid
  44. bisInspSvwtAreaRgstrWswm.setId(uuid);
  45. BisInspSvwtAreaRgstrWswmParam param = new BisInspSvwtAreaRgstrWswmParam();
  46. param.setRgstrId(bisInspSvwtAreaRgstrWswm.getRgstrId());
  47. List<BisInspSvwtAreaRgstrWswm> list = bisInspSvwtAreaRgstrWswmService.findList(param);
  48. if (list.size() > 0) {
  49. buildFailResponse(10010,"已存在此督查对象的检查清空");
  50. }
  51. bisInspSvwtAreaRgstrWswm.setInTm(new Date());
  52. bisInspSvwtAreaRgstrWswm.setUpTm(new Date());
  53. bisInspSvwtAreaRgstrWswmService.insert(bisInspSvwtAreaRgstrWswm);
  54. }else{
  55. bisInspSvwtAreaRgstrWswm.setUpTm(new Date());
  56. bisInspSvwtAreaRgstrWswmService.update(bisInspSvwtAreaRgstrWswm);
  57. }
  58. if (StringUtils.isNotBlank(bisInspSvwtAreaRgstrWswm.getRgstrId())) {
  59. BisInspSvwtAreaRgstr rgstr = svwtAreaRgstrService.get(bisInspSvwtAreaRgstrWswm.getRgstrId());
  60. if (rgstr != null) {
  61. rgstr.setWswmInfoStat(bisInspSvwtAreaRgstrWswm.getDataStat());
  62. if (!"2".equals(rgstr.getState())) {
  63. rgstr.setState("1");
  64. }
  65. svwtAreaRgstrService.update(rgstr);
  66. }
  67. }
  68. return buildSuccessResponse(bisInspSvwtAreaRgstrWswm);
  69. }
  70. @ApiOperation(value = "根据ID删除节约用水管理情况检查表")
  71. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  72. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  73. int ret = bisInspSvwtAreaRgstrWswmService.delete(id);
  74. return buildSuccessResponse();
  75. }
  76. @ApiOperation(value = "根据登记表id获获取取水许可审批监管情况")
  77. @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET)
  78. public BaseResponse<BisInspSvwtAreaRgstrWswm> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId,HttpServletRequest request) {
  79. if(StringUtils.isBlank(rgstrId)) {
  80. return buildFailResponse();
  81. }
  82. BisInspSvwtAreaRgstrWswmParam param = new BisInspSvwtAreaRgstrWswmParam();
  83. param.setRgstrId(rgstrId);
  84. BisInspSvwtAreaRgstrWswm info = this.bisInspSvwtAreaRgstrWswmService.getBy(param);
  85. return buildSuccessResponse(info);
  86. }
  87. @ApiOperation(value = "根据ID获取节约用水管理情况检查表(单表)")
  88. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  89. public BaseResponse<BisInspSvwtAreaRgstrWswm> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  90. BisInspSvwtAreaRgstrWswm bisInspSvwtAreaRgstrWswm = bisInspSvwtAreaRgstrWswmService.get(id);
  91. return buildSuccessResponse(bisInspSvwtAreaRgstrWswm);
  92. }
  93. @ApiOperation(value = "获取节约用水管理情况检查表(列表所有)")
  94. @RequestMapping(value = "/list", method = RequestMethod.POST)
  95. public BaseResponse<List<BisInspSvwtAreaRgstrWswm>> list(@ApiParam(name = "bisInspSvwtAreaRgstrWswmParam", value = "bisInspSvwtAreaRgstrWswmParam", required = true) @RequestBody BisInspSvwtAreaRgstrWswmParam bisInspSvwtAreaRgstrWswmParam) {
  96. List<BisInspSvwtAreaRgstrWswm> bisInspSvwtAreaRgstrWswmList = bisInspSvwtAreaRgstrWswmService.findList(bisInspSvwtAreaRgstrWswmParam);
  97. return buildSuccessResponse(bisInspSvwtAreaRgstrWswmList);
  98. }
  99. @ApiOperation(value = "获取节约用水管理情况检查表(列表--分页)")
  100. @RequestMapping(value = "/page", method = RequestMethod.POST)
  101. public BaseResponse<PageInfo<BisInspSvwtAreaRgstrWswm>> page(@ApiParam(name = "bisInspSvwtAreaRgstrWswmParam", value = "bisInspSvwtAreaRgstrWswmParam", required = true) @RequestBody BisInspSvwtAreaRgstrWswmParam bisInspSvwtAreaRgstrWswmParam) {
  102. PageInfo<BisInspSvwtAreaRgstrWswm> bisInspSvwtAreaRgstrWswmList = bisInspSvwtAreaRgstrWswmService.findPageInfo(bisInspSvwtAreaRgstrWswmParam);
  103. return buildSuccessResponse(bisInspSvwtAreaRgstrWswmList);
  104. }
  105. }