| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- package cn.com.goldenwater.dcproj.controller.vill;
- import cn.com.goldenwater.dcproj.dto.BisInspSecsurveyVlgDcdxDto;
- import cn.com.goldenwater.dcproj.dto.BisInspSecsurveyVlgDto;
- import cn.com.goldenwater.dcproj.dto.VillRgstrDto;
- import cn.com.goldenwater.dcproj.model.BisInspSecsurveyVlg;
- import cn.com.goldenwater.dcproj.param.BisInspSecsurveyVlgParam;
- import cn.com.goldenwater.dcproj.param.GetVillPageByNodeIdParam;
- import cn.com.goldenwater.dcproj.service.BisInspSecsurveyVlgService;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.target.VerifyBean;
- import com.alibaba.fastjson.JSONObject;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import com.github.pagehelper.PageInfo;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- import java.util.ArrayList;
- import java.util.List;
- /**
- * @author zhengdafei
- * @date 2019-2-19
- */
- @Api(value = "", tags = "农村暗访调研行政村登记")
- @RestController
- @RequestMapping("/dc/insp/secsurveyVlg")
- public class BisInspSecsurveyVlgController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspSecsurveyVlgService bisInspSecsurveyVlgService;
- @ApiOperation(value = "添加")
- @RequestMapping(value = "/insert", method = RequestMethod.POST)
- public BaseResponse<JSONObject> insert(@ApiParam(name = "bisInspSecsurveyVlg", value = "BisInspSecsurveyVlg", required = true) @RequestBody BisInspSecsurveyVlg bisInspSecsurveyVlg) {
- String uuid = "";
- JSONObject json = new JSONObject();
- try {
- uuid = bisInspSecsurveyVlgService.add(bisInspSecsurveyVlg);
- json.put("id", uuid);
- } catch (Exception e) {
- e.printStackTrace();
- logger.error(e.getMessage());
- return buildFailResponse(e.getMessage());
- }
- return buildSuccessResponse(json);
- }
- @ApiOperation(value = "根据ID删除")
- @RequestMapping(value = "/{id}", method = RequestMethod.POST)
- public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- int ret = bisInspSecsurveyVlgService.delete(id);
- JSONObject json = new JSONObject();
- json.put("id", id);
- return buildSuccessResponse(json);
- }
- @ApiOperation(value = "更新信息")
- @RequestMapping(value = "/update", method = RequestMethod.POST)
- public BaseResponse update(@ApiParam(name = "bisInspSecsurveyVlg", value = "BisInspSecsurveyVlg", required = true) @RequestBody BisInspSecsurveyVlg bisInspSecsurveyVlg) {
- int ret = 0;
- try {
- ret = bisInspSecsurveyVlgService.modify(bisInspSecsurveyVlg);
- } catch (Exception e) {
- e.printStackTrace();
- logger.error(e.getMessage());
- return buildFailResponse(e.getMessage());
- }
- return buildSuccessResponse(bisInspSecsurveyVlg);
- }
- @ApiOperation(value = "根据ID获取(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspSecsurveyVlg> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspSecsurveyVlg bisInspSecsurveyVlg = bisInspSecsurveyVlgService.get(id);
- if (bisInspSecsurveyVlg == null) {
- bisInspSecsurveyVlg = new BisInspSecsurveyVlg();
- }
- return buildSuccessResponse(bisInspSecsurveyVlg);
- }
- @ApiOperation(value = "获取列表(分页)")
- @RequestMapping(value = "/queryListByPage", method = {RequestMethod.GET, RequestMethod.POST})
- public BaseResponse<PageInfo<BisInspSecsurveyVlg>> queryListByPage(@RequestBody BisInspSecsurveyVlgParam param) {
- PageInfo<BisInspSecsurveyVlg> list = new PageInfo<>();
- try {
- list = bisInspSecsurveyVlgService.queryListByPage(param);
- } catch (Exception e) {
- e.printStackTrace();
- logger.error(e.getMessage());
- return buildFailResponse(e.getMessage());
- }
- return buildSuccessResponse(list);
- }
- @ApiOperation(value = "获取列表")
- @RequestMapping(value = "/queryList", method = {RequestMethod.GET, RequestMethod.POST})
- public BaseResponse<List<BisInspSecsurveyVlg>> queryList(@RequestBody BisInspSecsurveyVlgParam param) {
- List<BisInspSecsurveyVlg> list = new ArrayList<>();
- try {
- list = bisInspSecsurveyVlgService.queryList(param);
- } catch (Exception e) {
- e.printStackTrace();
- logger.error(e.getMessage());
- return buildFailResponse(e.getMessage());
- }
- return buildSuccessResponse(list);
- }
- @ApiOperation(value = "获取单个村(带状态)")
- @RequestMapping(value = "/getBy", method = {RequestMethod.GET, RequestMethod.POST})
- public BaseResponse<BisInspSecsurveyVlgDto> getBy(@RequestBody BisInspSecsurveyVlgParam param) {
- BisInspSecsurveyVlgDto list = new BisInspSecsurveyVlgDto();
- try {
- list = bisInspSecsurveyVlgService.getOne(param);
- } catch (Exception e) {
- e.printStackTrace();
- logger.error(e.getMessage());
- return buildFailResponse(e.getMessage());
- }
- return buildSuccessResponse(list);
- }
- @ApiOperation(value = "获取单个最新村(带状态)")
- @RequestMapping(value = "/getNearBy", method = RequestMethod.POST)
- public BaseResponse<BisInspSecsurveyVlgDto> getNearBy(@RequestBody BisInspSecsurveyVlgParam param) {
- BisInspSecsurveyVlgDto list = new BisInspSecsurveyVlgDto();
- try {
- list = bisInspSecsurveyVlgService.getNearOne(param);
- } catch (Exception e) {
- e.printStackTrace();
- logger.error(e.getMessage());
- return buildFailResponse(e.getMessage());
- }
- return buildSuccessResponse(list);
- }
- @ApiOperation(value = "根据行政区划编码和人员id获取列表(不分页)")
- @RequestMapping(value = "/getListByCodeAndPerId", method = RequestMethod.POST)
- public BaseResponse<List<BisInspSecsurveyVlg>> getListByCodeAndPerId(@RequestBody VillRgstrDto villRgstrDto) {
- List<BisInspSecsurveyVlg> list = new ArrayList<>();
- try {
- list = bisInspSecsurveyVlgService.getListByCodeAndPerId(villRgstrDto);
- } catch (Exception e) {
- e.printStackTrace();
- logger.error(e.getMessage());
- return buildFailResponse(e.getMessage());
- }
- return buildSuccessResponse(list);
- }
- @ApiOperation(value = "根据行政区划编码和人员id获取列表(分页)")
- @RequestMapping(value = "/getPageByCodeAndPerId", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspSecsurveyVlg>> getPageByCodeAndPerId(@RequestBody VillRgstrDto villRgstrDto) {
- try {
- PageInfo<BisInspSecsurveyVlg> list = bisInspSecsurveyVlgService.getPageByCodeAndPerId(villRgstrDto);
- return buildSuccessResponse(list);
- } catch (Exception e) {
- e.printStackTrace();
- logger.error(e.getMessage());
- return buildFailResponse(e.getMessage());
- }
- }
- @VerifyBean
- @ApiOperation(value = "根据节点id以及其他条件获取列表(分页)")
- @RequestMapping(value = "/getPageByNodeId", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspSecsurveyVlgDcdxDto>> getPageByNodeId(@RequestBody GetVillPageByNodeIdParam p) throws Exception {
- PageInfo<BisInspSecsurveyVlgDcdxDto> list = bisInspSecsurveyVlgService.getPageByNodeId(p);
- return buildSuccessResponse(list);
- }
- }
|