Commit ae53cc08 by huangjy

fix:修复bug

parent 64f25ad1
...@@ -421,9 +421,12 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -421,9 +421,12 @@ 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();
UserServerInfo usrServerInfo = dto.getUsrServerInfo();
Map<String, Object> map = getAttrMap(dto); Map<String, Object> map = getAttrMap(dto);
if (usrServerInfo != null) { UserServerInfo usrServerInfo = dto.getUsrServerInfo();
boolean usrServerInfoFlag = usrServerInfo != null && (StringUtils.isNotEmpty(usrServerInfo.getUsername()) || StringUtils.isNotEmpty(usrServerInfo.getPassword())
|| StringUtils.isNotEmpty(usrServerInfo.getAddr()) || usrServerInfo.getPort() != null ||
StringUtils.isNotEmpty(usrServerInfo.getSecureId()) || StringUtils.isNotEmpty(usrServerInfo.getSecureKey()));
if (usrServerInfoFlag) {
map.put("usrServerInfo",JSON.toJSONString(usrServerInfo)); map.put("usrServerInfo",JSON.toJSONString(usrServerInfo));
} }
String result = devicePropertiesOperateService.deviceWriteAttr(deviceId, map); String result = devicePropertiesOperateService.deviceWriteAttr(deviceId, map);
...@@ -433,13 +436,15 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -433,13 +436,15 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
PlatDeviceOther other = platDeviceOtherService.getOne(new QueryWrapper<PlatDeviceOther>().lambda() PlatDeviceOther other = platDeviceOtherService.getOne(new QueryWrapper<PlatDeviceOther>().lambda()
.eq(PlatDeviceOther::getOriDeviceId, deviceId) .eq(PlatDeviceOther::getOriDeviceId, deviceId)
.last("limit 1")); .last("limit 1"));
if (other != null && usrServerInfo != null) { if (other != null && usrServerInfoFlag) {
other.setProtocolAccount(usrServerInfo.getUsername()); other.setProtocolAccount(usrServerInfo.getUsername());
other.setProtocolPassword(usrServerInfo.getPassword()); other.setProtocolPassword(usrServerInfo.getPassword());
other.setProtocolAddress(usrServerInfo.getAddr()); other.setProtocolAddress(usrServerInfo.getAddr());
other.setProtocolPort(usrServerInfo.getPort() == null ? "" : usrServerInfo.getPort().toString()); other.setProtocolPort(usrServerInfo.getPort() == null ? "" : usrServerInfo.getPort().toString());
other.setSecureId(usrServerInfo.getSecureId()); other.setSecureId(usrServerInfo.getSecureId());
other.setSecureKey(usrServerInfo.getSecureKey()); other.setSecureKey(usrServerInfo.getSecureKey());
}
if (other != null && !map.isEmpty() && !usrServerInfoFlag) {
other.setAttribute(JSON.toJSONString(map)); other.setAttribute(JSON.toJSONString(map));
platDeviceOtherService.updateById(other); platDeviceOtherService.updateById(other);
} }
......
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