Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
218f9fe8
提交
218f9fe8
authored
2月 21, 2025
作者:
925993793@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
调试bug修改
上级
df3a629b
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
142 行增加
和
23 行删除
+142
-23
EventManageController.java
...java/com/zzsn/event/controller/EventManageController.java
+0
-1
SubjectManageController.java
...va/com/zzsn/event/controller/SubjectManageController.java
+2
-0
InformationController.java
...m/zzsn/event/controller/common/InformationController.java
+3
-5
PlatEventManageController.java
...zzsn/event/controller/plat/PlatEventManageController.java
+4
-9
EsService.java
src/main/java/com/zzsn/event/es/EsService.java
+70
-5
SubjectTypeMapper.java
src/main/java/com/zzsn/event/mapper/SubjectTypeMapper.java
+2
-0
SubjectTypeMapper.xml
...main/java/com/zzsn/event/mapper/xml/SubjectTypeMapper.xml
+13
-1
InformationService.java
src/main/java/com/zzsn/event/service/InformationService.java
+10
-1
InformationServiceImpl.java
...a/com/zzsn/event/service/impl/InformationServiceImpl.java
+18
-1
SubjectTypeServiceImpl.java
...a/com/zzsn/event/service/impl/SubjectTypeServiceImpl.java
+8
-0
DateUtil.java
src/main/java/com/zzsn/event/util/DateUtil.java
+3
-0
InfoDataSearchCondition.java
src/main/java/com/zzsn/event/vo/InfoDataSearchCondition.java
+7
-0
SubjectTypeTreeVO.java
src/main/java/com/zzsn/event/vo/SubjectTypeTreeVO.java
+2
-0
没有找到文件。
src/main/java/com/zzsn/event/controller/EventManageController.java
浏览文件 @
218f9fe8
...
...
@@ -19,7 +19,6 @@ import com.zzsn.event.service.LabelEntityService;
import
com.zzsn.event.util.HttpUtil
;
import
com.zzsn.event.util.ObjectUtil
;
import
com.zzsn.event.util.RedisUtil
;
import
com.zzsn.event.util.tree.Node
;
import
com.zzsn.event.util.user.UserUtil
;
import
com.zzsn.event.util.user.UserVo
;
import
com.zzsn.event.vo.*
;
...
...
src/main/java/com/zzsn/event/controller/SubjectManageController.java
浏览文件 @
218f9fe8
...
...
@@ -23,9 +23,11 @@ import com.zzsn.event.vo.*;
import
com.zzsn.event.vo.es.SpecialInformation
;
import
com.zzsn.event.xxljob.entity.XxlJobInfo
;
import
com.zzsn.event.xxljob.service.IXxlJobInfoService
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.kafka.common.utils.SecurityUtils
;
import
org.apache.poi.hwpf.HWPFDocument
;
import
org.apache.poi.hwpf.extractor.WordExtractor
;
import
org.apache.poi.xwpf.extractor.XWPFWordExtractor
;
...
...
src/main/java/com/zzsn/event/controller/common/InformationController.java
浏览文件 @
218f9fe8
...
...
@@ -203,7 +203,7 @@ public class InformationController {
@PostMapping
(
"/subjectPageList"
)
public
Result
<?>
subjectPageList
(
@RequestBody
InfoDataSearchCondition
searchCondition
)
{
if
(
StringUtils
.
isEmpty
(
searchCondition
.
getSubjectId
()))
{
return
Result
.
FAIL
(
"专题id不能为空"
);
return
Result
.
FAIL
(
"专题id
/专题分类id
不能为空"
);
}
UserVo
userVo
=
UserUtil
.
getLoginUser
();
IPage
<
DisplayInfo
>
pageList
=
informationService
.
subjectPageList
(
userVo
,
searchCondition
);
...
...
@@ -421,7 +421,7 @@ public class InformationController {
}
/**
* 根据条件
移除
专题下数据-研究中心
* 根据条件
新增
专题下数据-研究中心
*
* @param params 参数
* @author lkg
...
...
@@ -437,9 +437,7 @@ public class InformationController {
if
(
CollectionUtils
.
isEmpty
(
themeIds
))
{
return
Result
.
FAIL
(
"新增的主题id集合不能为空"
);
}
//todo 新增 redis塞缓存,对接数据处理
//2025-01-21:123,123,123
informationService
.
supplyByCondition
(
subjectId
,
JSONArray
.
parseArray
(
themeIds
.
toJSONString
(),
String
.
class
));
return
Result
.
OK
();
}
}
src/main/java/com/zzsn/event/controller/plat/PlatEventManageController.java
浏览文件 @
218f9fe8
...
...
@@ -11,7 +11,9 @@ import com.zzsn.event.entity.Event;
import
com.zzsn.event.service.IEventService
;
import
com.zzsn.event.service.IInfoSourceService
;
import
com.zzsn.event.service.ISubjectTypeService
;
import
com.zzsn.event.util.*
;
import
com.zzsn.event.util.EsDateUtil
;
import
com.zzsn.event.util.EsOpUtil
;
import
com.zzsn.event.util.Utility
;
import
com.zzsn.event.util.user.UserUtil
;
import
com.zzsn.event.util.user.UserVo
;
import
com.zzsn.event.vo.*
;
...
...
@@ -19,16 +21,11 @@ import com.zzsn.event.vo.es.DisplayInfo;
import
io.swagger.annotations.Api
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
* 平台事件管理页
...
...
@@ -366,9 +363,7 @@ public class PlatEventManageController {
queryWrapper
.
le
(
Event:
:
getCreateTime
,
endDate
);
}
if
(
StringUtils
.
isNotEmpty
(
keyword
))
{
queryWrapper
.
and
(
q
->
{
q
.
eq
(
Event:
:
getEventType
,
keyword
).
or
().
like
(
Event:
:
getEventName
,
keyword
).
or
().
eq
(
Event:
:
getEventDescribe
,
keyword
);
});
queryWrapper
.
and
(
q
->
q
.
eq
(
Event:
:
getEventType
,
keyword
).
or
().
like
(
Event:
:
getEventName
,
keyword
).
or
().
eq
(
Event:
:
getEventDescribe
,
keyword
));
}
}
}
src/main/java/com/zzsn/event/es/EsService.java
浏览文件 @
218f9fe8
...
...
@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.zzsn.event.constant.Constants
;
import
com.zzsn.event.entity.Event
;
import
com.zzsn.event.entity.Subject
;
import
com.zzsn.event.service.*
;
import
com.zzsn.event.util.DateUtil
;
import
com.zzsn.event.util.EsDateUtil
;
...
...
@@ -70,6 +72,8 @@ public class EsService {
@Autowired
private
ISubjectTypeService
subjectTypeService
;
@Autowired
private
SubjectService
subjectService
;
@Autowired
private
IEventService
eventService
;
@Autowired
private
ISubjectInfoSourceMapService
subjectInfoSourceMapService
;
...
...
@@ -1079,8 +1083,7 @@ public class EsService {
if
(
CollectionUtils
.
isNotEmpty
(
ids
))
{
count
=
ids
.
size
();
}
else
{
String
[]
indexArr
=
EsIndexUtil
.
getIndexIntervalYear
(
Constants
.
SUBJECT_INDEX
,
searchCondition
.
getStartTime
(),
searchCondition
.
getEndTime
());
SearchRequest
searchRequest
=
new
SearchRequest
(
indexArr
);
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
//默认最大数量是10000,设置为true后,显示准确数量
searchSourceBuilder
.
trackTotalHits
(
true
);
...
...
@@ -1107,8 +1110,7 @@ public class EsService {
* @param searchCondition 查询条件封装
*/
public
List
<
SpecialInformation
>
informationList
(
InfoDataSearchCondition
searchCondition
)
{
String
[]
indexArr
=
EsIndexUtil
.
getIndexIntervalYear
(
Constants
.
SUBJECT_INDEX
,
searchCondition
.
getStartTime
(),
searchCondition
.
getEndTime
());
SearchRequest
searchRequest
=
new
SearchRequest
(
indexArr
);
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
String
column
=
searchCondition
.
getColumn
();
String
order
=
searchCondition
.
getOrder
();
...
...
@@ -1666,6 +1668,45 @@ public class EsService {
return
list
;
}
/**
*
*
* @param subjectIdList 专题id集合
* @param sortOrder 排序方式
* @author lkg
* @date 2025/2/21
*/
public
String
getFirstTime
(
List
<
String
>
subjectIdList
,
String
sortOrder
){
String
firstTime
=
null
;
InfoDataSearchCondition
searchCondition
=
new
InfoDataSearchCondition
();
searchCondition
.
setColumn
(
"publishDate"
);
searchCondition
.
setOrder
(
sortOrder
);
searchCondition
.
setFetchFields
(
new
String
[]{
"publishDate"
});
searchCondition
.
setDeleteFlag
(
0
);
BoolQueryBuilder
boolQueryBuilder
=
buildQuery
(
searchCondition
,
subjectIdList
);
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
//默认最大数量是10000,设置为true后,显示准确数量
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
size
(
1
);
searchSourceBuilder
.
query
(
boolQueryBuilder
);
searchRequest
.
source
(
searchSourceBuilder
);
try
{
SearchResponse
searchResponse
=
client
.
search
(
searchRequest
,
RequestOptions
.
DEFAULT
);
SearchHits
searchHits
=
searchResponse
.
getHits
();
if
(
searchHits
!=
null
)
{
SearchHit
hit
=
searchHits
.
getHits
()[
0
];
Map
<
String
,
Object
>
sourceAsMap
=
hit
.
getSourceAsMap
();
String
publishDateStr
=
sourceAsMap
.
get
(
"publishDate"
).
toString
();
firstTime
=
EsDateUtil
.
esFieldDateMapping
(
publishDateStr
).
substring
(
0
,
10
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
firstTime
;
}
/**
* term方式聚合分组
*
...
...
@@ -1731,7 +1772,31 @@ public class EsService {
//创建查询对象
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
if
(
CollectionUtils
.
isNotEmpty
(
subjectIdList
))
{
Integer
category
=
searchCondition
.
getCategory
();
boolQuery
.
must
(
QueryBuilders
.
termsQuery
(
"subjectId.keyword"
,
subjectIdList
));
if
(
subjectIdList
.
size
()
==
1
)
{
String
configStartTime
=
null
;
String
configEndTime
=
null
;
String
id
=
subjectIdList
.
get
(
0
);
if
(
category
==
1
)
{
Subject
subject
=
subjectService
.
getById
(
id
);
configStartTime
=
DateUtil
.
dateToString
(
subject
.
getTimeEnable
());
configEndTime
=
DateUtil
.
dateToString
(
subject
.
getTimeDisable
());
}
else
if
(
category
==
2
)
{
Event
event
=
eventService
.
getById
(
id
);
configStartTime
=
DateUtil
.
dateToString
(
event
.
getStartTime
());
configEndTime
=
DateUtil
.
dateToString
(
event
.
getEndTime
());
}
//时间过滤筛选-专题配置
if
(
StringUtils
.
isNotBlank
(
configStartTime
))
{
boolQuery
.
filter
(
QueryBuilders
.
rangeQuery
(
"publishDate"
).
gte
(
EsDateUtil
.
esFieldDateFormat
(
configStartTime
)));
}
if
(
StringUtils
.
isNotBlank
(
configEndTime
))
{
boolQuery
.
filter
(
QueryBuilders
.
rangeQuery
(
"publishDate"
).
lte
(
EsDateUtil
.
esFieldDateFormat
(
configEndTime
)));
}
else
{
boolQuery
.
filter
(
QueryBuilders
.
rangeQuery
(
"publishDate"
).
lte
(
EsDateUtil
.
esFieldDateFormat
(
DateUtil
.
dateToString
(
new
Date
()))));
}
}
}
List
<
SearchWordVO
>
searchWordList
=
searchCondition
.
getSearchWordList
();
//研究中心 搜索词方式
...
...
@@ -1800,7 +1865,7 @@ public class EsService {
if
(
maxScore
!=
null
)
{
boolQuery
.
filter
(
QueryBuilders
.
rangeQuery
(
"score"
).
lte
(
maxScore
));
}
//时间过滤筛选
//时间过滤筛选
-前端传参
if
(
StringUtils
.
isNotBlank
(
searchCondition
.
getStartTime
()))
{
boolQuery
.
filter
(
QueryBuilders
.
rangeQuery
(
"publishDate"
).
gte
(
EsDateUtil
.
esFieldDateFormat
(
searchCondition
.
getStartTime
())));
}
...
...
src/main/java/com/zzsn/event/mapper/SubjectTypeMapper.java
浏览文件 @
218f9fe8
...
...
@@ -68,6 +68,8 @@ public interface SubjectTypeMapper extends BaseMapper<SubjectType> {
* @date 2025/1/8
*/
List
<
SubjectTypeTreeVO
>
typeBindCountTreeList
(
@Param
(
"category"
)
Integer
category
);
List
<
SubjectTypeTreeVO
>
typeBindSubjectList
();
List
<
SubjectTypeTreeVO
>
typeBindEventList
();
/**
* 根据是否公开获取专题列表
...
...
src/main/java/com/zzsn/event/mapper/xml/SubjectTypeMapper.xml
浏览文件 @
218f9fe8
...
...
@@ -19,7 +19,7 @@
</update>
<select
id=
"typeBindCountTreeList"
resultType=
"com.zzsn.event.vo.SubjectTypeTreeVO"
>
SELECT t.id,t.type_name as name,t.pid,count(m.type_id) as subjectCount,t.create_time
SELECT t.id,t.type_name as name,t.pid,count(m.type_id) as subjectCount,t.create_time
,'false' as ynSubject
FROM subject_type t
inner join `subject_type_map` m on t.id = m.type_id
<if
test=
"category != null and category == 1"
>
...
...
@@ -32,6 +32,18 @@
group by m.type_id
order by t.create_time
</select>
<select
id=
"typeBindSubjectList"
resultType=
"com.zzsn.event.vo.SubjectTypeTreeVO"
>
SELECT s.id,s.subject_name as name,m.type_id as pid,'0' as subjectCount,s.create_time,'true' as ynSubject
FROM subject s
inner join `subject_type_map` m on s.id = m.subject_id
order by s.create_time
</select>
<select
id=
"typeBindEventList"
resultType=
"com.zzsn.event.vo.SubjectTypeTreeVO"
>
SELECT s.id,s.event_name as name,m.type_id as pid,'0' as subjectCount,s.create_time,'true' as ynSubject
FROM event s
inner join `subject_type_map` m on s.id = m.subject_id
order by s.create_time
</select>
<select
id=
"subjectsByFacePublic"
resultType=
"com.zzsn.event.vo.SubjectTreeVO"
>
select s.id,
...
...
src/main/java/com/zzsn/event/service/InformationService.java
浏览文件 @
218f9fe8
...
...
@@ -198,9 +198,18 @@ public interface InformationService {
* 移除专题下的数据-研究中心
*
* @param subjectId 专题id
* @param themeIds 主题(关联标签)id集合
* @param themeIds
删除
主题(关联标签)id集合
* @author lkg
* @date 2025/2/20
*/
void
removeByCondition
(
String
subjectId
,
List
<
String
>
themeIds
);
/**
* 新增专题下的数据-研究中心
*
* @param subjectId 专题id
* @param themeIds 新增主题(关联标签)id集合
* @author lkg
* @date 2025/2/20
*/
void
supplyByCondition
(
String
subjectId
,
List
<
String
>
themeIds
);
}
src/main/java/com/zzsn/event/service/impl/InformationServiceImpl.java
浏览文件 @
218f9fe8
...
...
@@ -99,6 +99,7 @@ public class InformationServiceImpl implements InformationService {
@Override
public
IPage
<
DisplayInfo
>
subjectPageList
(
UserVo
userVo
,
InfoDataSearchCondition
searchCondition
)
{
IPage
<
DisplayInfo
>
page
=
new
Page
<>(
searchCondition
.
getPageNo
(),
searchCondition
.
getPageSize
());
Integer
category
=
searchCondition
.
getCategory
();
List
<
String
>
subjectIdList
=
new
ArrayList
<>();
//判断是否是专题
if
(
"1"
.
equals
(
searchCondition
.
getIsSubject
()))
{
...
...
@@ -109,7 +110,6 @@ public class InformationServiceImpl implements InformationService {
//该id其实是专题类别id
//查询类别id的所有明细id
String
subjectTypeId
=
searchCondition
.
getSubjectId
();
Integer
category
=
searchCondition
.
getCategory
();
List
<
String
>
typeIds
=
subjectTypeService
.
belowIdList
(
subjectTypeId
,
category
);
if
(
category
==
1
)
{
subjectIdList
=
subjectTypeMapService
.
selectSubjectByTypeIds
(
typeIds
);
...
...
@@ -809,6 +809,23 @@ public class InformationServiceImpl implements InformationService {
}
//python 去重接口
pythonUtil
.
clearDuplicateHistory
(
themeIds
);
}
@Override
public
void
supplyByCondition
(
String
subjectId
,
List
<
String
>
themeIds
)
{
Subject
subject
=
subjectService
.
getById
(
subjectId
);
String
startTime
=
esService
.
getFirstTime
(
themeIds
,
"asc"
);
String
endTime
=
esService
.
getFirstTime
(
themeIds
,
"desc"
);
List
<
String
>
dateList
=
DateUtil
.
betweenDate
(
startTime
,
endTime
);
if
(
CollectionUtils
.
isNotEmpty
(
dateList
))
{
List
<
String
>
redisCacheList
=
new
ArrayList
<>();
for
(
String
date
:
dateList
)
{
//2025-01-21:123,123,123
String
dateStr
=
date
+
":"
+
StringUtils
.
join
(
","
,
themeIds
);
redisCacheList
.
add
(
dateStr
);
}
redisUtil
.
rpushMultipleValues
(
Constants
.
HISTORY_SUBJECT_DATE_QUEUE
+
subject
.
getSubjectCode
(),
redisCacheList
.
toArray
(
new
String
[
0
]));
}
}
...
...
src/main/java/com/zzsn/event/service/impl/SubjectTypeServiceImpl.java
浏览文件 @
218f9fe8
...
...
@@ -160,6 +160,14 @@ public class SubjectTypeServiceImpl extends ServiceImpl<SubjectTypeMapper, Subje
subjectTypeTreeVOS
.
add
(
subjectTypeTreeVO
);
}
}
//获取专题数据
List
<
SubjectTypeTreeVO
>
dataList
=
new
ArrayList
<>();
if
(
category
==
1
)
{
dataList
=
baseMapper
.
typeBindSubjectList
();
}
else
if
(
category
==
2
)
{
dataList
=
baseMapper
.
typeBindEventList
();
}
subjectTypeTreeVOS
.
addAll
(
dataList
);
//构造树型结构
resultList
=
TreeUtil
.
tree
(
subjectTypeTreeVOS
,
"0"
);
//递归统计绑定专题的数量
...
...
src/main/java/com/zzsn/event/util/DateUtil.java
浏览文件 @
218f9fe8
...
...
@@ -23,6 +23,9 @@ public class DateUtil {
}
public
static
String
dateToString
(
Date
date
)
{
if
(
date
==
null
)
{
return
null
;
}
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
return
format
.
format
(
date
);
}
...
...
src/main/java/com/zzsn/event/vo/InfoDataSearchCondition.java
浏览文件 @
218f9fe8
...
...
@@ -35,6 +35,13 @@ public class InfoDataSearchCondition {
//结束时间
private
String
endTime
;
/*-----------------单个专题时,起效-----------*/
//专题配置的开始时间
private
String
configStartTime
;
//专题配置的结束时间
private
String
configEndTime
;
/*-----------------单个专题时,起效-----------*/
//专题库类型(对应字典编码为【Thematic_Library】的数据字典值)
private
List
<
Integer
>
classificationType
;
...
...
src/main/java/com/zzsn/event/vo/SubjectTypeTreeVO.java
浏览文件 @
218f9fe8
...
...
@@ -20,4 +20,6 @@ public class SubjectTypeTreeVO extends Node {
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
private
boolean
ynSubject
;
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论