02406ca8ca1be7cbb2456dfab0bc50ccaa705486.svn-base 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. package cn.com.goldenwater.dcproj.controller.waga;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.BisInspWagaSafeManage;
  5. import cn.com.goldenwater.dcproj.param.BisInspWagaSafeManageParam;
  6. import cn.com.goldenwater.dcproj.service.AttWagaRgstrService;
  7. import cn.com.goldenwater.dcproj.service.BisInspWagaSafeManageService;
  8. import cn.com.goldenwater.id.util.UuidUtil;
  9. import io.swagger.annotations.Api;
  10. import io.swagger.annotations.ApiOperation;
  11. import io.swagger.annotations.ApiParam;
  12. import org.apache.commons.lang3.StringUtils;
  13. import org.slf4j.Logger;
  14. import org.slf4j.LoggerFactory;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.util.Assert;
  17. import org.springframework.web.bind.annotation.*;
  18. import java.util.Date;
  19. /**
  20. * @author lune
  21. * @date 2019-4-22
  22. */
  23. @Api(value = "WAGA 水闸督查安全管理情况管理", tags = "WAGA 水闸督查安全管理情况管理")
  24. @RestController
  25. @RequestMapping("/bis/waga/safeManage")
  26. public class BisInspWagaSafeManageController extends BaseController {
  27. private Logger logger = LoggerFactory.getLogger(getClass());
  28. @Autowired
  29. private BisInspWagaSafeManageService bisInspWagaSafeManageService;
  30. @Autowired
  31. private AttWagaRgstrService attWagaRgstrService;
  32. @ApiOperation(value = "添加水闸督查安全管理情况")
  33. @RequestMapping(value = "", method = RequestMethod.POST)
  34. public BaseResponse<BisInspWagaSafeManage> insert(@ApiParam(name = "bisInspWagaSafeManage", value = "BisInspWagaSafeManage", required = true) @RequestBody BisInspWagaSafeManage bisInspWagaSafeManage) {
  35. Date date=new Date();
  36. if (StringUtils.isBlank(bisInspWagaSafeManage.getId())) {
  37. String uuid = UuidUtil.uuid();
  38. bisInspWagaSafeManage.setId(uuid);
  39. bisInspWagaSafeManage.setIntm(date);
  40. bisInspWagaSafeManage.setUptm(date);
  41. bisInspWagaSafeManageService.insert(bisInspWagaSafeManage);
  42. } else {
  43. bisInspWagaSafeManage.setUptm(date);
  44. bisInspWagaSafeManageService.update(bisInspWagaSafeManage);
  45. }
  46. attWagaRgstrService.addState(bisInspWagaSafeManage.getRgstrId(), bisInspWagaSafeManage.getDataStat(), "safe");
  47. return buildSuccessResponse(bisInspWagaSafeManage);
  48. }
  49. @ApiOperation(value = "根据ID删除水闸督查安全管理情况")
  50. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  51. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  52. bisInspWagaSafeManageService.delete(id);
  53. return buildSuccessResponse();
  54. }
  55. @ApiOperation(value = "更新水闸督查安全管理情况信息")
  56. @RequestMapping(value = "/update", method = RequestMethod.POST)
  57. public BaseResponse<BisInspWagaSafeManage> update(@ApiParam(name = "bisInspWagaSafeManage", value = "BisInspWagaSafeManage", required = true) @RequestBody BisInspWagaSafeManage bisInspWagaSafeManage) {
  58. Assert.notNull(bisInspWagaSafeManage.getId(), "主键id为必填参数");
  59. bisInspWagaSafeManageService.update(bisInspWagaSafeManage);
  60. return buildSuccessResponse(bisInspWagaSafeManage);
  61. }
  62. @ApiOperation(value = "根据ID获取水闸督查安全管理情况(单表)")
  63. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  64. public BaseResponse<BisInspWagaSafeManage> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  65. BisInspWagaSafeManage bisInspWagaSafeManage = bisInspWagaSafeManageService.get(id);
  66. return buildSuccessResponse(bisInspWagaSafeManage);
  67. }
  68. @ApiOperation(value = "根据督查表rgstrId获取水闸督查安全管理情况(单表)")
  69. @RequestMapping(value = "/getBy/{rgstrId}", method = RequestMethod.GET)
  70. public BaseResponse<BisInspWagaSafeManage> getBy(@ApiParam(name = "rgstrId", value = "rgstrId", required = true) @PathVariable String rgstrId) {
  71. BisInspWagaSafeManageParam wagaProenInfoParam = new BisInspWagaSafeManageParam();
  72. wagaProenInfoParam.setRgstrId(rgstrId);
  73. BisInspWagaSafeManage bisInspWagaProenInfo = bisInspWagaSafeManageService.getBy(wagaProenInfoParam);
  74. return buildSuccessResponse(bisInspWagaProenInfo);
  75. }
  76. }