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
834d9e45
authored
Dec 20, 2023
by
罗志长
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix: 编辑设备属性
parent
8e41dd08
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
30 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 @
834d9e45
...
@@ -620,19 +620,20 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
...
@@ -620,19 +620,20 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
if
(
StringUtils
.
isNotEmpty
(
result
))
{
if
(
StringUtils
.
isNotEmpty
(
result
))
{
throw
new
RuntimeException
(
"设备写入失败:"
+
result
);
throw
new
RuntimeException
(
"设备写入失败:"
+
result
);
}
}
List
<
PlatDeviceOther
>
platDeviceOtherList
=
platDeviceOtherService
.
list
(
new
QueryWrapper
<
PlatDeviceOther
>().
lambda
()
// 写入设备后等iot MQTT消息回复单独更新,不直接修改数据库属性
.
eq
(
PlatDeviceOther:
:
getOriDeviceId
,
deviceId
));
// List<PlatDeviceOther> platDeviceOtherList = platDeviceOtherService.list(new QueryWrapper<PlatDeviceOther>().lambda()
for
(
PlatDeviceOther
platDeviceOther
:
platDeviceOtherList
)
{
// .eq(PlatDeviceOther::getOriDeviceId, deviceId));
platDeviceOther
.
setAttribute
(
reqJson
);
// for (PlatDeviceOther platDeviceOther : platDeviceOtherList) {
platDeviceOtherService
.
updateById
(
platDeviceOther
);
// platDeviceOther.setAttribute(reqJson);
}
// platDeviceOtherService.updateById(platDeviceOther);
if
(
dto
.
getRadarMount
()
!=
null
)
{
// }
List
<
PlatDevice
>
platDeviceList
=
list
(
new
QueryWrapper
<
PlatDevice
>().
lambda
().
eq
(
PlatDevice:
:
getOriDeviceId
,
deviceId
));
// if (dto.getRadarMount() != null) {
//更新区域设置设备安装方式
// List<PlatDevice> platDeviceList = list(new QueryWrapper<PlatDevice>().lambda().eq(PlatDevice::getOriDeviceId, deviceId));
platRegionSettingService
.
update
(
new
UpdateWrapper
<
PlatRegionSetting
>().
lambda
()
// //更新区域设置设备安装方式
.
set
(
PlatRegionSetting:
:
getInstallType
,
dto
.
getRadarMount
())
// platRegionSettingService.update(new UpdateWrapper<PlatRegionSetting>().lambda()
.
in
(
CollectionUtils
.
isNotEmpty
(
platDeviceList
),
PlatRegionSetting:
:
getDeviceId
,
StreamUtil
.
map
(
platDeviceList
,
BaseEntity:
:
getId
)));
// .set(PlatRegionSetting::getInstallType, dto.getRadarMount())
}
// .in(CollectionUtils.isNotEmpty(platDeviceList),PlatRegionSetting::getDeviceId, StreamUtil.map(platDeviceList,BaseEntity::getId)));
// }
}
}
private
PlatDeviceBaseAttrDTO
getPlatDeviceBaseAttrDTO
(
String
deviceId
)
{
private
PlatDeviceBaseAttrDTO
getPlatDeviceBaseAttrDTO
(
String
deviceId
)
{
...
@@ -645,35 +646,31 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
...
@@ -645,35 +646,31 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
private
static
Map
<
String
,
Object
>
getReqMap
(
PlatDeviceBaseAttrDTO
dto
,
PlatDeviceBaseAttrDTO
platDeviceBaseAttrDTO
)
{
private
static
Map
<
String
,
Object
>
getReqMap
(
PlatDeviceBaseAttrDTO
dto
,
PlatDeviceBaseAttrDTO
platDeviceBaseAttrDTO
)
{
Map
<
String
,
Object
>
map
=
Maps
.
newHashMap
();
Map
<
String
,
Object
>
map
=
Maps
.
newHashMap
();
if
(!
Objects
.
equals
(
platDeviceBaseAttrDTO
.
getRadarMode
(),
dto
.
getRadarMode
()))
{
if
(
dto
.
getRadarMode
()
!=
null
&&
!
Objects
.
equals
(
platDeviceBaseAttrDTO
.
getRadarMode
(),
dto
.
getRadarMode
()))
{
map
.
put
(
"radarMode"
,
dto
.
getRadarMode
());
map
.
put
(
"radarMode"
,
dto
.
getRadarMode
());
}
}
if
(!
Objects
.
equals
(
platDeviceBaseAttrDTO
.
getRadarMount
(),
dto
.
getRadarMount
()))
{
if
(
dto
.
getRadarMount
()
!=
null
&&
!
Objects
.
equals
(
platDeviceBaseAttrDTO
.
getRadarMount
(),
dto
.
getRadarMount
()))
{
map
.
put
(
"radarMount"
,
dto
.
getRadarMount
());
map
.
put
(
"radarMount"
,
dto
.
getRadarMount
());
}
}
if
(!
Objects
.
equals
(
platDeviceBaseAttrDTO
.
getRadarHight
(),
dto
.
getRadarHight
()))
{
if
(
dto
.
getRadarHight
()
!=
null
&&
!
Objects
.
equals
(
platDeviceBaseAttrDTO
.
getRadarHight
(),
dto
.
getRadarHight
()))
{
map
.
put
(
"radarHight"
,
dto
.
getRadarHight
());
map
.
put
(
"radarHight"
,
dto
.
getRadarHight
());
}
}
if
(!
Objects
.
equals
(
platDeviceBaseAttrDTO
.
getRadarDelay
(),
dto
.
getRadarDelay
()))
{
if
(
dto
.
getRadarDelay
()
!=
null
&&
!
Objects
.
equals
(
platDeviceBaseAttrDTO
.
getRadarDelay
(),
dto
.
getRadarDelay
()))
{
map
.
put
(
"radarDelay"
,
dto
.
getRadarDelay
()
);
map
.
put
(
"radarDelay"
,
dto
.
getRadarDelay
());
}
}
PlatDeviceBaseAttrDTO
.
DeviceAttrRange
radarDistance
=
platDeviceBaseAttrDTO
.
getRadarDistance
();
PlatDeviceBaseAttrDTO
.
DeviceAttrRange
radarDistance
=
platDeviceBaseAttrDTO
.
getRadarDistance
();
if
(!
Objects
.
equals
(
radarDistance
,
dto
.
getRadarDistance
()))
{
if
(
dto
.
getRadarDistance
()
!=
null
&&
!
Objects
.
equals
(
radarDistance
,
dto
.
getRadarDistance
()))
{
if
(
dto
.
getRadarDistance
()
!=
null
)
{
map
.
put
(
"radarDistance"
,
JSON
.
toJSONString
(
dto
.
getRadarDistance
()));
map
.
put
(
"radarDistance"
,
JSON
.
toJSONString
(
dto
.
getRadarDistance
()));
}
}
}
PlatDeviceBaseAttrDTO
.
DeviceAttrRange
radarAngle
=
platDeviceBaseAttrDTO
.
getRadarAngle
();
PlatDeviceBaseAttrDTO
.
DeviceAttrRange
radarAngle
=
platDeviceBaseAttrDTO
.
getRadarAngle
();
if
(!
Objects
.
equals
(
radarAngle
,
dto
.
getRadarAngle
()))
{
if
(
dto
.
getRadarAngle
()
!=
null
&&
!
Objects
.
equals
(
radarAngle
,
dto
.
getRadarAngle
()))
{
if
(
dto
.
getRadarAngle
()
!=
null
)
{
map
.
put
(
"radarAngle"
,
JSON
.
toJSONString
(
dto
.
getRadarAngle
()));
map
.
put
(
"radarAngle"
,
JSON
.
toJSONString
(
dto
.
getRadarAngle
()));
}
}
}
if
(!
Objects
.
equals
(
platDeviceBaseAttrDTO
.
getRadarSence
(),
dto
.
getRadarSence
()))
{
if
(
dto
.
getRadarSence
()
!=
null
&&
!
Objects
.
equals
(
platDeviceBaseAttrDTO
.
getRadarSence
(),
dto
.
getRadarSence
()))
{
map
.
put
(
"radarSence"
,
dto
.
getRadarSence
()
);
map
.
put
(
"radarSence"
,
dto
.
getRadarSence
());
}
}
if
(!
Objects
.
equals
(
platDeviceBaseAttrDTO
.
getRadarSPL
(),
dto
.
getRadarSPL
()))
{
if
(
dto
.
getRadarSPL
()
!=
null
&&
!
Objects
.
equals
(
platDeviceBaseAttrDTO
.
getRadarSPL
(),
dto
.
getRadarSPL
()))
{
map
.
put
(
"radarSPL"
,
dto
.
getRadarSPL
()
);
map
.
put
(
"radarSPL"
,
dto
.
getRadarSPL
());
}
}
return
map
;
return
map
;
}
}
...
...
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