Commit 131db3a8 by huangjy

fix:空间实时定位问题

parent 02533394
...@@ -276,26 +276,28 @@ public class IotProductDeviceService extends IotCommonService { ...@@ -276,26 +276,28 @@ public class IotProductDeviceService extends IotCommonService {
} }
public List<DeviceInfoContentSpace> getDeviceLogByTimeRangeSpace(String deviceId, int pageSize, LocalDateTime startTime, LocalDateTime endTime) { public List<DeviceInfoContentSpace> getDeviceLogByTimeRangeSpace(String deviceId, int pageSize, LocalDateTime startTime, LocalDateTime endTime) {
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
List<DeviceInfoContentSpace> deviceInfoContentSpaceList = Lists.newArrayList(); List<DeviceInfoContentSpace> deviceInfoContentSpaceList = Lists.newArrayList();
int count = pageSize / 10000;
for (int i = 0; i < count + 1; i++) { List<String> lastDayHourRange = getLastDayHourRange(startTime);
List<DeviceOperationLogEntity> deviceOperationLogList = getDeviceLogByTimeRange(deviceId, REPORT_PROPERTY, 10000, dateTimeFormatter.format(startTime), dateTimeFormatter.format(endTime)); for (String hourRange : lastDayHourRange) {
String[] hourRangeArray = hourRange.split("~");
List<DeviceOperationLogEntity> deviceOperationLogList = getDeviceLogByTimeRange(deviceId, REPORT_PROPERTY, 5000, hourRangeArray[0], hourRangeArray[1]);
List<DeviceInfoContentSpace> tempDeviceInfoContentSpaceList = StreamUtil.map(deviceOperationLogList, e -> JsonUtil.toObj((String) e.getContent(), DeviceInfoContentSpace.class)); List<DeviceInfoContentSpace> tempDeviceInfoContentSpaceList = StreamUtil.map(deviceOperationLogList, e -> JsonUtil.toObj((String) e.getContent(), DeviceInfoContentSpace.class));
deviceInfoContentSpaceList.addAll(tempDeviceInfoContentSpaceList); deviceInfoContentSpaceList.addAll(tempDeviceInfoContentSpaceList);
} }
return deviceInfoContentSpaceList; return deviceInfoContentSpaceList;
} }
public List<DeviceInfoContentFall> getDeviceLogByTimeRangeFall(String deviceId, int pageSize, LocalDateTime startTime, LocalDateTime endTime) { public List<DeviceInfoContentFall> getDeviceLogByTimeRangeFall(String deviceId, int pageSize, LocalDateTime startTime, LocalDateTime endTime) {
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
List<DeviceOperationLogEntity> deviceOperationLogEntityList = getDeviceLogByTimeRange(deviceId, REPORT_PROPERTY, pageSize, dateTimeFormatter.format(startTime), dateTimeFormatter.format(endTime));
List<DeviceInfoContentFall> deviceInfoContentFallList = StreamUtil.map(deviceOperationLogEntityList, e -> JsonUtil.toObj((String) e.getContent(), DeviceInfoContentFall.class));
List<DeviceInfoContentFall> deviceInfoContentFallList = Lists.newArrayList();
List<String> lastDayHourRange = getLastDayHourRange(startTime);
for (String hourRange : lastDayHourRange) {
String[] hourRangeArray = hourRange.split("~");
List<DeviceOperationLogEntity> deviceOperationLogList = getDeviceLogByTimeRange(deviceId, REPORT_PROPERTY, 5000, hourRangeArray[0], hourRangeArray[1]);
List<DeviceInfoContentFall> tempDeviceInfoContentSpaceList = StreamUtil.map(deviceOperationLogList, e -> JsonUtil.toObj((String) e.getContent(), DeviceInfoContentFall.class));
deviceInfoContentFallList.addAll(tempDeviceInfoContentSpaceList);
}
return deviceInfoContentFallList; return deviceInfoContentFallList;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment