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 98bdb8b6
authored
Dec 29, 2021
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化Gps基站落库数据
1 parent
bc15f57b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
src/main/java/cn/com/glsx/kafka/service/TransitHandleService.java
src/test/java/cn/com/glsx/kafka/queue/remote/RemoteDeviceLocationServiceTest.java
src/main/java/cn/com/glsx/kafka/service/TransitHandleService.java
View file @
98bdb8b
...
@@ -50,6 +50,9 @@ public class TransitHandleService {
...
@@ -50,6 +50,9 @@ public class TransitHandleService {
public
void
handleGpsAndBsData
(
DeviceLocationDto
deviceLocationDto
)
{
public
void
handleGpsAndBsData
(
DeviceLocationDto
deviceLocationDto
)
{
DeviceLocationDto
deviceLocationCache
=
(
DeviceLocationDto
)
redisUtils
.
get
(
setKey
(
deviceLocationDto
.
getSn
()));
DeviceLocationDto
deviceLocationCache
=
(
DeviceLocationDto
)
redisUtils
.
get
(
setKey
(
deviceLocationDto
.
getSn
()));
if
(
ObjectUtil
.
isNull
(
deviceLocationCache
))
{
if
(
ObjectUtil
.
isNull
(
deviceLocationCache
))
{
// 缓存中没有 就是第一次插入数据 设置创建时间同步更新时间
deviceLocationDto
.
setCreatedTime
(
new
Date
());
deviceLocationDto
.
setUpdatedTime
(
new
Date
());
redisUtils
.
set
(
setKey
(
deviceLocationDto
.
getSn
()),
deviceLocationDto
);
redisUtils
.
set
(
setKey
(
deviceLocationDto
.
getSn
()),
deviceLocationDto
);
deviceLocationMap
.
put
(
deviceLocationDto
.
getSn
(),
deviceLocationDto
);
deviceLocationMap
.
put
(
deviceLocationDto
.
getSn
(),
deviceLocationDto
);
}
else
{
}
else
{
...
@@ -72,6 +75,8 @@ public class TransitHandleService {
...
@@ -72,6 +75,8 @@ public class TransitHandleService {
// 判断是否有数据更新 有数据更新重新设置回缓存
// 判断是否有数据更新 有数据更新重新设置回缓存
if
(
flag
)
{
if
(
flag
)
{
// 同步更新时间
deviceLocationCache
.
setUpdatedTime
(
new
Date
());
redisUtils
.
set
(
setKey
(
deviceLocationDto
.
getSn
()),
deviceLocationCache
);
redisUtils
.
set
(
setKey
(
deviceLocationDto
.
getSn
()),
deviceLocationCache
);
deviceLocationMap
.
put
(
deviceLocationDto
.
getSn
(),
deviceLocationCache
);
deviceLocationMap
.
put
(
deviceLocationDto
.
getSn
(),
deviceLocationCache
);
}
}
...
...
src/test/java/cn/com/glsx/kafka/queue/remote/RemoteDeviceLocationServiceTest.java
View file @
98bdb8b
...
@@ -36,6 +36,8 @@ public class RemoteDeviceLocationServiceTest {
...
@@ -36,6 +36,8 @@ public class RemoteDeviceLocationServiceTest {
deviceLocationDto
.
setSn
(
"123456789"
);
deviceLocationDto
.
setSn
(
"123456789"
);
deviceLocationDto
.
setLastGpsTime
(
new
Date
());
deviceLocationDto
.
setLastGpsTime
(
new
Date
());
deviceLocationDto
.
setLastBsTime
(
new
Date
());
deviceLocationDto
.
setLastBsTime
(
new
Date
());
deviceLocationDto
.
setCreatedTime
(
new
Date
());
deviceLocationDto
.
setUpdatedTime
(
new
Date
());
deviceLocationDtos
.
add
(
deviceLocationDto
);
deviceLocationDtos
.
add
(
deviceLocationDto
);
remoteDeviceLocationService
.
saveOrUpdateDeviceLocationData
(
deviceLocationDtos
);
remoteDeviceLocationService
.
saveOrUpdateDeviceLocationData
(
deviceLocationDtos
);
System
.
out
.
println
(
"更新成功==="
);
System
.
out
.
println
(
"更新成功==="
);
...
...
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