Authored by LUOXC

add api_version filed

... ... @@ -5,10 +5,6 @@ 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.annotation.IgnoreSignature;
import com.yohoufo.common.annotation.InnerApi;
import com.yohoufo.common.cache.Cachable;
import com.yohoufo.promotion.service.impl.CollectiveCouponService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -18,8 +14,11 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collections;
import java.util.List;
import static java.util.Collections.emptyList;
/**
* Created by chenchao on 2020/2/10.
*/
... ... @@ -36,12 +35,12 @@ public class CouponCenterController {
@RequestMapping(params = "method=ufo.couponsInPrdDetail.list")
@ResponseBody
public ApiResponse couponListOfPrdDetail(
@RequestParam(value = "uid", required = false) Integer uid,
@RequestParam(value = "productId") Integer productId,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "limit", required = false, defaultValue = "20") int limit,
@RequestParam(value = "business_client", required = false,defaultValue = "ufo") String businessClient) {
@RequestParam(value = "api_version", required = false, defaultValue = "0") int apiVersion,
@RequestParam(value = "uid", required = false) Integer uid,
@RequestParam(value = "productId") Integer productId,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "limit", required = false, defaultValue = "20") int limit,
@RequestParam(value = "business_client", required = false, defaultValue = "ufo") String businessClient) {
CouponListReq req = CouponListReq.builder()
.uid(uid)
.showReceive(true)
... ... @@ -52,13 +51,21 @@ public class CouponCenterController {
.businessClient(businessClient)
.build();
logger.info("in ufo.couponsOfPrdDetail.list, req:{}", req);
CouponListBo listBo = collectiveCouponService.queryCouponListOfPrdDetail(req);
CouponListBo listBo = apiVersion <= 0 ? emptyCouponList(req) : collectiveCouponService.queryCouponListOfPrdDetail(req);
logger.info("exit ufo.couponsOfPrdDetail.list, req {}, response {}", req, listBo);
return new ApiResponse.ApiResponseBuilder().code(200).data(listBo).build();
}
private CouponListBo emptyCouponList(CouponListReq req) {
return CouponListBo.builder()
.page(req.getPage())
.limit(req.getLimit())
.build();
}
/**
* 详情页聚合时使用
*
* @param productId
* @param page
* @param limit
... ... @@ -67,11 +74,11 @@ public class CouponCenterController {
*/
@RequestMapping(params = "method=ufo.couponTopListOfPrdDetail.list")
public ApiResponse couponTopListOfPrdDetail(
@RequestParam(value = "api_version", required = false, defaultValue = "0") int apiVersion,
@RequestParam(value = "productId") Integer productId,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "limit", required = false, defaultValue = "2") int limit,
@RequestParam(value = "business_client", required = false,defaultValue = "ufo") String businessClient) {
@RequestParam(value = "business_client", required = false, defaultValue = "ufo") String businessClient) {
CouponListReq req = CouponListReq.builder()
.showReceive(false)
.productId(productId)
... ... @@ -81,7 +88,7 @@ public class CouponCenterController {
.businessClient(businessClient)
.build();
logger.info("in couponTopListOfPrdDetail, req:{}", req);
List<CouponSimpleBo> resp = collectiveCouponService.getCouponTopListOfPrdDetail(req);
List<CouponSimpleBo> resp = apiVersion <= 0 ? emptyList() : collectiveCouponService.getCouponTopListOfPrdDetail(req);
logger.info("exit couponTopListOfPrdDetail, req {}, response {}", req, resp);
return new ApiResponse.ApiResponseBuilder().code(200).data(resp).build();
}
... ...