|
@@ -43,12 +43,16 @@ using System.Net.Http.Json;
|
|
using System.Drawing;
|
|
using System.Drawing;
|
|
using Microsoft.AspNetCore.DataProtection;
|
|
using Microsoft.AspNetCore.DataProtection;
|
|
using Newtonsoft.Json.Linq;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
+using Microsoft.Extensions.Hosting;
|
|
|
|
+using Microsoft.AspNetCore.Hosting;
|
|
|
|
+using TEAMModelOS.Models.ShanDa;
|
|
|
|
+using System.Runtime.ConstrainedExecution;
|
|
|
|
|
|
namespace TEAMModelOS.Controllers
|
|
namespace TEAMModelOS.Controllers
|
|
{
|
|
{
|
|
public class OpenApiService
|
|
public class OpenApiService
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
private static List<string> weekDays = new List<string> { "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN" };
|
|
private static List<string> weekDays = new List<string> { "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN" };
|
|
|
|
|
|
@@ -125,7 +129,7 @@ namespace TEAMModelOS.Controllers
|
|
AzureCosmosQuery cosmosDbQuery = SQLHelper.GetSQL(dict, sql);
|
|
AzureCosmosQuery cosmosDbQuery = SQLHelper.GetSQL(dict, sql);
|
|
string tbname = "";
|
|
string tbname = "";
|
|
string code = "";
|
|
string code = "";
|
|
-
|
|
|
|
|
|
+
|
|
List<string> autoTch = new List<string>();
|
|
List<string> autoTch = new List<string>();
|
|
string sqlPrivate = "";
|
|
string sqlPrivate = "";
|
|
code = $"LessonRecord-{school}";
|
|
code = $"LessonRecord-{school}";
|
|
@@ -242,16 +246,16 @@ namespace TEAMModelOS.Controllers
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
public static async Task<ResponseData<dynamic>> GetLessonRecord(AzureCosmosFactory _azureCosmos, IConfiguration _configuration, AzureServiceBusFactory _serviceBus,
|
|
public static async Task<ResponseData<dynamic>> GetLessonRecord(AzureCosmosFactory _azureCosmos, IConfiguration _configuration, AzureServiceBusFactory _serviceBus,
|
|
- Option _option, DingDing _dingDing, string id, string school, JsonElement json)
|
|
|
|
|
|
+ Option _option, DingDing _dingDing, string id, string school, JsonElement json)
|
|
{
|
|
{
|
|
|
|
|
|
json.TryGetProperty("identity", out JsonElement _identity);
|
|
json.TryGetProperty("identity", out JsonElement _identity);
|
|
string identity = "";
|
|
string identity = "";
|
|
if (!string.IsNullOrWhiteSpace($"{_identity}"))
|
|
if (!string.IsNullOrWhiteSpace($"{_identity}"))
|
|
{
|
|
{
|
|
- identity =$"{_identity}";
|
|
|
|
|
|
+ identity = $"{_identity}";
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
json.TryGetProperty("managePage", out JsonElement _managePage);
|
|
json.TryGetProperty("managePage", out JsonElement _managePage);
|
|
bool managePage = false;
|
|
bool managePage = false;
|
|
if (_managePage.ValueKind.Equals(JsonValueKind.True))
|
|
if (_managePage.ValueKind.Equals(JsonValueKind.True))
|
|
@@ -289,12 +293,12 @@ namespace TEAMModelOS.Controllers
|
|
AzureCosmosQuery cosmosDbQuery = SQLHelper.GetSQL(dict, sql);
|
|
AzureCosmosQuery cosmosDbQuery = SQLHelper.GetSQL(dict, sql);
|
|
string tbname = "";
|
|
string tbname = "";
|
|
string code = "";
|
|
string code = "";
|
|
-
|
|
|
|
|
|
+
|
|
string sqlPrivate = "";
|
|
string sqlPrivate = "";
|
|
List<string> autoTch = new List<string>();
|
|
List<string> autoTch = new List<string>();
|
|
code = $"LessonRecord-{school}";
|
|
code = $"LessonRecord-{school}";
|
|
tbname = "School";
|
|
tbname = "School";
|
|
-
|
|
|
|
|
|
+
|
|
List<string> ids = new List<string>();
|
|
List<string> ids = new List<string>();
|
|
//只查询某个老师的课例
|
|
//只查询某个老师的课例
|
|
if (json.TryGetProperty("tmdid", out JsonElement tmdid) && !string.IsNullOrWhiteSpace($"{tmdid}"))
|
|
if (json.TryGetProperty("tmdid", out JsonElement tmdid) && !string.IsNullOrWhiteSpace($"{tmdid}"))
|
|
@@ -384,7 +388,8 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
if (codes.IsNotEmpty())
|
|
if (codes.IsNotEmpty())
|
|
{
|
|
{
|
|
- lessonRecords.ForEach(x => {
|
|
|
|
|
|
+ lessonRecords.ForEach(x =>
|
|
|
|
+ {
|
|
var tmd = codes.Find(z => z.id.Equals(x.tmdid));
|
|
var tmd = codes.Find(z => z.id.Equals(x.tmdid));
|
|
if (tmd != null)
|
|
if (tmd != null)
|
|
{
|
|
{
|
|
@@ -398,9 +403,11 @@ namespace TEAMModelOS.Controllers
|
|
if (groupIds.Any())
|
|
if (groupIds.Any())
|
|
{
|
|
{
|
|
List<GroupListDto> groupLists = await GroupListService.GetGroupListByListids(_azureCosmos.GetCosmosClient(), _dingDing, groupIds.ToList(), school);
|
|
List<GroupListDto> groupLists = await GroupListService.GetGroupListByListids(_azureCosmos.GetCosmosClient(), _dingDing, groupIds.ToList(), school);
|
|
- lessonRecords.ForEach(x => {
|
|
|
|
|
|
+ lessonRecords.ForEach(x =>
|
|
|
|
+ {
|
|
List<string> groupNmae = new List<string>();
|
|
List<string> groupNmae = new List<string>();
|
|
- x.groupIds.ForEach(y => {
|
|
|
|
|
|
+ x.groupIds.ForEach(y =>
|
|
|
|
+ {
|
|
var dto = groupLists.Find(z => z.id.Equals(y));
|
|
var dto = groupLists.Find(z => z.id.Equals(y));
|
|
string name = dto != null ? dto.name : "-";
|
|
string name = dto != null ? dto.name : "-";
|
|
groupNmae.Add(name);
|
|
groupNmae.Add(name);
|
|
@@ -408,9 +415,17 @@ namespace TEAMModelOS.Controllers
|
|
x.groupNames = groupNmae;
|
|
x.groupNames = groupNmae;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- ResponseData<dynamic> resDate = new ResponseData<dynamic> { code= RespondCode.Ok,msg="成功", data =new { currCount = lessonRecords.Count, continuationToken,
|
|
|
|
- lessonRecords= lessonRecords.Select(x => new { x.tmdid, x.tmdname, x.tmdpicture, x.name, x.school, x.startTime, x.duration, x.courseId, x.groupIds, x.periodId, x.subjectId, x.grade, x.id, x.category })
|
|
|
|
- } };
|
|
|
|
|
|
+ ResponseData<dynamic> resDate = new ResponseData<dynamic>
|
|
|
|
+ {
|
|
|
|
+ code = RespondCode.Ok,
|
|
|
|
+ msg = "成功",
|
|
|
|
+ data = new
|
|
|
|
+ {
|
|
|
|
+ currCount = lessonRecords.Count,
|
|
|
|
+ continuationToken,
|
|
|
|
+ lessonRecords = lessonRecords.Select(x => new { x.tmdid, x.tmdname, x.tmdpicture, x.name, x.school, x.startTime, x.duration, x.courseId, x.groupIds, x.periodId, x.subjectId, x.grade, x.id, x.category })
|
|
|
|
+ }
|
|
|
|
+ };
|
|
return resDate;
|
|
return resDate;
|
|
}
|
|
}
|
|
catch (Exception)
|
|
catch (Exception)
|
|
@@ -468,7 +483,7 @@ namespace TEAMModelOS.Controllers
|
|
/// <param name="school"></param>
|
|
/// <param name="school"></param>
|
|
/// <param name="json"></param>
|
|
/// <param name="json"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static async Task<ResponseData<List<OGroupList>>> GetGroupList(AzureCosmosFactory _azureCosmos,DingDing _dingDing,string bizId, string school, JsonElement json)
|
|
|
|
|
|
+ public static async Task<ResponseData<List<OGroupList>>> GetGroupList(AzureCosmosFactory _azureCosmos, DingDing _dingDing, string bizId, string school, JsonElement json)
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -516,7 +531,7 @@ namespace TEAMModelOS.Controllers
|
|
school = $"{school}",
|
|
school = $"{school}",
|
|
type = "class",
|
|
type = "class",
|
|
year = item.year,
|
|
year = item.year,
|
|
- expire=0,
|
|
|
|
|
|
+ expire = 0,
|
|
groupName = groupNames
|
|
groupName = groupNames
|
|
};
|
|
};
|
|
tempGroupLists.Add(group);
|
|
tempGroupLists.Add(group);
|
|
@@ -560,8 +575,8 @@ namespace TEAMModelOS.Controllers
|
|
tempGroupLists.Add(new GroupListGrp(item, groupName));
|
|
tempGroupLists.Add(new GroupListGrp(item, groupName));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- groupLists = tempGroupLists.Select(x => new OGroupList { id = x.id, name = x.name, type = x.type, periodId = x.periodId, school = x.school, scope = x.scope, year = x.year,expire=x.expire }).ToList();
|
|
|
|
- if (groupLists.Count > 0)
|
|
|
|
|
|
+ groupLists = tempGroupLists.Select(x => new OGroupList { id = x.id, name = x.name, type = x.type, periodId = x.periodId, school = x.school, scope = x.scope, year = x.year, expire = x.expire }).ToList();
|
|
|
|
+ if (groupLists.Count > 0)
|
|
{
|
|
{
|
|
resDate.code = RespondCode.Ok;
|
|
resDate.code = RespondCode.Ok;
|
|
resDate.msg = "成功";
|
|
resDate.msg = "成功";
|
|
@@ -601,7 +616,8 @@ namespace TEAMModelOS.Controllers
|
|
if (!json.TryGetProperty("ids", out JsonElement ids)) return new ResponseData<dynamic>() { code = RespondCode.NotFound, msg = "参数错误" };
|
|
if (!json.TryGetProperty("ids", out JsonElement ids)) return new ResponseData<dynamic>() { code = RespondCode.NotFound, msg = "参数错误" };
|
|
List<string> listids = ids.ToObject<List<string>>();
|
|
List<string> listids = ids.ToObject<List<string>>();
|
|
(List<RMember> members, List<RGroupList> tGroups) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, listids, $"{school}");
|
|
(List<RMember> members, List<RGroupList> tGroups) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, listids, $"{school}");
|
|
- groups = tGroups.Select(x => new OGgroup {
|
|
|
|
|
|
+ groups = tGroups.Select(x => new OGgroup
|
|
|
|
+ {
|
|
name = x.name,
|
|
name = x.name,
|
|
no = x.no,
|
|
no = x.no,
|
|
periodId = x.periodId,
|
|
periodId = x.periodId,
|
|
@@ -622,7 +638,7 @@ namespace TEAMModelOS.Controllers
|
|
{
|
|
{
|
|
await _dingDing.SendBotMsg($"OpenApi,{Environment.GetEnvironmentVariable("Option:Location")} OpenApiService/GetGroupMembers() 参数:bizId:{bizId},school:{school},json:{json.ToJsonString()} \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
|
|
await _dingDing.SendBotMsg($"OpenApi,{Environment.GetEnvironmentVariable("Option:Location")} OpenApiService/GetGroupMembers() 参数:bizId:{bizId},school:{school},json:{json.ToJsonString()} \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
|
|
return new ResponseData<dynamic>() { code = RespondCode.Error, msg = "服务端异常" };
|
|
return new ResponseData<dynamic>() { code = RespondCode.Error, msg = "服务端异常" };
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -636,7 +652,7 @@ namespace TEAMModelOS.Controllers
|
|
/// <param name="school"></param>
|
|
/// <param name="school"></param>
|
|
/// <param name="json"></param>
|
|
/// <param name="json"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static async Task<ResponseData<dynamic>> GetCourseList(AzureCosmosFactory _azureCosmos, DingDing _dingDing,string bizId ,string school, JsonElement json)
|
|
|
|
|
|
+ public static async Task<ResponseData<dynamic>> GetCourseList(AzureCosmosFactory _azureCosmos, DingDing _dingDing, string bizId, string school, JsonElement json)
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -731,7 +747,7 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public static async Task<ResponseData<dynamic>> getCourseTechnology(IHttpClientFactory _httpClient, DingDing _dingDing, string bizId, string school, JsonElement json)
|
|
|
|
|
|
+ public static async Task<ResponseData<dynamic>> getCourseTechnology(IHttpClientFactory _httpClient, DingDing _dingDing, string bizId, string school, JsonElement json, IWebHostEnvironment _environment)
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -742,7 +758,22 @@ namespace TEAMModelOS.Controllers
|
|
//data.Add("params", new { method = "statistic/data/"});
|
|
//data.Add("params", new { method = "statistic/data/"});
|
|
//HttpResponseMessage responseMessage = await _httpClient.CreateClient().PostAsJsonAsync("http://116.204.72.199:81/statistic/data/", data);
|
|
//HttpResponseMessage responseMessage = await _httpClient.CreateClient().PostAsJsonAsync("http://116.204.72.199:81/statistic/data/", data);
|
|
var response = await _httpClient.CreateClient().PostAsync("http://116.204.72.199:81/statistic/data/", httpContent);
|
|
var response = await _httpClient.CreateClient().PostAsync("http://116.204.72.199:81/statistic/data/", httpContent);
|
|
- List<Events> events = new();
|
|
|
|
|
|
+ //获取配置文件内容
|
|
|
|
+ string path = $"{_environment.ContentRootPath}/JsonFile/Core/field.json";
|
|
|
|
+
|
|
|
|
+ StreamReader streamReader = new(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Encoding.UTF8);
|
|
|
|
+ StringBuilder stringBuilder = new();
|
|
|
|
+ string text;
|
|
|
|
+ while ((text = streamReader.ReadLine()) != null)
|
|
|
|
+ {
|
|
|
|
+ stringBuilder.Append(text.ToString());
|
|
|
|
+ }
|
|
|
|
+ streamReader.Close();
|
|
|
|
+ string input = stringBuilder.ToString();
|
|
|
|
+ Field fields = input.ToObject<Field>();
|
|
|
|
+ List<CourseBase> courses = new();
|
|
|
|
+ List<(string name, double T, double P, int attendCount,int mCount,int groups,long time, List<(string name, int count)> counts)> scores = new();
|
|
|
|
+ //List<(string name, List<(string name, int count)> counts)> eveCounts = new();
|
|
if (response.IsSuccessStatusCode)
|
|
if (response.IsSuccessStatusCode)
|
|
{
|
|
{
|
|
string responseBody = response.Content.ReadAsStringAsync().Result;
|
|
string responseBody = response.Content.ReadAsStringAsync().Result;
|
|
@@ -750,17 +781,189 @@ namespace TEAMModelOS.Controllers
|
|
JArray array = jo.Value<JArray>("base");
|
|
JArray array = jo.Value<JArray>("base");
|
|
foreach (var ne in array)
|
|
foreach (var ne in array)
|
|
{
|
|
{
|
|
|
|
+ CourseBase @base = new();
|
|
|
|
+ var tname = ne["tmdname"].Value<string>();
|
|
|
|
+ var cname = ne["courseName"].Value<string>();
|
|
|
|
+ var attendCount = ne["attendCount"].Value<int>();
|
|
|
|
+ var mCount = ne["mCount"].Value<int>();
|
|
|
|
+ var time = ne["time"].Value<long>();
|
|
var obj = ne["events"].ToObject<List<Events>>();
|
|
var obj = ne["events"].ToObject<List<Events>>();
|
|
|
|
+ @base.tmdname = tname;
|
|
|
|
+ @base.courseName = cname;
|
|
|
|
+ @base.attendCount = attendCount;
|
|
|
|
+ @base.mCount = mCount;
|
|
|
|
+ @base.groups = new List<string>();
|
|
|
|
+ @base.time = time;
|
|
|
|
+ @base.eves = obj;
|
|
//events.Add(obj);
|
|
//events.Add(obj);
|
|
- events.AddRange(obj);
|
|
|
|
|
|
+ courses.Add(@base);
|
|
}
|
|
}
|
|
|
|
+ foreach (var eve in courses)
|
|
|
|
+ {
|
|
|
|
+ var countEve = eve.eves.GroupBy(x => x.@event).Select(y => new { name = y.Key, value = y.Sum(c => c.freq) });
|
|
|
|
+ double scoreA = 0;
|
|
|
|
+ if (countEve.Any())
|
|
|
|
+ {
|
|
|
|
+ scoreA += 20;
|
|
|
|
+ }
|
|
|
|
+ double scoreB = 0;
|
|
|
|
+ int P1Count = 0;
|
|
|
|
+ int P2Count = 0;
|
|
|
|
+ int P3Count = 0;
|
|
|
|
+ int P4Count = 0;
|
|
|
|
+ int P5Count = 0;
|
|
|
|
+ List<(string name, int count)> eves = new();
|
|
|
|
+ foreach (var per in countEve)
|
|
|
|
+ {
|
|
|
|
+ eves.Add((per.name, per.value));
|
|
|
|
+ foreach (var evePercent in fields.fields)
|
|
|
|
+ {
|
|
|
|
+ //计算T分
|
|
|
|
+ if (per.name.Equals(evePercent.field))
|
|
|
|
+ {
|
|
|
|
+ if (evePercent.dimension.Equals("小组学习"))
|
|
|
|
+ {
|
|
|
|
+ P1Count++;
|
|
|
|
+ }
|
|
|
|
+ if (evePercent.dimension.Equals("全班互动"))
|
|
|
|
+ {
|
|
|
|
+ P2Count++;
|
|
|
|
+ }
|
|
|
|
+ if (evePercent.dimension.Equals("生本决策"))
|
|
|
|
+ {
|
|
|
|
+ P3Count++;
|
|
|
|
+ }
|
|
|
|
+ if (evePercent.dimension.Equals("全班测验"))
|
|
|
|
+ {
|
|
|
|
+ P4Count++;
|
|
|
|
+ }
|
|
|
|
+ if (evePercent.dimension.Equals("个人学习"))
|
|
|
|
+ {
|
|
|
|
+ P5Count++;
|
|
|
|
+ }
|
|
|
|
+ double bScore = 0;
|
|
|
|
+ if (per.value == 1)
|
|
|
|
+ {
|
|
|
|
+ bScore += evePercent.percent * 0.9;
|
|
|
|
+ }
|
|
|
|
+ else if (per.value == 2)
|
|
|
|
+ {
|
|
|
|
+ bScore += evePercent.percent * 0.95;
|
|
|
|
+ }
|
|
|
|
+ else if (per.value >= 3)
|
|
|
|
+ {
|
|
|
|
+ bScore += evePercent.percent;
|
|
|
|
+ }
|
|
|
|
+ scoreB += bScore;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ List<(string name, double score)> PScore = new();
|
|
|
|
+
|
|
|
|
+ double P1Score = 0;
|
|
|
|
+ if (P1Count == 1)
|
|
|
|
+ {
|
|
|
|
+ P1Score = 18 * 0.8;
|
|
|
|
+ }
|
|
|
|
+ else if (P1Count == 2)
|
|
|
|
+ {
|
|
|
|
+ P1Score = 18 * 0.9;
|
|
|
|
+ }
|
|
|
|
+ else if (P1Count >= 3)
|
|
|
|
+ {
|
|
|
|
+ P1Score = 18;
|
|
|
|
+ }
|
|
|
|
+ double P2Score = 0;
|
|
|
|
+ if (P2Count == 1)
|
|
|
|
+ {
|
|
|
|
+ P2Score = 18 * 0.8;
|
|
|
|
+ }
|
|
|
|
+ else if (P2Count == 2)
|
|
|
|
+ {
|
|
|
|
+ P2Score = 18 * 0.9;
|
|
|
|
+ }
|
|
|
|
+ else if (P2Count >= 3)
|
|
|
|
+ {
|
|
|
|
+ P2Score = 18;
|
|
|
|
+ }
|
|
|
|
+ double P3Score = 0;
|
|
|
|
+ if (P3Count == 1)
|
|
|
|
+ {
|
|
|
|
+ P3Score = 18 * 0.8;
|
|
|
|
+ }
|
|
|
|
+ else if (P3Count == 2)
|
|
|
|
+ {
|
|
|
|
+ P3Score = 18 * 0.9;
|
|
|
|
+ }
|
|
|
|
+ else if (P3Count >= 3)
|
|
|
|
+ {
|
|
|
|
+ P3Score = 18;
|
|
|
|
+ }
|
|
|
|
+ double P4Score = 0;
|
|
|
|
+ if (P4Count == 1)
|
|
|
|
+ {
|
|
|
|
+ P4Score = 18 * 0.8;
|
|
|
|
+ }
|
|
|
|
+ else if (P3Count == 2)
|
|
|
|
+ {
|
|
|
|
+ P4Score = 18 * 0.9;
|
|
|
|
+ }
|
|
|
|
+ else if (P4Count >= 3)
|
|
|
|
+ {
|
|
|
|
+ P4Score = 18;
|
|
|
|
+ }
|
|
|
|
+ double P5Score = 0;
|
|
|
|
+ if (P5Count == 1)
|
|
|
|
+ {
|
|
|
|
+ P5Score = 18 * 0.8;
|
|
|
|
+ }
|
|
|
|
+ else if (P5Count == 2)
|
|
|
|
+ {
|
|
|
|
+ P5Score = 18 * 0.9;
|
|
|
|
+ }
|
|
|
|
+ else if (P5Count >= 3)
|
|
|
|
+ {
|
|
|
|
+ P5Score = 18;
|
|
|
|
+ }
|
|
|
|
+ double P6Score = (P1Score + P2Score + P3Score + P4Score + P5Score) * 0.1;
|
|
|
|
+ PScore.Add(("小组学习", P1Score));
|
|
|
|
+ PScore.Add(("全班互动", P2Score));
|
|
|
|
+ PScore.Add(("生本决策", P3Score));
|
|
|
|
+ PScore.Add(("全班测验", P4Score));
|
|
|
|
+ PScore.Add(("个人学习", P5Score));
|
|
|
|
+ PScore.Add(("多元评价", P6Score));
|
|
|
|
+ double P = P1Score + P2Score + P3Score + P4Score + P5Score + P6Score;
|
|
|
|
+ double scoreC = (scoreA + scoreB) * 0.1;
|
|
|
|
+ double scoreT = scoreA + scoreB + scoreC;
|
|
|
|
+ scoreT = scoreT > 0 ? Math.Round(scoreT, 2) : 0;
|
|
|
|
+ P = P > 0 ? Math.Round(P, 2) : 0;
|
|
|
|
+ scores.Add((eve.courseName, scoreT, P,eve.attendCount,eve.mCount,eve.groups.Count,eve.time,eves));
|
|
|
|
+ //eveCounts.Add((eve.courseName, eves));
|
|
|
|
+ }
|
|
|
|
+ //var eve = courses.Select(c => c.eves).ToList();
|
|
/*using JsonDocument document = JsonDocument.Parse(responseBody.ToString());
|
|
/*using JsonDocument document = JsonDocument.Parse(responseBody.ToString());
|
|
if (document.RootElement.TryGetProperty("base", out JsonElement AccessTokenObj))
|
|
if (document.RootElement.TryGetProperty("base", out JsonElement AccessTokenObj))
|
|
{
|
|
{
|
|
//AccessToken = AccessTokenObj.ToString();
|
|
//AccessToken = AccessTokenObj.ToString();
|
|
}*/
|
|
}*/
|
|
}
|
|
}
|
|
- return new ResponseData<dynamic>() { code = RespondCode.Ok, msg = "成功", data = new { events } };
|
|
|
|
|
|
+ var courseScore = scores.Select(c => new
|
|
|
|
+ {
|
|
|
|
+ c.name,
|
|
|
|
+ c.T,
|
|
|
|
+ c.P,
|
|
|
|
+ c.attendCount,
|
|
|
|
+ c.mCount,
|
|
|
|
+ c.groups,
|
|
|
|
+ c.time,
|
|
|
|
+ count = c.counts.Select(x => new { x.name, x.count })
|
|
|
|
+ });
|
|
|
|
+ /*var courseCount = eveCounts.Select(c => new
|
|
|
|
+ {
|
|
|
|
+ c.name,
|
|
|
|
+ count = c.counts.Select(x => new { x.name, x.count })
|
|
|
|
+ });*/
|
|
|
|
+ return new ResponseData<dynamic>() { code = RespondCode.Ok, msg = "成功", data = new { courseScore} };
|
|
/*if (period != null)
|
|
/*if (period != null)
|
|
{
|
|
{
|
|
return new ResponseData<dynamic>() { code = RespondCode.Ok, msg = "成功", data = new { period.subjects, period.timetable, period.grades, period.majors, weekDays } };
|
|
return new ResponseData<dynamic>() { code = RespondCode.Ok, msg = "成功", data = new { period.subjects, period.timetable, period.grades, period.majors, weekDays } };
|
|
@@ -775,7 +978,7 @@ namespace TEAMModelOS.Controllers
|
|
return new ResponseData<dynamic>() { code = RespondCode.Error, msg = "服务端异常" };
|
|
return new ResponseData<dynamic>() { code = RespondCode.Error, msg = "服务端异常" };
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 物理教室列表
|
|
/// 物理教室列表
|
|
/// [ApiToken(Auth = "1401", Name = "物理教室列表",TName ="",EName ="", RWN = "R", Limit = false)]
|
|
/// [ApiToken(Auth = "1401", Name = "物理教室列表",TName ="",EName ="", RWN = "R", Limit = false)]
|
|
@@ -786,13 +989,13 @@ namespace TEAMModelOS.Controllers
|
|
/// <param name="school"></param>
|
|
/// <param name="school"></param>
|
|
/// <param name="json"></param>
|
|
/// <param name="json"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static async Task<ResponseData<List<ORoom>>> GetRoomList(AzureCosmosFactory _azureCosmos, DingDing _dingDing, string bizId, string school,JsonElement json)
|
|
|
|
|
|
+ public static async Task<ResponseData<List<ORoom>>> GetRoomList(AzureCosmosFactory _azureCosmos, DingDing _dingDing, string bizId, string school, JsonElement json)
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
List<ORoom> dtRooms = new();
|
|
List<ORoom> dtRooms = new();
|
|
- StringBuilder sql = new StringBuilder($"select value(c) from c where 1=1 ");
|
|
|
|
|
|
+ StringBuilder sql = new StringBuilder($"select value(c) from c where 1=1 ");
|
|
json.TryGetProperty("openType", out JsonElement openType);
|
|
json.TryGetProperty("openType", out JsonElement openType);
|
|
json.TryGetProperty("no", out JsonElement no);
|
|
json.TryGetProperty("no", out JsonElement no);
|
|
|
|
|
|
@@ -846,7 +1049,7 @@ namespace TEAMModelOS.Controllers
|
|
{
|
|
{
|
|
JsonDocument document = JsonDocument.Parse(response.Content);
|
|
JsonDocument document = JsonDocument.Parse(response.Content);
|
|
Room tRoom = document.RootElement.Deserialize<Room>();
|
|
Room tRoom = document.RootElement.Deserialize<Room>();
|
|
- return new ResponseData<dynamic>() { code = RespondCode.Ok, msg = "成功",data = new { tRoom.id, tRoom.name, tRoom.x, tRoom.y, tRoom.openType, tRoom.style, tRoom.area, tRoom.address, school } };
|
|
|
|
|
|
+ return new ResponseData<dynamic>() { code = RespondCode.Ok, msg = "成功", data = new { tRoom.id, tRoom.name, tRoom.x, tRoom.y, tRoom.openType, tRoom.style, tRoom.area, tRoom.address, school } };
|
|
}
|
|
}
|
|
else
|
|
else
|
|
return new ResponseData<dynamic>() { code = RespondCode.NotFound, msg = "未找到物理教室详情" };
|
|
return new ResponseData<dynamic>() { code = RespondCode.NotFound, msg = "未找到物理教室详情" };
|
|
@@ -912,13 +1115,13 @@ namespace TEAMModelOS.Controllers
|
|
if (coreUsers.Count > 0)
|
|
if (coreUsers.Count > 0)
|
|
{
|
|
{
|
|
var teacherIds = coreUsers.Select(x => x.id).Except(teachers.Select(x => x.id));
|
|
var teacherIds = coreUsers.Select(x => x.id).Except(teachers.Select(x => x.id));
|
|
- unjoined= coreUsers.FindAll(x => teacherIds.Contains(x.id));
|
|
|
|
|
|
+ unjoined = coreUsers.FindAll(x => teacherIds.Contains(x.id));
|
|
}
|
|
}
|
|
|
|
|
|
List<dynamic> tchs = new List<dynamic>();
|
|
List<dynamic> tchs = new List<dynamic>();
|
|
teachers.Select(x => new { x.id, x.name, x.picture, x.job, x.subjectIds, x.roles }).ToList().ForEach(x =>
|
|
teachers.Select(x => new { x.id, x.name, x.picture, x.job, x.subjectIds, x.roles }).ToList().ForEach(x =>
|
|
{
|
|
{
|
|
- if (coreUsers.Count > 0)
|
|
|
|
|
|
+ if (coreUsers.Count > 0)
|
|
{
|
|
{
|
|
var coreUser = coreUsers.Find(c => c.id.Equals(x.id));
|
|
var coreUser = coreUsers.Find(c => c.id.Equals(x.id));
|
|
if (coreUser != null)
|
|
if (coreUser != null)
|
|
@@ -950,9 +1153,11 @@ namespace TEAMModelOS.Controllers
|
|
/// <param name="school"></param>
|
|
/// <param name="school"></param>
|
|
/// <param name="json"></param>
|
|
/// <param name="json"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static async Task<ResponseData<dynamic>> GetTeacherTeach(AzureCosmosFactory _azureCosmos, DingDing _dingDing, string bizId, string school, JsonElement json) {
|
|
|
|
|
|
+ public static async Task<ResponseData<dynamic>> GetTeacherTeach(AzureCosmosFactory _azureCosmos, DingDing _dingDing, string bizId, string school, JsonElement json)
|
|
|
|
+ {
|
|
|
|
|
|
- try {
|
|
|
|
|
|
+ try
|
|
|
|
+ {
|
|
if (json.TryGetProperty("tmdid", out JsonElement _tmdid))
|
|
if (json.TryGetProperty("tmdid", out JsonElement _tmdid))
|
|
{
|
|
{
|
|
json.TryGetProperty("period", out JsonElement _period);
|
|
json.TryGetProperty("period", out JsonElement _period);
|
|
@@ -966,7 +1171,8 @@ namespace TEAMModelOS.Controllers
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<OCourse>(queryText: query,
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<OCourse>(queryText: query,
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Course-{school}") }))
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Course-{school}") }))
|
|
{
|
|
{
|
|
- if (!string.IsNullOrWhiteSpace(item.schedule?.stulist)) {
|
|
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(item.schedule?.stulist))
|
|
|
|
+ {
|
|
classIds.Add(item.schedule?.stulist);
|
|
classIds.Add(item.schedule?.stulist);
|
|
}
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(item.schedule?.classId))
|
|
if (!string.IsNullOrWhiteSpace(item.schedule?.classId))
|
|
@@ -976,9 +1182,10 @@ namespace TEAMModelOS.Controllers
|
|
courses.Add(item);
|
|
courses.Add(item);
|
|
}
|
|
}
|
|
List<OGroupList> groupLists = new List<OGroupList>();
|
|
List<OGroupList> groupLists = new List<OGroupList>();
|
|
- if (classIds.Any()) {
|
|
|
|
- var tempGroupLists= await GroupListService.GetGroupListByListids(_azureCosmos.GetCosmosClient(), _dingDing, classIds.ToList(), school);
|
|
|
|
- groupLists = tempGroupLists.Select(x => new OGroupList { id = x.id, name = x.name, type = x.type, periodId = x.periodId, school = x.school, scope = x.scope, year = x.year,expire=x.expire }).ToList();
|
|
|
|
|
|
+ if (classIds.Any())
|
|
|
|
+ {
|
|
|
|
+ var tempGroupLists = await GroupListService.GetGroupListByListids(_azureCosmos.GetCosmosClient(), _dingDing, classIds.ToList(), school);
|
|
|
|
+ groupLists = tempGroupLists.Select(x => new OGroupList { id = x.id, name = x.name, type = x.type, periodId = x.periodId, school = x.school, scope = x.scope, year = x.year, expire = x.expire }).ToList();
|
|
}
|
|
}
|
|
|
|
|
|
var group = courses.GroupBy(x => x.id).Select(g => new { key = g.Key, list = g.ToList() });
|
|
var group = courses.GroupBy(x => x.id).Select(g => new { key = g.Key, list = g.ToList() });
|
|
@@ -1000,12 +1207,16 @@ namespace TEAMModelOS.Controllers
|
|
schedule = x.list.Select(x => x.schedule).ToList()
|
|
schedule = x.list.Select(x => x.schedule).ToList()
|
|
});
|
|
});
|
|
});
|
|
});
|
|
- return new ResponseData<dynamic>() {
|
|
|
|
- code=RespondCode.Ok,data=new {
|
|
|
|
-
|
|
|
|
- courses = coursesR.Select(x => new {
|
|
|
|
|
|
+ return new ResponseData<dynamic>()
|
|
|
|
+ {
|
|
|
|
+ code = RespondCode.Ok,
|
|
|
|
+ data = new
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ courses = coursesR.Select(x => new
|
|
|
|
+ {
|
|
x.id,
|
|
x.id,
|
|
- school=school,
|
|
|
|
|
|
+ school = school,
|
|
x.name,
|
|
x.name,
|
|
x.no,
|
|
x.no,
|
|
x.period,
|
|
x.period,
|
|
@@ -1014,15 +1225,18 @@ namespace TEAMModelOS.Controllers
|
|
x.creatorId,
|
|
x.creatorId,
|
|
x.year,
|
|
x.year,
|
|
x.schedule
|
|
x.schedule
|
|
- }) ,
|
|
|
|
|
|
+ }),
|
|
groupLists
|
|
groupLists
|
|
- }
|
|
|
|
|
|
+ }
|
|
};
|
|
};
|
|
}
|
|
}
|
|
- else {
|
|
|
|
|
|
+ else
|
|
|
|
+ {
|
|
return new ResponseData<dynamic>() { code = RespondCode.ParamsError, msg = "参数错误" };
|
|
return new ResponseData<dynamic>() { code = RespondCode.ParamsError, msg = "参数错误" };
|
|
}
|
|
}
|
|
- } catch (Exception ex) {
|
|
|
|
|
|
+ }
|
|
|
|
+ catch (Exception ex)
|
|
|
|
+ {
|
|
await _dingDing.SendBotMsg($"OpenApi,{Environment.GetEnvironmentVariable("Option:Location")} OpenApiService/GetTeacherTeach() 参数:bizId:{bizId},school:{school},json:{json.ToJsonString()} \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
|
|
await _dingDing.SendBotMsg($"OpenApi,{Environment.GetEnvironmentVariable("Option:Location")} OpenApiService/GetTeacherTeach() 参数:bizId:{bizId},school:{school},json:{json.ToJsonString()} \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
|
|
return new ResponseData<dynamic>() { code = RespondCode.Error, msg = "服务端异常" };
|
|
return new ResponseData<dynamic>() { code = RespondCode.Error, msg = "服务端异常" };
|
|
}
|
|
}
|
|
@@ -1336,7 +1550,7 @@ namespace TEAMModelOS.Controllers
|
|
/// <param name="_dingDing"></param>
|
|
/// <param name="_dingDing"></param>
|
|
/// <param name="json"></param>
|
|
/// <param name="json"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static async Task<ResponseData<List<OVolume>>> GetVolumes(AzureCosmosFactory _azureCosmos,DingDing _dingDing, string bizId, string school, JsonElement json)
|
|
|
|
|
|
+ public static async Task<ResponseData<List<OVolume>>> GetVolumes(AzureCosmosFactory _azureCosmos, DingDing _dingDing, string bizId, string school, JsonElement json)
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -1379,7 +1593,7 @@ namespace TEAMModelOS.Controllers
|
|
/// <param name="_dingDing"></param>
|
|
/// <param name="_dingDing"></param>
|
|
/// <param name="json"></param>
|
|
/// <param name="json"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static async Task<ResponseData<dynamic>> GetKnowledges(AzureCosmosFactory _azureCosmos, DingDing _dingDing, string bizId, string school, JsonElement json)
|
|
|
|
|
|
+ public static async Task<ResponseData<dynamic>> GetKnowledges(AzureCosmosFactory _azureCosmos, DingDing _dingDing, string bizId, string school, JsonElement json)
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -1399,12 +1613,12 @@ namespace TEAMModelOS.Controllers
|
|
|
|
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<Knowledge>(queryText: sql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{code}") }))
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<Knowledge>(queryText: sql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{code}") }))
|
|
{
|
|
{
|
|
- knowledges.Add(new { item.periodId, item.subjectId, item.points, item.blocks, item.id });
|
|
|
|
|
|
+ knowledges.Add(new { item.periodId, item.subjectId, item.points, item.blocks, item.id });
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (knowledges.Any())
|
|
if (knowledges.Any())
|
|
{
|
|
{
|
|
- var data = knowledges.Select(x => new { });
|
|
|
|
|
|
+ var data = knowledges.Select(x => new { });
|
|
responseData = new() { code = RespondCode.Ok, msg = "成功", data = knowledges };
|
|
responseData = new() { code = RespondCode.Ok, msg = "成功", data = knowledges };
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -1427,21 +1641,26 @@ namespace TEAMModelOS.Controllers
|
|
/// <param name="_dingDing"></param>
|
|
/// <param name="_dingDing"></param>
|
|
/// <param name="json"></param>
|
|
/// <param name="json"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static async Task<ResponseData<dynamic>> UpsertStudentPortrait(AzureCosmosFactory _azureCosmos, DingDing _dingDing, string bizId, string school, JsonElement json) {
|
|
|
|
- try {
|
|
|
|
|
|
+ public static async Task<ResponseData<dynamic>> UpsertStudentPortrait(AzureCosmosFactory _azureCosmos, DingDing _dingDing, string bizId, string school, JsonElement json)
|
|
|
|
+ {
|
|
|
|
+ try
|
|
|
|
+ {
|
|
ResponseData<dynamic> responseData = new();
|
|
ResponseData<dynamic> responseData = new();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
if (!json.TryGetProperty("schoolCode", out JsonElement schoolCode))
|
|
if (!json.TryGetProperty("schoolCode", out JsonElement schoolCode))
|
|
{
|
|
{
|
|
return responseData = new() { code = RespondCode.ParamsError, msg = "schoolCode为空" };
|
|
return responseData = new() { code = RespondCode.ParamsError, msg = "schoolCode为空" };
|
|
}
|
|
}
|
|
- if (!json.TryGetProperty("periodId", out JsonElement periodId)) {
|
|
|
|
|
|
+ if (!json.TryGetProperty("periodId", out JsonElement periodId))
|
|
|
|
+ {
|
|
return responseData = new() { code = RespondCode.ParamsError, msg = "periodId为空" };
|
|
return responseData = new() { code = RespondCode.ParamsError, msg = "periodId为空" };
|
|
}
|
|
}
|
|
- if (!json.TryGetProperty("subjectId", out JsonElement subjectId)) {
|
|
|
|
|
|
+ if (!json.TryGetProperty("subjectId", out JsonElement subjectId))
|
|
|
|
+ {
|
|
return responseData = new() { code = RespondCode.ParamsError, msg = "subjectId为空" };
|
|
return responseData = new() { code = RespondCode.ParamsError, msg = "subjectId为空" };
|
|
}
|
|
}
|
|
- if (!json.TryGetProperty("students", out JsonElement _students) && !_students.ValueKind.Equals(JsonValueKind.Array)) {
|
|
|
|
|
|
+ if (!json.TryGetProperty("students", out JsonElement _students) && !_students.ValueKind.Equals(JsonValueKind.Array))
|
|
|
|
+ {
|
|
return responseData = new() { code = RespondCode.ParamsError, msg = "students为空或格式错误" };
|
|
return responseData = new() { code = RespondCode.ParamsError, msg = "students为空或格式错误" };
|
|
}
|
|
}
|
|
if (!$"{subjectId}".Equals("subject_sport") && !$"{subjectId}".Equals("subject_virtue") && !$"{subjectId}".Equals("subject_labour")
|
|
if (!$"{subjectId}".Equals("subject_sport") && !$"{subjectId}".Equals("subject_virtue") && !$"{subjectId}".Equals("subject_labour")
|
|
@@ -1452,8 +1671,8 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
School schoolBase = await client.GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemAsync<School>(school, new PartitionKey("Base"));
|
|
School schoolBase = await client.GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemAsync<School>(school, new PartitionKey("Base"));
|
|
List<PortraitStudent> students = _students.ToObject<List<PortraitStudent>>();
|
|
List<PortraitStudent> students = _students.ToObject<List<PortraitStudent>>();
|
|
- List<(Student studentBase, PortraitStudent portrait) > studentsBases = new List<(Student, PortraitStudent)>();
|
|
|
|
- List<PortraitStudent> unmatchStuInfo =new List<PortraitStudent>();
|
|
|
|
|
|
+ List<(Student studentBase, PortraitStudent portrait)> studentsBases = new List<(Student, PortraitStudent)>();
|
|
|
|
+ List<PortraitStudent> unmatchStuInfo = new List<PortraitStudent>();
|
|
List<PortraitStudent> unmatchSemester = new List<PortraitStudent>();
|
|
List<PortraitStudent> unmatchSemester = new List<PortraitStudent>();
|
|
List<PortraitStudent> upsertDatas = new List<PortraitStudent>();
|
|
List<PortraitStudent> upsertDatas = new List<PortraitStudent>();
|
|
string stusql = $"select c.id,c.classId,c.name,c.year from c where c.id in ({string.Join(",", students.Select(f => $"'{f.studentId}'"))})";
|
|
string stusql = $"select c.id,c.classId,c.name,c.year from c where c.id in ({string.Join(",", students.Select(f => $"'{f.studentId}'"))})";
|
|
@@ -1471,8 +1690,9 @@ namespace TEAMModelOS.Controllers
|
|
// unmatchStuInfo.Add(student);
|
|
// unmatchStuInfo.Add(student);
|
|
//}
|
|
//}
|
|
}
|
|
}
|
|
- var unexist = students.FindAll(z => !studentsBases.Select(z => z.studentBase.id).Contains(z.studentId));
|
|
|
|
- if (unexist.Any()) {
|
|
|
|
|
|
+ var unexist = students.FindAll(z => !studentsBases.Select(z => z.studentBase.id).Contains(z.studentId));
|
|
|
|
+ if (unexist.Any())
|
|
|
|
+ {
|
|
unmatchStuInfo.AddRange(unexist);
|
|
unmatchStuInfo.AddRange(unexist);
|
|
}
|
|
}
|
|
Period period = schoolBase.period.Find(x => x.id.Equals($"{periodId}"));
|
|
Period period = schoolBase.period.Find(x => x.id.Equals($"{periodId}"));
|
|
@@ -1481,7 +1701,8 @@ namespace TEAMModelOS.Controllers
|
|
{
|
|
{
|
|
return responseData = new() { code = RespondCode.NotFound, msg = "periodId不存在" };
|
|
return responseData = new() { code = RespondCode.NotFound, msg = "periodId不存在" };
|
|
}
|
|
}
|
|
- else {
|
|
|
|
|
|
+ else
|
|
|
|
+ {
|
|
bool periodChange = false;
|
|
bool periodChange = false;
|
|
if (!period.semesters.Any())
|
|
if (!period.semesters.Any())
|
|
{
|
|
{
|
|
@@ -1504,7 +1725,8 @@ namespace TEAMModelOS.Controllers
|
|
periodChange = true;
|
|
periodChange = true;
|
|
}
|
|
}
|
|
//是否需要创建科目
|
|
//是否需要创建科目
|
|
- if (!$"{subjectId}".Equals("subject_art")) {
|
|
|
|
|
|
+ if (!$"{subjectId}".Equals("subject_art"))
|
|
|
|
+ {
|
|
var bind = period.subjects.Find(x => !string.IsNullOrWhiteSpace(x.bindId) && x.bindId.Equals($"{subjectId}"));
|
|
var bind = period.subjects.Find(x => !string.IsNullOrWhiteSpace(x.bindId) && x.bindId.Equals($"{subjectId}"));
|
|
if (bind == null)
|
|
if (bind == null)
|
|
{
|
|
{
|
|
@@ -1520,14 +1742,15 @@ namespace TEAMModelOS.Controllers
|
|
case bool when $"{subjectId}".Equals("subject_labour"):
|
|
case bool when $"{subjectId}".Equals("subject_labour"):
|
|
subjectName = "劳动";
|
|
subjectName = "劳动";
|
|
break;
|
|
break;
|
|
- //case bool when $"{subjectId}".Equals("subject_music"):
|
|
|
|
- // subjectName = "音乐";
|
|
|
|
- // break;
|
|
|
|
- //case bool when $"{subjectId}".Equals("subject_painting"):
|
|
|
|
- // subjectName = "美术";
|
|
|
|
- // break;
|
|
|
|
|
|
+ //case bool when $"{subjectId}".Equals("subject_music"):
|
|
|
|
+ // subjectName = "音乐";
|
|
|
|
+ // break;
|
|
|
|
+ //case bool when $"{subjectId}".Equals("subject_painting"):
|
|
|
|
+ // subjectName = "美术";
|
|
|
|
+ // break;
|
|
}
|
|
}
|
|
- if (!string.IsNullOrWhiteSpace(subjectName)) {
|
|
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(subjectName))
|
|
|
|
+ {
|
|
var subName = period.subjects.Find(z => z.name.Contains(subjectName));
|
|
var subName = period.subjects.Find(z => z.name.Contains(subjectName));
|
|
if (subName != null)
|
|
if (subName != null)
|
|
{
|
|
{
|
|
@@ -1546,15 +1769,17 @@ namespace TEAMModelOS.Controllers
|
|
await client.GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync<School>(schoolBase, school, new PartitionKey("Base"));
|
|
await client.GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync<School>(schoolBase, school, new PartitionKey("Base"));
|
|
}
|
|
}
|
|
List<Semester> sortedSemesters = SchoolService.SortSemester(period.semesters);
|
|
List<Semester> sortedSemesters = SchoolService.SortSemester(period.semesters);
|
|
- foreach (var studentInfo in studentsBases) {
|
|
|
|
|
|
+ foreach (var studentInfo in studentsBases)
|
|
|
|
+ {
|
|
Student student = studentInfo.studentBase;
|
|
Student student = studentInfo.studentBase;
|
|
string studentId = studentInfo.studentBase.id;
|
|
string studentId = studentInfo.studentBase.id;
|
|
- string classId= studentInfo.studentBase.classId;
|
|
|
|
|
|
+ string classId = studentInfo.studentBase.classId;
|
|
List<SemesterData> semesterDatas = studentInfo.portrait.semesterData;
|
|
List<SemesterData> semesterDatas = studentInfo.portrait.semesterData;
|
|
-
|
|
|
|
|
|
+
|
|
if (semesterDatas.Any())
|
|
if (semesterDatas.Any())
|
|
{
|
|
{
|
|
- semesterDatas.ForEach(data => {
|
|
|
|
|
|
+ semesterDatas.ForEach(data =>
|
|
|
|
+ {
|
|
if (!string.IsNullOrWhiteSpace(data.semesterId))
|
|
if (!string.IsNullOrWhiteSpace(data.semesterId))
|
|
{
|
|
{
|
|
var semester = period.semesters.Find(s => s.id.Equals(data.semesterId));
|
|
var semester = period.semesters.Find(s => s.id.Equals(data.semesterId));
|
|
@@ -1616,7 +1841,8 @@ namespace TEAMModelOS.Controllers
|
|
});
|
|
});
|
|
}
|
|
}
|
|
var okSemesterDatas = semesterDatas.Where(z => !z.semesterId.Contains("学期无效"));
|
|
var okSemesterDatas = semesterDatas.Where(z => !z.semesterId.Contains("学期无效"));
|
|
- if (okSemesterDatas.Any()) {
|
|
|
|
|
|
+ if (okSemesterDatas.Any())
|
|
|
|
+ {
|
|
upsertDatas.Add(new PortraitStudent
|
|
upsertDatas.Add(new PortraitStudent
|
|
{
|
|
{
|
|
studentId = studentInfo.portrait.studentId,
|
|
studentId = studentInfo.portrait.studentId,
|
|
@@ -1640,7 +1866,8 @@ namespace TEAMModelOS.Controllers
|
|
var newDatas = semesterDatas.FindAll(k => nodbids.Contains($"{k.year}-{k.semesterId}-{studentId}"));
|
|
var newDatas = semesterDatas.FindAll(k => nodbids.Contains($"{k.year}-{k.semesterId}-{studentId}"));
|
|
var updateDatas = semesterDatas.FindAll(k => overallEducations.Select(z => z.id).Contains($"{k.year}-{k.semesterId}-{studentId}"));
|
|
var updateDatas = semesterDatas.FindAll(k => overallEducations.Select(z => z.id).Contains($"{k.year}-{k.semesterId}-{studentId}"));
|
|
List<OverallEducation> newOverallEducations = new List<OverallEducation>();
|
|
List<OverallEducation> newOverallEducations = new List<OverallEducation>();
|
|
- newDatas.ForEach(z => {
|
|
|
|
|
|
+ newDatas.ForEach(z =>
|
|
|
|
+ {
|
|
//处理新增的学生学期画像
|
|
//处理新增的学生学期画像
|
|
var overallEducation = newOverallEducations.Find(o => o.id.Equals($"{z.year}-{z.semesterId}-{studentId}") && o.code.Equals($"OverallEducation-{schoolCode}"));
|
|
var overallEducation = newOverallEducations.Find(o => o.id.Equals($"{z.year}-{z.semesterId}-{studentId}") && o.code.Equals($"OverallEducation-{schoolCode}"));
|
|
if (overallEducation == null)
|
|
if (overallEducation == null)
|
|
@@ -1666,7 +1893,8 @@ namespace TEAMModelOS.Controllers
|
|
if (newOverallEducations.Any())
|
|
if (newOverallEducations.Any())
|
|
{
|
|
{
|
|
newOverallEducations = FillSemesterData($"{subjectId}", newOverallEducations, newDatas);
|
|
newOverallEducations = FillSemesterData($"{subjectId}", newOverallEducations, newDatas);
|
|
- foreach (var edu in newOverallEducations) {
|
|
|
|
|
|
+ foreach (var edu in newOverallEducations)
|
|
|
|
+ {
|
|
await client.GetContainer(Constant.TEAMModelOS, Constant.Student).CreateItemAsync(edu, new PartitionKey(edu.code));
|
|
await client.GetContainer(Constant.TEAMModelOS, Constant.Student).CreateItemAsync(edu, new PartitionKey(edu.code));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1675,32 +1903,38 @@ namespace TEAMModelOS.Controllers
|
|
overallEducations = FillSemesterData($"{subjectId}", overallEducations, updateDatas);
|
|
overallEducations = FillSemesterData($"{subjectId}", overallEducations, updateDatas);
|
|
foreach (var edu in overallEducations)
|
|
foreach (var edu in overallEducations)
|
|
{
|
|
{
|
|
- await client.GetContainer(Constant.TEAMModelOS, Constant.Student).ReplaceItemAsync(edu,edu.id, new PartitionKey(edu.code));
|
|
|
|
|
|
+ await client.GetContainer(Constant.TEAMModelOS, Constant.Student).ReplaceItemAsync(edu, edu.id, new PartitionKey(edu.code));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return responseData = new() { data = new { unmatchStuInfo, unmatchSemester , upsertDatas }, code = RespondCode.Ok, msg = "成功" };
|
|
|
|
- } catch (CosmosException cex) when(cex.Status==404) {
|
|
|
|
|
|
+ return responseData = new() { data = new { unmatchStuInfo, unmatchSemester, upsertDatas }, code = RespondCode.Ok, msg = "成功" };
|
|
|
|
+ }
|
|
|
|
+ catch (CosmosException cex) when (cex.Status == 404)
|
|
|
|
+ {
|
|
return new ResponseData<dynamic>() { code = RespondCode.NotFound, msg = "学校编码不存在" };
|
|
return new ResponseData<dynamic>() { code = RespondCode.NotFound, msg = "学校编码不存在" };
|
|
}
|
|
}
|
|
- catch (Exception ex) {
|
|
|
|
|
|
+ catch (Exception ex)
|
|
|
|
+ {
|
|
await _dingDing.SendBotMsg($"OpenApi,{Environment.GetEnvironmentVariable("Option:Location")} OpenApiService/UpsertStudentPortrait() 参数:bizId:{bizId},school:{school},参数json:{json.ToJsonString()} \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
|
|
await _dingDing.SendBotMsg($"OpenApi,{Environment.GetEnvironmentVariable("Option:Location")} OpenApiService/UpsertStudentPortrait() 参数:bizId:{bizId},school:{school},参数json:{json.ToJsonString()} \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
|
|
return new ResponseData<dynamic>() { code = RespondCode.Error, msg = "服务端异常" };
|
|
return new ResponseData<dynamic>() { code = RespondCode.Error, msg = "服务端异常" };
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- public static List<OverallEducation> FillSemesterData(string subjectId, List<OverallEducation> overallEducations, List<SemesterData> semestersDatas) {
|
|
|
|
|
|
+ public static List<OverallEducation> FillSemesterData(string subjectId, List<OverallEducation> overallEducations, List<SemesterData> semestersDatas)
|
|
|
|
+ {
|
|
|
|
|
|
- semestersDatas.ForEach(z => {
|
|
|
|
- var oedu= overallEducations.Find(x => x.id.Equals($"{z.year}-{z.semesterId}"));
|
|
|
|
- if (oedu != null) {
|
|
|
|
- List<EducationScore> educationScores=null;
|
|
|
|
|
|
+ semestersDatas.ForEach(z =>
|
|
|
|
+ {
|
|
|
|
+ var oedu = overallEducations.Find(x => x.id.Equals($"{z.year}-{z.semesterId}"));
|
|
|
|
+ if (oedu != null)
|
|
|
|
+ {
|
|
|
|
+ List<EducationScore> educationScores = null;
|
|
switch (true)
|
|
switch (true)
|
|
{
|
|
{
|
|
case bool when $"{subjectId}".Equals("subject_sport"):
|
|
case bool when $"{subjectId}".Equals("subject_sport"):
|
|
- educationScores=oedu.sports;
|
|
|
|
|
|
+ educationScores = oedu.sports;
|
|
break;
|
|
break;
|
|
case bool when $"{subjectId}".Equals("subject_virtue"):
|
|
case bool when $"{subjectId}".Equals("subject_virtue"):
|
|
educationScores = oedu.virtue;
|
|
educationScores = oedu.virtue;
|
|
@@ -1717,10 +1951,11 @@ namespace TEAMModelOS.Controllers
|
|
case bool when $"{subjectId}".Equals("subject_art"):
|
|
case bool when $"{subjectId}".Equals("subject_art"):
|
|
educationScores = oedu.art;
|
|
educationScores = oedu.art;
|
|
break;
|
|
break;
|
|
- default:educationScores = new List<EducationScore>();
|
|
|
|
|
|
+ default:
|
|
|
|
+ educationScores = new List<EducationScore>();
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- var edu= educationScores.Find(m => m.examId.Equals(z.examId));
|
|
|
|
|
|
+ var edu = educationScores.Find(m => m.examId.Equals(z.examId));
|
|
z.totalScore = z.totalScore <= 0 ? 100 : z.totalScore;
|
|
z.totalScore = z.totalScore <= 0 ? 100 : z.totalScore;
|
|
if (edu == null)
|
|
if (edu == null)
|
|
{
|
|
{
|
|
@@ -1761,7 +1996,8 @@ namespace TEAMModelOS.Controllers
|
|
var apiResult = table.ExecuteQuerySegmented(new TableQuery<OpenApi>().Where(tbqurey), null);
|
|
var apiResult = table.ExecuteQuerySegmented(new TableQuery<OpenApi>().Where(tbqurey), null);
|
|
List<OpenApi> apis = apiResult.Results;
|
|
List<OpenApi> apis = apiResult.Results;
|
|
//数据库历史数据处理
|
|
//数据库历史数据处理
|
|
- apis.ForEach(x => {
|
|
|
|
|
|
+ apis.ForEach(x =>
|
|
|
|
+ {
|
|
var api = openApis.Find(z => z.RowKey.Equals(x.RowKey));
|
|
var api = openApis.Find(z => z.RowKey.Equals(x.RowKey));
|
|
if (api != null)
|
|
if (api != null)
|
|
{
|
|
{
|
|
@@ -1790,7 +2026,8 @@ namespace TEAMModelOS.Controllers
|
|
var hookResult = table.ExecuteQuerySegmented(new TableQuery<WebHook>().Where(tbqurey), null);
|
|
var hookResult = table.ExecuteQuerySegmented(new TableQuery<WebHook>().Where(tbqurey), null);
|
|
List<WebHook> hooks = hookResult.Results;
|
|
List<WebHook> hooks = hookResult.Results;
|
|
//数据库历史数据处理
|
|
//数据库历史数据处理
|
|
- hooks.ForEach(x => {
|
|
|
|
|
|
+ hooks.ForEach(x =>
|
|
|
|
+ {
|
|
var api = webHooks.Find(z => z.RowKey.Equals(x.RowKey));
|
|
var api = webHooks.Find(z => z.RowKey.Equals(x.RowKey));
|
|
if (api != null)
|
|
if (api != null)
|
|
{
|
|
{
|
|
@@ -1829,7 +2066,7 @@ namespace TEAMModelOS.Controllers
|
|
try
|
|
try
|
|
{
|
|
{
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
-
|
|
|
|
|
|
+
|
|
//if (!string.IsNullOrWhiteSpace($"{_idToken}") && JwtAuthExtension.ValidateApiToken($"{_idToken}", _option.JwtSecretKey))
|
|
//if (!string.IsNullOrWhiteSpace($"{_idToken}") && JwtAuthExtension.ValidateApiToken($"{_idToken}", _option.JwtSecretKey))
|
|
//{
|
|
//{
|
|
// JwtSecurityToken jwt = new($"{_idToken}");
|
|
// JwtSecurityToken jwt = new($"{_idToken}");
|
|
@@ -1837,8 +2074,8 @@ namespace TEAMModelOS.Controllers
|
|
OStudent student = new();
|
|
OStudent student = new();
|
|
jwt.Payload.TryGetValue("name", out object stuName);
|
|
jwt.Payload.TryGetValue("name", out object stuName);
|
|
jwt.Payload.TryGetValue("picture", out object stuPicture);
|
|
jwt.Payload.TryGetValue("picture", out object stuPicture);
|
|
- if(!jwt.Payload.TryGetValue("scope", out object scope)) return new ResponseData<dynamic>() { code = RespondCode.ParamsError, msg = "参数错误:scope", data = null };
|
|
|
|
- if(!jwt.Payload.TryGetValue("roles", out object _roles)) return new ResponseData<dynamic>() { code = RespondCode.ParamsError, msg = "参数错误:roles", data = null };
|
|
|
|
|
|
+ if (!jwt.Payload.TryGetValue("scope", out object scope)) return new ResponseData<dynamic>() { code = RespondCode.ParamsError, msg = "参数错误:scope", data = null };
|
|
|
|
+ if (!jwt.Payload.TryGetValue("roles", out object _roles)) return new ResponseData<dynamic>() { code = RespondCode.ParamsError, msg = "参数错误:roles", data = null };
|
|
jwt.Payload.TryGetValue("permissions", out object permissions);
|
|
jwt.Payload.TryGetValue("permissions", out object permissions);
|
|
jwt.Payload.TryGetValue("standard", out object standard);
|
|
jwt.Payload.TryGetValue("standard", out object standard);
|
|
jwt.Payload.TryGetValue("area", out object area);
|
|
jwt.Payload.TryGetValue("area", out object area);
|
|
@@ -1904,7 +2141,7 @@ namespace TEAMModelOS.Controllers
|
|
{
|
|
{
|
|
|
|
|
|
if (!json.TryGetProperty("ids", out JsonElement _ids)) return new ResponseData<dynamic>() { code = RespondCode.ParamsError, msg = "idToken参数错误", data = null };
|
|
if (!json.TryGetProperty("ids", out JsonElement _ids)) return new ResponseData<dynamic>() { code = RespondCode.ParamsError, msg = "idToken参数错误", data = null };
|
|
- try
|
|
|
|
|
|
+ try
|
|
{
|
|
{
|
|
List<string> ids = _ids.ToObject<List<string>>();
|
|
List<string> ids = _ids.ToObject<List<string>>();
|
|
List<OStudent> student = new();
|
|
List<OStudent> student = new();
|
|
@@ -1930,7 +2167,17 @@ namespace TEAMModelOS.Controllers
|
|
await _dingDing.SendBotMsg($"OpenApi,{Environment.GetEnvironmentVariable("Option:Location")} OpenApiService/GetLoginStuInfo() 参数:学生id集合:{_ids},school:{school},json:{json.ToJsonString()} \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
|
|
await _dingDing.SendBotMsg($"OpenApi,{Environment.GetEnvironmentVariable("Option:Location")} OpenApiService/GetLoginStuInfo() 参数:学生id集合:{_ids},school:{school},json:{json.ToJsonString()} \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
|
|
return new ResponseData<dynamic>() { code = RespondCode.Error, msg = "服务器错误" };
|
|
return new ResponseData<dynamic>() { code = RespondCode.Error, msg = "服务器错误" };
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ public class CourseBase
|
|
|
|
+ {
|
|
|
|
+ public string tmdname { get; set; }
|
|
|
|
+ public string courseName { get; set; }
|
|
|
|
+ public int attendCount { get; set; }
|
|
|
|
+ public int mCount { get; set; }
|
|
|
|
+ public List<string> groups { get; set; }
|
|
|
|
+ public long time { get; set; }
|
|
|
|
+ public List<Events> eves { get; set; }
|
|
}
|
|
}
|
|
public class Events
|
|
public class Events
|
|
{
|
|
{
|