Search in sources :

Example 1 with News

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;
}
Also used : Keywords(com.topcom.cms.yuqing.domain.Keywords) News(com.topcom.cms.data.domain.News)

Example 2 with News

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;
}
Also used : PageImpl(org.springframework.data.domain.PageImpl) Order(com.topcom.cms.common.page.Order) BoolQueryRequest(com.topcom.cms.es.vo.BoolQueryRequest) Keyword(com.topcom.cms.es.vo.Keyword) ArrayList(java.util.ArrayList) Page(org.springframework.data.domain.Page) KV(com.topcom.cms.es.vo.KV) Date(java.util.Date) PageRequest(com.topcom.cms.common.page.PageRequest) News(com.topcom.cms.data.domain.News) WarningTask(com.topcom.cms.yuqing.domain.WarningTask) DateParam(com.topcom.cms.common.page.DateParam)

Aggregations

News (com.topcom.cms.data.domain.News)2 DateParam (com.topcom.cms.common.page.DateParam)1 Order (com.topcom.cms.common.page.Order)1 PageRequest (com.topcom.cms.common.page.PageRequest)1 BoolQueryRequest (com.topcom.cms.es.vo.BoolQueryRequest)1 KV (com.topcom.cms.es.vo.KV)1 Keyword (com.topcom.cms.es.vo.Keyword)1 Keywords (com.topcom.cms.yuqing.domain.Keywords)1 WarningTask (com.topcom.cms.yuqing.domain.WarningTask)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 Page (org.springframework.data.domain.Page)1 PageImpl (org.springframework.data.domain.PageImpl)1