Authored by wujiexiang

Merge branch 'dev-seller-order-stat-6.9.9' into test6.9.9

... ... @@ -81,7 +81,6 @@ public class SellerOrderStatsConfigCacheService {
if (CollectionUtils.isEmpty(configurations)) {
return Optional.ofNullable(null);
}
Optional<SellerOrderStatsConfiguration> optional = configurations.stream().filter(config -> config.getOrderAttributes().contains(orderAttributes)).findFirst();
return optional;
return configurations.stream().filter(config -> config.getOrderAttributes().contains(orderAttributes)).findFirst();
}
}
... ...
... ... @@ -23,12 +23,12 @@ public class EmptyStatsProcessor implements StatsProcessor<SellerOrderStatsEntry
@Override
public void accept(SellerOrderStatsEntry entry, SellerOrderStatsConfiguration configuration) {
logger.info("emptyStatsProcessor accept entry:{},configuration:{},nothing to do", entry, configuration);
logger.info("emptyStatsProcessor accept entry:{},nothing to do", entry);
}
@Override
public SellerPlatformServiceFee apply(SellerOrderStatsEntry entry, SellerOrderStatsConfiguration configuration) {
logger.info("emptyStatsProcessor apply entry:{},configuration:{},nothing to do", entry, configuration);
logger.info("emptyStatsProcessor apply entry:{},nothing to do", entry);
return new SellerPlatformServiceFee(0, new PlatformServiceFeeDefinition());
}
}
... ...
... ... @@ -31,7 +31,7 @@ public class SellerOrderQuantityStatsProcessor implements StatsProcessor<SellerO
@Override
public void accept(SellerOrderStatsEntry entry, SellerOrderStatsConfiguration configuration) {
logger.info("[{}] sellerOrderQuantityStatsProcessor accept entry:{},configuration:{}", entry.getSellerUid(), entry, configuration);
logger.info("[{}] sellerOrderQuantityStatsProcessor accept entry:{}", entry.getSellerUid(), entry);
Pair<Integer, Integer> timeTuple = configuration.getStatsUnit().nextPeriodTimeTuple(configuration.getStatsPeriod(), configuration.getStatsPeriod());
... ... @@ -51,7 +51,7 @@ public class SellerOrderQuantityStatsProcessor implements StatsProcessor<SellerO
@Override
public SellerPlatformServiceFee apply(SellerOrderStatsEntry entry, SellerOrderStatsConfiguration configuration) {
logger.info("[{}] sellerOrderQuantityStatsProcessor apply entry:{},configuration:{}", entry.getSellerUid(), entry, configuration);
logger.info("[{}] sellerOrderQuantityStatsProcessor apply entry:{}", entry.getSellerUid(), entry);
SellerOrderStatsResult result = sellerOrderStatsResultMapper.selectStatsResult(entry.getSellerUid(), configuration.getStatsCode(), entry.getTime());
int quantity = (result != null) ? result.getQuantity() : 0;
PlatformServiceFeeDefinition psfd = PlatformServiceFeeDefinition.convert(configuration.getActionParam());
... ...
... ... @@ -4,6 +4,8 @@ import com.yohoufo.order.service.cache.SellerOrderStatsConfigCacheService;
import com.yohoufo.order.service.stats.StatsConfigManager;
import com.yohoufo.order.service.stats.StatsProcessor;
import com.yohoufo.order.service.stats.StatsProcessorRegistry;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -17,6 +19,8 @@ import java.util.Optional;
@Service
public class SellerOrderStatsConfigurationManager implements StatsConfigManager<SellerOrderStatsEntry, SellerOrderStatsConfiguration> {
private Logger logger = LoggerUtils.getSellerOrderLogger();
private StatsProcessorRegistry registry = new StatsProcessorRegistry();
@Autowired
... ... @@ -39,6 +43,7 @@ public class SellerOrderStatsConfigurationManager implements StatsConfigManager<
Optional<SellerOrderStatsConfiguration> configurationOp = sellerOrderStatsConfigCacheService.findBy(statsEntry.getOrderAttribute());
if (!configurationOp.isPresent() || configurationOp.get().getExcludeUids().stream().anyMatch(uid -> uid == statsEntry.getSellerUid())) {
// 没有找到配置项或卖家被排除
logger.info("stats config is null or seller is excluded for statsEntry:{}",statsEntry);
return SellerOrderStatsConfiguration.emptyConfiguration;
}
return configurationOp.get();
... ...