|
@@ -39,12 +39,16 @@ public class ProductServiceImpl implements ProductService {
|
|
|
* cm_user_search_frequency中keyword为唯一,表中已有添加一次frequency,表中没有则新增,修改时刷新searchTime 最近一次搜索时间
|
|
|
*/
|
|
|
SearchFrequencyVo sea = new SearchFrequencyVo();
|
|
|
- Integer id = baseMapper.findKeywordId(keyword);
|
|
|
- if (null != id) {
|
|
|
- //已存在改次数,不存在插入
|
|
|
- baseMapper.updateKeywordTimes(id);
|
|
|
- sea.setId(id);
|
|
|
- }else{
|
|
|
+ SearchFrequencyVo id = baseMapper.findKeywordId(keyword);
|
|
|
+ if (null != id & null != id.getId()) {
|
|
|
+ //已存在改次数,不存在插入 如果加上本次查询,有三次,则立即修改推荐标记,置入推荐列表
|
|
|
+ if (2 == id.getFrequency()) {
|
|
|
+ baseMapper.updateKeywordRecommend(id.getId());
|
|
|
+ } else {
|
|
|
+ baseMapper.updateKeywordTimes(id.getId());
|
|
|
+ }
|
|
|
+ sea.setId(id.getId());
|
|
|
+ } else {
|
|
|
sea.setFrequency(1);
|
|
|
sea.setKeyword(keyword);
|
|
|
baseMapper.saveInfo(sea);
|
|
@@ -55,7 +59,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
|
|
|
@Override
|
|
|
public void updateAllKeyword() {
|
|
|
- baseMapper.updateAllKeyword();
|
|
|
+ baseMapper.updateAllKeyword();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -63,7 +67,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
//查询本周时间内搜索大于等于三次的
|
|
|
Calendar instance = Calendar.getInstance();
|
|
|
instance.setTime(new Date());
|
|
|
- instance.add(Calendar.WEEK_OF_MONTH,-1);
|
|
|
+ instance.add(Calendar.WEEK_OF_MONTH, -1);
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
List<Integer> ids = baseMapper.getRecommendKeyword(format.format(instance.getTime()));
|
|
|
baseMapper.updateRecommend(ids);
|