Commit 590feb2f by shenjunjie

es-index 调整至线上配置

parent 83707cc7
...@@ -15,8 +15,8 @@ public class GenericAttribute { ...@@ -15,8 +15,8 @@ public class GenericAttribute {
* es index * es index
*/ */
public static final String ES_INDEX_PRE = "brandkbs2"; public static final String ES_INDEX_PRE = "brandkbs2";
public static final String ES_INDEX_TEST = "brandkbs2_test"; // public static final String ES_INDEX_TEST = "brandkbs2_test";
// public static final String ES_INDEX_TEST = "brandkbs2_2022"; public static final String ES_INDEX_TEST = "brandkbs2_2022";
public static final String ES_CHANNEL_INDEX_TEST = "brandkbs2_channel_record_test"; public static final String ES_CHANNEL_INDEX_TEST = "brandkbs2_channel_record_test";
/** /**
* es ind_title * es ind_title
......
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.zhiwei.brandkbs2.auth.UserThreadLocal; import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import com.zhiwei.brandkbs2.common.RedisKeyPrefix; import com.zhiwei.brandkbs2.common.RedisKeyPrefix;
import com.zhiwei.brandkbs2.config.Constant;
import com.zhiwei.brandkbs2.dao.EventDao; import com.zhiwei.brandkbs2.dao.EventDao;
import com.zhiwei.brandkbs2.dao.EventDataDao; import com.zhiwei.brandkbs2.dao.EventDataDao;
import com.zhiwei.brandkbs2.dao.EventDisseminationTrendDao; import com.zhiwei.brandkbs2.dao.EventDisseminationTrendDao;
...@@ -22,7 +23,10 @@ import com.zhiwei.brandkbs2.enmus.EventTagEnum; ...@@ -22,7 +23,10 @@ import com.zhiwei.brandkbs2.enmus.EventTagEnum;
import com.zhiwei.brandkbs2.exception.ExceptionCast; import com.zhiwei.brandkbs2.exception.ExceptionCast;
import com.zhiwei.brandkbs2.listener.ApplicationProjectListener; import com.zhiwei.brandkbs2.listener.ApplicationProjectListener;
import com.zhiwei.brandkbs2.model.CommonCodeEnum; import com.zhiwei.brandkbs2.model.CommonCodeEnum;
import com.zhiwei.brandkbs2.pojo.*; import com.zhiwei.brandkbs2.pojo.Event;
import com.zhiwei.brandkbs2.pojo.EventData;
import com.zhiwei.brandkbs2.pojo.EventDisseminationTrend;
import com.zhiwei.brandkbs2.pojo.EventTopArticlesAnalysis;
import com.zhiwei.brandkbs2.pojo.dto.EventDataDTO; import com.zhiwei.brandkbs2.pojo.dto.EventDataDTO;
import com.zhiwei.brandkbs2.pojo.dto.EventSearchDTO; import com.zhiwei.brandkbs2.pojo.dto.EventSearchDTO;
import com.zhiwei.brandkbs2.pojo.dto.YqEventDTO; import com.zhiwei.brandkbs2.pojo.dto.YqEventDTO;
...@@ -632,7 +636,7 @@ public class EventServiceImpl implements EventService { ...@@ -632,7 +636,7 @@ public class EventServiceImpl implements EventService {
boolean highLight = null == aggTitle || Objects.equals(aggTitle, eventTopArticlesAnalysis.getAggTitle()); boolean highLight = null == aggTitle || Objects.equals(aggTitle, eventTopArticlesAnalysis.getAggTitle());
return new EventTopArticlesAnalysisVO(eventTopArticlesAnalysis, highLight); return new EventTopArticlesAnalysisVO(eventTopArticlesAnalysis, highLight);
}).collect(Collectors.groupingBy(EventTopArticlesAnalysisVO::getTimePoint)); }).collect(Collectors.groupingBy(EventTopArticlesAnalysisVO::getTimePoint));
res.put("dataDay", collect); res.put("dataDay", Tools.sortTimeKeyMap(collect, Constant.SPEC_DAY_FORMAT, false));
res.put("dataAmount", null); res.put("dataAmount", null);
return res; return res;
case "按数量": case "按数量":
......
...@@ -37,6 +37,7 @@ import java.nio.ByteBuffer; ...@@ -37,6 +37,7 @@ import java.nio.ByteBuffer;
import java.nio.channels.Channels; import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel; import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel; import java.nio.channels.WritableByteChannel;
import java.text.ParseException;
import java.util.*; import java.util.*;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -877,6 +878,26 @@ public class Tools { ...@@ -877,6 +878,26 @@ public class Tools {
return new JSONObject(); return new JSONObject();
} }
public static <T> Map<String, T> sortTimeKeyMap(Map<String, T> map, FastDateFormat timePattern, boolean isDesc) {
Map<String, T> res = new LinkedHashMap<>();
List<Map.Entry<String, T>> sortKey = map.entrySet().stream().sorted((x, y) -> {
try {
long xTime = timePattern.parse(x.getKey()).getTime();
long yTime = timePattern.parse(y.getKey()).getTime();
if (isDesc) {
return Long.compare(yTime, xTime);
}
return Long.compare(xTime, yTime);
} catch (ParseException e) {
return 0;
}
}).collect(Collectors.toList());
for (Map.Entry<String, T> longTEntry : sortKey) {
res.put(longTEntry.getKey(), longTEntry.getValue());
}
return res;
}
public static <T> Map<Long, T> sortTimeKeyMap(Map<Long, T> map, boolean isDesc) { public static <T> Map<Long, T> sortTimeKeyMap(Map<Long, T> map, boolean isDesc) {
Map<Long, T> res = new LinkedHashMap<>(); Map<Long, T> res = new LinkedHashMap<>();
List<Map.Entry<Long, T>> sortKey = map.entrySet().stream().sorted((x, y) -> { List<Map.Entry<Long, T>> sortKey = map.entrySet().stream().sorted((x, y) -> {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment