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 3baa5774
authored
Oct 17, 2022
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'develop' of
http://192.168.3.233:8090/eshiled-new/ne-shield-kafkaconsumer
2 parents
7ef50e85
7a88af3f
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
1422 additions
and
4 deletions
src/main/java/cn/com/glsx/kafka/config/KafkaConsumerConfig.java
src/main/java/cn/com/glsx/kafka/constant/Constants.java
src/main/java/cn/com/glsx/kafka/protocol/KafkaDeviceOfflineIsFalse.java
src/main/java/cn/com/glsx/kafka/queue/consumer/KafkaBatteryConsumer.java
src/main/java/cn/com/glsx/kafka/queue/consumer/KafkaDeviceOfflineIsFalseConsumer.java
src/main/java/cn/com/glsx/kafka/queue/consumer/KafkaGpsMsgSvrConsumer.java
src/main/java/cn/com/glsx/kafka/queue/consumer/KafkaJourneyConsumer.java
src/main/java/cn/com/glsx/kafka/service/FakeOfflineChangeFeignService.java
src/main/resources/bootstrap.properties
src/test/java/cn/com/glsx/kafka/service/produce/KafkaDeviceOfflineIsFalseProducerTest.java
src/test/java/cn/com/glsx/kafka/service/produce/KafkaGpsMsgSvrProducerTest.java
src/main/java/cn/com/glsx/kafka/config/KafkaConsumerConfig.java
View file @
3baa577
...
...
@@ -165,4 +165,13 @@ public class KafkaConsumerConfig {
consumer
.
setTopic
(
topic
);
return
consumer
;
}
@Bean
(
initMethod
=
"init"
,
destroyMethod
=
"destroy"
)
KafkaDeviceOfflineIsFalseConsumer
kafkaDeviceOfflineIsFalseConsumer
(
@Value
(
"${mq.fake.offline.change.topic}"
)
String
topic
)
{
KafkaDeviceOfflineIsFalseConsumer
consumer
=
new
KafkaDeviceOfflineIsFalseConsumer
();
consumer
.
setnThreads
(
nThreads
);
consumer
.
setConsumerConfig
(
gpsConsumerConfig
);
consumer
.
setTopic
(
topic
);
return
consumer
;
}
}
src/main/java/cn/com/glsx/kafka/constant/Constants.java
View file @
3baa577
...
...
@@ -398,4 +398,34 @@ public class Constants {
* 停留状态常量类
*/
public
static
final
String
STAY_STATUS
=
"StayStatus"
;
//------------假性离线十日是否结束状态----------
/**
* 0:正常、1代表结束
*/
public
static
final
String
STATUS_CHANGE_END
=
"1"
;
/**
* 0:正常、1代表结束
*/
public
static
final
String
STATUS_CHANGE_NORMAL
=
"0"
;
//------------假性离线十日是否生效----------
/**
* 生效状态
*/
public
static
final
int
STATUS_CHANGE_ABLE
=
1
;
/**
* 失效状态
*/
public
static
final
int
STATUS_CHANGE_ENABLE
=
0
;
}
src/main/java/cn/com/glsx/kafka/protocol/KafkaDeviceOfflineIsFalse.java
0 → 100644
View file @
3baa577
package
cn
.
com
.
glsx
.
kafka
.
protocol
;
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: kafka_deviceOfflineIsFalse.proto
public
final
class
KafkaDeviceOfflineIsFalse
{
private
KafkaDeviceOfflineIsFalse
()
{}
public
static
void
registerAllExtensions
(
com
.
google
.
protobuf
.
ExtensionRegistry
registry
)
{
}
public
interface
deviceOfflineIsFalseOrBuilder
extends
com
.
google
.
protobuf
.
MessageOrBuilder
{
// required string sn = 1;
/**
* <code>required string sn = 1;</code>
*
* <pre>
*设备号
* </pre>
*/
boolean
hasSn
();
/**
* <code>required string sn = 1;</code>
*
* <pre>
*设备号
* </pre>
*/
String
getSn
();
/**
* <code>required string sn = 1;</code>
*
* <pre>
*设备号
* </pre>
*/
com
.
google
.
protobuf
.
ByteString
getSnBytes
();
// required string vin = 2;
/**
* <code>required string vin = 2;</code>
*
* <pre>
*车架号
* </pre>
*/
boolean
hasVin
();
/**
* <code>required string vin = 2;</code>
*
* <pre>
*车架号
* </pre>
*/
String
getVin
();
/**
* <code>required string vin = 2;</code>
*
* <pre>
*车架号
* </pre>
*/
com
.
google
.
protobuf
.
ByteString
getVinBytes
();
// required string uploadtime = 3;
/**
* <code>required string uploadtime = 3;</code>
*
* <pre>
*上传时间
* </pre>
*/
boolean
hasUploadtime
();
/**
* <code>required string uploadtime = 3;</code>
*
* <pre>
*上传时间
* </pre>
*/
String
getUploadtime
();
/**
* <code>required string uploadtime = 3;</code>
*
* <pre>
*上传时间
* </pre>
*/
com
.
google
.
protobuf
.
ByteString
getUploadtimeBytes
();
// required string datastatus = 4;
/**
* <code>required string datastatus = 4;</code>
*
* <pre>
*数据状态(0:正常、1代表结束)
* </pre>
*/
boolean
hasDatastatus
();
/**
* <code>required string datastatus = 4;</code>
*
* <pre>
*数据状态(0:正常、1代表结束)
* </pre>
*/
String
getDatastatus
();
/**
* <code>required string datastatus = 4;</code>
*
* <pre>
*数据状态(0:正常、1代表结束)
* </pre>
*/
com
.
google
.
protobuf
.
ByteString
getDatastatusBytes
();
}
/**
* Protobuf type {@code deviceOfflineIsFalse}
*/
public
static
final
class
deviceOfflineIsFalse
extends
com
.
google
.
protobuf
.
GeneratedMessage
implements
deviceOfflineIsFalseOrBuilder
{
// Use deviceOfflineIsFalse.newBuilder() to construct.
private
deviceOfflineIsFalse
(
com
.
google
.
protobuf
.
GeneratedMessage
.
Builder
<?>
builder
)
{
super
(
builder
);
this
.
unknownFields
=
builder
.
getUnknownFields
();
}
private
deviceOfflineIsFalse
(
boolean
noInit
)
{
this
.
unknownFields
=
com
.
google
.
protobuf
.
UnknownFieldSet
.
getDefaultInstance
();
}
private
static
final
deviceOfflineIsFalse
defaultInstance
;
public
static
deviceOfflineIsFalse
getDefaultInstance
()
{
return
defaultInstance
;
}
public
deviceOfflineIsFalse
getDefaultInstanceForType
()
{
return
defaultInstance
;
}
private
final
com
.
google
.
protobuf
.
UnknownFieldSet
unknownFields
;
@Override
public
final
com
.
google
.
protobuf
.
UnknownFieldSet
getUnknownFields
()
{
return
this
.
unknownFields
;
}
private
deviceOfflineIsFalse
(
com
.
google
.
protobuf
.
CodedInputStream
input
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
initFields
();
int
mutable_bitField0_
=
0
;
com
.
google
.
protobuf
.
UnknownFieldSet
.
Builder
unknownFields
=
com
.
google
.
protobuf
.
UnknownFieldSet
.
newBuilder
();
try
{
boolean
done
=
false
;
while
(!
done
)
{
int
tag
=
input
.
readTag
();
switch
(
tag
)
{
case
0
:
done
=
true
;
break
;
default
:
{
if
(!
parseUnknownField
(
input
,
unknownFields
,
extensionRegistry
,
tag
))
{
done
=
true
;
}
break
;
}
case
10
:
{
bitField0_
|=
0x00000001
;
sn_
=
input
.
readBytes
();
break
;
}
case
18
:
{
bitField0_
|=
0x00000002
;
vin_
=
input
.
readBytes
();
break
;
}
case
26
:
{
bitField0_
|=
0x00000004
;
uploadtime_
=
input
.
readBytes
();
break
;
}
case
34
:
{
bitField0_
|=
0x00000008
;
datastatus_
=
input
.
readBytes
();
break
;
}
}
}
}
catch
(
com
.
google
.
protobuf
.
InvalidProtocolBufferException
e
)
{
throw
e
.
setUnfinishedMessage
(
this
);
}
catch
(
java
.
io
.
IOException
e
)
{
throw
new
com
.
google
.
protobuf
.
InvalidProtocolBufferException
(
e
.
getMessage
()).
setUnfinishedMessage
(
this
);
}
finally
{
this
.
unknownFields
=
unknownFields
.
build
();
makeExtensionsImmutable
();
}
}
public
static
final
com
.
google
.
protobuf
.
Descriptors
.
Descriptor
getDescriptor
()
{
return
KafkaDeviceOfflineIsFalse
.
internal_static_deviceOfflineIsFalse_descriptor
;
}
protected
FieldAccessorTable
internalGetFieldAccessorTable
()
{
return
KafkaDeviceOfflineIsFalse
.
internal_static_deviceOfflineIsFalse_fieldAccessorTable
.
ensureFieldAccessorsInitialized
(
deviceOfflineIsFalse
.
class
,
Builder
.
class
);
}
public
static
com
.
google
.
protobuf
.
Parser
<
deviceOfflineIsFalse
>
PARSER
=
new
com
.
google
.
protobuf
.
AbstractParser
<
deviceOfflineIsFalse
>()
{
public
deviceOfflineIsFalse
parsePartialFrom
(
com
.
google
.
protobuf
.
CodedInputStream
input
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
new
deviceOfflineIsFalse
(
input
,
extensionRegistry
);
}
};
@Override
public
com
.
google
.
protobuf
.
Parser
<
deviceOfflineIsFalse
>
getParserForType
()
{
return
PARSER
;
}
private
int
bitField0_
;
// required string sn = 1;
public
static
final
int
SN_FIELD_NUMBER
=
1
;
private
Object
sn_
;
/**
* <code>required string sn = 1;</code>
*
* <pre>
*设备号
* </pre>
*/
public
boolean
hasSn
()
{
return
((
bitField0_
&
0x00000001
)
==
0x00000001
);
}
/**
* <code>required string sn = 1;</code>
*
* <pre>
*设备号
* </pre>
*/
public
String
getSn
()
{
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
(
bs
.
isValidUtf8
())
{
sn_
=
s
;
}
return
s
;
}
}
/**
* <code>required string sn = 1;</code>
*
* <pre>
*设备号
* </pre>
*/
public
com
.
google
.
protobuf
.
ByteString
getSnBytes
()
{
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 vin = 2;
public
static
final
int
VIN_FIELD_NUMBER
=
2
;
private
Object
vin_
;
/**
* <code>required string vin = 2;</code>
*
* <pre>
*车架号
* </pre>
*/
public
boolean
hasVin
()
{
return
((
bitField0_
&
0x00000002
)
==
0x00000002
);
}
/**
* <code>required string vin = 2;</code>
*
* <pre>
*车架号
* </pre>
*/
public
String
getVin
()
{
Object
ref
=
vin_
;
if
(
ref
instanceof
String
)
{
return
(
String
)
ref
;
}
else
{
com
.
google
.
protobuf
.
ByteString
bs
=
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
String
s
=
bs
.
toStringUtf8
();
if
(
bs
.
isValidUtf8
())
{
vin_
=
s
;
}
return
s
;
}
}
/**
* <code>required string vin = 2;</code>
*
* <pre>
*车架号
* </pre>
*/
public
com
.
google
.
protobuf
.
ByteString
getVinBytes
()
{
Object
ref
=
vin_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
(
(
String
)
ref
);
vin_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
// required string uploadtime = 3;
public
static
final
int
UPLOADTIME_FIELD_NUMBER
=
3
;
private
Object
uploadtime_
;
/**
* <code>required string uploadtime = 3;</code>
*
* <pre>
*上传时间
* </pre>
*/
public
boolean
hasUploadtime
()
{
return
((
bitField0_
&
0x00000004
)
==
0x00000004
);
}
/**
* <code>required string uploadtime = 3;</code>
*
* <pre>
*上传时间
* </pre>
*/
public
String
getUploadtime
()
{
Object
ref
=
uploadtime_
;
if
(
ref
instanceof
String
)
{
return
(
String
)
ref
;
}
else
{
com
.
google
.
protobuf
.
ByteString
bs
=
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
String
s
=
bs
.
toStringUtf8
();
if
(
bs
.
isValidUtf8
())
{
uploadtime_
=
s
;
}
return
s
;
}
}
/**
* <code>required string uploadtime = 3;</code>
*
* <pre>
*上传时间
* </pre>
*/
public
com
.
google
.
protobuf
.
ByteString
getUploadtimeBytes
()
{
Object
ref
=
uploadtime_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
(
(
String
)
ref
);
uploadtime_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
// required string datastatus = 4;
public
static
final
int
DATASTATUS_FIELD_NUMBER
=
4
;
private
Object
datastatus_
;
/**
* <code>required string datastatus = 4;</code>
*
* <pre>
*数据状态(0:正常、1代表结束)
* </pre>
*/
public
boolean
hasDatastatus
()
{
return
((
bitField0_
&
0x00000008
)
==
0x00000008
);
}
/**
* <code>required string datastatus = 4;</code>
*
* <pre>
*数据状态(0:正常、1代表结束)
* </pre>
*/
public
String
getDatastatus
()
{
Object
ref
=
datastatus_
;
if
(
ref
instanceof
String
)
{
return
(
String
)
ref
;
}
else
{
com
.
google
.
protobuf
.
ByteString
bs
=
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
String
s
=
bs
.
toStringUtf8
();
if
(
bs
.
isValidUtf8
())
{
datastatus_
=
s
;
}
return
s
;
}
}
/**
* <code>required string datastatus = 4;</code>
*
* <pre>
*数据状态(0:正常、1代表结束)
* </pre>
*/
public
com
.
google
.
protobuf
.
ByteString
getDatastatusBytes
()
{
Object
ref
=
datastatus_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
(
(
String
)
ref
);
datastatus_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
private
void
initFields
()
{
sn_
=
""
;
vin_
=
""
;
uploadtime_
=
""
;
datastatus_
=
""
;
}
private
byte
memoizedIsInitialized
=
-
1
;
public
final
boolean
isInitialized
()
{
byte
isInitialized
=
memoizedIsInitialized
;
if
(
isInitialized
!=
-
1
)
return
isInitialized
==
1
;
if
(!
hasSn
())
{
memoizedIsInitialized
=
0
;
return
false
;
}
if
(!
hasVin
())
{
memoizedIsInitialized
=
0
;
return
false
;
}
if
(!
hasUploadtime
())
{
memoizedIsInitialized
=
0
;
return
false
;
}
if
(!
hasDatastatus
())
{
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
,
getVinBytes
());
}
if
(((
bitField0_
&
0x00000004
)
==
0x00000004
))
{
output
.
writeBytes
(
3
,
getUploadtimeBytes
());
}
if
(((
bitField0_
&
0x00000008
)
==
0x00000008
))
{
output
.
writeBytes
(
4
,
getDatastatusBytes
());
}
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
,
getVinBytes
());
}
if
(((
bitField0_
&
0x00000004
)
==
0x00000004
))
{
size
+=
com
.
google
.
protobuf
.
CodedOutputStream
.
computeBytesSize
(
3
,
getUploadtimeBytes
());
}
if
(((
bitField0_
&
0x00000008
)
==
0x00000008
))
{
size
+=
com
.
google
.
protobuf
.
CodedOutputStream
.
computeBytesSize
(
4
,
getDatastatusBytes
());
}
size
+=
getUnknownFields
().
getSerializedSize
();
memoizedSerializedSize
=
size
;
return
size
;
}
private
static
final
long
serialVersionUID
=
0L
;
@Override
protected
Object
writeReplace
()
throws
java
.
io
.
ObjectStreamException
{
return
super
.
writeReplace
();
}
public
static
deviceOfflineIsFalse
parseFrom
(
com
.
google
.
protobuf
.
ByteString
data
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
PARSER
.
parseFrom
(
data
);
}
public
static
deviceOfflineIsFalse
parseFrom
(
com
.
google
.
protobuf
.
ByteString
data
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
PARSER
.
parseFrom
(
data
,
extensionRegistry
);
}
public
static
deviceOfflineIsFalse
parseFrom
(
byte
[]
data
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
PARSER
.
parseFrom
(
data
);
}
public
static
deviceOfflineIsFalse
parseFrom
(
byte
[]
data
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
com
.
google
.
protobuf
.
InvalidProtocolBufferException
{
return
PARSER
.
parseFrom
(
data
,
extensionRegistry
);
}
public
static
deviceOfflineIsFalse
parseFrom
(
java
.
io
.
InputStream
input
)
throws
java
.
io
.
IOException
{
return
PARSER
.
parseFrom
(
input
);
}
public
static
deviceOfflineIsFalse
parseFrom
(
java
.
io
.
InputStream
input
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
java
.
io
.
IOException
{
return
PARSER
.
parseFrom
(
input
,
extensionRegistry
);
}
public
static
deviceOfflineIsFalse
parseDelimitedFrom
(
java
.
io
.
InputStream
input
)
throws
java
.
io
.
IOException
{
return
PARSER
.
parseDelimitedFrom
(
input
);
}
public
static
deviceOfflineIsFalse
parseDelimitedFrom
(
java
.
io
.
InputStream
input
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
java
.
io
.
IOException
{
return
PARSER
.
parseDelimitedFrom
(
input
,
extensionRegistry
);
}
public
static
deviceOfflineIsFalse
parseFrom
(
com
.
google
.
protobuf
.
CodedInputStream
input
)
throws
java
.
io
.
IOException
{
return
PARSER
.
parseFrom
(
input
);
}
public
static
deviceOfflineIsFalse
parseFrom
(
com
.
google
.
protobuf
.
CodedInputStream
input
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
java
.
io
.
IOException
{
return
PARSER
.
parseFrom
(
input
,
extensionRegistry
);
}
public
static
Builder
newBuilder
()
{
return
Builder
.
create
();
}
public
Builder
newBuilderForType
()
{
return
newBuilder
();
}
public
static
Builder
newBuilder
(
deviceOfflineIsFalse
prototype
)
{
return
newBuilder
().
mergeFrom
(
prototype
);
}
public
Builder
toBuilder
()
{
return
newBuilder
(
this
);
}
@Override
protected
Builder
newBuilderForType
(
BuilderParent
parent
)
{
Builder
builder
=
new
Builder
(
parent
);
return
builder
;
}
/**
* Protobuf type {@code deviceOfflineIsFalse}
*/
public
static
final
class
Builder
extends
com
.
google
.
protobuf
.
GeneratedMessage
.
Builder
<
Builder
>
implements
deviceOfflineIsFalseOrBuilder
{
public
static
final
com
.
google
.
protobuf
.
Descriptors
.
Descriptor
getDescriptor
()
{
return
KafkaDeviceOfflineIsFalse
.
internal_static_deviceOfflineIsFalse_descriptor
;
}
protected
FieldAccessorTable
internalGetFieldAccessorTable
()
{
return
KafkaDeviceOfflineIsFalse
.
internal_static_deviceOfflineIsFalse_fieldAccessorTable
.
ensureFieldAccessorsInitialized
(
deviceOfflineIsFalse
.
class
,
Builder
.
class
);
}
// Construct using KafkaDeviceOfflineIsFalse.deviceOfflineIsFalse.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
);
vin_
=
""
;
bitField0_
=
(
bitField0_
&
~
0x00000002
);
uploadtime_
=
""
;
bitField0_
=
(
bitField0_
&
~
0x00000004
);
datastatus_
=
""
;
bitField0_
=
(
bitField0_
&
~
0x00000008
);
return
this
;
}
public
Builder
clone
()
{
return
create
().
mergeFrom
(
buildPartial
());
}
public
com
.
google
.
protobuf
.
Descriptors
.
Descriptor
getDescriptorForType
()
{
return
KafkaDeviceOfflineIsFalse
.
internal_static_deviceOfflineIsFalse_descriptor
;
}
public
deviceOfflineIsFalse
getDefaultInstanceForType
()
{
return
deviceOfflineIsFalse
.
getDefaultInstance
();
}
public
deviceOfflineIsFalse
build
()
{
deviceOfflineIsFalse
result
=
buildPartial
();
if
(!
result
.
isInitialized
())
{
throw
newUninitializedMessageException
(
result
);
}
return
result
;
}
public
deviceOfflineIsFalse
buildPartial
()
{
deviceOfflineIsFalse
result
=
new
deviceOfflineIsFalse
(
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
.
vin_
=
vin_
;
if
(((
from_bitField0_
&
0x00000004
)
==
0x00000004
))
{
to_bitField0_
|=
0x00000004
;
}
result
.
uploadtime_
=
uploadtime_
;
if
(((
from_bitField0_
&
0x00000008
)
==
0x00000008
))
{
to_bitField0_
|=
0x00000008
;
}
result
.
datastatus_
=
datastatus_
;
result
.
bitField0_
=
to_bitField0_
;
onBuilt
();
return
result
;
}
public
Builder
mergeFrom
(
com
.
google
.
protobuf
.
Message
other
)
{
if
(
other
instanceof
deviceOfflineIsFalse
)
{
return
mergeFrom
((
deviceOfflineIsFalse
)
other
);
}
else
{
super
.
mergeFrom
(
other
);
return
this
;
}
}
public
Builder
mergeFrom
(
deviceOfflineIsFalse
other
)
{
if
(
other
==
deviceOfflineIsFalse
.
getDefaultInstance
())
return
this
;
if
(
other
.
hasSn
())
{
bitField0_
|=
0x00000001
;
sn_
=
other
.
sn_
;
onChanged
();
}
if
(
other
.
hasVin
())
{
bitField0_
|=
0x00000002
;
vin_
=
other
.
vin_
;
onChanged
();
}
if
(
other
.
hasUploadtime
())
{
bitField0_
|=
0x00000004
;
uploadtime_
=
other
.
uploadtime_
;
onChanged
();
}
if
(
other
.
hasDatastatus
())
{
bitField0_
|=
0x00000008
;
datastatus_
=
other
.
datastatus_
;
onChanged
();
}
this
.
mergeUnknownFields
(
other
.
getUnknownFields
());
return
this
;
}
public
final
boolean
isInitialized
()
{
if
(!
hasSn
())
{
return
false
;
}
if
(!
hasVin
())
{
return
false
;
}
if
(!
hasUploadtime
())
{
return
false
;
}
if
(!
hasDatastatus
())
{
return
false
;
}
return
true
;
}
public
Builder
mergeFrom
(
com
.
google
.
protobuf
.
CodedInputStream
input
,
com
.
google
.
protobuf
.
ExtensionRegistryLite
extensionRegistry
)
throws
java
.
io
.
IOException
{
deviceOfflineIsFalse
parsedMessage
=
null
;
try
{
parsedMessage
=
PARSER
.
parsePartialFrom
(
input
,
extensionRegistry
);
}
catch
(
com
.
google
.
protobuf
.
InvalidProtocolBufferException
e
)
{
parsedMessage
=
(
deviceOfflineIsFalse
)
e
.
getUnfinishedMessage
();
throw
e
;
}
finally
{
if
(
parsedMessage
!=
null
)
{
mergeFrom
(
parsedMessage
);
}
}
return
this
;
}
private
int
bitField0_
;
// required string sn = 1;
private
Object
sn_
=
""
;
/**
* <code>required string sn = 1;</code>
*
* <pre>
*设备号
* </pre>
*/
public
boolean
hasSn
()
{
return
((
bitField0_
&
0x00000001
)
==
0x00000001
);
}
/**
* <code>required string sn = 1;</code>
*
* <pre>
*设备号
* </pre>
*/
public
String
getSn
()
{
Object
ref
=
sn_
;
if
(!(
ref
instanceof
String
))
{
String
s
=
((
com
.
google
.
protobuf
.
ByteString
)
ref
)
.
toStringUtf8
();
sn_
=
s
;
return
s
;
}
else
{
return
(
String
)
ref
;
}
}
/**
* <code>required string sn = 1;</code>
*
* <pre>
*设备号
* </pre>
*/
public
com
.
google
.
protobuf
.
ByteString
getSnBytes
()
{
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
;
}
}
/**
* <code>required string sn = 1;</code>
*
* <pre>
*设备号
* </pre>
*/
public
Builder
setSn
(
String
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000001
;
sn_
=
value
;
onChanged
();
return
this
;
}
/**
* <code>required string sn = 1;</code>
*
* <pre>
*设备号
* </pre>
*/
public
Builder
clearSn
()
{
bitField0_
=
(
bitField0_
&
~
0x00000001
);
sn_
=
getDefaultInstance
().
getSn
();
onChanged
();
return
this
;
}
/**
* <code>required string sn = 1;</code>
*
* <pre>
*设备号
* </pre>
*/
public
Builder
setSnBytes
(
com
.
google
.
protobuf
.
ByteString
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000001
;
sn_
=
value
;
onChanged
();
return
this
;
}
// required string vin = 2;
private
Object
vin_
=
""
;
/**
* <code>required string vin = 2;</code>
*
* <pre>
*车架号
* </pre>
*/
public
boolean
hasVin
()
{
return
((
bitField0_
&
0x00000002
)
==
0x00000002
);
}
/**
* <code>required string vin = 2;</code>
*
* <pre>
*车架号
* </pre>
*/
public
String
getVin
()
{
Object
ref
=
vin_
;
if
(!(
ref
instanceof
String
))
{
String
s
=
((
com
.
google
.
protobuf
.
ByteString
)
ref
)
.
toStringUtf8
();
vin_
=
s
;
return
s
;
}
else
{
return
(
String
)
ref
;
}
}
/**
* <code>required string vin = 2;</code>
*
* <pre>
*车架号
* </pre>
*/
public
com
.
google
.
protobuf
.
ByteString
getVinBytes
()
{
Object
ref
=
vin_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
(
(
String
)
ref
);
vin_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
/**
* <code>required string vin = 2;</code>
*
* <pre>
*车架号
* </pre>
*/
public
Builder
setVin
(
String
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000002
;
vin_
=
value
;
onChanged
();
return
this
;
}
/**
* <code>required string vin = 2;</code>
*
* <pre>
*车架号
* </pre>
*/
public
Builder
clearVin
()
{
bitField0_
=
(
bitField0_
&
~
0x00000002
);
vin_
=
getDefaultInstance
().
getVin
();
onChanged
();
return
this
;
}
/**
* <code>required string vin = 2;</code>
*
* <pre>
*车架号
* </pre>
*/
public
Builder
setVinBytes
(
com
.
google
.
protobuf
.
ByteString
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000002
;
vin_
=
value
;
onChanged
();
return
this
;
}
// required string uploadtime = 3;
private
Object
uploadtime_
=
""
;
/**
* <code>required string uploadtime = 3;</code>
*
* <pre>
*上传时间
* </pre>
*/
public
boolean
hasUploadtime
()
{
return
((
bitField0_
&
0x00000004
)
==
0x00000004
);
}
/**
* <code>required string uploadtime = 3;</code>
*
* <pre>
*上传时间
* </pre>
*/
public
String
getUploadtime
()
{
Object
ref
=
uploadtime_
;
if
(!(
ref
instanceof
String
))
{
String
s
=
((
com
.
google
.
protobuf
.
ByteString
)
ref
)
.
toStringUtf8
();
uploadtime_
=
s
;
return
s
;
}
else
{
return
(
String
)
ref
;
}
}
/**
* <code>required string uploadtime = 3;</code>
*
* <pre>
*上传时间
* </pre>
*/
public
com
.
google
.
protobuf
.
ByteString
getUploadtimeBytes
()
{
Object
ref
=
uploadtime_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
(
(
String
)
ref
);
uploadtime_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
/**
* <code>required string uploadtime = 3;</code>
*
* <pre>
*上传时间
* </pre>
*/
public
Builder
setUploadtime
(
String
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000004
;
uploadtime_
=
value
;
onChanged
();
return
this
;
}
/**
* <code>required string uploadtime = 3;</code>
*
* <pre>
*上传时间
* </pre>
*/
public
Builder
clearUploadtime
()
{
bitField0_
=
(
bitField0_
&
~
0x00000004
);
uploadtime_
=
getDefaultInstance
().
getUploadtime
();
onChanged
();
return
this
;
}
/**
* <code>required string uploadtime = 3;</code>
*
* <pre>
*上传时间
* </pre>
*/
public
Builder
setUploadtimeBytes
(
com
.
google
.
protobuf
.
ByteString
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000004
;
uploadtime_
=
value
;
onChanged
();
return
this
;
}
// required string datastatus = 4;
private
Object
datastatus_
=
""
;
/**
* <code>required string datastatus = 4;</code>
*
* <pre>
*数据状态(0:正常、1代表结束)
* </pre>
*/
public
boolean
hasDatastatus
()
{
return
((
bitField0_
&
0x00000008
)
==
0x00000008
);
}
/**
* <code>required string datastatus = 4;</code>
*
* <pre>
*数据状态(0:正常、1代表结束)
* </pre>
*/
public
String
getDatastatus
()
{
Object
ref
=
datastatus_
;
if
(!(
ref
instanceof
String
))
{
String
s
=
((
com
.
google
.
protobuf
.
ByteString
)
ref
)
.
toStringUtf8
();
datastatus_
=
s
;
return
s
;
}
else
{
return
(
String
)
ref
;
}
}
/**
* <code>required string datastatus = 4;</code>
*
* <pre>
*数据状态(0:正常、1代表结束)
* </pre>
*/
public
com
.
google
.
protobuf
.
ByteString
getDatastatusBytes
()
{
Object
ref
=
datastatus_
;
if
(
ref
instanceof
String
)
{
com
.
google
.
protobuf
.
ByteString
b
=
com
.
google
.
protobuf
.
ByteString
.
copyFromUtf8
(
(
String
)
ref
);
datastatus_
=
b
;
return
b
;
}
else
{
return
(
com
.
google
.
protobuf
.
ByteString
)
ref
;
}
}
/**
* <code>required string datastatus = 4;</code>
*
* <pre>
*数据状态(0:正常、1代表结束)
* </pre>
*/
public
Builder
setDatastatus
(
String
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000008
;
datastatus_
=
value
;
onChanged
();
return
this
;
}
/**
* <code>required string datastatus = 4;</code>
*
* <pre>
*数据状态(0:正常、1代表结束)
* </pre>
*/
public
Builder
clearDatastatus
()
{
bitField0_
=
(
bitField0_
&
~
0x00000008
);
datastatus_
=
getDefaultInstance
().
getDatastatus
();
onChanged
();
return
this
;
}
/**
* <code>required string datastatus = 4;</code>
*
* <pre>
*数据状态(0:正常、1代表结束)
* </pre>
*/
public
Builder
setDatastatusBytes
(
com
.
google
.
protobuf
.
ByteString
value
)
{
if
(
value
==
null
)
{
throw
new
NullPointerException
();
}
bitField0_
|=
0x00000008
;
datastatus_
=
value
;
onChanged
();
return
this
;
}
// @@protoc_insertion_point(builder_scope:deviceOfflineIsFalse)
}
static
{
defaultInstance
=
new
deviceOfflineIsFalse
(
true
);
defaultInstance
.
initFields
();
}
// @@protoc_insertion_point(class_scope:deviceOfflineIsFalse)
}
private
static
com
.
google
.
protobuf
.
Descriptors
.
Descriptor
internal_static_deviceOfflineIsFalse_descriptor
;
private
static
com
.
google
.
protobuf
.
GeneratedMessage
.
FieldAccessorTable
internal_static_deviceOfflineIsFalse_fieldAccessorTable
;
public
static
com
.
google
.
protobuf
.
Descriptors
.
FileDescriptor
getDescriptor
()
{
return
descriptor
;
}
private
static
com
.
google
.
protobuf
.
Descriptors
.
FileDescriptor
descriptor
;
static
{
String
[]
descriptorData
=
{
"\n kafka_deviceOfflineIsFalse.proto\"W\n\024de"
+
"viceOfflineIsFalse\022\n\n\002sn\030\001 \002(\t\022\013\n\003vin\030\002 "
+
"\002(\t\022\022\n\nuploadtime\030\003 \002(\t\022\022\n\ndatastatus\030\004 "
+
"\002(\t"
};
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_deviceOfflineIsFalse_descriptor
=
getDescriptor
().
getMessageTypes
().
get
(
0
);
internal_static_deviceOfflineIsFalse_fieldAccessorTable
=
new
com
.
google
.
protobuf
.
GeneratedMessage
.
FieldAccessorTable
(
internal_static_deviceOfflineIsFalse_descriptor
,
new
String
[]
{
"Sn"
,
"Vin"
,
"Uploadtime"
,
"Datastatus"
,
});
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/KafkaBatteryConsumer.java
View file @
3baa577
...
...
@@ -40,7 +40,6 @@ public class KafkaBatteryConsumer extends MessageReceiver {
batteryClient
.
saveBatteryInfo
(
devicePowerDTO
);
}
catch
(
Exception
e
)
{
log
.
error
(
"KafkaBatteryConsumer--消费异常:"
+
e
.
getMessage
());
e
.
printStackTrace
();
}
}
...
...
src/main/java/cn/com/glsx/kafka/queue/consumer/KafkaDeviceOfflineIsFalseConsumer.java
0 → 100644
View file @
3baa577
package
cn
.
com
.
glsx
.
kafka
.
queue
.
consumer
;
import
cn.com.glsx.admin.common.util.DateUtil
;
import
cn.com.glsx.kafka.constant.Constants
;
import
cn.com.glsx.kafka.protocol.KafkaDeviceOfflineIsFalse
;
import
cn.com.glsx.kafka.protocol.KafkaJourney
;
import
cn.com.glsx.kafka.queue.base.MessageReceiver
;
import
cn.com.glsx.kafka.service.FakeOfflineChangeFeignService
;
import
cn.com.glsx.stdinterface.dto.FakeOfflineChangeFrequentlyDTO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.Objects
;
/**
* 十日内反复在状态变化假性离线
* @author xiangyanlin
* @date 2022/9/15
*/
@Slf4j
public
class
KafkaDeviceOfflineIsFalseConsumer
extends
MessageReceiver
{
@Autowired
private
FakeOfflineChangeFeignService
fakeOfflineChangeFeignService
;
@Override
public
void
processMessage
(
String
topic
,
byte
[]
message
)
throws
Exception
{
try
{
KafkaDeviceOfflineIsFalse
.
deviceOfflineIsFalse
data
=
KafkaDeviceOfflineIsFalse
.
deviceOfflineIsFalse
.
parseFrom
(
message
);
log
.
info
(
"十日内反复在状态变化假性离线:{}"
,
data
.
toString
());
if
(
Objects
.
equals
(
Constants
.
STATUS_CHANGE_END
,
data
.
getDatastatus
()))
{
fakeOfflineChangeFeignService
.
updateStatus
();
return
;
}
FakeOfflineChangeFrequentlyDTO
frequentlyDTO
=
buildFakeOfflineChangeFrequentlyDTO
(
data
);
fakeOfflineChangeFeignService
.
save
(
frequentlyDTO
);
}
catch
(
Exception
e
)
{
log
.
error
(
"KafkaDeviceOfflineIsFalseConsumer--消费异常:"
+
e
.
getMessage
());
}
}
public
FakeOfflineChangeFrequentlyDTO
buildFakeOfflineChangeFrequentlyDTO
(
KafkaDeviceOfflineIsFalse
.
deviceOfflineIsFalse
source
)
{
FakeOfflineChangeFrequentlyDTO
fakeOfflineChangeFrequentlyDTO
=
new
FakeOfflineChangeFrequentlyDTO
();
fakeOfflineChangeFrequentlyDTO
.
setSn
(
source
.
getSn
());
fakeOfflineChangeFrequentlyDTO
.
setVin
(
source
.
getVin
());
fakeOfflineChangeFrequentlyDTO
.
setFakeOfflineTime
(
DateUtil
.
parseDateYmd
(
source
.
getUploadtime
()));
fakeOfflineChangeFrequentlyDTO
.
setStatus
(
Constants
.
STATUS_CHANGE_ENABLE
);
return
fakeOfflineChangeFrequentlyDTO
;
}
}
src/main/java/cn/com/glsx/kafka/queue/consumer/KafkaGpsMsgSvrConsumer.java
View file @
3baa577
package
cn
.
com
.
glsx
.
kafka
.
queue
.
consumer
;
import
cn.com.glsx.kafka.constant.Constants
;
import
cn.com.glsx.kafka.protocol.KafkaGpsMsgSvr
;
import
cn.com.glsx.kafka.queue.base.MessageReceiver
;
import
cn.com.glsx.stdinterface.api.DeviceFreqClient
;
import
cn.com.glsx.stdinterface.api.FreqRecordClient
;
import
cn.com.glsx.stdinterface.dto.FreqRecordDto
;
import
com.glsx.plat.core.web.R
;
...
...
@@ -25,14 +27,22 @@ public class KafkaGpsMsgSvrConsumer extends MessageReceiver {
@Autowired
private
FreqRecordClient
freqRecordClient
;
@Autowired
private
DeviceFreqClient
deviceFreqClient
;
@Override
public
void
processMessage
(
String
topic
,
byte
[]
message
)
throws
Exception
{
KafkaGpsMsgSvr
.
setParamMark
paramMark
=
KafkaGpsMsgSvr
.
setParamMark
.
parseFrom
(
message
);
log
.
info
(
"开始消费
gps_setparam_mark==="
+
topic
+
"调频日志接收参数为:"
+
paramMark
.
getDeviceno
()
+
" Seq:"
+
paramMark
.
getSeq
());
log
.
info
(
"开始消费
{}调频日志接收参数为:{}"
,
topic
,
paramMark
.
toString
());
if
(!
paramMark
.
hasSeq
())
{
return
;
}
if
(
paramMark
.
getType
()
==
Constants
.
FREQ_REPLY
)
{
String
sn
=
bytesToString
(
paramMark
.
getDeviceno
().
toByteArray
(),
"UTF-8"
);
R
<
Void
>
result
=
deviceFreqClient
.
updateDeviceFreqResponseStatus
(
sn
);
}
R
hisBySnAndSeqR
=
freqRecordClient
.
getHisBySnAndSeq
(
bytesToString
(
paramMark
.
getDeviceno
().
toByteArray
(),
"UTF-8"
),
paramMark
.
getSeq
());
FreqRecordDto
freqRecordDto
=
(
FreqRecordDto
)
hisBySnAndSeqR
.
getData
(
FreqRecordDto
.
class
);
if
(
freqRecordDto
!=
null
)
{
...
...
src/main/java/cn/com/glsx/kafka/queue/consumer/KafkaJourneyConsumer.java
View file @
3baa577
...
...
@@ -33,7 +33,6 @@ public class KafkaJourneyConsumer extends MessageReceiver {
journeyClient
.
saveDeviceJourney
(
convert
(
journey
));
}
catch
(
Exception
e
)
{
log
.
error
(
"KafkaJourneyConsumer--消费异常:"
+
e
.
getMessage
());
e
.
printStackTrace
();
}
}
...
...
src/main/java/cn/com/glsx/kafka/service/FakeOfflineChangeFeignService.java
0 → 100644
View file @
3baa577
package
cn
.
com
.
glsx
.
kafka
.
service
;
import
cn.com.glsx.stdinterface.api.FakeOfflineChangeClient
;
import
cn.com.glsx.stdinterface.dto.FakeOfflineChangeFrequentlyDTO
;
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.Objects
;
/**
* @author xiangyanlin
* @date 2022/9/15
*/
@Slf4j
@Service
public
class
FakeOfflineChangeFeignService
{
@Autowired
private
FakeOfflineChangeClient
fakeOfflineChangeClient
;
public
void
save
(
FakeOfflineChangeFrequentlyDTO
fakeOfflineChangeFrequentlyDTO
)
{
R
<
Void
>
result
=
fakeOfflineChangeClient
.
save
(
fakeOfflineChangeFrequentlyDTO
);
if
(
Objects
.
isNull
(
result
)
||
!
result
.
isSuccess
())
{
log
.
error
(
"保存假性离线十日反复变化数据失败"
);
}
}
public
void
updateStatus
()
{
R
<
Void
>
result
=
fakeOfflineChangeClient
.
updateStatus
();
if
(
Objects
.
isNull
(
result
)
||
!
result
.
isSuccess
())
{
log
.
error
(
"更新假性离线十日反复变化数据失败"
);
}
}
}
src/main/resources/bootstrap.properties
View file @
3baa577
...
...
@@ -4,7 +4,7 @@ spring.application.name=glsx-ne-shield-kafkaconsumer
#\u65E5\u5FD7\u8DEF\u5F84\uFF08logback-spring.xml\u8BFB\u53D6\uFF0C\u4E0D\u8981\u52A0\u5165\u914D\u7F6E\u4E2D\u5FC3\uFF09
logging.path
=
/data/java_log/jetty/${spring.application.name}/${spring.application.name}.log
#nacos\u914D\u7F6E\u4E2D\u5FC3
spring.cloud.nacos.config.server-
addr
=
192.168.
3.206:884
8
spring.cloud.nacos.config.server-
addr
=
192.168.
0.63:885
8
#\u8054\u8C03\u6D4B\u8BD5\u7684\u65F6\u5019\u4F7F\u7528
#spring.cloud.nacos.config.server-addr=192.168.0.63:8848
#nacos\u914D\u7F6Eid\uFF0C\u5B8C\u6574dataId=${spring.cloud.nacos.config.prefix}-${spring.profiles.active}.${file-extension\uFF08\u7531\u65B0\u589E\u914D\u7F6E\u65F6\u9009\u7684\u6587\u4EF6\u7C7B\u578B\u51B3\u5B9A\uFF09}
...
...
src/test/java/cn/com/glsx/kafka/service/produce/KafkaDeviceOfflineIsFalseProducerTest.java
0 → 100644
View file @
3baa577
package
cn
.
com
.
glsx
.
kafka
.
service
.
produce
;
import
cn.com.glsx.admin.common.util.DateUtil
;
import
cn.com.glsx.kafka.protocol.KafkaDeviceOfflineIsFalse
;
import
cn.com.glsx.kafka.protocol.KafkaJourneyOverSpeed
;
import
com.glsx.plat.common.utils.DateUtils
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* 十日内反复在状态变化假性离线消息发送
* @author xiangyanlin
* @date 2022/9/23
*/
public
class
KafkaDeviceOfflineIsFalseProducerTest
{
public
static
void
main
(
String
[]
args
)
{
// Date date = DateUtil.addDateDays(new Date(), -1);
// System.out.println(DateUtil.formatNormal(date));
List
<
byte
[]>
messages
=
new
ArrayList
<>();
KafkaDeviceOfflineIsFalse
.
deviceOfflineIsFalse
.
Builder
builder
=
KafkaDeviceOfflineIsFalse
.
deviceOfflineIsFalse
.
newBuilder
();
builder
.
setSn
(
"111"
);
builder
.
setUploadtime
(
DateUtils
.
formatNormal
(
new
Date
()));
// builder.setDatastatus("0");
builder
.
setVin
(
"111"
);
builder
.
setDatastatus
(
"1"
);
KafkaDeviceOfflineIsFalse
.
deviceOfflineIsFalse
req
=
builder
.
build
();
byte
[]
h
=
req
.
toByteArray
();
messages
.
add
(
h
);
new
ProducerBase
().
baseProducer
(
"device_offline_is_false"
,
messages
);
}
}
src/test/java/cn/com/glsx/kafka/service/produce/KafkaGpsMsgSvrProducerTest.java
0 → 100644
View file @
3baa577
package
cn
.
com
.
glsx
.
kafka
.
service
.
produce
;
import
cn.com.glsx.kafka.protocol.KafkaDeviceOfflineIsFalse
;
import
cn.com.glsx.kafka.protocol.KafkaGpsMsgSvr
;
import
com.glsx.plat.common.utils.DateUtils
;
import
com.google.protobuf.ByteString
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author xiangyanlin
* @date 2022/9/26
*/
public
class
KafkaGpsMsgSvrProducerTest
{
public
static
void
main
(
String
[]
args
)
{
List
<
byte
[]>
messages
=
new
ArrayList
<>();
KafkaGpsMsgSvr
.
setParamMark
.
Builder
builder
=
KafkaGpsMsgSvr
.
setParamMark
.
newBuilder
();
ByteString
sn
=
ByteString
.
copyFrom
(
"2691212734"
.
getBytes
());
builder
.
setSeq
(
31432
);
ByteString
value
=
ByteString
.
copyFrom
(
"D:006"
.
getBytes
());
builder
.
setValue
(
value
);
builder
.
setDeviceno
(
sn
);
builder
.
setType
(
3
);
builder
.
setTime
((
int
)
System
.
currentTimeMillis
()
/
1000
);
KafkaGpsMsgSvr
.
setParamMark
req
=
builder
.
build
();
byte
[]
h
=
req
.
toByteArray
();
messages
.
add
(
h
);
new
ProducerBase
().
baseProducer
(
"gps_setparam_mark"
,
messages
);
}
}
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