diff --git a/HealthMonitor.Service/Biz/IotWebApiService.cs b/HealthMonitor.Service/Biz/IotWebApiService.cs
index fc835f2..2e40c78 100644
--- a/HealthMonitor.Service/Biz/IotWebApiService.cs
+++ b/HealthMonitor.Service/Biz/IotWebApiService.cs
@@ -344,6 +344,86 @@ namespace HealthMonitor.Service.Biz
}
*/
///
+ ///// 更新 gps_person remark缓存和数据库
+ /////
+ /////
+ /////
+ /////
+ /////
+ /////
+ /////
+ /////
+ //public async Task UpdatePersonRemarksAsync(string imei, int systolicRefValue, int diastolicRefValue, int systolicIncValue, int diastolicIncValue, string remarks= "is_blood_press")
+ //{
+ // var flag = false;
+ // try
+ // {
+
+ // // 保证实时性,先更新缓存,再更新数据库
+ // var personCache = await _personCacheMgr.GetDeviceGpsPersonCacheObjectBySerialNoAsync(new Guid().ToString(), imei).ConfigureAwait(false);
+
+ // if (personCache == null)
+ // {
+ // _logger.LogInformation($"{imei} -- Person remarks数据异常,检查缓存和数据库");
+ // }
+ // else if (string.IsNullOrWhiteSpace(personCache["person"]!["remarks"]!.ToString()))
+ // {
+ // var newRemarkData = new
+ // {
+ // imei,
+ // time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+ // commandValue = new
+ // {
+ // systolicCalibrationValue = systolicRefValue, //收缩压标定值,值为0 表示不生效
+ // diastolicCalibrationValue = diastolicRefValue, //舒张压标定值,值为0表示不生效
+ // systolicIncValue, //收缩压显示增量,值为0 表示不生效
+ // diastolicIncValue //舒张压显示增量,值为0 表示不生效
+ // }
+ // };
+ // var newRemarkStr = $"{remarks}:{JsonConvert.SerializeObject(newRemarkData)}|";
+
+ // personCache["person"]!["remarks"] = newRemarkStr;
+ // bool cacheFlag = await _personCacheMgr.UpdateDeviceGpsPersonCacheObjectBySerialNoAsync(personCache, imei);
+ // if (cacheFlag)
+ // {
+ // GeneralParam condition = new()
+ // {
+ // Filters = new List {
+ // new QueryFilterCondition {
+ // Key=nameof(GpsDevice.Serialno),
+ // Value=imei,
+ // Operator= QueryOperatorEnum.Equal,
+ // ValueType=QueryValueTypeEnum.String
+ // }
+ // },
+ // OrderBys = new List { new OrderByCondition { Key = "serialno", IsDesc = true } }
+
+ // };
+ // _logger.LogInformation($"{imei} 更新缓存{nameof(UpdatePersonRemarksAsync)}成功,{JsonConvert.SerializeObject(personCache)}");
+ // // 读取数据库
+ // var person = await _gpsPersonApiClient.GetFirstAsync(condition, new RequestHeader() { RequestId = $"{imei}" }).ConfigureAwait(false);
+ // // 更新字段
+ // person!.Remarks = newRemarkStr;
+ // await _gpsPersonApiClient.UpdateAsync(person, new RequestHeader() { RequestId = $"{imei}" }).ConfigureAwait(false);
+ // _logger.LogInformation($"{imei} 更新Person remarks字段|{person.Remarks}");
+
+ // }
+ // else
+ // {
+ // _logger.LogInformation($"{imei} 更新缓存和数据库{nameof(UpdatePersonRemarksAsync)}失败,{JsonConvert.SerializeObject(personCache)}");
+ // }
+ // flag = cacheFlag;
+ // }
+ // }
+ // catch (Exception ex)
+ // {
+ // _logger.LogError($"{nameof(UpdatePersonRemarksAsync)} {imei}--更新个人信息异常:{ex.Message}, {ex.StackTrace}");
+ // }
+ // return flag;
+ //}
+
+
+
/// 更新 gps_person remark缓存和数据库
///
///
@@ -353,7 +433,7 @@ namespace HealthMonitor.Service.Biz
///
///
///
- public async Task UpdatePersonRemarksAsync(string imei, int systolicRefValue, int diastolicRefValue, int systolicIncValue, int diastolicIncValue, string remarks= "is_blood_press")
+ public async Task UpdatePersonRemarksAsync(string imei, int systolicRefValue, int diastolicRefValue, int systolicIncValue, int diastolicIncValue, string remarks = "is_blood_press")
{
var flag = false;
try
@@ -366,7 +446,7 @@ namespace HealthMonitor.Service.Biz
{
_logger.LogInformation($"{imei} -- Person remarks数据异常,检查缓存和数据库");
}
- else if (string.IsNullOrWhiteSpace(personCache["person"]!["remarks"]!.ToString()))
+ else
{
var newRemarkData = new
{
@@ -380,8 +460,8 @@ namespace HealthMonitor.Service.Biz
diastolicIncValue //舒张压显示增量,值为0 表示不生效
}
};
- var newRemarkStr = $"{remarks}:{JsonConvert.SerializeObject(newRemarkData)}|";
-
+ var newRemarkStr = $"{remarks}:{JsonConvert.SerializeObject(newRemarkData)}|";
+
personCache["person"]!["remarks"] = newRemarkStr;
bool cacheFlag = await _personCacheMgr.UpdateDeviceGpsPersonCacheObjectBySerialNoAsync(personCache, imei);
if (cacheFlag)
@@ -414,6 +494,55 @@ namespace HealthMonitor.Service.Biz
}
flag = cacheFlag;
}
+ // else if (string.IsNullOrWhiteSpace(personCache["person"]!["remarks"]!.ToString()))
+ //else if (personCache?["person"]!["remarks"]!.ToString()!=null)
+ //{
+ // var newRemarkData = new
+ // {
+ // imei,
+ // time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+ // commandValue = new
+ // {
+ // systolicCalibrationValue = systolicRefValue, //收缩压标定值,值为0 表示不生效
+ // diastolicCalibrationValue = diastolicRefValue, //舒张压标定值,值为0表示不生效
+ // systolicIncValue, //收缩压显示增量,值为0 表示不生效
+ // diastolicIncValue //舒张压显示增量,值为0 表示不生效
+ // }
+ // };
+ // var newRemarkStr = $"{remarks}:{JsonConvert.SerializeObject(newRemarkData)}|";
+
+ // personCache["person"]!["remarks"] = newRemarkStr;
+ // bool cacheFlag = await _personCacheMgr.UpdateDeviceGpsPersonCacheObjectBySerialNoAsync(personCache, imei);
+ // if (cacheFlag)
+ // {
+ // GeneralParam condition = new()
+ // {
+ // Filters = new List {
+ // new QueryFilterCondition {
+ // Key=nameof(GpsDevice.Serialno),
+ // Value=imei,
+ // Operator= QueryOperatorEnum.Equal,
+ // ValueType=QueryValueTypeEnum.String
+ // }
+ // },
+ // OrderBys = new List { new OrderByCondition { Key = "serialno", IsDesc = true } }
+
+ // };
+ // _logger.LogInformation($"{imei} 更新缓存{nameof(UpdatePersonRemarksAsync)}成功,{JsonConvert.SerializeObject(personCache)}");
+ // // 读取数据库
+ // var person = await _gpsPersonApiClient.GetFirstAsync(condition, new RequestHeader() { RequestId = $"{imei}" }).ConfigureAwait(false);
+ // // 更新字段
+ // person!.Remarks = newRemarkStr;
+ // await _gpsPersonApiClient.UpdateAsync(person, new RequestHeader() { RequestId = $"{imei}" }).ConfigureAwait(false);
+ // _logger.LogInformation($"{imei} 更新Person remarks字段|{person.Remarks}");
+
+ // }
+ // else
+ // {
+ // _logger.LogInformation($"{imei} 更新缓存和数据库{nameof(UpdatePersonRemarksAsync)}失败,{JsonConvert.SerializeObject(personCache)}");
+ // }
+ // flag = cacheFlag;
+ //}
}
catch (Exception ex)
{