Commit 8b71d588 by 杨伟程

增加获取跌倒数据的接口

parent d1c95f93
...@@ -12,7 +12,8 @@ import com.makeit.module.iot.vo.DeviceOperationLogEntity; ...@@ -12,7 +12,8 @@ import com.makeit.module.iot.vo.DeviceOperationLogEntity;
import com.makeit.module.iot.vo.IotPagerResult; import com.makeit.module.iot.vo.IotPagerResult;
import com.makeit.module.iot.vo.ResponseMessage; import com.makeit.module.iot.vo.ResponseMessage;
import com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe; import com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe;
import com.makeit.module.iot.vo.breathe.DeviceInfoContentSpace; import com.makeit.module.iot.vo.fall.DeviceInfoContentFall;
import com.makeit.module.iot.vo.space.DeviceInfoContentSpace;
import com.makeit.utils.LongTimestampUtil; import com.makeit.utils.LongTimestampUtil;
import com.makeit.utils.data.convert.JsonUtil; import com.makeit.utils.data.convert.JsonUtil;
import com.makeit.utils.data.convert.StreamUtil; import com.makeit.utils.data.convert.StreamUtil;
...@@ -23,9 +24,7 @@ import org.springframework.stereotype.Component; ...@@ -23,9 +24,7 @@ import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
import java.time.Duration; import java.time.Duration;
import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
...@@ -145,6 +144,16 @@ public class IotProductDeviceService extends IotCommonService { ...@@ -145,6 +144,16 @@ public class IotProductDeviceService extends IotCommonService {
return deviceInfoContentSpaceList; return deviceInfoContentSpaceList;
} }
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, "event", pageSize, dateTimeFormatter.format(startTime), dateTimeFormatter.format(endTime));
List<DeviceInfoContentFall> deviceInfoContentSpaceList = StreamUtil.map(deviceOperationLogEntityList, e -> JsonUtil.toObj((String) e.getContent(), DeviceInfoContentFall.class));
return deviceInfoContentSpaceList;
}
/** /**
* 根据类型查询设备日志 * 根据类型查询设备日志
...@@ -195,7 +204,6 @@ public class IotProductDeviceService extends IotCommonService { ...@@ -195,7 +204,6 @@ public class IotProductDeviceService extends IotCommonService {
} }
/** /**
*
* @param deviceId * @param deviceId
* @param typeValue * @param typeValue
* @param pageSize * @param pageSize
......
package com.makeit.module.iot.vo.fall;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@NoArgsConstructor
@Data
public class DeviceInfoContentFall {
@JsonProperty("headers")
private DeviceInfoContentBreathe.Headers headers;
@JsonProperty("messageType")
private String messageType;
@JsonProperty("deviceId")
private String deviceId;
@JsonProperty("properties")
private Properties properties;
@JsonProperty("timestamp")
private Long timestamp;
@NoArgsConstructor
@Data
public static class Properties {
@JsonProperty("personState")
private Integer personState;
@JsonProperty("person")
private Integer person;
@JsonProperty("radarHitch")
private String radarHitch;
@JsonProperty("track")
private List<Integer> track;
@JsonProperty("mount")
private Integer mount;
}
}
package com.makeit.module.iot.vo.breathe; package com.makeit.module.iot.vo.space;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
......
...@@ -10,7 +10,7 @@ import com.makeit.entity.platform.elder.PlatElderSleepAnalysis; ...@@ -10,7 +10,7 @@ import com.makeit.entity.platform.elder.PlatElderSleepAnalysis;
import com.makeit.enums.platform.alarm.PlatAlarmConfigEnum; import com.makeit.enums.platform.alarm.PlatAlarmConfigEnum;
import com.makeit.module.iot.service.IotProductDeviceService; import com.makeit.module.iot.service.IotProductDeviceService;
import com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe; import com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe;
import com.makeit.module.iot.vo.breathe.DeviceInfoContentSpace; import com.makeit.module.iot.vo.space.DeviceInfoContentSpace;
import com.makeit.service.platform.alarm.PlatAlarmRecordService; import com.makeit.service.platform.alarm.PlatAlarmRecordService;
import com.makeit.service.platform.device.PlatDeviceService; import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.service.platform.elder.*; import com.makeit.service.platform.elder.*;
......
...@@ -4,7 +4,7 @@ import com.makeit.dto.platform.elder.PlatElderIdDTO; ...@@ -4,7 +4,7 @@ import com.makeit.dto.platform.elder.PlatElderIdDTO;
import com.makeit.entity.platform.device.PlatDevice; import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.module.iot.service.IotProductDeviceService; import com.makeit.module.iot.service.IotProductDeviceService;
import com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe; import com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe;
import com.makeit.module.iot.vo.breathe.DeviceInfoContentSpace; import com.makeit.module.iot.vo.space.DeviceInfoContentSpace;
import com.makeit.service.platform.device.PlatDeviceService; import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.service.platform.elder.PlatElderRealTimeService; import com.makeit.service.platform.elder.PlatElderRealTimeService;
import com.makeit.service.platform.elder.PlatElderService; import com.makeit.service.platform.elder.PlatElderService;
......
...@@ -9,7 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -9,7 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest @SpringBootTest
public class IotTest { public class IotDeviceInfoContentFall {
@Autowired @Autowired
private IotTokenService tokenService; private IotTokenService tokenService;
......
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