Commit b84b4117777c060da43b1288235e28b54dbcc89a
1 parent
14c8e712
fix: 更新设备扩展信息空指针,保证sip信息在更新时不会被覆盖
(cherry picked from commit dd1ddc1b)
Showing
1 changed file
with
6 additions
and
4 deletions
... | ... | @@ -84,10 +84,12 @@ public class TkDeviceServiceImpl extends AbstractBaseService<DeviceMapper, TkDev |
84 | 84 | //更改了产品,需将原产品的缓存置为无效 |
85 | 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 | 94 | TkDeviceEntity device = new TkDeviceEntity(); |
93 | 95 | deviceDTO.copyToEntity( | ... | ... |