40eeaea035773755199a9ab65da96b6659cbaead.svn-base 6.0 KB

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