|
@@ -2406,8 +2406,11 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
//金牛直属。
|
|
|
+
|
|
|
+ //string sql = $"SELECT distinct c.id,s.schoolId as code , c.name as nickname, s.name as name FROM c join s in c.schools where s.areaId='f35e0031-a53f-45e5-b307-1cd39446a2cf'" +
|
|
|
+ // $" and array_length(c.binds)>0 and s.schoolId in ({string.Join(",", schools.Select(s => $"'{s}'"))})";
|
|
|
string sql = $"SELECT distinct c.id,s.schoolId as code , c.name as nickname, s.name as name FROM c join s in c.schools where s.areaId='f35e0031-a53f-45e5-b307-1cd39446a2cf'" +
|
|
|
- $" and array_length(c.binds)>0 and s.schoolId in ({string.Join(",", schools.Select(s => $"'{s}'"))})";
|
|
|
+ $" and array_length(c.binds)>0 and c.id in ({string.Join(",", schools.Select(s => $"'{s}'"))})";
|
|
|
List<IdNameCode> tmdidSchooCode = new List<IdNameCode>();
|
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).GetItemQueryIterator<IdNameCode>(queryText: sql,
|
|
|
requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey("Base") }))
|
|
@@ -2596,11 +2599,11 @@ namespace TEAMModelOS.Controllers
|
|
|
//检查是否正确上传任务的。
|
|
|
if (abilityStdTask == null)
|
|
|
{
|
|
|
- var dict = new Dictionary<string, List<string>>();
|
|
|
- dict.Add(x.id, new List<string>(x.task.Select(t => t.id)));
|
|
|
- x.task.ForEach(t => {
|
|
|
- unUpload.taskUnUplaod.Add(new aburls { stdid = x.id, stdname = x.std, taskid = t.id, taskname = t.stddesc });
|
|
|
- });
|
|
|
+ //var dict = new Dictionary<string, List<string>>();
|
|
|
+ //dict.Add(x.id, new List<string>(x.task.Select(t => t.id)));
|
|
|
+ //x.task.ForEach(t => {
|
|
|
+ // unUpload.taskUnUplaod.Add(new aburls { stdid = x.id, stdname = x.std, taskid = t.id, taskname = t.stddesc });
|
|
|
+ //});
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -2626,14 +2629,14 @@ namespace TEAMModelOS.Controllers
|
|
|
taskname = abilityStdTask.stddesc,
|
|
|
errorUrls = urlUn,
|
|
|
};
|
|
|
- if (abilityStdTask.limit > subUpload.urls.Count)
|
|
|
- {
|
|
|
- aburls.enough = 0;
|
|
|
- aburls.limit = abilityStdTask.limit;
|
|
|
- aburls.count = subUpload.urls.Count;
|
|
|
- aburls.uploadUrls = subUpload.urls.Select(x => $"{x.url}?{sas}").ToList();
|
|
|
- unUpload.urlUnExsit.Add(aburls);
|
|
|
- }
|
|
|
+ //if (abilityStdTask.limit > subUpload.urls.Count)
|
|
|
+ //{
|
|
|
+ // aburls.enough = 0;
|
|
|
+ // aburls.limit = abilityStdTask.limit;
|
|
|
+ // aburls.count = subUpload.urls.Count;
|
|
|
+ // aburls.uploadUrls = subUpload.urls.Select(x => $"{x.url}?{sas}").ToList();
|
|
|
+ // unUpload.urlUnExsit.Add(aburls);
|
|
|
+ //}
|
|
|
if (urlUn.Any())
|
|
|
{
|
|
|
unUpload.urlUnExsit.Add(aburls);
|
|
@@ -2641,19 +2644,19 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- var dict = new Dictionary<string, List<string>>();
|
|
|
- dict.Add(x.id, new List<string>(x.task.Select(t => t.id)));
|
|
|
- x.task.ForEach(t => {
|
|
|
- unUpload.taskUnUplaod.Add(new aburls { stdid = x.id, stdname = x.std, taskid = t.id, taskname = t.stddesc });
|
|
|
- });
|
|
|
+ //var dict = new Dictionary<string, List<string>>();
|
|
|
+ //dict.Add(x.id, new List<string>(x.task.Select(t => t.id)));
|
|
|
+ //x.task.ForEach(t => {
|
|
|
+ // unUpload.taskUnUplaod.Add(new aburls { stdid = x.id, stdname = x.std, taskid = t.id, taskname = t.stddesc });
|
|
|
+ //});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- unUpload.stdsUnUpload.Add(new aburls { stdid = x.id, stdname = x.std });
|
|
|
+ //unUpload.stdsUnUpload.Add(new aburls { stdid = x.id, stdname = x.std });
|
|
|
}
|
|
|
- if (unUpload.stdsUnUpload.Any() || unUpload.taskUnUplaod.Any() || unUpload.urlUnExsit.Any())
|
|
|
+ if (/*unUpload.stdsUnUpload.Any() || unUpload.taskUnUplaod.Any() ||*/ unUpload.urlUnExsit.Any())
|
|
|
{
|
|
|
unUploads.Add(unUpload);
|
|
|
}
|
|
@@ -2680,7 +2683,32 @@ namespace TEAMModelOS.Controllers
|
|
|
public List<string> uploadUrls { get; set; } = new List<string>();
|
|
|
public List<string> errorUrls { get; set; } = new List<string>();
|
|
|
}
|
|
|
-
|
|
|
+ [HttpPost("gen-school-teacher-pdf")]
|
|
|
+ public async Task<IActionResult> GenSchoolTeacherPdf(JsonElement json) {
|
|
|
+ var client = _azureCosmos.GetCosmosClient();
|
|
|
+ //金牛直属。
|
|
|
+
|
|
|
+ //string sql = $"SELECT distinct c.id,s.schoolId as code , c.name as nickname, s.name as name FROM c join s in c.schools where s.areaId='f35e0031-a53f-45e5-b307-1cd39446a2cf'" +
|
|
|
+ // $" and array_length(c.binds)>0 and s.schoolId in ({string.Join(",", schools.Select(s => $"'{s}'"))})";
|
|
|
+ string sql = $"SELECT distinct c.id,s.schoolId as code , c.name as nickname, s.name as name FROM c join s in c.schools where s.areaId='f35e0031-a53f-45e5-b307-1cd39446a2cf'" +
|
|
|
+ $" and array_length(c.binds)>0 ";
|
|
|
+ List<IdNameCode> tmdidSchooCode = new List<IdNameCode>();
|
|
|
+ await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).GetItemQueryIterator<IdNameCode>(queryText: sql,
|
|
|
+ requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey("Base") }))
|
|
|
+ {
|
|
|
+ tmdidSchooCode.Add(item);
|
|
|
+ }
|
|
|
+ var group = tmdidSchooCode.GroupBy(idcode => idcode.code).ToList();
|
|
|
+ List<Task<List<dynamic>>> dynamicsTask = new List<Task<List<dynamic>>>();
|
|
|
+
|
|
|
+ foreach (var g in group)
|
|
|
+ {
|
|
|
+ var messageBlobPDF = new ServiceBusMessage(new { id = g.ToList().Select(x=>x.id).ToHashSet(), g.Key, userType = "tmdid" }.ToJsonString());
|
|
|
+ var GenPdfQueue = _configuration.GetValue<string>("Azure:ServiceBus:GenPdfQueue");
|
|
|
+ await _serviceBus.GetServiceBusClient().SendMessageAsync(GenPdfQueue, messageBlobPDF);
|
|
|
+ }
|
|
|
+ return Ok();
|
|
|
+ }
|
|
|
/// <summary>
|
|
|
/// 修复学校课例及blob计算
|
|
|
/// </summary>
|