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
34e75af8
Commit
34e75af8
authored
Jan 06, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改接口修改设备
parent
82403c41
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
8 deletions
+33
-8
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
...n/java/com/mortals/xhx/busiz/web/DeviceApiController.java
+22
-8
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
...als/xhx/module/device/service/impl/DeviceServiceImpl.java
+11
-0
No files found.
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
View file @
34e75af8
...
@@ -354,25 +354,26 @@ public class DeviceApiController {
...
@@ -354,25 +354,26 @@ public class DeviceApiController {
}
}
DeviceEntity
deviceEntity
=
deviceService
.
getExtCache
(
req
.
getDeviceCode
());
DeviceEntity
deviceEntity
=
deviceService
.
getExtCache
(
req
.
getDeviceCode
());
if
(
ObjectUtils
.
isEmpty
(
deviceEntity
))
{
if
(
ObjectUtils
.
isEmpty
(
deviceEntity
))
{
//初始化新增基础设备,后续在线完善信息后再行注册添加
//初始化新增基础设备,后续在线完善信息后再行注册添加
deviceEntity
=
new
DeviceEntity
();
deviceEntity
=
new
DeviceEntity
();
deviceEntity
.
initAttrValue
();
deviceEntity
.
initAttrValue
();
save
OrUpdat
e
(
req
,
platformEntity
,
productEntity
,
deviceEntity
);
save
Devic
e
(
req
,
platformEntity
,
productEntity
,
deviceEntity
);
deviceEntity
.
setCreateTime
(
new
Date
());
deviceEntity
.
setCreateTime
(
new
Date
());
deviceEntity
.
setCreateUserId
(
1L
);
deviceEntity
.
setCreateUserId
(
1L
);
deviceService
.
save
(
deviceEntity
,
null
);
deviceService
.
save
(
deviceEntity
,
null
);
}
else
{
}
else
{
//更新
//更新
saveOrUpdat
e
(
req
,
platformEntity
,
productEntity
,
deviceEntity
);
updateDevic
e
(
req
,
platformEntity
,
productEntity
,
deviceEntity
);
deviceEntity
.
setUpdateTime
(
new
Date
());
deviceEntity
.
setUpdateTime
(
new
Date
());
deviceEntity
.
setUpdateUserId
(
1L
);
deviceEntity
.
setUpdateUserId
(
1L
);
deviceService
.
update
(
deviceEntity
,
null
);
deviceService
.
update
(
deviceEntity
,
null
);
}
}
if
(
deviceEntity
.
getDeviceStatus
()
==
DeviceStatusEnum
.
未激活
.
getValue
())
{
/*
if (deviceEntity.getDeviceStatus() == DeviceStatusEnum.未激活.getValue()) {
throw new AppException(DEVICE_UNACTIVE, DEVICE_UNACTIVE_CONTENT);
throw new AppException(DEVICE_UNACTIVE, DEVICE_UNACTIVE_CONTENT);
}
}
*/
DeviceQueueAuthInfo
authInfo
=
new
DeviceQueueAuthInfo
();
DeviceQueueAuthInfo
authInfo
=
new
DeviceQueueAuthInfo
();
authInfo
.
setHost
(
host
);
authInfo
.
setHost
(
host
);
...
@@ -471,7 +472,7 @@ public class DeviceApiController {
...
@@ -471,7 +472,7 @@ public class DeviceApiController {
return
JSON
.
toJSONString
(
rsp
);
return
JSON
.
toJSONString
(
rsp
);
}
}
private
void
save
OrUpdat
e
(
DeviceReq
req
,
PlatformEntity
platformEntity
,
ProductEntity
productEntity
,
DeviceEntity
deviceEntity
)
{
private
void
save
Devic
e
(
DeviceReq
req
,
PlatformEntity
platformEntity
,
ProductEntity
productEntity
,
DeviceEntity
deviceEntity
)
{
BeanUtils
.
copyProperties
(
req
,
deviceEntity
,
BeanUtil
.
getNullPropertyNames
(
req
));
BeanUtils
.
copyProperties
(
req
,
deviceEntity
,
BeanUtil
.
getNullPropertyNames
(
req
));
deviceEntity
.
setPlatformId
(
platformEntity
.
getId
());
deviceEntity
.
setPlatformId
(
platformEntity
.
getId
());
...
@@ -489,9 +490,22 @@ public class DeviceApiController {
...
@@ -489,9 +490,22 @@ public class DeviceApiController {
deviceEntity
.
setDeviceCode
(
req
.
getDeviceCode
());
deviceEntity
.
setDeviceCode
(
req
.
getDeviceCode
());
deviceEntity
.
setEnabled
(
YesNoEnum
.
YES
.
getValue
());
deviceEntity
.
setEnabled
(
YesNoEnum
.
YES
.
getValue
());
if
(!
ObjectUtils
.
isEmpty
(
req
.
getActive
()))
{
deviceEntity
.
setDeviceStatus
(
DeviceStatusEnum
.
未激活
.
getValue
());
deviceEntity
.
setDeviceStatus
(
req
.
getActive
()
==
YesNoEnum
.
YES
.
getValue
()
?
DeviceStatusEnum
.
离线
.
getValue
()
:
DeviceStatusEnum
.
未激活
.
getValue
());
deviceEntity
.
setSource
(
req
.
getSource
());
}
}
private
void
updateDevice
(
DeviceReq
req
,
PlatformEntity
platformEntity
,
ProductEntity
productEntity
,
DeviceEntity
deviceEntity
)
{
deviceEntity
.
setPlatformId
(
platformEntity
.
getId
());
deviceEntity
.
setPlatformName
(
platformEntity
.
getPlatformName
());
deviceEntity
.
setProductId
(
productEntity
.
getId
());
deviceEntity
.
setProductName
(
productEntity
.
getProductName
());
deviceEntity
.
setProductCode
(
productEntity
.
getProductCode
());
deviceEntity
.
setSiteId
(
req
.
getSiteId
());
deviceEntity
.
setSiteCode
(
req
.
getSiteCode
());
deviceEntity
.
setSiteName
(
req
.
getSiteName
());
deviceEntity
.
setSource
(
req
.
getSource
());
deviceEntity
.
setSource
(
req
.
getSource
());
}
}
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
View file @
34e75af8
...
@@ -100,6 +100,17 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -100,6 +100,17 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
@Autowired
@Autowired
private
SiteService
siteService
;
private
SiteService
siteService
;
public
void
refresh
()
{
log
.
info
(
"开始初始化系统参数..."
);
try
{
super
.
removeAllCache
();
super
.
loadCache
();
log
.
info
(
"系统参数初始化完成!"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"查询系统参数异常"
,
e
);
}
}
@Override
@Override
protected
String
getExtKey
(
DeviceEntity
data
)
{
protected
String
getExtKey
(
DeviceEntity
data
)
{
return
data
.
getDeviceCode
();
return
data
.
getDeviceCode
();
...
...
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