Showing
3 changed files
with
43 additions
and
0 deletions
@@ -5,6 +5,8 @@ import com.yohobuy.ufo.model.promotion.CouponSimpleBo; | @@ -5,6 +5,8 @@ import com.yohobuy.ufo.model.promotion.CouponSimpleBo; | ||
5 | import com.yohobuy.ufo.model.promotion.request.CouponListReq; | 5 | import com.yohobuy.ufo.model.promotion.request.CouponListReq; |
6 | import com.yohobuy.ufo.model.promotion.response.CouponListBo; | 6 | import com.yohobuy.ufo.model.promotion.response.CouponListBo; |
7 | import com.yohoufo.common.ApiResponse; | 7 | import com.yohoufo.common.ApiResponse; |
8 | +import com.yohoufo.common.annotation.IgnoreSession; | ||
9 | +import com.yohoufo.common.cache.Cachable; | ||
8 | import com.yohoufo.promotion.service.impl.CollectiveCouponService; | 10 | import com.yohoufo.promotion.service.impl.CollectiveCouponService; |
9 | import org.slf4j.Logger; | 11 | import org.slf4j.Logger; |
10 | import org.slf4j.LoggerFactory; | 12 | import org.slf4j.LoggerFactory; |
@@ -51,6 +53,8 @@ public class CouponCenterController { | @@ -51,6 +53,8 @@ public class CouponCenterController { | ||
51 | 53 | ||
52 | @RequestMapping(params = "method=ufo.couponTopListOfPrdDetail.list") | 54 | @RequestMapping(params = "method=ufo.couponTopListOfPrdDetail.list") |
53 | @ResponseBody | 55 | @ResponseBody |
56 | + @IgnoreSession | ||
57 | + @Cachable(expire = 120) | ||
54 | public ApiResponse couponTopListOfPrdDetail( | 58 | public ApiResponse couponTopListOfPrdDetail( |
55 | @RequestParam(value = "productId") Integer productId, | 59 | @RequestParam(value = "productId") Integer productId, |
56 | @RequestParam(value = "page", required = false, defaultValue = "1") int page, | 60 | @RequestParam(value = "page", required = false, defaultValue = "1") int page, |
@@ -30,6 +30,9 @@ public class CollectiveCouponService { | @@ -30,6 +30,9 @@ public class CollectiveCouponService { | ||
30 | @Autowired | 30 | @Autowired |
31 | private CouponViewMapper couponViewMapper; | 31 | private CouponViewMapper couponViewMapper; |
32 | 32 | ||
33 | + @Autowired | ||
34 | + private CouponHelperService couponHelperService; | ||
35 | + | ||
33 | public CouponListBo queryCouponListOfPrdDetail(CouponListReq req){ | 36 | public CouponListBo queryCouponListOfPrdDetail(CouponListReq req){ |
34 | int pageNum = req.getPage(); | 37 | int pageNum = req.getPage(); |
35 | int limit = req.getLimit(); | 38 | int limit = req.getLimit(); |
@@ -55,6 +58,9 @@ public class CollectiveCouponService { | @@ -55,6 +58,9 @@ public class CollectiveCouponService { | ||
55 | 58 | ||
56 | List<CouponSimpleBo> couponInfoListBo = datas.stream().map(coupon -> CouponConvert.do2CouponSimpleBo(coupon)) | 59 | List<CouponSimpleBo> couponInfoListBo = datas.stream().map(coupon -> CouponConvert.do2CouponSimpleBo(coupon)) |
57 | .collect(Collectors.toList()); | 60 | .collect(Collectors.toList()); |
61 | + | ||
62 | + couponInfoListBo = couponHelperService.filter(couponInfoListBo); | ||
63 | + | ||
58 | return couponInfoListBuilder.total(total) | 64 | return couponInfoListBuilder.total(total) |
59 | .totalPage(totalPage).coupons(couponInfoListBo) | 65 | .totalPage(totalPage).coupons(couponInfoListBo) |
60 | .build(); | 66 | .build(); |
1 | +package com.yohoufo.promotion.service.impl; | ||
2 | + | ||
3 | +import com.yohobuy.ufo.model.promotion.CouponSimpleBo; | ||
4 | +import org.springframework.stereotype.Service; | ||
5 | + | ||
6 | +import java.util.ArrayList; | ||
7 | +import java.util.List; | ||
8 | + | ||
9 | +/** | ||
10 | + * Created by Administrator on 2020/2/13. | ||
11 | + */ | ||
12 | +@Service | ||
13 | +public class CouponHelperService { | ||
14 | + /** | ||
15 | + * 3种类型的券,这个地方只展示两张券(2种类型的券) | ||
16 | + | ||
17 | + 逻辑是直降>满减>包邮 | ||
18 | + | ||
19 | + 展示的是每个类型金额最大的那个 | ||
20 | + 只展示2张券。。。 2张券分2个类型 | ||
21 | + 展示优惠金额最大的那个 | ||
22 | + | ||
23 | + * @param couponInfoListBo | ||
24 | + * @return | ||
25 | + */ | ||
26 | + public List<CouponSimpleBo> filter(List<CouponSimpleBo> couponInfoListBo) { | ||
27 | + List<CouponSimpleBo> result = new ArrayList<>(); | ||
28 | + | ||
29 | + | ||
30 | + | ||
31 | + return couponInfoListBo; | ||
32 | + } | ||
33 | +} |
-
Please register or login to post a comment