Commit 02716315ffc5e1f7e08dcdf58c5602420f8a7a6b
Merge branch 'minhang' into pudong
Showing
26 changed files
with
491 additions
and
273 deletions
src/main/java/com/bsth/ServiceStateTest.java deleted
100644 → 0
| 1 | -package com.bsth; | |
| 2 | - | |
| 3 | -public class ServiceStateTest { | |
| 4 | - | |
| 5 | - public static void main(String[] args) { | |
| 6 | - System.out.println("运营状态:" + getService(603979776)); | |
| 7 | - System.out.println("上下行:" + getUpOrDown(603979776)); | |
| 8 | - } | |
| 9 | - | |
| 10 | - /** | |
| 11 | - * 获取运营状态 | |
| 12 | - * | |
| 13 | - * @return -1无效 0运营 1未运营 | |
| 14 | - */ | |
| 15 | - public static byte getService(long serviceState) { | |
| 16 | - if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000) | |
| 17 | - return -1; | |
| 18 | - return (byte) (((serviceState & 0x02000000) == 0x02000000) ? 1 : 0); | |
| 19 | - } | |
| 20 | - | |
| 21 | - /** | |
| 22 | - * 王通 2016/6/29 9:23:24 获取车辆线路上下行 | |
| 23 | - * | |
| 24 | - * @return -1无效 0上行 1下行 | |
| 25 | - */ | |
| 26 | - public static byte getUpOrDown(long serviceState) { | |
| 27 | - if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000 | |
| 28 | - || (serviceState & 0x01000000) == 0x01000000 || (serviceState & 0x08000000) == 0x08000000) | |
| 29 | - return -1; | |
| 30 | - return (byte) (((serviceState & 0x10000000) == 0x10000000) ? 1 : 0); | |
| 31 | - } | |
| 32 | -} |
src/main/java/com/bsth/XDApplication.java
0 → 100644
| 1 | +package com.bsth; | |
| 2 | + | |
| 3 | +import com.bsth.data.BasicData; | |
| 4 | +import com.bsth.data.ThreadMonotor; | |
| 5 | +import com.bsth.data.car_out_info.UpdateDBThread; | |
| 6 | +import com.bsth.data.directive.DirectivesPstThread; | |
| 7 | +import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; | |
| 8 | +import com.bsth.data.gpsdata.thread.OfflineMonitorThread; | |
| 9 | +import com.bsth.data.schedule.late_adjust.ScheduleLateThread; | |
| 10 | +import com.bsth.data.schedule.thread.CalcOilThread; | |
| 11 | +import com.bsth.data.schedule.thread.SchedulePstThread; | |
| 12 | +import com.bsth.data.schedule.thread.ScheduleRefreshThread; | |
| 13 | +import com.bsth.data.schedule.thread.SubmitToTrafficManage; | |
| 14 | +import com.bsth.util.DateUtils; | |
| 15 | +import com.bsth.util.Tools; | |
| 16 | +import org.slf4j.Logger; | |
| 17 | +import org.slf4j.LoggerFactory; | |
| 18 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 19 | +import org.springframework.boot.CommandLineRunner; | |
| 20 | +import org.springframework.stereotype.Component; | |
| 21 | + | |
| 22 | +import java.util.concurrent.ScheduledExecutorService; | |
| 23 | +import java.util.concurrent.TimeUnit; | |
| 24 | + | |
| 25 | +/** | |
| 26 | + * 线调大部分服务都在这里启动 | |
| 27 | + * Created by panzhao on 2017/5/14. | |
| 28 | + */ | |
| 29 | +@Component | |
| 30 | +public class XDApplication implements CommandLineRunner { | |
| 31 | + | |
| 32 | + Logger log = LoggerFactory.getLogger(this.getClass()); | |
| 33 | + | |
| 34 | + @Autowired | |
| 35 | + BasicData.BasicDataLoader basicDataLoader; | |
| 36 | + @Autowired | |
| 37 | + UpdateDBThread fcxxUpdateThread; | |
| 38 | + @Autowired | |
| 39 | + GpsDataLoaderThread gpsDataLoader; | |
| 40 | + @Autowired | |
| 41 | + OfflineMonitorThread offlineMonitorThread; | |
| 42 | + @Autowired | |
| 43 | + ScheduleRefreshThread scheduleRefreshThread; | |
| 44 | + @Autowired | |
| 45 | + SchedulePstThread schedulePstThread; | |
| 46 | + @Autowired | |
| 47 | + ScheduleLateThread scheduleLateThread; | |
| 48 | + @Autowired | |
| 49 | + SubmitToTrafficManage submitToTrafficManage; | |
| 50 | + @Autowired | |
| 51 | + CalcOilThread calcOilThread; | |
| 52 | + @Autowired | |
| 53 | + DirectivesPstThread directivesPstThread; | |
| 54 | + @Autowired | |
| 55 | + ThreadMonotor threadMonotor; | |
| 56 | + | |
| 57 | + private static long timeDiff; | |
| 58 | + | |
| 59 | + static { | |
| 60 | + timeDiff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis(); | |
| 61 | + if (timeDiff < 0) | |
| 62 | + timeDiff += (1000 * 60 * 60 * 24); | |
| 63 | + } | |
| 64 | + | |
| 65 | + @Override | |
| 66 | + public void run(String... strings) throws Exception { | |
| 67 | + try { | |
| 68 | + Tools tools = new Tools("application.properties"); | |
| 69 | + String environment = tools.getValue("spring.profiles.active"); | |
| 70 | + //预先加载基础的对照数据 | |
| 71 | + basicDataLoader.loadAllData(); | |
| 72 | + switch (environment){ | |
| 73 | + case "dev": | |
| 74 | + devInit(); | |
| 75 | + break; | |
| 76 | + case "prod": | |
| 77 | + prodInit(); | |
| 78 | + break; | |
| 79 | + } | |
| 80 | + }catch (Exception e){ | |
| 81 | + log.error("线调后台启动出现异常!!", e); | |
| 82 | + System.exit(1); | |
| 83 | + } | |
| 84 | + } | |
| 85 | + | |
| 86 | + public void devInit(){ | |
| 87 | + ScheduledExecutorService sexec = Application.mainServices; | |
| 88 | + //抓取GPS数据 | |
| 89 | + gpsDataLoader.setFlag(-1); | |
| 90 | + sexec.scheduleWithFixedDelay(gpsDataLoader, 30, 2, TimeUnit.SECONDS); | |
| 91 | + //实际排班更新线程 | |
| 92 | + sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); | |
| 93 | + //实际排班延迟入库线程 | |
| 94 | + sexec.scheduleWithFixedDelay(schedulePstThread, 60, 30, TimeUnit.SECONDS); | |
| 95 | + | |
| 96 | + //线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | |
| 97 | + sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS); | |
| 98 | + } | |
| 99 | + | |
| 100 | + public void prodInit(){ | |
| 101 | + ScheduledExecutorService sexec = Application.mainServices; | |
| 102 | + //发车信息 | |
| 103 | + sexec.scheduleWithFixedDelay(fcxxUpdateThread, 60, 40, TimeUnit.SECONDS); | |
| 104 | + //抓取GPS数据 | |
| 105 | + sexec.scheduleWithFixedDelay(gpsDataLoader, 30, 2, TimeUnit.SECONDS); | |
| 106 | + //检查设备掉离线 | |
| 107 | + sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS); | |
| 108 | + //实际排班更新线程 | |
| 109 | + sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); | |
| 110 | + //实际排班延迟入库线程 | |
| 111 | + sexec.scheduleWithFixedDelay(schedulePstThread, 60, 30, TimeUnit.SECONDS); | |
| 112 | + //检查班次误点 | |
| 113 | + sexec.scheduleWithFixedDelay(scheduleLateThread, 60, 30, TimeUnit.SECONDS); | |
| 114 | + //调度指令延迟入库 | |
| 115 | + sexec.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS); | |
| 116 | + | |
| 117 | + //运管处静态数据提交 | |
| 118 | + log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | |
| 119 | + sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | |
| 120 | + //计算油、公里加注 | |
| 121 | + sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | |
| 122 | + | |
| 123 | + //线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | |
| 124 | + sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS); | |
| 125 | + } | |
| 126 | +} | ... | ... |
src/main/java/com/bsth/controller/realcontrol/anomalyCheckController.java
| 1 | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; |
| 4 | +import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; | |
| 4 | 5 | import com.bsth.data.msg_queue.DirectivePushQueue; |
| 5 | 6 | import com.bsth.data.msg_queue.WebSocketPushQueue; |
| 6 | 7 | import com.bsth.data.schedule.DayOfSchedule; |
| ... | ... | @@ -67,4 +68,11 @@ public class anomalyCheckController { |
| 67 | 68 | public void webSocketPushQueue(){ |
| 68 | 69 | WebSocketPushQueue.start(); |
| 69 | 70 | } |
| 71 | + | |
| 72 | + @RequestMapping(value = "/setHttpFlag") | |
| 73 | + public void setHttpFlag(@RequestParam int flag){ | |
| 74 | + if(flag != 0 && flag != -1) | |
| 75 | + return; | |
| 76 | + GpsDataLoaderThread.setFlag(flag); | |
| 77 | + } | |
| 70 | 78 | } | ... | ... |
src/main/java/com/bsth/data/BasicData.java
src/main/java/com/bsth/data/ThreadMonotor.java
| 1 | 1 | package com.bsth.data; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; |
| 4 | +import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; | |
| 4 | 5 | import com.bsth.data.msg_queue.DirectivePushQueue; |
| 5 | 6 | import com.bsth.data.msg_queue.WebSocketPushQueue; |
| 6 | 7 | import org.slf4j.Logger; |
| ... | ... | @@ -24,6 +25,11 @@ public class ThreadMonotor extends Thread{ |
| 24 | 25 | GpsRealAnalyse.shutdown(); |
| 25 | 26 | } |
| 26 | 27 | |
| 28 | + if(GpsRealAnalyse.isIdle()){ | |
| 29 | + //尝试使用网关的GPS实时对照数据 | |
| 30 | + GpsDataLoaderThread.setFlag(-1); | |
| 31 | + } | |
| 32 | + | |
| 27 | 33 | //webSocket 消息推送队列 |
| 28 | 34 | if(WebSocketPushQueue.isIdle()){ |
| 29 | 35 | log.warn("WebSocketPushQueue isIdle true !!!!"); | ... | ... |
src/main/java/com/bsth/data/car_out_info/CarOutInfo.java deleted
100644 → 0
| 1 | -package com.bsth.data.car_out_info; | |
| 2 | - | |
| 3 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 4 | - | |
| 5 | -import java.util.List; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * Created by panzhao on 2017/5/7. | |
| 9 | - */ | |
| 10 | -public interface CarOutInfo { | |
| 11 | - | |
| 12 | - void updateAll(); | |
| 13 | - | |
| 14 | - void update(String lineCode); | |
| 15 | - | |
| 16 | - void update(List<ScheduleRealInfo> list) ; | |
| 17 | -} |
src/main/java/com/bsth/data/car_out_info/CarOutInfoHandler.java
| ... | ... | @@ -9,15 +9,12 @@ import org.apache.commons.lang3.StringUtils; |
| 9 | 9 | import org.slf4j.Logger; |
| 10 | 10 | import org.slf4j.LoggerFactory; |
| 11 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | -import org.springframework.boot.CommandLineRunner; | |
| 13 | 12 | import org.springframework.jdbc.core.BatchPreparedStatementSetter; |
| 14 | 13 | import org.springframework.jdbc.core.JdbcTemplate; |
| 15 | 14 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
| 16 | 15 | import org.springframework.stereotype.Component; |
| 17 | -import org.springframework.stereotype.Service; | |
| 18 | 16 | import org.springframework.transaction.TransactionDefinition; |
| 19 | 17 | import org.springframework.transaction.TransactionStatus; |
| 20 | -import org.springframework.transaction.annotation.Transactional; | |
| 21 | 18 | import org.springframework.transaction.support.DefaultTransactionDefinition; |
| 22 | 19 | |
| 23 | 20 | import java.sql.PreparedStatement; |
| ... | ... | @@ -28,14 +25,23 @@ import java.util.*; |
| 28 | 25 | * 发车信息表处理程序 |
| 29 | 26 | * Created by panzhao on 2017/5/5. |
| 30 | 27 | */ |
| 31 | -@Service | |
| 32 | -public class CarOutInfoHandler implements CommandLineRunner, CarOutInfo { | |
| 28 | +@Component | |
| 29 | +public class CarOutInfoHandler { | |
| 33 | 30 | |
| 34 | 31 | @Autowired |
| 35 | 32 | DayOfSchedule dayOfSchedule; |
| 36 | 33 | |
| 37 | 34 | //班次类型对照表 |
| 38 | - Map<String, String> bcTypeMap; | |
| 35 | + static Map<String, String> bcTypeMap; | |
| 36 | + | |
| 37 | + static{ | |
| 38 | + bcTypeMap = new HashMap<>(); | |
| 39 | + bcTypeMap.put("normal", "正常班次"); | |
| 40 | + bcTypeMap.put("region", "区间"); | |
| 41 | + bcTypeMap.put("venting", "直放"); | |
| 42 | + bcTypeMap.put("major", "放站"); | |
| 43 | + bcTypeMap.put("ldks", "两点间空驶"); | |
| 44 | + } | |
| 39 | 45 | |
| 40 | 46 | private static ScheduleComparator.FCSJ schFCSJComparator = new ScheduleComparator.FCSJ(); |
| 41 | 47 | |
| ... | ... | @@ -47,7 +53,6 @@ public class CarOutInfoHandler implements CommandLineRunner, CarOutInfo { |
| 47 | 53 | /** |
| 48 | 54 | * 全量更新发车信息表 |
| 49 | 55 | */ |
| 50 | - @Override | |
| 51 | 56 | public void updateAll() { |
| 52 | 57 | Set<String> ks = BasicData.lineCode2NameMap.keySet(); |
| 53 | 58 | for (String lineCode : ks) { |
| ... | ... | @@ -55,7 +60,6 @@ public class CarOutInfoHandler implements CommandLineRunner, CarOutInfo { |
| 55 | 60 | } |
| 56 | 61 | } |
| 57 | 62 | |
| 58 | - @Override | |
| 59 | 63 | public void update(String lineCode) { |
| 60 | 64 | try { |
| 61 | 65 | ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap = dayOfSchedule.getLpScheduleMap(); |
| ... | ... | @@ -75,8 +79,6 @@ public class CarOutInfoHandler implements CommandLineRunner, CarOutInfo { |
| 75 | 79 | } |
| 76 | 80 | } |
| 77 | 81 | |
| 78 | - @Transactional | |
| 79 | - @Override | |
| 80 | 82 | public void update(List<ScheduleRealInfo> list) { |
| 81 | 83 | if (list.size() == 0) |
| 82 | 84 | return; |
| ... | ... | @@ -194,30 +196,4 @@ public class CarOutInfoHandler implements CommandLineRunner, CarOutInfo { |
| 194 | 196 | } |
| 195 | 197 | return array; |
| 196 | 198 | } |
| 197 | - | |
| 198 | - @Autowired | |
| 199 | - UpdateInfoThread updateInfoThread; | |
| 200 | - | |
| 201 | - @Override | |
| 202 | - public void run(String... strings) throws Exception { | |
| 203 | - bcTypeMap = new HashMap<>(); | |
| 204 | - bcTypeMap.put("normal", "正常班次"); | |
| 205 | - bcTypeMap.put("region", "区间"); | |
| 206 | - bcTypeMap.put("venting", "直放"); | |
| 207 | - bcTypeMap.put("major", "放站"); | |
| 208 | - bcTypeMap.put("ldks", "两点间空驶"); | |
| 209 | - //Application.mainServices.scheduleWithFixedDelay(updateInfoThread, 60, 40, TimeUnit.SECONDS); | |
| 210 | - } | |
| 211 | - | |
| 212 | - @Component | |
| 213 | - private static class UpdateInfoThread extends Thread { | |
| 214 | - | |
| 215 | - @Autowired | |
| 216 | - CarOutInfo carOutInfoHandler; | |
| 217 | - | |
| 218 | - @Override | |
| 219 | - public void run() { | |
| 220 | - carOutInfoHandler.updateAll(); | |
| 221 | - } | |
| 222 | - } | |
| 223 | 199 | } | ... | ... |
src/main/java/com/bsth/data/car_out_info/UpdateDBThread.java
0 → 100644
| 1 | +package com.bsth.data.car_out_info; | |
| 2 | + | |
| 3 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 4 | +import org.springframework.stereotype.Component; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 数据库发车信息表更新线程 | |
| 8 | + * Created by panzhao on 2017/5/14. | |
| 9 | + */ | |
| 10 | +@Component | |
| 11 | +public class UpdateDBThread extends Thread{ | |
| 12 | + | |
| 13 | + @Autowired | |
| 14 | + CarOutInfoHandler carOutInfoHandler; | |
| 15 | + | |
| 16 | + @Override | |
| 17 | + public void run() { | |
| 18 | + carOutInfoHandler.updateAll(); | |
| 19 | + } | |
| 20 | +} | ... | ... |
src/main/java/com/bsth/data/forecast/ForecastRealServer.java
| ... | ... | @@ -47,7 +47,7 @@ public class ForecastRealServer implements CommandLineRunner { |
| 47 | 47 | |
| 48 | 48 | //车辆 ——> 预测终点时间 |
| 49 | 49 | //static Map<String, Float> forecastMap = new HashMap<>(); |
| 50 | - //线路_上下行 ——> 封装耗时数据的路由链 | |
| 50 | + //线路_上下行 ——> 耗时数据的路由链 | |
| 51 | 51 | public static ArrayListMultimap<String, SimpleRoute> lineSampleMap; |
| 52 | 52 | //车辆 ——> 预测结果 |
| 53 | 53 | public static Map<String, ForecastResult> forecastMap; | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| ... | ... | @@ -2,8 +2,6 @@ package com.bsth.data.gpsdata; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.data.BasicData; |
| 4 | 4 | import com.bsth.data.forecast.ForecastRealServer; |
| 5 | -import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; | |
| 6 | -import com.bsth.data.gpsdata.thread.OfflineMonitorThread; | |
| 7 | 5 | import com.bsth.data.schedule.DayOfSchedule; |
| 8 | 6 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 9 | 7 | import com.google.common.collect.TreeMultimap; |
| ... | ... | @@ -11,7 +9,6 @@ import org.apache.commons.lang3.StringUtils; |
| 11 | 9 | import org.slf4j.Logger; |
| 12 | 10 | import org.slf4j.LoggerFactory; |
| 13 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | -import org.springframework.boot.CommandLineRunner; | |
| 15 | 12 | import org.springframework.stereotype.Component; |
| 16 | 13 | |
| 17 | 14 | import java.util.*; |
| ... | ... | @@ -25,7 +22,7 @@ import java.util.concurrent.ConcurrentMap; |
| 25 | 22 | * @date 2016年8月12日 下午2:04:41 |
| 26 | 23 | */ |
| 27 | 24 | @Component |
| 28 | -public class GpsRealData implements CommandLineRunner { | |
| 25 | +public class GpsRealData { | |
| 29 | 26 | |
| 30 | 27 | static Logger logger = LoggerFactory.getLogger(GpsRealData.class); |
| 31 | 28 | |
| ... | ... | @@ -35,12 +32,6 @@ public class GpsRealData implements CommandLineRunner { |
| 35 | 32 | private static TreeMultimap<String, String> lineCode2Devices; |
| 36 | 33 | |
| 37 | 34 | @Autowired |
| 38 | - GpsDataLoaderThread gpsDataLoader; | |
| 39 | - | |
| 40 | - @Autowired | |
| 41 | - OfflineMonitorThread offlineMonitorThread; | |
| 42 | - | |
| 43 | - @Autowired | |
| 44 | 35 | DayOfSchedule dayOfSchedule; |
| 45 | 36 | |
| 46 | 37 | @Autowired |
| ... | ... | @@ -54,15 +45,6 @@ public class GpsRealData implements CommandLineRunner { |
| 54 | 45 | lineCode2Devices = TreeMultimap.create(); |
| 55 | 46 | } |
| 56 | 47 | |
| 57 | - @Override | |
| 58 | - public void run(String... arg0) throws Exception { | |
| 59 | - logger.info("gpsDataLoader,30,2"); | |
| 60 | - //http形式获取GPS数据 | |
| 61 | - //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 30, 2, TimeUnit.SECONDS); | |
| 62 | - //定时扫描掉离线 | |
| 63 | - //Application.mainServices.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS); | |
| 64 | - } | |
| 65 | - | |
| 66 | 48 | |
| 67 | 49 | public void put(GpsEntity gps) { |
| 68 | 50 | String device = gps.getDeviceId(); | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/GpsRealAnalyse.java
| ... | ... | @@ -50,6 +50,10 @@ public class GpsRealAnalyse { |
| 50 | 50 | return System.currentTimeMillis() - st > 1000 * 20; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | + public static boolean isIdle(){ | |
| 54 | + return System.currentTimeMillis() - st > 1000 * 60; | |
| 55 | + } | |
| 56 | + | |
| 53 | 57 | public void analyse(List<GpsEntity> list) { |
| 54 | 58 | try { |
| 55 | 59 | st = System.currentTimeMillis(); | ... | ... |
src/main/java/com/bsth/data/gpsdata/thread/GpsDataLoaderThread.java
| ... | ... | @@ -6,7 +6,6 @@ import com.bsth.data.BasicData; |
| 6 | 6 | import com.bsth.data.gpsdata.GpsEntity; |
| 7 | 7 | import com.bsth.data.gpsdata.GpsRealData; |
| 8 | 8 | import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; |
| 9 | -import com.bsth.data.gpsdata.recovery.GpsDataRecovery; | |
| 10 | 9 | import com.bsth.util.ConfigUtil; |
| 11 | 10 | import org.apache.commons.lang3.StringUtils; |
| 12 | 11 | import org.apache.http.HttpEntity; |
| ... | ... | @@ -38,10 +37,24 @@ public class GpsDataLoaderThread extends Thread { |
| 38 | 37 | */ |
| 39 | 38 | public GpsDataLoaderThread() { |
| 40 | 39 | url = ConfigUtil.get("http.gps.real.url"); |
| 40 | + clientUrl = ConfigUtil.get("http.gps.real.cache.url"); | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // 网关数据接口地址 |
| 44 | 44 | private static String url; |
| 45 | + // GPS客户端内存数据接口 | |
| 46 | + private static String clientUrl; | |
| 47 | + | |
| 48 | + //0:从GPS客户端内存获取 -1:从网关获取 | |
| 49 | + private static int flag = 0; | |
| 50 | + | |
| 51 | + public static void setFlag(int v){ | |
| 52 | + flag = v; | |
| 53 | + } | |
| 54 | + | |
| 55 | + public static int getFlag(int v){ | |
| 56 | + return flag; | |
| 57 | + } | |
| 45 | 58 | |
| 46 | 59 | @Autowired |
| 47 | 60 | GpsRealData gpsRealData; |
| ... | ... | @@ -52,17 +65,20 @@ public class GpsDataLoaderThread extends Thread { |
| 52 | 65 | @Override |
| 53 | 66 | public void run() { |
| 54 | 67 | try { |
| 55 | - //如果正在恢复数据 | |
| 56 | - if (GpsDataRecovery.run) | |
| 57 | - return; | |
| 58 | - | |
| 59 | - load(); | |
| 68 | + if(flag == 0) | |
| 69 | + load(); | |
| 70 | + else | |
| 71 | + loadByGateway(); | |
| 60 | 72 | } catch (Exception e) { |
| 61 | 73 | logger.error("", e); |
| 62 | 74 | } |
| 63 | 75 | } |
| 64 | 76 | |
| 65 | - public void load() throws Exception { | |
| 77 | + /** | |
| 78 | + * 从网关获取实时GPS数据 | |
| 79 | + * @throws Exception | |
| 80 | + */ | |
| 81 | + public void loadByGateway() throws Exception { | |
| 66 | 82 | List<GpsEntity> list = null; |
| 67 | 83 | List<GpsEntity> updateList = new ArrayList<>(); |
| 68 | 84 | CloseableHttpClient httpClient = null; |
| ... | ... | @@ -72,8 +88,8 @@ public class GpsDataLoaderThread extends Thread { |
| 72 | 88 | HttpGet get = new HttpGet(url); |
| 73 | 89 | //超时时间 |
| 74 | 90 | RequestConfig requestConfig = RequestConfig.custom() |
| 75 | - .setConnectTimeout(2000).setConnectionRequestTimeout(1000) | |
| 76 | - .setSocketTimeout(2000).build(); | |
| 91 | + .setConnectTimeout(1500).setConnectionRequestTimeout(1000) | |
| 92 | + .setSocketTimeout(1500).build(); | |
| 77 | 93 | get.setConfig(requestConfig); |
| 78 | 94 | |
| 79 | 95 | response = httpClient.execute(get); |
| ... | ... | @@ -81,7 +97,7 @@ public class GpsDataLoaderThread extends Thread { |
| 81 | 97 | HttpEntity entity = response.getEntity(); |
| 82 | 98 | if (null != entity) { |
| 83 | 99 | BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent())); |
| 84 | - StringBuffer stringBuffer = new StringBuffer(); | |
| 100 | + StringBuilder stringBuffer = new StringBuilder(); | |
| 85 | 101 | String str = ""; |
| 86 | 102 | while ((str = br.readLine()) != null) |
| 87 | 103 | stringBuffer.append(str); |
| ... | ... | @@ -128,4 +144,55 @@ public class GpsDataLoaderThread extends Thread { |
| 128 | 144 | response.close(); |
| 129 | 145 | } |
| 130 | 146 | } |
| 147 | + | |
| 148 | + /** | |
| 149 | + * 从客户端内存获取GPS数据 | |
| 150 | + */ | |
| 151 | + public void load() throws Exception{ | |
| 152 | + List<GpsEntity> list = null; | |
| 153 | + CloseableHttpClient httpClient = null; | |
| 154 | + CloseableHttpResponse response = null; | |
| 155 | + | |
| 156 | + try { | |
| 157 | + httpClient = HttpClients.createDefault(); | |
| 158 | + HttpGet get = new HttpGet(clientUrl); | |
| 159 | + //超时时间 | |
| 160 | + RequestConfig requestConfig = RequestConfig.custom() | |
| 161 | + .setConnectTimeout(2000).setConnectionRequestTimeout(1000) | |
| 162 | + .setSocketTimeout(3000).build(); | |
| 163 | + get.setConfig(requestConfig); | |
| 164 | + | |
| 165 | + response = httpClient.execute(get); | |
| 166 | + | |
| 167 | + HttpEntity entity = response.getEntity(); | |
| 168 | + if (null != entity) { | |
| 169 | + BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent())); | |
| 170 | + StringBuilder stringBuffer = new StringBuilder(); | |
| 171 | + String str = ""; | |
| 172 | + while ((str = br.readLine()) != null) | |
| 173 | + stringBuffer.append(str); | |
| 174 | + | |
| 175 | + list = JSON.parseArray(stringBuffer.toString(), GpsEntity.class); | |
| 176 | + String nbbm; | |
| 177 | + for (GpsEntity gps : list) { | |
| 178 | + | |
| 179 | + nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId()); | |
| 180 | + if (StringUtils.isBlank(nbbm)) | |
| 181 | + gps.setIncomplete(true);//标记为异常数据 | |
| 182 | + else | |
| 183 | + gps.setNbbm(nbbm); | |
| 184 | + } | |
| 185 | + //分析数据 | |
| 186 | + gpsRealAnalyse.analyse(list); | |
| 187 | + } else | |
| 188 | + logger.error("client gps result is null"); | |
| 189 | + } catch (Exception e) { | |
| 190 | + logger.error("", e); | |
| 191 | + } finally { | |
| 192 | + if (null != httpClient) | |
| 193 | + httpClient.close(); | |
| 194 | + if (null != response) | |
| 195 | + response.close(); | |
| 196 | + } | |
| 197 | + } | |
| 131 | 198 | } |
| 132 | 199 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -2,20 +2,11 @@ package com.bsth.data.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSON; |
| 4 | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | -import com.bsth.Application; | |
| 6 | 5 | import com.bsth.common.Constants; |
| 7 | 6 | import com.bsth.common.ResponseCode; |
| 8 | -import com.bsth.data.BasicData; | |
| 9 | 7 | import com.bsth.data.LineConfigData; |
| 10 | -import com.bsth.data.ThreadMonotor; | |
| 11 | -import com.bsth.data.directive.DirectivesPstThread; | |
| 12 | 8 | import com.bsth.data.gpsdata.GpsRealData; |
| 13 | 9 | import com.bsth.data.gpsdata.recovery.GpsDataRecovery; |
| 14 | -import com.bsth.data.schedule.late_adjust.ScheduleLateThread; | |
| 15 | -import com.bsth.data.schedule.thread.CalcOilThread; | |
| 16 | -import com.bsth.data.schedule.thread.SchedulePstThread; | |
| 17 | -import com.bsth.data.schedule.thread.ScheduleRefreshThread; | |
| 18 | -import com.bsth.data.schedule.thread.SubmitToTrafficManage; | |
| 19 | 10 | import com.bsth.entity.realcontrol.LineConfig; |
| 20 | 11 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 21 | 12 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| ... | ... | @@ -33,8 +24,6 @@ import org.joda.time.format.DateTimeFormatter; |
| 33 | 24 | import org.slf4j.Logger; |
| 34 | 25 | import org.slf4j.LoggerFactory; |
| 35 | 26 | import org.springframework.beans.factory.annotation.Autowired; |
| 36 | -import org.springframework.boot.CommandLineRunner; | |
| 37 | -import org.springframework.core.annotation.Order; | |
| 38 | 27 | import org.springframework.dao.DataIntegrityViolationException; |
| 39 | 28 | import org.springframework.jdbc.core.JdbcTemplate; |
| 40 | 29 | import org.springframework.stereotype.Component; |
| ... | ... | @@ -42,7 +31,6 @@ import org.springframework.stereotype.Component; |
| 42 | 31 | import java.text.ParseException; |
| 43 | 32 | import java.text.SimpleDateFormat; |
| 44 | 33 | import java.util.*; |
| 45 | -import java.util.concurrent.TimeUnit; | |
| 46 | 34 | |
| 47 | 35 | /** |
| 48 | 36 | * @author PanZhao |
| ... | ... | @@ -51,8 +39,7 @@ import java.util.concurrent.TimeUnit; |
| 51 | 39 | * @date 2016年8月15日 上午10:16:12 |
| 52 | 40 | */ |
| 53 | 41 | @Component |
| 54 | -@Order(value = 3) | |
| 55 | -public class DayOfSchedule implements CommandLineRunner { | |
| 42 | +public class DayOfSchedule { | |
| 56 | 43 | |
| 57 | 44 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 58 | 45 | |
| ... | ... | @@ -95,9 +82,6 @@ public class DayOfSchedule implements CommandLineRunner { |
| 95 | 82 | @Autowired |
| 96 | 83 | GpsRealData gpsRealData; |
| 97 | 84 | |
| 98 | - @Autowired | |
| 99 | - BasicData.BasicDataLoader basicDataLoader; | |
| 100 | - | |
| 101 | 85 | /** |
| 102 | 86 | * 线路当前使用的排班的日期 |
| 103 | 87 | */ |
| ... | ... | @@ -117,63 +101,13 @@ public class DayOfSchedule implements CommandLineRunner { |
| 117 | 101 | } |
| 118 | 102 | |
| 119 | 103 | @Autowired |
| 120 | - ScheduleRefreshThread scheduleRefreshThread; | |
| 121 | - | |
| 122 | - @Autowired | |
| 123 | - SchedulePstThread schedulePstThread; | |
| 124 | - | |
| 125 | - @Autowired | |
| 126 | - ScheduleLateThread scheduleLateThread; | |
| 127 | - | |
| 128 | - @Autowired | |
| 129 | - SubmitToTrafficManage submitToTrafficManage; | |
| 130 | - | |
| 131 | - @Autowired | |
| 132 | 104 | LineConfigData lineConfigs; |
| 133 | 105 | |
| 134 | 106 | @Autowired |
| 135 | 107 | GpsDataRecovery gpsDataRecovery; |
| 136 | 108 | |
| 137 | - @Autowired | |
| 138 | - DirectivesPstThread directivesPstThread; | |
| 139 | - | |
| 140 | - @Autowired | |
| 141 | - CalcOilThread calcOilThread; | |
| 142 | - | |
| 143 | - @Autowired | |
| 144 | - ThreadMonotor threadMonotor; | |
| 145 | - | |
| 146 | 109 | private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"), fmtHHmm = DateTimeFormat.forPattern("HH:mm"); |
| 147 | 110 | |
| 148 | - @Override | |
| 149 | - public void run(String... arg0) throws Exception { | |
| 150 | - basicDataLoader.loadAllData(); | |
| 151 | - | |
| 152 | - //翻班线程 | |
| 153 | -// Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); | |
| 154 | - //入库 | |
| 155 | -// Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 30, TimeUnit.SECONDS); | |
| 156 | - //班次误点扫描 | |
| 157 | -// Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 30, TimeUnit.SECONDS); | |
| 158 | - | |
| 159 | - //每天凌晨2点20提交数据到运管处 | |
| 160 | - long diff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis(); | |
| 161 | - if (diff < 0) | |
| 162 | - diff += (1000 * 60 * 60 * 24); | |
| 163 | - | |
| 164 | - logger.info(diff / 1000 / 60 + "分钟之后提交到运管处"); | |
| 165 | - //Application.mainServices.scheduleAtFixedRate(submitToTrafficManage, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | |
| 166 | - | |
| 167 | - //计算油、公里加注 | |
| 168 | - Application.mainServices.scheduleAtFixedRate(calcOilThread, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | |
| 169 | - | |
| 170 | - //指令持久化线程 | |
| 171 | - Application.mainServices.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS); | |
| 172 | - | |
| 173 | - //监听 | |
| 174 | - Application.mainServices.scheduleWithFixedDelay(threadMonotor, 120, 60, TimeUnit.SECONDS); | |
| 175 | - } | |
| 176 | - | |
| 177 | 111 | //数据恢复 |
| 178 | 112 | private void dataRecovery() { |
| 179 | 113 | GpsDataRecovery.run = true; | ... | ... |
src/main/resources/fatso/handle_real_ctl.js
| ... | ... | @@ -9,19 +9,22 @@ var fs = require('fs') |
| 9 | 9 | , UglifyJS = require("uglify-js"); |
| 10 | 10 | ; |
| 11 | 11 | |
| 12 | +var platform = process.platform; | |
| 13 | +var iswin = platform=='win32'; | |
| 14 | +var separator = platform=='win32'?'\\':'/'; | |
| 12 | 15 | //不参与的目录 |
| 13 | 16 | var pName = 'bsth_control' |
| 14 | 17 | , path = process.cwd() |
| 15 | 18 | //根目录 |
| 16 | - , root = path.substr(0, path.indexOf('\\src\\main')) | |
| 17 | - , workspace = root.substr(0, root.indexOf('\\' + pName)) | |
| 19 | + , root = path.substr(0, path.indexOf(separator + 'src'+separator+'main')) | |
| 20 | + , workspace = root.substr(0, root.indexOf(separator + pName)) | |
| 18 | 21 | //临时目录 |
| 19 | - , dest = (workspace + '\\' + pName + '@fatso_copy').replace(/\//g, '\\') | |
| 20 | - , _static = '\\src\\main\\resources\\static'; | |
| 22 | + , dest = (workspace + separator + pName + '@fatso_copy')//.replace(/\//g, '\\') | |
| 23 | + , _static = separator + 'src'+separator+'main'+separator+'resources'+separator+'static'; | |
| 21 | 24 | |
| 22 | 25 | |
| 23 | -var mainFile = dest + _static + '\\real_control_v2\\main.html'; | |
| 24 | -var mapFile = dest + _static + '\\real_control_v2\\mapmonitor\\real.html'; | |
| 26 | +var mainFile = dest + _static + separator + 'real_control_v2'+separator+'main.html'; | |
| 27 | +var mapFile = dest + _static + separator + 'real_control_v2'+separator+'mapmonitor'+separator+'real.html'; | |
| 25 | 28 | var realCtl = { |
| 26 | 29 | /** |
| 27 | 30 | * 处理线调首页 |
| ... | ... | @@ -81,7 +84,7 @@ var handleCss = function ($, cb) { |
| 81 | 84 | var data = out.styles; |
| 82 | 85 | var fName = (k + '_' + md5(data)) + '.css'; |
| 83 | 86 | //写入 assets css 目录下 |
| 84 | - var descFile = dest + _static + '\\real_control_v2\\assets\\css\\' + fName; | |
| 87 | + var descFile = dest + _static + separator + 'real_control_v2'+separator+'assets'+separator+'css' + separator + fName; | |
| 85 | 88 | fs.open(descFile, 'a', function (err, fd) { |
| 86 | 89 | |
| 87 | 90 | fs.write(fd, data, function () { |
| ... | ... | @@ -135,7 +138,7 @@ var handleJs = function ($, file, cb) { |
| 135 | 138 | var data = result.code; |
| 136 | 139 | var fName = (k + '_' + md5(data)) + '.js'; |
| 137 | 140 | //写入 assets js 目录下 |
| 138 | - var descFile = dest + _static + '\\real_control_v2\\assets\\js\\' + fName; | |
| 141 | + var descFile = dest + _static + separator + 'real_control_v2'+separator+'assets'+separator+'js' + separator + fName; | |
| 139 | 142 | fs.open(descFile, 'a', function (err, fd) { |
| 140 | 143 | |
| 141 | 144 | fs.write(fd, data, function () { | ... | ... |
src/main/resources/fatso/minifier.js
| ... | ... | @@ -5,12 +5,15 @@ |
| 5 | 5 | var fs = require('fs'); |
| 6 | 6 | var UglifyJS = require("uglify-js"); |
| 7 | 7 | |
| 8 | +var platform = process.platform; | |
| 9 | +var iswin = platform=='win32'; | |
| 10 | +var separator = platform=='win32'?'\\':'/'; | |
| 8 | 11 | var minifier = { |
| 9 | 12 | |
| 10 | 13 | mergeAndMini: function(fileArray,scriptString, root, file){ |
| 11 | 14 | var len = fileArray.length; |
| 12 | 15 | for(var i = 0; i < len; i ++){ |
| 13 | - fileArray[i] = root + fileArray[i].split('/').join('\\'); | |
| 16 | + fileArray[i] = root + fileArray[i].split('/').join(separator); | |
| 14 | 17 | } |
| 15 | 18 | |
| 16 | 19 | var result, indoorRs; | ... | ... |
src/main/resources/fatso/start.js
| ... | ... | @@ -11,18 +11,22 @@ var fs = require('fs') |
| 11 | 11 | ,crypto = require("crypto") |
| 12 | 12 | ,handle_real_ctl = require('./handle_real_ctl'); |
| 13 | 13 | |
| 14 | + | |
| 15 | +var platform = process.platform; | |
| 16 | +var iswin = platform=='win32'; | |
| 17 | +var separator = platform=='win32'?'\\':'/'; | |
| 14 | 18 | //不参与的目录 |
| 15 | 19 | var excludes = ['scheduleApp', 'trafficManage', 'control'] |
| 16 | 20 | ,ep = new EventProxy() |
| 17 | 21 | ,pName = 'bsth_control' |
| 18 | 22 | ,path = process.cwd() |
| 19 | 23 | //根目录 |
| 20 | - ,root = path.substr(0, path.indexOf('\\src\\main')) | |
| 21 | - ,workspace = root.substr(0, root.indexOf('\\' + pName)) | |
| 24 | + ,root = path.substr(0, path.indexOf(separator + 'src'+separator+'main')) | |
| 25 | + ,workspace = root.substr(0, root.indexOf(separator + pName)) | |
| 22 | 26 | //临时目录 |
| 23 | - ,dest = (workspace + '\\' + pName+'@fatso_copy').replace(/\//g,'\\') | |
| 24 | - ,_static = '\\src\\main\\resources\\static' | |
| 25 | - ,_pages = dest + _static + '\\pages'; | |
| 27 | + ,dest = (workspace + separator + pName+'@fatso_copy') | |
| 28 | + ,_static = separator + 'src'+separator+'main'+separator+'resources'+separator+'static' | |
| 29 | + ,_pages = dest + _static + separator + 'pages'; | |
| 26 | 30 | |
| 27 | 31 | |
| 28 | 32 | //创建临时目录 |
| ... | ... | @@ -41,7 +45,7 @@ ep.tail('mvn-clean',function(){ |
| 41 | 45 | //ep.emit('copy-project'); |
| 42 | 46 | //清理target |
| 43 | 47 | logInfo('mvn clean...'); |
| 44 | - cProcess = child_process.exec("mvn clean",{cwd: workspace + '\\' + pName},function(error){ | |
| 48 | + cProcess = child_process.exec("mvn clean",{cwd: workspace + separator + pName},function(error){ | |
| 45 | 49 | if(error) |
| 46 | 50 | logError(error); |
| 47 | 51 | |
| ... | ... | @@ -55,8 +59,13 @@ ep.tail('mvn-clean',function(){ |
| 55 | 59 | //复制项目副本 |
| 56 | 60 | ep.tail('copy-project',function(){ |
| 57 | 61 | logInfo('copy project...'); |
| 58 | - var xcopyCom = 'XCOPY '+ root.replace(/\//g,'\\') + ' ' + dest +' /e /exclude:'+path+'\\exclude.txt'; | |
| 59 | - cProcess = child_process.exec(xcopyCom,{maxBuffer: 5000*1024},function(error){ | |
| 62 | + var xcopyCom; | |
| 63 | + if(iswin) | |
| 64 | + xcopyCom = 'XCOPY '+ root.replace(/\//g,'\\') + ' ' + dest +' /e /exclude:'+path+'\\exclude.txt'; | |
| 65 | + else | |
| 66 | + xcopyCom = 'cp -a ' + root + '/. ' + dest; | |
| 67 | + | |
| 68 | + cProcess = child_process.exec(xcopyCom,{cwd: workspace, maxBuffer: 5000*1024},function(error){ | |
| 60 | 69 | if(error) |
| 61 | 70 | logError(error); |
| 62 | 71 | |
| ... | ... | @@ -79,7 +88,7 @@ ep.tail('minifier-js', function(){ |
| 79 | 88 | //再处理首页 |
| 80 | 89 | ep.emit('handle-index', function(){ |
| 81 | 90 | //递归处理片段 |
| 82 | - walk(dest + _static + '\\pages', function(item){ | |
| 91 | + walk(dest + _static + separator + 'pages', function(item){ | |
| 83 | 92 | ep.emit('handle-fragment', item); |
| 84 | 93 | }, |
| 85 | 94 | function(){ |
| ... | ... | @@ -103,7 +112,7 @@ ep.tail('package-jar', function(file){ |
| 103 | 112 | |
| 104 | 113 | logSuccess('mvn package success'); |
| 105 | 114 | |
| 106 | - console.log(('成功打包在 ' + dest + '\\target 目录下').cyan); | |
| 115 | + console.log(('成功打包在 ' + dest + separator + 'target 目录下').cyan); | |
| 107 | 116 | }); |
| 108 | 117 | |
| 109 | 118 | output(cProcess); |
| ... | ... | @@ -113,7 +122,7 @@ ep.tail('package-jar', function(file){ |
| 113 | 122 | ep.tail('handle-fragment', function(file){ |
| 114 | 123 | //要排除的文件 |
| 115 | 124 | for(var i = 0, ex; ex = excludes[i++];){ |
| 116 | - if(file.indexOf(_pages + '\\' + ex) != -1) | |
| 125 | + if(file.indexOf(_pages + separator + ex) != -1) | |
| 117 | 126 | return false; |
| 118 | 127 | } |
| 119 | 128 | handleJavascript(file, function(mini, $){ |
| ... | ... | @@ -130,12 +139,12 @@ ep.tail('handle-fragment', function(file){ |
| 130 | 139 | |
| 131 | 140 | //处理首页 |
| 132 | 141 | ep.tail('handle-index', function(cb){ |
| 133 | - var index = dest + _static + '\\index.html'; | |
| 142 | + var index = dest + _static + separator + 'index.html'; | |
| 134 | 143 | handleJavascript(index, function(mini, $){ |
| 135 | 144 | var jsMiniText = mini.inside + mini.outside; |
| 136 | 145 | |
| 137 | 146 | var code = md5(jsMiniText); |
| 138 | - fs.open( dest + _static + '\\assets\\js\\' + code + '.js', 'a', function(err, fd){ | |
| 147 | + fs.open( dest + _static + separator + 'assets'+separator+'js' + separator + code + '.js', 'a', function(err, fd){ | |
| 139 | 148 | if(err) |
| 140 | 149 | logError(err); |
| 141 | 150 | |
| ... | ... | @@ -210,7 +219,7 @@ function walk(path ,handleFile, over) { |
| 210 | 219 | console.log('read dir error'.red); |
| 211 | 220 | } else { |
| 212 | 221 | files.forEach(function(item) { |
| 213 | - var tmpPath = path + '\\' + item; | |
| 222 | + var tmpPath = path + separator + item; | |
| 214 | 223 | fs.stat(tmpPath, function(err1, stats) { |
| 215 | 224 | if (err1) { |
| 216 | 225 | console.log('stat error'); | ... | ... |
src/main/resources/static/pages/base/timesmodel/add.html
| ... | ... | @@ -109,7 +109,7 @@ |
| 109 | 109 | <!-- 线路名称 (* 必填项) START --> |
| 110 | 110 | <div class="col-md-6"> |
| 111 | 111 | <label class="control-label col-md-5"> |
| 112 | - <span class="required"> * </span> 线路名称 : | |
| 112 | + <span class="required"> * </span> 线路名称 : | |
| 113 | 113 | </label> |
| 114 | 114 | <div class="col-md-6"> |
| 115 | 115 | <select name="lineName" class="form-control input-medium" id="lineSelect"></select> |
| ... | ... | @@ -138,7 +138,7 @@ |
| 138 | 138 | </div> |
| 139 | 139 | <!-- 客容总量 --> |
| 140 | 140 | <div class="form-group" id="krlGroup"> |
| 141 | - <label class="col-md-3 control-label"><span class="required"> * </span>客容总量 :</label> | |
| 141 | + <label class="col-md-3 control-label"><span class="required"> * </span>客容总量 :</label> | |
| 142 | 142 | <div class="col-md-9"> |
| 143 | 143 | <input type="text" class="form-control input-medium" name="krl" id="krlInput" placeholder="客容总量"> |
| 144 | 144 | </div> | ... | ... |
src/main/resources/static/pages/base/timesmodel/css/index.css
| ... | ... | @@ -118,7 +118,7 @@ text.alert-danger { |
| 118 | 118 | |
| 119 | 119 | .ganttSvgContainer { |
| 120 | 120 | height: 400px; |
| 121 | - overflow: auto; | |
| 121 | + overflow: hidden; | |
| 122 | 122 | position: relative; |
| 123 | 123 | } |
| 124 | 124 | |
| ... | ... | @@ -156,3 +156,72 @@ text.alert-danger { |
| 156 | 156 | ::selection { |
| 157 | 157 | background:rgba(255, 255, 255, 0); |
| 158 | 158 | } |
| 159 | + | |
| 160 | +.tipsdscontinue { | |
| 161 | + width:100%; | |
| 162 | + overflow: hidden; | |
| 163 | +} | |
| 164 | + | |
| 165 | +.tipsdscontinue span { | |
| 166 | + display:block; | |
| 167 | + float:left; | |
| 168 | + font-size:x-small; | |
| 169 | + line-height:10px; | |
| 170 | + padding: 2px 8px 4px 8px; | |
| 171 | +} | |
| 172 | + | |
| 173 | +.dscrp { | |
| 174 | + width: 28%; | |
| 175 | + height: 6px; | |
| 176 | + padding: 8px 8px 8px 30px; | |
| 177 | + float: left; | |
| 178 | +} | |
| 179 | + | |
| 180 | +.sx { | |
| 181 | + background-color: #233f5d; | |
| 182 | +} | |
| 183 | + | |
| 184 | +.xx { | |
| 185 | + background-color: #31394a; | |
| 186 | +} | |
| 187 | + | |
| 188 | +.tipso_bubble { | |
| 189 | + border: 1px #E91E63 solid; | |
| 190 | + /* box-shadow: 10px 10px 5px #888888; */ | |
| 191 | + box-shadow: 4px 4px 2px #888888; | |
| 192 | + background: #ffffff !important; | |
| 193 | +} | |
| 194 | +.tipso_arrow { | |
| 195 | + /* border-color: transparent #E91E63 transparent transparent !important; */ | |
| 196 | +} | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | +.ganttSvgContainer::-webkit-scrollbar { | |
| 201 | +width:6px; | |
| 202 | +height:6px; | |
| 203 | +} | |
| 204 | +.ganttSvgContainer::-webkit-scrollbar-button { | |
| 205 | +/* background-color:#FF7677; */ | |
| 206 | +background:rgba(255, 255, 255, 0); | |
| 207 | +} | |
| 208 | +.ganttSvgContainer::-webkit-scrollbar-track { | |
| 209 | +/* background:#FF66D5; */ | |
| 210 | +background:rgba(255, 255, 255, 0); | |
| 211 | +} | |
| 212 | +.ganttSvgContainer::-webkit-scrollbar-track-piece { | |
| 213 | +/* background:#ff0000; */ | |
| 214 | +background:rgba(255, 255, 255, 0); | |
| 215 | +} | |
| 216 | +.ganttSvgContainer::-webkit-scrollbar-thumb{ | |
| 217 | +background:rgba(197, 196, 196, 0.81); | |
| 218 | +border-radius:10px !important; | |
| 219 | +} | |
| 220 | +.ganttSvgContainer::-webkit-scrollbar-corner { | |
| 221 | +/* background:#82AFFF; */ | |
| 222 | +background:rgba(255, 255, 255, 0); | |
| 223 | +} | |
| 224 | +.ganttSvgContainer::-webkit-scrollbar-resizer { | |
| 225 | +/* background:#FF0BEE; */ | |
| 226 | +background:rgba(255, 255, 255, 0); | |
| 227 | +} | |
| 159 | 228 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/timesmodel/edit-detail.html
| ... | ... | @@ -232,6 +232,7 @@ |
| 232 | 232 | * @params [obj--甘特图对象;d--当前修改班次对象数据] |
| 233 | 233 | */ |
| 234 | 234 | $('#editDetail_mobal').on('editDetailMobal.show', function(e,obj,nodeContext,bf,map){ |
| 235 | + debugger; | |
| 235 | 236 | // 定义当前班次数据. |
| 236 | 237 | var dqbcData = nodeContext.dqbcData; |
| 237 | 238 | var ddbcminztjx = isUpdsgbctzsj(dqbcData.bcType) || isUpdsgbctzsj(nodeContext.nextData.bcType) ? dqbcData.STOPTIME : obj.configuration.dataMap.minztjx,lastminztjx = 0; | ... | ... |
src/main/resources/static/pages/base/timesmodel/gantt.html
| ... | ... | @@ -22,13 +22,14 @@ |
| 22 | 22 | <!-- col-md-12 组件START --> |
| 23 | 23 | <div class="col-md-12"> |
| 24 | 24 | <!-- portlet 组件START --> |
| 25 | - <div class="portlet light porttlet-fit bordered"> | |
| 25 | + <div class="portlet light porttlet-fit bordered" > | |
| 26 | 26 | <!-- portlet-title组件START --> |
| 27 | 27 | <div class="portlet-title"> |
| 28 | 28 | <!-- caption 组件START --> |
| 29 | - <div class="caption"> | |
| 29 | + <div class="caption offset"> | |
| 30 | 30 | <i class="fa fa-bar-chart font-dark"></i> |
| 31 | - <span class="caption-subject font-dark sbold uppercase">时刻表明细模型</span> | |
| 31 | + <span class="caption-subject font-dark sbold uppercase skmxTitle"></span> | |
| 32 | + <i class="fa fa-question-circle tipso-animation" style="color: rgba(158, 158, 158, 0.49);float: right;margin-left: 2px;"></i> | |
| 32 | 33 | </div> |
| 33 | 34 | <!-- caption 组件END --> |
| 34 | 35 | <div class="tools" style="margin-left: 20px;margin-top: -10px;"> |
| ... | ... | @@ -92,7 +93,7 @@ |
| 92 | 93 | <!-- portlet-title组件END --> |
| 93 | 94 | |
| 94 | 95 | <!-- portlet-body组件START --> |
| 95 | - <div class="portlet-body"> | |
| 96 | + <div class="portlet-body" id="scrllmouseEvent"> | |
| 96 | 97 | <!-- ganttSvgContainer SVG组件START --> |
| 97 | 98 | <div class="ganttSvgContainer"> |
| 98 | 99 | <div id="ganttSvg"></div> | ... | ... |
src/main/resources/static/pages/base/timesmodel/js/add-form-wizard.js
| ... | ... | @@ -612,8 +612,9 @@ var SKBFormWizard = function() { |
| 612 | 612 | function submit(p,argus) { |
| 613 | 613 | storage.setItem("Gantt_AgursData",JSON.stringify(argus)); |
| 614 | 614 | if(p!=null) { |
| 615 | - console.log(JSON.stringify(p.rsLp)); | |
| 616 | 615 | storage.setItem('isDoDate',JSON.stringify({'rsD':p.rsD,'rsLP':p.rsLp})); |
| 616 | + }else { | |
| 617 | + storage.setItem('isDoDate',''); | |
| 617 | 618 | } |
| 618 | 619 | loadPage('gantt.html'); |
| 619 | 620 | } | ... | ... |
src/main/resources/static/pages/base/timesmodel/js/base-fun.js
| ... | ... | @@ -269,11 +269,11 @@ var BaseFun = function() { |
| 269 | 269 | for(var a =0;a<carArray.length;a++) { |
| 270 | 270 | var _mmstartTime = baseF.getDateTime(gatps.earlyStartTime);// 获取早高峰开始时间点,并转为时间对象. |
| 271 | 271 | var tempTime = new Date(_mmstartTime.setMinutes(_mmstartTime.getMinutes()-(ca.length-parseInt(carArray[a].lpNo))*ma[0].fcjx)); |
| 272 | - var cctag = baseF.getdefaultDir(dataMap.smbcsjArr);// 获取出场类型 [0--上行出场;1--下行出场] | |
| 272 | + var cctag = gatps.linePlayType=='1' ? 0 : baseF.getdefaultDir(dataMap.smbcsjArr);// 获取出场类型 [0--上行出场;1--下行出场] | |
| 273 | 273 | var kssj = baseF.getDateTime(time[0]); // 获取该时段的开始时间点,并转为时间对象. |
| 274 | 274 | var sjAndDir = baseF.getBeganTime(tempTime,kssj,type, ma,dataMap.zgfsjd,dataMap.wgfsjd,dataMap.pcxssjArr,dataMap.gfxxsjArr,cctag, dataMap.ztjxA);// 计算当前路牌第一个首班时间点. |
| 275 | 275 | kssj = sjAndDir.d1; |
| 276 | - cctag = sjAndDir.dir; | |
| 276 | + cctag = gatps.linePlayType=='1' ? 0 : sjAndDir.dir; | |
| 277 | 277 | var endTime = baseF.getDateTime( |
| 278 | 278 | baseF.getEndStrt(type,dataMap.smbcsjArr,time[1],cctag));// 获取该时段的结束时间点,并转为时间对象. |
| 279 | 279 | var $_cfn = 0,$_cfw = 0; |
| ... | ... | @@ -287,7 +287,7 @@ var BaseFun = function() { |
| 287 | 287 | dataMap.dira[cctag],xhNo++,dataMap.cclcArr[cctag],gatps,0,dataMap.qdzArr[cctag],null,null,0,0));// 出场班次 |
| 288 | 288 | var fxTagDm = 0; |
| 289 | 289 | while(kssj<=endTime) { |
| 290 | - cctag = baseF.getfx(fxTagDm,cctag); | |
| 290 | + cctag = gatps.linePlayType=='1' ? 0 : baseF.getfx(fxTagDm,cctag); | |
| 291 | 291 | fxTagDm = 1; |
| 292 | 292 | if(kssj> new Date (baseF.getCFDate(10,30)) && |
| 293 | 293 | kssj<new Date (baseF.getCFDate(12,0)) && $_cfn<1 ) { |
| ... | ... | @@ -556,7 +556,6 @@ var BaseFun = function() { |
| 556 | 556 | getRankRule : function(list,clzs,seMap) { |
| 557 | 557 | // 定义班型人次数据的长度.路牌数组长度. |
| 558 | 558 | var bxgs = list.data.length,clzslen = clzs.length; |
| 559 | - | |
| 560 | 559 | /** |
| 561 | 560 | * 分配规则:获取总人数与车辆数的关系.返回值[-1-- 总人数小与车辆总数; 0--总人数等于车辆数; 1--总人数大与车辆数] |
| 562 | 561 | * |
| ... | ... | @@ -570,6 +569,7 @@ var BaseFun = function() { |
| 570 | 569 | * */ |
| 571 | 570 | switch(baseF.isrcNumEqualCarNum(list.rsa,clzslen)){ |
| 572 | 571 | case -1: |
| 572 | + baseF.fprclp(bxgs,list,clzs); | |
| 573 | 573 | break; |
| 574 | 574 | case 0: |
| 575 | 575 | // 判断.班型人次是否为一种还是多种情况. |
| ... | ... | @@ -584,6 +584,7 @@ var BaseFun = function() { |
| 584 | 584 | case 1: |
| 585 | 585 | // 定义最大工时值. |
| 586 | 586 | var maxhoursV = parseFloat((((baseF.getDateTime(seMap.e) - baseF.getDateTime(seMap.s))/60000)/60).toFixed(2)); |
| 587 | + // var maxhoursV = 24; | |
| 587 | 588 | // 定义总人数. |
| 588 | 589 | var rsdx = 0 ; |
| 589 | 590 | for(var n = 0 ; n < list.rsa.length;n++) { |
| ... | ... | @@ -598,9 +599,9 @@ var BaseFun = function() { |
| 598 | 599 | for(var a = b ; a<bxgs; a++) { |
| 599 | 600 | var pphours = list.data[a].hoursV; |
| 600 | 601 | var zhnum = pphours+dqhours; |
| 601 | - if(zhnum>maxhoursV) | |
| 602 | + if(zhnum>maxhoursV){ | |
| 602 | 603 | continue; |
| 603 | - else if(zhnum<maxhoursV) { | |
| 604 | + }else if(zhnum<maxhoursV) { | |
| 604 | 605 | zhHoursA.push({'bx1':list.data[b].type,'bx2':list.data[a].type,'countGs':zhnum}); |
| 605 | 606 | } |
| 606 | 607 | |
| ... | ... | @@ -608,43 +609,53 @@ var BaseFun = function() { |
| 608 | 609 | } |
| 609 | 610 | // 按照工时倒序排序. |
| 610 | 611 | zhHoursA.sort(function(a,b){return b.countGs-a.countGs}); |
| 611 | - var bxppA = zhHoursA[0],clp = null,dlp = null,pqobj = new Array(),bxpprc= new Array(); | |
| 612 | - for(var m = 0 ; m<list.data.length;m++) { | |
| 613 | - if(list.data[m].type==bxppA.bx1 || list.data[m].type==bxppA.bx2) { | |
| 614 | - bxpprc.push(list.data[m].rs); | |
| 615 | - var czDx = list.data[m].rs - _rcDx; | |
| 616 | - if(czDx<0) { | |
| 617 | - var djbctype = null,absInt = Math.abs(czDx); | |
| 618 | - if(list.data[m].type==bxppA.bx1) | |
| 619 | - djbctype = bxppA.bx2; | |
| 620 | - else if(list.data[m].type==bxppA.bx2) | |
| 621 | - djbctype = bxppA.bx1; | |
| 622 | - var bqbc = zhHoursA[1]; | |
| 623 | - for(var k = 0 ; k<bxgs ; k++) { | |
| 624 | - if(list.data[k].type == djbctype) | |
| 625 | - list.data[k].rs = list.data[k].rs + Math.abs(czDx); | |
| 626 | - if(list.data[k].type==bqbc.bx1 || list.data[k].type==bqbc.bx2) { | |
| 627 | - if(bqbc.bx1==bqbc.bx2) | |
| 628 | - list.data[k].rs = list.data[k].rs - absInt*2; | |
| 629 | - else if(bqbc.bx1!=bqbc.bx2) | |
| 630 | - list.data[k].rs = list.data[k].rs - absInt; | |
| 612 | + if(zhHoursA.length>0) { | |
| 613 | + var bxppA = zhHoursA[0],clp = null,dlp = null,pqobj = new Array(),bxpprc= new Array(); | |
| 614 | + for(var m = 0 ; m<list.data.length;m++) { | |
| 615 | + if(list.data[m].type==bxppA.bx1 || list.data[m].type==bxppA.bx2) { | |
| 616 | + bxpprc.push(list.data[m].rs); | |
| 617 | + var czDx = list.data[m].rs - _rcDx; | |
| 618 | + if(czDx<0) { | |
| 619 | + var djbctype = null,absInt = Math.abs(czDx); | |
| 620 | + if(list.data[m].type==bxppA.bx1) | |
| 621 | + djbctype = bxppA.bx2; | |
| 622 | + else if(list.data[m].type==bxppA.bx2) | |
| 623 | + djbctype = bxppA.bx1; | |
| 624 | + var bqbc = zhHoursA[1]; | |
| 625 | + for(var k = 0 ; k<bxgs ; k++) { | |
| 626 | + if(list.data[k].type == djbctype) | |
| 627 | + list.data[k].rs = list.data[k].rs + Math.abs(czDx); | |
| 628 | + if(list.data[k].type==bqbc.bx1 || list.data[k].type==bqbc.bx2) { | |
| 629 | + if(bqbc.bx1==bqbc.bx2) | |
| 630 | + list.data[k].rs = list.data[k].rs - absInt*2; | |
| 631 | + else if(bqbc.bx1!=bqbc.bx2) | |
| 632 | + list.data[k].rs = list.data[k].rs - absInt; | |
| 633 | + } | |
| 631 | 634 | } |
| 635 | + pqobj.push({'type':bqbc.bx1 + '</br></br>' + bqbc.bx2 ,'minueV':bqbc.countGs,'rs':absInt}); | |
| 636 | + } | |
| 637 | + czDx = czDx < 0 ? 0:czDx; | |
| 638 | + list.data[m].rs = czDx; | |
| 639 | + if(list.data[m].rs<=0) { | |
| 640 | + list.data.splice(m,1); | |
| 641 | + m--; | |
| 632 | 642 | } |
| 633 | - pqobj.push({'type':bqbc.bx1 + '</br></br>' + bqbc.bx2 ,'minueV':bqbc.countGs,'rs':absInt}); | |
| 634 | - } | |
| 635 | - czDx = czDx < 0 ? 0:czDx; | |
| 636 | - list.data[m].rs = czDx; | |
| 637 | - if(list.data[m].rs<=0) { | |
| 638 | - list.data.splice(m,1); | |
| 639 | - m--; | |
| 640 | 643 | } |
| 641 | 644 | } |
| 645 | + list.data.push({'type':bxppA.bx1 + '</br></br>' + bxppA.bx2 , | |
| 646 | + 'minueV' : bxppA.countGs, | |
| 647 | + 'rs':Math.min.apply(null, bxpprc) <_rcDx ? Math.min.apply(null, bxpprc) : _rcDx}); | |
| 648 | + if(pqobj.length>0) | |
| 649 | + list.data.push(pqobj[0]); | |
| 650 | + }else { | |
| 651 | + list.data.sort(function(a,b){return (b.rs*b.hoursV)-(a.rs*a.hoursV)}); | |
| 652 | + var fpchuqugs = Math.abs(_rcDx) * parseFloat(list.data[0].hoursV); | |
| 653 | + var avglp = parseFloat((fpchuqugs / clzslen).toFixed(2)); | |
| 654 | + list.data[0].rs = list.data[0].rs - Math.abs(_rcDx); | |
| 655 | + for(var c = 0 ;c <list.data.length;c++) { | |
| 656 | + list.data[c].hoursV = parseFloat(list.data[c].hoursV) + avglp; | |
| 657 | + } | |
| 642 | 658 | } |
| 643 | - list.data.push({'type':bxppA.bx1 + '</br></br>' + bxppA.bx2 , | |
| 644 | - 'minueV' : bxppA.countGs, | |
| 645 | - 'rs':Math.min.apply(null, bxpprc) <_rcDx ? Math.min.apply(null, bxpprc) : _rcDx}); | |
| 646 | - if(pqobj.length>0) | |
| 647 | - list.data.push(pqobj[0]); | |
| 648 | 659 | list.data.sort(function(a,b){return b.rs-a.rs}); |
| 649 | 660 | baseF.fprclp(list.data.length,list,clzs); |
| 650 | 661 | break; |
| ... | ... | @@ -749,13 +760,13 @@ var BaseFun = function() { |
| 749 | 760 | var _mmstartTime = baseF.getDateTime(map.earlyStartTime);// 获取早高峰开始时间点,并转为时间对象. |
| 750 | 761 | var tempTime = new Date(_mmstartTime.setMinutes(_mmstartTime.getMinutes()-(len - cara[c].lpNo)*saa[0].fcjx)); |
| 751 | 762 | var kssj = dataMap.zgfsjd[0].st; |
| 752 | - var cctag = baseF.getdefaultDir(dataMap.smbcsjArr);// 获取出场类型 [0--上行出场;1--下行出场] | |
| 763 | + var cctag = map.linePlayType=='1' ? 0 : baseF.getdefaultDir(dataMap.smbcsjArr);// 获取出场类型 [0--上行出场;1--下行出场] | |
| 753 | 764 | var sjAndDir = baseF.getBeganTime(tempTime,kssj,null, saa,dataMap.zgfsjd,dataMap.wgfsjd,dataMap.pcxssjArr,dataMap.gfxxsjArr,cctag, dataMap.ztjxA);// 计算当前路牌第一个首班时间点. |
| 754 | 765 | kssj = sjAndDir.d1; |
| 755 | - cctag = sjAndDir.dir; | |
| 766 | + cctag = map.linePlayType=='1' ? 0 : sjAndDir.dir; | |
| 756 | 767 | var endTime = baseF.getDateTime(seMap.e),fxTagDm = 0 , xhNo = 3,$_cfn = 0,$_cfw = 0; |
| 757 | 768 | while(kssj<=endTime) { |
| 758 | - cctag = baseF.getfx(fxTagDm,cctag); | |
| 769 | + cctag = map.linePlayType=='1' ? 0 : baseF.getfx(fxTagDm,cctag); | |
| 759 | 770 | fxTagDm = 1; |
| 760 | 771 | if(kssj> new Date (baseF.getCFDate(10,30)) && |
| 761 | 772 | kssj<new Date (baseF.getCFDate(12,0)) && $_cfn<1 ) { |
| ... | ... | @@ -783,6 +794,10 @@ var BaseFun = function() { |
| 783 | 794 | return rs; |
| 784 | 795 | }, |
| 785 | 796 | |
| 797 | + /** | |
| 798 | + * @description : (TODO) 该方法可去除. | |
| 799 | + * | |
| 800 | + * */ | |
| 786 | 801 | getGfData : function (type, saa , cara , map, seMap ,dataMap,len,car) { |
| 787 | 802 | var _mmstartTime = null,kssj = null,end = null ,result = new Array(),fxTagDm = 0 , xhNo = 0; |
| 788 | 803 | if(type == 'mm') { |
| ... | ... | @@ -1093,11 +1108,11 @@ var BaseFun = function() { |
| 1093 | 1108 | return sortGattArray; |
| 1094 | 1109 | }, |
| 1095 | 1110 | addbc : function(obj,lastObj,kssj,tzsj,xhNo,jsonArray,num) { |
| 1096 | - var cctag = baseF.dirDmToIndex(lastObj.xlDir); | |
| 1111 | + var cctag = obj.configuration.dataMap.map.linePlayType=='1' ? 0 : baseF.dirDmToIndex(lastObj.xlDir); | |
| 1097 | 1112 | var carArray = {'lp':lastObj.lp,'lpNo':lastObj.lpNo,'lpName':lastObj.lpName,'lpType':lastObj.lpType}; |
| 1098 | 1113 | var ags = {'tcc_id':lastObj.tcc,'skbName':lastObj.ttinfo,'lineName':lastObj.xl+'_'}; |
| 1099 | 1114 | for(var t = 0 ; t<num;t++){ |
| 1100 | - cctag = baseF.getfx(1,cctag); | |
| 1115 | + cctag = obj.configuration.dataMap.map.linePlayType=='1'? 0: baseF.getfx(1,cctag); | |
| 1101 | 1116 | var _xxsj = baseF.getxssj(obj.configuration.dataMap.zgfsjd, |
| 1102 | 1117 | obj.configuration.dataMap.wgfsjd, |
| 1103 | 1118 | kssj, |
| ... | ... | @@ -1172,7 +1187,7 @@ var BaseFun = function() { |
| 1172 | 1187 | var _mmstartTime = new Date(obj.configuration.dataMap.zgfsjd[0].st); |
| 1173 | 1188 | var tempTime = new Date(_mmstartTime.setMinutes(_mmstartTime.getMinutes()- |
| 1174 | 1189 | ((parseInt(obj.configuration.dataMap.map.clzs)-parseInt(theCar)))*obj.configuration.stopAraay[0].fcjx)); |
| 1175 | - var cctag = bf.getdefaultDir(obj.configuration.dataMap.smbcsjArr);// 获取出场类型 [0--上行出场;1--下行出场] | |
| 1190 | + var cctag = obj.configuration.dataMap.map.linePlayType=='1' ? 0 : bf.getdefaultDir(obj.configuration.dataMap.smbcsjArr);// 获取出场类型 [0--上行出场;1--下行出场] | |
| 1176 | 1191 | var kssj = new Date(obj.configuration.dataMap.zgfsjd[0].st); // 获取该时段的开始时间点,并转为时间对象. |
| 1177 | 1192 | var sjAndDir = bf.getBeganTime(tempTime,kssj,null, |
| 1178 | 1193 | obj.configuration.stopAraay, |
| ... | ... | @@ -1181,7 +1196,7 @@ var BaseFun = function() { |
| 1181 | 1196 | obj.configuration.dataMap.pcxssjArr, |
| 1182 | 1197 | obj.configuration.dataMap.gfxxsjArr,cctag, obj.configuration.dataMap.ztjxA);// 计算当前路牌第一个首班时间点. |
| 1183 | 1198 | kssj = sjAndDir.d1; |
| 1184 | - cctag = sjAndDir.dir; | |
| 1199 | + cctag = obj.configuration.dataMap.map.linePlayType=='1' ? 0 : sjAndDir.dir; | |
| 1185 | 1200 | dqlpbc.push(bf.getbcObj( |
| 1186 | 1201 | kssj,obj.configuration.dataMap.ccsjArr[cctag], |
| 1187 | 1202 | car,obj.configuration.dataMap.bcTypeArr.bd, |
| ... | ... | @@ -1196,7 +1211,7 @@ var BaseFun = function() { |
| 1196 | 1211 | obj.configuration.dataMap.qdzArr[cctag],null,null,0,0));// 出场班次 |
| 1197 | 1212 | var fxTagDm = 0; |
| 1198 | 1213 | for(var i = 0 ; i<numqs;i++) { |
| 1199 | - cctag = bf.getfx(fxTagDm,cctag); | |
| 1214 | + cctag = obj.configuration.dataMap.map.linePlayType=='1' ? 0 : bf.getfx(fxTagDm,cctag); | |
| 1200 | 1215 | fxTagDm = 1; |
| 1201 | 1216 | var _xxsj = bf.getxssj(obj.configuration.dataMap.zgfsjd, |
| 1202 | 1217 | obj.configuration.dataMap.wgfsjd,kssj, | ... | ... |
src/main/resources/static/pages/base/timesmodel/js/d3.relationshipgraph.js
| ... | ... | @@ -1242,11 +1242,13 @@ var RelationshipGraph = function () { |
| 1242 | 1242 | //console.log(tempa); |
| 1243 | 1243 | //console.log(tempa.upArr.concat(tempa.downArr).length); |
| 1244 | 1244 | // 5、均匀上行班次的发车间距. |
| 1245 | - BaseFun.jhfcjx(tempa.upArr,upDir,zzsj,$_GlobalGraph.configuration.dataMap); | |
| 1245 | + if(tempa.upArr.length>0) | |
| 1246 | + BaseFun.jhfcjx(tempa.upArr,upDir,zzsj,$_GlobalGraph.configuration.dataMap); | |
| 1246 | 1247 | //var sxbc = BaseFun.jhfcjx(tempa.upArr,upDir,zzsj,$_GlobalGraph.configuration.dataMap); |
| 1247 | 1248 | //console.log('getDirBc---- '+tempa.downArr.length); |
| 1248 | 1249 | // 6、均匀下行班次的发车间距. |
| 1249 | - BaseFun.jhfcjx(tempa.downArr,downDir,zzsj,$_GlobalGraph.configuration.dataMap); | |
| 1250 | + if(tempa.downArr.length>0) | |
| 1251 | + BaseFun.jhfcjx(tempa.downArr,downDir,zzsj,$_GlobalGraph.configuration.dataMap); | |
| 1250 | 1252 | //var xxbc = BaseFun.jhfcjx(tempa.downArr,downDir,zzsj,$_GlobalGraph.configuration.dataMap); |
| 1251 | 1253 | //console.log('jhfcjx---'+ xxbc.length); |
| 1252 | 1254 | //console.log(sxbc.concat(xxbc).length); | ... | ... |
src/main/resources/static/pages/base/timesmodel/js/gantt.js
| ... | ... | @@ -10,8 +10,28 @@ |
| 10 | 10 | var objD = window.localStorage.isDoDate; |
| 11 | 11 | // 获取表单参数配置数据. |
| 12 | 12 | var map = JSON.parse(window.localStorage.Gantt_AgursData); |
| 13 | + $('.skmxTitle').text( '【' + map.skbmc + '】' + '时刻表明细模型'); | |
| 13 | 14 | // 延迟500毫秒执行. |
| 14 | 15 | setTimeout(function(){ |
| 16 | + var offsetY = -parseInt($('.offset').offset().top)+16; | |
| 17 | + var offsetX = -parseInt($('.offset').offset().left)+50; | |
| 18 | + $('.tipso-animation').tipso({ | |
| 19 | + speed : 100, | |
| 20 | + background : '#E91E63', | |
| 21 | + color : '#E91E63', | |
| 22 | + position :'right', | |
| 23 | + width : 410, | |
| 24 | + delay : 400, | |
| 25 | + animationIn : 'bounceIn', | |
| 26 | + animationOut : 'bounceOut', | |
| 27 | + offsetX : offsetX, | |
| 28 | + offsetY : offsetY, | |
| 29 | + content :'<div class="tipsdscontinue"> <span>图例:</span> <div class="dscrp sx"></div><span>:上行</span> <div class="dscrp xx"></div> <span>:下行</span></br><div/></br>' + | |
| 30 | + '<div class="tipsdscontinue"> <span>该模块支持鼠标拖拽、鼠标绘制(鼠标右键按下3S开始)框选功能.</span> <div/>' | |
| 31 | + | |
| 32 | + }); | |
| 33 | + $('.tipso-animation').tipso('show'); | |
| 34 | + setTimeout(function(){$('.tipso-animation').tipso('hide');},4000); | |
| 15 | 35 | // 1、定义开始与结束时间点字符串. |
| 16 | 36 | var seMap = getStartAndEndDate(map); |
| 17 | 37 | // 2、获取开始与结束时间对象. |
| ... | ... | @@ -47,8 +67,6 @@ |
| 47 | 67 | |
| 48 | 68 | }else { |
| 49 | 69 | var jsonA = JSON.parse(objD); |
| 50 | - console.log(jsonA.rsD); | |
| 51 | - console.log(jsonA.rsLP); | |
| 52 | 70 | // 使用已有的时刻表明细数据渲染视图. |
| 53 | 71 | data = {'json':jsonA.rsD,'bxrcgs':null}; |
| 54 | 72 | CSMap = {'gattA':null,'stopSpace': Math.round(map.zzsj/map.clzs),'maxCar':jsonA.rsLP}; |
| ... | ... | @@ -153,8 +171,8 @@ |
| 153 | 171 | * @return 返回开始与结束时间字符串集合. |
| 154 | 172 | * */ |
| 155 | 173 | function getStartAndEndDate(map) { |
| 156 | - return {'s':getMinDate(map.startStationFirstTime,map.endStationFirstTime), | |
| 157 | - 'e':getMaxDate(map.startStationEndTime,map.endStationEndTime)} | |
| 174 | + return {'s': map.linePlayType=='1'? map.startStationFirstTime : getMinDate(map.startStationFirstTime,map.endStationFirstTime), | |
| 175 | + 'e': map.linePlayType=='1'? map.startStationEndTime : getMaxDate(map.startStationEndTime,map.endStationEndTime)} | |
| 158 | 176 | } |
| 159 | 177 | |
| 160 | 178 | /** |
| ... | ... | @@ -676,4 +694,10 @@ |
| 676 | 694 | layer.closeAll(); |
| 677 | 695 | layer.msg('操作成功!已【'+ msg + '】!'); |
| 678 | 696 | } |
| 697 | + | |
| 698 | + $('#scrllmouseEvent').on('mousemove',function() { | |
| 699 | + $('.ganttSvgContainer').css('overflow','auto'); | |
| 700 | + }).on('mouseleave',function() { | |
| 701 | + $('.ganttSvgContainer').css('overflow','hidden'); | |
| 702 | + }); | |
| 679 | 703 | })(); |
| 680 | 704 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/timesmodel/reladplus.html
| ... | ... | @@ -102,7 +102,7 @@ $('#reladplus_mobal').on('reladplusMobal.show', function(e,obj,bf,cardata){ |
| 102 | 102 | var zhbcA = bf.getLastTime(jsonArray,params.theCar); |
| 103 | 103 | if(zhbcA.length>0) { |
| 104 | 104 | var lastObj = zhbcA[0]; |
| 105 | - var cctag = bf.dirDmToIndex(lastObj.xlDir); | |
| 105 | + var cctag = obj.configuration.dataMap.map.linePlayType=='1' ? 0 : bf.dirDmToIndex(lastObj.xlDir); | |
| 106 | 106 | // cctag = baseF.getfx(0,cctag); |
| 107 | 107 | // 定义停站时间 |
| 108 | 108 | var tzsj = obj.configuration.dataMap.ztjxA[cctag]; | ... | ... |
src/main/resources/static/real_control_v2/fragments/north/nav/all_devices.html
| 1 | 1 | <div class="uk-modal ct_move_modal" id="all-devices-modal"> |
| 2 | - <div class="uk-modal-dialog" style="width: 1100px;"> | |
| 2 | + <div class="uk-modal-dialog" style="width: 1140px;"> | |
| 3 | 3 | <a href="" class="uk-modal-close uk-close"></a> |
| 4 | 4 | <div class="uk-modal-header"> |
| 5 | 5 | <h2>所有接入平台的设备</h2></div> |
| ... | ... | @@ -25,6 +25,14 @@ |
| 25 | 25 | <div class="uk-autocomplete uk-form autocomplete-device" > |
| 26 | 26 | <input type="text" name="deviceId" placeholder="设备号"> |
| 27 | 27 | </div> |
| 28 | + <span class="horizontal-field">来源</span> | |
| 29 | + <div class="uk-autocomplete uk-form" > | |
| 30 | + <select name="source"> | |
| 31 | + <option value="">全部</option> | |
| 32 | + <option value="1">网关</option> | |
| 33 | + <option value="0">转发</option> | |
| 34 | + </select> | |
| 35 | + </div> | |
| 28 | 36 | <button class="uk-button">检索</button> |
| 29 | 37 | </fieldset> |
| 30 | 38 | </form> |
| ... | ... | @@ -35,12 +43,13 @@ |
| 35 | 43 | <tr> |
| 36 | 44 | <th style="width: 14%;">线路</th> |
| 37 | 45 | <th style="width: 14%;">站点</th> |
| 38 | - <th style="width: 13%;">车辆</th> | |
| 39 | - <th style="width: 13%;">设备号</th> | |
| 40 | - <th style="width: 10%;">速度</th> | |
| 41 | - <th style="width: 10%;">上下行</th> | |
| 46 | + <th style="width: 11%;">车辆</th> | |
| 47 | + <th style="width: 11%;">设备号</th> | |
| 48 | + <th style="width: 9%;">速度</th> | |
| 49 | + <th style="width: 9%;">上下行</th> | |
| 42 | 50 | <th style="width: 10%;">程序版本</th> |
| 43 | 51 | <th>最后GPS时间</th> |
| 52 | + <th style="width: 8%;">来源</th> | |
| 44 | 53 | </tr> |
| 45 | 54 | </thead> |
| 46 | 55 | <tbody> |
| ... | ... | @@ -63,6 +72,15 @@ |
| 63 | 72 | <td>{{gps.upDown}}</td> |
| 64 | 73 | <td>{{gps.version}}</td> |
| 65 | 74 | <td>{{gps.timeStr}}</td> |
| 75 | + <td> | |
| 76 | + {{if gps.source==1}} | |
| 77 | + <span style="color: #1e1ef5;" title="已切换至新网关">网关</span> | |
| 78 | + {{else if gps.source==0}} | |
| 79 | + <span style="color: #8e8e8e;" title="转接的数据,无法下发指令">转发</span> | |
| 80 | + {{else}} | |
| 81 | + <span>未知</span> | |
| 82 | + {{/if}} | |
| 83 | + </td> | |
| 66 | 84 | </tr> |
| 67 | 85 | {{/each}} |
| 68 | 86 | </script> | ... | ... |