package cn.com.goldenwater.dcproj.controller.grw; import cn.com.goldenwater.dcproj.model.AttGrwBase; import cn.com.goldenwater.dcproj.param.AttGrwBaseCrrtParam; import cn.com.goldenwater.dcproj.param.AttGrwBaseParam; import cn.com.goldenwater.dcproj.param.AttGrwListByParam; import cn.com.goldenwater.dcproj.service.AttGrwBaseService; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.service.OlBisInspOrgService; import cn.com.goldenwater.dcproj.utils.AdLevelUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; 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; import com.alibaba.fastjson.JSONObject; import javax.servlet.http.HttpServletRequest; /** * @author zhengdafei * @date 2019-3-30 */ @Api(value = "地下水监测站基本信息管理", tags = "地下水监测站基本信息管理") @RestController @RequestMapping("/dc/insp/attGrwBase") public class AttGrwBaseController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private AttGrwBaseService attGrwBaseService; @Autowired private OlBisInspOrgService olBisInspOrgService; @ApiOperation(value = "根据STCD删除地下水监测站基本信息") @RequestMapping(value = "/{stcd}", method = RequestMethod.POST) public BaseResponse delete( @ApiParam(name = "stcd", value = "stcd", required = true) @PathVariable String stcd) throws Exception { attGrwBaseService.remove(stcd); JSONObject json = new JSONObject(); json.put("code", 200); return buildSuccessResponse(json); } @ApiOperation(value = "根据stcd获取地下水监测站基本信息(单表)") @RequestMapping(value = "/{stcd}", method = RequestMethod.GET) public BaseResponse get(@ApiParam(name = "stcd", value = "stcd", required = true) @PathVariable String stcd) throws Exception { AttGrwBase attGrwBase = attGrwBaseService.get(stcd); return buildSuccessResponse(attGrwBase); } @ApiOperation(value = "获取地下水监测站基本信息列表(分页)") @RequestMapping(value = "/pageInfo", method = {RequestMethod.POST}) public BaseResponse> queryListByPage(@RequestBody AttGrwBaseParam param) throws Exception { param.setProvince(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId()))); PageInfo list = new PageInfo<>(); list = attGrwBaseService.findPageInfo(param); return buildSuccessResponse(list); } @ApiOperation(value = "获取地下水监测站基本信息列表") @RequestMapping(value = "/list", method = {RequestMethod.POST}) public BaseResponse> queryList(@RequestBody AttGrwBaseParam param) throws Exception { List list = new ArrayList<>(); list = attGrwBaseService.findList(param); return buildSuccessResponse(list); } @ApiOperation(value = "获取一个地下水监测站基本信息对象") @RequestMapping(value = "/getBy", method = {RequestMethod.POST}) public BaseResponse getBy(@RequestBody AttGrwBaseParam param) throws Exception { AttGrwBase one = new AttGrwBase(); one = attGrwBaseService.getBy(param); return buildSuccessResponse(one); } @ApiOperation(value = "地下水测站列表----添加督查对象") @RequestMapping(value = "/getListBy", method = {RequestMethod.POST}) public BaseResponse> getListBy(@RequestBody AttGrwListByParam param, HttpServletRequest request) throws Exception { if (StringUtils.isBlank(param.getPersId())) { param.setPersId(request.getHeader("persId")); } if (StringUtils.isBlank(param.getPersId())) { throw new Exception("persId不能为空"); } PageInfo list = new PageInfo<>(); list = attGrwBaseService.getListBy(param); return buildSuccessResponse(list); } @ApiOperation(value = "更新基础信息纠错") @RequestMapping(value = "/crrctBase", method = RequestMethod.POST) public BaseResponse crrctBase(HttpServletRequest req, @RequestBody AttGrwBaseCrrtParam p) throws Exception { AttGrwBase bean = attGrwBaseService.crrctBase(p); return buildSuccessResponse(bean); } }