01bd4483e75466f16213bc09c28805a214a973db.svn-base 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. package cn.com.goldenwater.dcproj.controller.wtgov;
  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.dto.BisInspWtgovRgstrDto;
  6. import cn.com.goldenwater.dcproj.model.BisInspWtgovRgstr;
  7. import cn.com.goldenwater.dcproj.param.TypeParam;
  8. import cn.com.goldenwater.dcproj.service.BisInspWtgovRgstrService;
  9. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  10. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  11. import cn.com.goldenwater.target.CheckException;
  12. import com.github.pagehelper.PageInfo;
  13. import io.swagger.annotations.Api;
  14. import io.swagger.annotations.ApiOperation;
  15. import io.swagger.annotations.ApiParam;
  16. import org.apache.commons.lang3.StringUtils;
  17. import org.slf4j.Logger;
  18. import org.slf4j.LoggerFactory;
  19. import org.springframework.beans.factory.annotation.Autowired;
  20. import org.springframework.web.bind.annotation.*;
  21. import javax.servlet.http.HttpServletResponse;
  22. /**
  23. * @author lhc
  24. * @date 2021-5-11
  25. */
  26. @Api(value = "青海水行政执法管理", tags = "青海水行政执法管理")
  27. @RestController
  28. @RequestMapping("/bis/insp/wtgov")
  29. public class BisInspWtgovRgstrController extends BaseController {
  30. private Logger logger = LoggerFactory.getLogger(getClass());
  31. @Autowired
  32. private BisInspWtgovRgstrService bisInspWtgovRgstrService;
  33. @Autowired
  34. private OlBisInspOrgService olBisInspOrgService;
  35. @ApiOperation(value = "修改青海水行政执法")
  36. @RequestMapping(value = "", method = RequestMethod.POST)
  37. public BaseResponse<BisInspWtgovRgstr> insert(@ApiParam(name = "bisInspWtgovRgstr", value = "BisInspWtgovRgstr", required = true)
  38. @RequestBody BisInspWtgovRgstr bisInspWtgovRgstr) {
  39. if (StringUtils.isNotBlank(bisInspWtgovRgstr.getRgstrId()) &&
  40. StringUtils.isBlank(bisInspWtgovRgstr.getId())) {
  41. // rgstrId 不为 空 时,传给ID
  42. bisInspWtgovRgstr.setId(bisInspWtgovRgstr.getRgstrId());
  43. }
  44. if (StringUtils.isBlank(bisInspWtgovRgstr.getId())) {
  45. throw new CheckException("缺少登记表编码");
  46. }
  47. bisInspWtgovRgstrService.update(bisInspWtgovRgstr);
  48. return buildSuccessResponse(bisInspWtgovRgstr);
  49. }
  50. @ApiOperation(value = "根据ID删除青海水行政执法")
  51. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  52. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  53. int ret = bisInspWtgovRgstrService.delete(id);
  54. return buildSuccessResponse();
  55. }
  56. @ApiOperation(value = "根据ID获取青海水行政执法(单表)")
  57. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  58. public BaseResponse<BisInspWtgovRgstr> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  59. BisInspWtgovRgstr bisInspWtgovRgstr = bisInspWtgovRgstrService.get(id);
  60. return buildSuccessResponse(bisInspWtgovRgstr);
  61. }
  62. @ApiOperation(value = "获取督查对象")
  63. @RequestMapping(value = "/findPage", method = RequestMethod.POST)
  64. public BaseResponse<PageInfo<BisInspWtgovRgstrDto>> findPage(@RequestBody TypeParam param, HttpServletResponse response) {
  65. param.setpType(BisInspEnum.WTGOV.getValue());
  66. param.setPresId(getCurrentPersId());
  67. if (StringUtils.isBlank(param.getAdCode())) {
  68. param.setAdCodes(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId())));
  69. }
  70. PageInfo<BisInspWtgovRgstrDto> pageInfo = bisInspWtgovRgstrService.findObjPageByType(param, response);
  71. return buildSuccessResponse(pageInfo);
  72. }
  73. }