Commit 68a0488b by 罗志长

fix:绑定设备无属性时区域设置没保存

parent 83481083
......@@ -463,16 +463,25 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
List<PlatDeviceOther> platDeviceOtherList = platDeviceOtherService.list(new QueryWrapper<PlatDeviceOther>().lambda()
.eq(PlatDeviceOther::getOriDeviceId, dto.getOriDeviceId()));
PlatDeviceBaseAttrDTO defaultAttr = getDefaultAttr(db);
String attribute = defaultAttr != null ? JSON.toJSONString(defaultAttr) : null;
for (PlatDeviceOther platDeviceOther : platDeviceOtherList) {
BeanUtils.copyProperties(dto, platDeviceOther,"id");
platDeviceOther.setDeviceId(id);
platDeviceOther.setAttribute(getDefaultAttr(db));
platDeviceOther.setAttribute(attribute);
platDeviceOther.setOriDeviceId(db.getOriDeviceId());
platDeviceOtherService.saveOrUpdate(platDeviceOther);
}
if (defaultAttr != null) {
List<PlatDevice> platDeviceList = list(new QueryWrapper<PlatDevice>().lambda().eq(PlatDevice::getOriDeviceId, db.getOriDeviceId()));
//更新区域设置设备安装方式
platRegionSettingService.update(new UpdateWrapper<PlatRegionSetting>().lambda()
.set(PlatRegionSetting::getInstallType, defaultAttr.getRadarMount())
.in(CollectionUtils.isNotEmpty(platDeviceList), PlatRegionSetting::getDeviceId, StreamUtil.map(platDeviceList, BaseEntity::getId)));
}
}
private String getDefaultAttr(PlatDevice platDevice) {
private PlatDeviceBaseAttrDTO getDefaultAttr(PlatDevice platDevice) {
String category = platDevice.getCategory();
if (!(PlatDeviceEnum.CategoryEnum.FALL.getValue().equals(category) || PlatDeviceEnum.CategoryEnum.SPACE.getValue().equals(category))) {
return null;
......@@ -499,7 +508,7 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
platDeviceBaseAttrDTO.setRadarAngle(angle);
platDeviceBaseAttrDTO.setRadarDelay(30);
}
return JSON.toJSONString(platDeviceBaseAttrDTO);
return platDeviceBaseAttrDTO;
}
@Override
......
......@@ -78,10 +78,9 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM
if(map.get(item)!=null){
String attribute = map.get(item);
PlatDeviceAttrWechatDTO deviceAttrWechatDTO = JsonUtil.toObj(attribute,PlatDeviceAttrWechatDTO.class);
if (deviceAttrWechatDTO == null || deviceAttrWechatDTO.getRadarMount() == null) {
continue;
if (deviceAttrWechatDTO != null) {
platRegionSetting.setInstallType(deviceAttrWechatDTO.getRadarMount().toString());
}
platRegionSetting.setInstallType(deviceAttrWechatDTO.getRadarMount().toString());
}
list.add(platRegionSetting);
}
......
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