97d28fd49529221a0def90315229f60f923669f0.svn-base 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. package cn.com.goldenwater.dcproj.controller.chmcls;
  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.BisInspChmclsRgstrDto;
  6. import cn.com.goldenwater.dcproj.model.BisInspChmclsRgstr;
  7. import cn.com.goldenwater.dcproj.param.TypeParam;
  8. import cn.com.goldenwater.dcproj.service.BisInspChmclsRgstrService;
  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-13
  25. */
  26. @Api(value = "xxx管理", tags = "xxx管理")
  27. @RestController
  28. @RequestMapping("/bis/insp/chmcls")
  29. public class BisInspChmclsRgstrController extends BaseController {
  30. private Logger logger = LoggerFactory.getLogger(getClass());
  31. @Autowired
  32. private BisInspChmclsRgstrService bisInspChmclsRgstrService;
  33. @Autowired
  34. private OlBisInspOrgService olBisInspOrgService;
  35. @ApiOperation(value = "修改xxx")
  36. @RequestMapping(value = "", method = RequestMethod.POST)
  37. public BaseResponse<BisInspChmclsRgstr> insert(@ApiParam(name = "bisInspChmclsRgstr", value = "BisInspChmclsRgstr", required = true) @RequestBody BisInspChmclsRgstr bisInspChmclsRgstr) {
  38. if (StringUtils.isBlank(bisInspChmclsRgstr.getId()) ||
  39. StringUtils.isNotBlank(bisInspChmclsRgstr.getRgstrId())) {
  40. // rgstrId 不为 空 时,传给ID
  41. bisInspChmclsRgstr.setId(bisInspChmclsRgstr.getRgstrId());
  42. }
  43. if (StringUtils.isBlank(bisInspChmclsRgstr.getId())) {
  44. throw new CheckException("缺少登记表编码!");
  45. }
  46. int ret = bisInspChmclsRgstrService.update(bisInspChmclsRgstr);
  47. return buildSuccessResponse(bisInspChmclsRgstr);
  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 = bisInspChmclsRgstrService.delete(id);
  53. return buildSuccessResponse();
  54. }
  55. @ApiOperation(value = "根据ID获取xxx(单表)")
  56. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  57. public BaseResponse<BisInspChmclsRgstr> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  58. BisInspChmclsRgstr bisInspChmclsRgstr = bisInspChmclsRgstrService.get(id);
  59. return buildSuccessResponse(bisInspChmclsRgstr);
  60. }
  61. @ApiOperation(value = "列表--分页")
  62. @RequestMapping(value = "/findPage", method = RequestMethod.POST)
  63. public BaseResponse<PageInfo<BisInspChmclsRgstrDto>> page(@ApiParam(name = "bisInspChmclsRgstrParam", value = "bisInspChmclsRgstrParam", required = true)
  64. @RequestBody TypeParam typeParam) {
  65. typeParam.setpType(BisInspEnum.CHMCLS.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<BisInspChmclsRgstrDto> rgstrPageInfo = bisInspChmclsRgstrService.findObjPageByType(typeParam, null);
  75. return buildSuccessResponse(rgstrPageInfo);
  76. }
  77. }