From c04550550a13133be135fe56dc4585cf8b1b4f22 Mon Sep 17 00:00:00 2001 From: chents <78666437@qq.com> Date: Thu, 11 May 2023 12:37:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=8E=E8=BD=A6=E8=BE=86=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=AB=99=E7=82=B9=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CommonApiController.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/springblade/modules/business/controller/CommonApiController.java b/src/main/java/org/springblade/modules/business/controller/CommonApiController.java index d80b1a6..c5e7fe7 100644 --- a/src/main/java/org/springblade/modules/business/controller/CommonApiController.java +++ b/src/main/java/org/springblade/modules/business/controller/CommonApiController.java @@ -152,6 +152,7 @@ public class CommonApiController extends BladeController { if (BusinessConstant.CAR_STAT_IN.toString().equals(info.getNowstate())) { nextSiteIdx -= 1; } + // 下一站 List> snameList = new ArrayList<>(); SiteInfoVO nextSite = nextSiteIdx < siteList.size() ? siteList.get(nextSiteIdx) : null; @@ -315,13 +316,13 @@ public class CommonApiController extends BladeController { public R getCurrentCarInfo(@RequestParam String carNo) { CarInfoVO carInfo = carInfoService.getCarInfo(carNo); //获取当前站点 - StationHintVo currentStation = getCurrentStation(carInfo.getLinename(),carInfo.getUpordown(), carInfo.getInorder()); + SiteInfoVO currentStation = getCurrentStation(carInfo.getLinename(),carInfo.getUpordown(), carInfo.getInorder()); //当前站点 - String currentSnameKey = currentStation.getName(); + String currentSnameKey = currentStation.getSname(); //获取上一站 - StationHintVo upStation = getUpStation(carInfo.getLinename(), carInfo.getUpordown(), currentSnameKey); + SiteInfoVO upStation = getUpStation(carInfo.getLinename(), carInfo.getUpordown(), currentSnameKey); //获取下一站 - StationHintVo downStation = getDownStation(carInfo.getLinename(), carInfo.getUpordown(), currentSnameKey); + SiteInfoVO downStation = getDownStation(carInfo.getLinename(), carInfo.getUpordown(), currentSnameKey); //计算当前车辆距离上一站点百分比 double pass = 0; if (Func.isNotEmpty(upStation)) { @@ -340,8 +341,8 @@ public class CommonApiController extends BladeController { currentCarInfoVo.setLinename(carInfo.getLinename()); currentCarInfoVo.setSpeed(carInfo.getSpeed()); currentCarInfoVo.setCurrentStation(currentSnameKey); - currentCarInfoVo.setUpStation(upStation.getName()); - currentCarInfoVo.setDownStation(downStation.getName()); + currentCarInfoVo.setUpStation(upStation.getSname()); + currentCarInfoVo.setDownStation(downStation.getSname()); currentCarInfoVo.setPercentage(runPercent); //定时任务缓存 carInfoTask.setCarInfo(currentCarInfoVo); @@ -356,9 +357,9 @@ public class CommonApiController extends BladeController { * @param inOrder 已经经过了第几个站点 * @return 当前站点 */ - private StationHintVo getCurrentStation(String linename, String upOrDown, String inOrder) { + private SiteInfoVO getCurrentStation(String linename, String upOrDown, String inOrder) { // 根据上下行获取对应的站点集合 - List stationList = getStationListByUpOrDown(linename,upOrDown); + List stationList = getStationListByUpOrDown(linename,upOrDown); // 计算当前站点 int currentStationIndex = Integer.parseInt(inOrder) - 1; if (currentStationIndex < 0) { @@ -377,10 +378,10 @@ public class CommonApiController extends BladeController { * @param currentSnameKey * @return **/ - private StationHintVo getUpStation(String linename, String upordown, String currentSnameKey) { - List busLineVoList = getStationListByUpOrDown(linename, upordown); + private SiteInfoVO getUpStation(String linename, String upordown, String currentSnameKey) { + List busLineVoList = getStationListByUpOrDown(linename, upordown); for (int i = 0; i < busLineVoList.size(); i++) { - if (busLineVoList.get(i).getName().equals(currentSnameKey)) { + if (busLineVoList.get(i).getSname().equals(currentSnameKey)) { if (i == 0) { return null; } else { @@ -399,10 +400,10 @@ public class CommonApiController extends BladeController { * @param currentSnameKey * @return **/ - private StationHintVo getDownStation(String linename, String upordown, String currentSnameKey) { - List busLineVoList = getStationListByUpOrDown(linename, upordown); + private SiteInfoVO getDownStation(String linename, String upordown, String currentSnameKey) { + List busLineVoList = getStationListByUpOrDown(linename, upordown); for (int i = 0; i < busLineVoList.size(); i++) { - if (busLineVoList.get(i).getName().equals(currentSnameKey)) { + if (busLineVoList.get(i).getSname().equals(currentSnameKey)) { if (i == busLineVoList.size() - 1) { return null; } else { @@ -420,11 +421,10 @@ public class CommonApiController extends BladeController { * @param upOrDown 上下行 * @return 站点集合 */ - private List getStationListByUpOrDown(String linename,String upOrDown) { + private List getStationListByUpOrDown(String linename,String upOrDown) { //根据在那条线路,上下行获取对应的站点集合 - R queryStationHint = stationHintService.QueryBusLineMessage(linename, upOrDown); - List busLineVoList = (List) queryStationHint.getData(); - return busLineVoList; + List siteList = SiteListCache.getSiteList(linename,upOrDown); + return siteList; }