6199a771c58e59198178e072de9e2e05cca2eb9a.svn-base 3.9 KB

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