91c572dde08dcdf5e584f34488d97bb22ca2b772.svn-base 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. package cn.com.goldenwater.dcproj.controller.villqh;
  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.BisInspVillqhRgstr;
  8. import cn.com.goldenwater.dcproj.param.TypeParam;
  9. import cn.com.goldenwater.dcproj.service.AttAdXBaseService;
  10. import cn.com.goldenwater.dcproj.service.BisInspVillqhRgstrService;
  11. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  12. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  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.apache.commons.lang3.StringUtils;
  19. import org.slf4j.Logger;
  20. import org.slf4j.LoggerFactory;
  21. import org.springframework.beans.factory.annotation.Autowired;
  22. import org.springframework.web.bind.annotation.*;
  23. import java.util.List;
  24. /**
  25. * @author lhc
  26. * @date 2021-2-1
  27. */
  28. @Api(value = "农饮(青海)-登记表管理", tags = "农饮(青海)-登记表管理")
  29. @RestController
  30. @RequestMapping("/bis/insp/villqh")
  31. public class BisInspVillqhRgstrController extends BaseController {
  32. private Logger logger = LoggerFactory.getLogger(getClass());
  33. @Autowired
  34. private BisInspVillqhRgstrService bisInspVillqhRgstrService;
  35. @Autowired
  36. private AttAdXBaseService attAdXBaseService;
  37. @Autowired
  38. private OlBisInspOrgService olBisInspOrgService;
  39. @ApiOperation(value = "修改农饮(青海)-登记表")
  40. @RequestMapping(value = "", method = RequestMethod.POST)
  41. public BaseResponse insert(@ApiParam(name = "bisInspVillqhRgstr", value = "BisInspVillqhRgstr", required = true)
  42. @RequestBody BisInspVillqhRgstr bisInspVillqhRgstr) {
  43. if (StringUtils.isNotBlank(bisInspVillqhRgstr.getRgstrId()) &&
  44. StringUtils.isBlank(bisInspVillqhRgstr.getId())) {
  45. // rgstrId 不为 空 时,传给ID
  46. bisInspVillqhRgstr.setId(bisInspVillqhRgstr.getRgstrId());
  47. }
  48. if (StringUtils.isNotBlank(bisInspVillqhRgstr.getId())) {
  49. bisInspVillqhRgstrService.update(bisInspVillqhRgstr);
  50. return buildSuccessResponse(bisInspVillqhRgstr);
  51. }
  52. throw new CheckException("缺少登记表编码");
  53. }
  54. @ApiOperation(value = "根据ID删除农饮(青海)-登记表")
  55. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  56. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  57. int ret = bisInspVillqhRgstrService.delete(id);
  58. return buildSuccessResponse();
  59. }
  60. @ApiOperation(value = "根据ID获取农饮(青海)-登记表(单表)")
  61. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  62. public BaseResponse<BisInspVillqhRgstr> get(@ApiParam(name = "id", value = "id", required = true)
  63. @PathVariable String id) {
  64. BisInspVillqhRgstr bisInspVillqhRgstr = bisInspVillqhRgstrService.get(id);
  65. return buildSuccessResponse(bisInspVillqhRgstr);
  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.VILLQH.getValue());
  72. typeParam.setPresId(getCurrentPersId());
  73. if (StringUtils.isBlank(typeParam.getAdCode())) {
  74. typeParam.setAdCodes(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId())));
  75. }
  76. return buildSuccessResponse(bisInspVillqhRgstrService.findObjPageByType(typeParam, null));
  77. }
  78. @ApiOperation(value = "获取县-镇(乡)--村用水户和饮水工程列表")
  79. @RequestMapping(value = "/findNode/{code}/{regstrId}", method = RequestMethod.GET)
  80. public BaseResponse findNode(
  81. @ApiParam(name = "code", value = "code", required = true) @PathVariable String code,
  82. @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId) {
  83. return buildSuccessResponse(bisInspVillqhRgstrService.findNode(code, regstrId));
  84. }
  85. @ApiOperation(value = "获取督查中县-镇(乡)--村树节点")
  86. @RequestMapping(value = "/findTree/{code}/{regstrId}", method = RequestMethod.GET)
  87. public BaseResponse<List<BisNewDcuserRelVillDto>> findTree(
  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(attAdXBaseService.findZhenList(code, regstrId, BisInspEnum.VILLQH.getValue()));
  95. }
  96. @ApiOperation(value = "添加行政村县下镇(乡)--村树节点,code为县code")
  97. @RequestMapping(value = "/findCheckTree/{code}/{regstrId}", method = RequestMethod.GET)
  98. public BaseResponse<List<AttCountryDto>> findCheckTree(
  99. @ApiParam(name = "code", value = "code", required = true) @PathVariable String code,
  100. @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId
  101. ) {
  102. if (code.length() == 12) {
  103. code = code.substring(0, 6);
  104. }
  105. return buildSuccessResponse(bisInspVillqhRgstrService.findCheckTree(code, regstrId));
  106. }
  107. }