Commit 908f95875df88a0e5f4e41e55c0549d760d15d62
1 parent
9fbced11
fix:【iot】saveDeviceProperty 中,类型要转换
Showing
1 changed file
with
7 additions
and
0 deletions
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/property/IotDevicePropertyServiceImpl.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.service.device.property; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.convert.Convert; | |
| 4 | 5 | import cn.hutool.core.date.LocalDateTimeUtil; |
| 5 | 6 | import cn.hutool.core.map.MapUtil; |
| 6 | 7 | import cn.hutool.core.util.StrUtil; |
| ... | ... | @@ -145,6 +146,12 @@ public class IotDevicePropertyServiceImpl implements IotDevicePropertyService { |
| 145 | 146 | IotDataSpecsDataTypeEnum.STRUCT.getDataType(), IotDataSpecsDataTypeEnum.ARRAY.getDataType())) { |
| 146 | 147 | // 特殊:STRUCT 和 ARRAY 类型,在 TDengine 里,有没对应数据类型,只能通过 JSON 来存储 |
| 147 | 148 | properties.put((String) key, JsonUtils.toJsonString(value)); |
| 149 | + } else if (IotDataSpecsDataTypeEnum.DOUBLE.getDataType().equals(thingModel.getProperty().getDataType())) { | |
| 150 | + properties.put((String) key, Convert.toDouble(value)); | |
| 151 | + } else if (IotDataSpecsDataTypeEnum.FLOAT.getDataType().equals(thingModel.getProperty().getDataType())) { | |
| 152 | + properties.put((String) key, Convert.toFloat(value)); | |
| 153 | + } else if (IotDataSpecsDataTypeEnum.BOOL.getDataType().equals(thingModel.getProperty().getDataType())) { | |
| 154 | + properties.put((String) key, Convert.toByte(value)); | |
| 148 | 155 | } else { |
| 149 | 156 | properties.put((String) key, value); |
| 150 | 157 | } | ... | ... |