|
|
package com.yohoufo.order.service.seller;
|
|
|
|
|
|
import com.yoho.error.ServiceError;
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo;
|
|
|
import com.yohobuy.ufo.model.order.req.BatchImportPrdReq;
|
|
|
import com.yohobuy.ufo.model.order.vo.AddressInfo;
|
|
|
import com.yohobuy.ufo.model.request.product.ProductImportTranItemBo;
|
|
|
import com.yohoufo.common.alarm.EventBusPublisher;
|
|
|
import com.yohoufo.dal.order.model.SellerWallet;
|
|
|
import com.yohoufo.dal.order.model.SellerWalletDetail;
|
|
|
import com.yohoufo.order.event.BatchPublishTailEvent;
|
|
|
import com.yohoufo.order.model.SellerOrderContext;
|
|
|
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
|
|
|
import com.yohoufo.order.service.MerchantOrderPaymentService;
|
|
|
import com.yohoufo.order.service.handler.SellerOrderSubmitHandler;
|
|
|
import com.yohoufo.order.service.impl.SellerService;
|
...
|
...
|
@@ -57,8 +52,6 @@ public class ImportPublishExcutor implements PublishExcutor<BatchImportPrdReq, S |
|
|
@Autowired
|
|
|
private SkupBatchService skupBatchService;
|
|
|
|
|
|
@Autowired
|
|
|
private MerchantOrderPaymentService merchantOrderPaymentService;
|
|
|
|
|
|
@Autowired
|
|
|
private SellerService sellerService;
|
...
|
...
|
@@ -117,28 +110,14 @@ public class ImportPublishExcutor implements PublishExcutor<BatchImportPrdReq, S |
|
|
long batchNo = skupBatchService.generateBatchNo(uid, storageNum);
|
|
|
ctx.getSoldProduct().setBatchNo(batchNo);
|
|
|
|
|
|
SellerOrderComputeResult socr = ctx.getSellerOrderComputeResult();
|
|
|
BigDecimal singleEarestMoney = socr.getEarnestMoney().getEarnestMoney();
|
|
|
BigDecimal mEarestMoney = sellerOrderPrepareProcessor.checkNGetMergeEarnestMoney(uid, singleEarestMoney,
|
|
|
storageNum, ctx.getSalePrice(), isSuper);
|
|
|
SellerWalletDetail.Type swdType = SellerWalletDetail.Type.PUBLISH;
|
|
|
MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(uid)
|
|
|
.storageId(ctx.getStorageId()).earnestMoney(mEarestMoney)
|
|
|
.type(swdType.getValue()).build();
|
|
|
SellerWallet sellerWallet = merchantOrderPaymentService.useEarnest(uid, mEarestMoney, moai);
|
|
|
// invoke pay by wallet
|
|
|
boolean paySuccess = Objects.nonNull(sellerWallet);
|
|
|
if (!paySuccess){
|
|
|
logger.warn("batch publishOne pay fail, req {} mEarestMoney {}", node, mEarestMoney);
|
|
|
throw new ServiceException(ServiceError.WALLET_EARNESTMONEY_PAY_FAIL);
|
|
|
}
|
|
|
SellerOrderSubmitHandler.ForkJoinResult fjr = null;
|
|
|
|
|
|
SellerOrderSubmitHandler.ForkJoinResult fjr;
|
|
|
|
|
|
fjr = orderSubmitHandler.submitMultiple(ctx, storageNum);
|
|
|
// (异步实现)记录保证金流水
|
|
|
//(异步实现)同步数据到prd,记录支付,
|
|
|
BatchPublishTailEvent bpte = BatchPublishTailEvent.builder().isSurper(isSuper)
|
|
|
.fjr(fjr).sellerWallet(sellerWallet).build();
|
|
|
.fjr(fjr).sellerWallet(null).build();
|
|
|
EventBusPublisher.publishEvent(bpte);
|
|
|
return fjr;
|
|
|
}
|
...
|
...
|
|