| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- package cn.com.goldenwater.dcproj.controller.vill;
- import cn.com.goldenwater.dcproj.dto.BisInspVlgdrinkProjManageDcdxDto;
- import cn.com.goldenwater.dcproj.dto.VillRgstrDto;
- import cn.com.goldenwater.dcproj.model.BisInspVlgdrinkProjManage;
- import cn.com.goldenwater.dcproj.param.BisInspVlgdrinkProjManageParam;
- import cn.com.goldenwater.dcproj.param.GetVillPageByNodeIdParam;
- import cn.com.goldenwater.dcproj.service.BisInspVlgdrinkProjManageService;
- 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 com.github.pagehelper.PageInfo;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- 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/vlgdrinkProjManage")
- public class BisInspVlgdrinkProjManageController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private BisInspVlgdrinkProjManageService bisInspVlgdrinkProjManageService;
- @ApiOperation(value = "添加")
- @RequestMapping(value = "/insert", method = RequestMethod.POST)
- public BaseResponse<JSONObject> insert(@ApiParam(name = "bisInspVlgdrinkProjManage", value = "BisInspVlgdrinkProjManage", required = true) @RequestBody BisInspVlgdrinkProjManage bisInspVlgdrinkProjManage) {
- String uuid = "";
- JSONObject json = new JSONObject();
- try {
- BisInspVlgdrinkProjManageParam param = new BisInspVlgdrinkProjManageParam();
- param.setEngId(bisInspVlgdrinkProjManage.getEngId());
- param.setCwsCode(bisInspVlgdrinkProjManage.getCwsCode());
- List<BisInspVlgdrinkProjManage> list = bisInspVlgdrinkProjManageService.queryList(param);
- if (list != null && list.size() == 1) {
- BisInspVlgdrinkProjManage bisInspVlgdrinkProjManageUpdate = list.get(0);
- this.update(bisInspVlgdrinkProjManageUpdate);
- json.put("id", bisInspVlgdrinkProjManageUpdate.getRunId());
- } else {
- uuid = bisInspVlgdrinkProjManageService.add(bisInspVlgdrinkProjManage);
- 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 = bisInspVlgdrinkProjManageService.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 = "bisInspVlgdrinkProjManage", value = "BisInspVlgdrinkProjManage", required = true) @RequestBody BisInspVlgdrinkProjManage bisInspVlgdrinkProjManage) {
- try {
- int ret = bisInspVlgdrinkProjManageService.modify(bisInspVlgdrinkProjManage);
- } catch (Exception e) {
- e.printStackTrace();
- logger.error(e.getMessage());
- return buildFailResponse(e.getMessage());
- }
- return buildSuccessResponse(bisInspVlgdrinkProjManage);
- }
- @ApiOperation(value = "根据ID获取(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspVlgdrinkProjManage> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspVlgdrinkProjManage bisInspVlgdrinkProjManage = bisInspVlgdrinkProjManageService.get(id);
- if (bisInspVlgdrinkProjManage == null) {
- bisInspVlgdrinkProjManage = new BisInspVlgdrinkProjManage();
- }
- return buildSuccessResponse(bisInspVlgdrinkProjManage);
- }
- @ApiOperation(value = "获取列表(分页)")
- @RequestMapping(value = "/queryListByPage", method = {RequestMethod.GET, RequestMethod.POST})
- public BaseResponse<PageInfo<BisInspVlgdrinkProjManage>> queryListByPage(@RequestBody BisInspVlgdrinkProjManageParam param) {
- PageInfo<BisInspVlgdrinkProjManage> list = new PageInfo<>();
- try {
- list = bisInspVlgdrinkProjManageService.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<BisInspVlgdrinkProjManage>> queryList(@RequestBody BisInspVlgdrinkProjManageParam param) {
- List<BisInspVlgdrinkProjManage> list = new ArrayList<>();
- try {
- list = bisInspVlgdrinkProjManageService.queryList(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<BisInspVlgdrinkProjManage>> getListByCodeAndPerId(@RequestBody VillRgstrDto villRgstrDto) {
- List<BisInspVlgdrinkProjManage> list = new ArrayList<>();
- try {
- list = bisInspVlgdrinkProjManageService.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<BisInspVlgdrinkProjManage>> getPageByCodeAndPerId(@RequestBody VillRgstrDto villRgstrDto) {
- try {
- PageInfo<BisInspVlgdrinkProjManage> list = bisInspVlgdrinkProjManageService.getPageByCodeAndPerId(villRgstrDto);
- return buildSuccessResponse(list);
- } catch (Exception e) {
- e.printStackTrace();
- logger.error(e.getMessage());
- return buildFailResponse(e.getMessage());
- }
- }
- @ApiOperation(value = "获取单条")
- @RequestMapping(value = "/getBy", method = RequestMethod.POST)
- public BaseResponse<BisInspVlgdrinkProjManage> getPageByCodeAndPerId(@RequestBody BisInspVlgdrinkProjManageParam param) {
- try {
- if (param == null) {
- return buildFailResponse("参数不能为空");
- }
- BisInspVlgdrinkProjManage list = bisInspVlgdrinkProjManageService.getBy(param);
- 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<BisInspVlgdrinkProjManageDcdxDto>> getPageByNodeId(@RequestBody GetVillPageByNodeIdParam p) throws Exception {
- PageInfo<BisInspVlgdrinkProjManageDcdxDto> list = bisInspVlgdrinkProjManageService.getPageByNodeId(p);
- return buildSuccessResponse(list);
- }
- }
|