Showing
4 changed files
with
13 additions
and
7 deletions
@@ -46,7 +46,9 @@ public class BidProductService { | @@ -46,7 +46,9 @@ public class BidProductService { | ||
46 | * @param skupVo | 46 | * @param skupVo |
47 | */ | 47 | */ |
48 | public void createSkup(BidStoragePriceVo skupVo) { | 48 | public void createSkup(BidStoragePriceVo skupVo) { |
49 | - bidStoragePriceMapper.insert(checkAndConvert(skupVo)); | 49 | + BidStoragePrice bidStoragePrice = checkAndConvert(skupVo); |
50 | + bidStoragePriceMapper.insert(bidStoragePrice); | ||
51 | + publishBidPriceUpdateEvent(bidStoragePrice.getProductId()); // 重新设置缓存 | ||
50 | } | 52 | } |
51 | 53 | ||
52 | /** | 54 | /** |
@@ -3,6 +3,7 @@ package com.yohoufo.promotion.controller; | @@ -3,6 +3,7 @@ package com.yohoufo.promotion.controller; | ||
3 | import com.yohobuy.ufo.model.promotion.response.promotionActivity.PromotionActivityRspBo; | 3 | import com.yohobuy.ufo.model.promotion.response.promotionActivity.PromotionActivityRspBo; |
4 | import com.yohoufo.common.ApiResponse; | 4 | import com.yohoufo.common.ApiResponse; |
5 | import com.yohoufo.common.annotation.IgnoreSession; | 5 | import com.yohoufo.common.annotation.IgnoreSession; |
6 | +import com.yohoufo.common.cache.Cachable; | ||
6 | import com.yohoufo.promotion.service.IActivityService; | 7 | import com.yohoufo.promotion.service.IActivityService; |
7 | import org.slf4j.Logger; | 8 | import org.slf4j.Logger; |
8 | import org.slf4j.LoggerFactory; | 9 | import org.slf4j.LoggerFactory; |
@@ -34,9 +35,11 @@ public class ActivityController { | @@ -34,9 +35,11 @@ public class ActivityController { | ||
34 | @RequestMapping(params = "method=ufo.promotion.activityListForProduct") | 35 | @RequestMapping(params = "method=ufo.promotion.activityListForProduct") |
35 | @ResponseBody | 36 | @ResponseBody |
36 | @IgnoreSession | 37 | @IgnoreSession |
37 | - public ApiResponse getPromotionActivityList(@RequestParam(value = "product_id", required = true) Integer productId) { | 38 | + @Cachable(expire = 60) |
39 | + public ApiResponse getPromotionActivityList(@RequestParam(value = "product_id", required = true) Integer productId, | ||
40 | + @RequestParam(value = "business_client", required = false) String businessClient) { | ||
38 | logger.info("Method:ufo.promotion.activityListForProduct. enter, productId is {}", productId); | 41 | logger.info("Method:ufo.promotion.activityListForProduct. enter, productId is {}", productId); |
39 | - List<PromotionActivityRspBo> activityListForProduct = activityService.getActivityListForProduct(productId); | 42 | + List<PromotionActivityRspBo> activityListForProduct = activityService.getActivityListForProduct(productId, businessClient); |
40 | logger.info("Method:ufo.promotion.activityListForProduct. out, productId is {}", productId); | 43 | logger.info("Method:ufo.promotion.activityListForProduct. out, productId is {}", productId); |
41 | return new ApiResponse.ApiResponseBuilder().code(200).data(activityListForProduct).build(); | 44 | return new ApiResponse.ApiResponseBuilder().code(200).data(activityListForProduct).build(); |
42 | } | 45 | } |
@@ -11,7 +11,7 @@ public interface IActivityService { | @@ -11,7 +11,7 @@ public interface IActivityService { | ||
11 | * @param productId | 11 | * @param productId |
12 | * @return | 12 | * @return |
13 | */ | 13 | */ |
14 | - List<PromotionActivityRspBo> getActivityListForProduct(Integer productId); | 14 | + List<PromotionActivityRspBo> getActivityListForProduct(Integer productId, String businessClient); |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * 获取当前促销活动详情 | 17 | * 获取当前促销活动详情 |
@@ -23,6 +23,7 @@ import org.springframework.stereotype.Service; | @@ -23,6 +23,7 @@ import org.springframework.stereotype.Service; | ||
23 | 23 | ||
24 | import java.util.ArrayList; | 24 | import java.util.ArrayList; |
25 | import java.util.List; | 25 | import java.util.List; |
26 | +import java.util.Objects; | ||
26 | 27 | ||
27 | @Service | 28 | @Service |
28 | public class ActivityServiceImpl implements IActivityService { | 29 | public class ActivityServiceImpl implements IActivityService { |
@@ -48,11 +49,11 @@ public class ActivityServiceImpl implements IActivityService { | @@ -48,11 +49,11 @@ public class ActivityServiceImpl implements IActivityService { | ||
48 | * @return | 49 | * @return |
49 | */ | 50 | */ |
50 | @Override | 51 | @Override |
51 | - public List<PromotionActivityRspBo> getActivityListForProduct(Integer productId) { | ||
52 | - logger.info("getPromotionActivityList: enter. productId is {}", productId); | 52 | + public List<PromotionActivityRspBo> getActivityListForProduct(Integer productId, String businessClient) { |
53 | + logger.info("getPromotionActivityList: enter. productId is {}, businessClient is {}", productId, businessClient); | ||
53 | //获取当前正在进行中的活动 | 54 | //获取当前正在进行中的活动 |
54 | Activity activity = activityMapper.selectRunningActivity(DateUtil.getCurrentTimeSeconds()); | 55 | Activity activity = activityMapper.selectRunningActivity(DateUtil.getCurrentTimeSeconds()); |
55 | - if(activity == null){ | 56 | + if(activity == null || !Objects.equals(businessClient, activity.getBusinessClient())){ |
56 | logger.info("getPromotionActivityList: no running activity. productId is {}", productId); | 57 | logger.info("getPromotionActivityList: no running activity. productId is {}", productId); |
57 | return new ArrayList<>(); | 58 | return new ArrayList<>(); |
58 | } | 59 | } |
-
Please register or login to post a comment