use of com.topcom.cms.common.page.PageRequest in project topcom-cloud by 545314690.
the class WarningLogManagerImpl method getWarningInfo.
@Override
public Page getWarningInfo(WarningLog warningLog, int pageNum, int limit) {
if (warningLog == null) {
return new PageImpl<>(new ArrayList<>());
}
BoolQueryRequest request = new BoolQueryRequest();
request.setType(null);
request.setFiled(warningLog.getField());
request.setKeyword(new Keyword(warningLog.getMustWord(), warningLog.getShouldWord(), warningLog.getMustNotWord()));
/**
* 数据发布时间:暂定三天内
*/
// TODO:三天内合适不?
// Date now = new Date();
// request.setDate(new DateParam(DateUtil.dateToString(DateUtils.addDays(now, -3)), DateUtil.dateToString(now)));
/**
* 数据保存时间
*/
request.setDateCreated(new DateParam(warningLog.getStartDate(), warningLog.getEndDate()));
Date now = request.getDateCreated().endDate();
request.setDate(new DateParam(DateUtil.dateToString(DateUtils.addDays(now, -3)), DateUtil.dateToString(now)));
request.setPage(new PageRequest(pageNum, limit, new Order(Sort.Direction.DESC, "pubTime")));
List<KV> kvList = new ArrayList<>();
// 媒体类型
String[] type = warningLog.getType();
if (type != null && type.length > 0) {
request.setType(type);
}
String[] sentimentLabel = warningLog.getSentimentLabel();
// 情感类型
if (sentimentLabel != null && sentimentLabel.length > 0) {
kvList.add(new KV("nlp.sentiment.label", sentimentLabel));
}
request.setSearchKv(kvList);
final Page page = newsService.findByMustShouldDateInType(request);
return page;
}
use of com.topcom.cms.common.page.PageRequest in project topcom-cloud by 545314690.
the class DescriptionManagerImpl method weeklyOutline.
@Override
public Object weeklyOutline(BoolQueryRequest boolQueryRequest) {
boolQueryRequest.setPage(new PageRequest(1, 1));
JSONObject jsonObject = new JSONObject();
Page page = allESDataService.findByMustShouldDateInType(boolQueryRequest);
jsonObject.put("weekCount", page.getTotalElements());
jsonObject.put("wow", getmom(boolQueryRequest, "week"));
jsonObject.put("maxSite", getMaxType(boolQueryRequest, "site"));
jsonObject.put("maxType", getMaxType(boolQueryRequest, "type"));
jsonObject.put("compare", compareWithLastMonthEverySite(boolQueryRequest, "week"));
jsonObject.put("label", getMaxType(boolQueryRequest, "nlp.sentiment.label"));
return jsonObject;
}
Aggregations