Commit b650a337186b4ce90c29e53b7134db5ee1706708
Merge branch 'minhang' of
http://222.66.0.204:8090/panzhaov5/bsth_control into minhang
Showing
84 changed files
with
1906 additions
and
534 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; | |
| 5 | +import com.bsth.data.msg_queue.DirectivePushQueue; | |
| 6 | +import com.bsth.data.msg_queue.WebSocketPushQueue; | |
| 4 | 7 | import com.bsth.data.schedule.DayOfSchedule; |
| 5 | 8 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 6 | 9 | import org.slf4j.Logger; |
| ... | ... | @@ -55,4 +58,21 @@ public class anomalyCheckController { |
| 55 | 58 | public void shutdownThreadPool(){ |
| 56 | 59 | GpsRealAnalyse.shutdown(); |
| 57 | 60 | } |
| 61 | + | |
| 62 | + @RequestMapping(value = "/directivePushQueue") | |
| 63 | + public void directivePushQueue(){ | |
| 64 | + DirectivePushQueue.start(); | |
| 65 | + } | |
| 66 | + | |
| 67 | + @RequestMapping(value = "/webSocketPushQueue") | |
| 68 | + public void webSocketPushQueue(){ | |
| 69 | + WebSocketPushQueue.start(); | |
| 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 | + } | |
| 58 | 78 | } | ... | ... |
src/main/java/com/bsth/data/BasicData.java
src/main/java/com/bsth/data/ThreadMonotor.java
0 → 100644
| 1 | +package com.bsth.data; | |
| 2 | + | |
| 3 | +import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; | |
| 4 | +import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; | |
| 5 | +import com.bsth.data.msg_queue.DirectivePushQueue; | |
| 6 | +import com.bsth.data.msg_queue.WebSocketPushQueue; | |
| 7 | +import org.slf4j.Logger; | |
| 8 | +import org.slf4j.LoggerFactory; | |
| 9 | +import org.springframework.stereotype.Component; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * Created by panzhao on 2017/5/11. | |
| 13 | + */ | |
| 14 | +@Component | |
| 15 | +public class ThreadMonotor extends Thread{ | |
| 16 | + | |
| 17 | + Logger log = LoggerFactory.getLogger(this.getClass()); | |
| 18 | + | |
| 19 | + @Override | |
| 20 | + public void run() { | |
| 21 | + | |
| 22 | + //线调GPS分析主线程 | |
| 23 | + if(GpsRealAnalyse.isBlock()){ | |
| 24 | + log.warn("GpsRealAnalyse isBlock true !!!!"); | |
| 25 | + GpsRealAnalyse.shutdown(); | |
| 26 | + } | |
| 27 | + | |
| 28 | + if(GpsRealAnalyse.isIdle()){ | |
| 29 | + //尝试使用网关的GPS实时对照数据 | |
| 30 | + GpsDataLoaderThread.setFlag(-1); | |
| 31 | + } | |
| 32 | + | |
| 33 | + //webSocket 消息推送队列 | |
| 34 | + if(WebSocketPushQueue.isIdle()){ | |
| 35 | + log.warn("WebSocketPushQueue isIdle true !!!!"); | |
| 36 | + WebSocketPushQueue.start(); | |
| 37 | + } | |
| 38 | + | |
| 39 | + //网关指令推送队列(系统自动发送的) | |
| 40 | + if(DirectivePushQueue.isIdle()){ | |
| 41 | + log.warn("DirectivePushQueue isIdle true !!!!"); | |
| 42 | + DirectivePushQueue.start(); | |
| 43 | + } | |
| 44 | + } | |
| 45 | +} | ... | ... |
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/directive/DayOfDirectives.java
| ... | ... | @@ -57,10 +57,11 @@ public class DayOfDirectives { |
| 57 | 57 | pstDirectives = new LinkedList<>(); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - public void put60(D60 d60) { | |
| 60 | + public void put60(D60 d60, boolean pst) { | |
| 61 | 61 | d60Map.put(d60.getMsgId(), d60); |
| 62 | 62 | //等待持久化 |
| 63 | - pstDirectives.add(d60); | |
| 63 | + if(pst) | |
| 64 | + pstDirectives.add(d60); | |
| 64 | 65 | } |
| 65 | 66 | |
| 66 | 67 | public void put64(D64 d64) { | ... | ... |
src/main/java/com/bsth/data/directive/GatewayHttpUtils.java
| ... | ... | @@ -41,8 +41,8 @@ public class GatewayHttpUtils { |
| 41 | 41 | |
| 42 | 42 | //超时时间 |
| 43 | 43 | RequestConfig requestConfig = RequestConfig.custom() |
| 44 | - .setConnectTimeout(3000).setConnectionRequestTimeout(1000) | |
| 45 | - .setSocketTimeout(3000).build(); | |
| 44 | + .setConnectTimeout(1500).setConnectionRequestTimeout(1000) | |
| 45 | + .setSocketTimeout(1500).build(); | |
| 46 | 46 | |
| 47 | 47 | HttpPost post = new HttpPost(url); |
| 48 | 48 | ... | ... |
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/GpsEntity.java
| ... | ... | @@ -88,6 +88,13 @@ public class GpsEntity { |
| 88 | 88 | /** gps是否有效 设备端发送的状态 */ |
| 89 | 89 | private int valid; |
| 90 | 90 | |
| 91 | + /** | |
| 92 | + * 数据来源 | |
| 93 | + * 1:网关 | |
| 94 | + * 0:转发 | |
| 95 | + */ | |
| 96 | + private int source; | |
| 97 | + | |
| 91 | 98 | public String getDeviceId() { |
| 92 | 99 | return deviceId; |
| 93 | 100 | } |
| ... | ... | @@ -292,4 +299,12 @@ public class GpsEntity { |
| 292 | 299 | public void setSpeed(Float speed) { |
| 293 | 300 | this.speed = speed; |
| 294 | 301 | } |
| 302 | + | |
| 303 | + public int getSource() { | |
| 304 | + return source; | |
| 305 | + } | |
| 306 | + | |
| 307 | + public void setSource(int source) { | |
| 308 | + this.source = source; | |
| 309 | + } | |
| 295 | 310 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| ... | ... | @@ -2,9 +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 | -import com.bsth.data.gpsdata.thread.ThreadPollMonitor; | |
| 8 | 5 | import com.bsth.data.schedule.DayOfSchedule; |
| 9 | 6 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 10 | 7 | import com.google.common.collect.TreeMultimap; |
| ... | ... | @@ -12,7 +9,6 @@ import org.apache.commons.lang3.StringUtils; |
| 12 | 9 | import org.slf4j.Logger; |
| 13 | 10 | import org.slf4j.LoggerFactory; |
| 14 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | -import org.springframework.boot.CommandLineRunner; | |
| 16 | 12 | import org.springframework.stereotype.Component; |
| 17 | 13 | |
| 18 | 14 | import java.util.*; |
| ... | ... | @@ -26,7 +22,7 @@ import java.util.concurrent.ConcurrentMap; |
| 26 | 22 | * @date 2016年8月12日 下午2:04:41 |
| 27 | 23 | */ |
| 28 | 24 | @Component |
| 29 | -public class GpsRealData implements CommandLineRunner { | |
| 25 | +public class GpsRealData { | |
| 30 | 26 | |
| 31 | 27 | static Logger logger = LoggerFactory.getLogger(GpsRealData.class); |
| 32 | 28 | |
| ... | ... | @@ -36,20 +32,11 @@ public class GpsRealData implements CommandLineRunner { |
| 36 | 32 | private static TreeMultimap<String, String> lineCode2Devices; |
| 37 | 33 | |
| 38 | 34 | @Autowired |
| 39 | - GpsDataLoaderThread gpsDataLoader; | |
| 40 | - | |
| 41 | - @Autowired | |
| 42 | - OfflineMonitorThread offlineMonitorThread; | |
| 43 | - | |
| 44 | - @Autowired | |
| 45 | 35 | DayOfSchedule dayOfSchedule; |
| 46 | 36 | |
| 47 | 37 | @Autowired |
| 48 | 38 | ForecastRealServer forecastRealServer; |
| 49 | 39 | |
| 50 | - @Autowired | |
| 51 | - ThreadPollMonitor threadPollMonitor; | |
| 52 | - | |
| 53 | 40 | /** |
| 54 | 41 | * 构造函数 |
| 55 | 42 | */ |
| ... | ... | @@ -58,19 +45,6 @@ public class GpsRealData implements CommandLineRunner { |
| 58 | 45 | lineCode2Devices = TreeMultimap.create(); |
| 59 | 46 | } |
| 60 | 47 | |
| 61 | - @Override | |
| 62 | - public void run(String... arg0) throws Exception { | |
| 63 | - logger.info("gpsDataLoader,20,3"); | |
| 64 | - //http形式获取GPS数据 | |
| 65 | - //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 2, TimeUnit.SECONDS); | |
| 66 | - //定时扫描掉离线 | |
| 67 | - //Application.mainServices.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS); | |
| 68 | - | |
| 69 | - //扫描GPS线程池状态 | |
| 70 | - //Application.mainServices.scheduleWithFixedDelay(threadPollMonitor, 60, 20, TimeUnit.SECONDS); | |
| 71 | - | |
| 72 | - } | |
| 73 | - | |
| 74 | 48 | |
| 75 | 49 | public void put(GpsEntity gps) { |
| 76 | 50 | String device = gps.getDeviceId(); |
| ... | ... | @@ -89,19 +63,29 @@ public class GpsRealData implements CommandLineRunner { |
| 89 | 63 | gps.setExpectStopTime(forecastRealServer.expectStopTime(gps.getNbbm())); |
| 90 | 64 | } |
| 91 | 65 | } |
| 92 | - } catch (Exception e) { | |
| 93 | - logger.error("", e); | |
| 94 | - } | |
| 95 | 66 | |
| 96 | - //刷新对照 | |
| 97 | - gpsMap.put(device, gps); | |
| 98 | - if (StringUtils.isNotBlank(gps.getLineId())) { | |
| 99 | - //站点名称 | |
| 100 | - gps.setStationName(getStationName(gps)); | |
| 101 | - lineCode2Devices.put(gps.getLineId(), device); | |
| 67 | + //刷新对照 | |
| 68 | + gpsMap.put(device, gps); | |
| 69 | + if (StringUtils.isNotBlank(gps.getLineId())) { | |
| 70 | + //站点名称 | |
| 71 | + gps.setStationName(getStationName(gps)); | |
| 72 | + lineCode2Devices.put(gps.getLineId(), device); | |
| 73 | + | |
| 74 | + if(old != null && !gps.getLineId().equals(old.getLineId())) | |
| 75 | + lineCode2Devices.remove(old.getLineId(), device); | |
| 76 | + } | |
| 102 | 77 | |
| 103 | - if(old != null && !gps.getLineId().equals(old.getLineId())) | |
| 104 | - lineCode2Devices.remove(old.getLineId(), device); | |
| 78 | + //车辆换设备了 | |
| 79 | + String nbbm = gps.getNbbm(); | |
| 80 | + if(old != null && StringUtils.isNotEmpty(nbbm) && !nbbm.equals(old.getNbbm())){ | |
| 81 | + List<GpsEntity> list = findByNbbm(nbbm); | |
| 82 | + for(GpsEntity g : list){ | |
| 83 | + if(!g.getDeviceId().equals(device)) | |
| 84 | + gpsMap.remove(g.getDeviceId()); | |
| 85 | + } | |
| 86 | + } | |
| 87 | + } catch (Exception e) { | |
| 88 | + logger.error("", e); | |
| 105 | 89 | } |
| 106 | 90 | } |
| 107 | 91 | |
| ... | ... | @@ -116,6 +100,16 @@ public class GpsRealData implements CommandLineRunner { |
| 116 | 100 | return gpsMap.get(deviceId); |
| 117 | 101 | } |
| 118 | 102 | |
| 103 | + public List<GpsEntity> findByNbbm(String nbbm){ | |
| 104 | + Collection<GpsEntity> arr = gpsMap.values(); | |
| 105 | + List<GpsEntity> rs = new ArrayList<>(); | |
| 106 | + for(GpsEntity g : arr){ | |
| 107 | + if(nbbm.equals(g.getNbbm())) | |
| 108 | + rs.add(g); | |
| 109 | + } | |
| 110 | + return rs; | |
| 111 | + } | |
| 112 | + | |
| 119 | 113 | /** |
| 120 | 114 | * @Title: get @Description: TODO(线路编码获取GPS集合) @throws |
| 121 | 115 | */ | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/GpsRealAnalyse.java
| ... | ... | @@ -11,10 +11,7 @@ import org.slf4j.LoggerFactory; |
| 11 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | 12 | import org.springframework.stereotype.Component; |
| 13 | 13 | |
| 14 | -import java.util.Collections; | |
| 15 | -import java.util.Comparator; | |
| 16 | -import java.util.List; | |
| 17 | -import java.util.Set; | |
| 14 | +import java.util.*; | |
| 18 | 15 | import java.util.concurrent.CountDownLatch; |
| 19 | 16 | import java.util.concurrent.ExecutorService; |
| 20 | 17 | import java.util.concurrent.Executors; |
| ... | ... | @@ -44,15 +41,22 @@ public class GpsRealAnalyse { |
| 44 | 41 | @Autowired |
| 45 | 42 | GpsRealData gpsRealData; |
| 46 | 43 | |
| 47 | - static ExecutorService threadPool = Executors.newFixedThreadPool(100); | |
| 44 | + static ExecutorService threadPool = Executors.newFixedThreadPool(20); | |
| 48 | 45 | |
| 49 | 46 | public static long st; |
| 50 | 47 | public static CountDownLatch count; |
| 51 | 48 | |
| 49 | + public static boolean isBlock() { | |
| 50 | + return System.currentTimeMillis() - st > 1000 * 20; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public static boolean isIdle(){ | |
| 54 | + return System.currentTimeMillis() - st > 1000 * 60; | |
| 55 | + } | |
| 56 | + | |
| 52 | 57 | public void analyse(List<GpsEntity> list) { |
| 53 | 58 | try { |
| 54 | 59 | st = System.currentTimeMillis(); |
| 55 | - //如果正在恢复数据 | |
| 56 | 60 | if (GpsDataRecovery.run) |
| 57 | 61 | return; |
| 58 | 62 | |
| ... | ... | @@ -63,6 +67,7 @@ public class GpsRealAnalyse { |
| 63 | 67 | } |
| 64 | 68 | |
| 65 | 69 | Set<String> ks = multimap.keySet(); |
| 70 | + | |
| 66 | 71 | logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size()); |
| 67 | 72 | count = new CountDownLatch(ks.size()); |
| 68 | 73 | |
| ... | ... | @@ -125,7 +130,7 @@ public class GpsRealAnalyse { |
| 125 | 130 | abnormalStateHandle.handle(gps, prevs); |
| 126 | 131 | |
| 127 | 132 | if (!task) |
| 128 | - return; //无任务的,到这里就结束 | |
| 133 | + continue; //无任务的,到这里就结束 | |
| 129 | 134 | |
| 130 | 135 | //反向处理 |
| 131 | 136 | reverseSignalHandle.handle(gps, prevs); | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
| ... | ... | @@ -6,12 +6,12 @@ import com.bsth.data.gpsdata.arrival.SignalHandle; |
| 6 | 6 | import com.bsth.data.gpsdata.arrival.utils.CircleQueue; |
| 7 | 7 | import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState; |
| 8 | 8 | import com.bsth.data.gpsdata.arrival.utils.SignalSchPlanMatcher; |
| 9 | +import com.bsth.data.msg_queue.DirectivePushQueue; | |
| 9 | 10 | import com.bsth.data.schedule.DayOfSchedule; |
| 10 | 11 | import com.bsth.data.schedule.ScheduleComparator; |
| 11 | 12 | import com.bsth.data.schedule.late_adjust.LateAdjustHandle; |
| 12 | 13 | import com.bsth.entity.realcontrol.LineConfig; |
| 13 | 14 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 14 | -import com.bsth.service.directive.DirectiveService; | |
| 15 | 15 | import com.bsth.websocket.handler.SendUtils; |
| 16 | 16 | import org.apache.commons.lang3.StringUtils; |
| 17 | 17 | import org.slf4j.Logger; |
| ... | ... | @@ -41,9 +41,6 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 41 | 41 | SendUtils sendUtils; |
| 42 | 42 | |
| 43 | 43 | @Autowired |
| 44 | - DirectiveService directiveService; | |
| 45 | - | |
| 46 | - @Autowired | |
| 47 | 44 | ScheduleSignalState scheduleSignalState; |
| 48 | 45 | |
| 49 | 46 | @Autowired |
| ... | ... | @@ -151,7 +148,8 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 151 | 148 | |
| 152 | 149 | if(sch.getBcType().equals("out")){ |
| 153 | 150 | //出场时,切换成营运状态 |
| 154 | - directiveService.send60Operation(sch.getClZbh(), 0, Integer.parseInt(sch.getXlDir()), null, "出场@系统"); | |
| 151 | + DirectivePushQueue.put6003(sch.getClZbh(), 0, Integer.parseInt(sch.getXlDir()), null, "出场@系统"); | |
| 152 | + //directiveService.send60Operation(sch.getClZbh(), 0, Integer.parseInt(sch.getXlDir()), null, "出场@系统"); | |
| 155 | 153 | } |
| 156 | 154 | //出站既出场 |
| 157 | 155 | outStationAndOutPark(sch); |
| ... | ... | @@ -208,7 +206,8 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 208 | 206 | |
| 209 | 207 | if(schPrev.getBcType().equals("out")){ |
| 210 | 208 | //出场时,切换成营运状态 |
| 211 | - directiveService.send60Operation(schPrev.getClZbh(), 0, Integer.parseInt(schPrev.getXlDir()), null, "出场@系统"); | |
| 209 | + DirectivePushQueue.put6003(schPrev.getClZbh(), 0, Integer.parseInt(schPrev.getXlDir()), null, "出场@系统"); | |
| 210 | + //directiveService.send60Operation(schPrev.getClZbh(), 0, Integer.parseInt(schPrev.getXlDir()), null, "出场@系统"); | |
| 212 | 211 | } |
| 213 | 212 | } |
| 214 | 213 | } |
| ... | ... | @@ -276,15 +275,19 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 276 | 275 | //将gps转换为下一个班次走向的站内信号 |
| 277 | 276 | transformUpdown(gps, next); |
| 278 | 277 | //下发调度指令 |
| 279 | - directiveService.send60Dispatch(next, doneSum, "到站@系统"); | |
| 278 | + DirectivePushQueue.put6002(next, doneSum, "到站@系统"); | |
| 279 | + //directiveService.send60Dispatch(next, doneSum, "到站@系统"); | |
| 280 | 280 | |
| 281 | 281 | //套跑 -下发线路切换指令 |
| 282 | - if(!next.getXlBm().equals(sch.getXlBm())) | |
| 283 | - directiveService.lineChange(next.getClZbh(), next.getXlBm(), "套跑@系统"); | |
| 282 | + if(!next.getXlBm().equals(sch.getXlBm())){ | |
| 283 | + DirectivePushQueue.put64(next.getClZbh(), next.getXlBm(), "套跑@系统"); | |
| 284 | + //directiveService.lineChange(next.getClZbh(), next.getXlBm(), "套跑@系统"); | |
| 285 | + } | |
| 284 | 286 | } |
| 285 | 287 | else if(sch.getBcType().equals("in")){ |
| 286 | 288 | //终班进场,切换成非营运状态 |
| 287 | - directiveService.send60Operation(sch.getClZbh(), 1, Integer.parseInt(sch.getXlDir()), null, "进场@系统"); | |
| 289 | + DirectivePushQueue.put6003(sch.getClZbh(), 1, Integer.parseInt(sch.getXlDir()), null, "进场@系统"); | |
| 290 | + //directiveService.send60Operation(sch.getClZbh(), 1, Integer.parseInt(sch.getXlDir()), null, "进场@系统"); | |
| 288 | 291 | } |
| 289 | 292 | } |
| 290 | 293 | else { | ... | ... |
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java
| ... | ... | @@ -164,7 +164,7 @@ public class GpsDataRecovery implements ApplicationContextAware { |
| 164 | 164 | //abnormalStateHandle.handle(gps, prevs); |
| 165 | 165 | |
| 166 | 166 | if(!task) |
| 167 | - return; //无任务的,到这里就结束 | |
| 167 | + continue; //无任务的,到这里就结束 | |
| 168 | 168 | |
| 169 | 169 | //反向处理 |
| 170 | 170 | reverseSignalHandle.handle(gps, prevs); | ... | ... |
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/gpsdata/thread/ThreadPollMonitor.java deleted
100644 → 0
| 1 | -package com.bsth.data.gpsdata.thread; | |
| 2 | - | |
| 3 | -import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; | |
| 4 | -import org.springframework.stereotype.Component; | |
| 5 | - | |
| 6 | -/** | |
| 7 | - * 线程池监听 | |
| 8 | - * Created by panzhao on 2017/5/10. | |
| 9 | - */ | |
| 10 | -@Component | |
| 11 | -public class ThreadPollMonitor extends Thread{ | |
| 12 | - | |
| 13 | - @Override | |
| 14 | - public void run() { | |
| 15 | - long t = System.currentTimeMillis(); | |
| 16 | - | |
| 17 | - if(t - GpsRealAnalyse.st > 3000 * 10){ | |
| 18 | - GpsRealAnalyse.shutdown(); | |
| 19 | - } | |
| 20 | - } | |
| 21 | -} |
src/main/java/com/bsth/data/msg_queue/DirectivePushQueue.java
0 → 100644
| 1 | +package com.bsth.data.msg_queue; | |
| 2 | + | |
| 3 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 4 | +import com.bsth.service.directive.DirectiveService; | |
| 5 | +import org.slf4j.Logger; | |
| 6 | +import org.slf4j.LoggerFactory; | |
| 7 | +import org.springframework.beans.BeansException; | |
| 8 | +import org.springframework.boot.CommandLineRunner; | |
| 9 | +import org.springframework.context.ApplicationContext; | |
| 10 | +import org.springframework.context.ApplicationContextAware; | |
| 11 | +import org.springframework.stereotype.Component; | |
| 12 | + | |
| 13 | +import java.util.LinkedList; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * 到网关的指令推送队列 (系统发送的队列, 用户手动发送的不走这里) | |
| 17 | + * Created by panzhao on 2017/5/11. | |
| 18 | + */ | |
| 19 | +@Component | |
| 20 | +public class DirectivePushQueue implements CommandLineRunner, ApplicationContextAware { | |
| 21 | + | |
| 22 | + static LinkedList<QueueData_Directive> linkedList; | |
| 23 | + static DataPushThread thread; | |
| 24 | + static DirectiveService directiveService; | |
| 25 | + static long t; | |
| 26 | + static final int IDLE_TIME = 1000 * 30; | |
| 27 | + | |
| 28 | + static { | |
| 29 | + linkedList = new LinkedList<>(); | |
| 30 | + } | |
| 31 | + | |
| 32 | + public static void put6002(ScheduleRealInfo sch, int finish, String sender){ | |
| 33 | + QueueData_Directive qd6002 = new QueueData_Directive(); | |
| 34 | + qd6002.setSch(sch); | |
| 35 | + qd6002.setFinish(finish); | |
| 36 | + qd6002.setSender(sender); | |
| 37 | + qd6002.setCode("60_02"); | |
| 38 | + | |
| 39 | + linkedList.add(qd6002); | |
| 40 | + } | |
| 41 | + | |
| 42 | + public static void put6003(String nbbm, int state, int upDown, ScheduleRealInfo sch, String sender){ | |
| 43 | + QueueData_Directive qd6003 = new QueueData_Directive(); | |
| 44 | + qd6003.setNbbm(nbbm); | |
| 45 | + qd6003.setState(state); | |
| 46 | + qd6003.setUpDown(upDown); | |
| 47 | + qd6003.setSch(sch); | |
| 48 | + qd6003.setSender(sender); | |
| 49 | + | |
| 50 | + qd6003.setCode("60_03"); | |
| 51 | + | |
| 52 | + linkedList.add(qd6003); | |
| 53 | + } | |
| 54 | + | |
| 55 | + public static void put64(String nbbm, String lineCode, String sender){ | |
| 56 | + QueueData_Directive qd64 = new QueueData_Directive(); | |
| 57 | + qd64.setNbbm(nbbm); | |
| 58 | + qd64.setLineCode(lineCode); | |
| 59 | + qd64.setSender(sender); | |
| 60 | + | |
| 61 | + qd64.setCode("64"); | |
| 62 | + | |
| 63 | + linkedList.add(qd64); | |
| 64 | + } | |
| 65 | + | |
| 66 | + public static boolean isIdle(){ | |
| 67 | + return System.currentTimeMillis() - t > IDLE_TIME; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public static void start(){ | |
| 71 | + if(thread != null){ | |
| 72 | + thread.interrupt(); | |
| 73 | + } | |
| 74 | + thread = new DataPushThread(); | |
| 75 | + thread.start(); | |
| 76 | + } | |
| 77 | + | |
| 78 | + @Override | |
| 79 | + public void run(String... strings) throws Exception { | |
| 80 | + start(); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @Override | |
| 84 | + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | |
| 85 | + directiveService = applicationContext.getBean(DirectiveService.class); | |
| 86 | + } | |
| 87 | + | |
| 88 | + public static class DataPushThread extends Thread { | |
| 89 | + | |
| 90 | + Logger log = LoggerFactory.getLogger(this.getClass()); | |
| 91 | + | |
| 92 | + @Override | |
| 93 | + public void run() { | |
| 94 | + boolean sleepFlag = false; | |
| 95 | + QueueData_Directive qd; | |
| 96 | + String code; | |
| 97 | + while (true) { | |
| 98 | + try { | |
| 99 | + qd = linkedList.pollFirst(); | |
| 100 | + if (qd != null) { | |
| 101 | + sleepFlag = false; | |
| 102 | + code = qd.getCode(); | |
| 103 | + | |
| 104 | + if(code.equals("60_02")){ | |
| 105 | + directiveService.send60Dispatch(qd.getSch(), qd.getFinish(), qd.getSender()); | |
| 106 | + log.info("directive 60_02 sch id: " + qd.getSch().getId()); | |
| 107 | + } | |
| 108 | + else if(code.equals("60_03")){ | |
| 109 | + directiveService.send60Operation(qd.getNbbm(), qd.getState(), qd.getUpDown(), null, qd.getSender()); | |
| 110 | + log.info("directive 60_03 nbbm: " + qd.getNbbm()); | |
| 111 | + } | |
| 112 | + else if(code.equals("64")){ | |
| 113 | + directiveService.lineChange(qd.getNbbm(), qd.getLineCode(), qd.getSender()); | |
| 114 | + log.info("directive 64 nbbm: " + qd.getNbbm() + " lineCode: " + qd.getLineCode()); | |
| 115 | + } | |
| 116 | + | |
| 117 | + } else{ | |
| 118 | + Thread.sleep(500); | |
| 119 | + if(!sleepFlag){ | |
| 120 | + log.info("sleep..."); | |
| 121 | + sleepFlag = true; | |
| 122 | + } | |
| 123 | + } | |
| 124 | + t = System.currentTimeMillis(); | |
| 125 | + } | |
| 126 | + catch(InterruptedException e){ | |
| 127 | + break; | |
| 128 | + } | |
| 129 | + catch (Exception e) { | |
| 130 | + log.error("", e); | |
| 131 | + } | |
| 132 | + | |
| 133 | + } | |
| 134 | + } | |
| 135 | + } | |
| 136 | +} | ... | ... |
src/main/java/com/bsth/data/msg_queue/QueueData.java
0 → 100644
| 1 | +package com.bsth.data.msg_queue; | |
| 2 | + | |
| 3 | +import org.springframework.web.socket.TextMessage; | |
| 4 | +import org.springframework.web.socket.WebSocketSession; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * Created by panzhao on 2017/5/11. | |
| 8 | + */ | |
| 9 | +public class QueueData { | |
| 10 | + | |
| 11 | + private TextMessage message; | |
| 12 | + | |
| 13 | + private WebSocketSession session; | |
| 14 | + | |
| 15 | + | |
| 16 | + public WebSocketSession getSession() { | |
| 17 | + return session; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public void setSession(WebSocketSession session) { | |
| 21 | + this.session = session; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public TextMessage getMessage() { | |
| 25 | + return message; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public void setMessage(TextMessage message) { | |
| 29 | + this.message = message; | |
| 30 | + } | |
| 31 | +} | ... | ... |
src/main/java/com/bsth/data/msg_queue/QueueData_Directive.java
0 → 100644
| 1 | +package com.bsth.data.msg_queue; | |
| 2 | + | |
| 3 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Created by panzhao on 2017/5/11. | |
| 7 | + */ | |
| 8 | +public class QueueData_Directive { | |
| 9 | + | |
| 10 | + /** | |
| 11 | + * 指令类型 | |
| 12 | + * 60_02 | |
| 13 | + * 60_03 | |
| 14 | + * 64 | |
| 15 | + */ | |
| 16 | + private String code; | |
| 17 | + | |
| 18 | + /** 60调度指令内容 60_02*/ | |
| 19 | + private ScheduleRealInfo sch; | |
| 20 | + private int finish; | |
| 21 | + | |
| 22 | + /** 60 营运指令 60_03*/ | |
| 23 | + private String nbbm; | |
| 24 | + private int state; | |
| 25 | + private int upDown; | |
| 26 | + | |
| 27 | + /** 64指令内容 */ | |
| 28 | + private String lineCode; | |
| 29 | + | |
| 30 | + private String sender; | |
| 31 | + | |
| 32 | + | |
| 33 | + public ScheduleRealInfo getSch() { | |
| 34 | + return sch; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public void setSch(ScheduleRealInfo sch) { | |
| 38 | + this.sch = sch; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public int getFinish() { | |
| 42 | + return finish; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public void setFinish(int finish) { | |
| 46 | + this.finish = finish; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public String getSender() { | |
| 50 | + return sender; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public void setSender(String sender) { | |
| 54 | + this.sender = sender; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public String getNbbm() { | |
| 58 | + return nbbm; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public void setNbbm(String nbbm) { | |
| 62 | + this.nbbm = nbbm; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public int getState() { | |
| 66 | + return state; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setState(int state) { | |
| 70 | + this.state = state; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public int getUpDown() { | |
| 74 | + return upDown; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public void setUpDown(int upDown) { | |
| 78 | + this.upDown = upDown; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public String getCode() { | |
| 82 | + return code; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public void setCode(String code) { | |
| 86 | + this.code = code; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public String getLineCode() { | |
| 90 | + return lineCode; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public void setLineCode(String lineCode) { | |
| 94 | + this.lineCode = lineCode; | |
| 95 | + } | |
| 96 | +} | ... | ... |
src/main/java/com/bsth/data/msg_queue/WebSocketPushQueue.java
0 → 100644
| 1 | +package com.bsth.data.msg_queue; | |
| 2 | + | |
| 3 | +import com.bsth.common.Constants; | |
| 4 | +import org.slf4j.Logger; | |
| 5 | +import org.slf4j.LoggerFactory; | |
| 6 | +import org.springframework.boot.CommandLineRunner; | |
| 7 | +import org.springframework.stereotype.Component; | |
| 8 | +import org.springframework.web.socket.TextMessage; | |
| 9 | +import org.springframework.web.socket.WebSocketSession; | |
| 10 | + | |
| 11 | +import java.util.LinkedList; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * 线调web socket 推送队列 | |
| 15 | + * Created by panzhao on 2017/5/11. | |
| 16 | + */ | |
| 17 | +@Component | |
| 18 | +public class WebSocketPushQueue implements CommandLineRunner { | |
| 19 | + | |
| 20 | + static LinkedList<QueueData> linkedList; | |
| 21 | + static DataPushThread thread; | |
| 22 | + static Logger log = LoggerFactory.getLogger(WebSocketPushQueue.class); | |
| 23 | + static long t; | |
| 24 | + static final int IDLE_TIME = 1000 * 30; | |
| 25 | + | |
| 26 | + static { | |
| 27 | + linkedList = new LinkedList(); | |
| 28 | + } | |
| 29 | + | |
| 30 | + public static boolean isIdle() { | |
| 31 | + return System.currentTimeMillis() - t > IDLE_TIME; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public static void put(WebSocketSession session, TextMessage msg) { | |
| 35 | + QueueData qd = new QueueData(); | |
| 36 | + qd.setMessage(msg); | |
| 37 | + qd.setSession(session); | |
| 38 | + | |
| 39 | + log.info("put、[" + session.getAttributes().get(Constants.SESSION_USERNAME) + "] 、" + msg.getPayload()); | |
| 40 | + linkedList.add(qd); | |
| 41 | + } | |
| 42 | + | |
| 43 | + public static void start() { | |
| 44 | + if (thread != null) { | |
| 45 | + thread.interrupt(); | |
| 46 | + } | |
| 47 | + thread = new DataPushThread(); | |
| 48 | + thread.start(); | |
| 49 | + } | |
| 50 | + | |
| 51 | + @Override | |
| 52 | + public void run(String... strings) throws Exception { | |
| 53 | + start(); | |
| 54 | + } | |
| 55 | + | |
| 56 | + public static class DataPushThread extends Thread { | |
| 57 | + | |
| 58 | + Logger log = LoggerFactory.getLogger(this.getClass()); | |
| 59 | + | |
| 60 | + @Override | |
| 61 | + public void run() { | |
| 62 | + QueueData qd; | |
| 63 | + WebSocketSession session; | |
| 64 | + | |
| 65 | + boolean sleepFlag = false; | |
| 66 | + while (true) { | |
| 67 | + try { | |
| 68 | + qd = linkedList.pollFirst(); | |
| 69 | + if (qd != null) { | |
| 70 | + sleepFlag = false; | |
| 71 | + session = qd.getSession(); | |
| 72 | + if (session.isOpen()) { | |
| 73 | + log.info("push start、[" + session.getAttributes().get(Constants.SESSION_USERNAME) + "] 、" + qd.getMessage().getPayload()); | |
| 74 | + session.sendMessage(qd.getMessage()); | |
| 75 | + log.info("push end.."); | |
| 76 | + } | |
| 77 | + } else { | |
| 78 | + Thread.sleep(500); | |
| 79 | + if (!sleepFlag) { | |
| 80 | + log.info("sleep..."); | |
| 81 | + sleepFlag = true; | |
| 82 | + } | |
| 83 | + } | |
| 84 | + t = System.currentTimeMillis(); | |
| 85 | + } catch (InterruptedException e) { | |
| 86 | + break; | |
| 87 | + } catch (Exception e) { | |
| 88 | + log.error("", e); | |
| 89 | + } | |
| 90 | + } | |
| 91 | + } | |
| 92 | + } | |
| 93 | +} | ... | ... |
src/main/java/com/bsth/data/pilot80/PilotReport.java
| ... | ... | @@ -4,6 +4,7 @@ import com.bsth.data.BasicData; |
| 4 | 4 | import com.bsth.data.LineConfigData; |
| 5 | 5 | import com.bsth.data.gpsdata.GpsEntity; |
| 6 | 6 | import com.bsth.data.gpsdata.GpsRealData; |
| 7 | +import com.bsth.data.msg_queue.DirectivePushQueue; | |
| 7 | 8 | import com.bsth.data.schedule.DayOfSchedule; |
| 8 | 9 | import com.bsth.entity.Line; |
| 9 | 10 | import com.bsth.entity.directive.D80; |
| ... | ... | @@ -82,9 +83,11 @@ public class PilotReport { |
| 82 | 83 | outSch = dayOfSchedule.next(outSch); |
| 83 | 84 | |
| 84 | 85 | //下发调度指令 |
| 85 | - directiveService.send60Dispatch(outSch, dayOfSchedule.doneSum(nbbm), "请出@系统"); | |
| 86 | + DirectivePushQueue.put6002(outSch, dayOfSchedule.doneSum(nbbm), "请出@系统"); | |
| 87 | + //directiveService.send60Dispatch(outSch, dayOfSchedule.doneSum(nbbm), "请出@系统"); | |
| 86 | 88 | //下发线路切换指令 |
| 87 | - directiveService.lineChange(outSch.getClZbh(), outSch.getXlBm(), "请出@系统"); | |
| 89 | + DirectivePushQueue.put64(outSch.getClZbh(), outSch.getXlBm(), "请出@系统"); | |
| 90 | + //directiveService.lineChange(outSch.getClZbh(), outSch.getXlBm(), "请出@系统"); | |
| 88 | 91 | }else |
| 89 | 92 | d80.setRemarks("没有出场计划"); |
| 90 | 93 | ... | ... |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -2,19 +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.directive.DirectivesPstThread; | |
| 11 | 8 | import com.bsth.data.gpsdata.GpsRealData; |
| 12 | 9 | import com.bsth.data.gpsdata.recovery.GpsDataRecovery; |
| 13 | -import com.bsth.data.schedule.late_adjust.ScheduleLateThread; | |
| 14 | -import com.bsth.data.schedule.thread.CalcOilThread; | |
| 15 | -import com.bsth.data.schedule.thread.SchedulePstThread; | |
| 16 | -import com.bsth.data.schedule.thread.ScheduleRefreshThread; | |
| 17 | -import com.bsth.data.schedule.thread.SubmitToTrafficManage; | |
| 18 | 10 | import com.bsth.entity.realcontrol.LineConfig; |
| 19 | 11 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 20 | 12 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| ... | ... | @@ -32,8 +24,6 @@ import org.joda.time.format.DateTimeFormatter; |
| 32 | 24 | import org.slf4j.Logger; |
| 33 | 25 | import org.slf4j.LoggerFactory; |
| 34 | 26 | import org.springframework.beans.factory.annotation.Autowired; |
| 35 | -import org.springframework.boot.CommandLineRunner; | |
| 36 | -import org.springframework.core.annotation.Order; | |
| 37 | 27 | import org.springframework.dao.DataIntegrityViolationException; |
| 38 | 28 | import org.springframework.jdbc.core.JdbcTemplate; |
| 39 | 29 | import org.springframework.stereotype.Component; |
| ... | ... | @@ -41,7 +31,6 @@ import org.springframework.stereotype.Component; |
| 41 | 31 | import java.text.ParseException; |
| 42 | 32 | import java.text.SimpleDateFormat; |
| 43 | 33 | import java.util.*; |
| 44 | -import java.util.concurrent.TimeUnit; | |
| 45 | 34 | |
| 46 | 35 | /** |
| 47 | 36 | * @author PanZhao |
| ... | ... | @@ -50,8 +39,7 @@ import java.util.concurrent.TimeUnit; |
| 50 | 39 | * @date 2016年8月15日 上午10:16:12 |
| 51 | 40 | */ |
| 52 | 41 | @Component |
| 53 | -@Order(value = 3) | |
| 54 | -public class DayOfSchedule implements CommandLineRunner { | |
| 42 | +public class DayOfSchedule { | |
| 55 | 43 | |
| 56 | 44 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 57 | 45 | |
| ... | ... | @@ -94,9 +82,6 @@ public class DayOfSchedule implements CommandLineRunner { |
| 94 | 82 | @Autowired |
| 95 | 83 | GpsRealData gpsRealData; |
| 96 | 84 | |
| 97 | - @Autowired | |
| 98 | - BasicData.BasicDataLoader basicDataLoader; | |
| 99 | - | |
| 100 | 85 | /** |
| 101 | 86 | * 线路当前使用的排班的日期 |
| 102 | 87 | */ |
| ... | ... | @@ -116,57 +101,13 @@ public class DayOfSchedule implements CommandLineRunner { |
| 116 | 101 | } |
| 117 | 102 | |
| 118 | 103 | @Autowired |
| 119 | - ScheduleRefreshThread scheduleRefreshThread; | |
| 120 | - | |
| 121 | - @Autowired | |
| 122 | - SchedulePstThread schedulePstThread; | |
| 123 | - | |
| 124 | - @Autowired | |
| 125 | - ScheduleLateThread scheduleLateThread; | |
| 126 | - | |
| 127 | - @Autowired | |
| 128 | - SubmitToTrafficManage submitToTrafficManage; | |
| 129 | - | |
| 130 | - @Autowired | |
| 131 | 104 | LineConfigData lineConfigs; |
| 132 | 105 | |
| 133 | 106 | @Autowired |
| 134 | 107 | GpsDataRecovery gpsDataRecovery; |
| 135 | 108 | |
| 136 | - @Autowired | |
| 137 | - DirectivesPstThread directivesPstThread; | |
| 138 | - | |
| 139 | - @Autowired | |
| 140 | - CalcOilThread calcOilThread; | |
| 141 | - | |
| 142 | 109 | private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"), fmtHHmm = DateTimeFormat.forPattern("HH:mm"); |
| 143 | 110 | |
| 144 | - @Override | |
| 145 | - public void run(String... arg0) throws Exception { | |
| 146 | - basicDataLoader.loadAllData(); | |
| 147 | - | |
| 148 | - //翻班线程 | |
| 149 | -// Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); | |
| 150 | - //入库 | |
| 151 | -// Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 30, TimeUnit.SECONDS); | |
| 152 | - //班次误点扫描 | |
| 153 | -// Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 30, TimeUnit.SECONDS); | |
| 154 | - | |
| 155 | - //每天凌晨2点20提交数据到运管处 | |
| 156 | - long diff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis(); | |
| 157 | - if (diff < 0) | |
| 158 | - diff += (1000 * 60 * 60 * 24); | |
| 159 | - | |
| 160 | - logger.info(diff / 1000 / 60 + "分钟之后提交到运管处"); | |
| 161 | - //Application.mainServices.scheduleAtFixedRate(submitToTrafficManage, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | |
| 162 | - | |
| 163 | - //计算油、公里加注 | |
| 164 | - Application.mainServices.scheduleAtFixedRate(calcOilThread, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | |
| 165 | - | |
| 166 | - //指令持久化线程 | |
| 167 | - Application.mainServices.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS); | |
| 168 | - } | |
| 169 | - | |
| 170 | 111 | //数据恢复 |
| 171 | 112 | private void dataRecovery() { |
| 172 | 113 | GpsDataRecovery.run = true; | ... | ... |
src/main/java/com/bsth/entity/schedule/TTInfoDetail.java
| ... | ... | @@ -86,6 +86,8 @@ public class TTInfoDetail extends BEntity { |
| 86 | 86 | |
| 87 | 87 | /** 是否分班(表示这个班次是否是晚班班次,就是换另外一个驾驶员开)*/ |
| 88 | 88 | private Boolean isFB; |
| 89 | + /** 是否停驶(表示此班次执行完成,停在终点站,不进场) */ | |
| 90 | + private Boolean isTS; | |
| 89 | 91 | |
| 90 | 92 | /** 是否切换线路 */ |
| 91 | 93 | private Boolean isSwitchXl; |
| ... | ... | @@ -280,4 +282,12 @@ public class TTInfoDetail extends BEntity { |
| 280 | 282 | public void setZdzName(String zdzName) { |
| 281 | 283 | this.zdzName = zdzName; |
| 282 | 284 | } |
| 285 | + | |
| 286 | + public Boolean getIsTS() { | |
| 287 | + return isTS; | |
| 288 | + } | |
| 289 | + | |
| 290 | + public void setIsTS(Boolean isTS) { | |
| 291 | + this.isTS = isTS; | |
| 292 | + } | |
| 283 | 293 | } | ... | ... |
src/main/java/com/bsth/entity/schedule/temp/SchedulePlanRuleResult.java
| ... | ... | @@ -27,20 +27,22 @@ public class SchedulePlanRuleResult { |
| 27 | 27 | |
| 28 | 28 | /** 排班规则id */ |
| 29 | 29 | private String ruleId; |
| 30 | - /** 启用日期 */ | |
| 30 | + /** 启用日期(用于md5计算) */ | |
| 31 | 31 | private Date qyrq; |
| 32 | 32 | /** 车辆配置id */ |
| 33 | 33 | private String ccId; |
| 34 | 34 | /** 车辆自编号 */ |
| 35 | 35 | private String ccZbh; |
| 36 | 36 | |
| 37 | - /** 路牌id列表字符串 */ | |
| 37 | + /** 路牌id列表字符串(用于md5计算) */ | |
| 38 | 38 | @Column(length = 1000) |
| 39 | 39 | private String gids; |
| 40 | 40 | /** 路牌名字列表字符串 */ |
| 41 | 41 | private String gnames; |
| 42 | 42 | /** 翻到哪个路牌索引 */ |
| 43 | 43 | private String gidindex; |
| 44 | + /** 原始的起始路牌索引(用于md5计算) */ | |
| 45 | + private String origingidindex; | |
| 44 | 46 | /** 人员配置id列表字符串 */ |
| 45 | 47 | @Column(length = 1000) |
| 46 | 48 | private String ecids; |
| ... | ... | @@ -81,8 +83,8 @@ public class SchedulePlanRuleResult { |
| 81 | 83 | "(xl_id,xl_name,rule_id,cc_id,cc_zbh," + |
| 82 | 84 | "gids,gnames,gidindex,ecids,ecdbbms,ecindex," + |
| 83 | 85 | "ttinfo_id,ttinfo_name,schedule_date," + |
| 84 | - "sysuser_id,sysuser_name,create_date, qyrq) " + | |
| 85 | - "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; | |
| 86 | + "sysuser_id,sysuser_name,create_date, qyrq, origingidindex) " + | |
| 87 | + "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; | |
| 86 | 88 | |
| 87 | 89 | return sql; |
| 88 | 90 | } |
| ... | ... | @@ -106,7 +108,7 @@ public class SchedulePlanRuleResult { |
| 106 | 108 | ps.setString(16, this.getSysuserName()); |
| 107 | 109 | ps.setTimestamp(17, new java.sql.Timestamp(this.getCreateDate().getTime())); |
| 108 | 110 | ps.setDate(18, new java.sql.Date(this.getQyrq().getTime())); |
| 109 | - | |
| 111 | + ps.setString(19, this.getOrigingidindex()); | |
| 110 | 112 | |
| 111 | 113 | } |
| 112 | 114 | |
| ... | ... | @@ -261,4 +263,12 @@ public class SchedulePlanRuleResult { |
| 261 | 263 | public void setQyrq(Date qyrq) { |
| 262 | 264 | this.qyrq = qyrq; |
| 263 | 265 | } |
| 266 | + | |
| 267 | + public String getOrigingidindex() { | |
| 268 | + return origingidindex; | |
| 269 | + } | |
| 270 | + | |
| 271 | + public void setOrigingidindex(String origingidindex) { | |
| 272 | + this.origingidindex = origingidindex; | |
| 273 | + } | |
| 264 | 274 | } | ... | ... |
src/main/java/com/bsth/repository/StationRouteRepository.java
| ... | ... | @@ -113,8 +113,8 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int |
| 113 | 113 | /*@Query(value = "SELECT s.b_jwpoints,s.station_name FROM (" + |
| 114 | 114 | "SELECT b.station FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " + |
| 115 | 115 | "LEFT JOIN bsth_c_station s on r.station = s.id", nativeQuery=true)*/ |
| 116 | - @Query(value = "SELECT s.b_jwpoints,s.station_name,r.station_route_code FROM (" + | |
| 117 | - "SELECT b.station,b.station_route_code FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " + | |
| 116 | + @Query(value = "SELECT s.b_jwpoints,r.station_name,r.station_route_code FROM (" + | |
| 117 | + "SELECT b.station,b.station_route_code,b.station_name FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " + | |
| 118 | 118 | "LEFT JOIN bsth_c_station s on r.station = s.id order by r.station_route_code asc", nativeQuery=true) |
| 119 | 119 | List<Object[]> getSelectStationRouteCenterPoints(Integer lineId,Integer direction); |
| 120 | 120 | ... | ... |
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
| ... | ... | @@ -85,12 +85,15 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 85 | 85 | if(null != sender) |
| 86 | 86 | d60.setSender(sender); |
| 87 | 87 | d60.setHttpCode(code); |
| 88 | - // 添加到缓存 | |
| 89 | - dayOfDirectives.put60(d60); | |
| 90 | 88 | |
| 91 | - if (code != 0) { | |
| 89 | + if (code == 0) { | |
| 90 | + // 添加到缓存 | |
| 91 | + dayOfDirectives.put60(d60, true); | |
| 92 | + } | |
| 93 | + else{ | |
| 92 | 94 | d60.setErrorText("网关通讯失败, code: " + code); |
| 93 | 95 | d60Repository.save(d60); |
| 96 | + dayOfDirectives.put60(d60, false); | |
| 94 | 97 | } |
| 95 | 98 | return code; |
| 96 | 99 | } |
| ... | ... | @@ -139,12 +142,13 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 139 | 142 | if (code == 0) { |
| 140 | 143 | sch.setDirectiveState(60); |
| 141 | 144 | // 添加到缓存,延迟入库 |
| 142 | - dayOfDirectives.put60(d60); | |
| 145 | + dayOfDirectives.put60(d60, true); | |
| 143 | 146 | // 通知页面 |
| 144 | 147 | sendD60ToPage(sch); |
| 145 | 148 | } |
| 146 | 149 | else{ |
| 147 | 150 | d60.setErrorText("网关通讯失败, code: " + code); |
| 151 | + dayOfDirectives.put60(d60, false); | |
| 148 | 152 | d60Repository.save(d60); |
| 149 | 153 | } |
| 150 | 154 | return code; |
| ... | ... | @@ -196,11 +200,15 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 196 | 200 | d60.setHttpCode(code); |
| 197 | 201 | if (null != sch) |
| 198 | 202 | d60.setSch(sch); |
| 199 | - dayOfDirectives.put60(d60); | |
| 200 | 203 | |
| 201 | - if (code != 0) { | |
| 204 | + | |
| 205 | + if (code == 0) { | |
| 206 | + dayOfDirectives.put60(d60, true); | |
| 207 | + } | |
| 208 | + else{ | |
| 202 | 209 | d60.setErrorText("网关通讯失败, code: " + code); |
| 203 | 210 | d60Repository.save(d60); |
| 211 | + dayOfDirectives.put60(d60, false); | |
| 204 | 212 | } |
| 205 | 213 | return code; |
| 206 | 214 | } | ... | ... |
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| ... | ... | @@ -1569,7 +1569,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1569 | 1569 | |
| 1570 | 1570 | jhbc++; |
| 1571 | 1571 | jhlc += lc; |
| 1572 | - if(schedule.getStatus() == 2){ | |
| 1572 | + if(schedule.getStatus() != -1){ | |
| 1573 | 1573 | sjbc++; |
| 1574 | 1574 | sjlc += lc; |
| 1575 | 1575 | } else if(schedule.getStatus() == -1){ |
| ... | ... | @@ -1622,37 +1622,37 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1622 | 1622 | tempMap.put("lcbfb", df.format(jhlc>0?(double)sjlc/jhlc*100:0)+"%"); |
| 1623 | 1623 | tempMap.put("lzbc", lzbc); |
| 1624 | 1624 | tempMap.put("lzlc", lzlc); |
| 1625 | - tempMap.put("lzbfb", df.format(jhlc>0?(double)lzlc/jhlc*100:0)+"%"); | |
| 1625 | + tempMap.put("lzbfb", df.format(jhlc>0?(double)lzbc/jhbc*100:0)+"%"); | |
| 1626 | 1626 | tempMap.put("dmbc", dmbc); |
| 1627 | 1627 | tempMap.put("dmlc", dmlc); |
| 1628 | - tempMap.put("dmbfb", df.format(jhlc>0?(double)dmlc/jhlc*100:0)+"%"); | |
| 1628 | + tempMap.put("dmbfb", df.format(jhlc>0?(double)dmbc/jhbc*100:0)+"%"); | |
| 1629 | 1629 | tempMap.put("gzbc", gzbc); |
| 1630 | 1630 | tempMap.put("gzlc", gzlc); |
| 1631 | - tempMap.put("gzbfb", df.format(jhlc>0?(double)gzlc/jhlc*100:0)+"%"); | |
| 1631 | + tempMap.put("gzbfb", df.format(jhlc>0?(double)gzbc/jhbc*100:0)+"%"); | |
| 1632 | 1632 | tempMap.put("jfbc", jfbc); |
| 1633 | 1633 | tempMap.put("jflc", jflc); |
| 1634 | - tempMap.put("jfbfb", df.format(jhlc>0?(double)jflc/jhlc*100:0)+"%"); | |
| 1634 | + tempMap.put("jfbfb", df.format(jhlc>0?(double)jfbc/jhbc*100:0)+"%"); | |
| 1635 | 1635 | tempMap.put("zsbc", zsbc); |
| 1636 | 1636 | tempMap.put("zslc", zslc); |
| 1637 | - tempMap.put("zsbfb", df.format(jhlc>0?(double)zslc/jhlc*100:0)+"%"); | |
| 1637 | + tempMap.put("zsbfb", df.format(jhlc>0?(double)zsbc/jhbc*100:0)+"%"); | |
| 1638 | 1638 | tempMap.put("qrbc", qrbc); |
| 1639 | 1639 | tempMap.put("qrlc", qrlc); |
| 1640 | - tempMap.put("qrbfb", df.format(jhlc>0?(double)qrlc/jhlc*100:0)+"%"); | |
| 1640 | + tempMap.put("qrbfb", df.format(jhlc>0?(double)qrbc/jhbc*100:0)+"%"); | |
| 1641 | 1641 | tempMap.put("qcbc", qcbc); |
| 1642 | 1642 | tempMap.put("qclc", qclc); |
| 1643 | - tempMap.put("qcbfb", df.format(jhlc>0?(double)qclc/jhlc*100:0)+"%"); | |
| 1643 | + tempMap.put("qcbfb", df.format(jhlc>0?(double)qcbc/jhbc*100:0)+"%"); | |
| 1644 | 1644 | tempMap.put("kxbc", kxbc); |
| 1645 | 1645 | tempMap.put("kxlc", kxlc); |
| 1646 | - tempMap.put("kxbfb", df.format(jhlc>0?(double)kxlc/jhlc*100:0)+"%"); | |
| 1646 | + tempMap.put("kxbfb", df.format(jhlc>0?(double)kxbc/jhbc*100:0)+"%"); | |
| 1647 | 1647 | tempMap.put("qhbc", qhbc); |
| 1648 | 1648 | tempMap.put("qhlc", qhlc); |
| 1649 | - tempMap.put("qhbfb", df.format(jhlc>0?(double)qhlc/jhlc*100:0)+"%"); | |
| 1649 | + tempMap.put("qhbfb", df.format(jhlc>0?(double)qhbc/jhbc*100:0)+"%"); | |
| 1650 | 1650 | tempMap.put("wybc", wybc); |
| 1651 | 1651 | tempMap.put("wylc", wylc); |
| 1652 | - tempMap.put("wybfb", df.format(jhlc>0?(double)wylc/jhlc*100:0)+"%"); | |
| 1652 | + tempMap.put("wybfb", df.format(jhlc>0?(double)wybc/jhbc*100:0)+"%"); | |
| 1653 | 1653 | tempMap.put("qtbc", qtbc); |
| 1654 | 1654 | tempMap.put("qtlc", qtlc); |
| 1655 | - tempMap.put("qtbfb", df.format(jhlc>0?(double)qtlc/jhlc*100:0)+"%"); | |
| 1655 | + tempMap.put("qtbfb", df.format(jhlc>0?(double)qtbc/jhbc*100:0)+"%"); | |
| 1656 | 1656 | |
| 1657 | 1657 | resList.add(tempMap); |
| 1658 | 1658 | } | ... | ... |
src/main/java/com/bsth/service/impl/StationServiceImpl.java
| ... | ... | @@ -248,13 +248,13 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 248 | 248 | for(int i = 0;i <stationsArray.size();i++) { |
| 249 | 249 | // 站点名称 |
| 250 | 250 | String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString(); |
| 251 | - Double distance = stationsArray.getJSONObject(i).get("distance").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("distance").toString()); | |
| 251 | + Double distance = stationsArray.getJSONObject(i).get("distance").equals("") ? 0.0d : Double.parseDouble(stationsArray.getJSONObject(i).get("distance").toString()); | |
| 252 | 252 | // 转成公里 |
| 253 | 253 | distance = distance/1000; |
| 254 | 254 | BigDecimal d = new BigDecimal(distance); |
| 255 | 255 | distance = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| 256 | 256 | sectionDistance= distance + sectionDistance; |
| 257 | - Double duration = stationsArray.getJSONObject(i).get("duration").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("duration").toString()); | |
| 257 | + Double duration = stationsArray.getJSONObject(i).get("duration").equals("") ? 0.0d : Double.parseDouble(stationsArray.getJSONObject(i).get("duration").toString()); | |
| 258 | 258 | // 转成分钟 |
| 259 | 259 | duration = duration/60; |
| 260 | 260 | BigDecimal t = new BigDecimal(duration); |
| ... | ... | @@ -792,9 +792,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 792 | 792 | Station station = repository.findOne(stationId); |
| 793 | 793 | StationRoute arg0 = new StationRoute(); |
| 794 | 794 | // 距离 |
| 795 | - Double distances = map.get("distances").equals("") ? null : Double.parseDouble(map.get("distances").toString()); | |
| 795 | + Double distances = map.get("distances").equals("") ? 0.0d : Double.parseDouble(map.get("distances").toString()); | |
| 796 | 796 | // 时间 |
| 797 | - Double toTime = map.get("toTime").equals("") ? null : Double.parseDouble(map.get("toTime").toString()); | |
| 797 | + Double toTime = map.get("toTime").equals("") ? 0.0d : Double.parseDouble(map.get("toTime").toString()); | |
| 798 | 798 | // 站点路由名称 |
| 799 | 799 | String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString(); |
| 800 | 800 | // 线路ID |
| ... | ... | @@ -952,8 +952,8 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 952 | 952 | stationRouteCode = stationRouteCode == null ? 100 : stationRouteCode; |
| 953 | 953 | Integer LineId = map.get("stationRouteLine").equals("") ? null : Integer.parseInt(map.get("stationRouteLine").toString()); |
| 954 | 954 | String stationMark = map.get("stationMark").equals("") ? null : map.get("stationMark").toString(); |
| 955 | - Double distances = map.get("distances").equals("") ? null : Double.parseDouble(map.get("distances").toString()); | |
| 956 | - Double toTime = map.get("toTime").equals("") ? null : Double.parseDouble(map.get("toTime").toString()); | |
| 955 | + Double distances = map.get("distances").equals("") ? 0.0d : Double.parseDouble(map.get("distances").toString()); | |
| 956 | + Double toTime = map.get("toTime").equals("") ? 0.0d : Double.parseDouble(map.get("toTime").toString()); | |
| 957 | 957 | Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); |
| 958 | 958 | Station station = repository.findOne(stationId); |
| 959 | 959 | Line line = lineRepository.findOne(LineId); | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -10,6 +10,7 @@ import com.bsth.controller.realcontrol.dto.DfsjChange; |
| 10 | 10 | import com.bsth.controller.realcontrol.dto.LpData; |
| 11 | 11 | import com.bsth.data.BasicData; |
| 12 | 12 | import com.bsth.data.LineConfigData; |
| 13 | +import com.bsth.data.msg_queue.DirectivePushQueue; | |
| 13 | 14 | import com.bsth.data.schedule.DayOfSchedule; |
| 14 | 15 | import com.bsth.data.schedule.SchAttrCalculator; |
| 15 | 16 | import com.bsth.data.schedule.SchModifyLog; |
| ... | ... | @@ -1280,9 +1281,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1280 | 1281 | ts.add(next); |
| 1281 | 1282 | } |
| 1282 | 1283 | |
| 1283 | - if(!next.getXlBm().equals(sch.getXlBm())){ | |
| 1284 | - directiveService.lineChange(next.getClZbh(), next.getXlBm(), "套跑@系统"); | |
| 1285 | - } | |
| 1284 | + try{ | |
| 1285 | + //车辆下一个要执行的班次 | |
| 1286 | + ScheduleRealInfo carNext = dayOfSchedule.next(sch); | |
| 1287 | + if(carNext != null && !carNext.getXlBm().equals(sch.getXlBm())){ | |
| 1288 | + DirectivePushQueue.put64(carNext.getClZbh(), carNext.getXlBm(), "套跑@系统"); | |
| 1289 | + //directiveService.lineChange(carNext.getClZbh(), carNext.getXlBm(), "套跑@系统"); | |
| 1290 | + } | |
| 1291 | + }catch (Exception e){logger.error("", e);} | |
| 1286 | 1292 | |
| 1287 | 1293 | //重新计算车辆执行班次 |
| 1288 | 1294 | dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | ... | ... |
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
| 1 | 1 | package com.bsth.service.schedule.impl; |
| 2 | 2 | |
| 3 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 4 | -import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 5 | -import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | |
| 6 | -import com.bsth.util.ReportUtils; | |
| 7 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 8 | -import org.springframework.jdbc.core.JdbcTemplate; | |
| 9 | -import org.springframework.jdbc.core.RowMapper; | |
| 10 | -import org.springframework.stereotype.Service; | |
| 11 | - | |
| 12 | 3 | import java.math.BigDecimal; |
| 4 | +import java.net.URLEncoder; | |
| 13 | 5 | import java.sql.ResultSet; |
| 14 | 6 | import java.sql.SQLException; |
| 15 | 7 | import java.text.DecimalFormat; |
| 16 | 8 | import java.text.NumberFormat; |
| 17 | 9 | import java.text.ParseException; |
| 18 | 10 | import java.text.SimpleDateFormat; |
| 19 | -import java.util.*; | |
| 20 | - | |
| 11 | +import java.util.ArrayList; | |
| 12 | +import java.util.Collections; | |
| 13 | +import java.util.Date; | |
| 14 | +import java.util.HashMap; | |
| 15 | +import java.util.HashSet; | |
| 16 | +import java.util.Iterator; | |
| 17 | +import java.util.List; | |
| 18 | +import java.util.Map; | |
| 19 | +import java.util.Set; | |
| 21 | 20 | |
| 22 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
| 23 | 22 | import org.springframework.jdbc.core.JdbcTemplate; |
| ... | ... | @@ -404,20 +403,22 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 404 | 403 | } |
| 405 | 404 | } |
| 406 | 405 | |
| 407 | - if(!schedule.getBcType().equals("in") && !schedule.getBcType().equals("out")){ | |
| 408 | - String clZbh = schedule.getClZbh(); | |
| 409 | - if(!listMap.containsKey(clZbh)) | |
| 410 | - listMap.put(clZbh, new ArrayList<ScheduleRealInfo>()); | |
| 411 | - listMap.get(clZbh).add(schedule); | |
| 406 | + if(!schedule.getBcType().equals("in") && !schedule.getBcType().equals("out") | |
| 407 | + && schedule.getFcsjActual() != null){ | |
| 408 | +// String clZbh = schedule.getClZbh(); | |
| 409 | + String xlDir = schedule.getXlDir(); | |
| 410 | + if(!listMap.containsKey(xlDir)) | |
| 411 | + listMap.put(xlDir, new ArrayList<ScheduleRealInfo>()); | |
| 412 | + listMap.get(xlDir).add(schedule); | |
| 412 | 413 | } |
| 413 | 414 | } |
| 414 | 415 | |
| 415 | 416 | //求首末班准点率 |
| 416 | - for(String clZbh : listMap.keySet()){ | |
| 417 | + for(String xlDir : listMap.keySet()){ | |
| 417 | 418 | Map<Integer, ScheduleRealInfo> temp = new HashMap<Integer, ScheduleRealInfo>(); |
| 418 | 419 | List <ScheduleRealInfo> tempList = new ArrayList<ScheduleRealInfo>(); |
| 419 | 420 | List<Integer> sort = new ArrayList<Integer>(); |
| 420 | - for(ScheduleRealInfo schedule : listMap.get(clZbh)){ | |
| 421 | + for(ScheduleRealInfo schedule : listMap.get(xlDir)){ | |
| 421 | 422 | String[] split = schedule.getFcsj().split(":"); |
| 422 | 423 | int min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); |
| 423 | 424 | temp.put(min, schedule); |
| ... | ... | @@ -762,7 +763,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 762 | 763 | return modelMap; |
| 763 | 764 | } |
| 764 | 765 | |
| 765 | -// @Override | |
| 766 | + @Override | |
| 766 | 767 | public Map<String, Object> scheduleAnaly_sum(Map<String, Object> map) { |
| 767 | 768 | DecimalFormat df = new DecimalFormat("00"); |
| 768 | 769 | NumberFormat nf = NumberFormat.getNumberInstance(); |
| ... | ... | @@ -867,101 +868,122 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 867 | 868 | { |
| 868 | 869 | Map<String, Object> m0 = new HashMap<String, Object>(); |
| 869 | 870 | m0.put("time", "首~6:30"); |
| 870 | - m0.put("upbc", "0");m0.put("dnbc", "0"); | |
| 871 | - m0.put("upys", "--");m0.put("dnys", "--"); | |
| 872 | - m0.put("pjys", "--"); | |
| 871 | + m0.put("upbc", "0"); m0.put("dnbc", "0"); | |
| 872 | + m0.put("upys", "/"); m0.put("dnys", "/"); | |
| 873 | + m0.put("pjys", "/"); | |
| 873 | 874 | tempList.add(m0); |
| 874 | 875 | Map<String, Object> m1 = new HashMap<String, Object>(); |
| 875 | 876 | m1.put("time", "6:31~8:30"); |
| 876 | - m1.put("upbc", "0");m1.put("dnbc", "0"); | |
| 877 | - m1.put("upys", "--");m1.put("dnys", "--"); | |
| 878 | - m1.put("pjys", "--"); | |
| 877 | + m1.put("upbc", "0"); m1.put("dnbc", "0"); | |
| 878 | + m1.put("upys", "/"); m1.put("dnys", "/"); | |
| 879 | + m1.put("pjys", "/"); | |
| 879 | 880 | tempList.add(m1); |
| 880 | 881 | Map<String, Object> m2 = new HashMap<String, Object>(); |
| 881 | 882 | m2.put("time", "8:31~11:00"); |
| 882 | - m2.put("upbc", "0");m2.put("dnbc", "0"); | |
| 883 | - m2.put("upys", "--");m2.put("dnys", "--"); | |
| 884 | - m2.put("pjys", "--"); | |
| 883 | + m2.put("upbc", "0"); m2.put("dnbc", "0"); | |
| 884 | + m2.put("upys", "/"); m2.put("dnys", "/"); | |
| 885 | + m2.put("pjys", "/"); | |
| 885 | 886 | tempList.add(m2); |
| 886 | 887 | Map<String, Object> m3 = new HashMap<String, Object>(); |
| 887 | 888 | m3.put("time", "11:01~13:30"); |
| 888 | - m3.put("upbc", "0");m3.put("dnbc", "0"); | |
| 889 | - m3.put("upys", "--");m3.put("dnys", "--"); | |
| 890 | - m3.put("pjys", "--"); | |
| 889 | + m3.put("upbc", "0"); m3.put("dnbc", "0"); | |
| 890 | + m3.put("upys", "/"); m3.put("dnys", "/"); | |
| 891 | + m3.put("pjys", "/"); | |
| 891 | 892 | tempList.add(m3); |
| 892 | 893 | Map<String, Object> m4 = new HashMap<String, Object>(); |
| 893 | 894 | m4.put("time", "13:31~16:00"); |
| 894 | - m4.put("upbc", "0");m4.put("dnbc", "0"); | |
| 895 | - m4.put("upys", "--");m4.put("dnys", "--"); | |
| 896 | - m4.put("pjys", "--"); | |
| 895 | + m4.put("upbc", "0"); m4.put("dnbc", "0"); | |
| 896 | + m4.put("upys", "/"); m4.put("dnys", "/"); | |
| 897 | + m4.put("pjys", "/"); | |
| 897 | 898 | tempList.add(m4); |
| 898 | 899 | Map<String, Object> m5 = new HashMap<String, Object>(); |
| 899 | 900 | m5.put("time", "16:01~18:00"); |
| 900 | - m5.put("upbc", "0");m5.put("dnbc", "0"); | |
| 901 | - m5.put("upys", "--");m5.put("dnys", "--"); | |
| 902 | - m5.put("pjys", "--"); | |
| 901 | + m5.put("upbc", "0"); m5.put("dnbc", "0"); | |
| 902 | + m5.put("upys", "/"); m5.put("dnys", "/"); | |
| 903 | + m5.put("pjys", "/"); | |
| 903 | 904 | tempList.add(m5); |
| 904 | 905 | Map<String, Object> m6 = new HashMap<String, Object>(); |
| 905 | 906 | m6.put("time", "18:01~20:30"); |
| 906 | - m6.put("upbc", "0");m6.put("dnbc", "0"); | |
| 907 | - m6.put("upys", "--");m6.put("dnys", "--"); | |
| 908 | - m6.put("pjys", "--"); | |
| 907 | + m6.put("upbc", "0"); m6.put("dnbc", "0"); | |
| 908 | + m6.put("upys", "/"); m6.put("dnys", "/"); | |
| 909 | + m6.put("pjys", "/"); | |
| 909 | 910 | tempList.add(m6); |
| 910 | 911 | Map<String, Object> m7 = new HashMap<String, Object>(); |
| 911 | 912 | m7.put("time", "20:31~末"); |
| 912 | - m7.put("upbc", "0");m7.put("dnbc", "0"); | |
| 913 | - m7.put("upys", "--");m7.put("dnys", "--"); | |
| 914 | - m7.put("pjys", "--"); | |
| 913 | + m7.put("upbc", "0"); m7.put("dnbc", "0"); | |
| 914 | + m7.put("upys", "/"); m7.put("dnys", "/"); | |
| 915 | + m7.put("pjys", "/"); | |
| 915 | 916 | tempList.add(m7); |
| 916 | 917 | } |
| 917 | 918 | |
| 919 | + String companyName = ""; | |
| 920 | + String subCompanyName = ""; | |
| 921 | + | |
| 918 | 922 | //按时间段分组 |
| 919 | 923 | for(ScheduleRealInfo schedule : list){ |
| 924 | + if(companyName.length()==0&&schedule.getGsName()!=null | |
| 925 | + &&schedule.getGsName().trim().length()!=0){ | |
| 926 | + companyName = schedule.getGsName(); | |
| 927 | + } | |
| 928 | + if(subCompanyName.length()==0&&schedule.getFgsName()!=null | |
| 929 | + &&schedule.getFgsName().trim().length()!=0){ | |
| 930 | + subCompanyName = schedule.getFgsName(); | |
| 931 | + } | |
| 932 | + | |
| 920 | 933 | if(schedule.getFcsjActualTime()!=null && schedule.getZdsjActualTime()!=null){ |
| 921 | 934 | Long fcsjA = schedule.getFcsjActualTime(); |
| 922 | - if(fcsjA <= 6*60+30){ | |
| 935 | + if(!schedule.getRealExecDate().equals(schedule.getScheduleDateStr()) | |
| 936 | + || fcsjA > 20*60+30){ | |
| 937 | + if(!keyMap.containsKey("20:31~末")) | |
| 938 | + keyMap.put("20:31~末", new ArrayList<ScheduleRealInfo>()); | |
| 939 | + keyMap.get("20:31~末").add(schedule); | |
| 940 | + | |
| 941 | + } else if(fcsjA <= 6*60+30){ | |
| 942 | + | |
| 923 | 943 | if(!keyMap.containsKey("首~6:30")) |
| 924 | 944 | keyMap.put("首~6:30", new ArrayList<ScheduleRealInfo>()); |
| 925 | 945 | keyMap.get("首~6:30").add(schedule); |
| 926 | - } | |
| 927 | - if(fcsjA > 6*60+30 && fcsjA <= 8*60+30){ | |
| 946 | + | |
| 947 | + } else if(fcsjA > 6*60+30 && fcsjA <= 8*60+30){ | |
| 948 | + | |
| 928 | 949 | if(!keyMap.containsKey("6:31~8:30")) |
| 929 | 950 | keyMap.put("6:31~8:30", new ArrayList<ScheduleRealInfo>()); |
| 930 | 951 | keyMap.get("6:31~8:30").add(schedule); |
| 931 | - } | |
| 932 | - if(fcsjA > 8*60+30 && fcsjA <= 11*60){ | |
| 952 | + | |
| 953 | + } else if(fcsjA > 8*60+30 && fcsjA <= 11*60){ | |
| 954 | + | |
| 933 | 955 | if(!keyMap.containsKey("8:31~11:00")) |
| 934 | 956 | keyMap.put("8:31~11:00", new ArrayList<ScheduleRealInfo>()); |
| 935 | 957 | keyMap.get("8:31~11:00").add(schedule); |
| 936 | - } | |
| 937 | - if(fcsjA > 11*60 && fcsjA <= 13*60+30){ | |
| 958 | + | |
| 959 | + } else if(fcsjA > 11*60 && fcsjA <= 13*60+30){ | |
| 960 | + | |
| 938 | 961 | if(!keyMap.containsKey("11:01~13:30")) |
| 939 | 962 | keyMap.put("11:01~13:30", new ArrayList<ScheduleRealInfo>()); |
| 940 | 963 | keyMap.get("11:01~13:30").add(schedule); |
| 941 | - } | |
| 942 | - if(fcsjA > 13*60+30 && fcsjA <= 16*60){ | |
| 964 | + | |
| 965 | + } else if(fcsjA > 13*60+30 && fcsjA <= 16*60){ | |
| 966 | + | |
| 943 | 967 | if(!keyMap.containsKey("13:31~16:00")) |
| 944 | 968 | keyMap.put("13:31~16:00", new ArrayList<ScheduleRealInfo>()); |
| 945 | 969 | keyMap.get("13:31~16:00").add(schedule); |
| 946 | - } | |
| 947 | - if(fcsjA > 16*60 && fcsjA <= 18*60){ | |
| 970 | + | |
| 971 | + } else if(fcsjA > 16*60 && fcsjA <= 18*60){ | |
| 972 | + | |
| 948 | 973 | if(!keyMap.containsKey("16:01~18:00")) |
| 949 | 974 | keyMap.put("16:01~18:00", new ArrayList<ScheduleRealInfo>()); |
| 950 | 975 | keyMap.get("16:01~18:00").add(schedule); |
| 951 | - } | |
| 952 | - if(fcsjA > 18*60 && fcsjA <= 20*60+30){ | |
| 976 | + | |
| 977 | + } else if(fcsjA > 18*60 && fcsjA <= 20*60+30){ | |
| 978 | + | |
| 953 | 979 | if(!keyMap.containsKey("18:01~20:30")) |
| 954 | 980 | keyMap.put("18:01~20:30", new ArrayList<ScheduleRealInfo>()); |
| 955 | 981 | keyMap.get("18:01~20:30").add(schedule); |
| 956 | 982 | } |
| 957 | - if(fcsjA > 20*60+30){ | |
| 958 | - if(!keyMap.containsKey("20:31~末")) | |
| 959 | - keyMap.put("20:31~末", new ArrayList<ScheduleRealInfo>()); | |
| 960 | - keyMap.get("20:31~末").add(schedule); | |
| 961 | - } | |
| 962 | 983 | } |
| 963 | 984 | } |
| 964 | 985 | |
| 986 | + boolean flag = false; | |
| 965 | 987 | for(String key : keyMap.keySet()){ |
| 966 | 988 | Map<String, Object> m = null; |
| 967 | 989 | for(Map<String, Object> map2 : tempList){ |
| ... | ... | @@ -972,6 +994,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 972 | 994 | int upbc = 0, dnbc = 0; |
| 973 | 995 | long upys = 0, dnys = 0; |
| 974 | 996 | for(ScheduleRealInfo schedule : keyMap.get(key)){ |
| 997 | + flag = true; | |
| 975 | 998 | if(schedule.getXlDir().equals("0")){ |
| 976 | 999 | upbc++; |
| 977 | 1000 | upys += schedule.getZdsjActualTime() - schedule.getFcsjActualTime(); |
| ... | ... | @@ -979,15 +1002,25 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 979 | 1002 | dnbc++; |
| 980 | 1003 | dnys += schedule.getZdsjActualTime() - schedule.getFcsjActualTime(); |
| 981 | 1004 | } |
| 1005 | + | |
| 1006 | + if(schedule.getXlName() != null && schedule.getXlName().trim().length() != 0){ | |
| 1007 | + m.put("line", schedule.getXlName()); | |
| 1008 | + } | |
| 982 | 1009 | } |
| 983 | 1010 | m.put("upbc", upbc); |
| 984 | 1011 | m.put("dnbc", dnbc); |
| 985 | - m.put("upys", nf.format((float)upys / upbc)); | |
| 986 | - m.put("dnys", nf.format((float)dnys / dnbc)); | |
| 987 | - m.put("pjys", nf.format((float) (upys + dnys) / (upbc + dnbc))); | |
| 1012 | + m.put("upys", upbc > 0 ? nf.format((float)upys / upbc) : "/"); | |
| 1013 | + m.put("dnys", dnbc > 0 ? nf.format((float)dnys / dnbc) : "/"); | |
| 1014 | + m.put("pjys", (upbc + dnbc) > 0 ? nf.format((float) (upys + dnys) / (upbc + dnbc)) : "/"); | |
| 1015 | + m.put("company", companyName.trim()); | |
| 1016 | + m.put("subCompany", subCompanyName.trim()); | |
| 988 | 1017 | } |
| 989 | 1018 | |
| 990 | - modelMap.put("dataList", tempList); | |
| 1019 | + if(flag){ | |
| 1020 | + modelMap.put("dataList", tempList); | |
| 1021 | + } else { | |
| 1022 | + modelMap.put("dataList", new ArrayList<Map<String, Object>>()); | |
| 1023 | + } | |
| 991 | 1024 | |
| 992 | 1025 | //导出 |
| 993 | 1026 | if(type.equals("export")){ |
| ... | ... | @@ -1180,6 +1213,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1180 | 1213 | } |
| 1181 | 1214 | } |
| 1182 | 1215 | |
| 1216 | + if(longList0.size() == 0 && longList1.size() == 0){ | |
| 1217 | + continue; | |
| 1218 | + } | |
| 1219 | + | |
| 1183 | 1220 | if(longList0.size() != 0){ |
| 1184 | 1221 | Collections.sort(longList0); |
| 1185 | 1222 | ScheduleRealInfo shouban0 = temp0.get(longList0.get(0)); |
| ... | ... | @@ -1297,7 +1334,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1297 | 1334 | return resList; |
| 1298 | 1335 | } |
| 1299 | 1336 | |
| 1300 | -// @Override | |
| 1337 | + @Override | |
| 1301 | 1338 | public List<Map<String, Object>> firstAndLastBus_sum(Map<String, Object> map) { |
| 1302 | 1339 | NumberFormat nf = NumberFormat.getNumberInstance(); |
| 1303 | 1340 | nf.setMinimumFractionDigits(2); |
| ... | ... | @@ -1330,6 +1367,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1330 | 1367 | } |
| 1331 | 1368 | for(String key : keyMap.keySet()){ |
| 1332 | 1369 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 1370 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 1333 | 1371 | Map<Long, ScheduleRealInfo> temp0 = new HashMap<Long, ScheduleRealInfo>(); |
| 1334 | 1372 | List<Long> longList0 = new ArrayList<Long>(); |
| 1335 | 1373 | Map<Long, ScheduleRealInfo> temp1 = new HashMap<Long, ScheduleRealInfo>(); |
| ... | ... | @@ -1355,6 +1393,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1355 | 1393 | } |
| 1356 | 1394 | } |
| 1357 | 1395 | |
| 1396 | + if(longList0.size() == 0 && longList1.size() == 0){ | |
| 1397 | + continue; | |
| 1398 | + } | |
| 1358 | 1399 | int jhbc = 0; |
| 1359 | 1400 | int sjbc = 0; |
| 1360 | 1401 | |
| ... | ... | @@ -1370,6 +1411,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1370 | 1411 | if(delay >= -3 && delay <= 1){ |
| 1371 | 1412 | sjbc++; |
| 1372 | 1413 | } |
| 1414 | + m.put("qdzFirst0", shouban0.getQdzName()); | |
| 1415 | + m.put("jhfcFirst0", shouban0.getFcsj()); | |
| 1416 | + m.put("sjfcFirst0", shouban0.getFcsjActual()); | |
| 1417 | + m.put("delayFirst0", delay>0?"+"+delay:delay); | |
| 1373 | 1418 | } |
| 1374 | 1419 | |
| 1375 | 1420 | if(moban0.getFcsjActual() != null){ |
| ... | ... | @@ -1380,7 +1425,20 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1380 | 1425 | if(delay >= -3 && delay <= 1){ |
| 1381 | 1426 | sjbc++; |
| 1382 | 1427 | } |
| 1428 | + m.put("qdzLast0", moban0.getQdzName()); | |
| 1429 | + m.put("jhfcLast0", moban0.getFcsj()); | |
| 1430 | + m.put("sjfcLast0", moban0.getFcsjActual()); | |
| 1431 | + m.put("delayLast0", delay>0?"+"+delay:delay); | |
| 1383 | 1432 | } |
| 1433 | + } else { | |
| 1434 | + m.put("qdzFirst0", "--"); | |
| 1435 | + m.put("jhfcFirst0", "/"); | |
| 1436 | + m.put("sjfcFirst0", "/"); | |
| 1437 | + m.put("delayFirst0", "/"); | |
| 1438 | + m.put("qdzLast0", "--"); | |
| 1439 | + m.put("jhfcLast0", "/"); | |
| 1440 | + m.put("sjfcLast0", "/"); | |
| 1441 | + m.put("delayLast0", "/"); | |
| 1384 | 1442 | } |
| 1385 | 1443 | |
| 1386 | 1444 | if(longList1.size() != 0){ |
| ... | ... | @@ -1395,7 +1453,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1395 | 1453 | if(delay >= -3 && delay <= 1){ |
| 1396 | 1454 | sjbc++; |
| 1397 | 1455 | } |
| 1456 | + m.put("qdzFirst1", shouban1.getQdzName()); | |
| 1457 | + m.put("jhfcFirst1", shouban1.getFcsj()); | |
| 1458 | + m.put("sjfcFirst1", shouban1.getFcsjActual()); | |
| 1459 | + m.put("delayFirst1", delay>0?"+"+delay:delay); | |
| 1398 | 1460 | } |
| 1461 | + | |
| 1399 | 1462 | if(moban1.getFcsjActual() != null){ |
| 1400 | 1463 | jhbc++; |
| 1401 | 1464 | String[] split = moban1.getFcsjActual().split(":"); |
| ... | ... | @@ -1404,9 +1467,24 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1404 | 1467 | if(delay >= -3 && delay <= 1){ |
| 1405 | 1468 | sjbc++; |
| 1406 | 1469 | } |
| 1470 | + m.put("qdzLast1", moban1.getQdzName()); | |
| 1471 | + m.put("jhfcLast1", moban1.getFcsj()); | |
| 1472 | + m.put("sjfcLast1", moban1.getFcsjActual()); | |
| 1473 | + m.put("delayLast1", delay>0?"+"+delay:delay); | |
| 1407 | 1474 | } |
| 1475 | + } else { | |
| 1476 | + m.put("qdzFirst1", "--"); | |
| 1477 | + m.put("jhfcFirst1", "/"); | |
| 1478 | + m.put("sjfcFirst1", "/"); | |
| 1479 | + m.put("delayFirst1", "/"); | |
| 1480 | + m.put("qdzLast1", "--"); | |
| 1481 | + m.put("jhfcLast1", "/"); | |
| 1482 | + m.put("sjfcLast1", "/"); | |
| 1483 | + m.put("delayLast1", "/"); | |
| 1408 | 1484 | } |
| 1409 | - | |
| 1485 | + | |
| 1486 | + m.put("line", key); | |
| 1487 | + tempMap.put("map", m); | |
| 1410 | 1488 | tempMap.put("jhbc", jhbc); |
| 1411 | 1489 | tempMap.put("sjbc", sjbc); |
| 1412 | 1490 | tempMap.put("zdl", nf.format((float) sjbc / jhbc *100) + "%"); |
| ... | ... | @@ -1415,7 +1493,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1415 | 1493 | tempMap.put("subCompany", subCompanyName); |
| 1416 | 1494 | tempMap.put("line", key); |
| 1417 | 1495 | resList.add(tempMap); |
| 1418 | - System.out.println(tempMap); | |
| 1419 | 1496 | } |
| 1420 | 1497 | |
| 1421 | 1498 | if(type.equals("export")){ |
| ... | ... | @@ -1427,8 +1504,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1427 | 1504 | try { |
| 1428 | 1505 | listI.add(resList.iterator()); |
| 1429 | 1506 | String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; |
| 1430 | - ee.excelReplace(listI, new Object[] { m }, path+"mould/firstAndLastBus.xls", | |
| 1431 | - path+"export/线路首末班" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 1507 | + ee.excelReplace(listI, new Object[] { m }, path+"mould/firstAndLastBus_sum.xls", | |
| 1508 | + path+"export/线路首末班准点率" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 1432 | 1509 | } catch (Exception e) { |
| 1433 | 1510 | // TODO: handle exception |
| 1434 | 1511 | e.printStackTrace(); | ... | ... |
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
| ... | ... | @@ -21,6 +21,9 @@ import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; |
| 21 | 21 | import com.bsth.service.schedule.rules.ttinfo.*; |
| 22 | 22 | import com.bsth.service.schedule.rules.ttinfo2.CalcuParam; |
| 23 | 23 | import com.bsth.service.schedule.rules.ttinfo2.Result; |
| 24 | +import com.bsth.service.schedule.rules.validate.ValidateParam; | |
| 25 | +import com.bsth.service.schedule.rules.validate.ValidateResults_output; | |
| 26 | +import org.apache.commons.lang3.StringUtils; | |
| 24 | 27 | import org.joda.time.DateTime; |
| 25 | 28 | import org.kie.api.KieBase; |
| 26 | 29 | import org.kie.api.runtime.KieSession; |
| ... | ... | @@ -321,6 +324,60 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 321 | 324 | |
| 322 | 325 | } |
| 323 | 326 | |
| 327 | + /** | |
| 328 | + * 验证排班结果。 | |
| 329 | + * @param planResult | |
| 330 | + * @param schedulePlan | |
| 331 | + */ | |
| 332 | + public void validPlanResult(PlanResult planResult, SchedulePlan schedulePlan) { | |
| 333 | + // 1-1、构造drools规则输入数据,输出数据 | |
| 334 | + ValidateParam validateParam = new ValidateParam( | |
| 335 | + new DateTime(schedulePlan.getScheduleFromTime()), | |
| 336 | + new DateTime(schedulePlan.getScheduleToTime()) | |
| 337 | + ); | |
| 338 | + // 规则输出数据 | |
| 339 | + ValidateResults_output result = new ValidateResults_output(); | |
| 340 | + | |
| 341 | + // 1-2、构造drools session->载入数据->启动规则->计算->销毁session | |
| 342 | + // 创建session,内部配置的是stateful | |
| 343 | + KieSession session = kieBase.newKieSession(); | |
| 344 | + | |
| 345 | + // 设置gloable对象,在drl中通过别名使用 | |
| 346 | + session.setGlobal("validResult", result); | |
| 347 | + session.setGlobal("log", logger); // 设置日志 | |
| 348 | + | |
| 349 | + // 载入数据 | |
| 350 | + session.insert(validateParam); | |
| 351 | + for (SchedulePlanInfo schedulePlanInfo: planResult.getSchedulePlanInfos()) { | |
| 352 | + session.insert(schedulePlanInfo); | |
| 353 | + } | |
| 354 | + | |
| 355 | + // 执行rule | |
| 356 | + session.fireAllRules(); | |
| 357 | + | |
| 358 | + // 执行完毕销毁,有日志的也要关闭 | |
| 359 | + session.dispose(); | |
| 360 | + | |
| 361 | +// logger.info("错误总数={}", result.getInfos().size()); | |
| 362 | +// for (ValidateResults_output.ValidInfo validInfo: result.getInfos()) { | |
| 363 | +// logger.info(validInfo.getDesc()); | |
| 364 | +// } | |
| 365 | + | |
| 366 | + // 取10条错误 | |
| 367 | + int size = result.getInfos().size() > 10 ? 10: result.getInfos().size(); | |
| 368 | + List<String> desclist = new ArrayList<>(); | |
| 369 | + for (int i = 0; i < size; i++) { | |
| 370 | + desclist.add(result.getInfos().get(i).getDesc()); | |
| 371 | + } | |
| 372 | + if (desclist.size() > 0) { | |
| 373 | + schedulePlan.setPlanResult(StringUtils.join(desclist, "</br>")); | |
| 374 | + } else { | |
| 375 | + schedulePlan.setPlanResult("ok"); | |
| 376 | + } | |
| 377 | + | |
| 378 | + // TODO:设定错误信息 | |
| 379 | + } | |
| 380 | + | |
| 324 | 381 | @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) |
| 325 | 382 | public SchedulePlan save(SchedulePlan schedulePlan) { |
| 326 | 383 | // pre、如果排班的数据之前已经有了,删除之前的数据 |
| ... | ... | @@ -341,6 +398,9 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 341 | 398 | // 3、确定套跑规则 |
| 342 | 399 | rerunPlanResult(planResult, schedulePlan); |
| 343 | 400 | |
| 401 | + // TODO:3-1、验证排班结果 | |
| 402 | + validPlanResult(planResult, schedulePlan); | |
| 403 | + | |
| 344 | 404 | // 4、保存数据(jdbcTemplate 批量插入) |
| 345 | 405 | Date start4 = new Date(); |
| 346 | 406 | scheduleRuleService.generateSchedulePlan(schedulePlan, planResult.getSchedulePlanInfos()); | ... | ... |
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java
| ... | ... | @@ -74,6 +74,9 @@ public class MyDroolsConfiguration { |
| 74 | 74 | kfs.write("src/main/resources/rerun.drl", kieServices.getResources() |
| 75 | 75 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 76 | 76 | "/rules/rerun.drl"), "UTF-8")); |
| 77 | + kfs.write("src/main/resources/validplan.drl", kieServices.getResources() | |
| 78 | + .newInputStreamResource(this.getClass().getResourceAsStream( | |
| 79 | + "/rules/validplan.drl"), "UTF-8")); | |
| 77 | 80 | // TODO:还有其他drl.... |
| 78 | 81 | |
| 79 | 82 | // 4、创建KieBuilder,使用KieFileSystem构建 | ... | ... |
src/main/java/com/bsth/service/schedule/rules/ScheduleRuleServiceImpl.java
| ... | ... | @@ -119,6 +119,7 @@ public class ScheduleRuleServiceImpl implements ScheduleRuleService { |
| 119 | 119 | obj.setScheduleDate(rs.getDate("schedule_date")); |
| 120 | 120 | obj.setGidindex(rs.getString("gidindex")); |
| 121 | 121 | obj.setEcindex(rs.getString("ecindex")); |
| 122 | + obj.setOrigingidindex(rs.getString("origingidindex")); | |
| 122 | 123 | |
| 123 | 124 | // 其他字段没用 |
| 124 | 125 | return obj; | ... | ... |
src/main/java/com/bsth/service/schedule/rules/validate/ValidRepeatBcFunction.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.validate; | |
| 2 | + | |
| 3 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 4 | +import org.kie.api.runtime.rule.AccumulateFunction; | |
| 5 | + | |
| 6 | +import java.io.*; | |
| 7 | +import java.text.SimpleDateFormat; | |
| 8 | +import java.util.ArrayList; | |
| 9 | +import java.util.HashMap; | |
| 10 | +import java.util.List; | |
| 11 | +import java.util.Map; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * 计算班次重复错误。 | |
| 15 | + * 同一个路牌下,相同发车时间的班次数。 | |
| 16 | + * 注意:使用这个函数时,要一天计算一次,多天计算无意义。 | |
| 17 | + */ | |
| 18 | +public class ValidRepeatBcFunction implements AccumulateFunction { | |
| 19 | + @Override | |
| 20 | + public void writeExternal(ObjectOutput out) throws IOException { | |
| 21 | + } | |
| 22 | + | |
| 23 | + @Override | |
| 24 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | |
| 25 | + | |
| 26 | + } | |
| 27 | + | |
| 28 | + protected static class RepeatBcInfo implements Externalizable { | |
| 29 | + /** 错误描述 */ | |
| 30 | + public List<ValidateResults_output.ValidInfo> validInfoList = new ArrayList<>(); | |
| 31 | + /** 内部计数Map,key:{路牌Id}_{发车时间},value:个数 */ | |
| 32 | + public Map<String, Integer> lpBcFcsjCount = new HashMap<>(); | |
| 33 | + | |
| 34 | + public RepeatBcInfo() { | |
| 35 | + } | |
| 36 | + | |
| 37 | + @Override | |
| 38 | + public void writeExternal(ObjectOutput out) throws IOException { | |
| 39 | + out.writeObject(validInfoList); | |
| 40 | + } | |
| 41 | + | |
| 42 | + @Override | |
| 43 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | |
| 44 | + validInfoList = (List<ValidateResults_output.ValidInfo>) in.readObject(); | |
| 45 | + } | |
| 46 | + } | |
| 47 | + | |
| 48 | + @Override | |
| 49 | + public Serializable createContext() { | |
| 50 | + System.out.println("create"); | |
| 51 | + return new RepeatBcInfo(); | |
| 52 | + } | |
| 53 | + | |
| 54 | + @Override | |
| 55 | + public void init(Serializable serializable) throws Exception { | |
| 56 | + // TODO: | |
| 57 | + System.out.println("init"); | |
| 58 | + } | |
| 59 | + | |
| 60 | + @Override | |
| 61 | + public void accumulate(Serializable context, Object o) { | |
| 62 | + RepeatBcInfo repeatBcInfo = (RepeatBcInfo) context; | |
| 63 | + SchedulePlanInfo schedulePlanInfo = (SchedulePlanInfo) o; | |
| 64 | + | |
| 65 | + String key = schedulePlanInfo.getLp() + "_" + schedulePlanInfo.getFcsj(); | |
| 66 | + SimpleDateFormat sf = new SimpleDateFormat("yyyy年MM月dd日"); | |
| 67 | + String infoformat = "日期(%s),路牌(%s),班次(%s),重复(%d)次"; | |
| 68 | + if (repeatBcInfo.lpBcFcsjCount.get(key) == null) { | |
| 69 | + repeatBcInfo.lpBcFcsjCount.put(key, 1); | |
| 70 | + } else { | |
| 71 | + int count = repeatBcInfo.lpBcFcsjCount.get(key) + 1; | |
| 72 | + ValidateResults_output.ValidInfo validInfo = new ValidateResults_output.ValidInfo(); | |
| 73 | + validInfo.setSd(schedulePlanInfo.getScheduleDate()); | |
| 74 | + validInfo.setDesc(String.format( | |
| 75 | + infoformat, | |
| 76 | + sf.format(schedulePlanInfo.getScheduleDate()), | |
| 77 | + schedulePlanInfo.getLpName(), | |
| 78 | + schedulePlanInfo.getFcsj(), | |
| 79 | + count)); | |
| 80 | + repeatBcInfo.validInfoList.add(validInfo); | |
| 81 | + repeatBcInfo.lpBcFcsjCount.put(key, count); | |
| 82 | + } | |
| 83 | + } | |
| 84 | + | |
| 85 | + @Override | |
| 86 | + public boolean supportsReverse() { | |
| 87 | + return true; | |
| 88 | + } | |
| 89 | + | |
| 90 | + @Override | |
| 91 | + public void reverse(Serializable context, Object o) throws Exception { | |
| 92 | + RepeatBcInfo repeatBcInfo = (RepeatBcInfo) context; | |
| 93 | + SchedulePlanInfo schedulePlanInfo = (SchedulePlanInfo) o; | |
| 94 | + | |
| 95 | + String key = schedulePlanInfo.getLp() + "_" + schedulePlanInfo.getFcsj(); | |
| 96 | + repeatBcInfo.lpBcFcsjCount.remove(key); | |
| 97 | + | |
| 98 | + if (!repeatBcInfo.validInfoList.isEmpty()) { // 全部清空 | |
| 99 | + repeatBcInfo.validInfoList.clear(); | |
| 100 | + } | |
| 101 | + } | |
| 102 | + | |
| 103 | + @Override | |
| 104 | + public Class<?> getResultType() { | |
| 105 | + return List.class; | |
| 106 | + } | |
| 107 | + | |
| 108 | + @Override | |
| 109 | + public Object getResult(Serializable context) throws Exception { | |
| 110 | + RepeatBcInfo repeatBcInfo = (RepeatBcInfo) context; | |
| 111 | + return repeatBcInfo.validInfoList; | |
| 112 | + } | |
| 113 | +} | ... | ... |
src/main/java/com/bsth/service/schedule/rules/validate/ValidateParam.java
| ... | ... | @@ -16,7 +16,9 @@ public class ValidateParam { |
| 16 | 16 | /** 间隔天数 */ |
| 17 | 17 | private Integer days; |
| 18 | 18 | |
| 19 | - public ValidateParam() { | |
| 19 | + public ValidateParam(DateTime f, DateTime t) { | |
| 20 | + this.fromDate = f; | |
| 21 | + this.toDate = t; | |
| 20 | 22 | Period period = new Period(fromDate, toDate, PeriodType.days()); |
| 21 | 23 | days = period.getDays() + 1; |
| 22 | 24 | } | ... | ... |
src/main/java/com/bsth/service/schedule/rules/validate/ValidateResults_output.java
src/main/java/com/bsth/websocket/handler/RealControlSocketHandler.java
| 1 | 1 | package com.bsth.websocket.handler; |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.bsth.common.Constants; | |
| 5 | 4 | import com.bsth.data.BasicData; |
| 5 | +import com.bsth.data.msg_queue.WebSocketPushQueue; | |
| 6 | 6 | import com.google.common.base.Splitter; |
| 7 | 7 | import org.slf4j.Logger; |
| 8 | 8 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -103,7 +103,8 @@ public class RealControlSocketHandler implements WebSocketHandler { |
| 103 | 103 | return; |
| 104 | 104 | |
| 105 | 105 | for(WebSocketSession user : list){ |
| 106 | - try { | |
| 106 | + WebSocketPushQueue.put(user, message); | |
| 107 | + /*try { | |
| 107 | 108 | if (user.isOpen()) { |
| 108 | 109 | user.sendMessage(message); |
| 109 | 110 | } |
| ... | ... | @@ -114,7 +115,7 @@ public class RealControlSocketHandler implements WebSocketHandler { |
| 114 | 115 | catch(Exception e2){} |
| 115 | 116 | logger.error("sendMessageToLine error ...."+msg); |
| 116 | 117 | logger.error("sendMessageToLine error ....", e); |
| 117 | - } | |
| 118 | + }*/ | |
| 118 | 119 | } |
| 119 | 120 | } |
| 120 | 121 | ... | ... |
src/main/resources/application-dev.properties
| ... | ... | @@ -11,9 +11,7 @@ spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
| 11 | 11 | spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false |
| 12 | 12 | spring.datasource.username= root |
| 13 | 13 | spring.datasource.password= |
| 14 | -#spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 15 | -#spring.datasource.username= root | |
| 16 | -#spring.datasource.password= root | |
| 14 | + | |
| 17 | 15 | #DATASOURCE |
| 18 | 16 | spring.datasource.max-active=100 |
| 19 | 17 | spring.datasource.max-idle=8 |
| ... | ... | @@ -29,7 +27,6 @@ spring.datasource.validation-query=select 1 |
| 29 | 27 | ## |
| 30 | 28 | #222.66.0.204:5555 |
| 31 | 29 | ##\u5B9E\u65F6gps |
| 32 | -http.gps.real.url= http://114.80.178.12:18080/transport_server/rtgps/ | |
| 33 | 30 | #http.gps.real.url= http://27.115.69.123:8800/transport_server/rtgps/ |
| 34 | 31 | ##\u6D88\u606F\u4E0B\u53D1 |
| 35 | -http.send.directive = http://192.168.168.201:9090/transport_server/message/ | |
| 36 | 32 | \ No newline at end of file |
| 33 | +http.send.directive = http://192.168.168.201:9090/transport_server/message/ | ... | ... |
src/main/resources/datatools/ktrs/ttinfodetailDataInput.ktr
| ... | ... | @@ -828,7 +828,7 @@ |
| 828 | 828 | <optimizationLevel>9</optimizationLevel> |
| 829 | 829 | <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> |
| 830 | 830 | <jsScript_name>Script 1</jsScript_name> |
| 831 | - <jsScript_script>//Script here

// 使用正则表达式去除站点名称中的数字
qdzname = qdzname.replace(/\d+/g,'');

// sendtime处理,hhmm,hh:mm,hh,mm
var sendtime_calcu;
if (sendtime.length == 5) { // 最长格式,包括分隔符,统一把分隔符替换成冒号
 sendtime_calcu = sendtime.substr(0, 2) + ":" + sendtime.substr(3, 2);
} else if (sendtime.length == 4) {
 if (sendtime.indexOf(":") > 0) { // 冒号分隔,无需修改
 sendtime_calcu = sendtime;
 } else if (sendtime.indexOf(",") > 0) { // 逗号分隔,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 1) + ":" + sendtime.substr(2, 2);
 } else { // 无分隔符,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 2) + ":" + sendtime.substr(2, 2);
 }
} else if (sendtime.length == 3) { // 无分隔符,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 1) + ":" + sendtime.substr(1, 2);
}

// 设置分班
var isfb = 0;

// 设置isCanceled
var iscanceled = 0;</jsScript_script> | |
| 831 | + <jsScript_script>//Script here

// 使用正则表达式去除站点名称中的数字
qdzname = qdzname.replace(/\d+/g,'');

// sendtime处理,hhmm,hh:mm,hh,mm
var sendtime_calcu;
if (sendtime.length == 5) { // 最长格式,包括分隔符,统一把分隔符替换成冒号
 sendtime_calcu = sendtime.substr(0, 2) + ":" + sendtime.substr(3, 2);
} else if (sendtime.length == 4) {
 if (sendtime.indexOf(":") > 0) { // 冒号分隔,无需修改
 sendtime_calcu = sendtime;
 } else if (sendtime.indexOf(",") > 0) { // 逗号分隔,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 1) + ":" + sendtime.substr(2, 2);
 } else { // 无分隔符,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 2) + ":" + sendtime.substr(2, 2);
 }
} else if (sendtime.length == 3) { // 无分隔符,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 1) + ":" + sendtime.substr(1, 2);
}

// 设置分班
var isfb = 0;

// 设置停驶
var ists = 0;

// 设置isCanceled
var iscanceled = 0;</jsScript_script> | |
| 832 | 832 | </jsScript> </jsScripts> <fields> <field> <name>qdzname</name> |
| 833 | 833 | <rename>qdzname</rename> |
| 834 | 834 | <type>String</type> |
| ... | ... | @@ -853,6 +853,12 @@ |
| 853 | 853 | <length>-1</length> |
| 854 | 854 | <precision>-1</precision> |
| 855 | 855 | <replace>N</replace> |
| 856 | + </field> <field> <name>ists</name> | |
| 857 | + <rename>ists</rename> | |
| 858 | + <type>Integer</type> | |
| 859 | + <length>-1</length> | |
| 860 | + <precision>-1</precision> | |
| 861 | + <replace>N</replace> | |
| 856 | 862 | </field> </fields> <cluster_schema/> |
| 857 | 863 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 858 | 864 | <xloc>788</xloc> |
| ... | ... | @@ -1083,6 +1089,11 @@ |
| 1083 | 1089 | <rename>zdzname</rename> |
| 1084 | 1090 | <update>Y</update> |
| 1085 | 1091 | </value> |
| 1092 | + <value> | |
| 1093 | + <name>ists</name> | |
| 1094 | + <rename>ists</rename> | |
| 1095 | + <update>Y</update> | |
| 1096 | + </value> | |
| 1086 | 1097 | </lookup> |
| 1087 | 1098 | <cluster_schema/> |
| 1088 | 1099 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| ... | ... | @@ -1224,6 +1235,11 @@ |
| 1224 | 1235 | <rename>zdzname</rename> |
| 1225 | 1236 | <update>Y</update> |
| 1226 | 1237 | </value> |
| 1238 | + <value> | |
| 1239 | + <name>ists</name> | |
| 1240 | + <rename>ists</rename> | |
| 1241 | + <update>Y</update> | |
| 1242 | + </value> | |
| 1227 | 1243 | </lookup> |
| 1228 | 1244 | <cluster_schema/> |
| 1229 | 1245 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| ... | ... | @@ -1365,6 +1381,11 @@ |
| 1365 | 1381 | <rename>tn</rename> |
| 1366 | 1382 | <update>Y</update> |
| 1367 | 1383 | </value> |
| 1384 | + <value> | |
| 1385 | + <name>ists</name> | |
| 1386 | + <rename>ists</rename> | |
| 1387 | + <update>Y</update> | |
| 1388 | + </value> | |
| 1368 | 1389 | </lookup> |
| 1369 | 1390 | <cluster_schema/> |
| 1370 | 1391 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | ... | ... |
src/main/resources/datatools/ktrs/ttinfodetailDataInput2.ktr
| ... | ... | @@ -828,7 +828,7 @@ |
| 828 | 828 | <optimizationLevel>9</optimizationLevel> |
| 829 | 829 | <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> |
| 830 | 830 | <jsScript_name>Script 1</jsScript_name> |
| 831 | - <jsScript_script>//Script here

// 使用正则表达式去除站点名称中的数字
qdzname = qdzname.replace(/\d+/g,'');

// sendtime处理,hhmm,hh:mm,hh,mm
var sendtime_calcu;
if (sendtime.length == 5) { // 最长格式,包括分隔符,统一把分隔符替换成冒号
 sendtime_calcu = sendtime.substr(0, 2) + ":" + sendtime.substr(3, 2);
} else if (sendtime.length == 4) {
 if (sendtime.indexOf(":") > 0) { // 冒号分隔,无需修改
 sendtime_calcu = sendtime;
 } else if (sendtime.indexOf(",") > 0) { // 逗号分隔,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 1) + ":" + sendtime.substr(2, 2);
 } else { // 无分隔符,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 2) + ":" + sendtime.substr(2, 2);
 }
} else if (sendtime.length == 3) { // 无分隔符,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 1) + ":" + sendtime.substr(1, 2);
}

// 设置分班
var isfb = 0;

// 设置isCanceled
var iscanceled = 0;</jsScript_script> | |
| 831 | + <jsScript_script>//Script here

// 使用正则表达式去除站点名称中的数字
qdzname = qdzname.replace(/\d+/g,'');

// sendtime处理,hhmm,hh:mm,hh,mm
var sendtime_calcu;
if (sendtime.length == 5) { // 最长格式,包括分隔符,统一把分隔符替换成冒号
 sendtime_calcu = sendtime.substr(0, 2) + ":" + sendtime.substr(3, 2);
} else if (sendtime.length == 4) {
 if (sendtime.indexOf(":") > 0) { // 冒号分隔,无需修改
 sendtime_calcu = sendtime;
 } else if (sendtime.indexOf(",") > 0) { // 逗号分隔,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 1) + ":" + sendtime.substr(2, 2);
 } else { // 无分隔符,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 2) + ":" + sendtime.substr(2, 2);
 }
} else if (sendtime.length == 3) { // 无分隔符,改成冒号分隔
 sendtime_calcu = sendtime.substr(0, 1) + ":" + sendtime.substr(1, 2);
}

// 设置分班
var isfb = 0;

// 设置停驶
var ists = 0;

// 设置isCanceled
var iscanceled = 0;</jsScript_script> | |
| 832 | 832 | </jsScript> </jsScripts> <fields> <field> <name>qdzname</name> |
| 833 | 833 | <rename>qdzname</rename> |
| 834 | 834 | <type>String</type> |
| ... | ... | @@ -853,6 +853,12 @@ |
| 853 | 853 | <length>-1</length> |
| 854 | 854 | <precision>-1</precision> |
| 855 | 855 | <replace>N</replace> |
| 856 | + </field> <field> <name>ists</name> | |
| 857 | + <rename>ists</rename> | |
| 858 | + <type>Integer</type> | |
| 859 | + <length>-1</length> | |
| 860 | + <precision>-1</precision> | |
| 861 | + <replace>N</replace> | |
| 856 | 862 | </field> </fields> <cluster_schema/> |
| 857 | 863 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 858 | 864 | <xloc>788</xloc> |
| ... | ... | @@ -1083,6 +1089,11 @@ |
| 1083 | 1089 | <rename>zdzname</rename> |
| 1084 | 1090 | <update>Y</update> |
| 1085 | 1091 | </value> |
| 1092 | + <value> | |
| 1093 | + <name>ists</name> | |
| 1094 | + <rename>ists</rename> | |
| 1095 | + <update>Y</update> | |
| 1096 | + </value> | |
| 1086 | 1097 | </lookup> |
| 1087 | 1098 | <cluster_schema/> |
| 1088 | 1099 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| ... | ... | @@ -1224,6 +1235,11 @@ |
| 1224 | 1235 | <rename>zdzname</rename> |
| 1225 | 1236 | <update>Y</update> |
| 1226 | 1237 | </value> |
| 1238 | + <value> | |
| 1239 | + <name>ists</name> | |
| 1240 | + <rename>ists</rename> | |
| 1241 | + <update>Y</update> | |
| 1242 | + </value> | |
| 1227 | 1243 | </lookup> |
| 1228 | 1244 | <cluster_schema/> |
| 1229 | 1245 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| ... | ... | @@ -1365,6 +1381,11 @@ |
| 1365 | 1381 | <rename>tn</rename> |
| 1366 | 1382 | <update>Y</update> |
| 1367 | 1383 | </value> |
| 1384 | + <value> | |
| 1385 | + <name>ists</name> | |
| 1386 | + <rename>ists</rename> | |
| 1387 | + <update>Y</update> | |
| 1388 | + </value> | |
| 1368 | 1389 | </lookup> |
| 1369 | 1390 | <cluster_schema/> |
| 1370 | 1391 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | ... | ... |
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/logback.xml
| ... | ... | @@ -182,6 +182,48 @@ |
| 182 | 182 | <appender-ref ref="GPS_COUNT" /> |
| 183 | 183 | </logger> |
| 184 | 184 | |
| 185 | + <!-- 消息队列纪录 --> | |
| 186 | + <appender name="QUEUE_WEB_SOCKET" | |
| 187 | + class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 188 | + <file>${LOG_BASE}/msg_queue/websocket.log</file> | |
| 189 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
| 190 | + <fileNamePattern>${LOG_BASE}/msg_queue/websocket-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |
| 191 | + <timeBasedFileNamingAndTriggeringPolicy | |
| 192 | + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |
| 193 | + <maxFileSize>100MB</maxFileSize> | |
| 194 | + </timeBasedFileNamingAndTriggeringPolicy> | |
| 195 | + </rollingPolicy> | |
| 196 | + | |
| 197 | + <layout class="ch.qos.logback.classic.PatternLayout"> | |
| 198 | + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%file:%line] %-5level -%msg%n | |
| 199 | + </pattern> | |
| 200 | + </layout> | |
| 201 | + </appender> | |
| 202 | + <logger name="com.bsth.data.msg_queue.WebSocketPushQueue" | |
| 203 | + level="INFO" additivity="false"> | |
| 204 | + <appender-ref ref="QUEUE_WEB_SOCKET" /> | |
| 205 | + </logger> | |
| 206 | + <appender name="QUEUE_DIRECTIVE" | |
| 207 | + class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 208 | + <file>${LOG_BASE}/msg_queue/directive.log</file> | |
| 209 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
| 210 | + <fileNamePattern>${LOG_BASE}/msg_queue/directive-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |
| 211 | + <timeBasedFileNamingAndTriggeringPolicy | |
| 212 | + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |
| 213 | + <maxFileSize>100MB</maxFileSize> | |
| 214 | + </timeBasedFileNamingAndTriggeringPolicy> | |
| 215 | + </rollingPolicy> | |
| 216 | + | |
| 217 | + <layout class="ch.qos.logback.classic.PatternLayout"> | |
| 218 | + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%file:%line] %-5level -%msg%n | |
| 219 | + </pattern> | |
| 220 | + </layout> | |
| 221 | + </appender> | |
| 222 | + <logger name="com.bsth.data.msg_queue.DirectivePushQueue" | |
| 223 | + level="INFO" additivity="false"> | |
| 224 | + <appender-ref ref="QUEUE_DIRECTIVE" /> | |
| 225 | + </logger> | |
| 226 | + | |
| 185 | 227 | <!--<logger name="org.hibernate.SQL" level="TRACE">--> |
| 186 | 228 | <!--<appender-ref ref="STDOUT" />--> |
| 187 | 229 | <!--</logger>--> | ... | ... |
src/main/resources/rules/functions.drl
| ... | ... | @@ -4,4 +4,5 @@ import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction e |
| 4 | 4 | import accumulate com.bsth.service.schedule.rules.shiftloop.GidsCountFunction gidscount; |
| 5 | 5 | import accumulate com.bsth.service.schedule.rules.shiftloop.GidFbTimeFunction gidfbtime; |
| 6 | 6 | import accumulate com.bsth.service.schedule.rules.ttinfo.LpInfoResultsFunction lpinforesult; |
| 7 | -import accumulate com.bsth.service.schedule.rules.ttinfo.MinRuleQyrqFunction minruleqyrq | |
| 8 | 7 | \ No newline at end of file |
| 8 | +import accumulate com.bsth.service.schedule.rules.ttinfo.MinRuleQyrqFunction minruleqyrq; | |
| 9 | +import accumulate com.bsth.service.schedule.rules.validate.ValidRepeatBcFunction vrb; | |
| 9 | 10 | \ No newline at end of file | ... | ... |
src/main/resources/rules/shiftloop_fb_2.drl
| ... | ... | @@ -88,7 +88,9 @@ rule "calcu_days_1_" |
| 88 | 88 | String ruleMd5 = Md5Util.getMd5( |
| 89 | 89 | String.valueOf($qyrq.getMillis()) + |
| 90 | 90 | "_" + |
| 91 | - $sri.getSelf().getLpIds() | |
| 91 | + $sri.getSelf().getLpIds() + | |
| 92 | + "_" + | |
| 93 | + $sri.getSelf().getLpStart().toString() | |
| 92 | 94 | ); |
| 93 | 95 | cdrp.setRuleMd5(ruleMd5); |
| 94 | 96 | // 人员范围个数 |
| ... | ... | @@ -136,7 +138,9 @@ rule "calcu_days_2_" |
| 136 | 138 | String ruleMd5 = Md5Util.getMd5( |
| 137 | 139 | String.valueOf($qyrq.getMillis()) + |
| 138 | 140 | "_" + |
| 139 | - $sri.getSelf().getLpIds() | |
| 141 | + $sri.getSelf().getLpIds() + | |
| 142 | + "_" + | |
| 143 | + $sri.getSelf().getLpStart().toString() | |
| 140 | 144 | ); |
| 141 | 145 | cdrp.setRuleMd5(ruleMd5); |
| 142 | 146 | // 人员范围个数 |
| ... | ... | @@ -187,7 +191,9 @@ rule "Calcu_SchedulePlanRuleResult_wrap" |
| 187 | 191 | String md5 = Md5Util.getMd5( |
| 188 | 192 | String.valueOf($sprr.getQyrq().getTime()) + |
| 189 | 193 | "_" + |
| 190 | - $sprr.getGids() | |
| 194 | + $sprr.getGids() + | |
| 195 | + "_" + | |
| 196 | + $sprr.getOrigingidindex() | |
| 191 | 197 | ); |
| 192 | 198 | |
| 193 | 199 | // System.out.println("修改后的md5:" + md5 + "车辆:" + $sprr.getCcZbh()); |
| ... | ... | @@ -350,7 +356,7 @@ rule "Calcu_loop2_1_" // 路牌在时刻表中存在,就翻 |
| 350 | 356 | schedulePlanRuleResult.setRuleId($ruleId); |
| 351 | 357 | schedulePlanRuleResult.setCcId($cid); |
| 352 | 358 | schedulePlanRuleResult.setCcZbh($srf.getCarConfigInfo().getCl().getInsideCode()); |
| 353 | - schedulePlanRuleResult.setGids($srf.getLpIds()); | |
| 359 | + schedulePlanRuleResult.setGids($srf.getLpIds()); // 参与md5计算 | |
| 354 | 360 | schedulePlanRuleResult.setGnames($srf.getLpNames()); |
| 355 | 361 | schedulePlanRuleResult.setGidindex(String.valueOf($lpindex)); |
| 356 | 362 | schedulePlanRuleResult.setEcids($srf.getRyConfigIds()); |
| ... | ... | @@ -359,7 +365,8 @@ rule "Calcu_loop2_1_" // 路牌在时刻表中存在,就翻 |
| 359 | 365 | schedulePlanRuleResult.setScheduleDate($csd2.toDate()); |
| 360 | 366 | schedulePlanRuleResult.setTtinfoId($ttinfoId); |
| 361 | 367 | schedulePlanRuleResult.setTtinfoName($ttinfoName); |
| 362 | - schedulePlanRuleResult.setQyrq($sri.getQyrq().toDate()); | |
| 368 | + schedulePlanRuleResult.setQyrq($sri.getQyrq().toDate()); // 参与md5计算 | |
| 369 | + schedulePlanRuleResult.setOrigingidindex(String.valueOf($sri.getSelf().getLpStart())); // 参与md5计算 | |
| 363 | 370 | |
| 364 | 371 | scheduleResult.getSchedulePlanRuleResults().add(schedulePlanRuleResult); |
| 365 | 372 | ... | ... |
src/main/resources/rules/validplan.drl
| 1 | -// TODO: | |
| 2 | 1 | \ No newline at end of file |
| 2 | +package com.bsth.service.schedule.rules.validate; | |
| 3 | + | |
| 4 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 5 | + | |
| 6 | +import org.joda.time.*; | |
| 7 | +import java.util.*; | |
| 8 | + | |
| 9 | +import org.slf4j.Logger; | |
| 10 | + | |
| 11 | +// 全局日志类(一般使用调用此规则的service类) | |
| 12 | +global Logger log; | |
| 13 | + | |
| 14 | +// 输出 | |
| 15 | +global ValidateResults_output validResult; | |
| 16 | + | |
| 17 | +//------------------------- 第一阶段、构造循环体 ----------------------------// | |
| 18 | + | |
| 19 | +declare Loop_param | |
| 20 | + start_date: DateTime // 开始日期(这个要不停的更新迭代) | |
| 21 | + end_date: DateTime // 结束日期 | |
| 22 | + sdays: Integer // 总共循环的天数 | |
| 23 | +end | |
| 24 | + | |
| 25 | +rule "Calcu_Loop_param" | |
| 26 | + salience 1000 | |
| 27 | + when | |
| 28 | + ValidateParam( | |
| 29 | + $fd: fromDate, | |
| 30 | + $ed: toDate, | |
| 31 | + $days: days | |
| 32 | + ) | |
| 33 | + then | |
| 34 | + Loop_param p = new Loop_param(); | |
| 35 | + p.setStart_date($fd); | |
| 36 | + p.setEnd_date($ed); | |
| 37 | + p.setSdays($days); | |
| 38 | + | |
| 39 | + insert(p); | |
| 40 | +end | |
| 41 | + | |
| 42 | +//------------------------- 第二阶段、验证计算 ----------------------------// | |
| 43 | + | |
| 44 | + | |
| 45 | +rule "Valid_repeat_bc" // 验证是否存在重复班次 | |
| 46 | + salience 600 | |
| 47 | + when | |
| 48 | + $lp: Loop_param($sd: start_date, $ed: end_date) | |
| 49 | + eval($sd.isBefore($ed) || $sd.isEqual($ed)) | |
| 50 | + $spiList: ArrayList() from collect (SchedulePlanInfo(scheduleDate.getTime() == $sd.getMillis())) | |
| 51 | + $infos: ArrayList() from accumulate ($spi: SchedulePlanInfo() from $spiList, vrb($spi)) | |
| 52 | + then | |
| 53 | + // TODO: | |
| 54 | + log.info("日期={},班次重复错误数={}", $sd, $infos.size()); | |
| 55 | + | |
| 56 | + validResult.getInfos().addAll($infos); | |
| 57 | + | |
| 58 | + // 迭代 | |
| 59 | + $lp.setStart_date($sd.plusDays(1)); | |
| 60 | + update($lp); | |
| 61 | + | |
| 62 | +end | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | ... | ... |
src/main/resources/static/pages/base/section/editsection.html
| 1 | 1 | <!-- 编辑路段 --> |
| 2 | -<div class="modal fade" id="edit_section_mobal" tabindex="-1" role="basic" aria-hidden="true"> | |
| 2 | +<div class="modal fade" id="edit_section_mobal" role="basic" aria-hidden="true"> | |
| 3 | 3 | <div class="modal-dialog"> |
| 4 | 4 | <div class="modal-content"> |
| 5 | 5 | <div class="modal-header"> |
| ... | ... | @@ -49,7 +49,7 @@ |
| 49 | 49 | 上一路段: |
| 50 | 50 | </label> |
| 51 | 51 | <div class="col-md-6"> |
| 52 | - <select name="sectionrouteCode" class="form-control" id="sectionrouteCodeSelect"></select> | |
| 52 | + <select name="sectionrouteCode" class="form-control" id="sectionrouteCodeSelect" style="width:100%"></select> | |
| 53 | 53 | <span class="help-block">说明:选择的路段将作为本路段序号的参考,成为选择路段的下一个路段。 </span> |
| 54 | 54 | </div> |
| 55 | 55 | </div> |
| ... | ... | @@ -162,7 +162,7 @@ $('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,sect |
| 162 | 162 | var sectionRouteId = Section.sectionRouteId; |
| 163 | 163 | // 获取路段号元素,并添加下拉属性值 |
| 164 | 164 | ajaxd.getStation(lineId,dir,function(treeData) { |
| 165 | - var options = '<option value="">请选择...</option>'; | |
| 165 | + /* var options = '<option value="">请选择...</option>'; | |
| 166 | 166 | var dArray = treeData[0].children[1].children; |
| 167 | 167 | var eq_stationRouteCode = Section.sectionRouteCode; |
| 168 | 168 | for(var i = 0 ; i<dArray.length; i++){ |
| ... | ... | @@ -181,6 +181,33 @@ $('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,sect |
| 181 | 181 | }else { |
| 182 | 182 | $('#sectionrouteCodeSelect').val(''); |
| 183 | 183 | } |
| 184 | + }); */ | |
| 185 | + var array = treeData[0].children[1].children,paramsD =new Array(); | |
| 186 | + var eq_scetionRouteCode = Section.sectionRouteCode; | |
| 187 | + paramsD.push({'id':'请选择...','text':'请选择...'}); | |
| 188 | + // 遍历. | |
| 189 | + $.each(array, function(i, g){ | |
| 190 | + // 判断. | |
| 191 | + if(g.sectionName!='' || g.sectionName != null) { | |
| 192 | + var ptions_v = g.sectionrouteCode; | |
| 193 | + if(eq_scetionRouteCode != ptions_v){ | |
| 194 | + // 添加拼音检索下拉框格式数据数组. | |
| 195 | + paramsD.push({'id':ptions_v, | |
| 196 | + 'text':g.sectionName + '(' + ptions_v + ')' + ' --' + dirdmToName(g.sectionrouteDirections)}); | |
| 197 | + } | |
| 198 | + } | |
| 199 | + }); | |
| 200 | + // 初始化上一个路段拼音检索下拉框. | |
| 201 | + initPinYinSelect2($('#sectionrouteCodeSelect'),paramsD,function(selector) { | |
| 202 | + $('#sectionDirSelect').val('');// 设值方向. | |
| 203 | + ajaxd.findUpSectionRouteCode(lineId,dir,eq_scetionRouteCode,function(str) { | |
| 204 | + if(str.length>0){ | |
| 205 | + var upStationRouteCode = str[0].sectionrouteCode; | |
| 206 | + $('#sectionrouteCodeSelect').select2('val',upStationRouteCode); | |
| 207 | + }else { | |
| 208 | + $('#sectionrouteCodeSelect').select2('val','请选择...'); | |
| 209 | + } | |
| 210 | + }); | |
| 184 | 211 | }); |
| 185 | 212 | }); |
| 186 | 213 | function dirdmToName(value) { |
| ... | ... | @@ -257,6 +284,8 @@ $('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,sect |
| 257 | 284 | // 设置日期 |
| 258 | 285 | params.createDate = moment(Section.carParkCreateDate).format(fs); |
| 259 | 286 | error.hide(); |
| 287 | + if(params.sectionrouteCode=='请选择...') | |
| 288 | + params.sectionrouteCode=''; | |
| 260 | 289 | ajaxd.sectionUpdate(params,function(resuntDate) { |
| 261 | 290 | if(resuntDate.status=='SUCCESS') { |
| 262 | 291 | // 弹出添加成功提示消息 | ... | ... |
src/main/resources/static/pages/base/station/edit.html
| 1 | 1 | <!-- 编辑站点弹出层mobal --> |
| 2 | -<div class="modal fade" id="editPoitsions_station_mobal" tabindex="-1" role="basic" aria-hidden="true"> | |
| 2 | +<div class="modal fade" id="editPoitsions_station_mobal" role="basic" aria-hidden="true"> | |
| 3 | 3 | <div class="modal-dialog"> |
| 4 | 4 | <div class="modal-content"> |
| 5 | 5 | <!-- 弹出层标题title容器 --> |
| ... | ... | @@ -209,6 +209,7 @@ |
| 209 | 209 | </div> |
| 210 | 210 | <script type="text/javascript"> |
| 211 | 211 | $('#editPoitsions_station_mobal').on('editStationMobal_show', function(e, map,fun,stat){ |
| 212 | + layer.closeAll(); | |
| 212 | 213 | // 获取站点对象信息 |
| 213 | 214 | var editStation = stat.getAddStation(); |
| 214 | 215 | // 初始化表单值 |
| ... | ... | @@ -297,7 +298,9 @@ $('#editPoitsions_station_mobal').on('editStationMobal_show', function(e, map,fu |
| 297 | 298 | // 站点序号值改变事件 |
| 298 | 299 | $('#stationrouteSelect').on('change',function() { |
| 299 | 300 | var stationRValue = $('#stationrouteSelect').val(); |
| 300 | - if(stationRValue) { | |
| 301 | + if(stationRValue=='请选择...') { | |
| 302 | + $('#stationMarkSelect').val('B'); | |
| 303 | + }else { | |
| 301 | 304 | var tempStr = stationRValue.split('_'); |
| 302 | 305 | if(tempStr[1] == 'E') { |
| 303 | 306 | $('#stationMarkSelect').val('E'); |
| ... | ... | @@ -318,8 +321,15 @@ $('#editPoitsions_station_mobal').on('editStationMobal_show', function(e, map,fu |
| 318 | 321 | if(g.name!='' || g.name != null) { |
| 319 | 322 | if(g.stationRouteCode != editStation.stationRouteCode) { |
| 320 | 323 | // 添加拼音检索下拉框格式数据数组. |
| 321 | - paramsD.push({'id':g.stationRouteCode + '_' + g.stationMark + '_' + g.directions, | |
| 322 | - 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)}); | |
| 324 | + /* paramsD.push({'id':g.stationRouteCode + '_' + g.stationMark + '_' + g.directions, | |
| 325 | + 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)}); */ | |
| 326 | + if(editStation.stationRouteStationMark=='E' && i == (len_-2)){ | |
| 327 | + paramsD.push({'id':g.stationRouteCode + '_' + 'E' + '_' + g.directions, | |
| 328 | + 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)}); | |
| 329 | + }else { | |
| 330 | + paramsD.push({'id':g.stationRouteCode + '_' + g.stationMark + '_' + g.directions, | |
| 331 | + 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)}); | |
| 332 | + } | |
| 323 | 333 | } |
| 324 | 334 | } |
| 325 | 335 | }); |
| ... | ... | @@ -333,10 +343,17 @@ $('#editPoitsions_station_mobal').on('editStationMobal_show', function(e, map,fu |
| 333 | 343 | } |
| 334 | 344 | function setZdlyValue() { |
| 335 | 345 | fun.findUpStationRouteCode(editStation.stationRouteLine,editStation.stationRoutedirections,editStation.stationRouteCode,function(str) { |
| 336 | - if(str.length>0){ | |
| 346 | + /* if(str.length>0){ | |
| 337 | 347 | var upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke + '_' + editStation.stationRoutedirections; |
| 338 | 348 | $('#stationrouteSelect').select2('val',upStationRouteCode); |
| 349 | + } */ | |
| 350 | + if(str.length>0){ | |
| 351 | + var upStationRouteCode = str[0].stationRouteCode + '_' + editStation.stationRouteStationMark + '_' + editStation.stationRoutedirections; | |
| 352 | + $('#stationrouteSelect').select2('val',upStationRouteCode); | |
| 353 | + }else { | |
| 354 | + $('#stationrouteSelect').select2('val','请选择...'); | |
| 339 | 355 | } |
| 356 | + $('#stationMarkSelect').val(editStation.stationRouteStationMark); | |
| 340 | 357 | }); |
| 341 | 358 | } |
| 342 | 359 | // 当站点类型为中途站或者终点站时,上一站点为必填项! | ... | ... |
src/main/resources/static/pages/base/stationroute/add.html
| 1 | 1 | <!-- 新增站点 --> |
| 2 | -<div class="modal fade" id="add_station_mobal" tabindex="-1" role="basic" aria-hidden="true"> | |
| 2 | +<div class="modal fade" id="add_station_mobal" role="basic" aria-hidden="true"> | |
| 3 | 3 | <div class="modal-dialog"> |
| 4 | 4 | <div class="modal-content"> |
| 5 | 5 | <div class="modal-header"> |
| ... | ... | @@ -180,7 +180,7 @@ |
| 180 | 180 | |
| 181 | 181 | <!-- 描述/说明 --> |
| 182 | 182 | <div class="form-group"> |
| 183 | - <label class="control-label col-md-3"> 描述/说明 : </label> | |
| 183 | + <label class="control-label col-md-3"> 描述/说明 : </label> | |
| 184 | 184 | <div class="col-md-6"> |
| 185 | 185 | <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea> |
| 186 | 186 | </div> |
| ... | ... | @@ -243,7 +243,9 @@ $('#add_station_mobal').on('AddStationMobal.show', function(e, addMap,ajaxd,stao |
| 243 | 243 | // 站点序号值改变事件 |
| 244 | 244 | $('#stationrouteSelect').on('change',function() { |
| 245 | 245 | var stationRValue = $('#stationrouteSelect').val(); |
| 246 | - if(stationRValue) { | |
| 246 | + if(stationRValue=='请选择...') { | |
| 247 | + $('#stationMarkSelect').val('B'); | |
| 248 | + }else { | |
| 247 | 249 | var tempStr = stationRValue.split('_'); |
| 248 | 250 | if(tempStr[1] == 'E') { |
| 249 | 251 | $('#stationMarkSelect').val('E'); | ... | ... |
src/main/resources/static/pages/base/stationroute/css/bmap_base.css
| ... | ... | @@ -93,4 +93,39 @@ html,body{ |
| 93 | 93 | |
| 94 | 94 | box-shadow: 0 12px 15px 0 rgba(204, 204, 204, 0.33),0 17px 50px 0 rgba(204, 204, 204, 0.33)!important; |
| 95 | 95 | |
| 96 | +} | |
| 97 | + | |
| 98 | +.defeat-scroll { | |
| 99 | +width: 98%; | |
| 100 | +height:380px; | |
| 101 | +/* overflow:auto; */ | |
| 102 | +overflow:hidden; | |
| 103 | +} | |
| 104 | +.defeat-scroll::-webkit-scrollbar { | |
| 105 | +width:6px; | |
| 106 | +height:6px; | |
| 107 | +} | |
| 108 | +.defeat-scroll::-webkit-scrollbar-button { | |
| 109 | +/* background-color:#FF7677; */ | |
| 110 | +background:rgba(255, 255, 255, 0); | |
| 111 | +} | |
| 112 | +.defeat-scroll::-webkit-scrollbar-track { | |
| 113 | +/* background:#FF66D5; */ | |
| 114 | +background:rgba(255, 255, 255, 0); | |
| 115 | +} | |
| 116 | +.defeat-scroll::-webkit-scrollbar-track-piece { | |
| 117 | +/* background:#ff0000; */ | |
| 118 | +background:rgba(255, 255, 255, 0); | |
| 119 | +} | |
| 120 | +.defeat-scroll::-webkit-scrollbar-thumb{ | |
| 121 | +background:rgba(197, 196, 196, 0.81); | |
| 122 | +border-radius:10px !important; | |
| 123 | +} | |
| 124 | +.defeat-scroll::-webkit-scrollbar-corner { | |
| 125 | +/* background:#82AFFF; */ | |
| 126 | +background:rgba(255, 255, 255, 0); | |
| 127 | +} | |
| 128 | +.defeat-scroll::-webkit-scrollbar-resizer { | |
| 129 | +/* background:#FF0BEE; */ | |
| 130 | +background:rgba(255, 255, 255, 0); | |
| 96 | 131 | } |
| 97 | 132 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/stationroute/edit.html
| 1 | 1 | <!-- 编辑站点 --> |
| 2 | -<div class="modal fade" id="edit_station_mobal" tabindex="-1" role="basic" aria-hidden="true"> | |
| 2 | +<div class="modal fade" id="edit_station_mobal" role="basic" aria-hidden="true"> | |
| 3 | 3 | <div class="modal-dialog"> |
| 4 | 4 | <div class="modal-content"> |
| 5 | 5 | <div class="modal-header"> |
| ... | ... | @@ -50,7 +50,7 @@ |
| 50 | 50 | <span class="required"> * </span> 站点编码 : |
| 51 | 51 | </label> |
| 52 | 52 | <div class="col-md-6"> |
| 53 | - <input type="text" class="form-control" name="stationCod" id="stationCodInput" placeholder="站点编码"> | |
| 53 | + <input type="text" class="form-control" name="stationCod" id="stationCodInput" placeholder="站点编码" readonly="readonly"> | |
| 54 | 54 | </div> |
| 55 | 55 | </div> |
| 56 | 56 | </div> |
| ... | ... | @@ -177,7 +177,7 @@ |
| 177 | 177 | </div> |
| 178 | 178 | <!-- 描述/说明 --> |
| 179 | 179 | <div class="form-group"> |
| 180 | - <label class="control-label col-md-3"> 描述/说明 : </label> | |
| 180 | + <label class="control-label col-md-3"> 描述/说明 : </label> | |
| 181 | 181 | <div class="col-md-6"> |
| 182 | 182 | <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea> |
| 183 | 183 | </div> |
| ... | ... | @@ -194,6 +194,7 @@ |
| 194 | 194 | <script type="text/javascript"> |
| 195 | 195 | |
| 196 | 196 | $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,station_,Line_,fun){ |
| 197 | + layer.closeAll(); | |
| 197 | 198 | var editStationParmasObj = station_.getEitdStation(); |
| 198 | 199 | var addLine = Line_.getLineObj(); |
| 199 | 200 | fun.setFormValue(editStationParmasObj); |
| ... | ... | @@ -290,7 +291,9 @@ $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,stati |
| 290 | 291 | // 站点序号值改变事件 |
| 291 | 292 | $('#stationrouteSelect').on('change',function() { |
| 292 | 293 | var stationRValue = $('#stationrouteSelect').val(); |
| 293 | - if(stationRValue) { | |
| 294 | + if(stationRValue=='请选择...') { | |
| 295 | + $('#stationMarkSelect').val('B'); | |
| 296 | + }else { | |
| 294 | 297 | var tempStr = stationRValue.split('_'); |
| 295 | 298 | if(tempStr[1] == 'E') { |
| 296 | 299 | $('#stationMarkSelect').val('E'); |
| ... | ... | @@ -311,8 +314,13 @@ $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,stati |
| 311 | 314 | if(g.name!='' || g.name != null) { |
| 312 | 315 | if(g.stationRouteCode != editStationParmasObj.stationRouteStationRouteCode) { |
| 313 | 316 | // 添加拼音检索下拉框格式数据数组. |
| 314 | - paramsD.push({'id':g.stationRouteCode + '_' + g.stationMark + '_' + g.directions, | |
| 315 | - 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)}); | |
| 317 | + if(editStationParmasObj.stationRouteStationMark=='E' && i == (len_-2)){ | |
| 318 | + paramsD.push({'id':g.stationRouteCode + '_' + 'E' + '_' + g.directions, | |
| 319 | + 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)}); | |
| 320 | + }else { | |
| 321 | + paramsD.push({'id':g.stationRouteCode + '_' + g.stationMark + '_' + g.directions, | |
| 322 | + 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)}); | |
| 323 | + } | |
| 316 | 324 | } |
| 317 | 325 | } |
| 318 | 326 | }); |
| ... | ... | @@ -327,12 +335,14 @@ $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,stati |
| 327 | 335 | function setZdlyValue() { |
| 328 | 336 | ajaxd.findUpStationRouteCode(editStationParmasObj.stationRouteLine,editStationParmasObj.stationRouteDirections,editStationParmasObj.stationRouteStationRouteCode,function(str) { |
| 329 | 337 | if(str.length>0){ |
| 330 | - var upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke + '_' + editStationParmasObj.stationRouteDirections; | |
| 338 | + /* var upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke + '_' + editStationParmasObj.stationRouteDirections; */ | |
| 339 | + var upStationRouteCode = str[0].stationRouteCode + '_' + editStationParmasObj.stationRouteStationMark + '_' + editStationParmasObj.stationRouteDirections; | |
| 331 | 340 | $('#stationrouteSelect').select2('val',upStationRouteCode); |
| 332 | 341 | }else { |
| 333 | 342 | $('#stationrouteSelect').select2('val','请选择...'); |
| 334 | - $('#stationMarkSelect').val(editStationParmasObj.stationRouteStationMark); | |
| 343 | + /* $('#stationMarkSelect').val(editStationParmasObj.stationRouteStationMark); */ | |
| 335 | 344 | } |
| 345 | + $('#stationMarkSelect').val(editStationParmasObj.stationRouteStationMark); | |
| 336 | 346 | }); |
| 337 | 347 | } |
| 338 | 348 | // 当站点类型为中途站或者终点站时,上一站点为必填项! | ... | ... |
src/main/resources/static/pages/base/stationroute/editsection.html
| 1 | 1 | <!-- 编辑路段 --> |
| 2 | -<div class="modal fade" id="edit_section_mobal" tabindex="-1" role="basic" aria-hidden="true"> | |
| 2 | +<div class="modal fade" id="edit_section_mobal" role="basic" aria-hidden="true"> | |
| 3 | 3 | <div class="modal-dialog"> |
| 4 | 4 | <div class="modal-content"> |
| 5 | 5 | <div class="modal-header"> |
| ... | ... | @@ -49,7 +49,7 @@ |
| 49 | 49 | 上一路段: |
| 50 | 50 | </label> |
| 51 | 51 | <div class="col-md-6"> |
| 52 | - <select name="sectionrouteCode" class="form-control" id="sectionrouteCodeSelect"></select> | |
| 52 | + <select name="sectionrouteCode" class="form-control" id="sectionrouteCodeSelect" style="width:100%"></select> | |
| 53 | 53 | <span class="help-block">说明:选择的路段将作为本站序号的参考,成为选择路段的下一个路段。 </span> |
| 54 | 54 | </div> |
| 55 | 55 | </div> |
| ... | ... | @@ -157,10 +157,9 @@ $('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,sect |
| 157 | 157 | var lineId = Section.sectionrouteLine; |
| 158 | 158 | // 获取路段号元素,并添加下拉属性值 |
| 159 | 159 | ajaxd.getStation(lineId,dir,function(treeData) { |
| 160 | - var options = '<option value="">请选择...</option>'; | |
| 161 | - var dArray = treeData[0].children[1].children; | |
| 160 | + var array = treeData[0].children[1].children,paramsD =new Array(); | |
| 162 | 161 | var eq_scetionRouteCode = Section.sectionrouteCode; |
| 163 | - for(var i = 0 ; i<dArray.length; i++){ | |
| 162 | + /* for(var i = 0 ; i<dArray.length; i++){ | |
| 164 | 163 | var ptions_v = dArray[i].sectionrouteCode; |
| 165 | 164 | if(eq_scetionRouteCode == ptions_v){ |
| 166 | 165 | continue; |
| ... | ... | @@ -168,17 +167,32 @@ $('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,sect |
| 168 | 167 | options += '<option value="'+ ptions_v +'">'+dArray[i].sectionName + ' (' + ptions_v +')' |
| 169 | 168 | + ' --' + fun.dirdmToName(dArray[i].sectionrouteDirections) + '</option>' ; |
| 170 | 169 | } |
| 171 | - $('#sectionrouteCodeSelect').html(options); | |
| 172 | - ajaxd.findUpSectionRouteCode(lineId,dir,eq_scetionRouteCode,function(str) { | |
| 173 | - debugger; | |
| 174 | - console.log(eq_scetionRouteCode); | |
| 175 | - if(str.length>0){ | |
| 176 | - var upStationRouteCode = str[0].sectionrouteCode; | |
| 177 | - $('#sectionrouteCodeSelect').val(upStationRouteCode); | |
| 178 | - }else { | |
| 179 | - $('#sectionrouteCodeSelect').val(''); | |
| 170 | + $('#sectionrouteCodeSelect').html(options); */ | |
| 171 | + paramsD.push({'id':'请选择...','text':'请选择...'}); | |
| 172 | + // 遍历. | |
| 173 | + $.each(array, function(i, g){ | |
| 174 | + // 判断. | |
| 175 | + if(g.sectionName!='' || g.sectionName != null) { | |
| 176 | + var ptions_v = g.sectionrouteCode; | |
| 177 | + if(eq_scetionRouteCode != ptions_v){ | |
| 178 | + // 添加拼音检索下拉框格式数据数组. | |
| 179 | + paramsD.push({'id':ptions_v, | |
| 180 | + 'text':g.sectionName + '(' + ptions_v + ')' + ' --' + fun.dirdmToName(g.sectionrouteDirections)}); | |
| 181 | + } | |
| 180 | 182 | } |
| 181 | 183 | }); |
| 184 | + // 初始化上一个路段拼音检索下拉框. | |
| 185 | + initPinYinSelect2($('#sectionrouteCodeSelect'),paramsD,function(selector) { | |
| 186 | + $('#sectionDirSelect').val('');// 设值方向. | |
| 187 | + ajaxd.findUpSectionRouteCode(lineId,dir,eq_scetionRouteCode,function(str) { | |
| 188 | + if(str.length>0){ | |
| 189 | + var upStationRouteCode = str[0].sectionrouteCode; | |
| 190 | + $('#sectionrouteCodeSelect').select2('val',upStationRouteCode); | |
| 191 | + }else { | |
| 192 | + $('#sectionrouteCodeSelect').select2('val','请选择...'); | |
| 193 | + } | |
| 194 | + }); | |
| 195 | + }); | |
| 182 | 196 | }); |
| 183 | 197 | // 显示mobal |
| 184 | 198 | $('#edit_section_mobal').modal({show : true,backdrop: 'static',keyboard: false}); |
| ... | ... | @@ -238,6 +252,8 @@ $('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,sect |
| 238 | 252 | submitHandler : function(f) { |
| 239 | 253 | var params = form.serializeJSON(); |
| 240 | 254 | error.hide(); |
| 255 | + if(params.sectionrouteCode=='请选择...') | |
| 256 | + params.sectionrouteCode=''; | |
| 241 | 257 | ajaxd.sectionUpdate(params,function(resuntDate) { |
| 242 | 258 | if(resuntDate.status=='SUCCESS') { |
| 243 | 259 | // 弹出添加成功提示消息 | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-events.js
| ... | ... | @@ -238,4 +238,9 @@ $(function(){ |
| 238 | 238 | } |
| 239 | 239 | }); |
| 240 | 240 | }); |
| 241 | + $('#scrllmouseEvent').on('mousemove',function() { | |
| 242 | + $('.defeat-scroll').css('overflow','auto'); | |
| 243 | + }).on('mouseleave',function() { | |
| 244 | + $('.defeat-scroll').css('overflow','hidden'); | |
| 245 | + }); | |
| 241 | 246 | }); |
| 242 | 247 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
| ... | ... | @@ -354,7 +354,7 @@ var PublicFunctions = function () { |
| 354 | 354 | // 获取站点编码元素设值 |
| 355 | 355 | $('#stationCodInput').val(editStationParmas.stationStationCod); |
| 356 | 356 | // 获取站点类型元素设值 |
| 357 | - $('#stationMarkSelect').val(editStationParmas.stationRouteStationMark); | |
| 357 | + // $('#stationMarkSelect').val(editStationParmas.stationRouteStationMark); | |
| 358 | 358 | // 获取站点方向元素设值 |
| 359 | 359 | $('#stationdirSelect').val(editStationParmas.stationRouteDirections); |
| 360 | 360 | // 获取站点道路编码元素设值 | ... | ... |
src/main/resources/static/pages/base/stationroute/list.html
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | <div id="bmap_basic" class="bmaps"></div> |
| 5 | 5 | <div class="portlet box protlet-box" style="top:20px;border-radius: 6px !important;box-shadow: 10px 10px 5px #888888;"> |
| 6 | 6 | <!-- 左边标题栏 --> |
| 7 | - <div class="portlet-title" style="background-color:#3B3F51"> | |
| 7 | + <div class="portlet-title" style="background-color:#12527f;"> | |
| 8 | 8 | <div class="caption"> |
| 9 | 9 | <!-- 途径站点 --> |
| 10 | 10 | </div> |
| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | </div> |
| 14 | 14 | </div> |
| 15 | 15 | <!-- 左边栏 --> |
| 16 | - <div class="portlet-body" style="border: 1px solid rgb(255, 255, 255); display: block;min-height: 200px;"> | |
| 16 | + <div class="portlet-body" id="scrllmouseEvent" style="border: 1px solid rgb(255, 255, 255); display: block;min-height: 380px;"> | |
| 17 | 17 | <div class="row"> |
| 18 | 18 | <!-- 上下行栏 --> |
| 19 | 19 | <div class="col-md-3 col-sm-3 col-xs-3"> |
| ... | ... | @@ -83,8 +83,8 @@ |
| 83 | 83 | </div> |
| 84 | 84 | </div> |
| 85 | 85 | <!-- 树 --> |
| 86 | - <div class="portlet-body"> | |
| 87 | - <div id="station_Up_tree" style="height: auto;max-height: 500px;overflow-y: auto;"></div> | |
| 86 | + <div class="portlet-body" > | |
| 87 | + <div id="station_Up_tree" class="defeat-scroll" style="height: auto;max-height: 500px;"></div> | |
| 88 | 88 | </div> |
| 89 | 89 | </div> |
| 90 | 90 | <!-- 无上行站点添加方式 --> |
| ... | ... | @@ -176,7 +176,7 @@ |
| 176 | 176 | </div> |
| 177 | 177 | <!-- 树 --> |
| 178 | 178 | <div class="portlet-body"> |
| 179 | - <div id="station_Down_tree" style="height: auto;max-height: 500px;overflow-y: auto;"></div> | |
| 179 | + <div id="station_Down_tree" class="defeat-scroll" style="height: auto;max-height: 500px;"></div> | |
| 180 | 180 | </div> |
| 181 | 181 | </div> |
| 182 | 182 | <!-- 无上行站点添加方式 --> | ... | ... |
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/pages/forms/mould/firstAndLastBus_sum.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/scheduleAnaly_sum.xls
No preview for this file type
src/main/resources/static/pages/forms/statement/firstAndLastBus.html
| ... | ... | @@ -207,7 +207,6 @@ |
| 207 | 207 | params['company'] = company; |
| 208 | 208 | params['subCompany'] = subCompany; |
| 209 | 209 | params['line'] = line; |
| 210 | - params['line'] = line; | |
| 211 | 210 | params['date'] = date; |
| 212 | 211 | params['type'] = "query"; |
| 213 | 212 | $(".hidden").removeClass("hidden"); |
| ... | ... | @@ -225,11 +224,14 @@ |
| 225 | 224 | } |
| 226 | 225 | |
| 227 | 226 | $("#export").on("click",function(){ |
| 227 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | |
| 228 | + layer.msg("请选择时间!"); | |
| 229 | + return; | |
| 230 | + } | |
| 228 | 231 | var params = {}; |
| 229 | 232 | params['company'] = company; |
| 230 | 233 | params['subCompany'] = subCompany; |
| 231 | 234 | params['line'] = line; |
| 232 | - params['line'] = line; | |
| 233 | 235 | params['date'] = date; |
| 234 | 236 | params['type'] = "export"; |
| 235 | 237 | $get('/pcpc/firstAndLastBus', params, function(result){ |
| ... | ... | @@ -248,22 +250,50 @@ |
| 248 | 250 | <td>{{obj.company}}</td> |
| 249 | 251 | <td>{{obj.subCompany}}</td> |
| 250 | 252 | <td>{{obj.line}}</td> |
| 251 | - <td>{{obj.qdzFirst0}}</td> | |
| 252 | - <td>{{obj.jhfcFirst0}}</td> | |
| 253 | - <td>{{obj.sjfcFirst0}}</td> | |
| 254 | - <td>{{obj.delayFirst0}}</td> | |
| 255 | - <td>{{obj.qdzLast0}}</td> | |
| 256 | - <td>{{obj.jhfcLast0}}</td> | |
| 257 | - <td>{{obj.sjfcLast0}}</td> | |
| 258 | - <td>{{obj.delayLast0}}</td> | |
| 259 | - <td>{{obj.qdzFirst1}}</td> | |
| 260 | - <td>{{obj.jhfcFirst1}}</td> | |
| 261 | - <td>{{obj.sjfcFirst1}}</td> | |
| 262 | - <td>{{obj.delayFirst1}}</td> | |
| 263 | - <td>{{obj.qdzLast1}}</td> | |
| 264 | - <td>{{obj.jhfcLast1}}</td> | |
| 265 | - <td>{{obj.sjfcLast1}}</td> | |
| 266 | - <td>{{obj.delayLast1}}</td> | |
| 253 | + {{if obj.delayFirst0 != '/' && obj.delayFirst0 != '0'}} | |
| 254 | + <td style="background-color: #FF9999">{{obj.qdzFirst0}}</td> | |
| 255 | + <td style="background-color: #FF9999">{{obj.jhfcFirst0}}</td> | |
| 256 | + <td style="background-color: #FF9999">{{obj.sjfcFirst0}}</td> | |
| 257 | + <td style="background-color: #FF9999">{{obj.delayFirst0}}</td> | |
| 258 | + {{else}} | |
| 259 | + <td>{{obj.qdzFirst0}}</td> | |
| 260 | + <td>{{obj.jhfcFirst0}}</td> | |
| 261 | + <td>{{obj.sjfcFirst0}}</td> | |
| 262 | + <td>{{obj.delayFirst0}}</td> | |
| 263 | + {{/if}} | |
| 264 | + {{if obj.delayLast0 != '/' && obj.delayLast0 != '0'}} | |
| 265 | + <td style="background-color: #FF9999">{{obj.qdzLast0}}</td> | |
| 266 | + <td style="background-color: #FF9999">{{obj.jhfcLast0}}</td> | |
| 267 | + <td style="background-color: #FF9999">{{obj.sjfcLast0}}</td> | |
| 268 | + <td style="background-color: #FF9999">{{obj.delayLast0}}</td> | |
| 269 | + {{else}} | |
| 270 | + <td>{{obj.qdzLast0}}</td> | |
| 271 | + <td>{{obj.jhfcLast0}}</td> | |
| 272 | + <td>{{obj.sjfcLast0}}</td> | |
| 273 | + <td>{{obj.delayLast0}}</td> | |
| 274 | + {{/if}} | |
| 275 | + {{if obj.delayFirst1 != '/' && obj.delayFirst1 != '0'}} | |
| 276 | + <td style="background-color: #FF9999">{{obj.qdzFirst1}}</td> | |
| 277 | + <td style="background-color: #FF9999">{{obj.jhfcFirst1}}</td> | |
| 278 | + <td style="background-color: #FF9999">{{obj.sjfcFirst1}}</td> | |
| 279 | + <td style="background-color: #FF9999">{{obj.delayFirst1}}</td> | |
| 280 | + {{else}} | |
| 281 | + <td>{{obj.qdzFirst1}}</td> | |
| 282 | + <td>{{obj.jhfcFirst1}}</td> | |
| 283 | + <td>{{obj.sjfcFirst1}}</td> | |
| 284 | + <td>{{obj.delayFirst1}}</td> | |
| 285 | + {{/if}} | |
| 286 | + {{if obj.delayLast1 != '/' && obj.delayLast1 != '0'}} | |
| 287 | + <td style="background-color: #FF9999">{{obj.qdzLast1}}</td> | |
| 288 | + <td style="background-color: #FF9999">{{obj.jhfcLast1}}</td> | |
| 289 | + <td style="background-color: #FF9999">{{obj.sjfcLast1}}</td> | |
| 290 | + <td style="background-color: #FF9999">{{obj.delayLast1}}</td> | |
| 291 | + {{else}} | |
| 292 | + <td>{{obj.qdzLast1}}</td> | |
| 293 | + <td>{{obj.jhfcLast1}}</td> | |
| 294 | + <td>{{obj.sjfcLast1}}</td> | |
| 295 | + <td>{{obj.delayLast1}}</td> | |
| 296 | + {{/if}} | |
| 267 | 297 | </tr> |
| 268 | 298 | {{/each}} |
| 269 | 299 | {{if list.length == 0}} | ... | ... |
src/main/resources/static/pages/forms/statement/firstAndLastBus_sum.html
| ... | ... | @@ -67,9 +67,42 @@ |
| 67 | 67 | |
| 68 | 68 | </tbody> |
| 69 | 69 | </table> |
| 70 | - <div style="text-align: right;"> | |
| 71 | - <ul id="pagination" class="pagination"></ul> | |
| 72 | - </div> | |
| 70 | + </div> | |
| 71 | + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> | |
| 72 | + <table class="table table-bordered table-hover table-checkable" id="map"> | |
| 73 | + <thead> | |
| 74 | + <tr class="hidden"> | |
| 75 | + <th style="display: none;"></th> | |
| 76 | + <th rowspan="2">线路</th> | |
| 77 | + <th colspan="4">上行首发</th> | |
| 78 | + <th colspan="4">上行末发</th> | |
| 79 | + <th colspan="4">下行首发</th> | |
| 80 | + <th colspan="4">下行末发</th> | |
| 81 | + </tr> | |
| 82 | + <tr class="hidden"> | |
| 83 | + <th style="display: none;"></th> | |
| 84 | + <th>站点</th> | |
| 85 | + <th>计发</th> | |
| 86 | + <th>实发</th> | |
| 87 | + <th>快慢</th> | |
| 88 | + <th>站点</th> | |
| 89 | + <th>计发</th> | |
| 90 | + <th>实发</th> | |
| 91 | + <th>快慢</th> | |
| 92 | + <th>站点</th> | |
| 93 | + <th>计发</th> | |
| 94 | + <th>实发</th> | |
| 95 | + <th>快慢</th> | |
| 96 | + <th>站点</th> | |
| 97 | + <th>计发</th> | |
| 98 | + <th>实发</th> | |
| 99 | + <th>快慢</th> | |
| 100 | + </tr> | |
| 101 | + </thead> | |
| 102 | + <tbody> | |
| 103 | + | |
| 104 | + </tbody> | |
| 105 | + </table> | |
| 73 | 106 | </div> |
| 74 | 107 | </div> |
| 75 | 108 | </div> |
| ... | ... | @@ -165,6 +198,18 @@ |
| 165 | 198 | fage=true; |
| 166 | 199 | } |
| 167 | 200 | |
| 201 | + var list; | |
| 202 | + $("#forms tbody").on("click","a",function(){ | |
| 203 | + var index = $(this).parent().parent().index(); | |
| 204 | + $.each(list, function(i, g){ | |
| 205 | + if(index == i){ | |
| 206 | + var tbodyHtml = template('list_maps',{list:g.map}); | |
| 207 | + $('#map tbody').html(tbodyHtml); | |
| 208 | + $("#map .hidden").removeClass("hidden"); | |
| 209 | + $("html,body").animate({scrollTop:$("#map").offset().top},1000); | |
| 210 | + } | |
| 211 | + }); | |
| 212 | + }); | |
| 168 | 213 | |
| 169 | 214 | $("#query").on("click",jsDoQuery); |
| 170 | 215 | |
| ... | ... | @@ -190,12 +235,15 @@ |
| 190 | 235 | params['line'] = line; |
| 191 | 236 | params['date'] = date; |
| 192 | 237 | params['type'] = "query"; |
| 193 | - $(".hidden").removeClass("hidden"); | |
| 238 | + $("#forms .hidden").removeClass("hidden"); | |
| 239 | + $("#map tr").addClass("hidden"); | |
| 194 | 240 | $get('/pcpc/firstAndLastBus_sum', params, function(result){ |
| 195 | 241 | // 把数据填充到模版中 |
| 196 | 242 | var tbodyHtml = template('list_firstAndLastBus',{list:result}); |
| 197 | 243 | // 把渲染好的模版html文本追加到表格中 |
| 198 | 244 | $('#forms tbody').html(tbodyHtml); |
| 245 | + | |
| 246 | + list = result; | |
| 199 | 247 | |
| 200 | 248 | if(result.length == 0) |
| 201 | 249 | $("#export").attr('disabled',"true"); |
| ... | ... | @@ -205,6 +253,10 @@ |
| 205 | 253 | } |
| 206 | 254 | |
| 207 | 255 | $("#export").on("click",function(){ |
| 256 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | |
| 257 | + layer.msg("请选择时间!"); | |
| 258 | + return; | |
| 259 | + } | |
| 208 | 260 | var params = {}; |
| 209 | 261 | params['company'] = company; |
| 210 | 262 | params['subCompany'] = subCompany; |
| ... | ... | @@ -212,8 +264,8 @@ |
| 212 | 264 | params['line'] = line; |
| 213 | 265 | params['date'] = date; |
| 214 | 266 | params['type'] = "export"; |
| 215 | - $get('/pcpc/firstAndLastBus', params, function(result){ | |
| 216 | - window.open("/downloadFile/download?fileName=线路首末班"+moment(date).format("YYYYMMDD")); | |
| 267 | + $get('/pcpc/firstAndLastBus_sum', params, function(result){ | |
| 268 | + window.open("/downloadFile/download?fileName=线路首末班准点率"+moment(date).format("YYYYMMDD")); | |
| 217 | 269 | }); |
| 218 | 270 | }); |
| 219 | 271 | |
| ... | ... | @@ -230,7 +282,7 @@ |
| 230 | 282 | <td>{{obj.line}}</td> |
| 231 | 283 | <td>{{obj.jhbc}}</td> |
| 232 | 284 | <td>{{obj.sjbc}}</td> |
| 233 | - <td>{{obj.zdl}}</td> | |
| 285 | + <td><a id='delay'>{{obj.zdl}}</a></td> | |
| 234 | 286 | </tr> |
| 235 | 287 | {{/each}} |
| 236 | 288 | {{if list.length == 0}} |
| ... | ... | @@ -238,4 +290,25 @@ |
| 238 | 290 | <td colspan="20"><h6 class="muted">没有找到相关数据</h6></td> |
| 239 | 291 | </tr> |
| 240 | 292 | {{/if}} |
| 293 | +</script> | |
| 294 | +<script type="text/html" id="list_maps"> | |
| 295 | + <tr> | |
| 296 | + <td>{{list.line}}</td> | |
| 297 | + <td>{{list.qdzFirst0}}</td> | |
| 298 | + <td>{{list.jhfcFirst0}}</td> | |
| 299 | + <td>{{list.sjfcFirst0}}</td> | |
| 300 | + <td>{{list.delayFirst0}}</td> | |
| 301 | + <td>{{list.qdzLast0}}</td> | |
| 302 | + <td>{{list.jhfcLast0}}</td> | |
| 303 | + <td>{{list.sjfcLast0}}</td> | |
| 304 | + <td>{{list.delayLast0}}</td> | |
| 305 | + <td>{{list.qdzFirst1}}</td> | |
| 306 | + <td>{{list.jhfcFirst1}}</td> | |
| 307 | + <td>{{list.sjfcFirst1}}</td> | |
| 308 | + <td>{{list.delayFirst1}}</td> | |
| 309 | + <td>{{list.qdzLast1}}</td> | |
| 310 | + <td>{{list.jhfcLast1}}</td> | |
| 311 | + <td>{{list.sjfcLast1}}</td> | |
| 312 | + <td>{{list.delayLast1}}</td> | |
| 313 | + </tr> | |
| 241 | 314 | </script> |
| 242 | 315 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/forms/statement/scheduleAnaly_sum.html
| ... | ... | @@ -11,14 +11,16 @@ |
| 11 | 11 | .table-bordered > thead > tr > th, |
| 12 | 12 | .table-bordered > thead > tr > td { |
| 13 | 13 | border-bottom-width: 2px; } |
| 14 | - | |
| 15 | 14 | .table > tbody + tbody { |
| 16 | 15 | border-top: 1px solid; } |
| 16 | + #forms > tbody > tr{ | |
| 17 | + background-color: #FFFFFF; | |
| 18 | + } | |
| 17 | 19 | </style> |
| 18 | 20 | |
| 19 | 21 | <div class="page-head"> |
| 20 | 22 | <div class="page-title"> |
| 21 | - <h1>时刻表分析</h1> | |
| 23 | + <h1>时刻表分析(汇总)</h1> | |
| 22 | 24 | </div> |
| 23 | 25 | </div> |
| 24 | 26 | |
| ... | ... | @@ -70,6 +72,9 @@ |
| 70 | 72 | <thead> |
| 71 | 73 | <tr class="hidden"> |
| 72 | 74 | <th style="display: none;"></th> |
| 75 | + <th>公司</th> | |
| 76 | + <th>分公司</th> | |
| 77 | + <th>线路</th> | |
| 73 | 78 | <th>时间段</th> |
| 74 | 79 | <th>上行班次</th> |
| 75 | 80 | <th>下行班次</th> |
| ... | ... | @@ -196,6 +201,8 @@ |
| 196 | 201 | jsDoQuery(true); |
| 197 | 202 | }); |
| 198 | 203 | |
| 204 | + var companyName = ""; | |
| 205 | + var subCompanyName = ""; | |
| 199 | 206 | var line = $("#line").val(); |
| 200 | 207 | var startDate = $("#startDate").val(); |
| 201 | 208 | var endDate = $("#endDate").val(); |
| ... | ... | @@ -232,7 +239,7 @@ |
| 232 | 239 | $(".hidden").removeClass("hidden"); |
| 233 | 240 | $get('/pcpc/scheduleAnaly_sum', params, function(result){ |
| 234 | 241 | // 把数据填充到模版中 |
| 235 | - var tbodyHtml = template('list_scheduleAnaly',{list:result.dataList}); | |
| 242 | + var tbodyHtml = template('list_scheduleAnaly',{list:result.dataList, companyName:companyName, subCompanyName:subCompanyName}); | |
| 236 | 243 | // 把渲染好的模版html文本追加到表格中 |
| 237 | 244 | $('#forms tbody').html(tbodyHtml); |
| 238 | 245 | |
| ... | ... | @@ -362,6 +369,11 @@ |
| 362 | 369 | {{each list as obj i}} |
| 363 | 370 | <tr> |
| 364 | 371 | <th style="display: none;"></th> |
| 372 | + {{if i == 0}} | |
| 373 | + <td rowspan='8'>{{obj.company}}</td> | |
| 374 | + <td rowspan='8'>{{obj.subCompany}}</td> | |
| 375 | + <td rowspan='8'>{{obj.line}}</td> | |
| 376 | + {{/if}} | |
| 365 | 377 | <td>{{obj.time}}</td> |
| 366 | 378 | <td>{{obj.upbc}}</td> |
| 367 | 379 | <td>{{obj.dnbc}}</td> |
| ... | ... | @@ -372,7 +384,7 @@ |
| 372 | 384 | {{/each}} |
| 373 | 385 | {{if list.length == 0}} |
| 374 | 386 | <tr> |
| 375 | - <td colspan="6"><h6 class="muted">没有找到相关数据</h6></td> | |
| 387 | + <td colspan="9"><h6 class="muted">没有找到相关数据</h6></td> | |
| 376 | 388 | </tr> |
| 377 | 389 | {{/if}} |
| 378 | 390 | </script> |
| 379 | 391 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/list.html
| ... | ... | @@ -9,7 +9,8 @@ |
| 9 | 9 | <th style="width: 100%;">关联时刻表</th> |
| 10 | 10 | <th style="width: 150px;">排班开始日期</th> |
| 11 | 11 | <th style="width: 150px;">排班结束日期</th> |
| 12 | - <th style="width: 250px;">排班人/操作时间</th> | |
| 12 | + <th style="width: 150px;">排班人/操作时间</th> | |
| 13 | + <th style="width: 100px;">状态</th> | |
| 13 | 14 | <th style="width: 180px;">操作</th> |
| 14 | 15 | </tr> |
| 15 | 16 | <tr role="row" class="filter"> |
| ... | ... | @@ -60,6 +61,7 @@ |
| 60 | 61 | </div> |
| 61 | 62 | </td> |
| 62 | 63 | <td></td> |
| 64 | + <td></td> | |
| 63 | 65 | <td> |
| 64 | 66 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" |
| 65 | 67 | ng-click="ctrl.doPage()"> |
| ... | ... | @@ -94,9 +96,28 @@ |
| 94 | 96 | <span ng-bind="info.scheduleToTime | date: 'yyyy-MM-dd '"></span> |
| 95 | 97 | </td> |
| 96 | 98 | <td> |
| 97 | - <span ng-bind="info.updateBy.userName"></span> | |
| 98 | - / | |
| 99 | - <span ng-bind="info.updateDate | date: 'yyyy-MM-dd HH:mm:ss'"></span> | |
| 99 | + <div> | |
| 100 | + <a href="#"> | |
| 101 | + <i class="fa fa-user"></i> | |
| 102 | + <span ng-bind="info.updateBy.userName"></span> | |
| 103 | + </a> | |
| 104 | + </div> | |
| 105 | + <div> | |
| 106 | + <a href="#"> | |
| 107 | + <span ng-bind="info.updateDate | date: 'yyyy-MM-dd HH:mm:ss'"></span> | |
| 108 | + </a> | |
| 109 | + </div> | |
| 110 | + | |
| 111 | + </td> | |
| 112 | + <td> | |
| 113 | + <a href="#" class="btn btn-success btn-sm" ng-if="info.planResult == 'ok'"> | |
| 114 | + <span>成功</span> | |
| 115 | + </a> | |
| 116 | + <a sweetalert | |
| 117 | + sweet-options="{title: '排班错误信息',text: '线路:' + info.xl.name + '</br>开始时间:' + ctrl.toDateStr(info.scheduleFromTime) + '</br>结束时间:' + ctrl.toDateStr(info.scheduleToTime) + '</br>' + info.planResult, html: true,type: 'warning',showCancelButton: true,confirmButtonColor: '#DD6B55',confirmButtonText: '是',cancelButtonText: '取消'}" | |
| 118 | + sweet-on-confirm="" | |
| 119 | + class="btn btn-danger btn-sm" | |
| 120 | + ng-if="info.planResult != 'ok'">点击查错</a> | |
| 100 | 121 | </td> |
| 101 | 122 | <td> |
| 102 | 123 | <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/list.html
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail.html
| ... | ... | @@ -218,6 +218,14 @@ |
| 218 | 218 | |
| 219 | 219 | </div> |
| 220 | 220 | |
| 221 | + <div class="form-group has-success has-feedback"> | |
| 222 | + <label class="col-md-2 control-label">是否停驶:</label> | |
| 223 | + <div class="col-md-3"> | |
| 224 | + <sa-Radiogroup model="ctrl.TimeTableDetailForSave.isTS" dicgroup="truefalseType" name="isTS"></sa-Radiogroup> | |
| 225 | + </div> | |
| 226 | + | |
| 227 | + </div> | |
| 228 | + | |
| 221 | 229 | <div class="form-group"> |
| 222 | 230 | <label class="col-md-2 control-label">备注:</label> |
| 223 | 231 | <div class="col-md-3"> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail2.html
| ... | ... | @@ -172,6 +172,14 @@ |
| 172 | 172 | |
| 173 | 173 | </div> |
| 174 | 174 | |
| 175 | + <div class="form-group has-success has-feedback"> | |
| 176 | + <label class="col-md-2 control-label">是否停驶:</label> | |
| 177 | + <div class="col-md-3"> | |
| 178 | + <sa-Radiogroup model="ctrl.tt.isTS" dicgroup="truefalseType" name="isTS"></sa-Radiogroup> | |
| 179 | + </div> | |
| 180 | + | |
| 181 | + </div> | |
| 182 | + | |
| 175 | 183 | <div class="form-group"> |
| 176 | 184 | <label class="col-md-2 control-label">备注:</label> |
| 177 | 185 | <div class="col-md-3"> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/timeTableDetailManage_old.js
| ... | ... | @@ -573,6 +573,7 @@ angular.module('ScheduleApp').controller( |
| 573 | 573 | zdzCode: undefined, |
| 574 | 574 | bcType: undefined, |
| 575 | 575 | isFB: undefined, |
| 576 | + isTS: undefined, | |
| 576 | 577 | reSetTTinfoDetail: function(value) { |
| 577 | 578 | for (var key in this) { |
| 578 | 579 | if (!angular.isFunction(this[key])) { | ... | ... |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/fcxxwt.html
| ... | ... | @@ -116,10 +116,10 @@ |
| 116 | 116 | <label class="uk-form-label" >调整说明</label> |
| 117 | 117 | <div class="uk-form-controls"> |
| 118 | 118 | <select name="adjustExps"> |
| 119 | - <option value="">请选择..</option> | |
| 120 | - {{each adjustExps as exp i}} | |
| 119 | + <option value="">请选择..</option> | |
| 120 | + {{each adjustExps as exp i}} | |
| 121 | 121 | <option value="{{exp}}">{{exp}}</option> |
| 122 | - {{/each}} | |
| 122 | + {{/each}} | |
| 123 | 123 | </select> |
| 124 | 124 | </div> |
| 125 | 125 | </div> |
| ... | ... | @@ -129,7 +129,7 @@ |
| 129 | 129 | <div class="uk-width-1-1"> |
| 130 | 130 | <div class="uk-form-row ct-stacked"> |
| 131 | 131 | <div class="uk-form-controls" style="margin-top: 5px;"> |
| 132 | - <textarea id="form-s-t" cols="30" rows="5" name="remarks" data-fv-stringlength="true" data-fv-stringlength-max="50" placeholder="备注,不超过50个字符">{{sch.remarks}}</textarea> | |
| 132 | + <textarea id="form-s-t" cols="30" rows="5" required name="remarks" data-fv-stringlength="true" data-fv-stringlength-max="50" placeholder="备注,不超过50个字符">{{sch.remarks}}</textarea> | |
| 133 | 133 | </div> |
| 134 | 134 | </div> |
| 135 | 135 | </div> | ... | ... |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sftz.html
| ... | ... | @@ -54,7 +54,7 @@ |
| 54 | 54 | <div class="uk-form-row ct-stacked"> |
| 55 | 55 | <label class="uk-form-label" for="form-s-t">调整说明<small class="font-danger">(不超过20个字符)</small></label> |
| 56 | 56 | <div class="uk-form-controls"> |
| 57 | - <textarea id="form-s-t" cols="30" rows="5" name="remarks" data-fv-stringlength="true" data-fv-stringlength-max="20" placeholder="不超过20个字符。非必填"></textarea> | |
| 57 | + <textarea id="form-s-t" cols="30" rows="5" name="remarks" required data-fv-stringlength="true" data-fv-stringlength-max="20" placeholder="不超过20个字符。必填"></textarea> | |
| 58 | 58 | </div> |
| 59 | 59 | </div> |
| 60 | 60 | </div> | ... | ... |
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> | ... | ... |
src/main/resources/static/real_control_v2/js/main.js
| ... | ... | @@ -169,8 +169,8 @@ var disabled_submit_btn = function (form) { |
| 169 | 169 | function showUpdateDescription() { |
| 170 | 170 | //更新说明 |
| 171 | 171 | var updateDescription = { |
| 172 | - date: '2017-05-09', | |
| 173 | - text: '<h5>恢复到了最新功能版本,并修复了临加时没有保存售票员的问题。</h5>' | |
| 172 | + date: '2017-05-12', | |
| 173 | + text: '<h5>现在班次调整时,备注是必填项</h5><h5>现在中途更换设备后,需要刷新缓存数据后,再刷新线调页面。</h5><h5>分班套跑车辆将在上午最后一个班次完成后发送线路切换指令。捕捉到出场信号时也会切换至出场班次所在线路,驾驶员请求出场时候也会同步一次状态</h5><h5>修复了一些其他问题。</h5>' | |
| 174 | 174 | }; |
| 175 | 175 | |
| 176 | 176 | var storage = window.localStorage | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback_v2/main.html
src/test/resources/testdata/problem.properties
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | ##2=时刻表明细编辑功能,数据工具移到时刻表里,类似工具栏的样子 |
| 3 | 3 | 3=时刻表导入,可以选一个已经存在的时刻表导入,而不是excel文件 |
| 4 | 4 | ##4=所有的删除,作废,都要有提示框操作 |
| 5 | -5=排班计划错误提示,如果选的排班日期之前没有排班,提示错误,排班结果有重复与时刻表不符合,显示错误 | |
| 5 | +##5=排班计划错误提示,如果选的排班日期之前没有排班,提示错误,排班结果有重复与时刻表不符合,显示错误 | |
| 6 | 6 | ##6=调度执行日报,显示最近排班日期,修改操作强化 |
| 7 | 7 | 7=警告功能,如时刻表选择相同的常规有效日,特殊有效日,车辆,人员配置重复等等 |
| 8 | 8 | 8=时刻表明细编辑,颜色覆盖冲突 |
| ... | ... | @@ -31,4 +31,5 @@ |
| 31 | 31 | ##30=时刻表公里数 三位数 |
| 32 | 32 | |
| 33 | 33 | 31=规则修改,路牌范围,人员范围可以拖动 |
| 34 | -#32=人员配置不存在的情况下,导入规则ktr,找不到的人员不添加,人员范围不存在的,规则不导入 | |
| 34 | +##32=人员配置不存在的情况下,导入规则ktr,找不到的人员不添加,人员范围不存在的,规则不导入 | |
| 35 | +33=时刻表明细班次,里添加,是否停驶选项(计算工时使用) | ... | ... |
src/test/resources/testdata/test6.txt
| ... | ... | @@ -7,6 +7,13 @@ update bsth_c_s_sp_rule_rst a |
| 7 | 7 | set a.qyrq = (select qyrq from bsth_c_s_sr1_flat where id = a.rule_id) |
| 8 | 8 | where a.qyrq is null; |
| 9 | 9 | |
| 10 | +select * from bsth_c_s_sp_rule_rst | |
| 11 | +where origingidindex is null; | |
| 12 | + | |
| 13 | +update bsth_c_s_sp_rule_rst a | |
| 14 | +set a.origingidindex = (select lp_start from bsth_c_s_sr1_flat where id = a.rule_id) | |
| 15 | +where a.origingidindex is null; | |
| 16 | + | |
| 10 | 17 | 970 |
| 11 | 18 | 789 |
| 12 | 19 | 604 | ... | ... |