Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-devicemonitor
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 ab7f7d83
authored
Nov 17, 2021
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
解决设备状态显示问题
1 parent
bf2b9415
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
src/main/java/cn/com/glsx/devicemonitor/modules/utils/DeviceUtils.java
src/main/java/cn/com/glsx/devicemonitor/modules/utils/DeviceUtils.java
View file @
ab7f7d8
...
...
@@ -36,7 +36,7 @@ public class DeviceUtils {
}
long
gpsDateLong
=
lastRttrackDate
!=
null
?
lastRttrackDate
.
getTime
()
:
0
;
long
gprsDateLong
=
lastGprsDate
!=
null
?
lastGprsDate
.
getTime
()
:
0
;
Integer
speed
=
deviceLogin
.
getSpeed
();
if
(
gpsDateLong
==
0
&&
gprsDateLong
==
0
)
{
deviceStatus
.
setStatus
(
ConstantsDevice
.
DEVICE_STATUS_OFFLINE
);
return
deviceStatus
;
...
...
@@ -46,16 +46,16 @@ public class DeviceUtils {
if
(
trackTime
>
now
)
{
trackTime
=
now
;
}
parseStatus
(
deviceStatus
,
speed
,
trackTime
,
offlineTime
);
parseStatus
(
deviceStatus
,
deviceLogin
,
trackTime
,
offlineTime
);
return
deviceStatus
;
}
/**
* @param deviceStatus
* @param
speed
* @param
deviceLogin
* @param trackTime
*/
private
static
void
parseStatus
(
DeviceStatusModel
deviceStatus
,
Integer
speed
,
long
trackTime
,
long
offlineTime
)
{
private
static
void
parseStatus
(
DeviceStatusModel
deviceStatus
,
DeviceLoginDto
deviceLogin
,
long
trackTime
,
long
offlineTime
)
{
long
now
=
System
.
currentTimeMillis
();
if
(
now
-
trackTime
>
offlineTime
)
{
deviceStatus
.
setStatus
(
ConstantsDevice
.
DEVICE_STATUS_OFFLINE
);
...
...
@@ -71,17 +71,17 @@ public class DeviceUtils {
return
;
}
//有源设备 有速度 判断是否行驶
parseSourceStatus
(
deviceStatus
,
speed
,
trackTime
,
offline
Time
);
parseSourceStatus
(
deviceStatus
,
deviceLogin
,
track
Time
);
}
/**
* 解析有源设备的状态
*
* @param deviceStatus
* @param
speed
* @param
deviceLogin
* @param trackTime
*/
public
static
void
parseSourceStatus
(
DeviceStatusModel
deviceStatus
,
Integer
speed
,
long
trackTime
,
long
offline
Time
)
{
public
static
void
parseSourceStatus
(
DeviceStatusModel
deviceStatus
,
DeviceLoginDto
deviceLogin
,
long
track
Time
)
{
long
now
=
System
.
currentTimeMillis
();
long
drivingTime
=
6
*
60
*
1000
;
if
(
now
-
trackTime
>
drivingTime
)
{
...
...
@@ -91,7 +91,7 @@ public class DeviceUtils {
return
;
}
//否则 在6分钟内并且有速度 则为行驶中
if
(
speed
!=
null
&&
speed
>
0
)
{
if
(
deviceLogin
.
getDeviceStayStatus
()
==
2
&&
deviceLogin
.
getSpeed
()
!=
null
&&
deviceLogin
.
getSpeed
()
>
0
)
{
//行驶状态
deviceStatus
.
setStatus
(
ConstantsDevice
.
DEVICE_STATUS_DRIVING
);
return
;
...
...
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