|
@@ -1,5 +1,6 @@
|
|
|
using Hotline.Caching.Interfaces;
|
|
|
using Hotline.Users;
|
|
|
+using System.Drawing.Printing;
|
|
|
using XF.Domain.Cache;
|
|
|
using XF.Domain.Dependency;
|
|
|
using XF.Domain.Exceptions;
|
|
@@ -37,6 +38,22 @@ public class UserCacheManager : IUserCacheManager, IScopeDependency
|
|
|
return work;
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 查询用户当前工作记录(不抛异常)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="userId"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public Work? GetWorkByUserNoExp(string userId)
|
|
|
+ {
|
|
|
+ var work = _cacheWork.GetOrSet(Work.GetKey(KeyMode.UserId, userId), k =>
|
|
|
+ {
|
|
|
+ var dbWork = _workRepository.GetCurrentWorkByUserAsync(userId)
|
|
|
+ .GetAwaiter().GetResult();
|
|
|
+ return dbWork;
|
|
|
+ });
|
|
|
+ return work;
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 查询分机当前工作记录
|
|
|
/// </summary>
|
|
@@ -56,6 +73,22 @@ public class UserCacheManager : IUserCacheManager, IScopeDependency
|
|
|
return work;
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 查询分机当前工作记录
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="telNo"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public Work? GetWorkByTelNoExp(string telNo)
|
|
|
+ {
|
|
|
+ var work = _cacheWork.GetOrSet(Work.GetKey(KeyMode.TelNo, telNo), k =>
|
|
|
+ {
|
|
|
+ var dbWork = _workRepository.GetCurrentWorkByTelAsync(telNo)
|
|
|
+ .GetAwaiter().GetResult();
|
|
|
+ return dbWork;
|
|
|
+ });
|
|
|
+ return work;
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 查询分机是否处于工作
|
|
|
/// </summary>
|