Prechádzať zdrojové kódy

修改成绩降序排序

insomniaLee 5 rokov pred
rodič
commit
7640bc4058

+ 2 - 0
src/main/java/com/mooctest/service/JobService.java

@@ -18,6 +18,7 @@ import org.springframework.web.client.RestTemplate;
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.Iterator;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -167,6 +168,7 @@ public class JobService {
             object.fluentPut("name",findUserNameById(key));
             array.add(object);
         }
+        array.sort(Comparator.comparing(obj -> ((JSONObject) obj).getDouble("score")).reversed());
         return  array;
     }
 

+ 3 - 3
src/main/java/com/mooctest/service/TaskService.java

@@ -198,9 +198,9 @@ public class TaskService {
         exam.fluentPut("beginTime",TimeUtil.timestampTo24format(Long.parseLong(task.getStartTime())));
         exam.fluentPut("endTime",TimeUtil.timestampTo24format(Long.parseLong(task.getEndTime())));
         exam.fluentPut("caseTakeId",examId + "-" + caseId);
-        exam.fluentPut("caseTypeId",0); // 默认是app类型的
-        exam.fluentPut("state",0);
-        exam.fluentPut("groupId",0); // 需要从前端获取
+        exam.fluentPut("caseTypeId",1); // 默认是app类型的
+        exam.fluentPut("state",0); // 有默认值无需传
+        exam.fluentPut("groupId",30); // 需要从前端获取
         exam.fluentPut("id",0);
         vo.fluentPut("exam",exam);
         template.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));