6146c4835ff3ad8cffb1827962fd1d28844dba1b.svn-base 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. package cn.com.goldenwater.dcproj.controller.grw;
  2. import cn.com.goldenwater.dcproj.model.AttGrwBase;
  3. import cn.com.goldenwater.dcproj.param.AttGrwBaseCrrtParam;
  4. import cn.com.goldenwater.dcproj.param.AttGrwBaseParam;
  5. import cn.com.goldenwater.dcproj.param.AttGrwListByParam;
  6. import cn.com.goldenwater.dcproj.service.AttGrwBaseService;
  7. import cn.com.goldenwater.core.web.BaseController;
  8. import cn.com.goldenwater.core.web.BaseResponse;
  9. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  10. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  11. import io.swagger.annotations.Api;
  12. import io.swagger.annotations.ApiOperation;
  13. import io.swagger.annotations.ApiParam;
  14. import com.github.pagehelper.PageInfo;
  15. import org.apache.commons.lang3.StringUtils;
  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. import com.alibaba.fastjson.JSONObject;
  27. import javax.servlet.http.HttpServletRequest;
  28. /**
  29. * @author zhengdafei
  30. * @date 2019-3-30
  31. */
  32. @Api(value = "地下水监测站基本信息管理", tags = "地下水监测站基本信息管理")
  33. @RestController
  34. @RequestMapping("/dc/insp/attGrwBase")
  35. public class AttGrwBaseController extends BaseController {
  36. private Logger logger = LoggerFactory.getLogger(getClass());
  37. @Autowired
  38. private AttGrwBaseService attGrwBaseService;
  39. @Autowired
  40. private OlBisInspOrgService olBisInspOrgService;
  41. @ApiOperation(value = "根据STCD删除地下水监测站基本信息")
  42. @RequestMapping(value = "/{stcd}", method = RequestMethod.POST)
  43. public BaseResponse delete(
  44. @ApiParam(name = "stcd", value = "stcd", required = true) @PathVariable String stcd) throws Exception {
  45. attGrwBaseService.remove(stcd);
  46. JSONObject json = new JSONObject();
  47. json.put("code", 200);
  48. return buildSuccessResponse(json);
  49. }
  50. @ApiOperation(value = "根据stcd获取地下水监测站基本信息(单表)")
  51. @RequestMapping(value = "/{stcd}", method = RequestMethod.GET)
  52. public BaseResponse<AttGrwBase> get(@ApiParam(name = "stcd", value = "stcd", required = true) @PathVariable String stcd) throws Exception {
  53. AttGrwBase attGrwBase = attGrwBaseService.get(stcd);
  54. return buildSuccessResponse(attGrwBase);
  55. }
  56. @ApiOperation(value = "获取地下水监测站基本信息列表(分页)")
  57. @RequestMapping(value = "/pageInfo", method = {RequestMethod.POST})
  58. public BaseResponse<PageInfo<AttGrwBase>> queryListByPage(@RequestBody AttGrwBaseParam param) throws Exception {
  59. param.setProvince(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId())));
  60. PageInfo<AttGrwBase> list = new PageInfo<>();
  61. list = attGrwBaseService.findPageInfo(param);
  62. return buildSuccessResponse(list);
  63. }
  64. @ApiOperation(value = "获取地下水监测站基本信息列表")
  65. @RequestMapping(value = "/list", method = {RequestMethod.POST})
  66. public BaseResponse<List<AttGrwBase>> queryList(@RequestBody AttGrwBaseParam param) throws Exception {
  67. List<AttGrwBase> list = new ArrayList<>();
  68. list = attGrwBaseService.findList(param);
  69. return buildSuccessResponse(list);
  70. }
  71. @ApiOperation(value = "获取一个地下水监测站基本信息对象")
  72. @RequestMapping(value = "/getBy", method = {RequestMethod.POST})
  73. public BaseResponse<AttGrwBase> getBy(@RequestBody AttGrwBaseParam param) throws Exception {
  74. AttGrwBase one = new AttGrwBase();
  75. one = attGrwBaseService.getBy(param);
  76. return buildSuccessResponse(one);
  77. }
  78. @ApiOperation(value = "地下水测站列表----添加督查对象")
  79. @RequestMapping(value = "/getListBy", method = {RequestMethod.POST})
  80. public BaseResponse<PageInfo<AttGrwBase>> getListBy(@RequestBody AttGrwListByParam param, HttpServletRequest request) throws Exception {
  81. if (StringUtils.isBlank(param.getPersId())) {
  82. param.setPersId(request.getHeader("persId"));
  83. }
  84. if (StringUtils.isBlank(param.getPersId())) {
  85. throw new Exception("persId不能为空");
  86. }
  87. PageInfo<AttGrwBase> list = new PageInfo<>();
  88. list = attGrwBaseService.getListBy(param);
  89. return buildSuccessResponse(list);
  90. }
  91. @ApiOperation(value = "更新基础信息纠错")
  92. @RequestMapping(value = "/crrctBase", method = RequestMethod.POST)
  93. public BaseResponse<AttGrwBase> crrctBase(HttpServletRequest req,
  94. @RequestBody AttGrwBaseCrrtParam p) throws Exception {
  95. AttGrwBase bean = attGrwBaseService.crrctBase(p);
  96. return buildSuccessResponse(bean);
  97. }
  98. }