Commit 8b71d588 by 杨伟程

增加获取跌倒数据的接口

parent d1c95f93
......@@ -12,7 +12,8 @@ import com.makeit.module.iot.vo.DeviceOperationLogEntity;
import com.makeit.module.iot.vo.IotPagerResult;
import com.makeit.module.iot.vo.ResponseMessage;
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.data.convert.JsonUtil;
import com.makeit.utils.data.convert.StreamUtil;
......@@ -23,9 +24,7 @@ import org.springframework.stereotype.Component;
import java.io.IOException;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.List;
......@@ -145,6 +144,16 @@ public class IotProductDeviceService extends IotCommonService {
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 {
}
/**
*
* @param deviceId
* @param typeValue
* @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.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe;
import lombok.Data;
import lombok.NoArgsConstructor;
......
......@@ -10,7 +10,7 @@ import com.makeit.entity.platform.elder.PlatElderSleepAnalysis;
import com.makeit.enums.platform.alarm.PlatAlarmConfigEnum;
import com.makeit.module.iot.service.IotProductDeviceService;
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.device.PlatDeviceService;
import com.makeit.service.platform.elder.*;
......
......@@ -4,7 +4,7 @@ import com.makeit.dto.platform.elder.PlatElderIdDTO;
import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.module.iot.service.IotProductDeviceService;
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.elder.PlatElderRealTimeService;
import com.makeit.service.platform.elder.PlatElderService;
......
......@@ -9,7 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
public class IotTest {
public class IotDeviceInfoContentFall {
@Autowired
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