Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
d7cc7ba7
提交
d7cc7ba7
authored
1月 13, 2025
作者:
925993793@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
专题创建逻辑完善以及bug修改
上级
5ad50710
显示空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
277 行增加
和
90 行删除
+277
-90
StatisticalAnalysisController.java
...vent/controller/common/StatisticalAnalysisController.java
+25
-41
ClbModelArrangeSubjectMap.java
...java/com/zzsn/event/entity/ClbModelArrangeSubjectMap.java
+76
-0
EsService.java
src/main/java/com/zzsn/event/es/EsService.java
+44
-19
ClbModelArrangeSubjectMapMapper.java
...om/zzsn/event/mapper/ClbModelArrangeSubjectMapMapper.java
+15
-0
SubjectMapper.xml
src/main/java/com/zzsn/event/mapper/xml/SubjectMapper.xml
+3
-0
ClbModelArrangeSubjectMapService.java
.../zzsn/event/service/ClbModelArrangeSubjectMapService.java
+13
-0
SysDictItemService.java
src/main/java/com/zzsn/event/service/SysDictItemService.java
+11
-0
ClbModelArrangeSubjectMapServiceImpl.java
...nt/service/impl/ClbModelArrangeSubjectMapServiceImpl.java
+17
-0
EsStatisticsServiceImpl.java
.../com/zzsn/event/service/impl/EsStatisticsServiceImpl.java
+7
-6
EventServiceImpl.java
...in/java/com/zzsn/event/service/impl/EventServiceImpl.java
+3
-6
SubjectServiceImpl.java
.../java/com/zzsn/event/service/impl/SubjectServiceImpl.java
+4
-0
SubjectSimpleServiceImpl.java
...com/zzsn/event/service/impl/SubjectSimpleServiceImpl.java
+17
-12
SysDictItemServiceImpl.java
...a/com/zzsn/event/service/impl/SysDictItemServiceImpl.java
+36
-0
SubjectPage.java
src/main/java/com/zzsn/event/vo/SubjectPage.java
+6
-6
没有找到文件。
src/main/java/com/zzsn/event/controller/common/StatisticalAnalysisController.java
浏览文件 @
d7cc7ba7
...
@@ -103,10 +103,13 @@ public class StatisticalAnalysisController {
...
@@ -103,10 +103,13 @@ public class StatisticalAnalysisController {
@PostMapping
(
"/dataTrend"
)
@PostMapping
(
"/dataTrend"
)
public
Result
<
List
<
CountVO
>>
dataTrend
(
@RequestBody
InfoDataSearchCondition
searchCondition
)
{
public
Result
<
List
<
CountVO
>>
dataTrend
(
@RequestBody
InfoDataSearchCondition
searchCondition
)
{
List
<
CountVO
>
dataList
=
new
ArrayList
<>();
List
<
CountVO
>
dataList
=
new
ArrayList
<>();
List
<
SysDictItem
>
dictItemList
=
sysDictItemService
.
listByDictCode
(
"Thematic_Library"
);
List
<
String
>
includeValues
=
dictItemList
.
stream
().
map
(
SysDictItem:
:
getItemValue
).
collect
(
Collectors
.
toList
());
searchCondition
.
setIncludeValues
(
includeValues
.
toArray
(
new
String
[
0
]));
if
(
CollectionUtils
.
isEmpty
(
searchCondition
.
getIds
())
&&
searchCondition
.
getNum
()
==
null
)
{
if
(
CollectionUtils
.
isEmpty
(
searchCondition
.
getIds
())
&&
searchCondition
.
getNum
()
==
null
)
{
dataList
=
esService
.
groupByDate
(
searchCondition
);
dataList
=
esService
.
groupByDate
(
searchCondition
);
}
else
{
}
else
{
String
[]
fetchFields
=
new
String
[]{
"id"
,
"publishDate"
};
String
[]
fetchFields
=
new
String
[]{
"id"
,
"
classificationType"
,
"
publishDate"
};
searchCondition
.
setFetchFields
(
fetchFields
);
searchCondition
.
setFetchFields
(
fetchFields
);
List
<
SpecialInformation
>
informationList
=
esService
.
informationList
(
searchCondition
);
List
<
SpecialInformation
>
informationList
=
esService
.
informationList
(
searchCondition
);
String
groupType
=
searchCondition
.
getGroupType
();
String
groupType
=
searchCondition
.
getGroupType
();
...
@@ -127,11 +130,26 @@ public class StatisticalAnalysisController {
...
@@ -127,11 +130,26 @@ public class StatisticalAnalysisController {
for
(
Map
.
Entry
<
String
,
List
<
SpecialInformation
>>
entry
:
dateMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
SpecialInformation
>>
entry
:
dateMap
.
entrySet
())
{
CountVO
countVO
=
new
CountVO
();
CountVO
countVO
=
new
CountVO
();
countVO
.
setName
(
entry
.
getKey
());
countVO
.
setName
(
entry
.
getKey
());
countVO
.
setValue
((
long
)
entry
.
getValue
().
size
());
List
<
SpecialInformation
>
value
=
entry
.
getValue
();
countVO
.
setValue
((
long
)
value
.
size
());
List
<
CountVO
>
children
=
new
ArrayList
<>();
Map
<
Integer
,
List
<
SpecialInformation
>>
typeMap
=
value
.
stream
().
collect
(
Collectors
.
groupingBy
(
SpecialInformation:
:
getClassificationType
));
for
(
Map
.
Entry
<
Integer
,
List
<
SpecialInformation
>>
typeEntry
:
typeMap
.
entrySet
())
{
CountVO
typeCountVO
=
new
CountVO
();
typeCountVO
.
setName
(
typeEntry
.
getKey
().
toString
());
typeCountVO
.
setValue
((
long
)
typeEntry
.
getValue
().
size
());
children
.
add
(
typeCountVO
);
}
countVO
.
setChildren
(
children
);
dataList
.
add
(
countVO
);
dataList
.
add
(
countVO
);
}
}
}
}
}
}
for
(
CountVO
countVO
:
dataList
)
{
List
<
CountVO
>
children
=
countVO
.
getChildren
();
sysDictItemService
.
changeKey
(
children
,
dictItemList
);
}
return
Result
.
OK
(
dataList
);
return
Result
.
OK
(
dataList
);
}
}
...
@@ -145,6 +163,9 @@ public class StatisticalAnalysisController {
...
@@ -145,6 +163,9 @@ public class StatisticalAnalysisController {
@PostMapping
(
"/dataType/distribution"
)
@PostMapping
(
"/dataType/distribution"
)
public
Result
<?>
dataTypeDistribution
(
@RequestBody
InfoDataSearchCondition
searchCondition
)
{
public
Result
<?>
dataTypeDistribution
(
@RequestBody
InfoDataSearchCondition
searchCondition
)
{
List
<
CountVO
>
dataList
=
new
ArrayList
<>();
List
<
CountVO
>
dataList
=
new
ArrayList
<>();
List
<
SysDictItem
>
dictItemList
=
sysDictItemService
.
listByDictCode
(
"Thematic_Library"
);
List
<
String
>
includeValues
=
dictItemList
.
stream
().
map
(
SysDictItem:
:
getItemValue
).
collect
(
Collectors
.
toList
());
searchCondition
.
setIncludeValues
(
includeValues
.
toArray
(
new
String
[
0
]));
if
(
CollectionUtils
.
isEmpty
(
searchCondition
.
getIds
())
&&
searchCondition
.
getNum
()
==
null
)
{
if
(
CollectionUtils
.
isEmpty
(
searchCondition
.
getIds
())
&&
searchCondition
.
getNum
()
==
null
)
{
dataList
=
esService
.
groupByClassificationType
(
searchCondition
);
dataList
=
esService
.
groupByClassificationType
(
searchCondition
);
}
else
{
}
else
{
...
@@ -159,7 +180,8 @@ public class StatisticalAnalysisController {
...
@@ -159,7 +180,8 @@ public class StatisticalAnalysisController {
dataList
.
add
(
countVO
);
dataList
.
add
(
countVO
);
}
}
}
}
changeKey
(
dataList
,
"Thematic_Library"
);
sysDictItemService
.
changeKey
(
dataList
,
dictItemList
);
return
Result
.
OK
(
dataList
);
return
Result
.
OK
(
dataList
);
}
}
...
@@ -271,44 +293,6 @@ public class StatisticalAnalysisController {
...
@@ -271,44 +293,6 @@ public class StatisticalAnalysisController {
}
}
/**
/**
* 改变key值(字典值码转为字典值)
*
* @param dataList 统计数据
* @param dictCode 字典编码
* @author lkg
* @date 2024/12/30
*/
private
void
changeKey
(
List
<
CountVO
>
dataList
,
String
dictCode
)
{
List
<
SysDictItem
>
dictItemList
=
sysDictItemService
.
listByDictCode
(
dictCode
);
if
(
CollectionUtils
.
isNotEmpty
(
dataList
))
{
Map
<
String
,
List
<
SysDictItem
>>
map
=
dictItemList
.
stream
().
collect
(
Collectors
.
groupingBy
(
SysDictItem:
:
getItemValue
));
for
(
CountVO
countVO
:
dataList
)
{
String
name
=
countVO
.
getName
();
List
<
SysDictItem
>
sysDictItemList
=
map
.
get
(
name
);
if
(
CollectionUtils
.
isNotEmpty
(
sysDictItemList
))
{
countVO
.
setName
(
sysDictItemList
.
get
(
0
).
getItemText
());
map
.
remove
(
name
);
}
}
if
(
MapUtils
.
isNotEmpty
(
map
))
{
dataList
.
addAll
(
map
.
values
().
stream
().
map
(
e
->
{
CountVO
countVO
=
new
CountVO
();
countVO
.
setName
(
e
.
get
(
0
).
getItemText
());
countVO
.
setValue
(
0L
);
return
countVO
;
}).
collect
(
Collectors
.
toList
()));
}
}
else
{
for
(
SysDictItem
sysDictItem
:
dictItemList
)
{
CountVO
countVO
=
new
CountVO
();
countVO
.
setName
(
sysDictItem
.
getItemText
());
countVO
.
setValue
(
0L
);
dataList
.
add
(
countVO
);
}
}
}
/**
* 绑定的标签信息
* 绑定的标签信息
*
*
* @param subjectId 专题id
* @param subjectId 专题id
...
...
src/main/java/com/zzsn/event/entity/ClbModelArrangeSubjectMap.java
0 → 100644
浏览文件 @
d7cc7ba7
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
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
/**
* 流程编排-专题关联
*
* @author lkg
* @date 2025/1/13
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@TableName
(
"clb_model_arrange_subject_map"
)
public
class
ClbModelArrangeSubjectMap
{
/**
* 主键id
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
ASSIGN_ID
)
private
String
id
;
/**
* 专题id
*/
@TableField
(
"subject_id"
)
private
String
subjectId
;
/**
* 流程id
*/
@TableField
(
"arrange_id"
)
private
String
arrangeId
;
/**
* 匹配类型 信息源、定向信息源、企业库等
*/
@TableField
(
"type"
)
private
String
type
;
/**
* 创建人
*/
@TableField
(
"create_by"
)
private
String
createBy
;
/**
* 删除标志 0-正常 1-删除
*/
@TableField
(
"del_flag"
)
private
Integer
delFlag
;
/**
* 创建日期
*/
@TableField
(
"create_time"
)
private
Date
createTime
;
/**
* 更新人
*/
@TableField
(
"update_by"
)
private
String
updateBy
;
/**
* 更新日期
*/
@TableField
(
"update_time"
)
private
Date
updateTime
;
}
src/main/java/com/zzsn/event/es/EsService.java
浏览文件 @
d7cc7ba7
...
@@ -27,6 +27,7 @@ import org.elasticsearch.client.RestHighLevelClient;
...
@@ -27,6 +27,7 @@ import org.elasticsearch.client.RestHighLevelClient;
import
org.elasticsearch.index.query.*
;
import
org.elasticsearch.index.query.*
;
import
org.elasticsearch.search.SearchHit
;
import
org.elasticsearch.search.SearchHit
;
import
org.elasticsearch.search.SearchHits
;
import
org.elasticsearch.search.SearchHits
;
import
org.elasticsearch.search.aggregations.Aggregation
;
import
org.elasticsearch.search.aggregations.AggregationBuilders
;
import
org.elasticsearch.search.aggregations.AggregationBuilders
;
import
org.elasticsearch.search.aggregations.Aggregations
;
import
org.elasticsearch.search.aggregations.Aggregations
;
import
org.elasticsearch.search.aggregations.BucketOrder
;
import
org.elasticsearch.search.aggregations.BucketOrder
;
...
@@ -224,7 +225,7 @@ public class EsService {
...
@@ -224,7 +225,7 @@ public class EsService {
*/
*/
public
IPage
<
SubjectDataVo
>
frontListByPage
(
List
<
String
>
subjectIdList
,
String
searchWord
,
String
position
,
Integer
category
,
public
IPage
<
SubjectDataVo
>
frontListByPage
(
List
<
String
>
subjectIdList
,
String
searchWord
,
String
position
,
Integer
category
,
String
labelId
,
String
column
,
String
order
,
int
pageNo
,
int
pageSize
)
{
String
labelId
,
String
column
,
String
order
,
int
pageNo
,
int
pageSize
)
{
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
//设置分页参数
//设置分页参数
searchSourceBuilder
.
size
(
pageSize
);
searchSourceBuilder
.
size
(
pageSize
);
...
@@ -335,7 +336,7 @@ public class EsService {
...
@@ -335,7 +336,7 @@ public class EsService {
* @date 2024/4/10
* @date 2024/4/10
*/
*/
public
List
<
SubjectDataVo
>
queryRecommendList
(
String
subjectId
,
String
id
,
String
title
,
Integer
pageNo
,
Integer
pageSize
)
{
public
List
<
SubjectDataVo
>
queryRecommendList
(
String
subjectId
,
String
id
,
String
title
,
Integer
pageNo
,
Integer
pageSize
)
{
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
//设置分页参数
//设置分页参数
int
offset
=
(
pageNo
-
1
)
*
pageSize
;
int
offset
=
(
pageNo
-
1
)
*
pageSize
;
...
@@ -521,7 +522,7 @@ public class EsService {
...
@@ -521,7 +522,7 @@ public class EsService {
*/
*/
public
List
<
SubjectDataVo
>
exportDataList
(
List
<
String
>
subjectIdList
,
String
searchWord
,
String
position
,
Integer
category
,
public
List
<
SubjectDataVo
>
exportDataList
(
List
<
String
>
subjectIdList
,
String
searchWord
,
String
position
,
Integer
category
,
List
<
String
>
articleIdList
,
String
column
,
String
order
,
Integer
type
,
Integer
pageSize
)
{
List
<
String
>
articleIdList
,
String
column
,
String
order
,
Integer
type
,
Integer
pageSize
)
{
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
if
(
CollectionUtils
.
isNotEmpty
(
articleIdList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
articleIdList
))
{
pageSize
=
articleIdList
.
size
();
pageSize
=
articleIdList
.
size
();
...
@@ -714,7 +715,7 @@ public class EsService {
...
@@ -714,7 +715,7 @@ public class EsService {
* @date 2024/5/6
* @date 2024/5/6
*/
*/
public
IPage
<
SpecialInformation
>
pageListByCondition
(
InfoDataSearchCondition
searchCondition
,
List
<
String
>
subjectIdList
)
throws
IOException
{
public
IPage
<
SpecialInformation
>
pageListByCondition
(
InfoDataSearchCondition
searchCondition
,
List
<
String
>
subjectIdList
)
throws
IOException
{
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
//设置分页参数
//设置分页参数
Integer
pageNo
=
searchCondition
.
getPageNo
();
Integer
pageNo
=
searchCondition
.
getPageNo
();
...
@@ -753,6 +754,10 @@ public class EsService {
...
@@ -753,6 +754,10 @@ public class EsService {
}
}
//默认最大数量是10000,设置为true后,显示准确数量
//默认最大数量是10000,设置为true后,显示准确数量
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
String
[]
fetchFields
=
searchCondition
.
getFetchFields
();
if
(
fetchFields
!=
null
&&
fetchFields
.
length
>
0
)
{
searchSourceBuilder
.
fetchSource
(
fetchFields
,
null
);
}
BoolQueryBuilder
boolQuery
=
buildQuery
(
searchCondition
,
subjectIdList
);
BoolQueryBuilder
boolQuery
=
buildQuery
(
searchCondition
,
subjectIdList
);
searchSourceBuilder
.
query
(
boolQuery
);
searchSourceBuilder
.
query
(
boolQuery
);
searchRequest
.
source
(
searchSourceBuilder
);
searchRequest
.
source
(
searchSourceBuilder
);
...
@@ -782,7 +787,7 @@ public class EsService {
...
@@ -782,7 +787,7 @@ public class EsService {
List
<
String
>
list
=
new
ArrayList
<>();
List
<
String
>
list
=
new
ArrayList
<>();
List
<
String
>
idList
=
Arrays
.
asList
(
ids
.
split
(
","
));
List
<
String
>
idList
=
Arrays
.
asList
(
ids
.
split
(
","
));
List
<
String
>
beInStorageList
=
idList
.
stream
().
map
(
uniqueCode
->
subjectId
+
uniqueCode
).
collect
(
Collectors
.
toList
());
List
<
String
>
beInStorageList
=
idList
.
stream
().
map
(
uniqueCode
->
subjectId
+
uniqueCode
).
collect
(
Collectors
.
toList
());
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
//创建查询对象
//创建查询对象
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
boolQuery
.
must
(
QueryBuilders
.
termsQuery
(
"id"
,
beInStorageList
));
boolQuery
.
must
(
QueryBuilders
.
termsQuery
(
"id"
,
beInStorageList
));
...
@@ -939,7 +944,7 @@ public class EsService {
...
@@ -939,7 +944,7 @@ public class EsService {
*/
*/
public
List
<
EventViewVO
>
viewpointList
(
String
eventId
,
String
relationId
)
{
public
List
<
EventViewVO
>
viewpointList
(
String
eventId
,
String
relationId
)
{
List
<
EventViewVO
>
dataList
=
new
ArrayList
<>();
List
<
EventViewVO
>
dataList
=
new
ArrayList
<>();
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
//排序方式 按发布时间升序
//排序方式 按发布时间升序
searchSourceBuilder
.
sort
(
"publishDate"
,
SortOrder
.
DESC
);
searchSourceBuilder
.
sort
(
"publishDate"
,
SortOrder
.
DESC
);
...
@@ -1031,7 +1036,7 @@ public class EsService {
...
@@ -1031,7 +1036,7 @@ public class EsService {
//调用判重接口
//调用判重接口
public
boolean
duplicationByTitleOrSourceAddress
(
DisplayInfo
displayInfo
)
{
public
boolean
duplicationByTitleOrSourceAddress
(
DisplayInfo
displayInfo
)
{
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
shouldBoolQuery
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
shouldBoolQuery
=
QueryBuilders
.
boolQuery
();
...
@@ -1195,7 +1200,7 @@ public class EsService {
...
@@ -1195,7 +1200,7 @@ public class EsService {
regionIds
.
add
(
node
.
getId
());
regionIds
.
add
(
node
.
getId
());
}
}
//根据地区的id从ES查询相关的记录
//根据地区的id从ES查询相关的记录
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
size
(
0
);
...
@@ -1261,7 +1266,7 @@ public class EsService {
...
@@ -1261,7 +1266,7 @@ public class EsService {
*/
*/
public
List
<
CountVO
>
groupByOrigin
(
String
subjectId
,
String
rangField
,
String
startDate
,
String
endDate
,
int
size
)
{
public
List
<
CountVO
>
groupByOrigin
(
String
subjectId
,
String
rangField
,
String
startDate
,
String
endDate
,
int
size
)
{
List
<
CountVO
>
data
=
new
ArrayList
<>();
List
<
CountVO
>
data
=
new
ArrayList
<>();
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
size
(
0
);
...
@@ -1408,7 +1413,7 @@ public class EsService {
...
@@ -1408,7 +1413,7 @@ public class EsService {
*/
*/
public
List
<
CountVO
>
overView
(
InfoDataSearchCondition
searchCondition
)
{
public
List
<
CountVO
>
overView
(
InfoDataSearchCondition
searchCondition
)
{
List
<
CountVO
>
list
=
new
ArrayList
<>();
List
<
CountVO
>
list
=
new
ArrayList
<>();
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
size
(
0
);
...
@@ -1463,7 +1468,7 @@ public class EsService {
...
@@ -1463,7 +1468,7 @@ public class EsService {
*/
*/
public
List
<
CountVO
>
groupByDate
(
InfoDataSearchCondition
searchCondition
)
{
public
List
<
CountVO
>
groupByDate
(
InfoDataSearchCondition
searchCondition
)
{
List
<
CountVO
>
list
=
new
ArrayList
<>();
List
<
CountVO
>
list
=
new
ArrayList
<>();
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
size
(
0
);
...
@@ -1498,6 +1503,16 @@ public class EsService {
...
@@ -1498,6 +1503,16 @@ public class EsService {
.
format
(
"HH:00:00"
);
.
format
(
"HH:00:00"
);
}
}
if
(
aggregationBuilder
!=
null
)
{
if
(
aggregationBuilder
!=
null
)
{
TermsAggregationBuilder
groupLibraryType
=
AggregationBuilders
.
terms
(
"groupLibraryType"
)
.
field
(
"classificationType"
)
.
size
(
searchCondition
.
getIncludeValues
().
length
);
if
(!
Objects
.
isNull
(
searchCondition
.
getIncludeValues
())
||
!
Objects
.
isNull
(
searchCondition
.
getExcludeValues
()))
{
if
(!
Objects
.
isNull
(
searchCondition
.
getIncludeValues
()))
{
groupLibraryType
.
size
(
searchCondition
.
getIncludeValues
().
length
);
}
groupLibraryType
.
includeExclude
(
new
IncludeExclude
(
searchCondition
.
getIncludeValues
(),
searchCondition
.
getExcludeValues
()));
}
aggregationBuilder
.
subAggregation
(
groupLibraryType
);
searchSourceBuilder
.
aggregation
(
aggregationBuilder
);
searchSourceBuilder
.
aggregation
(
aggregationBuilder
);
searchRequest
.
source
(
searchSourceBuilder
);
searchRequest
.
source
(
searchSourceBuilder
);
SearchResponse
searchResponse
=
null
;
SearchResponse
searchResponse
=
null
;
...
@@ -1542,7 +1557,7 @@ public class EsService {
...
@@ -1542,7 +1557,7 @@ public class EsService {
*/
*/
public
List
<
CountVO
>
groupByInfoSourceTag
(
InfoDataSearchCondition
searchCondition
)
{
public
List
<
CountVO
>
groupByInfoSourceTag
(
InfoDataSearchCondition
searchCondition
)
{
List
<
CountVO
>
list
=
new
ArrayList
<>();
List
<
CountVO
>
list
=
new
ArrayList
<>();
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
size
(
0
);
...
@@ -1588,7 +1603,7 @@ public class EsService {
...
@@ -1588,7 +1603,7 @@ public class EsService {
*/
*/
public
List
<
CountVO
>
keywordsCount
(
String
subjectId
,
List
<
String
>
excludeKeywords
,
Integer
size
)
{
public
List
<
CountVO
>
keywordsCount
(
String
subjectId
,
List
<
String
>
excludeKeywords
,
Integer
size
)
{
List
<
CountVO
>
list
=
new
ArrayList
<>();
List
<
CountVO
>
list
=
new
ArrayList
<>();
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
size
(
0
);
...
@@ -1635,7 +1650,7 @@ public class EsService {
...
@@ -1635,7 +1650,7 @@ public class EsService {
*/
*/
private
List
<
CountVO
>
groupByTerm
(
InfoDataSearchCondition
searchCondition
,
String
groupName
,
String
field
,
boolean
sort
)
{
private
List
<
CountVO
>
groupByTerm
(
InfoDataSearchCondition
searchCondition
,
String
groupName
,
String
field
,
boolean
sort
)
{
List
<
CountVO
>
list
=
new
ArrayList
<>();
List
<
CountVO
>
list
=
new
ArrayList
<>();
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
size
(
0
);
...
@@ -1649,11 +1664,10 @@ public class EsService {
...
@@ -1649,11 +1664,10 @@ public class EsService {
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
groupName
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
groupName
);
aggregationBuilder
.
field
(
field
);
aggregationBuilder
.
field
(
field
);
if
(!
Objects
.
isNull
(
searchCondition
.
getIncludeValues
())
||
!
Objects
.
isNull
(
searchCondition
.
getExcludeValues
()))
{
if
(!
Objects
.
isNull
(
searchCondition
.
getIncludeValues
())
||
!
Objects
.
isNull
(
searchCondition
.
getExcludeValues
()))
{
aggregationBuilder
.
includeExclude
(
new
IncludeExclude
(
searchCondition
.
getIncludeValues
(),
searchCondition
.
getExcludeValues
()));
if
(!
Objects
.
isNull
(
searchCondition
.
getIncludeValues
()))
{
aggregationBuilder
.
size
(
searchCondition
.
getIncludeValues
().
length
);
}
}
Integer
size
=
searchCondition
.
getPageSize
();
aggregationBuilder
.
includeExclude
(
new
IncludeExclude
(
searchCondition
.
getIncludeValues
(),
searchCondition
.
getExcludeValues
()));
if
(
size
!=
null
)
{
aggregationBuilder
.
size
(
size
);
}
}
aggregationBuilder
.
order
(
BucketOrder
.
count
(
sort
));
aggregationBuilder
.
order
(
BucketOrder
.
count
(
sort
));
searchSourceBuilder
.
aggregation
(
aggregationBuilder
);
searchSourceBuilder
.
aggregation
(
aggregationBuilder
);
...
@@ -1806,6 +1820,17 @@ public class EsService {
...
@@ -1806,6 +1820,17 @@ public class EsService {
CountVO
countVO
=
new
CountVO
();
CountVO
countVO
=
new
CountVO
();
countVO
.
setName
(
bucket
.
getKeyAsString
());
countVO
.
setName
(
bucket
.
getKeyAsString
());
countVO
.
setValue
(
bucket
.
getDocCount
());
countVO
.
setValue
(
bucket
.
getDocCount
());
List
<
CountVO
>
children
=
new
ArrayList
<>();
Aggregations
typeAgg
=
bucket
.
getAggregations
();
Terms
groupLibraryType
=
typeAgg
.
get
(
"groupLibraryType"
);
List
<?
extends
Terms
.
Bucket
>
typeBuckets
=
groupLibraryType
.
getBuckets
();
for
(
Terms
.
Bucket
typeBucket
:
typeBuckets
)
{
CountVO
child
=
new
CountVO
();
child
.
setName
(
typeBucket
.
getKeyAsString
());
child
.
setValue
(
typeBucket
.
getDocCount
());
children
.
add
(
child
);
}
countVO
.
setChildren
(
children
);
data
.
add
(
countVO
);
data
.
add
(
countVO
);
}
}
}
}
...
@@ -1832,7 +1857,7 @@ public class EsService {
...
@@ -1832,7 +1857,7 @@ public class EsService {
//获取es查询结果
//获取es查询结果
private
SearchHits
getEsResult
(
SearchSourceBuilder
searchSourceBuilder
,
BoolQueryBuilder
boolQuery
,
String
subjectId
)
{
private
SearchHits
getEsResult
(
SearchSourceBuilder
searchSourceBuilder
,
BoolQueryBuilder
boolQuery
,
String
subjectId
)
{
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
//默认最大数量是10000,设置为true后,显示准确数量
//默认最大数量是10000,设置为true后,显示准确数量
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
//未删除
//未删除
...
...
src/main/java/com/zzsn/event/mapper/ClbModelArrangeSubjectMapMapper.java
0 → 100644
浏览文件 @
d7cc7ba7
package
com
.
zzsn
.
event
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.zzsn.event.entity.ClbModelArrangeSubjectMap
;
import
org.apache.ibatis.annotations.Mapper
;
/**
*
*
* @author lkg
* @date 2025/1/13
*/
@Mapper
public
interface
ClbModelArrangeSubjectMapMapper
extends
BaseMapper
<
ClbModelArrangeSubjectMap
>
{
}
src/main/java/com/zzsn/event/mapper/xml/SubjectMapper.xml
浏览文件 @
d7cc7ba7
...
@@ -107,6 +107,9 @@
...
@@ -107,6 +107,9 @@
<if
test=
"subjectCondition.status!=null"
>
<if
test=
"subjectCondition.status!=null"
>
and d.status = #{subjectCondition.status}
and d.status = #{subjectCondition.status}
</if>
</if>
<if
test=
"subjectCondition.username!=null and subjectCondition.username != ''"
>
and d.create_by = #{subjectCondition.username}
</if>
order by d.create_time desc
order by d.create_time desc
</select>
</select>
...
...
src/main/java/com/zzsn/event/service/ClbModelArrangeSubjectMapService.java
0 → 100644
浏览文件 @
d7cc7ba7
package
com
.
zzsn
.
event
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.zzsn.event.entity.ClbModelArrangeSubjectMap
;
/**
*
*
* @author lkg
* @date 2025/1/13
*/
public
interface
ClbModelArrangeSubjectMapService
extends
IService
<
ClbModelArrangeSubjectMap
>
{
}
src/main/java/com/zzsn/event/service/SysDictItemService.java
浏览文件 @
d7cc7ba7
...
@@ -2,6 +2,7 @@ package com.zzsn.event.service;
...
@@ -2,6 +2,7 @@ package com.zzsn.event.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.zzsn.event.entity.SysDictItem
;
import
com.zzsn.event.entity.SysDictItem
;
import
com.zzsn.event.vo.CountVO
;
import
java.util.List
;
import
java.util.List
;
...
@@ -16,4 +17,14 @@ import java.util.List;
...
@@ -16,4 +17,14 @@ import java.util.List;
public
interface
SysDictItemService
extends
IService
<
SysDictItem
>
{
public
interface
SysDictItemService
extends
IService
<
SysDictItem
>
{
List
<
SysDictItem
>
listByDictCode
(
String
dictCode
);
List
<
SysDictItem
>
listByDictCode
(
String
dictCode
);
/**
* 改变key值(字典值码转为字典值)
*
* @param dataList 统计数据
* @param dictItemList 字典值信息
* @author lkg
* @date 2024/12/30
*/
void
changeKey
(
List
<
CountVO
>
dataList
,
List
<
SysDictItem
>
dictItemList
);
}
}
src/main/java/com/zzsn/event/service/impl/ClbModelArrangeSubjectMapServiceImpl.java
0 → 100644
浏览文件 @
d7cc7ba7
package
com
.
zzsn
.
event
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.zzsn.event.entity.ClbModelArrangeSubjectMap
;
import
com.zzsn.event.mapper.ClbModelArrangeSubjectMapMapper
;
import
com.zzsn.event.service.ClbModelArrangeSubjectMapService
;
import
org.springframework.stereotype.Service
;
/**
*
*
* @author lkg
* @date 2025/1/13
*/
@Service
public
class
ClbModelArrangeSubjectMapServiceImpl
extends
ServiceImpl
<
ClbModelArrangeSubjectMapMapper
,
ClbModelArrangeSubjectMap
>
implements
ClbModelArrangeSubjectMapService
{
}
src/main/java/com/zzsn/event/service/impl/EsStatisticsServiceImpl.java
浏览文件 @
d7cc7ba7
...
@@ -6,6 +6,7 @@ import com.zzsn.event.service.EsStatisticsService;
...
@@ -6,6 +6,7 @@ import com.zzsn.event.service.EsStatisticsService;
import
com.zzsn.event.service.LabelEntityService
;
import
com.zzsn.event.service.LabelEntityService
;
import
com.zzsn.event.util.CalculateUtil
;
import
com.zzsn.event.util.CalculateUtil
;
import
com.zzsn.event.util.EsDateUtil
;
import
com.zzsn.event.util.EsDateUtil
;
import
com.zzsn.event.util.EsIndexUtil
;
import
com.zzsn.event.vo.CountVO
;
import
com.zzsn.event.vo.CountVO
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -54,7 +55,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
...
@@ -54,7 +55,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
long
totalCount
=
0L
;
long
totalCount
=
0L
;
long
max
=
0L
;
long
max
=
0L
;
String
maxTime
=
null
;
String
maxTime
=
null
;
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
formatSourceBuilder
(
subjectId
,
null
,
startTime
,
endTime
,
false
);
SearchSourceBuilder
searchSourceBuilder
=
formatSourceBuilder
(
subjectId
,
null
,
startTime
,
endTime
,
false
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
...
@@ -102,7 +103,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
...
@@ -102,7 +103,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
CountVO
countVO
=
new
CountVO
();
CountVO
countVO
=
new
CountVO
();
countVO
.
setName
(
name
);
countVO
.
setName
(
name
);
long
count
=
0L
;
long
count
=
0L
;
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
formatSourceBuilder
(
subjectId
,
labelId
,
startTime
,
endTime
,
false
);
SearchSourceBuilder
searchSourceBuilder
=
formatSourceBuilder
(
subjectId
,
labelId
,
startTime
,
endTime
,
false
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
...
@@ -132,7 +133,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
...
@@ -132,7 +133,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
LabelEntity
labelEntity
=
labelEntityService
.
getById
(
labelId
);
LabelEntity
labelEntity
=
labelEntityService
.
getById
(
labelId
);
countVO
.
setLabelId
(
labelEntity
.
getId
());
countVO
.
setLabelId
(
labelEntity
.
getId
());
countVO
.
setName
(
labelEntity
.
getName
());
countVO
.
setName
(
labelEntity
.
getName
());
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
formatSourceBuilder
(
subjectId
,
labelId
,
startTime
,
endTime
,
false
);
SearchSourceBuilder
searchSourceBuilder
=
formatSourceBuilder
(
subjectId
,
labelId
,
startTime
,
endTime
,
false
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
...
@@ -171,7 +172,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
...
@@ -171,7 +172,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
@Override
@Override
public
List
<
CountVO
>
origin
(
String
subjectId
,
String
startTime
,
String
endTime
)
{
public
List
<
CountVO
>
origin
(
String
subjectId
,
String
startTime
,
String
endTime
)
{
List
<
CountVO
>
list
=
new
ArrayList
<>();
List
<
CountVO
>
list
=
new
ArrayList
<>();
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
formatSourceBuilder
(
subjectId
,
null
,
startTime
,
endTime
,
true
);
SearchSourceBuilder
searchSourceBuilder
=
formatSourceBuilder
(
subjectId
,
null
,
startTime
,
endTime
,
true
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
...
@@ -322,7 +323,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
...
@@ -322,7 +323,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
@Override
@Override
public
List
<
CountVO
>
flowData
(
String
subjectId
,
String
startTime
,
String
endTime
,
Integer
type
)
{
public
List
<
CountVO
>
flowData
(
String
subjectId
,
String
startTime
,
String
endTime
,
Integer
type
)
{
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
formatSourceBuilder
(
subjectId
,
null
,
startTime
,
endTime
,
false
);
SearchSourceBuilder
searchSourceBuilder
=
formatSourceBuilder
(
subjectId
,
null
,
startTime
,
endTime
,
false
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
...
@@ -358,7 +359,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
...
@@ -358,7 +359,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
@Override
@Override
public
long
totalCount
(
List
<
String
>
eventIdList
,
String
startTime
,
String
endTime
)
{
public
long
totalCount
(
List
<
String
>
eventIdList
,
String
startTime
,
String
endTime
)
{
long
count
=
0
;
long
count
=
0
;
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
String
eventIds
=
String
.
join
(
","
,
eventIdList
);
String
eventIds
=
String
.
join
(
","
,
eventIdList
);
SearchSourceBuilder
searchSourceBuilder
=
formatSourceBuilder
(
eventIds
,
null
,
startTime
,
endTime
,
false
);
SearchSourceBuilder
searchSourceBuilder
=
formatSourceBuilder
(
eventIds
,
null
,
startTime
,
endTime
,
false
);
searchSourceBuilder
.
size
(
0
);
searchSourceBuilder
.
size
(
0
);
...
...
src/main/java/com/zzsn/event/service/impl/EventServiceImpl.java
浏览文件 @
d7cc7ba7
...
@@ -12,10 +12,7 @@ import com.zzsn.event.enums.CodePrefixEnum;
...
@@ -12,10 +12,7 @@ import com.zzsn.event.enums.CodePrefixEnum;
import
com.zzsn.event.es.EsService
;
import
com.zzsn.event.es.EsService
;
import
com.zzsn.event.mapper.EventMapper
;
import
com.zzsn.event.mapper.EventMapper
;
import
com.zzsn.event.service.*
;
import
com.zzsn.event.service.*
;
import
com.zzsn.event.util.CodeGenerateUtil
;
import
com.zzsn.event.util.*
;
import
com.zzsn.event.util.CronUtil
;
import
com.zzsn.event.util.DateUtil
;
import
com.zzsn.event.util.HanlpUtil
;
import
com.zzsn.event.util.tree.Node
;
import
com.zzsn.event.util.tree.Node
;
import
com.zzsn.event.util.tree.TreeUtil
;
import
com.zzsn.event.util.tree.TreeUtil
;
import
com.zzsn.event.util.user.UserUtil
;
import
com.zzsn.event.util.user.UserUtil
;
...
@@ -239,7 +236,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
...
@@ -239,7 +236,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
List
<
String
>
eventIdList
=
new
ArrayList
<>();
List
<
String
>
eventIdList
=
new
ArrayList
<>();
pageList
.
forEach
(
e
->
eventIdList
.
add
(
e
.
getId
()));
pageList
.
forEach
(
e
->
eventIdList
.
add
(
e
.
getId
()));
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
//根据设备查询设备的相关信息
//根据设备查询设备的相关信息
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
searchSourceBuilder
.
from
(
0
);
searchSourceBuilder
.
from
(
0
);
...
@@ -472,7 +469,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
...
@@ -472,7 +469,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
//查询每个专题的数量
//查询每个专题的数量
private
Map
<
String
,
Integer
>
subjectInfoCountMap
(
List
<
String
>
subjectIdList
,
List
<
Integer
>
checkStatusList
)
{
private
Map
<
String
,
Integer
>
subjectInfoCountMap
(
List
<
String
>
subjectIdList
,
List
<
Integer
>
checkStatusList
)
{
Map
<
String
,
Integer
>
map
=
new
HashMap
<>(
subjectIdList
.
size
());
Map
<
String
,
Integer
>
map
=
new
HashMap
<>(
subjectIdList
.
size
());
SearchRequest
searchRequest
=
new
SearchRequest
(
Constants
.
SUBJECT_INDEX
);
SearchRequest
searchRequest
=
new
SearchRequest
(
EsIndexUtil
.
getIndexYear
(
Constants
.
SUBJECT_INDEX
)
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
//默认最大数量是10000,设置为true后,显示准确数量
//默认最大数量是10000,设置为true后,显示准确数量
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
trackTotalHits
(
true
);
...
...
src/main/java/com/zzsn/event/service/impl/SubjectServiceImpl.java
浏览文件 @
d7cc7ba7
...
@@ -81,6 +81,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
...
@@ -81,6 +81,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
private
ClbSubjectModelDetailTaskService
subjectModelDetailTaskService
;
private
ClbSubjectModelDetailTaskService
subjectModelDetailTaskService
;
@Autowired
@Autowired
private
IAlgorithmModelService
modelService
;
private
IAlgorithmModelService
modelService
;
@Autowired
private
ClbModelArrangeSubjectMapService
clbModelArrangeSubjectMapService
;
@Value
(
"${python.subjectProcessorUrl}"
)
@Value
(
"${python.subjectProcessorUrl}"
)
...
@@ -231,6 +233,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
...
@@ -231,6 +233,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
subjectModelMapService
.
remove
(
Wrappers
.<
SubjectModelMap
>
lambdaQuery
().
eq
(
SubjectModelMap:
:
getSubjectId
,
subjectId
));
subjectModelMapService
.
remove
(
Wrappers
.<
SubjectModelMap
>
lambdaQuery
().
eq
(
SubjectModelMap:
:
getSubjectId
,
subjectId
));
//删除事件-搜索引擎关系
//删除事件-搜索引擎关系
subjectSearchEnginesMapService
.
remove
(
Wrappers
.<
SubjectSearchEnginesMap
>
lambdaQuery
().
eq
(
SubjectSearchEnginesMap:
:
getSubjectId
,
subjectId
));
subjectSearchEnginesMapService
.
remove
(
Wrappers
.<
SubjectSearchEnginesMap
>
lambdaQuery
().
eq
(
SubjectSearchEnginesMap:
:
getSubjectId
,
subjectId
));
//删除专题/事件-tpu流程关系
clbModelArrangeSubjectMapService
.
remove
(
Wrappers
.<
ClbModelArrangeSubjectMap
>
lambdaQuery
().
eq
(
ClbModelArrangeSubjectMap:
:
getSubjectId
,
subjectId
));
//向python发送消息结束
//向python发送消息结束
send
(
subjectId
,
"-1"
);
send
(
subjectId
,
"-1"
);
});
});
...
...
src/main/java/com/zzsn/event/service/impl/SubjectSimpleServiceImpl.java
浏览文件 @
d7cc7ba7
...
@@ -4,10 +4,7 @@ import com.alibaba.fastjson2.JSON;
...
@@ -4,10 +4,7 @@ import com.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.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.zzsn.event.entity.KeyWords
;
import
com.zzsn.event.entity.*
;
import
com.zzsn.event.entity.KeywordsTypeMap
;
import
com.zzsn.event.entity.Subject
;
import
com.zzsn.event.entity.SubjectKeywordsGroupRelation
;
import
com.zzsn.event.enums.CodePrefixEnum
;
import
com.zzsn.event.enums.CodePrefixEnum
;
import
com.zzsn.event.service.*
;
import
com.zzsn.event.service.*
;
import
com.zzsn.event.util.CodeGenerateUtil
;
import
com.zzsn.event.util.CodeGenerateUtil
;
...
@@ -44,6 +41,8 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
...
@@ -44,6 +41,8 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
private
SubjectKeywordsGroupRelationService
subjectKeywordsGroupRelationService
;
private
SubjectKeywordsGroupRelationService
subjectKeywordsGroupRelationService
;
@Autowired
@Autowired
private
ISubjectKeywordsMapService
subjectKeywordsMapService
;
private
ISubjectKeywordsMapService
subjectKeywordsMapService
;
@Autowired
private
ClbModelArrangeSubjectMapService
clbModelArrangeSubjectMapService
;
@Autowired
@Autowired
private
CodeGenerateUtil
codeGenerateUtil
;
private
CodeGenerateUtil
codeGenerateUtil
;
...
@@ -60,6 +59,12 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
...
@@ -60,6 +59,12 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
//关键词绑定 todo 关键词创建时是否还需要 创建定时任务、redis缓存以及发送kafka消息
//关键词绑定 todo 关键词创建时是否还需要 创建定时任务、redis缓存以及发送kafka消息
List
<
SearchWordVO
>
keywords
=
subjectSimpleVO
.
getKeywords
();
List
<
SearchWordVO
>
keywords
=
subjectSimpleVO
.
getKeywords
();
modifyKeyword
(
subject
.
getId
(),
subject
.
getSubjectName
(),
keywords
);
modifyKeyword
(
subject
.
getId
(),
subject
.
getSubjectName
(),
keywords
);
//默认绑定tpu流程
ClbModelArrangeSubjectMap
tpu
=
new
ClbModelArrangeSubjectMap
();
tpu
.
setSubjectId
(
subject
.
getId
());
tpu
.
setArrangeId
(
"1877652205629173761"
);
tpu
.
setType
(
"baseDateToSubject"
);
clbModelArrangeSubjectMapService
.
save
(
tpu
);
return
subject
;
return
subject
;
}
}
...
@@ -95,9 +100,9 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
...
@@ -95,9 +100,9 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
String
value
=
param1
.
get
(
"value"
).
toString
();
String
value
=
param1
.
get
(
"value"
).
toString
();
String
relationStr
=
null
;
String
relationStr
=
null
;
if
(
"&"
.
equals
(
value
))
{
if
(
"&"
.
equals
(
value
))
{
relationStr
=
"
AND
"
;
relationStr
=
"
and
"
;
}
else
if
(
"|"
.
equals
(
value
))
{
}
else
if
(
"|"
.
equals
(
value
))
{
relationStr
=
"
OR
"
;
relationStr
=
"
or
"
;
}
}
JSONObject
param2
=
params
.
get
(
i
+
1
);
JSONObject
param2
=
params
.
get
(
i
+
1
);
String
id
=
param2
.
get
(
"value"
).
toString
();
String
id
=
param2
.
get
(
"value"
).
toString
();
...
@@ -106,11 +111,11 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
...
@@ -106,11 +111,11 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
}
}
}
else
if
(
"3"
.
equals
(
relationType
))
{
}
else
if
(
"3"
.
equals
(
relationType
))
{
String
valueStr
=
params
.
get
(
0
).
get
(
"value"
).
toString
();
String
valueStr
=
params
.
get
(
0
).
get
(
"value"
).
toString
();
map
.
get
(
valueStr
).
setSearchLogicRelationship
(
"
AND
"
);
map
.
get
(
valueStr
).
setSearchLogicRelationship
(
"
and
"
);
for
(
int
i
=
1
;
i
<
params
.
size
()
-
2
;
i
+=
2
)
{
for
(
int
i
=
1
;
i
<
params
.
size
()
-
2
;
i
+=
2
)
{
JSONObject
param
=
params
.
get
(
i
+
1
);
JSONObject
param
=
params
.
get
(
i
+
1
);
String
id
=
param
.
get
(
"value"
).
toString
();
String
id
=
param
.
get
(
"value"
).
toString
();
map
.
get
(
id
).
setSearchLogicRelationship
(
"
AND
"
);
map
.
get
(
id
).
setSearchLogicRelationship
(
"
and
"
);
}
}
}
}
}
}
...
@@ -202,7 +207,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
...
@@ -202,7 +207,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
keywordsGroupIds
.
add
(
id
);
keywordsGroupIds
.
add
(
id
);
expressionStr
.
append
(
"&"
).
append
(
id
);
expressionStr
.
append
(
"&"
).
append
(
id
);
JSONObject
relationParam
=
new
JSONObject
();
JSONObject
relationParam
=
new
JSONObject
();
relationParam
.
put
(
"title"
,
"
AND
"
);
relationParam
.
put
(
"title"
,
"
and
"
);
relationParam
.
put
(
"value"
,
"&"
);
relationParam
.
put
(
"value"
,
"&"
);
paramsStr
.
add
(
relationParam
);
paramsStr
.
add
(
relationParam
);
JSONObject
params
=
new
JSONObject
();
JSONObject
params
=
new
JSONObject
();
...
@@ -228,9 +233,9 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
...
@@ -228,9 +233,9 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
}
else
{
}
else
{
String
searchLogicRelationship
=
searchWordVO
.
getSearchLogicRelationship
();
String
searchLogicRelationship
=
searchWordVO
.
getSearchLogicRelationship
();
String
relationStr
=
"|"
;
String
relationStr
=
"|"
;
if
(
"
AND
"
.
equals
(
searchLogicRelationship
))
{
if
(
"
and
"
.
equals
(
searchLogicRelationship
))
{
relationStr
=
"&"
;
relationStr
=
"&"
;
}
else
if
(
"
OR
"
.
equals
(
searchLogicRelationship
))
{
}
else
if
(
"
or
"
.
equals
(
searchLogicRelationship
))
{
relationStr
=
"|"
;
relationStr
=
"|"
;
}
}
expressionStr
.
append
(
relationStr
).
append
(
id
);
expressionStr
.
append
(
relationStr
).
append
(
id
);
...
@@ -262,7 +267,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
...
@@ -262,7 +267,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
subjectKeywordsMap
.
setSubjectId
(
subjectId
);
subjectKeywordsMap
.
setSubjectId
(
subjectId
);
subjectKeywordsMap
.
setType
(
String
.
valueOf
(
wordVO
.
getSearchScope
()));
subjectKeywordsMap
.
setType
(
String
.
valueOf
(
wordVO
.
getSearchScope
()));
String
bindType
;
String
bindType
;
if
(
"NOT"
.
equals
(
wordVO
.
getSearchLogicRelationship
()))
{
if
(
"NOT"
.
equals
IgnoreCase
(
wordVO
.
getSearchLogicRelationship
()))
{
bindType
=
"3"
;
bindType
=
"3"
;
}
else
{
}
else
{
bindType
=
"2"
;
bindType
=
"2"
;
...
...
src/main/java/com/zzsn/event/service/impl/SysDictItemServiceImpl.java
浏览文件 @
d7cc7ba7
...
@@ -5,9 +5,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...
@@ -5,9 +5,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
com.zzsn.event.entity.SysDictItem
;
import
com.zzsn.event.entity.SysDictItem
;
import
com.zzsn.event.mapper.SysDictItemMapper
;
import
com.zzsn.event.mapper.SysDictItemMapper
;
import
com.zzsn.event.service.SysDictItemService
;
import
com.zzsn.event.service.SysDictItemService
;
import
com.zzsn.event.vo.CountVO
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.MapUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
/**
* <p>
* <p>
...
@@ -25,4 +30,35 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
...
@@ -25,4 +30,35 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
public
List
<
SysDictItem
>
listByDictCode
(
String
dictCode
)
{
public
List
<
SysDictItem
>
listByDictCode
(
String
dictCode
)
{
return
this
.
baseMapper
.
listByDictCode
(
dictCode
);
return
this
.
baseMapper
.
listByDictCode
(
dictCode
);
}
}
@Override
public
void
changeKey
(
List
<
CountVO
>
dataList
,
List
<
SysDictItem
>
dictItemList
)
{
if
(
CollectionUtils
.
isNotEmpty
(
dataList
))
{
Map
<
String
,
List
<
SysDictItem
>>
map
=
dictItemList
.
stream
().
collect
(
Collectors
.
groupingBy
(
SysDictItem:
:
getItemValue
));
for
(
CountVO
countVO
:
dataList
)
{
String
name
=
countVO
.
getName
();
List
<
SysDictItem
>
sysDictItemList
=
map
.
get
(
name
);
if
(
CollectionUtils
.
isNotEmpty
(
sysDictItemList
))
{
countVO
.
setName
(
sysDictItemList
.
get
(
0
).
getItemText
());
map
.
remove
(
name
);
}
}
if
(
MapUtils
.
isNotEmpty
(
map
))
{
dataList
.
addAll
(
map
.
values
().
stream
().
map
(
e
->
{
CountVO
countVO
=
new
CountVO
();
countVO
.
setName
(
e
.
get
(
0
).
getItemText
());
countVO
.
setValue
(
0L
);
return
countVO
;
}).
collect
(
Collectors
.
toList
()));
}
}
else
{
for
(
SysDictItem
sysDictItem
:
dictItemList
)
{
CountVO
countVO
=
new
CountVO
();
countVO
.
setName
(
sysDictItem
.
getItemText
());
countVO
.
setValue
(
0L
);
dataList
.
add
(
countVO
);
}
}
}
}
}
src/main/java/com/zzsn/event/vo/SubjectPage.java
浏览文件 @
d7cc7ba7
...
@@ -52,15 +52,15 @@ public class SubjectPage {
...
@@ -52,15 +52,15 @@ public class SubjectPage {
/**数据来源(0-平台数据;1-全网搜)*/
/**数据来源(0-平台数据;1-全网搜)*/
private
Integer
dataSource
;
private
Integer
dataSource
;
/**启用时间*/
/**启用时间*/
@Excel
(
name
=
"启用时间"
,
width
=
15
,
format
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"启用时间"
,
width
=
15
,
format
=
"yyyy-MM-dd
HH:mm:ss
"
)
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd
HH:mm:ss
"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd
HH:mm:ss
"
)
@ApiModelProperty
(
value
=
"启用时间"
)
@ApiModelProperty
(
value
=
"启用时间"
)
private
Date
timeEnable
;
private
Date
timeEnable
;
/**停用时间*/
/**停用时间*/
@Excel
(
name
=
"停用时间"
,
width
=
15
,
format
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"停用时间"
,
width
=
15
,
format
=
"yyyy-MM-dd
HH:mm:ss
"
)
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd
HH:mm:ss
"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd
HH:mm:ss
"
)
@ApiModelProperty
(
value
=
"停用时间"
)
@ApiModelProperty
(
value
=
"停用时间"
)
private
Date
timeDisable
;
private
Date
timeDisable
;
/**划分专题库*/
/**划分专题库*/
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论