|
@@ -11,6 +11,7 @@ using TEAMModelOS.SDK.Helper.Common.JsonHelper.JsonPath;
|
|
|
using TEAMModelOS.SDK.Module.AzureCosmosDB.Interfaces;
|
|
|
using TEAMModelOS.Service.Models.Core;
|
|
|
using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
|
|
|
+using TEAMModelOS.Service.Models.Exam.Models;
|
|
|
|
|
|
namespace TEAMModelOS.Controllers.Analysis
|
|
|
{
|
|
@@ -35,13 +36,13 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
{
|
|
|
// 获取系统路径
|
|
|
string contentRootPath = _hostingEnvironment.ContentRootPath;
|
|
|
- identity = "IES/adas";
|
|
|
+ identity = "IES/ads2020";
|
|
|
//string query = "$.info";
|
|
|
//int countClasses = 0;
|
|
|
//string queryClass = "$member.1.item_answer[*]";
|
|
|
- string query = "$.exercise[*]";
|
|
|
- string queryInfo = "$.info";
|
|
|
- string queryPoint = "$.testpaper.item[*]";
|
|
|
+ string query = "$.exercise";
|
|
|
+ string queryInfo = "$.exercise.info";
|
|
|
+ string queryPoint = "$.testpaper.items[*]";
|
|
|
//string queryInfo = "$.exercise.info[*]";
|
|
|
string data = FileTool.getJson(contentRootPath, identity);
|
|
|
data = FileTool.UnicodeToString(data);
|
|
@@ -79,29 +80,27 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
});
|
|
|
//基本信息
|
|
|
info.ForEach(e => {
|
|
|
- simple.Name = e.test_name;
|
|
|
- simple.Time = e.test_date;
|
|
|
+ simple.Name = e.ex_name;
|
|
|
+ simple.Time = e.ex_time;
|
|
|
});
|
|
|
School sc = new School
|
|
|
{
|
|
|
schoolCode = "qcs",
|
|
|
schoolName = "青城山",
|
|
|
- period = new List<Period> { new Period {periodName = "中专" , periodCode = "zz",grades= new List<Grade> {
|
|
|
+ period = new List<Period> { new Period {periodName = "中专" , periodCode = "zz",grades= new List<Grade> {
|
|
|
new Grade { gradeName = "初中一年级" ,gradeCode = "7"} } } }
|
|
|
};
|
|
|
papers.ForEach(x =>
|
|
|
{
|
|
|
-
|
|
|
- //var c = papers[i].member;
|
|
|
- string stu = x.info.stucount;
|
|
|
- int k = int.Parse(stu);
|
|
|
- string key = x.info.class_name;
|
|
|
- string schoolName = x.info.school_name;
|
|
|
- Classroom classInfo = new Classroom
|
|
|
+ string stu = x.info.stucount;
|
|
|
+ int k = int.Parse(stu);
|
|
|
+ string key = x.info.course_name;
|
|
|
+ string classCode = x.info.course_no;
|
|
|
+ /*Classroom classInfo = new Classroom
|
|
|
{
|
|
|
id = System.Guid.NewGuid().ToString(),
|
|
|
classroomName = key,
|
|
|
- scopeCode = schoolName,
|
|
|
+ scopeCode = classCode,
|
|
|
studentCount = k,
|
|
|
classroomCode = "qcs"
|
|
|
};
|
|
@@ -109,26 +108,28 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
Classroom classInfoOfStudent = new Classroom
|
|
|
{
|
|
|
classroomName = key,
|
|
|
- scopeCode = schoolName,
|
|
|
+ scopeCode = classCode,
|
|
|
//studentCount = k,
|
|
|
classroomCode = "qcs"
|
|
|
- };
|
|
|
+ };*/
|
|
|
Dictionary<string, int[]> map = new Dictionary<string, int[]>();
|
|
|
int[] Range = new int[2];
|
|
|
- for (int j = 1; j <= k; j++)
|
|
|
+ for (int j = 0; j < k; j++)
|
|
|
{
|
|
|
Student stus = new Student
|
|
|
{
|
|
|
type = 2,
|
|
|
- schoolCode = schoolName
|
|
|
+ schoolCode = classCode
|
|
|
};
|
|
|
//stus.classroom = "";
|
|
|
- string men = x.member + "";
|
|
|
+ string men = x.members[j]+ "";
|
|
|
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";
|
|
|
+ /* string queryClass = "$." + j + ".item_answers[*]";
|
|
|
+ string queryStu = "$." + j + ".info";*/
|
|
|
+ string queryClass = "$.item_answers[*]";
|
|
|
+ string queryStu = "$.info";
|
|
|
List<dynamic> answers = context.SelectNodes(jArray,
|
|
|
queryClass).Select(node => node.Value).ToList();
|
|
|
//学生ID集合
|
|
@@ -140,24 +141,30 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
StuIds.Add("0");
|
|
|
k++;
|
|
|
}
|
|
|
- else {
|
|
|
+ else
|
|
|
+ {
|
|
|
studentIds.ToList<dynamic>().ForEach(s =>
|
|
|
{
|
|
|
-
|
|
|
- string id = s.studentid;
|
|
|
+
|
|
|
+ string id = s.student_id;
|
|
|
//id = System.Guid.NewGuid().ToString();
|
|
|
stus.id = id.Trim();
|
|
|
- stus.name = s.name;
|
|
|
+ //stus.name = s.name;
|
|
|
stus.studentId = id.Trim();
|
|
|
- stus.seatNo = s.seatno;
|
|
|
+ //stus.seatNo = s.seatno;
|
|
|
//stus.classroom = classInfoOfStudent;
|
|
|
StuIds.Add(id.Trim());
|
|
|
});
|
|
|
students.Add(stus);
|
|
|
- }
|
|
|
+ }
|
|
|
+ /* string[] answers = x.members[j].item_answers;
|
|
|
+ for (int i = 0;i< answers.Length;i++ ) {
|
|
|
+ string pt = answers[i];
|
|
|
+ point.Add(int.Parse(pt.Trim()));
|
|
|
+ }*/
|
|
|
answers.ToList<dynamic>().ForEach(p =>
|
|
|
{
|
|
|
- string pt = p.ans_point;
|
|
|
+ string pt = p.point;
|
|
|
point.Add(int.Parse(pt.Trim()));
|
|
|
});
|
|
|
StuPoint.Add(point);
|
|
@@ -185,6 +192,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
|
|
|
//ClassPoint.Add(StuPoint);
|
|
|
});
|
|
|
+ simple.id = System.Guid.NewGuid().ToString();
|
|
|
simple.Classes = Classes;
|
|
|
simple.Ids = StuIds;
|
|
|
simple.Point = points;
|
|
@@ -192,9 +200,9 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
|
|
|
//_examInfoService.SaveToCosmos(simple);
|
|
|
//_cosmosrepository.Save(sc);
|
|
|
- //_cosmosrepository.Save(simple);
|
|
|
+ _cosmosrepository.Save(simple);
|
|
|
//_cosmosrepository.SaveAll(classrooms);
|
|
|
- _cosmosrepository.SaveOrUpdateAll(students);
|
|
|
+ //_cosmosrepository.SaveOrUpdateAll(students);
|
|
|
//_examInfoService.SaveListToCosmos(students);
|
|
|
|
|
|
|