Commit 26b458d8 by chenweitao

Merge branch 'working' into 'master'

评论量讨论量数据类型超限

See merge request !80
parents b9b6305c 00b41a46
...@@ -77,8 +77,8 @@ public class HotSearchCacheDAO { ...@@ -77,8 +77,8 @@ public class HotSearchCacheDAO {
try { try {
String name = document.getString("name"); String name = document.getString("name");
String type = document.getString("type"); String type = document.getString("type");
Integer lastRank = document.getInteger("rank")!=null?document.getInteger("rank"): null; Long lastRank = document.getLong("rank")!=null?document.getLong("rank"): null;
Integer lastCount = document.getInteger("count")!=null?document.getInteger("count"): null; Long lastCount = document.getLong("count")!=null?document.getLong("count"): null;
Date startTime = document.getDate("time"); Date startTime = document.getDate("time");
Date endTime = getEndTime(type, startTime); Date endTime = getEndTime(type, startTime);
String topicLead = document.getString("topic_lead")!=null?document.getString("topic_lead"):null; String topicLead = document.getString("topic_lead")!=null?document.getString("topic_lead"):null;
...@@ -101,10 +101,10 @@ public class HotSearchCacheDAO { ...@@ -101,10 +101,10 @@ public class HotSearchCacheDAO {
if(Objects.nonNull(lastRank) && lastRank >0 ){ if(Objects.nonNull(lastRank) && lastRank >0 ){
Document nowDoc = (Document) collection.find(query).first(); Document nowDoc = (Document) collection.find(query).first();
if (Objects.nonNull(nowDoc)) { if (Objects.nonNull(nowDoc)) {
Integer highestRank = nowDoc.getInteger("highestRank"); Long highestRank = nowDoc.getLong("highestRank");
Integer highestCount = nowDoc.getInteger("highestCount"); Long highestCount = nowDoc.getLong("highestCount");
Integer preRank = nowDoc.getInteger("lastRank"); Integer preRank = nowDoc.getInteger("lastRank");
Integer preCount = nowDoc.getInteger("lastCount"); Long preCount = nowDoc.getLong("lastCount");
String lastUrl = nowDoc.getString("url"); String lastUrl = nowDoc.getString("url");
//判断最大热度值 //判断最大热度值
if (Objects.nonNull(lastCount) && Objects.nonNull(highestCount) && lastCount > highestCount) { if (Objects.nonNull(lastCount) && Objects.nonNull(highestCount) && lastCount > highestCount) {
...@@ -123,7 +123,7 @@ public class HotSearchCacheDAO { ...@@ -123,7 +123,7 @@ public class HotSearchCacheDAO {
//计算上升速度 //计算上升速度
double riseSpeed = nowDoc.containsKey("riseSpeed")?nowDoc.getDouble("riseSpeed"):0.00; double riseSpeed = nowDoc.containsKey("riseSpeed")?nowDoc.getDouble("riseSpeed"):0.00;
if(Objects.nonNull(lastCount) && nowDoc.containsKey("firstCount")) { if(Objects.nonNull(lastCount) && nowDoc.containsKey("firstCount")) {
int firstCount = nowDoc.getInteger("firstCount"); long firstCount = nowDoc.getLong("firstCount");
riseSpeed = ((double)(lastCount - firstCount)/(double)firstCount)*1000/((double)duration); riseSpeed = ((double)(lastCount - firstCount)/(double)firstCount)*1000/((double)duration);
} }
// endTime = getEndTime(type, new Date()); // endTime = getEndTime(type, new Date());
...@@ -191,8 +191,8 @@ public class HotSearchCacheDAO { ...@@ -191,8 +191,8 @@ public class HotSearchCacheDAO {
nowDoc.put("topicLead", nowDoc.getString("topicLead")); nowDoc.put("topicLead", nowDoc.getString("topicLead"));
} }
if(nowDoc.containsKey("readCount") && nowDoc.containsKey("discussCount")) { if(nowDoc.containsKey("readCount") && nowDoc.containsKey("discussCount")) {
nowDoc.put("readCount", nowDoc.getInteger("readCount")); nowDoc.put("readCount", nowDoc.getLong("readCount"));
nowDoc.put("discussCount", nowDoc.getInteger("discussCount")); nowDoc.put("discussCount", nowDoc.getLong("discussCount"));
} }
if (nowDoc.containsKey("pictureUrl")) { if (nowDoc.containsKey("pictureUrl")) {
nowDoc.put("pictureUrl",nowDoc.getString("pictureUrl")); nowDoc.put("pictureUrl",nowDoc.getString("pictureUrl"));
...@@ -205,7 +205,7 @@ public class HotSearchCacheDAO { ...@@ -205,7 +205,7 @@ public class HotSearchCacheDAO {
} }
} }
}catch (Exception e){ }catch (Exception e){
log.info("数据存储时出错:{}", e); log.error("数据存储时出错:{}", e);
} }
} }
......
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