Authored by qinchao

发货提醒设置为动态设置

@@ -35,6 +35,7 @@ import org.apache.commons.lang3.StringUtils; @@ -35,6 +35,7 @@ import org.apache.commons.lang3.StringUtils;
35 import org.slf4j.Logger; 35 import org.slf4j.Logger;
36 import org.slf4j.LoggerFactory; 36 import org.slf4j.LoggerFactory;
37 import org.springframework.beans.factory.annotation.Autowired; 37 import org.springframework.beans.factory.annotation.Autowired;
  38 +import org.springframework.beans.factory.annotation.Value;
38 import org.springframework.stereotype.Service; 39 import org.springframework.stereotype.Service;
39 40
40 import java.util.Arrays; 41 import java.util.Arrays;
@@ -70,6 +71,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { @@ -70,6 +71,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
70 @Autowired 71 @Autowired
71 private OrderStatusFlowService orderStatusFlowService; 72 private OrderStatusFlowService orderStatusFlowService;
72 73
  74 + @Value("${mq.seller.deliverNotice.third}")
  75 + private int deliverMinutes ;
  76 +
73 /** 77 /**
74 * 更新订单状态 78 * 更新订单状态
75 * @param orderInfo 79 * @param orderInfo
@@ -115,8 +119,10 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { @@ -115,8 +119,10 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
115 BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(uid, orderCode); 119 BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(uid, orderCode);
116 int skup = buyerOrderGoods.getSkup(); 120 int skup = buyerOrderGoods.getSkup();
117 SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); 121 SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
118 - inBoxFacade.sellerSkupPaidByBuyer(sellerOrderGoods,orderCode); 122 + int deliveryHours = deliverMinutes/60;//把分钟转小时
  123 + inBoxFacade.sellerSkupPaidByBuyer(sellerOrderGoods,orderCode,deliveryHours);
119 124
  125 + //离发货截止12小时提醒
120 DeliverNoticeEvent deliverNoticeEvent = DeliverNoticeEvent.builder().skup(sellerOrderGoods.getId()) 126 DeliverNoticeEvent deliverNoticeEvent = DeliverNoticeEvent.builder().skup(sellerOrderGoods.getId())
121 .sellerOrderGoods(sellerOrderGoods) 127 .sellerOrderGoods(sellerOrderGoods)
122 .sellerUid(sellerUid).buyerUid(uid).prdName(sellerOrderGoods.getProductName()).orderCode(orderCode).build(); 128 .sellerUid(sellerUid).buyerUid(uid).prdName(sellerOrderGoods.getProductName()).orderCode(orderCode).build();
@@ -131,7 +137,7 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { @@ -131,7 +137,7 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
131 EventBusPublisher.publishEvent(event); 137 EventBusPublisher.publishEvent(event);
132 138
133 139
134 - inBoxFacade.buyerFinishPaid(orderInfo.getUid(), orderInfo.getOrderCode()); 140 + inBoxFacade.buyerFinishPaid(orderInfo.getUid(), orderInfo.getOrderCode(),deliveryHours);
135 141
136 cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), 142 cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()),
137 CacheKeyBuilder.orderListKey(uid, TabType.BUY.getValue()), 143 CacheKeyBuilder.orderListKey(uid, TabType.BUY.getValue()),
@@ -9,6 +9,7 @@ import com.yohoufo.order.mq.producer.TradeMqSender; @@ -9,6 +9,7 @@ import com.yohoufo.order.mq.producer.TradeMqSender;
9 import org.slf4j.Logger; 9 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory; 10 import org.slf4j.LoggerFactory;
11 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.beans.factory.annotation.Value;
12 import org.springframework.stereotype.Component; 13 import org.springframework.stereotype.Component;
13 14
14 /** 15 /**
@@ -21,7 +22,10 @@ public class DeliverNoticeAsyncHandler implements IEventHandler<DeliverNoticeEve @@ -21,7 +22,10 @@ public class DeliverNoticeAsyncHandler implements IEventHandler<DeliverNoticeEve
21 22
22 final Logger logger = LoggerFactory.getLogger(getClass()); 23 final Logger logger = LoggerFactory.getLogger(getClass());
23 24
24 - public static final int DELAY_MINUTES_24_HOURS = DelayTime.MINUTES_24_HOURS; 25 + //public static final int DELAY_MINUTES_24_HOURS = DelayTime.MINUTES_24_HOURS;
  26 +
  27 + @Value("${mq.seller.deliverNotice.second}")
  28 + private int minutes ;
25 29
26 @Autowired 30 @Autowired
27 private TradeMqSender tradeMqSender; 31 private TradeMqSender tradeMqSender;
@@ -30,7 +34,7 @@ public class DeliverNoticeAsyncHandler implements IEventHandler<DeliverNoticeEve @@ -30,7 +34,7 @@ public class DeliverNoticeAsyncHandler implements IEventHandler<DeliverNoticeEve
30 @Override 34 @Override
31 @Subscribe 35 @Subscribe
32 public void handle(DeliverNoticeEvent event) { 36 public void handle(DeliverNoticeEvent event) {
33 - logger.info("in DeliverNoticeAsyncHandler handler, msg {}", event);  
34 - tradeMqSender.send(TopicConstants.ORDER_NOT_DELIVER_NOTICE, event, DELAY_MINUTES_24_HOURS); 37 + logger.info("in DeliverNoticeAsyncHandler handler, msg {},minutes {}", event,minutes);
  38 + tradeMqSender.send(TopicConstants.ORDER_NOT_DELIVER_NOTICE, event, minutes);
35 } 39 }
36 } 40 }
@@ -8,8 +8,8 @@ import com.yohoufo.order.mq.TopicConstants; @@ -8,8 +8,8 @@ import com.yohoufo.order.mq.TopicConstants;
8 import com.yohoufo.order.mq.producer.TradeMqSender; 8 import com.yohoufo.order.mq.producer.TradeMqSender;
9 import com.yohoufo.order.utils.LoggerUtils; 9 import com.yohoufo.order.utils.LoggerUtils;
10 import org.slf4j.Logger; 10 import org.slf4j.Logger;
11 -import org.slf4j.LoggerFactory;  
12 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.beans.factory.annotation.Value;
13 import org.springframework.stereotype.Component; 13 import org.springframework.stereotype.Component;
14 14
15 /** 15 /**
@@ -19,16 +19,19 @@ import org.springframework.stereotype.Component; @@ -19,16 +19,19 @@ import org.springframework.stereotype.Component;
19 public class SellerCancelDeliverHandler implements IEventHandler<SellerCancelDeliverEvent> { 19 public class SellerCancelDeliverHandler implements IEventHandler<SellerCancelDeliverEvent> {
20 20
21 private final Logger logger = LoggerUtils.getSellerOrderLogger(); 21 private final Logger logger = LoggerUtils.getSellerOrderLogger();
22 - public static final int DELAY_MINUTES_36_HOURS = DelayTime.MINUTES_36_HOURS; 22 + //public static final int DELAY_MINUTES_36_HOURS = DelayTime.MINUTES_36_HOURS;
23 23
24 @Autowired 24 @Autowired
25 private TradeMqSender tradeMqSender; 25 private TradeMqSender tradeMqSender;
26 26
  27 + @Value("${mq.seller.deliverNotice.third}")
  28 + private int minutes ;
  29 +
27 @Override 30 @Override
28 @Subscribe 31 @Subscribe
29 public void handle(SellerCancelDeliverEvent event) { 32 public void handle(SellerCancelDeliverEvent event) {
30 - logger.info("Subscribe Buyer Confirm delay msg, event {}", event); 33 + logger.info("Subscribe Buyer Confirm delay msg, event {},minutes {}", event,minutes);
31 34
32 - tradeMqSender.send(TopicConstants.SELLER_ORDER_AUTO_CANCEL_DELIVER, event, DELAY_MINUTES_36_HOURS); 35 + tradeMqSender.send(TopicConstants.SELLER_ORDER_AUTO_CANCEL_DELIVER, event, minutes);
33 } 36 }
34 } 37 }
@@ -75,11 +75,11 @@ public class InBoxFacade { @@ -75,11 +75,11 @@ public class InBoxFacade {
75 * @param buyerUid 75 * @param buyerUid
76 * @param orderCode 76 * @param orderCode
77 */ 77 */
78 - public void buyerFinishPaid(int buyerUid, long orderCode) { 78 + public void buyerFinishPaid(int buyerUid, long orderCode,int deliveryHours) {
79 try { 79 try {
80 executorService.execute(() -> { 80 executorService.execute(() -> {
81 InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_NOTIFIED_SELLER; 81 InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_NOTIFIED_SELLER;
82 - String params = buildParams(orderCode); 82 + String params = buildParams(orderCode,deliveryHours);
83 InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt); 83 InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
84 84
85 InBoxResponse resp = inBoxSDK.addInbox(req); 85 InBoxResponse resp = inBoxSDK.addInbox(req);
@@ -633,14 +633,14 @@ public class InBoxFacade { @@ -633,14 +633,14 @@ public class InBoxFacade {
633 * 633 *
634 * @param sog SellerOrderGoods 634 * @param sog SellerOrderGoods
635 */ 635 */
636 - public void sellerSkupPaidByBuyer(SellerOrderGoods sog,long orderCode) { 636 + public void sellerSkupPaidByBuyer(SellerOrderGoods sog,long orderCode,int deliveryHours) {
637 Integer sellerUid = sog.getUid(); 637 Integer sellerUid = sog.getUid();
638 String prdName = sog.getProductName(); 638 String prdName = sog.getProductName();
639 String sizeName = sog.getSizeName(); 639 String sizeName = sog.getSizeName();
640 try { 640 try {
641 executorService.execute(() -> { 641 executorService.execute(() -> {
642 InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.SALE_SEND; 642 InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.SALE_SEND;
643 - String params = buildParams(prdName, sizeName); 643 + String params = buildParams(prdName, sizeName,deliveryHours);
644 InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt); 644 InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
645 645
646 InBoxResponse resp = inBoxSDK.addInbox(req); 646 InBoxResponse resp = inBoxSDK.addInbox(req);
@@ -654,7 +654,7 @@ public class InBoxFacade { @@ -654,7 +654,7 @@ public class InBoxFacade {
654 return; 654 return;
655 } 655 }
656 List<String> mobileList = Arrays.asList(phone); 656 List<String> mobileList = Arrays.asList(phone);
657 - String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND.getContent(),prdName,orderCode); 657 + String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND.getContent(),prdName,orderCode,deliveryHours);
658 sendSmsService.smsSendByMobile(content, mobileList); 658 sendSmsService.smsSendByMobile(content, mobileList);
659 logger.info("record sellerSkupPaidByBuyer inbox sms msg,sellerUid {}, prdName {},orderCode {}", 659 logger.info("record sellerSkupPaidByBuyer inbox sms msg,sellerUid {}, prdName {},orderCode {}",
660 sellerUid, prdName,orderCode); 660 sellerUid, prdName,orderCode);
@@ -122,6 +122,11 @@ rabbit_host=192.168.102.45:5672 @@ -122,6 +122,11 @@ rabbit_host=192.168.102.45:5672
122 rabbit_user=yoho 122 rabbit_user=yoho
123 rabbit_password=yoho 123 rabbit_password=yoho
124 124
  125 +#二次发货提醒 108*60 minutes
  126 +mq.seller.deliverNotice.second=6480
  127 +#发货失败提醒 120*60 minutes
  128 +mq.seller.deliverNotice.third=7200
  129 +
125 130
126 yoho.gateway.url=http://api-test3.dev.yohocorp.com 131 yoho.gateway.url=http://api-test3.dev.yohocorp.com
127 132
@@ -33,6 +33,11 @@ consumer: @@ -33,6 +33,11 @@ consumer:
33 delay: 33 delay:
34 interval: 5 34 interval: 5
35 35
  36 + - class: com.yohoufo.order.mq.consumer.NotDeliverNoticeDelayMsgConsumer
  37 + topic: order.notDeliver
  38 + delay:
  39 + interval: 1440
  40 +
36 #更新物流调拨信息 41 #更新物流调拨信息
37 - address: 192.168.102.45:5672 42 - address: 192.168.102.45:5672
38 username: yoho 43 username: yoho
@@ -97,6 +97,11 @@ rabbit_host=${rabbit_ufo} @@ -97,6 +97,11 @@ rabbit_host=${rabbit_ufo}
97 rabbit_user=${rabbit_ufo_user} 97 rabbit_user=${rabbit_ufo_user}
98 rabbit_password=${rabbit_ufo_password} 98 rabbit_password=${rabbit_ufo_password}
99 99
  100 +#二次发货提醒 108*60 minutes
  101 +mq.seller.deliverNotice.second=${mq.seller.deliverNotice.second}
  102 +#发货失败提醒 120*60 minutes
  103 +mq.seller.deliverNotice.third=${mq.seller.deliverNotice.third}
  104 +
100 105
101 yoho.gateway.url=${yoho.gateway.url} 106 yoho.gateway.url=${yoho.gateway.url}
102 107
@@ -26,7 +26,7 @@ consumer: @@ -26,7 +26,7 @@ consumer:
26 - class: com.yohoufo.order.mq.consumer.SellerOrderCancelDeliverDelayMsgConsumer 26 - class: com.yohoufo.order.mq.consumer.SellerOrderCancelDeliverDelayMsgConsumer
27 topic: sellerOrder.autoCancelDeliver 27 topic: sellerOrder.autoCancelDeliver
28 delay: 28 delay:
29 - interval: 2160 29 + interval: ${mq.seller.deliverNotice.third}
30 30
31 #order.notPaidNotice 31 #order.notPaidNotice
32 - class: com.yohoufo.order.mq.consumer.NotPaidNoticeDelayMsgConsumer 32 - class: com.yohoufo.order.mq.consumer.NotPaidNoticeDelayMsgConsumer
@@ -37,7 +37,7 @@ consumer: @@ -37,7 +37,7 @@ consumer:
37 - class: com.yohoufo.order.mq.consumer.NotDeliverNoticeDelayMsgConsumer 37 - class: com.yohoufo.order.mq.consumer.NotDeliverNoticeDelayMsgConsumer
38 topic: order.notDeliver 38 topic: order.notDeliver
39 delay: 39 delay:
40 - interval: 1440 40 + interval: ${mq.seller.deliverNotice.second}
41 41
42 42
43 - address: ${rabbit_ufo} 43 - address: ${rabbit_ufo}