Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
glsx-smart-device-kafka-consumer
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 1ba0b6aa
authored
Apr 16, 2021
by
111-PC\111
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]kafka消费数据修改
1 parent
3945d97e
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
6 deletions
src/main/java/cn/com/glsx/smart/queue/EdrFlameOutConsumer.java
src/main/java/cn/com/glsx/smart/queue/EdrIgnitionConsumer.java
src/main/java/cn/com/glsx/smart/queue/GPSFlameOutConsumer.java
src/main/java/cn/com/glsx/smart/queue/GpsIgnitionConsumer.java
src/main/java/cn/com/glsx/smart/queue/LeaveHomeFlagConsumer.java
src/main/java/cn/com/glsx/smart/queue/OrderIssueConsumer.java
src/main/java/cn/com/glsx/smart/queue/EdrFlameOutConsumer.java
View file @
1ba0b6a
...
@@ -4,6 +4,7 @@ import cn.com.glsx.smart.queue.base.MessageReceiver;
...
@@ -4,6 +4,7 @@ import cn.com.glsx.smart.queue.base.MessageReceiver;
import
cn.com.glsx.smart.service.SmartDeviceStatusService
;
import
cn.com.glsx.smart.service.SmartDeviceStatusService
;
import
cn.com.glsx.smart.utils.ProtobufConvert
;
import
cn.com.glsx.smart.utils.ProtobufConvert
;
import
cn.com.glsx.smart.vo.Event
;
import
cn.com.glsx.smart.vo.Event
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
/**
/**
...
@@ -12,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -12,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
* @author zhouhaibao
* @author zhouhaibao
* @date 2021/4/10 18:12
* @date 2021/4/10 18:12
*/
*/
@Slf4j
public
class
EdrFlameOutConsumer
extends
MessageReceiver
{
public
class
EdrFlameOutConsumer
extends
MessageReceiver
{
...
@@ -20,10 +22,15 @@ public class EdrFlameOutConsumer extends MessageReceiver {
...
@@ -20,10 +22,15 @@ public class EdrFlameOutConsumer extends MessageReceiver {
@Override
@Override
public
void
processMessage
(
String
topic
,
byte
[]
message
)
{
public
void
processMessage
(
String
topic
,
byte
[]
message
)
{
Event
event
=
ProtobufConvert
.
convertFlameOut
(
message
);
try
{
Event
event
=
ProtobufConvert
.
convertFlameOut
(
message
);
if
(
event
==
null
)
{
if
(
event
==
null
)
{
return
;
return
;
}
}
smartDeviceStatusService
.
saveEvent
(
event
);
smartDeviceStatusService
.
saveEvent
(
event
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
info
(
"topic{}消费异常"
,
topic
);
}
}
}
}
}
src/main/java/cn/com/glsx/smart/queue/EdrIgnitionConsumer.java
View file @
1ba0b6a
...
@@ -4,6 +4,7 @@ import cn.com.glsx.smart.queue.base.MessageReceiver;
...
@@ -4,6 +4,7 @@ import cn.com.glsx.smart.queue.base.MessageReceiver;
import
cn.com.glsx.smart.service.SmartDeviceStatusService
;
import
cn.com.glsx.smart.service.SmartDeviceStatusService
;
import
cn.com.glsx.smart.utils.ProtobufConvert
;
import
cn.com.glsx.smart.utils.ProtobufConvert
;
import
cn.com.glsx.smart.vo.Event
;
import
cn.com.glsx.smart.vo.Event
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
/**
/**
...
@@ -12,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -12,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
* @author zhouhaibao
* @author zhouhaibao
* @date 2021/4/10 16:51
* @date 2021/4/10 16:51
*/
*/
@Slf4j
public
class
EdrIgnitionConsumer
extends
MessageReceiver
{
public
class
EdrIgnitionConsumer
extends
MessageReceiver
{
@Autowired
@Autowired
...
@@ -19,11 +21,17 @@ public class EdrIgnitionConsumer extends MessageReceiver {
...
@@ -19,11 +21,17 @@ public class EdrIgnitionConsumer extends MessageReceiver {
@Override
@Override
public
void
processMessage
(
String
topic
,
byte
[]
message
)
{
public
void
processMessage
(
String
topic
,
byte
[]
message
)
{
try
{
Event
event
=
ProtobufConvert
.
convertIgnition
(
message
);
Event
event
=
ProtobufConvert
.
convertIgnition
(
message
);
if
(
event
==
null
)
{
if
(
event
==
null
)
{
return
;
return
;
}
}
smartDeviceStatusService
.
saveEvent
(
event
);
smartDeviceStatusService
.
saveEvent
(
event
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
info
(
"topic{}消费异常"
,
topic
);
}
}
}
}
}
src/main/java/cn/com/glsx/smart/queue/GPSFlameOutConsumer.java
View file @
1ba0b6a
...
@@ -4,6 +4,7 @@ import cn.com.glsx.smart.queue.base.MessageReceiver;
...
@@ -4,6 +4,7 @@ import cn.com.glsx.smart.queue.base.MessageReceiver;
import
cn.com.glsx.smart.service.SmartDeviceStatusService
;
import
cn.com.glsx.smart.service.SmartDeviceStatusService
;
import
cn.com.glsx.smart.utils.ProtobufConvert
;
import
cn.com.glsx.smart.utils.ProtobufConvert
;
import
cn.com.glsx.smart.vo.Event
;
import
cn.com.glsx.smart.vo.Event
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
/**
/**
...
@@ -12,18 +13,23 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -12,18 +13,23 @@ import org.springframework.beans.factory.annotation.Autowired;
* @author zhouhaibao
* @author zhouhaibao
* @date 2021/4/10 18:12
* @date 2021/4/10 18:12
*/
*/
@Slf4j
public
class
GPSFlameOutConsumer
extends
MessageReceiver
{
public
class
GPSFlameOutConsumer
extends
MessageReceiver
{
@Autowired
@Autowired
private
SmartDeviceStatusService
smartDeviceStatusService
;
private
SmartDeviceStatusService
smartDeviceStatusService
;
@Override
@Override
public
void
processMessage
(
String
topic
,
byte
[]
message
)
{
public
void
processMessage
(
String
topic
,
byte
[]
message
)
{
Event
event
=
ProtobufConvert
.
convertFlameOut
(
message
);
try
{
Event
event
=
ProtobufConvert
.
convertFlameOut
(
message
);
if
(
event
==
null
)
{
if
(
event
==
null
)
{
return
;
return
;
}
}
smartDeviceStatusService
.
saveEvent
(
event
);
smartDeviceStatusService
.
saveEvent
(
event
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
info
(
"topic{}消费异常"
,
topic
);
}
}
}
}
}
src/main/java/cn/com/glsx/smart/queue/GpsIgnitionConsumer.java
View file @
1ba0b6a
...
@@ -4,6 +4,7 @@ import cn.com.glsx.smart.queue.base.MessageReceiver;
...
@@ -4,6 +4,7 @@ import cn.com.glsx.smart.queue.base.MessageReceiver;
import
cn.com.glsx.smart.service.SmartDeviceStatusService
;
import
cn.com.glsx.smart.service.SmartDeviceStatusService
;
import
cn.com.glsx.smart.utils.ProtobufConvert
;
import
cn.com.glsx.smart.utils.ProtobufConvert
;
import
cn.com.glsx.smart.vo.Event
;
import
cn.com.glsx.smart.vo.Event
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
/**
/**
...
@@ -12,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -12,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
* @author zhouhaibao
* @author zhouhaibao
* @date 2021/4/10 16:51
* @date 2021/4/10 16:51
*/
*/
@Slf4j
public
class
GpsIgnitionConsumer
extends
MessageReceiver
{
public
class
GpsIgnitionConsumer
extends
MessageReceiver
{
@Autowired
@Autowired
...
@@ -19,11 +21,16 @@ public class GpsIgnitionConsumer extends MessageReceiver {
...
@@ -19,11 +21,16 @@ public class GpsIgnitionConsumer extends MessageReceiver {
@Override
@Override
public
void
processMessage
(
String
topic
,
byte
[]
message
)
{
public
void
processMessage
(
String
topic
,
byte
[]
message
)
{
try
{
Event
event
=
ProtobufConvert
.
convertIgnition
(
message
);
Event
event
=
ProtobufConvert
.
convertIgnition
(
message
);
if
(
event
==
null
)
{
if
(
event
==
null
)
{
return
;
return
;
}
}
smartDeviceStatusService
.
saveEvent
(
event
);
smartDeviceStatusService
.
saveEvent
(
event
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
info
(
"topic{}消费异常"
,
topic
);
}
}
}
}
}
src/main/java/cn/com/glsx/smart/queue/LeaveHomeFlagConsumer.java
View file @
1ba0b6a
...
@@ -19,11 +19,16 @@ public class LeaveHomeFlagConsumer extends MessageReceiver {
...
@@ -19,11 +19,16 @@ public class LeaveHomeFlagConsumer extends MessageReceiver {
@Override
@Override
public
void
processMessage
(
String
topic
,
byte
[]
message
)
{
public
void
processMessage
(
String
topic
,
byte
[]
message
)
{
log
.
info
(
"topic{}开始消费"
,
topic
);
try
{
log
.
info
(
"topic{}开始消费"
,
topic
);
Event
event
=
ProtobufConvert
.
convertLeaveHome
(
message
);
Event
event
=
ProtobufConvert
.
convertLeaveHome
(
message
);
if
(
event
==
null
)
{
if
(
event
==
null
)
{
return
;
return
;
}
}
smartDeviceStatusService
.
saveEvent
(
event
);
smartDeviceStatusService
.
saveEvent
(
event
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
log
.
info
(
"topic{}消费异常"
,
topic
);
}
}
}
}
}
src/main/java/cn/com/glsx/smart/queue/OrderIssueConsumer.java
View file @
1ba0b6a
...
@@ -19,8 +19,13 @@ public class OrderIssueConsumer extends MessageReceiver {
...
@@ -19,8 +19,13 @@ public class OrderIssueConsumer extends MessageReceiver {
@Override
@Override
public
void
processMessage
(
String
topic
,
byte
[]
message
)
{
public
void
processMessage
(
String
topic
,
byte
[]
message
)
{
try
{
String
data
=
new
String
(
message
);
String
data
=
new
String
(
message
);
log
.
info
(
"开始消费----------{}"
,
data
);
log
.
info
(
"开始消费----------{}"
,
data
);
orderIssueService
.
processMessage
(
data
);
orderIssueService
.
processMessage
(
data
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
info
(
"topic{}消费异常"
,
topic
);
}
}
}
}
}
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