Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
5b84ca14
提交
5b84ca14
authored
4月 01, 2025
作者:
925993793@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【fix】专题绑定标签字段替换;文件导入优化,表头顺序可不一致
上级
33cf89ef
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
92 行增加
和
38 行删除
+92
-38
FileController.java
src/main/java/com/zzsn/event/controller/FileController.java
+16
-10
InformationController.java
...m/zzsn/event/controller/common/InformationController.java
+1
-1
RelationBindController.java
.../zzsn/event/controller/common/RelationBindController.java
+1
-1
SysDictItem.java
src/main/java/com/zzsn/event/entity/SysDictItem.java
+7
-0
SubjectDictMapMapper.java
...main/java/com/zzsn/event/mapper/SubjectDictMapMapper.java
+2
-1
SubjectDictMapMapper.xml
...n/java/com/zzsn/event/mapper/xml/SubjectDictMapMapper.xml
+2
-2
InformationService.java
src/main/java/com/zzsn/event/service/InformationService.java
+2
-2
SubjectDictMapService.java
...in/java/com/zzsn/event/service/SubjectDictMapService.java
+2
-1
InformationServiceImpl.java
...a/com/zzsn/event/service/impl/InformationServiceImpl.java
+19
-19
SubjectDictMapServiceImpl.java
...om/zzsn/event/service/impl/SubjectDictMapServiceImpl.java
+2
-1
DictVO.java
src/main/java/com/zzsn/event/vo/DictVO.java
+17
-0
FileDataVO.java
src/main/java/com/zzsn/event/vo/FileDataVO.java
+21
-0
没有找到文件。
src/main/java/com/zzsn/event/controller/FileController.java
浏览文件 @
5b84ca14
package
com
.
zzsn
.
event
.
controller
;
package
com
.
zzsn
.
event
.
controller
;
import
cn.hutool.poi.excel.ExcelReader
;
import
cn.hutool.poi.excel.ExcelUtil
;
import
com.aspose.words.Document
;
import
com.aspose.words.Document
;
import
com.aspose.words.SaveFormat
;
import
com.aspose.words.SaveFormat
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
...
@@ -14,6 +16,7 @@ import com.zzsn.event.service.*;
...
@@ -14,6 +16,7 @@ import com.zzsn.event.service.*;
import
com.zzsn.event.util.*
;
import
com.zzsn.event.util.*
;
import
com.zzsn.event.util.user.UserUtil
;
import
com.zzsn.event.util.user.UserUtil
;
import
com.zzsn.event.util.user.UserVo
;
import
com.zzsn.event.util.user.UserVo
;
import
com.zzsn.event.vo.FileDataVO
;
import
com.zzsn.event.vo.InfoDataSearchCondition
;
import
com.zzsn.event.vo.InfoDataSearchCondition
;
import
com.zzsn.event.vo.LabelModelVo
;
import
com.zzsn.event.vo.LabelModelVo
;
import
com.zzsn.event.vo.es.AttachmentInfo
;
import
com.zzsn.event.vo.es.AttachmentInfo
;
...
@@ -321,20 +324,23 @@ public class FileController {
...
@@ -321,20 +324,23 @@ public class FileController {
if
(
"xls"
.
equals
(
fileSuffix
)
||
"xlsx"
.
equals
(
fileSuffix
))
{
if
(
"xls"
.
equals
(
fileSuffix
)
||
"xlsx"
.
equals
(
fileSuffix
))
{
CompletableFuture
.
runAsync
(()
->
{
CompletableFuture
.
runAsync
(()
->
{
try
{
try
{
byte
[]
fileData
=
multipartFile
.
getBytes
();
ExcelReader
reader
=
ExcelUtil
.
getReader
(
multipartFile
.
getInputStream
());
//读取文件内容
Map
<
String
,
String
>
header
=
new
HashMap
<>();
List
<
List
<
String
>>
lists
;
header
.
put
(
"标题"
,
"title"
);
if
(
"xls"
.
equals
(
fileSuffix
))
{
header
.
put
(
"作者"
,
"author"
);
lists
=
ExcelExportUtil
.
readExcelXls
(
new
ByteArrayInputStream
(
fileData
),
true
,
1
,
7
);
header
.
put
(
"来源"
,
"origin"
);
}
else
{
header
.
put
(
"资讯类型"
,
"classificationType"
);
lists
=
ExcelExportUtil
.
readExcelXlsx
(
new
ByteArrayInputStream
(
fileData
),
true
,
1
,
7
);
header
.
put
(
"原文链接"
,
"sourceAddress"
);
}
header
.
put
(
"发布时间"
,
"publishDate"
);
informationService
.
importDataInfo
(
lists
,
subjectId
);
header
.
put
(
"正文内容"
,
"content"
);
reader
.
setHeaderAlias
(
header
);
List
<
FileDataVO
>
informationList
=
reader
.
read
(
0
,
1
,
FileDataVO
.
class
);
informationService
.
importDataInfo
(
informationList
,
subjectId
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
});
});
return
Result
.
OK
(
"
正在进行处理
"
);
return
Result
.
OK
(
"
数据正在处理,请稍后查看
"
);
}
else
{
}
else
{
return
Result
.
FAIL
(
500
,
"不支持的文件类型"
);
return
Result
.
FAIL
(
500
,
"不支持的文件类型"
);
}
}
...
...
src/main/java/com/zzsn/event/controller/common/InformationController.java
浏览文件 @
5b84ca14
...
@@ -356,7 +356,7 @@ public class InformationController {
...
@@ -356,7 +356,7 @@ public class InformationController {
*/
*/
@PostMapping
(
value
=
"/modifyLabel"
)
@PostMapping
(
value
=
"/modifyLabel"
)
public
Result
<?>
modifyLabel
(
@RequestBody
DataBindLabelFrom
bindLabelFrom
)
{
public
Result
<?>
modifyLabel
(
@RequestBody
DataBindLabelFrom
bindLabelFrom
)
{
List
<
Node
>
nodes
=
subjectDictMapService
.
boundList
(
bindLabelFrom
.
getSubjectId
());
List
<
DictVO
>
nodes
=
subjectDictMapService
.
boundList
(
bindLabelFrom
.
getSubjectId
());
informationService
.
modifyLabel
(
bindLabelFrom
,
nodes
);
informationService
.
modifyLabel
(
bindLabelFrom
,
nodes
);
return
Result
.
OK
();
return
Result
.
OK
();
}
}
...
...
src/main/java/com/zzsn/event/controller/common/RelationBindController.java
浏览文件 @
5b84ca14
...
@@ -292,7 +292,7 @@ public class RelationBindController {
...
@@ -292,7 +292,7 @@ public class RelationBindController {
*/
*/
@GetMapping
(
"/boundLabelList"
)
@GetMapping
(
"/boundLabelList"
)
public
Result
<?>
boundLabelList
(
@RequestParam
String
subjectId
){
public
Result
<?>
boundLabelList
(
@RequestParam
String
subjectId
){
List
<
Node
>
boundList
=
subjectDictMapService
.
boundList
(
subjectId
);
List
<
DictVO
>
boundList
=
subjectDictMapService
.
boundList
(
subjectId
);
return
Result
.
OK
(
boundList
);
return
Result
.
OK
(
boundList
);
}
}
}
}
src/main/java/com/zzsn/event/entity/SysDictItem.java
浏览文件 @
5b84ca14
package
com
.
zzsn
.
event
.
entity
;
package
com
.
zzsn
.
event
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -99,4 +100,10 @@ public class SysDictItem implements Serializable {
...
@@ -99,4 +100,10 @@ public class SysDictItem implements Serializable {
*/
*/
private
Integer
level
;
private
Integer
level
;
/**
* 字典编码
*/
@TableField
(
exist
=
false
)
private
String
dictCode
;
}
}
src/main/java/com/zzsn/event/mapper/SubjectDictMapMapper.java
浏览文件 @
5b84ca14
...
@@ -3,6 +3,7 @@ package com.zzsn.event.mapper;
...
@@ -3,6 +3,7 @@ package com.zzsn.event.mapper;
import
com.zzsn.event.entity.SubjectDictMap
;
import
com.zzsn.event.entity.SubjectDictMap
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.zzsn.event.util.tree.Node
;
import
com.zzsn.event.util.tree.Node
;
import
com.zzsn.event.vo.DictVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -24,7 +25,7 @@ public interface SubjectDictMapMapper extends BaseMapper<SubjectDictMap> {
...
@@ -24,7 +25,7 @@ public interface SubjectDictMapMapper extends BaseMapper<SubjectDictMap> {
* @author lkg
* @author lkg
* @date 2025/3/28
* @date 2025/3/28
*/
*/
List
<
Node
>
boundList
(
@Param
(
"subjectId"
)
String
subjectId
);
List
<
DictVO
>
boundList
(
@Param
(
"subjectId"
)
String
subjectId
);
}
}
...
...
src/main/java/com/zzsn/event/mapper/xml/SubjectDictMapMapper.xml
浏览文件 @
5b84ca14
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
</resultMap>
<select
id=
"boundList"
resultType=
"com.zzsn.event.
util.tree.Node
"
>
<select
id=
"boundList"
resultType=
"com.zzsn.event.
vo.DictVO
"
>
select d.id,d.dict_name as name from subject_dict_map m
select d.id,d.dict_
code as code,d.dict_
name as name from subject_dict_map m
inner join clb_system.sys_dict d on m.dict_id = d.id
inner join clb_system.sys_dict d on m.dict_id = d.id
where m.subject_id = #{subjectId}
where m.subject_id = #{subjectId}
</select>
</select>
...
...
src/main/java/com/zzsn/event/service/InformationService.java
浏览文件 @
5b84ca14
...
@@ -131,7 +131,7 @@ public interface InformationService {
...
@@ -131,7 +131,7 @@ public interface InformationService {
* @author lkg
* @author lkg
* @date 2025/3/31
* @date 2025/3/31
*/
*/
void
modifyLabel
(
DataBindLabelFrom
dataBindLabelFrom
,
List
<
Node
>
boundList
);
void
modifyLabel
(
DataBindLabelFrom
dataBindLabelFrom
,
List
<
DictVO
>
boundList
);
/**
/**
* 审核
* 审核
...
@@ -217,7 +217,7 @@ public interface InformationService {
...
@@ -217,7 +217,7 @@ public interface InformationService {
* @author lkg
* @author lkg
* @date 2025/2/5
* @date 2025/2/5
*/
*/
void
importDataInfo
(
List
<
List
<
String
>
>
lists
,
String
subjectId
);
void
importDataInfo
(
List
<
FileDataVO
>
lists
,
String
subjectId
);
/**
/**
* 移除专题下的数据-研究中心
* 移除专题下的数据-研究中心
...
...
src/main/java/com/zzsn/event/service/SubjectDictMapService.java
浏览文件 @
5b84ca14
...
@@ -3,6 +3,7 @@ package com.zzsn.event.service;
...
@@ -3,6 +3,7 @@ package com.zzsn.event.service;
import
com.zzsn.event.entity.SubjectDictMap
;
import
com.zzsn.event.entity.SubjectDictMap
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.zzsn.event.util.tree.Node
;
import
com.zzsn.event.util.tree.Node
;
import
com.zzsn.event.vo.DictVO
;
import
com.zzsn.event.vo.SubjectBindLabelParam
;
import
com.zzsn.event.vo.SubjectBindLabelParam
;
import
java.util.List
;
import
java.util.List
;
...
@@ -30,5 +31,5 @@ public interface SubjectDictMapService extends IService<SubjectDictMap> {
...
@@ -30,5 +31,5 @@ public interface SubjectDictMapService extends IService<SubjectDictMap> {
* @author lkg
* @author lkg
* @date 2025/3/28
* @date 2025/3/28
*/
*/
List
<
Node
>
boundList
(
String
subjectId
);
List
<
DictVO
>
boundList
(
String
subjectId
);
}
}
src/main/java/com/zzsn/event/service/impl/InformationServiceImpl.java
浏览文件 @
5b84ca14
...
@@ -610,7 +610,7 @@ public class InformationServiceImpl implements InformationService {
...
@@ -610,7 +610,7 @@ public class InformationServiceImpl implements InformationService {
}
}
@Override
@Override
public
void
modifyLabel
(
DataBindLabelFrom
dataBindLabelFrom
,
List
<
Node
>
boundList
)
{
public
void
modifyLabel
(
DataBindLabelFrom
dataBindLabelFrom
,
List
<
DictVO
>
boundList
)
{
DisplayInfo
info
=
(
DisplayInfo
)
esOpUtil
.
getInfoById
(
dataBindLabelFrom
.
getIndex
(),
dataBindLabelFrom
.
getId
(),
DisplayInfo
.
class
);
DisplayInfo
info
=
(
DisplayInfo
)
esOpUtil
.
getInfoById
(
dataBindLabelFrom
.
getIndex
(),
dataBindLabelFrom
.
getId
(),
DisplayInfo
.
class
);
if
(
info
!=
null
)
{
if
(
info
!=
null
)
{
List
<
Label
>
newLabels
=
new
ArrayList
<>();
List
<
Label
>
newLabels
=
new
ArrayList
<>();
...
@@ -618,7 +618,7 @@ public class InformationServiceImpl implements InformationService {
...
@@ -618,7 +618,7 @@ public class InformationServiceImpl implements InformationService {
for
(
SysDictItem
sysDictItem
:
dictItemList
)
{
for
(
SysDictItem
sysDictItem
:
dictItemList
)
{
Label
label
=
new
Label
();
Label
label
=
new
Label
();
label
.
setRelationId
(
sysDictItem
.
getId
());
label
.
setRelationId
(
sysDictItem
.
getId
());
label
.
setLabelMark
(
sysDictItem
.
getDict
Id
());
label
.
setLabelMark
(
sysDictItem
.
getDict
Code
());
label
.
setRelationName
(
sysDictItem
.
getItemText
());
label
.
setRelationName
(
sysDictItem
.
getItemText
());
newLabels
.
add
(
label
);
newLabels
.
add
(
label
);
}
}
...
@@ -937,25 +937,25 @@ public class InformationServiceImpl implements InformationService {
...
@@ -937,25 +937,25 @@ public class InformationServiceImpl implements InformationService {
}
}
@Override
@Override
public
void
importDataInfo
(
List
<
List
<
String
>
>
lists
,
String
subjectId
)
{
public
void
importDataInfo
(
List
<
FileDataVO
>
lists
,
String
subjectId
)
{
if
(
CollectionUtil
.
isNotEmpty
(
lists
))
{
if
(
CollectionUtil
.
isNotEmpty
(
lists
))
{
String
index
=
Constants
.
SUBJECT_INDEX
+
"_"
+
DateUtils
.
getYear
();
String
index
=
Constants
.
SUBJECT_INDEX
+
"_"
+
DateUtils
.
getYear
();
List
<
SpecialInformation
>
dataList
=
new
ArrayList
<>();
List
<
SpecialInformation
>
dataList
=
new
ArrayList
<>();
for
(
List
<
String
>
info
:
lists
)
{
for
(
FileDataVO
info
:
lists
)
{
SpecialInformation
specialInformation
=
new
SpecialInformation
();
SpecialInformation
specialInformation
=
new
SpecialInformation
();
specialInformation
.
setId
(
codeGenerateUtil
.
geneIdNo
(
Constants
.
DATA_ADD_ID
,
8
));
specialInformation
.
setId
(
codeGenerateUtil
.
geneIdNo
(
Constants
.
DATA_ADD_ID
,
8
));
if
(
StringUtils
.
isNotEmpty
(
info
.
get
(
0
)))
{
if
(
StringUtils
.
isNotEmpty
(
info
.
get
Title
(
)))
{
specialInformation
.
setTitle
(
info
.
get
(
0
));
specialInformation
.
setTitle
(
info
.
get
Title
(
));
}
}
if
(
StringUtils
.
isNotEmpty
(
info
.
get
(
1
)))
{
if
(
StringUtils
.
isNotEmpty
(
info
.
get
Author
(
)))
{
specialInformation
.
setAuthor
(
info
.
get
(
1
));
specialInformation
.
setAuthor
(
info
.
get
Author
(
));
}
}
if
(
StringUtils
.
isNotEmpty
(
info
.
get
(
2
)))
{
if
(
StringUtils
.
isNotEmpty
(
info
.
get
Origin
(
)))
{
specialInformation
.
setOrigin
(
info
.
get
(
2
));
specialInformation
.
setOrigin
(
info
.
get
Origin
(
));
specialInformation
.
setSid
(
info
.
get
(
2
));
specialInformation
.
setSid
(
info
.
get
Origin
(
));
}
}
if
(
StringUtils
.
isNotEmpty
(
info
.
get
(
3
)))
{
String
library
=
info
.
getClassificationType
();
String
library
=
info
.
get
(
3
);
if
(
StringUtils
.
isNotEmpty
(
library
))
{
SysDictItem
dictItem
=
sysDictItemService
.
dictItemInfoByName
(
"Thematic_Library"
,
library
);
SysDictItem
dictItem
=
sysDictItemService
.
dictItemInfoByName
(
"Thematic_Library"
,
library
);
if
(
dictItem
!=
null
)
{
if
(
dictItem
!=
null
)
{
specialInformation
.
setClassificationType
(
Integer
.
parseInt
(
dictItem
.
getItemValue
()));
specialInformation
.
setClassificationType
(
Integer
.
parseInt
(
dictItem
.
getItemValue
()));
...
@@ -965,14 +965,14 @@ public class InformationServiceImpl implements InformationService {
...
@@ -965,14 +965,14 @@ public class InformationServiceImpl implements InformationService {
}
else
{
}
else
{
specialInformation
.
setClassificationType
(
0
);
specialInformation
.
setClassificationType
(
0
);
}
}
if
(
StringUtils
.
isNotEmpty
(
info
.
get
(
4
)))
{
if
(
StringUtils
.
isNotEmpty
(
info
.
get
SourceAddress
(
)))
{
specialInformation
.
setSourceAddress
(
info
.
get
(
4
));
specialInformation
.
setSourceAddress
(
info
.
get
SourceAddress
(
));
}
}
if
(
StringUtils
.
isNotEmpty
(
info
.
get
(
5
)))
{
if
(
StringUtils
.
isNotEmpty
(
info
.
get
PublishDate
(
)))
{
specialInformation
.
setPublishDate
(
EsDateUtil
.
esFieldDateFormat
(
info
.
get
(
5
)));
specialInformation
.
setPublishDate
(
EsDateUtil
.
esFieldDateFormat
(
info
.
get
PublishDate
(
)));
}
}
if
(
StringUtils
.
isNotEmpty
(
info
.
get
(
6
)))
{
if
(
StringUtils
.
isNotEmpty
(
info
.
get
Content
(
)))
{
specialInformation
.
setContent
(
info
.
get
(
6
));
specialInformation
.
setContent
(
info
.
get
Content
(
));
}
}
specialInformation
.
setCheckStatus
(
1
);
specialInformation
.
setCheckStatus
(
1
);
specialInformation
.
setDeleteFlag
(
0
);
specialInformation
.
setDeleteFlag
(
0
);
...
...
src/main/java/com/zzsn/event/service/impl/SubjectDictMapServiceImpl.java
浏览文件 @
5b84ca14
...
@@ -7,6 +7,7 @@ import com.zzsn.event.entity.SubjectDictMap;
...
@@ -7,6 +7,7 @@ import com.zzsn.event.entity.SubjectDictMap;
import
com.zzsn.event.service.SubjectDictMapService
;
import
com.zzsn.event.service.SubjectDictMapService
;
import
com.zzsn.event.mapper.SubjectDictMapMapper
;
import
com.zzsn.event.mapper.SubjectDictMapMapper
;
import
com.zzsn.event.util.tree.Node
;
import
com.zzsn.event.util.tree.Node
;
import
com.zzsn.event.vo.DictVO
;
import
com.zzsn.event.vo.SubjectBindLabelParam
;
import
com.zzsn.event.vo.SubjectBindLabelParam
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -42,7 +43,7 @@ public class SubjectDictMapServiceImpl extends ServiceImpl<SubjectDictMapMapper,
...
@@ -42,7 +43,7 @@ public class SubjectDictMapServiceImpl extends ServiceImpl<SubjectDictMapMapper,
}
}
@Override
@Override
public
List
<
Node
>
boundList
(
String
subjectId
)
{
public
List
<
DictVO
>
boundList
(
String
subjectId
)
{
return
baseMapper
.
boundList
(
subjectId
);
return
baseMapper
.
boundList
(
subjectId
);
}
}
}
}
...
...
src/main/java/com/zzsn/event/vo/DictVO.java
0 → 100644
浏览文件 @
5b84ca14
package
com
.
zzsn
.
event
.
vo
;
import
lombok.Data
;
/**
*
*
* @author lkg
* @date 2025/4/1
*/
@Data
public
class
DictVO
{
private
String
id
;
private
String
code
;
private
String
name
;
}
src/main/java/com/zzsn/event/vo/FileDataVO.java
0 → 100644
浏览文件 @
5b84ca14
package
com
.
zzsn
.
event
.
vo
;
import
lombok.Data
;
/**
*
*
* @author lkg
* @date 2025/4/1
*/
@Data
public
class
FileDataVO
{
private
String
title
;
private
String
content
;
private
String
author
;
private
String
origin
;
private
String
sourceAddress
;
private
String
classificationType
;
private
String
publishDate
;
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论