|
@@ -3054,370 +3054,5 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
*/
|
|
|
|
|
|
- //統測活動資料架構生成測試
|
|
|
- [HttpPost("add-joint-event")]
|
|
|
- public async Task<IActionResult> AddJointEvent(JsonElement json)
|
|
|
- {
|
|
|
- var client = _azureCosmos.GetCosmosClient();
|
|
|
-
|
|
|
- JointEvent jointEvent = new JointEvent();
|
|
|
- jointEvent.id = "37db8a66-660c-43a5-b8ce-6686c070973e";
|
|
|
- jointEvent.creatorId = "1595321354";
|
|
|
- jointEvent.name = "統測活動(測試)";
|
|
|
- jointEvent.pk = "JointEvent";
|
|
|
- jointEvent.code = "JointEvent";
|
|
|
- jointEvent.startTime = DateTimeOffset.UtcNow.AddDays(-4).ToUnixTimeMilliseconds();
|
|
|
- jointEvent.endTime = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeMilliseconds();
|
|
|
- jointEvent.progress = "going";
|
|
|
- jointEvent.createTime = DateTimeOffset.UtcNow.AddDays(-4).ToUnixTimeMilliseconds();
|
|
|
- //行程
|
|
|
- ///行程1 報名
|
|
|
- JointEventSchedule jointEventSchedule1 = new JointEventSchedule();
|
|
|
- jointEventSchedule1.type = "join"; //報名
|
|
|
- jointEventSchedule1.name = "報名";
|
|
|
- jointEventSchedule1.startTime = DateTimeOffset.UtcNow.AddDays(-3).ToUnixTimeMilliseconds();
|
|
|
- jointEventSchedule1.endTime = DateTimeOffset.UtcNow.AddDays(-1).ToUnixTimeMilliseconds();
|
|
|
- jointEventSchedule1.progress = "finish";
|
|
|
- jointEvent.schedule.Add(jointEventSchedule1);
|
|
|
- ///行程2~4 評量
|
|
|
- JointEventSchedule jointEventSchedule2 = new JointEventSchedule();
|
|
|
- jointEventSchedule2.type = "exam"; //評量
|
|
|
- jointEventSchedule2.name = "練習";
|
|
|
- jointEventSchedule2.startTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); ;
|
|
|
- jointEventSchedule2.endTime = DateTimeOffset.UtcNow.AddDays(2).ToUnixTimeMilliseconds();
|
|
|
- jointEventSchedule2.progress = "going";
|
|
|
- jointEvent.schedule.Add(jointEventSchedule2);
|
|
|
- JointEventSchedule jointEventSchedule3 = new JointEventSchedule();
|
|
|
- jointEventSchedule3.type = "exam"; //評量
|
|
|
- jointEventSchedule3.name = "初賽";
|
|
|
- jointEventSchedule3.startTime = DateTimeOffset.UtcNow.AddDays(3).ToUnixTimeMilliseconds();
|
|
|
- jointEventSchedule3.endTime = DateTimeOffset.UtcNow.AddDays(5).ToUnixTimeMilliseconds();
|
|
|
- jointEventSchedule3.progress = "pending";
|
|
|
- jointEvent.schedule.Add(jointEventSchedule3);
|
|
|
- JointEventSchedule jointEventSchedule4 = new JointEventSchedule();
|
|
|
- jointEventSchedule4.type = "exam"; //評量
|
|
|
- jointEventSchedule4.name = "決賽";
|
|
|
- jointEventSchedule4.startTime = DateTimeOffset.UtcNow.AddDays(6).ToUnixTimeMilliseconds();
|
|
|
- jointEventSchedule4.endTime = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeMilliseconds();
|
|
|
- jointEventSchedule4.progress = "pending";
|
|
|
- jointEvent.schedule.Add(jointEventSchedule4);
|
|
|
-
|
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Teacher").UpsertItemAsync<JointEvent>(jointEvent, new PartitionKey("JointEvent"));
|
|
|
- return Ok();
|
|
|
- }
|
|
|
-
|
|
|
- //統測活動 教師課程生成測試
|
|
|
- [HttpPost("add-joint-course")]
|
|
|
- public async Task<IActionResult> AddJointCourse(JsonElement json)
|
|
|
- {
|
|
|
- var client = _azureCosmos.GetCosmosClient();
|
|
|
-
|
|
|
- string jointEventId = "37db8a66-660c-43a5-b8ce-6686c070973e";
|
|
|
- //第一位老師的課程、組別
|
|
|
- JointEventGroupDb jointEventTGroup1 = new JointEventGroupDb();
|
|
|
- jointEventTGroup1.id = "3f2c0d2e-c267-414a-a416-0029973e65f1";
|
|
|
- jointEventTGroup1.jointEventId = jointEventId;
|
|
|
- jointEventTGroup1.code = "JointCourse";
|
|
|
- jointEventTGroup1.pk = "JointCourse";
|
|
|
- jointEventTGroup1.creatorId = "1595321354";
|
|
|
- jointEventTGroup1.creatorName = "Rocket Man";
|
|
|
- JointEventGroupCourse jointEventTGroupCourse1 = new JointEventGroupCourse();
|
|
|
- jointEventTGroupCourse1.courseId = "e1d817e5-71b3-bc50-52ac-fa828e5f38d6";
|
|
|
- jointEventTGroupCourse1.courseName = "test";
|
|
|
- jointEventTGroupCourse1.groupLists.Add(new JointEventGroupCourseGroup() { id = "4dd434a8-a94a-4373-9a05-1a1add533a71", name = "a2" });
|
|
|
- jointEventTGroup1.courseLists.Add(jointEventTGroupCourse1);
|
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Teacher").UpsertItemAsync<JointEventGroupDb>(jointEventTGroup1, new PartitionKey("JointCourse"));
|
|
|
-
|
|
|
- //第二位老師的課程、組別
|
|
|
- JointEventGroupDb jointEventTGroup2 = new JointEventGroupDb();
|
|
|
- jointEventTGroup2.id = "23f2fc0b-c881-43d2-8679-754bd965bb09";
|
|
|
- jointEventTGroup2.jointEventId = jointEventId;
|
|
|
- jointEventTGroup2.code = "JointCourse";
|
|
|
- jointEventTGroup2.pk = "JointCourse";
|
|
|
- jointEventTGroup2.creatorId = "1522758684";
|
|
|
- jointEventTGroup2.creatorName = "DaTou Fu";
|
|
|
- JointEventGroupCourse jointEventTGroupCourse2 = new JointEventGroupCourse();
|
|
|
- jointEventTGroupCourse2.courseId = "424eb44d-8904-4e34-bfaf-e138f8e369cb";
|
|
|
- jointEventTGroupCourse2.courseName = "1522758684個人課程";
|
|
|
- jointEventTGroupCourse2.groupLists.Add(new JointEventGroupCourseGroup() { id = "5bf63f35-f82f-432e-9b78-a4f38b5edb81", name = "暑期班" });
|
|
|
- jointEventTGroup2.courseLists.Add(jointEventTGroupCourse2);
|
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Teacher").UpsertItemAsync<JointEventGroupDb>(jointEventTGroup2, new PartitionKey("JointCourse"));
|
|
|
-
|
|
|
- return Ok();
|
|
|
- }
|
|
|
-
|
|
|
- //統測資料架構生成測試
|
|
|
-
|
|
|
- [HttpPost("add-joint-exam")]
|
|
|
- public async Task<IActionResult> AddJointExam(JsonElement json)
|
|
|
- {
|
|
|
- var client = _azureCosmos.GetCosmosClient();
|
|
|
-
|
|
|
- JointExam jointExam = new JointExam();
|
|
|
- jointExam.code = "JointExam";
|
|
|
- jointExam.jointEventId = "37db8a66-660c-43a5-b8ce-6686c070973e";
|
|
|
- jointExam.id = "daaa3965-db28-49ae-8074-c9d4865b62ad";
|
|
|
- jointExam.creatorId = "1595321354";
|
|
|
- jointExam.name = "統測測試(一)";
|
|
|
- jointExam.scope = "private";
|
|
|
- jointExam.source = "0";
|
|
|
- //課程列表 ※課程列表可以從JointCourse拿,也可以前端挑選後加入
|
|
|
- ////課程1: [1595321354]"courseId": "e1d817e5-71b3-bc50-52ac-fa828e5f38d6", "groupId": "4dd434a8-a94a-4373-9a05-1a1add533a71",
|
|
|
- JointEventGroupBase jointExamGroup1 = new JointEventGroupBase();
|
|
|
- jointExamGroup1.creatorId = "1595321354";
|
|
|
- jointExamGroup1.creatorName = "Rocket Man";
|
|
|
- JointEventGroupCourse jointEventTGroupCourse1 = new JointEventGroupCourse();
|
|
|
- jointEventTGroupCourse1.courseId = "e1d817e5-71b3-bc50-52ac-fa828e5f38d6";
|
|
|
- jointEventTGroupCourse1.courseName = "test";
|
|
|
- jointEventTGroupCourse1.groupLists.Add(new JointEventGroupCourseGroup() { id = "4dd434a8-a94a-4373-9a05-1a1add533a71", name = "a2" } );
|
|
|
- jointExamGroup1.courseLists.Add(jointEventTGroupCourse1);
|
|
|
- jointExam.stuLists.Add(jointExamGroup1);
|
|
|
- ////課程2: [1522758684]"courseId": "424eb44d-8904-4e34-bfaf-e138f8e369cb", "groupId": "5bf63f35-f82f-432e-9b78-a4f38b5edb81",
|
|
|
- JointEventGroupBase jointExamGroup2 = new JointEventGroupBase();
|
|
|
- jointExamGroup2.creatorId = "1522758684";
|
|
|
- jointExamGroup2.creatorName = "DaTou Fu";
|
|
|
- JointEventGroupCourse jointEventTGroupCourse2 = new JointEventGroupCourse();
|
|
|
- jointEventTGroupCourse2.courseId = "424eb44d-8904-4e34-bfaf-e138f8e369cb";
|
|
|
- jointEventTGroupCourse2.courseName = "1522758684個人課程";
|
|
|
- jointEventTGroupCourse2.groupLists.Add(new JointEventGroupCourseGroup() { id = "5bf63f35-f82f-432e-9b78-a4f38b5edb81", name = "暑期班" });
|
|
|
- jointExamGroup2.courseLists.Add(jointEventTGroupCourse2);
|
|
|
- jointExam.stuLists.Add(jointExamGroup2);
|
|
|
- //試卷
|
|
|
- ///STEP1 Blob拷貝 ※此步驟由前端做
|
|
|
- ///拷貝目標:{TMID/SchoolId}/jointexam/{jointExam.id}/paper/{paperId}
|
|
|
- string paperSourceBlobPath = "paper/語文理解";
|
|
|
- string paperSourceBlobContainer = "tbslgb";
|
|
|
- string paperSourceScope = "school";
|
|
|
- var paperSourceBlobContainerClient = _azureStorage.GetBlobContainerClient(paperSourceBlobContainer);
|
|
|
- string paperId = "1c6a1e85-4b34-b8af-00de-a379bc47a26c";
|
|
|
- string paperTargetBlobPath = $"jointexam/{jointExam.id}/paper/{paperId}";
|
|
|
- string paperTargetBlobContainer = jointExam.creatorId;
|
|
|
- var paperTargetBlobContainerClient = _azureStorage.GetBlobContainerClient(paperTargetBlobContainer);
|
|
|
- Pageable<BlobItem> sourceBlobs = paperSourceBlobContainerClient.GetBlobs(prefix: paperSourceBlobPath);
|
|
|
- if (sourceBlobs.Count() > 0)
|
|
|
- {
|
|
|
- foreach (var blob in sourceBlobs)
|
|
|
- {
|
|
|
- var sourceFileBlob = paperSourceBlobContainerClient.GetBlobClient(blob.Name);
|
|
|
- if (sourceFileBlob.Exists())
|
|
|
- {
|
|
|
- var sourceFileUri = paperSourceBlobContainerClient.GetBlobClient(blob.Name).Uri;
|
|
|
- string fileName = blob.Name.Replace(paperSourceBlobPath, "");
|
|
|
- string destBlobFilePath = $"{paperTargetBlobPath}{fileName}";
|
|
|
- await paperTargetBlobContainerClient.GetBlobClient(destBlobFilePath).StartCopyFromUriAsync(sourceFileUri);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- bool paperDataCopyErrFlg = true;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- ///STEP2 document製作
|
|
|
- PaperSimple paper = new PaperSimple() { id= paperId , code = "Paper-tbslgb", name = "語文理解", blob = $"/{paperTargetBlobPath}", scope = "school", multipleRule = 1, point = new List<double>() { 50, 50}, answers = new List<List<string>>() { new List<string>() { "D" }, new List<string>() { "D" } }, knowledge = new List<List<string>>(), type = new List<string>() { "single","single"}, field=new List<int>() { 2, 2 } };
|
|
|
- jointExam.papers.Add(paper);
|
|
|
- //時間
|
|
|
- jointExam.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
- jointExam.startTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
- jointExam.endTime = DateTimeOffset.UtcNow.AddDays(2).ToUnixTimeMilliseconds();
|
|
|
- jointExam.progress = "going";
|
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Common").UpsertItemAsync<JointExam>(jointExam, new PartitionKey("JointExam"));
|
|
|
- return Ok();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //評量統一生成測試
|
|
|
-
|
|
|
- [HttpPost("add-exam-byJoint")]
|
|
|
- public async Task<IActionResult> AddExamByJointExam(JsonElement json)
|
|
|
- {
|
|
|
- if (!json.TryGetProperty("jointExamId", out JsonElement _jointExamId)) return BadRequest();
|
|
|
- var client = _azureCosmos.GetCosmosClient();
|
|
|
- string tmid = "1595321354";
|
|
|
- JointExam jointExam = new JointExam();
|
|
|
- await foreach (JointExam item in client.GetContainer(Constant.TEAMModelOS, "Common").GetItemQueryIteratorSql<JointExam>(
|
|
|
- queryText: $"select * from c where c.id = '{_jointExamId}' and c.creatorId = '{tmid}'",
|
|
|
- requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"JointExam") }))
|
|
|
- {
|
|
|
- jointExam = item;
|
|
|
- }
|
|
|
- if(string.IsNullOrWhiteSpace(jointExam.id))
|
|
|
- {
|
|
|
- return BadRequest();
|
|
|
- }
|
|
|
-
|
|
|
- //評量資料生成 ExamInfo actExamInfo
|
|
|
- List<ExamInfo> examList = new List<ExamInfo>();
|
|
|
- if(jointExam.stuLists.Count > 0)
|
|
|
- {
|
|
|
- foreach (JointEventGroupBase jointExamGroup in jointExam.stuLists)
|
|
|
- {
|
|
|
- string actExamCreatorId = jointExamGroup.creatorId;
|
|
|
- foreach(JointEventGroupCourse jointExamGroupCourse in jointExamGroup.courseLists)
|
|
|
- {
|
|
|
- string actExamCourseId = jointExamGroupCourse.courseId;
|
|
|
- string actExamCourseName = jointExamGroupCourse.courseName;
|
|
|
- //評量資料生成
|
|
|
- ExamInfo actExamInfo = new ExamInfo();
|
|
|
- actExamInfo.code = $"Exam-{jointExamGroup.creatorId}";
|
|
|
- actExamInfo.owner = "teacher";
|
|
|
- actExamInfo.scope = jointExam.scope;
|
|
|
- actExamInfo.creatorId = actExamCreatorId;
|
|
|
- actExamInfo.id = Guid.NewGuid().ToString();
|
|
|
- actExamInfo.source = jointExam.source;
|
|
|
- actExamInfo.name = jointExam.name;
|
|
|
- actExamInfo.jointExamId = jointExam.id;
|
|
|
- ///評量stuLists
|
|
|
- foreach (JointEventGroupCourseGroup actGroup in jointExamGroupCourse.groupLists)
|
|
|
- {
|
|
|
- actExamInfo.stuLists.Add(actGroup.id);
|
|
|
- List<string> targetRow = new List<string>() { actExamCourseId, actGroup.id };
|
|
|
- actExamInfo.targets.Add(System.Text.Json.JsonSerializer.SerializeToElement(targetRow));
|
|
|
- actExamInfo.subjects.Add(new ExamSubject() { id = actExamCourseId, name = actExamCourseName });
|
|
|
- }
|
|
|
- ///試卷 ※先用統購的試卷記入,生成評量(generateExam)時會做blob的路徑修正
|
|
|
- actExamInfo.papers = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PaperSimple>>(Newtonsoft.Json.JsonConvert.SerializeObject(jointExam.papers));
|
|
|
- ///時間
|
|
|
- actExamInfo.year = DateTimeOffset.UtcNow.Year;
|
|
|
- actExamInfo.startTime = jointExam.startTime;
|
|
|
- actExamInfo.endTime = jointExam.endTime;
|
|
|
-
|
|
|
- examList.Add(actExamInfo);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //生成評量
|
|
|
- if(examList.Count > 0)
|
|
|
- {
|
|
|
- foreach(ExamInfo exam in examList)
|
|
|
- {
|
|
|
- await generateExam(jointExam, exam);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return Ok();
|
|
|
- }
|
|
|
-
|
|
|
- //生成評量(單)
|
|
|
-
|
|
|
- private async Task<string> generateExam(JointExam jointExam, ExamInfo exam)
|
|
|
- {
|
|
|
- var client = _azureCosmos.GetCosmosClient();
|
|
|
- long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
- string Result = string.Empty;
|
|
|
- exam.createTime = now;
|
|
|
- if (exam.startTime <= 0) exam.startTime = now;
|
|
|
- List<(string pId, List<string> gid)> ps = new();
|
|
|
- var group = exam.groupLists;
|
|
|
- if (group.Count > 0)
|
|
|
- {
|
|
|
- foreach (var keys in group)
|
|
|
- {
|
|
|
- foreach (KeyValuePair<string, List<string>> pp in keys)
|
|
|
- {
|
|
|
- ps.Add((pp.Key, pp.Value));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- List<string> classes = ExamService.getClasses(exam.classes, exam.stuLists);
|
|
|
- (List<RMember> tchList, List<RGroupList> classLists) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, classes, exam.school, ps);
|
|
|
- exam.stuCount = tchList.Count;
|
|
|
- string mode = string.Empty;
|
|
|
- ResponseMessage response = null;
|
|
|
- if (string.IsNullOrEmpty(exam.id))
|
|
|
- {
|
|
|
- mode = "add";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- response = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(exam.id, new PartitionKey($"{exam.code}"));
|
|
|
- if (response.StatusCode==System.Net.HttpStatusCode.OK) mode = "upd";
|
|
|
- else mode = "add";
|
|
|
- }
|
|
|
- //DB操作
|
|
|
- if (mode.Equals("add")) //新建
|
|
|
- {
|
|
|
- if(string.IsNullOrWhiteSpace(exam.id)) exam.id = Guid.NewGuid().ToString();
|
|
|
- exam.progress = (exam.startTime > now) ? "pending" : "going";
|
|
|
- var messageBlob = new ServiceBusMessage();
|
|
|
- exam.size = await _azureStorage.GetBlobContainerClient(exam.creatorId).GetBlobsSize($"exam/{exam.id}"); //統測只允許老師個人,Blob只指向creatorId
|
|
|
- await BlobService.RefreshBlobRoot(new BlobRefreshMessage { progress = "insert", root = $"exam", name = exam.creatorId }, _serviceBus, _configuration, _azureRedis);
|
|
|
- int n = 0;
|
|
|
- List<string> sheetIds = new List<string>();
|
|
|
- foreach (PaperSimple simple in exam.papers)
|
|
|
- {
|
|
|
- simple.blob = $"/exam/{exam.id}/paper/{exam.subjects[n].id}";
|
|
|
- n++;
|
|
|
- simple.sheet = null;
|
|
|
- }
|
|
|
- exam = await client.GetContainer(Constant.TEAMModelOS, "Common").CreateItemAsync(exam, new PartitionKey($"{exam.code}"));
|
|
|
- await BIStats.SetTypeAddStats(client, _dingDing, exam.school, "Exam", 1);//BI统计增/减量
|
|
|
- }
|
|
|
- else if(response != null) //更新
|
|
|
- {
|
|
|
- using var json = await JsonDocument.ParseAsync(response.Content);
|
|
|
- ExamInfo info = json.ToObject<ExamInfo>();
|
|
|
- if (info.progress.Equals("going"))
|
|
|
- {
|
|
|
- Result = "活动正在进行中,无法修改";
|
|
|
- }
|
|
|
- var messageBlob = new ServiceBusMessage();
|
|
|
- exam.size = await _azureStorage.GetBlobContainerClient(exam.creatorId).GetBlobsSize($"exam/{exam.id}");
|
|
|
- await BlobService.RefreshBlobRoot(new BlobRefreshMessage { progress = "update", root = $"exam", name = exam.creatorId }, _serviceBus, _configuration, _azureRedis);
|
|
|
- exam.progress = info.progress;
|
|
|
- int n = 0;
|
|
|
- foreach (PaperSimple simple in exam.papers)
|
|
|
- {
|
|
|
- simple.blob = "/exam/" + exam.id + "/paper/" + exam.subjects[n].id;
|
|
|
- n++;
|
|
|
- }
|
|
|
- exam = await client.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync(exam, exam.id, new PartitionKey($"{exam.code}"));
|
|
|
- }
|
|
|
- //Blob操作 ※取得試卷源(blob)、複製到評測紀錄下
|
|
|
- ///試卷源字典
|
|
|
- List<Dictionary<string, string>> sourcePaperInfo = new List<Dictionary<string, string>>();
|
|
|
- foreach (PaperSimple paperInfo in jointExam.papers)
|
|
|
- {
|
|
|
- string paperBlobPath = (!paperInfo.blob.EndsWith("/")) ? paperInfo.blob + "/" : paperInfo.blob;
|
|
|
- paperBlobPath = (paperInfo.blob.StartsWith("/")) ? paperBlobPath.Remove(0, 1) : paperBlobPath;
|
|
|
- sourcePaperInfo.Add(new Dictionary<string, string>() { { "id", paperInfo.id }, { "blob", paperBlobPath }, { "itemcount", paperInfo.point.Count.ToString() } });
|
|
|
- }
|
|
|
- bool paperDataCopyErrFlg = false; //試卷資料拷貝錯誤Flag true:拷貝錯誤
|
|
|
- //Blob拷貝程序
|
|
|
- int paperIndex = 0;
|
|
|
- foreach (Dictionary<string, string> sourcePaperInfoDic in sourcePaperInfo)
|
|
|
- {
|
|
|
- //拷貝源:Container => jointExam.creatorId Path:papers.blob
|
|
|
- //拷貝對象:Container => exam.creatorId, Path:exam/{exam.id}/paper/{exam.subjects[paperIndex].id}/
|
|
|
- string targetScope = exam.scope; //評測對象 school:校本班級 private:私人課程
|
|
|
- var sourceBlobContainer = _azureStorage.GetBlobContainerClient(jointExam.creatorId);
|
|
|
- var blobPrivateContainer = _azureStorage.GetBlobContainerClient(exam.creatorId);
|
|
|
- string sourceBlobPath = sourcePaperInfoDic["blob"];
|
|
|
- string subjectId = exam.subjects[paperIndex].id;
|
|
|
- string destBlobPath = $"exam/{exam.id}/paper/{subjectId}/"; //拷貝對象路徑 path:exam/{評測ID}/paper/{subjectID}/
|
|
|
- Pageable<BlobItem> sourceBlobs = sourceBlobContainer.GetBlobs(prefix: sourceBlobPath);
|
|
|
- if (sourceBlobs.Count() > 0)
|
|
|
- {
|
|
|
- foreach (var blob in sourceBlobs)
|
|
|
- {
|
|
|
- var sourceFileBlob = sourceBlobContainer.GetBlobClient(blob.Name);
|
|
|
- if (sourceFileBlob.Exists())
|
|
|
- {
|
|
|
- var sourceFileUri = sourceBlobContainer.GetBlobClient(blob.Name).Uri;
|
|
|
- string fileName = blob.Name.Replace(sourceBlobPath, "");
|
|
|
- string destBlobFilePath = $"{destBlobPath}{fileName}";
|
|
|
- await blobPrivateContainer.GetBlobClient(destBlobFilePath).StartCopyFromUriAsync(sourceFileUri);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- paperDataCopyErrFlg = true;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- paperIndex++;
|
|
|
- }
|
|
|
-
|
|
|
- return Result;
|
|
|
- }
|
|
|
}
|
|
|
}
|