wangliang hace 2 años
padre
commit
8fb01597d6

+ 1 - 4
themis-admin/src/main/java/com/qmth/themis/admin/api/TIeInvigilateController.java

@@ -178,7 +178,6 @@ public class TIeInvigilateController {
     @RequestMapping(value = "/list/video/random", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "监考监控信息", response = InvigilateListVideoBean.class)})
     public Result listVideoRandom(@ApiParam(value = "考试批次id", required = false) @RequestParam(required = false) Long examId, @ApiParam(value = "随机数", required = true) @RequestParam Integer randomNum) {
-//        long startTime = System.currentTimeMillis();
         if (Objects.isNull(randomNum) || Objects.equals(randomNum, "")) {
             throw new BusinessException("随机数不能为空");
         }
@@ -218,9 +217,7 @@ public class TIeInvigilateController {
                 }
             });
         }
-//        long end = System.currentTimeMillis();
-//        log.info("============list/video/random耗时============:{}秒", (end - startTime) / 1000);
-        Collections.sort(invigilateListVideoBeanList);
+        invigilateListVideoBeanList.sort(Comparator.comparing(InvigilateListVideoBean::getMonitorLiveUrl, Comparator.nullsLast(Comparator.naturalOrder())));
         return ResultUtil.ok(invigilateListVideoBeanList);
     }
 

+ 1 - 13
themis-business/src/main/java/com/qmth/themis/business/bean/admin/InvigilateListVideoBean.java

@@ -7,7 +7,6 @@ import com.qmth.themis.business.enums.MonitorStatusSourceEnum;
 import com.qmth.themis.business.enums.WebsocketStatusEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
-import org.jetbrains.annotations.NotNull;
 
 import java.io.Serializable;
 import java.util.Objects;
@@ -20,7 +19,7 @@ import java.util.Objects;
  * @Date: 2020/8/22
  */
 @ApiModel("实时监控台视频返回对象")
-public class InvigilateListVideoBean implements Serializable, Comparable<InvigilateListVideoBean> {
+public class InvigilateListVideoBean implements Serializable {
 
     @ApiModelProperty(name = "序号")
     private Integer seq;
@@ -389,15 +388,4 @@ public class InvigilateListVideoBean implements Serializable, Comparable<Invigil
     public void setBreachStatus(Integer breachStatus) {
         this.breachStatus = breachStatus;
     }
-
-    @Override
-    public int compareTo(@NotNull InvigilateListVideoBean o) {
-        if (Objects.nonNull(o.getMonitorLiveUrl())) {
-            return 1;
-        }
-        if (Objects.isNull(o.getMonitorLiveUrl())) {
-            return -1;
-        }
-        return 0;
-    }
 }