Authored by tanling

Merge branch 'test6.9.9' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.9

... ... @@ -114,7 +114,7 @@ public class ShoppingController {
ShoppingRequest req = ShoppingRequest.builder().uid(uid)
.skup(skup)
.couponCodes(activityTypeEnum.isCouponFlag() ? CouponCodeUtils.asListDefaultUseAutoRecommended(couponCode) : null)
.couponCodes(activityTypeEnum.isCouponFlag() ? CouponCodeUtils.asList(couponCode) : null)
.addressId(addressId)
.userActivityId(userActivityId).activityType(activityTypeEnum)
.appVersion(appVersion)
... ...
... ... @@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
import com.yohobuy.ufo.model.order.bo.PrdPrice;
import com.yohobuy.ufo.model.order.bo.SellerBo;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.common.Payment;
import com.yohobuy.ufo.model.order.common.SellerFuncEnum;
import com.yohobuy.ufo.model.order.common.SkupStatus;
import com.yohobuy.ufo.model.order.constants.SkupType;
... ... @@ -18,19 +19,18 @@ import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.BuyerOrderGoods;
import com.yohoufo.dal.order.model.SellerOrder;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohobuy.ufo.model.order.common.Payment;
import com.yohoufo.order.model.dto.ChangePricePrepareDTO;
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
import com.yohoufo.order.model.dto.SkupDto;
import com.yohoufo.order.model.request.PrdQueryReq;
import com.yohoufo.order.service.seller.setting.SellerService;
import com.yohoufo.order.service.seller.OrderComputeHandler;
import com.yohoufo.order.service.seller.OrderComputeProvider;
import com.yohoufo.order.service.seller.SellerAuthCheckService;
import com.yohoufo.order.service.seller.fee.GoodsAmountService;
import com.yohoufo.order.service.seller.processor.ChangePriceCommonPrepareProcessor;
import com.yohoufo.order.service.seller.processor.PriceComputePrepareProcessor;
import com.yohoufo.order.service.seller.setting.SellerService;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.OrderAssist;
import com.yohoufo.order.utils.SellerGoodsHelper;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
... ... @@ -74,6 +74,9 @@ public class SingleGoodsChangePricePrepareProcessor {
@Autowired
private ChangePriceCommonPrepareProcessor changePriceCommonPrepareProcessor;
@Autowired
private GoodsAmountService goodsAmountService;
public void checkGoodsStatus(SellerOrderGoods psog){
if (SkupStatus.CAN_SELL.getCode() != psog.getStatus().intValue()){
logger.warn("in SingleGoodsChangePricePrepareProcessor.checkGoodsStatus not can sale, SellerOrderGoods {}", psog);
... ... @@ -131,8 +134,7 @@ public class SingleGoodsChangePricePrepareProcessor {
String tips = priceComputePrepareProcessor.checkSuggestPrice(prdPrice, salePrice, skupType);
// compute every fee from price
boolean isImperfect = SellerGoodsHelper.isImperfectGoods(skupType);
SellerOrderComputeResult pcc = isImperfect ? null : OrderAssist.buildPersonalComputeConfig(prdPrice);
SellerOrderComputeResult pcc = goodsAmountService.getGoodsServiceFeeRate(uid, storageId, prdPrice, skupType);
OrderComputeHandler computeHandler = orderComputeProvider.findBySkupType(skupType);
SellerOrderComputeResult computeResult = computeHandler.compute(salePrice, pcc);
//check income
... ...
... ... @@ -9,6 +9,7 @@ import com.yohoufo.order.service.impl.OrderDynamicConfig;
import com.yohoufo.order.service.support.SellerPlatformServiceFeeSupport;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.OrderAssist;
import com.yohoufo.order.utils.SellerGoodsHelper;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -56,18 +57,22 @@ public class GoodsAmountService {
logger.info("in GoodsAmountService.getGoodsServiceFeeRate uid {}, storageId {},prdPrice {} skupType {}",
uid, storageId, prdPrice, skupType);
ServiceFeeRate rate = orderDynamicConfig.getServiceFeeRate(skupType);
SellerOrderComputeResult highPriority = OrderAssist.buildHighestPriorityConfig(prdPrice, rate);
if (highPriority != null){
return highPriority;
boolean isImperfect = SellerGoodsHelper.isImperfectGoods(skupType);
//不适用类型:二手
if (!isImperfect) {
//skn + uid 指定的费率
//最高优先级 不仅决定了抽成费率 且决定了其他两项平台费用(鉴定费 包装费)
SellerOrderComputeResult highPriority = OrderAssist.buildHighestPriorityConfig(prdPrice, rate);
if (highPriority != null) {
return highPriority;
}
}
List<GoodsServiceFeeRateWrapper> allConfig = Lists.newArrayListWithCapacity(4);
//build One User One GoodsType
//build One User One GoodsType 卖家不同商品类型的指定费率
allConfig.add(buildOneUserOneGoodsType(uid, skupType));
// build by skn
allConfig.add(buildWithSkn(prdPrice));
//build by goods type
//build by goods type 不同商品类型指定的费率
allConfig.add(buildWithGoodsType(rate));
logger.info("in GoodsAmountService.getGoodsServiceFeeRate uid {}, storageId {}, skupType {} prdPrice {} allConfig {}",
uid, storageId, skupType, prdPrice, allConfig);
... ... @@ -91,10 +96,8 @@ public class GoodsAmountService {
}
public GoodsServiceFeeRateWrapper buildWithGoodsType(ServiceFeeRate rate){
GoodsServiceFeeRateWrapper gsfrw = new GoodsServiceFeeRateWrapper();
gsfrw.setGoodsServiceFeeRateDimension(GoodsServiceFeeRateDimension.ONE_USER_ONE_GOODS_TYPE);
gsfrw.setGoodsServiceFeeRateDimension(GoodsServiceFeeRateDimension.GOODS_TYPE);
gsfrw.setGoodsPaymentRate(rate == null ? null : rate.getGoodsPaymentRate());
return gsfrw;
}
... ...
... ... @@ -3,10 +3,22 @@ package com.yohoufo.order.service.seller.fee;
import lombok.Getter;
public enum GoodsServiceFeeRateDimension {
/**
* 不同商品类型对应独自费率
*/
GOODS_TYPE(1),
/**
* 一个skn 指定若干卖家,每个卖家有独自的费率
* 目前由合同控制,隶属第一优先级
*/
ONE_USER_ONE_SKN(2),
/**
* 每个卖家指定多个商品类型,每个商品有独立的费率
*/
ONE_USER_ONE_GOODS_TYPE(3),
/**
* skn 维度
*/
SKN(4);
@Getter
... ...
... ... @@ -19,11 +19,11 @@ import com.yohoufo.order.model.dto.ChangePricePrepareDTO;
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
import com.yohoufo.order.model.dto.SkupDto;
import com.yohoufo.order.model.request.PrdQueryReq;
import com.yohoufo.order.service.seller.setting.SellerService;
import com.yohoufo.order.service.seller.OrderComputeHandler;
import com.yohoufo.order.service.seller.OrderComputeProvider;
import com.yohoufo.order.service.seller.fee.GoodsAmountService;
import com.yohoufo.order.service.seller.setting.SellerService;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.OrderAssist;
import com.yohoufo.order.utils.SellerGoodsHelper;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
... ... @@ -70,6 +70,9 @@ public abstract class AbsEntryChangePricePrepareProcessor<T extends SellerBaseCh
@Autowired
ChangePriceCommonPrepareProcessor changePriceCommonPrepareProcessor;
@Autowired
private GoodsAmountService goodsAmountService;
public ChangePricePrepareDTO checkAndAcquire(T req) {
int uid = req.getUid();
... ... @@ -106,7 +109,7 @@ public abstract class AbsEntryChangePricePrepareProcessor<T extends SellerBaseCh
prdPrice = priceComputePrepareProcessor.checkPriceRange(pqr, req.isShowPriceError());
String tips = priceComputePrepareProcessor.checkSuggestPrice(prdPrice, salePrice, skupType);
// compute every fee from price
SellerOrderComputeResult pcc = OrderAssist.buildPersonalComputeConfig(prdPrice);
SellerOrderComputeResult pcc = goodsAmountService.getGoodsServiceFeeRate(uid, storageId, prdPrice, skupType);
OrderComputeHandler computeHandler = orderComputeProvider.findBySkupType(skupType);
SellerOrderComputeResult computeResult = computeHandler.compute(salePrice, pcc);
int num = skupMap.size();
... ...
... ... @@ -11,12 +11,12 @@ import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.order.model.SellerOrderContext;
import com.yohoufo.order.model.dto.ImPrdNode;
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
import com.yohoufo.order.service.seller.SkupService;
import com.yohoufo.order.service.seller.OrderComputeHandler;
import com.yohoufo.order.service.seller.OrderComputeProvider;
import com.yohoufo.order.service.seller.PublishProcessor;
import com.yohoufo.order.service.seller.SkupService;
import com.yohoufo.order.service.seller.fee.GoodsAmountService;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.OrderAssist;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -41,6 +41,9 @@ public class ImportPublishProcessor
@Autowired
private SkupService skupService;
@Autowired
private GoodsAmountService goodsAmountService;
@Override
public SellerOrderContext buildPublishCtx(ImPrdNode node) {
... ... @@ -135,7 +138,7 @@ public class ImportPublishProcessor
PrdPrice prdPrice = new PrdPrice();
prdPrice.setCanPublish(true);
prdPrice.setGoodsPaymentRate(goodsPaymentRate);
SellerOrderComputeResult pcc = OrderAssist.buildPersonalComputeConfig(prdPrice);
SellerOrderComputeResult pcc = goodsAmountService.getGoodsServiceFeeRate(uid, storageId, prdPrice, skupType);
OrderComputeHandler computeHandler = orderComputeProvider.findBySkupType(skupType);
SellerOrderComputeResult computeResult = computeHandler.compute(goodsInfo.getPrice(), pcc);
logger.info("in buildImportPrdCxt , uid {}, storageId {}, price {}, computeResult {}", uid, storageId,
... ...
... ... @@ -12,19 +12,19 @@ import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.common.utils.BigDecimalHelper;
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
import com.yohoufo.order.model.request.PrdQueryReq;
import com.yohoufo.order.service.seller.SellerOrderRiskWatchDog;
import com.yohoufo.order.service.seller.setting.SellerService;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.service.seller.OrderComputeHandler;
import com.yohoufo.order.service.seller.OrderComputeProvider;
import com.yohoufo.order.service.seller.SellerAuthCheckService;
import com.yohoufo.order.service.seller.SellerOrderRiskWatchDog;
import com.yohoufo.order.service.seller.fee.GoodsAmountService;
import com.yohoufo.order.service.seller.setting.SellerService;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.OrderAssist;
import com.yohoufo.order.utils.SellerGoodsHelper;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.Builder;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -58,6 +58,8 @@ public class PriceComputePrepareProcessor {
@Autowired
private SellerOrderRiskWatchDog sellerOrderRiskWatchDog;
@Autowired
private GoodsAmountService goodsAmountService;
@Data
@Builder
... ... @@ -151,7 +153,7 @@ public class PriceComputePrepareProcessor {
//check suggest price
String tips = checkSuggestPrice(prdPrice, salePrice, skupType);
//calculate fee
SellerOrderComputeResult pcc = isImperfect ? null : OrderAssist.buildPersonalComputeConfig(prdPrice);
SellerOrderComputeResult pcc = goodsAmountService.getGoodsServiceFeeRate(uid, storageId, prdPrice, skupType);
OrderComputeHandler computeHandler = orderComputeProvider.findBySkupType(skupType);
SellerOrderComputeResult computeResult = computeHandler.compute(salePrice, pcc);
//check seller type and wallet
... ...
... ... @@ -13,11 +13,11 @@ import com.yohoufo.common.utils.AddressUtil;
import com.yohoufo.order.model.SellerOrderContext;
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
import com.yohoufo.order.model.request.PrdQueryReq;
import com.yohoufo.order.service.seller.*;
import com.yohoufo.order.service.proxy.UserProxyService;
import com.yohoufo.order.service.seller.*;
import com.yohoufo.order.service.seller.fee.GoodsAmountService;
import com.yohoufo.order.utils.AddressHelper;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.OrderAssist;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -49,6 +49,9 @@ public class SellerOrderPrepareProcessor
@Autowired
private SellerOrderRiskWatchDog sellerOrderRiskWatchDog;
@Autowired
private GoodsAmountService goodsAmountService;
private SellerOrderContext buildPublishPrdCtx(SellerOrderSubmitReq req) {
SellerOrderContext ctx = buildSellerOrderContext(req);
int uid = ctx.getUid();
... ... @@ -141,7 +144,7 @@ public class SellerOrderPrepareProcessor
}
// compute every fee from price
SellerOrderComputeResult pcc = OrderAssist.buildPersonalComputeConfig(prdPrice);
SellerOrderComputeResult pcc = goodsAmountService.getGoodsServiceFeeRate(uid, storageId, prdPrice, skupType);
OrderComputeHandler computeHandler = orderComputeProvider.findBySkupType(skupType);
SellerOrderComputeResult computeResult = computeHandler.compute(goodsInfo.getPrice(), pcc);
priceComputePrepareProcessor.checkIncome(storageId, computeResult.getIncome());
... ...
... ... @@ -81,12 +81,16 @@ public class OrderAssist {
}
public static SellerOrderComputeResult buildHighestPriorityConfig(PrdPrice prdPrice, ServiceFeeRate serviceFeeRate){
SellerOrderComputeResult socr = new SellerOrderComputeResult();
SellerOrderComputeResult socr = null;
PlatformFeeDto platformFee;
BigDecimal goodsPaymentRate;
if (Objects.nonNull(prdPrice) && Objects.nonNull(goodsPaymentRate = prdPrice.getGoodsPaymentRate())){
if (Objects.nonNull(prdPrice)
&& Objects.nonNull(goodsPaymentRate = prdPrice.getGoodsPaymentRate())){
socr = new SellerOrderComputeResult();
//
serviceFeeRate.setGoodsPaymentRate(goodsPaymentRate);
//
socr.setServiceFeeRate(serviceFeeRate);
//如果基础商品已经设置了抽成比率,则鉴定费和包装费免除
platformFee = new PlatformFeeDto();
platformFee.setAppraiseFee(new BigDecimal(0));
... ... @@ -94,7 +98,7 @@ public class OrderAssist {
//
socr.setPlatformFee(platformFee);
}
socr.setServiceFeeRate(serviceFeeRate);
return socr;
}
... ...