b828ab89b4891304095e005b9b95a691e7ece374.svn-base 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. package cn.com.goldenwater.dcproj.controller.vill;
  2. import cn.com.goldenwater.dcproj.dto.BisInspVlgdrinkFacOperDcdxDto;
  3. import cn.com.goldenwater.dcproj.dto.VillRgstrDto;
  4. import cn.com.goldenwater.dcproj.model.BisInspVlgdrinkFacOper;
  5. import cn.com.goldenwater.dcproj.param.BisInspVlgdrinkFacOperParam;
  6. import cn.com.goldenwater.dcproj.param.GetVillPageByNodeIdParam;
  7. import cn.com.goldenwater.dcproj.service.BisInspVlgdrinkFacOperService;
  8. import cn.com.goldenwater.core.web.BaseController;
  9. import cn.com.goldenwater.core.web.BaseResponse;
  10. import cn.com.goldenwater.dcproj.target.VerifyBean;
  11. import com.alibaba.fastjson.JSONObject;
  12. import io.swagger.annotations.Api;
  13. import io.swagger.annotations.ApiOperation;
  14. import io.swagger.annotations.ApiParam;
  15. import com.github.pagehelper.PageInfo;
  16. import org.slf4j.Logger;
  17. import org.slf4j.LoggerFactory;
  18. import org.springframework.beans.factory.annotation.Autowired;
  19. import org.springframework.web.bind.annotation.PathVariable;
  20. import org.springframework.web.bind.annotation.RequestBody;
  21. import org.springframework.web.bind.annotation.RequestMapping;
  22. import org.springframework.web.bind.annotation.RequestMethod;
  23. import org.springframework.web.bind.annotation.RestController;
  24. import java.util.ArrayList;
  25. import java.util.List;
  26. /**
  27. * @author zhengdafei
  28. * @date 2019-2-19
  29. */
  30. @Api(value = "", tags = "农村饮水工程设施运行维护情况")
  31. @RestController
  32. @RequestMapping("/dc/insp/VlgdrinkFacOper")
  33. public class BisInspVlgdrinkFacOperController extends BaseController {
  34. private Logger logger = LoggerFactory.getLogger(getClass());
  35. @Autowired
  36. private BisInspVlgdrinkFacOperService bisInspVlgdrinkFacOperService;
  37. @ApiOperation(value = "添加")
  38. @RequestMapping(value = "/insert", method = RequestMethod.POST)
  39. public BaseResponse<JSONObject> insert(@ApiParam(name = "bisInspVlgdrinkFacOper", value = "BisInspVlgdrinkFacOper", required = true) @RequestBody BisInspVlgdrinkFacOper bisInspVlgdrinkFacOper) {
  40. String uuid = "";
  41. JSONObject json = new JSONObject();
  42. try {
  43. uuid = bisInspVlgdrinkFacOperService.add(bisInspVlgdrinkFacOper);
  44. json.put("id", uuid);
  45. } catch (Exception e) {
  46. e.printStackTrace();
  47. logger.error(e.getMessage());
  48. return buildFailResponse(e.getMessage());
  49. }
  50. return buildSuccessResponse(json);
  51. }
  52. @ApiOperation(value = "根据ID删除")
  53. @RequestMapping(value = "/{id}", method = RequestMethod.POST)
  54. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  55. int ret = bisInspVlgdrinkFacOperService.delete(id);
  56. JSONObject json = new JSONObject();
  57. json.put("id", id);
  58. return buildSuccessResponse(json);
  59. }
  60. @ApiOperation(value = "更新信息")
  61. @RequestMapping(value = "/update", method = RequestMethod.POST)
  62. public BaseResponse update(@ApiParam(name = "bisInspVlgdrinkFacOper", value = "BisInspVlgdrinkFacOper", required = true) @RequestBody BisInspVlgdrinkFacOper bisInspVlgdrinkFacOper) {
  63. int ret = 0;
  64. try {
  65. ret = bisInspVlgdrinkFacOperService.modify(bisInspVlgdrinkFacOper);
  66. } catch (Exception e) {
  67. e.printStackTrace();
  68. logger.error(e.getMessage());
  69. return buildFailResponse(e.getMessage());
  70. }
  71. return buildSuccessResponse(bisInspVlgdrinkFacOper);
  72. }
  73. @ApiOperation(value = "根据ID获取(单表)")
  74. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  75. public BaseResponse<BisInspVlgdrinkFacOper> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  76. BisInspVlgdrinkFacOper bisInspVlgdrinkFacOper = bisInspVlgdrinkFacOperService.get(id);
  77. if (bisInspVlgdrinkFacOper == null) {
  78. bisInspVlgdrinkFacOper = new BisInspVlgdrinkFacOper();
  79. }
  80. return buildSuccessResponse(bisInspVlgdrinkFacOper);
  81. }
  82. @ApiOperation(value = "根据参数获取(engId,adCode)")
  83. @RequestMapping(value = "/getBy", method = RequestMethod.POST)
  84. public BaseResponse<BisInspVlgdrinkFacOper> getBy(@RequestBody BisInspVlgdrinkFacOperParam param) {
  85. List<BisInspVlgdrinkFacOper> list = bisInspVlgdrinkFacOperService.findList(param);
  86. BisInspVlgdrinkFacOper bisInspVlgdrinkFacOper = new BisInspVlgdrinkFacOper();
  87. if (list != null && !list.isEmpty()) {
  88. bisInspVlgdrinkFacOper = list.get(0);
  89. }
  90. return buildSuccessResponse(bisInspVlgdrinkFacOper);
  91. }
  92. @ApiOperation(value = "获取列表(分页)")
  93. @RequestMapping(value = "/queryListByPage", method = {RequestMethod.GET, RequestMethod.POST})
  94. public BaseResponse<PageInfo<BisInspVlgdrinkFacOper>> queryListByPage(@RequestBody BisInspVlgdrinkFacOperParam param) {
  95. PageInfo<BisInspVlgdrinkFacOper> list = new PageInfo<>();
  96. try {
  97. list = bisInspVlgdrinkFacOperService.queryListByPage(param);
  98. } catch (Exception e) {
  99. e.printStackTrace();
  100. logger.error(e.getMessage());
  101. return buildFailResponse(e.getMessage());
  102. }
  103. return buildSuccessResponse(list);
  104. }
  105. @ApiOperation(value = "获取列表")
  106. @RequestMapping(value = "/queryList", method = {RequestMethod.GET, RequestMethod.POST})
  107. public BaseResponse<List<BisInspVlgdrinkFacOper>> queryList(@RequestBody BisInspVlgdrinkFacOperParam param) {
  108. List<BisInspVlgdrinkFacOper> list = new ArrayList<>();
  109. try {
  110. list = bisInspVlgdrinkFacOperService.queryList(param);
  111. } catch (Exception e) {
  112. e.printStackTrace();
  113. logger.error(e.getMessage());
  114. return buildFailResponse(e.getMessage());
  115. }
  116. return buildSuccessResponse(list);
  117. }
  118. @ApiOperation(value = "根据行政区划编码和人员id获取列表(不分页)")
  119. @RequestMapping(value = "/getListByCodeAndPerId", method = RequestMethod.POST)
  120. public BaseResponse<List<BisInspVlgdrinkFacOper>> getListByCodeAndPerId(@RequestBody VillRgstrDto villRgstrDto) {
  121. List<BisInspVlgdrinkFacOper> list = new ArrayList<>();
  122. try {
  123. list = bisInspVlgdrinkFacOperService.getListByCodeAndPerId(villRgstrDto);
  124. } catch (Exception e) {
  125. e.printStackTrace();
  126. logger.error(e.getMessage());
  127. return buildFailResponse(e.getMessage());
  128. }
  129. return buildSuccessResponse(list);
  130. }
  131. @ApiOperation(value = "根据行政区划编码和人员id获取列表(分页)")
  132. @RequestMapping(value = "/getPageByCodeAndPerId", method = RequestMethod.POST)
  133. public BaseResponse<PageInfo<BisInspVlgdrinkFacOper>> getPageByCodeAndPerId(@RequestBody VillRgstrDto villRgstrDto) {
  134. try {
  135. PageInfo<BisInspVlgdrinkFacOper> list = bisInspVlgdrinkFacOperService.getPageByCodeAndPerId(villRgstrDto);
  136. return buildSuccessResponse(list);
  137. } catch (Exception e) {
  138. e.printStackTrace();
  139. logger.error(e.getMessage());
  140. return buildFailResponse(e.getMessage());
  141. }
  142. }
  143. @VerifyBean
  144. @ApiOperation(value = "根据节点id以及其他条件获取列表(分页)")
  145. @RequestMapping(value = "/getPageByNodeId", method = RequestMethod.POST)
  146. public BaseResponse<PageInfo<BisInspVlgdrinkFacOperDcdxDto>> getPageByNodeId(@RequestBody GetVillPageByNodeIdParam p) throws Exception {
  147. PageInfo<BisInspVlgdrinkFacOperDcdxDto> list = bisInspVlgdrinkFacOperService.getPageByNodeId(p);
  148. return buildSuccessResponse(list);
  149. }
  150. }