|
|
@@ -10,6 +10,7 @@ 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.mediator.api.mapper.IotSensorMapper;
|
|
|
import com.xunmei.mediator.api.service.EquipmentSyncService;
|
|
|
@@ -76,7 +77,7 @@ public class IotSensorServiceImpl extends ServiceImpl<IotSensorMapper, IotSensor
|
|
|
}
|
|
|
|
|
|
private void saveStatusAsync(DataPageDto<SensorStatusDto> request, String msgId) throws ParseException {
|
|
|
- String path = "/api/{branchId}/status/sensorCommon";
|
|
|
+ String path = "/api/status/sensorCommon";
|
|
|
List<NorthError> errors = new ArrayList<>();
|
|
|
Map<String, List<IotSensor>> productDeviceMap = getAllDevice();
|
|
|
List<IotSensor> sensorList = new ArrayList<>();
|
|
|
@@ -105,7 +106,7 @@ public class IotSensorServiceImpl extends ServiceImpl<IotSensorMapper, IotSensor
|
|
|
iotSensor.setUpdateTime(LocalDateTime.now());
|
|
|
iotSensor.setDeviceName(status.getDeviceName());
|
|
|
iotSensor.setDeviceType(status.getDeviceType());
|
|
|
- iotSensor.setStateUpdateTime(LocalDateTime.now());
|
|
|
+ iotSensor.setStateUpdateTime(DateUtils.toLocalDateTime(status.getUpdateTime()));
|
|
|
iotSensor.setInfos(dealInfoData(infoStr));
|
|
|
final IotSensorLog iotSensorLog = new IotSensorLog();
|
|
|
BeanUtils.copyProperties(iotSensor, iotSensorLog, "id");
|
|
|
@@ -175,10 +176,10 @@ public class IotSensorServiceImpl extends ServiceImpl<IotSensorMapper, IotSensor
|
|
|
return dto;
|
|
|
}
|
|
|
|
|
|
- private List<IotSensor> convertToDomain(List<SensorDto> sensorDtos, String msgId,List<Long> deletedDeviceIds) {
|
|
|
+ private List<IotSensor> convertToDomain(List<SensorDto> sensorDtos, String msgId, List<Long> deletedDeviceIds) {
|
|
|
List<IotSensor> domains = new ArrayList<>();
|
|
|
List<NorthError> errors = new ArrayList<>();
|
|
|
- String path = "/api/{branchId}/data/sensorCommonList";
|
|
|
+ String path = "/api/data/sensorCommonList";
|
|
|
Map<String, List<IotSensor>> productDeviceMap = getAllDevice();
|
|
|
Set<String> uniqueSet = new HashSet<>();
|
|
|
for (SensorDto sensorDto : sensorDtos) {
|
|
|
@@ -235,9 +236,9 @@ public class IotSensorServiceImpl extends ServiceImpl<IotSensorMapper, IotSensor
|
|
|
domain.setSource(1);
|
|
|
domains.add(domain);
|
|
|
}
|
|
|
- if (errors.size() > 0) {
|
|
|
- northErrorService.saveErrorData(errors);
|
|
|
- }
|
|
|
+
|
|
|
+ northErrorService.saveErrorData(errors);
|
|
|
+
|
|
|
|
|
|
productDeviceMap.keySet().stream().filter(k -> !uniqueSet.contains(k)).forEach(k -> productDeviceMap.get(k).forEach(d -> deletedDeviceIds.add(d.getId())));
|
|
|
|
|
|
@@ -274,7 +275,8 @@ public class IotSensorServiceImpl extends ServiceImpl<IotSensorMapper, IotSensor
|
|
|
break;
|
|
|
case "41885"://燃气报警器
|
|
|
type = CategoryDataEnum.GAS_ALARM.getId();
|
|
|
- default:break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
return type;
|