Commit b89945db by Neo Turing

优化

parent 6650ff7c
......@@ -32,6 +32,6 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.2024.8200")]
[assembly: AssemblyFileVersion("5.4.2024.8200")]
[assembly: AssemblyVersion("5.4.2024.9180")]
[assembly: AssemblyFileVersion("5.4.2024.9180")]
......@@ -103,8 +103,16 @@ namespace Jst.Lims.Timeliness
BeginDate = DateTime.Parse(BeginDate.ToString("yyyy-MM-dd"));
EndDate = DateTime.Parse(EndDate.ToString("yyyy-MM-dd"));
if (EndDate < BeginDate) throw new Exception("查询结束日期不可小于开始日期!");
var days = EndDate.Subtract(BeginDate).Days;
if (days > 92) throw new Exception("最多查询三个月的数据,您已超出日期范围上线!");
(EndDate.Subtract(BeginDate).Days > 31).ThrowIfTrue("时间跨度不得大于31天!");
#region 启用缓存,20分钟内查询条件相同不重复请求数据库
var cache = KiviiContext.GetCacheClient();
var cacheKey = KiviiContext.GetUrnKey($"{this.GetType().FullName}_Request_{BeginDate:G}_{EndDate:G}_{TimeFilter}_{Grouped}_{Urgent}_{PolicyNodeKvids.Join(",")}");
var cacheValue = cache.Get<RestfulQueryResponse<TimelineStatistic>>(cacheKey);
if (cacheValue != null)
{
return cacheValue;
}
#endregion
var rtns = new RestfulQueryResponse<TimelineStatistic>();
rtns.Results = new List<TimelineStatistic>();
......@@ -390,6 +398,7 @@ namespace Jst.Lims.Timeliness
}
rtns.Results = rtns.Results.OrderBy(o => o.SortId).ToList();
rtns.Total = rtns.Results.Count;
cache.Set(cacheKey, rtns, TimeSpan.FromMinutes(20));
return rtns;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment