瀏覽代碼

处理数据接口。/

CrazyIter_Bin 3 年之前
父節點
當前提交
7653ca00b0

+ 1 - 2
TEAMModelFunction/TriggerStudy.cs

@@ -42,7 +42,6 @@ namespace TEAMModelFunction
                 List<ChangeRecord> changeRecords = await _azureStorage.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", input.Id }, { "PartitionKey", study.progress } });
                 if (study != null)
                 {
-
                     switch (study.progress)
                     {
                         case "pending":
@@ -129,7 +128,7 @@ namespace TEAMModelFunction
             }
             catch (Exception ex)
             {
-                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}研修活动异常{ex.Message}{ex.StackTrace}", GroupNames.成都开发測試群組);
+                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}研修活动异常{ex.Message}{ex.StackTrace}{tdata.ToJsonString()}{input}", GroupNames.成都开发測試群組);
             }
 
         }

+ 8 - 0
TEAMModelOS.SDK/Models/Service/ExamService.cs

@@ -47,6 +47,14 @@ namespace TEAMModelOS.SDK.Models.Service
 
                 if (string.IsNullOrEmpty(trExam.id))
                 {
+                    if (trExam.startTime > now)
+                    {
+                        trExam.progress = "pending";
+                    }
+                    else
+                    {
+                        trExam.progress = "going";
+                    }
                     trExam.id = Guid.NewGuid().ToString();
                     await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(trExam, new PartitionKey($"{trExam.code}"));
                 }

+ 8 - 0
TEAMModelOS.SDK/Models/Service/HomeworkService.cs

@@ -21,6 +21,14 @@ namespace TEAMModelOS.SDK.Models.Service
                 if (string.IsNullOrEmpty(work.id))
                 {
                     work.id = Guid.NewGuid().ToString();
+                    if (work.startTime > now)
+                    {
+                        work.progress = "pending";
+                    }
+                    else
+                    {
+                        work.progress = "going";
+                    }
                     await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(work, new PartitionKey($"{work.code}"));
                 }
                 else

+ 8 - 0
TEAMModelOS.SDK/Models/Service/SurveyService.cs

@@ -21,6 +21,14 @@ namespace TEAMModelOS.SDK.Models.Service
                 if (string.IsNullOrEmpty(survey.id))
                 {
                     survey.id = Guid.NewGuid().ToString();
+                    if (survey.startTime > now)
+                    {
+                        survey.progress = "pending";
+                    }
+                    else
+                    {
+                        survey.progress = "going";
+                    }
                     await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(survey, new PartitionKey($"{survey.code}"));
                 }
                 else

+ 33 - 1
TEAMModelOS/Controllers/Common/AreaController.cs

@@ -212,6 +212,14 @@ namespace TEAMModelOS.Controllers
                 areaStudy.scope = "school";
                 areaStudy.code = "Study-" + id.GetString();
                 areaStudy.createTime = now;
+                if (areaStudy.startTime > now)
+                {
+                    areaStudy.progress = "pending";
+                }
+                else
+                {
+                    areaStudy.progress = "going";
+                }
                 if (string.IsNullOrEmpty(areaStudy.id))
                 {
                     areaStudy.id = Guid.NewGuid().ToString();
@@ -227,6 +235,15 @@ namespace TEAMModelOS.Controllers
                     study.ttl = -1;
                     study.code = "Study-" + pa.sId;
                     study.createTime = now;
+
+                    if (study.startTime > now)
+                    {
+                        study.progress = "pending";
+                    }
+                    else
+                    {
+                        study.progress = "going";
+                    }
                     study.tchLists = pa.gId;
                     study.pId = areaStudy.id;
                     study.scope = "school";
@@ -1085,7 +1102,14 @@ namespace TEAMModelOS.Controllers
                     areaExam.id = Guid.NewGuid().ToString();
                 }
                 List<string> allName = new();
-
+                if (areaExam.startTime > now)
+                {
+                    areaExam.progress = "pending";
+                }
+                else
+                {
+                    areaExam.progress = "going";
+                }
                 foreach (parameter pa in parameters)
                 {
                     ExamLite trExam = exam.ToObject<ExamLite>();
@@ -1098,6 +1122,14 @@ namespace TEAMModelOS.Controllers
                     trExam.owner = "area";
                     trExam.pId = areaExam.id;
                     trExam.targetType = "research";
+                    if (trExam.startTime > now)
+                    {
+                        trExam.progress = "pending";
+                    }
+                    else
+                    {
+                        trExam.progress = "going";
+                    }
                     if (pa.gName.Count == 0)
                     {
                         string sName = pa.sName + "-" + "所有老师(未分组)";

+ 1 - 1
TEAMModelOS/Controllers/Common/ExamLiteController.cs

@@ -65,6 +65,7 @@ namespace TEAMModelOS.Controllers.Common
                 string id = await ExamService.saveMoreAsync(client, _dingDing, trExam);
                 if (string.IsNullOrEmpty(id))
                 {
+                    
                     return Ok(new { code = (int)HttpStatusCode.BadRequest, msg = "评测信息异常" });
                 }
                 else
@@ -72,7 +73,6 @@ namespace TEAMModelOS.Controllers.Common
                     return Ok(new { id, code = (int)HttpStatusCode.OK });
                 }
                 
-
             }
             catch (Exception ex)
             {

+ 8 - 1
TEAMModelOS/Controllers/Common/StudyController.cs

@@ -66,9 +66,16 @@ namespace TEAMModelOS.Controllers.Common
                 study.scope = "School";
                 long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
                 study.createTime = now;
-
                 if (string.IsNullOrEmpty(study.id))
                 {
+                    if (study.startTime > now)
+                    {
+                        study.progress = "pending";
+                    }
+                    else
+                    {
+                        study.progress = "going";
+                    }
                     study.id = Guid.NewGuid().ToString();
                     await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(study, new PartitionKey($"{study.code}"));
                 }

+ 15 - 13
TEAMModelOS/Controllers/Research/ResearchStatisticsController.cs

@@ -1040,19 +1040,21 @@ namespace TEAMModelOS.Controllers.Research
                             }
                         }
                         Ability ability = abilities.Find(x => x.id.Equals(item.id));
-                        subs.Add(new SubStatistic
-                        {
-                            abilityId = item.id,
-                            code = item.code,
-                            uploadCount = item.uploads.IsNotEmpty() ? item.uploads.Count : 0,
-                            otherScoreCount = item.otherScore.IsNotEmpty() ? item.otherScore.Count : 0,
-                            comidCount = 0,
-                            self = item.self,
-                            abilityName = ability.name,
-                            no = ability.no,
-                            dimension = ability.dimension,
-                            env = ability.env
-                        });
+                        if (ability != null) {
+                            subs.Add(new SubStatistic
+                            {
+                                abilityId = item.id,
+                                code = item.code,
+                                uploadCount = item.uploads.IsNotEmpty() ? item.uploads.Count : 0,
+                                otherScoreCount = item.otherScore.IsNotEmpty() ? item.otherScore.Count : 0,
+                                comidCount = 0,
+                                self = item.self,
+                                abilityName = ability.name,
+                                no = ability.no,
+                                dimension = ability.dimension,
+                                env = ability.env
+                            });
+                        }
                     });
                     //处理单项 超标准 学时 
                     alltime += onlineTime >= setting.onlineTime ? setting.onlineTime : onlineTime;

+ 1 - 1
TEAMModelOS/Controllers/XTest/TestController.cs

@@ -291,7 +291,7 @@ namespace TEAMModelOS.Controllers
             try
             {
                 var client = _azureCosmos.GetCosmosClient();
-                (List<TmdInfo> tchList, List<ClassListInfo> classInfos) = await TriggerStuActivity.GetTchList(client, _dingDing, new List<string> { "76739d39-b9c1-d34f-8407-836369a4f3a2", "82c216a2-2595-ffc7-1b80-5455e064bc03" , "a981419a-6c35-22fe-f339-8f46e5a41456" }, "hbcn");
+                (List<TmdInfo> tchList, List<ClassListInfo> classInfos) = await TriggerStuActivity.GetTchList(client, _dingDing, new List<string> { "default" }, "ssjxx");
                 return Ok(new { code = 1, tchList, classInfos });
             }
             catch (Exception e)