|
@@ -7,6 +7,7 @@ using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
using TEAMModelOS.Helper.Common.FileHelper;
|
|
using TEAMModelOS.Helper.Common.FileHelper;
|
|
|
|
+using TEAMModelOS.Model.Evaluation.Models.CosmosModels;
|
|
using TEAMModelOS.Model.EvaluaTion.Dtos;
|
|
using TEAMModelOS.Model.EvaluaTion.Dtos;
|
|
using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
|
|
using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
|
|
using TEAMModelOS.SDK.Extension.JsonPath;
|
|
using TEAMModelOS.SDK.Extension.JsonPath;
|
|
@@ -73,20 +74,192 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
// 获取系统路径
|
|
// 获取系统路径
|
|
string contentRootPath = _hostingEnvironment.ContentRootPath;
|
|
string contentRootPath = _hostingEnvironment.ContentRootPath;
|
|
identity = "IES/adas";
|
|
identity = "IES/adas";
|
|
- string query = "$.info";
|
|
|
|
- JObject parsedJson = JObject.Parse(identity);
|
|
|
|
|
|
+ //string query = "$.info";
|
|
|
|
+ //int countClasses = 0;
|
|
|
|
+ //string queryClass = "$member.1.item_answer[*]";
|
|
|
|
+ string query = "$.exercise[*]";
|
|
|
|
+ string queryInfo = "$.info";
|
|
|
|
+ string queryPoint = "$.testpaper.item[*]";
|
|
|
|
+ //string queryInfo = "$.exercise.info[*]";
|
|
|
|
+ string data = FileTool.getJson(contentRootPath, identity);
|
|
|
|
+ data = FileTool.UnicodeToString(data);
|
|
|
|
+ JObject parsedJson = JObject.Parse(data);
|
|
JsonPathContext context = new JsonPathContext
|
|
JsonPathContext context = new JsonPathContext
|
|
{ ValueSystem = new JsonNetValueSystem() };
|
|
{ ValueSystem = new JsonNetValueSystem() };
|
|
List<dynamic> papers = context.SelectNodes(parsedJson,
|
|
List<dynamic> papers = context.SelectNodes(parsedJson,
|
|
query).Select(node => node.Value).ToList();
|
|
query).Select(node => node.Value).ToList();
|
|
|
|
+ List<dynamic> info = context.SelectNodes(parsedJson,
|
|
|
|
+ queryInfo).Select(node => node.Value).ToList();
|
|
|
|
+ List<dynamic> Itempoint = context.SelectNodes(parsedJson,
|
|
|
|
+ queryPoint).Select(node => node.Value).ToList();
|
|
|
|
+
|
|
|
|
+ int m = 0;
|
|
|
|
+ //人数总和
|
|
|
|
+ int Count = 0;
|
|
|
|
+ //起始坐标
|
|
|
|
+ int Strat = 0;
|
|
|
|
+ // 初始化学生人数
|
|
|
|
+ int Stus = 0;
|
|
|
|
+ SimpleExam simple = new SimpleExam();
|
|
|
|
+ List<List<List<int>>> ClassPoint = new List<List<List<int>>>();
|
|
|
|
+ List<List<int>> StuPoint = new List<List<int>>();
|
|
|
|
+ List<string> StuIds = new List<string>();
|
|
|
|
+ List<Dictionary<object, int[]>> Classes = new List<Dictionary<object, int[]>>();
|
|
|
|
+ Dictionary<object, object> ListInfo = new Dictionary<object, object>();
|
|
|
|
+ List<int> points = new List<int>();
|
|
|
|
+ //配分数组
|
|
|
|
+ Itempoint.ForEach(p =>
|
|
|
|
+ {
|
|
|
|
+ string pt = p.point;
|
|
|
|
+ points.Add(int.Parse(pt));
|
|
|
|
+ });
|
|
|
|
+ //基本信息
|
|
|
|
+ info.ForEach(e => {
|
|
|
|
+ simple.Name = e.test_name;
|
|
|
|
+ simple.Time = e.test_date;
|
|
|
|
+ //ListInfo.Add("Name",e.test_name);
|
|
|
|
+ //ListInfo.Add("Time", e.test_date);
|
|
|
|
+ });
|
|
|
|
+ papers.ForEach(x =>
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ //var c = papers[i].member;
|
|
|
|
+ string stu = x.info.stucount;
|
|
|
|
+ int k = int.Parse(stu);
|
|
|
|
+ Dictionary<object, int[]> map = new Dictionary<object, int[]>();
|
|
|
|
+ int[] Range = new int[2];
|
|
|
|
+ //int[] EachRange = new int[2];
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //List<List<int>> StuPoint = new List<List<int>>();
|
|
|
|
+ for (int j = 1; j <= k; j++)
|
|
|
|
+ {
|
|
|
|
+ string men = x.member + "";
|
|
|
|
+ JObject jArray = JObject.Parse(men);
|
|
|
|
+ List<int> point = new List<int>();
|
|
|
|
+ //List<string> stuId = new List<string>();
|
|
|
|
+ string queryClass = "$." + j + ".item_answer[*]";
|
|
|
|
+ string queryStu = "$." + j + ".info";
|
|
|
|
+ List<dynamic> answers = context.SelectNodes(jArray,
|
|
|
|
+ queryClass).Select(node => node.Value).ToList();
|
|
|
|
+ //学生ID集合
|
|
|
|
+ List<dynamic> studentIds = context.SelectNodes(jArray,
|
|
|
|
+ queryStu).Select(node => node.Value).ToList();
|
|
|
|
+
|
|
|
|
+ if (answers.Count == 0)
|
|
|
|
+ {
|
|
|
|
+ StuIds.Add("0");
|
|
|
|
+ k++;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ studentIds.ToList<dynamic>().ForEach(s =>
|
|
|
|
+ {
|
|
|
|
+ string id = s.studentid;
|
|
|
|
+ StuIds.Add(id);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ answers.ToList<dynamic>().ForEach(p =>
|
|
|
|
+ {
|
|
|
|
+ string pt = p.ans_point;
|
|
|
|
+ point.Add(int.Parse(pt));
|
|
|
|
+ });
|
|
|
|
+ StuPoint.Add(point);
|
|
|
|
+ Stus++;
|
|
|
|
+ }
|
|
|
|
+ //每次人数累加得到实际总人数
|
|
|
|
+ Count += Stus;
|
|
|
|
+ if (m == 0)
|
|
|
|
+ {
|
|
|
|
+ Strat = Stus;
|
|
|
|
+ Range[0] = 0;
|
|
|
|
+ Range[1] = Stus - 1;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ Range[0] = Count - Stus;
|
|
|
|
+ Range[1] = Count - 1;
|
|
|
|
+ }
|
|
|
|
+ map.Add(x.info.class_name, Range);
|
|
|
|
+ Classes.Add(map);
|
|
|
|
+ m++;
|
|
|
|
+ //初始化每个班级人数
|
|
|
|
+ Stus = 0;
|
|
|
|
+
|
|
|
|
+ //ClassPoint.Add(StuPoint);
|
|
|
|
+ });
|
|
|
|
+ simple.Classes = Classes;
|
|
|
|
+ simple.Ids = StuIds;
|
|
|
|
+ simple.Point = points;
|
|
|
|
+ simple.Result = StuPoint;
|
|
JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
|
|
JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
|
|
- //string data = FileTool.getJson(contentRootPath, identity);
|
|
|
|
- //data = FileTool.UnicodeToString(data);
|
|
|
|
- //List<MemberAnswer> obj = MessagePackHelper.JsonToObject<List<MemberAnswer>>(data);
|
|
|
|
- //_examInfoService.SaveOrUpdate(obj, "cn");
|
|
|
|
- return builder.Data(papers).build();
|
|
|
|
|
|
+ _examInfoService.SaveToCosmos(simple);
|
|
|
|
+
|
|
|
|
+ return builder.Data(simple).build();
|
|
//return builder.build();
|
|
//return builder.build();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ [HttpGet("SaveStuInfo")]
|
|
|
|
+ public BaseJosnRPCResponse SaveStuInfo(string identity)
|
|
|
|
+
|
|
|
|
+ {
|
|
|
|
+ // 获取系统路径
|
|
|
|
+ string contentRootPath = _hostingEnvironment.ContentRootPath;
|
|
|
|
+ identity = "IES/adas";
|
|
|
|
+ string query = "$.exercise[*]";
|
|
|
|
+ //string queryInfo = "$.exercise.info[*]";
|
|
|
|
+ string data = FileTool.getJson(contentRootPath, identity);
|
|
|
|
+ data = FileTool.UnicodeToString(data);
|
|
|
|
+ JObject parsedJson = JObject.Parse(data);
|
|
|
|
+ JsonPathContext context = new JsonPathContext
|
|
|
|
+ { ValueSystem = new JsonNetValueSystem() };
|
|
|
|
+ List<dynamic> papers = context.SelectNodes(parsedJson,
|
|
|
|
+ query).Select(node => node.Value).ToList();
|
|
|
|
+ List<StuInfo> list = new List<StuInfo>();
|
|
|
|
+ string SchoolCode = Guid.NewGuid().ToString();
|
|
|
|
+ papers.ForEach(x =>
|
|
|
|
+ {
|
|
|
|
+ string GradeCode = Guid.NewGuid().ToString();
|
|
|
|
+ string ClassRoomCode = Guid.NewGuid().ToString();
|
|
|
|
+ //var c = papers[i].member;
|
|
|
|
+ string stu = x.info.stucount;
|
|
|
|
+ int k = int.Parse(stu);
|
|
|
|
+
|
|
|
|
+ for (int j = 1; j <= k; j++)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ string men = x.member + "";
|
|
|
|
+ JObject jArray = JObject.Parse(men);
|
|
|
|
+ List<int> point = new List<int>();
|
|
|
|
+ string queryClass = "$." + j + ".info";
|
|
|
|
+ List<dynamic> StuInfo = context.SelectNodes(jArray,
|
|
|
|
+ queryClass).Select(node => node.Value).ToList();
|
|
|
|
+ StuInfo.ToList<dynamic>().ForEach(p =>
|
|
|
|
+ {
|
|
|
|
+ StuInfo Stu = new StuInfo
|
|
|
|
+ {
|
|
|
|
+ Id = Guid.NewGuid().ToString(),
|
|
|
|
+ Name = p.name,
|
|
|
|
+ StudentId = "101010#" + p.studentid,
|
|
|
|
+ SeatNo = p.seatno,
|
|
|
|
+ SchoolCode = SchoolCode,
|
|
|
|
+ GradeCode = GradeCode,
|
|
|
|
+ ClassroomCode = ClassRoomCode
|
|
|
|
+
|
|
|
|
+ };
|
|
|
|
+ list.Add(Stu);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //ClassPoint.Add(StuPoint);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
|
|
|
|
+ _examInfoService.SaveListToCosmos(list);
|
|
|
|
+ return builder.Data(list).build();
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|