Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
brandkbs2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenjunjie
brandkbs2
Commits
eb4d6d46
Commit
eb4d6d46
authored
Nov 03, 2022
by
shenjunjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "情报预警相关接口"
This reverts commit
9664fae8
.
parent
9664fae8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
292 deletions
+2
-292
src/main/java/com/zhiwei/brandkbs2/controller/app/AppWarnController.java
+0
-279
src/main/resources/application-local.properties
+2
-13
No files found.
src/main/java/com/zhiwei/brandkbs2/controller/app/AppWarnController.java
deleted
100644 → 0
View file @
9664fae8
package
com
.
zhiwei
.
brandkbs2
.
controller
.
app
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.ProjectWarnService
;
import
com.zhiwei.brandkbs2.service.UserService
;
import
com.zhiwei.middleware.auth.util.JwtUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.Resource
;
import
java.net.URLEncoder
;
import
java.util.Map
;
/**
* @ClassName: AppWarnController
* @Description 情报预警
* @author: cjz
* @date: 2022-10-28 10:27
*/
@RestController
@Api
(
tags
=
"情报预警接口"
,
description
=
"情报预警"
)
@RequestMapping
(
"/app/warn"
)
public
class
AppWarnController
extends
BaseController
{
private
static
final
Logger
log
=
LogManager
.
getLogger
(
AppWarnController
.
class
);
private
static
final
String
taskType
=
"brandkbs"
;
@Value
(
"${jwt.key}"
)
private
String
jwtKey
;
@Autowired
private
RestTemplate
restTemplate
;
@Resource
(
name
=
"projectWarnServiceImpl"
)
private
ProjectWarnService
projectWarnService
;
@Resource
(
name
=
"projectServiceImpl"
)
private
ProjectService
projectService
;
@Resource
(
name
=
"userServiceImpl"
)
private
UserService
userService
;
@Value
(
"${warn.pushTask.token.url}"
)
private
String
token
;
@Value
(
"${warn.project.url}"
)
private
String
warnProjectUrl
;
@Value
(
"${warn.ticket.url}"
)
private
String
warnTicketUrl
;
@Value
(
"${warn.pushRecipientsList.url}"
)
private
String
warnPushRecipientsUrl
;
@Value
(
"${warn.deletePushRecipients.url}"
)
private
String
deletePushRecipientsUrl
;
@Value
(
"${warn.channel.url}"
)
private
String
warnChannelUrl
;
@Value
(
"${warn.hotEvent.url}"
)
private
String
warnHotEventUrl
;
@Value
(
"${warn.hotTop.url}"
)
private
String
warnHotTopUrl
;
@Value
(
"${warn.yuQing.url}"
)
private
String
warnYuQingUrl
;
@Value
(
"${warn.taskSwitch.url}"
)
private
String
warnTaskSwitchUrl
;
@ApiOperation
(
"情报预警-推送任务获取/新增"
)
@GetMapping
(
"/project"
)
public
ResponseResult
getPushTaskId
()
{
try
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
projectName
=
projectService
.
getProjectById
(
projectId
).
getProjectName
();
String
userId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
userName
=
URLEncoder
.
encode
(
userService
.
queryUserInfo
(
userId
,
projectId
).
getNickname
(),
"UTF-8"
);
// 请求头参数设置
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"token"
,
token
);
headers
.
add
(
"userId"
,
userId
);
headers
.
add
(
"userName"
,
userName
);
HttpEntity
<
Object
>
request
=
new
HttpEntity
<>(
headers
);
JSONObject
data
=
restTemplate
.
exchange
(
warnProjectUrl
,
HttpMethod
.
GET
,
request
,
JSONObject
.
class
,
projectId
,
projectName
).
getBody
().
getJSONObject
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
catch
(
Exception
e
){
log
.
error
(
"情报预警-推送任务获取/新增失败"
,
e
);
return
ResponseResult
.
failure
(
"情报预警-推送任务获取/新增失败"
);
}
}
@ApiOperation
(
"情报预警-获取项目预警更新条件"
)
@GetMapping
(
"/warnCriteria"
)
public
ResponseResult
getProjectWarnCriteria
(
@RequestParam
(
value
=
"type"
)
String
type
){
return
ResponseResult
.
success
(
projectWarnService
.
getProjectWarnCriteria
(
UserThreadLocal
.
getProjectId
(),
type
));
}
@ApiOperation
(
"情报预警-二维码ticket获取"
)
@GetMapping
(
"/getTicket"
)
public
ResponseResult
getTicket
(
@RequestParam
(
value
=
"pushTaskId"
)
String
pushTaskId
)
{
// 请求头
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"token"
,
token
);
HttpEntity
<
Object
>
request
=
new
HttpEntity
<>(
headers
);
JSONObject
data
=
restTemplate
.
exchange
(
warnTicketUrl
,
HttpMethod
.
GET
,
request
,
JSONObject
.
class
,
pushTaskId
,
taskType
).
getBody
().
getJSONObject
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
@ApiOperation
(
"情报预警-已扫码推送名单获取"
)
@GetMapping
(
"/pushRecipientsList"
)
public
ResponseResult
pushRecipientList
(
@RequestParam
(
value
=
"pushTaskId"
)
String
pushTaskId
){
// 请求头
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"token"
,
token
);
HttpEntity
<
Object
>
request
=
new
HttpEntity
<>(
headers
);
JSONArray
data
=
restTemplate
.
exchange
(
warnPushRecipientsUrl
,
HttpMethod
.
GET
,
request
,
JSONObject
.
class
,
pushTaskId
,
taskType
).
getBody
().
getJSONArray
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
@ApiOperation
(
"情报预警-删除推送人"
)
@GetMapping
(
"/deletePushRecipients"
)
public
ResponseResult
deletePushRecipients
(
@RequestParam
(
value
=
"recipientsId"
)
String
recipientsId
,
@RequestParam
(
value
=
"pushTaskId"
)
String
pushTaskId
){
// 请求头
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"token"
,
token
);
HttpEntity
<
Object
>
request
=
new
HttpEntity
<>(
headers
);
JSONObject
data
=
restTemplate
.
exchange
(
deletePushRecipientsUrl
,
HttpMethod
.
GET
,
request
,
JSONObject
.
class
,
pushTaskId
,
recipientsId
,
taskType
).
getBody
().
getJSONObject
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
@ApiOperation
(
"情报预警-渠道参与配置"
)
@PutMapping
(
"/channel/{pushTaskId}"
)
public
ResponseResult
channel
(
@ApiParam
(
name
=
"channelConfig"
,
value
=
"情报预警-渠道参与配置-json:{\"channel\": \"string\", \"configName\": \"string\", \"duplicate\": true, \"friendlyChannel\": true, \"markerTags\": [\"string\"], \"primary\": [true], \"pushInterval\": 0, \"threshold\": 0, \"used\": true}"
,
required
=
true
)
@RequestBody
JSONObject
channelConfig
,
@PathVariable
(
value
=
"pushTaskId"
)
String
pushTaskId
){
try
{
String
userId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
userName
=
URLEncoder
.
encode
(
userService
.
queryUserInfo
(
userId
,
UserThreadLocal
.
getProjectId
()).
getNickname
(),
"UTF-8"
);
// 请求头参数设置
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
add
(
"token"
,
token
);
headers
.
add
(
"userId"
,
userId
);
headers
.
add
(
"userName"
,
userName
);
HttpEntity
<
String
>
request
=
new
HttpEntity
<>(
channelConfig
.
toJSONString
(),
headers
);
JSONObject
data
=
restTemplate
.
exchange
(
warnChannelUrl
,
HttpMethod
.
PUT
,
request
,
JSONObject
.
class
,
pushTaskId
).
getBody
().
getJSONObject
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
catch
(
Exception
e
){
log
.
error
(
"情报预警-渠道参与配置失败"
,
e
);
return
ResponseResult
.
failure
(
"情报预警-渠道参与配置失败"
);
}
}
@ApiOperation
(
"情报预警-热点榜单配置"
)
@PutMapping
(
"/hotTop/{pushTaskId}"
)
public
ResponseResult
hotTop
(
@ApiParam
(
name
=
"hotTopConfig"
,
value
=
"情报预警-热点榜单配置-json:{\"configName\": \"string\", \"filterKeyword\": \"string\", \"firstTop\": true, \"introduction\": true,\"listType\": [\"string\"], \"newHeight\": true, \"pushInterval\": 0, \"topNewHeight\": 0, \"topOnceAgain\": true, \"used\": true, \"warnKeyword\": \"string\"}"
,
required
=
true
)
@RequestBody
JSONObject
hotTopConfig
,
@PathVariable
(
value
=
"pushTaskId"
)
String
pushTaskId
){
try
{
String
userId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
userName
=
URLEncoder
.
encode
(
userService
.
queryUserInfo
(
userId
,
UserThreadLocal
.
getProjectId
()).
getNickname
(),
"UTF-8"
);
// 请求头参数设置
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
add
(
"token"
,
token
);
headers
.
add
(
"userId"
,
userId
);
headers
.
add
(
"userName"
,
userName
);
HttpEntity
<
String
>
request
=
new
HttpEntity
<>(
hotTopConfig
.
toJSONString
(),
headers
);
JSONObject
data
=
restTemplate
.
exchange
(
warnHotTopUrl
,
HttpMethod
.
PUT
,
request
,
JSONObject
.
class
,
pushTaskId
).
getBody
().
getJSONObject
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
catch
(
Exception
e
){
log
.
error
(
"情报预警-热点榜单配置失败"
,
e
);
return
ResponseResult
.
failure
(
"情报预警-热点榜单配置失败"
);
}
}
@ApiOperation
(
"情报预警-热点事件配置"
)
@PutMapping
(
"/hotEvent/{pushTaskId}"
)
public
ResponseResult
hotEvent
(
@ApiParam
(
name
=
"hotEventConfig"
,
value
=
"情报预警-热点事件配置-json:{\"configName\": \"string\", \"contendsEvent\": [\"string\"], \"eventTop\": 0, \"ownEvent\": [\"string\"], \"timeCycles\": 0,\"used\": true, \"zhiWeiEvent\": [\"string\"]}"
,
required
=
true
)
@RequestBody
JSONObject
hotEventConfig
,
@PathVariable
(
value
=
"pushTaskId"
)
String
pushTaskId
){
try
{
String
userId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
userName
=
URLEncoder
.
encode
(
userService
.
queryUserInfo
(
userId
,
UserThreadLocal
.
getProjectId
()).
getNickname
(),
"UTF-8"
);
// 请求头参数设置
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
add
(
"token"
,
token
);
headers
.
add
(
"userId"
,
userId
);
headers
.
add
(
"userName"
,
userName
);
HttpEntity
<
String
>
request
=
new
HttpEntity
<>(
hotEventConfig
.
toJSONString
(),
headers
);
JSONObject
data
=
restTemplate
.
exchange
(
warnHotEventUrl
,
HttpMethod
.
PUT
,
request
,
JSONObject
.
class
,
pushTaskId
).
getBody
().
getJSONObject
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
catch
(
Exception
e
){
log
.
error
(
"情报预警-热点事件配置失败- "
,
e
);
return
ResponseResult
.
failure
(
"情报预警-热点事件配置失败"
);
}
}
@ApiOperation
(
"情报预警-舆情动态配置"
)
@PutMapping
(
"/yuQing/{pushTaskId}"
)
public
ResponseResult
yuQing
(
@ApiParam
(
name
=
"yuQingConfig"
,
value
=
"情报预警-舆情动态配置-json:{\"channelTypes\": [\"string\"], \"configName\": \"string\", \"contends\": [\"string\"], \"duplicate\": true, \"keyword\": \"string\", \"markerTags\": [\"string\"], \"primary\": [true], \"pushInterval\": 0, \"used\": true}"
,
required
=
true
)
@RequestBody
JSONObject
yuQingConfig
,
@PathVariable
(
value
=
"pushTaskId"
)
String
pushTaskId
){
try
{
String
userId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
userName
=
URLEncoder
.
encode
(
userService
.
queryUserInfo
(
userId
,
UserThreadLocal
.
getProjectId
()).
getNickname
(),
"UTF-8"
);
// 请求头参数设置
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
add
(
"token"
,
token
);
headers
.
add
(
"userId"
,
userId
);
headers
.
add
(
"userName"
,
userName
);
HttpEntity
<
String
>
request
=
new
HttpEntity
<>(
yuQingConfig
.
toJSONString
(),
headers
);
JSONObject
data
=
restTemplate
.
exchange
(
warnYuQingUrl
,
HttpMethod
.
PUT
,
request
,
JSONObject
.
class
,
pushTaskId
).
getBody
().
getJSONObject
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
catch
(
Exception
e
){
log
.
error
(
"情报预警-舆情动态配置失败"
,
e
);
return
ResponseResult
.
failure
(
"情报预警-舆情动态配置失败"
);
}
}
@ApiOperation
(
"情报预警-任务开关"
)
@PutMapping
(
"/taskSwitch"
)
public
ResponseResult
taskSwitch
(
@ApiParam
(
name
=
"info"
,
value
=
"推送任务-开关-json:{id:, used:true|false, configType:HOT_EVENT}"
,
required
=
true
)
@RequestBody
JSONObject
info
){
try
{
String
userId
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
).
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
userName
=
URLEncoder
.
encode
(
userService
.
queryUserInfo
(
userId
,
UserThreadLocal
.
getProjectId
()).
getNickname
(),
"UTF-8"
);
// 请求头参数设置
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
add
(
"token"
,
token
);
headers
.
add
(
"userId"
,
userId
);
headers
.
add
(
"userName"
,
userName
);
HttpEntity
<
String
>
request
=
new
HttpEntity
<>(
info
.
toJSONString
(),
headers
);
JSONObject
data
=
restTemplate
.
exchange
(
warnTaskSwitchUrl
,
HttpMethod
.
PUT
,
request
,
JSONObject
.
class
).
getBody
().
getJSONObject
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
catch
(
Exception
e
){
log
.
error
(
"情报预警-任务开关失败"
,
e
);
return
ResponseResult
.
failure
(
"情报预警-任务开关失败"
);
}
}
}
src/main/resources/application-local.properties
View file @
eb4d6d46
...
@@ -81,15 +81,4 @@ istarshine.addIStarShineKSData.url=https://istarshine-service.zhiweidata.com/ist
...
@@ -81,15 +81,4 @@ istarshine.addIStarShineKSData.url=https://istarshine-service.zhiweidata.com/ist
istarshine.getIStarShineKSInfoData.url
=
https://istarshine-service.zhiweidata.com/istarshine/ks/getIStarShineKSInfoData?taskId={1}&appId=6183571e0d710000f6003a12
istarshine.getIStarShineKSInfoData.url
=
https://istarshine-service.zhiweidata.com/istarshine/ks/getIStarShineKSInfoData?taskId={1}&appId=6183571e0d710000f6003a12
whole.search.url
=
https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/yuqing
whole.search.url
=
https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/yuqing
whole.searchCriteria.url
=
https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/pt
whole.searchCriteria.url
=
https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/pt
whole.extraParam.url
=
https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/extra/param
whole.extraParam.url
=
https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/extra/param
#????????
\ No newline at end of file
warn.pushTask.token.url
=
AoJ0ooy3H2BpHmuaviYObTKw/Xfw/oA5aKccNYhYnoJFJQ/BgeW/
warn.project.url
=
http://192.168.0.225:11003/qbjc/pushTask/interface/brandkbs/project?projectId={1}&projectName={2}
warn.ticket.url
=
http://192.168.0.225:11003/qbjc/pushTask/interface/code?pushId={1}&taskType={2}
warn.pushRecipientsList.url
=
http://192.168.0.225:11003/qbjc/pushTask/interface/pushRecipients/{1}?taskType={2}
warn.deletePushRecipients.url
=
http://192.168.0.225:11003/qbjc/pushTask/interface/pushRecipients/?pushId={1}&recipientsId={2}&taskType={3}
warn.channel.url
=
http://192.168.0.225:11003/qbjc/pushTask/interface/brandkbs/config/channel/{1}
warn.hotEvent.url
=
http://192.168.0.225:11003/qbjc/pushTask/interface/brandkbs/config/hotEvent/{1}
warn.hotTop.url
=
http://192.168.0.225:11003/qbjc/pushTask/interface/brandkbs/config/hotTop/{1}
warn.yuQing.url
=
http://192.168.0.225:11003/qbjc/pushTask/interface/brandkbs/config/yuQing/{1}
warn.taskSwitch.url
=
http://192.168.0.225:11003/qbjc/pushTask/interface/brandkbs/enable/used
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment