Authored by qinchao

发货提醒设置为动态设置

... ... @@ -35,6 +35,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.Arrays;
... ... @@ -70,6 +71,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
@Autowired
private OrderStatusFlowService orderStatusFlowService;
@Value("${mq.seller.deliverNotice.third}")
private int deliverMinutes ;
/**
* 更新订单状态
* @param orderInfo
... ... @@ -115,8 +119,10 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(uid, orderCode);
int skup = buyerOrderGoods.getSkup();
SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
inBoxFacade.sellerSkupPaidByBuyer(sellerOrderGoods,orderCode);
int deliveryHours = deliverMinutes/60;//把分钟转小时
inBoxFacade.sellerSkupPaidByBuyer(sellerOrderGoods,orderCode,deliveryHours);
//离发货截止12小时提醒
DeliverNoticeEvent deliverNoticeEvent = DeliverNoticeEvent.builder().skup(sellerOrderGoods.getId())
.sellerOrderGoods(sellerOrderGoods)
.sellerUid(sellerUid).buyerUid(uid).prdName(sellerOrderGoods.getProductName()).orderCode(orderCode).build();
... ... @@ -131,7 +137,7 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
EventBusPublisher.publishEvent(event);
inBoxFacade.buyerFinishPaid(orderInfo.getUid(), orderInfo.getOrderCode());
inBoxFacade.buyerFinishPaid(orderInfo.getUid(), orderInfo.getOrderCode(),deliveryHours);
cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()),
CacheKeyBuilder.orderListKey(uid, TabType.BUY.getValue()),
... ...
... ... @@ -9,6 +9,7 @@ import com.yohoufo.order.mq.producer.TradeMqSender;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
... ... @@ -21,7 +22,10 @@ public class DeliverNoticeAsyncHandler implements IEventHandler<DeliverNoticeEve
final Logger logger = LoggerFactory.getLogger(getClass());
public static final int DELAY_MINUTES_24_HOURS = DelayTime.MINUTES_24_HOURS;
//public static final int DELAY_MINUTES_24_HOURS = DelayTime.MINUTES_24_HOURS;
@Value("${mq.seller.deliverNotice.second}")
private int minutes ;
@Autowired
private TradeMqSender tradeMqSender;
... ... @@ -30,7 +34,7 @@ public class DeliverNoticeAsyncHandler implements IEventHandler<DeliverNoticeEve
@Override
@Subscribe
public void handle(DeliverNoticeEvent event) {
logger.info("in DeliverNoticeAsyncHandler handler, msg {}", event);
tradeMqSender.send(TopicConstants.ORDER_NOT_DELIVER_NOTICE, event, DELAY_MINUTES_24_HOURS);
logger.info("in DeliverNoticeAsyncHandler handler, msg {},minutes {}", event,minutes);
tradeMqSender.send(TopicConstants.ORDER_NOT_DELIVER_NOTICE, event, minutes);
}
}
... ...
... ... @@ -8,8 +8,8 @@ import com.yohoufo.order.mq.TopicConstants;
import com.yohoufo.order.mq.producer.TradeMqSender;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
... ... @@ -19,16 +19,19 @@ import org.springframework.stereotype.Component;
public class SellerCancelDeliverHandler implements IEventHandler<SellerCancelDeliverEvent> {
private final Logger logger = LoggerUtils.getSellerOrderLogger();
public static final int DELAY_MINUTES_36_HOURS = DelayTime.MINUTES_36_HOURS;
//public static final int DELAY_MINUTES_36_HOURS = DelayTime.MINUTES_36_HOURS;
@Autowired
private TradeMqSender tradeMqSender;
@Value("${mq.seller.deliverNotice.third}")
private int minutes ;
@Override
@Subscribe
public void handle(SellerCancelDeliverEvent event) {
logger.info("Subscribe Buyer Confirm delay msg, event {}", event);
logger.info("Subscribe Buyer Confirm delay msg, event {},minutes {}", event,minutes);
tradeMqSender.send(TopicConstants.SELLER_ORDER_AUTO_CANCEL_DELIVER, event, DELAY_MINUTES_36_HOURS);
tradeMqSender.send(TopicConstants.SELLER_ORDER_AUTO_CANCEL_DELIVER, event, minutes);
}
}
... ...
... ... @@ -75,11 +75,11 @@ public class InBoxFacade {
* @param buyerUid
* @param orderCode
*/
public void buyerFinishPaid(int buyerUid, long orderCode) {
public void buyerFinishPaid(int buyerUid, long orderCode,int deliveryHours) {
try {
executorService.execute(() -> {
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_NOTIFIED_SELLER;
String params = buildParams(orderCode);
String params = buildParams(orderCode,deliveryHours);
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
... ... @@ -633,14 +633,14 @@ public class InBoxFacade {
*
* @param sog SellerOrderGoods
*/
public void sellerSkupPaidByBuyer(SellerOrderGoods sog,long orderCode) {
public void sellerSkupPaidByBuyer(SellerOrderGoods sog,long orderCode,int deliveryHours) {
Integer sellerUid = sog.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
try {
executorService.execute(() -> {
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.SALE_SEND;
String params = buildParams(prdName, sizeName);
String params = buildParams(prdName, sizeName,deliveryHours);
InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
... ... @@ -654,7 +654,7 @@ public class InBoxFacade {
return;
}
List<String> mobileList = Arrays.asList(phone);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND.getContent(),prdName,orderCode);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND.getContent(),prdName,orderCode,deliveryHours);
sendSmsService.smsSendByMobile(content, mobileList);
logger.info("record sellerSkupPaidByBuyer inbox sms msg,sellerUid {}, prdName {},orderCode {}",
sellerUid, prdName,orderCode);
... ...
... ... @@ -122,6 +122,11 @@ rabbit_host=192.168.102.45:5672
rabbit_user=yoho
rabbit_password=yoho
#二次发货提醒 108*60 minutes
mq.seller.deliverNotice.second=6480
#发货失败提醒 120*60 minutes
mq.seller.deliverNotice.third=7200
yoho.gateway.url=http://api-test3.dev.yohocorp.com
... ...
... ... @@ -33,6 +33,11 @@ consumer:
delay:
interval: 5
- class: com.yohoufo.order.mq.consumer.NotDeliverNoticeDelayMsgConsumer
topic: order.notDeliver
delay:
interval: 1440
#更新物流调拨信息
- address: 192.168.102.45:5672
username: yoho
... ...
... ... @@ -97,6 +97,11 @@ rabbit_host=${rabbit_ufo}
rabbit_user=${rabbit_ufo_user}
rabbit_password=${rabbit_ufo_password}
#二次发货提醒 108*60 minutes
mq.seller.deliverNotice.second=${mq.seller.deliverNotice.second}
#发货失败提醒 120*60 minutes
mq.seller.deliverNotice.third=${mq.seller.deliverNotice.third}
yoho.gateway.url=${yoho.gateway.url}
... ...
... ... @@ -26,7 +26,7 @@ consumer:
- class: com.yohoufo.order.mq.consumer.SellerOrderCancelDeliverDelayMsgConsumer
topic: sellerOrder.autoCancelDeliver
delay:
interval: 2160
interval: ${mq.seller.deliverNotice.third}
#order.notPaidNotice
- class: com.yohoufo.order.mq.consumer.NotPaidNoticeDelayMsgConsumer
... ... @@ -37,7 +37,7 @@ consumer:
- class: com.yohoufo.order.mq.consumer.NotDeliverNoticeDelayMsgConsumer
topic: order.notDeliver
delay:
interval: 1440
interval: ${mq.seller.deliverNotice.second}
- address: ${rabbit_ufo}
... ...