use of com.topcom.cms.data.domain.News in project topcom-cloud by 545314690.
the class AccidentYuqingController method getAccidentArticle.
private Page<News> getAccidentArticle(DateParam dateParam, Accident accident) {
String companyName = accident.getCompanyName();
String atype = accident.getAtype();
String city = accident.getCity();
Keywords keywords = null;
if (StringUtils.isNotBlank(companyName)) {
keywords = new Keywords(companyName, atype + "@" + city);
} else {
keywords = new Keywords("事故", atype + "@" + city);
}
Page<News> page = newsService.findByMustShouldDateInType(keywords.getMustWord(), keywords.getShouldWord(), keywords.getMustNotWord(), DateUtil.dateToString(dateParam.startDate()), DateUtil.dateToString(dateParam.endDate()), "content", 0, 1, "pubTime", 1);
return page;
}
use of com.topcom.cms.data.domain.News in project topcom-cloud by 545314690.
the class WarningManagerImpl method getSubjectWarningInfo.
@Deprecated
@Override
public Page<News> getSubjectWarningInfo(CustomSubject subject, int pageNum, int limit) {
WarningTask warning = subject.getWarning();
if (warning == null) {
return new PageImpl<News>(new ArrayList<News>());
}
BoolQueryRequest request = new BoolQueryRequest();
request.setType(null);
request.setFiled(null);
request.setKeyword(new Keyword(subject.getMustWord(), subject.getShouldWord(), subject.getMustNotWord()));
// 本次预警时间
Date thisWarningDate = new Date();
// 上次预警时间
Date lastWarningDate = warning.getLastWarningDate();
if (lastWarningDate == null) {
lastWarningDate = subject.getStartDate();
}
request.setDate(new DateParam(DateUtil.dateToString(lastWarningDate), DateUtil.dateToString(thisWarningDate)));
request.setPage(new PageRequest(pageNum, limit, new Order(Sort.Direction.DESC, "pubTime")));
List<KV> kvList = new ArrayList<>();
// 媒体类型
String[] type = warning.getType();
if (type != null && type.length > 0) {
kvList.add(new KV("type", type));
}
String[] sentimentLabel = warning.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;
}
Aggregations