Authored by chenchao

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

... ... @@ -7,6 +7,8 @@ import com.yohoufo.dal.order.model.SellerWallet;
import com.yohoufo.order.event.BatchPublishTailEvent;
import com.yohoufo.order.service.MerchantOrderPaymentService;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
... ... @@ -18,7 +20,7 @@ import java.util.stream.Collectors;
*/
@Component
public class BatchPublishTailHandler implements IEventHandler<BatchPublishTailEvent> {
private final Logger logger = LoggerUtils.getSellerOrderLogger();
@Autowired
private MerchantOrderPaymentService merchantOrderPaymentService;
... ... @@ -28,6 +30,7 @@ public class BatchPublishTailHandler implements IEventHandler<BatchPublishTailEv
@Override
@Subscribe
public void handle(BatchPublishTailEvent event) {
logger.info("in handle BatchPublishTailEvent event {}", event);
batchPublishTailProcess(event.getFjr(), event.getSellerWallet(), event.isSurper());
}
... ...
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;
}
... ...