Authored by LUOXC

Merge branch 'master' into test6.9.14

# Conflicts:
#	product/src/main/java/com/yohoufo/product/service/impl/StoragePriceService.java
package com.yohoufo.order.service.seller.processor;
import com.yohoufo.common.alarm.CommonAlarmEventPublisher;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.SellerTaskMapper;
import com.yohoufo.dal.order.model.SellerTask;
import com.yohoufo.order.model.dto.*;
import com.yohoufo.order.model.dto.SellerTaskDTO;
import com.yohoufo.order.model.dto.SellerTaskResult;
import com.yohoufo.order.service.handler.ISellerTaskHandler;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
... ... @@ -23,7 +23,7 @@ public class SellerTaskProcessor {
private SellerTaskMapper sellerTaskMapper;
public SellerTaskResult process(SellerTaskDTO taskDto) {
if (taskDto == null){
if (taskDto == null) {
return null;
}
int uid = taskDto.getUid();
... ... @@ -52,11 +52,11 @@ public class SellerTaskProcessor {
private SellerTaskResult doProcess(SellerTaskDTO sbpDto) {
ISellerTaskHandler handler = sbpDto.getTaskHandler();
SellerTaskResult taskResult = handler.handle(sbpDto);
SellerTaskResult taskResult = handler.handle(sbpDto);
if (taskResult == null || taskResult.failCnt > 0) {
//任务失败或者有部分失败
CommonAlarmEventPublisher.publish("seller batch operation fail", "ufo.seller.batchTask",
"uid=" + sbpDto.getUid() + ",taskId=" + sbpDto.getTaskId() + ",taskType=" + sbpDto.getTaskType());
// 任务失败或者有部分失败, 改成异步检查数据一致性
log.info("[{}-{}] seller batch operation fail, taskType is {} and taskMeta is {}",
sbpDto.getUid(), sbpDto.getTaskId(), sbpDto.getTaskType(), sbpDto.getTaskMeta());
}
return taskResult;
}
... ...
... ... @@ -18,6 +18,7 @@ import com.yohoufo.product.cache.UfoProductCacheKeyEnum;
import com.yohoufo.product.cache.UfoProductCacheService;
import com.yohoufo.product.controller.ProductController;
import com.yohoufo.product.event.BidStoragePriceUpdateEvent;
import com.yohoufo.product.event.StoragePriceUpdateEvent;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -263,7 +264,13 @@ public class BidProductService {
public void publishBidPriceUpdateEvent(Integer productId) {
logger.info("method com.yohoufo.product.service.impl.BidProductService.publishBidPriceUpdateEvent in productId is 【{}】", productId);
BidStoragePriceUpdateEvent bidStoragePriceUpdateEvent = new BidStoragePriceUpdateEvent(this::reSetBidStoragePriceCache);
//BidStoragePriceUpdateEvent bidStoragePriceUpdateEvent = new BidStoragePriceUpdateEvent(this::reSetBidStoragePriceCache);
BidStoragePriceUpdateEvent bidStoragePriceUpdateEvent = new BidStoragePriceUpdateEvent(event->{
productCacheService.deleteCacheByString(UfoProductCacheKeyEnum.BIE_STORAGE_PRICE_IN_STOCK_INFO_KEY, productId.toString());
return true;
});
bidStoragePriceUpdateEvent.setProductId(productId);
EventBusPublisher.publishEvent(bidStoragePriceUpdateEvent);
... ...
... ... @@ -107,7 +107,11 @@ public class StoragePriceService {
public void publishPriceUpdateEvent(Integer productId) {
LOGGER.info("method com.yohoufo.product.service.impl.StoragePriceService.publishPriceUpdateEvent in productId is 【{}】", productId);
StoragePriceUpdateEvent storagePriceUpdateEvent = new StoragePriceUpdateEvent(this::reSetStoragePriceCache);
//StoragePriceUpdateEvent storagePriceUpdateEvent = new StoragePriceUpdateEvent(this::reSetStoragePriceCache);
StoragePriceUpdateEvent storagePriceUpdateEvent = new StoragePriceUpdateEvent(event->{
productCacheService.deleteCacheByString(UfoProductCacheKeyEnum.STORAGE_PRICE_IN_STOCK_INFO_KEY, productId.toString());
return true;
});
storagePriceUpdateEvent.setProductId(productId);
EventBusPublisher.publishEvent(storagePriceUpdateEvent);
}
... ...