Commit c56488f1 by chenweitao

Merge branch 'working' into 'master'

脉脉新增content字段,存真实文本内容

See merge request !142
parents 2dabf311 3c0900f2
......@@ -118,6 +118,11 @@ public class HotSearchList implements Serializable{
*/
private String downtext;
/**
* 内容
*/
private String content;
public HotSearchList(){}
public HotSearchList(String url, String name, Long count,Boolean hot,Integer rank,String type,String icon,Date date){
......
......@@ -48,6 +48,8 @@ public class MaiMaiHotSearchCrawler {
JSONObject jsonObject = jsonArray.getJSONObject(i).getJSONObject("style35");
if(jsonObject != null) {
String name = jsonObject.getString("text");
//真实文本长度
String content=name;
// 1024 - 26(时间戳+type)
// name.getBytes(StandardCharsets.UTF_8).length<998)
if (name.length()>nameLengthMax){
......@@ -61,6 +63,10 @@ public class MaiMaiHotSearchCrawler {
String hotValue = jsonArray.getJSONObject(i).getJSONObject("common").getString("hot_info");
Long count = hotValue.length() > 0 ? TipsUtils.getHotCount(hotValue) : 0;
HotSearchList hotSearchList = new HotSearchList(maimaiUrl, name, count, null, rank, HotSearchType.脉脉热榜.name(), icon, date);
//判断一下真实文本长度,如果大于332字符长度,则存储
if (content.length()>nameLengthMax){
hotSearchList.setContent(content);
}
list.add(hotSearchList);
}
}
......
......@@ -52,6 +52,9 @@ public class HotSearchCacheDAO {
document.put("topic_lead", hotSearch.getTopicLead());
document.put("comment_count", hotSearch.getCommentCount());
}
if ("脉脉热榜".equals(hotSearch.getType())) {
document.put("content", hotSearch.getContent());
}
if ("微博热搜".equals(hotSearch.getType())) {
document.put("iconUrl", hotSearch.getIconUrl());
document.put("heatLabel", hotSearch.getHeatLabel());
......@@ -241,6 +244,9 @@ public class HotSearchCacheDAO {
// if(readCount != null){
// nowDoc.put("readCount",readCount);
// }
if ("脉脉热榜".equals(type)) {
nowDoc.put("content", document.getString("content"));
}
if ("虎嗅热文推荐".equals(type)) {
nowDoc.put("comment_count", document.getLong("comment_count"));
}
......
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