|
@@ -1,17 +1,12 @@
|
|
|
package com.jpsoft.bus.modules.bus.callback;
|
|
|
|
|
|
import cn.hutool.core.lang.UUID;
|
|
|
-import com.jpsoft.bus.modules.bus.entity.ShiftInfo;
|
|
|
-import com.jpsoft.bus.modules.bus.service.GpsService;
|
|
|
-import com.jpsoft.bus.modules.bus.service.ShiftInfoService;
|
|
|
+import com.jpsoft.bus.modules.bus.entity.*;
|
|
|
+import com.jpsoft.bus.modules.bus.service.*;
|
|
|
import com.jpsoft.bus.modules.common.utils.CommonUtil;
|
|
|
import com.jpsoft.gps.callback.GpsDataCallback;
|
|
|
import com.jpsoft.gps.utils.GPSUtil;
|
|
|
import com.jpsoft.bus.config.GpsParamConfig;
|
|
|
-import com.jpsoft.bus.modules.bus.entity.GpsDataInfo;
|
|
|
-import com.jpsoft.bus.modules.bus.entity.VehicleInfo;
|
|
|
-import com.jpsoft.bus.modules.bus.service.GpsDataInfoService;
|
|
|
-import com.jpsoft.bus.modules.bus.service.VehicleInfoService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.joda.time.DateTime;
|
|
@@ -36,6 +31,12 @@ public class GpsDataCallbackImpl implements GpsDataCallback {
|
|
|
@Autowired
|
|
|
private GpsService gpsService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private StationInfoService stationInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PassengerInfoService passengerInfoService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ShiftInfoService shiftInfoService;
|
|
|
|
|
@@ -120,6 +121,43 @@ public class GpsDataCallbackImpl implements GpsDataCallback {
|
|
|
if (!shiftInfo.getCurrentStationId().equals(stationId)){
|
|
|
shiftInfo.setCurrentStationId(stationId);
|
|
|
shiftInfoService.update(shiftInfo);
|
|
|
+
|
|
|
+ //当前站点
|
|
|
+ StationInfo currentStation = stationInfoService.get(stationId);
|
|
|
+ //此线路的所有站点
|
|
|
+ List<StationInfo> stationInfoList = stationInfoService.findByRouteId(shiftInfo.getRouteId());
|
|
|
+
|
|
|
+ //站点集合大小
|
|
|
+ int stationSize = stationInfoList.size();
|
|
|
+
|
|
|
+ int currentStationIndex = stationInfoList.indexOf(currentStation);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //查询乘客表是否有过站的情况
|
|
|
+
|
|
|
+ List<PassengerInfo> passengerInfoList = passengerInfoService.findByShiftStatusPayStatusNotTicketDown(shiftInfo.getId(),"1","1",stationId);
|
|
|
+ if (passengerInfoList.size()>0){
|
|
|
+ for (PassengerInfo passengerInfo : passengerInfoList){
|
|
|
+
|
|
|
+ //乘客购票的下车站点
|
|
|
+ StationInfo downStation = stationInfoService.get(passengerInfo.getTicketDownStationId());
|
|
|
+ int downStationIndex = stationInfoList.indexOf(downStation);
|
|
|
+ //按照线路顺行并且当前站点大于乘客购票站点,则过站
|
|
|
+ if (shiftInfo.getStartStationId().equals(stationInfoList.get(0).getId()) && currentStationIndex > downStationIndex){
|
|
|
+ passengerInfo.setPayStatus("2");
|
|
|
+ passengerInfoService.update(passengerInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ //按照线路逆行并且当前站点小于乘客购票站点,则过站
|
|
|
+ if (!shiftInfo.getStartStationId().equals(stationInfoList.get(0).getId()) && currentStationIndex < downStationIndex){
|
|
|
+ passengerInfo.setPayStatus("2");
|
|
|
+ passengerInfoService.update(passengerInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}catch (Exception ex){
|