!234 修复查询满减活动和优惠券活动报错问题
Merge pull request !234 from OceansDeep/feature/pg
This commit is contained in:
		
						commit
						178e0d18cd
					
				@ -45,21 +45,20 @@ public class LimitInterceptor {
 | 
			
		||||
    @Before("@annotation(limitPointAnnotation)")
 | 
			
		||||
    public void interceptor(LimitPoint limitPointAnnotation) {
 | 
			
		||||
        LimitTypeEnums limitTypeEnums = limitPointAnnotation.limitType();
 | 
			
		||||
        String name = limitPointAnnotation.name();
 | 
			
		||||
 | 
			
		||||
        String key;
 | 
			
		||||
        int limitPeriod = limitPointAnnotation.period();
 | 
			
		||||
        int limitCount = limitPointAnnotation.limit();
 | 
			
		||||
        switch (limitTypeEnums) {
 | 
			
		||||
            case CUSTOMER:
 | 
			
		||||
        if (limitTypeEnums == LimitTypeEnums.CUSTOMER) {
 | 
			
		||||
            key = limitPointAnnotation.key();
 | 
			
		||||
                break;
 | 
			
		||||
            default:
 | 
			
		||||
        } else {
 | 
			
		||||
            key = limitPointAnnotation.key() + IpUtils
 | 
			
		||||
                    .getIpAddress(((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
 | 
			
		||||
        }
 | 
			
		||||
        ImmutableList<String> keys = ImmutableList.of(StringUtils.join(limitPointAnnotation.prefix(), key));
 | 
			
		||||
        try {
 | 
			
		||||
            Number count = redisTemplate.execute(limitScript, keys, limitCount, limitPeriod);
 | 
			
		||||
            assert count != null;
 | 
			
		||||
            log.info("限制请求{}, 当前请求{},缓存key{}", limitCount, count.intValue(), key);
 | 
			
		||||
            //如果缓存里没有值,或者他的值小于限制频率
 | 
			
		||||
            if (count.intValue() >= limitCount) {
 | 
			
		||||
@ -72,6 +71,7 @@ public class LimitInterceptor {
 | 
			
		||||
        } catch (ServiceException e) {
 | 
			
		||||
            throw e;
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            log.error("限流异常", e);
 | 
			
		||||
            throw new ServiceException(ResultCode.ERROR);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -47,6 +47,7 @@ public class PreventDuplicateSubmissionsInterceptor {
 | 
			
		||||
        } catch (ServiceException e) {
 | 
			
		||||
            throw e;
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            log.error("防重复提交拦截器异常", e);
 | 
			
		||||
            throw new ServiceException(ResultCode.ERROR);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -96,6 +96,7 @@ public class VerificationServiceImpl implements VerificationService {
 | 
			
		||||
        } catch (ServiceException e) {
 | 
			
		||||
            throw e;
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            log.error("生成验证码失败", e);
 | 
			
		||||
            throw new ServiceException(ResultCode.ERROR);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -35,7 +35,6 @@ public class FullDiscountManagerController {
 | 
			
		||||
    @ApiOperation(value = "获取满优惠列表")
 | 
			
		||||
    @GetMapping
 | 
			
		||||
    public ResultMessage<IPage<FullDiscount>> getCouponList(FullDiscountSearchParams searchParams, PageVO page) {
 | 
			
		||||
        page.setNotConvert(true);
 | 
			
		||||
        return ResultUtil.data(fullDiscountService.pageFindAll(searchParams, page));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -41,7 +41,6 @@ public class CouponStoreController {
 | 
			
		||||
    @GetMapping
 | 
			
		||||
    @ApiOperation(value = "获取优惠券列表")
 | 
			
		||||
    public ResultMessage<IPage<CouponVO>> getCouponList(CouponSearchParams queryParam, PageVO page) {
 | 
			
		||||
        page.setNotConvert(true);
 | 
			
		||||
        String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
 | 
			
		||||
        queryParam.setStoreId(storeId);
 | 
			
		||||
        IPage<CouponVO> coupons = couponService.pageVOFindAll(queryParam, page);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user