0ca02f542553ed7d20b0c5fca4f9eb3ec5640fdf.svn-base 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. package cn.com.goldenwater.dcproj.controller.vill;
  2. import cn.com.goldenwater.dcproj.dto.BisInspSecsurveyVlgDcdxDto;
  3. import cn.com.goldenwater.dcproj.dto.BisInspSecsurveyVlgDto;
  4. import cn.com.goldenwater.dcproj.dto.VillRgstrDto;
  5. import cn.com.goldenwater.dcproj.model.BisInspSecsurveyVlg;
  6. import cn.com.goldenwater.dcproj.param.BisInspSecsurveyVlgParam;
  7. import cn.com.goldenwater.dcproj.param.GetVillPageByNodeIdParam;
  8. import cn.com.goldenwater.dcproj.service.BisInspSecsurveyVlgService;
  9. import cn.com.goldenwater.core.web.BaseController;
  10. import cn.com.goldenwater.core.web.BaseResponse;
  11. import cn.com.goldenwater.dcproj.target.VerifyBean;
  12. import com.alibaba.fastjson.JSONObject;
  13. import io.swagger.annotations.Api;
  14. import io.swagger.annotations.ApiOperation;
  15. import io.swagger.annotations.ApiParam;
  16. import com.github.pagehelper.PageInfo;
  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.PathVariable;
  21. import org.springframework.web.bind.annotation.RequestBody;
  22. import org.springframework.web.bind.annotation.RequestMapping;
  23. import org.springframework.web.bind.annotation.RequestMethod;
  24. import org.springframework.web.bind.annotation.RestController;
  25. import java.util.ArrayList;
  26. import java.util.List;
  27. /**
  28. * @author zhengdafei
  29. * @date 2019-2-19
  30. */
  31. @Api(value = "", tags = "农村暗访调研行政村登记")
  32. @RestController
  33. @RequestMapping("/dc/insp/secsurveyVlg")
  34. public class BisInspSecsurveyVlgController extends BaseController {
  35. private Logger logger = LoggerFactory.getLogger(getClass());
  36. @Autowired
  37. private BisInspSecsurveyVlgService bisInspSecsurveyVlgService;
  38. @ApiOperation(value = "添加")
  39. @RequestMapping(value = "/insert", method = RequestMethod.POST)
  40. public BaseResponse<JSONObject> insert(@ApiParam(name = "bisInspSecsurveyVlg", value = "BisInspSecsurveyVlg", required = true) @RequestBody BisInspSecsurveyVlg bisInspSecsurveyVlg) {
  41. String uuid = "";
  42. JSONObject json = new JSONObject();
  43. try {
  44. uuid = bisInspSecsurveyVlgService.add(bisInspSecsurveyVlg);
  45. json.put("id", uuid);
  46. } catch (Exception e) {
  47. e.printStackTrace();
  48. logger.error(e.getMessage());
  49. return buildFailResponse(e.getMessage());
  50. }
  51. return buildSuccessResponse(json);
  52. }
  53. @ApiOperation(value = "根据ID删除")
  54. @RequestMapping(value = "/{id}", method = RequestMethod.POST)
  55. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  56. int ret = bisInspSecsurveyVlgService.delete(id);
  57. JSONObject json = new JSONObject();
  58. json.put("id", id);
  59. return buildSuccessResponse(json);
  60. }
  61. @ApiOperation(value = "更新信息")
  62. @RequestMapping(value = "/update", method = RequestMethod.POST)
  63. public BaseResponse update(@ApiParam(name = "bisInspSecsurveyVlg", value = "BisInspSecsurveyVlg", required = true) @RequestBody BisInspSecsurveyVlg bisInspSecsurveyVlg) {
  64. int ret = 0;
  65. try {
  66. ret = bisInspSecsurveyVlgService.modify(bisInspSecsurveyVlg);
  67. } catch (Exception e) {
  68. e.printStackTrace();
  69. logger.error(e.getMessage());
  70. return buildFailResponse(e.getMessage());
  71. }
  72. return buildSuccessResponse(bisInspSecsurveyVlg);
  73. }
  74. @ApiOperation(value = "根据ID获取(单表)")
  75. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  76. public BaseResponse<BisInspSecsurveyVlg> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  77. BisInspSecsurveyVlg bisInspSecsurveyVlg = bisInspSecsurveyVlgService.get(id);
  78. if (bisInspSecsurveyVlg == null) {
  79. bisInspSecsurveyVlg = new BisInspSecsurveyVlg();
  80. }
  81. return buildSuccessResponse(bisInspSecsurveyVlg);
  82. }
  83. @ApiOperation(value = "获取列表(分页)")
  84. @RequestMapping(value = "/queryListByPage", method = {RequestMethod.GET, RequestMethod.POST})
  85. public BaseResponse<PageInfo<BisInspSecsurveyVlg>> queryListByPage(@RequestBody BisInspSecsurveyVlgParam param) {
  86. PageInfo<BisInspSecsurveyVlg> list = new PageInfo<>();
  87. try {
  88. list = bisInspSecsurveyVlgService.queryListByPage(param);
  89. } catch (Exception e) {
  90. e.printStackTrace();
  91. logger.error(e.getMessage());
  92. return buildFailResponse(e.getMessage());
  93. }
  94. return buildSuccessResponse(list);
  95. }
  96. @ApiOperation(value = "获取列表")
  97. @RequestMapping(value = "/queryList", method = {RequestMethod.GET, RequestMethod.POST})
  98. public BaseResponse<List<BisInspSecsurveyVlg>> queryList(@RequestBody BisInspSecsurveyVlgParam param) {
  99. List<BisInspSecsurveyVlg> list = new ArrayList<>();
  100. try {
  101. list = bisInspSecsurveyVlgService.queryList(param);
  102. } catch (Exception e) {
  103. e.printStackTrace();
  104. logger.error(e.getMessage());
  105. return buildFailResponse(e.getMessage());
  106. }
  107. return buildSuccessResponse(list);
  108. }
  109. @ApiOperation(value = "获取单个村(带状态)")
  110. @RequestMapping(value = "/getBy", method = {RequestMethod.GET, RequestMethod.POST})
  111. public BaseResponse<BisInspSecsurveyVlgDto> getBy(@RequestBody BisInspSecsurveyVlgParam param) {
  112. BisInspSecsurveyVlgDto list = new BisInspSecsurveyVlgDto();
  113. try {
  114. list = bisInspSecsurveyVlgService.getOne(param);
  115. } catch (Exception e) {
  116. e.printStackTrace();
  117. logger.error(e.getMessage());
  118. return buildFailResponse(e.getMessage());
  119. }
  120. return buildSuccessResponse(list);
  121. }
  122. @ApiOperation(value = "获取单个最新村(带状态)")
  123. @RequestMapping(value = "/getNearBy", method = RequestMethod.POST)
  124. public BaseResponse<BisInspSecsurveyVlgDto> getNearBy(@RequestBody BisInspSecsurveyVlgParam param) {
  125. BisInspSecsurveyVlgDto list = new BisInspSecsurveyVlgDto();
  126. try {
  127. list = bisInspSecsurveyVlgService.getNearOne(param);
  128. } catch (Exception e) {
  129. e.printStackTrace();
  130. logger.error(e.getMessage());
  131. return buildFailResponse(e.getMessage());
  132. }
  133. return buildSuccessResponse(list);
  134. }
  135. @ApiOperation(value = "根据行政区划编码和人员id获取列表(不分页)")
  136. @RequestMapping(value = "/getListByCodeAndPerId", method = RequestMethod.POST)
  137. public BaseResponse<List<BisInspSecsurveyVlg>> getListByCodeAndPerId(@RequestBody VillRgstrDto villRgstrDto) {
  138. List<BisInspSecsurveyVlg> list = new ArrayList<>();
  139. try {
  140. list = bisInspSecsurveyVlgService.getListByCodeAndPerId(villRgstrDto);
  141. } catch (Exception e) {
  142. e.printStackTrace();
  143. logger.error(e.getMessage());
  144. return buildFailResponse(e.getMessage());
  145. }
  146. return buildSuccessResponse(list);
  147. }
  148. @ApiOperation(value = "根据行政区划编码和人员id获取列表(分页)")
  149. @RequestMapping(value = "/getPageByCodeAndPerId", method = RequestMethod.POST)
  150. public BaseResponse<PageInfo<BisInspSecsurveyVlg>> getPageByCodeAndPerId(@RequestBody VillRgstrDto villRgstrDto) {
  151. try {
  152. PageInfo<BisInspSecsurveyVlg> list = bisInspSecsurveyVlgService.getPageByCodeAndPerId(villRgstrDto);
  153. return buildSuccessResponse(list);
  154. } catch (Exception e) {
  155. e.printStackTrace();
  156. logger.error(e.getMessage());
  157. return buildFailResponse(e.getMessage());
  158. }
  159. }
  160. @VerifyBean
  161. @ApiOperation(value = "根据节点id以及其他条件获取列表(分页)")
  162. @RequestMapping(value = "/getPageByNodeId", method = RequestMethod.POST)
  163. public BaseResponse<PageInfo<BisInspSecsurveyVlgDcdxDto>> getPageByNodeId(@RequestBody GetVillPageByNodeIdParam p) throws Exception {
  164. PageInfo<BisInspSecsurveyVlgDcdxDto> list = bisInspSecsurveyVlgService.getPageByNodeId(p);
  165. return buildSuccessResponse(list);
  166. }
  167. }