|
|
package com.yohoufo.order.service;
|
|
|
|
|
|
import com.yohobuy.ufo.model.order.common.OrderAttributes;
|
|
|
import com.yohobuy.ufo.model.order.common.OrderCodeType;
|
|
|
import com.yohoufo.dal.order.AppraiseOrderMapper;
|
|
|
import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
|
|
|
import com.yohoufo.dal.order.BuyerOrderMapper;
|
|
|
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
|
|
|
import com.yohoufo.dal.order.model.AppraiseOrder;
|
|
|
import com.yohoufo.dal.order.model.BuyerOrder;
|
|
|
import com.yohoufo.dal.order.model.BuyerOrderGoods;
|
|
|
import com.yohoufo.dal.order.model.SellerOrderGoods;
|
|
|
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
|
|
|
import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
@Component
|
|
|
public class PaymentSupportService {
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
OrderCodeGenerator orderCodeGenerator;
|
|
|
|
|
|
@Autowired
|
|
|
BuyerOrderMapper buyerOrderMapper;
|
|
|
|
|
|
@Autowired
|
|
|
BuyerOrderGoodsMapper buyerOrderGoodsMapper;
|
|
|
|
|
|
@Autowired
|
|
|
SellerOrderGoodsMapper sellerOrderGoodsMapper;
|
|
|
|
|
|
@Autowired
|
|
|
AppraiseOrderMapper appraiseOrderMapper;
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 虚拟支付
|
|
|
* @param orderCode
|
|
|
* @return
|
|
|
*/
|
|
|
public boolean isVirtualPay(long orderCode){
|
|
|
|
|
|
CodeMeta codeMeta = orderCodeGenerator.expId(orderCode);
|
|
|
|
|
|
// 商家入驻保证金 ==> 用户入驻缴纳的保证金以及充值的保证金
|
|
|
if (codeMeta.getType() == OrderCodeType.SELLER_RECHARGE_EARNEST_TYPE.getType()){
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
// 个人卖家上架保证金 ==> 用户没有入驻,上架商品缴纳的保证金
|
|
|
else if (codeMeta.getType() == OrderCodeType.SELLER_TYPE.getType()){
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
else if (codeMeta.getType() == OrderCodeType.BUYER_TYPE.getType()){
|
|
|
// 闪购寄存
|
|
|
return isQuickDeliverDeposite(orderCode);
|
|
|
}
|
|
|
|
|
|
// 寄售保证金 and 实物鉴定
|
|
|
else if (codeMeta.getType() == OrderCodeType.GOODS_SERVICE.getType()){
|
|
|
AppraiseOrder appraiseOrder = appraiseOrderMapper.selectByOrderCode(orderCode);
|
|
|
if (appraiseOrder != null){
|
|
|
|
|
|
if (appraiseOrder.getAttributes() == OrderAttributes.DEPOSITE.getCode()){
|
|
|
return true;
|
|
|
}else if(appraiseOrder.getAttributes() == OrderAttributes.APPRAISE.getCode()){
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 寄存续约费 寄存滞纳金 寄存召回运费
|
|
|
else if(codeMeta.getType() == OrderCodeType.STORAGE_MANAGEMENT.getType()){
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
private boolean isQuickDeliverDeposite(long orderCode){
|
|
|
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
|
|
|
if (buyerOrder == null){
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
// 买家订单属性 ==>寄存
|
|
|
if (buyerOrder.getAttributes() == OrderAttributes.DEPOSITE.getCode()){
|
|
|
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
|
|
|
|
|
|
if (buyerOrderGoods == null){
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
// 卖家订单属性==> 闪购
|
|
|
SellerOrderGoods sellerOrder = sellerOrderGoodsMapper.selectByPrimaryKey(buyerOrderGoods.getSkup());
|
|
|
if (sellerOrder!=null && sellerOrder.getAttributes() == OrderAttributes.QUICK_DELIVER.getCode()){
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
} |
...
|
...
|
|