未验证 提交 0f834121 编写于 作者: X Xinyao Qian 提交者: GitHub

Merge pull request #9 from carsickcars/master

recommendation can be null
......@@ -3,21 +3,15 @@
*/
package top.qianxinyao.hotrecommend;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.log4j.Logger;
import top.qianxinyao.algorithms.RecommendAlgorithm;
import top.qianxinyao.algorithms.RecommendKit;
import top.qianxinyao.model.Newslogs;
import top.qianxinyao.model.Recommendations;
import java.sql.Timestamp;
import java.util.*;
/**
* @author qianxinyao
* @email tomqianmaple@gmail.com
......@@ -51,8 +45,11 @@ public class HotRecommender implements RecommendAlgorithm
+ "' and user_id='" + userId + "' group by user_id");
boolean flag=(recommendation!=null);
int delta=flag?TOTAL_REC_NUM - recommendation.getInt("recnums"):TOTAL_REC_NUM;
Integer tmpRecNums=0;
if(recommendation!=null) {
tmpRecNums = recommendation.getInt("recnums");
}
int delta=flag?TOTAL_REC_NUM - Integer.valueOf(tmpRecNums.toString()):TOTAL_REC_NUM;
Set<Long> toBeRecommended = new HashSet<Long>();
if (delta > 0)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册