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 5ee56be2
authored
Apr 12, 2021
by
111-PC\111
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]代码修改
1 parent
22e33404
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
src/main/java/com/glsx/smart/service/impl/SmartSceneServiceImpl.java
src/main/java/com/glsx/smart/service/impl/SmartSceneServiceImpl.java
View file @
5ee56be
...
@@ -4,7 +4,6 @@ import cn.com.glsx.didicb.app.enums.MessagePushResultEnum;
...
@@ -4,7 +4,6 @@ import cn.com.glsx.didicb.app.enums.MessagePushResultEnum;
import
cn.com.glsx.didicb.app.model.MessageBoxInfo
;
import
cn.com.glsx.didicb.app.model.MessageBoxInfo
;
import
cn.com.glsx.didicb.app.remote.MessageBoxInfoRemote
;
import
cn.com.glsx.didicb.app.remote.MessageBoxInfoRemote
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.glsx.smart.dao.entity.SmartProduct
;
import
com.glsx.smart.dao.entity.SmartScene
;
import
com.glsx.smart.dao.entity.SmartScene
;
import
com.glsx.smart.dao.entity.SmartSceneData
;
import
com.glsx.smart.dao.entity.SmartSceneData
;
import
com.glsx.smart.dao.mapper.SmartProductMapper
;
import
com.glsx.smart.dao.mapper.SmartProductMapper
;
...
@@ -247,17 +246,22 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
...
@@ -247,17 +246,22 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
return
orderResponseList
;
return
orderResponseList
;
}
}
/**
* 下发系统通知
*
* @param scene 场景
* @param msg 信息
*/
private
void
issueSystemNotice
(
SmartScene
scene
,
String
msg
)
{
private
void
issueSystemNotice
(
SmartScene
scene
,
String
msg
)
{
String
title
=
"收到一条智能消息"
;
String
title
=
"收到一条智能消息"
;
Map
<
String
,
Object
>
map
=
sceneMapper
.
getBySourceAndUserId
(
scene
.
getId
());
Map
<
String
,
Object
>
map
=
sceneMapper
.
getBySourceAndUserId
(
scene
.
getId
());
String
user_id
=
map
.
get
(
"user_id"
)+
""
;
String
user_id
=
map
.
get
(
"user_id"
)+
""
;
String
scene_name
=
map
.
get
(
"scene_name"
)+
""
;
Map
<
String
,
String
>
paramMap
=
new
HashMap
<>();
Map
<
String
,
String
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"alias"
,
user_id
);
paramMap
.
put
(
"alias"
,
user_id
);
paramMap
.
put
(
"deviceType"
,
map
.
get
(
"source"
)+
""
);
paramMap
.
put
(
"deviceType"
,
map
.
get
(
"source"
)+
""
);
paramMap
.
put
(
"title"
,
title
);
paramMap
.
put
(
"title"
,
title
);
paramMap
.
put
(
"body"
,
msg
);
paramMap
.
put
(
"body"
,
msg
);
saveMegInfo
(
user_id
,
title
,
msg
,
scene
.
getId
()
,
scene_name
);
saveMegInfo
(
user_id
,
title
,
msg
,
scene
.
getId
());
try
{
try
{
JSONObject
jsonObject
=
HttpUtil
.
sendPost
(
infoUrl
,
JSONObject
.
toJSONString
(
paramMap
),
new
HashMap
<>());
JSONObject
jsonObject
=
HttpUtil
.
sendPost
(
infoUrl
,
JSONObject
.
toJSONString
(
paramMap
),
new
HashMap
<>());
if
(
jsonObject
!=
null
)
{
if
(
jsonObject
!=
null
)
{
...
@@ -273,7 +277,15 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
...
@@ -273,7 +277,15 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
}
}
}
}
private
void
saveMegInfo
(
String
user_id
,
String
title
,
String
msg
,
Long
id
,
String
scene_name
)
{
/**
* 保存消息通知
*
* @param user_id 用户id
* @param title 标题
* @param msg 消息
* @param id 场景id
*/
private
void
saveMegInfo
(
String
user_id
,
String
title
,
String
msg
,
Long
id
)
{
MessageBoxInfo
messageBoxInfo
=
new
MessageBoxInfo
();
MessageBoxInfo
messageBoxInfo
=
new
MessageBoxInfo
();
messageBoxInfo
.
setAccountId
(
Integer
.
parseInt
(
user_id
));
messageBoxInfo
.
setAccountId
(
Integer
.
parseInt
(
user_id
));
messageBoxInfo
.
setSn
(
"88888888"
);
messageBoxInfo
.
setSn
(
"88888888"
);
...
@@ -342,14 +354,7 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
...
@@ -342,14 +354,7 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
List
<
String
>
names
=
orderResponseList
.
stream
().
map
(
p
->
p
.
getDeviceName
()).
collect
(
Collectors
.
toList
());
List
<
String
>
names
=
orderResponseList
.
stream
().
map
(
p
->
p
.
getDeviceName
()).
collect
(
Collectors
.
toList
());
context
=
MessageFormat
.
format
(
"您配置的{0}场景已在{1}触发执行,但因以下设备{2}未能执行成功,请关注以上设备状态"
,
scene_name
,
new
Date
(),
names
);
context
=
MessageFormat
.
format
(
"您配置的{0}场景已在{1}触发执行,但因以下设备{2}未能执行成功,请关注以上设备状态"
,
scene_name
,
new
Date
(),
names
);
}
}
MessageBoxInfo
messageBoxInfo
=
new
MessageBoxInfo
();
saveMegInfo
(
user_id
,
title
,
context
,
id
);
messageBoxInfo
.
setAccountId
(
Integer
.
parseInt
(
user_id
));
messageBoxInfo
.
setSn
(
"88888888"
);
messageBoxInfo
.
setContent
(
context
);
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