Authored by qinchao

Merge branch 'hotfix_超时' into test6.8.6

... ... @@ -121,7 +121,10 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(uid, orderCode);
int skup = buyerOrderGoods.getSkup();
SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
int deliveryHours = deliveryMinutesService.getDeliverMinutesThird_hours();//把分钟转小时
int ts = DateUtil.getCurrentTimeSecond();
int deliveryHours = deliveryMinutesService.getDeliverMinutesThird_hours(ts);//把分钟转小时
inBoxFacade.sellerSkupPaidByBuyer(sellerOrderGoods,orderCode,deliveryHours);
//离发货截止12小时提醒
... ...
... ... @@ -2,6 +2,7 @@ package com.yohoufo.order.service.handler;
import com.google.common.eventbus.Subscribe;
import com.yohoufo.common.alarm.IEventHandler;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.order.event.DeliverNoticeEvent;
import com.yohoufo.order.mq.DelayTime;
import com.yohoufo.order.mq.TopicConstants;
... ... @@ -35,7 +36,8 @@ public class DeliverNoticeAsyncHandler implements IEventHandler<DeliverNoticeEve
@Override
@Subscribe
public void handle(DeliverNoticeEvent event) {
int minutes = deliveryMinutesService.getDeliverMinutesSecond();
int ts = DateUtil.getCurrentTimeSecond();
int minutes = deliveryMinutesService.getDeliverMinutesSecond(ts);
String topic = TopicConstants.ORDER_NOT_DELIVER_NOTICE;
logger.info("in DeliverNoticeAsyncHandler handler, topic {},minutes {} ,msg {}",topic, minutes,event);
tradeMqSender.send(topic, event, minutes);
... ...
... ... @@ -38,13 +38,14 @@ public class SellerCancelDeliverHandler implements IEventHandler<SellerCancelDel
@Override
@Subscribe
public void handle(SellerCancelDeliverEvent event) {
int minutes = deliveryMinutesService.getDeliverMinutesThird();
int ts = DateUtil.getCurrentTimeSecond();
int minutes = deliveryMinutesService.getDeliverMinutesThird(ts);
String topic = TopicConstants.SELLER_ORDER_AUTO_CANCEL_DELIVER;
logger.info("Subscribe Buyer Confirm delay msg,topic {}, delay minutes {} , event {}",topic,minutes, event);
tradeMqSender.send(topic, event, minutes);
// 记录此订单的发货超时时间期限点
orderOverTimeService.insertDeliveryTime(new OrderOverTime(event.getOrderCode(), DateUtil.getCurrentTimeSecond() + minutes * 60, minutes));
orderOverTimeService.insertDeliveryTime(new OrderOverTime(event.getOrderCode(), ts + minutes * 60, minutes));
}
}
... ...
... ... @@ -28,30 +28,66 @@ import java.util.concurrent.TimeUnit;
public class DeliveryMinutesService {
private static final Logger logger = LoggerFactory.getLogger(DeliveryMinutesService.class);
//缓存
private LocalCache localCache_onlineTimeEx = new LocalCache();
private static final String ONLINE_TIME_EX_CACHE_KEY = "sellerDeliverNewOnlineTimeExCacheKey";
@Autowired
private ConfigReader configReader;
@Value("${mq.seller.deliverNotice.second}")
private int minutes_deliverNotice_second;
@Value("${mq.seller.deliverNotice.old.second}")
private int minutes_deliverNotice_second_old;
@Value("${mq.seller.deliverNotice.third}")
private int minutes_deliverNotice_third;
public int getDeliverMinutesSecond(){
@Value("${mq.seller.deliverNotice.old.third}")
private int minutes_deliverNotice_third_old;
@PostConstruct
private void init() {
localCache_onlineTimeEx.init(ONLINE_TIME_EX_CACHE_KEY, 10, TimeUnit.MINUTES, (String s, Object o) -> {
logger.info("init ONLINE_TIME_EX_CACHE_KEY s = {}, o = {}", s, o);
return configReader.getInt("ufo.order.sellerDeliverNewOnlineTimeEx",1550073600);
});
}
private int getOnlineTime(){
Object value=localCache_onlineTimeEx.get(ONLINE_TIME_EX_CACHE_KEY);
if(null == value) {
return 1550073600;
}
return (Integer) value;
}
public int getDeliverMinutesSecond(int ts){
if(ts<getOnlineTime()){
return minutes_deliverNotice_second_old;
}
return minutes_deliverNotice_second;
}
public int getDeliverMinutesThird(){
public int getDeliverMinutesThird(int ts){
if(ts<getOnlineTime()){
return minutes_deliverNotice_third_old;
}
return minutes_deliverNotice_third;
}
public int getDeliverMinutesThird_hours(){
int minutes = getDeliverMinutesThird();
public int getDeliverMinutesThird_hours(int ts){
int minutes = getDeliverMinutesThird(ts);
return minutes/60 ;
}
/**
@Autowired
private ConfigReader configReader;
//缓存
/**
private LocalCache localCache_onlineTime = new LocalCache();
private static final String ONLINE_TIME_CACHE_KEY = "sellerDeliverNewOnlineTimeCacheKey";
... ...
... ... @@ -128,6 +128,11 @@ mq.seller.deliverNotice.second=1440
#发货失败提醒 36*60 minutes
mq.seller.deliverNotice.third=2160
#old 二次发货提醒 108*60 minutes
mq.seller.deliverNotice.old.second=6480
#old发货失败提醒 120*60
mq.seller.deliverNotice.old.third=7200
yoho.gateway.url=http://api-test3.dev.yohocorp.com
ufo.platform.url=http://java-ufo-platform.test3.ingress.dev.yohocorp.com/ufoPlatform
... ...
... ... @@ -103,6 +103,12 @@ mq.seller.deliverNotice.second=${mq.seller.deliverNotice.second}
#发货失败提醒 36*60 minutes 2160
mq.seller.deliverNotice.third=${mq.seller.deliverNotice.third}
#old 二次发货提醒 108*60 minutes
mq.seller.deliverNotice.old.second=${mq.seller.deliverNotice.old.second}
#old发货失败提醒 120*60
mq.seller.deliverNotice.old.third=${mq.seller.deliverNotice.old.third}
yoho.gateway.url=${yoho.gateway.url}
offline.store.seller=${offline.store.seller}
\ No newline at end of file
... ...