Authored by mali

闲鱼促销请求

... ... @@ -46,7 +46,9 @@ public class BidProductService {
* @param skupVo
*/
public void createSkup(BidStoragePriceVo skupVo) {
bidStoragePriceMapper.insert(checkAndConvert(skupVo));
BidStoragePrice bidStoragePrice = checkAndConvert(skupVo);
bidStoragePriceMapper.insert(bidStoragePrice);
publishBidPriceUpdateEvent(bidStoragePrice.getProductId()); // 重新设置缓存
}
/**
... ...
... ... @@ -3,6 +3,7 @@ package com.yohoufo.promotion.controller;
import com.yohobuy.ufo.model.promotion.response.promotionActivity.PromotionActivityRspBo;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.cache.Cachable;
import com.yohoufo.promotion.service.IActivityService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -34,9 +35,11 @@ public class ActivityController {
@RequestMapping(params = "method=ufo.promotion.activityListForProduct")
@ResponseBody
@IgnoreSession
public ApiResponse getPromotionActivityList(@RequestParam(value = "product_id", required = true) Integer productId) {
@Cachable(expire = 60)
public ApiResponse getPromotionActivityList(@RequestParam(value = "product_id", required = true) Integer productId,
@RequestParam(value = "business_client", required = false) String businessClient) {
logger.info("Method:ufo.promotion.activityListForProduct. enter, productId is {}", productId);
List<PromotionActivityRspBo> activityListForProduct = activityService.getActivityListForProduct(productId);
List<PromotionActivityRspBo> activityListForProduct = activityService.getActivityListForProduct(productId, businessClient);
logger.info("Method:ufo.promotion.activityListForProduct. out, productId is {}", productId);
return new ApiResponse.ApiResponseBuilder().code(200).data(activityListForProduct).build();
}
... ...
... ... @@ -11,7 +11,7 @@ public interface IActivityService {
* @param productId
* @return
*/
List<PromotionActivityRspBo> getActivityListForProduct(Integer productId);
List<PromotionActivityRspBo> getActivityListForProduct(Integer productId, String businessClient);
/**
* 获取当前促销活动详情
... ...
... ... @@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Service
public class ActivityServiceImpl implements IActivityService {
... ... @@ -48,11 +49,11 @@ public class ActivityServiceImpl implements IActivityService {
* @return
*/
@Override
public List<PromotionActivityRspBo> getActivityListForProduct(Integer productId) {
logger.info("getPromotionActivityList: enter. productId is {}", productId);
public List<PromotionActivityRspBo> getActivityListForProduct(Integer productId, String businessClient) {
logger.info("getPromotionActivityList: enter. productId is {}, businessClient is {}", productId, businessClient);
//获取当前正在进行中的活动
Activity activity = activityMapper.selectRunningActivity(DateUtil.getCurrentTimeSeconds());
if(activity == null){
if(activity == null || !Objects.equals(businessClient, activity.getBusinessClient())){
logger.info("getPromotionActivityList: no running activity. productId is {}", productId);
return new ArrayList<>();
}
... ...