e2c86092a823b87eabc0d4be5a7106bd419ac308.svn-base 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. package cn.com.goldenwater.dcproj.controller.svwtqh;
  2. import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
  3. import cn.com.goldenwater.dcproj.dto.BisInspSvwtqhDto;
  4. import cn.com.goldenwater.dcproj.model.BisInspSvwtqh;
  5. import cn.com.goldenwater.dcproj.param.BisInspSvwtqhParam;
  6. import cn.com.goldenwater.dcproj.param.TypeParam;
  7. import cn.com.goldenwater.dcproj.service.BisInspSvwtqhService;
  8. import cn.com.goldenwater.core.web.BaseController;
  9. import cn.com.goldenwater.core.web.BaseResponse;
  10. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  11. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  12. import cn.com.goldenwater.id.util.UuidUtil;
  13. import cn.com.goldenwater.target.CheckException;
  14. import com.github.pagehelper.PageInfo;
  15. import io.swagger.annotations.Api;
  16. import io.swagger.annotations.ApiOperation;
  17. import io.swagger.annotations.ApiParam;
  18. import org.slf4j.Logger;
  19. import org.slf4j.LoggerFactory;
  20. import org.apache.commons.lang3.StringUtils;
  21. import org.springframework.beans.factory.annotation.Autowired;
  22. import org.springframework.util.Assert;
  23. import org.springframework.web.bind.annotation.PathVariable;
  24. import org.springframework.web.bind.annotation.RequestBody;
  25. import org.springframework.web.bind.annotation.RequestMapping;
  26. import org.springframework.web.bind.annotation.RequestMethod;
  27. import org.springframework.web.bind.annotation.RequestParam;
  28. import org.springframework.web.bind.annotation.RestController;
  29. import javax.servlet.http.HttpServletResponse;
  30. import java.util.List;
  31. /**
  32. * @author lhc
  33. * @date 2021-6-23
  34. */
  35. @Api(value = "青海-县域节水型社会达标建设监督管理",tags="青海-县域节水型社会达标建设监督管理")
  36. @RestController
  37. @RequestMapping("/bis/insp/svwtqh")
  38. public class BisInspSvwtqhController extends BaseController {
  39. private Logger logger = LoggerFactory.getLogger(getClass());
  40. @Autowired
  41. private BisInspSvwtqhService bisInspSvwtqhService;
  42. @Autowired
  43. private OlBisInspOrgService olBisInspOrgService;
  44. @ApiOperation(value = "修改青海-县域节水型社会达标建设监督")
  45. @RequestMapping(value = "", method = RequestMethod.POST)
  46. public BaseResponse<BisInspSvwtqh> insert(@ApiParam(name = "bisInspSvwtqh", value = "BisInspSvwtqh", required = true) @RequestBody BisInspSvwtqh bisInspSvwtqh) {
  47. if(StringUtils.isNotBlank(bisInspSvwtqh.getRgstrId())&&StringUtils.isBlank(bisInspSvwtqh.getId())){
  48. bisInspSvwtqh.setId(bisInspSvwtqh.getRgstrId());
  49. }
  50. if(StringUtils.isBlank(bisInspSvwtqh.getId())){
  51. throw new CheckException("缺少登记表编码");
  52. }
  53. bisInspSvwtqhService.update(bisInspSvwtqh);
  54. return buildSuccessResponse(bisInspSvwtqh);
  55. }
  56. @ApiOperation(value = "根据ID删除青海-县域节水型社会达标建设监督")
  57. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  58. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  59. int ret = bisInspSvwtqhService.delete(id);
  60. return buildSuccessResponse();
  61. }
  62. @ApiOperation(value = "根据ID获取青海-县域节水型社会达标建设监督(单表)")
  63. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  64. public BaseResponse<BisInspSvwtqh> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  65. BisInspSvwtqh bisInspSvwtqh = bisInspSvwtqhService.get(id);
  66. return buildSuccessResponse(bisInspSvwtqh);
  67. }
  68. @ApiOperation(value = "获取督查对象")
  69. @RequestMapping(value = "/findPage", method = RequestMethod.POST)
  70. public BaseResponse<PageInfo<BisInspSvwtqhDto>>findPage(@RequestBody TypeParam param, HttpServletResponse response) {
  71. param.setProvince(olBisInspOrgService.getProvince(getCurrentOrgId()));
  72. param.setpType(BisInspEnum.WTGOV.getValue());
  73. param.setPresId(getCurrentPersId());
  74. if (StringUtils.isBlank(param.getAdCode())) {
  75. param.setAdCodes(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId())));
  76. }
  77. PageInfo<BisInspSvwtqhDto> pageInfo = bisInspSvwtqhService.findObjPageByType(param, response);
  78. return buildSuccessResponse(pageInfo);
  79. }
  80. }