ed44dbe6db9b40f70c867ab547d324cf60ec6b14.svn-base 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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.BisInspEfpRgstrReasonsRec;
  7. import cn.com.goldenwater.dcproj.param.BisInspEfpRgstrReasonsRecParam;
  8. import cn.com.goldenwater.dcproj.service.BisInspEfpRgstrReasonsRecService;
  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/reasons/rec")
  30. public class BisInspEfpRgstrReasonsRecController extends BaseController {
  31. private Logger logger = LoggerFactory.getLogger(getClass());
  32. @Autowired
  33. private BisInspEfpRgstrReasonsRecService bisInspEfpRgstrReasonsRecService;
  34. @Autowired
  35. private BisInspEfpRgstrService bisInspEfpRgstrService;
  36. @ApiOperation(value = "添加/修改超标洪水防御预案原因分析和整改意见")
  37. @RequestMapping(value = "", method = RequestMethod.POST)
  38. public BaseResponse<BisInspEfpRgstrReasonsRec> insert(@ApiParam(name = "bisInspEfpRgstrReasonsRec", value = "BisInspEfpRgstrReasonsRec", required = true) @RequestBody BisInspEfpRgstrReasonsRec bisInspEfpRgstrReasonsRec) {
  39. bisInspEfpRgstrReasonsRec.setUptm(new Date());
  40. if(StringUtils.isBlank(bisInspEfpRgstrReasonsRec.getId())) {
  41. BisInspEfpRgstrReasonsRecParam bisInspEfpRgstrPlanComplParam = new BisInspEfpRgstrReasonsRecParam();
  42. bisInspEfpRgstrPlanComplParam.setRgstrId(bisInspEfpRgstrReasonsRec.getRgstrId());
  43. List<BisInspEfpRgstrReasonsRec> complList = bisInspEfpRgstrReasonsRecService.findList(bisInspEfpRgstrPlanComplParam);
  44. if (complList.size() > 0) {
  45. bisInspEfpRgstrReasonsRec.setId(complList.get(0).getId());
  46. bisInspEfpRgstrReasonsRecService.update(bisInspEfpRgstrReasonsRec);
  47. } else {
  48. String uuid = UuidUtil.uuid(); // 生成uuid
  49. bisInspEfpRgstrReasonsRec.setId(uuid);
  50. bisInspEfpRgstrReasonsRec.setIntm(new Date());
  51. bisInspEfpRgstrReasonsRecService.insert(bisInspEfpRgstrReasonsRec);
  52. }
  53. }else{
  54. bisInspEfpRgstrReasonsRecService.update(bisInspEfpRgstrReasonsRec);
  55. }
  56. if (StringUtils.isNotBlank(bisInspEfpRgstrReasonsRec.getRgstrId())) {
  57. BisInspEfpRgstr rgstr = bisInspEfpRgstrService.get(bisInspEfpRgstrReasonsRec.getRgstrId());
  58. if (!StateEnum.COMASTSTATE.getKey().equals(rgstr.getState())) {
  59. rgstr.setState(StateEnum.EXWASTSTATE.getKey());
  60. rgstr.setReasonStat(bisInspEfpRgstrReasonsRec.getStatus());
  61. bisInspEfpRgstrService.update(rgstr);
  62. }
  63. }
  64. return buildSuccessResponse(bisInspEfpRgstrReasonsRec);
  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 = bisInspEfpRgstrReasonsRecService.delete(id);
  70. return buildSuccessResponse();
  71. }
  72. @ApiOperation(value = "根据ID获取超标洪水防御预案原因分析和整改意见(单表)")
  73. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  74. public BaseResponse<BisInspEfpRgstrReasonsRec> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  75. BisInspEfpRgstrReasonsRec bisInspEfpRgstrReasonsRec = bisInspEfpRgstrReasonsRecService.get(id);
  76. return buildSuccessResponse(bisInspEfpRgstrReasonsRec);
  77. }
  78. @ApiOperation(value = "获取超标洪水防御预案原因分析和整改意见(列表所有)")
  79. @RequestMapping(value = "/list", method = RequestMethod.POST)
  80. public BaseResponse<List<BisInspEfpRgstrReasonsRec>> list(@ApiParam(name = "bisInspEfpRgstrReasonsRecParam", value = "bisInspEfpRgstrReasonsRecParam", required = true) @RequestBody BisInspEfpRgstrReasonsRecParam bisInspEfpRgstrReasonsRecParam) {
  81. List<BisInspEfpRgstrReasonsRec> bisInspEfpRgstrReasonsRecList = bisInspEfpRgstrReasonsRecService.findList(bisInspEfpRgstrReasonsRecParam);
  82. return buildSuccessResponse(bisInspEfpRgstrReasonsRecList);
  83. }
  84. @ApiOperation(value = "获取超标洪水防御预案原因分析和整改意见(列表--分页)")
  85. @RequestMapping(value = "/page", method = RequestMethod.POST)
  86. public BaseResponse<PageInfo<BisInspEfpRgstrReasonsRec>> page(@ApiParam(name = "bisInspEfpRgstrReasonsRecParam", value = "bisInspEfpRgstrReasonsRecParam", required = true) @RequestBody BisInspEfpRgstrReasonsRecParam bisInspEfpRgstrReasonsRecParam) {
  87. PageInfo<BisInspEfpRgstrReasonsRec> bisInspEfpRgstrReasonsRecList = bisInspEfpRgstrReasonsRecService.findPageInfo(bisInspEfpRgstrReasonsRecParam);
  88. return buildSuccessResponse(bisInspEfpRgstrReasonsRecList);
  89. }
  90. @ApiOperation(value = "根据登记表id获获取取水许可审批监管情况")
  91. @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET)
  92. public BaseResponse<BisInspEfpRgstrReasonsRec> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId, HttpServletRequest request) {
  93. if(StringUtils.isBlank(rgstrId)) {
  94. return buildFailResponse();
  95. }
  96. BisInspEfpRgstrReasonsRecParam param = new BisInspEfpRgstrReasonsRecParam();
  97. param.setRgstrId(rgstrId);
  98. BisInspEfpRgstrReasonsRec info = this.bisInspEfpRgstrReasonsRecService.getBy(param);
  99. return buildSuccessResponse(info);
  100. }
  101. }