fix: 3月3日后develop分支代码迁移至xc分支
This commit is contained in:
+4
@@ -22,6 +22,10 @@ public class WatchH5IndexItemNewVo {
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date dataDate;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date dataDateNew;
|
||||
/**
|
||||
* 注意 当wdType=sleep时此字段返回长睡时长
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.renkang.watch.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author TianZi
|
||||
* @date 2023/11/7 14:13
|
||||
*/
|
||||
@Data
|
||||
public class BindDeviceDTO {
|
||||
|
||||
@Schema(title = "手表编号")
|
||||
private String watchNo;
|
||||
}
|
||||
+59
-2
@@ -1,22 +1,79 @@
|
||||
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=睡眠
|
||||
*/
|
||||
private String type;
|
||||
private BigDecimal latest;
|
||||
private BigDecimal max;
|
||||
private BigDecimal min;
|
||||
private BigDecimal avg;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
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;
|
||||
}
|
||||
if (watchH5IndexItemNewVo.getWdType().equals("sleep")) {
|
||||
this.latest = parseSafe(watchH5IndexItemNewVo.getDataMax());// 总时长
|
||||
this.max = parseSafe(watchH5IndexItemNewVo.getDataMax());
|
||||
this.min = parseSafe(watchH5IndexItemNewVo.getDataMin());
|
||||
this.avg = parseSafe(watchH5IndexItemNewVo.getDataAvg());
|
||||
this.latestTime = watchH5IndexItemNewVo.getDataDate();
|
||||
}else {
|
||||
this.latest = parseSafe(watchH5IndexItemNewVo.getDataValue());
|
||||
this.max = parseSafe(watchH5IndexItemNewVo.getDataMax());
|
||||
this.min = parseSafe(watchH5IndexItemNewVo.getDataMin());
|
||||
this.avg = parseSafe(watchH5IndexItemNewVo.getDataAvg());
|
||||
this.latestTime = watchH5IndexItemNewVo.getDataDateNew();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全解析字符串为 BigDecimal,入参为 null 或空串时返回 null
|
||||
*
|
||||
* @param value 待解析的字符串数值
|
||||
* @return 解析结果,无效输入返回 null
|
||||
*/
|
||||
private static BigDecimal parseSafe(String value) {
|
||||
if (value == null || value.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return BigDecimal.valueOf(Double.parseDouble(value));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user