From b6e33cc2920b5a59833f8170c97523aff13152dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Mon, 28 Oct 2024 11:57:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=A1=A9=E5=8F=B7=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E4=B8=8A=E4=B8=8B=E8=A1=8C=E7=9B=B8=E6=9C=BA=E5=8A=A0?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=EF=BC=8C=E7=90=83=E6=9C=BA=E5=9C=A8=E5=89=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zc/business/controller/VideoController.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/VideoController.java b/zc-business/src/main/java/com/zc/business/controller/VideoController.java index 94cd2a9a..1dd6e6c8 100644 --- a/zc-business/src/main/java/com/zc/business/controller/VideoController.java +++ b/zc-business/src/main/java/com/zc/business/controller/VideoController.java @@ -35,12 +35,9 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; /** @@ -523,7 +520,14 @@ public class VideoController extends BaseController { List centerCameraList = iDcDeviceService.selectNearCamPile(UniversalEnum.TWO.getValue(), startMileage,endMileage); upCameraList.addAll(centerCameraList); List downCameraList = iDcDeviceService.selectNearCamPile(UniversalEnum.THREE.getValue(),startMileage,endMileage); - result.put("upCamera",upCameraList); + // 排序 + List sortedList = upCameraList.stream() + .sorted(Comparator.comparingInt((DcDevice d) -> + "1-2".equals(d.getChildType()) ? 0 : 1) + .thenComparing(DcDevice::getStakeMark, Comparator.reverseOrder())) + .collect(Collectors.toList()); + + result.put("upCamera",sortedList); result.put("downCamera",downCameraList); return AjaxResult.success(result);