Browse Source

调整时间精度对比

master
H Vs 5 months ago
parent
commit
dc3f33dd3c
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      HealthMonitor.WebApi/Worker.cs

+ 9
- 3
HealthMonitor.WebApi/Worker.cs View File

@@ -2022,7 +2022,7 @@ namespace HealthMonitor.WebApi
var statStartTime = segmentStatStartTime; var statStartTime = segmentStatStartTime;
var statEndTime = segmentStatEndTime; var statEndTime = segmentStatEndTime;


_logger.LogInformation($"{heartRate.Serialno} 当前统计周期{statStartTime}-{statEndTime}");
_logger.LogInformation($"{heartRate.Serialno} 当前统计周期{statStartTime.ToString("yyyy-MM-dd HH:mm:ss")}-{statEndTime.ToString("yyyy-MM-dd HH:mm:ss")}");


var segmentPhr = normalPhr var segmentPhr = normalPhr
.Where(i => i.LastUpdate <= statEndTime && i.LastUpdate >= statStartTime) .Where(i => i.LastUpdate <= statEndTime && i.LastUpdate >= statStartTime)
@@ -2031,7 +2031,7 @@ namespace HealthMonitor.WebApi
if (segmentPhr.Count == 0) if (segmentPhr.Count == 0)
{ {
// 跳出当次迭代,进入下次迭代 // 跳出当次迭代,进入下次迭代
_logger.LogWarning($"{heartRate.Serialno} 统计周期:{statStartTime}-{statEndTime} 孕妇心率数据不足,{segmentPhr.Count}条记录,不处理");
_logger.LogWarning($"{heartRate.Serialno} 统计周期:{statStartTime.ToString("yyyy-MM-dd HH:mm:ss")}-{statEndTime.ToString("yyyy-MM-dd HH:mm:ss")} 孕妇心率数据不足,{segmentPhr.Count}条记录,不处理");
continue; continue;
} }


@@ -2221,11 +2221,17 @@ namespace HealthMonitor.WebApi
} }
await Task.Delay(TimeSpan.FromSeconds(1)); await Task.Delay(TimeSpan.FromSeconds(1));
// 跳出循环 // 跳出循环
if (statEndTime == boundaryStatEndTime)
if (statEndTime.ToString("yyyyMMddHHmm") == boundaryStatEndTime.ToString("yyyyMMddHHmm"))
{ {
_logger.LogInformation($"{heartRate.Serialno} 迭代完成跳出循环 "); _logger.LogInformation($"{heartRate.Serialno} 迭代完成跳出循环 ");
break; break;
} }

if (statEndTime>= boundaryStatEndTime)
{
_logger.LogInformation($"{heartRate.Serialno} 时间边界,迭代完成跳出循环 ");
break;
}
} }
} }
catch (Exception ex) catch (Exception ex)


Loading…
Cancel
Save