Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
64a6b75a
提交
64a6b75a
authored
9月 15, 2025
作者:
925993793@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
自定义专题数量统计接口逻辑优化
上级
1373ada7
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
112 行增加
和
18 行删除
+112
-18
SubjectManageController.java
...va/com/zzsn/event/controller/SubjectManageController.java
+7
-6
CommonMapper.java
src/main/java/com/zzsn/event/mapper/CommonMapper.java
+1
-0
SubjectAdditionMapper.java
...ain/java/com/zzsn/event/mapper/SubjectAdditionMapper.java
+1
-0
CommonMapper.xml
src/main/java/com/zzsn/event/mapper/xml/CommonMapper.xml
+29
-0
SubjectAdditionMapper.xml
.../java/com/zzsn/event/mapper/xml/SubjectAdditionMapper.xml
+26
-0
CommonService.java
src/main/java/com/zzsn/event/service/CommonService.java
+7
-0
SubjectService.java
src/main/java/com/zzsn/event/service/SubjectService.java
+2
-1
CommonServiceImpl.java
...n/java/com/zzsn/event/service/impl/CommonServiceImpl.java
+11
-0
ConfigurationMessageService.java
.../zzsn/event/service/impl/ConfigurationMessageService.java
+12
-4
SubjectServiceImpl.java
.../java/com/zzsn/event/service/impl/SubjectServiceImpl.java
+7
-2
SubjectStatisticTask.java
src/main/java/com/zzsn/event/task/SubjectStatisticTask.java
+9
-5
没有找到文件。
src/main/java/com/zzsn/event/controller/SubjectManageController.java
浏览文件 @
64a6b75a
...
...
@@ -267,10 +267,7 @@ public class SubjectManageController {
*/
@GetMapping
(
value
=
"/statisticInfo"
)
private
Result
<?>
statisticInfo
(
@RequestParam
List
<
String
>
subjectIds
)
{
if
(
yjzxEnable
){
return
Result
.
OK
(
new
ArrayList
<>());
}
List
<
SubjectStatisticInfo
>
statisticInfoList
=
subjectService
.
statisticInfo
(
subjectIds
);
List
<
SubjectStatisticInfo
>
statisticInfoList
=
subjectService
.
statisticInfo
(
subjectIds
,
yjzxEnable
);
//异步更新专题统计信息表的数据
CompletableFuture
.
runAsync
(()
->
{
if
(
CollectionUtils
.
isNotEmpty
(
statisticInfoList
))
{
...
...
@@ -1277,8 +1274,9 @@ public class SubjectManageController {
List
<
String
>
infoSourceIds
=
new
ArrayList
<>();
for
(
SubjectBindSourceVO
subjectBindSourceVO
:
subjectBindSourceVOS
)
{
infoSourceIds
.
add
(
subjectBindSourceVO
.
getWebSiteId
());
//信息源下栏目id集合
List
<
String
>
infoColumnIds
=
subjectBindSourceVO
.
getColumnIds
();
if
(
CollectionUtils
.
isEmpty
(
infoColumnIds
))
{
if
(
CollectionUtils
.
isEmpty
(
infoColumnIds
))
{
//为空,则全选
String
response
=
remoteGetColumnList
(
subjectBindSourceVO
.
getWebSiteId
(),
null
,
null
,
1
,
1000
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
response
);
if
(
jsonObject
.
getInteger
(
"code"
)
==
200
)
{
...
...
@@ -1315,11 +1313,14 @@ public class SubjectManageController {
subjectInfoSourceMiddleMapService
.
saveBatch
(
dataList
);
}
//专题栏目关系绑定
List
<
SubjectInfoSourceMap
>
list
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
columnIds
))
{
LambdaQueryWrapper
<
SubjectInfoSourceMap
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
eq
(
SubjectInfoSourceMap:
:
getSubjectId
,
subjectId
)
.
in
(
SubjectInfoSourceMap:
:
getSourceId
,
columnIds
)
.
eq
(
SubjectInfoSourceMap:
:
getType
,
1
);
List
<
SubjectInfoSourceMap
>
list
=
subjectInfoSourceMapService
.
list
(
queryWrapper
);
list
=
subjectInfoSourceMapService
.
list
(
queryWrapper
);
}
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
List
<
String
>
existSourceIdList
=
list
.
stream
().
map
(
SubjectInfoSourceMap:
:
getSourceId
).
collect
(
Collectors
.
toList
());
columnIds
.
removeAll
(
existSourceIdList
);
...
...
src/main/java/com/zzsn/event/mapper/CommonMapper.java
浏览文件 @
64a6b75a
...
...
@@ -104,6 +104,7 @@ public interface CommonMapper {
List
<
LabelItemMapVO
>
infoSourceLabelsBySidList
(
@Param
(
"sidList"
)
List
<
String
>
sidList
);
List
<
SubjectSourceVO
>
bindSourceCount
(
@Param
(
"subjectIds"
)
List
<
String
>
subjectIds
);
List
<
SubjectSourceVO
>
bindSourceCountYjzx
(
@Param
(
"subjectIds"
)
List
<
String
>
subjectIds
);
List
<
SysDict
>
selectOldLabelTypeList
();
...
...
src/main/java/com/zzsn/event/mapper/SubjectAdditionMapper.java
浏览文件 @
64a6b75a
...
...
@@ -30,4 +30,5 @@ public interface SubjectAdditionMapper extends BaseMapper<SubjectAddition> {
int
count
(
String
subjectId
,
int
type
);
List
<
String
>
getSubjectBindInfoSourceIds
(
@Param
(
"subjectId"
)
String
subjectId
);
List
<
String
>
getSubjectBindInfoSourceIdsYjzx
(
@Param
(
"subjectId"
)
String
subjectId
);
}
src/main/java/com/zzsn/event/mapper/xml/CommonMapper.xml
浏览文件 @
64a6b75a
...
...
@@ -342,6 +342,35 @@
where b.source_id is null and x.id is not null group by a.subject_id
</select>
<select
id=
"bindSourceCountYjzx"
resultType=
"com.zzsn.event.vo.SubjectSourceVO"
>
select a.subject_id,count(*) count from
(select distinct x.source_id,x.subject_id from (
select sm.source_id,sm.subject_id from subject_info_source_map sm where sm.type = 1
<if
test=
"subjectIds != null and subjectIds.size() > 0"
>
and sm.subject_id in
<foreach
collection=
"subjectIds"
item=
"item"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</if>
union
select isoo.id as source_id,smm.subject_id
FROM
subject_info_source_map smm
INNER JOIN clb_label_main_source_map lam ON smm.source_id = lam.label_code
AND smm.source_item_id = lam.label_item_code
INNER JOIN info_source_main im ON lam.entity_code = im.id
INNER JOIN info_source isoo ON im.id = isoo.info_source_id
WHERE
smm.type = 312
<if
test=
"subjectIds != null and subjectIds.size() > 0"
>
and smm.subject_id in
<foreach
collection=
"subjectIds"
item=
"item"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</if>
) x) a group by a.subject_id
</select>
<select
id=
"selectOldLabelTypeList"
resultType=
"com.zzsn.event.feign.entity.SysDict"
>
select id,if(pid='0','1',pid) parentId,label_name dictName,has_child hasChild,if(has_child=0,'1',null) isDict from sys_base_label_type
where id not IN ('1602218529184993281','1602220733056864258') and category = 0
...
...
src/main/java/com/zzsn/event/mapper/xml/SubjectAdditionMapper.xml
浏览文件 @
64a6b75a
...
...
@@ -378,4 +378,30 @@
) y
)
</select>
<select
id=
"getSubjectBindInfoSourceIdsYjzx"
resultType=
"java.lang.String"
>
SELECT
distinct x.id
FROM
(
SELECT
iso.id
FROM
subject_info_source_map sm
INNER JOIN info_source iso ON sm.source_id = iso.id
WHERE
sm.type = 1
AND sm.subject_id = #{subjectId} UNION
SELECT
isoo.id
FROM
subject_info_source_map smm
INNER JOIN clb_label_main_source_map lam ON smm.source_id = lam.label_code
AND smm.source_item_id = lam.label_item_code
INNER JOIN info_source_main im ON lam.entity_code = im.id
INNER JOIN info_source isoo ON im.id = isoo.info_source_id
WHERE
smm.type = 312
AND smm.subject_id = #{subjectId}
) x
</select>
</mapper>
src/main/java/com/zzsn/event/service/CommonService.java
浏览文件 @
64a6b75a
...
...
@@ -117,6 +117,13 @@ public interface CommonService {
*/
Map
<
String
,
Integer
>
bindSourceCount
(
List
<
String
>
subjectIds
);
/**
* 按专题分组查询绑定信息源数量(研究中心环境)
* @param subjectIds 专题id列表
* @return
*/
Map
<
String
,
Integer
>
bindSourceCountYjzx
(
List
<
String
>
subjectIds
);
List
<
SysDict
>
selectOldLabelTypeList
();
List
<
SysDict
>
selectLeaderTypeList
();
...
...
src/main/java/com/zzsn/event/service/SubjectService.java
浏览文件 @
64a6b75a
...
...
@@ -46,10 +46,11 @@ public interface SubjectService extends IService<Subject> {
* 专题统计信息
*
* @param subjectIds 专题id集合
* @param yjzxEnable 是否研究中心环境
* @author lkg
* @date 2024/12/18
*/
List
<
SubjectStatisticInfo
>
statisticInfo
(
List
<
String
>
subjectIds
);
List
<
SubjectStatisticInfo
>
statisticInfo
(
List
<
String
>
subjectIds
,
boolean
yjzxEnable
);
/**
* 专题详情(包含专题分类、专题项目)
...
...
src/main/java/com/zzsn/event/service/impl/CommonServiceImpl.java
浏览文件 @
64a6b75a
...
...
@@ -381,6 +381,17 @@ public class CommonServiceImpl implements CommonService {
}
return
map
;
}
@Override
public
Map
<
String
,
Integer
>
bindSourceCountYjzx
(
List
<
String
>
subjectIds
)
{
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
List
<
SubjectSourceVO
>
bindList
=
commonMapper
.
bindSourceCountYjzx
(
subjectIds
);
if
(
CollectionUtils
.
isNotEmpty
(
bindList
))
{
for
(
SubjectSourceVO
subjectSourceVO
:
bindList
)
{
map
.
put
(
subjectSourceVO
.
getSubjectId
(),
subjectSourceVO
.
getCount
());
}
}
return
map
;
}
@Override
public
List
<
SysDict
>
selectOldLabelTypeList
()
{
...
...
src/main/java/com/zzsn/event/service/impl/ConfigurationMessageService.java
浏览文件 @
64a6b75a
...
...
@@ -134,6 +134,9 @@ public class ConfigurationMessageService {
@Autowired
private
ExternalSubjectInfoSourceMapService
externalSubjectInfoSourceMapService
;
@Value
(
"${scheduling.yjzxEnable:false}"
)
Boolean
yjzxEnable
;
public
void
bindKeyWordsSend
(
String
subjectId
,
Integer
type
)
{
try
{
remoteModelService
.
delSubjectCache
(
subjectId
);
...
...
@@ -318,8 +321,7 @@ public class ConfigurationMessageService {
if
(
StrUtil
.
isBlank
(
subjectId
))
{
return
new
ArrayList
<>();
}
return
getBindIds
(
subjectId
);
return
getBindIds
(
subjectId
,
yjzxEnable
);
}
...
...
@@ -380,8 +382,14 @@ public class ConfigurationMessageService {
return
excludeIds
;
}
private
List
<
String
>
getBindIds
(
String
subjectId
)
{
return
subjectAdditionMapper
.
getSubjectBindInfoSourceIds
(
subjectId
);
private
List
<
String
>
getBindIds
(
String
subjectId
,
boolean
yjzxEnable
)
{
List
<
String
>
ids
;
if
(
yjzxEnable
)
{
ids
=
subjectAdditionMapper
.
getSubjectBindInfoSourceIdsYjzx
(
subjectId
);
}
else
{
ids
=
subjectAdditionMapper
.
getSubjectBindInfoSourceIds
(
subjectId
);
}
return
ids
;
}
...
...
src/main/java/com/zzsn/event/service/impl/SubjectServiceImpl.java
浏览文件 @
64a6b75a
...
...
@@ -206,12 +206,17 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
}
@Override
public
List
<
SubjectStatisticInfo
>
statisticInfo
(
List
<
String
>
subjectIds
)
{
public
List
<
SubjectStatisticInfo
>
statisticInfo
(
List
<
String
>
subjectIds
,
boolean
yjzxEnable
)
{
List
<
SubjectStatisticInfo
>
list
=
new
ArrayList
<>();
//按专题分组,统计绑定关键词组的数量
Map
<
String
,
Integer
>
keyWordsNumMap
=
commonService
.
bindKeyWordsCountList
(
subjectIds
).
stream
().
collect
(
Collectors
.
toMap
(
SubjectPage:
:
getId
,
SubjectPage:
:
getKeyWordsNum
));
//按专题分组,统计绑定信息源的数量
Map
<
String
,
Integer
>
sourceCountMap
=
commonService
.
bindSourceCount
(
subjectIds
);
Map
<
String
,
Integer
>
sourceCountMap
;
if
(
yjzxEnable
)
{
sourceCountMap
=
commonService
.
bindSourceCountYjzx
(
subjectIds
);
}
else
{
sourceCountMap
=
commonService
.
bindSourceCount
(
subjectIds
);
}
//绑定全部信息源的专题
Map
<
String
,
Integer
>
infoSourceNumMap
=
new
HashMap
<>();
List
<
Subject
>
subjects
=
baseMapper
.
selectBatchIds
(
subjectIds
);
...
...
src/main/java/com/zzsn/event/task/SubjectStatisticTask.java
浏览文件 @
64a6b75a
...
...
@@ -35,13 +35,17 @@ public class SubjectStatisticTask {
@Value
(
"${scheduling.yjzxEnable:false}"
)
Boolean
yjzxEnable
;
/**
* 专题各项数量指标统计
* 每天凌晨0点30分执行一次
*
* @author lkg
* @date 2025/9/15
*/
@Scheduled
(
cron
=
"0 30 0 * * ?"
)
public
void
statistic
()
{
if
(
yjzxEnable
){
return
;
}
LambdaQueryWrapper
<
Subject
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
select
(
Subject:
:
getId
).
eq
(
Subject:
:
getSubjectType
,
1
);
queryWrapper
.
select
(
Subject:
:
getId
).
eq
(
Subject:
:
getSubjectType
,
1
)
.
eq
(
Subject:
:
getStatus
,
1
)
;
List
<
Subject
>
list
=
subjectService
.
list
(
queryWrapper
);
for
(
Subject
subject
:
list
)
{
CompletableFuture
.
runAsync
(()
->{
...
...
@@ -49,7 +53,7 @@ public class SubjectStatisticTask {
try
{
List
<
String
>
subjectIds
=
new
ArrayList
<>();
subjectIds
.
add
(
subjectId
);
List
<
SubjectStatisticInfo
>
subjectStatisticInfos
=
subjectService
.
statisticInfo
(
subjectIds
);
List
<
SubjectStatisticInfo
>
subjectStatisticInfos
=
subjectService
.
statisticInfo
(
subjectIds
,
yjzxEnable
);
SubjectStatisticInfo
statisticInfo
=
subjectStatisticInfos
.
get
(
0
);
LambdaQueryWrapper
<
SubjectStatisticInfo
>
query
=
Wrappers
.
lambdaQuery
();
query
.
eq
(
SubjectStatisticInfo:
:
getSubjectId
,
subjectId
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论