163566df7349e750ef8610052e0fb364258ae71c.svn-base 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. package cn.com.goldenwater.dcproj.controller.efp;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.constValue.StateEnum;
  5. import cn.com.goldenwater.dcproj.model.BisInspEfpRgstr;
  6. import cn.com.goldenwater.dcproj.model.BisInspEfpRgstrPlanCompl;
  7. import cn.com.goldenwater.dcproj.param.BisInspEfpRgstrPlanComplParam;
  8. import cn.com.goldenwater.dcproj.service.BisInspEfpRgstrPlanComplService;
  9. import cn.com.goldenwater.dcproj.service.BisInspEfpRgstrService;
  10. import cn.com.goldenwater.id.util.UuidUtil;
  11. import com.github.pagehelper.PageInfo;
  12. import io.swagger.annotations.Api;
  13. import io.swagger.annotations.ApiOperation;
  14. import io.swagger.annotations.ApiParam;
  15. import org.apache.commons.lang3.StringUtils;
  16. import org.slf4j.Logger;
  17. import org.slf4j.LoggerFactory;
  18. import org.springframework.beans.factory.annotation.Autowired;
  19. import org.springframework.web.bind.annotation.*;
  20. import javax.servlet.http.HttpServletRequest;
  21. import java.util.Date;
  22. import java.util.List;
  23. /**
  24. * @author lune
  25. * @date 2020-5-27
  26. */
  27. @Api(value = "BIS 超标洪水防御预案编制情况管理",tags="BIS 超标洪水防御预案编制情况管理")
  28. @RestController
  29. @RequestMapping("/bis/insp/efp/rgstr/plan/compl")
  30. public class BisInspEfpRgstrPlanComplController extends BaseController {
  31. private Logger logger = LoggerFactory.getLogger(getClass());
  32. @Autowired
  33. private BisInspEfpRgstrPlanComplService bisInspEfpRgstrPlanComplService;
  34. @Autowired
  35. private BisInspEfpRgstrService bisInspEfpRgstrService;
  36. @ApiOperation(value = "添加/修改超标洪水防御预案编制情况")
  37. @RequestMapping(value = "", method = RequestMethod.POST)
  38. public BaseResponse<BisInspEfpRgstrPlanCompl> insert(@ApiParam(name = "bisInspEfpRgstrPlanCompl", value = "BisInspEfpRgstrPlanCompl", required = true) @RequestBody BisInspEfpRgstrPlanCompl bisInspEfpRgstrPlanCompl) {
  39. bisInspEfpRgstrPlanCompl.setUptm(new Date());
  40. if(StringUtils.isBlank(bisInspEfpRgstrPlanCompl.getId())) {
  41. BisInspEfpRgstrPlanComplParam bisInspEfpRgstrPlanComplParam = new BisInspEfpRgstrPlanComplParam();
  42. bisInspEfpRgstrPlanComplParam.setRgstrId(bisInspEfpRgstrPlanCompl.getRgstrId());
  43. List<BisInspEfpRgstrPlanCompl> complList = bisInspEfpRgstrPlanComplService.findList(bisInspEfpRgstrPlanComplParam);
  44. if (complList.size() > 0) {
  45. bisInspEfpRgstrPlanCompl.setId(complList.get(0).getId());
  46. bisInspEfpRgstrPlanComplService.update(bisInspEfpRgstrPlanCompl);
  47. } else {
  48. String uuid = UuidUtil.uuid(); // 生成uuid
  49. bisInspEfpRgstrPlanCompl.setId(uuid);
  50. bisInspEfpRgstrPlanCompl.setIntm(new Date());
  51. bisInspEfpRgstrPlanComplService.insert(bisInspEfpRgstrPlanCompl);
  52. }
  53. }else{
  54. bisInspEfpRgstrPlanComplService.update(bisInspEfpRgstrPlanCompl);
  55. }
  56. if (StringUtils.isNotBlank(bisInspEfpRgstrPlanCompl.getRgstrId())) {
  57. BisInspEfpRgstr rgstr = bisInspEfpRgstrService.get(bisInspEfpRgstrPlanCompl.getRgstrId());
  58. if (!StateEnum.COMASTSTATE.getKey().equals(rgstr.getState())) {
  59. rgstr.setState(StateEnum.EXWASTSTATE.getKey());
  60. rgstr.setPlanStat(bisInspEfpRgstrPlanCompl.getStatus());
  61. bisInspEfpRgstrService.update(rgstr);
  62. }
  63. }
  64. return buildSuccessResponse(bisInspEfpRgstrPlanCompl);
  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 = bisInspEfpRgstrPlanComplService.delete(id);
  70. return buildSuccessResponse();
  71. }
  72. @ApiOperation(value = "根据ID获取超标洪水防御预案编制情况(单表)")
  73. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  74. public BaseResponse<BisInspEfpRgstrPlanCompl> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  75. BisInspEfpRgstrPlanCompl bisInspEfpRgstrPlanCompl = bisInspEfpRgstrPlanComplService.get(id);
  76. return buildSuccessResponse(bisInspEfpRgstrPlanCompl);
  77. }
  78. @ApiOperation(value = "获取超标洪水防御预案编制情况(列表所有)")
  79. @RequestMapping(value = "/list", method = RequestMethod.POST)
  80. public BaseResponse<List<BisInspEfpRgstrPlanCompl>> list(@ApiParam(name = "bisInspEfpRgstrPlanComplParam", value = "bisInspEfpRgstrPlanComplParam", required = true) @RequestBody BisInspEfpRgstrPlanComplParam bisInspEfpRgstrPlanComplParam) {
  81. List<BisInspEfpRgstrPlanCompl> bisInspEfpRgstrPlanComplList = bisInspEfpRgstrPlanComplService.findList(bisInspEfpRgstrPlanComplParam);
  82. return buildSuccessResponse(bisInspEfpRgstrPlanComplList);
  83. }
  84. @ApiOperation(value = "获取超标洪水防御预案编制情况(列表--分页)")
  85. @RequestMapping(value = "/page", method = RequestMethod.POST)
  86. public BaseResponse<PageInfo<BisInspEfpRgstrPlanCompl>> page(@ApiParam(name = "bisInspEfpRgstrPlanComplParam", value = "bisInspEfpRgstrPlanComplParam", required = true) @RequestBody BisInspEfpRgstrPlanComplParam bisInspEfpRgstrPlanComplParam) {
  87. PageInfo<BisInspEfpRgstrPlanCompl> bisInspEfpRgstrPlanComplList = bisInspEfpRgstrPlanComplService.findPageInfo(bisInspEfpRgstrPlanComplParam);
  88. return buildSuccessResponse(bisInspEfpRgstrPlanComplList);
  89. }
  90. @ApiOperation(value = "根据登记表id获获取取水许可审批监管情况")
  91. @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET)
  92. public BaseResponse<BisInspEfpRgstrPlanCompl> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId, HttpServletRequest request) {
  93. if(StringUtils.isBlank(rgstrId)) {
  94. return buildFailResponse();
  95. }
  96. BisInspEfpRgstrPlanComplParam param = new BisInspEfpRgstrPlanComplParam();
  97. param.setRgstrId(rgstrId);
  98. BisInspEfpRgstrPlanCompl info = this.bisInspEfpRgstrPlanComplService.getBy(param);
  99. return buildSuccessResponse(info);
  100. }
  101. }