|
@@ -27,6 +27,8 @@ using System;
|
|
|
using System.Web;
|
|
|
using System.Security.Policy;
|
|
|
using TEAMModelOS.Controllers.Third.LePei;
|
|
|
+using DocumentFormat.OpenXml.Wordprocessing;
|
|
|
+using System.Text.RegularExpressions;
|
|
|
|
|
|
namespace TEAMModelOS.Controllers
|
|
|
{
|
|
@@ -163,7 +165,8 @@ namespace TEAMModelOS.Controllers
|
|
|
private readonly IConverter _converter;
|
|
|
public readonly string type = "scsyxpt";
|
|
|
public readonly IHttpClientFactory _httpClient;
|
|
|
-
|
|
|
+ public static readonly string invalidChars = @"[\\/:*?""<>|]"; // 使用正则表达式替换特殊符号为空字符串
|
|
|
+
|
|
|
public IConfiguration _configuration { get; set; }
|
|
|
|
|
|
public ScDataPushController(IHttpClientFactory httpClient,IConverter converter, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, IConfiguration configuration)
|
|
@@ -444,7 +447,7 @@ namespace TEAMModelOS.Controllers
|
|
|
List<string> pushTeachers = new List<string> { userid};
|
|
|
School schoolData =await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemAsync<School>(school, new PartitionKey("Base"));
|
|
|
(List<ScsResult> results, List<PushFail> fails, List<Dictionary<string, object>> dicts) = await PushData(schoolData.areaId, schools, pushTeachers);
|
|
|
- (List<dynamic> ycd, List<dynamic> okd, List<TeacherSc> teachers, List<PushData> datas) = await CheckScPush(pushTeachers, schoolData.areaId, schools, ProjectItemID);
|
|
|
+ (List<dynamic> ycd, List<dynamic> okd, List<TeacherSc> teachers, List<PushData> datas,List<dynamic> files) = await CheckScPush(pushTeachers, schoolData.areaId, schools, ProjectItemID);
|
|
|
return Ok(new { results, fails, dicts, ycd, okd, teachers, datas });
|
|
|
}
|
|
|
|
|
@@ -1137,7 +1140,7 @@ namespace TEAMModelOS.Controllers
|
|
|
string areaIdJson = $"{json.GetProperty("areaId")}";
|
|
|
List<string> schools = json.GetProperty("schools").ToObject<List<string>>();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
- (List<dynamic> ycd, List<dynamic> okd, List<TeacherSc> teachers,List<PushData> datas)= await CheckScPush(pushTeachers, areaIdJson, schools, ProjectItemID);
|
|
|
+ (List<dynamic> ycd, List<dynamic> okd, List<TeacherSc> teachers,List<PushData> datas, List<dynamic> files)= await CheckScPush(pushTeachers, areaIdJson, schools, ProjectItemID);
|
|
|
List<string> pxids = json.GetProperty("pxids").ToObject<List<string>>();
|
|
|
List<PushData> ycData = new List<PushData>();
|
|
|
List<dynamic> ycds = new List<dynamic>();
|
|
@@ -1166,6 +1169,8 @@ namespace TEAMModelOS.Controllers
|
|
|
int hgCount = groupData.ToList().Where(x => x.teacherInfo.ComPassed == 1).Count();
|
|
|
var yc = groupData.ToList().Where(x => x.teacherInfo.ComPassed != 2 && x.teacherInfo.ComPassed != 1);
|
|
|
int ycCount = yc.Count();
|
|
|
+
|
|
|
+ files.Add(new { schoolName = groupData.Key, joinCount, yxCount, hgCount, ycCount, files = groupData.ToList().Select(z => z.files) });
|
|
|
okd.Add(new { schoolName = groupData.Key, joinCount, yxCount, hgCount, ycCount });
|
|
|
if (yc.Any())
|
|
|
{
|
|
@@ -1215,9 +1220,9 @@ namespace TEAMModelOS.Controllers
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
- return Ok(new { ycData = ycd, okData = okd , tmdid= teachers .Select(x=>x.tmdid), datas = datas, ycds });
|
|
|
+ return Ok(new { ycData = ycd, okData = okd , tmdid= teachers .Select(x=>x.tmdid), datas = datas, ycds , files });
|
|
|
}
|
|
|
- private async Task<(List<dynamic> ycd ,List<dynamic> okd, List<TeacherSc> teachers, List<PushData> datas)> CheckScPush(List<string> pushTeachers,string areaIdJson,List<string> schools,string ProjectItemID) {
|
|
|
+ private async Task<(List<dynamic> ycd ,List<dynamic> okd, List<TeacherSc> teachers, List<PushData> datas, List<dynamic> files)> CheckScPush(List<string> pushTeachers,string areaIdJson,List<string> schools,string ProjectItemID) {
|
|
|
|
|
|
Dictionary<string, Dictionary<string, object>> pushDatas = new Dictionary<string, Dictionary<string, object>>();
|
|
|
List<Dictionary<string, object>> dicts = new List<Dictionary<string, object>>();
|
|
@@ -1304,6 +1309,7 @@ namespace TEAMModelOS.Controllers
|
|
|
List<KeyValuePair<string, string>> htmls = new List<KeyValuePair<string, string>>();
|
|
|
var group = datas.GroupBy(x => x.teacherInfo.SchoolName);
|
|
|
List<dynamic> okd = new List<dynamic>();
|
|
|
+ List<dynamic>files = new List<dynamic>();
|
|
|
foreach (var groupData in group)
|
|
|
{
|
|
|
int joinCount = groupData.ToList().Count();
|
|
@@ -1313,6 +1319,8 @@ namespace TEAMModelOS.Controllers
|
|
|
var yc = groupData.ToList().Where(x => x.teacherInfo.ComPassed != 2 && x.teacherInfo.ComPassed != 1);
|
|
|
int ycCount = yc.Count();
|
|
|
okd.Add(new { schoolName = groupData.Key, joinCount, yxCount, hgCount, ycCount });
|
|
|
+
|
|
|
+ files.Add(new { schoolName = groupData.Key, joinCount, yxCount, hgCount, ycCount , files= groupData .ToList().Select(z=>z.files)});
|
|
|
if (yc.Any())
|
|
|
{
|
|
|
foreach (var bu in yc)
|
|
@@ -1362,13 +1370,76 @@ namespace TEAMModelOS.Controllers
|
|
|
});
|
|
|
if (datas.Any() && datas.Count == 1)
|
|
|
{
|
|
|
- return (ycd, okd, teachers,datas);
|
|
|
+ return (ycd, okd, teachers,datas,files);
|
|
|
}
|
|
|
else {
|
|
|
- return (ycd, okd, teachers, new List<PushData>());
|
|
|
+ return (ycd, okd, teachers, new List<PushData>(),files);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取四川省已经上传的。
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="json"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [ProducesDefaultResponseType]
|
|
|
+ [HttpPost("get-check-size")]
|
|
|
+ public async Task<IActionResult> CheckSize(JsonElement json)
|
|
|
+ {
|
|
|
+ long size = 0;
|
|
|
+ List<string> schools= json.GetProperty("schools").ToObject<List<string>>();
|
|
|
+ foreach (var school in schools)
|
|
|
+ {
|
|
|
+ List<dynamic> teacherData= new List<dynamic>();
|
|
|
+ var schoolBase = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemAsync<School>(school, new PartitionKey("Base"));
|
|
|
+ var result = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher)
|
|
|
+ .GetList<TeacherTrain>("select value c from c where c.pk='TeacherTrain'", $"TeacherTrain-{school}");
|
|
|
+ foreach (var teacherTrain in result.list)
|
|
|
+ {
|
|
|
+ List<dynamic> recordData = new List<dynamic>();
|
|
|
+ int teacherFileCount = 0;
|
|
|
+ long teacherFileLength = 0;
|
|
|
+ foreach (var off in teacherTrain.offlineRecords)
|
|
|
+ {
|
|
|
+ string name = $"{off.name}-{off.other.FirstOrDefault()?.name}";
|
|
|
+
|
|
|
+ name = Regex.Replace(name, invalidChars, "");
|
|
|
+ recordData.Add(new { type = "校本研修记录", name, off.url, off.size });
|
|
|
+ teacherFileCount+=1;
|
|
|
+ teacherFileLength+=off.size;
|
|
|
+ }
|
|
|
+ if (teacherTrain.offlineReport!=null) {
|
|
|
+ recordData.Add(new { type = "校本研修汇总", name = Regex.Replace(teacherTrain.offlineReport?.name, invalidChars, ""), teacherTrain.offlineReport?.url, teacherTrain.offlineReport?.size });
|
|
|
+ teacherFileCount+=1;
|
|
|
+ teacherFileLength+=teacherTrain.offlineReport.size;
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (var teacherClass in teacherTrain.teacherClasses)
|
|
|
+ {
|
|
|
+ recordData.Add(new { type = "课堂实录", name = Regex.Replace(teacherClass?.name, invalidChars, ""), teacherClass?.url, teacherClass?.size });
|
|
|
+ teacherFileCount+=1;
|
|
|
+ teacherFileLength+=teacherClass.size;
|
|
|
+ }
|
|
|
+ var resultAbility = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher)
|
|
|
+ .GetList<AbilitySub>("select value c from c where c.pk='AbilitySub'", $"AbilitySub-{school}-{teacherTrain.id}");
|
|
|
+ foreach (var ability in teacherTrain.currency.teacherAilities) {
|
|
|
+ AbilitySub abilitySub = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<AbilitySub>(ability.id, new PartitionKey($"AbilitySub-{school}-{teacherTrain.id}"));
|
|
|
+ foreach (var upload in abilitySub.uploads)
|
|
|
+ {
|
|
|
+ foreach (var url in upload.urls)
|
|
|
+ {
|
|
|
+ recordData.Add(new { type = "认证材料",name =$"{ability.no}-{url?.name}", url?.url, url?.size });
|
|
|
+ teacherFileCount+=1;
|
|
|
+ teacherFileLength+=url.size;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ teacherData.Add(new { id = teacherTrain.id, teacherTrain.nickname, teacherFileCount, teacherFileLength, teacherData });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Ok();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public class DiagnosisInfoItem
|