...
|
...
|
@@ -54,6 +54,7 @@ import com.yohoufo.order.service.seller.OrderComputeProvider; |
|
|
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
|
|
|
import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
|
|
|
import com.yohoufo.order.utils.LoggerUtils;
|
|
|
import com.yohoufo.order.utils.MsgHelper;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
...
|
...
|
@@ -70,7 +71,7 @@ import java.util.stream.Collectors; |
|
|
* Created by chenchao on 2018/9/13.
|
|
|
*/
|
|
|
@Service
|
|
|
public class SellerOrderService implements IOrderListService, IOrderDetailService {
|
|
|
public class SellerOrderService implements IOrderListService, IOrderDetailService {
|
|
|
|
|
|
private final Logger log = LoggerUtils.getSellerOrderLogger();
|
|
|
|
...
|
...
|
@@ -125,7 +126,6 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
@Autowired
|
|
|
private PriceComputePrepareProcessor priceComputePrepareProcessor;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private ChangePricePrepareProcessor changePricePrepareProcessor;
|
|
|
|
...
|
...
|
@@ -153,6 +153,22 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
@Autowired
|
|
|
private SellerDownShelfTaskHandler sellerDownShelfTaskHandler;
|
|
|
|
|
|
@Autowired
|
|
|
private InBoxFacade inBoxFacade;
|
|
|
|
|
|
@Autowired
|
|
|
private SellerService sellerService;
|
|
|
|
|
|
@Autowired
|
|
|
private SellerAuthCheckService sellerAuthCheckService;
|
|
|
|
|
|
@Autowired
|
|
|
private SellerBatchCancelPrepareProcessor sellerBatchCancelPrepareProcessor;
|
|
|
|
|
|
@Autowired
|
|
|
private NESChangePricePrepareProcessor nesChangePricePrepareProcessor;
|
|
|
|
|
|
private static final int MAX_DEAL = 10;
|
|
|
|
|
|
public SoldPrdComputeBo computePublishPrd(SellerOrderComputeReq req) throws GatewayException {
|
|
|
log.info("in computePublishPrd, req {}", req);
|
...
|
...
|
@@ -162,10 +178,10 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
int num = pcn.getNum();
|
|
|
BigDecimal salePrice = pcn.getPrdPrice();
|
|
|
String tips = null;
|
|
|
PrdPrice prdPrice = sellerOrderPrepareProcessor.checkPriceRange(storageId, salePrice, true);
|
|
|
PrdPrice prdPrice = priceComputePrepareProcessor.checkPriceRange(storageId, salePrice, true);
|
|
|
SkupType skupType = SkupType.getSkupType(req.getSkupType());
|
|
|
try {
|
|
|
sellerOrderPrepareProcessor.checkSuggestPrice(prdPrice, salePrice, skupType);
|
|
|
priceComputePrepareProcessor.checkSuggestPrice(prdPrice, salePrice, skupType);
|
|
|
}catch (UfoServiceException ex){
|
|
|
tips = ex.getErrorMessage();
|
|
|
}
|
...
|
...
|
@@ -178,11 +194,6 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
public SoldPrdComputeBo computeChangePrice(BatchChangePriceReq req) throws GatewayException {
|
|
|
log.info("in computeChangePrice, req {}", req);
|
|
|
ChangePricePrepareDTO pcn = changePricePrepareProcessor.checkAndAcquire(req);
|
|
|
/*
|
|
|
if (pcn.getTips() != null){
|
|
|
throw new UfoServiceException(SellerOrderPrepareProcessor.TIPS_ERROR_CODE, pcn.getTips() );
|
|
|
}
|
|
|
*/
|
|
|
SellerOrderComputeResult computeResult = pcn.getComputeResult();
|
|
|
SoldPrdComputeBo spc = SellerOrderConvertor.computeResult2SoldPrdComputeBo(computeResult);
|
|
|
spc.setTips(pcn.getTips());
|
...
|
...
|
@@ -269,14 +280,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
.actorType(TabType.SELL).cancelType(CancelType.TIME_OUT).build();
|
|
|
eventHandlerContainer.fireAsyncCancelEvent(orderCancelEvent);
|
|
|
}
|
|
|
@Autowired
|
|
|
private InBoxFacade inBoxFacade;
|
|
|
|
|
|
@Autowired
|
|
|
private SellerService sellerService;
|
|
|
|
|
|
@Autowired
|
|
|
private SellerAuthCheckService sellerAuthCheckService;
|
|
|
|
|
|
public OrderSubmitResp batchPublishPrds(SellerOrderContext ctx, SellerOrderSubmitReq req) throws GatewayException {
|
|
|
// 一串校验
|
...
|
...
|
@@ -287,7 +291,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
Boolean isSuper = sellerBo.getIsSuper();
|
|
|
SellerOrderComputeResult socr = ctx.getSellerOrderComputeResult();
|
|
|
BigDecimal singleEarestMoney = socr.getEarnestMoney().getEarnestMoney();
|
|
|
BigDecimal mEarestMoney = sellerOrderPrepareProcessor.checkNGetMergeEarnestMoney(uid, singleEarestMoney,
|
|
|
BigDecimal mEarestMoney = priceComputePrepareProcessor.checkNGetMergeEarnestMoney(uid, singleEarestMoney,
|
|
|
num, ctx.getSalePrice(), isSuper);
|
|
|
SellerWalletDetail.Type swdType = SellerWalletDetail.Type.PUBLISH;
|
|
|
MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(uid)
|
...
|
...
|
@@ -334,8 +338,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
|
private SellerBatchCancelPrepareProcessor sellerBatchCancelPrepareProcessor;
|
|
|
|
|
|
/**
|
|
|
* 总指导思想:先下架商品
|
|
|
* @param req
|
...
|
...
|
@@ -523,7 +526,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
* 验证是否是入驻商家
|
|
|
*/
|
|
|
if(sellerOrderPrepareProcessor.checkIsEntry(uid)){
|
|
|
sellerOrderPrepareProcessor.checkNGetMergeEarnestMoney(uid,
|
|
|
priceComputePrepareProcessor.checkNGetMergeEarnestMoney(uid,
|
|
|
computeResult.getEarnestMoney().getEarnestMoney(), num, prdPrice, isSuper);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -745,7 +748,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
}
|
|
|
|
|
|
|
|
|
private static final int MAX_DEAL = 10;
|
|
|
|
|
|
|
|
|
|
|
|
private class BatchProcessTask implements Callable<SellerOrderSubmitHandler.ForkJoinResult>{
|
...
|
...
|
@@ -859,7 +862,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
private final static String FLAG_PRE = "#*", FLAG_SUFFIX = "*#";
|
|
|
|
|
|
/**
|
|
|
* 您确定取消出售吗?取消后将根据《卖家须知》扣除对应保证金作为赔偿打入卖家账户
|
|
|
* “扣除对应保证金” 加粗标红
|
...
|
...
|
@@ -888,7 +891,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
|
|
|
if (OrderCodeType.BUYER_TYPE.equals(codeType)){
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
|
|
|
String confirmDesc = getConfirmDesc4BuyerOrder(buyerOrder);
|
|
|
String confirmDesc = MsgHelper.getConfirmDesc4BuyerOrder(buyerOrder);
|
|
|
occr.setConfirmDesc(confirmDesc);
|
|
|
//
|
|
|
if (buyerOrder !=null && OrderStatus.HAS_PAYED.getCode() == buyerOrder.getStatus()){
|
...
|
...
|
@@ -898,73 +901,20 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
return occr;
|
|
|
}
|
|
|
|
|
|
private String getConfirmDesc4BuyerOrder(BuyerOrder buyerOrder){
|
|
|
String confirmDesc = null;
|
|
|
|
|
|
if (buyerOrder == null){
|
|
|
return "订单不存在";
|
|
|
}
|
|
|
if (ActionStatusHold.sellerCanCancelBuyerOrder(buyerOrder.getStatus())) {
|
|
|
confirmDesc = "您确定取消出售吗?取消后将根据《卖家须知》" + FLAG_PRE + "扣除对应保证金" + FLAG_SUFFIX + "作为赔偿打入卖家账户";
|
|
|
}else {
|
|
|
confirmDesc = "无法取消,请刷新后查看订单最新状态";
|
|
|
}
|
|
|
return confirmDesc;
|
|
|
}
|
|
|
|
|
|
|
|
|
private SellerOrderGoods rebuildNESReq(SellerOrderComputeReq req){
|
|
|
int uid = req.getUid();
|
|
|
if (uid <=0){
|
|
|
log.warn("in rebuildNESReq uid illegal, req {}", req);
|
|
|
throw new UfoServiceException(400, "参数uid非法");
|
|
|
}
|
|
|
int skup = req.getSkup();
|
|
|
if (skup<=0){
|
|
|
log.warn("in rebuildNESReq find illegal skup code, req {}", req);
|
|
|
throw new UfoServiceException(400, "参数skup非法");
|
|
|
}
|
|
|
SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
|
|
|
if (Objects.isNull(psog)){
|
|
|
log.warn("in rebuildNESReq can not find skup in sys, req {}", req);
|
|
|
throw new UfoServiceException(400, "商品不存在");
|
|
|
}
|
|
|
Integer puid = psog.getUid();
|
|
|
if (!puid.equals(uid)){
|
|
|
log.warn("in rebuildNESReq can not find one hacker , req {} sys-uid {}", req, puid);
|
|
|
throw new UfoServiceException(400, "你是猴子么");
|
|
|
}
|
|
|
|
|
|
int storageId = psog.getId();
|
|
|
req.setNum(1);
|
|
|
req.setStorageId(storageId);
|
|
|
return psog;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* compute Change Price4 NES(Not Entry Seller)
|
|
|
* @param req
|
|
|
* @return
|
|
|
*/
|
|
|
public SoldPrdComputeBo computeChangePrice4NES(SellerOrderComputeReq req){
|
|
|
public SoldPrdComputeBo computeChangePrice4NES(NESChangePriceReq req){
|
|
|
log.info("in computeChangePrice4NES, req {}", req);
|
|
|
rebuildNESReq(req);
|
|
|
PriceComputePrepareProcessor.PriceComputeNode pcn = priceComputePrepareProcessor.checkBasePrice(req);
|
|
|
int uid = pcn.getUid();
|
|
|
Integer storageId = pcn.getStorageId();
|
|
|
int num = pcn.getNum();
|
|
|
BigDecimal salePrice = pcn.getPrdPrice();
|
|
|
String tips = null;
|
|
|
PrdPrice prdPrice = sellerOrderPrepareProcessor.checkPriceRange(storageId, salePrice, true);
|
|
|
SkupType skupType = SkupType.getSkupType(req.getSkupType());
|
|
|
try {
|
|
|
sellerOrderPrepareProcessor.checkSuggestPrice(prdPrice, salePrice, skupType);
|
|
|
}catch (UfoServiceException ex){
|
|
|
tips = ex.getErrorMessage();
|
|
|
}
|
|
|
boolean isSuper = sellerService.isSuperEntrySeller(uid);
|
|
|
SoldPrdComputeBo spc = buildSoldPrdComputeBo(uid, num, salePrice, isSuper, skupType);
|
|
|
spc.setTips(tips);
|
|
|
return spc;
|
|
|
ChangePricePrepareDTO cppDto = nesChangePricePrepareProcessor.checkAndAcquire(req);
|
|
|
SoldPrdComputeBo computeBo = SellerOrderConvertor.computeResult2SoldPrdComputeBo(cppDto.getComputeResult());
|
|
|
return computeBo;
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
|