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
e89c404f
Commit
e89c404f
authored
Jun 03, 2023
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对于收到的消息进行坐标校验,避免大量的无效坐标
parent
6597a33e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
CarIotNewListener.java
...a/com/yeejoin/equipmanage/listener/CarIotNewListener.java
+7
-5
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/listener/CarIotNewListener.java
View file @
e89c404f
...
...
@@ -65,20 +65,21 @@ public class CarIotNewListener extends EmqxListener {
String
deviceName
=
topic
.
split
(
"/"
)[
1
];
String
iotCode
=
measurement
+
deviceName
;
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
message
.
toString
());
if
(
jsonObject
.
containsKey
(
"FireCar_Longitude"
))
{
//如果map中已经存在该设备或者该设备有但是线程已经执行了
if
((!
deviceInfo
.
containsKey
(
topic
))
||
(
deviceInfo
.
containsKey
(
topic
)
&&
deviceInfo
.
get
(
topic
)
==
null
))
{
ThreadCar
threadCar
=
new
ThreadCar
(
topic
,
jsonObject
,
this
.
iWlCarMileageService
,
this
.
iotFeign
,
this
.
iCarService
,
this
.
emqkeeper
,
clipping_time
);
deviceInfo
.
put
(
topic
,
threadCar
);
threadCar
.
start
();
}
String
coordinate
=
jsonObject
.
getDoubleValue
(
"FireCar_Longitude"
)
+
String
.
valueOf
(
jsonObject
.
getDoubleValue
(
"FireCar_Latitude"
));
if
(!
deviceLastInfo
.
containsKey
(
topic
))
{
deviceLastInfo
.
put
(
topic
,
coordinate
);
String
coordinate
=
jsonObject
.
getDoubleValue
(
"FireCar_Longitude"
)
+
String
.
valueOf
(
jsonObject
.
getDoubleValue
(
"FireCar_Latitude"
));
if
(!
deviceLastInfo
.
containsKey
(
topic
))
{
deviceLastInfo
.
put
(
topic
,
coordinate
);
}
Long
currentTime
=
new
Date
().
getTime
();
Long
endTime
=
jsonObject
.
getLong
(
"time"
);
// if ((startTime - endTime) <= 600000) {
if
(((
currentTime
-
endTime
)
<=
clipping_time
)&&
(!
deviceLastInfo
.
get
(
topic
).
equals
(
coordinate
)))
{
if
(((
currentTime
-
endTime
)
<=
clipping_time
)
&&
(!
deviceLastInfo
.
get
(
topic
).
equals
(
coordinate
)))
{
try
{
deviceInfo
.
get
(
topic
).
interrupt
();
}
catch
(
Exception
e
)
{
...
...
@@ -86,7 +87,7 @@ public class CarIotNewListener extends EmqxListener {
ThreadCar
threadCar
=
new
ThreadCar
(
topic
,
jsonObject
,
this
.
iWlCarMileageService
,
this
.
iotFeign
,
this
.
iCarService
,
this
.
emqkeeper
,
clipping_time
);
deviceInfo
.
put
(
topic
,
threadCar
);
//更新车辆的最新坐标数据
deviceLastInfo
.
put
(
topic
,
coordinate
);
deviceLastInfo
.
put
(
topic
,
coordinate
);
threadCar
.
start
();
}
if
(
iWlCarMileageService
.
getUncompleteMileagByIotCode
(
iotCode
))
{
...
...
@@ -112,6 +113,7 @@ public class CarIotNewListener extends EmqxListener {
}
}
}
}
public
String
getAddress
(
double
longitude
,
double
lantitude
)
{
StringBuilder
api
=
new
StringBuilder
(
GUIDE_URL
);
...
...
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