Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-kafkaconsumer-gpsbs
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 de233333
authored
Dec 30, 2021
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化设备停驶状态消费逻辑
1 parent
afd5262d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
src/main/java/cn/com/glsx/kafka/service/TransitHandleService.java
src/main/java/cn/com/glsx/kafka/service/TransitHandleService.java
View file @
de23333
...
@@ -52,6 +52,10 @@ public class TransitHandleService {
...
@@ -52,6 +52,10 @@ public class TransitHandleService {
public
void
handleGpsAndBsData
(
DeviceLocationDto
deviceLocationDto
,
Integer
topicId
)
{
public
void
handleGpsAndBsData
(
DeviceLocationDto
deviceLocationDto
,
Integer
topicId
)
{
DeviceLocationDto
deviceLocationCache
=
(
DeviceLocationDto
)
redisUtils
.
get
(
setKey
(
deviceLocationDto
.
getSn
()));
DeviceLocationDto
deviceLocationCache
=
(
DeviceLocationDto
)
redisUtils
.
get
(
setKey
(
deviceLocationDto
.
getSn
()));
if
(
ObjectUtil
.
isNull
(
deviceLocationCache
))
{
if
(
ObjectUtil
.
isNull
(
deviceLocationCache
))
{
if
(
TopicsEnum
.
DEVICE_STATE
.
getId
().
equals
(
topicId
))
{
log
.
error
(
"该设备{}消费行驶状态前没有消费Gps或基站数据"
,
deviceLocationDto
.
getSn
());
return
;
}
// 缓存中没有 就是第一次插入数据 设置创建时间同步更新时间
// 缓存中没有 就是第一次插入数据 设置创建时间同步更新时间
deviceLocationDto
.
setCreatedTime
(
new
Date
());
deviceLocationDto
.
setCreatedTime
(
new
Date
());
log
.
info
(
"报警消费数据===sn:"
+
deviceLocationDto
.
getSn
()
+
"Gps时间:"
+
DateUtil
.
formatDateTime
(
deviceLocationDto
.
getLastGpsTime
())
+
"基站时间:"
+
DateUtil
.
formatDateTime
(
deviceLocationDto
.
getLastBsTime
()));
log
.
info
(
"报警消费数据===sn:"
+
deviceLocationDto
.
getSn
()
+
"Gps时间:"
+
DateUtil
.
formatDateTime
(
deviceLocationDto
.
getLastGpsTime
())
+
"基站时间:"
+
DateUtil
.
formatDateTime
(
deviceLocationDto
.
getLastBsTime
()));
...
@@ -75,9 +79,11 @@ public class TransitHandleService {
...
@@ -75,9 +79,11 @@ public class TransitHandleService {
flag
=
true
;
flag
=
true
;
}
}
// 停驶状态更新 同步设置flag为true
if
(
TopicsEnum
.
DEVICE_STATE
.
getId
().
equals
(
topicId
))
{
if
(
TopicsEnum
.
DEVICE_STATE
.
getId
().
equals
(
topicId
))
{
deviceLocationCache
.
setStayStatus
(
deviceLocationDto
.
getStayStatus
());
deviceLocationCache
.
setStayStatus
(
deviceLocationDto
.
getStayStatus
());
deviceLocationCache
.
setStayStatusUpdatetime
(
deviceLocationDto
.
getStayStatusUpdatetime
());
deviceLocationCache
.
setStayStatusUpdatetime
(
deviceLocationDto
.
getStayStatusUpdatetime
());
flag
=
true
;
}
}
// 判断是否有数据更新 有数据更新重新设置回缓存
// 判断是否有数据更新 有数据更新重新设置回缓存
...
...
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