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
e38a012a
Commit
e38a012a
authored
Jun 01, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改平台获取方式为缓存方式
parent
d99b0ba8
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
45 additions
and
45 deletions
+45
-45
device-manager/src/main/java/com/mortals/xhx/base/framework/listener/CustomerKeyExpirationListener.java
...ase/framework/listener/CustomerKeyExpirationListener.java
+2
-2
device-manager/src/main/java/com/mortals/xhx/base/framework/listener/DirectDynamicListener.java
...ls/xhx/base/framework/listener/DirectDynamicListener.java
+2
-2
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
...n/java/com/mortals/xhx/busiz/web/DeviceApiController.java
+4
-4
device-manager/src/main/java/com/mortals/xhx/daemon/DemoApiController.java
...c/main/java/com/mortals/xhx/daemon/DemoApiController.java
+1
-1
device-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/DeviceComsumersRegisterService.java
...on/applicationservice/DeviceComsumersRegisterService.java
+4
-4
device-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/DeviceMsgComsumerStartedService.java
...n/applicationservice/DeviceMsgComsumerStartedService.java
+7
-7
device-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/RabbitMsgComsumerStartedService.java
...n/applicationservice/RabbitMsgComsumerStartedService.java
+2
-2
device-manager/src/main/java/com/mortals/xhx/daemon/task/DeviceStatTaskImpl.java
.../java/com/mortals/xhx/daemon/task/DeviceStatTaskImpl.java
+2
-2
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceModuleUseServiceImpl.java
...odule/device/service/impl/DeviceModuleUseServiceImpl.java
+2
-2
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
...als/xhx/module/device/service/impl/DeviceServiceImpl.java
+18
-18
device-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
...s/xhx/module/product/service/impl/ProductServiceImpl.java
+1
-1
No files found.
device-manager/src/main/java/com/mortals/xhx/base/framework/listener/CustomerKeyExpirationListener.java
View file @
e38a012a
...
...
@@ -82,8 +82,8 @@ public class CustomerKeyExpirationListener implements MessageListener {
deviceService
.
putCache
(
deviceEntity
.
getId
().
toString
(),
deviceEntity
);
log
.
info
(
"deviceCode:{},deviceName:{}==>离线"
,
deviceEntity
.
getDeviceCode
(),
deviceEntity
.
getDeviceName
());
// deviceService.update(deviceEntity);
PlatformEntity
platformEntity
=
platformService
.
get
(
deviceEntity
.
getPlatformId
());
ProductEntity
productEntity
=
productService
.
get
(
deviceEntity
.
getProductId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
deviceEntity
.
getPlatformId
().
toString
());
ProductEntity
productEntity
=
productService
.
get
Cache
(
deviceEntity
.
getProductId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
)
&&
!
ObjectUtils
.
isEmpty
(
productEntity
))
{
//通知第三方平台
deviceService
.
sendThirdParty
(
deviceEntity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
OFFLINE
);
...
...
device-manager/src/main/java/com/mortals/xhx/base/framework/listener/DirectDynamicListener.java
View file @
e38a012a
...
...
@@ -86,7 +86,7 @@ public class DirectDynamicListener implements MessageListener {
// deviceService.update(deviceEntity);
deviceService
.
putCache
(
deviceEntity
.
getId
().
toString
(),
deviceEntity
);
PlatformEntity
platformEntity
=
platformService
.
get
(
deviceEntity
.
getPlatformId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
deviceEntity
.
getPlatformId
().
toString
());
ProductEntity
productEntity
=
productService
.
get
(
deviceEntity
.
getProductId
());
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
)
&&
!
ObjectUtils
.
isEmpty
(
productEntity
))
{
//新增设备通知第三方平台
...
...
@@ -110,7 +110,7 @@ public class DirectDynamicListener implements MessageListener {
deviceLogService
.
save
(
deviceLogEntity
);
}
//获取exchange,
PlatformEntity
platformEntity
=
platformService
.
get
(
deviceEntity
.
getPlatformId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
deviceEntity
.
getPlatformId
().
toString
());
String
phpInUrl
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_PHP_IN_HTTP_URL
,
"http://172.15.28.116:8090"
);
if
(!
Constant
.
MESSAGETYPE_HEARTBEAT
.
equalsIgnoreCase
(
messageType
)
...
...
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
View file @
e38a012a
...
...
@@ -664,12 +664,12 @@ public class DeviceApiController {
DeviceEntity
deviceEntity
=
deviceService
.
getExtCache
(
req
.
getDeviceCode
());
if
(!
ObjectUtils
.
isEmpty
(
deviceEntity
))
{
//将上报信息转发到mq中
PlatformEntity
platformEntity
=
platformService
.
get
(
deviceEntity
.
getPlatformId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
deviceEntity
.
getPlatformId
().
toString
());
if
(
ObjectUtils
.
isEmpty
(
platformEntity
))
{
throw
new
AppException
(
"当前设备未配置所属系统平台,请在后台配置后再激活!"
);
}
// authInfo.setHost(platformEntity.getPlatformSn());
ProductEntity
productEntity
=
productService
.
get
(
deviceEntity
.
getProductId
());
ProductEntity
productEntity
=
productService
.
get
Cache
(
deviceEntity
.
getProductId
().
toString
());
if
(
ObjectUtils
.
isEmpty
(
productEntity
))
{
throw
new
AppException
(
"当前设备未配置所属产品,请在后台配置后再激活!"
);
}
...
...
@@ -769,7 +769,7 @@ public class DeviceApiController {
if
(
ObjectUtils
.
isEmpty
(
productEntity
))
{
throw
new
AppException
(
PRODUCT_IS_EMPTY
,
PRODUCT_IS_EMPTY_CONTENT
);
}
PlatformEntity
platformEntity
=
platformService
.
get
(
productEntity
.
getPlatformId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
productEntity
.
getPlatformId
().
toString
());
if
(
ObjectUtils
.
isEmpty
(
platformEntity
))
{
throw
new
AppException
(
PLATFORM_IS_EMPTY
,
PLATFORM_IS_EMPTY_CONTENT
);
}
...
...
@@ -813,7 +813,7 @@ public class DeviceApiController {
throw
new
AppException
(
PRODUCT_IS_EMPTY
,
PRODUCT_IS_EMPTY_CONTENT
);
}
PlatformEntity
platformEntity
=
platformService
.
get
(
productEntity
.
getPlatformId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
productEntity
.
getPlatformId
().
toString
());
if
(
ObjectUtils
.
isEmpty
(
platformEntity
))
{
throw
new
AppException
(
PLATFORM_IS_EMPTY
,
PLATFORM_IS_EMPTY_CONTENT
);
}
...
...
device-manager/src/main/java/com/mortals/xhx/daemon/DemoApiController.java
View file @
e38a012a
...
...
@@ -151,7 +151,7 @@ public class DemoApiController {
if
(!
ObjectUtils
.
isEmpty
(
deviceEntity
))
{
//将上报信息转发到mq中
PlatformEntity
platformEntity
=
platformService
.
get
(
deviceEntity
.
getPlatformId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
deviceEntity
.
getPlatformId
().
toString
());
if
(
ObjectUtils
.
isEmpty
(
platformEntity
))
{
throw
new
AppException
(
"当前设备未配置所属系统平台,请在后台配置后再激活!"
);
}
...
...
device-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/DeviceComsumersRegisterService.java
View file @
e38a012a
...
...
@@ -49,8 +49,8 @@ public class DeviceComsumersRegisterService implements IApplicationStartedServic
deviceService
.
find
(
new
DeviceEntity
())
.
stream
()
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
platformService
.
get
(
f
.
getPlatformId
())))
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
productService
.
get
(
f
.
getProductId
()))).
forEach
(
item
->
{
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
platformService
.
get
Cache
(
f
.
getPlatformId
().
toString
())))
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
productService
.
get
Cache
(
f
.
getProductId
().
toString
()))).
forEach
(
item
->
{
String
uploadQueue
=
Constant
.
UPLOAD_TOPIC
+
item
.
getDeviceCode
();
String
downQueue
=
Constant
.
DOWN_TOPIC
+
item
.
getDeviceCode
();
messageProducer
.
queueAddAndBinds
(
QueueKey
.
DEFAULT_EXCHANGE
,
uploadQueue
,
uploadQueue
);
...
...
@@ -59,8 +59,8 @@ public class DeviceComsumersRegisterService implements IApplicationStartedServic
String
[]
queues
=
deviceService
.
find
(
new
DeviceEntity
())
.
stream
()
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
platformService
.
get
(
f
.
getPlatformId
())))
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
productService
.
get
(
f
.
getProductId
())))
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
platformService
.
get
Cache
(
f
.
getPlatformId
().
toString
())))
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
productService
.
get
Cache
(
f
.
getProductId
().
toString
())))
.
filter
(
f
->!
ObjectUtils
.
isEmpty
(
f
.
getDeviceCode
()))
.
map
(
item
->
Constant
.
UPLOAD_TOPIC
+
item
.
getDeviceCode
())
.
toArray
(
String
[]::
new
);
...
...
device-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/DeviceMsgComsumerStartedService.java
View file @
e38a012a
...
...
@@ -73,11 +73,11 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi
//.status(StatusEnum.启用.getValue())
)
.
stream
()
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
platformService
.
get
(
f
.
getPlatformId
())))
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
productService
.
get
(
f
.
getProductId
())))
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
platformService
.
get
Cache
(
f
.
getPlatformId
().
toString
())))
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
productService
.
get
Cache
(
f
.
getProductId
().
toString
())))
.
map
(
item
->
{
PlatformEntity
platformEntity
=
platformService
.
get
(
item
.
getPlatformId
());
ProductEntity
productEntity
=
productService
.
get
(
item
.
getProductId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
item
.
getPlatformId
().
toString
());
ProductEntity
productEntity
=
productService
.
get
Cache
(
item
.
getProductId
().
toString
());
String
exchangeName
=
platformEntity
.
getPlatformSn
()
+
Constant
.
EXCHANGE_SPLIT
+
productEntity
.
getProductCode
();
return
new
TopicPartitionInfo
(
Constant
.
UPLOAD_TOPIC
+
item
.
getDeviceCode
(),
null
,
exchangeName
);
}
...
...
@@ -169,8 +169,8 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi
deviceEntity
.
setDeviceStatus
(
DeviceStatusEnum
.
在线
.
getValue
());
deviceService
.
update
(
deviceEntity
);
PlatformEntity
platformEntity
=
platformService
.
get
(
deviceEntity
.
getPlatformId
());
ProductEntity
productEntity
=
productService
.
get
(
deviceEntity
.
getProductId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
deviceEntity
.
getPlatformId
().
toString
());
ProductEntity
productEntity
=
productService
.
get
Cache
(
deviceEntity
.
getProductId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
)
&&
!
ObjectUtils
.
isEmpty
(
productEntity
))
{
//新增设备通知第三方平台
deviceService
.
sendThirdParty
(
deviceEntity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
ONLINE
);
...
...
@@ -192,7 +192,7 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi
deviceLogService
.
save
(
deviceLogEntity
);
}
//获取exchange,
PlatformEntity
platformEntity
=
platformService
.
get
(
deviceEntity
.
getPlatformId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
deviceEntity
.
getPlatformId
().
toString
());
String
phpInUrl
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_PHP_IN_HTTP_URL
,
"http://172.15.28.116:8090"
);
if
(!
Constant
.
MESSAGETYPE_HEARTBEAT
.
equalsIgnoreCase
(
messageType
)
&&
!
ObjectUtils
.
isEmpty
(
platformEntity
)
...
...
device-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/RabbitMsgComsumerStartedService.java
View file @
e38a012a
...
...
@@ -39,8 +39,8 @@ public class RabbitMsgComsumerStartedService implements IApplicationStartedServi
log
.
info
(
"服务端消费消息服务开始.."
);
String
[]
queues
=
deviceService
.
find
(
new
DeviceEntity
())
.
stream
()
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
platformService
.
get
(
f
.
getPlatformId
())))
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
productService
.
get
(
f
.
getProductId
())))
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
platformService
.
get
Cache
(
f
.
getPlatformId
().
toString
())))
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
productService
.
get
Cache
(
f
.
getProductId
().
toString
())))
.
map
(
item
->
Constant
.
UPLOAD_TOPIC
+
item
.
getDeviceCode
())
.
distinct
()
.
toArray
(
String
[]::
new
);
...
...
device-manager/src/main/java/com/mortals/xhx/daemon/task/DeviceStatTaskImpl.java
View file @
e38a012a
...
...
@@ -76,8 +76,8 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
log
.
info
(
"修正设备数量:size:{}"
,
deviceOfflineList
.
size
());
deviceService
.
update
(
deviceOfflineList
);
deviceOfflineList
.
forEach
(
deviceEntity
->
{
PlatformEntity
platformEntity
=
platformService
.
get
(
deviceEntity
.
getPlatformId
());
ProductEntity
productEntity
=
productService
.
get
(
deviceEntity
.
getProductId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
deviceEntity
.
getPlatformId
().
toString
());
ProductEntity
productEntity
=
productService
.
get
Cache
(
deviceEntity
.
getProductId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
)
&&
!
ObjectUtils
.
isEmpty
(
productEntity
))
{
//通知第三方平台
deviceService
.
sendThirdParty
(
deviceEntity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
OFFLINE
);
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceModuleUseServiceImpl.java
View file @
e38a012a
...
...
@@ -41,8 +41,8 @@ public class DeviceModuleUseServiceImpl extends AbstractCRUDServiceImpl<DeviceMo
list
.
stream
().
forEach
(
item
->
{
DeviceEntity
deviceEntity
=
deviceService
.
getExtCache
(
item
.
getDeviceId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
deviceEntity
))
{
PlatformEntity
platformEntity
=
platformService
.
get
(
deviceEntity
.
getPlatformId
());
ProductEntity
productEntity
=
productService
.
get
(
deviceEntity
.
getProductId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
deviceEntity
.
getPlatformId
().
toString
());
ProductEntity
productEntity
=
productService
.
get
Cache
(
deviceEntity
.
getProductId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
)
&&
!
ObjectUtils
.
isEmpty
(
productEntity
))
{
item
.
setPlatformAndProductName
(
platformEntity
.
getPlatformName
()
+
"/"
+
productEntity
.
getProductName
());
}
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
View file @
e38a012a
...
...
@@ -210,8 +210,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
deviceEntity
.
setDeviceStatus
(
DeviceStatusEnum
.
离线
.
getValue
());
deviceEntity
.
setEnabled
(
EnabledEnum
.
启用
.
getValue
());
this
.
update
(
deviceEntity
);
PlatformEntity
platformEntity
=
platformService
.
get
(
deviceEntity
.
getPlatformId
());
ProductEntity
productEntity
=
productService
.
get
(
deviceEntity
.
getProductId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
deviceEntity
.
getPlatformId
().
toString
());
ProductEntity
productEntity
=
productService
.
get
Cache
(
deviceEntity
.
getProductId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
)
&&
!
ObjectUtils
.
isEmpty
(
productEntity
))
{
//注册rabbmit相关队列与绑定
messageProducer
.
queueAddAndBinds
(
QueueKey
.
DEFAULT_EXCHANGE
,
Constant
.
UPLOAD_TOPIC
+
deviceCode
,
Constant
.
UPLOAD_TOPIC
+
deviceCode
);
...
...
@@ -292,8 +292,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
deviceEntity
.
setUpdateTime
(
new
Date
());
deviceEntity
.
setUpdateUserId
(
getContextUserId
(
context
));
this
.
getDeviceDao
().
update
(
deviceEntity
);
ProductEntity
productEntity
=
productService
.
get
(
deviceEntity
.
getProductId
());
PlatformEntity
platformEntity
=
platformService
.
get
(
deviceEntity
.
getPlatformId
());
ProductEntity
productEntity
=
productService
.
get
Cache
(
deviceEntity
.
getProductId
().
toString
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
deviceEntity
.
getPlatformId
().
toString
());
if
(
enabled
==
YesNoEnum
.
YES
.
getValue
())
{
this
.
sendThirdParty
(
deviceEntity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
ENABLED
);
}
else
{
...
...
@@ -306,8 +306,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
DeviceEntity
deviceEntity
=
this
.
get
(
id
,
context
);
if
(
ObjectUtils
.
isEmpty
(
deviceEntity
))
throw
new
AppException
(
"当前设备不存在!"
);
PlatformEntity
platformEntity
=
platformService
.
get
(
deviceEntity
.
getPlatformId
());
ProductEntity
productEntity
=
productService
.
get
(
deviceEntity
.
getProductId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
deviceEntity
.
getPlatformId
().
toString
());
ProductEntity
productEntity
=
productService
.
get
Cache
(
deviceEntity
.
getProductId
().
toString
());
String
exchangeName
=
platformEntity
.
getPlatformSn
()
+
Constant
.
EXCHANGE_SPLIT
+
productEntity
.
getProductCode
();
TopicPartitionInfo
topicPartitionInfo
=
new
TopicPartitionInfo
(
Constant
.
UPLOAD_TOPIC
+
deviceEntity
.
getDeviceCode
(),
null
,
exchangeName
);
...
...
@@ -326,8 +326,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
@Override
protected
void
saveAfter
(
DeviceEntity
entity
,
Context
context
)
throws
AppException
{
super
.
saveAfter
(
entity
,
context
);
PlatformEntity
platformEntity
=
platformService
.
get
(
entity
.
getPlatformId
());
ProductEntity
productEntity
=
productService
.
get
(
entity
.
getProductId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
entity
.
getPlatformId
().
toString
());
ProductEntity
productEntity
=
productService
.
get
Cache
(
entity
.
getProductId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
)
&&
!
ObjectUtils
.
isEmpty
(
productEntity
))
{
//注册rabbmit相关队列与绑定 激活后才註冊綁定隊列
// registerRabbitQueue(entity, platformEntity, productEntity);
...
...
@@ -339,8 +339,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
@Override
protected
void
updateAfter
(
DeviceEntity
entity
,
Context
context
)
throws
AppException
{
super
.
updateAfter
(
entity
,
context
);
PlatformEntity
platformEntity
=
platformService
.
get
(
entity
.
getPlatformId
());
ProductEntity
productEntity
=
productService
.
get
(
entity
.
getProductId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
entity
.
getPlatformId
().
toString
());
ProductEntity
productEntity
=
productService
.
get
Cache
(
entity
.
getProductId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
)
&&
!
ObjectUtils
.
isEmpty
(
productEntity
))
{
//新增设备通知第三方平台 激活后的设备才通知和更新
if
(
entity
.
getDeviceStatus
()
>
0
)
{
...
...
@@ -614,8 +614,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
Long
[]
removeIds
=
Arrays
.
asList
(
ids
).
stream
().
map
(
id
->
{
DeviceEntity
deviceEntity
=
this
.
get
(
id
,
context
);
if
(!
ObjectUtils
.
isEmpty
(
deviceEntity
))
{
PlatformEntity
platformEntity
=
platformService
.
get
(
deviceEntity
.
getPlatformId
());
ProductEntity
productEntity
=
productService
.
get
(
deviceEntity
.
getProductId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
deviceEntity
.
getPlatformId
().
toString
());
ProductEntity
productEntity
=
productService
.
get
Cache
(
deviceEntity
.
getProductId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
)
&&
!
ObjectUtils
.
isEmpty
(
productEntity
))
{
Rest
<
String
>
thirtyRest
=
sendThirdParty
(
deviceEntity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
DEL
);
if
(
YesNoEnum
.
YES
.
getValue
()
==
thirtyRest
.
getCode
())
{
...
...
@@ -651,8 +651,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
@Override
protected
void
exportAfter
(
DeviceEntity
params
,
Context
context
,
List
<
DeviceEntity
>
list
)
throws
AppException
{
list
.
stream
().
forEach
(
deviceEntity
->
{
PlatformEntity
platformEntity
=
platformService
.
get
(
deviceEntity
.
getPlatformId
());
ProductEntity
productEntity
=
productService
.
get
(
deviceEntity
.
getProductId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
deviceEntity
.
getPlatformId
().
toString
());
ProductEntity
productEntity
=
productService
.
get
Cache
(
deviceEntity
.
getProductId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
)
&&
!
ObjectUtils
.
isEmpty
(
productEntity
))
{
deviceEntity
.
setProductCode
(
productEntity
.
getProductCode
());
deviceEntity
.
setPlatformCode
(
platformEntity
.
getPlatformSn
());
...
...
@@ -695,7 +695,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
entity
.
setProductName
(
productEntity
.
getProductName
());
//根据产品查询平台
if
(!
ObjectUtils
.
isEmpty
(
productEntity
.
getPlatformId
()))
{
PlatformEntity
platformEntity
=
platformService
.
get
(
productEntity
.
getPlatformId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
productEntity
.
getPlatformId
().
toString
());
entity
.
setPlatformId
(
platformEntity
.
getId
());
entity
.
setPlatformCode
(
platformEntity
.
getPlatformSn
());
entity
.
setPlatformName
(
platformEntity
.
getPlatformName
());
...
...
@@ -710,7 +710,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
entity
.
setProductName
(
productEntity
.
getProductName
());
//根据产品查询平台
if
(!
ObjectUtils
.
isEmpty
(
productEntity
.
getPlatformId
()))
{
PlatformEntity
platformEntity
=
platformService
.
get
(
productEntity
.
getPlatformId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
productEntity
.
getPlatformId
().
toString
());
entity
.
setPlatformId
(
platformEntity
.
getId
());
entity
.
setPlatformCode
(
platformEntity
.
getPlatformSn
());
entity
.
setPlatformName
(
platformEntity
.
getPlatformName
());
...
...
@@ -732,8 +732,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getDeviceStatus
())
&&
entity
.
getDeviceStatus
()
>
DeviceStatusEnum
.
未激活
.
getValue
())
{
//激活设备,添加队列订阅
container
.
addQueueNames
(
Constant
.
UPLOAD_TOPIC
+
entity
.
getDeviceCode
());
PlatformEntity
platformEntity
=
platformService
.
get
(
entity
.
getPlatformId
());
ProductEntity
productEntity
=
productService
.
get
(
entity
.
getProductId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
entity
.
getPlatformId
().
toString
());
ProductEntity
productEntity
=
productService
.
get
Cache
(
entity
.
getProductId
().
toString
());
sendThirdParty
(
entity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
ADD
);
sendThirdParty
(
entity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
ACTIVE
);
}
...
...
device-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
View file @
e38a012a
...
...
@@ -122,7 +122,7 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
if
(
ObjectUtils
.
isEmpty
(
productEntity
))
{
throw
new
AppException
(
"当前设备未配置所属产品,请在后台配置后再激活!"
);
}
PlatformEntity
platformEntity
=
platformService
.
get
(
productEntity
.
getPlatformId
());
PlatformEntity
platformEntity
=
platformService
.
get
Cache
(
productEntity
.
getPlatformId
().
toString
());
if
(
ObjectUtils
.
isEmpty
(
platformEntity
))
{
throw
new
AppException
(
"当前设备未配置所属系统平台,请在后台配置后再激活!"
);
}
...
...
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