Browse Source

交通流拥堵

develop
王兴琳 4 months ago
parent
commit
da3e0a43b4
  1. 13
      zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java

13
zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java

@ -1247,7 +1247,7 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi
.filter(device -> { .filter(device -> {
int deviceStakeMarkMeters = StakeMarkUtils.stakeMarkToInt(device.getStakeMark()); int deviceStakeMarkMeters = StakeMarkUtils.stakeMarkToInt(device.getStakeMark());
// return deviceStakeMarkMeters >= StakeMarkUtils.stakeMarkToInt("K111+107") && deviceStakeMarkMeters <= StakeMarkUtils.stakeMarkToInt("K132+577") ; // return deviceStakeMarkMeters >= StakeMarkUtils.stakeMarkToInt("K111+107") && deviceStakeMarkMeters <= StakeMarkUtils.stakeMarkToInt("K132+577") ;
return deviceStakeMarkMeters >= StakeMarkUtils.stakeMarkToInt(stakeMarkKilometre(stakeMark)) && deviceStakeMarkMeters <= StakeMarkUtils.stakeMarkToInt(stakeMarkKilometre(jsonObject.get("endMark").toString())) ; return deviceStakeMarkMeters >= StakeMarkUtils.stakeMarkToInt(stakeMarkKilometreReductionOf(stakeMark)) && deviceStakeMarkMeters <= StakeMarkUtils.stakeMarkToInt(stakeMarkKilometre(jsonObject.get("endMark").toString())) ;
}) })
.sorted(Comparator.comparingInt(device -> StakeMarkUtils.stakeMarkToInt(device.getStakeMark()))) .sorted(Comparator.comparingInt(device -> StakeMarkUtils.stakeMarkToInt(device.getStakeMark())))
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -1280,6 +1280,17 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi
// 将修改后的数字放回原字符串中 // 将修改后的数字放回原字符串中
return stakeMark.replaceFirst(numberBeforePlus, String.valueOf(incrementedNumber)); return stakeMark.replaceFirst(numberBeforePlus, String.valueOf(incrementedNumber));
} }
private String stakeMarkKilometreReductionOf(String stakeMark) {
// 使用正则表达式匹配+号前的数字
String numberBeforePlus = stakeMark.split("\\+")[0].replaceAll("[^0-9]", "");
// 将匹配到的字符串转换为整数
int number = Integer.parseInt(numberBeforePlus);
// 对数字加一
int incrementedNumber = number -1;
// 将修改后的数字放回原字符串中
return stakeMark.replaceFirst(numberBeforePlus, String.valueOf(incrementedNumber));
}
/** /**
* 各收费站日累计车流辆 * 各收费站日累计车流辆

Loading…
Cancel
Save