720880712b9ebb85cdca972843ce5db68ee00455.svn-base 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. package cn.com.goldenwater.dcproj.controller.rsfco;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.BisInspRsfcoRgstr;
  5. import cn.com.goldenwater.dcproj.model.BisInspRsfcoRgstrFcs;
  6. import cn.com.goldenwater.dcproj.param.BisInspRsfcoRgstrFcsParam;
  7. import cn.com.goldenwater.dcproj.service.BisInspRsfcoRgstrFcsService;
  8. import cn.com.goldenwater.dcproj.service.BisInspRsfcoRgstrService;
  9. import cn.com.goldenwater.id.util.UuidUtil;
  10. import com.github.pagehelper.PageInfo;
  11. import io.swagger.annotations.Api;
  12. import io.swagger.annotations.ApiOperation;
  13. import io.swagger.annotations.ApiParam;
  14. import org.apache.commons.lang3.StringUtils;
  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.*;
  19. import java.util.List;
  20. /**
  21. * @author lune
  22. * @date 2021年3月29日
  23. */
  24. @Api(value = "BIS 水库防洪调度监督检查-新管理",tags="BIS 水库防洪调度监督检查-新管理")
  25. @RestController
  26. @RequestMapping("/bis/insp/rsfco/rgstr/fcs")
  27. public class BisInspRsfcoRgstrFcsController extends BaseController {
  28. private Logger logger = LoggerFactory.getLogger(getClass());
  29. @Autowired
  30. private BisInspRsfcoRgstrFcsService bisInspRsfcoRgstrFcsService;
  31. @Autowired
  32. private BisInspRsfcoRgstrService bisInspRsfcoRgstrService;
  33. @ApiOperation(value = "添加/修改水库防洪调度监督检查-新")
  34. @RequestMapping(value = "", method = RequestMethod.POST)
  35. public BaseResponse<BisInspRsfcoRgstrFcs> insert(@ApiParam(name = "bisInspRsfcoRgstrFcs", value = "BisInspRsfcoRgstrFcs", required = true) @RequestBody BisInspRsfcoRgstrFcs bisInspRsfcoRgstrFcs) {
  36. if (StringUtils.isNotBlank(bisInspRsfcoRgstrFcs.getRgstrId())){
  37. BisInspRsfcoRgstr rgstr = bisInspRsfcoRgstrService.get(bisInspRsfcoRgstrFcs.getRgstrId());
  38. if (rgstr != null){
  39. rgstr.setFcsState(bisInspRsfcoRgstrFcs.getStatus());
  40. if (!"2".equals(rgstr.getState())) {
  41. rgstr.setState("1");
  42. if (StringUtils.isNotBlank(bisInspRsfcoRgstrFcs.getStatus())) {
  43. rgstr.setFcsState(
  44. bisInspRsfcoRgstrFcs.getStatus());
  45. }
  46. }
  47. bisInspRsfcoRgstrService.update(rgstr);
  48. }
  49. } else {
  50. return buildFailResponse(new IllegalArgumentException("rgstrId 为必传字段"));
  51. }
  52. if(StringUtils.isBlank(bisInspRsfcoRgstrFcs.getId())) {
  53. // 生成uuid
  54. String uuid = UuidUtil.uuid();
  55. bisInspRsfcoRgstrFcs.setId(uuid);
  56. bisInspRsfcoRgstrFcsService.insert(bisInspRsfcoRgstrFcs);
  57. }else{
  58. bisInspRsfcoRgstrFcsService.update(bisInspRsfcoRgstrFcs);
  59. }
  60. return buildSuccessResponse(bisInspRsfcoRgstrFcs);
  61. }
  62. @ApiOperation(value = "根据ID删除水库防洪调度监督检查-新")
  63. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  64. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  65. int ret = bisInspRsfcoRgstrFcsService.delete(id);
  66. return buildSuccessResponse();
  67. }
  68. @ApiOperation(value = "根据ID获取水库防洪调度监督检查-新(单表)")
  69. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  70. public BaseResponse<BisInspRsfcoRgstrFcs> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  71. BisInspRsfcoRgstrFcs bisInspRsfcoRgstrFcs = bisInspRsfcoRgstrFcsService.getWith(id);
  72. return buildSuccessResponse(bisInspRsfcoRgstrFcs);
  73. }
  74. @ApiOperation(value = "根据ID获取水库防洪调度监督检查-新(单表)")
  75. @RequestMapping(value = "/getBy/{id}", method = RequestMethod.GET)
  76. public BaseResponse<BisInspRsfcoRgstrFcs> getBy(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  77. if(StringUtils.isBlank(id)) {
  78. return buildFailResponse();
  79. }
  80. BisInspRsfcoRgstrFcsParam fcs = new BisInspRsfcoRgstrFcsParam();
  81. fcs.setRgstrId(id);
  82. BisInspRsfcoRgstrFcs bisInspRsfcoRgstrFcs = bisInspRsfcoRgstrFcsService.getBy(fcs);
  83. return buildSuccessResponse(bisInspRsfcoRgstrFcs);
  84. }
  85. @ApiOperation(value = "根据ID获取水库防洪调度监督检查-新(单表)")
  86. @RequestMapping(value = "getWith/{id}", method = RequestMethod.GET)
  87. public BaseResponse<BisInspRsfcoRgstrFcs> getWith(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  88. BisInspRsfcoRgstrFcs bisInspRsfcoRgstrFcs = bisInspRsfcoRgstrFcsService.get(id);
  89. return buildSuccessResponse(bisInspRsfcoRgstrFcs);
  90. }
  91. @ApiOperation(value = "获取水库防洪调度监督检查-新(列表所有)")
  92. @RequestMapping(value = "/list", method = RequestMethod.POST)
  93. public BaseResponse<List<BisInspRsfcoRgstrFcs>> list(@ApiParam(name = "bisInspRsfcoRgstrFcsParam", value = "bisInspRsfcoRgstrFcsParam", required = true) @RequestBody BisInspRsfcoRgstrFcsParam bisInspRsfcoRgstrFcsParam) {
  94. List<BisInspRsfcoRgstrFcs> bisInspRsfcoRgstrFcsList = bisInspRsfcoRgstrFcsService.findList(bisInspRsfcoRgstrFcsParam);
  95. return buildSuccessResponse(bisInspRsfcoRgstrFcsList);
  96. }
  97. @ApiOperation(value = "获取水库防洪调度监督检查-新(列表--分页)")
  98. @RequestMapping(value = "/page", method = RequestMethod.POST)
  99. public BaseResponse<PageInfo<BisInspRsfcoRgstrFcs>> page(@ApiParam(name = "bisInspRsfcoRgstrFcsParam", value = "bisInspRsfcoRgstrFcsParam", required = true) @RequestBody BisInspRsfcoRgstrFcsParam bisInspRsfcoRgstrFcsParam) {
  100. PageInfo<BisInspRsfcoRgstrFcs> bisInspRsfcoRgstrFcsList = bisInspRsfcoRgstrFcsService.findPageInfo(bisInspRsfcoRgstrFcsParam);
  101. return buildSuccessResponse(bisInspRsfcoRgstrFcsList);
  102. }
  103. }