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 83ba0d0c
authored
Apr 13, 2021
by
111-PC\111
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]失败消息错误信息推送
1 parent
30bd6169
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
6 deletions
pom.xml
src/main/java/com/glsx/smart/service/impl/SmartSceneServiceImpl.java
pom.xml
View file @
83ba0d0
...
@@ -84,6 +84,11 @@
...
@@ -84,6 +84,11 @@
<artifactId>
rest-admin-swagger2
</artifactId>
<artifactId>
rest-admin-swagger2
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.glsx
</groupId>
<artifactId>
rest-admin-redis
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<!-- 用户聚合服务 需要调用的dubbo服务 -->
<!-- 用户聚合服务 需要调用的dubbo服务 -->
<dependency>
<dependency>
...
...
src/main/java/com/glsx/smart/service/impl/SmartSceneServiceImpl.java
View file @
83ba0d0
...
@@ -16,6 +16,7 @@ import com.glsx.smart.exception.ResultEnum;
...
@@ -16,6 +16,7 @@ import com.glsx.smart.exception.ResultEnum;
import
com.glsx.smart.pojo.ExecuteTaskVo
;
import
com.glsx.smart.pojo.ExecuteTaskVo
;
import
com.glsx.smart.pojo.OrderResponse
;
import
com.glsx.smart.pojo.OrderResponse
;
import
com.glsx.smart.pojo.ResponseVo
;
import
com.glsx.smart.pojo.ResponseVo
;
import
com.glsx.smart.redis.RedisService
;
import
com.glsx.smart.service.BaseService
;
import
com.glsx.smart.service.BaseService
;
import
com.glsx.smart.service.SmartSceneService
;
import
com.glsx.smart.service.SmartSceneService
;
import
com.glsx.smart.utils.HttpUtil
;
import
com.glsx.smart.utils.HttpUtil
;
...
@@ -35,6 +36,7 @@ import java.util.Date;
...
@@ -35,6 +36,7 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -63,12 +65,18 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
...
@@ -63,12 +65,18 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
@Value
(
"${infoUrl}"
)
@Value
(
"${infoUrl}"
)
private
String
infoUrl
;
private
String
infoUrl
;
@Value
(
"${infotimeout}"
)
private
int
infotimeout
;
@DubboReference
@DubboReference
private
MessageBoxInfoRemote
messageBoxInfoRemote
;
private
MessageBoxInfoRemote
messageBoxInfoRemote
;
@Resource
@Resource
private
SmartDeviceStatusMapper
smartDeviceStatusMapper
;
private
SmartDeviceStatusMapper
smartDeviceStatusMapper
;
@Resource
private
RedisService
redisService
;
@Override
@Override
public
List
<
SmartScene
>
getList
(
SmartScene
record
)
{
public
List
<
SmartScene
>
getList
(
SmartScene
record
)
{
return
sceneMapper
.
getList
(
record
);
return
sceneMapper
.
getList
(
record
);
...
@@ -248,12 +256,15 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
...
@@ -248,12 +256,15 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
// 下发推送通知(Android设备和ios设备)
// 下发推送通知(Android设备和ios设备)
issueNotice
(
scene
,
orderResponseList
);
issueNotice
(
scene
,
orderResponseList
);
// 下发系统消息
// 下发系统消息
List
<
SmartSceneData
>
scene_content_system
=
smartTemplateParamList
.
stream
().
filter
(
index
->
index
.
getParamKey
().
equals
(
"scene_content_system"
)).
collect
(
Collectors
.
toList
());
List
<
OrderResponse
>
collect
=
orderResponseList
.
stream
().
filter
(
index
->
!
index
.
isResult
()).
collect
(
Collectors
.
toList
());
scene_content_system
.
forEach
(
index
->{
if
(
CollectionUtils
.
isEmpty
(
collect
))
{
String
paramValue
=
index
.
getParamValue
();
List
<
SmartSceneData
>
scene_content_system
=
smartTemplateParamList
.
stream
().
filter
(
index
->
index
.
getParamKey
().
equals
(
"scene_content_system"
)).
collect
(
Collectors
.
toList
());
ExecuteTaskVo
executeTaskVo
=
JSONObject
.
parseObject
(
paramValue
,
ExecuteTaskVo
.
class
);
scene_content_system
.
forEach
(
index
->
{
issueSystemNotice
(
scene
,
executeTaskVo
.
getMsg
());
String
paramValue
=
index
.
getParamValue
();
});
ExecuteTaskVo
executeTaskVo
=
JSONObject
.
parseObject
(
paramValue
,
ExecuteTaskVo
.
class
);
issueSystemNotice
(
scene
,
executeTaskVo
.
getMsg
());
});
}
return
orderResponseList
;
return
orderResponseList
;
}
}
...
@@ -328,6 +339,11 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
...
@@ -328,6 +339,11 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
if
(
CollectionUtils
.
isEmpty
(
collect
))
{
if
(
CollectionUtils
.
isEmpty
(
collect
))
{
content
=
MessageFormat
.
format
(
"您配置的{0}场景已执行,点击可查看详情。"
,
scene_name
);
content
=
MessageFormat
.
format
(
"您配置的{0}场景已执行,点击可查看详情。"
,
scene_name
);
}
else
{
}
else
{
boolean
flag
=
repeatNotification
(
scene
.
getId
());
if
(
flag
){
log
.
info
(
"场景下发不成功,不允许持续发消息,场景id{}"
,
scene
.
getId
());
return
;
}
content
=
MessageFormat
.
format
(
"您配置的{0}场景未顺利执行,点击可查看详情。"
,
scene_name
);
content
=
MessageFormat
.
format
(
"您配置的{0}场景未顺利执行,点击可查看详情。"
,
scene_name
);
}
}
paramMap
.
put
(
"body"
,
content
);
paramMap
.
put
(
"body"
,
content
);
...
@@ -348,6 +364,17 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
...
@@ -348,6 +364,17 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
}
}
}
}
private
boolean
repeatNotification
(
Long
id
)
{
String
key
=
"senceId_"
+
id
;
Object
o
=
redisService
.
get
(
key
);
if
(
o
==
null
){
redisService
.
setOutTime
(
key
,
key
,
infotimeout
,
TimeUnit
.
MINUTES
);
return
false
;
}
else
{
return
true
;
}
}
/**
/**
* 消息推送到app端
* 消息推送到app端
*
*
...
...
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