提交 b7bd8c2f 作者: yanxin

Merge remote-tracking branch 'origin/event_fusion' into event_fusion

......@@ -205,6 +205,9 @@ public class InformationController {
if (StringUtils.isEmpty(searchCondition.getSubjectId())) {
return Result.FAIL("专题id/专题分类id不能为空");
}
if (searchCondition.getCategory() == null) {
return Result.FAIL("专题类型不能为空");
}
UserVo userVo = UserUtil.getLoginUser();
IPage<DisplayInfo> pageList = informationService.subjectPageList(userVo, searchCondition);
return Result.OK(pageList);
......@@ -220,8 +223,7 @@ public class InformationController {
return Result.FAIL("专题id/专题分类id不能为空");
}
UserVo userVo = UserUtil.getLoginUser();
List<HashMap> pageList = informationService.subjectPageListGroupByLabel(userVo, searchCondition);
return Result.OK(pageList);
return informationService.subjectPageListGroupByLabel(userVo, searchCondition);
}
/**
......
......@@ -1774,29 +1774,34 @@ public class EsService {
if (CollectionUtils.isNotEmpty(subjectIdList)) {
Integer category = searchCondition.getCategory();
boolQuery.must(QueryBuilders.termsQuery("subjectId.keyword", subjectIdList));
//单个专题/事件,默认加上专题/事件的时间范围
if (subjectIdList.size() == 1) {
String configStartTime = null;
String configEndTime = null;
String id = subjectIdList.get(0);
if (category == 1) {
Subject subject = subjectService.getById(id);
Date timeEnable = subject.getTimeEnable();
if (!Objects.isNull(timeEnable)) {
configStartTime = DateUtil.dateToString(timeEnable);
}
Date timeDisable = subject.getTimeDisable();
if (!Objects.isNull(timeDisable)) {
configEndTime = DateUtil.dateToString(timeDisable);
if (!Objects.isNull(subject)) {
Date timeEnable = subject.getTimeEnable();
if (!Objects.isNull(timeEnable)) {
configStartTime = DateUtil.dateToString(timeEnable);
}
Date timeDisable = subject.getTimeDisable();
if (!Objects.isNull(timeDisable)) {
configEndTime = DateUtil.dateToString(timeDisable);
}
}
} else if (category == 2) {
Event event = eventService.getById(id);
Date startTime = event.getStartTime();
if (!Objects.isNull(startTime)) {
configStartTime = DateUtil.dateToString(startTime);
}
Date endTime = event.getEndTime();
if (!Objects.isNull(endTime)) {
configEndTime = DateUtil.dateToString(endTime);
if (!Objects.isNull(event)) {
Date startTime = event.getStartTime();
if (!Objects.isNull(startTime)) {
configStartTime = DateUtil.dateToString(startTime);
}
Date endTime = event.getEndTime();
if (!Objects.isNull(endTime)) {
configEndTime = DateUtil.dateToString(endTime);
}
}
}
//时间过滤筛选-专题配置
......
......@@ -2,6 +2,7 @@ package com.zzsn.event.service;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.ClbFileOperationLog;
import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.*;
......@@ -40,7 +41,7 @@ public interface InformationService {
/**
* 资讯分页列表(根据标签分类分组)
*/
List<HashMap> subjectPageListGroupByLabel(UserVo userVo, InfoDataSearchCondition subjectInfo);
Result subjectPageListGroupByLabel(UserVo userVo, InfoDataSearchCondition subjectInfo);
/**
* 保存数据集-研究中心
......
......@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.event.constant.Constants;
import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.*;
import com.zzsn.event.enums.EnumHandlerStatus;
import com.zzsn.event.enums.EnumOperateWay;
......@@ -155,7 +156,7 @@ public class InformationServiceImpl implements InformationService {
@Override
public List<HashMap> subjectPageListGroupByLabel(UserVo userVo, InfoDataSearchCondition searchCondition) {
public Result subjectPageListGroupByLabel(UserVo userVo, InfoDataSearchCondition searchCondition) {
List<HashMap> list = new ArrayList<>();
Integer category = searchCondition.getCategory();
List<String> subjectIdList = new ArrayList<>();
......@@ -176,7 +177,7 @@ public class InformationServiceImpl implements InformationService {
}
}
if (CollectionUtils.isEmpty(subjectIdList)) {
return list;
return Result.OK(list);
}
try {
IPage<SpecialInformation> specialInformationIPage = esService.pageListByCondition(searchCondition, subjectIdList);
......@@ -202,11 +203,32 @@ public class InformationServiceImpl implements InformationService {
map.put("infoList",displayInfos);
list.add(map);
});
}else{
//不加标签获取列表数据
searchCondition.setLabelMark(null);
specialInformationIPage = esService.pageListByCondition(searchCondition, subjectIdList);
long totalT = specialInformationIPage.getTotal();
if (totalT > 0) {
List<DisplayInfo> dataList = new ArrayList<>();
List<LabelModelVo> labelModelVos = commonService.subjectModelBindLabels(subjectIdList);
Map<String, List<LabelModelVo>> modelMap = labelModelVos.stream().collect(Collectors.groupingBy(LabelModelVo::getSubjectId));
List<SpecialInformation> records = specialInformationIPage.getRecords();
for (SpecialInformation specialInformation : records) {
DisplayInfo info = new DisplayInfo();
BeanUtils.copyProperties(specialInformation, info);
info.setPublishDate(EsDateUtil.esFieldDateMapping(info.getPublishDate()));
//标签处理
List<LabelModelVo> modelVoList = modelMap.get(info.getSubjectId());
formatLabel(modelVoList, info);
dataList.add(info);
}
return Result.OK(dataList);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return list;
return Result.OK(list);
}
public Map<String, List<DisplayInfo>> groupedByLabelMark(List<DisplayInfo> dataList) {
......
......@@ -55,9 +55,9 @@ public class EventHotTask {
*/
@Scheduled(cron = "0 0 0/3 * * ?")
public void hot() {
LambdaQueryWrapper<Event> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(Event::getFacePublic,1).eq(Event::getPublishStatus,1);
List<Event> list = eventService.list(queryWrapper);
//LambdaQueryWrapper<Event> queryWrapper = Wrappers.lambdaQuery();
//queryWrapper.eq(Event::getFacePublic,1).eq(Event::getPublishStatus,1);
List<Event> list = eventService.list();
List<HotVO> countList = new ArrayList<>();
for (Event event : list) {
CompletableFuture<HotVO> async = CompletableFuture.supplyAsync(() -> {
......
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.entity.Event;
import com.zzsn.event.entity.EventClb;
import com.zzsn.event.entity.EventTag;
import com.zzsn.event.entity.EventTagClb;
import com.zzsn.event.mapper.EventClbMapper;
......@@ -49,18 +50,18 @@ public class SynClbEventDataTask {
return;
}
log.info("同步克虏宝中事件信息到研究中心数据库开始");
LambdaQueryWrapper<Event> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(Event::getFacePublic,1).eq(Event::getPublishStatus,1);
List<Event> list = eventService.list(queryWrapper);
//LambdaQueryWrapper<Event> queryWrapper = Wrappers.lambdaQuery();
//queryWrapper.eq(Event::getFacePublic,1).eq(Event::getPublishStatus,1);
List<Event> list = eventService.list();
for (Event event : list) {
try{
// 克虏宝事件表
String eventId = event.getId();
EventVO eventVOClb = eventClbMapper.queryInfo(eventId);
if (eventVOClb != null) {
EventClb eventClb = eventClbMapper.selectById(eventId);
if (eventClb != null) {
LambdaUpdateWrapper<Event> lambdaUpdateWrapper = Wrappers.lambdaUpdate(Event.class).eq(Event::getId, eventId)
.set(Event::getRelationEvents, eventVOClb.getRelationEvents()) // 事件关联事件
.set(Event::getEventLabel, eventVOClb.getEventLabel()) // 事件表中打的标签
.set(Event::getRelationEvents, eventClb.getRelationEvents()) // 事件关联事件
.set(Event::getEventLabel, eventClb.getEventLabel()) // 事件表中打的标签
// total_hot根据所有事件定时统计,这个使用研究中心自己的
;
eventService.update(lambdaUpdateWrapper);
......@@ -70,7 +71,7 @@ public class SynClbEventDataTask {
.last(" limit 1"));
LambdaUpdateWrapper<EventTag> tagUpdateWrapper = Wrappers.lambdaUpdate(EventTag.class)
.eq(EventTag::getEventId, eventId)
.set(EventTag::getExtractIndustryTag, eventTagClb.getExtractIndustryTag()) // 事件关联事件
.set(EventTag::getExtractIndustryTag, eventTagClb.getExtractIndustryTag())
.set(EventTag::getExtractCompanyTag, eventTagClb.getExtractCompanyTag())
.set(EventTag::getExtractPersonTag, eventTagClb.getExtractPersonTag())
.set(EventTag::getExtractSentimentTag, eventTagClb.getExtractSentimentTag())
......
......@@ -8,6 +8,8 @@ import java.util.List;
@Data
public class InfoDataSearchCondition {
//subjectId是否专题id(1-是;0-否)
private String isSubject = "1";
//专题id/专题分类id
private String subjectId;
......@@ -64,8 +66,7 @@ public class InfoDataSearchCondition {
private Integer category;
//是否视频 "video"
private String video;
//subjectId是否专题id(1-是;0-否)
private String isSubject = "1";
//爬虫类型
private String crawler;
/**----企业类标签筛选----**/
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论