Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-kafkaconsumer
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 bcfbb35c
authored
May 12, 2022
by
向延琳
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
超速报警消费
1 parent
3b6440d3
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1981 additions
and
0 deletions
src/main/java/cn/com/glsx/kafka/config/KafkaConsumerConfig.java
src/main/java/cn/com/glsx/kafka/protocol/KafkaJourneyOverSpeed.java
src/main/java/cn/com/glsx/kafka/queue/consumer/KafkaOverSpeedConsumer.java
src/main/java/cn/com/glsx/kafka/service/OverSpeedService.java
src/main/java/cn/com/glsx/kafka/config/KafkaConsumerConfig.java
View file @
bcfbb35
...
@@ -135,4 +135,13 @@ public class KafkaConsumerConfig {
...
@@ -135,4 +135,13 @@ public class KafkaConsumerConfig {
gpsAlarmConsumer
.
setTopic
(
topic
);
gpsAlarmConsumer
.
setTopic
(
topic
);
return
gpsAlarmConsumer
;
return
gpsAlarmConsumer
;
}
}
@Bean
(
initMethod
=
"init"
,
destroyMethod
=
"destroy"
)
KafkaOverSpeedConsumer
kafkaOverSpeedConsumer
(
@Value
(
"${mq.kafka.device.journey.verspeed.topic}"
)
String
topic
)
{
KafkaOverSpeedConsumer
consumer
=
new
KafkaOverSpeedConsumer
();
consumer
.
setnThreads
(
nThreads
);
consumer
.
setConsumerConfig
(
bizConsumerConfig
);
consumer
.
setTopic
(
topic
);
return
consumer
;
}
}
}
src/main/java/cn/com/glsx/kafka/protocol/KafkaJourneyOverSpeed.java
0 → 100644
View file @
bcfbb35
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: kafka_journey.proto
package
cn
.
com
.
glsx
.
kafka
.
protocol
;
public
final
class
KafkaJourneyOverSpeed
{
private
KafkaJourneyOverSpeed
()
{}
public
static
void
registerAllExtensions
(
com
.
google
.
protobuf
.
ExtensionRegistry
registry
)
{
}
public
interface
neshield_journey_reqOrBuilder
extends
com
.
google
.
protobuf
.
MessageOrBuilder
{
// required string sn = 1;
boolean
hasSn
();
String
getSn
();
// required string beginTime = 3;
boolean
hasBeginTime
();
String
getBeginTime
();
// required string beginLng = 4;
boolean
hasBeginLng
();
String
getBeginLng
();
// required string beginLat = 5;
boolean
hasBeginLat
();
String
getBeginLat
();
// required string endTime = 6;
boolean
hasEndTime
();
String
getEndTime
();
// required string endLng = 7;
boolean
hasEndLng
();
String
getEndLng
();
// required string endLat = 8;
boolean
hasEndLat
();
String
getEndLat
();
// required uint32 mileage = 9;
boolean
hasMileage
();
int
getMileage
();
}
public
static
final
class
neshield_journey_req
extends
com
.
google
.
protobuf
.
GeneratedMessage
implements
neshield_journey_reqOrBuilder
{
// Use neshield_journey_req.newBuilder() to construct.
private
neshield_journey_req
(
Builder
builder
)
{
super
(
builder
);
}
private
neshield_journey_req
(
boolean
noInit
)
{}
private
static
final
neshield_journey_req
defaultInstance
;
public
static
neshield_journey_req
getDefaultInstance
()
{
return
defaultInstance
;
}
public
neshield_journey_req
getDefaultInstanceForType
()
{
return
defaultInstance
;
}
public
static
final
com
.
google
.
protobuf
.
Descriptors
.
Descriptor
getDescriptor
()
{
return
KafkaJourneyOverSpeed
.
internal_static_protos_journey_neshield_journey_req_descriptor
;
}
protected
com
.
google
.
protobuf
.
GeneratedMessage
.
FieldAccessorTable
internalGetFieldAccessorTable
()
{
return
KafkaJourneyOverSpeed
.
internal_static_protos_journey_neshield_journey_req_fieldAccessorTable
;
}
private
int
bitField0_
;
// required string sn = 1;
public
static
final
int
SN_FIELD_NUMBER
=
1
;
private
java
.
lang
.
Object
sn_
;
public
boolean
hasSn
()
{
return
((
bitField0_
&
0x00000001
)
==
0x00000001
);
}
public
String
getSn
()
{
java
.
lang
.
Object
ref
=
sn_
;
if
(
ref
instanceof
String
)
{
return
(
String
)
ref
;
}
else
{
com
.
google
.
protobuf
.
ByteString
bs
=
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
String
s
=
bs
.
toStringUtf8
();
if
(
com
.
google
.
protobuf
.
Internal
.
isValidUtf8
(
bs
))
{
sn_
=
s
;
}
return
s
;
}
}
private
com
.
google
.
protobuf
.
ByteString
getSnBytes
()
{
java
.
lang
.
Object
ref
=
sn_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
((
String
)
ref
);
sn_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
// required string beginTime = 3;
public
static
final
int
BEGINTIME_FIELD_NUMBER
=
3
;
private
java
.
lang
.
Object
beginTime_
;
public
boolean
hasBeginTime
()
{
return
((
bitField0_
&
0x00000002
)
==
0x00000002
);
}
public
String
getBeginTime
()
{
java
.
lang
.
Object
ref
=
beginTime_
;
if
(
ref
instanceof
String
)
{
return
(
String
)
ref
;
}
else
{
com
.
google
.
protobuf
.
ByteString
bs
=
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
String
s
=
bs
.
toStringUtf8
();
if
(
com
.
google
.
protobuf
.
Internal
.
isValidUtf8
(
bs
))
{
beginTime_
=
s
;
}
return
s
;
}
}
private
com
.
google
.
protobuf
.
ByteString
getBeginTimeBytes
()
{
java
.
lang
.
Object
ref
=
beginTime_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
((
String
)
ref
);
beginTime_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
// required string beginLng = 4;
public
static
final
int
BEGINLNG_FIELD_NUMBER
=
4
;
private
java
.
lang
.
Object
beginLng_
;
public
boolean
hasBeginLng
()
{
return
((
bitField0_
&
0x00000004
)
==
0x00000004
);
}
public
String
getBeginLng
()
{
java
.
lang
.
Object
ref
=
beginLng_
;
if
(
ref
instanceof
String
)
{
return
(
String
)
ref
;
}
else
{
com
.
google
.
protobuf
.
ByteString
bs
=
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
String
s
=
bs
.
toStringUtf8
();
if
(
com
.
google
.
protobuf
.
Internal
.
isValidUtf8
(
bs
))
{
beginLng_
=
s
;
}
return
s
;
}
}
private
com
.
google
.
protobuf
.
ByteString
getBeginLngBytes
()
{
java
.
lang
.
Object
ref
=
beginLng_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
((
String
)
ref
);
beginLng_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
// required string beginLat = 5;
public
static
final
int
BEGINLAT_FIELD_NUMBER
=
5
;
private
java
.
lang
.
Object
beginLat_
;
public
boolean
hasBeginLat
()
{
return
((
bitField0_
&
0x00000008
)
==
0x00000008
);
}
public
String
getBeginLat
()
{
java
.
lang
.
Object
ref
=
beginLat_
;
if
(
ref
instanceof
String
)
{
return
(
String
)
ref
;
}
else
{
com
.
google
.
protobuf
.
ByteString
bs
=
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
String
s
=
bs
.
toStringUtf8
();
if
(
com
.
google
.
protobuf
.
Internal
.
isValidUtf8
(
bs
))
{
beginLat_
=
s
;
}
return
s
;
}
}
private
com
.
google
.
protobuf
.
ByteString
getBeginLatBytes
()
{
java
.
lang
.
Object
ref
=
beginLat_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
((
String
)
ref
);
beginLat_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
// required string endTime = 6;
public
static
final
int
ENDTIME_FIELD_NUMBER
=
6
;
private
java
.
lang
.
Object
endTime_
;
public
boolean
hasEndTime
()
{
return
((
bitField0_
&
0x00000010
)
==
0x00000010
);
}
public
String
getEndTime
()
{
java
.
lang
.
Object
ref
=
endTime_
;
if
(
ref
instanceof
String
)
{
return
(
String
)
ref
;
}
else
{
com
.
google
.
protobuf
.
ByteString
bs
=
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
String
s
=
bs
.
toStringUtf8
();
if
(
com
.
google
.
protobuf
.
Internal
.
isValidUtf8
(
bs
))
{
endTime_
=
s
;
}
return
s
;
}
}
private
com
.
google
.
protobuf
.
ByteString
getEndTimeBytes
()
{
java
.
lang
.
Object
ref
=
endTime_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
((
String
)
ref
);
endTime_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
// required string endLng = 7;
public
static
final
int
ENDLNG_FIELD_NUMBER
=
7
;
private
java
.
lang
.
Object
endLng_
;
public
boolean
hasEndLng
()
{
return
((
bitField0_
&
0x00000020
)
==
0x00000020
);
}
public
String
getEndLng
()
{
java
.
lang
.
Object
ref
=
endLng_
;
if
(
ref
instanceof
String
)
{
return
(
String
)
ref
;
}
else
{
com
.
google
.
protobuf
.
ByteString
bs
=
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
String
s
=
bs
.
toStringUtf8
();
if
(
com
.
google
.
protobuf
.
Internal
.
isValidUtf8
(
bs
))
{
endLng_
=
s
;
}
return
s
;
}
}
private
com
.
google
.
protobuf
.
ByteString
getEndLngBytes
()
{
java
.
lang
.
Object
ref
=
endLng_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
((
String
)
ref
);
endLng_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
// required string endLat = 8;
public
static
final
int
ENDLAT_FIELD_NUMBER
=
8
;
private
java
.
lang
.
Object
endLat_
;
public
boolean
hasEndLat
()
{
return
((
bitField0_
&
0x00000040
)
==
0x00000040
);
}
public
String
getEndLat
()
{
java
.
lang
.
Object
ref
=
endLat_
;
if
(
ref
instanceof
String
)
{
return
(
String
)
ref
;
}
else
{
com
.
google
.
protobuf
.
ByteString
bs
=
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
String
s
=
bs
.
toStringUtf8
();
if
(
com
.
google
.
protobuf
.
Internal
.
isValidUtf8
(
bs
))
{
endLat_
=
s
;
}
return
s
;
}
}
private
com
.
google
.
protobuf
.
ByteString
getEndLatBytes
()
{
java
.
lang
.
Object
ref
=
endLat_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
((
String
)
ref
);
endLat_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
// required uint32 mileage = 9;
public
static
final
int
MILEAGE_FIELD_NUMBER
=
9
;
private
int
mileage_
;
public
boolean
hasMileage
()
{
return
((
bitField0_
&
0x00000080
)
==
0x00000080
);
}
public
int
getMileage
()
{
return
mileage_
;
}
private
void
initFields
()
{
sn_
=
""
;
beginTime_
=
""
;
beginLng_
=
""
;
beginLat_
=
""
;
endTime_
=
""
;
endLng_
=
""
;
endLat_
=
""
;
mileage_
=
0
;
}
private
byte
memoizedIsInitialized
=
-
1
;
public
final
boolean
isInitialized
()
{
byte
isInitialized
=
memoizedIsInitialized
;
if
(
isInitialized
!=
-
1
)
return
isInitialized
==
1
;
if
(!
hasSn
())
{
memoizedIsInitialized
=
0
;
return
false
;
}
if
(!
hasBeginTime
())
{
memoizedIsInitialized
=
0
;
return
false
;
}
if
(!
hasBeginLng
())
{
memoizedIsInitialized
=
0
;
return
false
;
}
if
(!
hasBeginLat
())
{
memoizedIsInitialized
=
0
;
return
false
;
}
if
(!
hasEndTime
())
{
memoizedIsInitialized
=
0
;
return
false
;
}
if
(!
hasEndLng
())
{
memoizedIsInitialized
=
0
;
return
false
;
}
if
(!
hasEndLat
())
{
memoizedIsInitialized
=
0
;
return
false
;
}
if
(!
hasMileage
())
{
memoizedIsInitialized
=
0
;
return
false
;
}
memoizedIsInitialized
=
1
;
return
true
;
}
public
void
writeTo
(
com
.
google
.
protobuf
.
CodedOutputStream
output
)
throws
java
.
io
.
IOException
{
getSerializedSize
();
if
(((
bitField0_
&
0x00000001
)
==
0x00000001
))
{
output
.
writeBytes
(
1
,
getSnBytes
());
}
if
(((
bitField0_
&
0x00000002
)
==
0x00000002
))
{
output
.
writeBytes
(
3
,
getBeginTimeBytes
());
}
if
(((
bitField0_
&
0x00000004
)
==
0x00000004
))
{
output
.
writeBytes
(
4
,
getBeginLngBytes
());
}
if
(((
bitField0_
&
0x00000008
)
==
0x00000008
))
{
output
.
writeBytes
(
5
,
getBeginLatBytes
());
}
if
(((
bitField0_
&
0x00000010
)
==
0x00000010
))
{
output
.
writeBytes
(
6
,
getEndTimeBytes
());
}
if
(((
bitField0_
&
0x00000020
)
==
0x00000020
))
{
output
.
writeBytes
(
7
,
getEndLngBytes
());
}
if
(((
bitField0_
&
0x00000040
)
==
0x00000040
))
{
output
.
writeBytes
(
8
,
getEndLatBytes
());
}
if
(((
bitField0_
&
0x00000080
)
==
0x00000080
))
{
output
.
writeUInt32
(
9
,
mileage_
);
}
getUnknownFields
().
writeTo
(
output
);
}
private
int
memoizedSerializedSize
=
-
1
;
public
int
getSerializedSize
()
{
int
size
=
memoizedSerializedSize
;
if
(
size
!=
-
1
)
return
size
;
size
=
0
;
if
(((
bitField0_
&
0x00000001
)
==
0x00000001
))
{
size
+=
com
.
google
.
protobuf
.
CodedOutputStream
.
computeBytesSize
(
1
,
getSnBytes
());
}
if
(((
bitField0_
&
0x00000002
)
==
0x00000002
))
{
size
+=
com
.
google
.
protobuf
.
CodedOutputStream
.
computeBytesSize
(
3
,
getBeginTimeBytes
());
}
if
(((
bitField0_
&
0x00000004
)
==
0x00000004
))
{
size
+=
com
.
google
.
protobuf
.
CodedOutputStream
.
computeBytesSize
(
4
,
getBeginLngBytes
());
}
if
(((
bitField0_
&
0x00000008
)
==
0x00000008
))
{
size
+=
com
.
google
.
protobuf
.
CodedOutputStream
.
computeBytesSize
(
5
,
getBeginLatBytes
());
}
if
(((
bitField0_
&
0x00000010
)
==
0x00000010
))
{
size
+=
com
.
google
.
protobuf
.
CodedOutputStream
.
computeBytesSize
(
6
,
getEndTimeBytes
());
}
if
(((
bitField0_
&
0x00000020
)
==
0x00000020
))
{
size
+=
com
.
google
.
protobuf
.
CodedOutputStream
.
computeBytesSize
(
7
,
getEndLngBytes
());
}
if
(((
bitField0_
&
0x00000040
)
==
0x00000040
))
{
size
+=
com
.
google
.
protobuf
.
CodedOutputStream
.
computeBytesSize
(
8
,
getEndLatBytes
());
}
if
(((
bitField0_
&
0x00000080
)
==
0x00000080
))
{
size
+=
com
.
google
.
protobuf
.
CodedOutputStream
.
computeUInt32Size
(
9
,
mileage_
);
}
size
+=
getUnknownFields
().
getSerializedSize
();
memoizedSerializedSize
=
size
;
return
size
;
}
private
static
final
long
serialVersionUID
=
0L
;
@java
.
lang
.
Override
protected
java
.
lang
.
Object
writeReplace
()
throws
java
.
io
.
ObjectStreamException
{
return
super
.
writeReplace
();
}
public
static
KafkaJourneyOverSpeed
.
neshield_journey_req
parseFrom
(
com
.
google
.
protobuf
.
ByteString
data
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
newBuilder
().
mergeFrom
(
data
).
buildParsed
();
}
public
static
KafkaJourneyOverSpeed
.
neshield_journey_req
parseFrom
(
com
.
google
.
protobuf
.
ByteString
data
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
newBuilder
().
mergeFrom
(
data
,
extensionRegistry
)
.
buildParsed
();
}
public
static
KafkaJourneyOverSpeed
.
neshield_journey_req
parseFrom
(
byte
[]
data
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
newBuilder
().
mergeFrom
(
data
).
buildParsed
();
}
public
static
KafkaJourneyOverSpeed
.
neshield_journey_req
parseFrom
(
byte
[]
data
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
newBuilder
().
mergeFrom
(
data
,
extensionRegistry
)
.
buildParsed
();
}
public
static
KafkaJourneyOverSpeed
.
neshield_journey_req
parseFrom
(
java
.
io
.
InputStream
input
)
throws
java
.
io
.
IOException
{
return
newBuilder
().
mergeFrom
(
input
).
buildParsed
();
}
public
static
KafkaJourneyOverSpeed
.
neshield_journey_req
parseFrom
(
java
.
io
.
InputStream
input
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
java
.
io
.
IOException
{
return
newBuilder
().
mergeFrom
(
input
,
extensionRegistry
)
.
buildParsed
();
}
public
static
KafkaJourneyOverSpeed
.
neshield_journey_req
parseDelimitedFrom
(
java
.
io
.
InputStream
input
)
throws
java
.
io
.
IOException
{
Builder
builder
=
newBuilder
();
if
(
builder
.
mergeDelimitedFrom
(
input
))
{
return
builder
.
buildParsed
();
}
else
{
return
null
;
}
}
public
static
KafkaJourneyOverSpeed
.
neshield_journey_req
parseDelimitedFrom
(
java
.
io
.
InputStream
input
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
java
.
io
.
IOException
{
Builder
builder
=
newBuilder
();
if
(
builder
.
mergeDelimitedFrom
(
input
,
extensionRegistry
))
{
return
builder
.
buildParsed
();
}
else
{
return
null
;
}
}
public
static
KafkaJourneyOverSpeed
.
neshield_journey_req
parseFrom
(
com
.
google
.
protobuf
.
CodedInputStream
input
)
throws
java
.
io
.
IOException
{
return
newBuilder
().
mergeFrom
(
input
).
buildParsed
();
}
public
static
KafkaJourneyOverSpeed
.
neshield_journey_req
parseFrom
(
com
.
google
.
protobuf
.
CodedInputStream
input
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
java
.
io
.
IOException
{
return
newBuilder
().
mergeFrom
(
input
,
extensionRegistry
)
.
buildParsed
();
}
public
static
Builder
newBuilder
()
{
return
Builder
.
create
();
}
public
Builder
newBuilderForType
()
{
return
newBuilder
();
}
public
static
Builder
newBuilder
(
KafkaJourneyOverSpeed
.
neshield_journey_req
prototype
)
{
return
newBuilder
().
mergeFrom
(
prototype
);
}
public
Builder
toBuilder
()
{
return
newBuilder
(
this
);
}
@java
.
lang
.
Override
protected
Builder
newBuilderForType
(
com
.
google
.
protobuf
.
GeneratedMessage
.
BuilderParent
parent
)
{
Builder
builder
=
new
Builder
(
parent
);
return
builder
;
}
public
static
final
class
Builder
extends
com
.
google
.
protobuf
.
GeneratedMessage
.
Builder
<
Builder
>
implements
KafkaJourneyOverSpeed
.
neshield_journey_reqOrBuilder
{
public
static
final
com
.
google
.
protobuf
.
Descriptors
.
Descriptor
getDescriptor
()
{
return
KafkaJourneyOverSpeed
.
internal_static_protos_journey_neshield_journey_req_descriptor
;
}
protected
com
.
google
.
protobuf
.
GeneratedMessage
.
FieldAccessorTable
internalGetFieldAccessorTable
()
{
return
KafkaJourneyOverSpeed
.
internal_static_protos_journey_neshield_journey_req_fieldAccessorTable
;
}
// Construct using cn.com.glsx.kafka.protocol.kafka_journey.neshield_journey_req.newBuilder()
private
Builder
()
{
maybeForceBuilderInitialization
();
}
private
Builder
(
BuilderParent
parent
)
{
super
(
parent
);
maybeForceBuilderInitialization
();
}
private
void
maybeForceBuilderInitialization
()
{
if
(
com
.
google
.
protobuf
.
GeneratedMessage
.
alwaysUseFieldBuilders
)
{
}
}
private
static
Builder
create
()
{
return
new
Builder
();
}
public
Builder
clear
()
{
super
.
clear
();
sn_
=
""
;
bitField0_
=
(
bitField0_
&
~
0x00000001
);
beginTime_
=
""
;
bitField0_
=
(
bitField0_
&
~
0x00000002
);
beginLng_
=
""
;
bitField0_
=
(
bitField0_
&
~
0x00000004
);
beginLat_
=
""
;
bitField0_
=
(
bitField0_
&
~
0x00000008
);
endTime_
=
""
;
bitField0_
=
(
bitField0_
&
~
0x00000010
);
endLng_
=
""
;
bitField0_
=
(
bitField0_
&
~
0x00000020
);
endLat_
=
""
;
bitField0_
=
(
bitField0_
&
~
0x00000040
);
mileage_
=
0
;
bitField0_
=
(
bitField0_
&
~
0x00000080
);
return
this
;
}
public
Builder
clone
()
{
return
create
().
mergeFrom
(
buildPartial
());
}
public
com
.
google
.
protobuf
.
Descriptors
.
Descriptor
getDescriptorForType
()
{
return
KafkaJourneyOverSpeed
.
neshield_journey_req
.
getDescriptor
();
}
public
KafkaJourneyOverSpeed
.
neshield_journey_req
getDefaultInstanceForType
()
{
return
KafkaJourneyOverSpeed
.
neshield_journey_req
.
getDefaultInstance
();
}
public
KafkaJourneyOverSpeed
.
neshield_journey_req
build
()
{
KafkaJourneyOverSpeed
.
neshield_journey_req
result
=
buildPartial
();
if
(!
result
.
isInitialized
())
{
throw
newUninitializedMessageException
(
result
);
}
return
result
;
}
private
KafkaJourneyOverSpeed
.
neshield_journey_req
buildParsed
()
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
KafkaJourneyOverSpeed
.
neshield_journey_req
result
=
buildPartial
();
if
(!
result
.
isInitialized
())
{
throw
newUninitializedMessageException
(
result
).
asInvalidProtocolBufferException
();
}
return
result
;
}
public
KafkaJourneyOverSpeed
.
neshield_journey_req
buildPartial
()
{
KafkaJourneyOverSpeed
.
neshield_journey_req
result
=
new
KafkaJourneyOverSpeed
.
neshield_journey_req
(
this
);
int
from_bitField0_
=
bitField0_
;
int
to_bitField0_
=
0
;
if
(((
from_bitField0_
&
0x00000001
)
==
0x00000001
))
{
to_bitField0_
|=
0x00000001
;
}
result
.
sn_
=
sn_
;
if
(((
from_bitField0_
&
0x00000002
)
==
0x00000002
))
{
to_bitField0_
|=
0x00000002
;
}
result
.
beginTime_
=
beginTime_
;
if
(((
from_bitField0_
&
0x00000004
)
==
0x00000004
))
{
to_bitField0_
|=
0x00000004
;
}
result
.
beginLng_
=
beginLng_
;
if
(((
from_bitField0_
&
0x00000008
)
==
0x00000008
))
{
to_bitField0_
|=
0x00000008
;
}
result
.
beginLat_
=
beginLat_
;
if
(((
from_bitField0_
&
0x00000010
)
==
0x00000010
))
{
to_bitField0_
|=
0x00000010
;
}
result
.
endTime_
=
endTime_
;
if
(((
from_bitField0_
&
0x00000020
)
==
0x00000020
))
{
to_bitField0_
|=
0x00000020
;
}
result
.
endLng_
=
endLng_
;
if
(((
from_bitField0_
&
0x00000040
)
==
0x00000040
))
{
to_bitField0_
|=
0x00000040
;
}
result
.
endLat_
=
endLat_
;
if
(((
from_bitField0_
&
0x00000080
)
==
0x00000080
))
{
to_bitField0_
|=
0x00000080
;
}
result
.
mileage_
=
mileage_
;
result
.
bitField0_
=
to_bitField0_
;
onBuilt
();
return
result
;
}
public
Builder
mergeFrom
(
com
.
google
.
protobuf
.
Message
other
)
{
if
(
other
instanceof
KafkaJourneyOverSpeed
.
neshield_journey_req
)
{
return
mergeFrom
((
KafkaJourneyOverSpeed
.
neshield_journey_req
)
other
);
}
else
{
super
.
mergeFrom
(
other
);
return
this
;
}
}
public
Builder
mergeFrom
(
KafkaJourneyOverSpeed
.
neshield_journey_req
other
)
{
if
(
other
==
KafkaJourneyOverSpeed
.
neshield_journey_req
.
getDefaultInstance
())
return
this
;
if
(
other
.
hasSn
())
{
setSn
(
other
.
getSn
());
}
if
(
other
.
hasBeginTime
())
{
setBeginTime
(
other
.
getBeginTime
());
}
if
(
other
.
hasBeginLng
())
{
setBeginLng
(
other
.
getBeginLng
());
}
if
(
other
.
hasBeginLat
())
{
setBeginLat
(
other
.
getBeginLat
());
}
if
(
other
.
hasEndTime
())
{
setEndTime
(
other
.
getEndTime
());
}
if
(
other
.
hasEndLng
())
{
setEndLng
(
other
.
getEndLng
());
}
if
(
other
.
hasEndLat
())
{
setEndLat
(
other
.
getEndLat
());
}
if
(
other
.
hasMileage
())
{
setMileage
(
other
.
getMileage
());
}
this
.
mergeUnknownFields
(
other
.
getUnknownFields
());
return
this
;
}
public
final
boolean
isInitialized
()
{
if
(!
hasSn
())
{
return
false
;
}
if
(!
hasBeginTime
())
{
return
false
;
}
if
(!
hasBeginLng
())
{
return
false
;
}
if
(!
hasBeginLat
())
{
return
false
;
}
if
(!
hasEndTime
())
{
return
false
;
}
if
(!
hasEndLng
())
{
return
false
;
}
if
(!
hasEndLat
())
{
return
false
;
}
if
(!
hasMileage
())
{
return
false
;
}
return
true
;
}
public
Builder
mergeFrom
(
com
.
google
.
protobuf
.
CodedInputStream
input
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
java
.
io
.
IOException
{
com
.
google
.
protobuf
.
UnknownFieldSet
.
Builder
unknownFields
=
com
.
google
.
protobuf
.
UnknownFieldSet
.
newBuilder
(
this
.
getUnknownFields
());
while
(
true
)
{
int
tag
=
input
.
readTag
();
switch
(
tag
)
{
case
0
:
this
.
setUnknownFields
(
unknownFields
.
build
());
onChanged
();
return
this
;
default
:
{
if
(!
parseUnknownField
(
input
,
unknownFields
,
extensionRegistry
,
tag
))
{
this
.
setUnknownFields
(
unknownFields
.
build
());
onChanged
();
return
this
;
}
break
;
}
case
10
:
{
bitField0_
|=
0x00000001
;
sn_
=
input
.
readBytes
();
break
;
}
case
26
:
{
bitField0_
|=
0x00000002
;
beginTime_
=
input
.
readBytes
();
break
;
}
case
34
:
{
bitField0_
|=
0x00000004
;
beginLng_
=
input
.
readBytes
();
break
;
}
case
42
:
{
bitField0_
|=
0x00000008
;
beginLat_
=
input
.
readBytes
();
break
;
}
case
50
:
{
bitField0_
|=
0x00000010
;
endTime_
=
input
.
readBytes
();
break
;
}
case
58
:
{
bitField0_
|=
0x00000020
;
endLng_
=
input
.
readBytes
();
break
;
}
case
66
:
{
bitField0_
|=
0x00000040
;
endLat_
=
input
.
readBytes
();
break
;
}
case
72
:
{
bitField0_
|=
0x00000080
;
mileage_
=
input
.
readUInt32
();
break
;
}
}
}
}
private
int
bitField0_
;
// required string sn = 1;
private
java
.
lang
.
Object
sn_
=
""
;
public
boolean
hasSn
()
{
return
((
bitField0_
&
0x00000001
)
==
0x00000001
);
}
public
String
getSn
()
{
java
.
lang
.
Object
ref
=
sn_
;
if
(!(
ref
instanceof
String
))
{
String
s
=
((
com
.
google
.
protobuf
.
ByteString
)
ref
).
toStringUtf8
();
sn_
=
s
;
return
s
;
}
else
{
return
(
String
)
ref
;
}
}
public
Builder
setSn
(
String
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000001
;
sn_
=
value
;
onChanged
();
return
this
;
}
public
Builder
clearSn
()
{
bitField0_
=
(
bitField0_
&
~
0x00000001
);
sn_
=
getDefaultInstance
().
getSn
();
onChanged
();
return
this
;
}
void
setSn
(
com
.
google
.
protobuf
.
ByteString
value
)
{
bitField0_
|=
0x00000001
;
sn_
=
value
;
onChanged
();
}
// required string beginTime = 3;
private
java
.
lang
.
Object
beginTime_
=
""
;
public
boolean
hasBeginTime
()
{
return
((
bitField0_
&
0x00000002
)
==
0x00000002
);
}
public
String
getBeginTime
()
{
java
.
lang
.
Object
ref
=
beginTime_
;
if
(!(
ref
instanceof
String
))
{
String
s
=
((
com
.
google
.
protobuf
.
ByteString
)
ref
).
toStringUtf8
();
beginTime_
=
s
;
return
s
;
}
else
{
return
(
String
)
ref
;
}
}
public
Builder
setBeginTime
(
String
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000002
;
beginTime_
=
value
;
onChanged
();
return
this
;
}
public
Builder
clearBeginTime
()
{
bitField0_
=
(
bitField0_
&
~
0x00000002
);
beginTime_
=
getDefaultInstance
().
getBeginTime
();
onChanged
();
return
this
;
}
void
setBeginTime
(
com
.
google
.
protobuf
.
ByteString
value
)
{
bitField0_
|=
0x00000002
;
beginTime_
=
value
;
onChanged
();
}
// required string beginLng = 4;
private
java
.
lang
.
Object
beginLng_
=
""
;
public
boolean
hasBeginLng
()
{
return
((
bitField0_
&
0x00000004
)
==
0x00000004
);
}
public
String
getBeginLng
()
{
java
.
lang
.
Object
ref
=
beginLng_
;
if
(!(
ref
instanceof
String
))
{
String
s
=
((
com
.
google
.
protobuf
.
ByteString
)
ref
).
toStringUtf8
();
beginLng_
=
s
;
return
s
;
}
else
{
return
(
String
)
ref
;
}
}
public
Builder
setBeginLng
(
String
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000004
;
beginLng_
=
value
;
onChanged
();
return
this
;
}
public
Builder
clearBeginLng
()
{
bitField0_
=
(
bitField0_
&
~
0x00000004
);
beginLng_
=
getDefaultInstance
().
getBeginLng
();
onChanged
();
return
this
;
}
void
setBeginLng
(
com
.
google
.
protobuf
.
ByteString
value
)
{
bitField0_
|=
0x00000004
;
beginLng_
=
value
;
onChanged
();
}
// required string beginLat = 5;
private
java
.
lang
.
Object
beginLat_
=
""
;
public
boolean
hasBeginLat
()
{
return
((
bitField0_
&
0x00000008
)
==
0x00000008
);
}
public
String
getBeginLat
()
{
java
.
lang
.
Object
ref
=
beginLat_
;
if
(!(
ref
instanceof
String
))
{
String
s
=
((
com
.
google
.
protobuf
.
ByteString
)
ref
).
toStringUtf8
();
beginLat_
=
s
;
return
s
;
}
else
{
return
(
String
)
ref
;
}
}
public
Builder
setBeginLat
(
String
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000008
;
beginLat_
=
value
;
onChanged
();
return
this
;
}
public
Builder
clearBeginLat
()
{
bitField0_
=
(
bitField0_
&
~
0x00000008
);
beginLat_
=
getDefaultInstance
().
getBeginLat
();
onChanged
();
return
this
;
}
void
setBeginLat
(
com
.
google
.
protobuf
.
ByteString
value
)
{
bitField0_
|=
0x00000008
;
beginLat_
=
value
;
onChanged
();
}
// required string endTime = 6;
private
java
.
lang
.
Object
endTime_
=
""
;
public
boolean
hasEndTime
()
{
return
((
bitField0_
&
0x00000010
)
==
0x00000010
);
}
public
String
getEndTime
()
{
java
.
lang
.
Object
ref
=
endTime_
;
if
(!(
ref
instanceof
String
))
{
String
s
=
((
com
.
google
.
protobuf
.
ByteString
)
ref
).
toStringUtf8
();
endTime_
=
s
;
return
s
;
}
else
{
return
(
String
)
ref
;
}
}
public
Builder
setEndTime
(
String
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000010
;
endTime_
=
value
;
onChanged
();
return
this
;
}
public
Builder
clearEndTime
()
{
bitField0_
=
(
bitField0_
&
~
0x00000010
);
endTime_
=
getDefaultInstance
().
getEndTime
();
onChanged
();
return
this
;
}
void
setEndTime
(
com
.
google
.
protobuf
.
ByteString
value
)
{
bitField0_
|=
0x00000010
;
endTime_
=
value
;
onChanged
();
}
// required string endLng = 7;
private
java
.
lang
.
Object
endLng_
=
""
;
public
boolean
hasEndLng
()
{
return
((
bitField0_
&
0x00000020
)
==
0x00000020
);
}
public
String
getEndLng
()
{
java
.
lang
.
Object
ref
=
endLng_
;
if
(!(
ref
instanceof
String
))
{
String
s
=
((
com
.
google
.
protobuf
.
ByteString
)
ref
).
toStringUtf8
();
endLng_
=
s
;
return
s
;
}
else
{
return
(
String
)
ref
;
}
}
public
Builder
setEndLng
(
String
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000020
;
endLng_
=
value
;
onChanged
();
return
this
;
}
public
Builder
clearEndLng
()
{
bitField0_
=
(
bitField0_
&
~
0x00000020
);
endLng_
=
getDefaultInstance
().
getEndLng
();
onChanged
();
return
this
;
}
void
setEndLng
(
com
.
google
.
protobuf
.
ByteString
value
)
{
bitField0_
|=
0x00000020
;
endLng_
=
value
;
onChanged
();
}
// required string endLat = 8;
private
java
.
lang
.
Object
endLat_
=
""
;
public
boolean
hasEndLat
()
{
return
((
bitField0_
&
0x00000040
)
==
0x00000040
);
}
public
String
getEndLat
()
{
java
.
lang
.
Object
ref
=
endLat_
;
if
(!(
ref
instanceof
String
))
{
String
s
=
((
com
.
google
.
protobuf
.
ByteString
)
ref
).
toStringUtf8
();
endLat_
=
s
;
return
s
;
}
else
{
return
(
String
)
ref
;
}
}
public
Builder
setEndLat
(
String
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000040
;
endLat_
=
value
;
onChanged
();
return
this
;
}
public
Builder
clearEndLat
()
{
bitField0_
=
(
bitField0_
&
~
0x00000040
);
endLat_
=
getDefaultInstance
().
getEndLat
();
onChanged
();
return
this
;
}
void
setEndLat
(
com
.
google
.
protobuf
.
ByteString
value
)
{
bitField0_
|=
0x00000040
;
endLat_
=
value
;
onChanged
();
}
// required uint32 mileage = 9;
private
int
mileage_
;
public
boolean
hasMileage
()
{
return
((
bitField0_
&
0x00000080
)
==
0x00000080
);
}
public
int
getMileage
()
{
return
mileage_
;
}
public
Builder
setMileage
(
int
value
)
{
bitField0_
|=
0x00000080
;
mileage_
=
value
;
onChanged
();
return
this
;
}
public
Builder
clearMileage
()
{
bitField0_
=
(
bitField0_
&
~
0x00000080
);
mileage_
=
0
;
onChanged
();
return
this
;
}
// @@protoc_insertion_point(builder_scope:protos_journey.neshield_journey_req)
}
static
{
defaultInstance
=
new
neshield_journey_req
(
true
);
defaultInstance
.
initFields
();
}
// @@protoc_insertion_point(class_scope:protos_journey.neshield_journey_req)
}
public
interface
track_journey_overspeed_reqOrBuilder
extends
com
.
google
.
protobuf
.
MessageOrBuilder
{
// required string sn = 1;
boolean
hasSn
();
String
getSn
();
// required string beginTime = 2;
boolean
hasBeginTime
();
String
getBeginTime
();
// required string endTime = 3;
boolean
hasEndTime
();
String
getEndTime
();
// required uint32 duration = 4;
boolean
hasDuration
();
int
getDuration
();
// required double averageSpeed = 5;
boolean
hasAverageSpeed
();
double
getAverageSpeed
();
}
public
static
final
class
track_journey_overspeed_req
extends
com
.
google
.
protobuf
.
GeneratedMessage
implements
track_journey_overspeed_reqOrBuilder
{
// Use track_journey_overspeed_req.newBuilder() to construct.
private
track_journey_overspeed_req
(
Builder
builder
)
{
super
(
builder
);
}
private
track_journey_overspeed_req
(
boolean
noInit
)
{}
private
static
final
track_journey_overspeed_req
defaultInstance
;
public
static
track_journey_overspeed_req
getDefaultInstance
()
{
return
defaultInstance
;
}
public
track_journey_overspeed_req
getDefaultInstanceForType
()
{
return
defaultInstance
;
}
public
static
final
com
.
google
.
protobuf
.
Descriptors
.
Descriptor
getDescriptor
()
{
return
KafkaJourneyOverSpeed
.
internal_static_protos_journey_track_journey_overspeed_req_descriptor
;
}
protected
com
.
google
.
protobuf
.
GeneratedMessage
.
FieldAccessorTable
internalGetFieldAccessorTable
()
{
return
KafkaJourneyOverSpeed
.
internal_static_protos_journey_track_journey_overspeed_req_fieldAccessorTable
;
}
private
int
bitField0_
;
// required string sn = 1;
public
static
final
int
SN_FIELD_NUMBER
=
1
;
private
java
.
lang
.
Object
sn_
;
public
boolean
hasSn
()
{
return
((
bitField0_
&
0x00000001
)
==
0x00000001
);
}
public
String
getSn
()
{
java
.
lang
.
Object
ref
=
sn_
;
if
(
ref
instanceof
String
)
{
return
(
String
)
ref
;
}
else
{
com
.
google
.
protobuf
.
ByteString
bs
=
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
String
s
=
bs
.
toStringUtf8
();
if
(
com
.
google
.
protobuf
.
Internal
.
isValidUtf8
(
bs
))
{
sn_
=
s
;
}
return
s
;
}
}
private
com
.
google
.
protobuf
.
ByteString
getSnBytes
()
{
java
.
lang
.
Object
ref
=
sn_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
((
String
)
ref
);
sn_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
// required string beginTime = 2;
public
static
final
int
BEGINTIME_FIELD_NUMBER
=
2
;
private
java
.
lang
.
Object
beginTime_
;
public
boolean
hasBeginTime
()
{
return
((
bitField0_
&
0x00000002
)
==
0x00000002
);
}
public
String
getBeginTime
()
{
java
.
lang
.
Object
ref
=
beginTime_
;
if
(
ref
instanceof
String
)
{
return
(
String
)
ref
;
}
else
{
com
.
google
.
protobuf
.
ByteString
bs
=
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
String
s
=
bs
.
toStringUtf8
();
if
(
com
.
google
.
protobuf
.
Internal
.
isValidUtf8
(
bs
))
{
beginTime_
=
s
;
}
return
s
;
}
}
private
com
.
google
.
protobuf
.
ByteString
getBeginTimeBytes
()
{
java
.
lang
.
Object
ref
=
beginTime_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
((
String
)
ref
);
beginTime_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
// required string endTime = 3;
public
static
final
int
ENDTIME_FIELD_NUMBER
=
3
;
private
java
.
lang
.
Object
endTime_
;
public
boolean
hasEndTime
()
{
return
((
bitField0_
&
0x00000004
)
==
0x00000004
);
}
public
String
getEndTime
()
{
java
.
lang
.
Object
ref
=
endTime_
;
if
(
ref
instanceof
String
)
{
return
(
String
)
ref
;
}
else
{
com
.
google
.
protobuf
.
ByteString
bs
=
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
String
s
=
bs
.
toStringUtf8
();
if
(
com
.
google
.
protobuf
.
Internal
.
isValidUtf8
(
bs
))
{
endTime_
=
s
;
}
return
s
;
}
}
private
com
.
google
.
protobuf
.
ByteString
getEndTimeBytes
()
{
java
.
lang
.
Object
ref
=
endTime_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
((
String
)
ref
);
endTime_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
// required uint32 duration = 4;
public
static
final
int
DURATION_FIELD_NUMBER
=
4
;
private
int
duration_
;
public
boolean
hasDuration
()
{
return
((
bitField0_
&
0x00000008
)
==
0x00000008
);
}
public
int
getDuration
()
{
return
duration_
;
}
// required double averageSpeed = 5;
public
static
final
int
AVERAGESPEED_FIELD_NUMBER
=
5
;
private
double
averageSpeed_
;
public
boolean
hasAverageSpeed
()
{
return
((
bitField0_
&
0x00000010
)
==
0x00000010
);
}
public
double
getAverageSpeed
()
{
return
averageSpeed_
;
}
private
void
initFields
()
{
sn_
=
""
;
beginTime_
=
""
;
endTime_
=
""
;
duration_
=
0
;
averageSpeed_
=
0
D
;
}
private
byte
memoizedIsInitialized
=
-
1
;
public
final
boolean
isInitialized
()
{
byte
isInitialized
=
memoizedIsInitialized
;
if
(
isInitialized
!=
-
1
)
return
isInitialized
==
1
;
if
(!
hasSn
())
{
memoizedIsInitialized
=
0
;
return
false
;
}
if
(!
hasBeginTime
())
{
memoizedIsInitialized
=
0
;
return
false
;
}
if
(!
hasEndTime
())
{
memoizedIsInitialized
=
0
;
return
false
;
}
if
(!
hasDuration
())
{
memoizedIsInitialized
=
0
;
return
false
;
}
if
(!
hasAverageSpeed
())
{
memoizedIsInitialized
=
0
;
return
false
;
}
memoizedIsInitialized
=
1
;
return
true
;
}
public
void
writeTo
(
com
.
google
.
protobuf
.
CodedOutputStream
output
)
throws
java
.
io
.
IOException
{
getSerializedSize
();
if
(((
bitField0_
&
0x00000001
)
==
0x00000001
))
{
output
.
writeBytes
(
1
,
getSnBytes
());
}
if
(((
bitField0_
&
0x00000002
)
==
0x00000002
))
{
output
.
writeBytes
(
2
,
getBeginTimeBytes
());
}
if
(((
bitField0_
&
0x00000004
)
==
0x00000004
))
{
output
.
writeBytes
(
3
,
getEndTimeBytes
());
}
if
(((
bitField0_
&
0x00000008
)
==
0x00000008
))
{
output
.
writeUInt32
(
4
,
duration_
);
}
if
(((
bitField0_
&
0x00000010
)
==
0x00000010
))
{
output
.
writeDouble
(
5
,
averageSpeed_
);
}
getUnknownFields
().
writeTo
(
output
);
}
private
int
memoizedSerializedSize
=
-
1
;
public
int
getSerializedSize
()
{
int
size
=
memoizedSerializedSize
;
if
(
size
!=
-
1
)
return
size
;
size
=
0
;
if
(((
bitField0_
&
0x00000001
)
==
0x00000001
))
{
size
+=
com
.
google
.
protobuf
.
CodedOutputStream
.
computeBytesSize
(
1
,
getSnBytes
());
}
if
(((
bitField0_
&
0x00000002
)
==
0x00000002
))
{
size
+=
com
.
google
.
protobuf
.
CodedOutputStream
.
computeBytesSize
(
2
,
getBeginTimeBytes
());
}
if
(((
bitField0_
&
0x00000004
)
==
0x00000004
))
{
size
+=
com
.
google
.
protobuf
.
CodedOutputStream
.
computeBytesSize
(
3
,
getEndTimeBytes
());
}
if
(((
bitField0_
&
0x00000008
)
==
0x00000008
))
{
size
+=
com
.
google
.
protobuf
.
CodedOutputStream
.
computeUInt32Size
(
4
,
duration_
);
}
if
(((
bitField0_
&
0x00000010
)
==
0x00000010
))
{
size
+=
com
.
google
.
protobuf
.
CodedOutputStream
.
computeDoubleSize
(
5
,
averageSpeed_
);
}
size
+=
getUnknownFields
().
getSerializedSize
();
memoizedSerializedSize
=
size
;
return
size
;
}
private
static
final
long
serialVersionUID
=
0L
;
@java
.
lang
.
Override
protected
java
.
lang
.
Object
writeReplace
()
throws
java
.
io
.
ObjectStreamException
{
return
super
.
writeReplace
();
}
public
static
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
parseFrom
(
com
.
google
.
protobuf
.
ByteString
data
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
newBuilder
().
mergeFrom
(
data
).
buildParsed
();
}
public
static
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
parseFrom
(
com
.
google
.
protobuf
.
ByteString
data
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
newBuilder
().
mergeFrom
(
data
,
extensionRegistry
)
.
buildParsed
();
}
public
static
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
parseFrom
(
byte
[]
data
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
newBuilder
().
mergeFrom
(
data
).
buildParsed
();
}
public
static
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
parseFrom
(
byte
[]
data
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
newBuilder
().
mergeFrom
(
data
,
extensionRegistry
)
.
buildParsed
();
}
public
static
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
parseFrom
(
java
.
io
.
InputStream
input
)
throws
java
.
io
.
IOException
{
return
newBuilder
().
mergeFrom
(
input
).
buildParsed
();
}
public
static
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
parseFrom
(
java
.
io
.
InputStream
input
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
java
.
io
.
IOException
{
return
newBuilder
().
mergeFrom
(
input
,
extensionRegistry
)
.
buildParsed
();
}
public
static
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
parseDelimitedFrom
(
java
.
io
.
InputStream
input
)
throws
java
.
io
.
IOException
{
Builder
builder
=
newBuilder
();
if
(
builder
.
mergeDelimitedFrom
(
input
))
{
return
builder
.
buildParsed
();
}
else
{
return
null
;
}
}
public
static
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
parseDelimitedFrom
(
java
.
io
.
InputStream
input
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
java
.
io
.
IOException
{
Builder
builder
=
newBuilder
();
if
(
builder
.
mergeDelimitedFrom
(
input
,
extensionRegistry
))
{
return
builder
.
buildParsed
();
}
else
{
return
null
;
}
}
public
static
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
parseFrom
(
com
.
google
.
protobuf
.
CodedInputStream
input
)
throws
java
.
io
.
IOException
{
return
newBuilder
().
mergeFrom
(
input
).
buildParsed
();
}
public
static
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
parseFrom
(
com
.
google
.
protobuf
.
CodedInputStream
input
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
java
.
io
.
IOException
{
return
newBuilder
().
mergeFrom
(
input
,
extensionRegistry
)
.
buildParsed
();
}
public
static
Builder
newBuilder
()
{
return
Builder
.
create
();
}
public
Builder
newBuilderForType
()
{
return
newBuilder
();
}
public
static
Builder
newBuilder
(
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
prototype
)
{
return
newBuilder
().
mergeFrom
(
prototype
);
}
public
Builder
toBuilder
()
{
return
newBuilder
(
this
);
}
@java
.
lang
.
Override
protected
Builder
newBuilderForType
(
com
.
google
.
protobuf
.
GeneratedMessage
.
BuilderParent
parent
)
{
Builder
builder
=
new
Builder
(
parent
);
return
builder
;
}
public
static
final
class
Builder
extends
com
.
google
.
protobuf
.
GeneratedMessage
.
Builder
<
Builder
>
implements
KafkaJourneyOverSpeed
.
track_journey_overspeed_reqOrBuilder
{
public
static
final
com
.
google
.
protobuf
.
Descriptors
.
Descriptor
getDescriptor
()
{
return
KafkaJourneyOverSpeed
.
internal_static_protos_journey_track_journey_overspeed_req_descriptor
;
}
protected
com
.
google
.
protobuf
.
GeneratedMessage
.
FieldAccessorTable
internalGetFieldAccessorTable
()
{
return
KafkaJourneyOverSpeed
.
internal_static_protos_journey_track_journey_overspeed_req_fieldAccessorTable
;
}
// Construct using cn.com.glsx.kafka.protocol.kafka_journey.track_journey_overspeed_req.newBuilder()
private
Builder
()
{
maybeForceBuilderInitialization
();
}
private
Builder
(
BuilderParent
parent
)
{
super
(
parent
);
maybeForceBuilderInitialization
();
}
private
void
maybeForceBuilderInitialization
()
{
if
(
com
.
google
.
protobuf
.
GeneratedMessage
.
alwaysUseFieldBuilders
)
{
}
}
private
static
Builder
create
()
{
return
new
Builder
();
}
public
Builder
clear
()
{
super
.
clear
();
sn_
=
""
;
bitField0_
=
(
bitField0_
&
~
0x00000001
);
beginTime_
=
""
;
bitField0_
=
(
bitField0_
&
~
0x00000002
);
endTime_
=
""
;
bitField0_
=
(
bitField0_
&
~
0x00000004
);
duration_
=
0
;
bitField0_
=
(
bitField0_
&
~
0x00000008
);
averageSpeed_
=
0
D
;
bitField0_
=
(
bitField0_
&
~
0x00000010
);
return
this
;
}
public
Builder
clone
()
{
return
create
().
mergeFrom
(
buildPartial
());
}
public
com
.
google
.
protobuf
.
Descriptors
.
Descriptor
getDescriptorForType
()
{
return
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
.
getDescriptor
();
}
public
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
getDefaultInstanceForType
()
{
return
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
.
getDefaultInstance
();
}
public
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
build
()
{
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
result
=
buildPartial
();
if
(!
result
.
isInitialized
())
{
throw
newUninitializedMessageException
(
result
);
}
return
result
;
}
private
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
buildParsed
()
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
result
=
buildPartial
();
if
(!
result
.
isInitialized
())
{
throw
newUninitializedMessageException
(
result
).
asInvalidProtocolBufferException
();
}
return
result
;
}
public
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
buildPartial
()
{
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
result
=
new
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
(
this
);
int
from_bitField0_
=
bitField0_
;
int
to_bitField0_
=
0
;
if
(((
from_bitField0_
&
0x00000001
)
==
0x00000001
))
{
to_bitField0_
|=
0x00000001
;
}
result
.
sn_
=
sn_
;
if
(((
from_bitField0_
&
0x00000002
)
==
0x00000002
))
{
to_bitField0_
|=
0x00000002
;
}
result
.
beginTime_
=
beginTime_
;
if
(((
from_bitField0_
&
0x00000004
)
==
0x00000004
))
{
to_bitField0_
|=
0x00000004
;
}
result
.
endTime_
=
endTime_
;
if
(((
from_bitField0_
&
0x00000008
)
==
0x00000008
))
{
to_bitField0_
|=
0x00000008
;
}
result
.
duration_
=
duration_
;
if
(((
from_bitField0_
&
0x00000010
)
==
0x00000010
))
{
to_bitField0_
|=
0x00000010
;
}
result
.
averageSpeed_
=
averageSpeed_
;
result
.
bitField0_
=
to_bitField0_
;
onBuilt
();
return
result
;
}
public
Builder
mergeFrom
(
com
.
google
.
protobuf
.
Message
other
)
{
if
(
other
instanceof
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
)
{
return
mergeFrom
((
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
)
other
);
}
else
{
super
.
mergeFrom
(
other
);
return
this
;
}
}
public
Builder
mergeFrom
(
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
other
)
{
if
(
other
==
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
.
getDefaultInstance
())
return
this
;
if
(
other
.
hasSn
())
{
setSn
(
other
.
getSn
());
}
if
(
other
.
hasBeginTime
())
{
setBeginTime
(
other
.
getBeginTime
());
}
if
(
other
.
hasEndTime
())
{
setEndTime
(
other
.
getEndTime
());
}
if
(
other
.
hasDuration
())
{
setDuration
(
other
.
getDuration
());
}
if
(
other
.
hasAverageSpeed
())
{
setAverageSpeed
(
other
.
getAverageSpeed
());
}
this
.
mergeUnknownFields
(
other
.
getUnknownFields
());
return
this
;
}
public
final
boolean
isInitialized
()
{
if
(!
hasSn
())
{
return
false
;
}
if
(!
hasBeginTime
())
{
return
false
;
}
if
(!
hasEndTime
())
{
return
false
;
}
if
(!
hasDuration
())
{
return
false
;
}
if
(!
hasAverageSpeed
())
{
return
false
;
}
return
true
;
}
public
Builder
mergeFrom
(
com
.
google
.
protobuf
.
CodedInputStream
input
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
java
.
io
.
IOException
{
com
.
google
.
protobuf
.
UnknownFieldSet
.
Builder
unknownFields
=
com
.
google
.
protobuf
.
UnknownFieldSet
.
newBuilder
(
this
.
getUnknownFields
());
while
(
true
)
{
int
tag
=
input
.
readTag
();
switch
(
tag
)
{
case
0
:
this
.
setUnknownFields
(
unknownFields
.
build
());
onChanged
();
return
this
;
default
:
{
if
(!
parseUnknownField
(
input
,
unknownFields
,
extensionRegistry
,
tag
))
{
this
.
setUnknownFields
(
unknownFields
.
build
());
onChanged
();
return
this
;
}
break
;
}
case
10
:
{
bitField0_
|=
0x00000001
;
sn_
=
input
.
readBytes
();
break
;
}
case
18
:
{
bitField0_
|=
0x00000002
;
beginTime_
=
input
.
readBytes
();
break
;
}
case
26
:
{
bitField0_
|=
0x00000004
;
endTime_
=
input
.
readBytes
();
break
;
}
case
32
:
{
bitField0_
|=
0x00000008
;
duration_
=
input
.
readUInt32
();
break
;
}
case
41
:
{
bitField0_
|=
0x00000010
;
averageSpeed_
=
input
.
readDouble
();
break
;
}
}
}
}
private
int
bitField0_
;
// required string sn = 1;
private
java
.
lang
.
Object
sn_
=
""
;
public
boolean
hasSn
()
{
return
((
bitField0_
&
0x00000001
)
==
0x00000001
);
}
public
String
getSn
()
{
java
.
lang
.
Object
ref
=
sn_
;
if
(!(
ref
instanceof
String
))
{
String
s
=
((
com
.
google
.
protobuf
.
ByteString
)
ref
).
toStringUtf8
();
sn_
=
s
;
return
s
;
}
else
{
return
(
String
)
ref
;
}
}
public
Builder
setSn
(
String
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000001
;
sn_
=
value
;
onChanged
();
return
this
;
}
public
Builder
clearSn
()
{
bitField0_
=
(
bitField0_
&
~
0x00000001
);
sn_
=
getDefaultInstance
().
getSn
();
onChanged
();
return
this
;
}
void
setSn
(
com
.
google
.
protobuf
.
ByteString
value
)
{
bitField0_
|=
0x00000001
;
sn_
=
value
;
onChanged
();
}
// required string beginTime = 2;
private
java
.
lang
.
Object
beginTime_
=
""
;
public
boolean
hasBeginTime
()
{
return
((
bitField0_
&
0x00000002
)
==
0x00000002
);
}
public
String
getBeginTime
()
{
java
.
lang
.
Object
ref
=
beginTime_
;
if
(!(
ref
instanceof
String
))
{
String
s
=
((
com
.
google
.
protobuf
.
ByteString
)
ref
).
toStringUtf8
();
beginTime_
=
s
;
return
s
;
}
else
{
return
(
String
)
ref
;
}
}
public
Builder
setBeginTime
(
String
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000002
;
beginTime_
=
value
;
onChanged
();
return
this
;
}
public
Builder
clearBeginTime
()
{
bitField0_
=
(
bitField0_
&
~
0x00000002
);
beginTime_
=
getDefaultInstance
().
getBeginTime
();
onChanged
();
return
this
;
}
void
setBeginTime
(
com
.
google
.
protobuf
.
ByteString
value
)
{
bitField0_
|=
0x00000002
;
beginTime_
=
value
;
onChanged
();
}
// required string endTime = 3;
private
java
.
lang
.
Object
endTime_
=
""
;
public
boolean
hasEndTime
()
{
return
((
bitField0_
&
0x00000004
)
==
0x00000004
);
}
public
String
getEndTime
()
{
java
.
lang
.
Object
ref
=
endTime_
;
if
(!(
ref
instanceof
String
))
{
String
s
=
((
com
.
google
.
protobuf
.
ByteString
)
ref
).
toStringUtf8
();
endTime_
=
s
;
return
s
;
}
else
{
return
(
String
)
ref
;
}
}
public
Builder
setEndTime
(
String
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000004
;
endTime_
=
value
;
onChanged
();
return
this
;
}
public
Builder
clearEndTime
()
{
bitField0_
=
(
bitField0_
&
~
0x00000004
);
endTime_
=
getDefaultInstance
().
getEndTime
();
onChanged
();
return
this
;
}
void
setEndTime
(
com
.
google
.
protobuf
.
ByteString
value
)
{
bitField0_
|=
0x00000004
;
endTime_
=
value
;
onChanged
();
}
// required uint32 duration = 4;
private
int
duration_
;
public
boolean
hasDuration
()
{
return
((
bitField0_
&
0x00000008
)
==
0x00000008
);
}
public
int
getDuration
()
{
return
duration_
;
}
public
Builder
setDuration
(
int
value
)
{
bitField0_
|=
0x00000008
;
duration_
=
value
;
onChanged
();
return
this
;
}
public
Builder
clearDuration
()
{
bitField0_
=
(
bitField0_
&
~
0x00000008
);
duration_
=
0
;
onChanged
();
return
this
;
}
// required double averageSpeed = 5;
private
double
averageSpeed_
;
public
boolean
hasAverageSpeed
()
{
return
((
bitField0_
&
0x00000010
)
==
0x00000010
);
}
public
double
getAverageSpeed
()
{
return
averageSpeed_
;
}
public
Builder
setAverageSpeed
(
double
value
)
{
bitField0_
|=
0x00000010
;
averageSpeed_
=
value
;
onChanged
();
return
this
;
}
public
Builder
clearAverageSpeed
()
{
bitField0_
=
(
bitField0_
&
~
0x00000010
);
averageSpeed_
=
0
D
;
onChanged
();
return
this
;
}
// @@protoc_insertion_point(builder_scope:protos_journey.track_journey_overspeed_req)
}
static
{
defaultInstance
=
new
track_journey_overspeed_req
(
true
);
defaultInstance
.
initFields
();
}
// @@protoc_insertion_point(class_scope:protos_journey.track_journey_overspeed_req)
}
private
static
com
.
google
.
protobuf
.
Descriptors
.
Descriptor
internal_static_protos_journey_neshield_journey_req_descriptor
;
private
static
com
.
google
.
protobuf
.
GeneratedMessage
.
FieldAccessorTable
internal_static_protos_journey_neshield_journey_req_fieldAccessorTable
;
private
static
com
.
google
.
protobuf
.
Descriptors
.
Descriptor
internal_static_protos_journey_track_journey_overspeed_req_descriptor
;
private
static
com
.
google
.
protobuf
.
GeneratedMessage
.
FieldAccessorTable
internal_static_protos_journey_track_journey_overspeed_req_fieldAccessorTable
;
public
static
com
.
google
.
protobuf
.
Descriptors
.
FileDescriptor
getDescriptor
()
{
return
descriptor
;
}
private
static
com
.
google
.
protobuf
.
Descriptors
.
FileDescriptor
descriptor
;
static
{
java
.
lang
.
String
[]
descriptorData
=
{
"\n\023kafka_journey.proto\022\016protos_journey\"\233\001"
+
"\n\024neshield_journey_req\022\n\n\002sn\030\001 \002(\t\022\021\n\tbe"
+
"ginTime\030\003 \002(\t\022\020\n\010beginLng\030\004 \002(\t\022\020\n\010begin"
+
"Lat\030\005 \002(\t\022\017\n\007endTime\030\006 \002(\t\022\016\n\006endLng\030\007 \002"
+
"(\t\022\016\n\006endLat\030\010 \002(\t\022\017\n\007mileage\030\t \002(\r\"u\n\033t"
+
"rack_journey_overspeed_req\022\n\n\002sn\030\001 \002(\t\022\021"
+
"\n\tbeginTime\030\002 \002(\t\022\017\n\007endTime\030\003 \002(\t\022\020\n\010du"
+
"ration\030\004 \002(\r\022\024\n\014averageSpeed\030\005 \002(\001B+\n\032cn"
+
".com.glsx.kafka.protocolB\rkafka_journey"
};
com
.
google
.
protobuf
.
Descriptors
.
FileDescriptor
.
InternalDescriptorAssigner
assigner
=
new
com
.
google
.
protobuf
.
Descriptors
.
FileDescriptor
.
InternalDescriptorAssigner
()
{
public
com
.
google
.
protobuf
.
ExtensionRegistry
assignDescriptors
(
com
.
google
.
protobuf
.
Descriptors
.
FileDescriptor
root
)
{
descriptor
=
root
;
internal_static_protos_journey_neshield_journey_req_descriptor
=
getDescriptor
().
getMessageTypes
().
get
(
0
);
internal_static_protos_journey_neshield_journey_req_fieldAccessorTable
=
new
com
.
google
.
protobuf
.
GeneratedMessage
.
FieldAccessorTable
(
internal_static_protos_journey_neshield_journey_req_descriptor
,
new
java
.
lang
.
String
[]
{
"Sn"
,
"BeginTime"
,
"BeginLng"
,
"BeginLat"
,
"EndTime"
,
"EndLng"
,
"EndLat"
,
"Mileage"
,
},
KafkaJourneyOverSpeed
.
neshield_journey_req
.
class
,
KafkaJourneyOverSpeed
.
neshield_journey_req
.
Builder
.
class
);
internal_static_protos_journey_track_journey_overspeed_req_descriptor
=
getDescriptor
().
getMessageTypes
().
get
(
1
);
internal_static_protos_journey_track_journey_overspeed_req_fieldAccessorTable
=
new
com
.
google
.
protobuf
.
GeneratedMessage
.
FieldAccessorTable
(
internal_static_protos_journey_track_journey_overspeed_req_descriptor
,
new
java
.
lang
.
String
[]
{
"Sn"
,
"BeginTime"
,
"EndTime"
,
"Duration"
,
"AverageSpeed"
,
},
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
.
class
,
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
.
Builder
.
class
);
return
null
;
}
};
com
.
google
.
protobuf
.
Descriptors
.
FileDescriptor
.
internalBuildGeneratedFileFrom
(
descriptorData
,
new
com
.
google
.
protobuf
.
Descriptors
.
FileDescriptor
[]
{
},
assigner
);
}
// @@protoc_insertion_point(outer_class_scope)
}
src/main/java/cn/com/glsx/kafka/queue/consumer/KafkaOverSpeedConsumer.java
0 → 100644
View file @
bcfbb35
package
cn
.
com
.
glsx
.
kafka
.
queue
.
consumer
;
import
cn.com.glsx.kafka.protocol.KafkaJourneyOverSpeed
;
import
cn.com.glsx.kafka.queue.base.MessageReceiver
;
import
cn.com.glsx.kafka.service.OverSpeedService
;
import
cn.com.glsx.stdinterface.api.DeviceSpeedingClient
;
import
cn.com.glsx.stdinterface.dto.DeviceSpeedingDTO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.Date
;
/**
* 超速报警消费类
*
* @author xiangyanlin
* @date 2022/5/12
*/
@Slf4j
public
class
KafkaOverSpeedConsumer
extends
MessageReceiver
{
@Autowired
private
OverSpeedService
overSpeedService
;
@Override
public
void
processMessage
(
String
topic
,
byte
[]
message
)
throws
Exception
{
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
req
=
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
.
parseFrom
(
message
);
log
.
info
(
"超速报警记录:{}"
+
req
.
toString
());
overSpeedService
.
saveDeviceSpeeding
(
req
);
}
}
src/main/java/cn/com/glsx/kafka/service/OverSpeedService.java
0 → 100644
View file @
bcfbb35
package
cn
.
com
.
glsx
.
kafka
.
service
;
import
cn.com.glsx.kafka.protocol.KafkaJourneyOverSpeed
;
import
cn.com.glsx.stdinterface.api.DeviceSpeedingClient
;
import
cn.com.glsx.stdinterface.api.VehicleDeviceClient
;
import
cn.com.glsx.stdinterface.api.VehicleServiceClient
;
import
cn.com.glsx.stdinterface.dto.DeviceSpeedingDTO
;
import
cn.com.glsx.stdinterface.dto.VehicleDeviceDto
;
import
cn.com.glsx.stdinterface.dto.VehicleDto
;
import
cn.hutool.core.date.DateUtil
;
import
com.glsx.plat.core.web.R
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.Optional
;
/**
* @author xiangyanlin
* @date 2022/5/12
*/
@Slf4j
@Service
public
class
OverSpeedService
{
@Autowired
private
DeviceSpeedingClient
deviceSpeedingClient
;
@Autowired
private
VehicleServiceClient
vehicleServiceClient
;
@Autowired
private
VehicleDeviceClient
vehicleDeviceClient
;
public
void
saveDeviceSpeeding
(
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
req
)
{
//查询vdId
VehicleDeviceDto
vehicleDevice
=
getVehicleDevice
(
req
);
Long
vdId
=
Optional
.
ofNullable
(
vehicleDevice
).
map
(
VehicleDeviceDto:
:
getId
).
orElse
(
0L
);
log
.
info
(
"vdId{}"
,
vdId
);
//查询创建人
VehicleDto
vehicle
=
getVehicle
(
req
.
getSn
());
Long
createBy
=
Optional
.
ofNullable
(
vehicle
).
map
(
VehicleDto:
:
getCreateBy
).
orElse
(
0L
);
log
.
info
(
"createBy{}"
,
createBy
);
DeviceSpeedingDTO
deviceSpeedingDTO
=
buildDeviceSpeedingDTO
(
req
,
vdId
,
createBy
);
deviceSpeedingClient
.
saveDeviceSpeeding
(
deviceSpeedingDTO
);
}
private
VehicleDeviceDto
getVehicleDevice
(
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
req
)
{
R
<
VehicleDeviceDto
>
result
=
vehicleDeviceClient
.
getVehicleDeviceBySn
(
req
.
getSn
());
return
result
.
getData
(
VehicleDeviceDto
.
class
);
}
private
VehicleDto
getVehicle
(
String
sn
)
{
R
<
VehicleDto
>
result
=
vehicleServiceClient
.
getVehicleBySn
(
sn
);
return
result
.
getData
(
VehicleDto
.
class
);
}
/**
* 构建超速记录
*/
public
DeviceSpeedingDTO
buildDeviceSpeedingDTO
(
KafkaJourneyOverSpeed
.
track_journey_overspeed_req
req
,
Long
vdId
,
Long
createBy
)
{
DeviceSpeedingDTO
deviceSpeedingDTO
=
new
DeviceSpeedingDTO
();
deviceSpeedingDTO
.
setSn
(
req
.
getSn
());
deviceSpeedingDTO
.
setVdId
(
vdId
);
//DateUtil.parseDateTime(alarm.getTime())DateUtil.parseDateTime(alarm.getTime())
Optional
.
ofNullable
(
req
.
getBeginTime
())
.
map
(
DateUtil:
:
parseDateTime
)
.
ifPresent
(
deviceSpeedingDTO:
:
setBeginTime
);
Optional
.
ofNullable
(
req
.
getEndTime
())
.
map
(
DateUtil:
:
parseDateTime
)
.
ifPresent
(
deviceSpeedingDTO:
:
setEndTime
);
Optional
.
ofNullable
(
req
.
getDuration
())
.
map
(
Integer:
:
longValue
)
.
ifPresent
(
deviceSpeedingDTO:
:
setDuration
);
deviceSpeedingDTO
.
setAverageSpeed
(
req
.
getAverageSpeed
());
deviceSpeedingDTO
.
setCreatedDate
(
new
Date
());
deviceSpeedingDTO
.
setCreatedBy
(
createBy
);
deviceSpeedingDTO
.
setUpdatedDate
(
new
Date
());
deviceSpeedingDTO
.
setUpdatedBy
(
createBy
);
return
deviceSpeedingDTO
;
}
}
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