|
@@ -211,7 +211,7 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (termDayS.Year < dateOff.Year)
|
|
|
+ if (termDayS.Year < dateOff.Year)
|
|
|
{
|
|
|
if (lastLesson != null)
|
|
|
{
|
|
@@ -327,7 +327,7 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
{
|
|
|
using var fileJson = await JsonDocument.ParseAsync(resLastStats.ContentStream);
|
|
|
lastStats = fileJson.ToObject<StatsInfo>();
|
|
|
- lastAct = DenseMatrix.OfColumns(new List<List<double>>() { lastStats.activity.year });
|
|
|
+ lastAct = DenseMatrix.OfColumns(new List<List<double>>() { lastStats.activity.year });
|
|
|
}
|
|
|
|
|
|
int lastDayCnt = 0;
|
|
@@ -404,16 +404,16 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
}
|
|
|
statsInfo.activity.term = term;
|
|
|
int lastMonth = 0;
|
|
|
- if (lMonthS.Year < dateOff.Year)
|
|
|
+ if (lMonthS.Year < dateOff.Year)
|
|
|
{
|
|
|
- if (lastAct != null)
|
|
|
+ if (lastAct != null)
|
|
|
{
|
|
|
- lastMonth = ((int)lastAct.SubMatrix(lMonthS.DayOfYear-1, lmthDay, 0, matris.ColumnCount).ColumnSums().Sum());
|
|
|
+ lastMonth = ((int)lastAct.SubMatrix(lMonthS.DayOfYear - 1, lmthDay, 0, matris.ColumnCount).ColumnSums().Sum());
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- lastMonth = ((int)matris.SubMatrix(lMonthS.DayOfYear-1, lmthDay, 0, matris.ColumnCount).ColumnSums().Sum());
|
|
|
+ lastMonth = ((int)matris.SubMatrix(lMonthS.DayOfYear - 1, lmthDay, 0, matris.ColumnCount).ColumnSums().Sum());
|
|
|
}
|
|
|
statsInfo.activity.lastMonth = lastMonth;
|
|
|
statsInfo.activity.month += ((int)matris.SubMatrix(monthDayS.DayOfYear, (dateOff.DayOfYear - monthDayS.DayOfYear), 0, matris.ColumnCount).ColumnSums().Sum());
|
|
@@ -442,7 +442,7 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
/// <param name="cosmosClient"></param>
|
|
|
/// <param name="school"></param>
|
|
|
/// <returns></returns>
|
|
|
- public static async Task SetScStatsInfo(CosmosClient cosmosClient, DingDing _dingDing,School school)
|
|
|
+ public static async Task SetScStatsInfo(CosmosClient cosmosClient, DingDing _dingDing, School school)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -567,7 +567,7 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
/// <returns></returns>
|
|
|
public static async Task SetStatsZeroPoint(AzureCosmosFactory _azureCosmos, DingDing _dingDing)
|
|
|
{
|
|
|
- string scId = null;
|
|
|
+ List<string> scId = new();
|
|
|
try
|
|
|
{
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
@@ -614,266 +614,270 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
{
|
|
|
foreach (var item in tempStatsInfos)
|
|
|
{
|
|
|
- scId = item.schoolId;
|
|
|
- StatsInfo lastStatsInfo = null;
|
|
|
- DenseMatrix lastTch = null;
|
|
|
- DenseMatrix lastStu = null;
|
|
|
- DenseMatrix lastLesson = null;
|
|
|
- DenseMatrix lastInter = null;
|
|
|
- DenseMatrix lastAct = null;
|
|
|
- var lastSts = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Common").ReadItemStreamAsync($"{dateOff.Year - 1}-{item.schoolId}", new PartitionKey("Statistics"));
|
|
|
- if (lastSts.Status == 200)
|
|
|
+ try
|
|
|
{
|
|
|
- using var fileJson = await JsonDocument.ParseAsync(lastSts.ContentStream);
|
|
|
- lastStatsInfo = fileJson.ToObject<StatsInfo>();
|
|
|
- item.schoolId = lastStatsInfo.schoolId;
|
|
|
- item.year = dateOff.Year;
|
|
|
- item.picture = lastStatsInfo.picture;
|
|
|
- item.name = lastStatsInfo.name;
|
|
|
- item.areaId = lastStatsInfo.areaId;
|
|
|
- item.size = lastStatsInfo.size;
|
|
|
- item.useSize = lastStatsInfo.useSize;
|
|
|
- item.tch = lastStatsInfo.tch;
|
|
|
- lastTch = DenseMatrix.OfColumns(new List<List<double>>() { lastStatsInfo.tchYear });
|
|
|
- lastStu = DenseMatrix.OfColumns(new List<List<double>>() { lastStatsInfo.stuYear});
|
|
|
- lastLesson = DenseMatrix.OfColumns(new List<List<double>>() { lastStatsInfo.lesson.year });
|
|
|
- lastInter = DenseMatrix.OfColumns(new List<List<double>>() { lastStatsInfo.lesson.yearInters });
|
|
|
- lastAct = DenseMatrix.OfColumns(new List<List<double>>() { lastStatsInfo.activity.year });
|
|
|
- }
|
|
|
-
|
|
|
- var tchList = DenseMatrix.OfColumns(new List<List<double>>() { item.tchYear });
|
|
|
- var stuList = DenseMatrix.OfColumns(new List<List<double>>() { item.stuYear });
|
|
|
- int dayTch = 0;
|
|
|
- int dayStu = 0;
|
|
|
- int lastDayLesson = 0;
|
|
|
- int lastDayAct = 0;
|
|
|
- if (lastDay.Year < dateOff.Year)
|
|
|
- {
|
|
|
- if (lastStatsInfo != null)
|
|
|
+ StatsInfo lastStatsInfo = null;
|
|
|
+ DenseMatrix lastTch = null;
|
|
|
+ DenseMatrix lastStu = null;
|
|
|
+ DenseMatrix lastLesson = null;
|
|
|
+ DenseMatrix lastInter = null;
|
|
|
+ DenseMatrix lastAct = null;
|
|
|
+ var lastSts = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Common").ReadItemStreamAsync($"{dateOff.Year - 1}-{item.schoolId}", new PartitionKey("Statistics"));
|
|
|
+ if (lastSts.Status == 200)
|
|
|
+ {
|
|
|
+ using var fileJson = await JsonDocument.ParseAsync(lastSts.ContentStream);
|
|
|
+ lastStatsInfo = fileJson.ToObject<StatsInfo>();
|
|
|
+ item.schoolId = lastStatsInfo.schoolId;
|
|
|
+ item.year = dateOff.Year;
|
|
|
+ item.picture = lastStatsInfo.picture;
|
|
|
+ item.name = lastStatsInfo.name;
|
|
|
+ item.areaId = lastStatsInfo.areaId;
|
|
|
+ item.size = lastStatsInfo.size;
|
|
|
+ item.useSize = lastStatsInfo.useSize;
|
|
|
+ item.tch = lastStatsInfo.tch;
|
|
|
+ lastTch = DenseMatrix.OfColumns(new List<List<double>>() { lastStatsInfo.tchYear });
|
|
|
+ lastStu = DenseMatrix.OfColumns(new List<List<double>>() { lastStatsInfo.stuYear });
|
|
|
+ lastLesson = DenseMatrix.OfColumns(new List<List<double>>() { lastStatsInfo.lesson.year });
|
|
|
+ lastInter = DenseMatrix.OfColumns(new List<List<double>>() { lastStatsInfo.lesson.yearInters });
|
|
|
+ lastAct = DenseMatrix.OfColumns(new List<List<double>>() { lastStatsInfo.activity.year });
|
|
|
+ }
|
|
|
+
|
|
|
+ var tchList = DenseMatrix.OfColumns(new List<List<double>>() { item.tchYear });
|
|
|
+ var stuList = DenseMatrix.OfColumns(new List<List<double>>() { item.stuYear });
|
|
|
+ int dayTch = 0;
|
|
|
+ int dayStu = 0;
|
|
|
+ int lastDayLesson = 0;
|
|
|
+ int lastDayAct = 0;
|
|
|
+ if (lastDay.Year < dateOff.Year)
|
|
|
{
|
|
|
- dayTch =((int)lastStatsInfo.tchYear[lastDay.DayOfYear - 1]);
|
|
|
- dayStu = ((int)lastStatsInfo.stuYear[lastDay.DayOfYear - 1]);
|
|
|
- lastDayLesson = ((int)lastStatsInfo.lesson.year[lastDay.DayOfYear - 1]);
|
|
|
- lastDayAct = ((int)lastStatsInfo.activity.year[lastDay.DayOfYear - 1]);
|
|
|
+ if (lastStatsInfo != null)
|
|
|
+ {
|
|
|
+ dayTch = ((int)lastStatsInfo.tchYear[lastDay.DayOfYear - 1]);
|
|
|
+ dayStu = ((int)lastStatsInfo.stuYear[lastDay.DayOfYear - 1]);
|
|
|
+ lastDayLesson = ((int)lastStatsInfo.lesson.year[lastDay.DayOfYear - 1]);
|
|
|
+ lastDayAct = ((int)lastStatsInfo.activity.year[lastDay.DayOfYear - 1]);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- dayTch = ((int)item.tchYear[dateOff.DayOfYear - 1]);
|
|
|
- dayStu = ((int)item.stuYear[dateOff.DayOfYear - 1]);
|
|
|
- lastDayLesson = ((int)item.lesson.year[lastDay.DayOfYear - 1]);
|
|
|
- lastDayAct =((int)item.activity.year[lastDay.DayOfYear - 1]);
|
|
|
- }
|
|
|
- item.dayTch = dayTch;
|
|
|
- int weekTch = 0;
|
|
|
- int weekStu = 0;
|
|
|
- if (weekDayS.Year < dateOff.Year)
|
|
|
- {
|
|
|
- if (lastTch != null)
|
|
|
+ else
|
|
|
{
|
|
|
- weekTch += ((int)lastTch.SubMatrix(weekDayS.DayOfYear - 1, lastTch.RowCount - weekDayS.DayOfYear + 1, 0, lastTch.ColumnCount).ColumnSums().Sum());
|
|
|
+ dayTch = ((int)item.tchYear[dateOff.DayOfYear - 1]);
|
|
|
+ dayStu = ((int)item.stuYear[dateOff.DayOfYear - 1]);
|
|
|
+ lastDayLesson = ((int)item.lesson.year[lastDay.DayOfYear - 1]);
|
|
|
+ lastDayAct = ((int)item.activity.year[lastDay.DayOfYear - 1]);
|
|
|
}
|
|
|
- weekTch += ((int)tchList.SubMatrix(0, weekDayE.DayOfYear + 1, 0, tchList.ColumnCount).ColumnSums().Sum());
|
|
|
-
|
|
|
- if (lastStu != null)
|
|
|
+ item.dayTch = dayTch;
|
|
|
+ int weekTch = 0;
|
|
|
+ int weekStu = 0;
|
|
|
+ if (weekDayS.Year < dateOff.Year)
|
|
|
{
|
|
|
- weekStu += ((int)lastStu.SubMatrix(weekDayS.DayOfYear - 1, lastStu.RowCount - weekDayS.DayOfYear + 1, 0, lastStu.ColumnCount).ColumnSums().Sum());
|
|
|
+ if (lastTch != null)
|
|
|
+ {
|
|
|
+ weekTch += ((int)lastTch.SubMatrix(weekDayS.DayOfYear - 1, lastTch.RowCount - weekDayS.DayOfYear + 1, 0, lastTch.ColumnCount).ColumnSums().Sum());
|
|
|
+ }
|
|
|
+ weekTch += ((int)tchList.SubMatrix(0, weekDayE.DayOfYear + 1, 0, tchList.ColumnCount).ColumnSums().Sum());
|
|
|
+
|
|
|
+ if (lastStu != null)
|
|
|
+ {
|
|
|
+ weekStu += ((int)lastStu.SubMatrix(weekDayS.DayOfYear - 1, lastStu.RowCount - weekDayS.DayOfYear + 1, 0, lastStu.ColumnCount).ColumnSums().Sum());
|
|
|
+ }
|
|
|
+ weekStu += ((int)lastStu.SubMatrix(0, weekDayE.DayOfYear + 1, 0, lastStu.ColumnCount).ColumnSums().Sum());
|
|
|
}
|
|
|
- weekStu += ((int)lastStu.SubMatrix(0, weekDayE.DayOfYear + 1, 0, lastStu.ColumnCount).ColumnSums().Sum());
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- weekTch = ((int)tchList.SubMatrix(weekDayS.DayOfYear - 1, 7, 0, tchList.ColumnCount).ColumnSums().Sum());
|
|
|
- weekStu = ((int)stuList.SubMatrix(weekDayS.DayOfYear - 1, 7, 0, stuList.ColumnCount).ColumnSums().Sum());
|
|
|
- }
|
|
|
- item.weekTch = weekTch;
|
|
|
- item.monthTch = ((int)tchList.SubMatrix(monthDayS.DayOfYear - 1, (dateOff.DayOfYear - monthDayS.DayOfYear + 1), 0, tchList.ColumnCount).ColumnSums().Sum());
|
|
|
- item.tchUpTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
-
|
|
|
- item.dayStu = dayStu;
|
|
|
- item.weekStu = weekStu;
|
|
|
- item.monthStu = ((int)stuList.SubMatrix(monthDayS.DayOfYear - 1, (dateOff.DayOfYear - monthDayS.DayOfYear + 1), 0, stuList.ColumnCount).ColumnSums().Sum());
|
|
|
- item.stuUpTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
-
|
|
|
- var lessList = DenseMatrix.OfColumns(new List<List<double>>() { item.lesson.year });
|
|
|
- var interList = DenseMatrix.OfColumns(new List<List<double>>() { item.lesson.yearInters });
|
|
|
- var actList = DenseMatrix.OfColumns(new List<List<double>>() { item.activity.year });
|
|
|
- item.lesson.lastDay = lastDayLesson;
|
|
|
-
|
|
|
- int lastWeekLesson = 0;
|
|
|
- int lastWeekAct = 0;
|
|
|
- if (lWeekDayS.Year != dateOff.Year)
|
|
|
- {
|
|
|
- if (lastLesson != null)
|
|
|
+ else
|
|
|
{
|
|
|
- lastWeekLesson += ((int)lastLesson.SubMatrix(lWeekDayS.DayOfYear - 1, lastLesson.RowCount - lWeekDayS.DayOfYear + 1, 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
+ weekTch = ((int)tchList.SubMatrix(weekDayS.DayOfYear - 1, 7, 0, tchList.ColumnCount).ColumnSums().Sum());
|
|
|
+ weekStu = ((int)stuList.SubMatrix(weekDayS.DayOfYear - 1, 7, 0, stuList.ColumnCount).ColumnSums().Sum());
|
|
|
}
|
|
|
- lastWeekLesson += ((int)lessList.SubMatrix(0, lWeekDayE.DayOfYear, 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
+ item.weekTch = weekTch;
|
|
|
+ item.monthTch = ((int)tchList.SubMatrix(monthDayS.DayOfYear - 1, (dateOff.DayOfYear - monthDayS.DayOfYear + 1), 0, tchList.ColumnCount).ColumnSums().Sum());
|
|
|
+ item.tchUpTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
|
|
|
- if (lastAct !=null)
|
|
|
- {
|
|
|
- lastWeekAct += ((int)lastAct.SubMatrix(lWeekDayS.DayOfYear - 1, lastAct.RowCount - lWeekDayS.DayOfYear + 1, 0, lastAct.ColumnCount).ColumnSums().Sum());
|
|
|
- }
|
|
|
- lastWeekAct += ((int)lastAct.SubMatrix(0, lWeekDayE.DayOfYear, 0, lastAct.ColumnCount).ColumnSums().Sum());
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- lastWeekLesson = ((int)lessList.SubMatrix(lWeekDayS.DayOfYear - 1, lWeekDayE.DayOfYear - lWeekDayS.DayOfYear + 1, 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
- lastWeekAct = ((int)actList.SubMatrix(lWeekDayS.DayOfYear - 1, 7, 0, actList.ColumnCount).ColumnSums().Sum());
|
|
|
- }
|
|
|
- item.lesson.lastWeek = lastWeekLesson;
|
|
|
- item.lesson.week = ((int)lessList.SubMatrix(weekDayS.DayOfYear - 1, (dateOff.DayOfYear - weekDayS.DayOfYear + 1), 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
+ item.dayStu = dayStu;
|
|
|
+ item.weekStu = weekStu;
|
|
|
+ item.monthStu = ((int)stuList.SubMatrix(monthDayS.DayOfYear - 1, (dateOff.DayOfYear - monthDayS.DayOfYear + 1), 0, stuList.ColumnCount).ColumnSums().Sum());
|
|
|
+ item.stuUpTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
|
|
|
- int lastTerm = 0;
|
|
|
- if (lTermDayS.Year < dateOff.Year)
|
|
|
- {
|
|
|
- if (lastLesson != null)
|
|
|
+ var lessList = DenseMatrix.OfColumns(new List<List<double>>() { item.lesson.year });
|
|
|
+ var interList = DenseMatrix.OfColumns(new List<List<double>>() { item.lesson.yearInters });
|
|
|
+ var actList = DenseMatrix.OfColumns(new List<List<double>>() { item.activity.year });
|
|
|
+ item.lesson.lastDay = lastDayLesson;
|
|
|
+
|
|
|
+ int lastWeekLesson = 0;
|
|
|
+ int lastWeekAct = 0;
|
|
|
+ if (lWeekDayS.Year != dateOff.Year)
|
|
|
{
|
|
|
- lastTerm += ((int)lastLesson.SubMatrix(lTermDayS.DayOfYear - 1, lastStatsInfo.lesson.year.Count - lTermDayS.DayOfYear + 1, 0, 1).ColumnSums().Sum());
|
|
|
- }
|
|
|
- lastTerm += ((int)lessList.SubMatrix(0, lTermDayE.DayOfYear, 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- lastTerm += ((int)lessList.SubMatrix(lTermDayS.DayOfYear - 1, lTermDayE.DayOfYear - lTermDayS.DayOfYear + 1, 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
- }
|
|
|
- item.lesson.lastTerm = lastTerm;
|
|
|
+ if (lastLesson != null)
|
|
|
+ {
|
|
|
+ lastWeekLesson += ((int)lastLesson.SubMatrix(lWeekDayS.DayOfYear - 1, lastLesson.RowCount - lWeekDayS.DayOfYear + 1, 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
+ }
|
|
|
+ lastWeekLesson += ((int)lessList.SubMatrix(0, lWeekDayE.DayOfYear, 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
|
|
|
- int term = 0;
|
|
|
- if (termDayE.Year > dateOff.Year)
|
|
|
- {
|
|
|
- if (lessList != null)
|
|
|
+ if (lastAct != null)
|
|
|
+ {
|
|
|
+ lastWeekAct += ((int)lastAct.SubMatrix(lWeekDayS.DayOfYear - 1, lastAct.RowCount - lWeekDayS.DayOfYear + 1, 0, lastAct.ColumnCount).ColumnSums().Sum());
|
|
|
+ }
|
|
|
+ lastWeekAct += ((int)lastAct.SubMatrix(0, lWeekDayE.DayOfYear, 0, lastAct.ColumnCount).ColumnSums().Sum());
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- term = ((int)lessList.SubMatrix(termDayS.DayOfYear - 1, (lessList.RowCount - termDayS.DayOfYear + 1), 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
+ lastWeekLesson = ((int)lessList.SubMatrix(lWeekDayS.DayOfYear - 1, lWeekDayE.DayOfYear - lWeekDayS.DayOfYear + 1, 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
+ lastWeekAct = ((int)actList.SubMatrix(lWeekDayS.DayOfYear - 1, 7, 0, actList.ColumnCount).ColumnSums().Sum());
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (termDayS.Year < dateOff.Year)
|
|
|
+ item.lesson.lastWeek = lastWeekLesson;
|
|
|
+ item.lesson.week = ((int)lessList.SubMatrix(weekDayS.DayOfYear - 1, (dateOff.DayOfYear - weekDayS.DayOfYear + 1), 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
+
|
|
|
+ int lastTerm = 0;
|
|
|
+ if (lTermDayS.Year < dateOff.Year)
|
|
|
{
|
|
|
if (lastLesson != null)
|
|
|
{
|
|
|
- term += ((int)lastLesson.SubMatrix(termDayS.DayOfYear - 1, lastLesson.RowCount - termDayS.DayOfYear + 1, 0, lastLesson.ColumnCount).ColumnSums().Sum());
|
|
|
+ lastTerm += ((int)lastLesson.SubMatrix(lTermDayS.DayOfYear - 1, lastStatsInfo.lesson.year.Count - lTermDayS.DayOfYear + 1, 0, 1).ColumnSums().Sum());
|
|
|
}
|
|
|
- term += ((int)lessList.SubMatrix(0, termDayE.DayOfYear, 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
+ lastTerm += ((int)lessList.SubMatrix(0, lTermDayE.DayOfYear, 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- term = ((int)lessList.SubMatrix(termDayS.DayOfYear - 1, termDayE.DayOfYear - termDayS.DayOfYear + 1, 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
+ lastTerm += ((int)lessList.SubMatrix(lTermDayS.DayOfYear - 1, lTermDayE.DayOfYear - lTermDayS.DayOfYear + 1, 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
}
|
|
|
- }
|
|
|
- item.lesson.term = term;
|
|
|
- item.lesson.day = 0;
|
|
|
+ item.lesson.lastTerm = lastTerm;
|
|
|
|
|
|
- int lastMonth = 0;
|
|
|
- int lastMonthInter = 0;
|
|
|
- int lastMonthAct = 0;
|
|
|
- if (lMonthS.Year < dateOff.Year)
|
|
|
- {
|
|
|
- if (lastLesson != null)
|
|
|
+ int term = 0;
|
|
|
+ if (termDayE.Year > dateOff.Year)
|
|
|
{
|
|
|
- lastMonth = ((int)lastLesson.SubMatrix(lMonthS.DayOfYear - 1, lmthDay, 0, lastLesson.ColumnCount).ColumnSums().Sum());
|
|
|
+ if (lessList != null)
|
|
|
+ {
|
|
|
+ term = ((int)lessList.SubMatrix(termDayS.DayOfYear - 1, (lessList.RowCount - termDayS.DayOfYear + 1), 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- if (lastInter != null)
|
|
|
+ else
|
|
|
{
|
|
|
- lastMonthInter = ((int)lastInter.SubMatrix(lMonthS.DayOfYear - 1, lmthDay, 0, lastInter.ColumnCount).ColumnSums().Sum());
|
|
|
+ if (termDayS.Year < dateOff.Year)
|
|
|
+ {
|
|
|
+ if (lastLesson != null)
|
|
|
+ {
|
|
|
+ term += ((int)lastLesson.SubMatrix(termDayS.DayOfYear - 1, lastLesson.RowCount - termDayS.DayOfYear + 1, 0, lastLesson.ColumnCount).ColumnSums().Sum());
|
|
|
+ }
|
|
|
+ term += ((int)lessList.SubMatrix(0, termDayE.DayOfYear, 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ term = ((int)lessList.SubMatrix(termDayS.DayOfYear - 1, termDayE.DayOfYear - termDayS.DayOfYear + 1, 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
+ }
|
|
|
}
|
|
|
+ item.lesson.term = term;
|
|
|
+ item.lesson.day = 0;
|
|
|
+
|
|
|
+ int lastMonth = 0;
|
|
|
+ int lastMonthInter = 0;
|
|
|
+ int lastMonthAct = 0;
|
|
|
+ if (lMonthS.Year < dateOff.Year)
|
|
|
+ {
|
|
|
+ if (lastLesson != null)
|
|
|
+ {
|
|
|
+ lastMonth = ((int)lastLesson.SubMatrix(lMonthS.DayOfYear - 1, lmthDay, 0, lastLesson.ColumnCount).ColumnSums().Sum());
|
|
|
+ }
|
|
|
|
|
|
- if (lastAct != null)
|
|
|
+ if (lastInter != null)
|
|
|
+ {
|
|
|
+ lastMonthInter = ((int)lastInter.SubMatrix(lMonthS.DayOfYear - 1, lmthDay, 0, lastInter.ColumnCount).ColumnSums().Sum());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (lastAct != null)
|
|
|
+ {
|
|
|
+ lastMonthAct = ((int)lastAct.SubMatrix(lMonthS.DayOfYear - 1, lmthDay, 0, lastAct.ColumnCount).ColumnSums().Sum());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- lastMonthAct = ((int)lastAct.SubMatrix(lMonthS.DayOfYear - 1, lmthDay, 0, lastAct.ColumnCount).ColumnSums().Sum());
|
|
|
+ lastMonth = ((int)lessList.SubMatrix(lMonthS.DayOfYear - 1, lmthDay, 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
+ lastMonthInter = ((int)interList.SubMatrix(lMonthS.DayOfYear - 1, lmthDay, 0, interList.ColumnCount).ColumnSums().Sum());
|
|
|
+ lastMonthAct = ((int)actList.SubMatrix(lMonthS.DayOfYear - 1, lmthDay, 0, actList.ColumnCount).ColumnSums().Sum());
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- lastMonth = ((int)lessList.SubMatrix(lMonthS.DayOfYear - 1, lmthDay, 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
- lastMonthInter = ((int)interList.SubMatrix(lMonthS.DayOfYear - 1, lmthDay, 0, interList.ColumnCount).ColumnSums().Sum());
|
|
|
- lastMonthAct = ((int)actList.SubMatrix(lMonthS.DayOfYear - 1, lmthDay, 0, actList.ColumnCount).ColumnSums().Sum());
|
|
|
- }
|
|
|
- item.lesson.lastMonth = lastMonth;
|
|
|
- item.lesson.month += ((int)lessList.SubMatrix(monthDayS.DayOfYear - 1, (dateOff.DayOfYear - monthDayS.DayOfYear + 1), 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
- item.lesson.upTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
+ item.lesson.lastMonth = lastMonth;
|
|
|
+ item.lesson.month += ((int)lessList.SubMatrix(monthDayS.DayOfYear - 1, (dateOff.DayOfYear - monthDayS.DayOfYear + 1), 0, lessList.ColumnCount).ColumnSums().Sum());
|
|
|
+ item.lesson.upTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
|
|
|
- int lastDayInter = 0;
|
|
|
- if (lastDay.Year < dateOff.Year)
|
|
|
- {
|
|
|
- if (lastStatsInfo.lesson.yearInters.Count > 0)
|
|
|
+ int lastDayInter = 0;
|
|
|
+ if (lastDay.Year < dateOff.Year)
|
|
|
{
|
|
|
- lastDayInter = ((int)lastStatsInfo.lesson.yearInters[lastDay.DayOfYear - 1]);
|
|
|
+ if (lastStatsInfo.lesson.yearInters.Count > 0)
|
|
|
+ {
|
|
|
+ lastDayInter = ((int)lastStatsInfo.lesson.yearInters[lastDay.DayOfYear - 1]);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- lastDayInter = ((int)item.lesson.yearInters[lastDay.DayOfYear - 1]);
|
|
|
- }
|
|
|
- item.lesson.lastDayInter = lastDayInter;
|
|
|
- item.lesson.dayInter = 0;
|
|
|
-
|
|
|
- item.lesson.lastMonthInter = lastMonthInter;
|
|
|
- item.lesson.monthInter = ((int)interList.SubMatrix(monthDayS.DayOfYear - 1, (dateOff.DayOfYear - monthDayS.DayOfYear + 1), 0, interList.ColumnCount).ColumnSums().Sum());
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lastDayInter = ((int)item.lesson.yearInters[lastDay.DayOfYear - 1]);
|
|
|
+ }
|
|
|
+ item.lesson.lastDayInter = lastDayInter;
|
|
|
+ item.lesson.dayInter = 0;
|
|
|
|
|
|
- if (lastStatsInfo != null)
|
|
|
- {
|
|
|
- if (lastInter != null)
|
|
|
+ item.lesson.lastMonthInter = lastMonthInter;
|
|
|
+ item.lesson.monthInter = ((int)interList.SubMatrix(monthDayS.DayOfYear - 1, (dateOff.DayOfYear - monthDayS.DayOfYear + 1), 0, interList.ColumnCount).ColumnSums().Sum());
|
|
|
+
|
|
|
+ if (lastStatsInfo != null)
|
|
|
{
|
|
|
- item.lesson.lastYearInter = ((int)lastInter.SubMatrix(0, lastInter.RowCount, 0, lastInter.ColumnCount).ColumnSums().Sum());
|
|
|
+ if (lastInter != null)
|
|
|
+ {
|
|
|
+ item.lesson.lastYearInter = ((int)lastInter.SubMatrix(0, lastInter.RowCount, 0, lastInter.ColumnCount).ColumnSums().Sum());
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- item.lesson.yearInter = ((int)item.lesson.yearInters.Sum());
|
|
|
+ item.lesson.yearInter = ((int)item.lesson.yearInters.Sum());
|
|
|
|
|
|
- item.activity.dayCnt = ((int)item.activity.year[dateOff.DayOfYear - 1]);
|
|
|
- item.activity.lastDay = lastDayAct;
|
|
|
- item.activity.lastWeek = lastWeekAct;
|
|
|
- item.activity.week = ((int)actList.SubMatrix(weekDayS.DayOfYear - 1, (dateOff.DayOfYear - monthDayS.DayOfYear + 1), 0, actList.ColumnCount).ColumnSums().Sum());
|
|
|
+ item.activity.dayCnt = ((int)item.activity.year[dateOff.DayOfYear - 1]);
|
|
|
+ item.activity.lastDay = lastDayAct;
|
|
|
+ item.activity.lastWeek = lastWeekAct;
|
|
|
+ item.activity.week = ((int)actList.SubMatrix(weekDayS.DayOfYear - 1, (dateOff.DayOfYear - monthDayS.DayOfYear + 1), 0, actList.ColumnCount).ColumnSums().Sum());
|
|
|
|
|
|
- item.activity.lastMonth = lastMonthAct;
|
|
|
+ item.activity.lastMonth = lastMonthAct;
|
|
|
|
|
|
- int lastTermAct = 0;
|
|
|
- if (lTermDayS.Year < dateOff.Year)
|
|
|
- {
|
|
|
- if (lastAct != null)
|
|
|
+ int lastTermAct = 0;
|
|
|
+ if (lTermDayS.Year < dateOff.Year)
|
|
|
{
|
|
|
- lastTermAct += ((int)lastAct.SubMatrix(lTermDayS.DayOfYear - 1, lastStatsInfo.activity.year.Count - lTermDayS.DayOfYear + 1, 0, lastAct.ColumnCount).ColumnSums().Sum());
|
|
|
+ if (lastAct != null)
|
|
|
+ {
|
|
|
+ lastTermAct += ((int)lastAct.SubMatrix(lTermDayS.DayOfYear - 1, lastStatsInfo.activity.year.Count - lTermDayS.DayOfYear + 1, 0, lastAct.ColumnCount).ColumnSums().Sum());
|
|
|
+ }
|
|
|
+ lastTermAct += ((int)actList.SubMatrix(0, lTermDayE.DayOfYear, 0, actList.ColumnCount).ColumnSums().Sum());
|
|
|
}
|
|
|
- lastTermAct += ((int)actList.SubMatrix(0, lTermDayE.DayOfYear, 0, actList.ColumnCount).ColumnSums().Sum());
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- lastTermAct += ((int)actList.SubMatrix(lTermDayS.DayOfYear - 1, lTermDayE.DayOfYear - lTermDayS.DayOfYear + 1, 0, actList.ColumnCount).ColumnSums().Sum());
|
|
|
- }
|
|
|
- item.activity.lastTerm = lastTerm;
|
|
|
-
|
|
|
- int termAct = 0;
|
|
|
- if (termDayS.Year > dateOff.Year)
|
|
|
- {
|
|
|
- if (lastAct != null)
|
|
|
+ else
|
|
|
{
|
|
|
- termAct += ((int)lastAct.SubMatrix(termDayS.DayOfYear - 1, lastStatsInfo.activity.year.Count - termDayS.DayOfYear + 1, 0, lastAct.ColumnCount).ColumnSums().Sum());
|
|
|
+ lastTermAct += ((int)actList.SubMatrix(lTermDayS.DayOfYear - 1, lTermDayE.DayOfYear - lTermDayS.DayOfYear + 1, 0, actList.ColumnCount).ColumnSums().Sum());
|
|
|
}
|
|
|
- termAct += ((int)actList.SubMatrix(0, termDayE.DayOfYear + 1, 0, actList.ColumnCount).ColumnSums().Sum());
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (lTermDayS.Year < dateOff.Year)
|
|
|
+ item.activity.lastTerm = lastTerm;
|
|
|
+
|
|
|
+ int termAct = 0;
|
|
|
+ if (termDayS.Year > dateOff.Year)
|
|
|
{
|
|
|
if (lastAct != null)
|
|
|
{
|
|
|
- termAct += ((int)lastAct.SubMatrix(termDayS.DayOfYear - 1, lastStatsInfo.lesson.year.Count - termDayS.DayOfYear + 1, 0, 1).ColumnSums().Sum());
|
|
|
+ termAct += ((int)lastAct.SubMatrix(termDayS.DayOfYear - 1, lastStatsInfo.activity.year.Count - termDayS.DayOfYear + 1, 0, lastAct.ColumnCount).ColumnSums().Sum());
|
|
|
}
|
|
|
- termAct += ((int)actList.SubMatrix(0, termDayE.DayOfYear, 0, lastAct.ColumnCount).ColumnSums().Sum());
|
|
|
+ termAct += ((int)actList.SubMatrix(0, termDayE.DayOfYear + 1, 0, actList.ColumnCount).ColumnSums().Sum());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- termAct += ((int)actList.SubMatrix(termDayS.DayOfYear - 1, termDayE.DayOfYear - termDayS.DayOfYear + 1, 0, actList.ColumnCount).ColumnSums().Sum());
|
|
|
+ if (lTermDayS.Year < dateOff.Year)
|
|
|
+ {
|
|
|
+ if (lastAct != null)
|
|
|
+ {
|
|
|
+ termAct += ((int)lastAct.SubMatrix(termDayS.DayOfYear - 1, lastStatsInfo.lesson.year.Count - termDayS.DayOfYear + 1, 0, 1).ColumnSums().Sum());
|
|
|
+ }
|
|
|
+ termAct += ((int)actList.SubMatrix(0, termDayE.DayOfYear, 0, lastAct.ColumnCount).ColumnSums().Sum());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ termAct += ((int)actList.SubMatrix(termDayS.DayOfYear - 1, termDayE.DayOfYear - termDayS.DayOfYear + 1, 0, actList.ColumnCount).ColumnSums().Sum());
|
|
|
+ }
|
|
|
}
|
|
|
+ item.activity.term = term;
|
|
|
+ item.activity.upTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
+ statsInfos.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync<StatsInfo>(item, item.id, new PartitionKey("Statistics")));
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ scId.Add(item.schoolId);
|
|
|
}
|
|
|
- item.activity.term = term;
|
|
|
-
|
|
|
- item.activity.upTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
-
|
|
|
- statsInfos.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync<StatsInfo>(item, item.id, new PartitionKey("Statistics")));
|
|
|
}
|
|
|
|
|
|
if (statsInfos.Count < 256)
|
|
@@ -890,10 +894,12 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ await _dingDing.SendBotMsg($"BI,{Environment.GetEnvironmentVariable("Option:Location")},SetStatsZeroPoint() \n定时未清理学校id:{scId.ToJsonString()}", GroupNames.成都开发測試群組);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- await _dingDing.SendBotMsg($"BI,{Environment.GetEnvironmentVariable("Option:Location")},SetStatsZeroPoint() \n{scId} \n{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
|
|
|
+ await _dingDing.SendBotMsg($"BI,{Environment.GetEnvironmentVariable("Option:Location")},SetStatsZeroPoint() \n{scId.ToJsonString()} \n{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
|
|
|
}
|
|
|
}
|
|
|
}
|