Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
c5ed869c
提交
c5ed869c
authored
5月 09, 2024
作者:
925993793@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加专题正面资讯数量统计接口
上级
d9a23857
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
61 行增加
和
0 行删除
+61
-0
EventAnalysisController.java
...va/com/zzsn/event/controller/EventAnalysisController.java
+13
-0
EsStatisticsService.java
...main/java/com/zzsn/event/service/EsStatisticsService.java
+11
-0
EsStatisticsServiceImpl.java
.../com/zzsn/event/service/impl/EsStatisticsServiceImpl.java
+37
-0
没有找到文件。
src/main/java/com/zzsn/event/controller/EventAnalysisController.java
浏览文件 @
c5ed869c
...
@@ -199,6 +199,19 @@ public class EventAnalysisController {
...
@@ -199,6 +199,19 @@ public class EventAnalysisController {
}
}
}
}
/**
* 专题下情感类标签下资讯数量统计
*
* @param subjectId 专题id
* @author lkg
* @date 2024/5/9
*/
@GetMapping
(
"/orientationCount"
)
public
Result
<?>
orientationCount
(
@RequestParam
String
subjectId
){
List
<
CountVO
>
countVOS
=
esStatisticsService
.
orientationCount
(
subjectId
,
null
,
null
);
return
Result
.
OK
(
countVOS
);
}
/**
/**
* 3.5 情感判断分析
* 3.5 情感判断分析
...
...
src/main/java/com/zzsn/event/service/EsStatisticsService.java
浏览文件 @
c5ed869c
...
@@ -26,6 +26,17 @@ public interface EsStatisticsService {
...
@@ -26,6 +26,17 @@ public interface EsStatisticsService {
*/
*/
Map
<
String
,
String
>
totalAndMax
(
String
subjectId
,
String
startTime
,
String
endTime
,
Integer
type
);
Map
<
String
,
String
>
totalAndMax
(
String
subjectId
,
String
startTime
,
String
endTime
,
Integer
type
);
/**
* 情感判断数量统计
*
* @param subjectId 专题id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2024/1/25
*/
List
<
CountVO
>
orientationCount
(
String
subjectId
,
String
startTime
,
String
endTime
);
/**
/**
* 情感判断分析
* 情感判断分析
...
...
src/main/java/com/zzsn/event/service/impl/EsStatisticsServiceImpl.java
浏览文件 @
c5ed869c
...
@@ -32,6 +32,7 @@ import org.springframework.stereotype.Service;
...
@@ -32,6 +32,7 @@ import org.springframework.stereotype.Service;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
/**
/**
* 舆情信息统计 es查询工具类
* 舆情信息统计 es查询工具类
...
@@ -89,6 +90,41 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
...
@@ -89,6 +90,41 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
return
map
;
return
map
;
}
}
@Override
public
List
<
CountVO
>
orientationCount
(
String
subjectId
,
String
startTime
,
String
endTime
)
{
List
<
CountVO
>
list
=
new
ArrayList
<>();
String
labelTypeId
=
"1631119596744265729"
;
List
<
LabelEntity
>
labelEntities
=
labelEntityService
.
listByType
(
labelTypeId
);
for
(
LabelEntity
labelEntity
:
labelEntities
)
{
CompletableFuture
<
CountVO
>
async
=
CompletableFuture
.
supplyAsync
(()
->
{
String
labelId
=
labelEntity
.
getId
();
String
name
=
labelEntity
.
getName
();
CountVO
countVO
=
new
CountVO
();
countVO
.
setName
(
name
);
long
count
=
0L
;
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchSourceBuilder
searchSourceBuilder
=
formatSourceBuilder
(
subjectId
,
labelId
,
startTime
,
endTime
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
trackTotalHits
(
true
);
searchRequest
.
source
(
searchSourceBuilder
);
try
{
SearchResponse
response
=
client
.
search
(
searchRequest
,
RequestOptions
.
DEFAULT
);
count
=
response
.
getHits
().
getTotalHits
().
value
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
countVO
.
setValue
(
count
);
return
countVO
;
});
try
{
CountVO
countVO
=
async
.
get
();
list
.
add
(
countVO
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
return
list
;
}
@Override
@Override
public
CountVO
orientation
(
String
subjectId
,
String
labelId
,
String
startTime
,
String
endTime
,
Integer
type
)
{
public
CountVO
orientation
(
String
subjectId
,
String
labelId
,
String
startTime
,
String
endTime
,
Integer
type
)
{
...
@@ -217,6 +253,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
...
@@ -217,6 +253,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
.
field
(
"repeatMark"
)
.
field
(
"repeatMark"
)
.
order
(
BucketOrder
.
count
(
false
))
.
order
(
BucketOrder
.
count
(
false
))
.
size
(
1
);
.
size
(
1
);
searchSourceBuilder
.
query
(
boolQuery
);
searchSourceBuilder
.
aggregation
(
aggregationBuilder
);
searchSourceBuilder
.
aggregation
(
aggregationBuilder
);
searchRequest
.
source
(
searchSourceBuilder
);
searchRequest
.
source
(
searchSourceBuilder
);
try
{
try
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论