|
@@ -42,17 +42,18 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
public async Task<BaseJosnRPCResponse> FindExam(JosnRPCRequest<Dictionary<string, object>> request)
|
|
|
{
|
|
|
JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
|
|
|
+ Dictionary<string, object> info = new Dictionary<string, object>();
|
|
|
if (RedisHelper.Instance != null)
|
|
|
{
|
|
|
|
|
|
- Dictionary<string, object> info = await RedisHelper.CacheShellAsync(CacheCosmosPrefix + request.method,
|
|
|
+ info = await RedisHelper.CacheShellAsync(CacheCosmosPrefix + request.method,
|
|
|
ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(request.@params)), timeoutSeconds, () => { return FindExamRedis(request.@params, request.method); });
|
|
|
builder.Data(info);
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Dictionary<string, object> info = await FindExamRedis(request.@params, request.method);
|
|
|
+ info = await FindExamRedis(request.@params, request.method);
|
|
|
builder.Data(info);
|
|
|
}
|
|
|
return builder.build();
|
|
@@ -62,7 +63,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
public async Task<Dictionary<string, object>> FindExamRedis (Dictionary<string, object> dict, string method) {
|
|
|
|
|
|
JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
|
|
|
- Console.WriteLine(DateTimeOffset.Now.Second);
|
|
|
+ //Console.WriteLine(DateTimeOffset.Now.Second);
|
|
|
List<ExamResult> exams = await azureCosmosDBRepository.FindByDict<ExamResult>(dict);
|
|
|
|
|
|
Dictionary<string, object> stuMap = new Dictionary<string, object>
|
|
@@ -142,9 +143,9 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
var gradeAverage = sumPoint / sumperson;
|
|
|
//存放年级平均
|
|
|
gAverage.Add(gradeAverage.ToString());
|
|
|
- //提取班级信息
|
|
|
+ //任意一次考试数据提取班级信息
|
|
|
List<Dictionary<string, int[]>> classToName = exams[0].classes;
|
|
|
- //提取学生ID信息
|
|
|
+ //任意一次考试数据提取学生ID信息
|
|
|
List<string> idToName = exams[0].ids;
|
|
|
//var gradeAverage = Math.Floor(Math.Round(decimal.Parse((10 / 3).ToString("0.000")), 2));
|
|
|
List<string> subjects = new List<string>();
|
|
@@ -174,7 +175,6 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
e.classes.ForEach(c =>
|
|
|
{
|
|
|
List<List<string>> classPRL = new List<List<string>>();
|
|
|
-
|
|
|
//初始化班级总分
|
|
|
int classPoint = 0;
|
|
|
//初始化班级缺考人数
|
|
@@ -289,7 +289,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
List<List<string>> sp = new List<List<string>>();
|
|
|
//Dictionary<string, int> rankScore = new Dictionary<string, int>();
|
|
|
List<int> rankScore = new List<int>();
|
|
|
- foreach (string key in dict.Keys)
|
|
|
+ foreach (string key in dicts.Keys)
|
|
|
{
|
|
|
int score = 0;
|
|
|
List<string> values = new List<string>();
|
|
@@ -455,6 +455,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
achievementAnalysis.Add("earlyWarning", early);
|
|
|
achievementAnalysis.Add("rankPR", rankPR);
|
|
|
achievementAnalysis.Add("stuAverage", AclassAverage);
|
|
|
+ //Redis处理结果集
|
|
|
if (RedisHelper.Instance != null)
|
|
|
{
|
|
|
if (!RedisHelper.Exists(CacheCosmosPrefix + method))
|