a8866d3b8e4a858e9a7e2094889db4b18a765150.svn-base 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. package cn.com.goldenwater.dcproj.controller.dstfldqh;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
  5. import cn.com.goldenwater.dcproj.model.BisInspDstfldqh;
  6. import cn.com.goldenwater.dcproj.param.TypeParam;
  7. import cn.com.goldenwater.dcproj.service.BisInspDstfldqhService;
  8. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  9. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  10. import cn.com.goldenwater.target.CheckException;
  11. import com.github.pagehelper.PageInfo;
  12. import io.swagger.annotations.Api;
  13. import io.swagger.annotations.ApiOperation;
  14. import io.swagger.annotations.ApiParam;
  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.util.Assert;
  20. import org.springframework.web.bind.annotation.*;
  21. /**
  22. * @author lhc
  23. * @date 2021-6-10
  24. */
  25. @Api(value = "青海水毁督查登记表管理", tags = "青海水毁督查登记表管理")
  26. @RestController
  27. @RequestMapping("/bis/insp/dstfldqh")
  28. public class BisInspDstfldqhController extends BaseController {
  29. private Logger logger = LoggerFactory.getLogger(getClass());
  30. @Autowired
  31. private BisInspDstfldqhService bisInspDstfldqhService;
  32. @Autowired
  33. private OlBisInspOrgService olBisInspOrgService;
  34. @ApiOperation(value = "添加青海水毁督查登记表")
  35. @RequestMapping(value = "", method = RequestMethod.POST)
  36. public BaseResponse<BisInspDstfldqh> insert(@ApiParam(name = "bisInspDstfldqh", value = "BisInspDstfldqh", required = true) @RequestBody BisInspDstfldqh bisInspDstfldqh) {
  37. if (StringUtils.isNotBlank(bisInspDstfldqh.getRgstrId()) &&
  38. StringUtils.isBlank(bisInspDstfldqh.getId())) {
  39. // rgstrId 不为 空 时,传给ID
  40. bisInspDstfldqh.setId(bisInspDstfldqh.getRgstrId());
  41. }
  42. if (StringUtils.isBlank(bisInspDstfldqh.getId())) {
  43. throw new CheckException("缺少登记表编码");
  44. }
  45. bisInspDstfldqhService.update(bisInspDstfldqh);
  46. return buildSuccessResponse(bisInspDstfldqh);
  47. }
  48. @ApiOperation(value = "根据ID删除青海水毁督查登记表")
  49. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  50. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  51. int ret = bisInspDstfldqhService.delete(id);
  52. return buildSuccessResponse();
  53. }
  54. @ApiOperation(value = "更新青海水毁督查登记表信息")
  55. @RequestMapping(value = "/update", method = RequestMethod.POST)
  56. public BaseResponse<BisInspDstfldqh> update(@ApiParam(name = "bisInspDstfldqh", value = "BisInspDstfldqh", required = true) @RequestBody BisInspDstfldqh bisInspDstfldqh) {
  57. Assert.notNull(bisInspDstfldqh.getId(), "主键id为必填参数");
  58. int ret = bisInspDstfldqhService.update(bisInspDstfldqh);
  59. return buildSuccessResponse(bisInspDstfldqh);
  60. }
  61. @ApiOperation(value = "根据ID获取青海水毁督查登记表(单表)")
  62. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  63. public BaseResponse<BisInspDstfldqh> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  64. BisInspDstfldqh bisInspDstfldqh = bisInspDstfldqhService.get(id);
  65. return buildSuccessResponse(bisInspDstfldqh);
  66. }
  67. @ApiOperation(value = "获取督查对象")
  68. @RequestMapping(value = "/findPage", method = RequestMethod.POST)
  69. public BaseResponse<PageInfo> page(@ApiParam(name = "typeParam", value = "typeParam", required = true)
  70. @RequestBody TypeParam typeParam) {
  71. typeParam.setpType(BisInspEnum.DSTFLDQH.getValue());
  72. typeParam.setPresId(getCurrentPersId());
  73. if (StringUtils.isBlank(typeParam.getAdCode())) {
  74. typeParam.setAdCodes(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId())));
  75. }
  76. return buildSuccessResponse(bisInspDstfldqhService.findObjPageByType(typeParam, null));
  77. }
  78. }