Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
chejia-smart-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 22e33404
authored
Apr 12, 2021
by
111-PC\111
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]代码修改
1 parent
5e90de1b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
src/main/java/com/glsx/smart/pojo/ExecuteTaskVo.java
src/main/java/com/glsx/smart/service/impl/SmartSceneServiceImpl.java
src/main/java/com/glsx/smart/pojo/ExecuteTaskVo.java
View file @
22e3340
...
...
@@ -15,4 +15,5 @@ public class ExecuteTaskVo {
private
String
remoteId
;
private
String
value
;
private
String
deviceName
;
private
String
msg
;
}
src/main/java/com/glsx/smart/service/impl/SmartSceneServiceImpl.java
View file @
22e3340
...
...
@@ -237,9 +237,53 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
}
// 下发推送通知(Android设备和ios设备)
issueNotice
(
scene
,
orderResponseList
);
// 下发系统消息
List
<
SmartSceneData
>
scene_content_system
=
smartTemplateParamList
.
stream
().
filter
(
index
->
index
.
getParamKey
().
equals
(
"scene_content_system"
)).
collect
(
Collectors
.
toList
());
scene_content_system
.
forEach
(
index
->{
String
paramValue
=
index
.
getParamValue
();
ExecuteTaskVo
executeTaskVo
=
JSONObject
.
parseObject
(
paramValue
,
ExecuteTaskVo
.
class
);
issueSystemNotice
(
scene
,
executeTaskVo
.
getMsg
());
});
return
orderResponseList
;
}
private
void
issueSystemNotice
(
SmartScene
scene
,
String
msg
)
{
String
title
=
"收到一条智能消息"
;
Map
<
String
,
Object
>
map
=
sceneMapper
.
getBySourceAndUserId
(
scene
.
getId
());
String
user_id
=
map
.
get
(
"user_id"
)+
""
;
String
scene_name
=
map
.
get
(
"scene_name"
)+
""
;
Map
<
String
,
String
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"alias"
,
user_id
);
paramMap
.
put
(
"deviceType"
,
map
.
get
(
"source"
)+
""
);
paramMap
.
put
(
"title"
,
title
);
paramMap
.
put
(
"body"
,
msg
);
saveMegInfo
(
user_id
,
title
,
msg
,
scene
.
getId
(),
scene_name
);
try
{
JSONObject
jsonObject
=
HttpUtil
.
sendPost
(
infoUrl
,
JSONObject
.
toJSONString
(
paramMap
),
new
HashMap
<>());
if
(
jsonObject
!=
null
)
{
String
code
=
jsonObject
.
get
(
"code"
)
+
""
;
if
((
"200"
).
equals
(
code
))
{
log
.
info
(
"场景{}系统消息下发通知成功"
,
scene
.
getId
());
}
else
{
log
.
info
(
"场景{}系统消息下发通知失败"
,
jsonObject
.
get
(
"message"
));
}
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
private
void
saveMegInfo
(
String
user_id
,
String
title
,
String
msg
,
Long
id
,
String
scene_name
)
{
MessageBoxInfo
messageBoxInfo
=
new
MessageBoxInfo
();
messageBoxInfo
.
setAccountId
(
Integer
.
parseInt
(
user_id
));
messageBoxInfo
.
setSn
(
"88888888"
);
messageBoxInfo
.
setContent
(
msg
);
messageBoxInfo
.
setTitle
(
title
);
messageBoxInfo
.
setExpandId
(
id
.
intValue
());
messageBoxInfo
.
setIsPushSuccess
(
MessagePushResultEnum
.
FAILURE
.
getValue
());
messageBoxInfoRemote
.
insert
(
messageBoxInfo
);
}
/**
* 推送通知
*
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment