存入redis
This commit is contained in:
parent
1dc559a1b7
commit
031ac27266
@ -9677,12 +9677,52 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
||||
public JsonActionResult<List<T_FM_DEPARTMENT_COMPLETION_SORT>> GetDepartmentCompletionSort([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return SafeExecute<List<T_FM_DEPARTMENT_COMPLETION_SORT>>(() =>
|
||||
{
|
||||
{
|
||||
List<T_FM_DEPARTMENT_COMPLETION_SORT> completionSorts = new List<T_FM_DEPARTMENT_COMPLETION_SORT>();
|
||||
#region 判断 从Redis中获取数据 有就直接返回到前端 没有就按原来的进行搜索 最后再判断存入Redis中
|
||||
|
||||
var redisCode = string.Format(RedisCacheKey.HomeJobCompletion, APT.Infrastructure.Api.AppContext.CurrentSession.OrgId);
|
||||
DateTime dtNow = DateTime.Now;
|
||||
bool isRedisConfig = true;
|
||||
var redisConfig = APT.Infrastructure.Api.ConfigurationManager.AppSettings["RedisFormConfig"];
|
||||
List<HomeResultMineType> listHomeRedis = null;
|
||||
if (!string.IsNullOrEmpty(redisConfig))
|
||||
isRedisConfig = bool.Parse(redisConfig);
|
||||
|
||||
if (isRedisConfig && CsRedisManager.KeyExists(redisCode))
|
||||
listHomeRedis = CsRedisManager.StringGet<List<HomeResultMineType>>(redisCode);
|
||||
|
||||
if (listHomeRedis != null && listHomeRedis.Count() > 0)
|
||||
{
|
||||
foreach (var item in listHomeRedis)
|
||||
{
|
||||
//if (item.MineType == MineType)
|
||||
{
|
||||
if (dtNow.ToString("yyyyMMddHH") == item.yyyyMMddHH)
|
||||
{
|
||||
completionSorts = item.deptResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
listHomeRedis.Remove(item);//Key不匹配 过期数据删除
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//redis获取到了数据
|
||||
if (completionSorts != null && completionSorts.Count() > 0)
|
||||
{
|
||||
return completionSorts;
|
||||
}
|
||||
|
||||
#endregion
|
||||
var orgId = APT.Infrastructure.Api.AppContext.CurrentSession.OrgId.Value;
|
||||
//var mineType = 30;
|
||||
var departmentIds = new List<Guid>();
|
||||
List<GroupbyDepartmentId> completionLists = new List<GroupbyDepartmentId>();
|
||||
List<T_FM_DEPARTMENT_COMPLETION_SORT> completionSorts = new List<T_FM_DEPARTMENT_COMPLETION_SORT>();
|
||||
|
||||
//if (string.IsNullOrEmpty(filter.Keyword))
|
||||
// return completionSorts;
|
||||
//var departmentInfo = this.GetEntities<T_FM_DEPARTMENT>(t => t.MineType == int.Parse(filter.Keyword.ToString()), new BaseFilter(orgId));
|
||||
@ -9766,7 +9806,29 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
||||
{
|
||||
item.NUM = i;
|
||||
i++;
|
||||
}
|
||||
#region 搜索结果 判断存入Redis中
|
||||
|
||||
if (isRedisConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (listHomeRedis == null)
|
||||
listHomeRedis = new List<HomeResultMineType>();
|
||||
|
||||
listHomeRedis.Add(new HomeResultMineType()
|
||||
{
|
||||
//MineType = MineType,
|
||||
yyyyMMddHH = dtNow.ToString("yyyyMMddHH"),
|
||||
deptResult = completionSorts1
|
||||
});
|
||||
|
||||
CsRedisManager.StringSet<List<HomeResultMineType>>(redisCode, listHomeRedis);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
#endregion
|
||||
return completionSorts1;
|
||||
});
|
||||
}
|
||||
@ -10308,7 +10370,7 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
||||
|
||||
|
||||
List<T_FM_WORK_TICKET_COMPLETION> completions = new List<T_FM_WORK_TICKET_COMPLETION>();
|
||||
BaseFilter baseFilter = new BaseFilter(filter.GetOrgId());
|
||||
BaseFilter baseFilter = new BaseFilter(orgId);
|
||||
baseFilter.IgnoreDataRule = true;
|
||||
var startTime = Convert.ToDateTime(DateTime.Now.Year + "-" + DateTime.Now.Month + "-01 00:00:00");
|
||||
var endTime = Convert.ToDateTime(DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + " 23:59:59");
|
||||
@ -11860,7 +11922,8 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
||||
/// <summary>
|
||||
/// 存储信息
|
||||
/// </summary>
|
||||
public List<T_FM_WORK_TICKET_COMPLETION> result { get; set; }
|
||||
public List<T_FM_WORK_TICKET_COMPLETION> result { get; set; }
|
||||
public List<T_FM_DEPARTMENT_COMPLETION_SORT> deptResult { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 系统运行情况报表
|
||||
|
||||
Loading…
Reference in New Issue
Block a user