Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
5e15cde4
提交
5e15cde4
authored
3月 28, 2025
作者:
obcy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【添加数据分页查询接口-数据处理使用】
上级
4f44a2a6
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
93 行增加
和
22 行删除
+93
-22
InformationController.java
...m/zzsn/event/controller/common/InformationController.java
+22
-2
EsService.java
src/main/java/com/zzsn/event/es/EsService.java
+12
-10
SubjectMapper.java
src/main/java/com/zzsn/event/mapper/SubjectMapper.java
+2
-0
SubjectMapper.xml
src/main/java/com/zzsn/event/mapper/xml/SubjectMapper.xml
+8
-0
InformationService.java
src/main/java/com/zzsn/event/service/InformationService.java
+9
-2
SubjectService.java
src/main/java/com/zzsn/event/service/SubjectService.java
+2
-0
InformationServiceImpl.java
...a/com/zzsn/event/service/impl/InformationServiceImpl.java
+33
-8
SubjectServiceImpl.java
.../java/com/zzsn/event/service/impl/SubjectServiceImpl.java
+5
-0
没有找到文件。
src/main/java/com/zzsn/event/controller/common/InformationController.java
浏览文件 @
5e15cde4
...
...
@@ -19,6 +19,7 @@ import com.zzsn.event.util.user.UserUtil;
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
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.jsoup.Jsoup
;
...
...
@@ -208,8 +209,27 @@ public class InformationController {
if
(
searchCondition
.
getCategory
()
==
null
)
{
return
Result
.
FAIL
(
"专题类型不能为空"
);
}
UserVo
userVo
=
UserUtil
.
getLoginUser
();
IPage
<
DisplayInfo
>
pageList
=
informationService
.
subjectPageList
(
userVo
,
searchCondition
);
IPage
<
DisplayInfo
>
pageList
=
informationService
.
subjectPageList
(
searchCondition
);
return
Result
.
OK
(
pageList
);
}
/**
* 事件对应专题库的资讯分页列表
*
* @param searchCondition 筛选条件
* @author lkg
* @date 2024/5/6
*/
@PostMapping
(
"/subjectPageListForDataDetail"
)
public
Result
<?>
subjectPageListForDataDetail
(
@RequestBody
InfoDataSearchCondition
searchCondition
)
{
if
(
StringUtils
.
isEmpty
(
searchCondition
.
getSubjectId
()))
{
return
Result
.
FAIL
(
"专题id/专题分类id不能为空"
);
}
if
(
searchCondition
.
getCategory
()
==
null
)
{
return
Result
.
FAIL
(
"专题类型不能为空"
);
}
//排除字段默认不排除
searchCondition
.
setExcludeFields
(
null
);
IPage
<
SpecialInformation
>
pageList
=
informationService
.
subjectPageListForDataDetail
(
searchCondition
);
return
Result
.
OK
(
pageList
);
}
...
...
src/main/java/com/zzsn/event/es/EsService.java
浏览文件 @
5e15cde4
...
...
@@ -739,8 +739,10 @@ public class EsService {
* @date 2024/5/6
*/
public
IPage
<
SpecialInformation
>
pageListByCondition
(
InfoDataSearchCondition
searchCondition
,
List
<
String
>
subjectIdList
)
throws
IOException
{
Subject
byId
=
subjectService
.
getById
(
searchCondition
.
getSubjectId
());
String
[]
indexs
=
EsIndexUtil
.
getIndexIntervalYear
(
Constants
.
SUBJECT_INDEX
,
byId
.
getCreateTime
());
String
minDate
=
subjectService
.
getMinCreateTime
(
subjectIdList
);
// Subject byId = subjectService(searchCondition.getSubjectId());
String
[]
indexs
=
EsIndexUtil
.
getIndexIntervalYearStr
(
Constants
.
SUBJECT_INDEX
,
minDate
);
SearchRequest
searchRequest
=
new
SearchRequest
(
indexs
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
//默认最大数量是10000,设置为true后,显示准确数量
...
...
@@ -822,8 +824,8 @@ public class EsService {
List
<
String
>
list
=
new
ArrayList
<>();
List
<
String
>
idList
=
Arrays
.
asList
(
ids
.
split
(
","
));
List
<
String
>
beInStorageList
=
idList
.
stream
().
map
(
uniqueCode
->
subjectId
+
uniqueCode
).
collect
(
Collectors
.
toList
());
S
ubject
byId
=
subjectService
.
getById
(
subjectId
);
String
[]
indexs
=
EsIndexUtil
.
getIndexIntervalYear
(
Constants
.
SUBJECT_INDEX
,
byId
.
getCreateTime
()
);
S
tring
minDate
=
subjectService
.
getMinCreateTime
(
Arrays
.
asList
(
subjectId
)
);
String
[]
indexs
=
EsIndexUtil
.
getIndexIntervalYear
Str
(
Constants
.
SUBJECT_INDEX
,
minDate
);
SearchRequest
searchRequest
=
new
SearchRequest
(
indexs
);
//创建查询对象
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
...
...
@@ -1071,8 +1073,8 @@ public class EsService {
//调用判重接口
public
boolean
duplicationByTitleOrSourceAddress
(
DisplayInfo
displayInfo
)
{
S
ubject
byId
=
subjectService
.
getById
(
displayInfo
.
getSubjectId
(
));
String
[]
indexs
=
EsIndexUtil
.
getIndexIntervalYear
(
Constants
.
SUBJECT_INDEX
,
byId
.
getCreateTime
()
);
S
tring
minDate
=
subjectService
.
getMinCreateTime
(
Arrays
.
asList
(
displayInfo
.
getSubjectId
()
));
String
[]
indexs
=
EsIndexUtil
.
getIndexIntervalYear
Str
(
Constants
.
SUBJECT_INDEX
,
minDate
);
SearchRequest
searchRequest
=
new
SearchRequest
(
indexs
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
...
...
@@ -1113,8 +1115,8 @@ public class EsService {
if
(
CollectionUtils
.
isNotEmpty
(
ids
))
{
count
=
ids
.
size
();
}
else
{
S
ubject
byId
=
subjectService
.
getById
(
searchCondition
.
getSubjectId
(
));
String
[]
indexs
=
EsIndexUtil
.
getIndexIntervalYear
(
Constants
.
SUBJECT_INDEX
,
byId
.
getCreateTime
()
);
S
tring
minDate
=
subjectService
.
getMinCreateTime
(
Arrays
.
asList
(
searchCondition
.
getSubjectId
()
));
String
[]
indexs
=
EsIndexUtil
.
getIndexIntervalYear
Str
(
Constants
.
SUBJECT_INDEX
,
minDate
);
SearchRequest
searchRequest
=
new
SearchRequest
(
indexs
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
//默认最大数量是10000,设置为true后,显示准确数量
...
...
@@ -1158,8 +1160,8 @@ public class EsService {
* @param searchCondition 查询条件封装
*/
public
List
<
SpecialInformation
>
informationList
(
InfoDataSearchCondition
searchCondition
)
{
S
ubject
byId
=
subjectService
.
getById
(
searchCondition
.
getSubjectId
(
));
String
[]
indexs
=
EsIndexUtil
.
getIndexIntervalYear
(
Constants
.
SUBJECT_INDEX
,
byId
.
getCreateTime
()
);
S
tring
minDate
=
subjectService
.
getMinCreateTime
(
Arrays
.
asList
(
searchCondition
.
getSubjectId
()
));
String
[]
indexs
=
EsIndexUtil
.
getIndexIntervalYear
Str
(
Constants
.
SUBJECT_INDEX
,
minDate
);
SearchRequest
searchRequest
=
new
SearchRequest
(
indexs
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
String
column
=
searchCondition
.
getColumn
();
...
...
src/main/java/com/zzsn/event/mapper/SubjectMapper.java
浏览文件 @
5e15cde4
...
...
@@ -121,4 +121,6 @@ public interface SubjectMapper extends BaseMapper<Subject> {
int
ynBelowExcludeGroup
(
@Param
(
"subjectId"
)
String
subjectId
,
@Param
(
"sourceId"
)
String
sourceId
);
List
<
String
>
getBindSubjectIds
(
@Param
(
"id"
)
String
id
);
String
getMinCreateTime
(
@Param
(
"subjectIdList"
)
List
<
String
>
subjectIdList
);
}
src/main/java/com/zzsn/event/mapper/xml/SubjectMapper.xml
浏览文件 @
5e15cde4
...
...
@@ -289,4 +289,12 @@
where subject_id = #{id}
and addition_type = 1
</select>
<select
id=
"getMinCreateTime"
resultType=
"java.lang.String"
>
SELECT MIN(create_time) FROM `subject` WHERE 1=1
<if
test=
"subjectIdList != null"
>
<foreach
collection=
"subjectIdList"
item=
"item"
open=
"and id in ("
close=
")"
separator=
","
>
#{item}
</foreach>
</if>
</select>
</mapper>
src/main/java/com/zzsn/event/service/InformationService.java
浏览文件 @
5e15cde4
...
...
@@ -33,12 +33,19 @@ public interface InformationService {
/**
* 专题库资讯分页列表
*
* @param userVo 用户信息
* @param subjectInfo 筛选条件
* @author lkg
* @date 2024/5/6
*/
IPage
<
DisplayInfo
>
subjectPageList
(
UserVo
userVo
,
InfoDataSearchCondition
subjectInfo
);
IPage
<
DisplayInfo
>
subjectPageList
(
InfoDataSearchCondition
subjectInfo
);
/**
* 专题库资讯分页列表
*
* @param subjectInfo 筛选条件
* @author lkg
* @date 2024/5/6
*/
IPage
<
SpecialInformation
>
subjectPageListForDataDetail
(
InfoDataSearchCondition
subjectInfo
);
/**
* 资讯分页列表(根据标签分类分组)
*/
...
...
src/main/java/com/zzsn/event/service/SubjectService.java
浏览文件 @
5e15cde4
...
...
@@ -200,4 +200,6 @@ public interface SubjectService extends IService<Subject> {
Result
<?>
infoSourceBindNew
(
SubjectPage
subjectPage
);
void
deleteBindNew
(
SubjectPage
subjectPage
);
String
getMinCreateTime
(
List
<
String
>
subjectIdList
);
}
src/main/java/com/zzsn/event/service/impl/InformationServiceImpl.java
浏览文件 @
5e15cde4
...
...
@@ -99,7 +99,7 @@ public class InformationServiceImpl implements InformationService {
}
@Override
public
IPage
<
DisplayInfo
>
subjectPageList
(
UserVo
userVo
,
InfoDataSearchCondition
searchCondition
)
{
public
IPage
<
DisplayInfo
>
subjectPageList
(
InfoDataSearchCondition
searchCondition
)
{
IPage
<
DisplayInfo
>
page
=
new
Page
<>(
searchCondition
.
getPageNo
(),
searchCondition
.
getPageSize
());
Integer
category
=
searchCondition
.
getCategory
();
List
<
String
>
subjectIdList
=
new
ArrayList
<>();
...
...
@@ -134,13 +134,6 @@ public class InformationServiceImpl implements InformationService {
DisplayInfo
info
=
new
DisplayInfo
();
BeanUtils
.
copyProperties
(
specialInformation
,
info
);
info
.
setPublishDate
(
EsDateUtil
.
esFieldDateMapping
(
info
.
getPublishDate
()));
/*LambdaQueryWrapper<CollectionMap> query = Wrappers.lambdaQuery();
query.eq(CollectionMap::getUserId, userVo.getId());
query.eq(CollectionMap::getArticleId, info.getId());
int count = collectionMapService.count(query);
if (count > 0) {
info.setYnCollect(true);
}*/
//标签处理
List
<
LabelModelVo
>
modelVoList
=
modelMap
.
get
(
info
.
getSubjectId
());
formatLabel
(
modelVoList
,
info
);
...
...
@@ -155,6 +148,38 @@ public class InformationServiceImpl implements InformationService {
return
page
;
}
@Override
public
IPage
<
SpecialInformation
>
subjectPageListForDataDetail
(
InfoDataSearchCondition
searchCondition
)
{
IPage
<
SpecialInformation
>
page
=
new
Page
<>(
searchCondition
.
getPageNo
(),
searchCondition
.
getPageSize
());
Integer
category
=
searchCondition
.
getCategory
();
List
<
String
>
subjectIdList
=
new
ArrayList
<>();
//判断是否是专题
if
(
"1"
.
equals
(
searchCondition
.
getIsSubject
()))
{
if
(
StringUtils
.
isNotEmpty
(
searchCondition
.
getSubjectId
()))
{
subjectIdList
.
add
(
searchCondition
.
getSubjectId
());
}
}
else
{
//该id其实是专题类别id
//查询类别id的所有明细id
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
);
}
}
if
(
CollectionUtils
.
isEmpty
(
subjectIdList
))
{
return
page
;
}
try
{
return
esService
.
pageListByCondition
(
searchCondition
,
subjectIdList
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
page
;
}
@Autowired
private
SubjectMapper
subjectMapper
;
...
...
src/main/java/com/zzsn/event/service/impl/SubjectServiceImpl.java
浏览文件 @
5e15cde4
...
...
@@ -899,6 +899,11 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
configurationMessageService
.
bindInfoSourceSend
(
subjectPage
.
getId
());
}
@Override
public
String
getMinCreateTime
(
List
<
String
>
subjectIdList
)
{
return
baseMapper
.
getMinCreateTime
(
subjectIdList
);
}
private
void
unBindInfoSourceGroup
(
SubjectPage
subjectPage
)
{
String
sourceBindType
=
subjectPage
.
getSourceBindType
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论