Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
event
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
陈世强
event
Commits
093f31fe
提交
093f31fe
authored
3月 18, 2025
作者:
obcy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【专题状态变更通知采集】
上级
aa655624
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
207 行增加
和
51 行删除
+207
-51
SubjectManageController.java
...va/com/zzsn/event/controller/SubjectManageController.java
+42
-0
CaiJiCenterHttpService.java
...a/com/zzsn/event/service/impl/CaiJiCenterHttpService.java
+144
-0
ConfigurationMessageService.java
.../zzsn/event/service/impl/ConfigurationMessageService.java
+21
-51
没有找到文件。
src/main/java/com/zzsn/event/controller/SubjectManageController.java
浏览文件 @
093f31fe
...
@@ -2,6 +2,7 @@ package com.zzsn.event.controller;
...
@@ -2,6 +2,7 @@ package com.zzsn.event.controller;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson2.JSON
;
import
com.alibaba.fastjson2.JSON
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
...
@@ -14,6 +15,7 @@ import com.zzsn.event.entity.*;
...
@@ -14,6 +15,7 @@ import com.zzsn.event.entity.*;
import
com.zzsn.event.es.EsService
;
import
com.zzsn.event.es.EsService
;
import
com.zzsn.event.feign.api.RemoteModelService
;
import
com.zzsn.event.feign.api.RemoteModelService
;
import
com.zzsn.event.service.*
;
import
com.zzsn.event.service.*
;
import
com.zzsn.event.service.impl.CaiJiCenterHttpService
;
import
com.zzsn.event.service.impl.ConfigurationMessageService
;
import
com.zzsn.event.service.impl.ConfigurationMessageService
;
import
com.zzsn.event.util.*
;
import
com.zzsn.event.util.*
;
import
com.zzsn.event.util.tree.Node
;
import
com.zzsn.event.util.tree.Node
;
...
@@ -104,6 +106,8 @@ public class SubjectManageController {
...
@@ -104,6 +106,8 @@ public class SubjectManageController {
@Value
(
"${kafka.topic.subject.run:}"
)
@Value
(
"${kafka.topic.subject.run:}"
)
private
String
SUBJECT_MODEL_KAFKA_CHANNEL
;
private
String
SUBJECT_MODEL_KAFKA_CHANNEL
;
@Autowired
private
CaiJiCenterHttpService
caiJiCenterHttpService
;
/**
/**
* 专题列表-资讯转换时使用
* 专题列表-资讯转换时使用
...
@@ -342,6 +346,19 @@ public class SubjectManageController {
...
@@ -342,6 +346,19 @@ public class SubjectManageController {
if
(
subject
.
getStatus
()
==
1
)
{
if
(
subject
.
getStatus
()
==
1
)
{
kafkaTemplate
.
send
(
SUBJECT_MODEL_KAFKA_CHANNEL
,
byId
.
getSubjectCode
());
kafkaTemplate
.
send
(
SUBJECT_MODEL_KAFKA_CHANNEL
,
byId
.
getSubjectCode
());
}
}
try
{
String
res
=
caiJiCenterHttpService
.
subjectStatusEdit
(
subject
.
getStatus
(),
subject
.
getId
());
cn
.
hutool
.
json
.
JSONObject
entries
=
JSONUtil
.
parseObj
(
res
);
//获取code状态码
Integer
code
=
entries
.
getInt
(
"code"
);
if
(
ObjectUtil
.
isEmpty
(
code
)
||
code
!=
200
)
{
log
.
error
(
"专题状态同步采集失败{}"
,
res
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"专题状态同步采集失败{}"
,
e
.
getMessage
(),
e
);
}
return
Result
.
OK
();
return
Result
.
OK
();
}
}
...
@@ -361,6 +378,17 @@ public class SubjectManageController {
...
@@ -361,6 +378,17 @@ public class SubjectManageController {
Subject
subject
=
subjectService
.
getOne
(
queryWrapper
);
Subject
subject
=
subjectService
.
getOne
(
queryWrapper
);
xxlJobInfoService
.
deleteByInfosourceCode
(
subject
.
getSubjectCode
());
xxlJobInfoService
.
deleteByInfosourceCode
(
subject
.
getSubjectCode
());
});
});
try
{
String
res
=
caiJiCenterHttpService
.
delSubject
(
id
);
cn
.
hutool
.
json
.
JSONObject
entries
=
JSONUtil
.
parseObj
(
res
);
//获取code状态码
Integer
code
=
entries
.
getInt
(
"code"
);
if
(
ObjectUtil
.
isEmpty
(
code
)
||
code
!=
200
)
{
log
.
error
(
"专题删除同步采集失败{}"
,
res
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"专题删除同步采集失败{}"
,
e
.
getMessage
(),
e
);
}
return
Result
.
OK
();
return
Result
.
OK
();
}
}
...
@@ -383,8 +411,22 @@ public class SubjectManageController {
...
@@ -383,8 +411,22 @@ public class SubjectManageController {
queryWrapper
.
eq
(
Subject:
:
getId
,
id
);
queryWrapper
.
eq
(
Subject:
:
getId
,
id
);
Subject
subject
=
subjectService
.
getOne
(
queryWrapper
);
Subject
subject
=
subjectService
.
getOne
(
queryWrapper
);
xxlJobInfoService
.
deleteByInfosourceCode
(
subject
.
getSubjectCode
());
xxlJobInfoService
.
deleteByInfosourceCode
(
subject
.
getSubjectCode
());
try
{
String
res
=
caiJiCenterHttpService
.
delSubject
(
id
);
cn
.
hutool
.
json
.
JSONObject
entries
=
JSONUtil
.
parseObj
(
res
);
//获取code状态码
Integer
code
=
entries
.
getInt
(
"code"
);
if
(
ObjectUtil
.
isEmpty
(
code
)
||
code
!=
200
)
{
log
.
error
(
"专题删除同步采集失败{}"
,
res
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"专题删除同步采集失败{}"
,
e
.
getMessage
(),
e
);
}
}
}
});
});
return
Result
.
OK
();
return
Result
.
OK
();
}
}
...
...
src/main/java/com/zzsn/event/service/impl/CaiJiCenterHttpService.java
0 → 100644
浏览文件 @
093f31fe
package
com
.
zzsn
.
event
.
service
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpUtil
;
import
cn.hutool.json.JSONUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.Map
;
@Slf4j
@Service
public
class
CaiJiCenterHttpService
{
@Value
(
"${caiji.infosourcebind.url:http://1.95.79.85:8823/baseSourceInfo/api/subject/infoSourceEdit}"
)
private
String
infosourcebindUrl
;
@Value
(
"${caiji.keyWordsbind.url:http://1.95.79.85:8823/baseSourceInfo/api/subject/keywordEdit}"
)
private
String
keyWordsbindUrl
;
@Value
(
"${caiji.keyWordsEdit.url:http://1.95.79.85:8823/baseSourceInfo/api/keyword/edit}"
)
private
String
keyWordsEditUrl
;
@Value
(
"${caiji.allInfosourcebind.url:http://1.95.79.85:8823/baseSourceInfo/api/subject/infoSourceSave}"
)
private
String
allInfosourcebindUrl
;
@Value
(
"${caiji.allKeyWordsBind.url:http://1.95.79.85:8823/baseSourceInfo/api/subject/keywordSave}"
)
private
String
allKeyWordsBindUrl
;
@Value
(
"${caiji.subjectStatusEditUrl.url:http://1.95.79.85:8823/baseSourceInfo/api/subject/editEnable}"
)
private
String
subjectStatusEditUrl
;
@Value
(
"${caiji.delSubjectUrl.url:http://1.95.79.85:8823/baseSourceInfo/api/subject/delSubject}"
)
private
String
delSubjectUrl
;
@Value
(
"${caiji.projectCode:zzsn_test}"
)
private
String
projectCode
;
@Value
(
"${caiji.projectName:克虏宝测试}"
)
private
String
projectName
;
@Value
(
"${caiji.secretKey:BsEHuAQTifhnMBDni5xjTMkThpmWlNWR3vvYp1rPstQGbE6nmfBX9VhpwrBPWxrU}"
)
private
String
secretKey
;
public
String
getProjectCode
()
{
return
projectCode
;
}
public
String
getProjectName
()
{
return
projectName
;
}
public
String
infosourcebindUrl
(
String
jsonBody
)
{
HttpRequest
post
=
post
(
infosourcebindUrl
,
jsonBody
);
return
post
.
execute
().
body
();
}
public
String
keyWordsbindUrl
(
String
jsonBody
)
{
HttpRequest
post
=
post
(
keyWordsbindUrl
,
jsonBody
);
return
post
.
execute
().
body
();
}
/**专题关键词配置通知采集*/
public
String
allKeyWordsBindUrl
(
String
jsonBody
)
{
log
.
info
(
"专题关键词配置通知采集{}-{}"
,
allKeyWordsBindUrl
,
jsonBody
);
HttpRequest
post
=
post
(
allKeyWordsBindUrl
,
jsonBody
);
return
post
.
execute
().
body
();
}
/**专题信息源配置通知采集*/
public
String
allInfosourcebindUrl
(
String
jsonBody
)
{
log
.
info
(
"专题信息源配置通知采集{}-{}"
,
allInfosourcebindUrl
,
jsonBody
);
HttpRequest
post
=
post
(
allInfosourcebindUrl
,
jsonBody
);
return
post
.
execute
().
body
();
}
/**编辑关键词通知采集*/
public
String
keyWordsEditUrl
(
Map
<
String
,
Object
>
map
)
{
log
.
info
(
"编辑关键词通知采集{}-{}"
,
keyWordsEditUrl
,
JSONUtil
.
toJsonStr
(
map
));
HttpRequest
post
=
post
(
keyWordsEditUrl
,
map
);
return
post
.
execute
().
body
();
}
/**专题状态通知采集平台*/
public
String
subjectStatusEdit
(
Integer
status
,
String
subjectId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
if
(
status
==
1
){
//启用
map
.
put
(
"subjectSign"
,
subjectId
);
map
.
put
(
"status"
,
0
);
}
else
{
//禁用
map
.
put
(
"subjectSign"
,
subjectId
);
map
.
put
(
"status"
,
1
);
}
log
.
info
(
"专题状态通知采集平台{}-{}"
,
subjectStatusEditUrl
,
JSONUtil
.
toJsonStr
(
map
));
HttpRequest
get
=
get
(
subjectStatusEditUrl
,
map
);
return
get
.
execute
().
body
();
}
/**专题删除通知采集平台*/
public
String
delSubject
(
String
subjectId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"subjectSign"
,
subjectId
);
log
.
info
(
"专题删除通知采集平台{}-{}"
,
delSubjectUrl
,
JSONUtil
.
toJsonStr
(
map
));
HttpRequest
get
=
get
(
delSubjectUrl
,
map
);
return
get
.
execute
().
body
();
}
private
HttpRequest
get
(
String
url
,
Map
<
String
,
Object
>
map
)
{
HttpRequest
get
=
HttpUtil
.
createGet
(
url
);
get
.
header
(
"Content-Type"
,
"application/json"
);
get
.
header
(
"authkey"
,
secretKey
);
if
(
ObjectUtil
.
isNotEmpty
(
map
))
{
get
.
form
(
map
);
}
get
.
timeout
(
120000
);
return
get
;
}
private
HttpRequest
post
(
String
url
,
Map
<
String
,
Object
>
map
)
{
HttpRequest
post
=
HttpUtil
.
createPost
(
url
);
post
.
header
(
"Content-Type"
,
"application/json"
);
post
.
header
(
"authkey"
,
secretKey
);
if
(
ObjectUtil
.
isNotEmpty
(
map
))
{
post
.
body
(
JSONUtil
.
toJsonStr
(
map
));
}
post
.
timeout
(
120000
);
return
post
;
}
private
HttpRequest
post
(
String
url
,
String
jsonBody
)
{
HttpRequest
post
=
HttpUtil
.
createPost
(
url
);
post
.
header
(
"Content-Type"
,
"application/json"
);
post
.
header
(
"authkey"
,
secretKey
);
if
(
StrUtil
.
isNotEmpty
(
jsonBody
))
{
post
.
body
(
jsonBody
);
}
post
.
timeout
(
120000
);
return
post
;
}
}
src/main/java/com/zzsn/event/service/impl/ConfigurationMessageService.java
浏览文件 @
093f31fe
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论