手表接口修改

This commit is contained in:
wanghao
2026-03-04 15:30:07 +08:00
parent 96242b5c00
commit fe82afd934
2 changed files with 203 additions and 34 deletions
@@ -1,18 +1,23 @@
package com.renkang.watch.vo.UserData.res;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.renkang.watch.WatchH5IndexItemNewVo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/** 用户统计数据
/**
* 用户统计数据
*
* @author stan
* @since 2024-11-04 16:33
*/
@Data
public class UserStat {
/** 数据类型:0=心率 1=血氧 2=压力 3=体温 4=睡眠 */
/**
* 数据类型:0=心率 1=血氧 2=压力 3=体温 4=睡眠
*/
private String type;
private BigDecimal latest;
private BigDecimal max;
@@ -21,4 +26,33 @@ public class UserStat {
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private Date latestTime;
public UserStat() {
}
public UserStat(WatchH5IndexItemNewVo watchH5IndexItemNewVo) {
switch (watchH5IndexItemNewVo.getWdType()) {
case "sleep":
this.type = "4";
break;
case "heart_rate":
this.type = "0";
break;
case "stress":
this.type = "2";
break;
case "spo2":
this.type = "1";
break;
case "temperature":
this.type = "3";
break;
default:
break;
}
this.latest = BigDecimal.valueOf(Double.parseDouble(watchH5IndexItemNewVo.getDataValue()));
this.max = BigDecimal.valueOf(Double.parseDouble(watchH5IndexItemNewVo.getDataMax()));
this.min = BigDecimal.valueOf(Double.parseDouble(watchH5IndexItemNewVo.getDataMin()));
this.avg = BigDecimal.valueOf(Double.parseDouble(watchH5IndexItemNewVo.getDataAvg()));
this.latestTime = watchH5IndexItemNewVo.getDataDate();
}
}