|
@@ -14,28 +14,15 @@ using TEAMModelOS.SDK;
|
|
|
using TEAMModelOS.SDK.DI;
|
|
|
using TEAMModelOS.SDK.Extension;
|
|
|
using Azure;
|
|
|
-using TEAMModelOS.SDK.Models.Cosmos.Common;
|
|
|
-using Azure.Messaging.ServiceBus;
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
using TEAMModelOS.Filter;
|
|
|
using HTEXLib.COMM.Helpers;
|
|
|
using System.Text;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
-using Microsoft.Extensions.Hosting;
|
|
|
-using OpenXmlPowerTools;
|
|
|
-using TEAMModelOS.SDK.Models.Dtos;
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
-using Azure.Core;
|
|
|
-using static TEAMModelOS.SDK.Services.ActivityStudentService;
|
|
|
using static TEAMModelOS.SDK.GroupListService;
|
|
|
using TEAMModelOS.Controllers.Both;
|
|
|
using CourseDto = TEAMModelOS.Controllers.Both.CourseDto;
|
|
|
-using DocumentFormat.OpenXml.Drawing.Charts;
|
|
|
-using Grpc.Core;
|
|
|
-using Org.BouncyCastle.Asn1.Ocsp;
|
|
|
-using DocumentFormat.OpenXml.Office2010.Excel;
|
|
|
-using System.Security.Claims;
|
|
|
-using TEAMModelOS.Controllers.Analysis;
|
|
|
|
|
|
namespace TEAMModelOS.Controllers
|
|
|
{
|
|
@@ -105,8 +92,40 @@ namespace TEAMModelOS.Controllers
|
|
|
|
|
|
return Ok(new { groups = groups });
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ [ProducesDefaultResponseType]
|
|
|
+ [HttpPost("get-grouplist-nos")]
|
|
|
+ public async Task<IActionResult> GetGroupListNos(JsonElement json)
|
|
|
+ {
|
|
|
+ GroupList groupList = null;
|
|
|
+ var client = _azureCosmos.GetCosmosClient();
|
|
|
+ if (!json.TryGetProperty("stuListNo", out JsonElement _stuListNo)) return BadRequest();
|
|
|
+ json.TryGetProperty("school", out JsonElement school);
|
|
|
+ var queryNo = $"SELECT value(c) FROM c where c.no ='{_stuListNo}'";
|
|
|
+ if (!string.IsNullOrEmpty($"{school}"))
|
|
|
+ {
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<GroupList>(queryText: queryNo,
|
|
|
+ requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"GroupList-{school}") }))
|
|
|
+ {
|
|
|
+ groupList=item;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (groupList==null) {
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<GroupList>(queryText: queryNo,
|
|
|
+ requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"GroupList") }))
|
|
|
+ {
|
|
|
+ groupList=item;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (groupList!=null)
|
|
|
+ {
|
|
|
+ return Ok(new {code=200, nos = groupList.members.Select(x => x.no),optNo= groupList.optNo });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return Ok(new {code=404, nos =new List<string>() , optNo =0});
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 扫码加入名单
|
|
@@ -120,6 +139,10 @@ namespace TEAMModelOS.Controllers
|
|
|
if (!json.TryGetProperty("stuListNo", out JsonElement _stuListNo)) return BadRequest();
|
|
|
json.TryGetProperty("school", out JsonElement school);
|
|
|
json.TryGetProperty("courseId", out JsonElement _courseId);
|
|
|
+ int seatNo = 0;
|
|
|
+ if (json.TryGetProperty("seatNo", out JsonElement _seatNo) && int.TryParse($"{_seatNo}", out seatNo)) {
|
|
|
+
|
|
|
+ }
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
json.TryGetProperty("id_token", out JsonElement id_token);
|
|
|
var jwt = new JwtSecurityToken(id_token.GetString());
|
|
@@ -153,7 +176,7 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
}
|
|
|
int year = DateTimeOffset.UtcNow.Year;
|
|
|
- (int status, GroupList stuList, Member member) data = await GroupListService.CodeJoinList(client, _azureRedis, $"{_stuListNo}", id, type: 1, $"{school}", year, $"{name}", $"{picture}", $"{lang}",$"{_courseId}");
|
|
|
+ (int status, GroupList stuList, Member member) data = await GroupListService.CodeJoinList(client, _azureRedis, $"{_stuListNo}", id, type: 1, $"{school}", year, $"{name}", $"{picture}", $"{lang}", seatNo, $"{_courseId}");
|
|
|
//没有TmdUser时
|
|
|
if (data.status == 0)
|
|
|
{
|
|
@@ -236,7 +259,8 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
type = 1;
|
|
|
}
|
|
|
- (int status, GroupList stuList, Member member) data = await GroupListService.CodeJoinList(client, _azureRedis, $"{_stuListNo}", userid, type, school, year, _name, _picture, head_lang);
|
|
|
+ int seatNo =0;
|
|
|
+ (int status, GroupList stuList, Member member) data = await GroupListService.CodeJoinList(client, _azureRedis, $"{_stuListNo}", userid, type, school, year, _name, _picture, head_lang,seatNo);
|
|
|
if (data.status == 0)
|
|
|
{
|
|
|
|