Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
device-new-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
device-new-platform
Commits
5c6dd7d6
Commit
5c6dd7d6
authored
Apr 26, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改消息组件
parent
a658a419
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
294 additions
and
241 deletions
+294
-241
common-lib/src/main/java/com/mortals/xhx/queue/ConsumerService.java
.../src/main/java/com/mortals/xhx/queue/ConsumerService.java
+0
-24
common-lib/src/main/java/com/mortals/xhx/queue/TopicPartitionInfo.java
...c/main/java/com/mortals/xhx/queue/TopicPartitionInfo.java
+19
-6
common-lib/src/main/java/com/mortals/xhx/queue/kafka/AbstractTbQueueConsumerTemplate.java
...tals/xhx/queue/kafka/AbstractTbQueueConsumerTemplate.java
+6
-8
common-lib/src/main/java/com/mortals/xhx/queue/rabbitmq/TbRabbitMqConsumerTemplate.java
...ortals/xhx/queue/rabbitmq/TbRabbitMqConsumerTemplate.java
+1
-3
common-lib/src/main/java/com/mortals/xhx/queue/rabbitmq/TbRabbitMqProducerTemplate.java
...ortals/xhx/queue/rabbitmq/TbRabbitMqProducerTemplate.java
+43
-14
device-manager-ui/admin/src/components/Header.vue
device-manager-ui/admin/src/components/Header.vue
+1
-1
device-manager/src/main/java/com/mortals/xhx/base/framework/config/P6spySqlFormatConfig.java
...rtals/xhx/base/framework/config/P6spySqlFormatConfig.java
+1
-0
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
...n/java/com/mortals/xhx/busiz/web/DeviceApiController.java
+14
-2
device-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/DeviceMsgComsumerStartedService.java
...n/applicationservice/DeviceMsgComsumerStartedService.java
+1
-1
device-manager/src/main/java/com/mortals/xhx/module/device/model/DeviceEntity.java
...ava/com/mortals/xhx/module/device/model/DeviceEntity.java
+201
-178
device-manager/src/main/resources/bootstrap.yml
device-manager/src/main/resources/bootstrap.yml
+1
-1
device-manager/src/main/resources/spy.properties
device-manager/src/main/resources/spy.properties
+4
-1
device-manager/src/test/java/com/mortals/httpclient/device/DeviceController.http
.../java/com/mortals/httpclient/device/DeviceController.http
+2
-2
No files found.
common-lib/src/main/java/com/mortals/xhx/queue/ConsumerService.java
View file @
5c6dd7d6
...
...
@@ -56,30 +56,6 @@ public class ConsumerService {
for
(
TbQueueMsg
item
:
msgs
)
{
//todo
// Message innerMsg = new Message();
// TbQueueMsgHeaders headMap = item.getHeaders();
// int messageProtocl = headMap.get(MessageHeader.MESSAGEPROTOCOL)[0];
// Map<String, Object> headers = new HashMap<>();
// innerMsg.setPayload(item.getData());
// headers.put(MessageHeader.MESSAGEPROTOCOL, messageProtocl);
// innerMsg.setStoreTime(DateUtils.getCurrDate().getTime());
// if(messageProtocl== MsgTypeEnum.MSG_SYSTEM.getValue()){
// innerMsg.setHeaders(headers);
// sendSysMessage2Cluster(innerMsg);
// }else{
// String clientId = MixAll.convertByteS2Str(headMap.get(MessageHeader.CLIENTID));
// int messageType = headMap.get(MessageHeader.MESSAGETYPE)[0];
// String topic = MixAll.convertByteS2Str(headMap.get(MessageHeader.TOPIC));
// int qos = headMap.get(MessageHeader.QOS)[0];
//
// innerMsg.setClientId(clientId);
// innerMsg.setType(Message.Type.valueOf(messageType));
// headers.put(MessageHeader.TOPIC, topic);
// headers.put(MessageHeader.QOS, qos);
// headers.put(MessageHeader.RETAIN, false);
// headers.put(MessageHeader.DUP, false);
// innerMsg.setHeaders(headers);
// sendContrlMessage2Cluster(innerMsg);
// }
}
}
catch
(
Exception
e
)
{
...
...
common-lib/src/main/java/com/mortals/xhx/queue/TopicPartitionInfo.java
View file @
5c6dd7d6
...
...
@@ -8,16 +8,29 @@ import java.util.Optional;
@Data
public
class
TopicPartitionInfo
{
private
String
topic
;
private
Integer
partition
;
private
String
fullTopicName
;
/**
* topic名称
*/
private
String
topic
;
/**
* 分区,kafka存在
*/
private
Integer
partition
;
/**
* 交换机名称,rabbmitmq存在
*/
private
String
exchangeName
;
/**
* 带分区的topic
*/
private
String
fullTopicName
;
@Builder
public
TopicPartitionInfo
(
String
topic
,
Integer
partition
)
{
public
TopicPartitionInfo
(
String
topic
,
Integer
partition
,
String
exchangeName
)
{
this
.
topic
=
topic
;
this
.
partition
=
partition
;
this
.
exchangeName
=
exchangeName
;
String
tmp
=
topic
;
if
(
partition
!=
null
)
{
tmp
+=
"."
+
partition
;
...
...
@@ -26,7 +39,7 @@ public class TopicPartitionInfo {
}
public
TopicPartitionInfo
newByTopic
(
String
topic
)
{
return
new
TopicPartitionInfo
(
topic
,
this
.
partition
);
return
new
TopicPartitionInfo
(
topic
,
this
.
partition
,
""
);
}
public
String
getTopic
()
{
...
...
common-lib/src/main/java/com/mortals/xhx/queue/kafka/AbstractTbQueueConsumerTemplate.java
View file @
5c6dd7d6
package
com.mortals.xhx.queue.kafka
;
import
com.alibaba.fastjson.JSON
;
import
com.mortals.xhx.queue.TbQueueConsumer
;
import
com.mortals.xhx.queue.TbQueueMsg
;
import
com.mortals.xhx.queue.TopicPartitionInfo
;
...
...
@@ -40,19 +41,19 @@ public abstract class AbstractTbQueueConsumerTemplate<R, T extends TbQueueMsg> i
@Override
public
void
subscribe
()
{
log
.
info
(
"enqueue topic subscribe {} "
,
topic
);
if
(
stopped
)
{
log
.
error
(
"
trying subscribe, but consumer stopped for
topic {}"
,
topic
);
log
.
error
(
"
consumer 线程已停止
topic {}"
,
topic
);
return
;
}
subscribeQueue
.
add
(
Collections
.
singleton
(
new
TopicPartitionInfo
(
topic
,
null
)));
subscribeQueue
.
add
(
Collections
.
singleton
(
new
TopicPartitionInfo
(
topic
,
null
,
""
)));
}
@Override
public
void
subscribe
(
Set
<
TopicPartitionInfo
>
partitions
)
{
log
.
info
(
"
enqueue topics subscribe {} "
,
partitions
);
log
.
info
(
"
订阅的topics {} "
,
JSON
.
toJSONString
(
partitions
)
);
if
(
stopped
)
{
log
.
error
(
"
trying subscribe, but consumer stopped for
topic {}"
,
topic
);
log
.
error
(
"
订阅服务已停止,
topic {}"
,
topic
);
return
;
}
subscribeQueue
.
add
(
partitions
);
...
...
@@ -60,7 +61,6 @@ public abstract class AbstractTbQueueConsumerTemplate<R, T extends TbQueueMsg> i
@Override
public
List
<
T
>
poll
(
long
durationInMillis
)
{
List
<
R
>
records
;
long
startNanos
=
System
.
nanoTime
();
if
(
stopped
)
{
...
...
@@ -73,7 +73,6 @@ public abstract class AbstractTbQueueConsumerTemplate<R, T extends TbQueueMsg> i
if
(
consumerLock
.
isLocked
())
{
log
.
error
(
"poll. consumerLock is locked. will wait with no timeout. it looks like a race conditions or deadlock"
,
new
RuntimeException
(
"stacktrace"
));
}
consumerLock
.
lock
();
try
{
//更新订阅的主题
...
...
@@ -169,5 +168,4 @@ public abstract class AbstractTbQueueConsumerTemplate<R, T extends TbQueueMsg> i
abstract
protected
void
doUnsubscribe
();
}
common-lib/src/main/java/com/mortals/xhx/queue/rabbitmq/TbRabbitMqConsumerTemplate.java
View file @
5c6dd7d6
...
...
@@ -56,9 +56,8 @@ public class TbRabbitMqConsumerTemplate<T extends TbQueueMsg> extends AbstractTb
GetResponse
getResponse
=
channel
.
basicGet
(
queue
,
true
);
return
getResponse
;
}
catch
(
IOException
e
)
{
// log.error("Failed to get messages from queue: [{}]" , queu
e);
log
.
error
(
"Failed to get messages from queue: [{}]"
,
queue
,
e
);
return
null
;
// throw new RuntimeException("Failed to get messages from queue." , e);
}
}).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toList
());
if
(
result
.
size
()
>
0
)
{
...
...
@@ -73,7 +72,6 @@ public class TbRabbitMqConsumerTemplate<T extends TbQueueMsg> extends AbstractTb
queues
=
partitions
.
stream
()
.
map
(
TopicPartitionInfo:
:
getFullTopicName
)
.
collect
(
Collectors
.
toSet
());
//queues.forEach(admin::createTopicIfNotExists);
}
@Override
...
...
common-lib/src/main/java/com/mortals/xhx/queue/rabbitmq/TbRabbitMqProducerTemplate.java
View file @
5c6dd7d6
...
...
@@ -6,6 +6,7 @@ import com.google.common.util.concurrent.MoreExecutors;
import
com.google.gson.Gson
;
import
com.mortals.xhx.queue.*
;
import
com.rabbitmq.client.AMQP
;
import
com.rabbitmq.client.BuiltinExchangeType
;
import
com.rabbitmq.client.Channel
;
import
com.rabbitmq.client.Connection
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -16,15 +17,37 @@ import java.util.concurrent.ConcurrentHashMap;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.TimeoutException
;
/**
* rabbmit 消息生产模板
*
* @author: zxfei
* @date: 2022/4/25 16:10
*/
@Slf4j
public
class
TbRabbitMqProducerTemplate
<
T
extends
TbQueueMsg
>
implements
TbQueueProducer
<
T
>
{
/**
* defaultTopic
*/
private
String
defaultTopic
;
/**
* rabbmit设置
*/
private
TbRabbitMqSettings
rabbitMqSettings
;
/**
* 线程执行器
*/
private
ListeningExecutorService
producerExecutor
;
/**
* 通道
*/
private
Channel
channel
;
/**
* 连接器
*/
private
Connection
connection
;
private
final
Gson
gson
=
new
Gson
();
/**
* topic组
*/
private
final
Set
<
TopicPartitionInfo
>
topics
=
ConcurrentHashMap
.
newKeySet
();
public
TbRabbitMqProducerTemplate
(
TbRabbitMqSettings
rabbitMqSettings
,
String
defaultTopic
)
{
...
...
@@ -35,8 +58,7 @@ public class TbRabbitMqProducerTemplate<T extends TbQueueMsg> implements TbQueue
connection
=
rabbitMqSettings
.
getConnectionFactory
().
newConnection
();
channel
=
connection
.
createChannel
();
}
catch
(
IOException
|
TimeoutException
e
)
{
log
.
error
(
"Failed to create connection."
,
e
);
// throw new RuntimeException("Failed to create connection." , e);
log
.
error
(
"rabbmit创建连接失败!"
,
e
);
}
}
...
...
@@ -55,23 +77,19 @@ public class TbRabbitMqProducerTemplate<T extends TbQueueMsg> implements TbQueue
public
void
send
(
TopicPartitionInfo
tpi
,
T
msg
,
TbQueueCallback
callback
)
{
Boolean
topicIfNotExist
=
createTopicIfNotExist
(
tpi
);
AMQP
.
BasicProperties
properties
=
new
AMQP
.
BasicProperties
();
// .builder()
// .contentType("application/json")
// .deliveryMode(2) // 消息是否持久化,1未持久,2持久
// .contentEncoding("UTF-8") // 编码方式
// .expiration("100000") // 过期时间单位毫秒
// .build();
try
{
if
(!
topicIfNotExist
)
{
channel
.
queueDeclare
(
tpi
.
getTopic
(),
true
,
false
,
false
,
null
);
}
//channel.basicPublish(rabbitMqSettings.getExchangeName(), tpi.getFullTopicName(), properties, gson.toJson(new DefaultTbQueueMsg(msg)).getBytes());
channel
.
basicPublish
(
rabbitMqSettings
.
getExchangeName
(),
tpi
.
getFullTopicName
(),
properties
,
JSON
.
toJSONString
(
new
DefaultTbQueueMsg
(
msg
)).
getBytes
());
if
(!
innerExists
(
tpi
.
getExchangeName
(),
channel
))
{
channel
=
connection
.
createChannel
();
channel
.
exchangeDeclare
(
tpi
.
getExchangeName
(),
BuiltinExchangeType
.
DIRECT
);
}
channel
.
basicPublish
(
tpi
.
getExchangeName
(),
tpi
.
getFullTopicName
(),
properties
,
JSON
.
toJSONString
(
new
DefaultTbQueueMsg
(
msg
)).
getBytes
());
if
(
callback
!=
null
)
{
callback
.
onSuccess
(
null
);
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
log
.
error
(
"Failed publish message: [{}]."
,
msg
,
e
);
if
(
callback
!=
null
)
{
callback
.
onFailure
(
e
);
...
...
@@ -108,4 +126,15 @@ public class TbRabbitMqProducerTemplate<T extends TbQueueMsg> implements TbQueue
topics
.
add
(
tpi
);
return
false
;
}
private
boolean
innerExists
(
String
exchangeName
,
Channel
outerChannel
)
{
boolean
result
=
true
;
try
{
outerChannel
.
exchangeDeclarePassive
(
exchangeName
);
}
catch
(
IOException
e
)
{
result
=
false
;
}
return
result
;
}
}
device-manager-ui/admin/src/components/Header.vue
View file @
5c6dd7d6
...
...
@@ -98,7 +98,7 @@ export default {
});
let
_this
=
this
;
const
getsocketData
=
(
e
)
=>
{
const
getsocketData
=
(
e
)
=>
{
i
// 创建接收消息函数
const
data
=
e
&&
e
.
detail
.
data
;
...
...
device-manager/src/main/java/com/mortals/xhx/base/framework/config/P6spySqlFormatConfig.java
View file @
5c6dd7d6
...
...
@@ -16,6 +16,7 @@ public class P6spySqlFormatConfig implements MessageFormattingStrategy {
@Override
public
String
formatMessage
(
int
connectionId
,
String
now
,
long
elapsed
,
String
category
,
String
prepared
,
String
sql
,
String
url
)
{
return
StringUtils
.
isNotBlank
(
sql
)
?
DateUtils
.
getCurrStrDateTime
()
+
" | 耗时 "
+
elapsed
+
" ms | SQL:"
+
StringUtils
.
LF
+
sql
.
replaceAll
(
"[\\s]+"
,
StringUtils
.
SPACE
)
+
";"
:
""
;
}
...
...
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
View file @
5c6dd7d6
...
...
@@ -148,7 +148,7 @@ public class DeviceApiController {
* @return
*/
@PostMapping
(
"upload"
)
@DeviceAuth
//
@DeviceAuth
public
String
upload
(
@RequestBody
UploadDeviceReq
req
)
{
log
.
info
(
"【设备数据上报】【请求体】--> "
+
JSONObject
.
toJSONString
(
req
));
ApiResp
<
String
>
rsp
=
new
ApiResp
<>();
...
...
@@ -159,7 +159,19 @@ public class DeviceApiController {
DeviceEntity
deviceEntity
=
deviceService
.
getExtCache
(
req
.
getDeviceNum
());
if
(!
ObjectUtils
.
isEmpty
(
deviceEntity
))
{
//将上报信息转发到mq中
TopicPartitionInfo
info
=
TopicPartitionInfo
.
builder
().
topic
(
Constant
.
UPLOAD_TOPIC
+
deviceEntity
.
getDeviceMac
()).
build
();
PlatformEntity
platformEntity
=
platformService
.
get
(
deviceEntity
.
getPlatformId
());
if
(
ObjectUtils
.
isEmpty
(
platformEntity
))
{
throw
new
AppException
(
"当前设备未配置所属系统平台,请在后台配置后再激活!"
);
}
// authInfo.setHost(platformEntity.getPlatformSn());
ProductEntity
productEntity
=
productService
.
get
(
deviceEntity
.
getProductId
());
if
(
ObjectUtils
.
isEmpty
(
productEntity
))
{
throw
new
AppException
(
"当前设备未配置所属产品,请在后台配置后再激活!"
);
}
String
exchangeName
=
platformEntity
.
getPlatformSn
()
+
Constant
.
EXCHANGE_SPLIT
+
productEntity
.
getProductCode
();
TopicPartitionInfo
info
=
TopicPartitionInfo
.
builder
().
exchangeName
(
exchangeName
).
topic
(
Constant
.
UPLOAD_TOPIC
+
deviceEntity
.
getDeviceMac
()).
build
();
TbQueueMsgHeaders
header
=
new
DefaultTbQueueMsgHeaders
();
header
.
put
(
MessageHeader
.
MESSAGETYPE
,
Constant
.
MESSAGETYPE_HEARTBEAT
);
ApiResp
<
String
>
sendDeviceMessageResp
=
deviceService
.
sendDeviceMessage
(
deviceEntity
,
info
,
header
,
JSON
.
toJSONString
(
req
),
null
);
...
...
device-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/DeviceMsgComsumerStartedService.java
View file @
5c6dd7d6
...
...
@@ -59,7 +59,7 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi
//订阅所有已几快活设备
Set
<
TopicPartitionInfo
>
topicPartitionInfoSet
=
deviceService
.
find
(
new
DeviceQuery
().
active
(
ActiveEnum
.
已激活
.
getValue
()).
status
(
StatusEnum
.
启用
.
getValue
())).
stream
()
.
map
(
item
->
new
TopicPartitionInfo
(
Constant
.
UPLOAD_TOPIC
+
item
.
getDeviceMac
(),
null
)
new
TopicPartitionInfo
(
Constant
.
UPLOAD_TOPIC
+
item
.
getDeviceMac
(),
null
,
null
)
).
collect
(
Collectors
.
toSet
());
mainConsumer
.
subscribe
(
topicPartitionInfoSet
);
log
.
info
(
"消费线程订阅设备上报消息成功!:"
+
JSON
.
toJSONString
(
topicPartitionInfoSet
));
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/model/DeviceEntity.java
View file @
5c6dd7d6
...
...
@@ -8,360 +8,380 @@ import com.mortals.framework.annotation.Excel;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.xhx.module.device.model.vo.DeviceVo
;
/**
* 设备实体对象
*
* @author zxfei
* @date 2022-04-25
*/
* 设备实体对象
*
* @author zxfei
* @date 2022-04-25
*/
public
class
DeviceEntity
extends
DeviceVo
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 设备名称
*/
* 设备名称
*/
@Excel
(
name
=
"设备名称"
)
private
String
deviceName
;
/**
* 设备编码
*/
* 设备编码
*/
private
String
deviceCode
;
/**
* 站点编号(来源基础服务平台)
*/
* 站点编号,来源基础服务平台
*/
private
String
siteCode
;
/**
* 设备的MAC地址
*/
* 站点名称
*/
private
String
siteName
;
/**
* 设备的MAC地址
*/
private
String
deviceMac
;
/**
* 平台系统Id
*/
* 平台系统Id
*/
private
Long
platformId
;
/**
* 平台系统名称
*/
* 平台系统名称
*/
private
String
platformName
;
/**
* 产品Id
*/
* 产品Id
*/
private
Long
productId
;
/**
* 产品Id
*/
* 产品名称
*/
private
String
productName
;
/**
* 设备生产厂商ID
*/
* 设备生产厂商ID
*/
private
Long
deviceFirmId
;
/**
* 设备生产厂商名称
*/
* 设备生产厂商名称
*/
@Excel
(
name
=
"设备生产厂商名称"
)
private
String
deviceFirmname
;
/**
* 设备访问ip
*/
* 设备访问ip
*/
private
String
ip
;
/**
* 中心设备编码
*/
* 中心设备编码
*/
private
String
centernum
;
/**
* 端口
*/
* 端口
*/
private
String
port
;
/**
* 在线状态 (0.离线,1.在线)
*/
* 在线状态 (0.离线,1.在线)
*/
@Excel
(
name
=
"在线状态 "
,
readConverterExp
=
"0=离线,1=在线"
)
private
Integer
deviceOnlineStatus
;
/**
* 启用状态 (0.停止,1.启用)
*/
* 启用状态 (0.停止,1.启用)
*/
private
Integer
status
;
/**
* 激活状态 (0.未激活,1.已激活)
*/
* 激活状态 (0.未激活,1.已激活)
*/
@Excel
(
name
=
"激活状态 "
,
readConverterExp
=
"0=未激活,1=已激活"
)
private
Integer
active
;
/**
* 备注
*/
* 备注
*/
private
String
deviceRemark
;
/**
* 最近上线时间
*/
* 最近上线时间
*/
private
Date
onlineTime
;
/**
* 最近离线时间
*/
* 最近离线时间
*/
private
Date
offlineTime
;
public
DeviceEntity
(){}
/**
* 获取 设备名称
* @return String
*/
* 获取 设备名称
* @return String
*/
public
String
getDeviceName
(){
return
deviceName
;
}
/**
* 设置 设备名称
* @param deviceName
*/
* 设置 设备名称
* @param deviceName
*/
public
void
setDeviceName
(
String
deviceName
){
this
.
deviceName
=
deviceName
;
}
/**
* 获取 设备编码
* @return String
*/
* 获取 设备编码
* @return String
*/
public
String
getDeviceCode
(){
return
deviceCode
;
}
/**
* 设置 设备编码
* @param deviceCode
*/
* 设置 设备编码
* @param deviceCode
*/
public
void
setDeviceCode
(
String
deviceCode
){
this
.
deviceCode
=
deviceCode
;
}
/**
* 获取 站点编号(来源基础服务平台)
* @return String
*/
* 获取 站点编号,来源基础服务平台
* @return String
*/
public
String
getSiteCode
(){
return
siteCode
;
}
/**
* 设置 站点编号(来源基础服务平台)
* @param siteCode
*/
* 设置 站点编号,来源基础服务平台
* @param siteCode
*/
public
void
setSiteCode
(
String
siteCode
){
this
.
siteCode
=
siteCode
;
}
/**
* 获取 设备的MAC地址
* @return String
*/
* 获取 站点名称
* @return String
*/
public
String
getSiteName
(){
return
siteName
;
}
/**
* 设置 站点名称
* @param siteName
*/
public
void
setSiteName
(
String
siteName
){
this
.
siteName
=
siteName
;
}
/**
* 获取 设备的MAC地址
* @return String
*/
public
String
getDeviceMac
(){
return
deviceMac
;
}
/**
* 设置 设备的MAC地址
* @param deviceMac
*/
* 设置 设备的MAC地址
* @param deviceMac
*/
public
void
setDeviceMac
(
String
deviceMac
){
this
.
deviceMac
=
deviceMac
;
}
/**
* 获取 平台系统Id
* @return Long
*/
* 获取 平台系统Id
* @return Long
*/
public
Long
getPlatformId
(){
return
platformId
;
}
/**
* 设置 平台系统Id
* @param platformId
*/
* 设置 平台系统Id
* @param platformId
*/
public
void
setPlatformId
(
Long
platformId
){
this
.
platformId
=
platformId
;
}
/**
* 获取 平台系统名称
* @return String
*/
* 获取 平台系统名称
* @return String
*/
public
String
getPlatformName
(){
return
platformName
;
}
/**
* 设置 平台系统名称
* @param platformName
*/
* 设置 平台系统名称
* @param platformName
*/
public
void
setPlatformName
(
String
platformName
){
this
.
platformName
=
platformName
;
}
/**
* 获取 产品Id
* @return Long
*/
* 获取 产品Id
* @return Long
*/
public
Long
getProductId
(){
return
productId
;
}
/**
* 设置 产品Id
* @param productId
*/
* 设置 产品Id
* @param productId
*/
public
void
setProductId
(
Long
productId
){
this
.
productId
=
productId
;
}
/**
* 获取 产品Id
* @return String
*/
* 获取 产品名称
* @return String
*/
public
String
getProductName
(){
return
productName
;
}
/**
* 设置 产品Id
* @param productName
*/
* 设置 产品名称
* @param productName
*/
public
void
setProductName
(
String
productName
){
this
.
productName
=
productName
;
}
/**
* 获取 设备生产厂商ID
* @return Long
*/
* 获取 设备生产厂商ID
* @return Long
*/
public
Long
getDeviceFirmId
(){
return
deviceFirmId
;
}
/**
* 设置 设备生产厂商ID
* @param deviceFirmId
*/
* 设置 设备生产厂商ID
* @param deviceFirmId
*/
public
void
setDeviceFirmId
(
Long
deviceFirmId
){
this
.
deviceFirmId
=
deviceFirmId
;
}
/**
* 获取 设备生产厂商名称
* @return String
*/
* 获取 设备生产厂商名称
* @return String
*/
public
String
getDeviceFirmname
(){
return
deviceFirmname
;
}
/**
* 设置 设备生产厂商名称
* @param deviceFirmname
*/
* 设置 设备生产厂商名称
* @param deviceFirmname
*/
public
void
setDeviceFirmname
(
String
deviceFirmname
){
this
.
deviceFirmname
=
deviceFirmname
;
}
/**
* 获取 设备访问ip
* @return String
*/
* 获取 设备访问ip
* @return String
*/
public
String
getIp
(){
return
ip
;
}
/**
* 设置 设备访问ip
* @param ip
*/
* 设置 设备访问ip
* @param ip
*/
public
void
setIp
(
String
ip
){
this
.
ip
=
ip
;
}
/**
* 获取 中心设备编码
* @return String
*/
* 获取 中心设备编码
* @return String
*/
public
String
getCenternum
(){
return
centernum
;
}
/**
* 设置 中心设备编码
* @param centernum
*/
* 设置 中心设备编码
* @param centernum
*/
public
void
setCenternum
(
String
centernum
){
this
.
centernum
=
centernum
;
}
/**
* 获取 端口
* @return String
*/
* 获取 端口
* @return String
*/
public
String
getPort
(){
return
port
;
}
/**
* 设置 端口
* @param port
*/
* 设置 端口
* @param port
*/
public
void
setPort
(
String
port
){
this
.
port
=
port
;
}
/**
* 获取 在线状态 (0.离线,1.在线)
* @return Integer
*/
* 获取 在线状态 (0.离线,1.在线)
* @return Integer
*/
public
Integer
getDeviceOnlineStatus
(){
return
deviceOnlineStatus
;
}
/**
* 设置 在线状态 (0.离线,1.在线)
* @param deviceOnlineStatus
*/
* 设置 在线状态 (0.离线,1.在线)
* @param deviceOnlineStatus
*/
public
void
setDeviceOnlineStatus
(
Integer
deviceOnlineStatus
){
this
.
deviceOnlineStatus
=
deviceOnlineStatus
;
}
/**
* 获取 启用状态 (0.停止,1.启用)
* @return Integer
*/
* 获取 启用状态 (0.停止,1.启用)
* @return Integer
*/
public
Integer
getStatus
(){
return
status
;
}
/**
* 设置 启用状态 (0.停止,1.启用)
* @param status
*/
* 设置 启用状态 (0.停止,1.启用)
* @param status
*/
public
void
setStatus
(
Integer
status
){
this
.
status
=
status
;
}
/**
* 获取 激活状态 (0.未激活,1.已激活)
* @return Integer
*/
* 获取 激活状态 (0.未激活,1.已激活)
* @return Integer
*/
public
Integer
getActive
(){
return
active
;
}
/**
* 设置 激活状态 (0.未激活,1.已激活)
* @param active
*/
* 设置 激活状态 (0.未激活,1.已激活)
* @param active
*/
public
void
setActive
(
Integer
active
){
this
.
active
=
active
;
}
/**
* 获取 备注
* @return String
*/
* 获取 备注
* @return String
*/
public
String
getDeviceRemark
(){
return
deviceRemark
;
}
/**
* 设置 备注
* @param deviceRemark
*/
* 设置 备注
* @param deviceRemark
*/
public
void
setDeviceRemark
(
String
deviceRemark
){
this
.
deviceRemark
=
deviceRemark
;
}
/**
* 获取 最近上线时间
* @return Date
*/
* 获取 最近上线时间
* @return Date
*/
public
Date
getOnlineTime
(){
return
onlineTime
;
}
/**
* 设置 最近上线时间
* @param onlineTime
*/
* 设置 最近上线时间
* @param onlineTime
*/
public
void
setOnlineTime
(
Date
onlineTime
){
this
.
onlineTime
=
onlineTime
;
}
/**
* 获取 最近离线时间
* @return Date
*/
* 获取 最近离线时间
* @return Date
*/
public
Date
getOfflineTime
(){
return
offlineTime
;
}
/**
* 设置 最近离线时间
* @param offlineTime
*/
* 设置 最近离线时间
* @param offlineTime
*/
public
void
setOfflineTime
(
Date
offlineTime
){
this
.
offlineTime
=
offlineTime
;
}
...
...
@@ -371,7 +391,7 @@ public class DeviceEntity extends DeviceVo {
@Override
public
int
hashCode
()
{
return
this
.
getId
().
hashCode
();
return
this
.
getId
().
hashCode
();
}
@Override
public
boolean
equals
(
Object
obj
)
{
...
...
@@ -379,7 +399,7 @@ public class DeviceEntity extends DeviceVo {
if
(
obj
instanceof
DeviceEntity
)
{
DeviceEntity
tmp
=
(
DeviceEntity
)
obj
;
if
(
this
.
getId
()
==
tmp
.
getId
())
{
return
true
;
return
true
;
}
}
return
false
;
...
...
@@ -390,6 +410,7 @@ public class DeviceEntity extends DeviceVo {
sb
.
append
(
",deviceName:"
).
append
(
getDeviceName
());
sb
.
append
(
",deviceCode:"
).
append
(
getDeviceCode
());
sb
.
append
(
",siteCode:"
).
append
(
getSiteCode
());
sb
.
append
(
",siteName:"
).
append
(
getSiteName
());
sb
.
append
(
",deviceMac:"
).
append
(
getDeviceMac
());
sb
.
append
(
",platformId:"
).
append
(
getPlatformId
());
sb
.
append
(
",platformName:"
).
append
(
getPlatformName
());
...
...
@@ -411,42 +432,44 @@ public class DeviceEntity extends DeviceVo {
public
void
initAttrValue
(){
this
.
deviceName
=
""
;
this
.
deviceName
=
""
;
this
.
deviceCode
=
""
;
this
.
devic
eCode
=
""
;
this
.
sit
eCode
=
""
;
this
.
siteCod
e
=
""
;
this
.
siteNam
e
=
""
;
this
.
deviceMac
=
""
;
this
.
deviceMac
=
""
;
this
.
platformId
=
null
;
this
.
platformId
=
null
;
this
.
platformName
=
""
;
this
.
platformName
=
""
;
this
.
productId
=
null
;
this
.
productId
=
null
;
this
.
productName
=
""
;
this
.
productName
=
""
;
this
.
deviceFirmId
=
null
;
this
.
deviceFirmId
=
null
;
this
.
deviceFirmname
=
""
;
this
.
deviceFirmname
=
""
;
this
.
ip
=
""
;
this
.
ip
=
""
;
this
.
centernum
=
""
;
this
.
centernum
=
""
;
this
.
port
=
""
;
this
.
port
=
""
;
this
.
deviceOnlineStatus
=
0
;
this
.
deviceOnlineStatus
=
0
;
this
.
status
=
0
;
this
.
status
=
0
;
this
.
active
=
0
;
this
.
active
=
0
;
this
.
deviceRemark
=
""
;
this
.
deviceRemark
=
""
;
this
.
onlineTime
=
null
;
this
.
onlineTime
=
null
;
this
.
offlineTime
=
null
;
this
.
offlineTime
=
null
;
}
}
\ No newline at end of file
device-manager/src/main/resources/bootstrap.yml
View file @
5c6dd7d6
...
...
@@ -105,7 +105,7 @@ token:
# 令牌自定义标识
header
:
Authorization
# 令牌密钥
secret
:
abcd1234
secret
:
026db82420614469897fcc2dc1b4ce38
# 令牌有效期(默认60分钟)
expireTime
:
60
# 令牌前缀
...
...
device-manager/src/main/resources/spy.properties
View file @
5c6dd7d6
...
...
@@ -16,4 +16,7 @@ driverlist=com.mysql.cj.jdbc.Driver
# 是否开启慢SQL记录
outagedetection
=
true
# 慢SQL记录标准 秒
outagedetectioninterval
=
2
\ No newline at end of file
outagedetectioninterval
=
2
filter
=
true
exclude
=
mortals_xhx_task
\ No newline at end of file
device-manager/src/test/java/com/mortals/httpclient/device/DeviceController.http
View file @
5c6dd7d6
...
...
@@ -54,7 +54,7 @@ POST {{baseUrl}}/api/active
Content-Type: application/json
{
"deviceNum":"
b12345678
",
"deviceNum":"
AB:DD:DF:FD:AD:FA:DA:SS
",
"deviceMac":"AB:DD:DF:FD:AD:FA:DA:SS",
"action":"active"
}
...
...
@@ -71,7 +71,7 @@ Content-Type: application/json
Authorization: Bearer {{authToken}}
{
"deviceNum":"
a12345678
",
"deviceNum":"
AB:DD:DF:FD:AD:FA:DA:SS
",
"action":"upload"
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment