Commit be687148 by 杨伟程
parents c15c0eff de005920
......@@ -160,7 +160,7 @@ public class IotProductDeviceService extends IotCommonService {
int movebodyRandomLong = RandomUtils.nextInt(40,90);
deviceInfoContentBreathe = new DeviceInfoContentBreathe();
LocalDateTime localDateTime = startTime.plusMinutes(i);
long timeStamp = localDateTime.toInstant(ZoneOffset.UTC).toEpochMilli();
long timeStamp = localDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
deviceInfoContentBreathe.setTimestamp(timeStamp);
DeviceInfoContentBreathe.Properties properties = new DeviceInfoContentBreathe.Properties();
properties.setBr(brRandomLong);
......@@ -191,6 +191,16 @@ public class IotProductDeviceService extends IotCommonService {
return breatheList;
}
public static void main(String[] args) {
LocalDateTime localDateTime = LocalDateTime.now();
long timeStamp = localDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
System.out.println(timeStamp);
long timestamp = localDateTime.toInstant(ZoneOffset.of("+8")).toEpochMilli();
System.out.println("LocalDateTime to Timestamp: " + timestamp);
}
public static String formatLongTime(long time) {
return DEFAULT_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault()));
}
......
package com.makeit.service.platform.elder.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.makeit.common.entity.BaseEntity;
import com.makeit.dto.platform.elder.PlatElderIdDTO;
......@@ -21,6 +22,7 @@ import com.makeit.utils.StandardDeviationUtil;
import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.data.validate.CollectionUtils;
import com.makeit.utils.old.StringUtils;
import com.makeit.utils.redis.RedisUtil;
import com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO;
import com.makeit.vo.platform.elder.realtime.PlatElderRealTimeBodyVO;
import com.makeit.vo.platform.elder.realtime.PlatElderRealTimeHeartRespiratoryVO;
......@@ -36,6 +38,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
......@@ -50,6 +53,8 @@ import java.util.stream.Collectors;
@Service
public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
public static final String ELDER_STATUS = "plat:elder:status:";
@Autowired
private PlatElderService platElderService;
......@@ -234,6 +239,11 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
@Override
public PlatElderRealTimeNowVO nowStatus(PlatElderIdDTO platElderIdDTO) {
Object result = RedisUtil.get(ELDER_STATUS + platElderIdDTO.getElderId());
if (result != null) {
return JSON.parseObject(result.toString(),PlatElderRealTimeNowVO.class);
}
DeviceInfoContentBreathe deviceInfoContentBreathe = getNowDataBreathe(platElderIdDTO.getElderId(), platElderIdDTO.getDeviceId());
//
PlatElderRealTimeNowVO platElderRealTimeNowVO = new PlatElderRealTimeNowVO();
......@@ -264,6 +274,7 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
platElderRealTimeNowVO.setRespiratoryRate(deviceInfoContentBreathe.getProperties().getBr());
platElderRealTimeNowVO.setBodyMove(deviceInfoContentBreathe.getProperties().getBodymove());
RedisUtil.set(ELDER_STATUS + platElderIdDTO.getElderId(), JSON.toJSONString(platElderRealTimeNowVO),15, TimeUnit.SECONDS);
return platElderRealTimeNowVO;
}
......
......@@ -43,6 +43,7 @@ import com.makeit.utils.data.convert.PageUtil;
import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.data.validate.CollectionUtils;
import com.makeit.utils.sql.join.JoinUtil;
import com.makeit.utils.sys.FileUtil;
import com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO;
import com.makeit.vo.platform.elder.realtime.PlatElderRealTimeNowVO;
import com.makeit.vo.platform.workstation.*;
......@@ -519,6 +520,10 @@ public class WorkStationServiceImpl implements WorkStationService {
e.setPathName(StreamUtil.join(l, Objects::nonNull, PlatSpace::getName, "-"));
});
FileUtil.convert(list, WorkStationHomeBedVO::getAvatar, (e, f) -> {
e.setAvatarPath(f.getFullUrl());
});
for(WorkStationHomeBedVO vo : list){
vo.setPathName(vo.getPathName() + "-" + vo.getRoomName());
if (StringUtil.isNotEmpty(vo.getElderId()) ) {
......
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