Authored by 马力

券增加类型字段

... ... @@ -5,6 +5,8 @@ import com.yohobuy.ufo.model.promotion.CouponSimpleBo;
import com.yohobuy.ufo.model.promotion.request.CouponListReq;
import com.yohobuy.ufo.model.promotion.response.CouponListBo;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.cache.Cachable;
import com.yohoufo.promotion.service.impl.CollectiveCouponService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -51,6 +53,8 @@ public class CouponCenterController {
@RequestMapping(params = "method=ufo.couponTopListOfPrdDetail.list")
@ResponseBody
@IgnoreSession
@Cachable(expire = 120)
public ApiResponse couponTopListOfPrdDetail(
@RequestParam(value = "productId") Integer productId,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
... ...
... ... @@ -30,6 +30,9 @@ public class CollectiveCouponService {
@Autowired
private CouponViewMapper couponViewMapper;
@Autowired
private CouponHelperService couponHelperService;
public CouponListBo queryCouponListOfPrdDetail(CouponListReq req){
int pageNum = req.getPage();
int limit = req.getLimit();
... ... @@ -55,6 +58,9 @@ public class CollectiveCouponService {
List<CouponSimpleBo> couponInfoListBo = datas.stream().map(coupon -> CouponConvert.do2CouponSimpleBo(coupon))
.collect(Collectors.toList());
couponInfoListBo = couponHelperService.filter(couponInfoListBo);
return couponInfoListBuilder.total(total)
.totalPage(totalPage).coupons(couponInfoListBo)
.build();
... ...
package com.yohoufo.promotion.service.impl;
import com.yohobuy.ufo.model.promotion.CouponSimpleBo;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Administrator on 2020/2/13.
*/
@Service
public class CouponHelperService {
/**
* 3种类型的券,这个地方只展示两张券(2种类型的券)
逻辑是直降>满减>包邮
展示的是每个类型金额最大的那个
只展示2张券。。。 2张券分2个类型
展示优惠金额最大的那个
* @param couponInfoListBo
* @return
*/
public List<CouponSimpleBo> filter(List<CouponSimpleBo> couponInfoListBo) {
List<CouponSimpleBo> result = new ArrayList<>();
return couponInfoListBo;
}
}
... ...