提交 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);
} }
......
...@@ -32,7 +32,6 @@ import org.springframework.web.bind.annotation.*; ...@@ -32,7 +32,6 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -166,12 +165,12 @@ public class EventDataController { ...@@ -166,12 +165,12 @@ public class EventDataController {
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
IPage<EventFrontVO> pageList = new Page<>(); IPage<EventFrontVO> pageList = new Page<>();
if (category == 1){ if (category == 1) {
pageList = eventService.frontAllPageList(projectId, eventId,eventName, eventType, labelField, labelName, order, orderType, pageNo, pageSize); pageList = eventService.frontAllPageList(projectId, eventId, eventName, eventType, labelField, labelName, order, orderType, pageNo, pageSize);
} else if (category == 3) { } else if (category == 3) {
pageList = eventService.frontOwnerPageList(projectId, eventName, eventType, labelField, labelName, order, orderType, pageNo, pageSize); pageList = eventService.frontOwnerPageList(projectId, eventName, eventType, labelField, labelName, order, orderType, pageNo, pageSize);
} else if (category == 4) { } else if (category == 4) {
pageList = eventService.frontCollectPageList(projectId,eventName, eventType, labelField, labelName, order, orderType, pageNo, pageSize); pageList = eventService.frontCollectPageList(projectId, eventName, eventType, labelField, labelName, order, orderType, pageNo, pageSize);
} }
return Result.OK(pageList); return Result.OK(pageList);
} }
...@@ -185,7 +184,7 @@ public class EventDataController { ...@@ -185,7 +184,7 @@ public class EventDataController {
*/ */
//@PostMapping("/simpleSaveEvent") //@PostMapping("/simpleSaveEvent")
public Result<?> addEvent(@RequestBody AddEventVO addEventVO) { public Result<?> addEvent(@RequestBody AddEventVO addEventVO) {
if(StringUtils.isNotEmpty(CLB_EVENT_ADD)){ if (StringUtils.isNotEmpty(CLB_EVENT_ADD)) {
UserVo currentUser = UserUtil.getLoginUser(); UserVo currentUser = UserUtil.getLoginUser();
KeywordsVO keywordsVO = addEventVO.getKeywordsVO(); KeywordsVO keywordsVO = addEventVO.getKeywordsVO();
addEventVO.setTenant(currentUser.getTenant()); addEventVO.setTenant(currentUser.getTenant());
...@@ -229,12 +228,12 @@ public class EventDataController { ...@@ -229,12 +228,12 @@ public class EventDataController {
} else { } else {
return Result.FAIL(500, "关键词不能为空"); return Result.FAIL(500, "关键词不能为空");
} }
}else{ } else {
KeywordsVO keywordsVO = addEventVO.getKeywordsVO(); KeywordsVO keywordsVO = addEventVO.getKeywordsVO();
if (keywordsVO != null) { if (keywordsVO != null) {
Event event = eventSimpleService.simpleSave(addEventVO); Event event = eventSimpleService.simpleSave(addEventVO);
KeyWords keyWords = keyWordsService.saveKeyword(event, keywordsVO.getKeyword(), keywordsVO.getExclusionWord()); KeyWords keyWords = keyWordsService.saveKeyword(event, keywordsVO.getKeyword(), keywordsVO.getExclusionWord());
CompletableFuture.runAsync(()->{ CompletableFuture.runAsync(() -> {
iXxlJobInfoService.eventInsert(event); iXxlJobInfoService.eventInsert(event);
//关键词 //关键词
KeyWordsDTO redisKeywordDTO = new KeyWordsDTO(); KeyWordsDTO redisKeywordDTO = new KeyWordsDTO();
...@@ -293,7 +292,7 @@ public class EventDataController { ...@@ -293,7 +292,7 @@ public class EventDataController {
*/ */
//@PostMapping("/simpleUpdateEvent") //@PostMapping("/simpleUpdateEvent")
public Result<?> updateEvent(@RequestBody AddEventVO addEventVO) { public Result<?> updateEvent(@RequestBody AddEventVO addEventVO) {
if(StringUtils.isNotEmpty(CLB_EVENT_EDIT)){ if (StringUtils.isNotEmpty(CLB_EVENT_EDIT)) {
UserVo currentUser = UserUtil.getLoginUser(); UserVo currentUser = UserUtil.getLoginUser();
KeywordsVO keywordsVO = addEventVO.getKeywordsVO(); KeywordsVO keywordsVO = addEventVO.getKeywordsVO();
addEventVO.setTenant(currentUser.getTenant()); addEventVO.setTenant(currentUser.getTenant());
...@@ -301,7 +300,7 @@ public class EventDataController { ...@@ -301,7 +300,7 @@ public class EventDataController {
// 调用克虏宝编辑接口 // 调用克虏宝编辑接口
JSONObject params = JSONObject.from(addEventVO); JSONObject params = JSONObject.from(addEventVO);
params.put("username", currentUser.getUsername()); params.put("username", currentUser.getUsername());
try{ try {
String resultStr = HttpUtil.doPost(CLB_EVENT_EDIT, params, 1000 * 30); String resultStr = HttpUtil.doPost(CLB_EVENT_EDIT, params, 1000 * 30);
JSONObject jsonObject = JSONObject.parseObject(resultStr); JSONObject jsonObject = JSONObject.parseObject(resultStr);
Integer code = jsonObject.getInteger("code"); Integer code = jsonObject.getInteger("code");
...@@ -323,14 +322,14 @@ public class EventDataController { ...@@ -323,14 +322,14 @@ public class EventDataController {
} else { } else {
return Result.FAIL(500, "关键词不能为空"); return Result.FAIL(500, "关键词不能为空");
} }
}else{ } else {
KeywordsVO keywordsVO = addEventVO.getKeywordsVO(); KeywordsVO keywordsVO = addEventVO.getKeywordsVO();
if (keywordsVO != null) { if (keywordsVO != null) {
eventSimpleService.updateMain(addEventVO); eventSimpleService.updateMain(addEventVO);
keyWordsService.update(Wrappers.<KeyWords>lambdaUpdate().eq(KeyWords::getId, keywordsVO.getId()) keyWordsService.update(Wrappers.<KeyWords>lambdaUpdate().eq(KeyWords::getId, keywordsVO.getId())
.set(KeyWords::getKeyWord, keywordsVO.getKeyword()) .set(KeyWords::getKeyWord, keywordsVO.getKeyword())
.set(KeyWords::getExclusionWord, keywordsVO.getExclusionWord())); .set(KeyWords::getExclusionWord, keywordsVO.getExclusionWord()));
CompletableFuture.runAsync(()->{ CompletableFuture.runAsync(() -> {
//关键词 //关键词
KeyWordsDTO redisKeywordDTO = new KeyWordsDTO(); KeyWordsDTO redisKeywordDTO = new KeyWordsDTO();
BeanUtils.copyProperties(keywordsVO, redisKeywordDTO); BeanUtils.copyProperties(keywordsVO, redisKeywordDTO);
...@@ -381,7 +380,7 @@ public class EventDataController { ...@@ -381,7 +380,7 @@ public class EventDataController {
* @date 2025/2/5 * @date 2025/2/5
*/ */
@PostMapping("/configVerification") @PostMapping("/configVerification")
public Result<?> configVerification(@RequestBody AddEventParam addEventParam){ public Result<?> configVerification(@RequestBody AddEventParam addEventParam) {
Boolean verification = eventService.configVerification(addEventParam); Boolean verification = eventService.configVerification(addEventParam);
return Result.OK(verification); return Result.OK(verification);
} }
...@@ -394,7 +393,7 @@ public class EventDataController { ...@@ -394,7 +393,7 @@ public class EventDataController {
* @date 2025/2/6 * @date 2025/2/6
*/ */
//@GetMapping("/clearData") //@GetMapping("/clearData")
public Result<?> clearData(@RequestParam String eventId){ public Result<?> clearData(@RequestParam String eventId) {
if (StringUtils.isNotEmpty(CLB_CLEAR_DATA)) { if (StringUtils.isNotEmpty(CLB_CLEAR_DATA)) {
try { try {
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
...@@ -402,7 +401,7 @@ public class EventDataController { ...@@ -402,7 +401,7 @@ public class EventDataController {
UserVo loginUser = UserUtil.getLoginUser(); UserVo loginUser = UserUtil.getLoginUser();
Map<String, String> headers = new HashMap<>(); Map<String, String> headers = new HashMap<>();
params.put("loginUser", JSON.toJSONString(loginUser)); params.put("loginUser", JSON.toJSONString(loginUser));
HttpUtil.doGet(CLB_CLEAR_DATA, params, headers,"utf-8"); HttpUtil.doGet(CLB_CLEAR_DATA, params, headers, "utf-8");
} catch (Exception e) { } catch (Exception e) {
return Result.FAIL(500, "调用克虏宝清空专题数据异常!"); return Result.FAIL(500, "调用克虏宝清空专题数据异常!");
} }
...@@ -412,7 +411,7 @@ public class EventDataController { ...@@ -412,7 +411,7 @@ public class EventDataController {
} }
@GetMapping("/clearData") @GetMapping("/clearData")
public Result<?> clearData_new(@RequestParam String eventId){ public Result<?> clearData_new(@RequestParam String eventId) {
eventService.clearSubjectData(eventId); eventService.clearSubjectData(eventId);
return Result.OK("正在清空数据"); return Result.OK("正在清空数据");
} }
...@@ -425,7 +424,7 @@ public class EventDataController { ...@@ -425,7 +424,7 @@ public class EventDataController {
*/ */
//@PostMapping(value = "/simpleDeleteEvent") //@PostMapping(value = "/simpleDeleteEvent")
public Result<?> delete(@RequestBody JSONObject param) { public Result<?> delete(@RequestBody JSONObject param) {
if(StringUtils.isNotEmpty(CLB_EVENT_DELETE)){ if (StringUtils.isNotEmpty(CLB_EVENT_DELETE)) {
try { try {
String id = param.getString("id"); String id = param.getString("id");
if (StringUtils.isBlank(id)) { if (StringUtils.isBlank(id)) {
...@@ -434,7 +433,7 @@ public class EventDataController { ...@@ -434,7 +433,7 @@ public class EventDataController {
// 调用克虏宝删除接口 // 调用克虏宝删除接口
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
params.put("id", id); params.put("id", id);
HttpUtil.doGet(CLB_EVENT_DELETE, params, null,"utf-8"); HttpUtil.doGet(CLB_EVENT_DELETE, params, null, "utf-8");
// 调用本地删除 // 调用本地删除
EventVO eventVO = eventService.queryInfo(id); EventVO eventVO = eventService.queryInfo(id);
eventService.deleteMain(id); eventService.deleteMain(id);
...@@ -450,7 +449,7 @@ public class EventDataController { ...@@ -450,7 +449,7 @@ public class EventDataController {
return Result.FAIL(500, "删除事件信息失败!"); return Result.FAIL(500, "删除事件信息失败!");
} }
return Result.OK(); return Result.OK();
}else{ } else {
String id = param.getString("id"); String id = param.getString("id");
EventVO eventVO = eventService.queryInfo(id); EventVO eventVO = eventService.queryInfo(id);
eventService.deleteMain(id); eventService.deleteMain(id);
...@@ -483,7 +482,7 @@ public class EventDataController { ...@@ -483,7 +482,7 @@ public class EventDataController {
@GetMapping("/labelList") @GetMapping("/labelList")
public Result<?> labelList(){ public Result<?> labelList() {
List<SysDictItem> dictItemList = dictItemService.listByDictCode("eventView"); List<SysDictItem> dictItemList = dictItemService.listByDictCode("eventView");
List<SysDictItem> collect = dictItemList.stream().filter(e -> !e.getItemText().equals("无观点")).collect(Collectors.toList()); List<SysDictItem> collect = dictItemList.stream().filter(e -> !e.getItemText().equals("无观点")).collect(Collectors.toList());
return Result.OK(collect); return Result.OK(collect);
...@@ -498,6 +497,10 @@ public class EventDataController { ...@@ -498,6 +497,10 @@ public class EventDataController {
* @param searchWord 搜索词 * @param searchWord 搜索词
* @param position 搜索位置(title-标题;content-内容) * @param position 搜索位置(title-标题;content-内容)
* @param category 匹配度(1-模糊;2-精确) * @param category 匹配度(1-模糊;2-精确)
* @param origin 来源
* @param labelId 标签id
* @param startTime 开始时间
* @param endTime 结束时间
* @param column 排序字段 * @param column 排序字段
* @param order 排序方式(asc-正序;desc-倒序) * @param order 排序方式(asc-正序;desc-倒序)
* @param pageNo 当前页 * @param pageNo 当前页
...@@ -512,7 +515,10 @@ public class EventDataController { ...@@ -512,7 +515,10 @@ public class EventDataController {
@RequestParam(name = "searchWord", required = false) String searchWord, @RequestParam(name = "searchWord", required = false) String searchWord,
@RequestParam(name = "position", required = false) String position, @RequestParam(name = "position", required = false) String position,
@RequestParam(name = "category", required = false) Integer category, @RequestParam(name = "category", required = false) Integer category,
@RequestParam(name = "origin", required = false) String origin,
@RequestParam(name = "labelId", required = false) String labelId, @RequestParam(name = "labelId", required = false) String labelId,
@RequestParam(name = "startTime", required = false) String startTime,
@RequestParam(name = "endTime", required = false) String endTime,
@RequestParam(name = "column", defaultValue = "publishDate") String column, @RequestParam(name = "column", defaultValue = "publishDate") String column,
@RequestParam(name = "order", defaultValue = "desc") String order, @RequestParam(name = "order", defaultValue = "desc") String order,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
...@@ -523,11 +529,11 @@ public class EventDataController { ...@@ -523,11 +529,11 @@ public class EventDataController {
if (StringUtils.isNotEmpty(subjectId)) { if (StringUtils.isNotEmpty(subjectId)) {
subjectIdList.add(subjectId); subjectIdList.add(subjectId);
} else { } else {
List<EventExcelVO> frontList = eventService.frontAllList(projectId,username, null,null,null,null,null,null); List<EventExcelVO> frontList = eventService.frontAllList(projectId, username, null, null, null, null, null, null);
frontList.forEach(e -> subjectIdList.add(e.getId())); frontList.forEach(e -> subjectIdList.add(e.getId()));
} }
//获取数据 //获取数据
IPage<SubjectDataVo> pageList = esService.frontListByPage(subjectIdList, searchWord, position, category,labelId, column, order, pageNo, pageSize); IPage<SubjectDataVo> pageList = esService.frontListByPage(subjectIdList, searchWord, position, category,origin, labelId, startTime, endTime, column, order, pageNo, pageSize);
return Result.OK(pageList); return Result.OK(pageList);
} }
...@@ -551,15 +557,15 @@ public class EventDataController { ...@@ -551,15 +557,15 @@ public class EventDataController {
* @date 2024/9/14 * @date 2024/9/14
*/ */
@PostMapping("/batchDelete") @PostMapping("/batchDelete")
public Result<?> batchDelete(@RequestBody List<JSONObject> list){ public Result<?> batchDelete(@RequestBody List<JSONObject> list) {
Map<String,String> updateFieldMap = new HashMap<>(); Map<String, String> updateFieldMap = new HashMap<>();
updateFieldMap.put("deleteFlag","1"); updateFieldMap.put("deleteFlag", "1");
List<CompletableFuture<Void>> asyncList = new ArrayList<>(); List<CompletableFuture<Void>> asyncList = new ArrayList<>();
for (JSONObject jsonObject : list) { for (JSONObject jsonObject : list) {
asyncList.add(CompletableFuture.runAsync(()->{ asyncList.add(CompletableFuture.runAsync(() -> {
String id = jsonObject.getString("id"); String id = jsonObject.getString("id");
String index = jsonObject.getString("index"); String index = jsonObject.getString("index");
esOpUtil.updateById(index,id,updateFieldMap); esOpUtil.updateById(index, id, updateFieldMap);
})); }));
} }
//等待全部执行完 //等待全部执行完
...@@ -575,7 +581,7 @@ public class EventDataController { ...@@ -575,7 +581,7 @@ public class EventDataController {
* @date 2024/8/21 * @date 2024/8/21
*/ */
@PostMapping("/translate") @PostMapping("/translate")
public Result<?> translate(@RequestBody SubjectDataVo transferData){ public Result<?> translate(@RequestBody SubjectDataVo transferData) {
TranslateVO translateVO = new TranslateVO(); TranslateVO translateVO = new TranslateVO();
translateVO.setFrom("auto"); translateVO.setFrom("auto");
translateVO.setTo("zh-CN"); translateVO.setTo("zh-CN");
......
...@@ -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,8 +790,8 @@ public class EsService { ...@@ -776,8 +790,8 @@ 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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论