Commit e7c6bb9c by huangjy

fix:设备写入

parent 131db3a8
...@@ -404,9 +404,10 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -404,9 +404,10 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
public void editDeviceProperties(PlatDeviceAttrWechatDTO dto) { public void editDeviceProperties(PlatDeviceAttrWechatDTO dto) {
log.info("写入设备属性请求参数:{}",JSON.toJSONString(dto)); log.info("写入设备属性请求参数:{}",JSON.toJSONString(dto));
String deviceId = dto.getDeviceId(); String deviceId = dto.getDeviceId();
PlatDeviceOther other = platDeviceOtherService.getOne(new QueryWrapper<PlatDeviceOther>().lambda()
.eq(PlatDeviceOther::getOriDeviceId, deviceId));
UserServerInfo usrServerInfo = dto.getUsrServerInfo(); UserServerInfo usrServerInfo = dto.getUsrServerInfo();
PlatDeviceOther other = platDeviceOtherService.getOne(new QueryWrapper<PlatDeviceOther>().lambda()
.eq(PlatDeviceOther::getOriDeviceId, deviceId)
.last("limit 1"));
if (other != null && usrServerInfo != null) { if (other != null && usrServerInfo != null) {
other.setProtocolAccount(usrServerInfo.getUsername()); other.setProtocolAccount(usrServerInfo.getUsername());
other.setProtocolPassword(usrServerInfo.getPassword()); other.setProtocolPassword(usrServerInfo.getPassword());
...@@ -418,10 +419,13 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -418,10 +419,13 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
} }
Map<String, Object> map = getAttrMap(dto); Map<String, Object> map = getAttrMap(dto);
if (dto.getUsrServerInfo() != null) { if (usrServerInfo != null) {
map.put("usrServerInfo",JSON.toJSONString(dto.getUsrServerInfo())); map.put("usrServerInfo",JSON.toJSONString(usrServerInfo));
}
String result = devicePropertiesOperateService.deviceWriteAttr(deviceId, map);
if (StringUtils.isNotEmpty(result)) {
throw new RuntimeException("设备写入失败:" + result);
} }
devicePropertiesOperateService.deviceWriteAttr(deviceId, map);
if (dto.getRadarMount() != null) { if (dto.getRadarMount() != null) {
//更新区域设置设备安装方式 //更新区域设置设备安装方式
......
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