Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
2b32b387
提交
2b32b387
authored
7月 18, 2025
作者:
925993793@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
事件分析功能迭代
上级
0a39c974
隐藏空白字符变更
内嵌
并排
正在显示
31 个修改的文件
包含
1523 行增加
和
175 行删除
+1523
-175
EventAnalysisController.java
...va/com/zzsn/event/controller/EventAnalysisController.java
+372
-117
EventMaintenanceController.java
...com/zzsn/event/controller/EventMaintenanceController.java
+35
-24
EventManageController.java
...java/com/zzsn/event/controller/EventManageController.java
+18
-5
EventDataController.java
...a/com/zzsn/event/controller/yjzx/EventDataController.java
+2
-2
Event.java
src/main/java/com/zzsn/event/entity/Event.java
+6
-0
EventAnalysisVersion.java
...main/java/com/zzsn/event/entity/EventAnalysisVersion.java
+58
-0
EventAnalysisVersionRecord.java
...ava/com/zzsn/event/entity/EventAnalysisVersionRecord.java
+84
-0
EventCollectMap.java
src/main/java/com/zzsn/event/entity/EventCollectMap.java
+44
-0
EventContext.java
src/main/java/com/zzsn/event/entity/EventContext.java
+104
-0
AnalysisColumnEnum.java
src/main/java/com/zzsn/event/enums/AnalysisColumnEnum.java
+79
-0
EsService.java
src/main/java/com/zzsn/event/es/EsService.java
+8
-6
KafkaConsumer.java
src/main/java/com/zzsn/event/kafka/KafkaConsumer.java
+58
-0
eventContextKafkaVO.java
src/main/java/com/zzsn/event/kafka/eventContextKafkaVO.java
+27
-0
EventAnalysisVersionMapper.java
...ava/com/zzsn/event/mapper/EventAnalysisVersionMapper.java
+20
-0
EventAnalysisVersionRecordMapper.java
...m/zzsn/event/mapper/EventAnalysisVersionRecordMapper.java
+20
-0
EventCollectMapMapper.java
...ain/java/com/zzsn/event/mapper/EventCollectMapMapper.java
+20
-0
EventContextMapper.java
src/main/java/com/zzsn/event/mapper/EventContextMapper.java
+32
-0
EventMapper.xml
src/main/java/com/zzsn/event/mapper/xml/EventMapper.xml
+1
-0
AnalysisService.java
src/main/java/com/zzsn/event/service/AnalysisService.java
+98
-8
EventAnalysisVersionRecordService.java
...zzsn/event/service/EventAnalysisVersionRecordService.java
+13
-0
EventAnalysisVersionService.java
...a/com/zzsn/event/service/EventAnalysisVersionService.java
+13
-0
EventCollectMapService.java
...n/java/com/zzsn/event/service/EventCollectMapService.java
+13
-0
EventContextService.java
...main/java/com/zzsn/event/service/EventContextService.java
+59
-0
AnalysisServiceImpl.java
...java/com/zzsn/event/service/impl/AnalysisServiceImpl.java
+127
-12
EventAnalysisVersionRecordServiceImpl.java
...t/service/impl/EventAnalysisVersionRecordServiceImpl.java
+22
-0
EventAnalysisVersionServiceImpl.java
...n/event/service/impl/EventAnalysisVersionServiceImpl.java
+22
-0
EventCollectMapServiceImpl.java
...m/zzsn/event/service/impl/EventCollectMapServiceImpl.java
+22
-0
EventContextServiceImpl.java
.../com/zzsn/event/service/impl/EventContextServiceImpl.java
+115
-0
ExcelExportUtil.java
src/main/java/com/zzsn/event/util/ExcelExportUtil.java
+1
-1
EventContextModifyVO.java
src/main/java/com/zzsn/event/vo/EventContextModifyVO.java
+28
-0
EventVO.java
src/main/java/com/zzsn/event/vo/EventVO.java
+2
-0
没有找到文件。
src/main/java/com/zzsn/event/controller/EventAnalysisController.java
浏览文件 @
2b32b387
...
@@ -4,19 +4,26 @@ import cn.hutool.core.date.DateField;
...
@@ -4,19 +4,26 @@ import cn.hutool.core.date.DateField;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson2.JSONArray
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.zzsn.event.constant.Constants
;
import
com.zzsn.event.constant.Constants
;
import
com.zzsn.event.constant.Result
;
import
com.zzsn.event.constant.Result
;
import
com.zzsn.event.entity.
EventAnalysisReport
;
import
com.zzsn.event.entity.
*
;
import
com.zzsn.event.en
tity.LabelEntity
;
import
com.zzsn.event.en
ums.AnalysisColumnEnum
;
import
com.zzsn.event.es.EsService
;
import
com.zzsn.event.es.EsService
;
import
com.zzsn.event.llm.LlmService
;
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
;
import
com.zzsn.event.vo.*
;
import
com.zzsn.event.util.user.UserUtil
;
import
com.zzsn.event.util.user.UserVo
;
import
com.zzsn.event.vo.CoOccurrenceVO
;
import
com.zzsn.event.vo.CountVO
;
import
com.zzsn.event.vo.EventVO
;
import
com.zzsn.event.vo.EventViewVO
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
...
@@ -59,18 +66,58 @@ public class EventAnalysisController {
...
@@ -59,18 +66,58 @@ public class EventAnalysisController {
private
RedisUtil
redisUtil
;
private
RedisUtil
redisUtil
;
@Autowired
@Autowired
private
LlmService
llmService
;
private
LlmService
llmService
;
@Autowired
private
EventCollectMapService
eventCollectMapService
;
@Autowired
private
EventContextService
eventContextService
;
@Autowired
private
EventAnalysisVersionService
eventAnalysisVersionService
;
@Autowired
private
EventAnalysisVersionRecordService
eventAnalysisVersionRecordService
;
/**
/**
* 核心摘要
* 重新生成
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/17
*/
@GetMapping
(
"/regenerate"
)
public
Result
<?>
regenerate
(
@RequestParam
String
eventId
)
{
CompletableFuture
.
runAsync
(()
->
analysisService
.
regenerate
(
eventId
));
return
Result
.
OK
(
"重新生成中,请稍后查看"
,
null
);
}
/**
* 事件分析的版本列表
*
*
* @param eventId 事件id
* @param eventId 事件id
* @param model LLM模型
* @author lkg
* @date 2025/7/16
*/
@GetMapping
(
"/versionList"
)
public
Result
<?>
versionList
(
@RequestParam
String
eventId
)
{
LambdaQueryWrapper
<
EventAnalysisVersion
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
eq
(
EventAnalysisVersion:
:
getEventId
,
eventId
);
List
<
EventAnalysisVersion
>
versionList
=
eventAnalysisVersionService
.
list
(
queryWrapper
);
return
Result
.
OK
(
versionList
);
}
/**
* 核心摘要
*
* @param eventId 事件id
* @param versionId 版本id
* @param model LLM模型
* @author lkg
* @author lkg
* @date 2025/7/10
* @date 2025/7/10
*/
*/
@GetMapping
(
"/coreSummary"
)
@GetMapping
(
"/coreSummary"
)
public
Result
<?>
coreSummary
(
@RequestParam
String
eventId
,
@RequestParam
(
required
=
false
)
String
model
)
{
public
Result
<?>
coreSummary
(
@RequestParam
String
eventId
,
@RequestParam
(
required
=
false
)
String
versionId
,
@RequestParam
(
required
=
false
)
String
model
)
{
EventVO
eventVO
=
eventService
.
queryInfo
(
eventId
);
EventVO
eventVO
=
eventService
.
queryInfo
(
eventId
);
String
eventDescribe
=
eventVO
.
getEventDescribe
();
String
eventDescribe
=
eventVO
.
getEventDescribe
();
if
(
StringUtils
.
isEmpty
(
eventDescribe
))
{
if
(
StringUtils
.
isEmpty
(
eventDescribe
))
{
...
@@ -87,128 +134,95 @@ public class EventAnalysisController {
...
@@ -87,128 +134,95 @@ public class EventAnalysisController {
/**
/**
* 3.4 总体分析
* 3.4 总体分析
*
*
* @param
subjectId 专题
id
* @param
eventId 事件
id
* @param startTime 开始时间
* @param startTime 开始时间
* @param endTime 结束时间
* @param endTime 结束时间
* @param type 1-按小时;2-按天
* @param type 1-按小时;2-按天
* @param category 自定义门户使用(自定义组件)
* @author lkg
* @author lkg
* @date 2024/1/24
* @date 2024/1/24
*/
*/
@GetMapping
(
"/total"
)
@GetMapping
(
"/total"
)
public
Result
<?>
totalAndMax
(
@RequestParam
String
subjec
tId
,
@RequestParam
String
startTime
,
public
Result
<?>
totalAndMax
(
@RequestParam
String
even
tId
,
@RequestParam
String
startTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
(
defaultValue
=
"1"
)
Integer
type
,
@RequestParam
(
defaultValue
=
"1"
)
Integer
type
)
{
@RequestParam
(
required
=
false
)
String
category
)
{
Map
<
String
,
String
>
map
=
esStatisticsService
.
totalAndMax
(
eventId
,
null
,
null
,
type
);
Map
<
String
,
String
>
map
=
esStatisticsService
.
totalAndMax
(
subjectId
,
null
,
null
,
type
);
if
(
StringUtils
.
isEmpty
(
endTime
))
{
if
(
StringUtils
.
isEmpty
(
endTime
))
{
endTime
=
DateUtil
.
now
();
endTime
=
DateUtil
.
now
();
}
}
long
hours
=
DateUtil
.
between
(
DateUtil
.
parseDateTime
(
startTime
),
DateUtil
.
parseDateTime
(
endTime
),
DateUnit
.
HOUR
);
long
hours
=
DateUtil
.
between
(
DateUtil
.
parseDateTime
(
startTime
),
DateUtil
.
parseDateTime
(
endTime
),
DateUnit
.
HOUR
);
map
.
put
(
"duration"
,
String
.
valueOf
(
hours
));
Object
count
=
map
.
get
(
"totalCount"
);
Object
count
=
map
.
get
(
"totalCount"
);
String
divide
=
CalculateUtil
.
divide
(
String
.
valueOf
(
count
),
String
.
valueOf
(
hours
),
0
,
RoundingMode
.
UP
);
String
divide
=
CalculateUtil
.
divide
(
String
.
valueOf
(
count
),
String
.
valueOf
(
hours
),
0
,
RoundingMode
.
UP
);
map
.
put
(
"spread"
,
divide
);
List
<
Map
<
String
,
Object
>>
dataList
=
new
ArrayList
<>();
String
mainReport
=
esStatisticsService
.
mainReport
(
subjectId
);
Map
<
String
,
Object
>
totalCountMap
=
new
HashMap
<>();
map
.
put
(
"mainReport"
,
mainReport
);
totalCountMap
.
put
(
"name"
,
"事件资讯数量"
);
List
<
String
>
subjectIdList
=
new
ArrayList
<>();
totalCountMap
.
put
(
"value"
,
count
);
subjectIdList
.
add
(
subjectId
);
totalCountMap
.
put
(
"unit"
,
"条"
);
DateTime
beforeHour
=
DateUtil
.
offsetHour
(
DateUtil
.
parseDateTime
(
endTime
),
-
1
);
dataList
.
add
(
totalCountMap
);
long
lastHour
=
esStatisticsService
.
totalCount
(
subjectIdList
,
DateUtil
.
formatDateTime
(
beforeHour
),
endTime
);
Map
<
String
,
Object
>
maxCountMap
=
new
HashMap
<>();
map
.
put
(
"lastHour"
,
String
.
valueOf
(
lastHour
));
maxCountMap
.
put
(
"name"
,
"波峰值"
);
if
(
"custom"
.
equalsIgnoreCase
(
category
))
{
maxCountMap
.
put
(
"value"
,
map
.
get
(
"max"
));
List
<
Map
<
String
,
Object
>>
dataList
=
new
ArrayList
<>();
maxCountMap
.
put
(
"unit"
,
"条"
);
Map
<
String
,
Object
>
totalCountMap
=
new
HashMap
<>();
dataList
.
add
(
maxCountMap
);
totalCountMap
.
put
(
"name"
,
"事件资讯数量"
);
Map
<
String
,
Object
>
spreadMap
=
new
HashMap
<>();
totalCountMap
.
put
(
"value"
,
count
);
spreadMap
.
put
(
"name"
,
"平均传播速度"
);
totalCountMap
.
put
(
"unit"
,
"条"
);
spreadMap
.
put
(
"value"
,
divide
);
dataList
.
add
(
totalCountMap
);
spreadMap
.
put
(
"unit"
,
type
==
1
?
"条/小时"
:
"条/天"
);
Map
<
String
,
Object
>
maxCountMap
=
new
HashMap
<>();
dataList
.
add
(
spreadMap
);
maxCountMap
.
put
(
"name"
,
"波峰值"
);
return
Result
.
OK
(
dataList
);
maxCountMap
.
put
(
"value"
,
map
.
get
(
"max"
));
maxCountMap
.
put
(
"unit"
,
"条"
);
dataList
.
add
(
maxCountMap
);
Map
<
String
,
Object
>
spreadMap
=
new
HashMap
<>();
spreadMap
.
put
(
"name"
,
"平均传播速度"
);
spreadMap
.
put
(
"value"
,
divide
);
spreadMap
.
put
(
"unit"
,
type
==
1
?
"条/小时"
:
"条/天"
);
dataList
.
add
(
spreadMap
);
/*Map<String, Object> mainReportMap = new HashMap<>();
mainReportMap.put("name", "主流报道");
mainReportMap.put("value", mainReport);
dataList.add(mainReportMap);*/
return
Result
.
OK
(
dataList
);
}
else
{
return
Result
.
OK
(
map
);
}
}
}
/**
/**
*
热门信息列表
*
事件脉络
*
*
* @param
subjectId 专题
id
* @param
eventId 事件
id
* @param
size 返回条数
* @param
versionId 版本id
* @author lkg
* @author lkg
* @date 202
4/4/10
* @date 202
5/7/14
*/
*/
@GetMapping
(
"/hotList"
)
@GetMapping
(
"/eventContext"
)
public
Result
<?>
hotList
(
@RequestParam
(
name
=
"subjectId"
)
String
subjectId
,
public
Result
<?>
eventContext
(
@RequestParam
String
eventId
,
@RequestParam
(
name
=
"size"
,
defaultValue
=
"10"
)
Integer
size
)
{
@RequestParam
(
required
=
false
)
String
versionId
)
{
String
[]
fetchFields
=
new
String
[]{
"id"
,
"subjectId"
,
"title"
,
"origin"
,
"publishDate"
,
"sourceAddress"
};
if
(
StringUtils
.
isNotEmpty
(
versionId
))
{
List
<
SubjectDataVo
>
pageList
=
esService
.
pageList
(
subjectId
,
null
,
null
,
fetchFields
,
2
,
1
,
size
);
return
getVersionData
(
versionId
,
AnalysisColumnEnum
.
EVENT_CONTEXT
.
getCode
());
if
(
CollectionUtils
.
isNotEmpty
(
pageList
))
{
List
<
String
>
idList
=
new
ArrayList
<>();
pageList
.
forEach
(
e
->
idList
.
add
(
e
.
getId
()));
Map
<
String
,
Integer
>
similarNumber
=
esService
.
getSimilarNumber
(
subjectId
,
idList
);
for
(
SubjectDataVo
subjectDataVo
:
pageList
)
{
subjectDataVo
.
setOrigin
(
Constants
.
getRealOrigin
(
subjectDataVo
.
getOrigin
()));
//相似数
Integer
count
=
similarNumber
.
get
(
subjectDataVo
.
getId
());
if
(
count
==
null
)
{
count
=
0
;
}
subjectDataVo
.
setSimilarNumber
(
count
);
}
}
}
return
Result
.
OK
(
pageList
);
List
<
Map
<
String
,
Object
>>
eventContext
=
eventContextService
.
eventContext
(
eventId
);
return
Result
.
OK
(
eventContext
);
}
}
/**
/**
*
3.1 传播路径
*
事件脉络关键节点列表
*
*
* @param eventId 事件id
* @param eventId 事件id
* @author lkg
* @date 2025/7/15
*/
*/
@GetMapping
(
"/propagationPath"
)
@GetMapping
(
"/eventContext/keNodeList"
)
public
Result
<?>
propagationPath
(
@RequestParam
String
eventId
)
{
public
Result
<?>
keNodeList
(
@RequestParam
String
eventId
)
{
String
key
=
Constants
.
SUBJECT_ANALYSIS_PRE
+
Constants
.
PROPAGATION_KEY
+
eventId
;
List
<
EventContext
>
keNodeList
=
eventContextService
.
keNodeList
(
eventId
);
Object
cacheObject
=
redisUtil
.
get
(
key
);
return
Result
.
OK
(
keNodeList
);
if
(
ObjectUtils
.
isEmpty
(
cacheObject
))
{
cacheObject
=
analysisService
.
propagationPath
(
eventId
);
}
return
Result
.
OK
(
cacheObject
);
}
}
/**
/**
*
3.2 事件脉络
*
关键节点下的资讯列表
*
*
* @param subjectId 专题id
* @param eventId 事件id
* @param fakeNum 专题事件脉络展示 伪事件脉络 的资讯数量阈值
* @param keyNodeId 关键节点id
* @return com.zzsn.subjectAnalysis.common.Result
* @param pageNo 页码
* @param pageSize 每页返回数量
* @author lkg
* @date 2025/7/15
*/
*/
@GetMapping
(
"/eventContext"
)
@GetMapping
(
"/eventContext/contextArticleList"
)
public
Result
<?>
eventContext
(
@RequestParam
String
subjectId
,
public
Result
<?>
contextArticleList
(
@RequestParam
String
eventId
,
@RequestParam
(
value
=
"fakeNum"
,
required
=
false
)
Integer
fakeNum
)
{
@RequestParam
String
keyNodeId
,
/*if (fakeNum == null) {
@RequestParam
(
defaultValue
=
"1"
)
Integer
pageNo
,
fakeNum = Constants.FAKE_NUM;
@RequestParam
(
defaultValue
=
"10"
)
Integer
pageSize
)
{
}
Page
<
EventContext
>
page
=
eventContextService
.
contextArticleList
(
eventId
,
keyNodeId
,
pageNo
,
pageSize
);
List<SubjectAnalysis> eventContextList = analysisService.eventContext(subjectId, fakeNum);
return
Result
.
OK
(
page
);
if (CollectionUtils.isNotEmpty(eventContextList)) {
eventContextList.forEach(e -> e.setOrigin(Constants.getRealOrigin(e.getOrigin())));
}*/
List
<
JSONObject
>
eventContextList
=
analysisService
.
eventContext
(
subjectId
);
return
Result
.
OK
(
eventContextList
);
}
}
/**
/**
* 3.8 媒体观点/专家观点信息列表
* 3.8 媒体观点/专家观点信息列表
*
*
...
@@ -218,8 +232,10 @@ public class EventAnalysisController {
...
@@ -218,8 +232,10 @@ public class EventAnalysisController {
@ApiOperation
(
value
=
"媒体观点/专家观点信息列表"
,
notes
=
"媒体观点/专家观点信息列表"
)
@ApiOperation
(
value
=
"媒体观点/专家观点信息列表"
,
notes
=
"媒体观点/专家观点信息列表"
)
@GetMapping
(
value
=
"/listEventAnalysis"
)
@GetMapping
(
value
=
"/listEventAnalysis"
)
public
Result
<?>
listEventAnalysis
(
@RequestParam
(
name
=
"eventId"
)
String
eventId
,
public
Result
<?>
listEventAnalysis
(
@RequestParam
(
name
=
"eventId"
)
String
eventId
,
@RequestParam
(
name
=
"relationId"
)
String
relationId
)
{
@RequestParam
(
name
=
"relationId"
)
String
relationId
,
List
<
EventViewVO
>
viewpointList
=
esService
.
viewpointList
(
eventId
,
relationId
);
@RequestParam
(
defaultValue
=
"1"
)
Integer
pageNo
,
@RequestParam
(
defaultValue
=
"10"
)
Integer
pageSize
)
{
List
<
EventViewVO
>
viewpointList
=
esService
.
viewpointList
(
eventId
,
relationId
,
pageNo
,
pageSize
);
if
(
CollectionUtils
.
isNotEmpty
(
viewpointList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
viewpointList
))
{
viewpointList
.
forEach
(
e
->
e
.
setOrigin
(
Constants
.
getRealOrigin
(
e
.
getOrigin
())));
viewpointList
.
forEach
(
e
->
e
.
setOrigin
(
Constants
.
getRealOrigin
(
e
.
getOrigin
())));
}
}
...
@@ -229,15 +245,18 @@ public class EventAnalysisController {
...
@@ -229,15 +245,18 @@ public class EventAnalysisController {
/**
/**
* 热词分析
* 热词分析
*
*
* @param
subjectId
事件id
* @param
eventId
事件id
* @param pageSize
返回个数
* @param pageSize 返回个数
* @author lkg
* @author lkg
* @date 2025/7/8
* @date 2025/7/8
*/
*/
@ApiOperation
(
value
=
"热词查询"
,
notes
=
"热词查询"
)
@ApiOperation
(
value
=
"热词查询"
,
notes
=
"热词查询"
)
@GetMapping
(
value
=
"/keywordsCount"
)
@GetMapping
(
value
=
"/keywordsCount"
)
public
Result
<?>
keywordsCount
(
@RequestParam
String
subjectId
,
@RequestParam
(
defaultValue
=
"150"
)
Integer
pageSize
)
{
public
Result
<?>
keywordsCount
(
@RequestParam
String
eventId
,
List
<
CountVO
>
countVOS
=
analysisService
.
wordCloud
(
subjectId
,
pageSize
);
@RequestParam
(
required
=
false
)
String
startTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
(
defaultValue
=
"150"
)
Integer
pageSize
)
{
List
<
CountVO
>
countVOS
=
analysisService
.
wordCloud
(
eventId
,
startTime
,
endTime
,
pageSize
);
return
Result
.
OK
(
countVOS
);
return
Result
.
OK
(
countVOS
);
}
}
...
@@ -249,8 +268,14 @@ public class EventAnalysisController {
...
@@ -249,8 +268,14 @@ public class EventAnalysisController {
* @date 2025/7/8
* @date 2025/7/8
*/
*/
@GetMapping
(
"/keywordTrend"
)
@GetMapping
(
"/keywordTrend"
)
public
Result
<?>
keywordTrend
(
@RequestParam
String
eventId
,
@RequestParam
(
required
=
false
)
String
endTime
)
{
public
Result
<?>
keywordTrend
(
@RequestParam
String
eventId
,
List
<
CountVO
>
countVOS
=
analysisService
.
wordTrend
(
eventId
,
endTime
);
@RequestParam
(
required
=
false
)
String
startTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
(
required
=
false
)
String
versionId
)
{
if
(
StringUtils
.
isNotEmpty
(
versionId
))
{
return
getVersionData
(
versionId
,
AnalysisColumnEnum
.
KEYWORD_TREND
.
getCode
());
}
List
<
CountVO
>
countVOS
=
analysisService
.
wordTrend
(
eventId
,
startTime
,
endTime
);
return
Result
.
OK
(
countVOS
);
return
Result
.
OK
(
countVOS
);
}
}
...
@@ -264,21 +289,27 @@ public class EventAnalysisController {
...
@@ -264,21 +289,27 @@ public class EventAnalysisController {
* @date 2025/7/9
* @date 2025/7/9
*/
*/
@GetMapping
(
"/coOccurrence"
)
@GetMapping
(
"/coOccurrence"
)
public
Result
<?>
coOccurrence
(
String
eventId
,
@RequestParam
(
required
=
false
)
String
endTime
)
{
public
Result
<?>
coOccurrence
(
@RequestParam
String
eventId
,
List
<
CoOccurrenceVO
>
coOccurrenceVOS
=
analysisService
.
coOccurrence
(
eventId
,
endTime
);
@RequestParam
(
required
=
false
)
String
startTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
(
required
=
false
)
String
versionId
)
{
if
(
StringUtils
.
isNotEmpty
(
versionId
))
{
return
getVersionData
(
versionId
,
AnalysisColumnEnum
.
CO_OCCURRENCE
.
getCode
());
}
List
<
CoOccurrenceVO
>
coOccurrenceVOS
=
analysisService
.
coOccurrence
(
eventId
,
startTime
,
endTime
);
return
Result
.
OK
(
coOccurrenceVOS
);
return
Result
.
OK
(
coOccurrenceVOS
);
}
}
/**
/**
*
专题
下情感类标签下资讯数量统计
*
事件
下情感类标签下资讯数量统计
*
*
* @param
subjectId 专题
id
* @param
eventId 事件
id
* @author lkg
* @author lkg
* @date 2024/5/9
* @date 2024/5/9
*/
*/
@GetMapping
(
"/orientationCount"
)
@GetMapping
(
"/orientationCount"
)
public
Result
<?>
orientationCount
(
@RequestParam
String
subjec
tId
)
{
public
Result
<?>
orientationCount
(
@RequestParam
String
even
tId
)
{
List
<
CountVO
>
countVOS
=
esStatisticsService
.
orientationCount
(
subjec
tId
,
null
,
null
);
List
<
CountVO
>
countVOS
=
esStatisticsService
.
orientationCount
(
even
tId
,
null
,
null
);
return
Result
.
OK
(
countVOS
);
return
Result
.
OK
(
countVOS
);
}
}
...
@@ -286,7 +317,7 @@ public class EventAnalysisController {
...
@@ -286,7 +317,7 @@ public class EventAnalysisController {
/**
/**
* 3.5 情感判断分析
* 3.5 情感判断分析
*
*
* @param
subjectId
专题id
* @param
eventId
专题id
* @param startTime 开始时间
* @param startTime 开始时间
* @param endTime 结束时间
* @param endTime 结束时间
* @param type 1-按小时;2-按天
* @param type 1-按小时;2-按天
...
@@ -294,10 +325,10 @@ public class EventAnalysisController {
...
@@ -294,10 +325,10 @@ public class EventAnalysisController {
* @date 2024/1/25
* @date 2024/1/25
*/
*/
@GetMapping
(
"/orientation"
)
@GetMapping
(
"/orientation"
)
public
Result
<?>
orientation
(
@RequestParam
String
subjec
tId
,
@RequestParam
String
startTime
,
public
Result
<?>
orientation
(
@RequestParam
String
even
tId
,
@RequestParam
String
startTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
Integer
type
)
{
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
Integer
type
)
{
List
<
CountVO
>
list
=
new
ArrayList
<>();
List
<
CountVO
>
list
=
new
ArrayList
<>();
Map
<
String
,
String
>
map
=
esStatisticsService
.
totalAndMax
(
subjec
tId
,
null
,
null
,
type
);
Map
<
String
,
String
>
map
=
esStatisticsService
.
totalAndMax
(
even
tId
,
null
,
null
,
type
);
String
totalCount
=
map
.
get
(
"totalCount"
);
String
totalCount
=
map
.
get
(
"totalCount"
);
if
(!
totalCount
.
equals
(
"0"
))
{
if
(!
totalCount
.
equals
(
"0"
))
{
String
maxTime
=
map
.
get
(
"maxTime"
);
String
maxTime
=
map
.
get
(
"maxTime"
);
...
@@ -311,7 +342,7 @@ public class EventAnalysisController {
...
@@ -311,7 +342,7 @@ public class EventAnalysisController {
String
finalEndTime
=
endTime
;
String
finalEndTime
=
endTime
;
labelEntities
.
forEach
(
e
->
{
labelEntities
.
forEach
(
e
->
{
CompletableFuture
<
CountVO
>
async
=
CompletableFuture
.
supplyAsync
(()
->
{
CompletableFuture
<
CountVO
>
async
=
CompletableFuture
.
supplyAsync
(()
->
{
CountVO
countVO
=
esStatisticsService
.
orientation
(
subjec
tId
,
e
.
getId
(),
finalStartTime
,
finalEndTime
,
type
);
CountVO
countVO
=
esStatisticsService
.
orientation
(
even
tId
,
e
.
getId
(),
finalStartTime
,
finalEndTime
,
type
);
total
.
addAndGet
(
countVO
.
getValue
());
total
.
addAndGet
(
countVO
.
getValue
());
supply
(
countVO
,
finalStartTime
,
finalEndTime
,
type
);
supply
(
countVO
,
finalStartTime
,
finalEndTime
,
type
);
return
countVO
;
return
countVO
;
...
@@ -348,8 +379,10 @@ public class EventAnalysisController {
...
@@ -348,8 +379,10 @@ public class EventAnalysisController {
* @date 2024/1/25
* @date 2024/1/25
*/
*/
@GetMapping
(
"/flowData"
)
@GetMapping
(
"/flowData"
)
public
Result
<?>
flowData
(
@RequestParam
String
subjectId
,
@RequestParam
String
startTime
,
public
Result
<?>
flowData
(
@RequestParam
String
subjectId
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
Integer
type
)
{
@RequestParam
String
startTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
Integer
type
)
{
Map
<
String
,
String
>
map
=
esStatisticsService
.
totalAndMax
(
subjectId
,
null
,
null
,
type
);
Map
<
String
,
String
>
map
=
esStatisticsService
.
totalAndMax
(
subjectId
,
null
,
null
,
type
);
String
totalCount
=
map
.
get
(
"totalCount"
);
String
totalCount
=
map
.
get
(
"totalCount"
);
List
<
CountVO
>
list
=
new
ArrayList
<>();
List
<
CountVO
>
list
=
new
ArrayList
<>();
...
@@ -366,6 +399,23 @@ public class EventAnalysisController {
...
@@ -366,6 +399,23 @@ public class EventAnalysisController {
/**
/**
* 传播路径
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/14
*/
@GetMapping
(
"/propagationPath"
)
public
Result
<?>
propagationPath
(
@RequestParam
String
eventId
)
{
String
key
=
Constants
.
SUBJECT_ANALYSIS_PRE
+
Constants
.
PROPAGATION_KEY
+
eventId
;
Object
cacheObject
=
redisUtil
.
get
(
key
);
if
(
ObjectUtils
.
isEmpty
(
cacheObject
))
{
cacheObject
=
analysisService
.
propagationPath
(
eventId
);
}
return
Result
.
OK
(
cacheObject
);
}
/**
* 按来源分析
* 按来源分析
*
*
* @param subjectId 专题id
* @param subjectId 专题id
...
@@ -373,18 +423,194 @@ public class EventAnalysisController {
...
@@ -373,18 +423,194 @@ public class EventAnalysisController {
* @date 2024/1/25
* @date 2024/1/25
*/
*/
@GetMapping
(
"/origin"
)
@GetMapping
(
"/origin"
)
public
Result
<?>
origin
(
@RequestParam
String
subjectId
)
{
public
Result
<?>
origin
(
@RequestParam
String
subjectId
,
List
<
CountVO
>
list
=
esStatisticsService
.
origin
(
subjectId
,
null
,
null
);
@RequestParam
(
required
=
false
)
String
startTime
,
@RequestParam
(
required
=
false
)
String
endTime
)
{
List
<
CountVO
>
list
=
esStatisticsService
.
origin
(
subjectId
,
startTime
,
endTime
);
return
Result
.
OK
(
list
);
return
Result
.
OK
(
list
);
}
}
public
Result
<?>
measureSuggest
()
{
/**
* 影响评估
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2025/7/14
*/
@GetMapping
(
"/impactAssessment"
)
public
Result
<?>
impactAssessment
(
@RequestParam
String
eventId
,
@RequestParam
(
required
=
false
)
String
startTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
(
required
=
false
)
String
versionId
)
{
if
(
StringUtils
.
isNotEmpty
(
versionId
))
{
return
getVersionData
(
versionId
,
AnalysisColumnEnum
.
IMPACT_ASSESSMENT
.
getCode
());
}
//todo
//todo
return
Result
.
OK
();
return
Result
.
OK
();
}
}
/**
/**
* 举措建议
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2024/4/12
*/
@GetMapping
(
"/measureSuggest"
)
public
Result
<?>
measureSuggest
(
@RequestParam
String
eventId
,
@RequestParam
(
required
=
false
)
String
startTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
(
required
=
false
)
String
versionId
)
{
if
(
StringUtils
.
isNotEmpty
(
versionId
))
{
return
getVersionData
(
versionId
,
AnalysisColumnEnum
.
MEASURE_SUGGEST
.
getCode
());
}
//todo
return
Result
.
OK
();
}
/**
* 知识词条
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2024/4/12
*/
@GetMapping
(
"/knowledgeEntry"
)
public
Result
<?>
knowledgeEntry
(
@RequestParam
String
eventId
,
@RequestParam
(
required
=
false
)
String
startTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
(
required
=
false
)
String
versionId
)
{
if
(
StringUtils
.
isNotEmpty
(
versionId
))
{
return
getVersionData
(
versionId
,
AnalysisColumnEnum
.
KNOWLEDGE_ENTRY
.
getCode
());
}
//todo
return
Result
.
OK
();
}
/**
* 企业案例
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2024/4/12
*/
@GetMapping
(
"/enterpriseCase"
)
public
Result
<?>
enterpriseCase
(
@RequestParam
String
eventId
,
@RequestParam
(
required
=
false
)
String
startTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
(
required
=
false
)
String
versionId
)
{
if
(
StringUtils
.
isNotEmpty
(
versionId
))
{
return
getVersionData
(
versionId
,
AnalysisColumnEnum
.
ENTERPRISE_CASE
.
getCode
());
}
//todo
return
Result
.
OK
();
}
/**
* 各国政策
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2024/4/12
*/
@GetMapping
(
"/countryPolicy"
)
public
Result
<?>
countryPolicy
(
@RequestParam
String
eventId
,
@RequestParam
(
required
=
false
)
String
startTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
(
required
=
false
)
String
versionId
)
{
if
(
StringUtils
.
isNotEmpty
(
versionId
))
{
return
getVersionData
(
versionId
,
AnalysisColumnEnum
.
COUNTRY_POLICY
.
getCode
());
}
//todo
return
Result
.
OK
();
}
/**
* 本国类似事件
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2024/4/12
*/
@GetMapping
(
"/domesticSimilarEvent"
)
public
Result
<?>
domesticSimilarEvent
(
@RequestParam
String
eventId
,
@RequestParam
(
required
=
false
)
String
startTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
(
required
=
false
)
String
versionId
)
{
if
(
StringUtils
.
isNotEmpty
(
versionId
))
{
return
getVersionData
(
versionId
,
AnalysisColumnEnum
.
DOMESTIC_SIMILAR_EVENT
.
getCode
());
}
//todo
return
Result
.
OK
();
}
/**
* 各国类似事件
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2024/4/12
*/
@GetMapping
(
"/foreignSimilarEvent"
)
public
Result
<?>
foreignSimilarEvent
(
@RequestParam
String
eventId
,
@RequestParam
(
required
=
false
)
String
startTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
(
required
=
false
)
String
versionId
)
{
if
(
StringUtils
.
isNotEmpty
(
versionId
))
{
return
getVersionData
(
versionId
,
AnalysisColumnEnum
.
FOREIGN_SIMILAR_EVENT
.
getCode
());
}
//todo
return
Result
.
OK
();
}
/**
* 关注
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/15
*/
@GetMapping
(
"/collect"
)
public
Result
<?>
collect
(
String
eventId
)
{
UserVo
currentUser
=
UserUtil
.
getLoginUser
();
eventCollectMapService
.
save
(
new
EventCollectMap
().
setEventId
(
eventId
).
setUserId
(
currentUser
.
getId
()));
return
Result
.
OK
();
}
/**
* 取消关注
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/15
*/
@GetMapping
(
"/cancelCollect"
)
public
Result
<?>
cancelCollect
(
String
eventId
)
{
UserVo
currentUser
=
UserUtil
.
getLoginUser
();
LambdaQueryWrapper
<
EventCollectMap
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
eq
(
EventCollectMap:
:
getEventId
,
eventId
).
eq
(
EventCollectMap:
:
getUserId
,
currentUser
.
getId
());
eventCollectMapService
.
remove
(
queryWrapper
);
return
Result
.
OK
();
}
/**
* 获取事件分析报告详细信息
* 获取事件分析报告详细信息
*
*
* @param eventId 事件id
* @param eventId 事件id
...
@@ -412,6 +638,35 @@ public class EventAnalysisController {
...
@@ -412,6 +638,35 @@ public class EventAnalysisController {
return
Result
.
OK
();
return
Result
.
OK
();
}
}
/**
* 获取接口的版本数据
*
* @param versionId 版本id
* @param columnCode 栏目编码
* @author lkg
* @date 2025/7/16
*/
private
Result
<?>
getVersionData
(
String
versionId
,
Integer
columnCode
)
{
LambdaQueryWrapper
<
EventAnalysisVersionRecord
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
eq
(
EventAnalysisVersionRecord:
:
getVersionId
,
versionId
)
.
eq
(
EventAnalysisVersionRecord:
:
getColumnCode
,
columnCode
);
EventAnalysisVersionRecord
eventAnalysisVersionRecord
=
eventAnalysisVersionRecordService
.
getOne
(
queryWrapper
);
if
(
eventAnalysisVersionRecord
!=
null
)
{
String
resType
=
eventAnalysisVersionRecord
.
getResType
();
String
returnData
=
eventAnalysisVersionRecord
.
getReturnData
();
if
(
resType
.
equalsIgnoreCase
(
"string"
))
{
return
Result
.
OK
(
returnData
);
}
else
if
(
resType
.
equalsIgnoreCase
(
"object"
))
{
return
Result
.
OK
(
JSONObject
.
parseObject
(
returnData
));
}
else
if
(
resType
.
equalsIgnoreCase
(
"array"
))
{
return
Result
.
OK
(
JSONArray
.
parseArray
(
returnData
));
}
}
return
Result
.
OK
();
}
/**
/**
* 获取趋势图数据的实际时间范围
* 获取趋势图数据的实际时间范围
*
*
...
...
src/main/java/com/zzsn/event/controller/
yjzx/
EventMaintenanceController.java
→
src/main/java/com/zzsn/event/controller/EventMaintenanceController.java
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
controller
.
yjzx
;
package
com
.
zzsn
.
event
.
controller
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.zzsn.event.constant.Result
;
import
com.zzsn.event.constant.Result
;
import
com.zzsn.event.entity.SubjectAnalysis
;
import
com.zzsn.event.entity.Event
;
import
com.zzsn.event.service.AnalysisService
;
import
com.zzsn.event.entity.EventContext
;
import
com.zzsn.event.service.SubjectAnalysisService
;
import
com.zzsn.event.service.EventContextService
;
import
com.zzsn.event.service.IEventService
;
import
com.zzsn.event.vo.EventContextModifyVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -23,46 +26,54 @@ import java.util.List;
...
@@ -23,46 +26,54 @@ import java.util.List;
public
class
EventMaintenanceController
{
public
class
EventMaintenanceController
{
@Autowired
@Autowired
private
SubjectAnalysisService
subjectAnalysis
Service
;
private
IEventService
event
Service
;
@Autowired
@Autowired
private
AnalysisService
analysisService
;
private
EventContextService
eventContextService
;
/**
/**
*
专题事件脉络列表
*
编辑核心摘要
*
*
* @param
subjectId 专题id
* @param
event 事件信息
* @author lkg
* @author lkg
* @date 202
4/5/27
* @date 202
5/7/15
*/
*/
@GetMapping
(
"/eventContextList"
)
@PostMapping
(
"/event/description/update"
)
public
Result
<?>
eventContextList
(
@RequestParam
String
subjectId
){
public
Result
<?>
eventContextList
(
@RequestBody
Event
event
)
{
List
<
JSONObject
>
eventContextList
=
analysisService
.
eventContext
(
subjectId
);
LambdaUpdateWrapper
<
Event
>
update
=
Wrappers
.
lambdaUpdate
();
return
Result
.
OK
(
eventContextList
);
update
.
set
(
Event:
:
getEventDescribe
,
event
.
getEventDescribe
())
.
set
(
Event:
:
getYnManualEdit
,
1
)
.
eq
(
Event:
:
getId
,
event
.
getId
());
eventService
.
update
(
update
);
return
Result
.
OK
();
}
}
/**
/**
* 事件脉络新增/编辑
* 事件脉络新增/编辑
*
*
* @param
subjectAnalysis
事件脉络信息
* @param
eventContextModifyVO
事件脉络信息
* @author lkg
* @author lkg
* @date 202
4/5/11
* @date 202
5/7/15
*/
*/
@PostMapping
(
"/eventContext
M
odify"
)
@PostMapping
(
"/eventContext
/m
odify"
)
public
Result
<?>
eventContextModify
(
@RequestBody
SubjectAnalysis
subjectAnalysis
){
public
Result
<?>
eventContextModify
(
@RequestBody
EventContextModifyVO
eventContextModifyVO
){
subjectAnalysisService
.
eventContextModify
(
subjectAnalysis
);
eventContextService
.
eventContextModify
(
eventContextModifyVO
);
return
Result
.
OK
();
return
Result
.
OK
();
}
}
/**
/**
* 删除事件脉络
* 删除事件脉络
*
*
* @param
id 主键
id
* @param
keyNodeId 脉络关健节点
id
* @author lkg
* @author lkg
* @date 202
4/5/27
* @date 202
5/7/15
*/
*/
@GetMapping
(
"/eventContextRemove"
)
@GetMapping
(
"/eventContext/remove"
)
public
Result
<?>
eventContextRemove
(
String
id
){
public
Result
<?>
eventContextRemove
(
@RequestParam
String
keyNodeId
){
subjectAnalysisService
.
removeById
(
id
);
LambdaQueryWrapper
<
EventContext
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
eventContextService
.
remove
(
queryWrapper
.
eq
(
EventContext:
:
getId
,
keyNodeId
).
or
().
eq
(
EventContext:
:
getParentId
,
keyNodeId
));
return
Result
.
OK
();
return
Result
.
OK
();
}
}
}
}
src/main/java/com/zzsn/event/controller/EventManageController.java
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
controller
;
package
com
.
zzsn
.
event
.
controller
;
import
com.alibaba.fastjson2.JSON
;
import
com.alibaba.fastjson2.JSON
;
import
com.alibaba.fastjson2.JSONArray
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
@@ -10,12 +11,11 @@ import com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO;
...
@@ -10,12 +11,11 @@ import com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO;
import
com.zzsn.event.constant.Constants
;
import
com.zzsn.event.constant.Constants
;
import
com.zzsn.event.constant.Result
;
import
com.zzsn.event.constant.Result
;
import
com.zzsn.event.entity.Event
;
import
com.zzsn.event.entity.Event
;
import
com.zzsn.event.entity.EventAnalysisVersionRecord
;
import
com.zzsn.event.entity.KeyWords
;
import
com.zzsn.event.entity.KeyWords
;
import
com.zzsn.event.entity.SubjectInfoSourceMap
;
import
com.zzsn.event.entity.SubjectInfoSourceMap
;
import
com.zzsn.event.service.IEventService
;
import
com.zzsn.event.enums.AnalysisColumnEnum
;
import
com.zzsn.event.service.IKeyWordsService
;
import
com.zzsn.event.service.*
;
import
com.zzsn.event.service.ISubjectInfoSourceMapService
;
import
com.zzsn.event.service.LabelEntityService
;
import
com.zzsn.event.service.impl.ConfigurationMessageService
;
import
com.zzsn.event.service.impl.ConfigurationMessageService
;
import
com.zzsn.event.util.HttpUtil
;
import
com.zzsn.event.util.HttpUtil
;
import
com.zzsn.event.util.ObjectUtil
;
import
com.zzsn.event.util.ObjectUtil
;
...
@@ -35,6 +35,7 @@ import org.springframework.kafka.core.KafkaTemplate;
...
@@ -35,6 +35,7 @@ import org.springframework.kafka.core.KafkaTemplate;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
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
;
...
@@ -66,6 +67,8 @@ public class EventManageController {
...
@@ -66,6 +67,8 @@ public class EventManageController {
private
RedisUtil
redisUtil
;
private
RedisUtil
redisUtil
;
@Resource
@Resource
private
KafkaTemplate
<
String
,
String
>
kafkaTemplate
;
private
KafkaTemplate
<
String
,
String
>
kafkaTemplate
;
@Autowired
private
EventAnalysisVersionRecordService
eventAnalysisVersionRecordService
;
@Value
((
"${serviceProject.url:}"
))
@Value
((
"${serviceProject.url:}"
))
private
String
SERVICE_PROJECT_URL
;
private
String
SERVICE_PROJECT_URL
;
...
@@ -125,8 +128,18 @@ public class EventManageController {
...
@@ -125,8 +128,18 @@ public class EventManageController {
* @return
* @return
*/
*/
@GetMapping
(
value
=
"/queryById"
)
@GetMapping
(
value
=
"/queryById"
)
public
Result
<?>
queryById
(
@RequestParam
(
name
=
"id"
)
String
id
)
{
public
Result
<?>
queryById
(
@RequestParam
(
name
=
"id"
)
String
id
,
@RequestParam
(
required
=
false
)
String
versionId
)
{
EventVO
eventVO
=
eventService
.
queryInfo
(
id
);
EventVO
eventVO
=
eventService
.
queryInfo
(
id
);
if
(
StringUtils
.
isNotEmpty
(
versionId
))
{
LambdaQueryWrapper
<
EventAnalysisVersionRecord
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
eq
(
EventAnalysisVersionRecord:
:
getVersionId
,
versionId
)
.
eq
(
EventAnalysisVersionRecord:
:
getColumnCode
,
AnalysisColumnEnum
.
CORE_SUMMARY
.
getCode
());
EventAnalysisVersionRecord
eventAnalysisVersionRecord
=
eventAnalysisVersionRecordService
.
getOne
(
queryWrapper
);
if
(
eventAnalysisVersionRecord
!=
null
)
{
eventVO
.
setEventDescribe
(
eventAnalysisVersionRecord
.
getReturnData
());
}
}
return
Result
.
OK
(
eventVO
);
return
Result
.
OK
(
eventVO
);
}
}
...
...
src/main/java/com/zzsn/event/controller/yjzx/EventDataController.java
浏览文件 @
2b32b387
...
@@ -167,10 +167,10 @@ public class EventDataController {
...
@@ -167,10 +167,10 @@ public class EventDataController {
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
==
2
)
{
pageList
=
eventService
.
frontCollectPageList
(
projectId
,
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
)
{
pageList
=
eventService
.
frontCollectPageList
(
projectId
,
eventName
,
eventType
,
labelField
,
labelName
,
order
,
orderType
,
pageNo
,
pageSize
);
}
}
return
Result
.
OK
(
pageList
);
return
Result
.
OK
(
pageList
);
}
}
...
...
src/main/java/com/zzsn/event/entity/Event.java
浏览文件 @
2b32b387
...
@@ -91,6 +91,12 @@ public class Event {
...
@@ -91,6 +91,12 @@ public class Event {
@ApiModelProperty
(
value
=
"事件描述"
)
@ApiModelProperty
(
value
=
"事件描述"
)
private
String
eventDescribe
;
private
String
eventDescribe
;
/**
/**
* 事件描述是否人工编辑(1-是;0-否)
*/
@Excel
(
name
=
"事件描述是否人工编辑(1-是;0-否)"
,
width
=
15
)
@ApiModelProperty
(
value
=
"事件描述是否人工编辑(1-是;0-否)"
)
private
Integer
ynManualEdit
;
/**
* 创建人id
* 创建人id
*/
*/
@Excel
(
name
=
"创建人id"
,
width
=
15
)
@Excel
(
name
=
"创建人id"
,
width
=
15
)
...
...
src/main/java/com/zzsn/event/entity/EventAnalysisVersion.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 事件分析版本表
* @TableName event_analysis_version
*/
@Data
@TableName
(
"event_analysis_version"
)
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
public
class
EventAnalysisVersion
implements
Serializable
{
/**
* 版本id
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
private
String
id
;
/**
* 事件id
*/
private
String
eventId
;
/**
* 版本名称
*/
private
String
versionName
;
/**
* 创建人
*/
private
String
createBy
;
/**
* 创建时间
*/
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
/**
* 更新人
*/
private
String
updateBy
;
/**
* 更新时间
*/
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
updateTime
;
}
src/main/java/com/zzsn/event/entity/EventAnalysisVersionRecord.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
entity
;
import
com.alibaba.fastjson2.JSON
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.zzsn.event.enums.AnalysisColumnEnum
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 事件分析版本记录表
*
* @TableName event_analysis_version_record
*/
@Data
@TableName
(
"event_analysis_version_record"
)
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
public
class
EventAnalysisVersionRecord
implements
Serializable
{
/**
* 主键id
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
private
String
id
;
/**
* 版本id
*/
private
String
versionId
;
/**
* 栏目编码
*/
private
Integer
columnCode
;
/**
* 参数
*/
private
String
params
;
/**
* 返回数据
*/
private
String
returnData
;
/**
* 返回数据类型(object、array)
*/
private
String
resType
;
/**
* 创建人
*/
private
String
createBy
;
/**
* 创建时间
*/
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
/**
* 更新人
*/
private
String
updateBy
;
/**
* 更新时间
*/
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
updateTime
;
public
static
EventAnalysisVersionRecord
of
(
String
versionId
,
AnalysisColumnEnum
analysisColumnEnum
,
String
returnData
)
{
EventAnalysisVersionRecord
record
=
new
EventAnalysisVersionRecord
();
record
.
setVersionId
(
versionId
);
record
.
setColumnCode
(
analysisColumnEnum
.
getCode
());
record
.
setReturnData
(
returnData
);
record
.
setResType
(
analysisColumnEnum
.
getResType
());
return
record
;
}
}
src/main/java/com/zzsn/event/entity/EventCollectMap.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 用户关注事件关系表
* @TableName event_collect_map
*/
@Data
@TableName
(
"event_collect_map"
)
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
public
class
EventCollectMap
implements
Serializable
{
/**
* 主键id
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
private
String
id
;
/**
* 事件id
*/
private
String
eventId
;
/**
* 用户id
*/
private
String
userId
;
/**
* 创建时间
*/
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
}
src/main/java/com/zzsn/event/entity/EventContext.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 事件脉络表
* @TableName event_context
*/
@Data
@TableName
(
"event_context"
)
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
public
class
EventContext
implements
Serializable
{
/**
* 主键id
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
private
String
id
;
/**
* 专题id
*/
private
String
eventId
;
/**
* 资讯id
*/
private
String
articleId
;
/**
* 标题
*/
private
String
title
;
/**
* 来源
*/
private
String
origin
;
/**
* 发布时间
*/
private
String
publishDate
;
/**
* 链接
*/
private
String
sourceAddress
;
/**
* 排序
*/
private
Integer
sortNumber
;
/**
* 是否关键节点(1-是;0-否)
*/
private
Integer
ynKeyNode
;
/**
* 关键节点唯一编码
*/
private
String
uniqueCode
;
/**
* 上级id(所属关键节点id)
*/
private
String
parentId
;
/**
* es索引名称
*/
private
String
esIndex
;
/**
* 生成方式(1-自动;2-人工)
*/
private
Integer
createWay
;
/**
* 创建人
*/
private
String
createBy
;
/**
* 创建时间
*/
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
/**
* 更新人
*/
private
String
updateBy
;
/**
* 更新时间
*/
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
updateTime
;
/**关键节点下资讯数量*/
@TableField
(
exist
=
false
)
private
Integer
articleCount
;
}
src/main/java/com/zzsn/event/enums/AnalysisColumnEnum.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
enums
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author zs
* @Description 事件分析栏目(支持版本逻辑) 枚举
* @since 2021/12/9
*/
public
enum
AnalysisColumnEnum
{
CORE_SUMMARY
(
1
,
"核心摘要"
,
"string"
,
1
),
EVENT_CONTEXT
(
2
,
"事件脉络"
,
"array"
,
0
),
KEYWORD_TREND
(
3
,
"关键词趋势分析"
,
"array"
,
0
),
CO_OCCURRENCE
(
4
,
"关键词共现"
,
"array"
,
0
),
IMPACT_ASSESSMENT
(
5
,
"影响评估"
,
"array"
,
1
),
MEASURE_SUGGEST
(
6
,
"举措建议"
,
"array"
,
1
),
KNOWLEDGE_ENTRY
(
7
,
"知识词条"
,
"array"
,
1
),
ENTERPRISE_CASE
(
8
,
"企业案例"
,
"array"
,
1
),
COUNTRY_POLICY
(
9
,
"各国政策"
,
"array"
,
1
),
DOMESTIC_SIMILAR_EVENT
(
10
,
"本国类似事件"
,
"array"
,
1
),
FOREIGN_SIMILAR_EVENT
(
11
,
"各国类似事件"
,
"array"
,
1
),
;
//栏目编码
private
final
Integer
code
;
//栏目名称
private
final
String
name
;
//返回数据类型
private
final
String
resType
;
//是否需要大模型(1-是;0-否)
private
final
Integer
ynNeedLlm
;
AnalysisColumnEnum
(
int
code
,
String
name
,
String
resType
,
Integer
ynNeedLlm
)
{
this
.
code
=
code
;
this
.
name
=
name
;
this
.
resType
=
resType
;
this
.
ynNeedLlm
=
ynNeedLlm
;
}
public
Integer
getCode
()
{
return
code
;
}
public
String
getName
()
{
return
name
;
}
public
String
getResType
()
{
return
resType
;
}
public
Integer
getYnNeedLlm
()
{
return
ynNeedLlm
;
}
public
static
List
<
AnalysisColumnEnum
>
llmList
()
{
List
<
AnalysisColumnEnum
>
list
=
new
ArrayList
<>();
for
(
AnalysisColumnEnum
value
:
AnalysisColumnEnum
.
values
())
{
if
(
value
.
ynNeedLlm
==
1
)
{
list
.
add
(
value
);
}
}
return
list
;
}
}
src/main/java/com/zzsn/event/es/EsService.java
浏览文件 @
2b32b387
...
@@ -1056,10 +1056,12 @@ public class EsService {
...
@@ -1056,10 +1056,12 @@ public class EsService {
* @author lkg
* @author lkg
* @date 2024/10/10
* @date 2024/10/10
*/
*/
public
List
<
EventViewVO
>
viewpointList
(
String
eventId
,
String
relationId
)
{
public
List
<
EventViewVO
>
viewpointList
(
String
eventId
,
String
relationId
,
Integer
pageNo
,
Integer
pageSize
)
{
List
<
EventViewVO
>
dataList
=
new
ArrayList
<>();
List
<
EventViewVO
>
dataList
=
new
ArrayList
<>();
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
searchSourceBuilder
.
from
((
pageNo
-
1
)
*
pageSize
);
searchSourceBuilder
.
size
(
pageSize
);
//排序方式 按发布时间升序
//排序方式 按发布时间升序
searchSourceBuilder
.
sort
(
"publishDate"
,
SortOrder
.
DESC
);
searchSourceBuilder
.
sort
(
"publishDate"
,
SortOrder
.
DESC
);
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
...
@@ -2028,7 +2030,7 @@ public class EsService {
...
@@ -2028,7 +2030,7 @@ public class EsService {
if
(!
Objects
.
isNull
(
searchCondition
.
getIncludeValues
())
||
!
Objects
.
isNull
(
searchCondition
.
getExcludeValues
()))
{
if
(!
Objects
.
isNull
(
searchCondition
.
getIncludeValues
())
||
!
Objects
.
isNull
(
searchCondition
.
getExcludeValues
()))
{
if
(!
Objects
.
isNull
(
searchCondition
.
getIncludeValues
()))
{
if
(!
Objects
.
isNull
(
searchCondition
.
getIncludeValues
()))
{
aggregationBuilder
.
size
(
searchCondition
.
getIncludeValues
().
length
);
aggregationBuilder
.
size
(
searchCondition
.
getIncludeValues
().
length
);
}
else
{
}
else
{
aggregationBuilder
.
size
(
size
);
aggregationBuilder
.
size
(
size
);
}
}
aggregationBuilder
.
includeExclude
(
new
IncludeExclude
(
searchCondition
.
getIncludeValues
(),
searchCondition
.
getExcludeValues
()));
aggregationBuilder
.
includeExclude
(
new
IncludeExclude
(
searchCondition
.
getIncludeValues
(),
searchCondition
.
getExcludeValues
()));
...
@@ -2142,7 +2144,7 @@ public class EsService {
...
@@ -2142,7 +2144,7 @@ public class EsService {
BoolQueryBuilder
boolQuery
=
buildQuery
(
searchCondition
,
subjectIds
);
BoolQueryBuilder
boolQuery
=
buildQuery
(
searchCondition
,
subjectIds
);
searchSourceBuilder
.
query
(
boolQuery
);
searchSourceBuilder
.
query
(
boolQuery
);
//按热词分组
//按热词分组
TermsAggregationBuilder
subAggregationBuilder
=
AggregationBuilders
.
terms
(
"groupId"
)
TermsAggregationBuilder
subAggregationBuilder
=
AggregationBuilders
.
terms
(
"groupId"
)
.
field
(
"id"
).
size
(
10000
);
.
field
(
"id"
).
size
(
10000
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"groupKeyword"
)
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"groupKeyword"
)
.
field
(
"keyWordsList.keyword"
)
.
field
(
"keyWordsList.keyword"
)
...
@@ -2161,10 +2163,10 @@ public class EsService {
...
@@ -2161,10 +2163,10 @@ public class EsService {
Terms
groupId
=
bucket
.
getAggregations
().
get
(
"groupId"
);
Terms
groupId
=
bucket
.
getAggregations
().
get
(
"groupId"
);
List
<?
extends
Terms
.
Bucket
>
idBuckets
=
groupId
.
getBuckets
();
List
<?
extends
Terms
.
Bucket
>
idBuckets
=
groupId
.
getBuckets
();
for
(
Terms
.
Bucket
idBucket
:
idBuckets
)
{
for
(
Terms
.
Bucket
idBucket
:
idBuckets
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"keyword"
,
keyword
);
map
.
put
(
"keyword"
,
keyword
);
map
.
put
(
"num"
,
String
.
valueOf
(
count
));
map
.
put
(
"num"
,
String
.
valueOf
(
count
));
map
.
put
(
"id"
,
idBucket
.
getKeyAsString
());
map
.
put
(
"id"
,
idBucket
.
getKeyAsString
());
list
.
add
(
map
);
list
.
add
(
map
);
}
}
}
}
...
...
src/main/java/com/zzsn/event/kafka/KafkaConsumer.java
浏览文件 @
2b32b387
...
@@ -6,10 +6,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...
@@ -6,10 +6,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.zzsn.event.constant.Constants
;
import
com.zzsn.event.constant.Constants
;
import
com.zzsn.event.entity.EventAnalysisReport
;
import
com.zzsn.event.entity.EventAnalysisReport
;
import
com.zzsn.event.entity.EventContext
;
import
com.zzsn.event.entity.SubjectAnalysis
;
import
com.zzsn.event.entity.SubjectAnalysis
;
import
com.zzsn.event.service.EventAnalysisReportService
;
import
com.zzsn.event.service.EventAnalysisReportService
;
import
com.zzsn.event.service.EventContextService
;
import
com.zzsn.event.service.SubjectAnalysisService
;
import
com.zzsn.event.service.SubjectAnalysisService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.kafka.clients.consumer.ConsumerRecord
;
import
org.apache.kafka.clients.consumer.ConsumerRecord
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -31,6 +34,61 @@ public class KafkaConsumer {
...
@@ -31,6 +34,61 @@ public class KafkaConsumer {
private
SubjectAnalysisService
subjectAnalysisService
;
private
SubjectAnalysisService
subjectAnalysisService
;
@Autowired
@Autowired
private
EventAnalysisReportService
eventAnalysisReportService
;
private
EventAnalysisReportService
eventAnalysisReportService
;
@Autowired
private
EventContextService
eventContextService
;
/**
* 获取-事件脉络-分析结果数据,并入库
*
* @param record 接收的kafka数据
*/
@KafkaListener
(
topics
=
{
"eventContextTopic"
})
public
void
eventContext_new
(
ConsumerRecord
<
String
,
String
>
record
)
{
String
value
=
record
.
value
();
if
(
StringUtils
.
isEmpty
(
value
))
{
return
;
}
List
<
eventContextKafkaVO
>
eventContextKafkaList
=
JSON
.
parseArray
(
value
,
eventContextKafkaVO
.
class
);
for
(
eventContextKafkaVO
contextKafkaVO
:
eventContextKafkaList
)
{
String
uniqueCode
=
contextKafkaVO
.
getUniqueCode
();
String
eventId
=
contextKafkaVO
.
getEventId
();
LambdaQueryWrapper
<
EventContext
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
eq
(
EventContext:
:
getEventId
,
eventId
).
eq
(
EventContext:
:
getUniqueCode
,
uniqueCode
);
EventContext
one
=
eventContextService
.
getOne
(
queryWrapper
);
Integer
maxSortNumber
=
eventContextService
.
getMaxSortNumber
(
eventId
);
String
keyNodeId
;
if
(
one
==
null
)
{
EventContext
keyNode
=
new
EventContext
();
keyNode
.
setEventId
(
eventId
);
keyNode
.
setTitle
(
contextKafkaVO
.
getTitle
());
keyNode
.
setPublishDate
(
contextKafkaVO
.
getPublishDate
());
keyNode
.
setUniqueCode
(
uniqueCode
);
keyNode
.
setYnKeyNode
(
1
);
keyNode
.
setParentId
(
"0"
);
maxSortNumber
=
maxSortNumber
+
1
;
keyNode
.
setSortNumber
(
maxSortNumber
);
eventContextService
.
save
(
keyNode
);
keyNodeId
=
keyNode
.
getId
();
}
else
{
keyNodeId
=
one
.
getId
();
}
List
<
EventContext
>
eventContextList
=
contextKafkaVO
.
getRelatedArticles
();
if
(
CollectionUtils
.
isNotEmpty
(
eventContextList
))
{
for
(
int
i
=
1
;
i
<=
eventContextList
.
size
();
i
++)
{
EventContext
eventContext
=
eventContextList
.
get
(
i
);
eventContext
.
setEventId
(
eventId
);
eventContext
.
setParentId
(
keyNodeId
);
eventContext
.
setSortNumber
(
maxSortNumber
+
i
);
eventContext
.
setCreateWay
(
2
);
}
eventContextService
.
saveBatch
(
eventContextList
);
}
}
}
/**
/**
* 获取-事件脉络-分析结果数据,并入库
* 获取-事件脉络-分析结果数据,并入库
...
...
src/main/java/com/zzsn/event/kafka/eventContextKafkaVO.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
kafka
;
import
com.zzsn.event.entity.EventContext
;
import
lombok.Data
;
import
java.util.List
;
/**
* kafka 事件脉络实体
*
* @author lkg
* @date 2025/7/15
*/
@Data
public
class
eventContextKafkaVO
{
/**事件id*/
private
String
eventId
;
/**关键节点唯一编码*/
private
String
uniqueCode
;
/**关键节点标题*/
private
String
title
;
/**关键节点时间*/
private
String
publishDate
;
/**关键节点-关联资讯列表*/
private
List
<
EventContext
>
relatedArticles
;
}
src/main/java/com/zzsn/event/mapper/EventAnalysisVersionMapper.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
mapper
;
import
com.zzsn.event.entity.EventAnalysisVersion
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* @author lenovo
* @description 针对表【event_analysis_version(事件分析版本表)】的数据库操作Mapper
* @createDate 2025-07-16 16:34:46
* @Entity com.zzsn.event.entity.EventAnalysisVersion
*/
@Mapper
public
interface
EventAnalysisVersionMapper
extends
BaseMapper
<
EventAnalysisVersion
>
{
}
src/main/java/com/zzsn/event/mapper/EventAnalysisVersionRecordMapper.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
mapper
;
import
com.zzsn.event.entity.EventAnalysisVersionRecord
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* @author lenovo
* @description 针对表【event_analysis_version_record(事件分析版本记录表)】的数据库操作Mapper
* @createDate 2025-07-16 16:34:46
* @Entity com.zzsn.event.entity.EventAnalysisVersionRecord
*/
@Mapper
public
interface
EventAnalysisVersionRecordMapper
extends
BaseMapper
<
EventAnalysisVersionRecord
>
{
}
src/main/java/com/zzsn/event/mapper/EventCollectMapMapper.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
mapper
;
import
com.zzsn.event.entity.EventCollectMap
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* @author lenovo
* @description 针对表【event_collect_map(用户关注事件关系表)】的数据库操作Mapper
* @createDate 2025-07-15 10:07:01
* @Entity com.zzsn.event.entity.EventCollectMap
*/
@Mapper
public
interface
EventCollectMapMapper
extends
BaseMapper
<
EventCollectMap
>
{
}
src/main/java/com/zzsn/event/mapper/EventContextMapper.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
mapper
;
import
com.zzsn.event.entity.EventContext
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
/**
* @author lenovo
* @description 针对表【event_context(事件脉络表)】的数据库操作Mapper
* @createDate 2025-07-14 18:05:06
* @Entity com.zzsn.event.entity.EventContext
*/
@Mapper
public
interface
EventContextMapper
extends
BaseMapper
<
EventContext
>
{
/**
* 获取事件下最大的排序号
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/14
*/
@Select
(
"SELECT IFNULL(MAX(sort_number), 1) FROM event_context WHERE event_id = #{eventId}"
)
Integer
getMaxSortNumber
(
@Param
(
"eventId"
)
String
eventId
);
}
src/main/java/com/zzsn/event/mapper/xml/EventMapper.xml
浏览文件 @
2b32b387
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
t.end_time,
t.end_time,
t.publish_date,
t.publish_date,
t.event_describe,
t.event_describe,
t.yn_manual_edit,
t.event_label,
t.event_label,
t.library,
t.library,
t.unit,
t.unit,
...
...
src/main/java/com/zzsn/event/service/AnalysisService.java
浏览文件 @
2b32b387
...
@@ -23,7 +23,7 @@ public interface AnalysisService {
...
@@ -23,7 +23,7 @@ public interface AnalysisService {
/**
/**
* 事件脉络
* 事件脉络
*
*
* @param eventId
专题
id
* @param eventId
事件
id
* @param fakeNum 专题事件脉络展示 伪事件脉络 的资讯数量阈值
* @param fakeNum 专题事件脉络展示 伪事件脉络 的资讯数量阈值
* @return java.util.List<com.zzsn.subjectAnalysis.entity.SubjectAnalysis>
* @return java.util.List<com.zzsn.subjectAnalysis.entity.SubjectAnalysis>
*/
*/
...
@@ -32,7 +32,7 @@ public interface AnalysisService {
...
@@ -32,7 +32,7 @@ public interface AnalysisService {
/**
/**
* 事件脉络-新版
* 事件脉络-新版
*
*
* @param eventId
专题
id
* @param eventId
事件
id
* @author lkg
* @author lkg
* @date 2025/7/7
* @date 2025/7/7
*/
*/
...
@@ -41,38 +41,128 @@ public interface AnalysisService {
...
@@ -41,38 +41,128 @@ public interface AnalysisService {
/**
/**
* 词云
* 词云
*
*
* @param eventId 专题id
* @param eventId 事件id
* @param size 返回热词个数
* @param startTime 开始时间
* @param endTime 结束时间
* @param size 返回热词个数
* @author lkg
* @author lkg
* @date 2025/7/7
* @date 2025/7/7
*/
*/
List
<
CountVO
>
wordCloud
(
String
eventId
,
Integer
size
);
List
<
CountVO
>
wordCloud
(
String
eventId
,
String
startTime
,
String
endTime
,
Integer
size
);
/**
/**
* 关键词时间趋势
* 关键词时间趋势
*
*
* @param eventId 事件id
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @param endTime 结束时间
* @author lkg
* @author lkg
* @date 2025/7/9
* @date 2025/7/9
*/
*/
List
<
CountVO
>
wordTrend
(
String
eventId
,
String
endTime
);
List
<
CountVO
>
wordTrend
(
String
eventId
,
String
startTime
,
String
endTime
);
/**
/**
* 关键词共现
* 关键词共现
*
*
* @param eventId 事件id
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @param endTime 结束时间
* @author lkg
* @author lkg
* @date 2025/7/9
* @date 2025/7/9
*/
*/
List
<
CoOccurrenceVO
>
coOccurrence
(
String
eventId
,
String
endTime
);
List
<
CoOccurrenceVO
>
coOccurrence
(
String
eventId
,
String
startTime
,
String
endTime
);
/**
/**
* 传播路径
* 传播路径
*
*
* @param eventId
专题
id
* @param eventId
事件
id
* @return com.zzsn.subjectAnalysis.vo.PropagationPathVo
* @return com.zzsn.subjectAnalysis.vo.PropagationPathVo
*/
*/
PropagationPathVo
propagationPath
(
String
eventId
);
PropagationPathVo
propagationPath
(
String
eventId
);
/**
* 影响评估
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2025/7/17
*/
Object
impactAssessment
(
String
eventId
,
String
startTime
,
String
endTime
);
/**
* 决策建议
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2025/7/17
*/
Object
measureSuggest
(
String
eventId
,
String
startTime
,
String
endTime
);
/**
* 知识词条
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2025/7/17
*/
Object
knowledgeEntry
(
String
eventId
,
String
startTime
,
String
endTime
);
/**
* 企业案例
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2025/7/17
*/
Object
enterpriseCase
(
String
eventId
,
String
startTime
,
String
endTime
);
/**
* 各国政策
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2025/7/17
*/
Object
countryPolicy
(
String
eventId
,
String
startTime
,
String
endTime
);
/**
* 本国类似事件
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2025/7/17
*/
Object
domesticSimilarEvent
(
String
eventId
,
String
startTime
,
String
endTime
);
/**
* 各国类似事件
*
* @param eventId 事件id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2025/7/17
*/
Object
foreignSimilarEvent
(
String
eventId
,
String
startTime
,
String
endTime
);
/**
* 重新生成
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/7
*/
void
regenerate
(
String
eventId
);
}
}
src/main/java/com/zzsn/event/service/EventAnalysisVersionRecordService.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
service
;
import
com.zzsn.event.entity.EventAnalysisVersionRecord
;
import
com.baomidou.mybatisplus.extension.service.IService
;
/**
* @author lenovo
* @description 针对表【event_analysis_version_record(事件分析版本记录表)】的数据库操作Service
* @createDate 2025-07-16 16:34:46
*/
public
interface
EventAnalysisVersionRecordService
extends
IService
<
EventAnalysisVersionRecord
>
{
}
src/main/java/com/zzsn/event/service/EventAnalysisVersionService.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
service
;
import
com.zzsn.event.entity.EventAnalysisVersion
;
import
com.baomidou.mybatisplus.extension.service.IService
;
/**
* @author lenovo
* @description 针对表【event_analysis_version(事件分析版本表)】的数据库操作Service
* @createDate 2025-07-16 16:34:46
*/
public
interface
EventAnalysisVersionService
extends
IService
<
EventAnalysisVersion
>
{
}
src/main/java/com/zzsn/event/service/EventCollectMapService.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
service
;
import
com.zzsn.event.entity.EventCollectMap
;
import
com.baomidou.mybatisplus.extension.service.IService
;
/**
* @author lenovo
* @description 针对表【event_collect_map(用户关注事件关系表)】的数据库操作Service
* @createDate 2025-07-15 10:07:01
*/
public
interface
EventCollectMapService
extends
IService
<
EventCollectMap
>
{
}
src/main/java/com/zzsn/event/service/EventContextService.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.zzsn.event.entity.EventContext
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.zzsn.event.vo.EventContextModifyVO
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author lenovo
* @description 针对表【event_context(事件脉络表)】的数据库操作Service
* @createDate 2025-07-14 18:05:06
*/
public
interface
EventContextService
extends
IService
<
EventContext
>
{
List
<
Map
<
String
,
Object
>>
eventContext
(
String
eventId
);
/**
* 事件脉络维护(新增/编辑)
*
* @param eventContextModifyVO 事件脉络维护参数
* @author lkg
* @date 2025/7/15
*/
void
eventContextModify
(
EventContextModifyVO
eventContextModifyVO
);
/**
* 事件脉络关键节点列表
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/15
*/
List
<
EventContext
>
keNodeList
(
String
eventId
);
/**
* 关键节点下的资讯列表
*
* @param eventId 事件id
* @param keyNodeId 关键节点id
* @param pageNo 页码
* @param pageSize 每页返回数量
* @author lkg
* @date 2025/7/15
*/
Page
<
EventContext
>
contextArticleList
(
String
eventId
,
String
keyNodeId
,
Integer
pageNo
,
Integer
pageSize
);
/**
* 获取最大排序序号
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/15
*/
Integer
getMaxSortNumber
(
String
eventId
);
}
src/main/java/com/zzsn/event/service/impl/AnalysisServiceImpl.java
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
service
.
impl
;
package
com
.
zzsn
.
event
.
service
.
impl
;
import
c
n.hutool.core.date.DateUnit
;
import
c
om.alibaba.fastjson2.JSON
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.zzsn.event.constant.Constants
;
import
com.zzsn.event.constant.Constants
;
import
com.zzsn.event.entity.Event
;
import
com.zzsn.event.entity.Event
;
import
com.zzsn.event.entity.EventAnalysisVersion
;
import
com.zzsn.event.entity.EventAnalysisVersionRecord
;
import
com.zzsn.event.entity.SubjectAnalysis
;
import
com.zzsn.event.entity.SubjectAnalysis
;
import
com.zzsn.event.enums.AnalysisColumnEnum
;
import
com.zzsn.event.es.EsService
;
import
com.zzsn.event.es.EsService
;
import
com.zzsn.event.service.AnalysisService
;
import
com.zzsn.event.llm.LlmService
;
import
com.zzsn.event.service.CommonService
;
import
com.zzsn.event.service.*
;
import
com.zzsn.event.service.IEventService
;
import
com.zzsn.event.service.SubjectAnalysisService
;
import
com.zzsn.event.util.DateUtil
;
import
com.zzsn.event.util.DateUtil
;
import
com.zzsn.event.util.HotWordUtil
;
import
com.zzsn.event.util.HotWordUtil
;
import
com.zzsn.event.util.SimilarityUtil
;
import
com.zzsn.event.vo.*
;
import
com.zzsn.event.vo.*
;
import
com.zzsn.event.vo.es.SpecialInformation
;
import
com.zzsn.event.vo.es.SpecialInformation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -42,6 +42,14 @@ public class AnalysisServiceImpl implements AnalysisService {
...
@@ -42,6 +42,14 @@ public class AnalysisServiceImpl implements AnalysisService {
private
EsService
esService
;
private
EsService
esService
;
@Autowired
@Autowired
private
CommonService
commonService
;
private
CommonService
commonService
;
@Autowired
private
LlmService
llmService
;
@Autowired
private
EventAnalysisVersionService
eventAnalysisVersionService
;
@Autowired
private
EventAnalysisVersionRecordService
eventAnalysisVersionRecordService
;
@Autowired
private
EventContextService
eventContextService
;
/*
/*
* 优先级:事件脉络 > 伪事件脉络 > 资讯
* 优先级:事件脉络 > 伪事件脉络 > 资讯
...
@@ -101,10 +109,12 @@ public class AnalysisServiceImpl implements AnalysisService {
...
@@ -101,10 +109,12 @@ public class AnalysisServiceImpl implements AnalysisService {
}
}
@Override
@Override
public
List
<
CountVO
>
wordCloud
(
String
eventId
,
Integer
size
)
{
public
List
<
CountVO
>
wordCloud
(
String
eventId
,
String
startTime
,
String
endTime
,
Integer
size
)
{
InfoDataSearchCondition
searchCondition
=
new
InfoDataSearchCondition
();
InfoDataSearchCondition
searchCondition
=
new
InfoDataSearchCondition
();
searchCondition
.
setCategory
(
2
);
searchCondition
.
setCategory
(
2
);
searchCondition
.
setSubjectId
(
eventId
);
searchCondition
.
setSubjectId
(
eventId
);
searchCondition
.
setStartTime
(
startTime
);
searchCondition
.
setEndTime
(
endTime
);
//排除词
//排除词
Set
<
String
>
excludeKeywords
=
commonService
.
getExcludeKeywords
(
eventId
);
Set
<
String
>
excludeKeywords
=
commonService
.
getExcludeKeywords
(
eventId
);
searchCondition
.
setExcludeValues
(
excludeKeywords
.
toArray
(
new
String
[
0
]));
searchCondition
.
setExcludeValues
(
excludeKeywords
.
toArray
(
new
String
[
0
]));
...
@@ -112,9 +122,12 @@ public class AnalysisServiceImpl implements AnalysisService {
...
@@ -112,9 +122,12 @@ public class AnalysisServiceImpl implements AnalysisService {
}
}
@Override
@Override
public
List
<
CountVO
>
wordTrend
(
String
eventId
,
String
endTime
)
{
public
List
<
CountVO
>
wordTrend
(
String
eventId
,
String
startTime
,
String
endTime
)
{
Event
event
=
eventService
.
getById
(
eventId
);
Event
event
=
eventService
.
getById
(
eventId
);
Date
startTime
=
event
.
getStartTime
();
Date
beginTime
=
event
.
getStartTime
();
if
(
StringUtils
.
isNotEmpty
(
startTime
))
{
beginTime
=
DateUtil
.
stringToDate
(
startTime
,
"yyyy-mm-dd HH:mm:ss"
);
}
Date
finishTime
;
Date
finishTime
;
if
(
StringUtils
.
isEmpty
(
endTime
))
{
if
(
StringUtils
.
isEmpty
(
endTime
))
{
finishTime
=
event
.
getEndTime
();
finishTime
=
event
.
getEndTime
();
...
@@ -124,7 +137,7 @@ public class AnalysisServiceImpl implements AnalysisService {
...
@@ -124,7 +137,7 @@ public class AnalysisServiceImpl implements AnalysisService {
}
else
{
}
else
{
finishTime
=
DateUtil
.
stringToDate
(
endTime
,
"yyyy-mm-dd HH:mm:ss"
);
finishTime
=
DateUtil
.
stringToDate
(
endTime
,
"yyyy-mm-dd HH:mm:ss"
);
}
}
long
between
=
DateUtil
.
betweenTwoDate
(
start
Time
,
finishTime
);
long
between
=
DateUtil
.
betweenTwoDate
(
begin
Time
,
finishTime
);
String
groupType
;
String
groupType
;
if
(
between
<=
30
)
{
if
(
between
<=
30
)
{
groupType
=
"day"
;
groupType
=
"day"
;
...
@@ -136,7 +149,7 @@ public class AnalysisServiceImpl implements AnalysisService {
...
@@ -136,7 +149,7 @@ public class AnalysisServiceImpl implements AnalysisService {
InfoDataSearchCondition
searchCondition
=
new
InfoDataSearchCondition
();
InfoDataSearchCondition
searchCondition
=
new
InfoDataSearchCondition
();
searchCondition
.
setCategory
(
2
);
searchCondition
.
setCategory
(
2
);
searchCondition
.
setSubjectId
(
eventId
);
searchCondition
.
setSubjectId
(
eventId
);
searchCondition
.
setStartTime
(
DateUtil
.
dateToString
(
start
Time
));
searchCondition
.
setStartTime
(
DateUtil
.
dateToString
(
begin
Time
));
searchCondition
.
setEndTime
(
DateUtil
.
dateToString
(
finishTime
));
searchCondition
.
setEndTime
(
DateUtil
.
dateToString
(
finishTime
));
//排除词
//排除词
Set
<
String
>
excludeKeywords
=
commonService
.
getExcludeKeywords
(
eventId
);
Set
<
String
>
excludeKeywords
=
commonService
.
getExcludeKeywords
(
eventId
);
...
@@ -145,11 +158,13 @@ public class AnalysisServiceImpl implements AnalysisService {
...
@@ -145,11 +158,13 @@ public class AnalysisServiceImpl implements AnalysisService {
}
}
@Override
@Override
public
List
<
CoOccurrenceVO
>
coOccurrence
(
String
eventId
,
String
endTime
)
{
public
List
<
CoOccurrenceVO
>
coOccurrence
(
String
eventId
,
String
startTime
,
String
endTime
)
{
List
<
CoOccurrenceVO
>
list
=
new
ArrayList
<>();
List
<
CoOccurrenceVO
>
list
=
new
ArrayList
<>();
InfoDataSearchCondition
searchCondition
=
new
InfoDataSearchCondition
();
InfoDataSearchCondition
searchCondition
=
new
InfoDataSearchCondition
();
searchCondition
.
setCategory
(
2
);
searchCondition
.
setCategory
(
2
);
searchCondition
.
setSubjectId
(
eventId
);
searchCondition
.
setSubjectId
(
eventId
);
searchCondition
.
setStartTime
(
startTime
);
searchCondition
.
setEndTime
(
endTime
);
String
[]
fetchFields
=
new
String
[]{
"id"
,
"keyWordsList"
};
String
[]
fetchFields
=
new
String
[]{
"id"
,
"keyWordsList"
};
searchCondition
.
setFetchFields
(
fetchFields
);
searchCondition
.
setFetchFields
(
fetchFields
);
int
pageNo
=
1
;
int
pageNo
=
1
;
...
@@ -260,6 +275,106 @@ public class AnalysisServiceImpl implements AnalysisService {
...
@@ -260,6 +275,106 @@ public class AnalysisServiceImpl implements AnalysisService {
return
top
;
return
top
;
}
}
@Override
public
Object
impactAssessment
(
String
eventId
,
String
startTime
,
String
endTime
)
{
return
null
;
}
@Override
public
Object
measureSuggest
(
String
eventId
,
String
startTime
,
String
endTime
)
{
return
null
;
}
@Override
public
Object
knowledgeEntry
(
String
eventId
,
String
startTime
,
String
endTime
)
{
return
null
;
}
@Override
public
Object
enterpriseCase
(
String
eventId
,
String
startTime
,
String
endTime
)
{
return
null
;
}
@Override
public
Object
countryPolicy
(
String
eventId
,
String
startTime
,
String
endTime
)
{
return
null
;
}
@Override
public
Object
domesticSimilarEvent
(
String
eventId
,
String
startTime
,
String
endTime
)
{
return
null
;
}
@Override
public
Object
foreignSimilarEvent
(
String
eventId
,
String
startTime
,
String
endTime
)
{
return
null
;
}
@Override
public
void
regenerate
(
String
eventId
)
{
//todo 获取模型配置信息(包含模型、提示词、角色等条件)
List
<
EventAnalysisVersionRecord
>
records
=
new
ArrayList
<>();
String
today
=
DateUtil
.
dateToString
(
new
Date
());
//保存版本信息
String
versionId
=
saveVersion
(
eventId
,
today
);
EventVO
eventVO
=
eventService
.
queryInfo
(
eventId
);
//核心摘要
Integer
ynManualEdit
=
eventVO
.
getYnManualEdit
();
if
(
ynManualEdit
==
0
)
{
String
prompt
=
"根据提供的事件名称【name】和对应的关键词【keyword】,关键词【keyword】中'|'表示或;'+'表示与;括号表示优先计算,再结合网络上的相关资讯,生成一段200字左右的核心摘要"
;
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"name"
,
eventVO
.
getEventName
());
jsonObject
.
put
(
"keyword"
,
eventVO
.
getKeywordsVO
().
getKeyword
());
String
eventDescribe
=
llmService
.
model
(
null
,
prompt
,
jsonObject
.
toJSONString
());
EventAnalysisVersionRecord
record
=
EventAnalysisVersionRecord
.
of
(
versionId
,
AnalysisColumnEnum
.
CORE_SUMMARY
,
eventDescribe
);
records
.
add
(
record
);
}
//事件脉络
List
<
Map
<
String
,
Object
>>
eventContext
=
eventContextService
.
eventContext
(
eventId
);
if
(
CollectionUtils
.
isNotEmpty
(
eventContext
))
{
EventAnalysisVersionRecord
record
=
EventAnalysisVersionRecord
.
of
(
versionId
,
AnalysisColumnEnum
.
EVENT_CONTEXT
,
JSON
.
toJSONString
(
eventContext
));
records
.
add
(
record
);
}
//关键词趋势分析
List
<
CountVO
>
wordTrend
=
this
.
wordTrend
(
eventId
,
null
,
null
);
if
(
CollectionUtils
.
isNotEmpty
(
wordTrend
))
{
EventAnalysisVersionRecord
record
=
EventAnalysisVersionRecord
.
of
(
versionId
,
AnalysisColumnEnum
.
KEYWORD_TREND
,
JSON
.
toJSONString
(
wordTrend
));
records
.
add
(
record
);
}
//关键词共现关系
List
<
CoOccurrenceVO
>
coOccurrenceVOS
=
this
.
coOccurrence
(
eventId
,
null
,
null
);
if
(
CollectionUtils
.
isNotEmpty
(
coOccurrenceVOS
))
{
EventAnalysisVersionRecord
record
=
EventAnalysisVersionRecord
.
of
(
versionId
,
AnalysisColumnEnum
.
CO_OCCURRENCE
,
JSON
.
toJSONString
(
coOccurrenceVOS
));
records
.
add
(
record
);
}
//todo 大模型相关逻辑
//影响评估
this
.
impactAssessment
(
eventId
,
null
,
null
);
//举措建议
this
.
measureSuggest
(
eventId
,
null
,
null
);
//知识词条
this
.
knowledgeEntry
(
eventId
,
null
,
null
);
//企业案例
this
.
enterpriseCase
(
eventId
,
null
,
null
);
//各国政策
this
.
countryPolicy
(
eventId
,
null
,
null
);
//本国类似事件
this
.
domesticSimilarEvent
(
eventId
,
null
,
null
);
//各国类似事件
this
.
foreignSimilarEvent
(
eventId
,
null
,
null
);
//保存版本记录信息
eventAnalysisVersionRecordService
.
saveBatch
(
records
);
}
private
String
saveVersion
(
String
eventId
,
String
time
)
{
EventAnalysisVersion
version
=
new
EventAnalysisVersion
();
version
.
setEventId
(
eventId
);
version
.
setVersionName
(
"版本"
+
time
);
eventAnalysisVersionService
.
save
(
version
);
return
version
.
getId
();
}
//获取发布时间最早的前N条资讯(来源不重复)
//获取发布时间最早的前N条资讯(来源不重复)
private
List
<
SubjectDataVo
>
topN
(
List
<
SubjectDataVo
>
list
,
Integer
num
)
{
private
List
<
SubjectDataVo
>
topN
(
List
<
SubjectDataVo
>
list
,
Integer
num
)
{
List
<
SubjectDataVo
>
collect
=
list
.
stream
().
filter
(
e
->
StringUtils
.
isNotEmpty
(
e
.
getOrigin
())).
List
<
SubjectDataVo
>
collect
=
list
.
stream
().
filter
(
e
->
StringUtils
.
isNotEmpty
(
e
.
getOrigin
())).
...
...
src/main/java/com/zzsn/event/service/impl/EventAnalysisVersionRecordServiceImpl.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.zzsn.event.entity.EventAnalysisVersionRecord
;
import
com.zzsn.event.service.EventAnalysisVersionRecordService
;
import
com.zzsn.event.mapper.EventAnalysisVersionRecordMapper
;
import
org.springframework.stereotype.Service
;
/**
* @author lenovo
* @description 针对表【event_analysis_version_record(事件分析版本记录表)】的数据库操作Service实现
* @createDate 2025-07-16 16:34:46
*/
@Service
public
class
EventAnalysisVersionRecordServiceImpl
extends
ServiceImpl
<
EventAnalysisVersionRecordMapper
,
EventAnalysisVersionRecord
>
implements
EventAnalysisVersionRecordService
{
}
src/main/java/com/zzsn/event/service/impl/EventAnalysisVersionServiceImpl.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.zzsn.event.entity.EventAnalysisVersion
;
import
com.zzsn.event.service.EventAnalysisVersionService
;
import
com.zzsn.event.mapper.EventAnalysisVersionMapper
;
import
org.springframework.stereotype.Service
;
/**
* @author lenovo
* @description 针对表【event_analysis_version(事件分析版本表)】的数据库操作Service实现
* @createDate 2025-07-16 16:34:46
*/
@Service
public
class
EventAnalysisVersionServiceImpl
extends
ServiceImpl
<
EventAnalysisVersionMapper
,
EventAnalysisVersion
>
implements
EventAnalysisVersionService
{
}
src/main/java/com/zzsn/event/service/impl/EventCollectMapServiceImpl.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.zzsn.event.entity.EventCollectMap
;
import
com.zzsn.event.service.EventCollectMapService
;
import
com.zzsn.event.mapper.EventCollectMapMapper
;
import
org.springframework.stereotype.Service
;
/**
* @author lenovo
* @description 针对表【event_collect_map(用户关注事件关系表)】的数据库操作Service实现
* @createDate 2025-07-15 10:07:01
*/
@Service
public
class
EventCollectMapServiceImpl
extends
ServiceImpl
<
EventCollectMapMapper
,
EventCollectMap
>
implements
EventCollectMapService
{
}
src/main/java/com/zzsn/event/service/impl/EventContextServiceImpl.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.zzsn.event.entity.EventContext
;
import
com.zzsn.event.mapper.EventContextMapper
;
import
com.zzsn.event.service.EventContextService
;
import
com.zzsn.event.vo.EventContextModifyVO
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @author lenovo
* @description 针对表【event_context(事件脉络表)】的数据库操作Service实现
* @createDate 2025-07-14 18:05:06
*/
@Service
public
class
EventContextServiceImpl
extends
ServiceImpl
<
EventContextMapper
,
EventContext
>
implements
EventContextService
{
@Override
public
List
<
Map
<
String
,
Object
>>
eventContext
(
String
eventId
)
{
List
<
Map
<
String
,
Object
>>
dataList
=
new
ArrayList
<>();
LambdaQueryWrapper
<
EventContext
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
orderByDesc
(
EventContext:
:
getSortNumber
);
List
<
EventContext
>
eventContexts
=
baseMapper
.
selectList
(
queryWrapper
);
if
(
CollectionUtils
.
isNotEmpty
(
eventContexts
))
{
List
<
EventContext
>
keyNodeList
=
eventContexts
.
stream
().
filter
(
eventContext
->
eventContext
.
getYnKeyNode
()
==
1
).
collect
(
Collectors
.
toList
());
for
(
EventContext
eventContext
:
keyNodeList
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
List
<
EventContext
>
childList
=
eventContexts
.
stream
().
filter
(
e
->
e
.
getParentId
().
equals
(
eventContext
.
getId
())).
collect
(
Collectors
.
toList
());
map
.
put
(
"keyNode"
,
eventContext
);
map
.
put
(
"dataList"
,
childList
);
map
.
put
(
"count"
,
childList
.
size
());
dataList
.
add
(
map
);
}
}
return
dataList
;
}
@Override
@Transactional
public
void
eventContextModify
(
EventContextModifyVO
eventContextModifyVO
)
{
EventContext
keyNode
=
eventContextModifyVO
.
getKeyNode
();
String
parentId
=
null
;
String
eventId
=
eventContextModifyVO
.
getEventId
();
Integer
maxSortNumber
=
this
.
getMaxSortNumber
(
eventId
);
if
(
keyNode
!=
null
)
{
String
id
=
keyNode
.
getId
();
if
(
StringUtils
.
isEmpty
(
id
))
{
maxSortNumber
=
maxSortNumber
+
1
;
keyNode
.
setSortNumber
(
maxSortNumber
);
keyNode
.
setParentId
(
"0"
);
keyNode
.
setEventId
(
eventId
);
baseMapper
.
insert
(
keyNode
);
parentId
=
keyNode
.
getId
();
}
else
{
baseMapper
.
updateById
(
keyNode
);
}
}
List
<
EventContext
>
saveList
=
eventContextModifyVO
.
getSaveList
();
if
(
CollectionUtils
.
isNotEmpty
(
saveList
))
{
for
(
int
i
=
1
;
i
<=
saveList
.
size
();
i
++)
{
EventContext
eventContext
=
saveList
.
get
(
i
);
if
(
parentId
!=
null
)
{
eventContext
.
setParentId
(
parentId
);
}
eventContext
.
setEventId
(
eventId
);
eventContext
.
setSortNumber
(
maxSortNumber
+
i
);
}
this
.
saveBatch
(
saveList
);
}
List
<
EventContext
>
updateList
=
eventContextModifyVO
.
getUpdateList
();
if
(
CollectionUtils
.
isNotEmpty
(
updateList
))
{
this
.
updateBatchById
(
updateList
);
}
}
@Override
public
List
<
EventContext
>
keNodeList
(
String
eventId
)
{
LambdaQueryWrapper
<
EventContext
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
eq
(
EventContext:
:
getEventId
,
eventId
)
.
eq
(
EventContext:
:
getYnKeyNode
,
1
)
.
orderByDesc
(
EventContext:
:
getSortNumber
);
return
baseMapper
.
selectList
(
queryWrapper
);
}
@Override
public
Page
<
EventContext
>
contextArticleList
(
String
eventId
,
String
keyNodeId
,
Integer
pageNo
,
Integer
pageSize
)
{
Page
<
EventContext
>
page
=
new
Page
<>(
pageNo
,
pageSize
);
LambdaQueryWrapper
<
EventContext
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
eq
(
EventContext:
:
getEventId
,
eventId
)
.
eq
(
EventContext:
:
getParentId
,
keyNodeId
)
.
orderByDesc
(
EventContext:
:
getSortNumber
);
return
baseMapper
.
selectPage
(
page
,
queryWrapper
);
}
@Override
public
Integer
getMaxSortNumber
(
String
eventId
)
{
return
baseMapper
.
getMaxSortNumber
(
eventId
);
}
}
src/main/java/com/zzsn/event/util/ExcelExportUtil.java
浏览文件 @
2b32b387
...
@@ -294,7 +294,7 @@ public class ExcelExportUtil {
...
@@ -294,7 +294,7 @@ public class ExcelExportUtil {
for
(
int
i
=
0
;
i
<
colData
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
colData
.
size
();
i
++)
{
cell
=
row
.
createCell
(
i
,
CellType
.
STRING
);
cell
=
row
.
createCell
(
i
,
CellType
.
STRING
);
cell
.
setCellStyle
(
titleStyle
);
cell
.
setCellStyle
(
titleStyle
);
cell
.
setCellValue
(
new
X
SSFRichTextString
(
colData
.
get
(
i
)));
cell
.
setCellValue
(
new
H
SSFRichTextString
(
colData
.
get
(
i
)));
}
}
// 数据行
// 数据行
for
(
int
m
=
0
;
m
<
rows
.
size
();
m
++)
{
for
(
int
m
=
0
;
m
<
rows
.
size
();
m
++)
{
...
...
src/main/java/com/zzsn/event/vo/EventContextModifyVO.java
0 → 100644
浏览文件 @
2b32b387
package
com
.
zzsn
.
event
.
vo
;
import
com.zzsn.event.entity.EventContext
;
import
lombok.Data
;
import
java.util.List
;
/**
* 事件脉络编辑对象
*
* @author lkg
* @date 2025/7/15
*/
@Data
public
class
EventContextModifyVO
{
//事件id
private
String
eventId
;
//关键节点
private
EventContext
keyNode
;
//新增集合
private
List
<
EventContext
>
saveList
;
//更换集合
private
List
<
EventContext
>
updateList
;
}
src/main/java/com/zzsn/event/vo/EventVO.java
浏览文件 @
2b32b387
...
@@ -33,6 +33,8 @@ public class EventVO {
...
@@ -33,6 +33,8 @@ public class EventVO {
private
String
publishDate
;
private
String
publishDate
;
/**事件描述*/
/**事件描述*/
private
String
eventDescribe
;
private
String
eventDescribe
;
/**事件描述是否人工编辑(1-是;0-否)*/
private
Integer
ynManualEdit
;
/**事件标签*/
/**事件标签*/
private
String
eventLabel
;
private
String
eventLabel
;
/**关联事件*/
/**关联事件*/
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论