|
|
@@ -1,3 +1,4 @@
|
|
|
+
|
|
|
package shop.alien.store.service.impl;
|
|
|
|
|
|
import com.alibaba.nacos.common.utils.CollectionUtils;
|
|
|
@@ -8,7 +9,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
-import org.apache.poi.util.StringUtil;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.BeansException;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -346,6 +346,7 @@ public class LifeDiscountCouponServiceImpl extends ServiceImpl<LifeDiscountCoupo
|
|
|
public List<LifeDiscountCouponVo> getStoreUserCouponList(String storeId, UserLoginInfo userLoginInfo) {
|
|
|
List<LifeDiscountCouponVo> lifeDiscountCouponVos = new ArrayList<>();
|
|
|
LocalDate now = LocalDate.now();
|
|
|
+ LocalDateTime now1 = now.atStartOfDay();
|
|
|
//根据店铺id查询该店铺的优惠券,状态是开启领取的券
|
|
|
List<LifeDiscountCoupon> lifeDiscountCoupons = lifeDiscountCouponMapper.selectList(new LambdaQueryWrapper<LifeDiscountCoupon>().eq(LifeDiscountCoupon::getStoreId, storeId).eq(LifeDiscountCoupon::getGetStatus, "1").gt(LifeDiscountCoupon::getSingleQty, 0) //还有库存
|
|
|
.ge(LifeDiscountCoupon::getEndGetDate, now).orderByDesc(LifeDiscountCoupon::getCreatedTime));
|
|
|
@@ -392,13 +393,13 @@ public class LifeDiscountCouponServiceImpl extends ServiceImpl<LifeDiscountCoupo
|
|
|
String unavailableRuleValue = lifeDiscountCouponUnavailableRules.getUnavailableRuleValue();
|
|
|
long confineTo = 0L;
|
|
|
if (DiscountCouponEnum.DAY.getValue().equals(unavailableRuleValue)) {//如果规则限制一天一张
|
|
|
- confineTo = ChronoUnit.DAYS.between(localDateTime, now);
|
|
|
+ confineTo = ChronoUnit.DAYS.between(localDateTime, now1);
|
|
|
} else if (DiscountCouponEnum.WEEK.getValue().equals(unavailableRuleValue)) {//如果规则限制一周一张
|
|
|
- confineTo = ChronoUnit.WEEKS.between(localDateTime, now);
|
|
|
+ confineTo = ChronoUnit.WEEKS.between(localDateTime, now1);
|
|
|
} else if (DiscountCouponEnum.MONTH.getValue().equals(unavailableRuleValue)) {//如果规则限制一月一张
|
|
|
- confineTo = ChronoUnit.MONTHS.between(localDateTime, now);
|
|
|
+ confineTo = ChronoUnit.MONTHS.between(localDateTime, now1);
|
|
|
} else if (DiscountCouponEnum.YEAR.getValue().equals(unavailableRuleValue)) {//如果规则限制一年一张
|
|
|
- confineTo = ChronoUnit.YEARS.between(localDateTime, now);
|
|
|
+ confineTo = ChronoUnit.YEARS.between(localDateTime, now1);
|
|
|
}
|
|
|
//如果在规则范围内,则不允许领取,范围外,则可以领取
|
|
|
lifeDiscountCouponVo.setCanReceived(confineTo >= 1);
|