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
|
}
|