Commit 07705a0a0b7fd13c211dbbfe1650ce3f0d3a75a3
1 parent
16b2b3db
update...
Showing
6 changed files
with
136 additions
and
182 deletions
src/main/java/com/bsth/data/gpsdata_v2/handlers/AbnormalStateProcess.java
| 1 | 1 | package com.bsth.data.gpsdata_v2.handlers; |
| 2 | 2 | |
| 3 | -import com.alibaba.fastjson.JSON; | |
| 4 | 3 | import com.bsth.data.gpsdata_v2.cache.GeoCacheData; |
| 5 | 4 | import com.bsth.data.gpsdata_v2.entity.CtLineString; |
| 6 | 5 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; |
| 7 | 6 | import com.bsth.data.gpsdata_v2.utils.GeoUtils; |
| 8 | 7 | import com.bsth.util.Geo.Point; |
| 9 | -import org.slf4j.Logger; | |
| 10 | -import org.slf4j.LoggerFactory; | |
| 11 | 8 | import org.springframework.stereotype.Component; |
| 12 | 9 | |
| 13 | 10 | import java.util.List; |
| ... | ... | @@ -28,40 +25,34 @@ public class AbnormalStateProcess { |
| 28 | 25 | */ |
| 29 | 26 | private static final double OUT_BOUNDS_THRESHOLD = 100; |
| 30 | 27 | |
| 31 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 32 | - | |
| 33 | 28 | public void process(GpsEntity gps) { |
| 34 | - try{ | |
| 35 | - if(isOffline(gps)) | |
| 36 | - return; | |
| 37 | - | |
| 38 | - if(overspeed(gps)) | |
| 39 | - return; | |
| 40 | - | |
| 41 | - if(outOfBounds((gps))) | |
| 42 | - return; | |
| 43 | - }catch (Exception e){ | |
| 44 | - logger.error("AbnormalStateProcess error", e); | |
| 45 | - logger.error("AbnormalStateProcess error data", JSON.toJSONString(gps)); | |
| 46 | - } | |
| 29 | + if (isOffline(gps)) | |
| 30 | + return; | |
| 31 | + | |
| 32 | + if (overspeed(gps)) | |
| 33 | + return; | |
| 34 | + | |
| 35 | + if (outOfBounds((gps))) | |
| 36 | + return; | |
| 47 | 37 | } |
| 48 | 38 | |
| 49 | - private boolean isOffline(GpsEntity gps){ | |
| 39 | + private boolean isOffline(GpsEntity gps) { | |
| 50 | 40 | return gps.getAbnormalStatus() != null && gps.getAbnormalStatus().equals("offline"); |
| 51 | 41 | } |
| 52 | 42 | |
| 53 | 43 | |
| 54 | 44 | /** |
| 55 | 45 | * 是否超速 |
| 46 | + * | |
| 56 | 47 | * @param gps |
| 57 | 48 | * @return |
| 58 | 49 | */ |
| 59 | - private boolean overspeed(GpsEntity gps){ | |
| 50 | + private boolean overspeed(GpsEntity gps) { | |
| 60 | 51 | double maxSpeed = DEFAULT_SPEED_LIMIT; |
| 61 | - if(GeoCacheData.speedLimit(gps.getLineId()) != null) | |
| 52 | + if (GeoCacheData.speedLimit(gps.getLineId()) != null) | |
| 62 | 53 | maxSpeed = GeoCacheData.speedLimit(gps.getLineId()); |
| 63 | 54 | |
| 64 | - if(gps.getSpeed() > maxSpeed){ | |
| 55 | + if (gps.getSpeed() > maxSpeed) { | |
| 65 | 56 | gps.setAbnormalStatus("overspeed"); |
| 66 | 57 | return true; |
| 67 | 58 | } |
| ... | ... | @@ -71,12 +62,13 @@ public class AbnormalStateProcess { |
| 71 | 62 | |
| 72 | 63 | /** |
| 73 | 64 | * 是否越界 |
| 65 | + * | |
| 74 | 66 | * @param gps |
| 75 | 67 | * @return |
| 76 | 68 | */ |
| 77 | - public boolean outOfBounds(GpsEntity gps){ | |
| 69 | + public boolean outOfBounds(GpsEntity gps) { | |
| 78 | 70 | //只处理场站外的车 |
| 79 | - if(gps.getInstation() != 0){ | |
| 71 | + if (gps.getInstation() != 0) { | |
| 80 | 72 | return false; |
| 81 | 73 | } |
| 82 | 74 | |
| ... | ... | @@ -85,15 +77,15 @@ public class AbnormalStateProcess { |
| 85 | 77 | |
| 86 | 78 | double min = -1, distance; |
| 87 | 79 | |
| 88 | - for(CtLineString lineString : list){ | |
| 89 | - distance = GeoUtils.getDistanceFromLine(lineString.getS(),lineString.getE(), point); | |
| 80 | + for (CtLineString lineString : list) { | |
| 81 | + distance = GeoUtils.getDistanceFromLine(lineString.getS(), lineString.getE(), point); | |
| 90 | 82 | |
| 91 | - if(min == -1 || min > distance) | |
| 83 | + if (min == -1 || min > distance) | |
| 92 | 84 | min = distance; |
| 93 | 85 | } |
| 94 | 86 | |
| 95 | 87 | gps.setOutOfBoundDistance(min); |
| 96 | - if(min > OUT_BOUNDS_THRESHOLD){ | |
| 88 | + if (min > OUT_BOUNDS_THRESHOLD) { | |
| 97 | 89 | gps.setAbnormalStatus("outBounds"); |
| 98 | 90 | return true; |
| 99 | 91 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/handlers/GpsStateProcess.java
| 1 | 1 | package com.bsth.data.gpsdata_v2.handlers; |
| 2 | 2 | |
| 3 | -import com.alibaba.fastjson.JSON; | |
| 4 | 3 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; |
| 5 | 4 | import com.bsth.data.gpsdata_v2.status_manager.GpsStatusManager; |
| 6 | 5 | import com.bsth.data.schedule.DayOfSchedule; |
| 7 | 6 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 8 | -import org.slf4j.Logger; | |
| 9 | -import org.slf4j.LoggerFactory; | |
| 10 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | 8 | import org.springframework.stereotype.Component; |
| 12 | 9 | |
| ... | ... | @@ -23,35 +20,28 @@ public class GpsStateProcess { |
| 23 | 20 | @Autowired |
| 24 | 21 | GpsStatusManager gpsStatusManager; |
| 25 | 22 | |
| 26 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 23 | + public void process(GpsEntity gps) { | |
| 24 | + //在执行的任务 | |
| 25 | + ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); | |
| 27 | 26 | |
| 28 | - public void process(GpsEntity gps){ | |
| 29 | - try{ | |
| 30 | - //在执行的任务 | |
| 31 | - ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); | |
| 27 | + if (null == sch) | |
| 28 | + return; | |
| 32 | 29 | |
| 33 | - if(null == sch) | |
| 34 | - return; | |
| 30 | + byte upDown = Byte.parseByte(sch.getXlDir()); | |
| 35 | 31 | |
| 36 | - byte upDown = Byte.parseByte(sch.getXlDir()); | |
| 37 | - | |
| 38 | - if(gps.getUpDown() != upDown){ | |
| 39 | - gps.setUpDown(upDown);//修正走向 | |
| 40 | - } | |
| 32 | + if (gps.getUpDown() != upDown) { | |
| 33 | + gps.setUpDown(upDown);//修正走向 | |
| 34 | + } | |
| 41 | 35 | |
| 42 | - if((!gps.isService() || gps.getUpDown() != upDown) && | |
| 43 | - !dayOfSchedule.emptyService(sch)){ | |
| 44 | - //下发指令纠正车载的 营运状态 和 走向 | |
| 45 | - gpsStatusManager.changeServiceState(gps.getNbbm(), upDown, 0, "同步@系统"); | |
| 46 | - } | |
| 36 | + if ((!gps.isService() || gps.getUpDown() != upDown) && | |
| 37 | + !dayOfSchedule.emptyService(sch)) { | |
| 38 | + //下发指令纠正车载的 营运状态 和 走向 | |
| 39 | + gpsStatusManager.changeServiceState(gps.getNbbm(), upDown, 0, "同步@系统"); | |
| 40 | + } | |
| 47 | 41 | |
| 48 | - if(!sch.getXlBm().equals(gps.getLineId())){ | |
| 49 | - //切换车载的 线路编码 | |
| 50 | - gpsStatusManager.changeLine(gps.getNbbm(), sch.getXlBm(), "同步@系统"); | |
| 51 | - } | |
| 52 | - }catch (Exception e){ | |
| 53 | - logger.error("GpsStateProcess error" , e); | |
| 54 | - logger.error("GpsStateProcess error data" , JSON.toJSONString(gps)); | |
| 42 | + if (!sch.getXlBm().equals(gps.getLineId())) { | |
| 43 | + //切换车载的 线路编码 | |
| 44 | + gpsStatusManager.changeLine(gps.getNbbm(), sch.getXlBm(), "同步@系统"); | |
| 55 | 45 | } |
| 56 | 46 | } |
| 57 | 47 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
| 1 | 1 | package com.bsth.data.gpsdata_v2.handlers; |
| 2 | 2 | |
| 3 | -import com.alibaba.fastjson.JSON; | |
| 4 | 3 | import com.bsth.data.LineConfigData; |
| 5 | 4 | import com.bsth.data.gpsdata_v2.cache.GeoCacheData; |
| 6 | 5 | import com.bsth.data.gpsdata_v2.cache.GpsCacheData; |
| ... | ... | @@ -44,40 +43,35 @@ public class InStationProcess { |
| 44 | 43 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 45 | 44 | |
| 46 | 45 | public void process(GpsEntity gps) { |
| 47 | - try{ | |
| 48 | - //自动执行的班次信号,滚蛋 | |
| 49 | - LineConfig config = lineConfigData.get(gps.getLineId()); | |
| 50 | - if(null != config && config.isAutoExec()) | |
| 51 | - return; | |
| 52 | - | |
| 53 | - GpsEntity prev = GpsCacheData.getPrev(gps); | |
| 54 | - | |
| 55 | - if(null == prev) | |
| 56 | - return; | |
| 57 | - | |
| 58 | - //从站外到站内 | |
| 59 | - if(prev.getInstation() == 0 && gps.getInstation() > 0){ | |
| 60 | - inStation(gps, prev); | |
| 61 | - } | |
| 62 | - | |
| 63 | - //从站内到另一个站内 | |
| 64 | - if(prev.getInstation() == 1 && gps.getInstation() == 1 | |
| 65 | - && !prev.getStopNo().equals(gps.getStopNo()) | |
| 66 | - && !prev.getStation().getName().equals(gps.getStation().getName())) | |
| 67 | - inStation(gps, prev); | |
| 68 | - | |
| 69 | - //从场内到站内 | |
| 70 | - if(prev.getInstation() == 2 && gps.getInstation() == 1){ | |
| 71 | - inStation(gps, prev); | |
| 72 | - } | |
| 73 | - | |
| 74 | - //被起点站覆盖的情况下进场 | |
| 75 | - if(isInPark(gps, prev)) | |
| 76 | - inStation(gps, prev); | |
| 77 | - }catch (Exception e){ | |
| 78 | - logger.error("InStationProcess error", e); | |
| 79 | - logger.error("InStationProcess error data", JSON.toJSONString(gps)); | |
| 46 | + //自动执行的班次信号,滚蛋 | |
| 47 | + LineConfig config = lineConfigData.get(gps.getLineId()); | |
| 48 | + if (null != config && config.isAutoExec()) | |
| 49 | + return; | |
| 50 | + | |
| 51 | + GpsEntity prev = GpsCacheData.getPrev(gps); | |
| 52 | + | |
| 53 | + if (null == prev) | |
| 54 | + return; | |
| 55 | + | |
| 56 | + //从站外到站内 | |
| 57 | + if (prev.getInstation() == 0 && gps.getInstation() > 0) { | |
| 58 | + inStation(gps, prev); | |
| 80 | 59 | } |
| 60 | + | |
| 61 | + //从站内到另一个站内 | |
| 62 | + if (prev.getInstation() == 1 && gps.getInstation() == 1 | |
| 63 | + && !prev.getStopNo().equals(gps.getStopNo()) | |
| 64 | + && !prev.getStation().getName().equals(gps.getStation().getName())) | |
| 65 | + inStation(gps, prev); | |
| 66 | + | |
| 67 | + //从场内到站内 | |
| 68 | + if (prev.getInstation() == 2 && gps.getInstation() == 1) { | |
| 69 | + inStation(gps, prev); | |
| 70 | + } | |
| 71 | + | |
| 72 | + //被起点站覆盖的情况下进场 | |
| 73 | + if (isInPark(gps, prev)) | |
| 74 | + inStation(gps, prev); | |
| 81 | 75 | } |
| 82 | 76 | |
| 83 | 77 | /** |
| ... | ... | @@ -102,7 +96,7 @@ public class InStationProcess { |
| 102 | 96 | |
| 103 | 97 | //进终点 |
| 104 | 98 | if (flow && null != sch && |
| 105 | - ((sch.getZdzCode().equals(gps.getStopNo()) && gps.getInstation()>0) || sch.getZdzCode().equals(gps.getCarparkNo()))) { | |
| 99 | + ((sch.getZdzCode().equals(gps.getStopNo()) && gps.getInstation() > 0) || sch.getZdzCode().equals(gps.getCarparkNo()))) { | |
| 106 | 100 | inEndStation(sch, gps); |
| 107 | 101 | isEnd = true; |
| 108 | 102 | } |
| ... | ... | @@ -273,8 +267,8 @@ public class InStationProcess { |
| 273 | 267 | } |
| 274 | 268 | } |
| 275 | 269 | |
| 276 | - private boolean isInPark(GpsEntity gps, GpsEntity prve){ | |
| 277 | - if(StringUtils.isNotEmpty(gps.getCarparkNo()) && StringUtils.isEmpty(prve.getCarparkNo())) | |
| 270 | + private boolean isInPark(GpsEntity gps, GpsEntity prve) { | |
| 271 | + if (StringUtils.isNotEmpty(gps.getCarparkNo()) && StringUtils.isEmpty(prve.getCarparkNo())) | |
| 278 | 272 | return true; |
| 279 | 273 | return false; |
| 280 | 274 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/handlers/OutStationProcess.java
| 1 | 1 | package com.bsth.data.gpsdata_v2.handlers; |
| 2 | 2 | |
| 3 | -import com.alibaba.fastjson.JSON; | |
| 4 | 3 | import com.bsth.data.LineConfigData; |
| 5 | 4 | import com.bsth.data.gpsdata_v2.cache.GpsCacheData; |
| 6 | 5 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; |
| ... | ... | @@ -43,33 +42,28 @@ public class OutStationProcess { |
| 43 | 42 | private final static int MAX_BEFORE_TIME = 1000 * 60 * 120; |
| 44 | 43 | |
| 45 | 44 | public void process(GpsEntity gps) { |
| 46 | - try{ | |
| 47 | - //自动执行的线路,滚蛋 | |
| 48 | - LineConfig config = lineConfigData.get(gps.getLineId()); | |
| 49 | - if (null != config && config.isAutoExec()) | |
| 50 | - return; | |
| 45 | + //自动执行的线路,滚蛋 | |
| 46 | + LineConfig config = lineConfigData.get(gps.getLineId()); | |
| 47 | + if (null != config && config.isAutoExec()) | |
| 48 | + return; | |
| 51 | 49 | |
| 52 | - GpsEntity prev = GpsCacheData.getPrev(gps); | |
| 50 | + GpsEntity prev = GpsCacheData.getPrev(gps); | |
| 53 | 51 | |
| 54 | - if (null == prev) | |
| 55 | - return; | |
| 52 | + if (null == prev) | |
| 53 | + return; | |
| 56 | 54 | |
| 57 | - //从站内到站外 | |
| 58 | - if (prev.getInstation() > 0 && gps.getInstation() == 0) | |
| 59 | - outStation(gps, prev); | |
| 55 | + //从站内到站外 | |
| 56 | + if (prev.getInstation() > 0 && gps.getInstation() == 0) | |
| 57 | + outStation(gps, prev); | |
| 60 | 58 | |
| 61 | - //从站内到另一个站内 | |
| 62 | - if (prev.getInstation() > 0 && gps.getInstation() > 0 | |
| 63 | - && !prev.getStopNo().equals(gps.getStopNo())) | |
| 64 | - outStation(gps, prev); | |
| 59 | + //从站内到另一个站内 | |
| 60 | + if (prev.getInstation() > 0 && gps.getInstation() > 0 | |
| 61 | + && !prev.getStopNo().equals(gps.getStopNo())) | |
| 62 | + outStation(gps, prev); | |
| 65 | 63 | |
| 66 | - //在被起点站覆盖的情况下出场 | |
| 67 | - if (isOutPark(gps, prev)) | |
| 68 | - outStation(gps, prev); | |
| 69 | - }catch (Exception e){ | |
| 70 | - logger.error("OutStationProcess error", e); | |
| 71 | - logger.error("OutStationProcess error", JSON.toJSONString(gps)); | |
| 72 | - } | |
| 64 | + //在被起点站覆盖的情况下出场 | |
| 65 | + if (isOutPark(gps, prev)) | |
| 66 | + outStation(gps, prev); | |
| 73 | 67 | } |
| 74 | 68 | |
| 75 | 69 | /** | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/handlers/ReverseRouteProcess.java
| 1 | 1 | package com.bsth.data.gpsdata_v2.handlers; |
| 2 | 2 | |
| 3 | -import com.alibaba.fastjson.JSON; | |
| 4 | 3 | import com.bsth.data.LineConfigData; |
| 5 | 4 | import com.bsth.data.gpsdata_v2.cache.GeoCacheData; |
| 6 | 5 | import com.bsth.data.gpsdata_v2.cache.GpsCacheData; |
| ... | ... | @@ -35,61 +34,56 @@ public class ReverseRouteProcess { |
| 35 | 34 | |
| 36 | 35 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 37 | 36 | |
| 38 | - public void process(GpsEntity gps){ | |
| 39 | - try{ | |
| 40 | - LineConfig config = lineConfigData.get(gps.getLineId()); | |
| 41 | - if(null != config && config.isReadReverse() && | |
| 42 | - reversRoute(gps) && !GeoCacheData.isLoopLine(gps.getLineId())){ | |
| 37 | + public void process(GpsEntity gps) { | |
| 38 | + LineConfig config = lineConfigData.get(gps.getLineId()); | |
| 39 | + if (null != config && config.isReadReverse() && | |
| 40 | + reversRoute(gps) && !GeoCacheData.isLoopLine(gps.getLineId())) { | |
| 43 | 41 | |
| 44 | - ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); | |
| 42 | + ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); | |
| 45 | 43 | |
| 46 | - if(null == sch) | |
| 47 | - return; | |
| 48 | - if(isInOut(sch) || !sch.getXlBm().equals(gps.getLineId())) | |
| 49 | - return; | |
| 44 | + if (null == sch) | |
| 45 | + return; | |
| 46 | + if (isInOut(sch) || !sch.getXlBm().equals(gps.getLineId())) | |
| 47 | + return; | |
| 50 | 48 | |
| 51 | - //next | |
| 52 | - ScheduleRealInfo next = dayOfSchedule.next(sch); | |
| 53 | - if(isInOut(next)) | |
| 54 | - return; | |
| 49 | + //next | |
| 50 | + ScheduleRealInfo next = dayOfSchedule.next(sch); | |
| 51 | + if (isInOut(next)) | |
| 52 | + return; | |
| 55 | 53 | |
| 56 | - //跳下一个班次 | |
| 57 | - if(Math.abs(next.getDfsjT() - gps.getTimestamp()) < TIME_THRESHOLD) | |
| 58 | - dayOfSchedule.addExecPlan(next); | |
| 59 | - } | |
| 60 | - }catch (Exception e){ | |
| 61 | - logger.error("ReverseRouteProcess error", e); | |
| 62 | - logger.error("ReverseRouteProcess error data", JSON.toJSONString(gps)); | |
| 54 | + //跳下一个班次 | |
| 55 | + if (Math.abs(next.getDfsjT() - gps.getTimestamp()) < TIME_THRESHOLD) | |
| 56 | + dayOfSchedule.addExecPlan(next); | |
| 63 | 57 | } |
| 64 | 58 | } |
| 65 | 59 | |
| 66 | 60 | private boolean reversRoute(GpsEntity gps) { |
| 67 | - if(gps.getInstation() != 1) | |
| 61 | + if (gps.getInstation() != 1) | |
| 68 | 62 | return false; |
| 69 | 63 | |
| 70 | 64 | int sortNo = gps.getStation().getRouteSort(); |
| 71 | - StationRoute prev = GpsCacheData.prevStation(gps); | |
| 65 | + StationRoute prev = GpsCacheData.prevStation(gps); | |
| 72 | 66 | //和上一个站点是反向 |
| 73 | - if(null != prev && sortNo < prev.getRouteSort()){ | |
| 67 | + if (null != prev && sortNo < prev.getRouteSort()) { | |
| 74 | 68 | |
| 75 | 69 | //满足3个进站反向信号 |
| 76 | 70 | List<StationRoute> prevs = GpsCacheData.prevMultiStation(gps); |
| 77 | 71 | |
| 78 | 72 | int count = 0; |
| 79 | - for(StationRoute s : prevs){ | |
| 80 | - if(sortNo < s.getRouteSort()) | |
| 81 | - count ++; | |
| 73 | + for (StationRoute s : prevs) { | |
| 74 | + if (sortNo < s.getRouteSort()) | |
| 75 | + count++; | |
| 82 | 76 | sortNo = s.getRouteSort(); |
| 83 | 77 | } |
| 84 | 78 | |
| 85 | - if(count >= REVER_THRESHOLD) | |
| 79 | + if (count >= REVER_THRESHOLD) | |
| 86 | 80 | return true; |
| 87 | 81 | } |
| 88 | 82 | |
| 89 | 83 | return false; |
| 90 | 84 | } |
| 91 | 85 | |
| 92 | - private boolean isInOut(ScheduleRealInfo sch){ | |
| 86 | + private boolean isInOut(ScheduleRealInfo sch) { | |
| 93 | 87 | return sch.getBcType().equals("in") || sch.getBcType().equals("out"); |
| 94 | 88 | } |
| 95 | 89 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/handlers/StationInsideProcess.java
| 1 | 1 | package com.bsth.data.gpsdata_v2.handlers; |
| 2 | 2 | |
| 3 | -import com.alibaba.fastjson.JSON; | |
| 4 | 3 | import com.bsth.data.gpsdata_v2.cache.GeoCacheData; |
| 5 | 4 | import com.bsth.data.gpsdata_v2.cache.GpsCacheData; |
| 6 | 5 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; |
| 7 | 6 | import com.bsth.data.gpsdata_v2.entity.StationRoute; |
| 8 | 7 | import com.bsth.data.gpsdata_v2.utils.GeoUtils; |
| 9 | -import org.slf4j.Logger; | |
| 10 | -import org.slf4j.LoggerFactory; | |
| 11 | 8 | import org.springframework.stereotype.Component; |
| 12 | 9 | |
| 13 | 10 | import java.util.List; |
| ... | ... | @@ -19,48 +16,41 @@ import java.util.List; |
| 19 | 16 | @Component |
| 20 | 17 | public class StationInsideProcess { |
| 21 | 18 | |
| 22 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 23 | - | |
| 24 | 19 | public void process(GpsEntity gps) { |
| 25 | - try { | |
| 26 | - //是否在场内 | |
| 27 | - String parkCode = GeoUtils.gpsInCarpark(gps); | |
| 20 | + //是否在场内 | |
| 21 | + String parkCode = GeoUtils.gpsInCarpark(gps); | |
| 28 | 22 | |
| 29 | - if (parkCode != null) { | |
| 30 | - gps.setInstation(2); | |
| 31 | - gps.setStopNo(parkCode); | |
| 32 | - gps.setCarparkNo(parkCode); | |
| 33 | - } | |
| 23 | + if (parkCode != null) { | |
| 24 | + gps.setInstation(2); | |
| 25 | + gps.setStopNo(parkCode); | |
| 26 | + gps.setCarparkNo(parkCode); | |
| 27 | + } | |
| 34 | 28 | |
| 35 | - //是否在站内 | |
| 36 | - List<StationRoute> srs = GeoCacheData.getStationRoute(gps.getLineId(), gps.getUpDown()); | |
| 37 | - StationRoute station = GeoUtils.gpsInStation(gps, srs); | |
| 38 | - if (station != null) { | |
| 39 | - gps.setInstation(1); | |
| 40 | - gps.setStopNo(station.getCode()); | |
| 41 | - gps.setStation(station); | |
| 42 | - } | |
| 29 | + //是否在站内 | |
| 30 | + List<StationRoute> srs = GeoCacheData.getStationRoute(gps.getLineId(), gps.getUpDown()); | |
| 31 | + StationRoute station = GeoUtils.gpsInStation(gps, srs); | |
| 32 | + if (station != null) { | |
| 33 | + gps.setInstation(1); | |
| 34 | + gps.setStopNo(station.getCode()); | |
| 35 | + gps.setStation(station); | |
| 36 | + } | |
| 43 | 37 | |
| 44 | - //是否在进站前置围栏内 | |
| 45 | - String premiseCode = GeoUtils.gpsInPremiseGeo(gps); | |
| 46 | - gps.setPremiseCode(premiseCode); | |
| 38 | + //是否在进站前置围栏内 | |
| 39 | + String premiseCode = GeoUtils.gpsInPremiseGeo(gps); | |
| 40 | + gps.setPremiseCode(premiseCode); | |
| 47 | 41 | |
| 48 | - //上一个点位 | |
| 49 | - GpsEntity prev = GpsCacheData.getPrev(gps); | |
| 42 | + //上一个点位 | |
| 43 | + GpsEntity prev = GpsCacheData.getPrev(gps); | |
| 50 | 44 | |
| 51 | - if (null != prev) { | |
| 52 | - //继承前置围栏状态 | |
| 53 | - if (null == premiseCode && null != prev.getPremiseCode()) | |
| 54 | - gps.setPremiseCode(prev.getPremiseCode()); | |
| 45 | + if (null != prev) { | |
| 46 | + //继承前置围栏状态 | |
| 47 | + if (null == premiseCode && null != prev.getPremiseCode()) | |
| 48 | + gps.setPremiseCode(prev.getPremiseCode()); | |
| 55 | 49 | |
| 56 | - //在场,站外 | |
| 57 | - if (gps.getInstation() == 0) { | |
| 58 | - gps.setStopNo(prev.getStopNo());//继承上一个点的站点编码 | |
| 59 | - } | |
| 50 | + //在场,站外 | |
| 51 | + if (gps.getInstation() == 0) { | |
| 52 | + gps.setStopNo(prev.getStopNo());//继承上一个点的站点编码 | |
| 60 | 53 | } |
| 61 | - } catch (Exception e) { | |
| 62 | - logger.error("StationInsideProcess error", e); | |
| 63 | - logger.error("StationInsideProcess error data", JSON.toJSONString(gps)); | |
| 64 | 54 | } |
| 65 | 55 | } |
| 66 | 56 | } | ... | ... |