|
@@ -20,7 +20,9 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
@@ -20,7 +20,9 @@ import org.springframework.beans.factory.annotation.Autowired; |
20
|
import org.springframework.stereotype.Service;
|
20
|
import org.springframework.stereotype.Service;
|
21
|
|
21
|
|
22
|
import java.math.BigDecimal;
|
22
|
import java.math.BigDecimal;
|
23
|
-import java.util.*;
|
23
|
+import java.util.List;
|
|
|
24
|
+import java.util.Objects;
|
|
|
25
|
+import java.util.Optional;
|
24
|
|
26
|
|
25
|
/**
|
27
|
/**
|
26
|
* Created by jiexiang.wu on 2019/7/23.
|
28
|
* Created by jiexiang.wu on 2019/7/23.
|
|
@@ -56,6 +58,7 @@ public class SellerPlatformServiceFeeSupport { |
|
@@ -56,6 +58,7 @@ public class SellerPlatformServiceFeeSupport { |
56
|
SellerOrderStatsConfiguration currentStatsConfig = statsConfigurationManager.getStatsConfig(currentStatsEntry);
|
58
|
SellerOrderStatsConfiguration currentStatsConfig = statsConfigurationManager.getStatsConfig(currentStatsEntry);
|
57
|
SellerOrderStatsResult statsResult = (SellerOrderStatsResult) statsConfigurationManager.getStatsProcessor(currentStatsConfig.getStatsProcessorName()).getResult(currentStatsEntry, currentStatsConfig);
|
59
|
SellerOrderStatsResult statsResult = (SellerOrderStatsResult) statsConfigurationManager.getStatsProcessor(currentStatsConfig.getStatsProcessorName()).getResult(currentStatsEntry, currentStatsConfig);
|
58
|
if (Objects.isNull(statsResult)) {
|
60
|
if (Objects.isNull(statsResult)) {
|
|
|
61
|
+ //没有统计记录,按0件处理,这样可以获得0档费率
|
59
|
statsResult = createEmptyStatsResult(uid, currentStatsConfig.getStatsCode());
|
62
|
statsResult = createEmptyStatsResult(uid, currentStatsConfig.getStatsCode());
|
60
|
}
|
63
|
}
|
61
|
return this.buildSellerPlatformServiceFee(uid, statsResult);
|
64
|
return this.buildSellerPlatformServiceFee(uid, statsResult);
|
|
@@ -96,26 +99,12 @@ public class SellerPlatformServiceFeeSupport { |
|
@@ -96,26 +99,12 @@ public class SellerPlatformServiceFeeSupport { |
96
|
public BigDecimal getPlatformServiceFeeRate(int uid, SkupType skupType) {
|
99
|
public BigDecimal getPlatformServiceFeeRate(int uid, SkupType skupType) {
|
97
|
logger.info("[{}] in platformServiceFeeRate,skupType:{}", uid, skupType);
|
100
|
logger.info("[{}] in platformServiceFeeRate,skupType:{}", uid, skupType);
|
98
|
|
101
|
|
99
|
- BigDecimal feeRate = null;
|
|
|
100
|
//查询当前周期的费用
|
102
|
//查询当前周期的费用
|
101
|
- //当前的扣点服务
|
|
|
102
|
- SellerOrderStatsEntry currentStatsEntry = SellerOrderStatsEntry.builder()
|
|
|
103
|
- .sellerUid(uid)
|
|
|
104
|
- .skupType(skupType)
|
|
|
105
|
- .time(DateUtil.getCurrentTimeSecond())
|
|
|
106
|
- .bidType(OrderConstant.NON_LIMIT_BID_TYPE)
|
|
|
107
|
- .build();
|
|
|
108
|
- SellerOrderStatsConfiguration currentStatsConfig = statsConfigurationManager.getStatsConfig(currentStatsEntry);
|
|
|
109
|
- //若当前查询的配置为空配置,返回null
|
|
|
110
|
- if (currentStatsConfig != SellerOrderStatsConfiguration.emptyConfiguration) {
|
|
|
111
|
- SellerOrderStatsResult statsResult = (SellerOrderStatsResult) statsConfigurationManager.getStatsProcessor(currentStatsConfig.getStatsProcessorName()).getResult(currentStatsEntry, currentStatsConfig);
|
|
|
112
|
- if (Objects.isNull(statsResult)) {
|
|
|
113
|
- //满足规则,但没有统计记录,按0件处理
|
|
|
114
|
- statsResult = createEmptyStatsResult(uid, currentStatsConfig.getStatsCode());
|
|
|
115
|
- }
|
|
|
116
|
- //3.最终费率
|
|
|
117
|
- feeRate = this.buildSellerPlatformServiceFee(uid, statsResult).getFeeRate();
|
|
|
118
|
- }
|
103
|
+ SellerPlatformServiceFee sellerPlatformServiceFee = currentPeriod(uid, skupType);
|
|
|
104
|
+
|
|
|
105
|
+ //3.最终的费用
|
|
|
106
|
+ BigDecimal feeRate = sellerPlatformServiceFee.getFeeRate();
|
|
|
107
|
+
|
119
|
logger.info("[{}] out platformServiceFeeRate:{}", uid, feeRate);
|
108
|
logger.info("[{}] out platformServiceFeeRate:{}", uid, feeRate);
|
120
|
return feeRate;
|
109
|
return feeRate;
|
121
|
}
|
110
|
}
|