Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
a6a40fad
提交
a6a40fad
authored
3月 20, 2025
作者:
925993793@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【fix】资讯列表高级检索增加 全文 逻辑;增加是否启用元搜索逻辑
上级
d9d24f75
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
70 行增加
和
22 行删除
+70
-22
EventManageController.java
...java/com/zzsn/event/controller/EventManageController.java
+12
-4
EventApi.java
...ain/java/com/zzsn/event/controller/thirdApi/EventApi.java
+7
-0
EventDataController.java
...a/com/zzsn/event/controller/yjzx/EventDataController.java
+7
-0
EsService.java
src/main/java/com/zzsn/event/es/EsService.java
+41
-18
KeyWordsServiceImpl.java
...java/com/zzsn/event/service/impl/KeyWordsServiceImpl.java
+2
-0
SubjectSimpleServiceImpl.java
...com/zzsn/event/service/impl/SubjectSimpleServiceImpl.java
+1
-0
没有找到文件。
src/main/java/com/zzsn/event/controller/EventManageController.java
浏览文件 @
a6a40fad
...
...
@@ -16,6 +16,7 @@ import com.zzsn.event.service.IEventService;
import
com.zzsn.event.service.IKeyWordsService
;
import
com.zzsn.event.service.ISubjectInfoSourceMapService
;
import
com.zzsn.event.service.LabelEntityService
;
import
com.zzsn.event.service.impl.ConfigurationMessageService
;
import
com.zzsn.event.util.HttpUtil
;
import
com.zzsn.event.util.ObjectUtil
;
import
com.zzsn.event.util.RedisUtil
;
...
...
@@ -57,7 +58,8 @@ public class EventManageController {
private
IXxlJobInfoService
iXxlJobInfoService
;
@Autowired
private
ISubjectInfoSourceMapService
subjectInfoSourceMapService
;
@Autowired
private
ConfigurationMessageService
configurationMessageService
;
@Autowired
private
IKeyWordsService
keyWordsService
;
...
...
@@ -149,6 +151,7 @@ public class EventManageController {
CompletableFuture
.
runAsync
(()
->
{
//插入xxlJob
iXxlJobInfoService
.
eventInsert
(
event
);
/*-------------------------------------------------------------老采集逻辑---------------*/
//关键词入缓存
KeyWordsDTO
redisKeywordDTO
=
new
KeyWordsDTO
();
BeanUtils
.
copyProperties
(
keyWords
,
redisKeywordDTO
);
...
...
@@ -160,8 +163,11 @@ public class EventManageController {
iXxlJobInfoService
.
keyWordsInsert
(
redisKeywordDTO
);
//为了立即响应,关键词新增时放入消息队列
kafkaTemplate
.
send
(
Constants
.
KEY_WORDS_COLLECT_TOPIC
,
JSON
.
toJSONString
(
redisKeywordDTO
));
/*-----------------------------------------------------------------老采集逻辑---------------*/
//通知采集
configurationMessageService
.
bindKeyWordsEventSend
(
event
.
getId
());
//事件分析
kafkaTemplate
.
send
(
EVENT_MODEL_KAFKA_CHANNEL
,
event
.
getEventCode
());
});
return
Result
.
OK
();
}
else
{
...
...
@@ -188,6 +194,7 @@ public class EventManageController {
.
set
(
KeyWords:
:
getKeyWord
,
keywordsVO
.
getKeyword
())
.
set
(
KeyWords:
:
getExclusionWord
,
keywordsVO
.
getExclusionWord
()));
CompletableFuture
.
runAsync
(()
->
{
/*-----------------------------------------------------------------老采集逻辑---------------*/
KeyWordsDTO
redisKeywordDTO
=
new
KeyWordsDTO
();
BeanUtils
.
copyProperties
(
keywordsVO
,
redisKeywordDTO
);
redisKeywordDTO
.
setKeyWord
(
keywordsVO
.
getKeyword
());
...
...
@@ -197,6 +204,9 @@ public class EventManageController {
redisUtil
.
set
(
Constants
.
KEY_WORDS_TO_REDIS_PREFIX
+
keywordsVO
.
getWordsCode
(),
redisKeywordDTO
);
//为了立即响应,关键词编辑时放入消息队列
kafkaTemplate
.
send
(
Constants
.
KEY_WORDS_COLLECT_TOPIC
,
JSON
.
toJSONString
(
redisKeywordDTO
));
/*-----------------------------------------------------------------老采集逻辑---------------*/
//通知采集
configurationMessageService
.
bindKeyWordsEventSend
(
addEventParam
.
getId
());
});
return
Result
.
OK
();
}
else
{
...
...
@@ -250,7 +260,6 @@ public class EventManageController {
keyWordsService
.
remove
(
Wrappers
.<
KeyWords
>
lambdaQuery
().
eq
(
KeyWords:
:
getWordsCode
,
wordsCode
));
redisUtil
.
del
(
Constants
.
KEY_WORDS_TO_REDIS_PREFIX
+
wordsCode
);
iXxlJobInfoService
.
deleteByInfosourceCode
(
wordsCode
);
//todo 是否删除对应的资讯数据
}
});
return
Result
.
OK
();
...
...
@@ -285,7 +294,6 @@ public class EventManageController {
}
}
});
//todo 是否删除对应的资讯数据
return
Result
.
OK
();
}
...
...
src/main/java/com/zzsn/event/controller/thirdApi/EventApi.java
浏览文件 @
a6a40fad
...
...
@@ -8,6 +8,7 @@ import com.zzsn.event.constant.Result;
import
com.zzsn.event.entity.*
;
import
com.zzsn.event.enums.CodePrefixEnum
;
import
com.zzsn.event.service.*
;
import
com.zzsn.event.service.impl.ConfigurationMessageService
;
import
com.zzsn.event.util.CodeGenerateUtil
;
import
com.zzsn.event.util.CronUtil
;
import
com.zzsn.event.util.DateUtil
;
...
...
@@ -66,6 +67,8 @@ public class EventApi {
private
IEventTagService
eventTagService
;
@Autowired
private
EventRegionMapService
eventRegionMapService
;
@Autowired
private
ConfigurationMessageService
configurationMessageService
;
@Value
(
"${kafka.topic.event.run:}"
)
private
String
EVENT_MODEL_KAFKA_CHANNEL
;
...
...
@@ -97,6 +100,8 @@ public class EventApi {
iXxlJobInfoService
.
keyWordsInsert
(
redisKeywordDTO
);
//为了立即响应,关键词新增时放入一个首次录入消息队列
kafkaTemplate
.
send
(
Constants
.
KEY_WORDS_COLLECT_TOPIC
,
JSON
.
toJSONString
(
redisKeywordDTO
));
//通知采集
configurationMessageService
.
bindKeyWordsEventSend
(
event
.
getId
());
kafkaTemplate
.
send
(
EVENT_MODEL_KAFKA_CHANNEL
,
event
.
getEventCode
());
});
return
Result
.
OK
(
event
);
...
...
@@ -131,6 +136,8 @@ public class EventApi {
redisUtil
.
set
(
Constants
.
KEY_WORDS_TO_REDIS_PREFIX
+
keywordsVO
.
getWordsCode
(),
redisKeywordDTO
);
//为了立即响应,关键词新增时放入一个首次录入消息队列
kafkaTemplate
.
send
(
Constants
.
KEY_WORDS_COLLECT_TOPIC
,
JSON
.
toJSONString
(
redisKeywordDTO
));
//通知采集
configurationMessageService
.
bindKeyWordsEventSend
(
addEventVO
.
getId
());
});
return
Result
.
OK
();
}
else
{
...
...
src/main/java/com/zzsn/event/controller/yjzx/EventDataController.java
浏览文件 @
a6a40fad
...
...
@@ -16,6 +16,7 @@ import com.zzsn.event.service.EventSimpleService;
import
com.zzsn.event.service.IEventService
;
import
com.zzsn.event.service.IKeyWordsService
;
import
com.zzsn.event.service.InformationService
;
import
com.zzsn.event.service.impl.ConfigurationMessageService
;
import
com.zzsn.event.util.*
;
import
com.zzsn.event.util.user.UserUtil
;
import
com.zzsn.event.util.user.UserVo
;
...
...
@@ -62,6 +63,8 @@ public class EventDataController {
@Autowired
private
InformationService
informationService
;
@Autowired
private
ConfigurationMessageService
configurationMessageService
;
@Autowired
private
RedisUtil
redisUtil
;
@Resource
private
KafkaTemplate
<
String
,
String
>
kafkaTemplate
;
...
...
@@ -241,6 +244,8 @@ public class EventDataController {
iXxlJobInfoService
.
keyWordsInsert
(
redisKeywordDTO
);
//为了立即响应,关键词新增时放入一个首次录入消息队列
kafkaTemplate
.
send
(
Constants
.
KEY_WORDS_COLLECT_TOPIC
,
JSON
.
toJSONString
(
redisKeywordDTO
));
//通知采集
configurationMessageService
.
bindKeyWordsEventSend
(
event
.
getId
());
kafkaTemplate
.
send
(
EVENT_MODEL_KAFKA_CHANNEL
,
event
.
getEventCode
());
});
return
Result
.
OK
();
...
...
@@ -307,6 +312,8 @@ public class EventDataController {
redisUtil
.
set
(
Constants
.
KEY_WORDS_TO_REDIS_PREFIX
+
keywordsVO
.
getWordsCode
(),
redisKeywordDTO
);
//为了立即响应,关键词新增时放入一个首次录入消息队列
kafkaTemplate
.
send
(
Constants
.
KEY_WORDS_COLLECT_TOPIC
,
JSON
.
toJSONString
(
redisKeywordDTO
));
//通知采集
configurationMessageService
.
bindKeyWordsEventSend
(
addEventVO
.
getId
());
});
return
Result
.
OK
();
}
else
{
...
...
src/main/java/com/zzsn/event/es/EsService.java
浏览文件 @
a6a40fad
...
...
@@ -2321,8 +2321,7 @@ public class EsService {
String
rule
=
item
.
getString
(
"rule"
);
String
field
=
item
.
getString
(
"field"
);
String
val
=
item
.
getString
(
"val"
);
if
(
"date"
.
equals
(
type
))
{
//日期类型处理
if
(
"date"
.
equals
(
type
))
{
//日期类型处理
if
(
"eq"
.
equals
(
rule
))
{
builder2
.
must
(
QueryBuilders
.
rangeQuery
(
field
).
from
(
val
+
"T00:00:00"
).
to
(
val
+
"T23:59:59"
));
}
...
...
@@ -2337,8 +2336,7 @@ public class EsService {
}
else
if
(
"le"
.
equals
(
rule
))
{
builder2
.
must
(
QueryBuilders
.
rangeQuery
(
field
).
to
((
val
+
"T23:59:59"
)));
}
}
else
if
(
"list"
.
equals
(
type
))
{
//列表(数组)类查询
}
else
if
(
"list"
.
equals
(
type
))
{
//列表(数组)类查询
if
(
"eq"
.
equals
(
rule
))
{
builder2
.
must
(
QueryBuilders
.
termQuery
(
field
+
".keyword"
,
val
));
}
else
if
(
"ne"
.
equals
(
rule
))
{
...
...
@@ -2362,9 +2360,27 @@ public class EsService {
builder2
.
must
(
wordAllBoolQuery
);
}
}
}
else
if
(
"string"
.
equals
(
type
))
{
//文本类查询
if
(
"eq"
.
equals
(
rule
))
{
}
else
if
(
"string"
.
equals
(
type
))
{
//文本类查询
if
(
"fullText"
.
equals
(
field
))
{
BoolQueryBuilder
fullTextBoolQuery
=
multiMatchQuery
(
val
);
if
(
"like"
.
equals
(
rule
))
{
builder2
.
must
(
fullTextBoolQuery
);
}
else
if
(
"not_like"
.
equals
(
rule
))
{
builder2
.
mustNot
(
fullTextBoolQuery
);
}
else
if
(
"keyWordsGroup"
.
equals
(
rule
))
{
BoolQueryBuilder
wordAllBoolQuery
=
QueryBuilders
.
boolQuery
();
String
[]
andWords
=
val
.
split
(
"\\+"
);
for
(
String
words
:
andWords
)
{
String
replace
=
words
.
replace
(
"("
,
""
).
replace
(
")"
,
""
);
BoolQueryBuilder
wordOrBoolQuery
=
QueryBuilders
.
boolQuery
();
for
(
String
word
:
replace
.
split
(
"\\|"
))
{
wordOrBoolQuery
.
should
(
multiMatchQuery
(
word
));
}
wordAllBoolQuery
.
must
(
wordOrBoolQuery
);
}
builder2
.
must
(
wordAllBoolQuery
);
}
}
else
if
(
"eq"
.
equals
(
rule
))
{
builder2
.
must
(
QueryBuilders
.
termQuery
(
field
+
".keyword"
,
val
));
}
else
if
(
"ne"
.
equals
(
rule
))
{
builder2
.
mustNot
(
QueryBuilders
.
termQuery
(
field
+
".keyword"
,
val
));
...
...
@@ -2377,19 +2393,17 @@ public class EsService {
}
else
if
(
"not_like"
.
equals
(
rule
))
{
builder2
.
mustNot
(
QueryBuilders
.
matchPhrasePrefixQuery
(
field
,
val
));
}
else
if
(
"keyWordsGroup"
.
equals
(
rule
))
{
if
(
StringUtils
.
isNotEmpty
(
val
))
{
BoolQueryBuilder
wordAllBoolQuery
=
QueryBuilders
.
boolQuery
();
String
[]
andWords
=
val
.
split
(
"\\+"
);
for
(
String
words
:
andWords
)
{
String
replace
=
words
.
replace
(
"("
,
""
).
replace
(
")"
,
""
);
BoolQueryBuilder
wordOrBoolQuery
=
QueryBuilders
.
boolQuery
();
for
(
String
word
:
replace
.
split
(
"\\|"
))
{
wordOrBoolQuery
.
should
(
QueryBuilders
.
matchPhraseQuery
(
field
,
word
));
}
wordAllBoolQuery
.
must
(
wordOrBoolQuery
);
BoolQueryBuilder
wordAllBoolQuery
=
QueryBuilders
.
boolQuery
();
String
[]
andWords
=
val
.
split
(
"\\+"
);
for
(
String
words
:
andWords
)
{
String
replace
=
words
.
replace
(
"("
,
""
).
replace
(
")"
,
""
);
BoolQueryBuilder
wordOrBoolQuery
=
QueryBuilders
.
boolQuery
();
for
(
String
word
:
replace
.
split
(
"\\|"
))
{
wordOrBoolQuery
.
should
(
QueryBuilders
.
matchPhraseQuery
(
field
,
word
));
}
builder2
.
must
(
wordAll
BoolQuery
);
wordAllBoolQuery
.
must
(
wordOr
BoolQuery
);
}
builder2
.
must
(
wordAllBoolQuery
);
}
}
if
(
"or"
.
equals
(
superQueryMatchType
))
{
...
...
@@ -2405,4 +2419,13 @@ public class EsService {
}
return
null
;
}
private
BoolQueryBuilder
multiMatchQuery
(
String
word
)
{
BoolQueryBuilder
fullTextBoolQuery
=
QueryBuilders
.
boolQuery
();
String
[]
fullTextFields
=
new
String
[]
{
"title"
,
"summary"
,
"content"
};
for
(
String
fullTextField
:
fullTextFields
)
{
fullTextBoolQuery
.
should
(
QueryBuilders
.
matchPhraseQuery
(
fullTextField
,
word
));
}
return
fullTextBoolQuery
;
}
}
src/main/java/com/zzsn/event/service/impl/KeyWordsServiceImpl.java
浏览文件 @
a6a40fad
...
...
@@ -238,6 +238,7 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i
SubjectKeywordsMap
subjectKeywordsMap
=
new
SubjectKeywordsMap
();
subjectKeywordsMap
.
setKeywordsId
(
keyWordsId
);
subjectKeywordsMap
.
setSubjectId
(
event
.
getId
());
subjectKeywordsMap
.
setMetaSearchFlag
(
1
);
subjectKeywordsMapService
.
save
(
subjectKeywordsMap
);
}
return
keyWords
;
...
...
@@ -252,6 +253,7 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i
SubjectKeywordsMap
subjectKeywordsMap
=
new
SubjectKeywordsMap
();
subjectKeywordsMap
.
setKeywordsId
(
keyWordsId
);
subjectKeywordsMap
.
setSubjectId
(
subjectId
);
subjectKeywordsMap
.
setMetaSearchFlag
(
1
);
subjectKeywordsMapService
.
save
(
subjectKeywordsMap
);
}
return
keyWords
;
...
...
src/main/java/com/zzsn/event/service/impl/SubjectSimpleServiceImpl.java
浏览文件 @
a6a40fad
...
...
@@ -606,6 +606,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
bindType
=
"2"
;
}
subjectKeywordsMap
.
setBindingType
(
bindType
);
subjectKeywordsMap
.
setMetaSearchFlag
(
1
);
subjectKeywordsMapList
.
add
(
subjectKeywordsMap
);
}
subjectKeywordsMapService
.
saveBatch
(
subjectKeywordsMapList
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论