|
@@ -169,7 +169,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
CreateSchoolInfo createSchoolInfo = new CreateSchoolInfo()
|
|
|
{
|
|
|
province = bischool.province,
|
|
|
- id = "",
|
|
|
+ id = bischool.id,
|
|
|
name = bischool.name,
|
|
|
city = bischool.city,
|
|
|
aname = "",
|
|
@@ -233,8 +233,15 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
{
|
|
|
using var tchJson = await JsonDocument.ParseAsync(resTeache.ContentStream);
|
|
|
teacher = tchJson.ToObject<Teacher>();
|
|
|
- //教师存在,在该教师信息中添加要管理的学校信息
|
|
|
- teacher.schools.Add(new Teacher.TeacherSchool { areaId = string.IsNullOrEmpty(bischool.areaId) ? "" : bischool.areaId, schoolId = createSchoolInfo.id, name = bischool.name, status = "join", time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() });
|
|
|
+ Teacher.TeacherSchool tchSc = null;
|
|
|
+ //var tempTch = teacher.schools.Select(x => x.schoolId.Equals(upSchool.id)).ToString();
|
|
|
+ tchSc = teacher.schools.Find(x => x.schoolId.Equals(upSchool.id));
|
|
|
+ if (tchSc == null)
|
|
|
+ {
|
|
|
+ //教师存在,在该教师信息中添加要管理的学校信息
|
|
|
+ teacher.schools.Add(new Teacher.TeacherSchool { areaId = string.IsNullOrEmpty(bischool.areaId) ? "" : bischool.areaId, schoolId = createSchoolInfo.id, name = bischool.name, status = "join", time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() });
|
|
|
+ }
|
|
|
+
|
|
|
//await cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<Teacher>(teacher, coreUser.id, new PartitionKey("Base"));
|
|
|
SchoolTeacher schoolTeacher = new()
|
|
|
{
|
|
@@ -533,18 +540,13 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
if (jsonElement.TryGetProperty("pageSize", out JsonElement jsonPageSize))
|
|
|
{
|
|
|
if (!jsonPageSize.ValueKind.Equals(JsonValueKind.Undefined) && !jsonPageSize.ValueKind.Equals(JsonValueKind.Null) && jsonPageSize.TryGetInt32(out int tempPageSize))
|
|
|
- {
|
|
|
pageSize = tempPageSize;
|
|
|
- }
|
|
|
}
|
|
|
if (pageSize != null && pageSize.Value > 0)
|
|
|
- {
|
|
|
iscontinuation = true;
|
|
|
- }
|
|
|
+
|
|
|
if (jsonElement.TryGetProperty("contToken", out JsonElement ContToken))
|
|
|
- {
|
|
|
pageToken = ContToken.GetString();
|
|
|
- }
|
|
|
|
|
|
if (!string.IsNullOrEmpty($"{tmdId}"))
|
|
|
{
|
|
@@ -561,9 +563,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
StringBuilder sqlTxt = new($"select c.id,c.code,c.schoolCode,c.name,c.region,c.province,c.city,c.dist,c.size,c.address,c.picture,c.type,c.scale,c.areaId,c.standard from c where c.id='{id}'");
|
|
|
|
|
|
if ($"{order}".Equals("desc"))
|
|
|
- {
|
|
|
sqlTxt.Append(" order by c.createTime desc");
|
|
|
- }
|
|
|
|
|
|
await foreach (var itemSchool in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<AssistSchool>(queryText: sqlTxt.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
|
|
|
{
|
|
@@ -600,9 +600,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
}
|
|
|
|
|
|
if ($"{order}".Equals("desc"))
|
|
|
- {
|
|
|
stringBuilder.Append(" order by c.createTime desc");
|
|
|
- }
|
|
|
|
|
|
scCnt = await CommonFind.GetSqlValueCount(cosmosClient, "School", scCntSql.ToString(), "Base");
|
|
|
|
|
@@ -631,17 +629,11 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(response.ContentStream);
|
|
|
if (json.RootElement.TryGetProperty("serial", out JsonElement serial) && !serial.ValueKind.Equals(JsonValueKind.Null))
|
|
|
- {
|
|
|
item.serial = serial.ToObject<List<SchoolProductSumData>>().Select(x => x.prodCode).ToList();
|
|
|
- }
|
|
|
if (json.RootElement.TryGetProperty("service", out JsonElement service) && !service.ValueKind.Equals(JsonValueKind.Null))
|
|
|
- {
|
|
|
item.service = service.ToObject<List<SchoolProductSumData>>().Select(x => x.prodCode).ToList();
|
|
|
- }
|
|
|
if (json.RootElement.TryGetProperty("hard", out JsonElement hard) && !hard.ValueKind.Equals(JsonValueKind.Null))
|
|
|
- {
|
|
|
item.hard = hard.ToObject<List<SchoolProductSumDataHard>>().Select(x => x.prodCode).ToList();
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
item.assists = await CommonFind.FindSchoolRoles(cosmosClient, item.id, "assist");
|
|
@@ -1323,7 +1315,6 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
return Ok(new { state = RespondCode.Ok, createScInfo });
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 添加多个学校添加多个管理员
|
|
|
/// </summary>
|
|
@@ -1572,7 +1563,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
/// <param name="Language"></param>
|
|
|
/// <param name="campusId"></param>
|
|
|
/// <returns></returns>
|
|
|
- public List<Period> PresetSchoolPeriod(List<string> period, string Language, string campusId)
|
|
|
+ public List<Period> PresetSchoolPeriod(List<PeriodType> period, string Language, string campusId)
|
|
|
{
|
|
|
var builder = $"{_environment.ContentRootPath}/JsonFile/Preset/LangSchoolConfig.json";
|
|
|
StreamReader streamReader = new(new FileStream(builder, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Encoding.UTF8);
|
|
@@ -1603,7 +1594,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
periods.Add(new Period
|
|
|
{
|
|
|
id = Guid.NewGuid().ToString(),
|
|
|
- name = x,
|
|
|
+ name = x.pidName,
|
|
|
campusId = campusId,
|
|
|
semesters = new List<Semester>() { new Semester { name = schoolConfig.semester[0].term, start = schoolConfig.semester[0].start, month = schoolConfig.semester[0].month, day = schoolConfig.semester[0].day, id = Guid.NewGuid().ToString() },
|
|
|
new Semester { name = schoolConfig.semester[1].term, start = schoolConfig.semester[1].start, month = schoolConfig.semester[1].month, day = schoolConfig.semester[1].day, id = Guid.NewGuid().ToString() } },
|
|
@@ -1622,7 +1613,9 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
income = schoolConfig.PresetExam[0].income,
|
|
|
eugenics = schoolConfig.PresetExam[0].eugenics,
|
|
|
touch = schoolConfig.PresetExam[0].touch
|
|
|
- }
|
|
|
+ },
|
|
|
+ type = x.pidType
|
|
|
+
|
|
|
});
|
|
|
});
|
|
|
}
|
|
@@ -1723,7 +1716,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
/// <summary>
|
|
|
/// 学校的学段
|
|
|
/// </summary>
|
|
|
- public List<string> period { get; set; }
|
|
|
+ public List<PeriodType> period { get; set; }
|
|
|
/// <summary>
|
|
|
/// 学校空间大小
|
|
|
/// </summary>
|
|
@@ -1762,6 +1755,15 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
public string standard { get; set; }
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 学段类型和学段名称
|
|
|
+ /// </summary>
|
|
|
+ public record PeriodType
|
|
|
+ {
|
|
|
+ public List<string> pidType { get; set; }
|
|
|
+ public string pidName { get; set; }
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 存在的学校
|
|
|
/// </summary>
|