Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
6e59dbb9
提交
6e59dbb9
authored
8月 01, 2025
作者:
925993793@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
研究中心-报告中主题拍寻问题处理
上级
409b7cb0
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
73 行增加
和
26 行删除
+73
-26
InformationServiceImpl.java
...a/com/zzsn/event/service/impl/InformationServiceImpl.java
+73
-26
没有找到文件。
src/main/java/com/zzsn/event/service/impl/InformationServiceImpl.java
浏览文件 @
6e59dbb9
...
...
@@ -5,6 +5,7 @@ import cn.hutool.core.bean.copier.CopyOptions;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson2.JSON
;
import
com.alibaba.fastjson2.JSONArray
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
...
...
@@ -37,6 +38,7 @@ import org.elasticsearch.index.query.TermsQueryBuilder;
import
org.jsoup.Jsoup
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.kafka.core.KafkaTemplate
;
import
org.springframework.stereotype.Service
;
...
...
@@ -98,6 +100,9 @@ public class InformationServiceImpl implements InformationService {
private
ImageUtil
imageUtil
;
private
String
subjectId
=
"1898653164373065730"
;
//中外智库专栏对应专题id
@Value
(
"${ai-article.thematicColumnConfig-url:}"
)
private
String
thematicColumnConfig
;
@Override
public
IPage
<
EventDataVO
>
collectPageList
(
InfoDataSearchCondition
eventDataCondition
)
{
return
esService
.
collectPageList
(
eventDataCondition
);
...
...
@@ -160,7 +165,7 @@ public class InformationServiceImpl implements InformationService {
publishDate
=
EsDateUtil
.
esFieldDateMapping
(
info
.
getPublishDate
());
String
dateFormat
=
searchCondition
.
getDateFormat
();
if
(!
dateFormat
.
equals
(
"yyyy-MM-dd HH:mm:ss"
))
{
info
.
setPublishDate
(
DateUtil
.
formatStr
(
publishDate
,
"yyyy-MM-dd HH:mm:ss"
,
dateFormat
));
info
.
setPublishDate
(
DateUtil
.
formatStr
(
publishDate
,
"yyyy-MM-dd HH:mm:ss"
,
dateFormat
));
}
}
//标签处理
...
...
@@ -287,6 +292,10 @@ public class InformationServiceImpl implements InformationService {
map
.
put
(
"infoList"
,
listN
);
list
.
add
(
map
);
});
List
<
String
>
columnConfigList
=
thematicColumnConfig
(
searchCondition
.
getSubjectId
());
if
(
CollectionUtils
.
isNotEmpty
(
columnConfigList
))
{
sortByAnotherList
(
list
,
columnConfigList
);
}
}
else
{
//不加标签获取列表数据
searchCondition
.
setLabelMark
(
null
);
...
...
@@ -372,6 +381,44 @@ public class InformationServiceImpl implements InformationService {
return
groupedByLabelMark
;
}
private
List
<
String
>
thematicColumnConfig
(
String
subjectId
)
{
List
<
String
>
list
=
new
ArrayList
<>();
try
{
Map
<
String
,
String
>
variables
=
new
HashMap
<>();
variables
.
put
(
"id"
,
subjectId
);
String
response
=
HttpUtil
.
doGet
(
thematicColumnConfig
,
variables
,
null
,
"utf-8"
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
response
);
if
(
jsonObject
==
null
)
{
return
list
;
}
JSONArray
data
=
jsonObject
.
getJSONArray
(
"data"
);
if
(
data
!=
null
&&
data
.
size
()
>
0
)
{
for
(
Object
datum
:
data
)
{
JSONObject
item
=
(
JSONObject
)
datum
;
list
.
add
(
item
.
getString
(
"themeName"
));
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
list
;
}
//目标集合按照另一个集合的顺序排序
private
void
sortByAnotherList
(
List
<
HashMap
>
list
,
List
<
String
>
anotherList
)
{
list
.
sort
((
o1
,
o2
)
->
{
int
index1
=
anotherList
.
indexOf
(
o1
.
get
(
"relationName"
).
toString
());
int
index2
=
anotherList
.
indexOf
(
o2
.
get
(
"relationName"
).
toString
());
if
(
index1
!=
-
1
)
{
index1
=
list
.
size
()
-
index1
;
}
if
(
index2
!=
-
1
)
{
index2
=
list
.
size
()
-
index2
;
}
return
index2
-
index1
;
});
}
@Override
public
DisplayInfo
queryInfo
(
Integer
type
,
String
index
,
String
id
)
{
DisplayInfo
info
=
(
DisplayInfo
)
esOpUtil
.
getInfoById
(
index
,
id
,
DisplayInfo
.
class
);
...
...
@@ -1103,7 +1150,7 @@ public class InformationServiceImpl implements InformationService {
dataList
.
add
(
specialInformation
);
}
esOpUtil
.
docSaveBulk
(
index
,
dataList
);
log
.
info
(
"专题-{},批量插入-{}-条数据完成"
,
subjectId
,
lists
.
size
());
log
.
info
(
"专题-{},批量插入-{}-条数据完成"
,
subjectId
,
lists
.
size
());
}
}
...
...
@@ -1228,7 +1275,7 @@ public class InformationServiceImpl implements InformationService {
deleteParams
.
put
(
"fieldType"
,
word
);
long
start
=
System
.
currentTimeMillis
();
esOpUtil
.
batchNestedDeleteScript
(
indexArr
,
buildQuery
,
deleteParams
,
"sortField"
);
log
.
info
(
"删除关键词-{},耗时:{}"
,
word
,
System
.
currentTimeMillis
()-
start
);
log
.
info
(
"删除关键词-{},耗时:{}"
,
word
,
System
.
currentTimeMillis
()
-
start
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
...
...
@@ -1252,11 +1299,11 @@ public class InformationServiceImpl implements InformationService {
}
Map
<
String
,
Object
>
modifyParams
=
new
HashMap
<>();
modifyParams
.
put
(
"checkStatus"
,
1
);
modifyParams
.
put
(
"deleteFlag"
,
0
);
modifyParams
.
put
(
"updateDate"
,
EsDateUtil
.
esFieldDateFormat
(
DateUtils
.
formatDateTime
()));
modifyParams
.
put
(
"deleteFlag"
,
0
);
modifyParams
.
put
(
"updateDate"
,
EsDateUtil
.
esFieldDateFormat
(
DateUtils
.
formatDateTime
()));
long
start
=
System
.
currentTimeMillis
();
esOpUtil
.
batchUpdateScript
(
indexArr
,
buildQuery
,
modifyParams
);
log
.
info
(
"添加到精选,耗时:{}"
,
System
.
currentTimeMillis
()
-
start
);
log
.
info
(
"添加到精选,耗时:{}"
,
System
.
currentTimeMillis
()
-
start
);
}
@Override
...
...
@@ -1273,12 +1320,12 @@ public class InformationServiceImpl implements InformationService {
buildQuery
=
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
termsQuery
(
"id"
,
ids
));
}
Map
<
String
,
Object
>
modifyParams
=
new
HashMap
<>();
modifyParams
.
put
(
"checkStatus"
,
3
);
modifyParams
.
put
(
"deleteFlag"
,
0
);
modifyParams
.
put
(
"updateDate"
,
EsDateUtil
.
esFieldDateFormat
(
DateUtils
.
formatDateTime
()));
modifyParams
.
put
(
"checkStatus"
,
3
);
modifyParams
.
put
(
"deleteFlag"
,
0
);
modifyParams
.
put
(
"updateDate"
,
EsDateUtil
.
esFieldDateFormat
(
DateUtils
.
formatDateTime
()));
long
start
=
System
.
currentTimeMillis
();
esOpUtil
.
batchUpdateScript
(
indexArr
,
buildQuery
,
modifyParams
);
log
.
info
(
"添加到待定,耗时:{}"
,
System
.
currentTimeMillis
()
-
start
);
log
.
info
(
"添加到待定,耗时:{}"
,
System
.
currentTimeMillis
()
-
start
);
}
@Override
...
...
@@ -1295,11 +1342,11 @@ public class InformationServiceImpl implements InformationService {
buildQuery
=
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
termsQuery
(
"id"
,
ids
));
}
Map
<
String
,
Object
>
modifyParams
=
new
HashMap
<>();
modifyParams
.
put
(
"deleteFlag"
,
1
);
modifyParams
.
put
(
"updateDate"
,
EsDateUtil
.
esFieldDateFormat
(
DateUtils
.
formatDateTime
()));
modifyParams
.
put
(
"deleteFlag"
,
1
);
modifyParams
.
put
(
"updateDate"
,
EsDateUtil
.
esFieldDateFormat
(
DateUtils
.
formatDateTime
()));
long
start
=
System
.
currentTimeMillis
();
esOpUtil
.
batchUpdateScript
(
indexArr
,
buildQuery
,
modifyParams
);
log
.
info
(
"添加到删除,耗时:{}"
,
System
.
currentTimeMillis
()
-
start
);
log
.
info
(
"添加到删除,耗时:{}"
,
System
.
currentTimeMillis
()
-
start
);
}
@Override
...
...
@@ -1310,12 +1357,12 @@ public class InformationServiceImpl implements InformationService {
String
[]
indexArr
=
EsIndexUtil
.
getIndexIntervalYearStr
(
Constants
.
SUBJECT_INDEX
,
minCreateTime
);
BoolQueryBuilder
buildQuery
=
esService
.
buildQuery
(
searchCondition
,
subjectIdList
);
Map
<
String
,
Object
>
modifyParams
=
new
HashMap
<>();
modifyParams
.
put
(
"checkStatus"
,
0
);
modifyParams
.
put
(
"deleteFlag"
,
0
);
modifyParams
.
put
(
"updateDate"
,
EsDateUtil
.
esFieldDateFormat
(
DateUtils
.
formatDateTime
()));
modifyParams
.
put
(
"checkStatus"
,
0
);
modifyParams
.
put
(
"deleteFlag"
,
0
);
modifyParams
.
put
(
"updateDate"
,
EsDateUtil
.
esFieldDateFormat
(
DateUtils
.
formatDateTime
()));
long
start
=
System
.
currentTimeMillis
();
esOpUtil
.
batchUpdateScript
(
indexArr
,
buildQuery
,
modifyParams
);
log
.
info
(
"初始化数据,耗时:{}"
,
System
.
currentTimeMillis
()
-
start
);
log
.
info
(
"初始化数据,耗时:{}"
,
System
.
currentTimeMillis
()
-
start
);
}
@Override
...
...
@@ -1329,7 +1376,7 @@ public class InformationServiceImpl implements InformationService {
Integer
searchScope
=
searchWordVO
.
getSearchScope
();
String
oldWord
=
searchWordVO
.
getSearchInfo
();
String
newWord
=
searchCondition
.
getReplaceWord
();
if
(
StringUtils
.
isEmpty
(
newWord
))
{
if
(
StringUtils
.
isEmpty
(
newWord
))
{
newWord
=
""
;
}
List
<
String
>
modifyFields
=
new
ArrayList
<>();
...
...
@@ -1352,14 +1399,14 @@ public class InformationServiceImpl implements InformationService {
BoolQueryBuilder
buildQuery
=
esService
.
buildQuery
(
searchCondition
,
subjectIdList
);
long
start
=
System
.
currentTimeMillis
();
esOpUtil
.
batchReplaceScript
(
indexArr
,
buildQuery
,
modifyFields
,
oldWord
,
newWord
);
log
.
info
(
"字符串替换-{},耗时:{}"
,
oldWord
,
System
.
currentTimeMillis
()-
start
);
log
.
info
(
"字符串替换-{},耗时:{}"
,
oldWord
,
System
.
currentTimeMillis
()
-
start
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
Map
<
String
,
Object
>
modifyParams
=
new
HashMap
<>();
modifyParams
.
put
(
"updateDate"
,
EsDateUtil
.
esFieldDateFormat
(
DateUtils
.
formatDateTime
()));
modifyParams
.
put
(
"updateDate"
,
EsDateUtil
.
esFieldDateFormat
(
DateUtils
.
formatDateTime
()));
esOpUtil
.
batchUpdateScript
(
indexArr
,
buildQuery
,
modifyParams
);
}
...
...
@@ -1379,17 +1426,17 @@ public class InformationServiceImpl implements InformationService {
Map
<
String
,
Object
>
addParams
=
new
HashMap
<>();
for
(
Label
markTag
:
searchCondition
.
getMarkTags
())
{
Map
<
String
,
String
>
addTag
=
ObjectUtil
.
objectToMap
(
markTag
);
addParams
.
put
(
"labels"
,
addTag
);
addParams
.
put
(
"labels"
,
addTag
);
long
start
=
System
.
currentTimeMillis
();
esOpUtil
.
batchNestedAddScript
(
indexArr
,
buildQuery
,
addParams
,
"labels"
,
"relationId"
);
log
.
info
(
"打标-{},耗时:{}"
,
markTag
.
getRelationName
(),
System
.
currentTimeMillis
()-
start
);
esOpUtil
.
batchNestedAddScript
(
indexArr
,
buildQuery
,
addParams
,
"labels"
,
"relationId"
);
log
.
info
(
"打标-{},耗时:{}"
,
markTag
.
getRelationName
(),
System
.
currentTimeMillis
()
-
start
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
Map
<
String
,
Object
>
modifyParams
=
new
HashMap
<>();
modifyParams
.
put
(
"updateDate"
,
EsDateUtil
.
esFieldDateFormat
(
DateUtils
.
formatDateTime
()));
modifyParams
.
put
(
"updateDate"
,
EsDateUtil
.
esFieldDateFormat
(
DateUtils
.
formatDateTime
()));
esOpUtil
.
batchUpdateScript
(
indexArr
,
buildQuery
,
modifyParams
);
try
{
Thread
.
sleep
(
1000
);
...
...
@@ -1422,14 +1469,14 @@ public class InformationServiceImpl implements InformationService {
deleteParams
.
put
(
"relationId"
,
markTag
.
getRelationId
());
long
start
=
System
.
currentTimeMillis
();
esOpUtil
.
batchNestedDeleteScript
(
indexArr
,
buildQuery
,
deleteParams
,
"labels"
);
log
.
info
(
"删除标签-{},耗时:{}"
,
markTag
.
getRelationName
(),
System
.
currentTimeMillis
()-
start
);
log
.
info
(
"删除标签-{},耗时:{}"
,
markTag
.
getRelationName
(),
System
.
currentTimeMillis
()
-
start
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
Map
<
String
,
Object
>
modifyParams
=
new
HashMap
<>();
modifyParams
.
put
(
"updateDate"
,
EsDateUtil
.
esFieldDateFormat
(
DateUtils
.
formatDateTime
()));
modifyParams
.
put
(
"updateDate"
,
EsDateUtil
.
esFieldDateFormat
(
DateUtils
.
formatDateTime
()));
esOpUtil
.
batchUpdateScript
(
indexArr
,
buildQuery
,
modifyParams
);
try
{
Thread
.
sleep
(
1000
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论