Browse Source

优化附近上下行相机接口

develop
lau572 4 weeks ago
parent
commit
1ff713ce63
  1. 26
      zc-business/src/main/java/com/zc/business/controller/VideoController.java
  2. 2
      zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml

26
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.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysConfigService;
import com.zc.business.constant.DeviceTypeConstants; import com.zc.business.constant.DeviceTypeConstants;
import com.zc.business.domain.DcDevice; import com.zc.business.domain.DcDevice;
@ -526,8 +527,7 @@ public class VideoController extends BaseController {
List<DcDevice> downCameraList = iDcDeviceService.selectNearCamPile(UniversalEnum.THREE.getValue(),startMileage,endMileage); List<DcDevice> downCameraList = iDcDeviceService.selectNearCamPile(UniversalEnum.THREE.getValue(),startMileage,endMileage);
// 排序 // 排序
List<DcDevice> sortedList = upCameraList.stream() List<DcDevice> sortedList = upCameraList.stream()
.sorted(Comparator.comparingInt((DcDevice d) -> .sorted(Comparator.comparingInt(this::cameraTypeSorted)
"1-2".equals(d.getChildType()) ? 0 : 1)
.thenComparing(DcDevice::getStakeMark, Comparator.reverseOrder())) .thenComparing(DcDevice::getStakeMark, Comparator.reverseOrder()))
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -536,6 +536,28 @@ public class VideoController extends BaseController {
return AjaxResult.success(result); 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;
}
}
/** /**
* 根据桩号查询附近收费站摄像机 * 根据桩号查询附近收费站摄像机
*/ */

2
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 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 from dc_device t1
left join (select * from dc_stake_mark GROUP BY stake_mark) t2 on t1.stake_mark = t2.stake_mark 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 &lt;= #{endMileage} and t2.mileage >= #{startMileage} and t2.mileage &lt;= #{endMileage}
</select> </select>
<select id="selectNearBoard" resultType="com.zc.business.domain.DcDevice"> <select id="selectNearBoard" resultType="com.zc.business.domain.DcDevice">

Loading…
Cancel
Save