|
@@ -104,10 +104,10 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
var (daySt, dayEt) = TimeHelper.GetStartOrEnd(dateTime); //今天开始时间 13位
|
|
|
var dateDay = dateTime.ToString("yyyyMMdd"); //获取当天的日期
|
|
|
|
|
|
- Dictionary<string, int> allDays = new(); //所有在线人数
|
|
|
- Dictionary<string, int> tchDays = new(); //教师在线人数
|
|
|
- Dictionary<string, int> stuDays = new(); //学生在线人数
|
|
|
- Dictionary<string, int> tmdDays = new(); //醍摩豆账户学生
|
|
|
+ Dictionary<int, int> allDays = new(); //所有在线人数
|
|
|
+ Dictionary<int, int> tchDays = new(); //教师在线人数
|
|
|
+ Dictionary<int, int> stuDays = new(); //学生在线人数
|
|
|
+ Dictionary<int, int> tmdDays = new(); //醍摩豆账户学生
|
|
|
|
|
|
SortedSetEntry[] tchDay = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Login:IES:teacher:{dateDay}");
|
|
|
if (tchDay.Length > 0)
|
|
@@ -116,7 +116,7 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
{
|
|
|
int val = ((int)item.Score);
|
|
|
int key = ((int)item.Element);
|
|
|
- var hour = DateTime.SpecifyKind(Convert.ToDateTime($"{dateTime.Year}/{dateTime.Month}/{ dateTime.Day} {key}:00:00"), DateTimeKind.Utc).ToLocalTime().ToString("HH:mm");
|
|
|
+ var hour = int.Parse(DateTime.SpecifyKind(Convert.ToDateTime($"{dateTime.Year}/{dateTime.Month}/{ dateTime.Day} {key}:00:00"), DateTimeKind.Utc).ToLocalTime().ToString("HH"));
|
|
|
tchDays.Add(hour, val);
|
|
|
if (allDays.ContainsKey(hour))
|
|
|
allDays[hour] = (allDays[hour] + val);
|
|
@@ -135,7 +135,7 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
foreach (var item in hourTchCnt)
|
|
|
{
|
|
|
await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Login:IES:teacher:{dateDay}", $"{item.key}", item.value);//存一天24小时
|
|
|
- var hour = DateTime.SpecifyKind(Convert.ToDateTime($"{dateTime.Year}/{dateTime.Month}/{ dateTime.Day} {item.key}:00:00"), DateTimeKind.Utc).ToLocalTime().ToString("HH:mm");
|
|
|
+ var hour = int.Parse(DateTime.SpecifyKind(Convert.ToDateTime($"{dateTime.Year}/{dateTime.Month}/{ dateTime.Day} {item.key}:00:00"), DateTimeKind.Utc).ToLocalTime().ToString("HH"));
|
|
|
tchDays.Add(hour, item.value);
|
|
|
if (allDays.ContainsKey(hour))
|
|
|
allDays[hour] = (allDays[hour] + item.value);
|
|
@@ -152,7 +152,7 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
{
|
|
|
int val = (int)item.Score;
|
|
|
int key = (int)item.Element;
|
|
|
- var hour = DateTime.SpecifyKind(Convert.ToDateTime($"{dateTime.Year}/{dateTime.Month}/{ dateTime.Day} {key}:00:00"), DateTimeKind.Utc).ToLocalTime().ToString("HH:mm");
|
|
|
+ var hour = int.Parse(DateTime.SpecifyKind(Convert.ToDateTime($"{dateTime.Year}/{dateTime.Month}/{ dateTime.Day} {key}:00:00"), DateTimeKind.Utc).ToLocalTime().ToString("HH"));
|
|
|
stuDays.Add(hour, val);
|
|
|
if (allDays.ContainsKey(hour))
|
|
|
allDays[hour] = (allDays[hour] + val);
|
|
@@ -172,7 +172,7 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
foreach (var item in hourStuCnt)
|
|
|
{
|
|
|
await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Login:IES:student:{dateDay}", $"{item.key}", item.value);//存一天24小时
|
|
|
- var hour = DateTime.SpecifyKind(Convert.ToDateTime($"{dateTime.Year}/{dateTime.Month}/{ dateTime.Day} {item.key}:00:00"), DateTimeKind.Utc).ToLocalTime().ToString("HH:mm");
|
|
|
+ var hour = int.Parse(DateTime.SpecifyKind(Convert.ToDateTime($"{dateTime.Year}/{dateTime.Month}/{ dateTime.Day} {item.key}:00:00"), DateTimeKind.Utc).ToLocalTime().ToString("HH"));
|
|
|
stuDays.Add(hour, item.value);
|
|
|
if (allDays.ContainsKey(hour))
|
|
|
allDays[hour] = (allDays[hour] + item.value);
|
|
@@ -189,7 +189,7 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
{
|
|
|
int val = (int)item.Score;
|
|
|
int key = (int)item.Element;
|
|
|
- var hour = DateTime.SpecifyKind(Convert.ToDateTime($"{dateTime.Year}/{dateTime.Month}/{ dateTime.Day} {key}:00:00"), DateTimeKind.Utc).ToLocalTime().ToString("HH:mm");
|
|
|
+ var hour = int.Parse(DateTime.SpecifyKind(Convert.ToDateTime($"{dateTime.Year}/{dateTime.Month}/{ dateTime.Day} {key}:00:00"), DateTimeKind.Utc).ToLocalTime().ToString("HH"));
|
|
|
tmdDays.Add(hour, val);
|
|
|
if (allDays.ContainsKey(hour))
|
|
|
allDays[hour] = (allDays[hour] + val);
|
|
@@ -208,7 +208,7 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
foreach (var item in hourTmdCnt)
|
|
|
{
|
|
|
await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Login:IES:tmduser:{dateDay}", $"{item.key}", item.value);//存一天24小时
|
|
|
- var hour = DateTime.SpecifyKind(Convert.ToDateTime($"{dateTime.Year}/{dateTime.Month}/{ dateTime.Day} {item.key}:00:00"), DateTimeKind.Utc).ToLocalTime().ToString("HH:mm");
|
|
|
+ var hour = int.Parse(DateTime.SpecifyKind(Convert.ToDateTime($"{dateTime.Year}/{dateTime.Month}/{ dateTime.Day} {item.key}:00:00"), DateTimeKind.Utc).ToLocalTime().ToString("HH"));
|
|
|
tmdDays.Add(hour, item.value);
|
|
|
if (allDays.ContainsKey(hour))
|
|
|
allDays[hour] = (allDays[hour] + item.value);
|
|
@@ -218,7 +218,7 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return Ok(new { state = 200,allDays = allDays.ToList(), tchDays=tchDays.ToList(), stuDays= stuDays.ToList(), tmdDays= tmdDays.ToList() });
|
|
|
+ return Ok(new { state = 200,allDays = allDays.OrderBy(o=>o.Key).ToList(), tchDays=tchDays.OrderBy(o => o.Key).ToList(), stuDays= stuDays.OrderBy(o => o.Key).ToList(), tmdDays= tmdDays.OrderBy(o => o.Key).ToList() });
|
|
|
}
|
|
|
|
|
|
/// <summary>
|