Commit 6d06b4bf by 罗志长

fix: 批量编辑设备属性

parent 78ff14d3
...@@ -738,7 +738,6 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -738,7 +738,6 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
if (CollectionUtils.isEmpty(deviceIdList)) { if (CollectionUtils.isEmpty(deviceIdList)) {
return; return;
} }
String reqJson = JSON.toJSONString(dto);
for (String deviceId : deviceIdList) { for (String deviceId : deviceIdList) {
PlatDeviceBaseAttrDTO platDeviceBaseAttrDTO = getPlatDeviceBaseAttrDTO(deviceId); PlatDeviceBaseAttrDTO platDeviceBaseAttrDTO = getPlatDeviceBaseAttrDTO(deviceId);
Map<String, Object> map = getReqMap(dto,platDeviceBaseAttrDTO); Map<String, Object> map = getReqMap(dto,platDeviceBaseAttrDTO);
...@@ -746,12 +745,13 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -746,12 +745,13 @@ 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> otherList = platDeviceOtherService.list(new QueryWrapper<PlatDeviceOther>().lambda() // 写入设备后等iot MQTT消息回复单独更新,不直接修改数据库属性
.eq(PlatDeviceOther::getOriDeviceId, deviceId)); // List<PlatDeviceOther> otherList = platDeviceOtherService.list(new QueryWrapper<PlatDeviceOther>().lambda()
for (PlatDeviceOther platDeviceOther : otherList) { // .eq(PlatDeviceOther::getOriDeviceId, deviceId));
platDeviceOther.setAttribute(reqJson); // for (PlatDeviceOther platDeviceOther : otherList) {
platDeviceOtherService.updateById(platDeviceOther); // platDeviceOther.setAttribute(reqJson);
} // platDeviceOtherService.updateById(platDeviceOther);
// }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment