提交 c1bb8d09 作者: 925993793@qq.com

调试bug修改

上级 7c581c80
...@@ -14,7 +14,6 @@ import com.zzsn.event.constant.Result; ...@@ -14,7 +14,6 @@ import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.*; import com.zzsn.event.entity.*;
import com.zzsn.event.enums.AnalysisColumnEnum; import com.zzsn.event.enums.AnalysisColumnEnum;
import com.zzsn.event.es.EsService; import com.zzsn.event.es.EsService;
import com.zzsn.event.llm.LlmService;
import com.zzsn.event.service.*; import com.zzsn.event.service.*;
import com.zzsn.event.util.CalculateUtil; import com.zzsn.event.util.CalculateUtil;
import com.zzsn.event.util.RedisUtil; import com.zzsn.event.util.RedisUtil;
...@@ -280,7 +279,7 @@ public class EventAnalysisController { ...@@ -280,7 +279,7 @@ public class EventAnalysisController {
} else { } else {
List<CoOccurrenceVO> coOccurrenceVOS = analysisService.coOccurrence(eventId, startTime, endTime); List<CoOccurrenceVO> coOccurrenceVOS = analysisService.coOccurrence(eventId, startTime, endTime);
if (CollectionUtils.isNotEmpty(coOccurrenceVOS)) { if (CollectionUtils.isNotEmpty(coOccurrenceVOS)) {
redisUtil.set(key, coOccurrenceVOS,3600 * 24); redisUtil.set(key, coOccurrenceVOS, 3600 * 24);
} }
return Result.OK(coOccurrenceVOS); return Result.OK(coOccurrenceVOS);
} }
...@@ -357,7 +356,7 @@ public class EventAnalysisController { ...@@ -357,7 +356,7 @@ public class EventAnalysisController {
/** /**
* 3.6 信息传播走势 * 3.6 信息传播走势
* *
* @param subjectId 专题id * @param eventId 专题id
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param type 1-按小时;2-按天 * @param type 1-按小时;2-按天
...@@ -365,11 +364,11 @@ public class EventAnalysisController { ...@@ -365,11 +364,11 @@ public class EventAnalysisController {
* @date 2024/1/25 * @date 2024/1/25
*/ */
@GetMapping("/flowData") @GetMapping("/flowData")
public Result<?> flowData(@RequestParam String subjectId, public Result<?> flowData(@RequestParam String eventId,
@RequestParam String startTime, @RequestParam String startTime,
@RequestParam(required = false) String endTime, @RequestParam(required = false) String endTime,
@RequestParam Integer type) { @RequestParam Integer type) {
Map<String, String> map = esStatisticsService.totalAndMax(subjectId, null, null, type); Map<String, String> map = esStatisticsService.totalAndMax(eventId, null, null, type);
String totalCount = map.get("totalCount"); String totalCount = map.get("totalCount");
List<CountVO> list = new ArrayList<>(); List<CountVO> list = new ArrayList<>();
if (!totalCount.equals("0")) { if (!totalCount.equals("0")) {
...@@ -377,7 +376,7 @@ public class EventAnalysisController { ...@@ -377,7 +376,7 @@ public class EventAnalysisController {
Map<String, String> timeRangeMap = getTimeRange(startTime, endTime, maxTime, type); Map<String, String> timeRangeMap = getTimeRange(startTime, endTime, maxTime, type);
startTime = timeRangeMap.get("startTime"); startTime = timeRangeMap.get("startTime");
endTime = timeRangeMap.get("endTime"); endTime = timeRangeMap.get("endTime");
List<CountVO> dataList = esStatisticsService.flowData(subjectId, startTime, endTime, type); List<CountVO> dataList = esStatisticsService.flowData(eventId, startTime, endTime, type);
list = supplyChildren(dataList, startTime, endTime, type); list = supplyChildren(dataList, startTime, endTime, type);
} }
return Result.OK(list); return Result.OK(list);
...@@ -404,15 +403,15 @@ public class EventAnalysisController { ...@@ -404,15 +403,15 @@ public class EventAnalysisController {
/** /**
* 按来源分析 * 按来源分析
* *
* @param subjectId 专题id * @param eventId 事件id
* @author lkg * @author lkg
* @date 2024/1/25 * @date 2024/1/25
*/ */
@GetMapping("/origin") @GetMapping("/origin")
public Result<?> origin(@RequestParam String subjectId, public Result<?> origin(@RequestParam String eventId,
@RequestParam(required = false) String startTime, @RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime) { @RequestParam(required = false) String endTime) {
List<CountVO> list = esStatisticsService.origin(subjectId, startTime, endTime); List<CountVO> list = esStatisticsService.origin(eventId, startTime, endTime);
return Result.OK(list); return Result.OK(list);
} }
......
...@@ -236,9 +236,6 @@ public class Event { ...@@ -236,9 +236,6 @@ public class Event {
private String estimateStatus; private String estimateStatus;
/** 环境 1-测试 2-正式 */ /** 环境 1-测试 2-正式 */
private String environment; private String environment;
/**数据范围(是否是全库) - 采集库全库-1,企业库全库-2,政策库全库-3*/
@TableField(updateStrategy = FieldStrategy.IGNORED) // 忽略更新策略
private String dataScope;
/** /**
* 关键词信息 * 关键词信息
*/ */
......
...@@ -239,6 +239,7 @@ public class EsService { ...@@ -239,6 +239,7 @@ public class EsService {
* @param searchWord 搜索词 * @param searchWord 搜索词
* @param position 搜索位置(title-标题;content-内容) * @param position 搜索位置(title-标题;content-内容)
* @param category 匹配度(1-模糊;2-精确) * @param category 匹配度(1-模糊;2-精确)
* @param origin 来源
* @param column 排序字段 * @param column 排序字段
* @param order 排序方式(asc-正序;desc-倒序) * @param order 排序方式(asc-正序;desc-倒序)
* @param pageNo 当前页 * @param pageNo 当前页
...@@ -246,8 +247,8 @@ public class EsService { ...@@ -246,8 +247,8 @@ public class EsService {
* @author lkg * @author lkg
* @date 2024/4/10 * @date 2024/4/10
*/ */
public IPage<SubjectDataVo> frontListByPage(List<String> subjectIdList, String searchWord, String position, Integer category, public IPage<SubjectDataVo> frontListByPage(List<String> subjectIdList, String searchWord, String position, Integer category, String origin,
String labelId, String column, String order, int pageNo, int pageSize) { String labelId, String startTime, String endTime, String column, String order, int pageNo, int pageSize) {
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX); SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
//设置分页参数 //设置分页参数
...@@ -284,9 +285,22 @@ public class EsService { ...@@ -284,9 +285,22 @@ public class EsService {
boolQuery.must(QueryBuilders.matchPhraseQuery(position, searchWord)); boolQuery.must(QueryBuilders.matchPhraseQuery(position, searchWord));
} }
} }
if (StringUtils.isNotBlank(origin)) {
boolQuery.must(QueryBuilders.matchPhraseQuery("origin", origin));
}
if (StringUtils.isNotBlank(labelId)) { if (StringUtils.isNotBlank(labelId)) {
boolQuery.must(QueryBuilders.nestedQuery("labels", QueryBuilders.termQuery("labels.relationId", labelId), ScoreMode.None)); boolQuery.must(QueryBuilders.nestedQuery("labels", QueryBuilders.termQuery("labels.relationId", labelId), ScoreMode.None));
} }
if (StringUtils.isNotBlank(startTime) || StringUtils.isNotBlank(endTime)) {
RangeQueryBuilder rangeQueryBuilder = QueryBuilders.rangeQuery("publishDate");
if (StringUtils.isNotBlank(startTime)) {
rangeQueryBuilder.gte(EsDateUtil.esFieldDateFormat(startTime));
}
if (StringUtils.isNotBlank(endTime)) {
rangeQueryBuilder.lte(EsDateUtil.esFieldDateFormat(endTime));
}
boolQuery.filter(rangeQueryBuilder);
}
boolQuery.mustNot(QueryBuilders.termQuery("deleteFlag", "1")); boolQuery.mustNot(QueryBuilders.termQuery("deleteFlag", "1"));
searchSourceBuilder.query(boolQuery); searchSourceBuilder.query(boolQuery);
searchRequest.source(searchSourceBuilder); searchRequest.source(searchSourceBuilder);
...@@ -701,11 +715,11 @@ public class EsService { ...@@ -701,11 +715,11 @@ public class EsService {
infoSourceIdList.addAll(wordsIdList); infoSourceIdList.addAll(wordsIdList);
} }
//装配信息源的条件 //装配信息源的条件
if (!StrUtil.contains(byId.getDataScope(),"1") && CollectionUtils.isNotEmpty(infoSourceIdList)) { if (!StrUtil.contains(byId.getDataScope(), "1") && CollectionUtils.isNotEmpty(infoSourceIdList)) {
boolQuery.must(QueryBuilders.termsQuery("sid", infoSourceIdList.stream().filter(StringUtils::isNotEmpty).collect(Collectors.toList()))); boolQuery.must(QueryBuilders.termsQuery("sid", infoSourceIdList.stream().filter(StringUtils::isNotEmpty).collect(Collectors.toList())));
} else if (StrUtil.contains(byId.getDataScope(),"1")) { } else if (StrUtil.contains(byId.getDataScope(), "1")) {
}else if (!Constants.COLLECT_INDEX.equals(index)){ } else if (!Constants.COLLECT_INDEX.equals(index)) {
} else { } else {
return new Page<>(); return new Page<>();
...@@ -714,7 +728,7 @@ public class EsService { ...@@ -714,7 +728,7 @@ public class EsService {
boolQuery.must(QueryBuilders.termQuery("sid", eventDataCondition.getSourceId())); boolQuery.must(QueryBuilders.termQuery("sid", eventDataCondition.getSourceId()));
} }
// //
specialQuery(byId,eventDataCondition, boolQuery); specialQuery(byId, eventDataCondition, boolQuery);
//高级查询数据处理 //高级查询数据处理
BoolQueryBuilder superQuery = buildSuperQuery(eventDataCondition.getSuperQueryMatchType(), eventDataCondition.getSuperQueryParams()); BoolQueryBuilder superQuery = buildSuperQuery(eventDataCondition.getSuperQueryMatchType(), eventDataCondition.getSuperQueryParams());
if (superQuery != null) { if (superQuery != null) {
...@@ -776,7 +790,7 @@ public class EsService { ...@@ -776,7 +790,7 @@ public class EsService {
} }
private void specialQuery(Subject byId, InfoDataSearchCondition eventDataCondition, BoolQueryBuilder boolQuery) { private void specialQuery(Subject byId, InfoDataSearchCondition eventDataCondition, BoolQueryBuilder boolQuery) {
if (StrUtil.isNotBlank(byId.getEsIndex()) && "researchreportdata".equals(byId.getEsIndex()) && StrUtil.equals(byId.getId(),"1662011688013963265")){ if (StrUtil.isNotBlank(byId.getEsIndex()) && "researchreportdata".equals(byId.getEsIndex()) && StrUtil.equals(byId.getId(), "1662011688013963265")) {
//研报库数据,查询企业库的研报类型的数据 //研报库数据,查询企业库的研报类型的数据
boolQuery.must(QueryBuilders.termQuery("type.keyword", "0")); boolQuery.must(QueryBuilders.termQuery("type.keyword", "0"));
} }
...@@ -2506,27 +2520,27 @@ public class EsService { ...@@ -2506,27 +2520,27 @@ public class EsService {
if (CollectionUtils.isNotEmpty(searchCondition.getSpecialLabelParams())) { if (CollectionUtils.isNotEmpty(searchCondition.getSpecialLabelParams())) {
cn.hutool.json.JSONObject params = searchCondition.getSpecialLabelParams(); cn.hutool.json.JSONObject params = searchCondition.getSpecialLabelParams();
String entityObjectId = params.getStr("entityObjectId"); String entityObjectId = params.getStr("entityObjectId");
if (StrUtil.isNotBlank(entityObjectId) && ("1892197364882550786".equals(entityObjectId) || "1874728877847257089".equals(entityObjectId))){ if (StrUtil.isNotBlank(entityObjectId) && ("1892197364882550786".equals(entityObjectId) || "1874728877847257089".equals(entityObjectId))) {
cn.hutool.json.JSONArray jsonArray = params.getJSONArray("labelCodeList"); cn.hutool.json.JSONArray jsonArray = params.getJSONArray("labelCodeList");
if (ObjectUtil.isNotEmpty(jsonArray) && !jsonArray.isEmpty()){ if (ObjectUtil.isNotEmpty(jsonArray) && !jsonArray.isEmpty()) {
jsonArray.forEach(e -> { jsonArray.forEach(e -> {
cn.hutool.json.JSONObject jsonObject = (cn.hutool.json.JSONObject) e; cn.hutool.json.JSONObject jsonObject = (cn.hutool.json.JSONObject) e;
String labelCode = jsonObject.getStr("labelCode"); String labelCode = jsonObject.getStr("labelCode");
if (StrUtil.isNotBlank(labelCode)){ if (StrUtil.isNotBlank(labelCode)) {
cn.hutool.json.JSONArray jsonArray1 = jsonObject.getJSONArray("children"); cn.hutool.json.JSONArray jsonArray1 = jsonObject.getJSONArray("children");
if (jsonArray1 != null && !jsonArray1.isEmpty()){ if (jsonArray1 != null && !jsonArray1.isEmpty()) {
List<String> reids = new ArrayList<>(); List<String> reids = new ArrayList<>();
jsonArray1.forEach(f -> { jsonArray1.forEach(f -> {
cn.hutool.json.JSONObject jsonObject1 = (cn.hutool.json.JSONObject) f; cn.hutool.json.JSONObject jsonObject1 = (cn.hutool.json.JSONObject) f;
String labelItemCode = jsonObject1.getStr("labelItemCode"); String labelItemCode = jsonObject1.getStr("labelItemCode");
if (StrUtil.isNotBlank(labelItemCode)){ if (StrUtil.isNotBlank(labelItemCode)) {
reids.add(labelCode+"-"+labelItemCode); reids.add(labelCode + "-" + labelItemCode);
} }
}); });
if (CollectionUtils.isNotEmpty(reids)){ if (CollectionUtils.isNotEmpty(reids)) {
BoolQueryBuilder specialLabelQuery = QueryBuilders.boolQuery(); BoolQueryBuilder specialLabelQuery = QueryBuilders.boolQuery();
specialLabelQuery.must(QueryBuilders.nestedQuery("labels",QueryBuilders.termsQuery("labels.relationId",reids),ScoreMode.None)); specialLabelQuery.must(QueryBuilders.nestedQuery("labels", QueryBuilders.termsQuery("labels.relationId", reids), ScoreMode.None));
boolQuery.must(specialLabelQuery); boolQuery.must(specialLabelQuery);
} }
} }
......
...@@ -3,7 +3,6 @@ package com.zzsn.event.mapper; ...@@ -3,7 +3,6 @@ package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.event.entity.LabelEntity; import com.zzsn.event.entity.LabelEntity;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.LabelTypeVO; import com.zzsn.event.vo.LabelTypeVO;
import com.zzsn.event.vo.SysLabelVo; import com.zzsn.event.vo.SysLabelVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
......
...@@ -197,7 +197,7 @@ public class AnalysisServiceImpl implements AnalysisService { ...@@ -197,7 +197,7 @@ public class AnalysisServiceImpl implements AnalysisService {
if (CollectionUtils.isNotEmpty(informationList)) { if (CollectionUtils.isNotEmpty(informationList)) {
for (SpecialInformation information : informationList) { for (SpecialInformation information : informationList) {
List<String> keyWordsList = information.getKeyWordsList(); List<String> keyWordsList = information.getKeyWordsList();
if (CollectionUtils.isNotEmpty(keyWordsList)) { if (CollectionUtils.isEmpty(keyWordsList)) {
continue; continue;
} }
keyWordsList = keyWordsList.stream().filter(e -> !excludeKeywords.contains(e)).collect(Collectors.toList()); keyWordsList = keyWordsList.stream().filter(e -> !excludeKeywords.contains(e)).collect(Collectors.toList());
......
...@@ -30,7 +30,7 @@ import java.util.stream.Collectors; ...@@ -30,7 +30,7 @@ import java.util.stream.Collectors;
*/ */
@Slf4j @Slf4j
@Component @Component
public class NetWordEventTask { public class NetWorkEventTask {
@Autowired @Autowired
private EventNetworkService eventNetworkService; private EventNetworkService eventNetworkService;
...@@ -108,7 +108,7 @@ public class NetWordEventTask { ...@@ -108,7 +108,7 @@ public class NetWordEventTask {
} }
eventNetworkService.saveOrUpdateBatch(finalList); eventNetworkService.saveOrUpdateBatch(finalList);
} }
log.info("{}-数据采集更新完成", type == 1 ? "百度热榜" : "新浪热榜"); log.info("{}-网络事件数据采集更新完成", type == 1 ? "百度热榜" : "新浪热榜");
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论