Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
glsx-smart-device-kafka-consumer
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 beabfe09
authored
Mar 22, 2021
by
111-PC\111
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]智能设备场景kafka消费
1 parent
b6c79e92
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
7 deletions
src/main/java/cn/com/glsx/smart/service/OrderIssueService.java
src/main/java/cn/com/glsx/smart/service/OrderIssueService.java
View file @
beabfe0
...
...
@@ -55,17 +55,18 @@ public class OrderIssueService {
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
ordermaps
=
new
HashMap
<>();
List
<
Map
<
String
,
Object
>>
maps
=
new
ArrayList
<>();
Map
<
String
,
Object
>
ordermap
=
new
HashMap
<>();
List
<
Object
>
objects
=
JSONObject
.
parseArray
(
index
.
getParamValue
(),
Object
.
class
);
String
devideId
=
objects
.
get
(
0
)+
""
;
ordermap
.
put
(
"code"
,
objects
.
get
(
1
)+
""
);
ordermap
.
put
(
"value"
,
objects
.
get
(
2
));
String
[]
objects
=
index
.
getParamValue
().
split
(
","
);
String
devideId
=
objects
[
0
];
String
valueType
=
objects
[
3
];
ordermap
.
put
(
"code"
,
objects
[
1
]);
ordermap
.
put
(
"value"
,
revertType
(
valueType
,
objects
[
2
]));
maps
.
add
(
ordermap
);
ordermaps
.
put
(
"commands"
,
maps
);
try
{
JSONObject
jsonObject
=
HttpUtil
.
sendPost
(
orderIssueurl
.
replace
(
"{device_id}"
,
devideId
),
JSONObject
.
toJSONString
(
ordermaps
),
new
HashMap
<>());
Object
code
=
jsonObject
.
get
(
"code"
);
Object
message
=
jsonObject
.
get
(
"messag
e"
);
if
(
code
!=
null
)
{
if
(
jsonObject
!=
null
)
{
Object
code
=
jsonObject
.
get
(
"cod
e"
);
Object
message
=
jsonObject
.
get
(
"message"
);
if
(
Integer
.
parseInt
(
code
.
toString
())==
200
)
{
log
.
info
(
"设备{},{}"
,
devideId
,
message
);
}
else
{
...
...
@@ -81,4 +82,23 @@ public class OrderIssueService {
List
<
SmartTemplateParam
>
messageOrders
=
smartTemplateParamList
.
stream
().
filter
(
index
->
index
.
getParamKey
().
equals
(
Constants
.
MESSAGE_NOTI
)).
collect
(
Collectors
.
toList
());
// 推送消息结束 -----TODO
}
private
Object
revertType
(
String
valueType
,
String
object
)
{
Object
orderValue
=
null
;
switch
(
valueType
){
case
"1"
:
orderValue
=
object
;
break
;
case
"2"
:
orderValue
=
Integer
.
parseInt
(
object
);
break
;
case
"3"
:
orderValue
=
Boolean
.
valueOf
(
object
);
break
;
default
:
orderValue
=
object
;
break
;
}
return
orderValue
;
}
}
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