|
|
|
@ -1,6 +1,7 @@
|
|
|
|
package cn.iocoder.yudao.module.iot.service.device;
|
|
|
|
package cn.iocoder.yudao.module.iot.service.device;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import cn.iocoder.yudao.framework.common.enums.DeviceConnectionStatusEnum;
|
|
|
|
import cn.iocoder.yudao.framework.common.enums.DeviceConnectionStatusEnum;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
@ -144,6 +145,9 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
|
throw exception(DEVICE_CODE_ALREADY_EXISTS);
|
|
|
|
throw exception(DEVICE_CODE_ALREADY_EXISTS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(createReqVO.getDeviceCode())) {
|
|
|
|
|
|
|
|
tdengineService.validateTableName(createReqVO.getDeviceCode());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DeviceModelDO deviceModelDO = deviceModelMapper.selectById(createReqVO.getDeviceModelId());
|
|
|
|
DeviceModelDO deviceModelDO = deviceModelMapper.selectById(createReqVO.getDeviceModelId());
|
|
|
|
|
|
|
|
|
|
|
|
@ -154,11 +158,13 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
|
device.setTenantId("1");
|
|
|
|
device.setTenantId("1");
|
|
|
|
device.setProtocol(StringUtils.isBlank(device.getProtocol()) || device.getProtocol() == null ? "MQTT":device.getProtocol());
|
|
|
|
device.setProtocol(StringUtils.isBlank(device.getProtocol()) || device.getProtocol() == null ? "MQTT":device.getProtocol());
|
|
|
|
|
|
|
|
|
|
|
|
deviceMapper.insert(device);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
insertTemplatePoint(createReqVO, device);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deviceMapper.insert(device);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//新增点位规则模板
|
|
|
|
|
|
|
|
insertTemplatePoint(createReqVO, device);
|
|
|
|
return device;
|
|
|
|
return device;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -197,6 +203,13 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
|
List<DevicePointRulesDO> devicePointRulesDOList = new ArrayList<>();
|
|
|
|
List<DevicePointRulesDO> devicePointRulesDOList = new ArrayList<>();
|
|
|
|
DeviceModelDO deviceModelDO = deviceModelMapper.selectById(deviceModelId);
|
|
|
|
DeviceModelDO deviceModelDO = deviceModelMapper.selectById(deviceModelId);
|
|
|
|
if(deviceModelDO == null){
|
|
|
|
if(deviceModelDO == null){
|
|
|
|
|
|
|
|
DevicePointRulesDO devicePointRulesDO = new DevicePointRulesDO();
|
|
|
|
|
|
|
|
devicePointRulesDO.setIdentifier("RUNNING");
|
|
|
|
|
|
|
|
devicePointRulesDO.setFieldName("运行");
|
|
|
|
|
|
|
|
devicePointRulesDO.setDefaultValue("运行");
|
|
|
|
|
|
|
|
devicePointRulesDO.setDeviceId(deviceId);
|
|
|
|
|
|
|
|
devicePointRulesDOList.add(devicePointRulesDO);
|
|
|
|
|
|
|
|
devicePointRulesMapper.insert(devicePointRulesDO);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<DeviceModelRulesDO> deviceModelRulesDOList = deviceModelRulesMapper.selectList(Wrappers.<DeviceModelRulesDO>lambdaQuery()
|
|
|
|
List<DeviceModelRulesDO> deviceModelRulesDOList = deviceModelRulesMapper.selectList(Wrappers.<DeviceModelRulesDO>lambdaQuery()
|
|
|
|
|