eb32db7492f564760b8fa25998fd18575ffb77fb.svn-base 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package cn.com.goldenwater.dcproj.controller.swhsjs;
  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.BisInspSwhsjs;
  6. import cn.com.goldenwater.dcproj.param.TypeParam;
  7. import cn.com.goldenwater.dcproj.service.BisInspSwhsjsService;
  8. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  9. import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
  10. import cn.com.goldenwater.dcproj.utils.DateUtils;
  11. import cn.com.goldenwater.target.CheckException;
  12. import com.github.pagehelper.PageInfo;
  13. import io.swagger.annotations.Api;
  14. import io.swagger.annotations.ApiOperation;
  15. import io.swagger.annotations.ApiParam;
  16. import org.apache.commons.lang.StringUtils;
  17. import org.springframework.beans.factory.annotation.Autowired;
  18. import org.springframework.web.bind.annotation.*;
  19. /**
  20. * @author
  21. * @date 2022-2-23
  22. */
  23. @Api(value = "江苏水源地登记管理", tags = "江苏水源地登记管理")
  24. @RestController
  25. @RequestMapping("/bis/insp/swhsjs")
  26. public class BisInspSwhsjsController extends BaseController {
  27. @Autowired
  28. private BisInspSwhsjsService bisInspSwhsjsService;
  29. @Autowired
  30. private OlBisInspOrgService olBisInspOrgService;
  31. @ApiOperation(value = "修改江苏水源地登记")
  32. @RequestMapping(value = "", method = RequestMethod.POST)
  33. public BaseResponse<BisInspSwhsjs> insert(@ApiParam(name = "bisInspSwhsjs", value = "BisInspSwhsjs", required = true) @RequestBody BisInspSwhsjs bisInspSwhsjs) {
  34. if (org.apache.commons.lang.StringUtils.isBlank(bisInspSwhsjs.getId()) ||
  35. org.apache.commons.lang.StringUtils.isNotBlank(bisInspSwhsjs.getRgstrId())) {
  36. // rgstrId 不为 空 时,传给ID
  37. bisInspSwhsjs.setId(bisInspSwhsjs.getRgstrId());
  38. }
  39. if (StringUtils.isBlank(bisInspSwhsjs.getId())) {
  40. throw new CheckException("缺少登记表编码!");
  41. }
  42. int ret = bisInspSwhsjsService.update(bisInspSwhsjs);
  43. return buildSuccessResponse(bisInspSwhsjs);
  44. }
  45. @ApiOperation(value = "根据ID删除江苏水源地登记")
  46. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  47. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  48. int ret = bisInspSwhsjsService.delete(id);
  49. return buildSuccessResponse();
  50. }
  51. @ApiOperation(value = "根据ID获取江苏水源地登记(单表)")
  52. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  53. public BaseResponse<BisInspSwhsjs> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  54. BisInspSwhsjs bisInspSwhsjs = bisInspSwhsjsService.get(id);
  55. return buildSuccessResponse(bisInspSwhsjs);
  56. }
  57. @ApiOperation(value = "列表--分页")
  58. @RequestMapping(value = "/findPage", method = RequestMethod.POST)
  59. public BaseResponse<PageInfo> page(@ApiParam(name = "bisInspSwhsjsParam", value = "bisInspSwhsjsParam", required = true)
  60. @RequestBody TypeParam typeParam) {
  61. typeParam.setpType(BisInspEnum.SWHSJS.getValue());
  62. typeParam.setPresId(getCurrentPersId());
  63. typeParam.setOrgId(getCurrentOrgId());
  64. typeParam.setNowTime(DateUtils.getToday("yyyy-MM-dd"));
  65. if (!StringUtils.isBlank(typeParam.getAdCodes())) {
  66. typeParam.setAdCodes(AdLevelUtil.getListAddvcd(typeParam.getAdCodes()));
  67. } else {
  68. typeParam.setAdCodes(AdLevelUtil.getAddvcd(olBisInspOrgService.getProvince(getCurrentOrgId())));
  69. }
  70. return buildSuccessResponse(bisInspSwhsjsService.findObjPageByType(typeParam, null));
  71. }
  72. }