Commit 2c1aa1f7 by huangjy

fix:修复bug

parent 359893b0
...@@ -407,13 +407,15 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -407,13 +407,15 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void modifyWifiInfo(PlatDeviceSetupDTO dto) { public void modifyWifiInfo(PlatDeviceSetupDTO dto) {
PlatDeviceOther other = platDeviceOtherService.getOne(new QueryWrapper<PlatDeviceOther>().lambda() List<PlatDeviceOther> platDeviceOtherList = platDeviceOtherService.list(new QueryWrapper<PlatDeviceOther>().lambda()
.eq(PlatDeviceOther::getDeviceId, dto.getId())); .eq(PlatDeviceOther::getDeviceId, dto.getId()));
for (PlatDeviceOther other : platDeviceOtherList) {
other.setWifiName(dto.getWifiName()); other.setWifiName(dto.getWifiName());
other.setWifiPassword(dto.getWifiPassword()); other.setWifiPassword(dto.getWifiPassword());
platDeviceOtherService.updateById(other); platDeviceOtherService.updateById(other);
} }
}
/** /**
* 设备信息 * 设备信息
...@@ -524,13 +526,14 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -524,13 +526,14 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
if (StringUtils.isNotEmpty(result)) { if (StringUtils.isNotEmpty(result)) {
resultList.add(result); resultList.add(result);
} }
PlatDeviceOther other = platDeviceOtherService.getOne(new QueryWrapper<PlatDeviceOther>().lambda() List<PlatDeviceOther> otherList = platDeviceOtherService.list(new QueryWrapper<PlatDeviceOther>().lambda()
.eq(PlatDeviceOther::getOriDeviceId, deviceId) .eq(PlatDeviceOther::getOriDeviceId, deviceId)
.last("limit 1")); .last("limit 1"));
if (other != null) { for (PlatDeviceOther platDeviceOther : otherList) {
other.setAttribute(JSON.toJSONString(map)); platDeviceOther.setAttribute(JSON.toJSONString(map));
platDeviceOtherService.updateById(other); platDeviceOtherService.updateById(platDeviceOther);
} }
} }
if (CollectionUtils.isNotEmpty(resultList)) { if (CollectionUtils.isNotEmpty(resultList)) {
throw new RuntimeException("修改设备属性失败:" + resultList.get(0)); throw new RuntimeException("修改设备属性失败:" + resultList.get(0));
......
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