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
07969554
Commit
07969554
authored
Nov 16, 2021
by
helinlin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改消防巡查消息推送
parent
f190a9a3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
130 additions
and
40 deletions
+130
-40
MsgRo.java
...main/java/com/yeejoin/amos/patrol/business/dto/MsgRo.java
+50
-0
MessageServiceImpl.java
...amos/patrol/business/service/impl/MessageServiceImpl.java
+3
-4
RulePlanService.java
...in/amos/patrol/business/service/impl/RulePlanService.java
+51
-0
PushFeignServer.java
...n/java/com/yeejoin/amos/patrol/feign/PushFeignServer.java
+26
-36
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dto/MsgRo.java
0 → 100644
View file @
07969554
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
dto
;
import
com.yeejoin.amos.component.rule.Label
;
import
com.yeejoin.amos.component.rule.RuleFact
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.Map
;
/**
* 发送到规则平台的消息对象
*/
@Data
@RuleFact
(
value
=
"消防巡查"
,
project
=
"消息规则"
)
public
class
MsgRo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
4210693601552557441L
;
@Label
(
"名称"
)
private
String
name
;
@Label
(
"内容"
)
private
String
content
;
@Label
(
value
=
"推送时间"
)
private
String
sendTime
;
@Label
(
value
=
"接收人"
)
private
List
<
String
>
recivers
;
@Label
(
value
=
"发送到web标识"
)
private
Boolean
isSendWeb
;
@Label
(
value
=
"发送到app标识"
)
private
Boolean
isSendApp
;
@Label
(
"关联id"
)
private
String
relationId
;
@Label
(
"消息类型"
)
private
String
msgType
;
@Label
(
value
=
"终端标识"
)
private
String
terminal
;
@Label
(
value
=
"扩展参数"
)
private
Map
<
String
,
String
>
extras
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/MessageServiceImpl.java
View file @
07969554
...
@@ -247,7 +247,7 @@ public class MessageServiceImpl implements IMessageService {
...
@@ -247,7 +247,7 @@ public class MessageServiceImpl implements IMessageService {
pushMsgParam
.
setRelationId
(
checkMsgBo
.
getCheckId
()+
""
);
pushMsgParam
.
setRelationId
(
checkMsgBo
.
getCheckId
()+
""
);
pmps
.
add
(
pushMsgParam
);
pmps
.
add
(
pushMsgParam
);
List
<
Msg
>
msgList
=
createMsg
(
jpushUser
,
checkMsgBo
);
List
<
Msg
>
msgList
=
createMsg
(
jpushUser
,
checkMsgBo
);
pushFeignServer
.
sendMessage
(
toke
,
product
,
appKey
,
pmps
);
pushFeignServer
.
sendMessage
(
pmps
);
}
}
}
}
...
@@ -328,7 +328,7 @@ public class MessageServiceImpl implements IMessageService {
...
@@ -328,7 +328,7 @@ public class MessageServiceImpl implements IMessageService {
pmps
.
add
(
pushMsg
);
pmps
.
add
(
pushMsg
);
msg
.
setSendTime
(
new
Date
());
msg
.
setSendTime
(
new
Date
());
msg
.
setStatus
(
1
);
msg
.
setStatus
(
1
);
pushFeignServer
.
sendMessage
(
toke
,
product
,
appKey
,
pmps
);
pushFeignServer
.
sendMessage
(
pmps
);
iMsgDao
.
save
(
msg
);
iMsgDao
.
save
(
msg
);
return
msg
;
return
msg
;
}
}
...
@@ -436,7 +436,6 @@ public class MessageServiceImpl implements IMessageService {
...
@@ -436,7 +436,6 @@ public class MessageServiceImpl implements IMessageService {
@Override
@Override
public
void
pushMsg
(
String
toke
,
String
product
,
String
appKey
,
PushMsgParam
pmsg
)
{
public
void
pushMsg
(
String
toke
,
String
product
,
String
appKey
,
PushMsgParam
pmsg
)
{
// TODO Auto-generated method stub
pushFeignServer
.
sendMessage
(
pmsg
);
pushFeignServer
.
sendMessage
(
toke
,
product
,
appKey
,
pmsg
);
}
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/RulePlanService.java
0 → 100644
View file @
07969554
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
service
.
impl
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.amos.patrol.business.dto.MsgRo
;
import
com.yeejoin.amos.patrol.business.param.PushMsgParam
;
import
com.yeejoin.amos.patrol.business.util.DateUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
/**
* @Author: hll
* @Description: 消防巡查触发规则
* @Date: 2021/11/10 9:50
*/
@Service
public
class
RulePlanService
{
private
final
String
packageId
=
"消息/addCheckRule"
;
private
final
String
msgType
=
"patrol"
;
private
final
String
APP
=
"APP"
;
private
final
String
WEB
=
"WEB"
;
private
final
String
APP_WEB
=
"APP/WEB"
;
@Autowired
private
RuleTrigger
ruleTrigger
;
public
Boolean
sendRule
(
PushMsgParam
pushMsgParam
)
{
MsgRo
msgRo
=
new
MsgRo
();
msgRo
.
setName
(
pushMsgParam
.
getSubject
());
msgRo
.
setContent
(
pushMsgParam
.
getContent
());
msgRo
.
setRecivers
(
pushMsgParam
.
getRecivers
());
msgRo
.
setMsgType
(
msgType
);
msgRo
.
setTerminal
(
APP_WEB
);
msgRo
.
setSendTime
(
DateUtil
.
date2LongStr
(
new
Date
()));
msgRo
.
setRelationId
(
pushMsgParam
.
getRelationId
());
msgRo
.
setExtras
(
pushMsgParam
.
getExtras
());
msgRo
.
setIsSendApp
(
true
);
msgRo
.
setIsSendWeb
(
true
);
//触发规则
try
{
ruleTrigger
.
publish
(
msgRo
,
packageId
,
new
String
[
0
]);
return
true
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
false
;
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/feign/PushFeignServer.java
View file @
07969554
package
com
.
yeejoin
.
amos
.
patrol
.
feign
;
package
com
.
yeejoin
.
amos
.
patrol
.
feign
;
import
java.util.List
;
import
com.yeejoin.amos.patrol.business.param.PushMsgParam
;
import
com.yeejoin.amos.patrol.business.service.impl.RulePlanService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
java.util.List
;
import
com.yeejoin.amos.feign.systemctl.model.MessageModel
;
import
com.yeejoin.amos.patrol.business.param.PushMsgParam
;
@Service
(
"pushFeignServer"
)
@Service
(
"pushFeignServer"
)
public
class
PushFeignServer
{
public
class
PushFeignServer
{
public
void
sendMessage
(
String
toke
,
String
product
,
String
appKey
,
List
<
PushMsgParam
>
pushMsgParam
){
@Autowired
try
{
RulePlanService
rulePlanService
;
pushMsgParam
.
forEach
(
action
->{
sendJP
(
action
);
/**
});
* 批量发送
}
catch
(
Exception
e
)
{
*
e
.
printStackTrace
();
* @param pushMsgParam 消息参数
}
*/
}
public
void
sendMessage
(
List
<
PushMsgParam
>
pushMsgParam
)
{
pushMsgParam
.
forEach
(
rulePlanService:
:
sendRule
);
}
public
void
sendMessage
(
String
toke
,
String
product
,
String
appKey
,
PushMsgParam
pushMsgParam
){
try
{
/**
sendJP
(
pushMsgParam
);
* 单个发送
}
catch
(
Exception
e
)
{
*
e
.
printStackTrace
();
* @param pushMsgParam 消息参数
}
*/
}
public
void
sendMessage
(
PushMsgParam
pushMsgParam
)
{
rulePlanService
.
sendRule
(
pushMsgParam
);
private
void
sendJP
(
PushMsgParam
pushMsgParam
){
}
MessageModel
model
=
new
MessageModel
();
model
.
setRelationId
(
pushMsgParam
.
getRelationId
());
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
);
}
}
}
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