Przeglądaj źródła

开放平台新增/修改学生艺术评测(音乐)分数结果

Li 2 lat temu
rodzic
commit
fd56776fc6

+ 1 - 1
TEAMModelOS.SDK/Models/Cosmos/OpenEntity/OSchool.cs

@@ -223,6 +223,6 @@ namespace TEAMModelOS.SDK.Models.Cosmos.OpenEntity
         public int upload { get; set; }
         public int upload { get; set; }
 
 
         public LearningCategory learningCategory { get; set; }
         public LearningCategory learningCategory { get; set; }
-        public int hitaClientCmpCount { get; set; }
+        //public int hitaClientCmpCount { get; set; }
     }
     }
 }
 }

+ 102 - 0
TEAMModelOS.SDK/Models/Cosmos/OpenEntity/OStudent.cs

@@ -74,4 +74,106 @@ namespace TEAMModelOS.SDK.Models.Cosmos.OpenEntity
         /// </summary>
         /// </summary>
         public long createTime { get; set; }
         public long createTime { get; set; }
     }
     }
+
+
+    
+    public class OAnswerUp: OAnswer
+    {
+        /// <summary>
+        /// 活动id
+        /// </summary>
+        public string artId { get; set; }
+        /// <summary>
+        /// 学生id
+        /// </summary>
+        public string studentId { get; set; }
+    }
+
+    /// <summary>
+    /// 答题回传信息
+    /// </summary>
+    public class OAnswer
+    {
+        /// <summary>
+        /// 答题id
+        /// </summary>
+        public int questionId { get; set; }
+        /// <summary>
+        /// 任务id
+        /// </summary>
+        public string thirdAnswerId { get; set; }
+        /// <summary>
+        /// 身份
+        /// </summary>
+        public int status { get; set; }
+        /// <summary>
+        /// 答题总体结果
+        /// </summary>
+        public int score { get; set; }
+        /// <summary>
+        /// 答题结果
+        /// </summary>
+        public OAnswerDetail detail { get; set; }
+    }
+
+    /// <summary>
+    /// 音乐答题结果信息
+    /// </summary>
+    public class OAnswerDetail
+    {
+        /// <summary>
+        /// 必唱
+        /// </summary>
+        public ODetail mustSong { get; set; }
+        /// <summary>
+        /// 选唱
+        /// </summary>
+        public ODetail optionSong { get; set; }
+    }
+
+    /// <summary>
+    /// 答题详情
+    /// </summary>
+    public class ODetail
+    {
+        /// <summary>
+        /// 曲目信息
+        /// </summary>
+        public List<OSong> songs { get; set; }
+        /// <summary>
+        /// 曲目打分结果
+        /// </summary>
+        public List<OScore> score { get; set; }
+    }
+
+    /// <summary>
+    /// 曲目信息
+    /// </summary>
+    public class OSong
+    {
+        public int songId { get; set; }
+        public string songName { get; set; }
+    }
+    /// <summary>
+    /// 曲目打分结果
+    /// </summary>
+    public class OScore : OSong
+    {
+        /// <summary>
+        /// 音准
+        /// </summary>
+        public int pitchAccuracy { get; set; }
+        /// <summary>
+        /// 节奏
+        /// </summary>
+        public int rhythmAccuracy { get; set; }
+        /// <summary>
+        /// 唱词
+        /// </summary>
+        public int lyricAccuracy { get; set; }
+        /// <summary>
+        /// 情感
+        /// </summary>
+        public int emotionAccuracy { get; set; }
+    }
 }
 }

+ 12 - 0
TEAMModelOS.SDK/Models/Cosmos/Student/StudentArtResult.cs

@@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations;
 using System.Linq;
 using System.Linq;
 using System.Text;
 using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
+using TEAMModelOS.SDK.Models.Cosmos.OpenEntity;
 
 
 namespace TEAMModelOS.SDK.Models 
 namespace TEAMModelOS.SDK.Models 
 {
 {
@@ -25,6 +26,12 @@ namespace TEAMModelOS.SDK.Models
         public string blob { get; set; }
         public string blob { get; set; }
 
 
         public Attachment pdf { get; set; }= new Attachment();
         public Attachment pdf { get; set; }= new Attachment();
+
+        /// <summary>
+        /// 艺术评测 音乐 从智音传过来的分数结果信息
+        /// </summary>
+        public OAnswer oAnswer { get; set; }
+
     }
     }
     public class ArtSubjectScore {
     public class ArtSubjectScore {
         public string subjectId { get; set; }
         public string subjectId { get; set; }
@@ -68,6 +75,11 @@ namespace TEAMModelOS.SDK.Models
         /// 上传的文件
         /// 上传的文件
         /// </summary>
         /// </summary>
         public List<Attachment> files { get; set; }
         public List<Attachment> files { get; set; }
+
+        /// <summary>
+        /// 分数结果来源    0醍摩豆系统分数结果   1智音传分数结果
+        /// </summary>
+        public int source { get; set; } = 0;
     }
     }
     public class ArtStudentPdf
     public class ArtStudentPdf
     {
     {

+ 104 - 48
TEAMModelOS/Controllers/OpenApi/Business/BizOverallEducationController.cs

@@ -80,7 +80,7 @@ namespace TEAMModelOS.Controllers
         [ProducesDefaultResponseType]
         [ProducesDefaultResponseType]
         [HttpPost("get-student-info")]
         [HttpPost("get-student-info")]
         [ApiToken(Auth = "1902", Name = "学生详细信息", TName = "學生詳細信息", EName = "Student Details", RWN = "R", Limit = false)]
         [ApiToken(Auth = "1902", Name = "学生详细信息", TName = "學生詳細信息", EName = "Student Details", RWN = "R", Limit = false)]
-        public async Task<IActionResult> GetLoginStuInfo(JsonElement jsonElement) 
+        public async Task<IActionResult> GetLoginStuInfo(JsonElement jsonElement)
         {
         {
             var (id, school) = HttpContext.GetApiTokenInfo();
             var (id, school) = HttpContext.GetApiTokenInfo();
             //if(!jsonElement.TryGetProperty("schoolId",out JsonElement schoolId)) return Ok(new { code = RespondCode.ParamsError, msg = "参数错误:schoolId", data = "" });
             //if(!jsonElement.TryGetProperty("schoolId",out JsonElement schoolId)) return Ok(new { code = RespondCode.ParamsError, msg = "参数错误:schoolId", data = "" });
@@ -88,8 +88,10 @@ namespace TEAMModelOS.Controllers
             return Ok(new { responseData });
             return Ok(new { responseData });
         }
         }
 
 
+        #region  杉达公司
+
         /// <summary>
         /// <summary>
-        /// 开课或者上传课例信息  是因支持VR/AR的公司
+        /// 开课或者上传课例信息  是因支持VR/AR的公司(杉达)
         /// </summary>
         /// </summary>
         /// <param name="jsonElement"></param>
         /// <param name="jsonElement"></param>
         /// <returns></returns>
         /// <returns></returns>
@@ -130,7 +132,7 @@ namespace TEAMModelOS.Controllers
                 }
                 }
                 else
                 else
                     lessonRecord.upload = 0;
                     lessonRecord.upload = 0;
-                if (!string.IsNullOrEmpty($"{timLineJson}")) 
+                if (!string.IsNullOrEmpty($"{timLineJson}"))
                 {
                 {
                     timeLine = timLineJson.ToObject<TimeLine>();
                     timeLine = timLineJson.ToObject<TimeLine>();
                     lessonRecord.upload = 1;
                     lessonRecord.upload = 1;
@@ -278,12 +280,12 @@ namespace TEAMModelOS.Controllers
             catch (Exception ex)
             catch (Exception ex)
             {
             {
                 await _dingDing.SendBotMsg($"OpenApi,{Environment.GetEnvironmentVariable("Option:Location")} BizOverallEducation/UpLessonRec()   参数:bizId:{id},school:{school},json:{jsonElement.ToJsonString()} \n  {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
                 await _dingDing.SendBotMsg($"OpenApi,{Environment.GetEnvironmentVariable("Option:Location")} BizOverallEducation/UpLessonRec()   参数:bizId:{id},school:{school},json:{jsonElement.ToJsonString()} \n  {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
-                return Ok(new { responseData= new ResponseData<dynamic>() { code = RespondCode.Error, msg = "服务端异常" } });
+                return Ok(new { responseData = new ResponseData<dynamic>() { code = RespondCode.Error, msg = "服务端异常" } });
             }
             }
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 获取学校课例  是因支持VR/AR的公司
+        /// 获取学校课例  是因支持VR/AR的公司(杉达)
         /// </summary>
         /// </summary>
         /// <param name="jsonElement"></param>
         /// <param name="jsonElement"></param>
         /// <returns></returns>
         /// <returns></returns>
@@ -301,13 +303,67 @@ namespace TEAMModelOS.Controllers
                 sql.Append($" and c.id='{lessId}'");
                 sql.Append($" and c.id='{lessId}'");
 
 
             List<OLessonRecord> lessonRecords = new();
             List<OLessonRecord> lessonRecords = new();
-            await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS,"School").GetItemQueryIterator<OLessonRecord>(queryText:sql.ToString(),requestOptions:new QueryRequestOptions() { PartitionKey = new PartitionKey($"LessonRecord-{school}") }))
+            await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<OLessonRecord>(queryText: sql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"LessonRecord-{school}") }))
             {
             {
                 lessonRecords.Add(item);
                 lessonRecords.Add(item);
             }
             }
 
 
             return Ok(new { responseData = new ResponseData<dynamic>() { code = RespondCode.Ok, msg = "成功", data = lessonRecords } });
             return Ok(new { responseData = new ResponseData<dynamic>() { code = RespondCode.Ok, msg = "成功", data = lessonRecords } });
         }
         }
+
+        #endregion
+
+        #region 智音公司
+
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="jsonElement"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [HttpPost("set-stdent-score")]
+        [ApiToken(Auth = "1905", Name = "添加/修改学生艺术评测音乐答题结果", TName = "添加/修改學生藝術評測音樂答題結果", EName = "Add/modify the music answer results of student art evaluation", RWN = "R", Limit = false)]
+        public async Task<IActionResult> SetStudnetScore(JsonElement jsonElement)
+        {
+            var (id, school) = HttpContext.GetApiTokenInfo();
+
+            if (!jsonElement.TryGetProperty("oaswer", out JsonElement _oaswer)) return Ok(new { responseDate = new ResponseData<dynamic>() { code = RespondCode.ParamsError, msg = "oaswer参数错误", data = null } });
+            OAnswerUp oAnswer = _oaswer.ToObject<OAnswerUp>();
+            StudentArtResult studentArtResult = new();
+            var cosmosClient = _azureCosmos.GetCosmosClient();
+            var resArt = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Student").ReadItemStreamAsync($"{school}-{oAnswer.studentId}", new PartitionKey($"ArtResult-{oAnswer.artId}"));
+            if (resArt.Status == 200)
+            {
+                JsonDocument jsonD = JsonDocument.Parse(resArt.Content);
+                studentArtResult = jsonD.RootElement.ToObject<StudentArtResult>();
+                var temp = studentArtResult.results.Find(f => f.Equals(oAnswer.thirdAnswerId));
+                temp.score = oAnswer.score;
+                temp.source = 1;
+                studentArtResult.oAnswer.questionId = oAnswer.questionId;
+                studentArtResult.oAnswer.thirdAnswerId = oAnswer.thirdAnswerId;
+                studentArtResult.oAnswer.score = oAnswer.score;
+                studentArtResult.oAnswer.detail = oAnswer.detail;
+
+                studentArtResult= await cosmosClient.GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StudentArtResult>(studentArtResult, studentArtResult.id,new PartitionKey(studentArtResult.code));
+            }
+            else
+                return Ok(new { responseDate = new ResponseData<dynamic>() { code = RespondCode.NotFound, msg = "未找到活动相关学生答题信息", data = null } });
+
+            return Ok(new { responseData = new ResponseData<dynamic>() { code = RespondCode.Ok, msg = "成功", data = null } });
+        }
+
+
+
+
+        #endregion
+
+
+
+
+
+
+
         ///数据结构说明
         ///数据结构说明
         /**
         /**
          *
          *
@@ -318,10 +374,10 @@ X-Auth-ApiToken:授权token eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRz
 Content-Type: application/json
 Content-Type: application/json
 params [body json]: 
 params [body json]: 
 {
 {
-    "schoolCode": "hbcn",
-    "periodId": "463db08d-cbe7-48a0-a81a-fc39b3c1fep1",
-    "subjectId": "subject_sport",
-    "students": [
+"schoolCode": "hbcn",
+"periodId": "463db08d-cbe7-48a0-a81a-fc39b3c1fep1",
+"subjectId": "subject_sport",
+"students": [
         {
         {
             "studentId": "202001001",
             "studentId": "202001001",
             "name": "卢三诗",
             "name": "卢三诗",
@@ -348,11 +404,11 @@ params [body json]:
                 }
                 }
             ]
             ]
         }
         }
-    ]
+]
 }
 }
 //正确返回
 //正确返回
 {
 {
-    "responseData": {
+"responseData": {
         "code": 200,
         "code": 200,
         "msg": "成功",
         "msg": "成功",
         "data": {
         "data": {
@@ -360,15 +416,15 @@ params [body json]:
             "unmatchSemester":[],//如果数组长度大于0则,包含的学期信息不匹配
             "unmatchSemester":[],//如果数组长度大于0则,包含的学期信息不匹配
             "upsertDatas":[],//如果数组长度大于0则,表示更新或保存成功的数据
             "upsertDatas":[],//如果数组长度大于0则,表示更新或保存成功的数据
         }
         }
-    }
+}
 }
 }
 //错误返回
 //错误返回
 {
 {
-    "responseData": {
+"responseData": {
         "code": 500,
         "code": 500,
         "msg": "返回信息"
         "msg": "返回信息"
         
         
-    }
+}
 }
 }
 code:
 code:
 500 服务端异常
 500 服务端异常
@@ -381,10 +437,10 @@ code:
 400 schoolCode为空
 400 schoolCode为空
 //接口规范
 //接口规范
 {
 {
-    "schoolCode": "hbcn", //学校简码
-    "periodId": "52076c94-7581-fbae-4487-4b162a61fea3", //学段id
-    "subjectId": "subject_sport", //体育科目id
-    "students": [
+"schoolCode": "hbcn", //学校简码
+"periodId": "52076c94-7581-fbae-4487-4b162a61fea3", //学段id
+"subjectId": "subject_sport", //体育科目id
+"students": [
         {
         {
             "studentId": "20220901", //学生编号
             "studentId": "20220901", //学生编号
             "name": "海献仪", //学生姓名
             "name": "海献仪", //学生姓名
@@ -411,25 +467,25 @@ code:
                 }
                 }
             ]
             ]
         }
         }
-    ]
+]
 }
 }
 //五育数据看板结构
 //五育数据看板结构
 {
 {
-    "id": "年份2021-学期id",
-    "semesterName": "上学期",
-    "year": 2021,
-    "semesterId": "17f85c96-253d-4f84-84ad-c819f0b605s2",
-    "code": "hbcn-20220901",
-    "schoolCode": "hbcn",
-    "studentId": "20220901",
-    "name": "海献仪",
-    "classId": [
+"id": "年份2021-学期id",
+"semesterName": "上学期",
+"year": 2021,
+"semesterId": "17f85c96-253d-4f84-84ad-c819f0b605s2",
+"code": "hbcn-20220901",
+"schoolCode": "hbcn",
+"studentId": "20220901",
+"name": "海献仪",
+"classId": [
         "c406eee2-1ce9-caf4-5fc0-57351604b615"
         "c406eee2-1ce9-caf4-5fc0-57351604b615"
-    ],
-    "periodId": "52076c94-7581-fbae-4487-4b162a61fea3",
-    "grade": 1,
-    "virtue": //德
-    [
+],
+"periodId": "52076c94-7581-fbae-4487-4b162a61fea3",
+"grade": 1,
+"virtue": //德
+[
         {
         {
             "id": "17f85c96-253d-4f84-84ad-c819f0b605s2",
             "id": "17f85c96-253d-4f84-84ad-c819f0b605s2",
             "name": "评测名称",
             "name": "评测名称",
@@ -447,9 +503,9 @@ code:
                 }
                 }
             ]
             ]
         }
         }
-    ],
-    "intelligence": //智
-    [
+],
+"intelligence": //智
+[
         {
         {
             "id": "17f85c96-253d-4f84-84ad-c819f0b605s2",
             "id": "17f85c96-253d-4f84-84ad-c819f0b605s2",
             "name": "评测名称",
             "name": "评测名称",
@@ -458,9 +514,9 @@ code:
             "examDate": 1629947402486,
             "examDate": 1629947402486,
             "level": 1
             "level": 1
         }
         }
-    ],
-    "sports": //体
-    [
+],
+"sports": //体
+[
         {
         {
             "id": "17f85c96-253d-4f84-84ad-c819f0b605s2",
             "id": "17f85c96-253d-4f84-84ad-c819f0b605s2",
             "name": "评测名称",
             "name": "评测名称",
@@ -477,9 +533,9 @@ code:
                 }
                 }
             ]
             ]
         }
         }
-    ],
-    "art": //美
-    [
+],
+"art": //美
+[
         {
         {
             "id": "17f85c96-253d-4f84-84ad-c819f0b605s2",
             "id": "17f85c96-253d-4f84-84ad-c819f0b605s2",
             "name": "评测名称",
             "name": "评测名称",
@@ -488,9 +544,9 @@ code:
             "examDate": 1629947402486,
             "examDate": 1629947402486,
             "level": 1,
             "level": 1,
         }
         }
-    ],
-    "labour": //劳
-    [
+],
+"labour": //劳
+[
         {
         {
             "id": "17f85c96-253d-4f84-84ad-c819f0b605s2",
             "id": "17f85c96-253d-4f84-84ad-c819f0b605s2",
             "name": "任务名称",
             "name": "任务名称",
@@ -505,9 +561,9 @@ code:
                 }
                 }
             ]
             ]
         }
         }
-    ]
+]
 }
 }
-* **/
+    * **/
 
 
     }
     }
 }
 }