Commit f1e4fdf3 by shenjunjie

Merge branch 'release' into 'master'

Release

See merge request !157
parents b732279a 73b02661
......@@ -51,7 +51,7 @@ public class EsClientDao {
private static final Logger log = LogManager.getLogger(EsClientDao.class);
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",
"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;
// 滚动查询超时时间
......
......@@ -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() {
......
......@@ -161,7 +161,10 @@ public class ChannelIndex extends AbstractBaseMongo {
public Record(Map<String, Object> esMap) {
this.lastTime = Long.parseLong(esMap.get("time") + "");
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);
}
......@@ -174,6 +177,12 @@ public class ChannelIndex extends AbstractBaseMongo {
public Record mergeRecord(Record record) {
this.articles.addAll(record.getArticles());
setLastTime(record.getLastTime());
if (null != record.getInfluence()) {
this.influence = record.getInfluence();
}
if (null != record.getCacheMaps()) {
this.cacheMaps = record.getCacheMaps();
}
return this;
}
......@@ -219,10 +228,17 @@ public class ChannelIndex extends AbstractBaseMongo {
Long time;
Long mtime;
String id;
// String url;
// String title;
String url;
String title;
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) {
Long time = Long.parseLong(recordMap.get("time") + "");
Long mtime = Long.parseLong(recordMap.get("mtime") + "");
......@@ -238,10 +254,10 @@ public class ChannelIndex extends AbstractBaseMongo {
Long time = baseMap.getTime();
Long mtime = Long.parseLong(esMap.get("mtime") + "");
String id = String.valueOf(esMap.get("id"));
// String url = baseMap.getUrl();
// String title = baseMap.getTitle();
String url = baseMap.getUrl();
String title = baseMap.getTitle();
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() {
......
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