Merge branch 'hotfix_超时' into test6.8.6
Showing
6 changed files
with
65 additions
and
12 deletions
@@ -121,7 +121,10 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | @@ -121,7 +121,10 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { | ||
121 | BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(uid, orderCode); | 121 | BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(uid, orderCode); |
122 | int skup = buyerOrderGoods.getSkup(); | 122 | int skup = buyerOrderGoods.getSkup(); |
123 | SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); | 123 | SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); |
124 | - int deliveryHours = deliveryMinutesService.getDeliverMinutesThird_hours();//把分钟转小时 | 124 | + |
125 | + int ts = DateUtil.getCurrentTimeSecond(); | ||
126 | + int deliveryHours = deliveryMinutesService.getDeliverMinutesThird_hours(ts);//把分钟转小时 | ||
127 | + | ||
125 | inBoxFacade.sellerSkupPaidByBuyer(sellerOrderGoods,orderCode,deliveryHours); | 128 | inBoxFacade.sellerSkupPaidByBuyer(sellerOrderGoods,orderCode,deliveryHours); |
126 | 129 | ||
127 | //离发货截止12小时提醒 | 130 | //离发货截止12小时提醒 |
@@ -2,6 +2,7 @@ package com.yohoufo.order.service.handler; | @@ -2,6 +2,7 @@ package com.yohoufo.order.service.handler; | ||
2 | 2 | ||
3 | import com.google.common.eventbus.Subscribe; | 3 | import com.google.common.eventbus.Subscribe; |
4 | import com.yohoufo.common.alarm.IEventHandler; | 4 | import com.yohoufo.common.alarm.IEventHandler; |
5 | +import com.yohoufo.common.utils.DateUtil; | ||
5 | import com.yohoufo.order.event.DeliverNoticeEvent; | 6 | import com.yohoufo.order.event.DeliverNoticeEvent; |
6 | import com.yohoufo.order.mq.DelayTime; | 7 | import com.yohoufo.order.mq.DelayTime; |
7 | import com.yohoufo.order.mq.TopicConstants; | 8 | import com.yohoufo.order.mq.TopicConstants; |
@@ -35,7 +36,8 @@ public class DeliverNoticeAsyncHandler implements IEventHandler<DeliverNoticeEve | @@ -35,7 +36,8 @@ public class DeliverNoticeAsyncHandler implements IEventHandler<DeliverNoticeEve | ||
35 | @Override | 36 | @Override |
36 | @Subscribe | 37 | @Subscribe |
37 | public void handle(DeliverNoticeEvent event) { | 38 | public void handle(DeliverNoticeEvent event) { |
38 | - int minutes = deliveryMinutesService.getDeliverMinutesSecond(); | 39 | + int ts = DateUtil.getCurrentTimeSecond(); |
40 | + int minutes = deliveryMinutesService.getDeliverMinutesSecond(ts); | ||
39 | String topic = TopicConstants.ORDER_NOT_DELIVER_NOTICE; | 41 | String topic = TopicConstants.ORDER_NOT_DELIVER_NOTICE; |
40 | logger.info("in DeliverNoticeAsyncHandler handler, topic {},minutes {} ,msg {}",topic, minutes,event); | 42 | logger.info("in DeliverNoticeAsyncHandler handler, topic {},minutes {} ,msg {}",topic, minutes,event); |
41 | tradeMqSender.send(topic, event, minutes); | 43 | tradeMqSender.send(topic, event, minutes); |
@@ -38,13 +38,14 @@ public class SellerCancelDeliverHandler implements IEventHandler<SellerCancelDel | @@ -38,13 +38,14 @@ public class SellerCancelDeliverHandler implements IEventHandler<SellerCancelDel | ||
38 | @Override | 38 | @Override |
39 | @Subscribe | 39 | @Subscribe |
40 | public void handle(SellerCancelDeliverEvent event) { | 40 | public void handle(SellerCancelDeliverEvent event) { |
41 | - int minutes = deliveryMinutesService.getDeliverMinutesThird(); | 41 | + int ts = DateUtil.getCurrentTimeSecond(); |
42 | + int minutes = deliveryMinutesService.getDeliverMinutesThird(ts); | ||
42 | String topic = TopicConstants.SELLER_ORDER_AUTO_CANCEL_DELIVER; | 43 | String topic = TopicConstants.SELLER_ORDER_AUTO_CANCEL_DELIVER; |
43 | logger.info("Subscribe Buyer Confirm delay msg,topic {}, delay minutes {} , event {}",topic,minutes, event); | 44 | logger.info("Subscribe Buyer Confirm delay msg,topic {}, delay minutes {} , event {}",topic,minutes, event); |
44 | 45 | ||
45 | tradeMqSender.send(topic, event, minutes); | 46 | tradeMqSender.send(topic, event, minutes); |
46 | 47 | ||
47 | // 记录此订单的发货超时时间期限点 | 48 | // 记录此订单的发货超时时间期限点 |
48 | - orderOverTimeService.insertDeliveryTime(new OrderOverTime(event.getOrderCode(), DateUtil.getCurrentTimeSecond() + minutes * 60, minutes)); | 49 | + orderOverTimeService.insertDeliveryTime(new OrderOverTime(event.getOrderCode(), ts + minutes * 60, minutes)); |
49 | } | 50 | } |
50 | } | 51 | } |
@@ -28,30 +28,66 @@ import java.util.concurrent.TimeUnit; | @@ -28,30 +28,66 @@ import java.util.concurrent.TimeUnit; | ||
28 | public class DeliveryMinutesService { | 28 | public class DeliveryMinutesService { |
29 | private static final Logger logger = LoggerFactory.getLogger(DeliveryMinutesService.class); | 29 | private static final Logger logger = LoggerFactory.getLogger(DeliveryMinutesService.class); |
30 | 30 | ||
31 | + //缓存 | ||
32 | + private LocalCache localCache_onlineTimeEx = new LocalCache(); | ||
33 | + private static final String ONLINE_TIME_EX_CACHE_KEY = "sellerDeliverNewOnlineTimeExCacheKey"; | ||
34 | + | ||
35 | + @Autowired | ||
36 | + private ConfigReader configReader; | ||
37 | + | ||
38 | + | ||
31 | @Value("${mq.seller.deliverNotice.second}") | 39 | @Value("${mq.seller.deliverNotice.second}") |
32 | private int minutes_deliverNotice_second; | 40 | private int minutes_deliverNotice_second; |
33 | 41 | ||
42 | + @Value("${mq.seller.deliverNotice.old.second}") | ||
43 | + private int minutes_deliverNotice_second_old; | ||
44 | + | ||
34 | @Value("${mq.seller.deliverNotice.third}") | 45 | @Value("${mq.seller.deliverNotice.third}") |
35 | private int minutes_deliverNotice_third; | 46 | private int minutes_deliverNotice_third; |
36 | 47 | ||
37 | - public int getDeliverMinutesSecond(){ | 48 | + @Value("${mq.seller.deliverNotice.old.third}") |
49 | + private int minutes_deliverNotice_third_old; | ||
50 | + | ||
51 | + @PostConstruct | ||
52 | + private void init() { | ||
53 | + localCache_onlineTimeEx.init(ONLINE_TIME_EX_CACHE_KEY, 10, TimeUnit.MINUTES, (String s, Object o) -> { | ||
54 | + logger.info("init ONLINE_TIME_EX_CACHE_KEY s = {}, o = {}", s, o); | ||
55 | + return configReader.getInt("ufo.order.sellerDeliverNewOnlineTimeEx",1550073600); | ||
56 | + }); | ||
57 | + } | ||
58 | + | ||
59 | + private int getOnlineTime(){ | ||
60 | + Object value=localCache_onlineTimeEx.get(ONLINE_TIME_EX_CACHE_KEY); | ||
61 | + if(null == value) { | ||
62 | + return 1550073600; | ||
63 | + } | ||
64 | + return (Integer) value; | ||
65 | + } | ||
66 | + | ||
67 | + public int getDeliverMinutesSecond(int ts){ | ||
68 | + if(ts<getOnlineTime()){ | ||
69 | + return minutes_deliverNotice_second_old; | ||
70 | + } | ||
38 | return minutes_deliverNotice_second; | 71 | return minutes_deliverNotice_second; |
39 | } | 72 | } |
40 | 73 | ||
41 | - public int getDeliverMinutesThird(){ | 74 | + public int getDeliverMinutesThird(int ts){ |
75 | + if(ts<getOnlineTime()){ | ||
76 | + return minutes_deliverNotice_third_old; | ||
77 | + } | ||
42 | return minutes_deliverNotice_third; | 78 | return minutes_deliverNotice_third; |
43 | } | 79 | } |
44 | 80 | ||
45 | - public int getDeliverMinutesThird_hours(){ | ||
46 | - int minutes = getDeliverMinutesThird(); | 81 | + public int getDeliverMinutesThird_hours(int ts){ |
82 | + int minutes = getDeliverMinutesThird(ts); | ||
47 | return minutes/60 ; | 83 | return minutes/60 ; |
48 | } | 84 | } |
49 | 85 | ||
50 | - /** | ||
51 | - @Autowired | ||
52 | - private ConfigReader configReader; | ||
53 | 86 | ||
54 | - //缓存 | 87 | + |
88 | + | ||
89 | + | ||
90 | + /** | ||
55 | private LocalCache localCache_onlineTime = new LocalCache(); | 91 | private LocalCache localCache_onlineTime = new LocalCache(); |
56 | private static final String ONLINE_TIME_CACHE_KEY = "sellerDeliverNewOnlineTimeCacheKey"; | 92 | private static final String ONLINE_TIME_CACHE_KEY = "sellerDeliverNewOnlineTimeCacheKey"; |
57 | 93 |
@@ -128,6 +128,11 @@ mq.seller.deliverNotice.second=1440 | @@ -128,6 +128,11 @@ mq.seller.deliverNotice.second=1440 | ||
128 | #发货失败提醒 36*60 minutes | 128 | #发货失败提醒 36*60 minutes |
129 | mq.seller.deliverNotice.third=2160 | 129 | mq.seller.deliverNotice.third=2160 |
130 | 130 | ||
131 | +#old 二次发货提醒 108*60 minutes | ||
132 | +mq.seller.deliverNotice.old.second=6480 | ||
133 | +#old发货失败提醒 120*60 | ||
134 | +mq.seller.deliverNotice.old.third=7200 | ||
135 | + | ||
131 | yoho.gateway.url=http://api-test3.dev.yohocorp.com | 136 | yoho.gateway.url=http://api-test3.dev.yohocorp.com |
132 | 137 | ||
133 | ufo.platform.url=http://java-ufo-platform.test3.ingress.dev.yohocorp.com/ufoPlatform | 138 | 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} | @@ -103,6 +103,12 @@ mq.seller.deliverNotice.second=${mq.seller.deliverNotice.second} | ||
103 | #发货失败提醒 36*60 minutes 2160 | 103 | #发货失败提醒 36*60 minutes 2160 |
104 | mq.seller.deliverNotice.third=${mq.seller.deliverNotice.third} | 104 | mq.seller.deliverNotice.third=${mq.seller.deliverNotice.third} |
105 | 105 | ||
106 | +#old 二次发货提醒 108*60 minutes | ||
107 | +mq.seller.deliverNotice.old.second=${mq.seller.deliverNotice.old.second} | ||
108 | +#old发货失败提醒 120*60 | ||
109 | +mq.seller.deliverNotice.old.third=${mq.seller.deliverNotice.old.third} | ||
110 | + | ||
111 | + | ||
106 | yoho.gateway.url=${yoho.gateway.url} | 112 | yoho.gateway.url=${yoho.gateway.url} |
107 | 113 | ||
108 | offline.store.seller=${offline.store.seller} | 114 | offline.store.seller=${offline.store.seller} |
-
Please register or login to post a comment