|
@ -9,13 +9,11 @@ import com.google.gson.Gson; |
|
|
import com.ruoyi.common.core.redis.RedisCache; |
|
|
import com.ruoyi.common.core.redis.RedisCache; |
|
|
import com.ruoyi.common.utils.spring.SpringUtils; |
|
|
import com.ruoyi.common.utils.spring.SpringUtils; |
|
|
import com.zc.business.constant.RedisKeyConstants; |
|
|
import com.zc.business.constant.RedisKeyConstants; |
|
|
import com.zc.business.domain.DcCongestionSection; |
|
|
import com.zc.business.domain.*; |
|
|
import com.zc.business.domain.DcFacility; |
|
|
|
|
|
import com.zc.business.domain.DcRoadSection; |
|
|
|
|
|
import com.zc.business.domain.DcRoadSectionCongestion; |
|
|
|
|
|
import com.zc.business.enums.LocationEnum; |
|
|
import com.zc.business.enums.LocationEnum; |
|
|
import com.zc.business.enums.StakeMarkRange; |
|
|
import com.zc.business.enums.StakeMarkRange; |
|
|
import com.zc.business.enums.UniversalEnum; |
|
|
import com.zc.business.enums.UniversalEnum; |
|
|
|
|
|
import com.zc.business.service.IDcDeviceService; |
|
|
import com.zc.business.service.IDcFacilityService; |
|
|
import com.zc.business.service.IDcFacilityService; |
|
|
import com.zc.business.service.IDcRoadSectionService; |
|
|
import com.zc.business.service.IDcRoadSectionService; |
|
|
import com.zc.business.service.IDcTrafficStatisticsService; |
|
|
import com.zc.business.service.IDcTrafficStatisticsService; |
|
@ -59,7 +57,8 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
private IDcFacilityService facilityService; |
|
|
private IDcFacilityService facilityService; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private IDcDeviceService dcDeviceService; |
|
|
@Resource |
|
|
@Resource |
|
|
private IDcRoadSectionService roadSectionService; |
|
|
private IDcRoadSectionService roadSectionService; |
|
|
|
|
|
|
|
@ -1117,6 +1116,18 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public JSONArray getTheCurrentCongestedSection() throws HttpException, IOException { |
|
|
public JSONArray getTheCurrentCongestedSection() throws HttpException, IOException { |
|
|
|
|
|
Map<String,Object> parameter =new HashMap<>(); |
|
|
|
|
|
String[] endStakeMark={"208","979"}; |
|
|
|
|
|
String[] startStakeMark={"054","378"}; |
|
|
|
|
|
parameter.put("deviceType","1"); |
|
|
|
|
|
parameter.put("endStakeMark",endStakeMark); |
|
|
|
|
|
parameter.put("startStakeMark",startStakeMark); |
|
|
|
|
|
parameter.put("deviceState","1"); |
|
|
|
|
|
|
|
|
|
|
|
// StakeMarkUtils.stakeMarkToInt()
|
|
|
|
|
|
//facilitiesType
|
|
|
|
|
|
List<DcDevice> dcDevices = dcDeviceService.devicePileNumberQueryDevice(parameter); |
|
|
|
|
|
|
|
|
// 创建OkHttpClient.Builder实例
|
|
|
// 创建OkHttpClient.Builder实例
|
|
|
OkHttpClient.Builder httpClientBuilder = new OkHttpClient.Builder(); |
|
|
OkHttpClient.Builder httpClientBuilder = new OkHttpClient.Builder(); |
|
|
|
|
|
|
|
@ -1229,6 +1240,17 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi |
|
|
//System.out.printf("两点之间的距离为: %.2f 米%n", distanceMeters);
|
|
|
//System.out.printf("两点之间的距离为: %.2f 米%n", distanceMeters);
|
|
|
jsonObject.put("jam_dist", distanceMeters);//当前拥堵距离
|
|
|
jsonObject.put("jam_dist", distanceMeters);//当前拥堵距离
|
|
|
} |
|
|
} |
|
|
|
|
|
// 使用流来过滤设备
|
|
|
|
|
|
List<DcDevice> filteredDevices = dcDevices.stream() |
|
|
|
|
|
.filter(device -> device.getFacilitiesType() .equals("1")) |
|
|
|
|
|
.filter(device -> { |
|
|
|
|
|
int deviceStakeMarkMeters = StakeMarkUtils.stakeMarkToInt(device.getStakeMark()); |
|
|
|
|
|
//return deviceStakeMarkMeters >= StakeMarkUtils.stakeMarkToInt("K111+107") && deviceStakeMarkMeters <= StakeMarkUtils.stakeMarkToInt("K132+577") ;
|
|
|
|
|
|
return deviceStakeMarkMeters >= StakeMarkUtils.stakeMarkToInt(stakeMark) && deviceStakeMarkMeters <= StakeMarkUtils.stakeMarkToInt(jsonObject.get("endMark").toString()) ; |
|
|
|
|
|
}) |
|
|
|
|
|
.sorted(Comparator.comparingInt(device -> StakeMarkUtils.stakeMarkToInt(device.getStakeMark()))) |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
jsonObject.put("filteredDevices",filteredDevices); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return jsonArray; |
|
|
return jsonArray; |
|
|