cfbbb8f52ae3bf95ba5794781c43e32b4c4afe39.svn-base 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. package cn.com.goldenwater.dcproj.controller.wiu;
  2. import cn.com.goldenwater.dcproj.model.BisInspWiuRgstr;
  3. import cn.com.goldenwater.dcproj.model.BisInspWiuRgstrIntInfo;
  4. import cn.com.goldenwater.dcproj.param.BisInspWiuRgstrIntInfoParam;
  5. import cn.com.goldenwater.dcproj.service.BisInspWiuRgstrIntInfoService;
  6. import cn.com.goldenwater.core.web.BaseController;
  7. import cn.com.goldenwater.core.web.BaseResponse;
  8. import cn.com.goldenwater.dcproj.service.BisInspWiuRgstrService;
  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-8-9
  28. */
  29. @Api(value = "BIS 取水口取水及监管情况检查表管理",tags="BIS 取水口取水及监管情况检查表管理")
  30. @RestController
  31. @RequestMapping("/bis/insp/wiu/rgstr/int/info")
  32. public class BisInspWiuRgstrIntInfoController extends BaseController {
  33. private Logger logger = LoggerFactory.getLogger(getClass());
  34. @Autowired
  35. private BisInspWiuRgstrIntInfoService bisInspWiuRgstrIntInfoService;
  36. @Autowired
  37. private BisInspWiuRgstrService wiuRgstrService;
  38. @ApiOperation(value = "添加/修改取水单位取用水情况")
  39. @RequestMapping(value = "", method = RequestMethod.POST)
  40. public BaseResponse<BisInspWiuRgstrIntInfo> insert(@ApiParam(name = "bisInspWiuRgstrIntInfo", value = "BisInspWiuRgstrIntInfo", required = true) @RequestBody BisInspWiuRgstrIntInfo bisInspWiuRgstrIntInfo) {
  41. if(StringUtils.isBlank(bisInspWiuRgstrIntInfo.getId())) {
  42. String uuid = UuidUtil.uuid(); // 生成uuid
  43. bisInspWiuRgstrIntInfo.setId(uuid);
  44. bisInspWiuRgstrIntInfoService.insert(bisInspWiuRgstrIntInfo);
  45. }else{
  46. bisInspWiuRgstrIntInfoService.update(bisInspWiuRgstrIntInfo);
  47. }
  48. if (StringUtils.isNotBlank(bisInspWiuRgstrIntInfo.getRgstrId())) {
  49. BisInspWiuRgstr rgstr = wiuRgstrService.get(bisInspWiuRgstrIntInfo.getRgstrId());
  50. if (rgstr != null) {
  51. rgstr.setIntInfoStat(bisInspWiuRgstrIntInfo.getDataStat());
  52. if (!"2".equals(rgstr.getState())) {
  53. rgstr.setState("1");
  54. }
  55. wiuRgstrService.update(rgstr);
  56. }
  57. }
  58. return buildSuccessResponse(bisInspWiuRgstrIntInfo);
  59. }
  60. @ApiOperation(value = "根据ID删除取水单位取用水情况")
  61. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  62. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  63. int ret = bisInspWiuRgstrIntInfoService.delete(id);
  64. return buildSuccessResponse();
  65. }
  66. @ApiOperation(value = "根据ID获取取水单位取用水情况(单表)")
  67. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  68. public BaseResponse<BisInspWiuRgstrIntInfo> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  69. BisInspWiuRgstrIntInfo bisInspWiuRgstrIntInfo = bisInspWiuRgstrIntInfoService.get(id);
  70. return buildSuccessResponse(bisInspWiuRgstrIntInfo);
  71. }
  72. @ApiOperation(value = "获取取水单位取用水情况(列表所有)")
  73. @RequestMapping(value = "/list", method = RequestMethod.POST)
  74. public BaseResponse<List<BisInspWiuRgstrIntInfo>> list(@ApiParam(name = "bisInspWiuRgstrIntInfoParam", value = "bisInspWiuRgstrIntInfoParam", required = true) @RequestBody BisInspWiuRgstrIntInfoParam bisInspWiuRgstrIntInfoParam) {
  75. List<BisInspWiuRgstrIntInfo> bisInspWiuRgstrIntInfoList = bisInspWiuRgstrIntInfoService.findList(bisInspWiuRgstrIntInfoParam);
  76. return buildSuccessResponse(bisInspWiuRgstrIntInfoList);
  77. }
  78. @ApiOperation(value = "获取取水单位取用水情况(列表--分页)")
  79. @RequestMapping(value = "/page", method = RequestMethod.POST)
  80. public BaseResponse<PageInfo<BisInspWiuRgstrIntInfo>> page(@ApiParam(name = "bisInspWiuRgstrIntInfoParam", value = "bisInspWiuRgstrIntInfoParam", required = true) @RequestBody BisInspWiuRgstrIntInfoParam bisInspWiuRgstrIntInfoParam) {
  81. PageInfo<BisInspWiuRgstrIntInfo> bisInspWiuRgstrIntInfoList = bisInspWiuRgstrIntInfoService.findPageInfo(bisInspWiuRgstrIntInfoParam);
  82. return buildSuccessResponse(bisInspWiuRgstrIntInfoList);
  83. }
  84. @ApiOperation(value = "根据登记表id获取取水单位用水情况")
  85. @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET)
  86. public BaseResponse<BisInspWiuRgstrIntInfo> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId,HttpServletRequest request) {
  87. if(StringUtils.isBlank(rgstrId)) {
  88. return buildFailResponse();
  89. }
  90. BisInspWiuRgstrIntInfoParam param = new BisInspWiuRgstrIntInfoParam();
  91. param.setRgstrId(rgstrId);
  92. BisInspWiuRgstrIntInfo info = this.bisInspWiuRgstrIntInfoService.getBy(param);
  93. return buildSuccessResponse(info);
  94. }
  95. }