Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
7116f7bf
提交
7116f7bf
authored
6月 11, 2025
作者:
925993793@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
自定义专题-信息源绑定对接采集中心
上级
90b50cae
全部展开
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
163 行增加
和
14 行删除
+163
-14
SubjectManageController.java
...va/com/zzsn/event/controller/SubjectManageController.java
+0
-0
SubjectInfoSourceMiddleMap.java
...ava/com/zzsn/event/entity/SubjectInfoSourceMiddleMap.java
+7
-1
InfoSourceMapper.java
src/main/java/com/zzsn/event/mapper/InfoSourceMapper.java
+1
-1
InfoSourceMapper.xml
src/main/java/com/zzsn/event/mapper/xml/InfoSourceMapper.xml
+8
-2
IInfoSourceService.java
src/main/java/com/zzsn/event/service/IInfoSourceService.java
+2
-1
InfoSourceServiceImpl.java
...va/com/zzsn/event/service/impl/InfoSourceServiceImpl.java
+4
-5
WaitConfigInfoSourceTask.java
...in/java/com/zzsn/event/task/WaitConfigInfoSourceTask.java
+110
-0
SubjectBindDirectSourceVO.java
...ain/java/com/zzsn/event/vo/SubjectBindDirectSourceVO.java
+2
-0
SubjectBindSourceVO.java
src/main/java/com/zzsn/event/vo/SubjectBindSourceVO.java
+18
-0
application-test.yml
src/main/resources/application-test.yml
+11
-4
没有找到文件。
src/main/java/com/zzsn/event/controller/SubjectManageController.java
浏览文件 @
7116f7bf
差异被折叠。
点击展开。
src/main/java/com/zzsn/event/entity/SubjectInfoSourceMiddleMap.java
浏览文件 @
7116f7bf
...
...
@@ -31,12 +31,18 @@ public class SubjectInfoSourceMiddleMap implements Serializable {
/**专题id*/
@TableField
(
"subject_id"
)
private
String
subjectId
;
/**信息源id或信息源组id*/
/**信息源id*/
@TableField
(
"info_source_id"
)
private
String
infoSourceId
;
/**信息源名称*/
@TableField
(
"info_source_name"
)
private
String
infoSourceName
;
/**网址*/
@TableField
(
"url"
)
private
String
url
;
/**状态(1-已有;0-待配置)*/
@TableField
(
"status"
)
private
Integer
status
;
/**创建时间*/
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
...
...
src/main/java/com/zzsn/event/mapper/InfoSourceMapper.java
浏览文件 @
7116f7bf
...
...
@@ -89,7 +89,7 @@ public interface InfoSourceMapper extends BaseMapper<InfoSource> {
* @author lkg
* @date 2025/1/6
*/
Page
<
SubjectBindDirectSourceVO
>
subjectBindDirectInfoSourceList
(
@Param
(
"subjectId"
)
String
subjectId
,
Page
<
Map
<
String
,
Object
>>
page
);
Page
<
SubjectBindDirectSourceVO
>
subjectBindDirectInfoSourceList
(
@Param
(
"subjectId"
)
String
subjectId
,
@Param
(
"webSiteName"
)
String
webSiteName
,
Page
<
Map
<
String
,
Object
>>
page
);
/**
...
...
src/main/java/com/zzsn/event/mapper/xml/InfoSourceMapper.xml
浏览文件 @
7116f7bf
...
...
@@ -335,7 +335,7 @@
<select
id=
"subjectBindDirectInfoSourceList"
resultType=
"com.zzsn.event.vo.SubjectBindDirectSourceVO"
>
select a.*
<!--
select a.*
from (
select iso.web_site_name as webSiteName, 1 as `status`
from info_source iso
...
...
@@ -348,7 +348,13 @@
where subject_id = #{subjectId}
group by info_source_name
) a
order by a.status desc, a.webSiteName asc
order by a.status desc, a.webSiteName asc-->
select info_source_id as webSiteId,info_source_name as webSiteName, `status`
from subject_info_source_middle_map
where subject_id = #{subjectId}
<if
test=
"webSiteName!=null and webSiteName != ''"
>
and info_source_name like CONCAT('%',#{webSiteName},'%')
</if>
</select>
<select
id=
"infoSourcePageList"
resultType=
"com.zzsn.event.vo.SubjectBindDirectSourceVO"
>
...
...
src/main/java/com/zzsn/event/service/IInfoSourceService.java
浏览文件 @
7116f7bf
...
...
@@ -60,12 +60,13 @@ public interface IInfoSourceService extends IService<InfoSource> {
* 专题绑定的定向信息源分页列表(专题绑定定向信息源时使用-研究中心)
*
* @param subjectId 专题id
* @param webSiteName 信息源名称
* @param pageNo 当前页
* @param pageSize 返回条数
* @author lkg
* @date 2025/1/4
*/
IPage
<
SubjectBindDirectSourceVO
>
subjectBindDirectSourcePageList
(
String
subjectId
,
Integer
pageNo
,
Integer
pageSize
);
IPage
<
SubjectBindDirectSourceVO
>
subjectBindDirectSourcePageList
(
String
subjectId
,
String
webSiteName
,
Integer
pageNo
,
Integer
pageSize
);
/**
* 信息源分页列表(专题绑定定向信息源时使用-研究中心)
...
...
src/main/java/com/zzsn/event/service/impl/InfoSourceServiceImpl.java
浏览文件 @
7116f7bf
...
...
@@ -127,10 +127,9 @@ public class InfoSourceServiceImpl extends ServiceImpl<InfoSourceMapper, InfoSou
}
@Override
public
IPage
<
SubjectBindDirectSourceVO
>
subjectBindDirectSourcePageList
(
String
subjectId
,
Integer
pageNo
,
Integer
pageSize
)
{
public
IPage
<
SubjectBindDirectSourceVO
>
subjectBindDirectSourcePageList
(
String
subjectId
,
String
webSiteName
,
Integer
pageNo
,
Integer
pageSize
)
{
Page
<
Map
<
String
,
Object
>>
page
=
new
Page
<>(
pageNo
,
pageSize
);
Page
<
SubjectBindDirectSourceVO
>
pageList
=
baseMapper
.
subjectBindDirectInfoSourceList
(
subjectId
,
page
);
List
<
SubjectBindDirectSourceVO
>
records
=
pageList
.
getRecords
();
/*List<SubjectBindDirectSourceVO> records = pageList.getRecords();
if (CollectionUtils.isNotEmpty(records)) {
List<String> webSiteNames = records.stream().map(SubjectBindDirectSourceVO::getWebSiteName).collect(Collectors.toList());
List<InfoSource> bindSourceColumnList = this.subjectBindSourceColumnList(subjectId, webSiteNames);
...
...
@@ -142,8 +141,8 @@ public class InfoSourceServiceImpl extends ServiceImpl<InfoSourceMapper, InfoSou
subjectBindDirectSourceVO.setChildren(infoSources);
}
}
}
return
pageList
;
}
*/
return
baseMapper
.
subjectBindDirectInfoSourceList
(
subjectId
,
webSiteName
,
page
)
;
}
@Override
...
...
src/main/java/com/zzsn/event/task/WaitConfigInfoSourceTask.java
0 → 100644
浏览文件 @
7116f7bf
package
com
.
zzsn
.
event
.
task
;
import
com.alibaba.fastjson2.JSON
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.zzsn.event.entity.InfoSource
;
import
com.zzsn.event.entity.SubjectInfoSourceMap
;
import
com.zzsn.event.entity.SubjectInfoSourceMiddleMap
;
import
com.zzsn.event.service.IInfoSourceService
;
import
com.zzsn.event.service.ISubjectInfoSourceMapService
;
import
com.zzsn.event.service.SubjectInfoSourceMiddleMapService
;
import
com.zzsn.event.util.HttpUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 待配置信息源,状态监控更新任务(和采集中心交互)
*
* @author lkg
* @date 2025/5/23
*/
@Slf4j
@Component
public
class
WaitConfigInfoSourceTask
{
@Value
(
"${infoSource.columnListByWait:}"
)
private
String
columnListByWait
;
@Autowired
private
ISubjectInfoSourceMapService
subjectInfoSourceMapService
;
@Autowired
private
SubjectInfoSourceMiddleMapService
subjectInfoSourceMiddleMapService
;
@Autowired
private
IInfoSourceService
infoSourceService
;
@Value
(
"${scheduling.yjzxEnable:false}"
)
Boolean
yjzxEnable
;
/**
* 每6小时,执行一次
*/
@Scheduled
(
cron
=
"0 0 0/6 * * ?"
)
public
void
syncConfig
()
{
if
(!
yjzxEnable
){
return
;
}
List
<
SubjectInfoSourceMiddleMap
>
waitConfigSourceList
=
subjectInfoSourceMiddleMapService
.
list
(
new
LambdaQueryWrapper
<
SubjectInfoSourceMiddleMap
>()
.
eq
(
SubjectInfoSourceMiddleMap:
:
getStatus
,
0
)
);
if
(
CollectionUtils
.
isNotEmpty
(
waitConfigSourceList
))
{
for
(
SubjectInfoSourceMiddleMap
middleMap
:
waitConfigSourceList
)
{
String
subjectId
=
middleMap
.
getSubjectId
();
String
waitForConfigId
=
middleMap
.
getInfoSourceId
();
JSONObject
jsonObject
=
getColumnListByWait
(
waitForConfigId
);
if
(
jsonObject
!=
null
)
{
middleMap
.
setStatus
(
1
);
middleMap
.
setInfoSourceId
(
jsonObject
.
getString
(
"infoSourceId"
));
middleMap
.
setInfoSourceName
(
jsonObject
.
getString
(
"infoSourceName"
));
subjectInfoSourceMiddleMapService
.
updateById
(
middleMap
);
List
<
JSONObject
>
columnList
=
JSON
.
parseArray
(
jsonObject
.
getString
(
"columnList"
),
JSONObject
.
class
);
List
<
SubjectInfoSourceMap
>
list
=
new
ArrayList
<>();
List
<
InfoSource
>
infoSourceList
=
new
ArrayList
<>();
for
(
JSONObject
column
:
columnList
)
{
SubjectInfoSourceMap
sms
=
new
SubjectInfoSourceMap
();
sms
.
setSubjectId
(
subjectId
);
sms
.
setSourceId
(
column
.
getString
(
"id"
));
sms
.
setType
(
1
);
list
.
add
(
sms
);
//信息源
InfoSource
infoSource
=
new
InfoSource
();
infoSource
.
setId
(
column
.
getString
(
"id"
));
infoSource
.
setSiteName
(
column
.
getString
(
"columnName"
));
infoSource
.
setSiteUri
(
column
.
getString
(
"columnAddress"
));
infoSource
.
setWebSiteName
(
jsonObject
.
getString
(
"infoSourceName"
));
infoSourceList
.
add
(
infoSource
);
}
subjectInfoSourceMapService
.
saveBatch
(
list
);
if
(
CollectionUtils
.
isNotEmpty
(
infoSourceList
))
{
infoSourceService
.
saveOrUpdateBatch
(
infoSourceList
);
}
log
.
info
(
"待配置信息源-{},对应已配置信息源-{},同步更新完成"
,
waitForConfigId
,
jsonObject
.
getString
(
"infoSourceId"
));
}
}
}
}
private
JSONObject
getColumnListByWait
(
String
waitConfigId
)
{
JSONObject
result
=
null
;
Map
<
String
,
String
>
variables
=
new
HashMap
<>();
variables
.
put
(
"waitConfigId"
,
waitConfigId
);
String
response
=
HttpUtil
.
doGet
(
columnListByWait
,
variables
,
null
,
"utf-8"
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
response
);
if
(
jsonObject
.
getInteger
(
"code"
)
==
200
)
{
result
=
jsonObject
.
getJSONObject
(
"result"
);
}
return
result
;
}
}
src/main/java/com/zzsn/event/vo/SubjectBindDirectSourceVO.java
浏览文件 @
7116f7bf
...
...
@@ -15,6 +15,8 @@ import java.util.List;
public
class
SubjectBindDirectSourceVO
{
/**专题id*/
private
String
subjectId
;
/**信息源id*/
private
String
webSiteId
;
/**信息源名称*/
private
String
webSiteName
;
/**状态(1-已配置;0-待配置)*/
...
...
src/main/java/com/zzsn/event/vo/SubjectBindSourceVO.java
0 → 100644
浏览文件 @
7116f7bf
package
com
.
zzsn
.
event
.
vo
;
import
lombok.Data
;
import
java.util.List
;
/**
*
*
* @author lkg
* @date 2024/4/28
*/
@Data
public
class
SubjectBindSourceVO
{
private
String
webSiteId
;
private
String
webSiteName
;
private
List
<
String
>
columnIds
;
}
src/main/resources/application-test.yml
浏览文件 @
7116f7bf
...
...
@@ -60,11 +60,11 @@ spring:
password
:
qwer@9988&zzsn
driver-class-name
:
com.mysql.cj.jdbc.Driver
elasticsearch
:
uris
:
[
"
1.95.69.2:9200"
]
#
uris: ["1.95.38.69:9700","1.95.3.121:9200","1.95.87.177:9700"]
#
uris: ["1.95.69.2:9200"]
uris
:
[
"
1.95.38.69:9700"
,
"
1.95.3.121:9200"
,
"
1.95.87.177:9700"
]
username
:
elastic
password
:
elastic
#
password: zzsn9988
#
password: elastic
password
:
zzsn9988
connection-timeout
:
300000
socket-timeout
:
300000
cloud
:
...
...
@@ -177,3 +177,10 @@ clb:
data-permit
:
dataPermitGetQueryEntityTest
:
http://1.95.77.159:10089/permission/
dataPermitGetQueryEntityProd
:
http://1.95.14.24:8060/
infoSource
:
pageList
:
http://1.95.79.85:8823/baseSourceInfo/api/infoSource/pageList
columnList
:
http://1.95.79.85:8823/baseSourceInfo/api/infoSource/columnList
add
:
http://1.95.79.85:8823/baseSourceInfo/api/infoSource/addInfoSourceTask
waitInfoRemove
:
http://1.95.79.85:8823/baseSourceInfo/api/infoSource/waitInfoRemove
columnListByWait
:
http://1.95.79.85:8823/baseSourceInfo/api/infoSource/columnListByWait
columnDetail
:
http://1.95.79.85:8823/baseSourceInfo/api/infoSource/columnDetail
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论