|
|
@@ -6,12 +6,14 @@ import com.alibaba.fastjson2.JSONArray;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.xunmei.common.core.constant.DictConstants;
|
|
|
import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
import com.xunmei.common.core.domain.iot.domain.IotSensor;
|
|
|
import com.xunmei.common.core.domain.iot.domain.IotSensorLog;
|
|
|
import com.xunmei.common.core.enums.CategoryDataEnum;
|
|
|
import com.xunmei.common.core.utils.DateUtils;
|
|
|
import com.xunmei.common.core.utils.IDHelper;
|
|
|
+import com.xunmei.common.security.utils.DictUtils;
|
|
|
import com.xunmei.mediator.api.mapper.IotSensorMapper;
|
|
|
import com.xunmei.mediator.api.service.*;
|
|
|
import com.xunmei.mediator.util.CheckDataUtil;
|
|
|
@@ -223,7 +225,7 @@ public class IotSensorServiceImpl extends ServiceImpl<IotSensorMapper, IotSensor
|
|
|
, sensorDto, "数据来源中,同机构中设备编号重复。"));
|
|
|
continue;
|
|
|
}
|
|
|
- Long deviceType = convertDeviceType(sensorDto.getDeviceType());
|
|
|
+ String deviceType = convertDeviceType(sensorDto.getDeviceType());
|
|
|
if (ObjectUtil.isNull(deviceType)) {
|
|
|
errors.add(new NorthError(msgId, path
|
|
|
, sensorDto, "无法识别的设备类型"));
|
|
|
@@ -244,7 +246,6 @@ public class IotSensorServiceImpl extends ServiceImpl<IotSensorMapper, IotSensor
|
|
|
}
|
|
|
domain.setUpdateTime(LocalDateTime.now());
|
|
|
domain.setDeviceName(sensorDto.getDeviceName().replace("机房/基站环境", "物联环境"));
|
|
|
- domain.setCategoryId(deviceType);
|
|
|
domain.setHostCode(sensorDto.getHostCode());
|
|
|
domain.setDeviceCode(sensorDto.getDeviceCode());
|
|
|
domain.setOrgId(org.getId());
|
|
|
@@ -269,33 +270,10 @@ public class IotSensorServiceImpl extends ServiceImpl<IotSensorMapper, IotSensor
|
|
|
.collect(Collectors.groupingBy(c -> String.valueOf(c.getOrgId())));
|
|
|
}
|
|
|
|
|
|
- private Long convertDeviceType(String deviceCode) {
|
|
|
- Long type = null;
|
|
|
- switch (deviceCode) {
|
|
|
- case "4183"://温湿度
|
|
|
- type = CategoryDataEnum.HUMITURE_SENSOR.getId(); //todo
|
|
|
- break;
|
|
|
- case "4181"://红外
|
|
|
- type = CategoryDataEnum.INFRARED_SENSOR.getId();
|
|
|
- break;
|
|
|
- case "4182": //烟感
|
|
|
- type = CategoryDataEnum.SMOKE_SENSOR.getId();
|
|
|
- break;
|
|
|
- case "4184": //水浸
|
|
|
- type = CategoryDataEnum.WATER_SENSOR.getId();
|
|
|
- break;
|
|
|
- case "4160"://智能电表
|
|
|
- type = CategoryDataEnum.AMMETER_SENSOR.getId();
|
|
|
- break;
|
|
|
- case "4188"://门窗磁
|
|
|
- type = CategoryDataEnum.DOOR_WINDOW_SENSOR.getId();
|
|
|
- break;
|
|
|
- case "41885"://燃气报警器
|
|
|
- type = CategoryDataEnum.GAS_ALARM.getId();
|
|
|
- default:
|
|
|
- break;
|
|
|
+ private String convertDeviceType(String deviceType) {
|
|
|
+ if (ObjectUtil.isNotNull(deviceType)){
|
|
|
+ return null;
|
|
|
}
|
|
|
-
|
|
|
- return type;
|
|
|
+ return DictUtils.getDictLabel(DictConstants.SENSOR_DEVICE_TYPE, Integer.parseInt(deviceType));
|
|
|
}
|
|
|
}
|