c0152d9a0742c065cec72cdbfd2b00008ec7e861.svn-base 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. package cn.com.goldenwater.dcproj.controller.wint;
  2. import cn.com.goldenwater.dcproj.model.BisInspWintRgstr;
  3. import cn.com.goldenwater.dcproj.model.BisInspWintRgstrIntInfo;
  4. import cn.com.goldenwater.dcproj.param.BisInspWintRgstrIntInfoParam;
  5. import cn.com.goldenwater.dcproj.service.BisInspWintRgstrIntInfoService;
  6. import cn.com.goldenwater.core.web.BaseController;
  7. import cn.com.goldenwater.core.web.BaseResponse;
  8. import cn.com.goldenwater.dcproj.service.BisInspWintRgstrService;
  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 java.util.Date;
  24. import java.util.List;
  25. /**
  26. * @author lune
  27. * @date 2019-8-22
  28. */
  29. @Api(value = "BIS 年度水量分配及取用水管控情况抽查表管理",tags="BIS 年度水量分配及取用水管控情况抽查表管理")
  30. @RestController
  31. @RequestMapping("/bis/insp/wint/rgstr/int/info")
  32. public class BisInspWintRgstrIntInfoController extends BaseController {
  33. private Logger logger = LoggerFactory.getLogger(getClass());
  34. @Autowired
  35. private BisInspWintRgstrIntInfoService bisInspWintRgstrIntInfoService;
  36. @Autowired
  37. private BisInspWintRgstrService wintRgstrService;
  38. @ApiOperation(value = "添加/修改年度水量分配及取用水管控情况抽查表")
  39. @RequestMapping(value = "", method = RequestMethod.POST)
  40. public BaseResponse<BisInspWintRgstrIntInfo> insert(@ApiParam(name = "bisInspWintRgstrIntInfo", value = "BisInspWintRgstrIntInfo", required = true) @RequestBody BisInspWintRgstrIntInfo bisInspWintRgstrIntInfo) {
  41. bisInspWintRgstrIntInfo.setUpTm(new Date());
  42. if(StringUtils.isBlank(bisInspWintRgstrIntInfo.getId())) {
  43. BisInspWintRgstrIntInfoParam param = new BisInspWintRgstrIntInfoParam();
  44. param.setRgstrId(bisInspWintRgstrIntInfo.getRgstrId());
  45. List<BisInspWintRgstrIntInfo> list = bisInspWintRgstrIntInfoService.findList(param);
  46. if (list.size() > 0 ){
  47. return buildFailResponse(10001,"该督查对象已有抽查记录,无法重复添加");
  48. }
  49. bisInspWintRgstrIntInfo.setInTm(new Date());
  50. String uuid = UuidUtil.uuid(); // 生成uuid
  51. bisInspWintRgstrIntInfo.setId(uuid);
  52. bisInspWintRgstrIntInfoService.insert(bisInspWintRgstrIntInfo);
  53. }else{
  54. bisInspWintRgstrIntInfoService.update(bisInspWintRgstrIntInfo);
  55. }
  56. if (StringUtils.isNotBlank(bisInspWintRgstrIntInfo.getRgstrId())) {
  57. BisInspWintRgstr rgstr = wintRgstrService.get(bisInspWintRgstrIntInfo.getRgstrId());
  58. if (rgstr != null) {
  59. rgstr.setIntInfoStat(bisInspWintRgstrIntInfo.getDataStat());
  60. if (!"2".equals(rgstr.getState())) {
  61. rgstr.setState("1");
  62. }
  63. wintRgstrService.update(rgstr);
  64. }
  65. }
  66. return buildSuccessResponse(bisInspWintRgstrIntInfo);
  67. }
  68. @ApiOperation(value = "根据ID删除年度水量分配及取用水管控情况抽查表")
  69. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  70. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  71. int ret = bisInspWintRgstrIntInfoService.delete(id);
  72. return buildSuccessResponse();
  73. }
  74. @ApiOperation(value = "根据ID获取年度水量分配及取用水管控情况抽查表(单表)")
  75. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  76. public BaseResponse<BisInspWintRgstrIntInfo> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  77. BisInspWintRgstrIntInfo bisInspWintRgstrIntInfo = bisInspWintRgstrIntInfoService.get(id);
  78. return buildSuccessResponse(bisInspWintRgstrIntInfo);
  79. }
  80. @ApiOperation(value = "获取年度水量分配及取用水管控情况抽查表(列表所有)")
  81. @RequestMapping(value = "/list", method = RequestMethod.POST)
  82. public BaseResponse<List<BisInspWintRgstrIntInfo>> list(@ApiParam(name = "bisInspWintRgstrIntInfoParam", value = "bisInspWintRgstrIntInfoParam", required = true) @RequestBody BisInspWintRgstrIntInfoParam bisInspWintRgstrIntInfoParam) {
  83. List<BisInspWintRgstrIntInfo> bisInspWintRgstrIntInfoList = bisInspWintRgstrIntInfoService.findList(bisInspWintRgstrIntInfoParam);
  84. return buildSuccessResponse(bisInspWintRgstrIntInfoList);
  85. }
  86. @ApiOperation(value = "获取年度水量分配及取用水管控情况抽查表(列表--分页)")
  87. @RequestMapping(value = "/page", method = RequestMethod.POST)
  88. public BaseResponse<PageInfo<BisInspWintRgstrIntInfo>> page(@ApiParam(name = "bisInspWintRgstrIntInfoParam", value = "bisInspWintRgstrIntInfoParam", required = true) @RequestBody BisInspWintRgstrIntInfoParam bisInspWintRgstrIntInfoParam) {
  89. PageInfo<BisInspWintRgstrIntInfo> bisInspWintRgstrIntInfoList = bisInspWintRgstrIntInfoService.findPageInfo(bisInspWintRgstrIntInfoParam);
  90. return buildSuccessResponse(bisInspWintRgstrIntInfoList);
  91. }
  92. @ApiOperation(value = "根据督查表主键主键ID获取水库工程实体(单表)")
  93. @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET)
  94. public BaseResponse<BisInspWintRgstrIntInfo> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId) {
  95. BisInspWintRgstrIntInfoParam rsvrProjectParam = new BisInspWintRgstrIntInfoParam();
  96. rsvrProjectParam.setRgstrId(rgstrId);
  97. BisInspWintRgstrIntInfo bisInspRsvrProject = bisInspWintRgstrIntInfoService.getBy(rsvrProjectParam);
  98. return buildSuccessResponse(bisInspRsvrProject);
  99. }
  100. }