use of com.topcom.cms.yuqing.domain.Keywords 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.yuqing.domain.Keywords in project topcom-cloud by 545314690.
the class BriefingCreatorImpl method sendRequestAndCreateBriefing.
/**
* 根据报告类型和开始结束时间发送请求生成json,并创建附件,保存到数据库
*
* @param briefingTask
* @param startTime
* @param endTime
* @return
* @throws BusinessException
*/
private Future sendRequestAndCreateBriefing(BriefingTask briefingTask, long startTime, long endTime) throws BusinessException {
FutureTask<JSONObject> futureTask = new FutureTask<>(() -> {
Briefing.BriefingType type = briefingTask.getBriefingType();
List<Keywords> keywordList = keywordsManager.findByUserIdAndType(briefingTask.getUserId(), Keywords.Type.BASIC);
if (keywordList.size() > 0) {
Keywords keyword = keywordList.get(0);
String mustWord = keyword.getMustWord();
String shouldWord = keyword.getShouldWord();
String mustNotWord = keyword.getMustNotWord();
try {
String object = requestBriefingString(type, mustWord, shouldWord, mustNotWord, startTime, endTime, null);
DBObject dbObject = (BasicDBObject) JSON.parse(object);
dbObject.put("userId", briefingTask.getUserId());
dbObject.put("type", type.name());
dbObject.put("issue", briefingTask.getIssue());
JSONObject json = JSONObject.fromObject(dbObject);
json.put("dateCreated", endTime);
saveBriefingToMongo(json);
String message = "生成报告成功@" + new Date() + "@" + type.name();
LogUtil.logger.info(message);
return json;
} catch (Exception e) {
e.printStackTrace();
String message = "生成报告失败@" + new Date() + "@" + type.name();
LogUtil.logger.error(message);
throw new BusinessException(message);
}
}
return null;
});
executorService.submit(futureTask);
return futureTask;
}
Aggregations