Commit f1e4fdf3 by shenjunjie

Merge branch 'release' into 'master'

Release

See merge request !157
parents b732279a 73b02661
...@@ -51,7 +51,7 @@ public class EsClientDao { ...@@ -51,7 +51,7 @@ public class EsClientDao {
private static final Logger log = LogManager.getLogger(EsClientDao.class); private static final Logger log = LogManager.getLogger(EsClientDao.class);
protected static final FastDateFormat DF = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss"); protected static final FastDateFormat DF = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss");
private static final String[] CHANNEL_RECORD_FETCH_SOURCE = new String[]{"id", "c5", "foreign", "real_source", "source", "mtime", "time", private static final String[] CHANNEL_RECORD_FETCH_SOURCE = new String[]{"id", "c5", "foreign", "real_source", "source", "mtime", "time",
"brandkbs_cache_maps", "brandkbs_mark_cache_maps"}; "brandkbs_cache_maps", "brandkbs_mark_cache_maps","channel_influence"};
private static final Long ONE_HOUR = 60 * 60 * 1000L; private static final Long ONE_HOUR = 60 * 60 * 1000L;
// 滚动查询超时时间 // 滚动查询超时时间
......
...@@ -139,6 +139,14 @@ public class Channel extends ChannelIndex { ...@@ -139,6 +139,14 @@ public class Channel extends ChannelIndex {
} }
} }
} }
List<Article> articles = Record.sortArticles(record.getArticles());
if (!Tools.isEmpty(articles)) {
Article article = articles.get(0);
JSONObject json = new JSONObject();
json.put("title", article.getTitle());
json.put("url", article.getUrl());
this.setLastArticle(json.toJSONString());
}
} }
public Map<String, Object> createChannelCopyMap() { public Map<String, Object> createChannelCopyMap() {
......
...@@ -161,7 +161,10 @@ public class ChannelIndex extends AbstractBaseMongo { ...@@ -161,7 +161,10 @@ public class ChannelIndex extends AbstractBaseMongo {
public Record(Map<String, Object> esMap) { public Record(Map<String, Object> esMap) {
this.lastTime = Long.parseLong(esMap.get("time") + ""); this.lastTime = Long.parseLong(esMap.get("time") + "");
this.articles.add(Article.fromEsMap(esMap)); this.articles.add(Article.fromEsMap(esMap));
this.influence = Double.valueOf(esMap.get("channel_influence") + ""); Object channelInfluence = esMap.get("channel_influence");
if (null != channelInfluence) {
this.influence = Double.valueOf(channelInfluence + "");
}
this.cacheMaps = (List<Map<String, Object>>) esMap.get(GenericAttribute.ES_BRANDKBS_CACHE_MAPS); this.cacheMaps = (List<Map<String, Object>>) esMap.get(GenericAttribute.ES_BRANDKBS_CACHE_MAPS);
} }
...@@ -174,6 +177,12 @@ public class ChannelIndex extends AbstractBaseMongo { ...@@ -174,6 +177,12 @@ public class ChannelIndex extends AbstractBaseMongo {
public Record mergeRecord(Record record) { public Record mergeRecord(Record record) {
this.articles.addAll(record.getArticles()); this.articles.addAll(record.getArticles());
setLastTime(record.getLastTime()); setLastTime(record.getLastTime());
if (null != record.getInfluence()) {
this.influence = record.getInfluence();
}
if (null != record.getCacheMaps()) {
this.cacheMaps = record.getCacheMaps();
}
return this; return this;
} }
...@@ -219,10 +228,17 @@ public class ChannelIndex extends AbstractBaseMongo { ...@@ -219,10 +228,17 @@ public class ChannelIndex extends AbstractBaseMongo {
Long time; Long time;
Long mtime; Long mtime;
String id; String id;
// String url; String url;
// String title; String title;
int emotion; int emotion;
public Article(Long time, Long mtime, String id, int emotion) {
this.time = time;
this.mtime = mtime;
this.id = id;
this.emotion = emotion;
}
public static Article fromRecordMap(Map<String, Object> recordMap) { public static Article fromRecordMap(Map<String, Object> recordMap) {
Long time = Long.parseLong(recordMap.get("time") + ""); Long time = Long.parseLong(recordMap.get("time") + "");
Long mtime = Long.parseLong(recordMap.get("mtime") + ""); Long mtime = Long.parseLong(recordMap.get("mtime") + "");
...@@ -238,10 +254,10 @@ public class ChannelIndex extends AbstractBaseMongo { ...@@ -238,10 +254,10 @@ public class ChannelIndex extends AbstractBaseMongo {
Long time = baseMap.getTime(); Long time = baseMap.getTime();
Long mtime = Long.parseLong(esMap.get("mtime") + ""); Long mtime = Long.parseLong(esMap.get("mtime") + "");
String id = String.valueOf(esMap.get("id")); String id = String.valueOf(esMap.get("id"));
// String url = baseMap.getUrl(); String url = baseMap.getUrl();
// String title = baseMap.getTitle(); String title = baseMap.getTitle();
String emotionStr = baseMap.getEmotion(); String emotionStr = baseMap.getEmotion();
return new Article(time, mtime, id, EmotionEnum.parseFromName2State(emotionStr)); return new Article(time, mtime, id, url, title, EmotionEnum.parseFromName2State(emotionStr));
} }
public Map<String, Object> toEsMap() { public Map<String, Object> toEsMap() {
......
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