From 6e624702e86fc973c00db5cf59ec8ad57ac8336c Mon Sep 17 00:00:00 2001
From: 陶杰 <1378534974@qq.com>
Date: 星期四, 12 九月 2024 17:04:28 +0800
Subject: [PATCH] 1. 用户优惠券-首页弹框-去掉登录用户限制
---
src/main/java/com/mzl/flower/config/ResourceServerConfig.java | 1 +
src/main/java/com/mzl/flower/service/impl/coupon/CouponTemplateServiceImpl2.java | 19 ++++++++++++-------
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/mzl/flower/config/ResourceServerConfig.java b/src/main/java/com/mzl/flower/config/ResourceServerConfig.java
index 73cb25a..885356a 100644
--- a/src/main/java/com/mzl/flower/config/ResourceServerConfig.java
+++ b/src/main/java/com/mzl/flower/config/ResourceServerConfig.java
@@ -57,6 +57,7 @@
.antMatchers("/api/config/content/list/view").permitAll()
.antMatchers("/api/v2/coupon/home/alert").permitAll()
.antMatchers("/api/customer/partner/name").permitAll()
+ .antMatchers("/api/v2/coupon/app/home/alert").permitAll()
.antMatchers("/api/**").authenticated();//配置访问控制,必须认证过后才可以访问
}
diff --git a/src/main/java/com/mzl/flower/service/impl/coupon/CouponTemplateServiceImpl2.java b/src/main/java/com/mzl/flower/service/impl/coupon/CouponTemplateServiceImpl2.java
index 1a264ea..aebc889 100644
--- a/src/main/java/com/mzl/flower/service/impl/coupon/CouponTemplateServiceImpl2.java
+++ b/src/main/java/com/mzl/flower/service/impl/coupon/CouponTemplateServiceImpl2.java
@@ -462,14 +462,19 @@
@Override
public CouponTemplateVO getHomeActivityEffectAlert(QueryActivityEffectCouponDTO dto) {
- dto.setUserId(SecurityUtils.getUserId());
+
+ // 存在用户是空的情况
final CouponTemplateVO homeActivityEffectAlert = couponTemplateMapperCustom.getHomeActivityEffectAlert(dto);
- if(null!=homeActivityEffectAlert){
- // 查看当前已经领取了几张
- final Integer getCnt = couponRecordService.getUserGainCouponRecordAmountByUserId(homeActivityEffectAlert.getId(), SecurityUtils.getUserId());
- // 如果当前领取的数量小于限制领取的数量的时候,可以再次领取
- if(null!=homeActivityEffectAlert.getGetLimit() && null!=getCnt
- && homeActivityEffectAlert.getGetLimit().compareTo(getCnt)>0){
+ if(null!=homeActivityEffectAlert ){
+ if(StringUtils.isNotBlank(SecurityUtils.getUserId()) ){
+ // 查看当前已经领取了几张
+ final Integer getCnt = couponRecordService.getUserGainCouponRecordAmountByUserId(homeActivityEffectAlert.getId(), SecurityUtils.getUserId());
+ // 如果当前领取的数量小于限制领取的数量的时候,可以再次领取
+ if(null!=homeActivityEffectAlert.getGetLimit() && null!=getCnt
+ && homeActivityEffectAlert.getGetLimit().compareTo(getCnt)>0){
+ return homeActivityEffectAlert;
+ }
+ }else{
return homeActivityEffectAlert;
}
}
--
Gitblit v1.9.3