From 1ff713ce639fdf1f6923708757e9a269d3a673ab Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Mon, 28 Oct 2024 17:30:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=99=84=E8=BF=91=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E8=A1=8C=E7=9B=B8=E6=9C=BA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/controller/VideoController.java | 26 +++++++++++++++++-- .../mapper/business/DcDeviceMapper.xml | 2 +- 2 files changed, 25 insertions(+), 3 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 45f6402f..88625424 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 @@ -8,6 +8,7 @@ import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.service.ISysConfigService; import com.zc.business.constant.DeviceTypeConstants; import com.zc.business.domain.DcDevice; @@ -526,8 +527,7 @@ public class VideoController extends BaseController { List downCameraList = iDcDeviceService.selectNearCamPile(UniversalEnum.THREE.getValue(),startMileage,endMileage); // 排序 List sortedList = upCameraList.stream() - .sorted(Comparator.comparingInt((DcDevice d) -> - "1-2".equals(d.getChildType()) ? 0 : 1) + .sorted(Comparator.comparingInt(this::cameraTypeSorted) .thenComparing(DcDevice::getStakeMark, Comparator.reverseOrder())) .collect(Collectors.toList()); @@ -536,6 +536,28 @@ public class VideoController extends BaseController { return AjaxResult.success(result); } + + /** + * 摄像头类型排序 + * 球机->360全景->180全景->其他类型 + */ + private int cameraTypeSorted(DcDevice dcDevice){ + if (StringUtils.isEmpty(dcDevice.getChildType())){ + return 3; + } + String deviceType = dcDevice.getChildType(); + switch (deviceType) { + case "1-2": + return 0; + case "1-3": + return 1; + case "1-5": + return 2; + default: + return 3; + } + } + /** * 根据桩号查询附近收费站摄像机 */ diff --git a/zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml b/zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml index 45d28fa9..4a408d2a 100644 --- a/zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml @@ -128,7 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" t1.device_ip,t1.stake_mark_range,t1.network_segment,t1.device_img,t1.child_type,t1.facilities_type,t1.longitude,t1.latitude from dc_device t1 left join (select * from dc_stake_mark GROUP BY stake_mark) t2 on t1.stake_mark = t2.stake_mark - where !ISNULL(t1.iot_device_id) and t1.device_type = '1' and t1.direction = #{direction} + where !ISNULL(t1.iot_device_id) and t1.device_type = '1' and t1.facilities_type = '1' and t1.direction = #{direction} and t2.mileage >= #{startMileage} and t2.mileage <= #{endMileage}