Commit d7046ca6 by 杨伟程

坐标定位和轨迹更新

parent 30bb5321
...@@ -158,6 +158,24 @@ public class IotProductDeviceService extends IotCommonService { ...@@ -158,6 +158,24 @@ public class IotProductDeviceService extends IotCommonService {
} }
public DeviceInfoContentFall getLastDeviceLogFall(String deviceId, Integer ignoreDuration) {//秒
DeviceOperationLogEntity deviceOperationLogEntity = getLastDeviceLogByType(deviceId, REPORT_PROPERTY);
if (deviceOperationLogEntity == null) {
return null;
}
DeviceInfoContentFall fall = JsonUtil.toObj((String) deviceOperationLogEntity.getContent(), DeviceInfoContentFall.class);
LocalDateTime time = LongTimestampUtil.toLocalDateTime(fall.getTimestamp());
if (ignoreDuration != null && Duration.between(time, LocalDateTime.now()).getSeconds() > ignoreDuration) {
return null;
}
return fall;
}
public List<String> getLastDayHourRange(LocalDateTime startDateTime) { public List<String> getLastDayHourRange(LocalDateTime startDateTime) {
int count = 24; int count = 24;
List<String> list = Lists.newArrayList(); List<String> list = Lists.newArrayList();
......
...@@ -354,22 +354,25 @@ public class PlatElderDayReportDayServiceImpl implements PlatElderDayReportDaySe ...@@ -354,22 +354,25 @@ public class PlatElderDayReportDayServiceImpl implements PlatElderDayReportDaySe
@Override @Override
public List<PlatElderCoordinateVO> coordinateList(String elderId, String deviceId, LocalDateTime start, LocalDateTime end) { public List<PlatElderCoordinateVO> coordinateList(String elderId, String deviceId, LocalDateTime start, LocalDateTime end) {
List<PlatDevice> platDeviceList = platElderRealTimeService.getSpaceDevice(elderId, deviceId); List<PlatDevice> platDeviceListSpace = platElderRealTimeService.getSpaceDevice(elderId, deviceId);
if (CollectionUtils.isEmpty(platDeviceList)) { List<PlatDevice> platDeviceListFall = platElderRealTimeService.getFallDevice(elderId, deviceId);
if (CollectionUtils.isEmpty(platDeviceListSpace) && CollectionUtils.isEmpty(platDeviceListFall)) {
return new ArrayList<>(10); return new ArrayList<>(10);
} }
List<PlatElderCoordinateVO> voList = new ArrayList<>(10); List<PlatElderCoordinateVO> voList = new ArrayList<>(10);
platDeviceList.forEach(e -> { platDeviceListSpace.forEach(e -> {
List<DeviceInfoContentSpace> spaceList = iotProductDeviceService.getDeviceLogByTimeRangeSpace(e.getOriDeviceId(), 2 * 24 * 3600, start, end); List<DeviceInfoContentSpace> spaceList = iotProductDeviceService.getDeviceLogByTimeRangeSpace(e.getOriDeviceId(), 2 * 24 * 3600, start, end);
voList.addAll(StreamUtil.map(spaceList, i -> { voList.addAll(StreamUtil.map(spaceList, i -> {
PlatElderCoordinateVO vo = new PlatElderCoordinateVO(); PlatElderCoordinateVO vo = new PlatElderCoordinateVO();
vo.setX(new BigDecimal(i.getProperties().getDistance()).multiply(new BigDecimal(Math.cos(i.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP));
vo.setY(new BigDecimal(i.getProperties().getDistance()).multiply(new BigDecimal(Math.sin(i.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP)); // vo.setX(new BigDecimal(i.getProperties().getDistance()).multiply(new BigDecimal(Math.cos(i.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP));
// vo.setY(new BigDecimal(i.getProperties().getDistance()).multiply(new BigDecimal(Math.sin(i.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP));
vo.setDistance(i.getProperties().getDistance()); vo.setDistance(i.getProperties().getDistance());
vo.setAngle(i.getProperties().getAngle()); vo.setAngle(i.getProperties().getAngle());
...@@ -384,6 +387,25 @@ public class PlatElderDayReportDayServiceImpl implements PlatElderDayReportDaySe ...@@ -384,6 +387,25 @@ public class PlatElderDayReportDayServiceImpl implements PlatElderDayReportDaySe
}); });
platDeviceListFall.forEach(e -> {
List<DeviceInfoContentFall> fallList = iotProductDeviceService.getDeviceLogByTimeRangeFall(e.getOriDeviceId(), 2 * 24 * 3600, start, end);
voList.addAll(StreamUtil.map(fallList, i -> {
PlatElderCoordinateVO vo = new PlatElderCoordinateVO();
vo.setTrack(i.getProperties().getTrack());
vo.setDeviceId(e.getId());
vo.setOriDeviceId(e.getOriDeviceId());
return vo;
})
);
});
return voList; return voList;
} }
......
...@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
@Data @Data
public class PlatElderCoordinateVO { public class PlatElderCoordinateVO {
...@@ -14,11 +15,11 @@ public class PlatElderCoordinateVO { ...@@ -14,11 +15,11 @@ public class PlatElderCoordinateVO {
@ApiModelProperty(value = "原始设备ID") @ApiModelProperty(value = "原始设备ID")
private String oriDeviceId; private String oriDeviceId;
@ApiModelProperty("x") // @ApiModelProperty("x")
private BigDecimal x; // private BigDecimal x;
//
@ApiModelProperty("y") // @ApiModelProperty("y")
private BigDecimal y; // private BigDecimal y;
@ApiModelProperty("人体目标距离雷达位置 范围:0-1000,单位cm") @ApiModelProperty("人体目标距离雷达位置 范围:0-1000,单位cm")
private Integer distance; private Integer distance;
...@@ -26,5 +27,8 @@ public class PlatElderCoordinateVO { ...@@ -26,5 +27,8 @@ public class PlatElderCoordinateVO {
@ApiModelProperty("人体目标偏离雷达法线角度范围:±60,单位°") @ApiModelProperty("人体目标偏离雷达法线角度范围:±60,单位°")
private Integer angle; private Integer angle;
@ApiModelProperty("跌倒设备轨迹")
private List<Integer> track;
} }
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