Authored by wujiexiang

Merge branch 'hotfix-PlatformServiceFee' into test6.9.22

... ... @@ -19,7 +19,7 @@ import java.util.List;
public class SellerOrderStatsConfiguration implements StatsConfiguration {
public static SellerOrderStatsConfiguration emptyConfiguration = SellerOrderStatsConfiguration.builder()
.statsCode("OrderQuantityStats")
.statsCode("")
.excludeUids(Lists.newArrayList())
.statsUnit(StatsUnit.MONTH)
.skupTypes(Lists.newArrayList())
... ...
... ... @@ -20,7 +20,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
* Created by jiexiang.wu on 2019/7/23.
... ... @@ -56,6 +58,7 @@ public class SellerPlatformServiceFeeSupport {
SellerOrderStatsConfiguration currentStatsConfig = statsConfigurationManager.getStatsConfig(currentStatsEntry);
SellerOrderStatsResult statsResult = (SellerOrderStatsResult) statsConfigurationManager.getStatsProcessor(currentStatsConfig.getStatsProcessorName()).getResult(currentStatsEntry, currentStatsConfig);
if (Objects.isNull(statsResult)) {
//没有统计记录,按0件处理,这样可以获得0档费率
statsResult = createEmptyStatsResult(uid, currentStatsConfig.getStatsCode());
}
return this.buildSellerPlatformServiceFee(uid, statsResult);
... ... @@ -96,26 +99,12 @@ public class SellerPlatformServiceFeeSupport {
public BigDecimal getPlatformServiceFeeRate(int uid, SkupType skupType) {
logger.info("[{}] in platformServiceFeeRate,skupType:{}", uid, skupType);
BigDecimal feeRate = null;
//查询当前周期的费用
//当前的扣点服务
SellerOrderStatsEntry currentStatsEntry = SellerOrderStatsEntry.builder()
.sellerUid(uid)
.skupType(skupType)
.time(DateUtil.getCurrentTimeSecond())
.bidType(OrderConstant.NON_LIMIT_BID_TYPE)
.build();
SellerOrderStatsConfiguration currentStatsConfig = statsConfigurationManager.getStatsConfig(currentStatsEntry);
//若当前查询的配置为空配置,返回null
if (currentStatsConfig != SellerOrderStatsConfiguration.emptyConfiguration) {
SellerOrderStatsResult statsResult = (SellerOrderStatsResult) statsConfigurationManager.getStatsProcessor(currentStatsConfig.getStatsProcessorName()).getResult(currentStatsEntry, currentStatsConfig);
if (Objects.isNull(statsResult)) {
//满足规则,但没有统计记录,按0件处理
statsResult = createEmptyStatsResult(uid, currentStatsConfig.getStatsCode());
}
//3.最终费率
feeRate = this.buildSellerPlatformServiceFee(uid, statsResult).getFeeRate();
}
SellerPlatformServiceFee sellerPlatformServiceFee = currentPeriod(uid, skupType);
//3.最终的费用
BigDecimal feeRate = sellerPlatformServiceFee.getFeeRate();
logger.info("[{}] out platformServiceFeeRate:{}", uid, feeRate);
return feeRate;
}
... ...