|
@@ -90,7 +90,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
//
|
|
|
dict.TryGetValue("subjectCode", out object subjectCode);
|
|
|
dict.TryGetValue("code", out object code);
|
|
|
- List<ExamResult> exams = null;
|
|
|
+ List<ExamResult> exams = new List<ExamResult>();
|
|
|
/*if (RedisHelper.Instance != null)
|
|
|
{
|
|
|
exams = await RedisHelper.CacheShellAsync(CacheCosmosPrefix + "FindExamResultRedis",
|
|
@@ -100,11 +100,16 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
{
|
|
|
exams = await FindExamResultRedis(dict, "FindExamResultRedis");
|
|
|
}*/
|
|
|
- if (RedisHelper.Exists(CacheCosmosPrefix + ""))
|
|
|
- {
|
|
|
- exams = RedisHelper.HGet<List<ExamResult>>(CacheCosmosPrefix + "examResult" + subjectCode.ToString(), ShaHashHelper.GetSHA1(code.ToString()));
|
|
|
- //builder.Data(info);
|
|
|
+ List<string> subjectCouns = JsonApiHelper.FromApiJson<List<string>>(subjectCode.ToApiJson());
|
|
|
+ for (int i =0;i < subjectCouns.Count;i++ ) {
|
|
|
+ if (RedisHelper.Exists(CacheCosmosPrefix + "examResult" + subjectCouns[i]))
|
|
|
+ {
|
|
|
+ ExamResult result = RedisHelper.HGet<ExamResult>(CacheCosmosPrefix + "examResult" + subjectCouns[i], ShaHashHelper.GetSHA1(code.ToString()));
|
|
|
+ //builder.Data(info);
|
|
|
+ exams.Add(result);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
|
|
|
Dictionary<string, object> stuMap = new Dictionary<string, object>
|
|
|
{
|
|
@@ -549,22 +554,19 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
List<Dictionary<string, dynamic>> scatterAnalysis = new List<Dictionary<string, dynamic>>();
|
|
|
//Dictionary<string, object> scatterAnalysis = new Dictionary<string, object>();
|
|
|
List<ExamResult> exams = new List<ExamResult>();
|
|
|
- /*if (RedisHelper.Instance != null)
|
|
|
- {
|
|
|
- exams = await RedisHelper.CacheShellAsync(CacheCosmosPrefix + "FindExamResultRedis",
|
|
|
- ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(dict)), timeoutSeconds, () => { return FindExamResultRedis(dict, "FindExamResultRedis"); });
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- exams = await FindExamResultRedis(dict, "FindExamResultRedis");
|
|
|
- }*/
|
|
|
+
|
|
|
dict.TryGetValue("subjectCode", out object subjectCode);
|
|
|
dict.TryGetValue("code", out object code);
|
|
|
- if (RedisHelper.Exists(CacheCosmosPrefix + ""))
|
|
|
- {
|
|
|
- exams = RedisHelper.HGet<List<ExamResult>>(CacheCosmosPrefix + "examResult" + subjectCode.ToString(), ShaHashHelper.GetSHA1(code.ToString()));
|
|
|
- //builder.Data(info);
|
|
|
- }
|
|
|
+ /* List<string> subjectCouns = JsonApiHelper.FromApiJson<List<string>>(subjectCode.ToApiJson());
|
|
|
+ for (int i = 0; i < subjectCouns.Count; i++)
|
|
|
+ {*/
|
|
|
+ if (RedisHelper.Exists(CacheCosmosPrefix + "examResult" + subjectCode.ToString()))
|
|
|
+ {
|
|
|
+ ExamResult result = RedisHelper.HGet<ExamResult>(CacheCosmosPrefix + "examResult" + subjectCode.ToString(), ShaHashHelper.GetSHA1(code.ToString()));
|
|
|
+ //builder.Data(info);
|
|
|
+ exams.Add(result);
|
|
|
+ }
|
|
|
+ //}
|
|
|
Dictionary<string, object> stuMap = new Dictionary<string, object>
|
|
|
{
|
|
|
{ "schoolCode", "Habook" }
|
|
@@ -758,7 +760,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
List<Paper> paper = new List<Paper>();
|
|
|
if (RedisHelper.Exists(CacheCosmosPrefix + "paperInfo" + subjectCode.ToString()))
|
|
|
{
|
|
|
- Paper paper1 = RedisHelper.HGet<Paper>(CacheCosmosPrefix + "examResult" + subjectCode.ToString(), ShaHashHelper.GetSHA1(code.ToString()));
|
|
|
+ Paper paper1 = RedisHelper.HGet<Paper>(CacheCosmosPrefix + "paperInfo" + subjectCode.ToString(), ShaHashHelper.GetSHA1(code.ToString()));
|
|
|
paper.Add(paper1);
|
|
|
}
|
|
|
|
|
@@ -998,40 +1000,31 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
|
|
|
};*/
|
|
|
List<ExamResult> exams = new List<ExamResult>();
|
|
|
- /* if (RedisHelper.Instance != null)
|
|
|
- {
|
|
|
- exams = await RedisHelper.CacheShellAsync(CacheCosmosPrefix + "FindExamResultRedis",
|
|
|
- ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(examMap)), timeoutSeconds, () => { return FindExamResultRedis(examMap, "FindExamResultRedis"); });
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- exams = await FindExamResultRedis(examMap, "FindExamResultRedis");
|
|
|
- }*/
|
|
|
- if (RedisHelper.Exists(CacheCosmosPrefix + ""))
|
|
|
- {
|
|
|
- exams = RedisHelper.HGet<List<ExamResult>>(CacheCosmosPrefix + "examResult" + subjectCode.ToString(), ShaHashHelper.GetSHA1(code.ToString()));
|
|
|
- //builder.Data(info);
|
|
|
- }
|
|
|
+
|
|
|
+ if (RedisHelper.Exists(CacheCosmosPrefix + "examResult" + subjectCode.ToString()))
|
|
|
+ {
|
|
|
+ ExamResult res = RedisHelper.HGet<ExamResult>(CacheCosmosPrefix + "examResult" + subjectCode.ToString(), ShaHashHelper.GetSHA1(code.ToString()));
|
|
|
+ exams.Add(res);
|
|
|
+ }
|
|
|
List<Paper> paper = new List<Paper>();
|
|
|
- if (RedisHelper.Exists(CacheCosmosPrefix + ""))
|
|
|
- {
|
|
|
- paper = RedisHelper.HGet<List<Paper>>(CacheCosmosPrefix + "paperInfo" + subjectCode.ToString(), ShaHashHelper.GetSHA1(code.ToString()));
|
|
|
- //builder.Data(info);
|
|
|
- }
|
|
|
- /*if (RedisHelper.Instance != null)
|
|
|
- {
|
|
|
- paper = await RedisHelper.CacheShellAsync(CacheCosmosPrefix + "FindExamPaperRedis",
|
|
|
- ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(sub)), timeoutSeconds, () => { return FindExamPaperRedis(sub, "FindExamPaperRedis"); });
|
|
|
- }
|
|
|
- else
|
|
|
+ if (RedisHelper.Exists(CacheCosmosPrefix + "paperInfo" + subjectCode.ToString()))
|
|
|
{
|
|
|
- paper = await FindExamPaperRedis(sub, "FindExamPaperRedis");
|
|
|
- }*/
|
|
|
+
|
|
|
+ Paper papers = RedisHelper.HGet<Paper>(CacheCosmosPrefix + "paperInfo" + subjectCode.ToString(), ShaHashHelper.GetSHA1(code.ToString()));
|
|
|
+ paper.Add(papers);
|
|
|
+ }
|
|
|
Dictionary<string, object> stuMap = new Dictionary<string, object>
|
|
|
{
|
|
|
{ "schoolCode", "Habook" }
|
|
|
};
|
|
|
- List<Student> students = await azureCosmosDBRepository.FindByDict<Student>(stuMap);
|
|
|
+ //List<Student> students = await azureCosmosDBRepository.FindByDict<Student>(stuMap);
|
|
|
+ List<Student> students = null;
|
|
|
+ if (RedisHelper.Exists(CacheCosmosPrefix + "students"))
|
|
|
+ {
|
|
|
+ students = RedisHelper.HGet<List<Student>>(CacheCosmosPrefix + "students", ShaHashHelper.GetSHA1(schoolCode.ToString()));
|
|
|
+ //builder.Data(info);
|
|
|
+ //students.Add(student);
|
|
|
+ }
|
|
|
HashSet<string> knowledge = new HashSet<string>();
|
|
|
HashSet<string> area = new HashSet<string>();
|
|
|
List<double> point = new List<double>();
|
|
@@ -1655,7 +1648,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
public async Task<BaseResponse> HomeStatistics(JosnRequest<Dictionary<string, object>> request)
|
|
|
{
|
|
|
ResponseBuilder builder = ResponseBuilder.custom();
|
|
|
- Dictionary<string, dynamic> info = new Dictionary<string, dynamic>();
|
|
|
+ List<Dictionary<string, dynamic>> info = new List<Dictionary<string, dynamic>>();
|
|
|
if (RedisHelper.Instance != null)
|
|
|
{
|
|
|
|
|
@@ -1673,7 +1666,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
}
|
|
|
return builder.build();
|
|
|
}
|
|
|
- public async Task<Dictionary<string, dynamic>> FindHomeStatisticsRedis(Dictionary<string, object> dict, string method) {
|
|
|
+ public async Task<List<Dictionary<string, dynamic>>> FindHomeStatisticsRedis(Dictionary<string, object> dict, string method) {
|
|
|
|
|
|
//request.@params.TryGetValue("subjectCode", out object subjectCode);
|
|
|
dict.TryGetValue("schoolCode", out object schoolCode);
|
|
@@ -1687,7 +1680,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
{
|
|
|
{ "schoolCode", schoolCode.ToString()},
|
|
|
};
|
|
|
- await SaveRedisInfoAsync(eMap);
|
|
|
+ //await SaveRedisInfoAsync(eMap);
|
|
|
//说明 同学校、同类型考试数据
|
|
|
//List<ExamInfo> exams = await azureCosmosDBRepository.FindByDict<ExamInfo>(eMap);
|
|
|
List<ExamInfo> exams = new List<ExamInfo>();
|
|
@@ -1701,19 +1694,25 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
exams = await FindExamInfoRedis(eMap, "FindExamInfo");
|
|
|
}
|
|
|
List<ExamInfo> newInfo = new List<ExamInfo>();
|
|
|
- //获取最新的考试信息
|
|
|
+ //获取各个学段最新的考试信息
|
|
|
foreach (IGrouping<string, ExamInfo> group in exams.GroupBy(c => c.conditions.period))
|
|
|
- {
|
|
|
-
|
|
|
+ {
|
|
|
ExamInfo examInfo = group.ToList().OrderByDescending(e => e.createTime).ToList().FirstOrDefault();
|
|
|
newInfo.Add(examInfo);
|
|
|
};
|
|
|
//newInfo.Select(e => e.type.Equals("union"));
|
|
|
- List<ExamInfo> unionInfo = newInfo.Where(e => e.type.Equals("union")).ToList();
|
|
|
+ //List<ExamInfo> unionInfo = newInfo.Where(e => e.type.Equals("union")).ToList();
|
|
|
//exams.GroupBy(e => e.conditions.period);
|
|
|
//ExamInfo info = exams.OrderByDescending(e => e.createTime).ToList().FirstOrDefault();
|
|
|
//查询学校对应的年级信息
|
|
|
- List<School> schools = await azureCosmosDBRepository.FindByDict<School>(SCMap);
|
|
|
+ //List<School> schools = await azureCosmosDBRepository.FindByDict<School>(SCMap);
|
|
|
+ List<School> schools = new List<School>();
|
|
|
+ if (RedisHelper.Exists(CacheCosmosPrefix + "schoolInfo"))
|
|
|
+ {
|
|
|
+ School sc = RedisHelper.HGet<School>(CacheCosmosPrefix + "schoolInfo",
|
|
|
+ ShaHashHelper.GetSHA1(schoolCode.ToString()));
|
|
|
+ schools.Add(sc);
|
|
|
+ }
|
|
|
HashSet<string> classList = new HashSet<string>();
|
|
|
HashSet<string> subjectList = new HashSet<string>();
|
|
|
List<List<List<string>>> AllPoint = new List<List<List<string>>>();
|
|
@@ -1746,282 +1745,295 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
grades = p.grades;
|
|
|
}
|
|
|
});
|
|
|
+ List<Dictionary<string, object>> map = new List<Dictionary<string, object>>();
|
|
|
//循环处理不同年级考试信息
|
|
|
- /*foreach (Grade g in grades) {
|
|
|
-
|
|
|
- }*/
|
|
|
- foreach (ExamInfo e in newInfo)
|
|
|
+ foreach (Grade g in grades)
|
|
|
{
|
|
|
- List<ExamResult> simples = null ;
|
|
|
- if (RedisHelper.Exists(CacheCosmosPrefix + "results"))
|
|
|
- {
|
|
|
- simples = RedisHelper.HGet<List<ExamResult>>(CacheCosmosPrefix + "results", ShaHashHelper.GetSHA1(e.examCode));
|
|
|
- }
|
|
|
- //List<ExamResult> examResults = new List<ExamResult>();
|
|
|
- Dictionary<string, object> sub = new Dictionary<string, object>
|
|
|
+ for (int i = 0; i < newInfo.Count; i++)
|
|
|
{
|
|
|
- { "code", e.id}
|
|
|
- };
|
|
|
- Period = e.conditions.period;
|
|
|
- Grade = e.conditions.grade;
|
|
|
- List<string> subjects = new List<string>();
|
|
|
- List<List<string>> SubjectClassAverage = new List<List<string>>();
|
|
|
- List<List<string>> SubjectAverage = new List<List<string>>();
|
|
|
- //List<List<string>> SubjectClassAverage = new List<List<string>>();
|
|
|
- //List<ExamResult> simples = await azureCosmosDBRepository.FindByDict<ExamResult>(sub);
|
|
|
-
|
|
|
- // 学生总分
|
|
|
- double coreSum = 0;
|
|
|
- int stuCount = e.stuCount;
|
|
|
- //初始化进行人数
|
|
|
- double iPersons = 0;
|
|
|
- //获取进线人数
|
|
|
- iPersons = stuCount * 0.4;
|
|
|
- //
|
|
|
- List<List<double>> subSum = new List<List<double>>();
|
|
|
- if (simples.IsEmpty()) continue;
|
|
|
- double weight = 0.5;
|
|
|
- weightSum += weight;
|
|
|
- int classLen = simples[0].classes.Count;
|
|
|
- for (int cls = 0; cls < classLen; cls++)
|
|
|
- {
|
|
|
- if (simples[0].classes[cls].TryGetValue(simples[0].classes[cls].Keys.ToArray<string>()[0], out int[] indexs))
|
|
|
+ if (g.gradeCode.Equals(newInfo[i].conditions.grade))
|
|
|
{
|
|
|
- List<double> stuScore = new List<double>();
|
|
|
- int stdLen = indexs[1] - indexs[0] + 1;
|
|
|
-
|
|
|
- for (int i = 0; i < stdLen; i++)
|
|
|
+ List<ExamResult> simples = new List<ExamResult>();
|
|
|
+ for (int j = 0; j < newInfo[i].conditions.subject.Count; j++)
|
|
|
{
|
|
|
- stuScore.Add(0);
|
|
|
+ ExamResult result = new ExamResult();
|
|
|
+ if (RedisHelper.Exists(CacheCosmosPrefix + "examResult" + newInfo[i].conditions.subject[j]))
|
|
|
+ {
|
|
|
+ result = RedisHelper.HGet<ExamResult>(CacheCosmosPrefix + "examResult" + newInfo[i].conditions.subject[j],
|
|
|
+ ShaHashHelper.GetSHA1(newInfo[i].examCode));
|
|
|
+ simples.Add(result);
|
|
|
+ }
|
|
|
}
|
|
|
- subSum.Add(stuScore);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- simples.ForEach(s =>
|
|
|
- {
|
|
|
- subjectList.Add(s.subjectCode);
|
|
|
- //计算试卷总分
|
|
|
- double sum = s.point.Sum();
|
|
|
- //int stuSum = 0;
|
|
|
- int classIndex = 0;
|
|
|
- List<string> ClassAverage = new List<string>();
|
|
|
- List<string> Average = new List<string>();
|
|
|
- List<string> passList = new List<string>();
|
|
|
- s.classes.ForEach(c =>
|
|
|
- {
|
|
|
- List<List<string>> classPRL = new List<List<string>>();
|
|
|
-
|
|
|
- //初始化班级总分
|
|
|
- double classPoint = 0;
|
|
|
- //初始化班级缺考人数
|
|
|
- int classCount = 0;
|
|
|
- //初始化班级平均得分率
|
|
|
- double points = 0;
|
|
|
- //初始化班级平均得分率
|
|
|
- double AveragePoints = 0;
|
|
|
- //初始化各班参考人数
|
|
|
- int counts = 0;
|
|
|
- //c.Keys遍历key值
|
|
|
- foreach (string key in c.Keys)
|
|
|
+ //List<ExamResult> examResults = new List<ExamResult>();
|
|
|
+ /*Dictionary<string, object> sub = new Dictionary<string, object>
|
|
|
{
|
|
|
- classList.Add(key);
|
|
|
+ { "code", newInfo[i].id}
|
|
|
+ };*/
|
|
|
+ Period = newInfo[i].conditions.period;
|
|
|
+ Grade = newInfo[i].conditions.grade;
|
|
|
+ List<string> subjects = new List<string>();
|
|
|
+ List<List<string>> SubjectClassAverage = new List<List<string>>();
|
|
|
+ List<List<string>> SubjectAverage = new List<List<string>>();
|
|
|
+ //List<List<string>> SubjectClassAverage = new List<List<string>>();
|
|
|
+ //List<ExamResult> simples = await azureCosmosDBRepository.FindByDict<ExamResult>(sub);
|
|
|
+
|
|
|
+ // 学生总分
|
|
|
+ double coreSum = 0;
|
|
|
+ int stuCount = newInfo[i].stuCount;
|
|
|
+ //初始化进行人数
|
|
|
+ double iPersons = 0;
|
|
|
+ //获取进线人数
|
|
|
+ iPersons = stuCount * 0.4;
|
|
|
+ //
|
|
|
+ List<List<double>> subSum = new List<List<double>>();
|
|
|
+ if (simples.IsEmpty()) continue;
|
|
|
+ double weight = 0.5;
|
|
|
+ weightSum += weight;
|
|
|
+ int classLen = simples[0].classes.Count;
|
|
|
+ for (int cls = 0; cls < classLen; cls++)
|
|
|
+ {
|
|
|
+ if (simples[0].classes[cls].TryGetValue(simples[0].classes[cls].Keys.ToArray<string>()[0], out int[] indexs))
|
|
|
+ {
|
|
|
+ List<double> stuScore = new List<double>();
|
|
|
+ int stdLen = indexs[1] - indexs[0] + 1;
|
|
|
+
|
|
|
+ for (int n = 0; n < stdLen; n++)
|
|
|
+ {
|
|
|
+ stuScore.Add(0);
|
|
|
+ }
|
|
|
+ subSum.Add(stuScore);
|
|
|
+ }
|
|
|
}
|
|
|
- //每个班级平均分
|
|
|
- foreach (int[] value in c.Values)
|
|
|
+
|
|
|
+ simples.ForEach(s =>
|
|
|
{
|
|
|
- for (int i = value[0]; i <= value[1]; i++)
|
|
|
+ subjectList.Add(s.subjectCode);
|
|
|
+ //计算试卷总分
|
|
|
+ double sum = s.point.Sum();
|
|
|
+ //int stuSum = 0;
|
|
|
+ int classIndex = 0;
|
|
|
+ List<string> ClassAverage = new List<string>();
|
|
|
+ List<string> Average = new List<string>();
|
|
|
+ List<string> passList = new List<string>();
|
|
|
+ s.classes.ForEach(c =>
|
|
|
{
|
|
|
- //初始化学生单科个人得分
|
|
|
- double stuPoints = s.result[i].Sum();
|
|
|
+ List<List<string>> classPRL = new List<List<string>>();
|
|
|
+
|
|
|
+ //初始化班级总分
|
|
|
+ double classPoint = 0;
|
|
|
+ //初始化班级缺考人数
|
|
|
+ int classCount = 0;
|
|
|
+ //初始化班级平均得分率
|
|
|
+ double points = 0;
|
|
|
+ //初始化班级平均得分率
|
|
|
+ double AveragePoints = 0;
|
|
|
+ //初始化各班参考人数
|
|
|
+ int counts = 0;
|
|
|
+ //c.Keys遍历key值
|
|
|
+ foreach (string key in c.Keys)
|
|
|
+ {
|
|
|
+ classList.Add(key);
|
|
|
+ }
|
|
|
+ //每个班级平均分
|
|
|
+ foreach (int[] value in c.Values)
|
|
|
+ {
|
|
|
+ for (int i = value[0]; i <= value[1]; i++)
|
|
|
+ {
|
|
|
+ //初始化学生单科个人得分
|
|
|
+ double stuPoints = s.result[i].Sum();
|
|
|
|
|
|
- subSum[classIndex][i - value[0]] = stuPoints + subSum[classIndex][i - value[0]];
|
|
|
+ subSum[classIndex][i - value[0]] = stuPoints + subSum[classIndex][i - value[0]];
|
|
|
|
|
|
- classPoint += s.result[i].Sum();
|
|
|
- coreSum += s.result[i].Sum();
|
|
|
+ classPoint += s.result[i].Sum();
|
|
|
+ coreSum += s.result[i].Sum();
|
|
|
|
|
|
- if (s.result[i].Sum() == 0)
|
|
|
+ if (s.result[i].Sum() == 0)
|
|
|
+ {
|
|
|
+ classCount++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //每个班级实际参考人数
|
|
|
+ counts = value[1] - value[0] - classCount + 1;
|
|
|
+ //stuSum += counts;
|
|
|
+ points = Convert.ToDouble(classPoint) / counts / sum;
|
|
|
+ //计算每个班级平均得分
|
|
|
+ AveragePoints = Convert.ToDouble(classPoint) / counts;
|
|
|
+ ClassAverage.Add(points.ToString("0.000"));
|
|
|
+ Average.Add(AveragePoints.ToString());
|
|
|
+ }
|
|
|
+ classIndex += 1;
|
|
|
+ });
|
|
|
+ SubjectClassAverage.Add(ClassAverage);
|
|
|
+ SubjectAverage.Add(Average);
|
|
|
+ //subAverage = subjectPoint / ClassAverage.Count();
|
|
|
+ //subjectAverage.Add(subAverage.ToString("0.00"));
|
|
|
+ });
|
|
|
+ double core = coreSum / stuCount * weight;
|
|
|
+ CoreAverage.Add(core);
|
|
|
+ AllPoint.Add(SubjectClassAverage);
|
|
|
+ AllPointAverage.Add(SubjectAverage);
|
|
|
+
|
|
|
+ //处理人数为整
|
|
|
+ string ip = iPersons.ToString("0");
|
|
|
+ //初始化进线分数
|
|
|
+ int ipoint = 0;
|
|
|
+ List<int> AllPoints = new List<int>();
|
|
|
+ foreach (List<double> points in subSum)
|
|
|
+ {
|
|
|
+ foreach (int po in points)
|
|
|
+ {
|
|
|
+ AllPoints.Add(po);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (int sn = 0; sn < subSum.Count; sn++)
|
|
|
+ {
|
|
|
+ for (int j = 0; j < subSum[sn].Count; j++)
|
|
|
+ {
|
|
|
+ if (subSum[sn][j].Equals("0"))
|
|
|
{
|
|
|
- classCount++;
|
|
|
+ subSum[sn].Remove(subSum[sn][j]);
|
|
|
}
|
|
|
}
|
|
|
- //每个班级实际参考人数
|
|
|
- counts = value[1] - value[0] - classCount + 1;
|
|
|
- //stuSum += counts;
|
|
|
- points = Convert.ToDouble(classPoint) / counts / sum;
|
|
|
- //计算每个班级平均得分
|
|
|
- AveragePoints = Convert.ToDouble(classPoint) / counts;
|
|
|
- ClassAverage.Add(points.ToString("0.000"));
|
|
|
- Average.Add(AveragePoints.ToString());
|
|
|
}
|
|
|
- classIndex += 1;
|
|
|
- });
|
|
|
- SubjectClassAverage.Add(ClassAverage);
|
|
|
- SubjectAverage.Add(Average);
|
|
|
- //subAverage = subjectPoint / ClassAverage.Count();
|
|
|
- //subjectAverage.Add(subAverage.ToString("0.00"));
|
|
|
- });
|
|
|
- double core = coreSum / stuCount * weight;
|
|
|
- CoreAverage.Add(core);
|
|
|
- AllPoint.Add(SubjectClassAverage);
|
|
|
- AllPointAverage.Add(SubjectAverage);
|
|
|
-
|
|
|
- //处理人数为整
|
|
|
- string ip = iPersons.ToString("0");
|
|
|
- //初始化进线分数
|
|
|
- int ipoint = 0;
|
|
|
- List<int> AllPoints = new List<int>();
|
|
|
- foreach (List<double> points in subSum)
|
|
|
- {
|
|
|
- foreach (int po in points)
|
|
|
- {
|
|
|
- AllPoints.Add(po);
|
|
|
- }
|
|
|
- }
|
|
|
- for (int i = 0; i < subSum.Count; i++)
|
|
|
- {
|
|
|
- for (int j = 0; j < subSum[i].Count; j++)
|
|
|
- {
|
|
|
- if (subSum[i][j].Equals("0"))
|
|
|
+ //计算成绩年级排名
|
|
|
+ AllPoints.Sort(delegate (int s1, int s2) { return s2.CompareTo(s1); });
|
|
|
+ ipoint = AllPoints[int.Parse(ip)];
|
|
|
+ int m = 0;
|
|
|
+ List<List<string>> KeyLine = new List<List<string>>();
|
|
|
+ foreach (List<double> points in subSum)
|
|
|
{
|
|
|
- subSum[i].Remove(subSum[i][j]);
|
|
|
+ List<string> detail = new List<string>();
|
|
|
+ double sum = points.Count;
|
|
|
+ int l = 0;
|
|
|
+ for (int mq = 0; mq < points.Count; mq++)
|
|
|
+ {
|
|
|
+ if (points[i] > ipoint)
|
|
|
+ {
|
|
|
+ l++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ double Lines = l;
|
|
|
+ detail.Add(Lines.ToString());
|
|
|
+ detail.Add(points.Count.ToString());
|
|
|
+ var t3 = Math.Floor(Math.Round(decimal.Parse((Lines / sum).ToString("0.000")), 2) * 100);
|
|
|
+ detail.Add(t3.ToString());
|
|
|
+ KeyLine.Add(detail);
|
|
|
+ m++;
|
|
|
}
|
|
|
+ AllKeyLine.Add(KeyLine);
|
|
|
+
|
|
|
}
|
|
|
- }
|
|
|
- //计算成绩年级排名
|
|
|
- AllPoints.Sort(delegate (int s1, int s2) { return s2.CompareTo(s1); });
|
|
|
- ipoint = AllPoints[int.Parse(ip)];
|
|
|
- int m = 0;
|
|
|
- List<List<string>> KeyLine = new List<List<string>>();
|
|
|
- foreach (List<double> points in subSum)
|
|
|
- {
|
|
|
- List<string> detail = new List<string>();
|
|
|
- double sum = points.Count;
|
|
|
- int j = 0;
|
|
|
- for (int i = 0; i < points.Count; i++)
|
|
|
+ //年级成就指标
|
|
|
+ if (weightSum == 0)
|
|
|
{
|
|
|
- if (points[i] > ipoint)
|
|
|
- {
|
|
|
- j++;
|
|
|
- }
|
|
|
+ weightSum = 1;
|
|
|
}
|
|
|
- double Lines = j;
|
|
|
- detail.Add(Lines.ToString());
|
|
|
- detail.Add(points.Count.ToString());
|
|
|
- var t3 = Math.Floor(Math.Round(decimal.Parse((Lines / sum).ToString("0.000")), 2) * 100);
|
|
|
- detail.Add(t3.ToString());
|
|
|
- KeyLine.Add(detail);
|
|
|
- m++;
|
|
|
- }
|
|
|
- AllKeyLine.Add(KeyLine);
|
|
|
-
|
|
|
- }
|
|
|
- //年级成就指标
|
|
|
- if (weightSum == 0)
|
|
|
- {
|
|
|
- weightSum = 1;
|
|
|
- }
|
|
|
- double index = CoreAverage.Sum() / weightSum;
|
|
|
- List<List<double>> AveragePoint = new List<List<double>>();
|
|
|
- List<List<double>> AverageClassPoint = new List<List<double>>();
|
|
|
- //List<double> ClassCore = new List<double>();
|
|
|
- int k = AllPoint.Count;
|
|
|
- if (k > 0)
|
|
|
- {
|
|
|
- for (int m = 0; m < AllPoint[0].Count; m++)
|
|
|
- {
|
|
|
- List<double> SubjectAverage = new List<double>();
|
|
|
- for (int n = 0; n < AllPoint[0][m].Count; n++)
|
|
|
+ double index = CoreAverage.Sum() / weightSum;
|
|
|
+ List<List<double>> AveragePoint = new List<List<double>>();
|
|
|
+ List<List<double>> AverageClassPoint = new List<List<double>>();
|
|
|
+ //List<double> ClassCore = new List<double>();
|
|
|
+ int k = AllPoint.Count;
|
|
|
+ if (k > 0)
|
|
|
{
|
|
|
- double startPoint = 0;
|
|
|
- for (int f = 0; f < k; f++)
|
|
|
+ for (int m = 0; m < AllPoint[0].Count; m++)
|
|
|
{
|
|
|
- startPoint = double.Parse(AllPoint[f][m][n]) + startPoint;
|
|
|
+ List<double> SubjectAverage = new List<double>();
|
|
|
+ for (int n = 0; n < AllPoint[0][m].Count; n++)
|
|
|
+ {
|
|
|
+ double startPoint = 0;
|
|
|
+ for (int f = 0; f < k; f++)
|
|
|
+ {
|
|
|
+ startPoint = double.Parse(AllPoint[f][m][n]) + startPoint;
|
|
|
+ }
|
|
|
+ SubjectAverage.Add(startPoint / k);
|
|
|
+ }
|
|
|
+ AveragePoint.Add(SubjectAverage);
|
|
|
}
|
|
|
- SubjectAverage.Add(startPoint / k);
|
|
|
}
|
|
|
- AveragePoint.Add(SubjectAverage);
|
|
|
- }
|
|
|
- }
|
|
|
- //每个班级成就指标
|
|
|
- int p = AllPointAverage.Count;
|
|
|
- if (p > 0)
|
|
|
- {
|
|
|
- for (int m = 0; m < AllPointAverage[0].Count; m++)
|
|
|
- {
|
|
|
- List<double> SubjectAverage = new List<double>();
|
|
|
- for (int n = 0; n < AllPointAverage[0][m].Count; n++)
|
|
|
+ //每个班级成就指标
|
|
|
+ int p = AllPointAverage.Count;
|
|
|
+ if (p > 0)
|
|
|
{
|
|
|
- double startPoint = 0;
|
|
|
- for (int f = 0; f < k; f++)
|
|
|
+ for (int m = 0; m < AllPointAverage[0].Count; m++)
|
|
|
{
|
|
|
- startPoint = double.Parse(AllPointAverage[f][m][n]) + startPoint;
|
|
|
+ List<double> SubjectAverage = new List<double>();
|
|
|
+ for (int n = 0; n < AllPointAverage[0][m].Count; n++)
|
|
|
+ {
|
|
|
+ double startPoint = 0;
|
|
|
+ for (int f = 0; f < k; f++)
|
|
|
+ {
|
|
|
+ startPoint = double.Parse(AllPointAverage[f][m][n]) + startPoint;
|
|
|
+ }
|
|
|
+ SubjectAverage.Add(startPoint / k);
|
|
|
+ }
|
|
|
+ AverageClassPoint.Add(SubjectAverage);
|
|
|
}
|
|
|
- SubjectAverage.Add(startPoint / k);
|
|
|
}
|
|
|
- AverageClassPoint.Add(SubjectAverage);
|
|
|
- }
|
|
|
- }
|
|
|
- int c = AverageClassPoint.Count;
|
|
|
- List<double> ClassCore = new List<double>();
|
|
|
- if (c > 0)
|
|
|
- {
|
|
|
- for (int j = 0; j < AverageClassPoint[0].Count; j++)
|
|
|
- {
|
|
|
- double startAverage = 0;
|
|
|
- for (int f = 0; f < c; f++)
|
|
|
+ int c = AverageClassPoint.Count;
|
|
|
+ List<double> ClassCore = new List<double>();
|
|
|
+ if (c > 0)
|
|
|
{
|
|
|
- startAverage = AverageClassPoint[f][j] + startAverage;
|
|
|
+ for (int j = 0; j < AverageClassPoint[0].Count; j++)
|
|
|
+ {
|
|
|
+ double startAverage = 0;
|
|
|
+ for (int f = 0; f < c; f++)
|
|
|
+ {
|
|
|
+ startAverage = AverageClassPoint[f][j] + startAverage;
|
|
|
+ }
|
|
|
+ ClassCore.Add(startAverage / weightSum);
|
|
|
+ }
|
|
|
}
|
|
|
- ClassCore.Add(startAverage / weightSum);
|
|
|
- }
|
|
|
- }
|
|
|
- //班级平均进线率
|
|
|
- int ExamCount = AllKeyLine.Count;
|
|
|
- List<List<double>> KeyLines = new List<List<double>>();
|
|
|
- if (ExamCount > 0)
|
|
|
- {
|
|
|
- for (int m = 0; m < AllKeyLine[0].Count; m++)
|
|
|
- {
|
|
|
- List<double> ClassLine = new List<double>();
|
|
|
- for (int n = 0; n < AllKeyLine[0][m].Count; n++)
|
|
|
+ //班级平均进线率
|
|
|
+ int ExamCount = AllKeyLine.Count;
|
|
|
+ List<List<double>> KeyLines = new List<List<double>>();
|
|
|
+ if (ExamCount > 0)
|
|
|
{
|
|
|
- double startPoint = 0;
|
|
|
- for (int f = 0; f < ExamCount; f++)
|
|
|
+ for (int m = 0; m < AllKeyLine[0].Count; m++)
|
|
|
{
|
|
|
- startPoint = double.Parse(AllKeyLine[f][m][n]) + startPoint;
|
|
|
+ List<double> ClassLine = new List<double>();
|
|
|
+ for (int n = 0; n < AllKeyLine[0][m].Count; n++)
|
|
|
+ {
|
|
|
+ double startPoint = 0;
|
|
|
+ for (int f = 0; f < ExamCount; f++)
|
|
|
+ {
|
|
|
+ startPoint = double.Parse(AllKeyLine[f][m][n]) + startPoint;
|
|
|
+ }
|
|
|
+ ClassLine.Add(startPoint / ExamCount);
|
|
|
+ }
|
|
|
+ KeyLines.Add(ClassLine);
|
|
|
}
|
|
|
- ClassLine.Add(startPoint / ExamCount);
|
|
|
}
|
|
|
- KeyLines.Add(ClassLine);
|
|
|
- }
|
|
|
+ Dictionary<string, object> AveragePointMap = new Dictionary<string, object>
|
|
|
+ {
|
|
|
+ { "Period",Period},
|
|
|
+ { "Grade",Grade},
|
|
|
+ { "index", index},
|
|
|
+ { "className", classList },
|
|
|
+ { "subjectName", subjectList },
|
|
|
+ { "AveragePoint", AveragePoint },
|
|
|
+ //{ "AverageClassPoint", AverageClassPoint },
|
|
|
+ { "ClassCore", ClassCore },
|
|
|
+ { "KeyLines",KeyLines}
|
|
|
+ };
|
|
|
+ map.Add(AveragePointMap);
|
|
|
+ }
|
|
|
}
|
|
|
- Dictionary<string, object> AveragePointMap = new Dictionary<string, object>
|
|
|
- {
|
|
|
- { "Period",Period},
|
|
|
- { "Grade",Grade},
|
|
|
- { "index", index},
|
|
|
- { "className", classList },
|
|
|
- { "subjectName", subjectList },
|
|
|
- { "AveragePoint", AveragePoint },
|
|
|
- //{ "AverageClassPoint", AverageClassPoint },
|
|
|
- { "ClassCore", ClassCore },
|
|
|
- { "KeyLines",KeyLines}
|
|
|
- };
|
|
|
+
|
|
|
//Redis处理结果集
|
|
|
if (RedisHelper.Instance != null)
|
|
|
{
|
|
|
if (!RedisHelper.Exists(CacheCosmosPrefix + method))
|
|
|
{
|
|
|
- await RedisHelper.HSetAsync(CacheCosmosPrefix + method, ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(dict)), AveragePointMap);
|
|
|
+ await RedisHelper.HSetAsync(CacheCosmosPrefix + method, ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(dict)), map);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- await RedisHelper.HSetAsync(CacheCosmosPrefix + method, ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(dict)), AveragePointMap);
|
|
|
+ await RedisHelper.HSetAsync(CacheCosmosPrefix + method, ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(dict)), map);
|
|
|
await RedisHelper.ExpireAsync(CacheCosmosPrefix + method, timeoutSeconds);
|
|
|
}
|
|
|
}
|
|
|
- return AveragePointMap;
|
|
|
+ return map;
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|