继续操作前请注册或者登录。
提交 d9d24f75 作者: obcy

【事件关键词同步采集】

上级 ad7ff7a7
......@@ -106,6 +106,8 @@ public class ConfigurationMessageService {
@Autowired
private SubjectService subjectService;
@Autowired
private IEventService eventService;
@Autowired
private IInfoSourceService iInfoSourceService;
@Autowired
......@@ -329,6 +331,34 @@ public class ConfigurationMessageService {
log.error("删除专题缓存失败{}",e.getMessage(),e);
}
}
public void bindKeyWordsEventSend(String eventId) {
Event byId = eventService.getById(eventId);
if (byId == null) {
log.info("未查询到事件");
return;
}
List<String> subjectIdList = new ArrayList<>();
subjectIdList.add(eventId);
List<KeyWordsPage> keyWordsPages = subjectService.bindKeyWordsListByIdsAndBindType(subjectIdList,null,1);
String keyWordsParam;
if (CollectionUtil.isEmpty(keyWordsPages)) {
log.info("事件未绑定采集词组,通知采集清空");
keyWordsParam = getEventKeyWordsParam(byId, null, new ArrayList<>());
}else {
List<KeyWords> keyWords = keyWordsService.listByIds(keyWordsPages.stream().map(KeyWordsPage::getId).collect(Collectors.toList()));
keyWordsParam = getEventKeyWordsParam(byId, null, keyWords);
}
String post = caiJiCenterHttpService.allKeyWordsBindUrl(keyWordsParam);
JSONObject entries = JSONUtil.parseObj(post);
//获取code状态码
Integer code = entries.getInt("code");
if (ObjectUtil.isEmpty(code) || code != 200) {
log.error("事件关键词配置通知采集失败{}",post);
throw new RuntimeException("事件关键词配置通知采集失败");
}
log.info("{}事件关键词配置通知采集结束",byId.getEventName());
}
public void bindInfoSourceSend(String subjectId){
......@@ -561,6 +591,33 @@ public class ConfigurationMessageService {
return JSONUtil.toJsonStr(param);
}
private String getEventKeyWordsParam(Event event ,Integer option,List<KeyWords> keyWords) {
Map<String,Object> param = new HashMap<>();
List<Map<String,Object>> kw = new ArrayList<>();
param.put("subjectSign",event.getId());
param.put("subjectName",event.getEventName());
param.put("customerSign",caiJiCenterHttpService.getProjectCode()+"_event");
param.put("customerName",caiJiCenterHttpService.getProjectName()+"_event");
param.put("mode",option);
if (ObjectUtil.isNotNull(event.getStartTime())) {
param.put("startTime", DateUtil.format(event.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
}else {
param.put("startTime",DateUtil.format(getPreviousMonths(LocalDateTime.now(),6),"yyyy-MM-dd HH:mm:ss"));
}
if (ObjectUtil.isNotNull(event.getEndTime())) {
param.put("endTime",DateUtil.format(event.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
}
keyWords.forEach(e -> {
Map<String,Object> map = new HashMap<>();
map.put("collectWordExp",e.getKeyWord());
map.put("keywordSign",e.getId());
kw.add(map);
});
param.put("keywordList",kw);
return JSONUtil.toJsonStr(param);
}
//日期往前推 num 个月
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论