|
@@ -964,19 +964,19 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
else return exerciseScatter;
|
|
|
}
|
|
|
|
|
|
- [HttpPost("knowledgePoint")]
|
|
|
- public async Task<BaseJosnRPCResponse> KnowledgePoint(JosnRPCRequest<Dictionary<string, object>> request)
|
|
|
+
|
|
|
+ public async Task<Dictionary<string, dynamic>> FindKnowledgePointRedis(Dictionary<string, object> dict, string method)
|
|
|
{
|
|
|
- JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
|
|
|
- request.@params.TryGetValue("subjectCode", out object subjectCode);
|
|
|
- request.@params.TryGetValue("schoolCode", out object schoolCode);
|
|
|
- request.@params.TryGetValue("examCode", out object examCode);
|
|
|
- request.@params.TryGetValue("scopeCode", out object scopeCode);
|
|
|
+ //JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
|
|
|
+ dict.TryGetValue("subjectCode", out object subjectCode);
|
|
|
+ dict.TryGetValue("schoolCode", out object schoolCode);
|
|
|
+ dict.TryGetValue("examCode", out object examCode);
|
|
|
+ dict.TryGetValue("scopeCode", out object scopeCode);
|
|
|
Dictionary<string, object> sub = new Dictionary<string, object>
|
|
|
{
|
|
|
{ "subjectCode", subjectCode.ToString()},
|
|
|
{ "scopeCode",scopeCode.ToString()}
|
|
|
-
|
|
|
+
|
|
|
};
|
|
|
Dictionary<string, object> examMap = new Dictionary<string, object>
|
|
|
{
|
|
@@ -986,8 +986,26 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
|
|
|
|
|
|
};
|
|
|
- List<ExamPaper> paper = await azureCosmosDBRepository.FindByDict<ExamPaper>(sub);
|
|
|
- List<ExamResult> exams = await azureCosmosDBRepository.FindByDict<ExamResult>(examMap);
|
|
|
+ List<ExamResult> exams = new List<ExamResult>();
|
|
|
+ if (RedisHelper.Instance != null)
|
|
|
+ {
|
|
|
+ exams = await RedisHelper.CacheShellAsync(CacheCosmosPrefix + method + "KnowledgeResource",
|
|
|
+ ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(examMap)), timeoutSeconds, () => { return FindExamResultRedis(examMap, method + "KnowledgeResource"); });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ exams = await FindExamResultRedis(examMap, method + "KnowledgeResource");
|
|
|
+ }
|
|
|
+ List<ExamPaper> paper = new List<ExamPaper>();
|
|
|
+ if (RedisHelper.Instance != null)
|
|
|
+ {
|
|
|
+ paper = await RedisHelper.CacheShellAsync(CacheCosmosPrefix + method + "KnowledgePaperResource",
|
|
|
+ ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(sub)), timeoutSeconds, () => { return FindExamPaperRedis(sub, method + "KnowledgePaperResource"); });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ paper = await FindExamPaperRedis(sub, method + "KnowledgePaperResource");
|
|
|
+ }
|
|
|
Dictionary<string, object> stuMap = new Dictionary<string, object>
|
|
|
{
|
|
|
{ "schoolCode", "Habook" }
|
|
@@ -1000,7 +1018,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
List<Dictionary<string, int[]>> classes = new List<Dictionary<string, int[]>>();
|
|
|
List<string> ids = new List<string>();
|
|
|
//string Type = "";
|
|
|
- if (request.@params.TryGetValue("type",out object Type))
|
|
|
+ if (dict.TryGetValue("type", out object Type))
|
|
|
{
|
|
|
paper.ForEach(p =>
|
|
|
{
|
|
@@ -1029,7 +1047,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
double Qnum = 0;
|
|
|
//确定高分组 低分组人数
|
|
|
List<List<int>> re = exams[0].result;
|
|
@@ -1059,23 +1077,35 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
classes = ex.classes;
|
|
|
ids = ex.ids;
|
|
|
}
|
|
|
- /* exams.ForEach(e =>
|
|
|
- {
|
|
|
- point = e.Point;
|
|
|
- result = e.Result;
|
|
|
- classes = e.Classes;
|
|
|
- ids = e.Ids;
|
|
|
- });*/
|
|
|
+ /* exams.ForEach(e =>
|
|
|
+ {
|
|
|
+ point = e.Point;
|
|
|
+ result = e.Result;
|
|
|
+ classes = e.Classes;
|
|
|
+ ids = e.Ids;
|
|
|
+ });*/
|
|
|
List<string> knowledgeName = new List<string>();
|
|
|
foreach (string cla in knowledge)
|
|
|
{
|
|
|
knowledgeName.Add(cla);
|
|
|
}
|
|
|
+ for (int k = 0;k < knowledgeName.Count;k++ ) {
|
|
|
+ if (null == knowledgeName[k]) {
|
|
|
+ knowledgeName.Remove(knowledgeName[k]);
|
|
|
+ }
|
|
|
+ }
|
|
|
List<string> areaName = new List<string>();
|
|
|
foreach (string cla in area)
|
|
|
{
|
|
|
areaName.Add(cla);
|
|
|
}
|
|
|
+ for (int k = 0; k < areaName.Count; k++)
|
|
|
+ {
|
|
|
+ if (null == areaName[k])
|
|
|
+ {
|
|
|
+ areaName.Remove(areaName[k]);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//初始化年级总分
|
|
|
double total = 0;
|
|
@@ -1165,7 +1195,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
paper.ForEach(p =>
|
|
|
{
|
|
|
int n = 0;
|
|
|
- if (request.@params.TryGetValue("type", out object Type)) {
|
|
|
+ if (dict.TryGetValue("type", out object Type)) {
|
|
|
p.item.ForEach(i =>
|
|
|
{
|
|
|
if (i.field.Contains(knowledgeName[k]))
|
|
@@ -1189,7 +1219,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
}
|
|
|
n++;
|
|
|
});
|
|
|
- }
|
|
|
+ }
|
|
|
valuew[1] = OnePoint.ToString();
|
|
|
string itemNos = "";
|
|
|
foreach (string index in itemNo)
|
|
@@ -1232,7 +1262,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
double po = 0;
|
|
|
p.item.ForEach(i =>
|
|
|
{
|
|
|
- if (request.@params.TryGetValue("type", out object Type))
|
|
|
+ if (dict.TryGetValue("type", out object Type))
|
|
|
{
|
|
|
if (i.field.Contains(knowledgeName[k]))
|
|
|
{
|
|
@@ -1240,7 +1270,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
//Dictionary<string, double> mapkeyItem = new Dictionary<string, double>();
|
|
|
//OnePoint += 1 / Convert.ToDouble(i.points.Count) * point[n];
|
|
|
//当前认知层次在该题占比多少
|
|
|
- ePoint = 1 ;
|
|
|
+ ePoint = 1;
|
|
|
anwPoint += result[m][n] * ePoint;
|
|
|
//所有学生单个认知层次得分情况
|
|
|
anwGPoint += result[m][n] * ePoint;
|
|
@@ -1292,7 +1322,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
}
|
|
|
}
|
|
|
n++;
|
|
|
- }
|
|
|
+ }
|
|
|
});
|
|
|
double stuPser = anwPoint / po;
|
|
|
values[3] = po.ToString();
|
|
@@ -1334,12 +1364,12 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
|
|
|
p.item.ForEach(i =>
|
|
|
{
|
|
|
- if (request.@params.TryGetValue("type", out object Type))
|
|
|
+ if (dict.TryGetValue("type", out object Type))
|
|
|
{
|
|
|
if (i.field.Contains(knowledgeName[k]))
|
|
|
{
|
|
|
//当前认知层次在该题占比多少
|
|
|
- ePoint = 1 ;
|
|
|
+ ePoint = 1;
|
|
|
anwCPoint += result[n][x] * ePoint;
|
|
|
cpo += point[x] * ePoint;
|
|
|
}
|
|
@@ -1355,7 +1385,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
}
|
|
|
x++;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
});
|
|
|
|
|
|
});
|
|
@@ -1381,8 +1411,44 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
knowledgeALL.Add("stupercent", knowledgeMap);
|
|
|
knowledgeALL.Add("classpercent", classMap);
|
|
|
knowledgeALL.Add("wrong", wrongMap);
|
|
|
- builder.Data(knowledgeALL);
|
|
|
+ //builder.Data(knowledgeALL);
|
|
|
+
|
|
|
+ //Redis处理结果集
|
|
|
+ if (RedisHelper.Instance != null)
|
|
|
+ {
|
|
|
+ if (!RedisHelper.Exists(CacheCosmosPrefix + method))
|
|
|
+ {
|
|
|
+ await RedisHelper.HSetAsync(CacheCosmosPrefix + method, ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(dict)), knowledgeALL);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ await RedisHelper.HSetAsync(CacheCosmosPrefix + method, ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(dict)), knowledgeALL);
|
|
|
+ await RedisHelper.ExpireAsync(CacheCosmosPrefix + method, timeoutSeconds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return knowledgeALL;
|
|
|
+ }
|
|
|
|
|
|
+ [HttpPost("knowledgePoint")]
|
|
|
+ public async Task<BaseJosnRPCResponse> KnowledgePoint(JosnRPCRequest<Dictionary<string, object>> request)
|
|
|
+ {
|
|
|
+ JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
|
|
|
+ Dictionary<string, dynamic> info = new Dictionary<string, dynamic>();
|
|
|
+ if (RedisHelper.Instance != null)
|
|
|
+ {
|
|
|
+
|
|
|
+ info = await RedisHelper.CacheShellAsync(CacheCosmosPrefix + request.method,
|
|
|
+ ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(request.@params)), timeoutSeconds, () => { return FindKnowledgePointRedis(request.@params, request.method); });
|
|
|
+
|
|
|
+ //数据从redis读取过后进行转换格式
|
|
|
+ builder.Data(JsonApiHelper.FromApiJson<System.Text.Json.JsonElement>(info.ToJson()));
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ info = await FindKnowledgePointRedis(request.@params, request.method);
|
|
|
+ builder.Data(JsonApiHelper.FromApiJson<System.Text.Json.JsonElement>(info.ToJson()));
|
|
|
+ }
|
|
|
return builder.build();
|
|
|
}
|
|
|
[HttpPost("FindExamInfo")]
|