Commit b5fff9cebdd9de1fc1b3abae0f38cc71fd6747b0

Authored by 潘钊
1 parent 8dff7fa1

update...

src/main/java/com/bsth/controller/realcontrol/LineConfigController.java
@@ -121,4 +121,9 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{ @@ -121,4 +121,9 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{
121 public Map<String, Object> setAutoExec(@RequestParam Map<String, String> map){ 121 public Map<String, Object> setAutoExec(@RequestParam Map<String, String> map){
122 return lineConfigService.setAutoExec(map); 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
@@ -131,6 +131,7 @@ public class LineConfigData implements CommandLineRunner { @@ -131,6 +131,7 @@ public class LineConfigData implements CommandLineRunner {
131 if (null == line) 131 if (null == line)
132 throw new NullPointerException("异常的lineCode"); 132 throw new NullPointerException("异常的lineCode");
133 133
  134 + conf.setReadReverse(true);
134 conf.setLine(line); 135 conf.setLine(line);
135 //开始运营时间 136 //开始运营时间
136 conf.setStartOpt("02:00"); 137 conf.setStartOpt("02:00");
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
@@ -81,7 +81,7 @@ public class InStationProcess { @@ -81,7 +81,7 @@ public class InStationProcess {
81 //要经过2个中途站才能进 81 //要经过2个中途站才能进
82 int count = GpsCacheData.lastInTrailsSize(gps); 82 int count = GpsCacheData.lastInTrailsSize(gps);
83 List<StationRoute> routes = GeoCacheData.getStationRoute(gps.getLineId(), gps.getUpDown()); 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 && count < 2) { 85 && count < 2) {
86 logger.info("没有进中途站,拒绝进站... -" + gps.getNbbm() + " -time:" + gps.getTimestamp()); 86 logger.info("没有进中途站,拒绝进站... -" + gps.getNbbm() + " -time:" + gps.getTimestamp());
87 flow = false; 87 flow = false;
@@ -99,6 +99,10 @@ public class InStationProcess { @@ -99,6 +99,10 @@ public class InStationProcess {
99 GpsCacheData.in(gps, isEnd); 99 GpsCacheData.in(gps, isEnd);
100 } 100 }
101 101
  102 + private boolean isNormalSch(ScheduleRealInfo sch) {
  103 + return sch.getBcType().equals("normal");
  104 + }
  105 +
102 private boolean isNotInOut(ScheduleRealInfo sch) { 106 private boolean isNotInOut(ScheduleRealInfo sch) {
103 return !sch.getBcType().equals("in") && !sch.getBcType().equals("out"); 107 return !sch.getBcType().equals("in") && !sch.getBcType().equals("out");
104 } 108 }
src/main/java/com/bsth/data/gpsdata_v2/handlers/ReverseRouteProcess.java
1 package com.bsth.data.gpsdata_v2.handlers; 1 package com.bsth.data.gpsdata_v2.handlers;
2 2
  3 +import com.bsth.data.LineConfigData;
3 import com.bsth.data.gpsdata_v2.cache.GeoCacheData; 4 import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
4 import com.bsth.data.gpsdata_v2.cache.GpsCacheData; 5 import com.bsth.data.gpsdata_v2.cache.GpsCacheData;
5 import com.bsth.data.gpsdata_v2.entity.GpsEntity; 6 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
6 import com.bsth.data.gpsdata_v2.entity.StationRoute; 7 import com.bsth.data.gpsdata_v2.entity.StationRoute;
7 import com.bsth.data.schedule.DayOfSchedule; 8 import com.bsth.data.schedule.DayOfSchedule;
  9 +import com.bsth.entity.realcontrol.LineConfig;
8 import com.bsth.entity.realcontrol.ScheduleRealInfo; 10 import com.bsth.entity.realcontrol.ScheduleRealInfo;
9 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.stereotype.Component; 12 import org.springframework.stereotype.Component;
@@ -18,15 +20,21 @@ import java.util.List; @@ -18,15 +20,21 @@ import java.util.List;
18 @Component 20 @Component
19 public class ReverseRouteProcess { 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 private static final long TIME_THRESHOLD = 1000 * 60 * 120; 25 private static final long TIME_THRESHOLD = 1000 * 60 * 120;
24 26
25 @Autowired 27 @Autowired
26 DayOfSchedule dayOfSchedule; 28 DayOfSchedule dayOfSchedule;
27 29
  30 + @Autowired
  31 + LineConfigData lineConfigData;
  32 +
28 public void process(GpsEntity gps){ 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 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); 38 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());
31 if(isInOut(sch) || !sch.getXlBm().equals(gps.getLineId())) 39 if(isInOut(sch) || !sch.getXlBm().equals(gps.getLineId()))
32 return; 40 return;
src/main/java/com/bsth/service/realcontrol/LineConfigService.java
@@ -28,4 +28,6 @@ public interface LineConfigService extends BaseService&lt;LineConfig, Integer&gt;{ @@ -28,4 +28,6 @@ public interface LineConfigService extends BaseService&lt;LineConfig, Integer&gt;{
28 Map<String,Object> findByIdx(String idx); 28 Map<String,Object> findByIdx(String idx);
29 29
30 Map<String,Object> setAutoExec(Map<String, String> map); 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&lt;LineConfig, Integer&gt; @@ -245,4 +245,22 @@ public class LineConfigServiceImpl extends BaseServiceImpl&lt;LineConfig, Integer&gt;
245 } 245 }
246 return rs; 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 }