Commit 3b73fcce authored by 赵啸非's avatar 赵啸非

修改热门词汇

parent 69825b45
Pipeline #2408 canceled with stages
...@@ -12,7 +12,9 @@ import com.mortals.framework.model.Context; ...@@ -12,7 +12,9 @@ import com.mortals.framework.model.Context;
import com.mortals.xhx.module.baseset.dao.BasesetDao; import com.mortals.xhx.module.baseset.dao.BasesetDao;
import com.mortals.xhx.module.baseset.model.BasesetEntity; import com.mortals.xhx.module.baseset.model.BasesetEntity;
import com.mortals.xhx.module.baseset.service.BasesetService; import com.mortals.xhx.module.baseset.service.BasesetService;
import org.springframework.util.ObjectUtils;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -31,13 +33,34 @@ public class BasesetServiceImpl extends AbstractCRUDServiceImpl<BasesetDao, Base ...@@ -31,13 +33,34 @@ public class BasesetServiceImpl extends AbstractCRUDServiceImpl<BasesetDao, Base
@Override @Override
protected void findAfter(BasesetEntity params, PageInfo pageInfo, Context context, List<BasesetEntity> list) throws AppException { protected void findAfter(BasesetEntity params, PageInfo pageInfo, Context context, List<BasesetEntity> list) throws AppException {
list.forEach(item -> { list.forEach(item -> {
List<HotwordEntity> hotwordEntities = hotwordService.find(new HotwordQuery().siteId(item.getSiteId())); List<HotwordEntity> hotwordEntities = hotwordService.find(new HotwordQuery().siteId(item.getSiteId()));
item.setHotwordList(hotwordEntities); item.setHotwordList(hotwordEntities);
}); });
super.findAfter(params, pageInfo, context, list);
}
@Override
protected void saveAfter(BasesetEntity entity, Context context) throws AppException {
if(!ObjectUtils.isEmpty(entity.getHotwordList())){
//更新新增热门词汇
entity.getHotwordList().forEach(item -> {
HotwordEntity hotwordEntity = hotwordService.selectOne(new HotwordQuery().siteId(item.getSiteId()).hotwords(item.getHotwords()));
if (!ObjectUtils.isEmpty(hotwordEntity)) {
item.setId(hotwordEntity.getId());
item.setSearchCount(hotwordEntity.getSearchCount());
item.setUpdateTime(new Date());
hotwordService.update(item,context);
}else{
item.setCreateUserId(this.getContextUserId(context));
item.setCreateTime(new Date());
hotwordService.save(item,context);
}
});
}
super.findAfter(params, pageInfo, context, list);
super.saveAfter(entity, context);
} }
} }
\ No newline at end of file
...@@ -55,11 +55,11 @@ Content-Type: application/json ...@@ -55,11 +55,11 @@ Content-Type: application/json
"siteId": 3, "siteId": 3,
"hotwords": "测试1", "hotwords": "测试1",
"searchCount": 0, "searchCount": 0,
"wordsSource": 1 "wordsSource": 0
}, },
{ {
"siteId": 3, "siteId": 3,
"hotwords": "测试2", "hotwords": "测试3",
"searchCount": 0, "searchCount": 0,
"wordsSource": 1 "wordsSource": 1
} }
......
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