f6bff4f177681fc63855d2925dd4c11e376c9c80.svn-base 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package cn.com.goldenwater.dcproj.controller.wiuqh;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.dto.BisInspWiuqhRgstrDto;
  5. import cn.com.goldenwater.dcproj.model.BisInspWiuqhRgstr;
  6. import cn.com.goldenwater.dcproj.param.TypeParam;
  7. import cn.com.goldenwater.dcproj.service.BisInspWiuqhRgstrService;
  8. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  9. import cn.com.goldenwater.target.CheckException;
  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 javax.servlet.http.HttpServletResponse;
  20. /**
  21. * @author lhc
  22. * @date 2021-2-3
  23. */
  24. @Api(value = "青海-取水许可-登记表管理", tags = "青海-取水许可-登记表管理")
  25. @RestController
  26. @RequestMapping("/bis/insp/wiuqh")
  27. public class BisInspWiuqhRgstrController extends BaseController {
  28. private Logger logger = LoggerFactory.getLogger(getClass());
  29. @Autowired
  30. private BisInspWiuqhRgstrService bisInspWiuqhRgstrService;
  31. @Autowired
  32. private OlBisInspOrgService olBisInspOrgService;
  33. @ApiOperation(value = "修改青海-取水许可-登记表")
  34. @RequestMapping(value = "", method = RequestMethod.POST)
  35. public BaseResponse<BisInspWiuqhRgstr> insert(@ApiParam(name = "bisInspWiuqhRgstr", value = "BisInspWiuqhRgstr", required = true)
  36. @RequestBody BisInspWiuqhRgstr bisInspWiuqhRgstr) {
  37. if (StringUtils.isNotBlank(bisInspWiuqhRgstr.getRgstrId()) &&
  38. StringUtils.isBlank(bisInspWiuqhRgstr.getId())) {
  39. // rgstrId 不为 空 时,传给ID
  40. bisInspWiuqhRgstr.setId(bisInspWiuqhRgstr.getRgstrId());
  41. }
  42. if (StringUtils.isBlank(bisInspWiuqhRgstr.getId())) {
  43. throw new CheckException("缺少登记表编码");
  44. }
  45. bisInspWiuqhRgstrService.update(bisInspWiuqhRgstr);
  46. return buildSuccessResponse(bisInspWiuqhRgstr);
  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 = bisInspWiuqhRgstrService.delete(id);
  52. return buildSuccessResponse();
  53. }
  54. @ApiOperation(value = "根据ID获取青海-取水许可-登记表(单表)")
  55. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  56. public BaseResponse<BisInspWiuqhRgstr> get(@ApiParam(name = "id", value = "id", required = true)
  57. @PathVariable String id) {
  58. BisInspWiuqhRgstr bisInspWiuqhRgstr = bisInspWiuqhRgstrService.get(id);
  59. return buildSuccessResponse(bisInspWiuqhRgstr);
  60. }
  61. @ApiOperation(value = "获取督查对象")
  62. @RequestMapping(value = "/findPage", method = RequestMethod.POST)
  63. public BaseResponse<PageInfo<BisInspWiuqhRgstrDto>> findPage(@RequestBody TypeParam param, HttpServletResponse response) {
  64. param.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  65. PageInfo<BisInspWiuqhRgstrDto> pageInfo = bisInspWiuqhRgstrService.listOfPage(param, response);
  66. return buildSuccessResponse(pageInfo);
  67. }
  68. }