Commit dd1ddc1b388c43e4ee36f5f455980b57c2d889db

Authored by xp.Huang
1 parent 14c8e712

fix: 更新设备扩展信息空指针,保证sip信息在更新时不会被覆盖

@@ -84,10 +84,12 @@ public class TkDeviceServiceImpl extends AbstractBaseService<DeviceMapper, TkDev @@ -84,10 +84,12 @@ public class TkDeviceServiceImpl extends AbstractBaseService<DeviceMapper, TkDev
84 //更改了产品,需将原产品的缓存置为无效 84 //更改了产品,需将原产品的缓存置为无效
85 cacheUtils.invalidate(cacheName,deviceDTO.getTenantId()+","+entity.getProfileId()); 85 cacheUtils.invalidate(cacheName,deviceDTO.getTenantId()+","+entity.getProfileId());
86 } 86 }
87 - Optional.ofNullable(db.getDeviceInfo().get(FastIotConstants.DeviceAdditional.SIP)).ifPresent(sip ->{  
88 - ObjectNode additional = (ObjectNode) deviceDTO.getDeviceInfo();  
89 - additional.set(FastIotConstants.DeviceAdditional.SIP,sip);  
90 - }); 87 + if(null !=db.getDeviceInfo()){
  88 + Optional.ofNullable(db.getDeviceInfo().get(FastIotConstants.DeviceAdditional.SIP)).ifPresent(sip ->{
  89 + ObjectNode additional = (ObjectNode) deviceDTO.getDeviceInfo();
  90 + additional.set(FastIotConstants.DeviceAdditional.SIP,sip);
  91 + });
  92 + }
91 }); 93 });
92 TkDeviceEntity device = new TkDeviceEntity(); 94 TkDeviceEntity device = new TkDeviceEntity();
93 deviceDTO.copyToEntity( 95 deviceDTO.copyToEntity(