Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
项目统一框架
amos-boot-biz
Commits
0b0549c0
Commit
0b0549c0
authored
Nov 04, 2021
by
maoying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加维保防火监督消息推送
parent
6efedc40
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
86 additions
and
163 deletions
+86
-163
PushMsgParam.java
...yeejoin/amos/maintenance/business/param/PushMsgParam.java
+4
-49
MessageServiceImpl.java
...maintenance/business/service/impl/MessageServiceImpl.java
+4
-2
PushFeignServer.java
...a/com/yeejoin/amos/maintenance/feign/PushFeignServer.java
+32
-39
PushFeignServer.java
...n/java/com/yeejoin/amos/patrol/feign/PushFeignServer.java
+5
-32
PushMsgParam.java
...yeejoin/amos/supervision/business/param/PushMsgParam.java
+5
-0
MessageServiceImpl.java
...supervision/business/service/impl/MessageServiceImpl.java
+4
-2
PushFeignServer.java
...a/com/yeejoin/amos/supervision/feign/PushFeignServer.java
+32
-39
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/param/PushMsgParam.java
View file @
0b0549c0
...
...
@@ -3,6 +3,8 @@ package com.yeejoin.amos.maintenance.business.param;
import
java.util.List
;
import
java.util.Map
;
import
lombok.Data
;
@Data
public
class
PushMsgParam
{
...
...
@@ -41,54 +43,7 @@ public class PushMsgParam {
* jpush发送类型:1:广播;2:标签;3:别名
*/
private
String
type
=
"3"
;
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
public
List
<
String
>
getRecivers
()
{
return
recivers
;
}
public
void
setRecivers
(
List
<
String
>
recivers
)
{
this
.
recivers
=
recivers
;
}
public
Map
<
String
,
String
>
getExtras
()
{
return
extras
;
}
public
void
setExtras
(
Map
<
String
,
String
>
extras
)
{
this
.
extras
=
extras
;
}
public
String
getSubject
()
{
return
subject
;
}
public
void
setSubject
(
String
subject
)
{
this
.
subject
=
subject
;
}
public
String
[]
getEmails
()
{
return
emails
;
}
public
void
setEmails
(
String
[]
emails
)
{
this
.
emails
=
emails
;
}
private
String
relationId
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/service/impl/MessageServiceImpl.java
View file @
0b0549c0
...
...
@@ -233,9 +233,10 @@ public class MessageServiceImpl implements IMessageService {
extras
.
put
(
"type"
,
MsgTypeEnum
.
CHECK
.
getCode
());
extras
.
put
(
"id"
,
checkMsgBo
.
getCheckId
()+
""
);
pushMsgParam
.
setExtras
(
extras
);
pushMsgParam
.
setRelationId
(
String
.
valueOf
(
checkMsgBo
.
getCheckId
()));
pmps
.
add
(
pushMsgParam
);
List
<
Msg
>
msgList
=
createMsg
(
jpushUser
,
checkMsgBo
);
pushFeignServer
.
sendMessage
(
toke
,
product
,
appKey
,
pmps
);
pushFeignServer
.
sendMessage
(
pmps
);
}
}
...
...
@@ -312,10 +313,11 @@ public class MessageServiceImpl implements IMessageService {
extras
.
put
(
"type"
,
msg
.
getMsgType
());
extras
.
put
(
"id"
,
msg
.
getRelationId
()==
null
?
"0"
:
msg
.
getRelationId
().
toString
());
pushMsg
.
setExtras
(
extras
);
pushMsg
.
setRelationId
(
msg
.
getRelationId
()==
null
?
"0"
:
msg
.
getRelationId
().
toString
());
pmps
.
add
(
pushMsg
);
msg
.
setSendTime
(
new
Date
());
msg
.
setStatus
(
1
);
pushFeignServer
.
sendMessage
(
toke
,
product
,
appKey
,
pmps
);
pushFeignServer
.
sendMessage
(
pmps
);
iMsgDao
.
save
(
msg
);
return
msg
;
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/feign/PushFeignServer.java
View file @
0b0549c0
...
...
@@ -2,49 +2,42 @@ package com.yeejoin.amos.maintenance.feign;
import
java.util.List
;
import
com.yeejoin.amos.maintenance.business.util.CommonResponse
;
import
com.yeejoin.amos.maintenance.business.util.CommonResponseUtil
;
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.MediaType
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.MessageModel
;
import
com.yeejoin.amos.maintenance.business.param.PushMsgParam
;
@Service
(
"pushFeignServer"
)
public
class
PushFeignServer
{
@Autowired
private
RestTemplate
restTemplate
;
@Value
(
"${Push.fegin.name}"
)
private
String
RPushFeginName
;
private
static
String
sendMessage
=
"/api/user/sendMessage"
;
public
String
geturls
(
String
url
){
return
"http://"
+
RPushFeginName
+
url
;
}
public
HttpHeaders
getHeader
(
String
toke
,
String
product
,
String
appKey
){
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
set
(
"Content-Type"
,
"application/json"
);
headers
.
set
(
"token"
,
toke
);
headers
.
set
(
"product"
,
product
);
headers
.
set
(
"appKey"
,
appKey
);
return
headers
;
}
public
CommonResponse
sendMessage
(
String
toke
,
String
product
,
String
appKey
,
List
<
PushMsgParam
>
pushMsgParam
){
try
{
HttpEntity
httpEntity
=
new
HttpEntity
<>(
pushMsgParam
,
getHeader
(
toke
,
product
,
appKey
));
CommonResponse
commonResponse1
=
restTemplate
.
postForObject
(
geturls
(
sendMessage
),
httpEntity
,
CommonResponse
.
class
);
return
commonResponse1
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
CommonResponseUtil
.
failure
(
"发送失败"
);
}
}
public
void
sendMessage
(
List
<
PushMsgParam
>
pushMsgParam
){
try
{
pushMsgParam
.
forEach
(
action
->{
sendJP
(
action
);
});
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
void
sendMessage
(
PushMsgParam
pushMsgParam
){
try
{
sendJP
(
pushMsgParam
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
private
void
sendJP
(
PushMsgParam
pushMsgParam
){
MessageModel
model
=
new
MessageModel
();
model
.
setRelationId
(
pushMsgParam
.
getRelationId
());
model
.
setTitle
(
pushMsgParam
.
getSubject
());
model
.
setBody
(
pushMsgParam
.
getContent
());
model
.
setMsgType
(
"maintenance"
);
model
.
setIsSendApp
(
true
);
model
.
setRecivers
(
pushMsgParam
.
getRecivers
());
model
.
setExtras
(
pushMsgParam
.
getExtras
());
Systemctl
.
messageClient
.
create
(
model
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/feign/PushFeignServer.java
View file @
0b0549c0
package
com
.
yeejoin
.
amos
.
patrol
.
feign
;
import
java.util.List
;
import
java.util.Map
;
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.MediaType
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
com.yeejoin.amos.patrol.business.param.PushMsgParam
;
import
com.yeejoin.amos.patrol.business.util.CommonResponse
;
import
com.yeejoin.amos.patrol.business.util.CommonResponseUtil
;
import
com.yeejoin.amos.patrol.core.common.response.TaskInfoRespone
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.MessageModel
;
import
com.yeejoin.amos.patrol.business.param.PushMsgParam
;
@Service
(
"pushFeignServer"
)
public
class
PushFeignServer
{
// @Autowired
// private RestTemplate restTemplate;
//
// @Value("${Push.fegin.name}")
// private String RPushFeginName;
// private static String sendMessage = "/api/user/sendMessage";
//
// public String geturls(String url){
// return "http://"+RPushFeginName+url;
// }
// public HttpHeaders getHeader(String toke,String product,String appKey){
// HttpHeaders headers = new HttpHeaders();
// headers.setContentType(MediaType.APPLICATION_JSON);
// headers.set("Content-Type", "application/json");
// headers.set("token", toke);
// headers.set("product",product);
// headers.set("appKey", appKey);
// return headers;
// }
public
void
sendMessage
(
String
toke
,
String
product
,
String
appKey
,
List
<
PushMsgParam
>
pushMsgParam
){
public
void
sendMessage
(
String
toke
,
String
product
,
String
appKey
,
List
<
PushMsgParam
>
pushMsgParam
){
try
{
pushMsgParam
.
forEach
(
action
->{
sendJP
(
action
);
...
...
@@ -50,7 +21,8 @@ public class PushFeignServer {
}
}
public
void
sendMessage
(
String
toke
,
String
product
,
String
appKey
,
PushMsgParam
pushMsgParam
){
public
void
sendMessage
(
String
toke
,
String
product
,
String
appKey
,
PushMsgParam
pushMsgParam
){
try
{
sendJP
(
pushMsgParam
);
}
catch
(
Exception
e
)
{
...
...
@@ -64,6 +36,7 @@ public class PushFeignServer {
model
.
setTitle
(
pushMsgParam
.
getSubject
());
model
.
setBody
(
pushMsgParam
.
getContent
());
model
.
setMsgType
(
"patrolSystem"
);
model
.
setIsSendApp
(
true
);
model
.
setRecivers
(
pushMsgParam
.
getRecivers
());
model
.
setExtras
(
pushMsgParam
.
getExtras
());
Systemctl
.
messageClient
.
create
(
model
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/business/param/PushMsgParam.java
View file @
0b0549c0
...
...
@@ -3,6 +3,9 @@ package com.yeejoin.amos.supervision.business.param;
import
java.util.List
;
import
java.util.Map
;
import
lombok.Data
;
@Data
public
class
PushMsgParam
{
...
...
@@ -41,6 +44,8 @@ public class PushMsgParam {
* jpush发送类型:1:广播;2:标签;3:别名
*/
private
String
type
=
"3"
;
private
String
relationId
;
public
String
getType
()
{
return
type
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/business/service/impl/MessageServiceImpl.java
View file @
0b0549c0
...
...
@@ -233,9 +233,10 @@ public class MessageServiceImpl implements IMessageService {
extras
.
put
(
"type"
,
MsgTypeEnum
.
CHECK
.
getCode
());
extras
.
put
(
"id"
,
checkMsgBo
.
getCheckId
()+
""
);
pushMsgParam
.
setExtras
(
extras
);
pushMsgParam
.
setRelationId
(
checkMsgBo
.
getCheckId
()+
""
);
pmps
.
add
(
pushMsgParam
);
List
<
Msg
>
msgList
=
createMsg
(
jpushUser
,
checkMsgBo
);
pushFeignServer
.
sendMessage
(
toke
,
product
,
appKey
,
pmps
);
pushFeignServer
.
sendMessage
(
pmps
);
}
}
...
...
@@ -312,10 +313,11 @@ public class MessageServiceImpl implements IMessageService {
extras
.
put
(
"type"
,
msg
.
getMsgType
());
extras
.
put
(
"id"
,
msg
.
getRelationId
()==
null
?
"0"
:
msg
.
getRelationId
().
toString
());
pushMsg
.
setExtras
(
extras
);
pushMsg
.
setRelationId
(
msg
.
getRelationId
()==
null
?
"0"
:
msg
.
getRelationId
().
toString
());
pmps
.
add
(
pushMsg
);
msg
.
setSendTime
(
new
Date
());
msg
.
setStatus
(
1
);
pushFeignServer
.
sendMessage
(
toke
,
product
,
appKey
,
pmps
);
pushFeignServer
.
sendMessage
(
pmps
);
iMsgDao
.
save
(
msg
);
return
msg
;
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/feign/PushFeignServer.java
View file @
0b0549c0
...
...
@@ -2,49 +2,42 @@ package com.yeejoin.amos.supervision.feign;
import
java.util.List
;
import
com.yeejoin.amos.supervision.business.util.CommonResponse
;
import
com.yeejoin.amos.supervision.business.util.CommonResponseUtil
;
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.MediaType
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.MessageModel
;
import
com.yeejoin.amos.supervision.business.param.PushMsgParam
;
@Service
(
"pushFeignServer"
)
public
class
PushFeignServer
{
@Autowired
private
RestTemplate
restTemplate
;
@Value
(
"${Push.fegin.name}"
)
private
String
RPushFeginName
;
private
static
String
sendMessage
=
"/api/user/sendMessage"
;
public
String
geturls
(
String
url
){
return
"http://"
+
RPushFeginName
+
url
;
}
public
HttpHeaders
getHeader
(
String
toke
,
String
product
,
String
appKey
){
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
set
(
"Content-Type"
,
"application/json"
);
headers
.
set
(
"token"
,
toke
);
headers
.
set
(
"product"
,
product
);
headers
.
set
(
"appKey"
,
appKey
);
return
headers
;
}
public
CommonResponse
sendMessage
(
String
toke
,
String
product
,
String
appKey
,
List
<
PushMsgParam
>
pushMsgParam
){
try
{
HttpEntity
httpEntity
=
new
HttpEntity
<>(
pushMsgParam
,
getHeader
(
toke
,
product
,
appKey
));
CommonResponse
commonResponse1
=
restTemplate
.
postForObject
(
geturls
(
sendMessage
),
httpEntity
,
CommonResponse
.
class
);
return
commonResponse1
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
CommonResponseUtil
.
failure
(
"发送失败"
);
}
}
public
void
sendMessage
(
List
<
PushMsgParam
>
pushMsgParam
){
try
{
pushMsgParam
.
forEach
(
action
->{
sendJP
(
action
);
});
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
void
sendMessage
(
PushMsgParam
pushMsgParam
){
try
{
sendJP
(
pushMsgParam
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
private
void
sendJP
(
PushMsgParam
pushMsgParam
){
MessageModel
model
=
new
MessageModel
();
model
.
setRelationId
(
pushMsgParam
.
getRelationId
());
model
.
setTitle
(
pushMsgParam
.
getSubject
());
model
.
setBody
(
pushMsgParam
.
getContent
());
model
.
setMsgType
(
"supervision"
);
model
.
setIsSendApp
(
true
);
model
.
setRecivers
(
pushMsgParam
.
getRecivers
());
model
.
setExtras
(
pushMsgParam
.
getExtras
());
Systemctl
.
messageClient
.
create
(
model
);
}
}
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