Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
1820fab7
提交
1820fab7
authored
2月 28, 2025
作者:
925993793@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【fix】导出时数据查询bug修改
上级
b3c4febe
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
83 行增加
和
49 行删除
+83
-49
FileController.java
src/main/java/com/zzsn/event/controller/FileController.java
+2
-2
StatisticalAnalysisController.java
...vent/controller/common/StatisticalAnalysisController.java
+8
-9
EsService.java
src/main/java/com/zzsn/event/es/EsService.java
+5
-6
InformationService.java
src/main/java/com/zzsn/event/service/InformationService.java
+10
-0
InformationServiceImpl.java
...a/com/zzsn/event/service/impl/InformationServiceImpl.java
+52
-26
SubjectSimpleServiceImpl.java
...com/zzsn/event/service/impl/SubjectSimpleServiceImpl.java
+5
-5
InfoDataSearchCondition.java
src/main/java/com/zzsn/event/vo/InfoDataSearchCondition.java
+1
-1
没有找到文件。
src/main/java/com/zzsn/event/controller/FileController.java
浏览文件 @
1820fab7
...
...
@@ -360,7 +360,7 @@ public class FileController {
fetchFields
=
new
String
[]{
"id"
,
"title"
,
"content"
,
"origin"
,
"publishDate"
,
"sourceAddress"
};
}
searchCondition
.
setFetchFields
(
fetchFields
);
List
<
SpecialInformation
>
informationList
=
esService
.
information
List
(
searchCondition
);
List
<
SpecialInformation
>
informationList
=
informationService
.
informationAll
List
(
searchCondition
);
Map
<
String
,
Object
>
map
=
formatDocData
(
informationList
,
null
,
exportType
);
Template
template
=
FreeMarkerConfiguration
.
get
().
getTemplate
(
"EVENT_DATA_REPORT.ftl"
,
"UTF-8"
);
bos
=
new
ByteArrayOutputStream
();
...
...
@@ -433,7 +433,7 @@ public class FileController {
SXSSFWorkbook
workbook
=
new
SXSSFWorkbook
();
for
(
int
i
=
1
;
;
i
++)
{
searchCondition
.
setPageNo
(
i
);
List
<
SpecialInformation
>
informationList
=
esService
.
information
List
(
searchCondition
);
List
<
SpecialInformation
>
informationList
=
informationService
.
informationAll
List
(
searchCondition
);
log
.
info
(
"本次循环-{},数据量为-{}"
,
i
,
informationList
.
size
());
if
(
CollectionUtils
.
isEmpty
(
informationList
))
{
break
;
...
...
src/main/java/com/zzsn/event/controller/common/StatisticalAnalysisController.java
浏览文件 @
1820fab7
...
...
@@ -8,10 +8,7 @@ import com.zzsn.event.entity.InfoSource;
import
com.zzsn.event.entity.Subject
;
import
com.zzsn.event.entity.SysDictItem
;
import
com.zzsn.event.es.EsService
;
import
com.zzsn.event.service.ClbLabelService
;
import
com.zzsn.event.service.IInfoSourceService
;
import
com.zzsn.event.service.SubjectService
;
import
com.zzsn.event.service.SysDictItemService
;
import
com.zzsn.event.service.*
;
import
com.zzsn.event.util.DateUtil
;
import
com.zzsn.event.vo.*
;
import
com.zzsn.event.vo.es.Label
;
...
...
@@ -47,6 +44,8 @@ public class StatisticalAnalysisController {
private
SysDictItemService
sysDictItemService
;
@Autowired
private
ClbLabelService
clbLabelService
;
@Autowired
private
InformationService
informationService
;
/**
* 概述分析
...
...
@@ -76,7 +75,7 @@ public class StatisticalAnalysisController {
}
else
{
String
[]
fetchFields
=
new
String
[]{
"id"
,
"sid"
,
"labels"
};
searchCondition
.
setFetchFields
(
fetchFields
);
List
<
SpecialInformation
>
specialInformationList
=
esService
.
information
List
(
searchCondition
);
List
<
SpecialInformation
>
specialInformationList
=
informationService
.
informationAll
List
(
searchCondition
);
totalCount
=
specialInformationList
.
size
();
Map
<
String
,
List
<
SpecialInformation
>>
map
=
buildMap
(
specialInformationList
,
labelMap
);
for
(
Map
.
Entry
<
String
,
List
<
SpecialInformation
>>
entry
:
map
.
entrySet
())
{
...
...
@@ -114,7 +113,7 @@ public class StatisticalAnalysisController {
}
else
{
String
[]
fetchFields
=
new
String
[]{
"id"
,
"classificationType"
,
"publishDate"
};
searchCondition
.
setFetchFields
(
fetchFields
);
List
<
SpecialInformation
>
informationList
=
esService
.
information
List
(
searchCondition
);
List
<
SpecialInformation
>
informationList
=
informationService
.
informationAll
List
(
searchCondition
);
String
groupType
=
searchCondition
.
getGroupType
();
String
format
=
null
;
if
(
"year"
.
equalsIgnoreCase
(
groupType
))
{
...
...
@@ -174,7 +173,7 @@ public class StatisticalAnalysisController {
}
else
{
String
[]
fetchFields
=
new
String
[]{
"id"
,
"classificationType"
};
searchCondition
.
setFetchFields
(
fetchFields
);
List
<
SpecialInformation
>
informationList
=
esService
.
information
List
(
searchCondition
);
List
<
SpecialInformation
>
informationList
=
informationService
.
informationAll
List
(
searchCondition
);
Map
<
Integer
,
List
<
SpecialInformation
>>
map
=
informationList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
SpecialInformation:
:
getClassificationType
));
for
(
Map
.
Entry
<
Integer
,
List
<
SpecialInformation
>>
entry
:
map
.
entrySet
())
{
...
...
@@ -208,7 +207,7 @@ public class StatisticalAnalysisController {
}
else
{
String
[]
fetchFields
=
new
String
[]{
"id"
,
"labels"
};
searchCondition
.
setFetchFields
(
fetchFields
);
List
<
SpecialInformation
>
specialInformationList
=
esService
.
information
List
(
searchCondition
);
List
<
SpecialInformation
>
specialInformationList
=
informationService
.
informationAll
List
(
searchCondition
);
Map
<
String
,
List
<
SpecialInformation
>>
map
=
buildMap
(
specialInformationList
,
labelMap
);
for
(
Map
.
Entry
<
String
,
List
<
SpecialInformation
>>
entry
:
map
.
entrySet
())
{
CountVO
countVO
=
new
CountVO
();
...
...
@@ -245,7 +244,7 @@ public class StatisticalAnalysisController {
}
else
{
String
[]
fetchFields
=
new
String
[]{
"id"
,
"sid"
};
searchCondition
.
setFetchFields
(
fetchFields
);
List
<
SpecialInformation
>
informationList
=
esService
.
information
List
(
searchCondition
);
List
<
SpecialInformation
>
informationList
=
informationService
.
informationAll
List
(
searchCondition
);
Map
<
String
,
List
<
SpecialInformation
>>
map
=
informationList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
SpecialInformation:
:
getSid
));
for
(
Map
.
Entry
<
String
,
List
<
SpecialInformation
>>
entry
:
map
.
entrySet
())
{
...
...
src/main/java/com/zzsn/event/es/EsService.java
浏览文件 @
1820fab7
...
...
@@ -1158,27 +1158,24 @@ public class EsService {
}
//默认最大数量是10000,设置为true后,显示准确数量
searchSourceBuilder
.
trackTotalHits
(
true
);
//设置分页参数
Integer
pageNo
=
searchCondition
.
getPageNo
();
Integer
pageSize
=
searchCondition
.
getPageSize
();
//创建查询对象
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
//判断ids字段是否为空,若不为空,则表示按照id勾选
List
<
String
>
ids
=
searchCondition
.
getIds
();
if
(
CollectionUtils
.
isNotEmpty
(
ids
))
{
searchSourceBuilder
.
size
(
ids
.
size
());
boolQuery
.
must
(
QueryBuilders
.
termsQuery
(
"id"
,
ids
));
List
<
String
>
sourceIdList
=
searchCondition
.
getSourceIdList
();
if
(
CollectionUtils
.
isNotEmpty
(
sourceIdList
))
{
boolQuery
.
must
(
QueryBuilders
.
termsQuery
(
"sid.keyword"
,
sourceIdList
));
}
}
else
{
//设置分页参数
Integer
pageNo
=
searchCondition
.
getPageNo
();
Integer
pageSize
=
searchCondition
.
getPageSize
();
Integer
num
=
searchCondition
.
getNum
();
if
(
num
!=
null
)
{
pageSize
=
num
;
}
searchSourceBuilder
.
size
(
pageSize
);
searchSourceBuilder
.
from
((
pageNo
-
1
)
*
pageSize
);
List
<
String
>
subjectIdList
=
new
ArrayList
<>();
//判断是否是专题
if
(
"1"
.
equals
(
searchCondition
.
getIsSubject
()))
{
...
...
@@ -1199,6 +1196,8 @@ public class EsService {
}
boolQuery
=
buildQuery
(
searchCondition
,
subjectIdList
);
}
searchSourceBuilder
.
from
((
pageNo
-
1
)
*
pageSize
);
searchSourceBuilder
.
size
(
pageSize
);
searchSourceBuilder
.
query
(
boolQuery
);
searchRequest
.
source
(
searchSourceBuilder
);
List
<
SpecialInformation
>
dataList
=
new
ArrayList
<>();
...
...
src/main/java/com/zzsn/event/service/InformationService.java
浏览文件 @
1820fab7
...
...
@@ -7,6 +7,7 @@ import com.zzsn.event.entity.ClbFileOperationLog;
import
com.zzsn.event.util.user.UserVo
;
import
com.zzsn.event.vo.*
;
import
com.zzsn.event.vo.es.DisplayInfo
;
import
com.zzsn.event.vo.es.SpecialInformation
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -218,4 +219,13 @@ public interface InformationService {
* @date 2025/2/20
*/
void
supplyByCondition
(
String
subjectId
,
List
<
String
>
themeIds
);
/**
* 获取所有资讯列表
*
* @param searchCondition 检索条件
* @author lkg
* @date 2025/2/28
*/
List
<
SpecialInformation
>
informationAllList
(
InfoDataSearchCondition
searchCondition
);
}
src/main/java/com/zzsn/event/service/impl/InformationServiceImpl.java
浏览文件 @
1820fab7
...
...
@@ -289,40 +289,46 @@ public class InformationServiceImpl implements InformationService {
public
void
saveAsDataSet
(
InfoDataSearchCondition
searchCondition
)
{
String
[]
fetchFields
=
new
String
[]{
"id"
,
"labels"
};
searchCondition
.
setFetchFields
(
fetchFields
);
searchCondition
.
setPageSize
(
300
);
Label
dataSet
=
new
Label
();
String
dataSetId
=
searchCondition
.
getDataSetId
();
dataSet
.
setRelationId
(
dataSetId
);
Map
<
String
,
List
<
SpecialInformation
>>
map
=
new
HashMap
<>();
for
(
int
i
=
1
;
;
i
++)
{
searchCondition
.
setPageNo
(
i
);
List
<
SpecialInformation
>
informationList
=
esService
.
informationList
(
searchCondition
);
log
.
info
(
"保存数据集:本次循环-{},数据量为-{}"
,
i
,
informationList
.
size
());
if
(
CollectionUtils
.
isEmpty
(
informationList
))
{
break
;
}
for
(
SpecialInformation
information
:
informationList
)
{
String
index
=
information
.
getDbIndex
();
List
<
Label
>
labels
=
information
.
getLabels
();
if
(
CollectionUtils
.
isNotEmpty
(
labels
))
{
boolean
present
=
labels
.
stream
().
anyMatch
(
label
->
label
.
getRelationId
().
equals
(
dataSetId
));
if
(!
present
)
{
labels
.
add
(
dataSet
);
}
}
else
{
Integer
num
=
searchCondition
.
getNum
();
List
<
SpecialInformation
>
informationList
=
this
.
informationAllList
(
searchCondition
);
formatUpdateMap
(
map
,
informationList
,
dataSet
);
map
.
forEach
((
k
,
v
)
->
esOpUtil
.
docUpdateBulk
(
k
,
v
));
}
/**
* 格式化数据
*
* @param map 待更新的数据map集合
* @param informationList 查询到的数据集合
* @param dataSet 数据集标签信息
* @author lkg
* @date 2025/2/28
*/
private
void
formatUpdateMap
(
Map
<
String
,
List
<
SpecialInformation
>>
map
,
List
<
SpecialInformation
>
informationList
,
Label
dataSet
){
for
(
SpecialInformation
information
:
informationList
)
{
String
index
=
information
.
getDbIndex
();
List
<
Label
>
labels
=
information
.
getLabels
();
if
(
CollectionUtils
.
isNotEmpty
(
labels
))
{
boolean
present
=
labels
.
stream
().
anyMatch
(
label
->
label
.
getRelationId
().
equals
(
dataSet
.
getRelationId
()));
if
(!
present
)
{
labels
.
add
(
dataSet
);
}
information
.
setLabels
(
labels
);
if
(
map
.
containsKey
(
index
))
{
map
.
get
(
index
).
add
(
information
);
}
else
{
List
<
SpecialInformation
>
list
=
new
ArrayList
<>();
list
.
add
(
information
);
map
.
put
(
index
,
list
);
}
}
else
{
labels
.
add
(
dataSet
);
}
information
.
setLabels
(
labels
);
if
(
map
.
containsKey
(
index
))
{
map
.
get
(
index
).
add
(
information
);
}
else
{
List
<
SpecialInformation
>
list
=
new
ArrayList
<>();
list
.
add
(
information
);
map
.
put
(
index
,
list
);
}
}
map
.
forEach
((
k
,
v
)
->
esOpUtil
.
docUpdateBulk
(
k
,
v
));
}
@Override
...
...
@@ -923,7 +929,27 @@ public class InformationServiceImpl implements InformationService {
}
redisUtil
.
rpushMultipleValues
(
Constants
.
HISTORY_SUBJECT_DATE_QUEUE
+
subject
.
getSubjectCode
(),
redisCacheList
.
toArray
(
new
String
[
0
]));
}
}
@Override
public
List
<
SpecialInformation
>
informationAllList
(
InfoDataSearchCondition
searchCondition
)
{
List
<
SpecialInformation
>
informationList
=
new
ArrayList
<>();
Integer
num
=
searchCondition
.
getNum
();
if
(
num
==
null
)
{
searchCondition
.
setPageSize
(
300
);
for
(
int
i
=
1
;
;
i
++)
{
searchCondition
.
setPageNo
(
i
);
List
<
SpecialInformation
>
list
=
esService
.
informationList
(
searchCondition
);
log
.
info
(
"保存数据集:本次循环-{},数据量为-{}"
,
i
,
list
.
size
());
if
(
CollectionUtils
.
isEmpty
(
list
))
{
break
;
}
informationList
.
addAll
(
list
);
}
}
else
{
informationList
=
esService
.
informationList
(
searchCondition
);
}
return
informationList
;
}
private
void
formatLabel
(
List
<
LabelModelVo
>
labelModelVos
,
DisplayInfo
info
)
{
...
...
src/main/java/com/zzsn/event/service/impl/SubjectSimpleServiceImpl.java
浏览文件 @
1820fab7
...
...
@@ -71,9 +71,9 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
private
ScoreModelService
scoreModelService
;
@Autowired
private
ConfigurationMessageService
configurationMessageService
;
@Autowired
private
EsService
esService
;
private
InformationService
informationService
;
@Autowired
private
EsOpUtil
esOpUtil
;
@Autowired
...
...
@@ -371,7 +371,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
String
[]
fetchFields
=
new
String
[]{
"id"
,
"checkStatus"
};
searchCondition
.
setFetchFields
(
fetchFields
);
Map
<
String
,
List
<
SpecialInformation
>>
updateMap
=
new
HashMap
<>();
List
<
SpecialInformation
>
informationList
=
esService
.
information
List
(
searchCondition
);
List
<
SpecialInformation
>
informationList
=
informationService
.
informationAll
List
(
searchCondition
);
for
(
SpecialInformation
information
:
informationList
)
{
String
index
=
information
.
getDbIndex
();
information
.
setCheckStatus
(
1
);
...
...
@@ -391,7 +391,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
String
[]
fetchFields
=
new
String
[]{
"id"
,
"checkStatus"
};
searchCondition
.
setFetchFields
(
fetchFields
);
Map
<
String
,
List
<
SpecialInformation
>>
updateMap
=
new
HashMap
<>();
List
<
SpecialInformation
>
informationList
=
esService
.
information
List
(
searchCondition
);
List
<
SpecialInformation
>
informationList
=
informationService
.
informationAll
List
(
searchCondition
);
for
(
SpecialInformation
information
:
informationList
)
{
String
index
=
information
.
getDbIndex
();
information
.
setCheckStatus
(
0
);
...
...
@@ -411,7 +411,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
String
[]
fetchFields
=
new
String
[]{
"id"
,
"deleteFlag"
};
searchCondition
.
setFetchFields
(
fetchFields
);
Map
<
String
,
List
<
SpecialInformation
>>
updateMap
=
new
HashMap
<>();
List
<
SpecialInformation
>
informationList
=
esService
.
information
List
(
searchCondition
);
List
<
SpecialInformation
>
informationList
=
informationService
.
informationAll
List
(
searchCondition
);
for
(
SpecialInformation
information
:
informationList
)
{
String
index
=
information
.
getDbIndex
();
information
.
setDeleteFlag
(
1
);
...
...
src/main/java/com/zzsn/event/vo/InfoDataSearchCondition.java
浏览文件 @
1820fab7
...
...
@@ -125,7 +125,7 @@ public class InfoDataSearchCondition {
//选择前num条数据
private
Integer
num
;
//资讯id集合
-研究中心
//资讯id集合
private
List
<
String
>
ids
;
//关联标签名称
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论