浏览代码

开放API内容

zhouj1203@hotmail.com 4 年之前
父节点
当前提交
2dcb224356

+ 77 - 75
TEAMModelFunction/TriggerExam.cs

@@ -357,95 +357,97 @@ namespace TEAMModelFunction
                     }
                     break;
                 case "finish":
-                    int fno = 0;
-                    foreach (ExamSubject subject in info.subjects)
-                    {
-                        await createClassResultAsync(info, examClassResults, subject, fno, _azureCosmos, _dingDing, _azureStorage);
-                        fno++;
-                    }
+                    if (info.papers.Count > 0) {
+                        int fno = 0;
+                        foreach (ExamSubject subject in info.subjects)
+                        {
+                            await createClassResultAsync(info, examClassResults, subject, fno, _azureCosmos, _dingDing, _azureStorage);
+                            fno++;
+                        }
 
-                    //计算单次考试简易统计信息
-                    List<ExamResult> examResults = new List<ExamResult>();
-                    await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryIterator<ExamResult>(
-                                       queryText: $"select value(c) from c where c.examId  = '{info.id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"ExamResult-{info.id}") }))
-                    {
-                        examResults.Add(item);
-                    }
-                    //结算单科单班的标准差和平均分
-                    foreach (ExamClassResult classResult in examClassResults)
-                    {
-                        //标记单科单班总得分
-                        double subScore = 0;
-                        //标准差
-                        double sPowSum = 0;
-                        var scount = classResult.studentIds.Count;
-                        foreach (List<double> sc in classResult.studentScores)
+                        //计算单次考试简易统计信息
+                        List<ExamResult> examResults = new List<ExamResult>();
+                        await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryIterator<ExamResult>(
+                                           queryText: $"select value(c) from c where c.examId  = '{info.id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"ExamResult-{info.id}") }))
                         {
-                            subScore += sc.Sum();
+                            examResults.Add(item);
                         }
-                        foreach (string sid in classResult.studentIds)
+                        //结算单科单班的标准差和平均分
+                        foreach (ExamClassResult classResult in examClassResults)
                         {
-                            double ssc = classResult.studentScores[classResult.studentIds.IndexOf(sid)].Sum();
-                            sPowSum += Math.Pow(ssc - scount > 0 ? Math.Round(subScore * 1.0 / scount, 2) : 0, 2);
+                            //标记单科单班总得分
+                            double subScore = 0;
+                            //标准差
+                            double sPowSum = 0;
+                            var scount = classResult.studentIds.Count;
+                            foreach (List<double> sc in classResult.studentScores)
+                            {
+                                subScore += sc.Sum();
+                            }
+                            foreach (string sid in classResult.studentIds)
+                            {
+                                double ssc = classResult.studentScores[classResult.studentIds.IndexOf(sid)].Sum();
+                                sPowSum += Math.Pow(ssc - scount > 0 ? Math.Round(subScore * 1.0 / scount, 2) : 0, 2);
 
+                            }
+                            classResult.standard = Math.Round(scount > 0 ? Math.Pow(sPowSum / scount, 0.5) : 0, 2);
+                            classResult.average = scount > 0 ? Math.Round(subScore / scount, 2) : 0;
+                            await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(classResult, classResult.id, new Azure.Cosmos.PartitionKey($"{classResult.code}"));
                         }
-                        classResult.standard = Math.Round(scount > 0 ? Math.Pow(sPowSum / scount, 0.5) : 0, 2);
-                        classResult.average = scount > 0 ? Math.Round(subScore / scount, 2) : 0;
-                        await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(classResult, classResult.id, new Azure.Cosmos.PartitionKey($"{classResult.code}"));
-                    }
-                    //记录某次考试所有学生得分总分
-                    double score = 0;
-                    double allScore = 0;
-                    int stuCount = 0;
-                    //整体平均分
-                    double average = 0;
-                    //标准差
-                    double powSum = 0;
-                    List<string> losStu = new List<string>();
-                    //先与第一个值取并集
-                    if (examResults.Count > 0)
-                    {
-                        losStu.Union(examResults[0].lostStus);
-                        foreach (ExamResult examResult in examResults)
+                        //记录某次考试所有学生得分总分
+                        double score = 0;
+                        double allScore = 0;
+                        int stuCount = 0;
+                        //整体平均分
+                        double average = 0;
+                        //标准差
+                        double powSum = 0;
+                        List<string> losStu = new List<string>();
+                        //先与第一个值取并集
+                        if (examResults.Count > 0)
                         {
-                            if (info.id == examResult.examId)
+                            losStu.Union(examResults[0].lostStus);
+                            foreach (ExamResult examResult in examResults)
                             {
-                                foreach (List<double> sc in examResult.studentScores)
+                                if (info.id == examResult.examId)
                                 {
-                                    score += sc.Sum();
+                                    foreach (List<double> sc in examResult.studentScores)
+                                    {
+                                        score += sc.Sum();
+                                    }
+                                    stuCount = examResult.studentIds.Count;
                                 }
-                                stuCount = examResult.studentIds.Count;
+                                //powSum += Math.Pow(score - examResult.studentIds.Count > 0 ? Math.Round(score * 1.0 / examResult.studentIds.Count, 2) : 0, 2);
+                                //取交集
+                                losStu = losStu.Intersect(examResult.lostStus).ToList();
                             }
-                            //powSum += Math.Pow(score - examResult.studentIds.Count > 0 ? Math.Round(score * 1.0 / examResult.studentIds.Count, 2) : 0, 2);
-                            //取交集
-                            losStu = losStu.Intersect(examResult.lostStus).ToList();
                         }
-                    }
-                    double NewsRateScore = stuCount > 0 ? Math.Round(score * 1.0 / stuCount, 2) : 0;
-                    foreach (PaperSimple simple in info.papers)
-                    {
-                        allScore += simple.point.Sum();
-                    }
-                    //计算全科标准差
-                    foreach (string id in examResults[0].studentIds)
-                    {
-                        double sc = 0;
-                        foreach (ExamResult result in examResults)
+                        double NewsRateScore = stuCount > 0 ? Math.Round(score * 1.0 / stuCount, 2) : 0;
+                        foreach (PaperSimple simple in info.papers)
                         {
-                            sc += result.studentScores[result.studentIds.IndexOf(id)].Sum();
+                            allScore += simple.point.Sum();
                         }
-                        powSum += Math.Pow(sc - NewsRateScore, 2);
-                    }
-                    info.standard = Math.Round(examResults[0].studentIds.Count > 0 ? Math.Pow(powSum / examResults[0].studentIds.Count, 0.5) : 0, 2);
-                    double NewsRate = allScore > 0 ? Math.Round(NewsRateScore / allScore * 100, 2) : 0;
-                    info.lostStu = losStu;
-                    //判断均分是否发生变化,便于实时的更新评测基本信息
-                    if (info.sRate != NewsRate || info.average != NewsRateScore)
-                    {
-                        info.sRate = NewsRate;
-                        info.average = NewsRateScore;
-                        await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync<ExamInfo>(info, info.id, new Azure.Cosmos.PartitionKey(info.code));
-                    }
+                        //计算全科标准差
+                        foreach (string id in examResults[0].studentIds)
+                        {
+                            double sc = 0;
+                            foreach (ExamResult result in examResults)
+                            {
+                                sc += result.studentScores[result.studentIds.IndexOf(id)].Sum();
+                            }
+                            powSum += Math.Pow(sc - NewsRateScore, 2);
+                        }
+                        info.standard = Math.Round(examResults[0].studentIds.Count > 0 ? Math.Pow(powSum / examResults[0].studentIds.Count, 0.5) : 0, 2);
+                        double NewsRate = allScore > 0 ? Math.Round(NewsRateScore / allScore * 100, 2) : 0;
+                        info.lostStu = losStu;
+                        //判断均分是否发生变化,便于实时的更新评测基本信息
+                        if (info.sRate != NewsRate || info.average != NewsRateScore)
+                        {
+                            info.sRate = NewsRate;
+                            info.average = NewsRateScore;
+                            await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync<ExamInfo>(info, info.id, new Azure.Cosmos.PartitionKey(info.code));
+                        }
+                    }                    
                     break;
             }
         }

+ 1 - 1
TEAMModelOS.SDK/Models/Cosmos/School/ExamInfo.cs

@@ -71,7 +71,7 @@ namespace TEAMModelOS.SDK.Models
         public List<ExamSubject> subjects { get; set; }
         //public long sequenceNumber { get; set; }
         //public Condition conditions { get; set; }
-        public List<string> blobUrl { get; set; }
+        //public List<string> blobUrl { get; set; }
         public string progress { get; set; }
         public string scope { get; set; }
         public Custom examType { get; set; }

+ 200 - 73
TEAMModelOS/Controllers/Analysis/AchievementController.cs

@@ -24,6 +24,9 @@ using static TEAMModelOS.SDK.Models.Cosmos.School.ClassAnalysis;
 using static TEAMModelOS.SDK.Models.Cosmos.School.GradeAnalysis;
 using TEAMModelOS.Models.Dto;
 using System.Text;
+using Microsoft.AspNetCore.Http;
+using TEAMModelOS.SDK.Context.Constant.Common;
+using HTEXLib.Translator;
 
 namespace TEAMModelOS.Controllers.Analysis
 {
@@ -38,6 +41,9 @@ namespace TEAMModelOS.Controllers.Analysis
         private const string CacheCosmosPrefix = "Analysis:";
         private const int timeoutSeconds = 3600;
         public readonly AzureStorageFactory _azureStorage;
+        public DOXC2HTMLTranslator _DOXC2HTMLTranslator { get; set; }
+        //public PPTX2HTEXTranslator _PPTX2HTEXTranslator { get; set; }
+        public HTML2ITEMV3Translator _HTML2ITEMV3Translator { get; set; }
         public AchievementController(AzureCosmosFactory azureCosmos, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage)
         {
             _azureCosmos = azureCosmos;
@@ -3590,84 +3596,24 @@ namespace TEAMModelOS.Controllers.Analysis
                 ExamDto examDtos = new ExamDto();
                 examDtos = exam.ToObject<ExamDto>();
                 ExamInfo info = new ExamInfo();
-                info.code = info.pk +"-"+ code;
-                info.progress = "pending";
-                info.id = examDtos.id;
+                info.code = info.pk + "-" + code;
+                info.progress = "finish";
+                info.id = Guid.NewGuid().ToString();
                 info.name = examDtos.name;
                 info.grades = examDtos.grades;
                 info.subjects = examDtos.subjects;
                 info.period = examDtos.period;
                 examDtos.targetClasses.ForEach(e =>
                 {
-                    info.classes.Add(e.id);
-                });
-                examDtos.papers.ForEach(p =>
-                {
-                    PaperSimple simple = new PaperSimple
-                    {
-                        id = p.id,
-                        name = p.name
-                    };
-                    p.points.ForEach(po =>
-                    {
-                        simple.point.Add(double.Parse(po));
-                    });
-                    //List<List<string>> answers = new List<List<string>>();
-                    p.answers.ForEach(an =>
-                    {
-                        List<string> ans = new List<string>();
-                        if (an.Length > 1)
-                        {
-                            char[] aa = an.ToCharArray();
-                            foreach (char a in aa)
-                            {
-                                switch (a)
-                                {
-                                    case '1':
-                                        ans.Add("A");
-                                        break;
-                                    case '2':
-                                        ans.Add("B");
-                                        break;
-                                    case '3':
-                                        ans.Add("C");
-                                        break;
-                                    case '4':
-                                        ans.Add("D");
-                                        break;
-                                    default:
-                                        ans.Add("");
-                                        break;
-                                }
-                               // answers.Add(ans);
-                            }
-                        }
-                        else
-                        {
-                            switch (an)
-                            {
-                                case "1":
-                                    ans.Add("A");
-                                    break;
-                                case "2":
-                                    ans.Add("B");
-                                    break;
-                                case "3":
-                                    ans.Add("C");
-                                    break;
-                                case "4":
-                                    ans.Add("D");
-                                    break;
-                                default:
-                                    ans.Add("");
-                                    break;
-                            }
-                            //answers.Add(ans);
-                        }
-                        simple.answers.Add(ans);
-                    });
-                    info.papers.Add(simple);
+                    info.classes.Add(e);
                 });
+                info.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
+                info.startTime = examDtos.startTime;
+                info.endTime = examDtos.endTime;
+                info.school = code.GetString();
+                info.type = examDtos.type;
+                info.scope = "school";
+                info.examType = examDtos.examType;                
                 await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(info, new PartitionKey($"Exam-{code}"));
                 return Ok(new { info });
             }
@@ -3677,6 +3623,187 @@ namespace TEAMModelOS.Controllers.Analysis
                 return BadRequest();
             }
         }
+        public class FileDto
+        {
+            public string periodId { get; set; }
+            public string code { get; set; }
+            public string name { get; set; }
+            public int multipleRule { get; set; }
+            public string examId { get; set; }
+            public string subjectId { get; set; }
+            public List<string> gradeIds { get; set; }
+            public IFormFile file { get; set; }
+        }
+
+        [HttpPost("parse-word")]
+        public async Task<IActionResult> ParseWord([FromForm] FileDto fileDto)
+        {
+            if (!FileType.GetExtention(fileDto.file.FileName).ToLower().Equals("docx"))
+            {
+                return BadRequest(new Dictionary<string, object> { { "msg", "type is not docx!" }, { "code", ResponseCode.FAILED } });
+            }
+
+            try {
+                var client = _azureCosmos.GetCosmosClient();
+                var response = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(fileDto.examId, new PartitionKey($"Exam-{fileDto.code}"));
+                ExamInfo examInfo;
+                if (response.Status == 200)
+                {
+                    using var json = await JsonDocument.ParseAsync(response.ContentStream);
+                    examInfo = json.ToObject<ExamInfo>();
+
+                }
+                else
+                {
+                    return Ok(new { error = 404, msg = "请先导入评测信息" });
+                }
+                foreach (PaperSimple paper in examInfo.papers)
+                {
+                    if (paper.id.Contains(fileDto.subjectId))
+                    {
+                        return Ok(new { error = 500, msg = "该试卷信息已存在" });
+                    }
+                }
+                PaperSimple simple = new();
+                var doc = _DOXC2HTMLTranslator.Translate(fileDto.file.OpenReadStream());
+                (List<HTEXLib.DOCX.Models.ItemInfo> tests, List<string> error) = _HTML2ITEMV3Translator.Translate(doc);
+                List<Task<string>> tasks = new List<Task<string>>();
+                PaperDto paperDto = new PaperDto();
+                paperDto.id = Guid.NewGuid().ToString();
+                paperDto.name = fileDto.name;
+                paperDto.code = fileDto.code;
+                paperDto.scope = "school";
+                paperDto.multipleRule = fileDto.multipleRule;
+                paperDto.gradeIds = fileDto.gradeIds;
+                paperDto.subjectId = fileDto.subjectId;
+                paperDto.periodId = fileDto.periodId;
+                foreach (HTEXLib.DOCX.Models.ItemInfo item in tests)
+                {
+                    Slides slides = new();
+                    ItemDto dto = new();
+                    TEAMModelOS.SDK.Models.Scoring scoring = new();
+                    dto.id = Guid.NewGuid().ToString();
+                    dto.exercise.answer = item.answer;
+                    dto.exercise.explain = item.explain;
+                    dto.exercise.type = item.type;
+                    dto.exercise.opts = item.option.Count;
+                    dto.exercise.knowledge = item.knowledge;
+                    dto.exercise.field = item.field;
+                    dto.exercise.level = item.level;
+                    dto.exercise.subjectId = fileDto.subjectId;
+                    dto.exercise.periodId = fileDto.periodId;
+                    dto.exercise.gradeIds = fileDto.gradeIds;
+                    slides.url = dto.id + ".json";
+                    slides.type = dto.exercise.type;
+                    scoring.ans = dto.exercise.answer;
+                    scoring.score = dto.exercise.score;
+                    scoring.knowledge = dto.exercise.knowledge;
+                    scoring.field = dto.exercise.field;
+                    slides.scoring = scoring;
+                    //添加试卷信息
+                    paperDto.slides.Add(slides);
+                    if (!slides.type.Equals("compose"))
+                    {
+                        simple.point.Add(dto.exercise.score);
+                        simple.answers.Add(dto.exercise.answer);
+                        simple.knowledge.Add(dto.exercise.knowledge);
+                        simple.type.Add(dto.exercise.type);
+                        simple.field.Add((int)dto.exercise.field);
+                    }
+                    if (item.children.Count > 0)
+                    {
+                        foreach (HTEXLib.DOCX.Models.ItemInfo its in item.children)
+                        {
+                            Slides cslides = new();
+                            TEAMModelOS.SDK.Models.Scoring cscoring = new();
+                            ItemDto dtoChildren = new ItemDto();
+                            dtoChildren.id = Guid.NewGuid().ToString();
+                            dtoChildren.pid = dto.id;
+                            dtoChildren.exercise.answer = its.answer;
+                            dtoChildren.exercise.explain = its.explain;
+                            dtoChildren.exercise.type = its.type;
+                            dtoChildren.exercise.opts = its.option.Count;
+                            dtoChildren.exercise.knowledge = its.knowledge;
+                            dtoChildren.exercise.field = its.field;
+                            dtoChildren.exercise.level = its.level;
+                            dtoChildren.exercise.scope = "school";
+                            dtoChildren.exercise.score = its.score;
+                            dtoChildren.exercise.subjectId = fileDto.subjectId;
+                            dtoChildren.exercise.periodId = fileDto.periodId;
+                            dtoChildren.exercise.gradeIds = fileDto.gradeIds;
+                            dtoChildren.exercise.children.Add(dtoChildren.id);
+                            info info1 = new();
+                            info1.uid = dtoChildren.id;
+                            info1.question = its.question;
+                            info1.option = its.option;
+                            dtoChildren.item.Add(info1);
+                            dto.exercise.children.Add(dtoChildren.id);
+                            //处理子题的slides
+                            cslides.url = dtoChildren.id + ".json";
+                            cslides.type = dtoChildren.exercise.type;
+                            cscoring.ans = dtoChildren.exercise.answer;
+                            cscoring.score = dtoChildren.exercise.score;
+                            cscoring.knowledge = dtoChildren.exercise.knowledge;
+                            cscoring.field = dtoChildren.exercise.field;
+                            cslides.scoring = scoring;
+                            paperDto.slides.Add(cslides);
+                            //添加试卷信息
+                            simple.point.Add(dtoChildren.exercise.score);
+                            simple.answers.Add(dto.exercise.answer);
+                            simple.knowledge.Add(dto.exercise.knowledge);
+                            simple.type.Add(dto.exercise.type);
+                            simple.field.Add((int)dto.exercise.field);
+
+                            StringBuilder stringBuilder = new StringBuilder();
+                            stringBuilder.Append(fileDto.examId).Append("/");
+                            stringBuilder.Append("paper").Append("/");
+                            stringBuilder.Append(fileDto.subjectId).Append("/");
+                            stringBuilder.Append(dtoChildren.id + ".json");
+                            tasks.Add(_azureStorage.UploadFileByContainer(fileDto.code, dtoChildren.ToJsonString(), "exam", stringBuilder.ToString(), false));
+                        }
+                    }
+                    info @info = new();
+                    @info.uid = dto.id;
+                    @info.question = item.question;
+                    @info.option = item.option;
+                    dto.item.Add(@info);
+                    dto.exercise.scope = "school";
+                    dto.exercise.score = item.score;
+                    StringBuilder builder = new StringBuilder();
+                    builder.Append(fileDto.examId).Append("/");
+                    builder.Append("paper").Append("/");
+                    builder.Append(fileDto.subjectId).Append("/");
+                    builder.Append(dto.id + ".json");
+                    tasks.Add(_azureStorage.UploadFileByContainer(fileDto.code, dto.ToJsonString(), "exam", builder.ToString(), false));
+
+
+                }
+                StringBuilder paperBuilder = new StringBuilder();
+                paperBuilder.Append(fileDto.examId).Append("/");
+                paperBuilder.Append("paper").Append("/");
+                paperBuilder.Append(fileDto.subjectId).Append("/");
+                paperBuilder.Append("index.json");
+                tasks.Add(_azureStorage.UploadFileByContainer(fileDto.code, paperDto.ToJsonString(), "exam", paperBuilder.ToString(), false));
+
+                //开始给ExamInfo paper赋值
+                simple.id = fileDto.subjectId;
+                simple.code = "Paper-" + fileDto.code;
+                simple.name = fileDto.name;
+                simple.blob = paperBuilder.ToString().Replace("index.json", "");
+                simple.scope = "school";
+                simple.multipleRule = fileDto.multipleRule;
+
+                examInfo.papers.Add(simple);
+                await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(examInfo, examInfo.id, new PartitionKey($"{examInfo.code}"));
+                await Task.WhenAll(tasks);
+
+                return Ok(new { code = 200 });
+            } catch (Exception e) {
+                await _dingDing.SendBotMsg($"OS,{_option.Location},analysis/word()\n{e.Message}", GroupNames.醍摩豆服務運維群組);
+                return BadRequest();
+            }
+            
+        }
         [HttpPost("importResult")]
         public async Task<IActionResult> importClassResult(JsonElement request)
         {
@@ -3838,7 +3965,7 @@ namespace TEAMModelOS.Controllers.Analysis
                 var client = _azureCosmos.GetCosmosClient();
                 List<object> info = new List<object>();
                 var query = $"select c.period,c.id,c.campuses from c where c.id = '{code}'";
-                await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base")}))
+                await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
                 {
                     using var json = await JsonDocument.ParseAsync(item.ContentStream);
                     if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
@@ -3888,7 +4015,7 @@ namespace TEAMModelOS.Controllers.Analysis
                 return BadRequest();
             }
         }
-    }   
+    }
 }
 //private List<Dictionary<string, dynamic>> getKnowledgePoint(List<ExamResult> examResults, ExamInfo info)
 //{

+ 14 - 1
TEAMModelOS/Models/Dto/ExamDto.cs

@@ -11,10 +11,23 @@ namespace TEAMModelOS.Models.Dto
         public string id { get; set; }
         public string name { get; set; }
         public List<Grade> grades { get; set; } = new List<Grade>();
-        public List<TargetClass> targetClasses { get; set; } = new List<TargetClass>();
+        public List<string> targetClasses { get; set; } = new List<string>();
         public List<Papers> papers { get; set; } = new List<Papers>();
         public List<ExamSubject> subjects { get; set; } = new List<ExamSubject>();
         public PeriodSimple period { get; set; } = new PeriodSimple();
+        public string school { get; set; }
+        public string creatorId { get; set; }
+        /// <summary>
+        /// 施测起始时间
+        /// </summary>
+        public long startTime { get; set; }
+        /// <summary>
+        /// 施测结束时间
+        /// </summary>
+        public long endTime { get; set; }
+        public string type { get; set; }
+        public Custom examType { get; set; }
+
 
     }
     public class TargetClass {

+ 53 - 0
TEAMModelOS/Models/Dto/ItemDto.cs

@@ -0,0 +1,53 @@
+using HTEXLib;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace TEAMModelOS.Models.Dto
+{
+    public class ItemDto
+    {
+        public string id { get; set; }
+        public string pid { get; set; }
+
+        public Exercise exercise { get; set; } = new Exercise();
+        //public double render { get; set; }
+
+        public List<info> item { get; set; } = new List<info>();
+        public class Exercise {
+            public List<string> answer { get; set; } = new List<string>();
+
+            public string explain { get; set;}
+            public string type { get; set; }
+            public int opts { get; set; }
+            public List<string> knowledge { get; set; } = new List<string>();
+            public int? field { get; set; }
+            public int level { get; set; }
+            public string periodId { get; set; }
+            public List<string> gradeIds { get; set; } = new List<string>();
+            public string subjectId { get; set; }
+            public List<string> children { get; set; } = new List<string>();
+            public string scope { get; set; }
+            public double score { get; set; }
+            //public List<Repair> repair { get; set; }
+
+
+        }
+       
+/*        public class CodeValue
+        {
+            public string code { get; set; }
+            public string value { get; set; }
+        }*/
+
+    }
+    public class info
+    {
+        public string type { get; set; } = "Html";
+        public string uid { get; set; }
+        public string question { get; set; }
+
+        public List<CodeValue> option { get; set; } = new List<CodeValue>();
+    }
+}

+ 24 - 61
TEAMModelOS/Models/Dto/PaperDto.cs

@@ -14,71 +14,34 @@ namespace TEAMModelOS.SDK.Models
     /// </summary>
     public class PaperDto
     {
-        
-        /// <summary>
-        ///  学校编码,个人编码,考试编码
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
+        public string id { get; set; }
+
+        public string name { get; set; }
         public string code { get; set; }
-        public PaperDto() {
-            item = new List<ItemInfoDto>();
-            //markConfig = new MarkConfig();
-        }
+        public string scope { get; set; }
+        public int multipleRule { get; set; }
+        public List<Slides> slides { get; set; }
+        public string periodId { get; set; }
+        public List<string> points { get; set; } = new List<string>();
+        public List<string> gradeIds { get; set; } = new List<string>();
+        public string subjectId { get; set; }
+        public string subjectName { get; set; }
+        public double score { get; set; }             
 
-        [JsonProperty(PropertyName = "id")]
-        public string id { get; set; }
-        /// <summary>
-        /// 试卷的基本信息
-        /// </summary>
+    }
+    public class Slides
+    {
         public string url { get; set; }
-        /// <summary>
-        /// 题目信息
-        /// </summary>
-        public List<ItemInfoDto> item { get; set; }
-        /// <summary>
-        /// 科目
-        /// </summary>
-        public string subjectCode { get; set; }
-        /// <summary>
-        /// 学段
-        /// </summary>
-        public string periodCode { get; set; }
-        /// <summary>
-        /// 年级
-        /// </summary>
-        public List<string> gradeCode { get; set; }
 
-        /// <summary>
-        /// 试卷名称
-        /// </summary>
-        public string name { get; set; }
-        /// <summary>
-        /// 题目总数
-        /// </summary>
-        public int itemCount { get; set; }
-        /// <summary>
-        /// 题目难度
-        /// </summary>
-        public double level { get; set; }
-        /// <summary>
-        /// 总分
-        /// </summary>
+        public string type { get; set; }
+        public Scoring scoring { get; set; } = new Scoring();
+
+    }
+    public class Scoring
+    {
         public double score { get; set; }
-        /// <summary>
-        /// 创建时间
-        /// </summary>
-        public long createTime { get; set; }
-        /// <summary>
-        /// 正确答案
-        /// </summary>
-        public List<Answer> answers { get; set; }
-        /// <summary>
-        /// 阅卷规则
-        /// </summary>
-        //public MarkConfig markConfig { get; set; }
-        /// <summary>
-        /// 题目集合
-        /// </summary>
-        public List<string> itemids { get; set; }
+        public List<string> knowledge { get; set; } = new List<string>();
+        public int? field { get; set; }
+        public List<string> ans { get; set; } = new List<string>();
     }
 }