Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8beb3b67
authored
Dec 15, 2023
by
罗志长
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix: 设备配网时保存默认属性
parent
946462fa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
1 deletions
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
View file @
8beb3b67
...
...
@@ -382,11 +382,42 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
for
(
PlatDeviceOther
platDeviceOther
:
platDeviceOtherList
)
{
BeanUtils
.
copyProperties
(
dto
,
platDeviceOther
,
"id"
);
platDeviceOther
.
setDeviceId
(
id
);
platDeviceOther
.
setAttribute
(
getDefaultAttr
(
db
));
platDeviceOther
.
setOriDeviceId
(
db
.
getOriDeviceId
());
platDeviceOtherService
.
saveOrUpdate
(
platDeviceOther
);
}
}
private
String
getDefaultAttr
(
PlatDevice
platDevice
)
{
String
category
=
platDevice
.
getCategory
();
if
(!(
PlatDeviceEnum
.
CategoryEnum
.
FALL
.
getValue
().
equals
(
category
)
||
PlatDeviceEnum
.
CategoryEnum
.
SPACE
.
getValue
().
equals
(
category
)))
{
return
null
;
}
PlatDeviceBaseAttrDTO
platDeviceBaseAttrDTO
=
new
PlatDeviceBaseAttrDTO
();
// 跌倒
if
(
PlatDeviceEnum
.
CategoryEnum
.
FALL
.
getValue
().
equals
(
category
))
{
platDeviceBaseAttrDTO
.
setRadarMount
(
1
);
platDeviceBaseAttrDTO
.
setRadarHight
(
300
);
platDeviceBaseAttrDTO
.
setRadarSence
(
2
);
platDeviceBaseAttrDTO
.
setRadarSPL
(
1
);
}
// 空间人体
if
(
PlatDeviceEnum
.
CategoryEnum
.
SPACE
.
getValue
().
equals
(
category
))
{
platDeviceBaseAttrDTO
.
setRadarMount
(
0
);
platDeviceBaseAttrDTO
.
setRadarMode
(
1
);
PlatDeviceBaseAttrDTO
.
DeviceAttrRange
distance
=
new
PlatDeviceBaseAttrDTO
.
DeviceAttrRange
();
distance
.
setMax
(
1000
);
distance
.
setMin
(
10
);
platDeviceBaseAttrDTO
.
setRadarDistance
(
distance
);
PlatDeviceBaseAttrDTO
.
DeviceAttrRange
angle
=
new
PlatDeviceBaseAttrDTO
.
DeviceAttrRange
();
angle
.
setMax
(
60
);
angle
.
setMin
(-
60
);
platDeviceBaseAttrDTO
.
setRadarAngle
(
angle
);
platDeviceBaseAttrDTO
.
setRadarDelay
(
30
);
}
return
JSON
.
toJSONString
(
platDeviceBaseAttrDTO
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
wechatEdit
(
PlatDeviceEditWechatDTO
dto
)
{
...
...
@@ -765,7 +796,6 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
platDeviceOther
=
new
PlatDeviceOther
();
platDeviceOther
.
setDeviceId
(
platDevice
.
getId
());
platDeviceOther
.
setOriDeviceId
(
platDevice
.
getOriDeviceId
());
platDeviceOther
.
setAttribute
(
JSON
.
toJSONString
(
getDeviceBaseAttrDTO
(
platDevice
)));
platDeviceOther
.
setTenantId
(
platDevice
.
getTenantId
());
platDeviceOtherService
.
save
(
platDeviceOther
);
}
...
...
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