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
538f3d36
Commit
538f3d36
authored
Jul 12, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加前端页面
parent
01b30c54
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
6 deletions
+32
-6
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
...als/xhx/module/device/service/impl/DeviceServiceImpl.java
+32
-6
No files found.
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
View file @
538f3d36
...
...
@@ -116,6 +116,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
if
(
ObjectUtils
.
isEmpty
(
deviceEntity
))
throw
new
AppException
(
"当前设备不存在!"
);
if
(
deviceEntity
.
getDeviceStatus
()
!=
DeviceStatusEnum
.
未激活
.
getValue
())
throw
new
AppException
(
"当前设备已激活!"
);
deviceEntity
.
setDeviceStatus
(
DeviceStatusEnum
.
离线
.
getValue
());
deviceEntity
.
setEnabled
(
EnabledEnum
.
启用
.
getValue
());
this
.
update
(
deviceEntity
,
context
);
PlatformEntity
platformEntity
=
platformService
.
get
(
deviceEntity
.
getPlatformId
());
ProductEntity
productEntity
=
productService
.
get
(
deviceEntity
.
getProductId
());
...
...
@@ -308,12 +309,19 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
throw
new
AppException
(
"设备编码重复!"
);
}
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getPlatformCode
()))
{
PlatformEntity
platformEntity
=
platformService
.
selectOne
(
new
PlatformQuery
().
platformSn
(
entity
.
getPlatformCode
()));
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
))
{
entity
.
setPlatformId
(
platformEntity
.
getId
());
entity
.
setPlatformName
(
platformEntity
.
getPlatformName
());
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getProductId
()))
{
ProductEntity
productEntity
=
productService
.
get
(
entity
.
getProductId
());
if
(!
ObjectUtils
.
isEmpty
(
productEntity
))
{
entity
.
setProductId
(
productEntity
.
getId
());
entity
.
setProductCode
(
productEntity
.
getProductCode
());
entity
.
setProductName
(
productEntity
.
getProductName
());
//根据产品查询平台
if
(!
ObjectUtils
.
isEmpty
(
productEntity
.
getPlatformId
())){
PlatformEntity
platformEntity
=
platformService
.
get
(
productEntity
.
getPlatformId
());
entity
.
setPlatformId
(
platformEntity
.
getId
());
entity
.
setPlatformCode
(
platformEntity
.
getPlatformSn
());
entity
.
setPlatformName
(
platformEntity
.
getPlatformName
());
}
}
}
...
...
@@ -322,10 +330,28 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
if
(!
ObjectUtils
.
isEmpty
(
productEntity
))
{
entity
.
setProductId
(
productEntity
.
getId
());
entity
.
setProductName
(
productEntity
.
getProductName
());
//根据产品查询平台
if
(!
ObjectUtils
.
isEmpty
(
productEntity
.
getPlatformId
())){
PlatformEntity
platformEntity
=
platformService
.
get
(
productEntity
.
getPlatformId
());
entity
.
setPlatformId
(
platformEntity
.
getId
());
entity
.
setPlatformCode
(
platformEntity
.
getPlatformSn
());
entity
.
setPlatformName
(
platformEntity
.
getPlatformName
());
}
}
}
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getPlatformCode
()))
{
PlatformEntity
platformEntity
=
platformService
.
selectOne
(
new
PlatformQuery
().
platformSn
(
entity
.
getPlatformCode
()));
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
))
{
entity
.
setPlatformId
(
platformEntity
.
getId
());
entity
.
setPlatformName
(
platformEntity
.
getPlatformName
());
}
}
super
.
saveBefore
(
entity
,
context
);
}
}
\ No newline at end of file
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