|
@@ -229,6 +229,7 @@ namespace TEAMModelOS.Controllers
|
|
study.createTime = now;
|
|
study.createTime = now;
|
|
study.tchLists = pa.gId;
|
|
study.tchLists = pa.gId;
|
|
study.pId = areaStudy.id;
|
|
study.pId = areaStudy.id;
|
|
|
|
+ study.scope = "school";
|
|
study.targetType = "research";
|
|
study.targetType = "research";
|
|
if (pa.gName.Count == 0)
|
|
if (pa.gName.Count == 0)
|
|
{
|
|
{
|
|
@@ -263,6 +264,7 @@ namespace TEAMModelOS.Controllers
|
|
trExam.school = pa.sId;
|
|
trExam.school = pa.sId;
|
|
trExam.areaId = id.GetString();
|
|
trExam.areaId = id.GetString();
|
|
trExam.tchLists = pa.gId;
|
|
trExam.tchLists = pa.gId;
|
|
|
|
+ trExam.scope = "school";
|
|
trExam.targetType = "research";
|
|
trExam.targetType = "research";
|
|
trExam.blob = $"/{trExam.areaId}/exam/{study.pId}/index.json";
|
|
trExam.blob = $"/{trExam.areaId}/exam/{study.pId}/index.json";
|
|
//处理发布对象
|
|
//处理发布对象
|
|
@@ -286,6 +288,7 @@ namespace TEAMModelOS.Controllers
|
|
trSurvey.school = pa.sId;
|
|
trSurvey.school = pa.sId;
|
|
trSurvey.areaId = id.GetString();
|
|
trSurvey.areaId = id.GetString();
|
|
trSurvey.tchLists = pa.gId;
|
|
trSurvey.tchLists = pa.gId;
|
|
|
|
+ trSurvey.scope = "school";
|
|
trSurvey.targetType = "research";
|
|
trSurvey.targetType = "research";
|
|
trSurvey.blob = $"/{trSurvey.areaId}/survey/{study.pId}/index.json";
|
|
trSurvey.blob = $"/{trSurvey.areaId}/survey/{study.pId}/index.json";
|
|
await getMoreSurvey(pa, trSurvey);
|
|
await getMoreSurvey(pa, trSurvey);
|
|
@@ -299,6 +302,28 @@ namespace TEAMModelOS.Controllers
|
|
study.surveyId = surveyId;
|
|
study.surveyId = surveyId;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if (setting.Equals("work"))
|
|
|
|
+ {
|
|
|
|
+ if (!request.TryGetProperty("work", out JsonElement work)) return BadRequest();
|
|
|
|
+ TeacherWork teacherWork = work.ToObject<TeacherWork>();
|
|
|
|
+ teacherWork.owner = "area";
|
|
|
|
+ teacherWork.school = pa.sId;
|
|
|
|
+ teacherWork.areaId = id.GetString();
|
|
|
|
+ teacherWork.tchLists = pa.gId;
|
|
|
|
+ teacherWork.scope = "school";
|
|
|
|
+ teacherWork.targetType = "research";
|
|
|
|
+ teacherWork.blob = $"/{teacherWork.areaId}/survey/{study.pId}/index.json";
|
|
|
|
+ await getMoreWork(pa, teacherWork);
|
|
|
|
+ string workId = await TeacherWorkService.saveMoreAsync(client, _dingDing, teacherWork);
|
|
|
|
+ if (string.IsNullOrEmpty(workId))
|
|
|
|
+ {
|
|
|
|
+ return Ok(new { code = (int)HttpStatusCode.BadRequest, msg = "作业活动异常" });
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ study.workId = workId;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (string.IsNullOrEmpty(study.id))
|
|
if (string.IsNullOrEmpty(study.id))
|
|
{
|
|
{
|
|
@@ -1165,6 +1190,23 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
return Task.FromResult(trSurvey);
|
|
return Task.FromResult(trSurvey);
|
|
}
|
|
}
|
|
|
|
+ private Task<TeacherWork> getMoreWork(parameter pa, TeacherWork work)
|
|
|
|
+ {
|
|
|
|
+ if (pa.gName.Count == 0)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ //trSurvey.targets.Add("所有老师(未分组)");
|
|
|
|
+ string json = "所有老师(未分组)";
|
|
|
|
+ work.targets.Add(json.ToJsonString().ToObject<JsonElement>());
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ var tn = pa.gName.ToJsonString().ToObject<List<JsonElement>>();
|
|
|
|
+ work.targets = tn;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ return Task.FromResult(work);
|
|
|
|
+ }
|
|
|
|
|
|
private async Task<List<(string id, string name)>> getInfo(CosmosClient client, string id) {
|
|
private async Task<List<(string id, string name)>> getInfo(CosmosClient client, string id) {
|
|
List<(string id, string name)> scInfos = new List<(string id, string name)>();
|
|
List<(string id, string name)> scInfos = new List<(string id, string name)>();
|