094ae76cb3c7292c8eb0a24a2e593419739f62d7.svn-base 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. package cn.com.goldenwater.dcproj.controller.rsfcoqh;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
  5. import cn.com.goldenwater.dcproj.model.BisInspRsfcoqhRgstr;
  6. import cn.com.goldenwater.dcproj.param.TypeParam;
  7. import cn.com.goldenwater.dcproj.service.BisInspRsfcoqhRgstrService;
  8. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  9. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  10. import cn.com.goldenwater.target.CheckException;
  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.util.Assert;
  20. import org.springframework.web.bind.annotation.*;
  21. /**
  22. * @author lhc
  23. * @date 2021-6-10
  24. */
  25. @Api(value = "青海-水库防洪调度督查登记表管理", tags = "青海-水库防洪调度督查登记表管理")
  26. @RestController
  27. @RequestMapping("/bis/insp/rsfcoqh")
  28. public class BisInspRsfcoqhRgstrController extends BaseController {
  29. private Logger logger = LoggerFactory.getLogger(getClass());
  30. @Autowired
  31. private BisInspRsfcoqhRgstrService bisInspRsfcoqhRgstrService;
  32. @Autowired
  33. private OlBisInspOrgService olBisInspOrgService;
  34. @ApiOperation(value = "添加青海-水库防洪调度督查登记表")
  35. @RequestMapping(value = "", method = RequestMethod.POST)
  36. public BaseResponse<BisInspRsfcoqhRgstr> insert(@ApiParam(name = "bisInspRsfcoqhRgstr", value = "BisInspRsfcoqhRgstr", required = true) @RequestBody BisInspRsfcoqhRgstr bisInspRsfcoqhRgstr) {
  37. if (StringUtils.isNotBlank(bisInspRsfcoqhRgstr.getRgstrId()) &&
  38. StringUtils.isBlank(bisInspRsfcoqhRgstr.getId())) {
  39. // rgstrId 不为 空 时,传给ID
  40. bisInspRsfcoqhRgstr.setId(bisInspRsfcoqhRgstr.getRgstrId());
  41. }
  42. if (StringUtils.isBlank(bisInspRsfcoqhRgstr.getId())) {
  43. throw new CheckException("缺少登记表编码");
  44. }
  45. bisInspRsfcoqhRgstrService.update(bisInspRsfcoqhRgstr);
  46. return buildSuccessResponse(bisInspRsfcoqhRgstr);
  47. }
  48. @ApiOperation(value = "根据ID删除青海-水库防洪调度督查登记表")
  49. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  50. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  51. int ret = bisInspRsfcoqhRgstrService.delete(id);
  52. return buildSuccessResponse();
  53. }
  54. @ApiOperation(value = "更新青海-水库防洪调度督查登记表信息")
  55. @RequestMapping(value = "/update", method = RequestMethod.POST)
  56. public BaseResponse<BisInspRsfcoqhRgstr> update(@ApiParam(name = "bisInspRsfcoqhRgstr", value = "BisInspRsfcoqhRgstr", required = true) @RequestBody BisInspRsfcoqhRgstr bisInspRsfcoqhRgstr) {
  57. Assert.notNull(bisInspRsfcoqhRgstr.getId(), "主键id为必填参数");
  58. int ret = bisInspRsfcoqhRgstrService.update(bisInspRsfcoqhRgstr);
  59. return buildSuccessResponse(bisInspRsfcoqhRgstr);
  60. }
  61. @ApiOperation(value = "根据ID获取青海-水库防洪调度督查登记表(单表)")
  62. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  63. public BaseResponse<BisInspRsfcoqhRgstr> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  64. BisInspRsfcoqhRgstr bisInspRsfcoqhRgstr = bisInspRsfcoqhRgstrService.get(id);
  65. return buildSuccessResponse(bisInspRsfcoqhRgstr);
  66. }
  67. @ApiOperation(value = "获取督查对象")
  68. @RequestMapping(value = "/findPage", method = RequestMethod.POST)
  69. public BaseResponse<PageInfo> page(@ApiParam(name = "typeParam", value = "typeParam", required = true)
  70. @RequestBody TypeParam typeParam) {
  71. typeParam.setpType(BisInspEnum.RSFCOQH.getValue());
  72. typeParam.setPresId(getCurrentPersId());
  73. if (StringUtils.isBlank(typeParam.getAdCode())) {
  74. typeParam.setAdCodes(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId())));
  75. }
  76. return buildSuccessResponse(bisInspRsfcoqhRgstrService.findObjPageByType(typeParam, null));
  77. }
  78. }