f5fb923ac3e2bdc3a949cf891de234ef1deb5459.svn-base 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. package cn.com.goldenwater.dcproj.controller;
  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.AttCountryDto;
  6. import cn.com.goldenwater.dcproj.dto.BisNewDcuserRelVillDto;
  7. import cn.com.goldenwater.dcproj.model.BisInspVill2021Rgstr;
  8. import cn.com.goldenwater.dcproj.param.TypeParam;
  9. import cn.com.goldenwater.dcproj.service.AttAdXBaseService;
  10. import cn.com.goldenwater.dcproj.service.BisInspVill2021RgstrService;
  11. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  12. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  13. import com.github.pagehelper.PageInfo;
  14. import io.swagger.annotations.Api;
  15. import io.swagger.annotations.ApiOperation;
  16. import io.swagger.annotations.ApiParam;
  17. import org.apache.commons.lang3.StringUtils;
  18. import org.slf4j.Logger;
  19. import org.slf4j.LoggerFactory;
  20. import org.springframework.beans.factory.annotation.Autowired;
  21. import org.springframework.web.bind.annotation.*;
  22. import java.util.List;
  23. /**
  24. * @author lhc
  25. * @date 2021-6-16
  26. */
  27. @Api(value = "097 2021农饮登记表管理", tags = "097 2021农饮登记表管理")
  28. @RestController
  29. @RequestMapping("/bis/insp/vill2021")
  30. public class BisInspVill2021RgstrController extends BaseController {
  31. private Logger logger = LoggerFactory.getLogger(getClass());
  32. @Autowired
  33. private BisInspVill2021RgstrService bisInspVill2021RgstrService;
  34. @Autowired
  35. private OlBisInspOrgService olBisInspOrgService;
  36. @Autowired
  37. private AttAdXBaseService attAdXBaseService;
  38. @ApiOperation(value = "修改097 2021农饮登记表")
  39. @RequestMapping(value = "", method = RequestMethod.POST)
  40. public BaseResponse<BisInspVill2021Rgstr> insert(@ApiParam(name = "bisInspVill2021Rgstr", value = "BisInspVill2021Rgstr", required = true) @RequestBody BisInspVill2021Rgstr bisInspVill2021Rgstr) {
  41. bisInspVill2021RgstrService.update(bisInspVill2021Rgstr);
  42. return buildSuccessResponse(bisInspVill2021Rgstr);
  43. }
  44. @ApiOperation(value = "根据ID删除097 2021农饮登记表")
  45. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  46. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  47. int ret = bisInspVill2021RgstrService.delete(id);
  48. return buildSuccessResponse();
  49. }
  50. @ApiOperation(value = "根据ID获取097 2021农饮登记表(单表)")
  51. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  52. public BaseResponse<BisInspVill2021Rgstr> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  53. BisInspVill2021Rgstr bisInspVill2021Rgstr = bisInspVill2021RgstrService.get(id);
  54. return buildSuccessResponse(bisInspVill2021Rgstr);
  55. }
  56. @ApiOperation(value = "列表--分页")
  57. @RequestMapping(value = "/findPage", method = RequestMethod.POST)
  58. public BaseResponse<PageInfo> page(@ApiParam(name = "typeParam", value = "typeParam", required = true)
  59. @RequestBody TypeParam typeParam) {
  60. typeParam.setpType(BisInspEnum.VILL2021.getValue());
  61. typeParam.setPresId(getCurrentPersId());
  62. if (StringUtils.isBlank(typeParam.getAdCode())) {
  63. typeParam.setAdCodes(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId())));
  64. }
  65. return buildSuccessResponse(bisInspVill2021RgstrService.findObjPageByType(typeParam, null));
  66. }
  67. @ApiOperation(value = "获取县-镇(乡)--村用水户和饮水工程列表")
  68. @RequestMapping(value = "/findNode/{code}/{regstrId}", method = RequestMethod.GET)
  69. public BaseResponse findNode(
  70. @ApiParam(name = "code", value = "code", required = true) @PathVariable String code,
  71. @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId) {
  72. return buildSuccessResponse(bisInspVill2021RgstrService.findNode(code, regstrId));
  73. }
  74. @ApiOperation(value = "获取督查中县-镇(乡)--村树节点")
  75. @RequestMapping(value = "/findTree/{code}/{regstrId}", method = RequestMethod.GET)
  76. public BaseResponse<List<BisNewDcuserRelVillDto>> findTree(
  77. @ApiParam(name = "code", value = "code", required = true) @PathVariable String code,
  78. @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId) {
  79. //获取镇,乡
  80. if (code.length() == 12) {
  81. code = code.substring(0, 6);
  82. }
  83. return buildSuccessResponse(attAdXBaseService.findZhenList(code, regstrId, BisInspEnum.VILL2021.getValue()));
  84. }
  85. @ApiOperation(value = "添加行政村县下镇(乡)--村树节点,code为县code")
  86. @RequestMapping(value = "/findCheckTree/{code}/{regstrId}", method = RequestMethod.GET)
  87. public BaseResponse<List<AttCountryDto>> findCheckTree(
  88. @ApiParam(name = "code", value = "code", required = true) @PathVariable String code,
  89. @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId
  90. ) {
  91. if (code.length() == 12) {
  92. code = code.substring(0, 6);
  93. }
  94. return buildSuccessResponse(bisInspVill2021RgstrService.findCheckTree(code, regstrId));
  95. }
  96. }