...
|
...
|
@@ -9,9 +9,9 @@ import com.yohoufo.dal.order.SellerOrderStatsConfigMapper; |
|
|
import com.yohoufo.dal.order.model.SellerOrderStatsConfig;
|
|
|
import com.yohoufo.order.service.stats.StatsUnit;
|
|
|
import com.yohoufo.order.service.stats.impl.SellerOrderStatsConfiguration;
|
|
|
import com.yohoufo.order.utils.LoggerUtils;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
...
|
...
|
@@ -28,7 +28,10 @@ import java.util.stream.Collectors; |
|
|
@Component
|
|
|
public class SellerOrderStatsConfigCacheService {
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(SellerOrderStatsConfigCacheService.class);
|
|
|
private static final Logger logger = LoggerUtils.getSellerOrderLogger();
|
|
|
|
|
|
//分隔字符
|
|
|
private static final String FIELD_SPLIT_TOKEN = ",";
|
|
|
|
|
|
//统计所有配置项
|
|
|
public final static String SELLER_ORDER_STATS_CONFIG_KEY = "SELLER_ORDER_STATS_CONFIG";
|
...
|
...
|
@@ -53,8 +56,8 @@ public class SellerOrderStatsConfigCacheService { |
|
|
configs.forEach(config -> {
|
|
|
SellerOrderStatsConfiguration configuration = SellerOrderStatsConfiguration.builder()
|
|
|
.statsCode(config.getStatsCode())
|
|
|
.excludeUids(Splitter.on(",").omitEmptyStrings().splitToList(config.getExcludeUid()).stream().map(uid -> Integer.parseInt(uid.trim())).collect(Collectors.toList()))
|
|
|
.orderAttributes(Splitter.on(",").omitEmptyStrings().splitToList(config.getOrderAttribute()).stream().map(code -> OrderAttributes.getOrderAttributes(Integer.parseInt(code.trim()))).collect(Collectors.toList()))
|
|
|
.excludeUids(Splitter.on(FIELD_SPLIT_TOKEN).omitEmptyStrings().splitToList(config.getExcludeUid()).stream().map(uid -> Integer.parseInt(uid.trim())).collect(Collectors.toList()))
|
|
|
.orderAttributes(Splitter.on(FIELD_SPLIT_TOKEN).omitEmptyStrings().splitToList(config.getOrderAttribute()).stream().map(code -> OrderAttributes.getOrderAttributes(Integer.parseInt(code.trim()))).collect(Collectors.toList()))
|
|
|
.statsUnit(StatsUnit.find(config.getStatsUnit()))
|
|
|
.statsPeriod(config.getStatsPeriod())
|
|
|
.statsProcessorName(config.getStatsProcessor())
|
...
|
...
|
@@ -63,7 +66,7 @@ public class SellerOrderStatsConfigCacheService { |
|
|
|
|
|
configurations.add(configuration);
|
|
|
});
|
|
|
|
|
|
logger.info("key {}, old value is {}, new value is {}.", key, oldValue, configurations);
|
|
|
return configurations;
|
|
|
} catch (Exception ex) {
|
|
|
logger.warn("key {}, old value is {}, error message is {}.", key, oldValue, ex.getMessage());
|
...
|
...
|
|