|
|
@@ -1,7 +1,7 @@
|
|
|
package com.example.hotel.blImpl.coupon;
|
|
|
|
|
|
import com.example.hotel.bl.coupon.CouponService;
|
|
|
-import com.example.hotel.bl.coupon.CouponStrategy;
|
|
|
+import com.example.hotel.bl.coupon.CouponMatchStrategy;
|
|
|
import com.example.hotel.data.coupon.CouponMapper;
|
|
|
import com.example.hotel.po.Coupon;
|
|
|
import com.example.hotel.vo.CouponVO;
|
|
|
@@ -23,7 +23,7 @@ public class CouponServiceImpl implements CouponService {
|
|
|
private final TimeCouponStrategyImpl timeCouponStrategy;
|
|
|
private final CouponMapper couponMapper;
|
|
|
|
|
|
- private static List<CouponStrategy> strategyList = new ArrayList<>();
|
|
|
+ private static List<CouponMatchStrategy> strategyList = new ArrayList<>();
|
|
|
|
|
|
@Autowired
|
|
|
public CouponServiceImpl(TargetMoneyCouponStrategyImpl targetMoneyCouponStrategy,
|
|
|
@@ -39,15 +39,15 @@ public class CouponServiceImpl implements CouponService {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public List<Coupon> matchOrderCoupon(OrderVO orderVO) {
|
|
|
+ public List<Coupon> getMatchOrderCoupon(OrderVO orderVO) {
|
|
|
|
|
|
List<Coupon> hotelCoupons = getHotelAllCoupon(orderVO.getHotelId());
|
|
|
|
|
|
List<Coupon> availAbleCoupons = new ArrayList<>();
|
|
|
|
|
|
for (int i = 0; i < hotelCoupons.size(); i++) {
|
|
|
- for (CouponStrategy strategy : strategyList) {
|
|
|
- if (strategy.isMatchCoupon(orderVO, hotelCoupons.get(i))) {
|
|
|
+ for (CouponMatchStrategy strategy : strategyList) {
|
|
|
+ if (strategy.isMatch(orderVO, hotelCoupons.get(i))) {
|
|
|
availAbleCoupons.add(hotelCoupons.get(i));
|
|
|
}
|
|
|
}
|