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 a514541a
authored
Dec 29, 2021
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
打印消费日志
1 parent
98bdb8b6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
1 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 @
a514541
...
@@ -3,6 +3,7 @@ package cn.com.glsx.kafka.service;
...
@@ -3,6 +3,7 @@ package cn.com.glsx.kafka.service;
import
cn.com.glsx.kafka.queue.remote.RemoteDeviceLocationService
;
import
cn.com.glsx.kafka.queue.remote.RemoteDeviceLocationService
;
import
cn.com.glsx.stdinterface.dto.DeviceLocationDto
;
import
cn.com.glsx.stdinterface.dto.DeviceLocationDto
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.glsx.plat.redis.utils.RedisUtils
;
import
com.glsx.plat.redis.utils.RedisUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -53,6 +54,7 @@ public class TransitHandleService {
...
@@ -53,6 +54,7 @@ public class TransitHandleService {
// 缓存中没有 就是第一次插入数据 设置创建时间同步更新时间
// 缓存中没有 就是第一次插入数据 设置创建时间同步更新时间
deviceLocationDto
.
setCreatedTime
(
new
Date
());
deviceLocationDto
.
setCreatedTime
(
new
Date
());
deviceLocationDto
.
setUpdatedTime
(
new
Date
());
deviceLocationDto
.
setUpdatedTime
(
new
Date
());
log
.
info
(
"报警消费数据==="
+
JSONUtil
.
toJsonStr
(
deviceLocationDto
));
redisUtils
.
set
(
setKey
(
deviceLocationDto
.
getSn
()),
deviceLocationDto
);
redisUtils
.
set
(
setKey
(
deviceLocationDto
.
getSn
()),
deviceLocationDto
);
deviceLocationMap
.
put
(
deviceLocationDto
.
getSn
(),
deviceLocationDto
);
deviceLocationMap
.
put
(
deviceLocationDto
.
getSn
(),
deviceLocationDto
);
}
else
{
}
else
{
...
@@ -77,6 +79,7 @@ public class TransitHandleService {
...
@@ -77,6 +79,7 @@ public class TransitHandleService {
if
(
flag
)
{
if
(
flag
)
{
// 同步更新时间
// 同步更新时间
deviceLocationCache
.
setUpdatedTime
(
new
Date
());
deviceLocationCache
.
setUpdatedTime
(
new
Date
());
log
.
info
(
"报警消费数据==="
+
JSONUtil
.
toJsonStr
(
deviceLocationDto
));
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 @
a514541
...
@@ -36,7 +36,6 @@ public class RemoteDeviceLocationServiceTest {
...
@@ -36,7 +36,6 @@ 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
());
deviceLocationDto
.
setUpdatedTime
(
new
Date
());
deviceLocationDtos
.
add
(
deviceLocationDto
);
deviceLocationDtos
.
add
(
deviceLocationDto
);
remoteDeviceLocationService
.
saveOrUpdateDeviceLocationData
(
deviceLocationDtos
);
remoteDeviceLocationService
.
saveOrUpdateDeviceLocationData
(
deviceLocationDtos
);
...
...
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