Authored by qinchao

记录订单状态流程

@@ -7,6 +7,7 @@ import com.yohoufo.common.alarm.EventBusPublisher; @@ -7,6 +7,7 @@ import com.yohoufo.common.alarm.EventBusPublisher;
7 import com.yohoufo.common.alarm.SmsAlarmEvent; 7 import com.yohoufo.common.alarm.SmsAlarmEvent;
8 import com.yohoufo.common.utils.DateUtil; 8 import com.yohoufo.common.utils.DateUtil;
9 import com.yohoufo.dal.order.BuyerOrderMapper; 9 import com.yohoufo.dal.order.BuyerOrderMapper;
  10 +import com.yohoufo.dal.order.BuyerOrderStatusFlowMapper;
10 import com.yohoufo.dal.order.SellerOrderGoodsMapper; 11 import com.yohoufo.dal.order.SellerOrderGoodsMapper;
11 import com.yohoufo.dal.order.model.BuyerOrder; 12 import com.yohoufo.dal.order.model.BuyerOrder;
12 import com.yohoufo.dal.order.model.SellerOrderGoods; 13 import com.yohoufo.dal.order.model.SellerOrderGoods;
@@ -24,6 +25,7 @@ import com.yohoufo.order.mq.TopicConstants; @@ -24,6 +25,7 @@ import com.yohoufo.order.mq.TopicConstants;
24 import com.yohoufo.order.service.impl.PayRefundService; 25 import com.yohoufo.order.service.impl.PayRefundService;
25 import com.yohoufo.order.service.impl.TransferService; 26 import com.yohoufo.order.service.impl.TransferService;
26 import com.yohoufo.order.service.proxy.InBoxFacade; 27 import com.yohoufo.order.service.proxy.InBoxFacade;
  28 +import com.yohoufo.order.service.proxy.OrderStatusFlowService;
27 import com.yohoufo.order.utils.LoggerUtils; 29 import com.yohoufo.order.utils.LoggerUtils;
28 import org.slf4j.Logger; 30 import org.slf4j.Logger;
29 import org.springframework.beans.factory.annotation.Autowired; 31 import org.springframework.beans.factory.annotation.Autowired;
@@ -55,6 +57,9 @@ public class SellerOrderCancelDeliverDelayMsgConsumer implements YhConsumer { @@ -55,6 +57,9 @@ public class SellerOrderCancelDeliverDelayMsgConsumer implements YhConsumer {
55 @Autowired 57 @Autowired
56 private SellerOrderGoodsMapper sellerOrderGoodsMapper; 58 private SellerOrderGoodsMapper sellerOrderGoodsMapper;
57 59
  60 + @Autowired
  61 + private OrderStatusFlowService orderStatusFlowService;
  62 +
58 public String getMessageTopic() { 63 public String getMessageTopic() {
59 return TopicConstants.SELLER_ORDER_AUTO_CANCEL_DELIVER; 64 return TopicConstants.SELLER_ORDER_AUTO_CANCEL_DELIVER;
60 } 65 }
@@ -121,6 +126,10 @@ public class SellerOrderCancelDeliverDelayMsgConsumer implements YhConsumer { @@ -121,6 +126,10 @@ public class SellerOrderCancelDeliverDelayMsgConsumer implements YhConsumer {
121 SmsAlarmEvent smsAlarmEvent = new SmsAlarmEvent(alarmConfig.getRefundName(), alarmConfig.name(), content); 126 SmsAlarmEvent smsAlarmEvent = new SmsAlarmEvent(alarmConfig.getRefundName(), alarmConfig.name(), content);
122 EventBusPublisher.publishEvent(smsAlarmEvent); 127 EventBusPublisher.publishEvent(smsAlarmEvent);
123 } 128 }
  129 +
  130 + //记录状态信息
  131 + logger.info("in SellerOrderCancelDeliverDelayMsgConsumer handle record status change, orderCode {},uid {} ,sellerUid {}", orderCode,buyerUid,sellerUid);
  132 + orderStatusFlowService.addAsy(orderCode,targetStatus.getCode());
124 } 133 }
125 } 134 }
126 135
@@ -29,6 +29,7 @@ import com.yohoufo.order.service.cache.CacheCleaner; @@ -29,6 +29,7 @@ import com.yohoufo.order.service.cache.CacheCleaner;
29 import com.yohoufo.order.service.cache.CacheKeyBuilder; 29 import com.yohoufo.order.service.cache.CacheKeyBuilder;
30 import com.yohoufo.order.service.impl.SellerAddressService; 30 import com.yohoufo.order.service.impl.SellerAddressService;
31 import com.yohoufo.order.service.proxy.InBoxFacade; 31 import com.yohoufo.order.service.proxy.InBoxFacade;
  32 +import com.yohoufo.order.service.proxy.OrderStatusFlowService;
32 import org.apache.commons.lang3.StringUtils; 33 import org.apache.commons.lang3.StringUtils;
33 import org.slf4j.Logger; 34 import org.slf4j.Logger;
34 import org.slf4j.LoggerFactory; 35 import org.slf4j.LoggerFactory;
@@ -65,6 +66,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { @@ -65,6 +66,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
65 @Autowired 66 @Autowired
66 private CacheCleaner cacheCleaner; 67 private CacheCleaner cacheCleaner;
67 68
  69 + @Autowired
  70 + private OrderStatusFlowService orderStatusFlowService;
  71 +
68 /** 72 /**
69 * 更新订单状态 73 * 更新订单状态
70 * @param orderInfo 74 * @param orderInfo
@@ -78,6 +82,11 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { @@ -78,6 +82,11 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
78 buyerOrder.setUpdateTime(DateUtil.getCurrentTimeSecond()); 82 buyerOrder.setUpdateTime(DateUtil.getCurrentTimeSecond());
79 int result = buyerOrderMapper.updateByOrderCode(buyerOrder); 83 int result = buyerOrderMapper.updateByOrderCode(buyerOrder);
80 // 84 //
  85 + if(result>0){
  86 + //记录状态信息
  87 + logger.info("in updateOrderStatusPaid record status change, orderCode {}", orderInfo.getOrderCode());
  88 + orderStatusFlowService.addAsy(orderInfo.getOrderCode(), OrderStatus.HAS_PAYED.getCode());
  89 + }
81 orderInfo.setStatus(OrderStatus.HAS_PAYED.getCode()); 90 orderInfo.setStatus(OrderStatus.HAS_PAYED.getCode());
82 return result; 91 return result;
83 } 92 }
@@ -28,6 +28,7 @@ import com.yohoufo.order.service.IPaymentService; @@ -28,6 +28,7 @@ import com.yohoufo.order.service.IPaymentService;
28 import com.yohoufo.order.service.cache.CacheCleaner; 28 import com.yohoufo.order.service.cache.CacheCleaner;
29 import com.yohoufo.order.service.cache.CacheKeyBuilder; 29 import com.yohoufo.order.service.cache.CacheKeyBuilder;
30 import com.yohoufo.order.service.proxy.InBoxFacade; 30 import com.yohoufo.order.service.proxy.InBoxFacade;
  31 +import com.yohoufo.order.service.proxy.OrderStatusFlowService;
31 import com.yohoufo.order.utils.PaymentHelper; 32 import com.yohoufo.order.utils.PaymentHelper;
32 import com.yohoufo.order.utils.PubThreadFactory; 33 import com.yohoufo.order.utils.PubThreadFactory;
33 import org.apache.commons.lang3.StringUtils; 34 import org.apache.commons.lang3.StringUtils;
@@ -57,6 +58,9 @@ public class AppraiseService { @@ -57,6 +58,9 @@ public class AppraiseService {
57 private IExpressInfoService expressInfoService; 58 private IExpressInfoService expressInfoService;
58 59
59 @Autowired 60 @Autowired
  61 + private OrderStatusFlowService orderStatusFlowService;
  62 +
  63 + @Autowired
60 private BuyerOrderMapper buyerOrderMapper; 64 private BuyerOrderMapper buyerOrderMapper;
61 65
62 @Autowired 66 @Autowired
@@ -189,6 +193,11 @@ public class AppraiseService { @@ -189,6 +193,11 @@ public class AppraiseService {
189 //记录物流信息 193 //记录物流信息
190 //不发物流 194 //不发物流
191 //expressInfoService.appraiseSuccess(buyerUid, expressCompanyId, orderCode, wayBillCode, depotNum,mobile); 195 //expressInfoService.appraiseSuccess(buyerUid, expressCompanyId, orderCode, wayBillCode, depotNum,mobile);
  196 +
  197 + //记录订单的状态变更信息
  198 + LOGGER.info("in appraiseSuccess record status change, orderCode {},uid {} ,sellerUid {}", orderCode,buyerUid,sellerUid);
  199 + orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetOrderStatus.getCode());
  200 +
192 //平台已发货给买家 201 //平台已发货给买家
193 inBoxFacade.appraisePassNotice(buyerUid, orderCode, sellerOrderGoods); 202 inBoxFacade.appraisePassNotice(buyerUid, orderCode, sellerOrderGoods);
194 }catch (Exception ex){ 203 }catch (Exception ex){
@@ -327,6 +336,11 @@ public class AppraiseService { @@ -327,6 +336,11 @@ public class AppraiseService {
327 //平台已发货给买家 TODO 336 //平台已发货给买家 TODO
328 //inBoxFacade.appraisePassNotice(buyerUid, orderCode, sellerOrderGoods); 337 //inBoxFacade.appraisePassNotice(buyerUid, orderCode, sellerOrderGoods);
329 338
  339 + //记录订单的状态变更信息
  340 + LOGGER.info("in deliverGoods record status change, orderCode {},uid {} ,sellerUid {}", orderCode,buyerUid,sellerUid);
  341 + orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetStatus.getCode());
  342 +
  343 +
330 //清理 344 //清理
331 cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), 345 cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()),
332 CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()), 346 CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()),
@@ -502,6 +516,9 @@ public class AppraiseService { @@ -502,6 +516,9 @@ public class AppraiseService {
502 try{ 516 try{
503 payRefundService.refund(req, bleb); 517 payRefundService.refund(req, bleb);
504 // 518 //
  519 + //记录订单的状态变更信息
  520 + LOGGER.info("in appraiseFail record status change, orderCode {},uid {} ,sellerUid {}", orderCode,buyerUid,sellerUid);
  521 + orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetStatus.getCode());
505 522
506 //TODO 消息 523 //TODO 消息
507 inBoxFacade.noticeSellerWhenAppraiseFail( sellerOrderGoods,orderCode,wayBillCode); 524 inBoxFacade.noticeSellerWhenAppraiseFail( sellerOrderGoods,orderCode,wayBillCode);
@@ -44,6 +44,7 @@ import com.yohoufo.order.service.cache.CacheKeyBuilder; @@ -44,6 +44,7 @@ import com.yohoufo.order.service.cache.CacheKeyBuilder;
44 import com.yohoufo.order.service.cache.OrderCacheService; 44 import com.yohoufo.order.service.cache.OrderCacheService;
45 import com.yohoufo.order.service.pay.AbstractPayService; 45 import com.yohoufo.order.service.pay.AbstractPayService;
46 import com.yohoufo.order.service.proxy.InBoxFacade; 46 import com.yohoufo.order.service.proxy.InBoxFacade;
  47 +import com.yohoufo.order.service.proxy.OrderStatusFlowService;
47 import com.yohoufo.order.service.proxy.ProductProxyService; 48 import com.yohoufo.order.service.proxy.ProductProxyService;
48 import com.yohoufo.order.utils.LoggerUtils; 49 import com.yohoufo.order.utils.LoggerUtils;
49 import org.apache.commons.collections.CollectionUtils; 50 import org.apache.commons.collections.CollectionUtils;
@@ -102,6 +103,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -102,6 +103,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
102 @Autowired 103 @Autowired
103 private IExpressInfoService expressInfoService; 104 private IExpressInfoService expressInfoService;
104 105
  106 + @Autowired
  107 + private OrderStatusFlowService orderStatusFlowService;
  108 +
105 /** 109 /**
106 * 提交订单 110 * 提交订单
107 * @param orderRequest 111 * @param orderRequest
@@ -122,6 +126,10 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -122,6 +126,10 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
122 BuyerOrderGoods bog = buyerOrderGoodsMapper.selectByOrderCode(uid, orderCode); 126 BuyerOrderGoods bog = buyerOrderGoodsMapper.selectByOrderCode(uid, orderCode);
123 SellerOrderGoods sog = sellerOrderGoodsMapper.selectByPrimaryKey(bog.getSkup()); 127 SellerOrderGoods sog = sellerOrderGoodsMapper.selectByPrimaryKey(bog.getSkup());
124 128
  129 + //记录状态信息
  130 + logger.info("in seller confirm record status change, orderCode {},uid {} ,sellerUid {}", orderCode,uid,sellerUid);
  131 + orderStatusFlowService.addAsy(orderCode,OrderStatus.DONE.getCode());
  132 +
125 cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), 133 cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()),
126 CacheKeyBuilder.orderListKey(uid, TabType.BUY.getValue()), 134 CacheKeyBuilder.orderListKey(uid, TabType.BUY.getValue()),
127 CacheKeyBuilder.sellerOrderDetailKey(sog), 135 CacheKeyBuilder.sellerOrderDetailKey(sog),
@@ -314,6 +322,10 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -314,6 +322,10 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
314 OrderStatus targetStatus = OrderStatus.BUYER_CANCEL_TIMEOUT; 322 OrderStatus targetStatus = OrderStatus.BUYER_CANCEL_TIMEOUT;
315 DataNode node = checkBase(orderRequest); 323 DataNode node = checkBase(orderRequest);
316 cancelBeforePaid(orderRequest, node, expectStatus, targetStatus); 324 cancelBeforePaid(orderRequest, node, expectStatus, targetStatus);
  325 +
  326 + //记录状态变更信息
  327 + logger.info("in cancelByAuto record status change, orderRequest {}", orderRequest);
  328 + orderStatusFlowService.addAsy(orderRequest.getOrderCode(),targetStatus.getCode());
317 } 329 }
318 330
319 private void doCancel(OrderRequest orderRequest){ 331 private void doCancel(OrderRequest orderRequest){
@@ -335,6 +347,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -335,6 +347,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
335 targetStatus = OrderStatus.BUYER_CANCEL_BEFORE_PAY; 347 targetStatus = OrderStatus.BUYER_CANCEL_BEFORE_PAY;
336 cancelBeforePaid(orderRequest, node, expectStatus, targetStatus); 348 cancelBeforePaid(orderRequest, node, expectStatus, targetStatus);
337 buyerOrderCancelService.refundCouponIfNeed(buyerOrder.getUid(), buyerOrder.getOrderCode()); 349 buyerOrderCancelService.refundCouponIfNeed(buyerOrder.getUid(), buyerOrder.getOrderCode());
  350 + //记录状态变更信息
  351 + logger.info("in doCancel record status WAITING_PAY change, orderRequest {}", orderRequest);
  352 + orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetStatus.getCode());
338 break; 353 break;
339 case HAS_PAYED: 354 case HAS_PAYED:
340 BuyerOrderGoods bog = buyerOrderGoodsMapper.selectByOrderCode(orderRequest.getUid(), 355 BuyerOrderGoods bog = buyerOrderGoodsMapper.selectByOrderCode(orderRequest.getUid(),
@@ -347,6 +362,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -347,6 +362,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
347 .amount(buyerOrder.getAmount()) 362 .amount(buyerOrder.getAmount())
348 .build(); 363 .build();
349 buyerOrderCancelService.cancel(bsde); 364 buyerOrderCancelService.cancel(bsde);
  365 + //记录状态变更信息
  366 + logger.info("in doCancel record status HAS_PAYED change, orderRequest {}", orderRequest);
  367 + orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetStatus.getCode());
350 break; 368 break;
351 case SELLER_SEND_OUT: 369 case SELLER_SEND_OUT:
352 bog = buyerOrderGoodsMapper.selectByOrderCode(orderRequest.getUid(), 370 bog = buyerOrderGoodsMapper.selectByOrderCode(orderRequest.getUid(),
@@ -359,6 +377,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -359,6 +377,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
359 .amount(buyerOrder.getAmount()) 377 .amount(buyerOrder.getAmount())
360 .build(); 378 .build();
361 buyerOrderCancelService.cancel(bdre); 379 buyerOrderCancelService.cancel(bdre);
  380 + //记录状态变更信息
  381 + logger.info("in doCancel record status HAS_PAYED change, orderRequest {}", orderRequest);
  382 + orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetStatus.getCode());
362 break; 383 break;
363 } 384 }
364 385
@@ -638,9 +659,17 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -638,9 +659,17 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
638 int uid = buyerOrder.getUid(); 659 int uid = buyerOrder.getUid();
639 int sellerUid = buyerOrder.getSellerUid(); 660 int sellerUid = buyerOrder.getSellerUid();
640 logger.info("in confirmReceive begin update status orderCode {},uid {} ,sellerUid {}", orderCode,uid,sellerUid); 661 logger.info("in confirmReceive begin update status orderCode {},uid {} ,sellerUid {}", orderCode,uid,sellerUid);
641 - buyerOrderMapper.updateStatusByOrderCode(orderCode, uid, expectStatus.getCode(), 662 + int num = buyerOrderMapper.updateStatusByOrderCode(orderCode, uid, expectStatus.getCode(),
642 targetStatus.getCode(), DateUtil.getCurrentTimeSecond()); 663 targetStatus.getCode(), DateUtil.getCurrentTimeSecond());
643 664
  665 + //记录订单的状态变更信息
  666 + if(num>=1){
  667 + logger.info("in confirmReceive record status change, orderCode {},uid {} ,sellerUid {}", orderCode,uid,sellerUid);
  668 + orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetStatus.getCode());
  669 + }else{
  670 + logger.warn("in confirmReceive not record status change cause of update empty num , orderCode {},uid {} ,sellerUid {}", orderCode,uid,sellerUid);
  671 + }
  672 +
644 //记录调拨信息(只保存卖家一条) 673 //记录调拨信息(只保存卖家一条)
645 EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER; 674 EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
646 EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer; 675 EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
@@ -678,9 +707,17 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -678,9 +707,17 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
678 int uid = buyerOrder.getUid(); 707 int uid = buyerOrder.getUid();
679 int sellerUid = buyerOrder.getSellerUid(); 708 int sellerUid = buyerOrder.getSellerUid();
680 logger.info("in judgeBegin begin update status orderCode {},uid {} ,sellerUid {}", orderCode,uid,sellerUid); 709 logger.info("in judgeBegin begin update status orderCode {},uid {} ,sellerUid {}", orderCode,uid,sellerUid);
681 - buyerOrderMapper.updateStatusByOrderCode(orderCode, uid, expectStatus.getCode(), 710 + int num=buyerOrderMapper.updateStatusByOrderCode(orderCode, uid, expectStatus.getCode(),
682 targetStatus.getCode(), DateUtil.getCurrentTimeSecond()); 711 targetStatus.getCode(), DateUtil.getCurrentTimeSecond());
683 712
  713 + //记录订单的状态变更信息
  714 + if(num>=1){
  715 + logger.info("in judgeBegin record status change, orderCode {},uid {} ,sellerUid {}", orderCode,uid,sellerUid);
  716 + orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetStatus.getCode());
  717 + }else{
  718 + logger.warn("in judgeBegin not record status change cause of update empty num , orderCode {},uid {} ,sellerUid {}", orderCode,uid,sellerUid);
  719 + }
  720 +
684 //记录调拨信息(只保存卖家一条) 721 //记录调拨信息(只保存卖家一条)
685 EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER; 722 EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
686 EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer; 723 EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
@@ -26,6 +26,7 @@ import com.yohoufo.order.service.IExpressInfoService; @@ -26,6 +26,7 @@ import com.yohoufo.order.service.IExpressInfoService;
26 import com.yohoufo.order.service.cache.CacheCleaner; 26 import com.yohoufo.order.service.cache.CacheCleaner;
27 import com.yohoufo.order.service.cache.CacheKeyBuilder; 27 import com.yohoufo.order.service.cache.CacheKeyBuilder;
28 import com.yohoufo.order.service.proxy.InBoxFacade; 28 import com.yohoufo.order.service.proxy.InBoxFacade;
  29 +import com.yohoufo.order.service.proxy.OrderStatusFlowService;
29 import com.yohoufo.order.service.proxy.ProductProxyService; 30 import com.yohoufo.order.service.proxy.ProductProxyService;
30 import lombok.AllArgsConstructor; 31 import lombok.AllArgsConstructor;
31 import lombok.Data; 32 import lombok.Data;
@@ -89,6 +90,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -89,6 +90,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
89 @Autowired 90 @Autowired
90 private CacheCleaner cacheCleaner; 91 private CacheCleaner cacheCleaner;
91 92
  93 + @Autowired
  94 + private OrderStatusFlowService orderStatusFlowService;
  95 +
92 //private static String EXPRESS_MQ_SEND = "logistics.logistics_data"; 96 //private static String EXPRESS_MQ_SEND = "logistics.logistics_data";
93 //private static String EXPRESS_MQ_SEND = "order.updateChangeRefundOrderExpressInfo"; 97 //private static String EXPRESS_MQ_SEND = "order.updateChangeRefundOrderExpressInfo";
94 private static String EXPRESS_MQ_SEND = "third.logistics.logistics_data"; 98 private static String EXPRESS_MQ_SEND = "third.logistics.logistics_data";
@@ -160,6 +164,11 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -160,6 +164,11 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
160 sendExpressMQ(sellerUid,expressCompanyId,orderCode,wayBillCode,mobile); 164 sendExpressMQ(sellerUid,expressCompanyId,orderCode,wayBillCode,mobile);
161 psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup); 165 psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
162 LOGGER.info("deliverToDepot end ! send express to erp "); 166 LOGGER.info("deliverToDepot end ! send express to erp ");
  167 +
  168 + //记录订单的状态变更信息
  169 + LOGGER.info("in deliverToDepot record status change, orderCode {},uid {} ,sellerUid {}", orderCode,buyerUid,sellerUid);
  170 + orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetOrderStatus.getCode());
  171 +
163 inBoxFacade.sellerDeliver2Depot(buyerUid, orderCode, psog.getProductName()); 172 inBoxFacade.sellerDeliver2Depot(buyerUid, orderCode, psog.getProductName());
164 // 173 //
165 cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()), 174 cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()),
@@ -32,6 +32,7 @@ import com.yohoufo.order.service.impl.visitor.OffShelveCancelCase; @@ -32,6 +32,7 @@ import com.yohoufo.order.service.impl.visitor.OffShelveCancelCase;
32 import com.yohoufo.order.service.impl.visitor.UserCancelCase; 32 import com.yohoufo.order.service.impl.visitor.UserCancelCase;
33 import com.yohoufo.order.service.pay.AbstractPayService; 33 import com.yohoufo.order.service.pay.AbstractPayService;
34 import com.yohoufo.order.service.proxy.InBoxFacade; 34 import com.yohoufo.order.service.proxy.InBoxFacade;
  35 +import com.yohoufo.order.service.proxy.OrderStatusFlowService;
35 import com.yohoufo.order.service.proxy.ProductProxyService; 36 import com.yohoufo.order.service.proxy.ProductProxyService;
36 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; 37 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
37 import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta; 38 import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
@@ -94,6 +95,9 @@ public class SellerOrderCancelService { @@ -94,6 +95,9 @@ public class SellerOrderCancelService {
94 @Autowired 95 @Autowired
95 IPaymentService paymentService; 96 IPaymentService paymentService;
96 97
  98 + @Autowired
  99 + private OrderStatusFlowService orderStatusFlowService;
  100 +
97 /** 101 /**
98 * TODO 如何控制好并发,必须控制不能重复转账 退款 102 * TODO 如何控制好并发,必须控制不能重复转账 退款
99 * 使用乐观锁,带着查询到的状态且符合条件时再去更新 103 * 使用乐观锁,带着查询到的状态且符合条件时再去更新
@@ -488,6 +492,10 @@ public class SellerOrderCancelService { @@ -488,6 +492,10 @@ public class SellerOrderCancelService {
488 SmsAlarmEvent smsAlarmEvent = new SmsAlarmEvent(alarmConfig.getRefundName(), alarmConfig.name(), content); 492 SmsAlarmEvent smsAlarmEvent = new SmsAlarmEvent(alarmConfig.getRefundName(), alarmConfig.name(), content);
489 EventBusPublisher.publishEvent(smsAlarmEvent); 493 EventBusPublisher.publishEvent(smsAlarmEvent);
490 } 494 }
  495 +
  496 + //记录状态信息
  497 + logger.info("in cancelAfterPayExistBuyAction record status change, orderCode {}", buyerOrderCode);
  498 + orderStatusFlowService.addAsy(buyerOrderCode,targetBOStatus.getCode());
491 } 499 }
492 500
493 return result; 501 return result;
@@ -19,6 +19,7 @@ import com.yohoufo.order.model.dto.BuyerOrderSubmitResult; @@ -19,6 +19,7 @@ import com.yohoufo.order.model.dto.BuyerOrderSubmitResult;
19 import com.yohoufo.order.model.dto.OrderBuilder; 19 import com.yohoufo.order.model.dto.OrderBuilder;
20 import com.yohoufo.order.service.ISubmitOrderService; 20 import com.yohoufo.order.service.ISubmitOrderService;
21 import com.yohoufo.order.service.proxy.CouponProxyService; 21 import com.yohoufo.order.service.proxy.CouponProxyService;
  22 +import com.yohoufo.order.service.proxy.OrderStatusFlowService;
22 import com.yohoufo.order.service.proxy.ProductProxyService; 23 import com.yohoufo.order.service.proxy.ProductProxyService;
23 import com.yohoufo.order.utils.LoggerUtils; 24 import com.yohoufo.order.utils.LoggerUtils;
24 import org.slf4j.Logger; 25 import org.slf4j.Logger;
@@ -117,6 +118,9 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService { @@ -117,6 +118,9 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService {
117 @Autowired 118 @Autowired
118 private ProductProxyService productProxyService; 119 private ProductProxyService productProxyService;
119 120
  121 + @Autowired
  122 + private OrderStatusFlowService orderStatusFlowService;
  123 +
120 /** 124 /**
121 * 创建订单 125 * 创建订单
122 * @param orderBuilder 126 * @param orderBuilder
@@ -152,6 +156,10 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService { @@ -152,6 +156,10 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService {
152 //6.插入优惠券 order_coupon 156 //6.插入优惠券 order_coupon
153 insertOrderCouponIfNeed(orderBuilder); 157 insertOrderCouponIfNeed(orderBuilder);
154 158
  159 + //7.记录状态变更信息
  160 + logger.info("in createOrder record status change, orderBuilder {}", orderBuilder);
  161 + orderStatusFlowService.addAsy(orderBuilder.getOrderCode(),OrderStatus.WAITING_PAY.getCode());
  162 +
155 BuyerOrderSubmitResult result = BuyerOrderSubmitResult.builder() 163 BuyerOrderSubmitResult result = BuyerOrderSubmitResult.builder()
156 .orderCode(orderBuilder.getOrderCode()) 164 .orderCode(orderBuilder.getOrderCode())
157 .sellerOrder(sellerOrder).sellerOrderGoods(sellerOrderGoods).build(); 165 .sellerOrder(sellerOrder).sellerOrderGoods(sellerOrderGoods).build();