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}