Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
a540eacb
提交
a540eacb
authored
7月 30, 2025
作者:
925993793@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
调试问题修改
上级
9139cbde
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
153 行增加
和
26 行删除
+153
-26
EventAnalysisController.java
...va/com/zzsn/event/controller/EventAnalysisController.java
+12
-2
LLmConfigController.java
...com/zzsn/event/controller/common/LLmConfigController.java
+49
-4
EventLlmConfigService.java
...in/java/com/zzsn/event/service/EventLlmConfigService.java
+32
-1
AnalysisServiceImpl.java
...java/com/zzsn/event/service/impl/AnalysisServiceImpl.java
+18
-0
EventLlmConfigServiceImpl.java
...om/zzsn/event/service/impl/EventLlmConfigServiceImpl.java
+26
-1
KeyWordsServiceImpl.java
...java/com/zzsn/event/service/impl/KeyWordsServiceImpl.java
+2
-1
AnalysisTask.java
src/main/java/com/zzsn/event/task/AnalysisTask.java
+7
-5
CoOccurrenceTask.java
src/main/java/com/zzsn/event/task/CoOccurrenceTask.java
+7
-1
EventHotTask.java
src/main/java/com/zzsn/event/task/EventHotTask.java
+0
-4
NetWorkEventTask.java
src/main/java/com/zzsn/event/task/NetWorkEventTask.java
+0
-4
SynClbEventDataTask.java
src/main/java/com/zzsn/event/task/SynClbEventDataTask.java
+0
-3
没有找到文件。
src/main/java/com/zzsn/event/controller/EventAnalysisController.java
浏览文件 @
a540eacb
...
@@ -272,8 +272,18 @@ public class EventAnalysisController {
...
@@ -272,8 +272,18 @@ public class EventAnalysisController {
String
versionData
=
eventAnalysisVersionRecordService
.
getVersionData
(
versionId
,
AnalysisColumnEnum
.
CO_OCCURRENCE
.
getCode
());
String
versionData
=
eventAnalysisVersionRecordService
.
getVersionData
(
versionId
,
AnalysisColumnEnum
.
CO_OCCURRENCE
.
getCode
());
return
Result
.
OK
(
JSON
.
parseArray
(
versionData
,
JSONObject
.
class
));
return
Result
.
OK
(
JSON
.
parseArray
(
versionData
,
JSONObject
.
class
));
}
}
List
<
CoOccurrenceVO
>
versionData
=
analysisService
.
coOccurrence
(
eventId
,
startTime
,
endTime
);
//增加缓存逻辑,提升查询效率
return
Result
.
OK
(
versionData
);
String
key
=
Constants
.
SUBJECT_ANALYSIS_PRE
+
Constants
.
CO_OCCURRENCE
+
eventId
;
Object
cacheObject
=
redisUtil
.
get
(
key
);
if
(
cacheObject
!=
null
)
{
return
Result
.
OK
(
cacheObject
);
}
else
{
List
<
CoOccurrenceVO
>
coOccurrenceVOS
=
analysisService
.
coOccurrence
(
eventId
,
startTime
,
endTime
);
if
(
CollectionUtils
.
isNotEmpty
(
coOccurrenceVOS
))
{
redisUtil
.
set
(
key
,
coOccurrenceVOS
,
3600
*
24
);
}
return
Result
.
OK
(
coOccurrenceVOS
);
}
}
}
/**
/**
...
...
src/main/java/com/zzsn/event/controller/common/LLmConfigController.java
浏览文件 @
a540eacb
package
com
.
zzsn
.
event
.
controller
.
common
;
package
com
.
zzsn
.
event
.
controller
.
common
;
import
com.zzsn.event.constant.Result
;
import
com.zzsn.event.constant.Result
;
import
com.zzsn.event.entity.EventAnalysisVersion
;
import
com.zzsn.event.entity.EventAnalysisVersionRecord
;
import
com.zzsn.event.entity.EventLlmConfig
;
import
com.zzsn.event.entity.EventLlmConfig
;
import
com.zzsn.event.enums.AnalysisColumnEnum
;
import
com.zzsn.event.service.AnalysisService
;
import
com.zzsn.event.service.EventAnalysisVersionRecordService
;
import
com.zzsn.event.service.EventAnalysisVersionService
;
import
com.zzsn.event.service.EventLlmConfigService
;
import
com.zzsn.event.service.EventLlmConfigService
;
import
com.zzsn.event.util.DateUtil
;
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.*
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.concurrent.CompletableFuture
;
/**
/**
* 大模型配置
* 大模型配置
...
@@ -20,6 +29,12 @@ public class LLmConfigController {
...
@@ -20,6 +29,12 @@ public class LLmConfigController {
@Autowired
@Autowired
private
EventLlmConfigService
llmConfigService
;
private
EventLlmConfigService
llmConfigService
;
@Autowired
private
AnalysisService
analysisService
;
@Autowired
private
EventAnalysisVersionService
eventAnalysisVersionService
;
@Autowired
private
EventAnalysisVersionRecordService
eventAnalysisVersionRecordService
;
/**
/**
* 事件下大模型配置信息
* 事件下大模型配置信息
...
@@ -35,15 +50,45 @@ public class LLmConfigController {
...
@@ -35,15 +50,45 @@ public class LLmConfigController {
}
}
/**
/**
* 编辑事件的大模型配置信息
*
批量
编辑事件的大模型配置信息
*
*
* @param eventLlmConfigList 大模型配置信息
* @param eventLlmConfigList 大模型配置信息
* @author lkg
* @author lkg
* @date 2025/7/28
* @date 2025/7/28
*/
*/
@PostMapping
(
"/modify"
)
@PostMapping
(
"/modifyBatch"
)
public
Result
<?>
modify
(
@RequestBody
List
<
EventLlmConfig
>
eventLlmConfigList
)
{
public
Result
<?>
modifyBatch
(
@RequestBody
List
<
EventLlmConfig
>
eventLlmConfigList
)
{
llmConfigService
.
modify
(
eventLlmConfigList
);
llmConfigService
.
modifyBatch
(
eventLlmConfigList
);
return
Result
.
OK
();
}
/**
* 编辑事件栏目的大模型配置信息,同时触发大模型更新结果
*
* @param eventLlmConfig 大模型配置信息
* @author lkg
* @date 2025/7/28
*/
@PostMapping
(
"/modifySingle"
)
public
Result
<?>
modifySingle
(
@RequestBody
EventLlmConfig
eventLlmConfig
)
{
llmConfigService
.
modifySingle
(
eventLlmConfig
);
CompletableFuture
.
runAsync
(()
->{
String
eventId
=
eventLlmConfig
.
getEventId
();
//调用大模型更细结果
String
llmResult
=
analysisService
.
llmResult
(
eventId
,
null
,
null
,
eventLlmConfig
.
getColumnCode
());
EventAnalysisVersion
eventAnalysisVersion
=
eventAnalysisVersionService
.
latestVersion
(
eventId
);
String
versionId
;
if
(
eventAnalysisVersion
==
null
)
{
eventAnalysisVersion
=
new
EventAnalysisVersion
();
eventAnalysisVersion
.
setEventId
(
eventId
);
eventAnalysisVersion
.
setVersionName
(
"版本"
+
DateUtil
.
dateToString
(
new
Date
()));
eventAnalysisVersionService
.
save
(
eventAnalysisVersion
);
versionId
=
eventAnalysisVersion
.
getId
();
}
else
{
versionId
=
eventAnalysisVersion
.
getId
();
}
EventAnalysisVersionRecord
versionRecord
=
EventAnalysisVersionRecord
.
of
(
versionId
,
AnalysisColumnEnum
.
CORE_SUMMARY
,
llmResult
);
eventAnalysisVersionRecordService
.
save
(
versionRecord
);
});
return
Result
.
OK
();
return
Result
.
OK
();
}
}
}
}
src/main/java/com/zzsn/event/service/EventLlmConfigService.java
浏览文件 @
a540eacb
...
@@ -12,9 +12,40 @@ import java.util.List;
...
@@ -12,9 +12,40 @@ import java.util.List;
*/
*/
public
interface
EventLlmConfigService
extends
IService
<
EventLlmConfig
>
{
public
interface
EventLlmConfigService
extends
IService
<
EventLlmConfig
>
{
/**
* 获取事件的大模型配置信息,没有则返回默认的配置信息
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/30
*/
List
<
EventLlmConfig
>
getConfigList
(
String
eventId
);
List
<
EventLlmConfig
>
getConfigList
(
String
eventId
);
/**
* 获取事件下某个栏目的大模型配置信息
*
* @param eventId 事件id
* @param columnCode 栏目id
* @author lkg
* @date 2025/7/30
*/
EventLlmConfig
getConfig
(
String
eventId
,
Integer
columnCode
);
EventLlmConfig
getConfig
(
String
eventId
,
Integer
columnCode
);
void
modify
(
List
<
EventLlmConfig
>
eventLlmConfigList
);
/**
* 批量更新大模型配置
*
* @param eventLlmConfigList 配置信息
* @author lkg
* @date 2025/7/30
*/
void
modifyBatch
(
List
<
EventLlmConfig
>
eventLlmConfigList
);
/**
* 更新大模型配置
*
* @param eventLlmConfig 配置信息
* @author lkg
* @date 2025/7/30
*/
void
modifySingle
(
EventLlmConfig
eventLlmConfig
);
}
}
src/main/java/com/zzsn/event/service/impl/AnalysisServiceImpl.java
浏览文件 @
a540eacb
...
@@ -140,6 +140,10 @@ public class AnalysisServiceImpl implements AnalysisService {
...
@@ -140,6 +140,10 @@ public class AnalysisServiceImpl implements AnalysisService {
@Override
@Override
public
List
<
CountVO
>
wordTrend
(
String
eventId
,
String
startTime
,
String
endTime
)
{
public
List
<
CountVO
>
wordTrend
(
String
eventId
,
String
startTime
,
String
endTime
)
{
int
count
=
esService
.
count
(
eventId
,
startTime
,
endTime
);
if
(
count
==
0
)
{
return
new
ArrayList
<>();
}
Event
event
=
eventService
.
getById
(
eventId
);
Event
event
=
eventService
.
getById
(
eventId
);
Date
beginTime
=
event
.
getStartTime
();
Date
beginTime
=
event
.
getStartTime
();
if
(
StringUtils
.
isNotEmpty
(
startTime
))
{
if
(
StringUtils
.
isNotEmpty
(
startTime
))
{
...
@@ -177,6 +181,10 @@ public class AnalysisServiceImpl implements AnalysisService {
...
@@ -177,6 +181,10 @@ public class AnalysisServiceImpl implements AnalysisService {
@Override
@Override
public
List
<
CoOccurrenceVO
>
coOccurrence
(
String
eventId
,
String
startTime
,
String
endTime
)
{
public
List
<
CoOccurrenceVO
>
coOccurrence
(
String
eventId
,
String
startTime
,
String
endTime
)
{
List
<
CoOccurrenceVO
>
list
=
new
ArrayList
<>();
List
<
CoOccurrenceVO
>
list
=
new
ArrayList
<>();
int
count
=
esService
.
count
(
eventId
,
startTime
,
endTime
);
if
(
count
==
0
)
{
return
list
;
}
InfoDataSearchCondition
searchCondition
=
new
InfoDataSearchCondition
();
InfoDataSearchCondition
searchCondition
=
new
InfoDataSearchCondition
();
searchCondition
.
setCategory
(
2
);
searchCondition
.
setCategory
(
2
);
searchCondition
.
setSubjectId
(
eventId
);
searchCondition
.
setSubjectId
(
eventId
);
...
@@ -295,6 +303,11 @@ public class AnalysisServiceImpl implements AnalysisService {
...
@@ -295,6 +303,11 @@ public class AnalysisServiceImpl implements AnalysisService {
@Override
@Override
public
String
llmResult
(
String
eventName
,
String
startTime
,
String
endTime
,
EventLlmConfig
llmConfig
)
{
public
String
llmResult
(
String
eventName
,
String
startTime
,
String
endTime
,
EventLlmConfig
llmConfig
)
{
String
result
=
llmService
.
model
(
llmConfig
.
getLlmName
(),
llmConfig
.
getLlmPrompt
(),
eventName
);
String
result
=
llmService
.
model
(
llmConfig
.
getLlmName
(),
llmConfig
.
getLlmPrompt
(),
eventName
);
if
(
result
.
startsWith
(
"```json"
))
{
return
result
.
substring
(
7
,
result
.
length
()
-
3
);
}
else
if
(
result
.
startsWith
(
"```"
))
{
return
result
.
substring
(
3
,
result
.
length
()
-
3
);
}
if
(
llmConfig
.
getColumnCode
().
equals
(
AnalysisColumnEnum
.
IMPACT_ASSESSMENT
.
getCode
()))
{
if
(
llmConfig
.
getColumnCode
().
equals
(
AnalysisColumnEnum
.
IMPACT_ASSESSMENT
.
getCode
()))
{
String
prompt
=
"根据提供的事件名称,以及其%s的概述,详细的描述下该事件的%s"
;
String
prompt
=
"根据提供的事件名称,以及其%s的概述,详细的描述下该事件的%s"
;
List
<
JSONObject
>
impactList
=
JSON
.
parseArray
(
result
,
JSONObject
.
class
);
List
<
JSONObject
>
impactList
=
JSON
.
parseArray
(
result
,
JSONObject
.
class
);
...
@@ -316,6 +329,11 @@ public class AnalysisServiceImpl implements AnalysisService {
...
@@ -316,6 +329,11 @@ public class AnalysisServiceImpl implements AnalysisService {
Event
event
=
eventService
.
getById
(
eventId
);
Event
event
=
eventService
.
getById
(
eventId
);
EventLlmConfig
llmConfig
=
eventLlmConfigService
.
getConfig
(
eventId
,
columnCode
);
EventLlmConfig
llmConfig
=
eventLlmConfigService
.
getConfig
(
eventId
,
columnCode
);
String
result
=
llmService
.
model
(
llmConfig
.
getLlmName
(),
llmConfig
.
getLlmPrompt
(),
event
.
getEventName
());
String
result
=
llmService
.
model
(
llmConfig
.
getLlmName
(),
llmConfig
.
getLlmPrompt
(),
event
.
getEventName
());
if
(
result
.
startsWith
(
"```json"
))
{
return
result
.
substring
(
7
,
result
.
length
()
-
3
);
}
else
if
(
result
.
startsWith
(
"```"
))
{
return
result
.
substring
(
3
,
result
.
length
()
-
3
);
}
if
(
columnCode
.
equals
(
AnalysisColumnEnum
.
IMPACT_ASSESSMENT
.
getCode
()))
{
if
(
columnCode
.
equals
(
AnalysisColumnEnum
.
IMPACT_ASSESSMENT
.
getCode
()))
{
String
prompt
=
"根据提供的事件名称,以及其%s的概述,详细的描述下该事件的%s"
;
String
prompt
=
"根据提供的事件名称,以及其%s的概述,详细的描述下该事件的%s"
;
List
<
JSONObject
>
impactList
=
JSON
.
parseArray
(
result
,
JSONObject
.
class
);
List
<
JSONObject
>
impactList
=
JSON
.
parseArray
(
result
,
JSONObject
.
class
);
...
...
src/main/java/com/zzsn/event/service/impl/EventLlmConfigServiceImpl.java
浏览文件 @
a540eacb
...
@@ -51,7 +51,7 @@ public class EventLlmConfigServiceImpl extends ServiceImpl<EventLlmConfigMapper,
...
@@ -51,7 +51,7 @@ public class EventLlmConfigServiceImpl extends ServiceImpl<EventLlmConfigMapper,
@Override
@Override
@Transactional
@Transactional
public
void
modify
(
List
<
EventLlmConfig
>
eventLlmConfigList
)
{
public
void
modify
Batch
(
List
<
EventLlmConfig
>
eventLlmConfigList
)
{
if
(
CollectionUtils
.
isEmpty
(
eventLlmConfigList
))
{
if
(
CollectionUtils
.
isEmpty
(
eventLlmConfigList
))
{
return
;
return
;
}
}
...
@@ -82,6 +82,31 @@ public class EventLlmConfigServiceImpl extends ServiceImpl<EventLlmConfigMapper,
...
@@ -82,6 +82,31 @@ public class EventLlmConfigServiceImpl extends ServiceImpl<EventLlmConfigMapper,
}
}
}
}
}
}
@Override
public
void
modifySingle
(
EventLlmConfig
eventLlmConfig
)
{
String
eventId
=
eventLlmConfig
.
getEventId
();
LambdaQueryWrapper
<
EventLlmConfig
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
eq
(
EventLlmConfig:
:
getEventId
,
eventId
);
List
<
EventLlmConfig
>
configList
=
this
.
list
(
queryWrapper
);
if
(
CollectionUtils
.
isEmpty
(
configList
))
{
LambdaQueryWrapper
<
EventLlmConfig
>
query
=
Wrappers
.
lambdaQuery
();
query
.
eq
(
EventLlmConfig:
:
getYnDefault
,
1
).
orderByAsc
(
EventLlmConfig:
:
getColumnCode
);
List
<
EventLlmConfig
>
defaultConfigList
=
this
.
list
(
query
);
List
<
EventLlmConfig
>
collect
=
defaultConfigList
.
stream
().
filter
(
config
->
!
eventLlmConfig
.
getColumnCode
().
equals
(
config
.
getColumnCode
())).
collect
(
Collectors
.
toList
());
for
(
EventLlmConfig
config
:
collect
)
{
config
.
setId
(
null
);
config
.
setEventId
(
eventId
);
config
.
setYnDefault
(
0
);
}
collect
.
add
(
eventLlmConfig
);
this
.
saveBatch
(
collect
);
}
else
{
LambdaUpdateWrapper
<
EventLlmConfig
>
update
=
Wrappers
.
lambdaUpdate
();
update
.
eq
(
EventLlmConfig:
:
getEventId
,
eventId
).
eq
(
EventLlmConfig:
:
getColumnCode
,
eventLlmConfig
.
getColumnCode
());
this
.
update
(
eventLlmConfig
,
update
);
}
}
}
}
...
...
src/main/java/com/zzsn/event/service/impl/KeyWordsServiceImpl.java
浏览文件 @
a540eacb
...
@@ -409,6 +409,7 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i
...
@@ -409,6 +409,7 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i
//专题和关键词关系
//专题和关键词关系
List
<
SubjectKeywordsMap
>
dataList
=
new
ArrayList
<>();
List
<
SubjectKeywordsMap
>
dataList
=
new
ArrayList
<>();
if
(
type
==
1
)
{
if
(
type
==
1
)
{
//统计绑定采集词和过滤词
for
(
int
i
=
1
;
i
<
3
;
i
++)
{
for
(
int
i
=
1
;
i
<
3
;
i
++)
{
//专题和词组关系
//专题和词组关系
SubjectKeywordsMap
subjectKeywordsMap
=
new
SubjectKeywordsMap
();
SubjectKeywordsMap
subjectKeywordsMap
=
new
SubjectKeywordsMap
();
...
@@ -432,7 +433,7 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i
...
@@ -432,7 +433,7 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i
relation
.
setParamsStr
(
JSON
.
toJSONString
(
jsonArray
));
relation
.
setParamsStr
(
JSON
.
toJSONString
(
jsonArray
));
relationList
.
add
(
relation
);
relationList
.
add
(
relation
);
}
}
}
else
if
(
type
==
2
)
{
}
else
if
(
type
==
2
)
{
//排除词
//专题和词组关系
//专题和词组关系
SubjectKeywordsMap
subjectKeywordsMap
=
new
SubjectKeywordsMap
();
SubjectKeywordsMap
subjectKeywordsMap
=
new
SubjectKeywordsMap
();
subjectKeywordsMap
.
setKeywordsId
(
keyWordsId
);
subjectKeywordsMap
.
setKeywordsId
(
keyWordsId
);
...
...
src/main/java/com/zzsn/event/task/AnalysisTask.java
浏览文件 @
a540eacb
...
@@ -45,8 +45,8 @@ public class AnalysisTask {
...
@@ -45,8 +45,8 @@ public class AnalysisTask {
/**
/**
*
补充事件当天的脉络
*
重新生成事件分析(版本)
* 每
3小时
执行一次
* 每
天凌晨00:30
执行一次
*
*
* @author lkg
* @author lkg
* @date 2025/7/9
* @date 2025/7/9
...
@@ -54,6 +54,7 @@ public class AnalysisTask {
...
@@ -54,6 +54,7 @@ public class AnalysisTask {
//@Scheduled(cron = "0 30 0 * * ?")
//@Scheduled(cron = "0 30 0 * * ?")
public
void
analysis
()
{
public
void
analysis
()
{
Date
now
=
new
Date
();
Date
now
=
new
Date
();
Date
deadlineDate
=
DateUtil
.
addDate
(
now
,
-
1
);
LambdaQueryWrapper
<
Event
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
LambdaQueryWrapper
<
Event
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
eq
(
Event:
:
getStatus
,
1
).
gt
(
Event:
:
getCreateTime
,
"2025-07-27"
);
queryWrapper
.
eq
(
Event:
:
getStatus
,
1
).
gt
(
Event:
:
getCreateTime
,
"2025-07-27"
);
List
<
Event
>
eventList
=
eventService
.
list
(
queryWrapper
);
List
<
Event
>
eventList
=
eventService
.
list
(
queryWrapper
);
...
@@ -61,8 +62,9 @@ public class AnalysisTask {
...
@@ -61,8 +62,9 @@ public class AnalysisTask {
CompletableFuture
.
runAsync
(()
->
{
CompletableFuture
.
runAsync
(()
->
{
String
eventId
=
event
.
getId
();
String
eventId
=
event
.
getId
();
String
estimateStatus
=
event
.
getEstimateStatus
();
String
estimateStatus
=
event
.
getEstimateStatus
();
if
(
StringUtils
.
isNotBlank
(
estimateStatus
)
&&
!
estimateStatus
.
equals
(
"已完成"
))
{
if
(
StringUtils
.
isNotBlank
(
estimateStatus
)
if
(
DateUtil
.
stringToDate
(
estimateStatus
,
"yyyy-MM-dd HH:mm:ss"
).
compareTo
(
now
)
>
0
)
{
&&
!
estimateStatus
.
equals
(
"已完成"
)
&&
!
estimateStatus
.
equals
(
"未启用"
))
{
if
(
DateUtil
.
stringToDate
(
estimateStatus
,
"yyyy-MM-dd HH:mm:ss"
).
compareTo
(
deadlineDate
)
>
0
)
{
analysisService
.
regenerate
(
eventId
);
analysisService
.
regenerate
(
eventId
);
}
}
}
}
...
@@ -72,7 +74,7 @@ public class AnalysisTask {
...
@@ -72,7 +74,7 @@ public class AnalysisTask {
/**
/**
* 定时生成传播路径
* 定时生成传播路径
* 每天凌晨0点
10分
执行一次
* 每天凌晨0点执行一次
*/
*/
@Scheduled
(
cron
=
"0 0 0 * * ?"
)
@Scheduled
(
cron
=
"0 0 0 * * ?"
)
public
void
propagationPath
()
{
public
void
propagationPath
()
{
...
...
src/main/java/com/zzsn/event/task/CoOccurrenceTask.java
浏览文件 @
a540eacb
package
com
.
zzsn
.
event
.
task
;
package
com
.
zzsn
.
event
.
task
;
import
com.zzsn.event.constant.Constants
;
import
com.zzsn.event.constant.Constants
;
import
com.zzsn.event.es.EsService
;
import
com.zzsn.event.service.AnalysisService
;
import
com.zzsn.event.service.AnalysisService
;
import
com.zzsn.event.service.IEventService
;
import
com.zzsn.event.service.IEventService
;
import
com.zzsn.event.util.DateUtil
;
import
com.zzsn.event.util.DateUtil
;
...
@@ -33,13 +34,15 @@ public class CoOccurrenceTask {
...
@@ -33,13 +34,15 @@ public class CoOccurrenceTask {
private
RedisUtil
redisUtil
;
private
RedisUtil
redisUtil
;
@Autowired
@Autowired
private
AnalysisService
analysisService
;
private
AnalysisService
analysisService
;
@Autowired
private
EsService
esService
;
/**
/**
* 定时缓存热词共现关系数据
* 定时缓存热词共现关系数据
* 每天凌晨1点执行一次
* 每天凌晨1点执行一次
*/
*/
@Scheduled
(
cron
=
"0 0 1 * * ?"
)
@Scheduled
(
cron
=
"0 0 1 * * ?"
)
public
void
propagationPath
()
{
public
void
co_occurrence
()
{
Date
today
=
new
Date
();
Date
today
=
new
Date
();
Date
deadlineDate
=
DateUtil
.
addDate
(
today
,
-
1
);
Date
deadlineDate
=
DateUtil
.
addDate
(
today
,
-
1
);
List
<
SubjectKafkaVo
>
events
=
eventService
.
eventSubjectList
();
List
<
SubjectKafkaVo
>
events
=
eventService
.
eventSubjectList
();
...
@@ -48,6 +51,8 @@ public class CoOccurrenceTask {
...
@@ -48,6 +51,8 @@ public class CoOccurrenceTask {
String
eventId
=
event
.
getId
();
String
eventId
=
event
.
getId
();
String
key
=
Constants
.
SUBJECT_ANALYSIS_PRE
+
Constants
.
CO_OCCURRENCE
+
eventId
;
String
key
=
Constants
.
SUBJECT_ANALYSIS_PRE
+
Constants
.
CO_OCCURRENCE
+
eventId
;
Date
timeDisable
=
event
.
getTimeDisable
();
Date
timeDisable
=
event
.
getTimeDisable
();
int
count
=
esService
.
count
(
eventId
,
null
,
null
);
if
(
count
>
0
)
{
if
(
timeDisable
!=
null
&&
deadlineDate
.
compareTo
(
timeDisable
)
>
0
)
{
if
(
timeDisable
!=
null
&&
deadlineDate
.
compareTo
(
timeDisable
)
>
0
)
{
Object
cacheObject
=
redisUtil
.
get
(
key
);
Object
cacheObject
=
redisUtil
.
get
(
key
);
if
(
cacheObject
==
null
)
{
if
(
cacheObject
==
null
)
{
...
@@ -64,6 +69,7 @@ public class CoOccurrenceTask {
...
@@ -64,6 +69,7 @@ public class CoOccurrenceTask {
log
.
info
(
"专题-{},热词共现关系数据缓存成功!"
,
event
.
getSubjectName
());
log
.
info
(
"专题-{},热词共现关系数据缓存成功!"
,
event
.
getSubjectName
());
}
}
}
}
}
});
});
}
}
}
}
...
...
src/main/java/com/zzsn/event/task/EventHotTask.java
浏览文件 @
a540eacb
...
@@ -3,9 +3,7 @@ package com.zzsn.event.task;
...
@@ -3,9 +3,7 @@ package com.zzsn.event.task;
import
cn.hutool.core.date.DateField
;
import
cn.hutool.core.date.DateField
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
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.zzsn.event.entity.Event
;
import
com.zzsn.event.entity.Event
;
import
com.zzsn.event.service.EsStatisticsService
;
import
com.zzsn.event.service.EsStatisticsService
;
import
com.zzsn.event.service.IEventService
;
import
com.zzsn.event.service.IEventService
;
...
@@ -55,8 +53,6 @@ public class EventHotTask {
...
@@ -55,8 +53,6 @@ public class EventHotTask {
*/
*/
@Scheduled
(
cron
=
"0 0 0/3 * * ?"
)
@Scheduled
(
cron
=
"0 0 0/3 * * ?"
)
public
void
hot
()
{
public
void
hot
()
{
//LambdaQueryWrapper<Event> queryWrapper = Wrappers.lambdaQuery();
//queryWrapper.eq(Event::getFacePublic,1).eq(Event::getPublishStatus,1);
List
<
Event
>
list
=
eventService
.
list
();
List
<
Event
>
list
=
eventService
.
list
();
List
<
HotVO
>
countList
=
new
ArrayList
<>();
List
<
HotVO
>
countList
=
new
ArrayList
<>();
for
(
Event
event
:
list
)
{
for
(
Event
event
:
list
)
{
...
...
src/main/java/com/zzsn/event/task/NetWorkEventTask.java
浏览文件 @
a540eacb
...
@@ -52,10 +52,6 @@ public class NetWorkEventTask {
...
@@ -52,10 +52,6 @@ public class NetWorkEventTask {
*/
*/
@Scheduled
(
cron
=
"0 0 0/1 * * ?"
)
@Scheduled
(
cron
=
"0 0 0/1 * * ?"
)
public
void
execute
()
{
public
void
execute
()
{
if
(!
yjzxEnable
){
//研究中心需要此任务
return
;
}
for
(
int
i
=
1
;
i
<
3
;
i
++)
{
for
(
int
i
=
1
;
i
<
3
;
i
++)
{
int
finalI
=
i
;
int
finalI
=
i
;
CompletableFuture
.
runAsync
(()
->
handler
(
finalI
));
CompletableFuture
.
runAsync
(()
->
handler
(
finalI
));
...
...
src/main/java/com/zzsn/event/task/SynClbEventDataTask.java
浏览文件 @
a540eacb
...
@@ -11,7 +11,6 @@ import com.zzsn.event.mapper.EventClbMapper;
...
@@ -11,7 +11,6 @@ import com.zzsn.event.mapper.EventClbMapper;
import
com.zzsn.event.service.IEventService
;
import
com.zzsn.event.service.IEventService
;
import
com.zzsn.event.service.IEventTagClbService
;
import
com.zzsn.event.service.IEventTagClbService
;
import
com.zzsn.event.service.IEventTagService
;
import
com.zzsn.event.service.IEventTagService
;
import
com.zzsn.event.vo.EventVO
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.annotation.Scheduled
;
...
@@ -50,8 +49,6 @@ public class SynClbEventDataTask {
...
@@ -50,8 +49,6 @@ public class SynClbEventDataTask {
return
;
return
;
}
}
log
.
info
(
"同步克虏宝中事件信息到研究中心数据库开始"
);
log
.
info
(
"同步克虏宝中事件信息到研究中心数据库开始"
);
//LambdaQueryWrapper<Event> queryWrapper = Wrappers.lambdaQuery();
//queryWrapper.eq(Event::getFacePublic,1).eq(Event::getPublishStatus,1);
List
<
Event
>
list
=
eventService
.
list
();
List
<
Event
>
list
=
eventService
.
list
();
for
(
Event
event
:
list
)
{
for
(
Event
event
:
list
)
{
try
{
try
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论