Authored by chenchao

Merge branch 'dev_批量导入' into test6.8.6

@@ -7,6 +7,8 @@ import com.yohoufo.dal.order.model.SellerWallet; @@ -7,6 +7,8 @@ import com.yohoufo.dal.order.model.SellerWallet;
7 import com.yohoufo.order.event.BatchPublishTailEvent; 7 import com.yohoufo.order.event.BatchPublishTailEvent;
8 import com.yohoufo.order.service.MerchantOrderPaymentService; 8 import com.yohoufo.order.service.MerchantOrderPaymentService;
9 import com.yohoufo.order.service.proxy.ProductProxyService; 9 import com.yohoufo.order.service.proxy.ProductProxyService;
  10 +import com.yohoufo.order.utils.LoggerUtils;
  11 +import org.slf4j.Logger;
10 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Component; 13 import org.springframework.stereotype.Component;
12 14
@@ -18,7 +20,7 @@ import java.util.stream.Collectors; @@ -18,7 +20,7 @@ import java.util.stream.Collectors;
18 */ 20 */
19 @Component 21 @Component
20 public class BatchPublishTailHandler implements IEventHandler<BatchPublishTailEvent> { 22 public class BatchPublishTailHandler implements IEventHandler<BatchPublishTailEvent> {
21 - 23 + private final Logger logger = LoggerUtils.getSellerOrderLogger();
22 @Autowired 24 @Autowired
23 private MerchantOrderPaymentService merchantOrderPaymentService; 25 private MerchantOrderPaymentService merchantOrderPaymentService;
24 26
@@ -28,6 +30,7 @@ public class BatchPublishTailHandler implements IEventHandler<BatchPublishTailEv @@ -28,6 +30,7 @@ public class BatchPublishTailHandler implements IEventHandler<BatchPublishTailEv
28 @Override 30 @Override
29 @Subscribe 31 @Subscribe
30 public void handle(BatchPublishTailEvent event) { 32 public void handle(BatchPublishTailEvent event) {
  33 + logger.info("in handle BatchPublishTailEvent event {}", event);
31 batchPublishTailProcess(event.getFjr(), event.getSellerWallet(), event.isSurper()); 34 batchPublishTailProcess(event.getFjr(), event.getSellerWallet(), event.isSurper());
32 } 35 }
33 36
1 package com.yohoufo.order.service.seller; 1 package com.yohoufo.order.service.seller;
2 2
3 -import com.yoho.error.ServiceError;  
4 -import com.yoho.error.exception.ServiceException;  
5 -import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo;  
6 import com.yohobuy.ufo.model.order.req.BatchImportPrdReq; 3 import com.yohobuy.ufo.model.order.req.BatchImportPrdReq;
7 import com.yohobuy.ufo.model.order.vo.AddressInfo; 4 import com.yohobuy.ufo.model.order.vo.AddressInfo;
8 import com.yohobuy.ufo.model.request.product.ProductImportTranItemBo; 5 import com.yohobuy.ufo.model.request.product.ProductImportTranItemBo;
9 import com.yohoufo.common.alarm.EventBusPublisher; 6 import com.yohoufo.common.alarm.EventBusPublisher;
10 import com.yohoufo.dal.order.model.SellerWallet; 7 import com.yohoufo.dal.order.model.SellerWallet;
11 -import com.yohoufo.dal.order.model.SellerWalletDetail;  
12 import com.yohoufo.order.event.BatchPublishTailEvent; 8 import com.yohoufo.order.event.BatchPublishTailEvent;
13 import com.yohoufo.order.model.SellerOrderContext; 9 import com.yohoufo.order.model.SellerOrderContext;
14 -import com.yohoufo.order.model.dto.SellerOrderComputeResult;  
15 import com.yohoufo.order.service.MerchantOrderPaymentService; 10 import com.yohoufo.order.service.MerchantOrderPaymentService;
16 import com.yohoufo.order.service.handler.SellerOrderSubmitHandler; 11 import com.yohoufo.order.service.handler.SellerOrderSubmitHandler;
17 import com.yohoufo.order.service.impl.SellerService; 12 import com.yohoufo.order.service.impl.SellerService;
@@ -57,8 +52,6 @@ public class ImportPublishExcutor implements PublishExcutor<BatchImportPrdReq, S @@ -57,8 +52,6 @@ public class ImportPublishExcutor implements PublishExcutor<BatchImportPrdReq, S
57 @Autowired 52 @Autowired
58 private SkupBatchService skupBatchService; 53 private SkupBatchService skupBatchService;
59 54
60 - @Autowired  
61 - private MerchantOrderPaymentService merchantOrderPaymentService;  
62 55
63 @Autowired 56 @Autowired
64 private SellerService sellerService; 57 private SellerService sellerService;
@@ -117,28 +110,14 @@ public class ImportPublishExcutor implements PublishExcutor<BatchImportPrdReq, S @@ -117,28 +110,14 @@ public class ImportPublishExcutor implements PublishExcutor<BatchImportPrdReq, S
117 long batchNo = skupBatchService.generateBatchNo(uid, storageNum); 110 long batchNo = skupBatchService.generateBatchNo(uid, storageNum);
118 ctx.getSoldProduct().setBatchNo(batchNo); 111 ctx.getSoldProduct().setBatchNo(batchNo);
119 112
120 - SellerOrderComputeResult socr = ctx.getSellerOrderComputeResult();  
121 - BigDecimal singleEarestMoney = socr.getEarnestMoney().getEarnestMoney();  
122 - BigDecimal mEarestMoney = sellerOrderPrepareProcessor.checkNGetMergeEarnestMoney(uid, singleEarestMoney,  
123 - storageNum, ctx.getSalePrice(), isSuper);  
124 - SellerWalletDetail.Type swdType = SellerWalletDetail.Type.PUBLISH;  
125 - MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(uid)  
126 - .storageId(ctx.getStorageId()).earnestMoney(mEarestMoney)  
127 - .type(swdType.getValue()).build();  
128 - SellerWallet sellerWallet = merchantOrderPaymentService.useEarnest(uid, mEarestMoney, moai);  
129 - // invoke pay by wallet  
130 - boolean paySuccess = Objects.nonNull(sellerWallet);  
131 - if (!paySuccess){  
132 - logger.warn("batch publishOne pay fail, req {} mEarestMoney {}", node, mEarestMoney);  
133 - throw new ServiceException(ServiceError.WALLET_EARNESTMONEY_PAY_FAIL);  
134 - }  
135 - SellerOrderSubmitHandler.ForkJoinResult fjr = null; 113 +
  114 + SellerOrderSubmitHandler.ForkJoinResult fjr;
136 115
137 fjr = orderSubmitHandler.submitMultiple(ctx, storageNum); 116 fjr = orderSubmitHandler.submitMultiple(ctx, storageNum);
138 // (异步实现)记录保证金流水 117 // (异步实现)记录保证金流水
139 //(异步实现)同步数据到prd,记录支付, 118 //(异步实现)同步数据到prd,记录支付,
140 BatchPublishTailEvent bpte = BatchPublishTailEvent.builder().isSurper(isSuper) 119 BatchPublishTailEvent bpte = BatchPublishTailEvent.builder().isSurper(isSuper)
141 - .fjr(fjr).sellerWallet(sellerWallet).build(); 120 + .fjr(fjr).sellerWallet(null).build();
142 EventBusPublisher.publishEvent(bpte); 121 EventBusPublisher.publishEvent(bpte);
143 return fjr; 122 return fjr;
144 } 123 }