use of com.topcom.cms.yuqing.domain.WarningTask 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;
}
use of com.topcom.cms.yuqing.domain.WarningTask in project topcom-cloud by 545314690.
the class WarningLogManagerImpl method formSubject.
@Override
public WarningLog formSubject(CustomSubject subject) {
if (subject == null) {
return null;
}
WarningTask warningTask = subject.getWarning();
if (warningTask == null) {
return null;
}
WarningLog warningLog = new WarningLog();
warningLog.setUserId(subject.getUserId());
warningLog.setSubjectName(subject.getName());
warningLog.setSubjectId(subject.getId());
warningLog.setMustWord(subject.getMustWord());
warningLog.setShouldWord(subject.getShouldWord());
warningLog.setMustNotWord(subject.getMustNotWord());
// 本次预警时间
Date thisWarningDate = new Date();
// 上次预警时间
Date lastWarningDate = warningTask.getLastWarningDate();
if (lastWarningDate == null) {
lastWarningDate = subject.getStartDate();
}
warningLog.setStartDate(DateUtil.dateToString(lastWarningDate));
warningLog.setEndDate(DateUtil.dateToString(thisWarningDate));
// 媒体类型
warningLog.setType(warningTask.getType());
// 情感
warningLog.setSentimentLabel(warningTask.getSentimentLabel());
warningLog.setWarningTaskId(warningTask.getId());
warningLog.setField(warningTask.getFiled());
return warningLog;
}
Aggregations