fix: modbus点位模版同步到产品

同步属性错误修改
V0.5.x
ZOUZDC 2024-05-17 00:10:27 +08:00
parent 3ccfb11478
commit 3fc76949d9
1 changed files with 3 additions and 2 deletions

View File

@ -23,6 +23,7 @@ import cc.iotkit.model.modbus.ModbusInfo;
import cc.iotkit.model.modbus.ModbusThingModel; import cc.iotkit.model.modbus.ModbusThingModel;
import cc.iotkit.model.product.Product; import cc.iotkit.model.product.Product;
import cc.iotkit.model.product.ThingModel; import cc.iotkit.model.product.ThingModel;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
@ -208,8 +209,8 @@ public class ModbusInfoServiceImpl implements IModbusInfoService {
if(CollectionUtil.isNotEmpty(modbusThingModel.getModel().getProperties())){ if(CollectionUtil.isNotEmpty(modbusThingModel.getModel().getProperties())){
properties = modbusThingModel.getModel().getProperties().stream().map(p -> { properties = modbusThingModel.getModel().getProperties().stream().map(p -> {
ThingModel.Property property = MapstructUtils.convert(p, ThingModel.Property.class); ThingModel.Property property = BeanUtil.copyProperties(p, ThingModel.Property.class);
property.setProData(JSONUtil.toJsonStr(MapstructUtils.convert(p, ModbusThingModel.Property.class))); property.setProData(JSONUtil.toJsonStr(BeanUtil.copyProperties(p, ModbusThingModel.ProData.class)));
return property; return property;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }