Authored by LUOXC

fixbug

1 package com.yohoufo.order.service.proxy; 1 package com.yohoufo.order.service.proxy;
2 2
  3 +import com.yohobuy.ufo.model.order.common.OrderCodeType;
3 import com.yohoufo.common.utils.DateUtil; 4 import com.yohoufo.common.utils.DateUtil;
4 import com.yohoufo.dal.order.BuyerOrderStatusFlowMapper; 5 import com.yohoufo.dal.order.BuyerOrderStatusFlowMapper;
5 import com.yohoufo.dal.order.model.BuyerOrderStatusFlow; 6 import com.yohoufo.dal.order.model.BuyerOrderStatusFlow;
6 import com.yohoufo.order.service.IInviteSettlementService; 7 import com.yohoufo.order.service.IInviteSettlementService;
  8 +import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
  9 +import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
7 import com.yohoufo.order.utils.NamedThreadFactory; 10 import com.yohoufo.order.utils.NamedThreadFactory;
8 import org.slf4j.Logger; 11 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory; 12 import org.slf4j.LoggerFactory;
@@ -31,9 +34,14 @@ public class OrderStatusFlowService { @@ -31,9 +34,14 @@ public class OrderStatusFlowService {
31 @Autowired 34 @Autowired
32 private IInviteSettlementService inviterService; 35 private IInviteSettlementService inviterService;
33 36
  37 + @Autowired
  38 + private OrderCodeGenerator orderCodeGenerator;
  39 +
34 40
35 public void addAsy(Long orderCode, Integer status) { 41 public void addAsy(Long orderCode, Integer status) {
36 try { 42 try {
  43 + CodeMeta codeMeta = orderCodeGenerator.expId(orderCode);
  44 + boolean isBuyerOrderCode = OrderCodeType.BUYER_TYPE.getType() == codeMeta.getType();
37 logger.info("OrderStatusFlowService add enter , status {}, orderCode {} ", status, orderCode); 45 logger.info("OrderStatusFlowService add enter , status {}, orderCode {} ", status, orderCode);
38 executorService.execute(() -> { 46 executorService.execute(() -> {
39 BuyerOrderStatusFlow buyerOrderStatusFlow = new BuyerOrderStatusFlow(); 47 BuyerOrderStatusFlow buyerOrderStatusFlow = new BuyerOrderStatusFlow();
@@ -43,7 +51,9 @@ public class OrderStatusFlowService { @@ -43,7 +51,9 @@ public class OrderStatusFlowService {
43 logger.info("OrderStatusFlowService add execute , buyerOrderStatusFlow {} ", buyerOrderStatusFlow); 51 logger.info("OrderStatusFlowService add execute , buyerOrderStatusFlow {} ", buyerOrderStatusFlow);
44 buyerOrderStatusFlowMapper.insert(buyerOrderStatusFlow); 52 buyerOrderStatusFlowMapper.insert(buyerOrderStatusFlow);
45 }); 53 });
  54 + if (isBuyerOrderCode) {
46 inviteExecutorService.execute(() -> inviterService.createInviteSettlementItem(orderCode, status)); 55 inviteExecutorService.execute(() -> inviterService.createInviteSettlementItem(orderCode, status));
  56 + }
47 } catch (Exception e) { 57 } catch (Exception e) {
48 logger.warn("OrderStatusFlowService add error , status {}, orderCode {} ", status, orderCode, e); 58 logger.warn("OrderStatusFlowService add error , status {}, orderCode {} ", status, orderCode, e);
49 } 59 }