解决优惠券在购物车中缓存会出现的一些极端bug
This commit is contained in:
parent
4095481411
commit
81c7a72b9c
@ -160,4 +160,9 @@ public class TradeDTO implements Serializable {
|
|||||||
}
|
}
|
||||||
return skuList;
|
return skuList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeCoupon() {
|
||||||
|
this.canUseCoupons = new ArrayList<>();
|
||||||
|
this.cantUseCoupons = new ArrayList<>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,12 @@ public class CouponRender implements CartRenderStep {
|
|||||||
* @param tradeDTO 交易dto
|
* @param tradeDTO 交易dto
|
||||||
*/
|
*/
|
||||||
private void renderCouponRule(TradeDTO tradeDTO) {
|
private void renderCouponRule(TradeDTO tradeDTO) {
|
||||||
|
// 清除之前的优惠券
|
||||||
|
tradeDTO.removeCoupon();
|
||||||
|
|
||||||
List<MemberCoupon> memberCouponList = memberCouponService.getMemberCoupons(tradeDTO.getMemberId());
|
List<MemberCoupon> memberCouponList = memberCouponService.getMemberCoupons(tradeDTO.getMemberId());
|
||||||
|
|
||||||
|
//获取最新优惠券
|
||||||
memberCouponList = memberCouponList.stream()
|
memberCouponList = memberCouponList.stream()
|
||||||
.filter(item -> item.getStartTime().before(new Date()) && item.getEndTime().after(new Date()))
|
.filter(item -> item.getStartTime().before(new Date()) && item.getEndTime().after(new Date()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user