877ae8917a295ee624c0a41c36568e84e250a6b7.svn-base 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. package cn.com.goldenwater.dcproj.controller.villgd;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.dto.BisInspVillgdVillDto;
  5. import cn.com.goldenwater.dcproj.model.BisInspVillgd;
  6. import cn.com.goldenwater.dcproj.model.BisInspVillgdVillWtsp;
  7. import cn.com.goldenwater.dcproj.param.TypeParam;
  8. import cn.com.goldenwater.dcproj.service.BisInspVillgdService;
  9. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  10. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  11. import cn.com.goldenwater.dcproj.utils.DateUtils;
  12. import cn.com.goldenwater.target.CheckException;
  13. import cn.com.goldenwater.util.common.SqlUtils;
  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-4-23
  27. */
  28. @Api(value = "xxx管理", tags = "xxx管理")
  29. @RestController
  30. @RequestMapping("/bis/insp/villgd")
  31. public class BisInspVillgdController extends BaseController {
  32. private Logger logger = LoggerFactory.getLogger(getClass());
  33. @Autowired
  34. private BisInspVillgdService bisInspVillgdService;
  35. @Autowired
  36. private OlBisInspOrgService olBisInspOrgService;
  37. @ApiOperation(value = "修改xxx")
  38. @RequestMapping(value = "", method = RequestMethod.POST)
  39. public BaseResponse<BisInspVillgd> insert(@ApiParam(name = "bisInspVillgd", value = "BisInspVillgd", required = true) @RequestBody BisInspVillgd bisInspVillgd) {
  40. if (StringUtils.isBlank(bisInspVillgd.getId()) ||
  41. StringUtils.isNotBlank(bisInspVillgd.getRgstrId())) {
  42. // rgstrId 不为 空 时,传给ID
  43. bisInspVillgd.setId(bisInspVillgd.getRgstrId());
  44. }
  45. if (StringUtils.isBlank(bisInspVillgd.getId())) {
  46. throw new CheckException("缺少登记表编码!");
  47. }
  48. bisInspVillgdService.update(bisInspVillgd);
  49. return buildSuccessResponse(bisInspVillgd);
  50. }
  51. @ApiOperation(value = "根据ID删除xxx")
  52. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  53. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  54. int ret = bisInspVillgdService.delete(id);
  55. return buildSuccessResponse();
  56. }
  57. @ApiOperation(value = "根据ID获取xxx(单表)")
  58. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  59. public BaseResponse<BisInspVillgd> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  60. BisInspVillgd bisInspVillgd = bisInspVillgdService.get(id);
  61. return buildSuccessResponse(bisInspVillgd);
  62. }
  63. @ApiOperation(value = "根据ID获取xxx(单表)")
  64. @RequestMapping(value = "getVillTree/{id}", method = RequestMethod.GET)
  65. public BaseResponse<List<BisInspVillgdVillDto>> getVillTree(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  66. return buildSuccessResponse(bisInspVillgdService.getVillTree(id));
  67. }
  68. @ApiOperation(value = "获取县-镇(乡)--村用水户和饮水工程列表")
  69. @RequestMapping(value = "/findNode/{villId}/{regstrId}", method = RequestMethod.GET)
  70. public BaseResponse findNode(
  71. @ApiParam(name = "villId", value = "villId", required = true) @PathVariable String villId,
  72. @ApiParam(name = "regstrId", value = "regstrId", required = true) @PathVariable String regstrId) {
  73. return buildSuccessResponse(bisInspVillgdService.findNode(villId, regstrId));
  74. }
  75. @ApiOperation(value = "根据ID获取xxx(单表)")
  76. @RequestMapping(value = "/findPage", method = RequestMethod.POST)
  77. public BaseResponse<PageInfo> listOfPage(@RequestBody TypeParam typeParam) {
  78. typeParam.setPresId(getCurrentPersId());
  79. typeParam.setOrgId(getCurrentOrgId());
  80. typeParam.setNowTime(DateUtils.getToday("yyyy-MM-dd"));
  81. typeParam.setInIdsSql(SqlUtils.getinIdsSql(typeParam.getPresId(), typeParam.getProvince()));
  82. if (!org.apache.commons.lang.StringUtils.isBlank(typeParam.getAdCodes())) {
  83. typeParam.setAdCodes(AdLevelUtil.getListAddvcd(typeParam.getAdCodes()));
  84. } else {
  85. typeParam.setAdCodes(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId())));
  86. }
  87. return buildSuccessResponse(bisInspVillgdService.findObjPageByType(typeParam, null));
  88. }
  89. }