Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
b3c4febe
提交
b3c4febe
authored
2月 28, 2025
作者:
925993793@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【fix】已入库资讯导出逻辑修改以及其他bug修改
上级
b7bd8c2f
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
138 行增加
和
23 行删除
+138
-23
FileController.java
src/main/java/com/zzsn/event/controller/FileController.java
+47
-13
SubjectManageController.java
...va/com/zzsn/event/controller/SubjectManageController.java
+1
-1
InformationController.java
...m/zzsn/event/controller/common/InformationController.java
+3
-0
EsService.java
src/main/java/com/zzsn/event/es/EsService.java
+38
-6
CustomExceptionHandler.java
...java/com/zzsn/event/exception/CustomExceptionHandler.java
+22
-0
FileExportException.java
...in/java/com/zzsn/event/exception/FileExportException.java
+19
-0
InformationServiceImpl.java
...a/com/zzsn/event/service/impl/InformationServiceImpl.java
+7
-2
SubjectSimpleServiceImpl.java
...com/zzsn/event/service/impl/SubjectSimpleServiceImpl.java
+1
-1
没有找到文件。
src/main/java/com/zzsn/event/controller/FileController.java
浏览文件 @
b3c4febe
...
...
@@ -7,11 +7,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import
com.obs.services.model.PutObjectResult
;
import
com.zzsn.event.config.FreeMarkerConfiguration
;
import
com.zzsn.event.constant.Result
;
import
com.zzsn.event.entity.ClbFileOperationLog
;
import
com.zzsn.event.entity.Event
;
import
com.zzsn.event.entity.FileDownloadCenter
;
import
com.zzsn.event.entity.Subject
;
import
com.zzsn.event.entity.*
;
import
com.zzsn.event.es.EsService
;
import
com.zzsn.event.exception.FileExportException
;
import
com.zzsn.event.service.*
;
import
com.zzsn.event.util.*
;
import
com.zzsn.event.util.user.UserUtil
;
...
...
@@ -31,6 +29,8 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.jsoup.Jsoup
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
...
...
@@ -75,6 +75,10 @@ public class FileController {
private
CommonService
commonService
;
@Autowired
private
IClbFileOperationLogService
clbFileOperationLogService
;
@Autowired
private
ISubjectTypeService
subjectTypeService
;
@Autowired
private
ISubjectTypeMapService
subjectTypeMapService
;
/**
* 专题关联信息源采集量统计-导出excel(专题列表页)
...
...
@@ -226,11 +230,13 @@ public class FileController {
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
else
{
}
else
if
(
count
<
100000
)
{
//获取当前登录用户
UserVo
userVo
=
UserUtil
.
getLoginUser
();
String
subjectName
;
Integer
category
=
searchCondition
.
getCategory
();
String
isSubject
=
searchCondition
.
getIsSubject
();
if
(
isSubject
.
equals
(
"1"
))
{
if
(
category
==
1
)
{
Subject
subject
=
subjectService
.
getById
(
subjectId
);
subjectName
=
subject
.
getSubjectName
();
...
...
@@ -238,6 +244,10 @@ public class FileController {
Event
event
=
eventService
.
getById
(
subjectId
);
subjectName
=
event
.
getEventName
();
}
}
else
{
SubjectType
subjectType
=
subjectTypeService
.
getById
(
subjectId
);
subjectName
=
subjectType
.
getTypeName
();
}
FileDownloadCenter
fileDownloadCenter
=
new
FileDownloadCenter
();
fileDownloadCenter
.
setRelationId
(
subjectId
);
String
name
=
fileDownloadCenterService
.
getNoRepeatName
(
subjectName
+
"-已入库信息"
,
userVo
.
getUsername
());
...
...
@@ -265,12 +275,17 @@ public class FileController {
}
fileDownloadCenterService
.
update
(
updateWrapper
);
});
}
else
{
throw
new
FileExportException
(
"导出数据量超出100000,请联系技术人员"
);
}
}
else
{
throw
new
FileExportException
(
"数据量为0,无法导出"
);
}
}
/**
* 专题资讯导入模板下载-研究中心
*
...
...
@@ -391,11 +406,30 @@ public class FileController {
byte
[]
bytes
=
null
;
try
{
String
[]
arr
=
new
String
[]{
"得分"
,
"标题"
,
"标题译文"
,
"摘要"
,
"摘要译文"
,
"正文"
,
"正文译文"
,
"作者"
,
"来源"
,
"发布时间"
,
"网址"
,
"专题库类型"
,
"命中词"
};
List
<
String
>
subjectIds
=
new
ArrayList
<>();
subjectIds
.
add
(
searchCondition
.
getSubjectId
());
List
<
LabelModelVo
>
labelTypeVos
=
commonService
.
subjectModelBindLabels
(
subjectIds
);
List
<
String
>
headers
=
Arrays
.
asList
(
arr
);
List
<
String
>
subjectIdList
=
new
ArrayList
<>();
//判断是否是专题
if
(
"1"
.
equals
(
searchCondition
.
getIsSubject
()))
{
if
(
StringUtils
.
isNotEmpty
(
searchCondition
.
getSubjectId
()))
{
subjectIdList
.
add
(
searchCondition
.
getSubjectId
());
}
}
else
{
//该id其实是专题类别id
//查询类别id的所有明细id
Integer
category
=
searchCondition
.
getCategory
();
String
subjectTypeId
=
searchCondition
.
getSubjectId
();
List
<
String
>
typeIds
=
subjectTypeService
.
belowIdList
(
subjectTypeId
,
category
);
if
(
category
==
1
)
{
subjectIdList
=
subjectTypeMapService
.
selectSubjectByTypeIds
(
typeIds
);
}
else
if
(
category
==
2
)
{
subjectIdList
=
subjectTypeMapService
.
selectEventByTypeIds
(
typeIds
);
}
}
List
<
LabelModelVo
>
labelTypeVos
=
commonService
.
subjectModelBindLabels
(
subjectIdList
);
if
(
subjectIdList
.
size
()
==
1
)
{
//动态补充表头
List
<
String
>
headers
=
supplyHeaders
(
arr
,
labelTypeVos
);
headers
=
supplyHeaders
(
arr
,
labelTypeVos
);
}
SXSSFWorkbook
workbook
=
new
SXSSFWorkbook
();
for
(
int
i
=
1
;
;
i
++)
{
searchCondition
.
setPageNo
(
i
);
...
...
@@ -404,7 +438,7 @@ public class FileController {
if
(
CollectionUtils
.
isEmpty
(
informationList
))
{
break
;
}
List
<
List
<
String
>>
rows
=
formatData
(
informationList
,
labelTypeVos
);
List
<
List
<
String
>>
rows
=
formatData
(
informationList
,
labelTypeVos
,
subjectIdList
);
BigExcelExportUtil
.
exportExcelData
(
workbook
,
i
-
1
,
headers
,
rows
,
"sheet"
+
i
);
log
.
info
(
"第【{}】个sheet页写入成功"
,
i
);
}
...
...
@@ -429,7 +463,7 @@ public class FileController {
return
headers
;
}
private
List
<
List
<
String
>>
formatData
(
List
<
SpecialInformation
>
informationList
,
List
<
LabelModelVo
>
labelTypeVos
)
{
private
List
<
List
<
String
>>
formatData
(
List
<
SpecialInformation
>
informationList
,
List
<
LabelModelVo
>
labelTypeVos
,
List
<
String
>
subjectIdList
)
{
List
<
List
<
String
>>
list
=
new
ArrayList
<>();
for
(
SpecialInformation
info
:
informationList
)
{
List
<
String
>
data
=
new
ArrayList
<>();
...
...
@@ -515,8 +549,7 @@ public class FileController {
}
else
{
data
.
add
(
" "
);
}
//标签处理
if
(
CollectionUtils
.
isNotEmpty
(
labelTypeVos
))
{
if
(
subjectIdList
.
size
()
==
1
&&
(
CollectionUtils
.
isNotEmpty
(
labelTypeVos
)))
{
List
<
Label
>
relationLabels
=
info
.
getLabels
();
Map
<
String
,
List
<
Label
>>
map
=
new
HashMap
<>(
labelTypeVos
.
size
());
for
(
LabelModelVo
labelTypeVo
:
labelTypeVos
)
{
...
...
@@ -569,6 +602,7 @@ public class FileController {
data
.
add
(
sb
.
substring
(
1
));
}
}
}
list
.
add
(
data
);
}
...
...
src/main/java/com/zzsn/event/controller/SubjectManageController.java
浏览文件 @
b3c4febe
...
...
@@ -99,7 +99,7 @@ public class SubjectManageController {
private
KafkaTemplate
<
String
,
String
>
kafkaTemplate
;
@Autowired
private
PythonUtil
pythonUtil
;
@Autowired
@Autowired
(
required
=
false
)
private
RemoteModelService
remoteModelService
;
@Autowired
private
ConfigurationMessageService
configurationMessageService
;
...
...
src/main/java/com/zzsn/event/controller/common/InformationController.java
浏览文件 @
b3c4febe
...
...
@@ -222,6 +222,9 @@ public class InformationController {
if
(
StringUtils
.
isEmpty
(
searchCondition
.
getSubjectId
()))
{
return
Result
.
FAIL
(
"专题id/专题分类id不能为空"
);
}
if
(
searchCondition
.
getCategory
()
==
null
)
{
return
Result
.
FAIL
(
"专题类型不能为空"
);
}
UserVo
userVo
=
UserUtil
.
getLoginUser
();
return
informationService
.
subjectPageListGroupByLabel
(
userVo
,
searchCondition
);
}
...
...
src/main/java/com/zzsn/event/es/EsService.java
浏览文件 @
b3c4febe
...
...
@@ -1089,9 +1089,25 @@ public class EsService {
searchSourceBuilder
.
trackTotalHits
(
true
);
searchSourceBuilder
.
size
(
0
);
//创建查询对象
List
<
String
>
subjectIds
=
new
ArrayList
<>();
subjectIds
.
add
(
searchCondition
.
getSubjectId
());
BoolQueryBuilder
boolQuery
=
buildQuery
(
searchCondition
,
subjectIds
);
List
<
String
>
subjectIdList
=
new
ArrayList
<>();
//判断是否是专题
if
(
"1"
.
equals
(
searchCondition
.
getIsSubject
()))
{
if
(
StringUtils
.
isNotEmpty
(
searchCondition
.
getSubjectId
()))
{
subjectIdList
.
add
(
searchCondition
.
getSubjectId
());
}
}
else
{
//该id其实是专题类别id
//查询类别id的所有明细id
Integer
category
=
searchCondition
.
getCategory
();
String
subjectTypeId
=
searchCondition
.
getSubjectId
();
List
<
String
>
typeIds
=
subjectTypeService
.
belowIdList
(
subjectTypeId
,
category
);
if
(
category
==
1
)
{
subjectIdList
=
subjectTypeMapService
.
selectSubjectByTypeIds
(
typeIds
);
}
else
if
(
category
==
2
)
{
subjectIdList
=
subjectTypeMapService
.
selectEventByTypeIds
(
typeIds
);
}
}
BoolQueryBuilder
boolQuery
=
buildQuery
(
searchCondition
,
subjectIdList
);
searchSourceBuilder
.
query
(
boolQuery
);
searchRequest
.
source
(
searchSourceBuilder
);
try
{
...
...
@@ -1163,9 +1179,25 @@ public class EsService {
}
searchSourceBuilder
.
size
(
pageSize
);
searchSourceBuilder
.
from
((
pageNo
-
1
)
*
pageSize
);
List
<
String
>
subjectIds
=
new
ArrayList
<>();
subjectIds
.
add
(
searchCondition
.
getSubjectId
());
boolQuery
=
buildQuery
(
searchCondition
,
subjectIds
);
List
<
String
>
subjectIdList
=
new
ArrayList
<>();
//判断是否是专题
if
(
"1"
.
equals
(
searchCondition
.
getIsSubject
()))
{
if
(
StringUtils
.
isNotEmpty
(
searchCondition
.
getSubjectId
()))
{
subjectIdList
.
add
(
searchCondition
.
getSubjectId
());
}
}
else
{
//该id其实是专题类别id
//查询类别id的所有明细id
Integer
category
=
searchCondition
.
getCategory
();
String
subjectTypeId
=
searchCondition
.
getSubjectId
();
List
<
String
>
typeIds
=
subjectTypeService
.
belowIdList
(
subjectTypeId
,
category
);
if
(
category
==
1
)
{
subjectIdList
=
subjectTypeMapService
.
selectSubjectByTypeIds
(
typeIds
);
}
else
if
(
category
==
2
)
{
subjectIdList
=
subjectTypeMapService
.
selectEventByTypeIds
(
typeIds
);
}
}
boolQuery
=
buildQuery
(
searchCondition
,
subjectIdList
);
}
searchSourceBuilder
.
query
(
boolQuery
);
searchRequest
.
source
(
searchSourceBuilder
);
...
...
src/main/java/com/zzsn/event/exception/CustomExceptionHandler.java
0 → 100644
浏览文件 @
b3c4febe
package
com
.
zzsn
.
event
.
exception
;
import
com.zzsn.event.constant.Result
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
/**
* 异常拦截
*
* @author lkg
* @date 2025/2/28
*/
@RestControllerAdvice
public
class
CustomExceptionHandler
{
@ExceptionHandler
(
FileExportException
.
class
)
public
ResponseEntity
<
Object
>
handleFileExportException
(
FileExportException
ex
)
{
return
new
ResponseEntity
<>(
Result
.
FAIL
(
ex
.
getMessage
()),
HttpStatus
.
valueOf
(
ex
.
getStatusCode
()));
}
}
src/main/java/com/zzsn/event/exception/FileExportException.java
0 → 100644
浏览文件 @
b3c4febe
package
com
.
zzsn
.
event
.
exception
;
import
lombok.Data
;
/**
* 文件导出异常
*
* @author lkg
* @date 2025/2/28
*/
@Data
public
class
FileExportException
extends
RuntimeException
{
private
int
statusCode
=
500
;
public
FileExportException
(
String
message
)
{
super
(
message
);
}
}
src/main/java/com/zzsn/event/service/impl/InformationServiceImpl.java
浏览文件 @
b3c4febe
...
...
@@ -876,11 +876,13 @@ public class InformationServiceImpl implements InformationService {
}
for
(
SpecialInformation
specialInformation
:
informationList
)
{
List
<
Label
>
labels
=
specialInformation
.
getLabels
();
if
(
labels
.
size
()
==
1
)
{
List
<
Label
>
collect
=
labels
.
stream
().
filter
(
e
->
"thematic_information_column"
.
equals
(
e
.
getLabelMark
())).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
collect
))
{
if
(
collect
.
size
()
==
1
)
{
removeList
.
add
(
specialInformation
);
}
else
{
List
<
Label
>
newLabels
=
new
ArrayList
<>();
for
(
Label
label
:
labels
)
{
for
(
Label
label
:
collect
)
{
String
labelRelationId
=
label
.
getRelationId
();
if
(!
themeIds
.
contains
(
labelRelationId
))
{
newLabels
.
add
(
label
);
...
...
@@ -889,6 +891,9 @@ public class InformationServiceImpl implements InformationService {
specialInformation
.
setLabels
(
newLabels
);
dataList
.
add
(
specialInformation
);
}
}
else
{
removeList
.
add
(
specialInformation
);
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
removeList
))
{
...
...
src/main/java/com/zzsn/event/service/impl/SubjectSimpleServiceImpl.java
浏览文件 @
b3c4febe
...
...
@@ -80,7 +80,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
private
CodeGenerateUtil
codeGenerateUtil
;
@Autowired
private
PythonUtil
pythonUtil
;
@Autowired
@Autowired
(
required
=
false
)
private
RemoteModelService
remoteModelService
;
@Value
(
"${clb.subject.default.processing.advanceMonth}"
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论