Commit b5fff9cebdd9de1fc1b3abae0f38cc71fd6747b0
1 parent
8dff7fa1
update...
Showing
6 changed files
with
41 additions
and
3 deletions
src/main/java/com/bsth/controller/realcontrol/LineConfigController.java
| ... | ... | @@ -121,4 +121,9 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{ |
| 121 | 121 | public Map<String, Object> setAutoExec(@RequestParam Map<String, String> map){ |
| 122 | 122 | return lineConfigService.setAutoExec(map); |
| 123 | 123 | } |
| 124 | + | |
| 125 | + @RequestMapping(value = "/setReadReverse") | |
| 126 | + public Map<String, Object> setReadReverse(@RequestParam int status,@RequestParam String lineCode){ | |
| 127 | + return lineConfigService.setReadReverse(status, lineCode); | |
| 128 | + } | |
| 124 | 129 | } | ... | ... |
src/main/java/com/bsth/data/LineConfigData.java
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
| ... | ... | @@ -81,7 +81,7 @@ public class InStationProcess { |
| 81 | 81 | //要经过2个中途站才能进 |
| 82 | 82 | int count = GpsCacheData.lastInTrailsSize(gps); |
| 83 | 83 | List<StationRoute> routes = GeoCacheData.getStationRoute(gps.getLineId(), gps.getUpDown()); |
| 84 | - if (null != sch && isNotInOut(sch) && gps.getInstation() == 1 && routes.size() > 4 | |
| 84 | + if (null != sch && isNormalSch(sch) && gps.getInstation() == 1 && routes.size() > 4 | |
| 85 | 85 | && count < 2) { |
| 86 | 86 | logger.info("没有进中途站,拒绝进站... -" + gps.getNbbm() + " -time:" + gps.getTimestamp()); |
| 87 | 87 | flow = false; |
| ... | ... | @@ -99,6 +99,10 @@ public class InStationProcess { |
| 99 | 99 | GpsCacheData.in(gps, isEnd); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | + private boolean isNormalSch(ScheduleRealInfo sch) { | |
| 103 | + return sch.getBcType().equals("normal"); | |
| 104 | + } | |
| 105 | + | |
| 102 | 106 | private boolean isNotInOut(ScheduleRealInfo sch) { |
| 103 | 107 | return !sch.getBcType().equals("in") && !sch.getBcType().equals("out"); |
| 104 | 108 | } | ... | ... |
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.bsth.data.LineConfigData; | |
| 3 | 4 | import com.bsth.data.gpsdata_v2.cache.GeoCacheData; |
| 4 | 5 | import com.bsth.data.gpsdata_v2.cache.GpsCacheData; |
| 5 | 6 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; |
| 6 | 7 | import com.bsth.data.gpsdata_v2.entity.StationRoute; |
| 7 | 8 | import com.bsth.data.schedule.DayOfSchedule; |
| 9 | +import com.bsth.entity.realcontrol.LineConfig; | |
| 8 | 10 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 9 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | 12 | import org.springframework.stereotype.Component; |
| ... | ... | @@ -18,15 +20,21 @@ import java.util.List; |
| 18 | 20 | @Component |
| 19 | 21 | public class ReverseRouteProcess { |
| 20 | 22 | |
| 21 | - private static final int REVER_THRESHOLD = 3; | |
| 23 | + private static final int REVER_THRESHOLD = 4; | |
| 22 | 24 | |
| 23 | 25 | private static final long TIME_THRESHOLD = 1000 * 60 * 120; |
| 24 | 26 | |
| 25 | 27 | @Autowired |
| 26 | 28 | DayOfSchedule dayOfSchedule; |
| 27 | 29 | |
| 30 | + @Autowired | |
| 31 | + LineConfigData lineConfigData; | |
| 32 | + | |
| 28 | 33 | public void process(GpsEntity gps){ |
| 29 | - if(reversRoute(gps) && !GeoCacheData.isLoopLine(gps.getLineId())){ | |
| 34 | + | |
| 35 | + LineConfig config = lineConfigData.get(gps.getLineId()); | |
| 36 | + if(null != config && config.isReadReverse() && | |
| 37 | + reversRoute(gps) && !GeoCacheData.isLoopLine(gps.getLineId())){ | |
| 30 | 38 | ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); |
| 31 | 39 | if(isInOut(sch) || !sch.getXlBm().equals(gps.getLineId())) |
| 32 | 40 | return; | ... | ... |
src/main/java/com/bsth/service/realcontrol/LineConfigService.java
| ... | ... | @@ -28,4 +28,6 @@ public interface LineConfigService extends BaseService<LineConfig, Integer>{ |
| 28 | 28 | Map<String,Object> findByIdx(String idx); |
| 29 | 29 | |
| 30 | 30 | Map<String,Object> setAutoExec(Map<String, String> map); |
| 31 | + | |
| 32 | + Map<String,Object> setReadReverse(int status, String lineCode); | |
| 31 | 33 | } | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/LineConfigServiceImpl.java
| ... | ... | @@ -245,4 +245,22 @@ public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> |
| 245 | 245 | } |
| 246 | 246 | return rs; |
| 247 | 247 | } |
| 248 | + | |
| 249 | + @Override | |
| 250 | + public Map<String, Object> setReadReverse(int status, String lineCode) { | |
| 251 | + Map<String, Object> rs = new HashMap<>(); | |
| 252 | + try { | |
| 253 | + LineConfig conf = lineConfigData.get(lineCode); | |
| 254 | + conf.setReadReverse(status==1?true:false); | |
| 255 | + | |
| 256 | + lineConfigData.set(conf); | |
| 257 | + rs.put("status", ResponseCode.SUCCESS); | |
| 258 | + rs.put("conf", conf); | |
| 259 | + } catch (Exception e) { | |
| 260 | + rs.put("status", ResponseCode.ERROR); | |
| 261 | + rs.put("msg", e.getMessage()); | |
| 262 | + logger.error("", e); | |
| 263 | + } | |
| 264 | + return rs; | |
| 265 | + } | |
| 248 | 266 | } | ... | ... |