Authored by LUOXC

Merge branch 'master' into test6.9.14

# Conflicts:
#	product/src/main/java/com/yohoufo/product/service/impl/StoragePriceService.java
1 package com.yohoufo.order.service.seller.processor; 1 package com.yohoufo.order.service.seller.processor;
2 2
3 -import com.yohoufo.common.alarm.CommonAlarmEventPublisher;  
4 import com.yohoufo.common.utils.DateUtil; 3 import com.yohoufo.common.utils.DateUtil;
5 import com.yohoufo.dal.order.SellerTaskMapper; 4 import com.yohoufo.dal.order.SellerTaskMapper;
6 import com.yohoufo.dal.order.model.SellerTask; 5 import com.yohoufo.dal.order.model.SellerTask;
7 -import com.yohoufo.order.model.dto.*; 6 +import com.yohoufo.order.model.dto.SellerTaskDTO;
  7 +import com.yohoufo.order.model.dto.SellerTaskResult;
8 import com.yohoufo.order.service.handler.ISellerTaskHandler; 8 import com.yohoufo.order.service.handler.ISellerTaskHandler;
9 import com.yohoufo.order.utils.LoggerUtils; 9 import com.yohoufo.order.utils.LoggerUtils;
10 import org.slf4j.Logger; 10 import org.slf4j.Logger;
@@ -23,7 +23,7 @@ public class SellerTaskProcessor { @@ -23,7 +23,7 @@ public class SellerTaskProcessor {
23 private SellerTaskMapper sellerTaskMapper; 23 private SellerTaskMapper sellerTaskMapper;
24 24
25 public SellerTaskResult process(SellerTaskDTO taskDto) { 25 public SellerTaskResult process(SellerTaskDTO taskDto) {
26 - if (taskDto == null){ 26 + if (taskDto == null) {
27 return null; 27 return null;
28 } 28 }
29 int uid = taskDto.getUid(); 29 int uid = taskDto.getUid();
@@ -54,9 +54,9 @@ public class SellerTaskProcessor { @@ -54,9 +54,9 @@ public class SellerTaskProcessor {
54 ISellerTaskHandler handler = sbpDto.getTaskHandler(); 54 ISellerTaskHandler handler = sbpDto.getTaskHandler();
55 SellerTaskResult taskResult = handler.handle(sbpDto); 55 SellerTaskResult taskResult = handler.handle(sbpDto);
56 if (taskResult == null || taskResult.failCnt > 0) { 56 if (taskResult == null || taskResult.failCnt > 0) {
57 - //任务失败或者有部分失败  
58 - CommonAlarmEventPublisher.publish("seller batch operation fail", "ufo.seller.batchTask",  
59 - "uid=" + sbpDto.getUid() + ",taskId=" + sbpDto.getTaskId() + ",taskType=" + sbpDto.getTaskType()); 57 + // 任务失败或者有部分失败, 改成异步检查数据一致性
  58 + log.info("[{}-{}] seller batch operation fail, taskType is {} and taskMeta is {}",
  59 + sbpDto.getUid(), sbpDto.getTaskId(), sbpDto.getTaskType(), sbpDto.getTaskMeta());
60 } 60 }
61 return taskResult; 61 return taskResult;
62 } 62 }
@@ -18,6 +18,7 @@ import com.yohoufo.product.cache.UfoProductCacheKeyEnum; @@ -18,6 +18,7 @@ import com.yohoufo.product.cache.UfoProductCacheKeyEnum;
18 import com.yohoufo.product.cache.UfoProductCacheService; 18 import com.yohoufo.product.cache.UfoProductCacheService;
19 import com.yohoufo.product.controller.ProductController; 19 import com.yohoufo.product.controller.ProductController;
20 import com.yohoufo.product.event.BidStoragePriceUpdateEvent; 20 import com.yohoufo.product.event.BidStoragePriceUpdateEvent;
  21 +import com.yohoufo.product.event.StoragePriceUpdateEvent;
21 import org.apache.commons.collections.CollectionUtils; 22 import org.apache.commons.collections.CollectionUtils;
22 import org.slf4j.Logger; 23 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory; 24 import org.slf4j.LoggerFactory;
@@ -263,7 +264,13 @@ public class BidProductService { @@ -263,7 +264,13 @@ public class BidProductService {
263 264
264 public void publishBidPriceUpdateEvent(Integer productId) { 265 public void publishBidPriceUpdateEvent(Integer productId) {
265 logger.info("method com.yohoufo.product.service.impl.BidProductService.publishBidPriceUpdateEvent in productId is 【{}】", productId); 266 logger.info("method com.yohoufo.product.service.impl.BidProductService.publishBidPriceUpdateEvent in productId is 【{}】", productId);
266 - BidStoragePriceUpdateEvent bidStoragePriceUpdateEvent = new BidStoragePriceUpdateEvent(this::reSetBidStoragePriceCache); 267 + //BidStoragePriceUpdateEvent bidStoragePriceUpdateEvent = new BidStoragePriceUpdateEvent(this::reSetBidStoragePriceCache);
  268 +
  269 + BidStoragePriceUpdateEvent bidStoragePriceUpdateEvent = new BidStoragePriceUpdateEvent(event->{
  270 + productCacheService.deleteCacheByString(UfoProductCacheKeyEnum.BIE_STORAGE_PRICE_IN_STOCK_INFO_KEY, productId.toString());
  271 + return true;
  272 + });
  273 +
267 bidStoragePriceUpdateEvent.setProductId(productId); 274 bidStoragePriceUpdateEvent.setProductId(productId);
268 EventBusPublisher.publishEvent(bidStoragePriceUpdateEvent); 275 EventBusPublisher.publishEvent(bidStoragePriceUpdateEvent);
269 276
@@ -107,7 +107,11 @@ public class StoragePriceService { @@ -107,7 +107,11 @@ public class StoragePriceService {
107 public void publishPriceUpdateEvent(Integer productId) { 107 public void publishPriceUpdateEvent(Integer productId) {
108 LOGGER.info("method com.yohoufo.product.service.impl.StoragePriceService.publishPriceUpdateEvent in productId is 【{}】", productId); 108 LOGGER.info("method com.yohoufo.product.service.impl.StoragePriceService.publishPriceUpdateEvent in productId is 【{}】", productId);
109 109
110 - StoragePriceUpdateEvent storagePriceUpdateEvent = new StoragePriceUpdateEvent(this::reSetStoragePriceCache); 110 + //StoragePriceUpdateEvent storagePriceUpdateEvent = new StoragePriceUpdateEvent(this::reSetStoragePriceCache);
  111 + StoragePriceUpdateEvent storagePriceUpdateEvent = new StoragePriceUpdateEvent(event->{
  112 + productCacheService.deleteCacheByString(UfoProductCacheKeyEnum.STORAGE_PRICE_IN_STOCK_INFO_KEY, productId.toString());
  113 + return true;
  114 + });
111 storagePriceUpdateEvent.setProductId(productId); 115 storagePriceUpdateEvent.setProductId(productId);
112 EventBusPublisher.publishEvent(storagePriceUpdateEvent); 116 EventBusPublisher.publishEvent(storagePriceUpdateEvent);
113 } 117 }