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
82403c41
Commit
82403c41
authored
Jan 05, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加评价器事件地址
parent
f0929f26
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
14 deletions
+7
-14
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
...als/xhx/module/device/service/impl/DeviceServiceImpl.java
+6
-13
device-manager/src/test/java/com/mortals/httpclient/device/DeviceController.http
.../java/com/mortals/httpclient/device/DeviceController.http
+1
-1
No files found.
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
View file @
82403c41
...
@@ -203,14 +203,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -203,14 +203,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
messageProducer
.
queueAddAndBinds
(
QueueKey
.
DEFAULT_EXCHANGE
,
Constant
.
DOWN_TOPIC
+
deviceCode
,
Constant
.
DOWN_TOPIC
+
deviceCode
);
messageProducer
.
queueAddAndBinds
(
QueueKey
.
DEFAULT_EXCHANGE
,
Constant
.
DOWN_TOPIC
+
deviceCode
,
Constant
.
DOWN_TOPIC
+
deviceCode
);
//订阅上行队列
//订阅上行队列
container
.
addQueueNames
(
Constant
.
UPLOAD_TOPIC
+
deviceCode
);
container
.
addQueueNames
(
Constant
.
UPLOAD_TOPIC
+
deviceCode
);
// registerRabbitQueue(deviceEntity, platformEntity, productEntity);
//
// TbQueueConsumer<TbQueueMsg> mainConsumer = consumerService.getMainConsumer();
// String exchangeName = platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode();
// TopicPartitionInfo topicPartitionInfo = new TopicPartitionInfo(Constant.UPLOAD_TOPIC + deviceCode, null, exchangeName);
// Set<TopicPartitionInfo> topicPartitionInfos = new HashSet<>();
// topicPartitionInfos.add(topicPartitionInfo);
// mainConsumer.subscribe(topicPartitionInfos);
//新增设备通知第三方平台,先新增后激活
//新增设备通知第三方平台,先新增后激活
sendThirdParty
(
deviceEntity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
ADD
);
sendThirdParty
(
deviceEntity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
ADD
);
sendThirdParty
(
deviceEntity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
ACTIVE
);
sendThirdParty
(
deviceEntity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
ACTIVE
);
...
@@ -259,6 +252,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -259,6 +252,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
@Override
@Override
protected
void
saveAfter
(
DeviceEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
saveAfter
(
DeviceEntity
entity
,
Context
context
)
throws
AppException
{
super
.
saveAfter
(
entity
,
context
);
PlatformEntity
platformEntity
=
platformService
.
get
(
entity
.
getPlatformId
());
PlatformEntity
platformEntity
=
platformService
.
get
(
entity
.
getPlatformId
());
ProductEntity
productEntity
=
productService
.
get
(
entity
.
getProductId
());
ProductEntity
productEntity
=
productService
.
get
(
entity
.
getProductId
());
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
)
&&
!
ObjectUtils
.
isEmpty
(
productEntity
))
{
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
)
&&
!
ObjectUtils
.
isEmpty
(
productEntity
))
{
...
@@ -267,11 +261,11 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -267,11 +261,11 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
}
else
{
}
else
{
throw
new
AppException
(
"产品或平台不存在!"
);
throw
new
AppException
(
"产品或平台不存在!"
);
}
}
super
.
saveAfter
(
entity
,
context
);
}
}
@Override
@Override
protected
void
updateAfter
(
DeviceEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
updateAfter
(
DeviceEntity
entity
,
Context
context
)
throws
AppException
{
super
.
updateAfter
(
entity
,
context
);
PlatformEntity
platformEntity
=
platformService
.
get
(
entity
.
getPlatformId
());
PlatformEntity
platformEntity
=
platformService
.
get
(
entity
.
getPlatformId
());
ProductEntity
productEntity
=
productService
.
get
(
entity
.
getProductId
());
ProductEntity
productEntity
=
productService
.
get
(
entity
.
getProductId
());
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
)
&&
!
ObjectUtils
.
isEmpty
(
productEntity
))
{
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
)
&&
!
ObjectUtils
.
isEmpty
(
productEntity
))
{
...
@@ -281,11 +275,9 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -281,11 +275,9 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
messageProducer
.
queueAddAndBinds
(
QueueKey
.
DEFAULT_EXCHANGE
,
Constant
.
UPLOAD_TOPIC
+
entity
.
getDeviceCode
(),
Constant
.
UPLOAD_TOPIC
+
entity
.
getDeviceCode
());
messageProducer
.
queueAddAndBinds
(
QueueKey
.
DEFAULT_EXCHANGE
,
Constant
.
UPLOAD_TOPIC
+
entity
.
getDeviceCode
(),
Constant
.
UPLOAD_TOPIC
+
entity
.
getDeviceCode
());
messageProducer
.
queueAddAndBinds
(
QueueKey
.
DEFAULT_EXCHANGE
,
Constant
.
DOWN_TOPIC
+
entity
.
getDeviceCode
(),
Constant
.
DOWN_TOPIC
+
entity
.
getDeviceCode
());
messageProducer
.
queueAddAndBinds
(
QueueKey
.
DEFAULT_EXCHANGE
,
Constant
.
DOWN_TOPIC
+
entity
.
getDeviceCode
(),
Constant
.
DOWN_TOPIC
+
entity
.
getDeviceCode
());
//registerRabbitQueue(entity, platformEntity, productEntity);
sendThirdParty
(
entity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
UPDATE
);
sendThirdParty
(
entity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
UPDATE
);
}
}
}
}
super
.
updateAfter
(
entity
,
context
);
}
}
@Override
@Override
...
@@ -583,6 +575,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -583,6 +575,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
@Override
@Override
protected
void
saveBefore
(
DeviceEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
saveBefore
(
DeviceEntity
entity
,
Context
context
)
throws
AppException
{
super
.
saveBefore
(
entity
,
context
);
if
(
ObjectUtils
.
isEmpty
(
entity
.
getDeviceCode
()))
{
if
(
ObjectUtils
.
isEmpty
(
entity
.
getDeviceCode
()))
{
throw
new
AppException
(
"设备编码不能为空!"
);
throw
new
AppException
(
"设备编码不能为空!"
);
}
}
...
@@ -657,15 +650,15 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -657,15 +650,15 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
sendThirdParty
(
entity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
ACTIVE
);
sendThirdParty
(
entity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
ACTIVE
);
}
}
updateDeviceHomeUrl
(
entity
);
updateDeviceHomeUrl
(
entity
);
super
.
saveBefore
(
entity
,
context
);
}
}
@Override
@Override
protected
void
updateBefore
(
DeviceEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
updateBefore
(
DeviceEntity
entity
,
Context
context
)
throws
AppException
{
super
.
updateBefore
(
entity
,
context
);
ProductEntity
productEntity
=
productService
.
get
(
entity
.
getProductId
(),
context
);
ProductEntity
productEntity
=
productService
.
get
(
entity
.
getProductId
(),
context
);
entity
.
setProductCode
(
productEntity
.
getProductCode
());
entity
.
setProductCode
(
productEntity
.
getProductCode
());
updateDeviceHomeUrl
(
entity
);
updateDeviceHomeUrl
(
entity
);
super
.
updateBefore
(
entity
,
context
);
}
}
private
void
updateDeviceHomeUrl
(
DeviceEntity
entity
)
{
private
void
updateDeviceHomeUrl
(
DeviceEntity
entity
)
{
...
...
device-manager/src/test/java/com/mortals/httpclient/device/DeviceController.http
View file @
82403c41
...
@@ -89,7 +89,7 @@ POST {{baseUrl}}/api/register
...
@@ -89,7 +89,7 @@ POST {{baseUrl}}/api/register
Content-Type: application/json
Content-Type: application/json
{
{
"deviceCode": "
a109
"
"deviceCode": "
18-93-7F-C0-AD-B5
"
}
}
> {%
> {%
...
...
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