Commit 1888aaab47fc0e49cf147cec8f0e6ae6e4674bc8
1 parent
914f0551
update...
Showing
5 changed files
with
180 additions
and
130 deletions
src/main/java/com/bsth/controller/realcontrol/anomalyCheckController.java renamed to src/main/java/com/bsth/controller/realcontrol/AdminUtilsController.java
| 1 | -package com.bsth.controller.realcontrol; | ||
| 2 | - | ||
| 3 | -import com.bsth.data.gpsdata_v2.cache.GeoCacheData; | ||
| 4 | -import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread; | ||
| 5 | -import com.bsth.data.msg_queue.DirectivePushQueue; | ||
| 6 | -import com.bsth.data.msg_queue.WebSocketPushQueue; | ||
| 7 | -import com.bsth.data.schedule.DayOfSchedule; | ||
| 8 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 9 | -import org.slf4j.Logger; | ||
| 10 | -import org.slf4j.LoggerFactory; | ||
| 11 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 13 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 14 | -import org.springframework.web.bind.annotation.RequestParam; | ||
| 15 | -import org.springframework.web.bind.annotation.RestController; | ||
| 16 | - | ||
| 17 | -import java.util.HashMap; | ||
| 18 | -import java.util.List; | ||
| 19 | -import java.util.Map; | ||
| 20 | - | ||
| 21 | -/** | ||
| 22 | - * Created by panzhao on 2017/4/14. | ||
| 23 | - */ | ||
| 24 | -@RestController | ||
| 25 | -@RequestMapping("anomalyCheck") | ||
| 26 | -public class anomalyCheckController { | ||
| 27 | - | ||
| 28 | - | ||
| 29 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 30 | - | ||
| 31 | - @Autowired | ||
| 32 | - DayOfSchedule dayOfSchedule; | ||
| 33 | - | ||
| 34 | - @Autowired | ||
| 35 | - GeoCacheData geoCacheData; | ||
| 36 | - | ||
| 37 | - /** | ||
| 38 | - * 出现重复班次的车辆 | ||
| 39 | - * @param nbbm | ||
| 40 | - */ | ||
| 41 | - @RequestMapping(value = "/schRepeat", method = RequestMethod.POST) | ||
| 42 | - public void schRepeat(@RequestParam String nbbm){ | ||
| 43 | - logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测..."); | ||
| 44 | - List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm); | ||
| 45 | - logger.info("检测前,车辆班次数量:" + list.size()); | ||
| 46 | - | ||
| 47 | - Map<Long, ScheduleRealInfo> map = new HashMap<>(); | ||
| 48 | - for(ScheduleRealInfo sch : list){ | ||
| 49 | - if(map.containsKey(sch.getId())){ | ||
| 50 | - logger.info("检测到重复ID: " + sch.getId()); | ||
| 51 | - } | ||
| 52 | - map.put(sch.getId(), sch); | ||
| 53 | - } | ||
| 54 | - | ||
| 55 | - logger.info("检测后,车辆班次数量:" + list.size()); | ||
| 56 | - if(map.values().size() > 0){ | ||
| 57 | - dayOfSchedule.replaceByNbbm(nbbm, map.values()); | ||
| 58 | - } | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - @RequestMapping(value = "/directivePushQueue") | ||
| 62 | - public void directivePushQueue(){ | ||
| 63 | - DirectivePushQueue.start(); | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | - @RequestMapping(value = "/directiveQueueSize") | ||
| 67 | - public void directiveQueueSize(){ | ||
| 68 | - DirectivePushQueue.size(); | ||
| 69 | - } | ||
| 70 | - | ||
| 71 | - @RequestMapping(value = "/webSocketPushQueue") | ||
| 72 | - public void webSocketPushQueue(){ | ||
| 73 | - WebSocketPushQueue.start(); | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - @RequestMapping(value = "/webSocketQueueSize") | ||
| 77 | - public void webSocketQueueSize(){ | ||
| 78 | - WebSocketPushQueue.size(); | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - @RequestMapping(value = "/setHttpFlag") | ||
| 82 | - public void setHttpFlag(@RequestParam int flag){ | ||
| 83 | - if(flag != 0 && flag != -1) | ||
| 84 | - return; | ||
| 85 | - GpsDataLoaderThread.setFlag(flag); | ||
| 86 | - } | ||
| 87 | - | ||
| 88 | - @RequestMapping(value = "/updateCacheBuff") | ||
| 89 | - public void updateCacheBuff(){ | ||
| 90 | - geoCacheData.loadData(); | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | - @RequestMapping(value = "/reCalcLpSch") | ||
| 94 | - public void reCalcLpSch(){ | ||
| 95 | - dayOfSchedule._test_reCalcLpSch(); | ||
| 96 | - } | ||
| 97 | - | ||
| 98 | - @RequestMapping(value = "/findSchByLpName") | ||
| 99 | - public List<ScheduleRealInfo> findSchByLpName(@RequestParam String lpName){ | ||
| 100 | - return dayOfSchedule.getLpScheduleMap().get(lpName); | ||
| 101 | - } | ||
| 102 | - | ||
| 103 | - @RequestMapping(value = "/findSchByNbbm") | ||
| 104 | - public List<ScheduleRealInfo> findSchByNbbm(@RequestParam String nbbm){ | ||
| 105 | - return dayOfSchedule.findByNbbm(nbbm); | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | - @RequestMapping(value = "/removeExecPlan") | ||
| 109 | - public int removeExecPlan(@RequestParam String nbbm){ | ||
| 110 | - dayOfSchedule.removeExecPlan(nbbm); | ||
| 111 | - return 1; | ||
| 112 | - } | ||
| 113 | - | ||
| 114 | - @RequestMapping(value = "/sch_re_calc_id_maps") | ||
| 115 | - public int reCalcIdMaps(){ | ||
| 116 | - return dayOfSchedule.reCalcIdMaps(); | ||
| 117 | - } | ||
| 118 | - | ||
| 119 | - @RequestMapping(value = "/sch_size_string") | ||
| 120 | - public String schSizeString(){ | ||
| 121 | - return dayOfSchedule.sizeString(); | ||
| 122 | - } | ||
| 123 | -} | 1 | +package com.bsth.controller.realcontrol; |
| 2 | + | ||
| 3 | +import com.bsth.data.directive.DayOfDirectives; | ||
| 4 | +import com.bsth.data.gpsdata_v2.cache.GeoCacheData; | ||
| 5 | +import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread; | ||
| 6 | +import com.bsth.data.msg_queue.DirectivePushQueue; | ||
| 7 | +import com.bsth.data.msg_queue.WebSocketPushQueue; | ||
| 8 | +import com.bsth.data.schedule.DayOfSchedule; | ||
| 9 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 10 | +import com.bsth.websocket.handler.RealControlSocketHandler; | ||
| 11 | +import org.slf4j.Logger; | ||
| 12 | +import org.slf4j.LoggerFactory; | ||
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 14 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 15 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 16 | +import org.springframework.web.bind.annotation.RestController; | ||
| 17 | + | ||
| 18 | +import java.util.HashMap; | ||
| 19 | +import java.util.List; | ||
| 20 | +import java.util.Map; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Created by panzhao on 2017/4/14. | ||
| 24 | + */ | ||
| 25 | +@RestController | ||
| 26 | +@RequestMapping("adminUtils") | ||
| 27 | +public class AdminUtilsController { | ||
| 28 | + | ||
| 29 | + | ||
| 30 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 31 | + | ||
| 32 | + @Autowired | ||
| 33 | + DayOfSchedule dayOfSchedule; | ||
| 34 | + | ||
| 35 | + @Autowired | ||
| 36 | + GeoCacheData geoCacheData; | ||
| 37 | + | ||
| 38 | + @Autowired | ||
| 39 | + DayOfDirectives dayOfDirectives; | ||
| 40 | + | ||
| 41 | + @Autowired | ||
| 42 | + RealControlSocketHandler realControlSocketHandler; | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 出现重复班次的车辆 | ||
| 46 | + * @param | ||
| 47 | + | ||
| 48 | + @RequestMapping(value = "/schRepeat", method = RequestMethod.POST) | ||
| 49 | + public void schRepeat(@RequestParam String nbbm){ | ||
| 50 | + logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测..."); | ||
| 51 | + List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm); | ||
| 52 | + logger.info("检测前,车辆班次数量:" + list.size()); | ||
| 53 | + | ||
| 54 | + Map<Long, ScheduleRealInfo> map = new HashMap<>(); | ||
| 55 | + for(ScheduleRealInfo sch : list){ | ||
| 56 | + if(map.containsKey(sch.getId())){ | ||
| 57 | + logger.info("检测到重复ID: " + sch.getId()); | ||
| 58 | + } | ||
| 59 | + map.put(sch.getId(), sch); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + logger.info("检测后,车辆班次数量:" + list.size()); | ||
| 63 | + if(map.values().size() > 0){ | ||
| 64 | + dayOfSchedule.replaceByNbbm(nbbm, map.values()); | ||
| 65 | + } | ||
| 66 | + }*/ | ||
| 67 | + | ||
| 68 | +/* @RequestMapping(value = "/directivePushQueue") | ||
| 69 | + public void directivePushQueue(){ | ||
| 70 | + DirectivePushQueue.start(); | ||
| 71 | + }*/ | ||
| 72 | + | ||
| 73 | + @RequestMapping(value = "/directiveQueueSize") | ||
| 74 | + public void directiveQueueSize(){ | ||
| 75 | + DirectivePushQueue.size(); | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + /*@RequestMapping(value = "/webSocketPushQueue") | ||
| 79 | + public void webSocketPushQueue(){ | ||
| 80 | + WebSocketPushQueue.start(); | ||
| 81 | + }*/ | ||
| 82 | + | ||
| 83 | + @RequestMapping(value = "/webSocketQueueSize") | ||
| 84 | + public void webSocketQueueSize(){ | ||
| 85 | + WebSocketPushQueue.size(); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + @RequestMapping(value = "/setHttpFlag") | ||
| 89 | + public void setHttpFlag(@RequestParam int flag){ | ||
| 90 | + if(flag != 0 && flag != -1) | ||
| 91 | + return; | ||
| 92 | + GpsDataLoaderThread.setFlag(flag); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + @RequestMapping(value = "/updateCacheBuff") | ||
| 96 | + public void updateCacheBuff(){ | ||
| 97 | + geoCacheData.loadData(); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @RequestMapping(value = "/reCalcLpSch") | ||
| 101 | + public void reCalcLpSch(){ | ||
| 102 | + dayOfSchedule._test_reCalcLpSch(); | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + @RequestMapping(value = "/findSchByLpName") | ||
| 106 | + public List<ScheduleRealInfo> findSchByLpName(@RequestParam String lpName){ | ||
| 107 | + return dayOfSchedule.getLpScheduleMap().get(lpName); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + @RequestMapping(value = "/findSchByNbbm") | ||
| 111 | + public List<ScheduleRealInfo> findSchByNbbm(@RequestParam String nbbm){ | ||
| 112 | + return dayOfSchedule.findByNbbm(nbbm); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + @RequestMapping(value = "/removeExecPlan") | ||
| 116 | + public int removeExecPlan(@RequestParam String nbbm){ | ||
| 117 | + dayOfSchedule.removeExecPlan(nbbm); | ||
| 118 | + return 1; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + @RequestMapping(value = "/sch_re_calc_id_maps") | ||
| 122 | + public int reCalcIdMaps(){ | ||
| 123 | + return dayOfSchedule.reCalcIdMaps(); | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + @RequestMapping(value = "/sch_size_string") | ||
| 127 | + public String schSizeString(){ | ||
| 128 | + return dayOfSchedule.sizeString(); | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + @RequestMapping(value = "/containerSize") | ||
| 132 | + public Map<String, Integer> containerSize(){ | ||
| 133 | + Map<String, Integer> rs = new HashMap<>(); | ||
| 134 | + rs.put("60_size", dayOfDirectives.all60().size()); | ||
| 135 | + rs.put("nbbm_sch_size", dayOfSchedule.findAll().size()); | ||
| 136 | + rs.put("lp_sch_size", dayOfSchedule.findAllByLpContainer().size()); | ||
| 137 | + rs.put("id_sch_size", dayOfSchedule.findAllByIdContainer().size()); | ||
| 138 | + rs.put("pst_sch_size", dayOfSchedule.getPstSize()); | ||
| 139 | + return rs; | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + @RequestMapping(value = "/websocketRadioText") | ||
| 143 | + public int radioText(String t){ | ||
| 144 | + realControlSocketHandler.sendMessage(t); | ||
| 145 | + return 0; | ||
| 146 | + } | ||
| 147 | +} |
src/main/java/com/bsth/data/gpsdata_v2/handlers/OutStationProcess.java
| @@ -39,7 +39,7 @@ public class OutStationProcess { | @@ -39,7 +39,7 @@ public class OutStationProcess { | ||
| 39 | 39 | ||
| 40 | @Autowired | 40 | @Autowired |
| 41 | GpsStatusManager gpsStatusManager; | 41 | GpsStatusManager gpsStatusManager; |
| 42 | - private final static int MAX_BEFORE_TIME = 1000 * 60 * 120; | 42 | + private final static int MAX_BEFORE_TIME = 1000 * 60 * 60 * 3; |
| 43 | 43 | ||
| 44 | public void process(GpsEntity gps) { | 44 | public void process(GpsEntity gps) { |
| 45 | //自动执行的线路,滚蛋 | 45 | //自动执行的线路,滚蛋 |
| @@ -86,8 +86,8 @@ public class OutStationProcess { | @@ -86,8 +86,8 @@ public class OutStationProcess { | ||
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | int diff = (int) (sch.getDfsjT() - gps.getTimestamp()); | 88 | int diff = (int) (sch.getDfsjT() - gps.getTimestamp()); |
| 89 | - //首班出场最多提前2小时 | ||
| 90 | - if ((dayOfSchedule.isFirstOut(sch) && diff > MAX_BEFORE_TIME) || diff > MAX_BEFORE_TIME / 2) | 89 | + //首班出场最多提前3小时 |
| 90 | + if (dayOfSchedule.isFirstOut(sch) && diff > MAX_BEFORE_TIME) | ||
| 91 | return; | 91 | return; |
| 92 | 92 | ||
| 93 | gps.setPremiseCode(null);//清除前置围栏标记 | 93 | gps.setPremiseCode(null);//清除前置围栏标记 |
src/main/java/com/bsth/data/gpsdata_v2/utils/GpsDataRecovery.java
| @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | ||
| 84 | Calendar calendar = Calendar.getInstance(); | 84 | Calendar calendar = Calendar.getInstance(); |
| 85 | int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); | 85 | int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); |
| 86 | 86 | ||
| 87 | - String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info where days_year=346"; //+ dayOfYear; | 87 | + String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info where days_year=39"; //+ dayOfYear; |
| 88 | JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource()); | 88 | JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource()); |
| 89 | 89 | ||
| 90 | List<GpsEntity> list = | 90 | List<GpsEntity> list = |
| @@ -102,6 +102,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | @@ -102,6 +102,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | ||
| 102 | gps.setTimestamp(rs.getLong("TS")); | 102 | gps.setTimestamp(rs.getLong("TS")); |
| 103 | gps.setUpDown((byte) getUpOrDown(rs.getLong("SERVICE_STATE"))); | 103 | gps.setUpDown((byte) getUpOrDown(rs.getLong("SERVICE_STATE"))); |
| 104 | gps.setServerTimestamp(rs.getLong("SERVER_TS")); | 104 | gps.setServerTimestamp(rs.getLong("SERVER_TS")); |
| 105 | + gps.setState((int) getService(rs.getLong("SERVICE_STATE"))); | ||
| 105 | return gps; | 106 | return gps; |
| 106 | } | 107 | } |
| 107 | }); | 108 | }); |
| @@ -109,6 +110,17 @@ public class GpsDataRecovery implements ApplicationContextAware { | @@ -109,6 +110,17 @@ public class GpsDataRecovery implements ApplicationContextAware { | ||
| 109 | } | 110 | } |
| 110 | 111 | ||
| 111 | /** | 112 | /** |
| 113 | + * 获取运营状态 | ||
| 114 | + * | ||
| 115 | + * @return -1无效 0运营 1未运营 | ||
| 116 | + */ | ||
| 117 | + public static byte getService(long serviceState) { | ||
| 118 | + if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000) | ||
| 119 | + return -1; | ||
| 120 | + return (byte) (((serviceState & 0x02000000) == 0x02000000) ? 1 : 0); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + /** | ||
| 112 | * 王通 2016/6/29 9:23:24 获取车辆线路上下行 | 124 | * 王通 2016/6/29 9:23:24 获取车辆线路上下行 |
| 113 | * | 125 | * |
| 114 | * @return -1无效 0上行 1下行 | 126 | * @return -1无效 0上行 1下行 |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| @@ -861,6 +861,18 @@ public class DayOfSchedule { | @@ -861,6 +861,18 @@ public class DayOfSchedule { | ||
| 861 | return nbbmScheduleMap.values(); | 861 | return nbbmScheduleMap.values(); |
| 862 | } | 862 | } |
| 863 | 863 | ||
| 864 | + public Collection<ScheduleRealInfo> findAllByLpContainer() { | ||
| 865 | + return lpScheduleMap.values(); | ||
| 866 | + } | ||
| 867 | + | ||
| 868 | + public Collection<ScheduleRealInfo> findAllByIdContainer() { | ||
| 869 | + return id2SchedulMap.values(); | ||
| 870 | + } | ||
| 871 | + | ||
| 872 | + public int getPstSize() { | ||
| 873 | + return pstBuffer.size(); | ||
| 874 | + } | ||
| 875 | + | ||
| 864 | public boolean addExecPlan(ScheduleRealInfo sch) { | 876 | public boolean addExecPlan(ScheduleRealInfo sch) { |
| 865 | ScheduleRealInfo oldExec = executeCurr(sch.getClZbh()); | 877 | ScheduleRealInfo oldExec = executeCurr(sch.getClZbh()); |
| 866 | if (sch != null){ | 878 | if (sch != null){ |
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
| @@ -476,10 +476,12 @@ var gb_schedule_table = (function () { | @@ -476,10 +476,12 @@ var gb_schedule_table = (function () { | ||
| 476 | 476 | ||
| 477 | if (nextSch) { | 477 | if (nextSch) { |
| 478 | $('dl[data-id=' + nextSch.id + ']', contWrap).addClass('intimity'); | 478 | $('dl[data-id=' + nextSch.id + ']', contWrap).addClass('intimity'); |
| 479 | - if (nextSch.xlDir == sch.xlDir) | ||
| 480 | - return; | 479 | + /*if (nextSch.xlDir == sch.xlDir) |
| 480 | + return;*/ | ||
| 481 | //滚动到下一个班次 | 481 | //滚动到下一个班次 |
| 482 | - scroToDl(nextSch); | 482 | + if(nextSch.xlDir != sch.xlDir) |
| 483 | + scroToDl(nextSch); | ||
| 484 | + | ||
| 483 | } | 485 | } |
| 484 | 486 | ||
| 485 | //如果有打开轨迹回放 | 487 | //如果有打开轨迹回放 |