|
@@ -14,7 +14,7 @@ using TEAMModelOS.SDK.Models.Cosmos.BI.BITable;
|
|
|
|
|
|
namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
{
|
|
|
- public class BILeeson
|
|
|
+ public class BILeesonService
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 通过时间戳保存开课记录和课例记录统计
|
|
@@ -239,6 +239,8 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 通过时间戳保存开课记录和课例记录统计
|
|
|
/// 统计数据存储在table表中
|
|
@@ -249,9 +251,10 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
/// <param name="unix">13位时间戳</param>
|
|
|
/// <param name="num">数量</param>
|
|
|
/// <param name="type">类型:0 开课记录 1 课例记录</param>
|
|
|
+ /// <param name="scope">范围(默认学校范围):学校 school 个人 private</param>
|
|
|
/// <param name="schoolId">学校编码</param>
|
|
|
/// <returns></returns>
|
|
|
- public static async Task SetTableStats(AzureStorageFactory _azureStorage, AzureRedisFactory _azureRedis, DingDing _dingDing, long unix, int num = 1, int type = 0, string schoolId = null)
|
|
|
+ public static async Task SetTableStats(AzureStorageFactory _azureStorage, AzureRedisFactory _azureRedis, DingDing _dingDing, long unix, int num = 1, int type = 0,string scope = "private", string schoolId = null)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -354,7 +357,7 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
if (lessYear.lesson != null)
|
|
|
{
|
|
|
double[] tempLess = Array.ConvertAll<string, double>(lessYear.lesson.Split(','), s => double.Parse(s));
|
|
|
- tempLess[hour] = tempLess[hour] + num;
|
|
|
+ tempLess[days] = tempLess[days] + num;
|
|
|
string sLess = string.Join(',', tempLess);
|
|
|
lessYear.lesson = sLess;
|
|
|
}
|
|
@@ -388,75 +391,8 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
}
|
|
|
catch { }
|
|
|
|
|
|
- //if (dayCnt != null && dayCnt.Length > 0)
|
|
|
- //{
|
|
|
- // double[] daHour = new double[23];
|
|
|
- // foreach (var item in dayCnt)
|
|
|
- // {
|
|
|
- // double val = ((double)item.Score);
|
|
|
- // int key = ((int)item.Element);
|
|
|
- // daHour[key] = val;
|
|
|
- // }
|
|
|
-
|
|
|
- // string hoursStats = string.Join(",", daHour);
|
|
|
- // LessStats lessStats = table.Get<LessStats>("LessonHour", $"{dateDay}");
|
|
|
- // if (lessStats != null)
|
|
|
- // {
|
|
|
- // if (type == 1)
|
|
|
- // lessStats.lesson = hoursStats;
|
|
|
- // else
|
|
|
- // lessStats.open = hoursStats;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // lessStats = new() { PartitionKey = "LessonHour", RowKey = $"{dateDay}" };
|
|
|
- // if (type == 1)
|
|
|
- // lessStats.lesson = hoursStats;
|
|
|
- // else
|
|
|
- // lessStats.open = hoursStats;
|
|
|
- // }
|
|
|
- // try
|
|
|
- // {
|
|
|
- // await table.SaveOrUpdate<LessStats>(lessStats);
|
|
|
- // }
|
|
|
- // catch {}
|
|
|
- //}
|
|
|
-
|
|
|
- //if (yearCnt != null && yearCnt.Length > 0)
|
|
|
- //{
|
|
|
- // double[] daYear = new double[yearDays];
|
|
|
- // foreach (var item in yearCnt)
|
|
|
- // {
|
|
|
- // double val = ((double)item.Score);
|
|
|
- // int key = ((int)item.Element);
|
|
|
- // daYear[key] = val;
|
|
|
- // }
|
|
|
- // string tempStats = string.Join(",", daYear);
|
|
|
- // LessStats lessStats = table.Get<LessStats>("LessonYear", $"{year}");
|
|
|
- // if (lessStats != null)
|
|
|
- // {
|
|
|
- // if (type == 1)
|
|
|
- // lessStats.lesson = tempStats;
|
|
|
- // else
|
|
|
- // lessStats.open = tempStats;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // lessStats = new() { PartitionKey = "LessonYear", RowKey = $"{year}" };
|
|
|
- // if (type == 1)
|
|
|
- // lessStats.lesson = tempStats;
|
|
|
- // else
|
|
|
- // lessStats.open = tempStats;
|
|
|
- // }
|
|
|
- // try
|
|
|
- // {
|
|
|
- // await table.SaveOrUpdate<LessStats>(lessStats);
|
|
|
- // }
|
|
|
- // catch { }
|
|
|
- //}
|
|
|
-
|
|
|
//保存学校课例数据
|
|
|
- if (!string.IsNullOrEmpty(schoolId))
|
|
|
+ if (!string.IsNullOrEmpty(schoolId) && scope.Equals("school"))
|
|
|
{
|
|
|
////保存学校当天的统计 小时
|
|
|
//SortedSetEntry[] dayScCnt = null;
|
|
@@ -539,7 +475,7 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
if (lessScYear.lesson != null)
|
|
|
{
|
|
|
double[] tempLess = Array.ConvertAll<string, double>(lessScYear.lesson.Split(','), s => double.Parse(s));
|
|
|
- tempLess[hour] = tempLess[hour] + num;
|
|
|
+ tempLess[days] = tempLess[days] + num;
|
|
|
string sLess = string.Join(',', tempLess);
|
|
|
lessScYear.lesson = sLess;
|
|
|
}
|
|
@@ -653,7 +589,7 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-SetBITableStats BI课例统计异常参数:{unix}|{num}|{type}|{schoolId} ;错误信息:{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
|
|
|
+ await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-SetBITableStats BI记录课例统计数据异常!参数:{unix}|{num}|{type}|{scope}|{schoolId} ;错误信息:{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
|
|
|
}
|
|
|
}
|
|
|
}
|