|
@@ -1,8 +1,11 @@
|
|
using Azure;
|
|
using Azure;
|
|
using Azure.Storage.Blobs.Models;
|
|
using Azure.Storage.Blobs.Models;
|
|
|
|
+using DocumentFormat.OpenXml.Drawing.Charts;
|
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
|
using DocumentFormat.OpenXml.Office2013.Drawing.ChartStyle;
|
|
using DocumentFormat.OpenXml.Office2013.Drawing.ChartStyle;
|
|
|
|
+using DocumentFormat.OpenXml.Office2016.Drawing.ChartDrawing;
|
|
using MathNet.Numerics;
|
|
using MathNet.Numerics;
|
|
|
|
+using MathNet.Numerics.Distributions;
|
|
using Microsoft.Azure.Cosmos;
|
|
using Microsoft.Azure.Cosmos;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.Logging;
|
|
using Microsoft.Extensions.Logging;
|
|
@@ -14,6 +17,7 @@ using System.IO;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Text;
|
|
|
|
+using System.Text.Json;
|
|
using System.Text.RegularExpressions;
|
|
using System.Text.RegularExpressions;
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
using System.Xml;
|
|
using System.Xml;
|
|
@@ -21,6 +25,7 @@ using TEAMModelOS.SDK;
|
|
using TEAMModelOS.SDK.DI;
|
|
using TEAMModelOS.SDK.DI;
|
|
using TEAMModelOS.SDK.Extension;
|
|
using TEAMModelOS.SDK.Extension;
|
|
using TEAMModelOS.SDK.Models;
|
|
using TEAMModelOS.SDK.Models;
|
|
|
|
+using TEAMModelOS.SDK.Models.Cosmos.Common;
|
|
using TEAMModelOS.SDK.Models.Cosmos.OpenEntity;
|
|
using TEAMModelOS.SDK.Models.Cosmos.OpenEntity;
|
|
|
|
|
|
namespace HTEX.Lib.ETL.Lesson
|
|
namespace HTEX.Lib.ETL.Lesson
|
|
@@ -28,12 +33,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
public class LessonETLService
|
|
public class LessonETLService
|
|
{
|
|
{
|
|
|
|
|
|
- public static async void DoLessonStudentRecordV2(DingDing _dingding, SnowflakeId snowflakeId, LessonRecord lessonRecord, string scope, CosmosClient client, string school, string tmdid,
|
|
|
|
- Teacher teacher, AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, IConfiguration _configuration, LessonBase lessonBase, AzureRedisFactory _azureRedis)
|
|
|
|
- {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 生成学生student-analysis.json
|
|
/// 生成学生student-analysis.json
|
|
@@ -42,7 +42,10 @@ namespace HTEX.Lib.ETL.Lesson
|
|
/// <param name="azureStorage"></param>
|
|
/// <param name="azureStorage"></param>
|
|
/// <param name="lessonLocal"></param>
|
|
/// <param name="lessonLocal"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static async Task<(List<StudentLessonData> studentLessonDatas, List<StudentLessonItem> lessonItems)> DoStudentLessonData(List<string> objectiveTypes, AzureStorageFactory azureStorage, LessonLocal lessonLocal,DingDing _dingDing)
|
|
|
|
|
|
+ public static async Task<(List<StudentLessonData> studentLessonDatas, List<StudentLessonItem> lessonItems)>
|
|
|
|
+ DoStudentLessonData(List<string> objectiveTypes, AzureStorageFactory azureStorage, LessonLocal lessonLocal,DingDing _dingDing,
|
|
|
|
+ CosmosClient client,string location
|
|
|
|
+ )
|
|
{
|
|
{
|
|
List<StudentLessonData> studentLessonDatas = lessonLocal.studentLessonDatas.ToJsonString().ToObject<List<StudentLessonData>>();
|
|
List<StudentLessonData> studentLessonDatas = lessonLocal.studentLessonDatas.ToJsonString().ToObject<List<StudentLessonData>>();
|
|
studentLessonDatas = LessonETLService.GetBaseInfo(lessonLocal.lessonBase!, studentLessonDatas, lessonLocal?.lessonRecord?.id);
|
|
studentLessonDatas = LessonETLService.GetBaseInfo(lessonLocal.lessonBase!, studentLessonDatas, lessonLocal?.lessonRecord?.id);
|
|
@@ -78,6 +81,75 @@ namespace HTEX.Lib.ETL.Lesson
|
|
}
|
|
}
|
|
}
|
|
}
|
|
await azureStorage.GetBlobContainerClient(owner).UploadFileByContainer(studentLessonDatas.ToJsonString(), "records", $"{lessonLocal.lessonRecord.id}/student-analysis.json");
|
|
await azureStorage.GetBlobContainerClient(owner).UploadFileByContainer(studentLessonDatas.ToJsonString(), "records", $"{lessonLocal.lessonRecord.id}/student-analysis.json");
|
|
|
|
+ if (lessonLocal.lessonRecord.scope.Equals("school")&& !string.IsNullOrWhiteSpace(lessonLocal.lessonRecord.school) && location.Equals("China",StringComparison.OrdinalIgnoreCase))
|
|
|
|
+ {
|
|
|
|
+ School school = null;
|
|
|
|
+ ResponseMessage response = await client.GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemStreamAsync(lessonLocal.lessonRecord.school, new PartitionKey("Base"));
|
|
|
|
+ if (response.IsSuccessStatusCode)
|
|
|
|
+ {
|
|
|
|
+ school = JsonDocument.Parse(response.Content).RootElement.ToObject<School>();
|
|
|
|
+ }
|
|
|
|
+ if (school!=null)
|
|
|
|
+ {
|
|
|
|
+ string? periodId = !string.IsNullOrWhiteSpace(lessonLocal.lessonRecord.periodId) ? lessonLocal.lessonRecord.periodId : school.period.FirstOrDefault()?.id;
|
|
|
|
+ var period = school.period.Find(x => x.id.Equals(periodId));
|
|
|
|
+ var semester = SchoolService.GetSemester(period, lessonLocal.lessonRecord.startTime);
|
|
|
|
+ string pre_id = $"{semester.studyYear}-{semester.currSemester.id}";
|
|
|
|
+ string code = $"StudentSemesterRecord-{school.id}";
|
|
|
|
+ foreach (var studentLessonData in studentLessonDatas)
|
|
|
|
+ {
|
|
|
|
+ StudentSemesterRecord studentSemester = null;// students.Find(x => x.stuid.Equals(studentLessonData.id) &&x.id.Equals($"{pre_id}-{studentLessonData.id}") && x.code.Equals(code));
|
|
|
|
+ if (studentSemester==null)
|
|
|
|
+ {
|
|
|
|
+ studentSemester= new StudentSemesterRecord
|
|
|
|
+ {
|
|
|
|
+ id= $"{pre_id}-{studentLessonData.id}",
|
|
|
|
+ code=code,
|
|
|
|
+ stuid= studentLessonData.id,
|
|
|
|
+ userType=Constant.ScopeStudent,
|
|
|
|
+ school=school.id,
|
|
|
|
+ studyYear=semester.studyYear,
|
|
|
|
+ semesterId=semester.currSemester.id,
|
|
|
|
+ period= period?.id,
|
|
|
|
+ };
|
|
|
|
+ // students.Add(studentSemester);
|
|
|
|
+ }
|
|
|
|
+ StuLesson lesson = new StuLesson()
|
|
|
|
+ {
|
|
|
|
+ id= lessonLocal.lessonRecord.id,
|
|
|
|
+ time= lessonLocal.lessonRecord.startTime,
|
|
|
|
+ attend=0
|
|
|
|
+ };
|
|
|
|
+ if (studentLessonData.cooperation>0 || studentLessonData.achieve>0|| studentLessonData.attitude>0 || studentLessonData.cowork>0 || studentLessonData.appraise>0)
|
|
|
|
+ {
|
|
|
|
+ lesson.attend=1;
|
|
|
|
+ studentSemester.lessons.Add(new StuLessonLite
|
|
|
|
+ {
|
|
|
|
+ tmdid=lessonLocal.lessonRecord.tmdid,
|
|
|
|
+ sid= lessonLocal.lessonRecord.subjectId,
|
|
|
|
+ cid= lessonLocal.lessonRecord.courseId,
|
|
|
|
+ hrate=studentLessonData.cooperation,
|
|
|
|
+ crate=studentLessonData.achieve,
|
|
|
|
+ trate=studentLessonData.attitude,
|
|
|
|
+ xrate=studentLessonData.cowork,
|
|
|
|
+ prate=studentLessonData.appraise
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (studentLessonData.attend==1)
|
|
|
|
+ {
|
|
|
|
+ lesson.attend=1;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ lesson.attend=0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ studentSemester.les.Add(lesson);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return (studentLessonDatas, lessonItems);
|
|
return (studentLessonDatas, lessonItems);
|
|
}
|
|
}
|
|
public static void GenAnalysisData(string pathAnalysis, long newest, List<TechCount> techCounts)
|
|
public static void GenAnalysisData(string pathAnalysis, long newest, List<TechCount> techCounts)
|
|
@@ -1996,7 +2068,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
{
|
|
{
|
|
fxGrp=(pickRate+coworkRate+gscoreRate+groupTask)*0.8/groupType;
|
|
fxGrp=(pickRate+coworkRate+gscoreRate+groupTask)*0.8/groupType;
|
|
}
|
|
}
|
|
- lessonItem.hz_nl=fxGrp;
|
|
|
|
|
|
+ lessonItem.hz_nl=Math.Round(fxGrp,4);
|
|
}
|
|
}
|
|
{
|
|
{
|
|
//任务相关指数
|
|
//任务相关指数
|
|
@@ -2130,7 +2202,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
}
|
|
}
|
|
if (avg_cx>0)
|
|
if (avg_cx>0)
|
|
{
|
|
{
|
|
- xx_cx+=lessonItem.hd_cx * 1.0/avg_cx+ lessonItem.pc_df* 1.0/avg_cx+ lessonItem.rw_cx* 1.0/avg_cx+ lessonItem.pj_nl* 1.0/avg_cx+ lessonItem.xz_cx* 1.0/avg_cx+ lessonItem.hz_nl* 1.0/avg_cx;
|
|
|
|
|
|
+ xx_cx+=Math.Round(lessonItem.hd_cx * 1.0/avg_cx+ lessonItem.pc_df* 1.0/avg_cx+ lessonItem.rw_cx* 1.0/avg_cx+ lessonItem.pj_nl* 1.0/avg_cx+ lessonItem.xz_cx* 1.0/avg_cx+ lessonItem.hz_nl* 1.0/avg_cx,4);
|
|
}
|
|
}
|
|
if (lessonItem.xz_cy>0)
|
|
if (lessonItem.xz_cy>0)
|
|
{
|
|
{
|
|
@@ -2158,7 +2230,7 @@ namespace HTEX.Lib.ETL.Lesson
|
|
}
|
|
}
|
|
if (avg_cy>0)
|
|
if (avg_cy>0)
|
|
{
|
|
{
|
|
- xx_cy+=lessonItem.hd_cy * 1.0/avg_cy+ lessonItem.pc_zd* 1.0/avg_cy+ lessonItem.rw_cy* 1.0/avg_cy+ lessonItem.pj_nl* 1.0/avg_cy+ lessonItem.xz_cy* 1.0/avg_cy+ lessonItem.hz_nl* 1.0/avg_cy;
|
|
|
|
|
|
+ xx_cy+=Math.Round(lessonItem.hd_cy * 1.0/avg_cy+ lessonItem.pc_zd* 1.0/avg_cy+ lessonItem.rw_cy* 1.0/avg_cy+ lessonItem.pj_nl* 1.0/avg_cy+ lessonItem.xz_cy* 1.0/avg_cy+ lessonItem.hz_nl* 1.0/avg_cy,4);
|
|
}
|
|
}
|
|
lessonItem.xx_cx=xx_cx;
|
|
lessonItem.xx_cx=xx_cx;
|
|
lessonItem.xx_cy=xx_cy;
|
|
lessonItem.xx_cy=xx_cy;
|
|
@@ -2622,6 +2694,43 @@ namespace HTEX.Lib.ETL.Lesson
|
|
public string? yearMonth { get; set; }
|
|
public string? yearMonth { get; set; }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+ public class LessonWeek
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 第几周
|
|
|
|
+ /// </summary>
|
|
|
|
+ public int week { get; set; }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 课例id
|
|
|
|
+ /// </summary>
|
|
|
|
+ public string? id { get; set;}
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 课程id
|
|
|
|
+ /// </summary>
|
|
|
|
+ public string? cid { get; set; }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 科目id
|
|
|
|
+ /// </summary>
|
|
|
|
+ public string? sid { get; set;}
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 学校
|
|
|
|
+ /// </summary>
|
|
|
|
+ public string?school { get; set; }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 名单id
|
|
|
|
+ /// </summary>
|
|
|
|
+ public string? gid { get; set; }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 学段id
|
|
|
|
+ /// </summary>
|
|
|
|
+ //public string? pid { get; set; }
|
|
|
|
+
|
|
|
|
+ public string? scope { get; set; }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
///
|
|
///
|
|
/// </summary>
|
|
/// </summary>
|