手表接口修改

This commit is contained in:
wanghao
2026-03-04 17:23:32 +08:00
parent fe82afd934
commit 3cea926a1e
2 changed files with 18 additions and 4 deletions
@@ -49,10 +49,23 @@ public class UserStat {
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.latest = parseSafe(watchH5IndexItemNewVo.getDataValue());
this.max = parseSafe(watchH5IndexItemNewVo.getDataMax());
this.min = parseSafe(watchH5IndexItemNewVo.getDataMin());
this.avg = parseSafe(watchH5IndexItemNewVo.getDataAvg());
this.latestTime = watchH5IndexItemNewVo.getDataDate();
}
/**
* 安全解析字符串为 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));
}
}
@@ -969,6 +969,7 @@ public class WatchDataApiServiceImpl implements WatchDataApiService {
wrapper.selectAs(WatchStatUserInfoDaySleep::getLongDurationTotal,WatchH5IndexItemNewVo::getDataValue);
wrapper.selectAs(WatchStatUserInfoDaySleep::getLongDurationTotal,WatchH5IndexItemNewVo::getDataMax);
wrapper.selectAs(WatchStatUserInfoDaySleep::getShortDurationTotal,WatchH5IndexItemNewVo::getDataMin);
wrapper.selectAs(WatchStatUserInfoDaySleep::getSleepAvg,WatchH5IndexItemNewVo::getDataAvg);
wrapper.selectAs(WatchStatUserInfoDaySleep::getDataDate,WatchH5IndexItemNewVo::getDataDate);
wrapper.eq(WatchStatUserInfoDaySleep::getUserId, userId);
wrapper.orderByDesc(WatchStatUserInfoDaySleep::getDataDate);