Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
cd49ba7e
提交
cd49ba7e
authored
1月 15, 2025
作者:
925993793@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
代码优化
上级
87bfd3fc
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
24 行增加
和
18 行删除
+24
-18
LoginInterceptor.java
...a/com/zzsn/event/config/interceptor/LoginInterceptor.java
+1
-1
SubjectSimpleController.java
...va/com/zzsn/event/controller/SubjectSimpleController.java
+4
-3
KeyWordsServiceImpl.java
...java/com/zzsn/event/service/impl/KeyWordsServiceImpl.java
+0
-2
SubjectSimpleServiceImpl.java
...com/zzsn/event/service/impl/SubjectSimpleServiceImpl.java
+16
-10
InfoDataSearchCondition.java
src/main/java/com/zzsn/event/vo/InfoDataSearchCondition.java
+3
-2
没有找到文件。
src/main/java/com/zzsn/event/config/interceptor/LoginInterceptor.java
浏览文件 @
cd49ba7e
...
...
@@ -30,7 +30,7 @@ public class LoginInterceptor implements HandlerInterceptor {
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
@NotNull
HttpServletResponse
response
,
@NotNull
Object
handler
)
{
String
userInfo
=
URLDecoder
.
decode
(
request
.
getHeader
(
LOGIN_USER_HEADER
),
StandardCharsets
.
UTF_8
);
log
.
info
(
"当前登录用户信息:{}"
,
userInfo
);
log
.
debug
(
"当前登录用户信息:{}"
,
userInfo
);
if
(
StringUtils
.
isBlank
(
userInfo
))
{
returnJson
(
response
,
JSON
.
toJSONString
(
Result
.
FAIL
(
401
,
"用户未登录"
)));
return
false
;
...
...
src/main/java/com/zzsn/event/controller/SubjectSimpleController.java
浏览文件 @
cd49ba7e
...
...
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.zzsn.event.constant.Result
;
import
com.zzsn.event.entity.Subject
;
import
com.zzsn.event.es.EsService
;
import
com.zzsn.event.service.SubjectService
;
import
com.zzsn.event.service.SubjectSimpleService
;
import
com.zzsn.event.vo.InfoDataSearchCondition
;
...
...
@@ -36,8 +35,6 @@ public class SubjectSimpleController {
private
SubjectService
subjectService
;
@Autowired
private
IXxlJobInfoService
xxlJobInfoService
;
@Autowired
private
EsService
esService
;
/**
* 创建专题
...
...
@@ -67,6 +64,10 @@ public class SubjectSimpleController {
*/
@PostMapping
(
"/editSubject"
)
public
Result
<?>
editSubject
(
@RequestBody
SubjectSimpleVO
subjectSimpleVO
)
{
List
<
SearchWordVO
>
keywords
=
subjectSimpleVO
.
getKeywords
();
if
(
CollectionUtils
.
isEmpty
(
keywords
))
{
return
Result
.
FAIL
(
"请先添加关键词"
);
}
subjectSimpleService
.
editSubject
(
subjectSimpleVO
);
return
Result
.
OK
();
}
...
...
src/main/java/com/zzsn/event/service/impl/KeyWordsServiceImpl.java
浏览文件 @
cd49ba7e
package
com
.
zzsn
.
event
.
service
.
impl
;
import
cn.hutool.core.lang.tree.Tree
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
...
@@ -36,7 +35,6 @@ import org.springframework.stereotype.Service;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
src/main/java/com/zzsn/event/service/impl/SubjectSimpleServiceImpl.java
浏览文件 @
cd49ba7e
...
...
@@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
...
...
@@ -69,6 +70,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
private
final
static
String
PROJECT_ID
=
"1476527644425682945"
;
@Override
@Transactional
public
Subject
createSubject
(
SubjectSimpleVO
subjectSimpleVO
)
{
SubjectPage
subjectPage
=
new
SubjectPage
();
BeanUtils
.
copyProperties
(
subjectSimpleVO
,
subjectPage
);
...
...
@@ -99,6 +101,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
}
@Override
@Transactional
public
void
editSubject
(
SubjectSimpleVO
subjectSimpleVO
)
{
SubjectPage
subjectPage
=
new
SubjectPage
();
BeanUtils
.
copyProperties
(
subjectSimpleVO
,
subjectPage
);
...
...
@@ -150,7 +153,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
}
}
List
<
SearchWordVO
>
wordList
=
new
ArrayList
<>(
map
.
values
());
sortByAnotherList
(
wordList
,
sortList
);
sortByAnotherList
(
wordList
,
sortList
);
return
wordList
;
}
...
...
@@ -167,7 +170,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
@Override
public
void
removeSubject
(
String
subjectId
)
{
subjectService
.
removeById
(
subjectId
);
CompletableFuture
.
runAsync
(()
->
{
CompletableFuture
.
runAsync
(()
->
{
//删除与类别的映射
subjectTypeMapService
.
deleteBySubjectId
(
subjectId
);
//删除与信息源的关联关系
...
...
@@ -177,7 +180,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
queryWrapper
.
eq
(
SubjectKeywordsMap:
:
getSubjectId
,
subjectId
);
List
<
SubjectKeywordsMap
>
list
=
subjectKeywordsMapService
.
list
(
queryWrapper
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
List
<
String
>
keywordIds
=
list
.
stream
().
map
(
SubjectKeywordsMap:
:
getKeywordsId
).
collect
(
Collectors
.
toList
());
List
<
String
>
keywordIds
=
list
.
stream
().
map
(
SubjectKeywordsMap:
:
getKeywordsId
).
collect
(
Collectors
.
toList
());
//删除关键词
keywordWordsService
.
removeByIds
(
keywordIds
);
//删除与关键词组的关联关系
...
...
@@ -202,7 +205,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
public
void
selected
(
InfoDataSearchCondition
searchCondition
)
{
String
[]
fetchFields
=
new
String
[]{
"id"
,
"checkStatus"
};
searchCondition
.
setFetchFields
(
fetchFields
);
Map
<
String
,
List
<
SpecialInformation
>>
updateMap
=
new
HashMap
<>();
Map
<
String
,
List
<
SpecialInformation
>>
updateMap
=
new
HashMap
<>();
List
<
SpecialInformation
>
informationList
=
esService
.
informationList
(
searchCondition
);
for
(
SpecialInformation
information
:
informationList
)
{
String
index
=
information
.
getDbIndex
();
...
...
@@ -215,14 +218,14 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
updateMap
.
put
(
index
,
list
);
}
}
updateMap
.
forEach
((
k
,
v
)->
esOpUtil
.
docUpdateBulk
(
k
,
v
));
updateMap
.
forEach
((
k
,
v
)
->
esOpUtil
.
docUpdateBulk
(
k
,
v
));
}
@Override
public
void
removeSelected
(
InfoDataSearchCondition
searchCondition
)
{
String
[]
fetchFields
=
new
String
[]{
"id"
,
"checkStatus"
};
searchCondition
.
setFetchFields
(
fetchFields
);
Map
<
String
,
List
<
SpecialInformation
>>
updateMap
=
new
HashMap
<>();
Map
<
String
,
List
<
SpecialInformation
>>
updateMap
=
new
HashMap
<>();
List
<
SpecialInformation
>
informationList
=
esService
.
informationList
(
searchCondition
);
for
(
SpecialInformation
information
:
informationList
)
{
String
index
=
information
.
getDbIndex
();
...
...
@@ -235,14 +238,14 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
updateMap
.
put
(
index
,
list
);
}
}
updateMap
.
forEach
((
k
,
v
)->
esOpUtil
.
docUpdateBulk
(
k
,
v
));
updateMap
.
forEach
((
k
,
v
)
->
esOpUtil
.
docUpdateBulk
(
k
,
v
));
}
@Override
public
void
batchRemove
(
InfoDataSearchCondition
searchCondition
)
{
String
[]
fetchFields
=
new
String
[]{
"id"
,
"deleteFlag"
};
searchCondition
.
setFetchFields
(
fetchFields
);
Map
<
String
,
List
<
SpecialInformation
>>
updateMap
=
new
HashMap
<>();
Map
<
String
,
List
<
SpecialInformation
>>
updateMap
=
new
HashMap
<>();
List
<
SpecialInformation
>
informationList
=
esService
.
informationList
(
searchCondition
);
for
(
SpecialInformation
information
:
informationList
)
{
String
index
=
information
.
getDbIndex
();
...
...
@@ -255,7 +258,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
updateMap
.
put
(
index
,
list
);
}
}
updateMap
.
forEach
((
k
,
v
)->
esOpUtil
.
docUpdateBulk
(
k
,
v
));
updateMap
.
forEach
((
k
,
v
)
->
esOpUtil
.
docUpdateBulk
(
k
,
v
));
}
//目标集合按照另一个集合的顺序排序
...
...
@@ -416,7 +419,10 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
//绑定为过滤词的同时,绑定为采集词
List
<
SubjectKeywordsMap
>
collect
=
subjectKeywordsMapList
.
stream
().
filter
(
e
->
"2"
.
equals
(
e
.
getBindingType
())).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
collect
))
{
collect
.
forEach
(
e
->
e
.
setBindingType
(
"1"
));
collect
.
forEach
(
e
->
{
e
.
setBindingType
(
"1"
);
e
.
setId
(
null
);
});
subjectKeywordsMapService
.
saveBatch
(
subjectKeywordsMapList
);
}
}
...
...
src/main/java/com/zzsn/event/vo/InfoDataSearchCondition.java
浏览文件 @
cd49ba7e
...
...
@@ -101,6 +101,9 @@ public class InfoDataSearchCondition {
//每页返回条数
private
Integer
pageSize
=
10
;
//选择前num条数据
private
Integer
num
;
//资讯id集合,导出/专题分析时使用-研究中心
private
List
<
String
>
ids
;
...
...
@@ -113,8 +116,6 @@ public class InfoDataSearchCondition {
/*------专题分析类参数---start-------------------*/
//聚合分组类型-按日期集合分析时使用
private
String
groupType
;
//选择的前num条数据-专题分析时使用
private
Integer
num
;
//信息源id集合-统计分析资讯量最多的信息源时使用
private
List
<
String
>
sourceIdList
;
//聚合包含的字段值的集合
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论