Commit b650a337186b4ce90c29e53b7134db5ee1706708

Authored by 廖磊
2 parents 71c8a272 bfe499ac

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 package com.bsth.controller.realcontrol; 1 package com.bsth.controller.realcontrol;
2 2
3 import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; 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 import com.bsth.data.schedule.DayOfSchedule; 7 import com.bsth.data.schedule.DayOfSchedule;
5 import com.bsth.entity.realcontrol.ScheduleRealInfo; 8 import com.bsth.entity.realcontrol.ScheduleRealInfo;
6 import org.slf4j.Logger; 9 import org.slf4j.Logger;
@@ -55,4 +58,21 @@ public class anomalyCheckController { @@ -55,4 +58,21 @@ public class anomalyCheckController {
55 public void shutdownThreadPool(){ 58 public void shutdownThreadPool(){
56 GpsRealAnalyse.shutdown(); 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
@@ -154,8 +154,6 @@ public class BasicData implements CommandLineRunner { @@ -154,8 +154,6 @@ public class BasicData implements CommandLineRunner {
154 loadLineInfo(); 154 loadLineInfo();
155 //车辆和线路映射信息 155 //车辆和线路映射信息
156 loadNbbm2LineInfo(); 156 loadNbbm2LineInfo();
157 - //站点路由信息  
158 - //loadStationRouteInfo();  
159 //人员信息 157 //人员信息
160 loadPersonnelInfo(); 158 loadPersonnelInfo();
161 //公司信息 159 //公司信息
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,15 +9,12 @@ import org.apache.commons.lang3.StringUtils;
9 import org.slf4j.Logger; 9 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory; 10 import org.slf4j.LoggerFactory;
11 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
12 -import org.springframework.boot.CommandLineRunner;  
13 import org.springframework.jdbc.core.BatchPreparedStatementSetter; 12 import org.springframework.jdbc.core.BatchPreparedStatementSetter;
14 import org.springframework.jdbc.core.JdbcTemplate; 13 import org.springframework.jdbc.core.JdbcTemplate;
15 import org.springframework.jdbc.datasource.DataSourceTransactionManager; 14 import org.springframework.jdbc.datasource.DataSourceTransactionManager;
16 import org.springframework.stereotype.Component; 15 import org.springframework.stereotype.Component;
17 -import org.springframework.stereotype.Service;  
18 import org.springframework.transaction.TransactionDefinition; 16 import org.springframework.transaction.TransactionDefinition;
19 import org.springframework.transaction.TransactionStatus; 17 import org.springframework.transaction.TransactionStatus;
20 -import org.springframework.transaction.annotation.Transactional;  
21 import org.springframework.transaction.support.DefaultTransactionDefinition; 18 import org.springframework.transaction.support.DefaultTransactionDefinition;
22 19
23 import java.sql.PreparedStatement; 20 import java.sql.PreparedStatement;
@@ -28,14 +25,23 @@ import java.util.*; @@ -28,14 +25,23 @@ import java.util.*;
28 * 发车信息表处理程序 25 * 发车信息表处理程序
29 * Created by panzhao on 2017/5/5. 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 @Autowired 31 @Autowired
35 DayOfSchedule dayOfSchedule; 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 private static ScheduleComparator.FCSJ schFCSJComparator = new ScheduleComparator.FCSJ(); 46 private static ScheduleComparator.FCSJ schFCSJComparator = new ScheduleComparator.FCSJ();
41 47
@@ -47,7 +53,6 @@ public class CarOutInfoHandler implements CommandLineRunner, CarOutInfo { @@ -47,7 +53,6 @@ public class CarOutInfoHandler implements CommandLineRunner, CarOutInfo {
47 /** 53 /**
48 * 全量更新发车信息表 54 * 全量更新发车信息表
49 */ 55 */
50 - @Override  
51 public void updateAll() { 56 public void updateAll() {
52 Set<String> ks = BasicData.lineCode2NameMap.keySet(); 57 Set<String> ks = BasicData.lineCode2NameMap.keySet();
53 for (String lineCode : ks) { 58 for (String lineCode : ks) {
@@ -55,7 +60,6 @@ public class CarOutInfoHandler implements CommandLineRunner, CarOutInfo { @@ -55,7 +60,6 @@ public class CarOutInfoHandler implements CommandLineRunner, CarOutInfo {
55 } 60 }
56 } 61 }
57 62
58 - @Override  
59 public void update(String lineCode) { 63 public void update(String lineCode) {
60 try { 64 try {
61 ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap = dayOfSchedule.getLpScheduleMap(); 65 ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap = dayOfSchedule.getLpScheduleMap();
@@ -75,8 +79,6 @@ public class CarOutInfoHandler implements CommandLineRunner, CarOutInfo { @@ -75,8 +79,6 @@ public class CarOutInfoHandler implements CommandLineRunner, CarOutInfo {
75 } 79 }
76 } 80 }
77 81
78 - @Transactional  
79 - @Override  
80 public void update(List<ScheduleRealInfo> list) { 82 public void update(List<ScheduleRealInfo> list) {
81 if (list.size() == 0) 83 if (list.size() == 0)
82 return; 84 return;
@@ -194,30 +196,4 @@ public class CarOutInfoHandler implements CommandLineRunner, CarOutInfo { @@ -194,30 +196,4 @@ public class CarOutInfoHandler implements CommandLineRunner, CarOutInfo {
194 } 196 }
195 return array; 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,10 +57,11 @@ public class DayOfDirectives {
57 pstDirectives = new LinkedList<>(); 57 pstDirectives = new LinkedList<>();
58 } 58 }
59 59
60 - public void put60(D60 d60) { 60 + public void put60(D60 d60, boolean pst) {
61 d60Map.put(d60.getMsgId(), d60); 61 d60Map.put(d60.getMsgId(), d60);
62 //等待持久化 62 //等待持久化
63 - pstDirectives.add(d60); 63 + if(pst)
  64 + pstDirectives.add(d60);
64 } 65 }
65 66
66 public void put64(D64 d64) { 67 public void put64(D64 d64) {
src/main/java/com/bsth/data/directive/GatewayHttpUtils.java
@@ -41,8 +41,8 @@ public class GatewayHttpUtils { @@ -41,8 +41,8 @@ public class GatewayHttpUtils {
41 41
42 //超时时间 42 //超时时间
43 RequestConfig requestConfig = RequestConfig.custom() 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 HttpPost post = new HttpPost(url); 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,7 +47,7 @@ public class ForecastRealServer implements CommandLineRunner {
47 47
48 //车辆 ——> 预测终点时间 48 //车辆 ——> 预测终点时间
49 //static Map<String, Float> forecastMap = new HashMap<>(); 49 //static Map<String, Float> forecastMap = new HashMap<>();
50 - //线路_上下行 ——> 封装耗时数据的路由链 50 + //线路_上下行 ——> 耗时数据的路由链
51 public static ArrayListMultimap<String, SimpleRoute> lineSampleMap; 51 public static ArrayListMultimap<String, SimpleRoute> lineSampleMap;
52 //车辆 ——> 预测结果 52 //车辆 ——> 预测结果
53 public static Map<String, ForecastResult> forecastMap; 53 public static Map<String, ForecastResult> forecastMap;
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
@@ -88,6 +88,13 @@ public class GpsEntity { @@ -88,6 +88,13 @@ public class GpsEntity {
88 /** gps是否有效 设备端发送的状态 */ 88 /** gps是否有效 设备端发送的状态 */
89 private int valid; 89 private int valid;
90 90
  91 + /**
  92 + * 数据来源
  93 + * 1:网关
  94 + * 0:转发
  95 + */
  96 + private int source;
  97 +
91 public String getDeviceId() { 98 public String getDeviceId() {
92 return deviceId; 99 return deviceId;
93 } 100 }
@@ -292,4 +299,12 @@ public class GpsEntity { @@ -292,4 +299,12 @@ public class GpsEntity {
292 public void setSpeed(Float speed) { 299 public void setSpeed(Float speed) {
293 this.speed = speed; 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,9 +2,6 @@ package com.bsth.data.gpsdata;
2 2
3 import com.bsth.data.BasicData; 3 import com.bsth.data.BasicData;
4 import com.bsth.data.forecast.ForecastRealServer; 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 import com.bsth.data.schedule.DayOfSchedule; 5 import com.bsth.data.schedule.DayOfSchedule;
9 import com.bsth.entity.realcontrol.ScheduleRealInfo; 6 import com.bsth.entity.realcontrol.ScheduleRealInfo;
10 import com.google.common.collect.TreeMultimap; 7 import com.google.common.collect.TreeMultimap;
@@ -12,7 +9,6 @@ import org.apache.commons.lang3.StringUtils; @@ -12,7 +9,6 @@ import org.apache.commons.lang3.StringUtils;
12 import org.slf4j.Logger; 9 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory; 10 import org.slf4j.LoggerFactory;
14 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
15 -import org.springframework.boot.CommandLineRunner;  
16 import org.springframework.stereotype.Component; 12 import org.springframework.stereotype.Component;
17 13
18 import java.util.*; 14 import java.util.*;
@@ -26,7 +22,7 @@ import java.util.concurrent.ConcurrentMap; @@ -26,7 +22,7 @@ import java.util.concurrent.ConcurrentMap;
26 * @date 2016年8月12日 下午2:04:41 22 * @date 2016年8月12日 下午2:04:41
27 */ 23 */
28 @Component 24 @Component
29 -public class GpsRealData implements CommandLineRunner { 25 +public class GpsRealData {
30 26
31 static Logger logger = LoggerFactory.getLogger(GpsRealData.class); 27 static Logger logger = LoggerFactory.getLogger(GpsRealData.class);
32 28
@@ -36,20 +32,11 @@ public class GpsRealData implements CommandLineRunner { @@ -36,20 +32,11 @@ public class GpsRealData implements CommandLineRunner {
36 private static TreeMultimap<String, String> lineCode2Devices; 32 private static TreeMultimap<String, String> lineCode2Devices;
37 33
38 @Autowired 34 @Autowired
39 - GpsDataLoaderThread gpsDataLoader;  
40 -  
41 - @Autowired  
42 - OfflineMonitorThread offlineMonitorThread;  
43 -  
44 - @Autowired  
45 DayOfSchedule dayOfSchedule; 35 DayOfSchedule dayOfSchedule;
46 36
47 @Autowired 37 @Autowired
48 ForecastRealServer forecastRealServer; 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,19 +45,6 @@ public class GpsRealData implements CommandLineRunner {
58 lineCode2Devices = TreeMultimap.create(); 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 public void put(GpsEntity gps) { 49 public void put(GpsEntity gps) {
76 String device = gps.getDeviceId(); 50 String device = gps.getDeviceId();
@@ -89,19 +63,29 @@ public class GpsRealData implements CommandLineRunner { @@ -89,19 +63,29 @@ public class GpsRealData implements CommandLineRunner {
89 gps.setExpectStopTime(forecastRealServer.expectStopTime(gps.getNbbm())); 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,6 +100,16 @@ public class GpsRealData implements CommandLineRunner {
116 return gpsMap.get(deviceId); 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 * @Title: get @Description: TODO(线路编码获取GPS集合) @throws 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,10 +11,7 @@ import org.slf4j.LoggerFactory;
11 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.stereotype.Component; 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 import java.util.concurrent.CountDownLatch; 15 import java.util.concurrent.CountDownLatch;
19 import java.util.concurrent.ExecutorService; 16 import java.util.concurrent.ExecutorService;
20 import java.util.concurrent.Executors; 17 import java.util.concurrent.Executors;
@@ -44,15 +41,22 @@ public class GpsRealAnalyse { @@ -44,15 +41,22 @@ public class GpsRealAnalyse {
44 @Autowired 41 @Autowired
45 GpsRealData gpsRealData; 42 GpsRealData gpsRealData;
46 43
47 - static ExecutorService threadPool = Executors.newFixedThreadPool(100); 44 + static ExecutorService threadPool = Executors.newFixedThreadPool(20);
48 45
49 public static long st; 46 public static long st;
50 public static CountDownLatch count; 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 public void analyse(List<GpsEntity> list) { 57 public void analyse(List<GpsEntity> list) {
53 try { 58 try {
54 st = System.currentTimeMillis(); 59 st = System.currentTimeMillis();
55 - //如果正在恢复数据  
56 if (GpsDataRecovery.run) 60 if (GpsDataRecovery.run)
57 return; 61 return;
58 62
@@ -63,6 +67,7 @@ public class GpsRealAnalyse { @@ -63,6 +67,7 @@ public class GpsRealAnalyse {
63 } 67 }
64 68
65 Set<String> ks = multimap.keySet(); 69 Set<String> ks = multimap.keySet();
  70 +
66 logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size()); 71 logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size());
67 count = new CountDownLatch(ks.size()); 72 count = new CountDownLatch(ks.size());
68 73
@@ -125,7 +130,7 @@ public class GpsRealAnalyse { @@ -125,7 +130,7 @@ public class GpsRealAnalyse {
125 abnormalStateHandle.handle(gps, prevs); 130 abnormalStateHandle.handle(gps, prevs);
126 131
127 if (!task) 132 if (!task)
128 - return; //无任务的,到这里就结束 133 + continue; //无任务的,到这里就结束
129 134
130 //反向处理 135 //反向处理
131 reverseSignalHandle.handle(gps, prevs); 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,12 +6,12 @@ import com.bsth.data.gpsdata.arrival.SignalHandle;
6 import com.bsth.data.gpsdata.arrival.utils.CircleQueue; 6 import com.bsth.data.gpsdata.arrival.utils.CircleQueue;
7 import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState; 7 import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState;
8 import com.bsth.data.gpsdata.arrival.utils.SignalSchPlanMatcher; 8 import com.bsth.data.gpsdata.arrival.utils.SignalSchPlanMatcher;
  9 +import com.bsth.data.msg_queue.DirectivePushQueue;
9 import com.bsth.data.schedule.DayOfSchedule; 10 import com.bsth.data.schedule.DayOfSchedule;
10 import com.bsth.data.schedule.ScheduleComparator; 11 import com.bsth.data.schedule.ScheduleComparator;
11 import com.bsth.data.schedule.late_adjust.LateAdjustHandle; 12 import com.bsth.data.schedule.late_adjust.LateAdjustHandle;
12 import com.bsth.entity.realcontrol.LineConfig; 13 import com.bsth.entity.realcontrol.LineConfig;
13 import com.bsth.entity.realcontrol.ScheduleRealInfo; 14 import com.bsth.entity.realcontrol.ScheduleRealInfo;
14 -import com.bsth.service.directive.DirectiveService;  
15 import com.bsth.websocket.handler.SendUtils; 15 import com.bsth.websocket.handler.SendUtils;
16 import org.apache.commons.lang3.StringUtils; 16 import org.apache.commons.lang3.StringUtils;
17 import org.slf4j.Logger; 17 import org.slf4j.Logger;
@@ -41,9 +41,6 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -41,9 +41,6 @@ public class InOutStationSignalHandle extends SignalHandle{
41 SendUtils sendUtils; 41 SendUtils sendUtils;
42 42
43 @Autowired 43 @Autowired
44 - DirectiveService directiveService;  
45 -  
46 - @Autowired  
47 ScheduleSignalState scheduleSignalState; 44 ScheduleSignalState scheduleSignalState;
48 45
49 @Autowired 46 @Autowired
@@ -151,7 +148,8 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -151,7 +148,8 @@ public class InOutStationSignalHandle extends SignalHandle{
151 148
152 if(sch.getBcType().equals("out")){ 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 outStationAndOutPark(sch); 155 outStationAndOutPark(sch);
@@ -208,7 +206,8 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -208,7 +206,8 @@ public class InOutStationSignalHandle extends SignalHandle{
208 206
209 if(schPrev.getBcType().equals("out")){ 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,15 +275,19 @@ public class InOutStationSignalHandle extends SignalHandle{
276 //将gps转换为下一个班次走向的站内信号 275 //将gps转换为下一个班次走向的站内信号
277 transformUpdown(gps, next); 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 else if(sch.getBcType().equals("in")){ 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 else { 293 else {
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java
@@ -164,7 +164,7 @@ public class GpsDataRecovery implements ApplicationContextAware { @@ -164,7 +164,7 @@ public class GpsDataRecovery implements ApplicationContextAware {
164 //abnormalStateHandle.handle(gps, prevs); 164 //abnormalStateHandle.handle(gps, prevs);
165 165
166 if(!task) 166 if(!task)
167 - return; //无任务的,到这里就结束 167 + continue; //无任务的,到这里就结束
168 168
169 //反向处理 169 //反向处理
170 reverseSignalHandle.handle(gps, prevs); 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,7 +6,6 @@ import com.bsth.data.BasicData;
6 import com.bsth.data.gpsdata.GpsEntity; 6 import com.bsth.data.gpsdata.GpsEntity;
7 import com.bsth.data.gpsdata.GpsRealData; 7 import com.bsth.data.gpsdata.GpsRealData;
8 import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; 8 import com.bsth.data.gpsdata.arrival.GpsRealAnalyse;
9 -import com.bsth.data.gpsdata.recovery.GpsDataRecovery;  
10 import com.bsth.util.ConfigUtil; 9 import com.bsth.util.ConfigUtil;
11 import org.apache.commons.lang3.StringUtils; 10 import org.apache.commons.lang3.StringUtils;
12 import org.apache.http.HttpEntity; 11 import org.apache.http.HttpEntity;
@@ -38,10 +37,24 @@ public class GpsDataLoaderThread extends Thread { @@ -38,10 +37,24 @@ public class GpsDataLoaderThread extends Thread {
38 */ 37 */
39 public GpsDataLoaderThread() { 38 public GpsDataLoaderThread() {
40 url = ConfigUtil.get("http.gps.real.url"); 39 url = ConfigUtil.get("http.gps.real.url");
  40 + clientUrl = ConfigUtil.get("http.gps.real.cache.url");
41 } 41 }
42 42
43 // 网关数据接口地址 43 // 网关数据接口地址
44 private static String url; 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 @Autowired 59 @Autowired
47 GpsRealData gpsRealData; 60 GpsRealData gpsRealData;
@@ -52,17 +65,20 @@ public class GpsDataLoaderThread extends Thread { @@ -52,17 +65,20 @@ public class GpsDataLoaderThread extends Thread {
52 @Override 65 @Override
53 public void run() { 66 public void run() {
54 try { 67 try {
55 - //如果正在恢复数据  
56 - if (GpsDataRecovery.run)  
57 - return;  
58 -  
59 - load(); 68 + if(flag == 0)
  69 + load();
  70 + else
  71 + loadByGateway();
60 } catch (Exception e) { 72 } catch (Exception e) {
61 logger.error("", e); 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 List<GpsEntity> list = null; 82 List<GpsEntity> list = null;
67 List<GpsEntity> updateList = new ArrayList<>(); 83 List<GpsEntity> updateList = new ArrayList<>();
68 CloseableHttpClient httpClient = null; 84 CloseableHttpClient httpClient = null;
@@ -72,8 +88,8 @@ public class GpsDataLoaderThread extends Thread { @@ -72,8 +88,8 @@ public class GpsDataLoaderThread extends Thread {
72 HttpGet get = new HttpGet(url); 88 HttpGet get = new HttpGet(url);
73 //超时时间 89 //超时时间
74 RequestConfig requestConfig = RequestConfig.custom() 90 RequestConfig requestConfig = RequestConfig.custom()
75 - .setConnectTimeout(2000).setConnectionRequestTimeout(1000)  
76 - .setSocketTimeout(2000).build(); 91 + .setConnectTimeout(1500).setConnectionRequestTimeout(1000)
  92 + .setSocketTimeout(1500).build();
77 get.setConfig(requestConfig); 93 get.setConfig(requestConfig);
78 94
79 response = httpClient.execute(get); 95 response = httpClient.execute(get);
@@ -81,7 +97,7 @@ public class GpsDataLoaderThread extends Thread { @@ -81,7 +97,7 @@ public class GpsDataLoaderThread extends Thread {
81 HttpEntity entity = response.getEntity(); 97 HttpEntity entity = response.getEntity();
82 if (null != entity) { 98 if (null != entity) {
83 BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent())); 99 BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent()));
84 - StringBuffer stringBuffer = new StringBuffer(); 100 + StringBuilder stringBuffer = new StringBuilder();
85 String str = ""; 101 String str = "";
86 while ((str = br.readLine()) != null) 102 while ((str = br.readLine()) != null)
87 stringBuffer.append(str); 103 stringBuffer.append(str);
@@ -128,4 +144,55 @@ public class GpsDataLoaderThread extends Thread { @@ -128,4 +144,55 @@ public class GpsDataLoaderThread extends Thread {
128 response.close(); 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 \ No newline at end of file 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,6 +4,7 @@ import com.bsth.data.BasicData;
4 import com.bsth.data.LineConfigData; 4 import com.bsth.data.LineConfigData;
5 import com.bsth.data.gpsdata.GpsEntity; 5 import com.bsth.data.gpsdata.GpsEntity;
6 import com.bsth.data.gpsdata.GpsRealData; 6 import com.bsth.data.gpsdata.GpsRealData;
  7 +import com.bsth.data.msg_queue.DirectivePushQueue;
7 import com.bsth.data.schedule.DayOfSchedule; 8 import com.bsth.data.schedule.DayOfSchedule;
8 import com.bsth.entity.Line; 9 import com.bsth.entity.Line;
9 import com.bsth.entity.directive.D80; 10 import com.bsth.entity.directive.D80;
@@ -82,9 +83,11 @@ public class PilotReport { @@ -82,9 +83,11 @@ public class PilotReport {
82 outSch = dayOfSchedule.next(outSch); 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 }else 91 }else
89 d80.setRemarks("没有出场计划"); 92 d80.setRemarks("没有出场计划");
90 93
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -2,19 +2,11 @@ package com.bsth.data.schedule; @@ -2,19 +2,11 @@ package com.bsth.data.schedule;
2 2
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONArray; 4 import com.alibaba.fastjson.JSONArray;
5 -import com.bsth.Application;  
6 import com.bsth.common.Constants; 5 import com.bsth.common.Constants;
7 import com.bsth.common.ResponseCode; 6 import com.bsth.common.ResponseCode;
8 -import com.bsth.data.BasicData;  
9 import com.bsth.data.LineConfigData; 7 import com.bsth.data.LineConfigData;
10 -import com.bsth.data.directive.DirectivesPstThread;  
11 import com.bsth.data.gpsdata.GpsRealData; 8 import com.bsth.data.gpsdata.GpsRealData;
12 import com.bsth.data.gpsdata.recovery.GpsDataRecovery; 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 import com.bsth.entity.realcontrol.LineConfig; 10 import com.bsth.entity.realcontrol.LineConfig;
19 import com.bsth.entity.realcontrol.ScheduleRealInfo; 11 import com.bsth.entity.realcontrol.ScheduleRealInfo;
20 import com.bsth.entity.schedule.SchedulePlanInfo; 12 import com.bsth.entity.schedule.SchedulePlanInfo;
@@ -32,8 +24,6 @@ import org.joda.time.format.DateTimeFormatter; @@ -32,8 +24,6 @@ import org.joda.time.format.DateTimeFormatter;
32 import org.slf4j.Logger; 24 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory; 25 import org.slf4j.LoggerFactory;
34 import org.springframework.beans.factory.annotation.Autowired; 26 import org.springframework.beans.factory.annotation.Autowired;
35 -import org.springframework.boot.CommandLineRunner;  
36 -import org.springframework.core.annotation.Order;  
37 import org.springframework.dao.DataIntegrityViolationException; 27 import org.springframework.dao.DataIntegrityViolationException;
38 import org.springframework.jdbc.core.JdbcTemplate; 28 import org.springframework.jdbc.core.JdbcTemplate;
39 import org.springframework.stereotype.Component; 29 import org.springframework.stereotype.Component;
@@ -41,7 +31,6 @@ import org.springframework.stereotype.Component; @@ -41,7 +31,6 @@ import org.springframework.stereotype.Component;
41 import java.text.ParseException; 31 import java.text.ParseException;
42 import java.text.SimpleDateFormat; 32 import java.text.SimpleDateFormat;
43 import java.util.*; 33 import java.util.*;
44 -import java.util.concurrent.TimeUnit;  
45 34
46 /** 35 /**
47 * @author PanZhao 36 * @author PanZhao
@@ -50,8 +39,7 @@ import java.util.concurrent.TimeUnit; @@ -50,8 +39,7 @@ import java.util.concurrent.TimeUnit;
50 * @date 2016年8月15日 上午10:16:12 39 * @date 2016年8月15日 上午10:16:12
51 */ 40 */
52 @Component 41 @Component
53 -@Order(value = 3)  
54 -public class DayOfSchedule implements CommandLineRunner { 42 +public class DayOfSchedule {
55 43
56 Logger logger = LoggerFactory.getLogger(this.getClass()); 44 Logger logger = LoggerFactory.getLogger(this.getClass());
57 45
@@ -94,9 +82,6 @@ public class DayOfSchedule implements CommandLineRunner { @@ -94,9 +82,6 @@ public class DayOfSchedule implements CommandLineRunner {
94 @Autowired 82 @Autowired
95 GpsRealData gpsRealData; 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,57 +101,13 @@ public class DayOfSchedule implements CommandLineRunner {
116 } 101 }
117 102
118 @Autowired 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 LineConfigData lineConfigs; 104 LineConfigData lineConfigs;
132 105
133 @Autowired 106 @Autowired
134 GpsDataRecovery gpsDataRecovery; 107 GpsDataRecovery gpsDataRecovery;
135 108
136 - @Autowired  
137 - DirectivesPstThread directivesPstThread;  
138 -  
139 - @Autowired  
140 - CalcOilThread calcOilThread;  
141 -  
142 private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"), fmtHHmm = DateTimeFormat.forPattern("HH:mm"); 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 private void dataRecovery() { 112 private void dataRecovery() {
172 GpsDataRecovery.run = true; 113 GpsDataRecovery.run = true;
src/main/java/com/bsth/entity/schedule/TTInfoDetail.java
@@ -86,6 +86,8 @@ public class TTInfoDetail extends BEntity { @@ -86,6 +86,8 @@ public class TTInfoDetail extends BEntity {
86 86
87 /** 是否分班(表示这个班次是否是晚班班次,就是换另外一个驾驶员开)*/ 87 /** 是否分班(表示这个班次是否是晚班班次,就是换另外一个驾驶员开)*/
88 private Boolean isFB; 88 private Boolean isFB;
  89 + /** 是否停驶(表示此班次执行完成,停在终点站,不进场) */
  90 + private Boolean isTS;
89 91
90 /** 是否切换线路 */ 92 /** 是否切换线路 */
91 private Boolean isSwitchXl; 93 private Boolean isSwitchXl;
@@ -280,4 +282,12 @@ public class TTInfoDetail extends BEntity { @@ -280,4 +282,12 @@ public class TTInfoDetail extends BEntity {
280 public void setZdzName(String zdzName) { 282 public void setZdzName(String zdzName) {
281 this.zdzName = zdzName; 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,20 +27,22 @@ public class SchedulePlanRuleResult {
27 27
28 /** 排班规则id */ 28 /** 排班规则id */
29 private String ruleId; 29 private String ruleId;
30 - /** 启用日期 */ 30 + /** 启用日期(用于md5计算) */
31 private Date qyrq; 31 private Date qyrq;
32 /** 车辆配置id */ 32 /** 车辆配置id */
33 private String ccId; 33 private String ccId;
34 /** 车辆自编号 */ 34 /** 车辆自编号 */
35 private String ccZbh; 35 private String ccZbh;
36 36
37 - /** 路牌id列表字符串 */ 37 + /** 路牌id列表字符串(用于md5计算) */
38 @Column(length = 1000) 38 @Column(length = 1000)
39 private String gids; 39 private String gids;
40 /** 路牌名字列表字符串 */ 40 /** 路牌名字列表字符串 */
41 private String gnames; 41 private String gnames;
42 /** 翻到哪个路牌索引 */ 42 /** 翻到哪个路牌索引 */
43 private String gidindex; 43 private String gidindex;
  44 + /** 原始的起始路牌索引(用于md5计算) */
  45 + private String origingidindex;
44 /** 人员配置id列表字符串 */ 46 /** 人员配置id列表字符串 */
45 @Column(length = 1000) 47 @Column(length = 1000)
46 private String ecids; 48 private String ecids;
@@ -81,8 +83,8 @@ public class SchedulePlanRuleResult { @@ -81,8 +83,8 @@ public class SchedulePlanRuleResult {
81 "(xl_id,xl_name,rule_id,cc_id,cc_zbh," + 83 "(xl_id,xl_name,rule_id,cc_id,cc_zbh," +
82 "gids,gnames,gidindex,ecids,ecdbbms,ecindex," + 84 "gids,gnames,gidindex,ecids,ecdbbms,ecindex," +
83 "ttinfo_id,ttinfo_name,schedule_date," + 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 return sql; 89 return sql;
88 } 90 }
@@ -106,7 +108,7 @@ public class SchedulePlanRuleResult { @@ -106,7 +108,7 @@ public class SchedulePlanRuleResult {
106 ps.setString(16, this.getSysuserName()); 108 ps.setString(16, this.getSysuserName());
107 ps.setTimestamp(17, new java.sql.Timestamp(this.getCreateDate().getTime())); 109 ps.setTimestamp(17, new java.sql.Timestamp(this.getCreateDate().getTime()));
108 ps.setDate(18, new java.sql.Date(this.getQyrq().getTime())); 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,4 +263,12 @@ public class SchedulePlanRuleResult {
261 public void setQyrq(Date qyrq) { 263 public void setQyrq(Date qyrq) {
262 this.qyrq = qyrq; 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&lt;StationRoute, Int @@ -113,8 +113,8 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
113 /*@Query(value = "SELECT s.b_jwpoints,s.station_name FROM (" + 113 /*@Query(value = "SELECT s.b_jwpoints,s.station_name FROM (" +
114 "SELECT b.station FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " + 114 "SELECT b.station FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " +
115 "LEFT JOIN bsth_c_station s on r.station = s.id", nativeQuery=true)*/ 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 "LEFT JOIN bsth_c_station s on r.station = s.id order by r.station_route_code asc", nativeQuery=true) 118 "LEFT JOIN bsth_c_station s on r.station = s.id order by r.station_route_code asc", nativeQuery=true)
119 List<Object[]> getSelectStationRouteCenterPoints(Integer lineId,Integer direction); 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&lt;D60, Integer&gt; implemen @@ -85,12 +85,15 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
85 if(null != sender) 85 if(null != sender)
86 d60.setSender(sender); 86 d60.setSender(sender);
87 d60.setHttpCode(code); 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 d60.setErrorText("网关通讯失败, code: " + code); 94 d60.setErrorText("网关通讯失败, code: " + code);
93 d60Repository.save(d60); 95 d60Repository.save(d60);
  96 + dayOfDirectives.put60(d60, false);
94 } 97 }
95 return code; 98 return code;
96 } 99 }
@@ -139,12 +142,13 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -139,12 +142,13 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
139 if (code == 0) { 142 if (code == 0) {
140 sch.setDirectiveState(60); 143 sch.setDirectiveState(60);
141 // 添加到缓存,延迟入库 144 // 添加到缓存,延迟入库
142 - dayOfDirectives.put60(d60); 145 + dayOfDirectives.put60(d60, true);
143 // 通知页面 146 // 通知页面
144 sendD60ToPage(sch); 147 sendD60ToPage(sch);
145 } 148 }
146 else{ 149 else{
147 d60.setErrorText("网关通讯失败, code: " + code); 150 d60.setErrorText("网关通讯失败, code: " + code);
  151 + dayOfDirectives.put60(d60, false);
148 d60Repository.save(d60); 152 d60Repository.save(d60);
149 } 153 }
150 return code; 154 return code;
@@ -196,11 +200,15 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -196,11 +200,15 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
196 d60.setHttpCode(code); 200 d60.setHttpCode(code);
197 if (null != sch) 201 if (null != sch)
198 d60.setSch(sch); 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 d60.setErrorText("网关通讯失败, code: " + code); 209 d60.setErrorText("网关通讯失败, code: " + code);
203 d60Repository.save(d60); 210 d60Repository.save(d60);
  211 + dayOfDirectives.put60(d60, false);
204 } 212 }
205 return code; 213 return code;
206 } 214 }
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
@@ -1569,7 +1569,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1569,7 +1569,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1569 1569
1570 jhbc++; 1570 jhbc++;
1571 jhlc += lc; 1571 jhlc += lc;
1572 - if(schedule.getStatus() == 2){ 1572 + if(schedule.getStatus() != -1){
1573 sjbc++; 1573 sjbc++;
1574 sjlc += lc; 1574 sjlc += lc;
1575 } else if(schedule.getStatus() == -1){ 1575 } else if(schedule.getStatus() == -1){
@@ -1622,37 +1622,37 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1622,37 +1622,37 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1622 tempMap.put("lcbfb", df.format(jhlc>0?(double)sjlc/jhlc*100:0)+"%"); 1622 tempMap.put("lcbfb", df.format(jhlc>0?(double)sjlc/jhlc*100:0)+"%");
1623 tempMap.put("lzbc", lzbc); 1623 tempMap.put("lzbc", lzbc);
1624 tempMap.put("lzlc", lzlc); 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 tempMap.put("dmbc", dmbc); 1626 tempMap.put("dmbc", dmbc);
1627 tempMap.put("dmlc", dmlc); 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 tempMap.put("gzbc", gzbc); 1629 tempMap.put("gzbc", gzbc);
1630 tempMap.put("gzlc", gzlc); 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 tempMap.put("jfbc", jfbc); 1632 tempMap.put("jfbc", jfbc);
1633 tempMap.put("jflc", jflc); 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 tempMap.put("zsbc", zsbc); 1635 tempMap.put("zsbc", zsbc);
1636 tempMap.put("zslc", zslc); 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 tempMap.put("qrbc", qrbc); 1638 tempMap.put("qrbc", qrbc);
1639 tempMap.put("qrlc", qrlc); 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 tempMap.put("qcbc", qcbc); 1641 tempMap.put("qcbc", qcbc);
1642 tempMap.put("qclc", qclc); 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 tempMap.put("kxbc", kxbc); 1644 tempMap.put("kxbc", kxbc);
1645 tempMap.put("kxlc", kxlc); 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 tempMap.put("qhbc", qhbc); 1647 tempMap.put("qhbc", qhbc);
1648 tempMap.put("qhlc", qhlc); 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 tempMap.put("wybc", wybc); 1650 tempMap.put("wybc", wybc);
1651 tempMap.put("wylc", wylc); 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 tempMap.put("qtbc", qtbc); 1653 tempMap.put("qtbc", qtbc);
1654 tempMap.put("qtlc", qtlc); 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 resList.add(tempMap); 1657 resList.add(tempMap);
1658 } 1658 }
src/main/java/com/bsth/service/impl/StationServiceImpl.java
@@ -248,13 +248,13 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -248,13 +248,13 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
248 for(int i = 0;i <stationsArray.size();i++) { 248 for(int i = 0;i <stationsArray.size();i++) {
249 // 站点名称 249 // 站点名称
250 String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString(); 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 distance = distance/1000; 253 distance = distance/1000;
254 BigDecimal d = new BigDecimal(distance); 254 BigDecimal d = new BigDecimal(distance);
255 distance = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); 255 distance = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
256 sectionDistance= distance + sectionDistance; 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 duration = duration/60; 259 duration = duration/60;
260 BigDecimal t = new BigDecimal(duration); 260 BigDecimal t = new BigDecimal(duration);
@@ -792,9 +792,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -792,9 +792,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
792 Station station = repository.findOne(stationId); 792 Station station = repository.findOne(stationId);
793 StationRoute arg0 = new StationRoute(); 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 String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString(); 799 String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString();
800 // 线路ID 800 // 线路ID
@@ -952,8 +952,8 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -952,8 +952,8 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
952 stationRouteCode = stationRouteCode == null ? 100 : stationRouteCode; 952 stationRouteCode = stationRouteCode == null ? 100 : stationRouteCode;
953 Integer LineId = map.get("stationRouteLine").equals("") ? null : Integer.parseInt(map.get("stationRouteLine").toString()); 953 Integer LineId = map.get("stationRouteLine").equals("") ? null : Integer.parseInt(map.get("stationRouteLine").toString());
954 String stationMark = map.get("stationMark").equals("") ? null : map.get("stationMark").toString(); 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 Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); 957 Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString());
958 Station station = repository.findOne(stationId); 958 Station station = repository.findOne(stationId);
959 Line line = lineRepository.findOne(LineId); 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,6 +10,7 @@ import com.bsth.controller.realcontrol.dto.DfsjChange;
10 import com.bsth.controller.realcontrol.dto.LpData; 10 import com.bsth.controller.realcontrol.dto.LpData;
11 import com.bsth.data.BasicData; 11 import com.bsth.data.BasicData;
12 import com.bsth.data.LineConfigData; 12 import com.bsth.data.LineConfigData;
  13 +import com.bsth.data.msg_queue.DirectivePushQueue;
13 import com.bsth.data.schedule.DayOfSchedule; 14 import com.bsth.data.schedule.DayOfSchedule;
14 import com.bsth.data.schedule.SchAttrCalculator; 15 import com.bsth.data.schedule.SchAttrCalculator;
15 import com.bsth.data.schedule.SchModifyLog; 16 import com.bsth.data.schedule.SchModifyLog;
@@ -1280,9 +1281,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1280,9 +1281,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1280 ts.add(next); 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 dayOfSchedule.reCalcExecPlan(sch.getClZbh()); 1294 dayOfSchedule.reCalcExecPlan(sch.getClZbh());
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
1 package com.bsth.service.schedule.impl; 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 import java.math.BigDecimal; 3 import java.math.BigDecimal;
  4 +import java.net.URLEncoder;
13 import java.sql.ResultSet; 5 import java.sql.ResultSet;
14 import java.sql.SQLException; 6 import java.sql.SQLException;
15 import java.text.DecimalFormat; 7 import java.text.DecimalFormat;
16 import java.text.NumberFormat; 8 import java.text.NumberFormat;
17 import java.text.ParseException; 9 import java.text.ParseException;
18 import java.text.SimpleDateFormat; 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 import org.springframework.beans.factory.annotation.Autowired; 21 import org.springframework.beans.factory.annotation.Autowired;
23 import org.springframework.jdbc.core.JdbcTemplate; 22 import org.springframework.jdbc.core.JdbcTemplate;
@@ -404,20 +403,22 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -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 Map<Integer, ScheduleRealInfo> temp = new HashMap<Integer, ScheduleRealInfo>(); 418 Map<Integer, ScheduleRealInfo> temp = new HashMap<Integer, ScheduleRealInfo>();
418 List <ScheduleRealInfo> tempList = new ArrayList<ScheduleRealInfo>(); 419 List <ScheduleRealInfo> tempList = new ArrayList<ScheduleRealInfo>();
419 List<Integer> sort = new ArrayList<Integer>(); 420 List<Integer> sort = new ArrayList<Integer>();
420 - for(ScheduleRealInfo schedule : listMap.get(clZbh)){ 421 + for(ScheduleRealInfo schedule : listMap.get(xlDir)){
421 String[] split = schedule.getFcsj().split(":"); 422 String[] split = schedule.getFcsj().split(":");
422 int min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); 423 int min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]);
423 temp.put(min, schedule); 424 temp.put(min, schedule);
@@ -762,7 +763,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -762,7 +763,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
762 return modelMap; 763 return modelMap;
763 } 764 }
764 765
765 -// @Override 766 + @Override
766 public Map<String, Object> scheduleAnaly_sum(Map<String, Object> map) { 767 public Map<String, Object> scheduleAnaly_sum(Map<String, Object> map) {
767 DecimalFormat df = new DecimalFormat("00"); 768 DecimalFormat df = new DecimalFormat("00");
768 NumberFormat nf = NumberFormat.getNumberInstance(); 769 NumberFormat nf = NumberFormat.getNumberInstance();
@@ -867,101 +868,122 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -867,101 +868,122 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
867 { 868 {
868 Map<String, Object> m0 = new HashMap<String, Object>(); 869 Map<String, Object> m0 = new HashMap<String, Object>();
869 m0.put("time", "首~6:30"); 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 tempList.add(m0); 874 tempList.add(m0);
874 Map<String, Object> m1 = new HashMap<String, Object>(); 875 Map<String, Object> m1 = new HashMap<String, Object>();
875 m1.put("time", "6:31~8:30"); 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 tempList.add(m1); 880 tempList.add(m1);
880 Map<String, Object> m2 = new HashMap<String, Object>(); 881 Map<String, Object> m2 = new HashMap<String, Object>();
881 m2.put("time", "8:31~11:00"); 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 tempList.add(m2); 886 tempList.add(m2);
886 Map<String, Object> m3 = new HashMap<String, Object>(); 887 Map<String, Object> m3 = new HashMap<String, Object>();
887 m3.put("time", "11:01~13:30"); 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 tempList.add(m3); 892 tempList.add(m3);
892 Map<String, Object> m4 = new HashMap<String, Object>(); 893 Map<String, Object> m4 = new HashMap<String, Object>();
893 m4.put("time", "13:31~16:00"); 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 tempList.add(m4); 898 tempList.add(m4);
898 Map<String, Object> m5 = new HashMap<String, Object>(); 899 Map<String, Object> m5 = new HashMap<String, Object>();
899 m5.put("time", "16:01~18:00"); 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 tempList.add(m5); 904 tempList.add(m5);
904 Map<String, Object> m6 = new HashMap<String, Object>(); 905 Map<String, Object> m6 = new HashMap<String, Object>();
905 m6.put("time", "18:01~20:30"); 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 tempList.add(m6); 910 tempList.add(m6);
910 Map<String, Object> m7 = new HashMap<String, Object>(); 911 Map<String, Object> m7 = new HashMap<String, Object>();
911 m7.put("time", "20:31~末"); 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 tempList.add(m7); 916 tempList.add(m7);
916 } 917 }
917 918
  919 + String companyName = "";
  920 + String subCompanyName = "";
  921 +
918 //按时间段分组 922 //按时间段分组
919 for(ScheduleRealInfo schedule : list){ 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 if(schedule.getFcsjActualTime()!=null && schedule.getZdsjActualTime()!=null){ 933 if(schedule.getFcsjActualTime()!=null && schedule.getZdsjActualTime()!=null){
921 Long fcsjA = schedule.getFcsjActualTime(); 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 if(!keyMap.containsKey("首~6:30")) 943 if(!keyMap.containsKey("首~6:30"))
924 keyMap.put("首~6:30", new ArrayList<ScheduleRealInfo>()); 944 keyMap.put("首~6:30", new ArrayList<ScheduleRealInfo>());
925 keyMap.get("首~6:30").add(schedule); 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 if(!keyMap.containsKey("6:31~8:30")) 949 if(!keyMap.containsKey("6:31~8:30"))
929 keyMap.put("6:31~8:30", new ArrayList<ScheduleRealInfo>()); 950 keyMap.put("6:31~8:30", new ArrayList<ScheduleRealInfo>());
930 keyMap.get("6:31~8:30").add(schedule); 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 if(!keyMap.containsKey("8:31~11:00")) 955 if(!keyMap.containsKey("8:31~11:00"))
934 keyMap.put("8:31~11:00", new ArrayList<ScheduleRealInfo>()); 956 keyMap.put("8:31~11:00", new ArrayList<ScheduleRealInfo>());
935 keyMap.get("8:31~11:00").add(schedule); 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 if(!keyMap.containsKey("11:01~13:30")) 961 if(!keyMap.containsKey("11:01~13:30"))
939 keyMap.put("11:01~13:30", new ArrayList<ScheduleRealInfo>()); 962 keyMap.put("11:01~13:30", new ArrayList<ScheduleRealInfo>());
940 keyMap.get("11:01~13:30").add(schedule); 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 if(!keyMap.containsKey("13:31~16:00")) 967 if(!keyMap.containsKey("13:31~16:00"))
944 keyMap.put("13:31~16:00", new ArrayList<ScheduleRealInfo>()); 968 keyMap.put("13:31~16:00", new ArrayList<ScheduleRealInfo>());
945 keyMap.get("13:31~16:00").add(schedule); 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 if(!keyMap.containsKey("16:01~18:00")) 973 if(!keyMap.containsKey("16:01~18:00"))
949 keyMap.put("16:01~18:00", new ArrayList<ScheduleRealInfo>()); 974 keyMap.put("16:01~18:00", new ArrayList<ScheduleRealInfo>());
950 keyMap.get("16:01~18:00").add(schedule); 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 if(!keyMap.containsKey("18:01~20:30")) 979 if(!keyMap.containsKey("18:01~20:30"))
954 keyMap.put("18:01~20:30", new ArrayList<ScheduleRealInfo>()); 980 keyMap.put("18:01~20:30", new ArrayList<ScheduleRealInfo>());
955 keyMap.get("18:01~20:30").add(schedule); 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 for(String key : keyMap.keySet()){ 987 for(String key : keyMap.keySet()){
966 Map<String, Object> m = null; 988 Map<String, Object> m = null;
967 for(Map<String, Object> map2 : tempList){ 989 for(Map<String, Object> map2 : tempList){
@@ -972,6 +994,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -972,6 +994,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
972 int upbc = 0, dnbc = 0; 994 int upbc = 0, dnbc = 0;
973 long upys = 0, dnys = 0; 995 long upys = 0, dnys = 0;
974 for(ScheduleRealInfo schedule : keyMap.get(key)){ 996 for(ScheduleRealInfo schedule : keyMap.get(key)){
  997 + flag = true;
975 if(schedule.getXlDir().equals("0")){ 998 if(schedule.getXlDir().equals("0")){
976 upbc++; 999 upbc++;
977 upys += schedule.getZdsjActualTime() - schedule.getFcsjActualTime(); 1000 upys += schedule.getZdsjActualTime() - schedule.getFcsjActualTime();
@@ -979,15 +1002,25 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -979,15 +1002,25 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
979 dnbc++; 1002 dnbc++;
980 dnys += schedule.getZdsjActualTime() - schedule.getFcsjActualTime(); 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 m.put("upbc", upbc); 1010 m.put("upbc", upbc);
984 m.put("dnbc", dnbc); 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 if(type.equals("export")){ 1026 if(type.equals("export")){
@@ -1180,6 +1213,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -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 if(longList0.size() != 0){ 1220 if(longList0.size() != 0){
1184 Collections.sort(longList0); 1221 Collections.sort(longList0);
1185 ScheduleRealInfo shouban0 = temp0.get(longList0.get(0)); 1222 ScheduleRealInfo shouban0 = temp0.get(longList0.get(0));
@@ -1297,7 +1334,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1297,7 +1334,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1297 return resList; 1334 return resList;
1298 } 1335 }
1299 1336
1300 -// @Override 1337 + @Override
1301 public List<Map<String, Object>> firstAndLastBus_sum(Map<String, Object> map) { 1338 public List<Map<String, Object>> firstAndLastBus_sum(Map<String, Object> map) {
1302 NumberFormat nf = NumberFormat.getNumberInstance(); 1339 NumberFormat nf = NumberFormat.getNumberInstance();
1303 nf.setMinimumFractionDigits(2); 1340 nf.setMinimumFractionDigits(2);
@@ -1330,6 +1367,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1330,6 +1367,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1330 } 1367 }
1331 for(String key : keyMap.keySet()){ 1368 for(String key : keyMap.keySet()){
1332 Map<String, Object> tempMap = new HashMap<String, Object>(); 1369 Map<String, Object> tempMap = new HashMap<String, Object>();
  1370 + Map<String, Object> m = new HashMap<String, Object>();
1333 Map<Long, ScheduleRealInfo> temp0 = new HashMap<Long, ScheduleRealInfo>(); 1371 Map<Long, ScheduleRealInfo> temp0 = new HashMap<Long, ScheduleRealInfo>();
1334 List<Long> longList0 = new ArrayList<Long>(); 1372 List<Long> longList0 = new ArrayList<Long>();
1335 Map<Long, ScheduleRealInfo> temp1 = new HashMap<Long, ScheduleRealInfo>(); 1373 Map<Long, ScheduleRealInfo> temp1 = new HashMap<Long, ScheduleRealInfo>();
@@ -1355,6 +1393,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -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 int jhbc = 0; 1399 int jhbc = 0;
1359 int sjbc = 0; 1400 int sjbc = 0;
1360 1401
@@ -1370,6 +1411,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1370,6 +1411,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1370 if(delay >= -3 && delay <= 1){ 1411 if(delay >= -3 && delay <= 1){
1371 sjbc++; 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 if(moban0.getFcsjActual() != null){ 1420 if(moban0.getFcsjActual() != null){
@@ -1380,7 +1425,20 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1380,7 +1425,20 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1380 if(delay >= -3 && delay <= 1){ 1425 if(delay >= -3 && delay <= 1){
1381 sjbc++; 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 if(longList1.size() != 0){ 1444 if(longList1.size() != 0){
@@ -1395,7 +1453,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1395,7 +1453,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1395 if(delay >= -3 && delay <= 1){ 1453 if(delay >= -3 && delay <= 1){
1396 sjbc++; 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 if(moban1.getFcsjActual() != null){ 1462 if(moban1.getFcsjActual() != null){
1400 jhbc++; 1463 jhbc++;
1401 String[] split = moban1.getFcsjActual().split(":"); 1464 String[] split = moban1.getFcsjActual().split(":");
@@ -1404,9 +1467,24 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1404,9 +1467,24 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1404 if(delay >= -3 && delay <= 1){ 1467 if(delay >= -3 && delay <= 1){
1405 sjbc++; 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 tempMap.put("jhbc", jhbc); 1488 tempMap.put("jhbc", jhbc);
1411 tempMap.put("sjbc", sjbc); 1489 tempMap.put("sjbc", sjbc);
1412 tempMap.put("zdl", nf.format((float) sjbc / jhbc *100) + "%"); 1490 tempMap.put("zdl", nf.format((float) sjbc / jhbc *100) + "%");
@@ -1415,7 +1493,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1415,7 +1493,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1415 tempMap.put("subCompany", subCompanyName); 1493 tempMap.put("subCompany", subCompanyName);
1416 tempMap.put("line", key); 1494 tempMap.put("line", key);
1417 resList.add(tempMap); 1495 resList.add(tempMap);
1418 - System.out.println(tempMap);  
1419 } 1496 }
1420 1497
1421 if(type.equals("export")){ 1498 if(type.equals("export")){
@@ -1427,8 +1504,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1427,8 +1504,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1427 try { 1504 try {
1428 listI.add(resList.iterator()); 1505 listI.add(resList.iterator());
1429 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; 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 } catch (Exception e) { 1509 } catch (Exception e) {
1433 // TODO: handle exception 1510 // TODO: handle exception
1434 e.printStackTrace(); 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,6 +21,9 @@ import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
21 import com.bsth.service.schedule.rules.ttinfo.*; 21 import com.bsth.service.schedule.rules.ttinfo.*;
22 import com.bsth.service.schedule.rules.ttinfo2.CalcuParam; 22 import com.bsth.service.schedule.rules.ttinfo2.CalcuParam;
23 import com.bsth.service.schedule.rules.ttinfo2.Result; 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 import org.joda.time.DateTime; 27 import org.joda.time.DateTime;
25 import org.kie.api.KieBase; 28 import org.kie.api.KieBase;
26 import org.kie.api.runtime.KieSession; 29 import org.kie.api.runtime.KieSession;
@@ -321,6 +324,60 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -321,6 +324,60 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; 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 @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) 381 @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)
325 public SchedulePlan save(SchedulePlan schedulePlan) { 382 public SchedulePlan save(SchedulePlan schedulePlan) {
326 // pre、如果排班的数据之前已经有了,删除之前的数据 383 // pre、如果排班的数据之前已经有了,删除之前的数据
@@ -341,6 +398,9 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -341,6 +398,9 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
341 // 3、确定套跑规则 398 // 3、确定套跑规则
342 rerunPlanResult(planResult, schedulePlan); 399 rerunPlanResult(planResult, schedulePlan);
343 400
  401 + // TODO:3-1、验证排班结果
  402 + validPlanResult(planResult, schedulePlan);
  403 +
344 // 4、保存数据(jdbcTemplate 批量插入) 404 // 4、保存数据(jdbcTemplate 批量插入)
345 Date start4 = new Date(); 405 Date start4 = new Date();
346 scheduleRuleService.generateSchedulePlan(schedulePlan, planResult.getSchedulePlanInfos()); 406 scheduleRuleService.generateSchedulePlan(schedulePlan, planResult.getSchedulePlanInfos());
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java
@@ -74,6 +74,9 @@ public class MyDroolsConfiguration { @@ -74,6 +74,9 @@ public class MyDroolsConfiguration {
74 kfs.write("src/main/resources/rerun.drl", kieServices.getResources() 74 kfs.write("src/main/resources/rerun.drl", kieServices.getResources()
75 .newInputStreamResource(this.getClass().getResourceAsStream( 75 .newInputStreamResource(this.getClass().getResourceAsStream(
76 "/rules/rerun.drl"), "UTF-8")); 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 // TODO:还有其他drl.... 80 // TODO:还有其他drl....
78 81
79 // 4、创建KieBuilder,使用KieFileSystem构建 82 // 4、创建KieBuilder,使用KieFileSystem构建
src/main/java/com/bsth/service/schedule/rules/ScheduleRuleServiceImpl.java
@@ -119,6 +119,7 @@ public class ScheduleRuleServiceImpl implements ScheduleRuleService { @@ -119,6 +119,7 @@ public class ScheduleRuleServiceImpl implements ScheduleRuleService {
119 obj.setScheduleDate(rs.getDate("schedule_date")); 119 obj.setScheduleDate(rs.getDate("schedule_date"));
120 obj.setGidindex(rs.getString("gidindex")); 120 obj.setGidindex(rs.getString("gidindex"));
121 obj.setEcindex(rs.getString("ecindex")); 121 obj.setEcindex(rs.getString("ecindex"));
  122 + obj.setOrigingidindex(rs.getString("origingidindex"));
122 123
123 // 其他字段没用 124 // 其他字段没用
124 return obj; 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,7 +16,9 @@ public class ValidateParam {
16 /** 间隔天数 */ 16 /** 间隔天数 */
17 private Integer days; 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 Period period = new Period(fromDate, toDate, PeriodType.days()); 22 Period period = new Period(fromDate, toDate, PeriodType.days());
21 days = period.getDays() + 1; 23 days = period.getDays() + 1;
22 } 24 }
src/main/java/com/bsth/service/schedule/rules/validate/ValidateResults_output.java
@@ -10,7 +10,7 @@ import java.util.List; @@ -10,7 +10,7 @@ import java.util.List;
10 public class ValidateResults_output { 10 public class ValidateResults_output {
11 private List<ValidInfo> infos = new ArrayList<>(); 11 private List<ValidInfo> infos = new ArrayList<>();
12 12
13 - static class ValidInfo { 13 + public static class ValidInfo {
14 /** 日期 */ 14 /** 日期 */
15 private Date sd; 15 private Date sd;
16 /** 描述 */ 16 /** 描述 */
src/main/java/com/bsth/websocket/handler/RealControlSocketHandler.java
1 package com.bsth.websocket.handler; 1 package com.bsth.websocket.handler;
2 2
3 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
4 -import com.bsth.common.Constants;  
5 import com.bsth.data.BasicData; 4 import com.bsth.data.BasicData;
  5 +import com.bsth.data.msg_queue.WebSocketPushQueue;
6 import com.google.common.base.Splitter; 6 import com.google.common.base.Splitter;
7 import org.slf4j.Logger; 7 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory; 8 import org.slf4j.LoggerFactory;
@@ -103,7 +103,8 @@ public class RealControlSocketHandler implements WebSocketHandler { @@ -103,7 +103,8 @@ public class RealControlSocketHandler implements WebSocketHandler {
103 return; 103 return;
104 104
105 for(WebSocketSession user : list){ 105 for(WebSocketSession user : list){
106 - try { 106 + WebSocketPushQueue.put(user, message);
  107 + /*try {
107 if (user.isOpen()) { 108 if (user.isOpen()) {
108 user.sendMessage(message); 109 user.sendMessage(message);
109 } 110 }
@@ -114,7 +115,7 @@ public class RealControlSocketHandler implements WebSocketHandler { @@ -114,7 +115,7 @@ public class RealControlSocketHandler implements WebSocketHandler {
114 catch(Exception e2){} 115 catch(Exception e2){}
115 logger.error("sendMessageToLine error ...."+msg); 116 logger.error("sendMessageToLine error ...."+msg);
116 logger.error("sendMessageToLine error ....", e); 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,9 +11,7 @@ spring.datasource.driver-class-name= com.mysql.jdbc.Driver
11 spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false 11 spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false
12 spring.datasource.username= root 12 spring.datasource.username= root
13 spring.datasource.password= 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 #DATASOURCE 15 #DATASOURCE
18 spring.datasource.max-active=100 16 spring.datasource.max-active=100
19 spring.datasource.max-idle=8 17 spring.datasource.max-idle=8
@@ -29,7 +27,6 @@ spring.datasource.validation-query=select 1 @@ -29,7 +27,6 @@ spring.datasource.validation-query=select 1
29 ## 27 ##
30 #222.66.0.204:5555 28 #222.66.0.204:5555
31 ##\u5B9E\u65F6gps 29 ##\u5B9E\u65F6gps
32 -http.gps.real.url= http://114.80.178.12:18080/transport_server/rtgps/  
33 #http.gps.real.url= http://27.115.69.123:8800/transport_server/rtgps/ 30 #http.gps.real.url= http://27.115.69.123:8800/transport_server/rtgps/
34 ##\u6D88\u606F\u4E0B\u53D1 31 ##\u6D88\u606F\u4E0B\u53D1
35 -http.send.directive = http://192.168.168.201:9090/transport_server/message/  
36 \ No newline at end of file 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,7 +828,7 @@
828 <optimizationLevel>9</optimizationLevel> 828 <optimizationLevel>9</optimizationLevel>
829 <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> 829 <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
830 <jsScript_name>Script 1</jsScript_name> 830 <jsScript_name>Script 1</jsScript_name>
831 - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f; &#x4f7f;&#x7528;&#x6b63;&#x5219;&#x8868;&#x8fbe;&#x5f0f;&#x53bb;&#x9664;&#x7ad9;&#x70b9;&#x540d;&#x79f0;&#x4e2d;&#x7684;&#x6570;&#x5b57;&#xa;qdzname &#x3d; qdzname.replace&#x28;&#x2f;&#x5c;d&#x2b;&#x2f;g,&#x27;&#x27;&#x29;&#x3b;&#xa;&#xa;&#x2f;&#x2f; sendtime&#x5904;&#x7406;&#xff0c;hhmm&#xff0c;hh&#x3a;mm&#xff0c;hh,mm&#xa;var sendtime_calcu&#x3b;&#xa;if &#x28;sendtime.length &#x3d;&#x3d; 5&#x29; &#x7b; &#x2f;&#x2f; &#x6700;&#x957f;&#x683c;&#x5f0f;&#xff0c;&#x5305;&#x62ec;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x7edf;&#x4e00;&#x628a;&#x5206;&#x9694;&#x7b26;&#x66ff;&#x6362;&#x6210;&#x5192;&#x53f7;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 2&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;3, 2&#x29;&#x3b;&#xa;&#x7d; else if &#x28;sendtime.length &#x3d;&#x3d; 4&#x29; &#x7b;&#xa; if &#x28;sendtime.indexOf&#x28;&#x22;&#x3a;&#x22;&#x29; &#x3e; 0&#x29; &#x7b; &#x2f;&#x2f; &#x5192;&#x53f7;&#x5206;&#x9694;&#xff0c;&#x65e0;&#x9700;&#x4fee;&#x6539;&#xa; sendtime_calcu &#x3d; sendtime&#x3b;&#xa; &#x7d; else if &#x28;sendtime.indexOf&#x28;&#x22;,&#x22;&#x29; &#x3e; 0&#x29; &#x7b; &#x2f;&#x2f; &#x9017;&#x53f7;&#x5206;&#x9694;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 1&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;2, 2&#x29;&#x3b;&#xa; &#x7d; else &#x7b; &#x2f;&#x2f; &#x65e0;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 2&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;2, 2&#x29;&#x3b;&#xa; &#x7d;&#xa;&#x7d; else if &#x28;sendtime.length &#x3d;&#x3d; 3&#x29; &#x7b; &#x2f;&#x2f; &#x65e0;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 1&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;1, 2&#x29;&#x3b;&#xa;&#x7d;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;&#x5206;&#x73ed;&#xa;var isfb &#x3d; 0&#x3b;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;isCanceled&#xa;var iscanceled &#x3d; 0&#x3b;</jsScript_script> 831 + <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f; &#x4f7f;&#x7528;&#x6b63;&#x5219;&#x8868;&#x8fbe;&#x5f0f;&#x53bb;&#x9664;&#x7ad9;&#x70b9;&#x540d;&#x79f0;&#x4e2d;&#x7684;&#x6570;&#x5b57;&#xa;qdzname &#x3d; qdzname.replace&#x28;&#x2f;&#x5c;d&#x2b;&#x2f;g,&#x27;&#x27;&#x29;&#x3b;&#xa;&#xa;&#x2f;&#x2f; sendtime&#x5904;&#x7406;&#xff0c;hhmm&#xff0c;hh&#x3a;mm&#xff0c;hh,mm&#xa;var sendtime_calcu&#x3b;&#xa;if &#x28;sendtime.length &#x3d;&#x3d; 5&#x29; &#x7b; &#x2f;&#x2f; &#x6700;&#x957f;&#x683c;&#x5f0f;&#xff0c;&#x5305;&#x62ec;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x7edf;&#x4e00;&#x628a;&#x5206;&#x9694;&#x7b26;&#x66ff;&#x6362;&#x6210;&#x5192;&#x53f7;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 2&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;3, 2&#x29;&#x3b;&#xa;&#x7d; else if &#x28;sendtime.length &#x3d;&#x3d; 4&#x29; &#x7b;&#xa; if &#x28;sendtime.indexOf&#x28;&#x22;&#x3a;&#x22;&#x29; &#x3e; 0&#x29; &#x7b; &#x2f;&#x2f; &#x5192;&#x53f7;&#x5206;&#x9694;&#xff0c;&#x65e0;&#x9700;&#x4fee;&#x6539;&#xa; sendtime_calcu &#x3d; sendtime&#x3b;&#xa; &#x7d; else if &#x28;sendtime.indexOf&#x28;&#x22;,&#x22;&#x29; &#x3e; 0&#x29; &#x7b; &#x2f;&#x2f; &#x9017;&#x53f7;&#x5206;&#x9694;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 1&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;2, 2&#x29;&#x3b;&#xa; &#x7d; else &#x7b; &#x2f;&#x2f; &#x65e0;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 2&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;2, 2&#x29;&#x3b;&#xa; &#x7d;&#xa;&#x7d; else if &#x28;sendtime.length &#x3d;&#x3d; 3&#x29; &#x7b; &#x2f;&#x2f; &#x65e0;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 1&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;1, 2&#x29;&#x3b;&#xa;&#x7d;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;&#x5206;&#x73ed;&#xa;var isfb &#x3d; 0&#x3b;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;&#x505c;&#x9a76;&#xa;var ists &#x3d; 0&#x3b;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;isCanceled&#xa;var iscanceled &#x3d; 0&#x3b;</jsScript_script>
832 </jsScript> </jsScripts> <fields> <field> <name>qdzname</name> 832 </jsScript> </jsScripts> <fields> <field> <name>qdzname</name>
833 <rename>qdzname</rename> 833 <rename>qdzname</rename>
834 <type>String</type> 834 <type>String</type>
@@ -853,6 +853,12 @@ @@ -853,6 +853,12 @@
853 <length>-1</length> 853 <length>-1</length>
854 <precision>-1</precision> 854 <precision>-1</precision>
855 <replace>N</replace> 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 </field> </fields> <cluster_schema/> 862 </field> </fields> <cluster_schema/>
857 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> 863 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
858 <xloc>788</xloc> 864 <xloc>788</xloc>
@@ -1083,6 +1089,11 @@ @@ -1083,6 +1089,11 @@
1083 <rename>zdzname</rename> 1089 <rename>zdzname</rename>
1084 <update>Y</update> 1090 <update>Y</update>
1085 </value> 1091 </value>
  1092 + <value>
  1093 + <name>ists</name>
  1094 + <rename>ists</rename>
  1095 + <update>Y</update>
  1096 + </value>
1086 </lookup> 1097 </lookup>
1087 <cluster_schema/> 1098 <cluster_schema/>
1088 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> 1099 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
@@ -1224,6 +1235,11 @@ @@ -1224,6 +1235,11 @@
1224 <rename>zdzname</rename> 1235 <rename>zdzname</rename>
1225 <update>Y</update> 1236 <update>Y</update>
1226 </value> 1237 </value>
  1238 + <value>
  1239 + <name>ists</name>
  1240 + <rename>ists</rename>
  1241 + <update>Y</update>
  1242 + </value>
1227 </lookup> 1243 </lookup>
1228 <cluster_schema/> 1244 <cluster_schema/>
1229 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> 1245 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
@@ -1365,6 +1381,11 @@ @@ -1365,6 +1381,11 @@
1365 <rename>tn</rename> 1381 <rename>tn</rename>
1366 <update>Y</update> 1382 <update>Y</update>
1367 </value> 1383 </value>
  1384 + <value>
  1385 + <name>ists</name>
  1386 + <rename>ists</rename>
  1387 + <update>Y</update>
  1388 + </value>
1368 </lookup> 1389 </lookup>
1369 <cluster_schema/> 1390 <cluster_schema/>
1370 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> 1391 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
src/main/resources/datatools/ktrs/ttinfodetailDataInput2.ktr
@@ -828,7 +828,7 @@ @@ -828,7 +828,7 @@
828 <optimizationLevel>9</optimizationLevel> 828 <optimizationLevel>9</optimizationLevel>
829 <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> 829 <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
830 <jsScript_name>Script 1</jsScript_name> 830 <jsScript_name>Script 1</jsScript_name>
831 - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f; &#x4f7f;&#x7528;&#x6b63;&#x5219;&#x8868;&#x8fbe;&#x5f0f;&#x53bb;&#x9664;&#x7ad9;&#x70b9;&#x540d;&#x79f0;&#x4e2d;&#x7684;&#x6570;&#x5b57;&#xa;qdzname &#x3d; qdzname.replace&#x28;&#x2f;&#x5c;d&#x2b;&#x2f;g,&#x27;&#x27;&#x29;&#x3b;&#xa;&#xa;&#x2f;&#x2f; sendtime&#x5904;&#x7406;&#xff0c;hhmm&#xff0c;hh&#x3a;mm&#xff0c;hh,mm&#xa;var sendtime_calcu&#x3b;&#xa;if &#x28;sendtime.length &#x3d;&#x3d; 5&#x29; &#x7b; &#x2f;&#x2f; &#x6700;&#x957f;&#x683c;&#x5f0f;&#xff0c;&#x5305;&#x62ec;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x7edf;&#x4e00;&#x628a;&#x5206;&#x9694;&#x7b26;&#x66ff;&#x6362;&#x6210;&#x5192;&#x53f7;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 2&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;3, 2&#x29;&#x3b;&#xa;&#x7d; else if &#x28;sendtime.length &#x3d;&#x3d; 4&#x29; &#x7b;&#xa; if &#x28;sendtime.indexOf&#x28;&#x22;&#x3a;&#x22;&#x29; &#x3e; 0&#x29; &#x7b; &#x2f;&#x2f; &#x5192;&#x53f7;&#x5206;&#x9694;&#xff0c;&#x65e0;&#x9700;&#x4fee;&#x6539;&#xa; sendtime_calcu &#x3d; sendtime&#x3b;&#xa; &#x7d; else if &#x28;sendtime.indexOf&#x28;&#x22;,&#x22;&#x29; &#x3e; 0&#x29; &#x7b; &#x2f;&#x2f; &#x9017;&#x53f7;&#x5206;&#x9694;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 1&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;2, 2&#x29;&#x3b;&#xa; &#x7d; else &#x7b; &#x2f;&#x2f; &#x65e0;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 2&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;2, 2&#x29;&#x3b;&#xa; &#x7d;&#xa;&#x7d; else if &#x28;sendtime.length &#x3d;&#x3d; 3&#x29; &#x7b; &#x2f;&#x2f; &#x65e0;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 1&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;1, 2&#x29;&#x3b;&#xa;&#x7d;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;&#x5206;&#x73ed;&#xa;var isfb &#x3d; 0&#x3b;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;isCanceled&#xa;var iscanceled &#x3d; 0&#x3b;</jsScript_script> 831 + <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f; &#x4f7f;&#x7528;&#x6b63;&#x5219;&#x8868;&#x8fbe;&#x5f0f;&#x53bb;&#x9664;&#x7ad9;&#x70b9;&#x540d;&#x79f0;&#x4e2d;&#x7684;&#x6570;&#x5b57;&#xa;qdzname &#x3d; qdzname.replace&#x28;&#x2f;&#x5c;d&#x2b;&#x2f;g,&#x27;&#x27;&#x29;&#x3b;&#xa;&#xa;&#x2f;&#x2f; sendtime&#x5904;&#x7406;&#xff0c;hhmm&#xff0c;hh&#x3a;mm&#xff0c;hh,mm&#xa;var sendtime_calcu&#x3b;&#xa;if &#x28;sendtime.length &#x3d;&#x3d; 5&#x29; &#x7b; &#x2f;&#x2f; &#x6700;&#x957f;&#x683c;&#x5f0f;&#xff0c;&#x5305;&#x62ec;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x7edf;&#x4e00;&#x628a;&#x5206;&#x9694;&#x7b26;&#x66ff;&#x6362;&#x6210;&#x5192;&#x53f7;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 2&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;3, 2&#x29;&#x3b;&#xa;&#x7d; else if &#x28;sendtime.length &#x3d;&#x3d; 4&#x29; &#x7b;&#xa; if &#x28;sendtime.indexOf&#x28;&#x22;&#x3a;&#x22;&#x29; &#x3e; 0&#x29; &#x7b; &#x2f;&#x2f; &#x5192;&#x53f7;&#x5206;&#x9694;&#xff0c;&#x65e0;&#x9700;&#x4fee;&#x6539;&#xa; sendtime_calcu &#x3d; sendtime&#x3b;&#xa; &#x7d; else if &#x28;sendtime.indexOf&#x28;&#x22;,&#x22;&#x29; &#x3e; 0&#x29; &#x7b; &#x2f;&#x2f; &#x9017;&#x53f7;&#x5206;&#x9694;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 1&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;2, 2&#x29;&#x3b;&#xa; &#x7d; else &#x7b; &#x2f;&#x2f; &#x65e0;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 2&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;2, 2&#x29;&#x3b;&#xa; &#x7d;&#xa;&#x7d; else if &#x28;sendtime.length &#x3d;&#x3d; 3&#x29; &#x7b; &#x2f;&#x2f; &#x65e0;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 1&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;1, 2&#x29;&#x3b;&#xa;&#x7d;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;&#x5206;&#x73ed;&#xa;var isfb &#x3d; 0&#x3b;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;&#x505c;&#x9a76;&#xa;var ists &#x3d; 0&#x3b;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;isCanceled&#xa;var iscanceled &#x3d; 0&#x3b;</jsScript_script>
832 </jsScript> </jsScripts> <fields> <field> <name>qdzname</name> 832 </jsScript> </jsScripts> <fields> <field> <name>qdzname</name>
833 <rename>qdzname</rename> 833 <rename>qdzname</rename>
834 <type>String</type> 834 <type>String</type>
@@ -853,6 +853,12 @@ @@ -853,6 +853,12 @@
853 <length>-1</length> 853 <length>-1</length>
854 <precision>-1</precision> 854 <precision>-1</precision>
855 <replace>N</replace> 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 </field> </fields> <cluster_schema/> 862 </field> </fields> <cluster_schema/>
857 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> 863 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
858 <xloc>788</xloc> 864 <xloc>788</xloc>
@@ -1083,6 +1089,11 @@ @@ -1083,6 +1089,11 @@
1083 <rename>zdzname</rename> 1089 <rename>zdzname</rename>
1084 <update>Y</update> 1090 <update>Y</update>
1085 </value> 1091 </value>
  1092 + <value>
  1093 + <name>ists</name>
  1094 + <rename>ists</rename>
  1095 + <update>Y</update>
  1096 + </value>
1086 </lookup> 1097 </lookup>
1087 <cluster_schema/> 1098 <cluster_schema/>
1088 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> 1099 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
@@ -1224,6 +1235,11 @@ @@ -1224,6 +1235,11 @@
1224 <rename>zdzname</rename> 1235 <rename>zdzname</rename>
1225 <update>Y</update> 1236 <update>Y</update>
1226 </value> 1237 </value>
  1238 + <value>
  1239 + <name>ists</name>
  1240 + <rename>ists</rename>
  1241 + <update>Y</update>
  1242 + </value>
1227 </lookup> 1243 </lookup>
1228 <cluster_schema/> 1244 <cluster_schema/>
1229 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> 1245 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
@@ -1365,6 +1381,11 @@ @@ -1365,6 +1381,11 @@
1365 <rename>tn</rename> 1381 <rename>tn</rename>
1366 <update>Y</update> 1382 <update>Y</update>
1367 </value> 1383 </value>
  1384 + <value>
  1385 + <name>ists</name>
  1386 + <rename>ists</rename>
  1387 + <update>Y</update>
  1388 + </value>
1368 </lookup> 1389 </lookup>
1369 <cluster_schema/> 1390 <cluster_schema/>
1370 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> 1391 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
src/main/resources/fatso/handle_real_ctl.js
@@ -9,19 +9,22 @@ var fs = require(&#39;fs&#39;) @@ -9,19 +9,22 @@ var fs = require(&#39;fs&#39;)
9 , UglifyJS = require("uglify-js"); 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 var pName = 'bsth_control' 16 var pName = 'bsth_control'
14 , path = process.cwd() 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 var realCtl = { 28 var realCtl = {
26 /** 29 /**
27 * 处理线调首页 30 * 处理线调首页
@@ -81,7 +84,7 @@ var handleCss = function ($, cb) { @@ -81,7 +84,7 @@ var handleCss = function ($, cb) {
81 var data = out.styles; 84 var data = out.styles;
82 var fName = (k + '_' + md5(data)) + '.css'; 85 var fName = (k + '_' + md5(data)) + '.css';
83 //写入 assets css 目录下 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 fs.open(descFile, 'a', function (err, fd) { 88 fs.open(descFile, 'a', function (err, fd) {
86 89
87 fs.write(fd, data, function () { 90 fs.write(fd, data, function () {
@@ -135,7 +138,7 @@ var handleJs = function ($, file, cb) { @@ -135,7 +138,7 @@ var handleJs = function ($, file, cb) {
135 var data = result.code; 138 var data = result.code;
136 var fName = (k + '_' + md5(data)) + '.js'; 139 var fName = (k + '_' + md5(data)) + '.js';
137 //写入 assets js 目录下 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 fs.open(descFile, 'a', function (err, fd) { 142 fs.open(descFile, 'a', function (err, fd) {
140 143
141 fs.write(fd, data, function () { 144 fs.write(fd, data, function () {
src/main/resources/fatso/minifier.js
@@ -5,12 +5,15 @@ @@ -5,12 +5,15 @@
5 var fs = require('fs'); 5 var fs = require('fs');
6 var UglifyJS = require("uglify-js"); 6 var UglifyJS = require("uglify-js");
7 7
  8 +var platform = process.platform;
  9 +var iswin = platform=='win32';
  10 +var separator = platform=='win32'?'\\':'/';
8 var minifier = { 11 var minifier = {
9 12
10 mergeAndMini: function(fileArray,scriptString, root, file){ 13 mergeAndMini: function(fileArray,scriptString, root, file){
11 var len = fileArray.length; 14 var len = fileArray.length;
12 for(var i = 0; i < len; i ++){ 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 var result, indoorRs; 19 var result, indoorRs;
src/main/resources/fatso/start.js
@@ -11,18 +11,22 @@ var fs = require(&#39;fs&#39;) @@ -11,18 +11,22 @@ var fs = require(&#39;fs&#39;)
11 ,crypto = require("crypto") 11 ,crypto = require("crypto")
12 ,handle_real_ctl = require('./handle_real_ctl'); 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 var excludes = ['scheduleApp', 'trafficManage', 'control'] 19 var excludes = ['scheduleApp', 'trafficManage', 'control']
16 ,ep = new EventProxy() 20 ,ep = new EventProxy()
17 ,pName = 'bsth_control' 21 ,pName = 'bsth_control'
18 ,path = process.cwd() 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(&#39;mvn-clean&#39;,function(){ @@ -41,7 +45,7 @@ ep.tail(&#39;mvn-clean&#39;,function(){
41 //ep.emit('copy-project'); 45 //ep.emit('copy-project');
42 //清理target 46 //清理target
43 logInfo('mvn clean...'); 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 if(error) 49 if(error)
46 logError(error); 50 logError(error);
47 51
@@ -55,8 +59,13 @@ ep.tail(&#39;mvn-clean&#39;,function(){ @@ -55,8 +59,13 @@ ep.tail(&#39;mvn-clean&#39;,function(){
55 //复制项目副本 59 //复制项目副本
56 ep.tail('copy-project',function(){ 60 ep.tail('copy-project',function(){
57 logInfo('copy project...'); 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 if(error) 69 if(error)
61 logError(error); 70 logError(error);
62 71
@@ -79,7 +88,7 @@ ep.tail(&#39;minifier-js&#39;, function(){ @@ -79,7 +88,7 @@ ep.tail(&#39;minifier-js&#39;, function(){
79 //再处理首页 88 //再处理首页
80 ep.emit('handle-index', function(){ 89 ep.emit('handle-index', function(){
81 //递归处理片段 90 //递归处理片段
82 - walk(dest + _static + '\\pages', function(item){ 91 + walk(dest + _static + separator + 'pages', function(item){
83 ep.emit('handle-fragment', item); 92 ep.emit('handle-fragment', item);
84 }, 93 },
85 function(){ 94 function(){
@@ -103,7 +112,7 @@ ep.tail(&#39;package-jar&#39;, function(file){ @@ -103,7 +112,7 @@ ep.tail(&#39;package-jar&#39;, function(file){
103 112
104 logSuccess('mvn package success'); 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 output(cProcess); 118 output(cProcess);
@@ -113,7 +122,7 @@ ep.tail(&#39;package-jar&#39;, function(file){ @@ -113,7 +122,7 @@ ep.tail(&#39;package-jar&#39;, function(file){
113 ep.tail('handle-fragment', function(file){ 122 ep.tail('handle-fragment', function(file){
114 //要排除的文件 123 //要排除的文件
115 for(var i = 0, ex; ex = excludes[i++];){ 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 return false; 126 return false;
118 } 127 }
119 handleJavascript(file, function(mini, $){ 128 handleJavascript(file, function(mini, $){
@@ -130,12 +139,12 @@ ep.tail(&#39;handle-fragment&#39;, function(file){ @@ -130,12 +139,12 @@ ep.tail(&#39;handle-fragment&#39;, function(file){
130 139
131 //处理首页 140 //处理首页
132 ep.tail('handle-index', function(cb){ 141 ep.tail('handle-index', function(cb){
133 - var index = dest + _static + '\\index.html'; 142 + var index = dest + _static + separator + 'index.html';
134 handleJavascript(index, function(mini, $){ 143 handleJavascript(index, function(mini, $){
135 var jsMiniText = mini.inside + mini.outside; 144 var jsMiniText = mini.inside + mini.outside;
136 145
137 var code = md5(jsMiniText); 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 if(err) 148 if(err)
140 logError(err); 149 logError(err);
141 150
@@ -210,7 +219,7 @@ function walk(path ,handleFile, over) { @@ -210,7 +219,7 @@ function walk(path ,handleFile, over) {
210 console.log('read dir error'.red); 219 console.log('read dir error'.red);
211 } else { 220 } else {
212 files.forEach(function(item) { 221 files.forEach(function(item) {
213 - var tmpPath = path + '\\' + item; 222 + var tmpPath = path + separator + item;
214 fs.stat(tmpPath, function(err1, stats) { 223 fs.stat(tmpPath, function(err1, stats) {
215 if (err1) { 224 if (err1) {
216 console.log('stat error'); 225 console.log('stat error');
src/main/resources/logback.xml
@@ -182,6 +182,48 @@ @@ -182,6 +182,48 @@
182 <appender-ref ref="GPS_COUNT" /> 182 <appender-ref ref="GPS_COUNT" />
183 </logger> 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 <!--<logger name="org.hibernate.SQL" level="TRACE">--> 227 <!--<logger name="org.hibernate.SQL" level="TRACE">-->
186 <!--<appender-ref ref="STDOUT" />--> 228 <!--<appender-ref ref="STDOUT" />-->
187 <!--</logger>--> 229 <!--</logger>-->
src/main/resources/rules/functions.drl
@@ -4,4 +4,5 @@ import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction e @@ -4,4 +4,5 @@ import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction e
4 import accumulate com.bsth.service.schedule.rules.shiftloop.GidsCountFunction gidscount; 4 import accumulate com.bsth.service.schedule.rules.shiftloop.GidsCountFunction gidscount;
5 import accumulate com.bsth.service.schedule.rules.shiftloop.GidFbTimeFunction gidfbtime; 5 import accumulate com.bsth.service.schedule.rules.shiftloop.GidFbTimeFunction gidfbtime;
6 import accumulate com.bsth.service.schedule.rules.ttinfo.LpInfoResultsFunction lpinforesult; 6 import accumulate com.bsth.service.schedule.rules.ttinfo.LpInfoResultsFunction lpinforesult;
7 -import accumulate com.bsth.service.schedule.rules.ttinfo.MinRuleQyrqFunction minruleqyrq  
8 \ No newline at end of file 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 \ No newline at end of file 10 \ No newline at end of file
src/main/resources/rules/shiftloop_fb_2.drl
@@ -88,7 +88,9 @@ rule &quot;calcu_days_1_&quot; @@ -88,7 +88,9 @@ rule &quot;calcu_days_1_&quot;
88 String ruleMd5 = Md5Util.getMd5( 88 String ruleMd5 = Md5Util.getMd5(
89 String.valueOf($qyrq.getMillis()) + 89 String.valueOf($qyrq.getMillis()) +
90 "_" + 90 "_" +
91 - $sri.getSelf().getLpIds() 91 + $sri.getSelf().getLpIds() +
  92 + "_" +
  93 + $sri.getSelf().getLpStart().toString()
92 ); 94 );
93 cdrp.setRuleMd5(ruleMd5); 95 cdrp.setRuleMd5(ruleMd5);
94 // 人员范围个数 96 // 人员范围个数
@@ -136,7 +138,9 @@ rule &quot;calcu_days_2_&quot; @@ -136,7 +138,9 @@ rule &quot;calcu_days_2_&quot;
136 String ruleMd5 = Md5Util.getMd5( 138 String ruleMd5 = Md5Util.getMd5(
137 String.valueOf($qyrq.getMillis()) + 139 String.valueOf($qyrq.getMillis()) +
138 "_" + 140 "_" +
139 - $sri.getSelf().getLpIds() 141 + $sri.getSelf().getLpIds() +
  142 + "_" +
  143 + $sri.getSelf().getLpStart().toString()
140 ); 144 );
141 cdrp.setRuleMd5(ruleMd5); 145 cdrp.setRuleMd5(ruleMd5);
142 // 人员范围个数 146 // 人员范围个数
@@ -187,7 +191,9 @@ rule &quot;Calcu_SchedulePlanRuleResult_wrap&quot; @@ -187,7 +191,9 @@ rule &quot;Calcu_SchedulePlanRuleResult_wrap&quot;
187 String md5 = Md5Util.getMd5( 191 String md5 = Md5Util.getMd5(
188 String.valueOf($sprr.getQyrq().getTime()) + 192 String.valueOf($sprr.getQyrq().getTime()) +
189 "_" + 193 "_" +
190 - $sprr.getGids() 194 + $sprr.getGids() +
  195 + "_" +
  196 + $sprr.getOrigingidindex()
191 ); 197 );
192 198
193 // System.out.println("修改后的md5:" + md5 + "车辆:" + $sprr.getCcZbh()); 199 // System.out.println("修改后的md5:" + md5 + "车辆:" + $sprr.getCcZbh());
@@ -350,7 +356,7 @@ rule &quot;Calcu_loop2_1_&quot; // 路牌在时刻表中存在,就翻 @@ -350,7 +356,7 @@ rule &quot;Calcu_loop2_1_&quot; // 路牌在时刻表中存在,就翻
350 schedulePlanRuleResult.setRuleId($ruleId); 356 schedulePlanRuleResult.setRuleId($ruleId);
351 schedulePlanRuleResult.setCcId($cid); 357 schedulePlanRuleResult.setCcId($cid);
352 schedulePlanRuleResult.setCcZbh($srf.getCarConfigInfo().getCl().getInsideCode()); 358 schedulePlanRuleResult.setCcZbh($srf.getCarConfigInfo().getCl().getInsideCode());
353 - schedulePlanRuleResult.setGids($srf.getLpIds()); 359 + schedulePlanRuleResult.setGids($srf.getLpIds()); // 参与md5计算
354 schedulePlanRuleResult.setGnames($srf.getLpNames()); 360 schedulePlanRuleResult.setGnames($srf.getLpNames());
355 schedulePlanRuleResult.setGidindex(String.valueOf($lpindex)); 361 schedulePlanRuleResult.setGidindex(String.valueOf($lpindex));
356 schedulePlanRuleResult.setEcids($srf.getRyConfigIds()); 362 schedulePlanRuleResult.setEcids($srf.getRyConfigIds());
@@ -359,7 +365,8 @@ rule &quot;Calcu_loop2_1_&quot; // 路牌在时刻表中存在,就翻 @@ -359,7 +365,8 @@ rule &quot;Calcu_loop2_1_&quot; // 路牌在时刻表中存在,就翻
359 schedulePlanRuleResult.setScheduleDate($csd2.toDate()); 365 schedulePlanRuleResult.setScheduleDate($csd2.toDate());
360 schedulePlanRuleResult.setTtinfoId($ttinfoId); 366 schedulePlanRuleResult.setTtinfoId($ttinfoId);
361 schedulePlanRuleResult.setTtinfoName($ttinfoName); 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 scheduleResult.getSchedulePlanRuleResults().add(schedulePlanRuleResult); 371 scheduleResult.getSchedulePlanRuleResults().add(schedulePlanRuleResult);
365 372
src/main/resources/rules/validplan.drl
1 -// TODO:  
2 \ No newline at end of file 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 <div class="modal-dialog"> 3 <div class="modal-dialog">
4 <div class="modal-content"> 4 <div class="modal-content">
5 <div class="modal-header"> 5 <div class="modal-header">
@@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
49 上一路段: 49 上一路段:
50 </label> 50 </label>
51 <div class="col-md-6"> 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 <span class="help-block">说明:选择的路段将作为本路段序号的参考,成为选择路段的下一个路段。 </span> 53 <span class="help-block">说明:选择的路段将作为本路段序号的参考,成为选择路段的下一个路段。 </span>
54 </div> 54 </div>
55 </div> 55 </div>
@@ -162,7 +162,7 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect @@ -162,7 +162,7 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
162 var sectionRouteId = Section.sectionRouteId; 162 var sectionRouteId = Section.sectionRouteId;
163 // 获取路段号元素,并添加下拉属性值 163 // 获取路段号元素,并添加下拉属性值
164 ajaxd.getStation(lineId,dir,function(treeData) { 164 ajaxd.getStation(lineId,dir,function(treeData) {
165 - var options = '<option value="">请选择...</option>'; 165 + /* var options = '<option value="">请选择...</option>';
166 var dArray = treeData[0].children[1].children; 166 var dArray = treeData[0].children[1].children;
167 var eq_stationRouteCode = Section.sectionRouteCode; 167 var eq_stationRouteCode = Section.sectionRouteCode;
168 for(var i = 0 ; i<dArray.length; i++){ 168 for(var i = 0 ; i<dArray.length; i++){
@@ -181,6 +181,33 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect @@ -181,6 +181,33 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
181 }else { 181 }else {
182 $('#sectionrouteCodeSelect').val(''); 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 function dirdmToName(value) { 213 function dirdmToName(value) {
@@ -257,6 +284,8 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect @@ -257,6 +284,8 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
257 // 设置日期 284 // 设置日期
258 params.createDate = moment(Section.carParkCreateDate).format(fs); 285 params.createDate = moment(Section.carParkCreateDate).format(fs);
259 error.hide(); 286 error.hide();
  287 + if(params.sectionrouteCode=='请选择...')
  288 + params.sectionrouteCode='';
260 ajaxd.sectionUpdate(params,function(resuntDate) { 289 ajaxd.sectionUpdate(params,function(resuntDate) {
261 if(resuntDate.status=='SUCCESS') { 290 if(resuntDate.status=='SUCCESS') {
262 // 弹出添加成功提示消息 291 // 弹出添加成功提示消息
src/main/resources/static/pages/base/station/edit.html
1 <!-- 编辑站点弹出层mobal --> 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 <div class="modal-dialog"> 3 <div class="modal-dialog">
4 <div class="modal-content"> 4 <div class="modal-content">
5 <!-- 弹出层标题title容器 --> 5 <!-- 弹出层标题title容器 -->
@@ -209,6 +209,7 @@ @@ -209,6 +209,7 @@
209 </div> 209 </div>
210 <script type="text/javascript"> 210 <script type="text/javascript">
211 $('#editPoitsions_station_mobal').on('editStationMobal_show', function(e, map,fun,stat){ 211 $('#editPoitsions_station_mobal').on('editStationMobal_show', function(e, map,fun,stat){
  212 + layer.closeAll();
212 // 获取站点对象信息 213 // 获取站点对象信息
213 var editStation = stat.getAddStation(); 214 var editStation = stat.getAddStation();
214 // 初始化表单值 215 // 初始化表单值
@@ -297,7 +298,9 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu @@ -297,7 +298,9 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu
297 // 站点序号值改变事件 298 // 站点序号值改变事件
298 $('#stationrouteSelect').on('change',function() { 299 $('#stationrouteSelect').on('change',function() {
299 var stationRValue = $('#stationrouteSelect').val(); 300 var stationRValue = $('#stationrouteSelect').val();
300 - if(stationRValue) { 301 + if(stationRValue=='请选择...') {
  302 + $('#stationMarkSelect').val('B');
  303 + }else {
301 var tempStr = stationRValue.split('_'); 304 var tempStr = stationRValue.split('_');
302 if(tempStr[1] == 'E') { 305 if(tempStr[1] == 'E') {
303 $('#stationMarkSelect').val('E'); 306 $('#stationMarkSelect').val('E');
@@ -318,8 +321,15 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu @@ -318,8 +321,15 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu
318 if(g.name!='' || g.name != null) { 321 if(g.name!='' || g.name != null) {
319 if(g.stationRouteCode != editStation.stationRouteCode) { 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 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu @@ -333,10 +343,17 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu
333 } 343 }
334 function setZdlyValue() { 344 function setZdlyValue() {
335 fun.findUpStationRouteCode(editStation.stationRouteLine,editStation.stationRoutedirections,editStation.stationRouteCode,function(str) { 345 fun.findUpStationRouteCode(editStation.stationRouteLine,editStation.stationRoutedirections,editStation.stationRouteCode,function(str) {
336 - if(str.length>0){ 346 + /* if(str.length>0){
337 var upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke + '_' + editStation.stationRoutedirections; 347 var upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke + '_' + editStation.stationRoutedirections;
338 $('#stationrouteSelect').select2('val',upStationRouteCode); 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 <div class="modal-dialog"> 3 <div class="modal-dialog">
4 <div class="modal-content"> 4 <div class="modal-content">
5 <div class="modal-header"> 5 <div class="modal-header">
@@ -180,7 +180,7 @@ @@ -180,7 +180,7 @@
180 180
181 <!-- 描述/说明 --> 181 <!-- 描述/说明 -->
182 <div class="form-group"> 182 <div class="form-group">
183 - <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;&nbsp;: </label> 183 + <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;&nbsp;&nbsp;: </label>
184 <div class="col-md-6"> 184 <div class="col-md-6">
185 <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea> 185 <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea>
186 </div> 186 </div>
@@ -243,7 +243,9 @@ $(&#39;#add_station_mobal&#39;).on(&#39;AddStationMobal.show&#39;, function(e, addMap,ajaxd,stao @@ -243,7 +243,9 @@ $(&#39;#add_station_mobal&#39;).on(&#39;AddStationMobal.show&#39;, function(e, addMap,ajaxd,stao
243 // 站点序号值改变事件 243 // 站点序号值改变事件
244 $('#stationrouteSelect').on('change',function() { 244 $('#stationrouteSelect').on('change',function() {
245 var stationRValue = $('#stationrouteSelect').val(); 245 var stationRValue = $('#stationrouteSelect').val();
246 - if(stationRValue) { 246 + if(stationRValue=='请选择...') {
  247 + $('#stationMarkSelect').val('B');
  248 + }else {
247 var tempStr = stationRValue.split('_'); 249 var tempStr = stationRValue.split('_');
248 if(tempStr[1] == 'E') { 250 if(tempStr[1] == 'E') {
249 $('#stationMarkSelect').val('E'); 251 $('#stationMarkSelect').val('E');
src/main/resources/static/pages/base/stationroute/css/bmap_base.css
@@ -93,4 +93,39 @@ html,body{ @@ -93,4 +93,39 @@ html,body{
93 93
94 box-shadow: 0 12px 15px 0 rgba(204, 204, 204, 0.33),0 17px 50px 0 rgba(204, 204, 204, 0.33)!important; 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 \ No newline at end of file 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 <div class="modal-dialog"> 3 <div class="modal-dialog">
4 <div class="modal-content"> 4 <div class="modal-content">
5 <div class="modal-header"> 5 <div class="modal-header">
@@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
50 <span class="required"> * </span> 站点编码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 50 <span class="required"> * </span> 站点编码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
51 </label> 51 </label>
52 <div class="col-md-6"> 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 </div> 54 </div>
55 </div> 55 </div>
56 </div> 56 </div>
@@ -177,7 +177,7 @@ @@ -177,7 +177,7 @@
177 </div> 177 </div>
178 <!-- 描述/说明 --> 178 <!-- 描述/说明 -->
179 <div class="form-group"> 179 <div class="form-group">
180 - <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;: </label> 180 + <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;&nbsp;: </label>
181 <div class="col-md-6"> 181 <div class="col-md-6">
182 <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea> 182 <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea>
183 </div> 183 </div>
@@ -194,6 +194,7 @@ @@ -194,6 +194,7 @@
194 <script type="text/javascript"> 194 <script type="text/javascript">
195 195
196 $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,station_,Line_,fun){ 196 $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,station_,Line_,fun){
  197 + layer.closeAll();
197 var editStationParmasObj = station_.getEitdStation(); 198 var editStationParmasObj = station_.getEitdStation();
198 var addLine = Line_.getLineObj(); 199 var addLine = Line_.getLineObj();
199 fun.setFormValue(editStationParmasObj); 200 fun.setFormValue(editStationParmasObj);
@@ -290,7 +291,9 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati @@ -290,7 +291,9 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
290 // 站点序号值改变事件 291 // 站点序号值改变事件
291 $('#stationrouteSelect').on('change',function() { 292 $('#stationrouteSelect').on('change',function() {
292 var stationRValue = $('#stationrouteSelect').val(); 293 var stationRValue = $('#stationrouteSelect').val();
293 - if(stationRValue) { 294 + if(stationRValue=='请选择...') {
  295 + $('#stationMarkSelect').val('B');
  296 + }else {
294 var tempStr = stationRValue.split('_'); 297 var tempStr = stationRValue.split('_');
295 if(tempStr[1] == 'E') { 298 if(tempStr[1] == 'E') {
296 $('#stationMarkSelect').val('E'); 299 $('#stationMarkSelect').val('E');
@@ -311,8 +314,13 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati @@ -311,8 +314,13 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
311 if(g.name!='' || g.name != null) { 314 if(g.name!='' || g.name != null) {
312 if(g.stationRouteCode != editStationParmasObj.stationRouteStationRouteCode) { 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 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati @@ -327,12 +335,14 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
327 function setZdlyValue() { 335 function setZdlyValue() {
328 ajaxd.findUpStationRouteCode(editStationParmasObj.stationRouteLine,editStationParmasObj.stationRouteDirections,editStationParmasObj.stationRouteStationRouteCode,function(str) { 336 ajaxd.findUpStationRouteCode(editStationParmasObj.stationRouteLine,editStationParmasObj.stationRouteDirections,editStationParmasObj.stationRouteStationRouteCode,function(str) {
329 if(str.length>0){ 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 $('#stationrouteSelect').select2('val',upStationRouteCode); 340 $('#stationrouteSelect').select2('val',upStationRouteCode);
332 }else { 341 }else {
333 $('#stationrouteSelect').select2('val','请选择...'); 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 <div class="modal-dialog"> 3 <div class="modal-dialog">
4 <div class="modal-content"> 4 <div class="modal-content">
5 <div class="modal-header"> 5 <div class="modal-header">
@@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
49 上一路段: 49 上一路段:
50 </label> 50 </label>
51 <div class="col-md-6"> 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 <span class="help-block">说明:选择的路段将作为本站序号的参考,成为选择路段的下一个路段。 </span> 53 <span class="help-block">说明:选择的路段将作为本站序号的参考,成为选择路段的下一个路段。 </span>
54 </div> 54 </div>
55 </div> 55 </div>
@@ -157,10 +157,9 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect @@ -157,10 +157,9 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
157 var lineId = Section.sectionrouteLine; 157 var lineId = Section.sectionrouteLine;
158 // 获取路段号元素,并添加下拉属性值 158 // 获取路段号元素,并添加下拉属性值
159 ajaxd.getStation(lineId,dir,function(treeData) { 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 var eq_scetionRouteCode = Section.sectionrouteCode; 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 var ptions_v = dArray[i].sectionrouteCode; 163 var ptions_v = dArray[i].sectionrouteCode;
165 if(eq_scetionRouteCode == ptions_v){ 164 if(eq_scetionRouteCode == ptions_v){
166 continue; 165 continue;
@@ -168,17 +167,32 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect @@ -168,17 +167,32 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
168 options += '<option value="'+ ptions_v +'">'+dArray[i].sectionName + ' (' + ptions_v +')' 167 options += '<option value="'+ ptions_v +'">'+dArray[i].sectionName + ' (' + ptions_v +')'
169 + ' --' + fun.dirdmToName(dArray[i].sectionrouteDirections) + '</option>' ; 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 // 显示mobal 197 // 显示mobal
184 $('#edit_section_mobal').modal({show : true,backdrop: 'static',keyboard: false}); 198 $('#edit_section_mobal').modal({show : true,backdrop: 'static',keyboard: false});
@@ -238,6 +252,8 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect @@ -238,6 +252,8 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
238 submitHandler : function(f) { 252 submitHandler : function(f) {
239 var params = form.serializeJSON(); 253 var params = form.serializeJSON();
240 error.hide(); 254 error.hide();
  255 + if(params.sectionrouteCode=='请选择...')
  256 + params.sectionrouteCode='';
241 ajaxd.sectionUpdate(params,function(resuntDate) { 257 ajaxd.sectionUpdate(params,function(resuntDate) {
242 if(resuntDate.status=='SUCCESS') { 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,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 \ No newline at end of file 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,7 +354,7 @@ var PublicFunctions = function () {
354 // 获取站点编码元素设值 354 // 获取站点编码元素设值
355 $('#stationCodInput').val(editStationParmas.stationStationCod); 355 $('#stationCodInput').val(editStationParmas.stationStationCod);
356 // 获取站点类型元素设值 356 // 获取站点类型元素设值
357 - $('#stationMarkSelect').val(editStationParmas.stationRouteStationMark); 357 + // $('#stationMarkSelect').val(editStationParmas.stationRouteStationMark);
358 // 获取站点方向元素设值 358 // 获取站点方向元素设值
359 $('#stationdirSelect').val(editStationParmas.stationRouteDirections); 359 $('#stationdirSelect').val(editStationParmas.stationRouteDirections);
360 // 获取站点道路编码元素设值 360 // 获取站点道路编码元素设值
src/main/resources/static/pages/base/stationroute/list.html
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <div id="bmap_basic" class="bmaps"></div> 4 <div id="bmap_basic" class="bmaps"></div>
5 <div class="portlet box protlet-box" style="top:20px;border-radius: 6px !important;box-shadow: 10px 10px 5px #888888;"> 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 <div class="caption"> 8 <div class="caption">
9 <!-- 途径站点 --> 9 <!-- 途径站点 -->
10 </div> 10 </div>
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 </div> 13 </div>
14 </div> 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 <div class="row"> 17 <div class="row">
18 <!-- 上下行栏 --> 18 <!-- 上下行栏 -->
19 <div class="col-md-3 col-sm-3 col-xs-3"> 19 <div class="col-md-3 col-sm-3 col-xs-3">
@@ -83,8 +83,8 @@ @@ -83,8 +83,8 @@
83 </div> 83 </div>
84 </div> 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 </div> 88 </div>
89 </div> 89 </div>
90 <!-- 无上行站点添加方式 --> 90 <!-- 无上行站点添加方式 -->
@@ -176,7 +176,7 @@ @@ -176,7 +176,7 @@
176 </div> 176 </div>
177 <!-- 树 --> 177 <!-- 树 -->
178 <div class="portlet-body"> 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 </div> 180 </div>
181 </div> 181 </div>
182 <!-- 无上行站点添加方式 --> 182 <!-- 无上行站点添加方式 -->
src/main/resources/static/pages/base/timesmodel/add.html
@@ -109,7 +109,7 @@ @@ -109,7 +109,7 @@
109 <!-- 线路名称 (* 必填项) START --> 109 <!-- 线路名称 (* 必填项) START -->
110 <div class="col-md-6"> 110 <div class="col-md-6">
111 <label class="control-label col-md-5"> 111 <label class="control-label col-md-5">
112 - <span class="required"> * </span> 线路名称&nbsp; 112 + <span class="required"> * </span> 线路名称&nbsp;&nbsp;&nbsp;&nbsp;
113 </label> 113 </label>
114 <div class="col-md-6"> 114 <div class="col-md-6">
115 <select name="lineName" class="form-control input-medium" id="lineSelect"></select> 115 <select name="lineName" class="form-control input-medium" id="lineSelect"></select>
@@ -138,7 +138,7 @@ @@ -138,7 +138,7 @@
138 </div> 138 </div>
139 <!-- 客容总量 --> 139 <!-- 客容总量 -->
140 <div class="form-group" id="krlGroup"> 140 <div class="form-group" id="krlGroup">
141 - <label class="col-md-3 control-label"><span class="required"> * </span>客容总量&nbsp;&nbsp;:</label> 141 + <label class="col-md-3 control-label"><span class="required"> * </span>客容总量&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
142 <div class="col-md-9"> 142 <div class="col-md-9">
143 <input type="text" class="form-control input-medium" name="krl" id="krlInput" placeholder="客容总量"> 143 <input type="text" class="form-control input-medium" name="krl" id="krlInput" placeholder="客容总量">
144 </div> 144 </div>
src/main/resources/static/pages/base/timesmodel/css/index.css
@@ -118,7 +118,7 @@ text.alert-danger { @@ -118,7 +118,7 @@ text.alert-danger {
118 118
119 .ganttSvgContainer { 119 .ganttSvgContainer {
120 height: 400px; 120 height: 400px;
121 - overflow: auto; 121 + overflow: hidden;
122 position: relative; 122 position: relative;
123 } 123 }
124 124
@@ -156,3 +156,72 @@ text.alert-danger { @@ -156,3 +156,72 @@ text.alert-danger {
156 ::selection { 156 ::selection {
157 background:rgba(255, 255, 255, 0); 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 \ No newline at end of file 228 \ No newline at end of file
src/main/resources/static/pages/base/timesmodel/edit-detail.html
@@ -232,6 +232,7 @@ @@ -232,6 +232,7 @@
232 * @params [obj--甘特图对象;d--当前修改班次对象数据] 232 * @params [obj--甘特图对象;d--当前修改班次对象数据]
233 */ 233 */
234 $('#editDetail_mobal').on('editDetailMobal.show', function(e,obj,nodeContext,bf,map){ 234 $('#editDetail_mobal').on('editDetailMobal.show', function(e,obj,nodeContext,bf,map){
  235 + debugger;
235 // 定义当前班次数据. 236 // 定义当前班次数据.
236 var dqbcData = nodeContext.dqbcData; 237 var dqbcData = nodeContext.dqbcData;
237 var ddbcminztjx = isUpdsgbctzsj(dqbcData.bcType) || isUpdsgbctzsj(nodeContext.nextData.bcType) ? dqbcData.STOPTIME : obj.configuration.dataMap.minztjx,lastminztjx = 0; 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,13 +22,14 @@
22 <!-- col-md-12 组件START --> 22 <!-- col-md-12 组件START -->
23 <div class="col-md-12"> 23 <div class="col-md-12">
24 <!-- portlet 组件START --> 24 <!-- portlet 组件START -->
25 - <div class="portlet light porttlet-fit bordered"> 25 + <div class="portlet light porttlet-fit bordered" >
26 <!-- portlet-title组件START --> 26 <!-- portlet-title组件START -->
27 <div class="portlet-title"> 27 <div class="portlet-title">
28 <!-- caption 组件START --> 28 <!-- caption 组件START -->
29 - <div class="caption"> 29 + <div class="caption offset">
30 <i class="fa fa-bar-chart font-dark"></i> 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 </div> 33 </div>
33 <!-- caption 组件END --> 34 <!-- caption 组件END -->
34 <div class="tools" style="margin-left: 20px;margin-top: -10px;"> 35 <div class="tools" style="margin-left: 20px;margin-top: -10px;">
@@ -92,7 +93,7 @@ @@ -92,7 +93,7 @@
92 <!-- portlet-title组件END --> 93 <!-- portlet-title组件END -->
93 94
94 <!-- portlet-body组件START --> 95 <!-- portlet-body组件START -->
95 - <div class="portlet-body"> 96 + <div class="portlet-body" id="scrllmouseEvent">
96 <!-- ganttSvgContainer SVG组件START --> 97 <!-- ganttSvgContainer SVG组件START -->
97 <div class="ganttSvgContainer"> 98 <div class="ganttSvgContainer">
98 <div id="ganttSvg"></div> 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,8 +612,9 @@ var SKBFormWizard = function() {
612 function submit(p,argus) { 612 function submit(p,argus) {
613 storage.setItem("Gantt_AgursData",JSON.stringify(argus)); 613 storage.setItem("Gantt_AgursData",JSON.stringify(argus));
614 if(p!=null) { 614 if(p!=null) {
615 - console.log(JSON.stringify(p.rsLp));  
616 storage.setItem('isDoDate',JSON.stringify({'rsD':p.rsD,'rsLP':p.rsLp})); 615 storage.setItem('isDoDate',JSON.stringify({'rsD':p.rsD,'rsLP':p.rsLp}));
  616 + }else {
  617 + storage.setItem('isDoDate','');
617 } 618 }
618 loadPage('gantt.html'); 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,11 +269,11 @@ var BaseFun = function() {
269 for(var a =0;a<carArray.length;a++) { 269 for(var a =0;a<carArray.length;a++) {
270 var _mmstartTime = baseF.getDateTime(gatps.earlyStartTime);// 获取早高峰开始时间点,并转为时间对象. 270 var _mmstartTime = baseF.getDateTime(gatps.earlyStartTime);// 获取早高峰开始时间点,并转为时间对象.
271 var tempTime = new Date(_mmstartTime.setMinutes(_mmstartTime.getMinutes()-(ca.length-parseInt(carArray[a].lpNo))*ma[0].fcjx)); 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 var kssj = baseF.getDateTime(time[0]); // 获取该时段的开始时间点,并转为时间对象. 273 var kssj = baseF.getDateTime(time[0]); // 获取该时段的开始时间点,并转为时间对象.
274 var sjAndDir = baseF.getBeganTime(tempTime,kssj,type, ma,dataMap.zgfsjd,dataMap.wgfsjd,dataMap.pcxssjArr,dataMap.gfxxsjArr,cctag, dataMap.ztjxA);// 计算当前路牌第一个首班时间点. 274 var sjAndDir = baseF.getBeganTime(tempTime,kssj,type, ma,dataMap.zgfsjd,dataMap.wgfsjd,dataMap.pcxssjArr,dataMap.gfxxsjArr,cctag, dataMap.ztjxA);// 计算当前路牌第一个首班时间点.
275 kssj = sjAndDir.d1; 275 kssj = sjAndDir.d1;
276 - cctag = sjAndDir.dir; 276 + cctag = gatps.linePlayType=='1' ? 0 : sjAndDir.dir;
277 var endTime = baseF.getDateTime( 277 var endTime = baseF.getDateTime(
278 baseF.getEndStrt(type,dataMap.smbcsjArr,time[1],cctag));// 获取该时段的结束时间点,并转为时间对象. 278 baseF.getEndStrt(type,dataMap.smbcsjArr,time[1],cctag));// 获取该时段的结束时间点,并转为时间对象.
279 var $_cfn = 0,$_cfw = 0; 279 var $_cfn = 0,$_cfw = 0;
@@ -287,7 +287,7 @@ var BaseFun = function() { @@ -287,7 +287,7 @@ var BaseFun = function() {
287 dataMap.dira[cctag],xhNo++,dataMap.cclcArr[cctag],gatps,0,dataMap.qdzArr[cctag],null,null,0,0));// 出场班次 287 dataMap.dira[cctag],xhNo++,dataMap.cclcArr[cctag],gatps,0,dataMap.qdzArr[cctag],null,null,0,0));// 出场班次
288 var fxTagDm = 0; 288 var fxTagDm = 0;
289 while(kssj<=endTime) { 289 while(kssj<=endTime) {
290 - cctag = baseF.getfx(fxTagDm,cctag); 290 + cctag = gatps.linePlayType=='1' ? 0 : baseF.getfx(fxTagDm,cctag);
291 fxTagDm = 1; 291 fxTagDm = 1;
292 if(kssj> new Date (baseF.getCFDate(10,30)) && 292 if(kssj> new Date (baseF.getCFDate(10,30)) &&
293 kssj<new Date (baseF.getCFDate(12,0)) && $_cfn<1 ) { 293 kssj<new Date (baseF.getCFDate(12,0)) && $_cfn<1 ) {
@@ -556,7 +556,6 @@ var BaseFun = function() { @@ -556,7 +556,6 @@ var BaseFun = function() {
556 getRankRule : function(list,clzs,seMap) { 556 getRankRule : function(list,clzs,seMap) {
557 // 定义班型人次数据的长度.路牌数组长度. 557 // 定义班型人次数据的长度.路牌数组长度.
558 var bxgs = list.data.length,clzslen = clzs.length; 558 var bxgs = list.data.length,clzslen = clzs.length;
559 -  
560 /** 559 /**
561 * 分配规则:获取总人数与车辆数的关系.返回值[-1-- 总人数小与车辆总数; 0--总人数等于车辆数; 1--总人数大与车辆数] 560 * 分配规则:获取总人数与车辆数的关系.返回值[-1-- 总人数小与车辆总数; 0--总人数等于车辆数; 1--总人数大与车辆数]
562 * 561 *
@@ -570,6 +569,7 @@ var BaseFun = function() { @@ -570,6 +569,7 @@ var BaseFun = function() {
570 * */ 569 * */
571 switch(baseF.isrcNumEqualCarNum(list.rsa,clzslen)){ 570 switch(baseF.isrcNumEqualCarNum(list.rsa,clzslen)){
572 case -1: 571 case -1:
  572 + baseF.fprclp(bxgs,list,clzs);
573 break; 573 break;
574 case 0: 574 case 0:
575 // 判断.班型人次是否为一种还是多种情况. 575 // 判断.班型人次是否为一种还是多种情况.
@@ -584,6 +584,7 @@ var BaseFun = function() { @@ -584,6 +584,7 @@ var BaseFun = function() {
584 case 1: 584 case 1:
585 // 定义最大工时值. 585 // 定义最大工时值.
586 var maxhoursV = parseFloat((((baseF.getDateTime(seMap.e) - baseF.getDateTime(seMap.s))/60000)/60).toFixed(2)); 586 var maxhoursV = parseFloat((((baseF.getDateTime(seMap.e) - baseF.getDateTime(seMap.s))/60000)/60).toFixed(2));
  587 + // var maxhoursV = 24;
587 // 定义总人数. 588 // 定义总人数.
588 var rsdx = 0 ; 589 var rsdx = 0 ;
589 for(var n = 0 ; n < list.rsa.length;n++) { 590 for(var n = 0 ; n < list.rsa.length;n++) {
@@ -598,9 +599,9 @@ var BaseFun = function() { @@ -598,9 +599,9 @@ var BaseFun = function() {
598 for(var a = b ; a<bxgs; a++) { 599 for(var a = b ; a<bxgs; a++) {
599 var pphours = list.data[a].hoursV; 600 var pphours = list.data[a].hoursV;
600 var zhnum = pphours+dqhours; 601 var zhnum = pphours+dqhours;
601 - if(zhnum>maxhoursV) 602 + if(zhnum>maxhoursV){
602 continue; 603 continue;
603 - else if(zhnum<maxhoursV) { 604 + }else if(zhnum<maxhoursV) {
604 zhHoursA.push({'bx1':list.data[b].type,'bx2':list.data[a].type,'countGs':zhnum}); 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,43 +609,53 @@ var BaseFun = function() {
608 } 609 }
609 // 按照工时倒序排序. 610 // 按照工时倒序排序.
610 zhHoursA.sort(function(a,b){return b.countGs-a.countGs}); 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 list.data.sort(function(a,b){return b.rs-a.rs}); 659 list.data.sort(function(a,b){return b.rs-a.rs});
649 baseF.fprclp(list.data.length,list,clzs); 660 baseF.fprclp(list.data.length,list,clzs);
650 break; 661 break;
@@ -749,13 +760,13 @@ var BaseFun = function() { @@ -749,13 +760,13 @@ var BaseFun = function() {
749 var _mmstartTime = baseF.getDateTime(map.earlyStartTime);// 获取早高峰开始时间点,并转为时间对象. 760 var _mmstartTime = baseF.getDateTime(map.earlyStartTime);// 获取早高峰开始时间点,并转为时间对象.
750 var tempTime = new Date(_mmstartTime.setMinutes(_mmstartTime.getMinutes()-(len - cara[c].lpNo)*saa[0].fcjx)); 761 var tempTime = new Date(_mmstartTime.setMinutes(_mmstartTime.getMinutes()-(len - cara[c].lpNo)*saa[0].fcjx));
751 var kssj = dataMap.zgfsjd[0].st; 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 var sjAndDir = baseF.getBeganTime(tempTime,kssj,null, saa,dataMap.zgfsjd,dataMap.wgfsjd,dataMap.pcxssjArr,dataMap.gfxxsjArr,cctag, dataMap.ztjxA);// 计算当前路牌第一个首班时间点. 764 var sjAndDir = baseF.getBeganTime(tempTime,kssj,null, saa,dataMap.zgfsjd,dataMap.wgfsjd,dataMap.pcxssjArr,dataMap.gfxxsjArr,cctag, dataMap.ztjxA);// 计算当前路牌第一个首班时间点.
754 kssj = sjAndDir.d1; 765 kssj = sjAndDir.d1;
755 - cctag = sjAndDir.dir; 766 + cctag = map.linePlayType=='1' ? 0 : sjAndDir.dir;
756 var endTime = baseF.getDateTime(seMap.e),fxTagDm = 0 , xhNo = 3,$_cfn = 0,$_cfw = 0; 767 var endTime = baseF.getDateTime(seMap.e),fxTagDm = 0 , xhNo = 3,$_cfn = 0,$_cfw = 0;
757 while(kssj<=endTime) { 768 while(kssj<=endTime) {
758 - cctag = baseF.getfx(fxTagDm,cctag); 769 + cctag = map.linePlayType=='1' ? 0 : baseF.getfx(fxTagDm,cctag);
759 fxTagDm = 1; 770 fxTagDm = 1;
760 if(kssj> new Date (baseF.getCFDate(10,30)) && 771 if(kssj> new Date (baseF.getCFDate(10,30)) &&
761 kssj<new Date (baseF.getCFDate(12,0)) && $_cfn<1 ) { 772 kssj<new Date (baseF.getCFDate(12,0)) && $_cfn<1 ) {
@@ -783,6 +794,10 @@ var BaseFun = function() { @@ -783,6 +794,10 @@ var BaseFun = function() {
783 return rs; 794 return rs;
784 }, 795 },
785 796
  797 + /**
  798 + * @description : (TODO) 该方法可去除.
  799 + *
  800 + * */
786 getGfData : function (type, saa , cara , map, seMap ,dataMap,len,car) { 801 getGfData : function (type, saa , cara , map, seMap ,dataMap,len,car) {
787 var _mmstartTime = null,kssj = null,end = null ,result = new Array(),fxTagDm = 0 , xhNo = 0; 802 var _mmstartTime = null,kssj = null,end = null ,result = new Array(),fxTagDm = 0 , xhNo = 0;
788 if(type == 'mm') { 803 if(type == 'mm') {
@@ -1093,11 +1108,11 @@ var BaseFun = function() { @@ -1093,11 +1108,11 @@ var BaseFun = function() {
1093 return sortGattArray; 1108 return sortGattArray;
1094 }, 1109 },
1095 addbc : function(obj,lastObj,kssj,tzsj,xhNo,jsonArray,num) { 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 var carArray = {'lp':lastObj.lp,'lpNo':lastObj.lpNo,'lpName':lastObj.lpName,'lpType':lastObj.lpType}; 1112 var carArray = {'lp':lastObj.lp,'lpNo':lastObj.lpNo,'lpName':lastObj.lpName,'lpType':lastObj.lpType};
1098 var ags = {'tcc_id':lastObj.tcc,'skbName':lastObj.ttinfo,'lineName':lastObj.xl+'_'}; 1113 var ags = {'tcc_id':lastObj.tcc,'skbName':lastObj.ttinfo,'lineName':lastObj.xl+'_'};
1099 for(var t = 0 ; t<num;t++){ 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 var _xxsj = baseF.getxssj(obj.configuration.dataMap.zgfsjd, 1116 var _xxsj = baseF.getxssj(obj.configuration.dataMap.zgfsjd,
1102 obj.configuration.dataMap.wgfsjd, 1117 obj.configuration.dataMap.wgfsjd,
1103 kssj, 1118 kssj,
@@ -1172,7 +1187,7 @@ var BaseFun = function() { @@ -1172,7 +1187,7 @@ var BaseFun = function() {
1172 var _mmstartTime = new Date(obj.configuration.dataMap.zgfsjd[0].st); 1187 var _mmstartTime = new Date(obj.configuration.dataMap.zgfsjd[0].st);
1173 var tempTime = new Date(_mmstartTime.setMinutes(_mmstartTime.getMinutes()- 1188 var tempTime = new Date(_mmstartTime.setMinutes(_mmstartTime.getMinutes()-
1174 ((parseInt(obj.configuration.dataMap.map.clzs)-parseInt(theCar)))*obj.configuration.stopAraay[0].fcjx)); 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 var kssj = new Date(obj.configuration.dataMap.zgfsjd[0].st); // 获取该时段的开始时间点,并转为时间对象. 1191 var kssj = new Date(obj.configuration.dataMap.zgfsjd[0].st); // 获取该时段的开始时间点,并转为时间对象.
1177 var sjAndDir = bf.getBeganTime(tempTime,kssj,null, 1192 var sjAndDir = bf.getBeganTime(tempTime,kssj,null,
1178 obj.configuration.stopAraay, 1193 obj.configuration.stopAraay,
@@ -1181,7 +1196,7 @@ var BaseFun = function() { @@ -1181,7 +1196,7 @@ var BaseFun = function() {
1181 obj.configuration.dataMap.pcxssjArr, 1196 obj.configuration.dataMap.pcxssjArr,
1182 obj.configuration.dataMap.gfxxsjArr,cctag, obj.configuration.dataMap.ztjxA);// 计算当前路牌第一个首班时间点. 1197 obj.configuration.dataMap.gfxxsjArr,cctag, obj.configuration.dataMap.ztjxA);// 计算当前路牌第一个首班时间点.
1183 kssj = sjAndDir.d1; 1198 kssj = sjAndDir.d1;
1184 - cctag = sjAndDir.dir; 1199 + cctag = obj.configuration.dataMap.map.linePlayType=='1' ? 0 : sjAndDir.dir;
1185 dqlpbc.push(bf.getbcObj( 1200 dqlpbc.push(bf.getbcObj(
1186 kssj,obj.configuration.dataMap.ccsjArr[cctag], 1201 kssj,obj.configuration.dataMap.ccsjArr[cctag],
1187 car,obj.configuration.dataMap.bcTypeArr.bd, 1202 car,obj.configuration.dataMap.bcTypeArr.bd,
@@ -1196,7 +1211,7 @@ var BaseFun = function() { @@ -1196,7 +1211,7 @@ var BaseFun = function() {
1196 obj.configuration.dataMap.qdzArr[cctag],null,null,0,0));// 出场班次 1211 obj.configuration.dataMap.qdzArr[cctag],null,null,0,0));// 出场班次
1197 var fxTagDm = 0; 1212 var fxTagDm = 0;
1198 for(var i = 0 ; i<numqs;i++) { 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 fxTagDm = 1; 1215 fxTagDm = 1;
1201 var _xxsj = bf.getxssj(obj.configuration.dataMap.zgfsjd, 1216 var _xxsj = bf.getxssj(obj.configuration.dataMap.zgfsjd,
1202 obj.configuration.dataMap.wgfsjd,kssj, 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,11 +1242,13 @@ var RelationshipGraph = function () {
1242 //console.log(tempa); 1242 //console.log(tempa);
1243 //console.log(tempa.upArr.concat(tempa.downArr).length); 1243 //console.log(tempa.upArr.concat(tempa.downArr).length);
1244 // 5、均匀上行班次的发车间距. 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 //var sxbc = BaseFun.jhfcjx(tempa.upArr,upDir,zzsj,$_GlobalGraph.configuration.dataMap); 1247 //var sxbc = BaseFun.jhfcjx(tempa.upArr,upDir,zzsj,$_GlobalGraph.configuration.dataMap);
1247 //console.log('getDirBc---- '+tempa.downArr.length); 1248 //console.log('getDirBc---- '+tempa.downArr.length);
1248 // 6、均匀下行班次的发车间距. 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 //var xxbc = BaseFun.jhfcjx(tempa.downArr,downDir,zzsj,$_GlobalGraph.configuration.dataMap); 1252 //var xxbc = BaseFun.jhfcjx(tempa.downArr,downDir,zzsj,$_GlobalGraph.configuration.dataMap);
1251 //console.log('jhfcjx---'+ xxbc.length); 1253 //console.log('jhfcjx---'+ xxbc.length);
1252 //console.log(sxbc.concat(xxbc).length); 1254 //console.log(sxbc.concat(xxbc).length);
src/main/resources/static/pages/base/timesmodel/js/gantt.js
@@ -10,8 +10,28 @@ @@ -10,8 +10,28 @@
10 var objD = window.localStorage.isDoDate; 10 var objD = window.localStorage.isDoDate;
11 // 获取表单参数配置数据. 11 // 获取表单参数配置数据.
12 var map = JSON.parse(window.localStorage.Gantt_AgursData); 12 var map = JSON.parse(window.localStorage.Gantt_AgursData);
  13 + $('.skmxTitle').text( '【' + map.skbmc + '】' + '时刻表明细模型');
13 // 延迟500毫秒执行. 14 // 延迟500毫秒执行.
14 setTimeout(function(){ 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 // 1、定义开始与结束时间点字符串. 35 // 1、定义开始与结束时间点字符串.
16 var seMap = getStartAndEndDate(map); 36 var seMap = getStartAndEndDate(map);
17 // 2、获取开始与结束时间对象. 37 // 2、获取开始与结束时间对象.
@@ -47,8 +67,6 @@ @@ -47,8 +67,6 @@
47 67
48 }else { 68 }else {
49 var jsonA = JSON.parse(objD); 69 var jsonA = JSON.parse(objD);
50 - console.log(jsonA.rsD);  
51 - console.log(jsonA.rsLP);  
52 // 使用已有的时刻表明细数据渲染视图. 70 // 使用已有的时刻表明细数据渲染视图.
53 data = {'json':jsonA.rsD,'bxrcgs':null}; 71 data = {'json':jsonA.rsD,'bxrcgs':null};
54 CSMap = {'gattA':null,'stopSpace': Math.round(map.zzsj/map.clzs),'maxCar':jsonA.rsLP}; 72 CSMap = {'gattA':null,'stopSpace': Math.round(map.zzsj/map.clzs),'maxCar':jsonA.rsLP};
@@ -153,8 +171,8 @@ @@ -153,8 +171,8 @@
153 * @return 返回开始与结束时间字符串集合. 171 * @return 返回开始与结束时间字符串集合.
154 * */ 172 * */
155 function getStartAndEndDate(map) { 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,4 +694,10 @@
676 layer.closeAll(); 694 layer.closeAll();
677 layer.msg('操作成功!已【'+ msg + '】!'); 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 \ No newline at end of file 704 \ No newline at end of file
src/main/resources/static/pages/base/timesmodel/reladplus.html
@@ -102,7 +102,7 @@ $(&#39;#reladplus_mobal&#39;).on(&#39;reladplusMobal.show&#39;, function(e,obj,bf,cardata){ @@ -102,7 +102,7 @@ $(&#39;#reladplus_mobal&#39;).on(&#39;reladplusMobal.show&#39;, function(e,obj,bf,cardata){
102 var zhbcA = bf.getLastTime(jsonArray,params.theCar); 102 var zhbcA = bf.getLastTime(jsonArray,params.theCar);
103 if(zhbcA.length>0) { 103 if(zhbcA.length>0) {
104 var lastObj = zhbcA[0]; 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 // cctag = baseF.getfx(0,cctag); 106 // cctag = baseF.getfx(0,cctag);
107 // 定义停站时间 107 // 定义停站时间
108 var tzsj = obj.configuration.dataMap.ztjxA[cctag]; 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,7 +207,6 @@
207 params['company'] = company; 207 params['company'] = company;
208 params['subCompany'] = subCompany; 208 params['subCompany'] = subCompany;
209 params['line'] = line; 209 params['line'] = line;
210 - params['line'] = line;  
211 params['date'] = date; 210 params['date'] = date;
212 params['type'] = "query"; 211 params['type'] = "query";
213 $(".hidden").removeClass("hidden"); 212 $(".hidden").removeClass("hidden");
@@ -225,11 +224,14 @@ @@ -225,11 +224,14 @@
225 } 224 }
226 225
227 $("#export").on("click",function(){ 226 $("#export").on("click",function(){
  227 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  228 + layer.msg("请选择时间!");
  229 + return;
  230 + }
228 var params = {}; 231 var params = {};
229 params['company'] = company; 232 params['company'] = company;
230 params['subCompany'] = subCompany; 233 params['subCompany'] = subCompany;
231 params['line'] = line; 234 params['line'] = line;
232 - params['line'] = line;  
233 params['date'] = date; 235 params['date'] = date;
234 params['type'] = "export"; 236 params['type'] = "export";
235 $get('/pcpc/firstAndLastBus', params, function(result){ 237 $get('/pcpc/firstAndLastBus', params, function(result){
@@ -248,22 +250,50 @@ @@ -248,22 +250,50 @@
248 <td>{{obj.company}}</td> 250 <td>{{obj.company}}</td>
249 <td>{{obj.subCompany}}</td> 251 <td>{{obj.subCompany}}</td>
250 <td>{{obj.line}}</td> 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 </tr> 297 </tr>
268 {{/each}} 298 {{/each}}
269 {{if list.length == 0}} 299 {{if list.length == 0}}
src/main/resources/static/pages/forms/statement/firstAndLastBus_sum.html
@@ -67,9 +67,42 @@ @@ -67,9 +67,42 @@
67 67
68 </tbody> 68 </tbody>
69 </table> 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 </div> 106 </div>
74 </div> 107 </div>
75 </div> 108 </div>
@@ -165,6 +198,18 @@ @@ -165,6 +198,18 @@
165 fage=true; 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 $("#query").on("click",jsDoQuery); 214 $("#query").on("click",jsDoQuery);
170 215
@@ -190,12 +235,15 @@ @@ -190,12 +235,15 @@
190 params['line'] = line; 235 params['line'] = line;
191 params['date'] = date; 236 params['date'] = date;
192 params['type'] = "query"; 237 params['type'] = "query";
193 - $(".hidden").removeClass("hidden"); 238 + $("#forms .hidden").removeClass("hidden");
  239 + $("#map tr").addClass("hidden");
194 $get('/pcpc/firstAndLastBus_sum', params, function(result){ 240 $get('/pcpc/firstAndLastBus_sum', params, function(result){
195 // 把数据填充到模版中 241 // 把数据填充到模版中
196 var tbodyHtml = template('list_firstAndLastBus',{list:result}); 242 var tbodyHtml = template('list_firstAndLastBus',{list:result});
197 // 把渲染好的模版html文本追加到表格中 243 // 把渲染好的模版html文本追加到表格中
198 $('#forms tbody').html(tbodyHtml); 244 $('#forms tbody').html(tbodyHtml);
  245 +
  246 + list = result;
199 247
200 if(result.length == 0) 248 if(result.length == 0)
201 $("#export").attr('disabled',"true"); 249 $("#export").attr('disabled',"true");
@@ -205,6 +253,10 @@ @@ -205,6 +253,10 @@
205 } 253 }
206 254
207 $("#export").on("click",function(){ 255 $("#export").on("click",function(){
  256 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  257 + layer.msg("请选择时间!");
  258 + return;
  259 + }
208 var params = {}; 260 var params = {};
209 params['company'] = company; 261 params['company'] = company;
210 params['subCompany'] = subCompany; 262 params['subCompany'] = subCompany;
@@ -212,8 +264,8 @@ @@ -212,8 +264,8 @@
212 params['line'] = line; 264 params['line'] = line;
213 params['date'] = date; 265 params['date'] = date;
214 params['type'] = "export"; 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,7 +282,7 @@
230 <td>{{obj.line}}</td> 282 <td>{{obj.line}}</td>
231 <td>{{obj.jhbc}}</td> 283 <td>{{obj.jhbc}}</td>
232 <td>{{obj.sjbc}}</td> 284 <td>{{obj.sjbc}}</td>
233 - <td>{{obj.zdl}}</td> 285 + <td><a id='delay'>{{obj.zdl}}</a></td>
234 </tr> 286 </tr>
235 {{/each}} 287 {{/each}}
236 {{if list.length == 0}} 288 {{if list.length == 0}}
@@ -238,4 +290,25 @@ @@ -238,4 +290,25 @@
238 <td colspan="20"><h6 class="muted">没有找到相关数据</h6></td> 290 <td colspan="20"><h6 class="muted">没有找到相关数据</h6></td>
239 </tr> 291 </tr>
240 {{/if}} 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 </script> 314 </script>
242 \ No newline at end of file 315 \ No newline at end of file
src/main/resources/static/pages/forms/statement/scheduleAnaly_sum.html
@@ -11,14 +11,16 @@ @@ -11,14 +11,16 @@
11 .table-bordered > thead > tr > th, 11 .table-bordered > thead > tr > th,
12 .table-bordered > thead > tr > td { 12 .table-bordered > thead > tr > td {
13 border-bottom-width: 2px; } 13 border-bottom-width: 2px; }
14 -  
15 .table > tbody + tbody { 14 .table > tbody + tbody {
16 border-top: 1px solid; } 15 border-top: 1px solid; }
  16 + #forms > tbody > tr{
  17 + background-color: #FFFFFF;
  18 + }
17 </style> 19 </style>
18 20
19 <div class="page-head"> 21 <div class="page-head">
20 <div class="page-title"> 22 <div class="page-title">
21 - <h1>时刻表分析</h1> 23 + <h1>时刻表分析(汇总)</h1>
22 </div> 24 </div>
23 </div> 25 </div>
24 26
@@ -70,6 +72,9 @@ @@ -70,6 +72,9 @@
70 <thead> 72 <thead>
71 <tr class="hidden"> 73 <tr class="hidden">
72 <th style="display: none;"></th> 74 <th style="display: none;"></th>
  75 + <th>公司</th>
  76 + <th>分公司</th>
  77 + <th>线路</th>
73 <th>时间段</th> 78 <th>时间段</th>
74 <th>上行班次</th> 79 <th>上行班次</th>
75 <th>下行班次</th> 80 <th>下行班次</th>
@@ -196,6 +201,8 @@ @@ -196,6 +201,8 @@
196 jsDoQuery(true); 201 jsDoQuery(true);
197 }); 202 });
198 203
  204 + var companyName = "";
  205 + var subCompanyName = "";
199 var line = $("#line").val(); 206 var line = $("#line").val();
200 var startDate = $("#startDate").val(); 207 var startDate = $("#startDate").val();
201 var endDate = $("#endDate").val(); 208 var endDate = $("#endDate").val();
@@ -232,7 +239,7 @@ @@ -232,7 +239,7 @@
232 $(".hidden").removeClass("hidden"); 239 $(".hidden").removeClass("hidden");
233 $get('/pcpc/scheduleAnaly_sum', params, function(result){ 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 // 把渲染好的模版html文本追加到表格中 243 // 把渲染好的模版html文本追加到表格中
237 $('#forms tbody').html(tbodyHtml); 244 $('#forms tbody').html(tbodyHtml);
238 245
@@ -362,6 +369,11 @@ @@ -362,6 +369,11 @@
362 {{each list as obj i}} 369 {{each list as obj i}}
363 <tr> 370 <tr>
364 <th style="display: none;"></th> 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 <td>{{obj.time}}</td> 377 <td>{{obj.time}}</td>
366 <td>{{obj.upbc}}</td> 378 <td>{{obj.upbc}}</td>
367 <td>{{obj.dnbc}}</td> 379 <td>{{obj.dnbc}}</td>
@@ -372,7 +384,7 @@ @@ -372,7 +384,7 @@
372 {{/each}} 384 {{/each}}
373 {{if list.length == 0}} 385 {{if list.length == 0}}
374 <tr> 386 <tr>
375 - <td colspan="6"><h6 class="muted">没有找到相关数据</h6></td> 387 + <td colspan="9"><h6 class="muted">没有找到相关数据</h6></td>
376 </tr> 388 </tr>
377 {{/if}} 389 {{/if}}
378 </script> 390 </script>
379 \ No newline at end of file 391 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/list.html
@@ -9,7 +9,8 @@ @@ -9,7 +9,8 @@
9 <th style="width: 100%;">关联时刻表</th> 9 <th style="width: 100%;">关联时刻表</th>
10 <th style="width: 150px;">排班开始日期</th> 10 <th style="width: 150px;">排班开始日期</th>
11 <th style="width: 150px;">排班结束日期</th> 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 <th style="width: 180px;">操作</th> 14 <th style="width: 180px;">操作</th>
14 </tr> 15 </tr>
15 <tr role="row" class="filter"> 16 <tr role="row" class="filter">
@@ -60,6 +61,7 @@ @@ -60,6 +61,7 @@
60 </div> 61 </div>
61 </td> 62 </td>
62 <td></td> 63 <td></td>
  64 + <td></td>
63 <td> 65 <td>
64 <button class="btn btn-sm green btn-outline filter-submit margin-bottom" 66 <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
65 ng-click="ctrl.doPage()"> 67 ng-click="ctrl.doPage()">
@@ -94,9 +96,28 @@ @@ -94,9 +96,28 @@
94 <span ng-bind="info.scheduleToTime | date: 'yyyy-MM-dd '"></span> 96 <span ng-bind="info.scheduleToTime | date: 'yyyy-MM-dd '"></span>
95 </td> 97 </td>
96 <td> 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 </td> 121 </td>
101 <td> 122 <td>
102 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> 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
@@ -66,6 +66,7 @@ @@ -66,6 +66,7 @@
66 <td> 66 <td>
67 <div> 67 <div>
68 <a href="#"> 68 <a href="#">
  69 + <i class="fa fa-user"></i>
69 <span ng-bind="info.updateBy.userName"></span> 70 <span ng-bind="info.updateBy.userName"></span>
70 </a> 71 </a>
71 </div> 72 </div>
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail.html
@@ -218,6 +218,14 @@ @@ -218,6 +218,14 @@
218 218
219 </div> 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 <div class="form-group"> 229 <div class="form-group">
222 <label class="col-md-2 control-label">备注:</label> 230 <label class="col-md-2 control-label">备注:</label>
223 <div class="col-md-3"> 231 <div class="col-md-3">
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail2.html
@@ -172,6 +172,14 @@ @@ -172,6 +172,14 @@
172 172
173 </div> 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 <div class="form-group"> 183 <div class="form-group">
176 <label class="col-md-2 control-label">备注:</label> 184 <label class="col-md-2 control-label">备注:</label>
177 <div class="col-md-3"> 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(&#39;ScheduleApp&#39;).controller( @@ -573,6 +573,7 @@ angular.module(&#39;ScheduleApp&#39;).controller(
573 zdzCode: undefined, 573 zdzCode: undefined,
574 bcType: undefined, 574 bcType: undefined,
575 isFB: undefined, 575 isFB: undefined,
  576 + isTS: undefined,
576 reSetTTinfoDetail: function(value) { 577 reSetTTinfoDetail: function(value) {
577 for (var key in this) { 578 for (var key in this) {
578 if (!angular.isFunction(this[key])) { 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,10 +116,10 @@
116 <label class="uk-form-label" >调整说明</label> 116 <label class="uk-form-label" >调整说明</label>
117 <div class="uk-form-controls"> 117 <div class="uk-form-controls">
118 <select name="adjustExps"> 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 <option value="{{exp}}">{{exp}}</option> 121 <option value="{{exp}}">{{exp}}</option>
122 - {{/each}} 122 + {{/each}}
123 </select> 123 </select>
124 </div> 124 </div>
125 </div> 125 </div>
@@ -129,7 +129,7 @@ @@ -129,7 +129,7 @@
129 <div class="uk-width-1-1"> 129 <div class="uk-width-1-1">
130 <div class="uk-form-row ct-stacked"> 130 <div class="uk-form-row ct-stacked">
131 <div class="uk-form-controls" style="margin-top: 5px;"> 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 </div> 133 </div>
134 </div> 134 </div>
135 </div> 135 </div>
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sftz.html
@@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
54 <div class="uk-form-row ct-stacked"> 54 <div class="uk-form-row ct-stacked">
55 <label class="uk-form-label" for="form-s-t">调整说明<small class="font-danger">(不超过20个字符)</small></label> 55 <label class="uk-form-label" for="form-s-t">调整说明<small class="font-danger">(不超过20个字符)</small></label>
56 <div class="uk-form-controls"> 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 </div> 58 </div>
59 </div> 59 </div>
60 </div> 60 </div>
src/main/resources/static/real_control_v2/fragments/north/nav/all_devices.html
1 <div class="uk-modal ct_move_modal" id="all-devices-modal"> 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 <a href="" class="uk-modal-close uk-close"></a> 3 <a href="" class="uk-modal-close uk-close"></a>
4 <div class="uk-modal-header"> 4 <div class="uk-modal-header">
5 <h2>所有接入平台的设备</h2></div> 5 <h2>所有接入平台的设备</h2></div>
@@ -25,6 +25,14 @@ @@ -25,6 +25,14 @@
25 <div class="uk-autocomplete uk-form autocomplete-device" > 25 <div class="uk-autocomplete uk-form autocomplete-device" >
26 <input type="text" name="deviceId" placeholder="设备号"> 26 <input type="text" name="deviceId" placeholder="设备号">
27 </div> 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 <button class="uk-button">检索</button> 36 <button class="uk-button">检索</button>
29 </fieldset> 37 </fieldset>
30 </form> 38 </form>
@@ -35,12 +43,13 @@ @@ -35,12 +43,13 @@
35 <tr> 43 <tr>
36 <th style="width: 14%;">线路</th> 44 <th style="width: 14%;">线路</th>
37 <th style="width: 14%;">站点</th> 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 <th style="width: 10%;">程序版本</th> 50 <th style="width: 10%;">程序版本</th>
43 <th>最后GPS时间</th> 51 <th>最后GPS时间</th>
  52 + <th style="width: 8%;">来源</th>
44 </tr> 53 </tr>
45 </thead> 54 </thead>
46 <tbody> 55 <tbody>
@@ -63,6 +72,15 @@ @@ -63,6 +72,15 @@
63 <td>{{gps.upDown}}</td> 72 <td>{{gps.upDown}}</td>
64 <td>{{gps.version}}</td> 73 <td>{{gps.version}}</td>
65 <td>{{gps.timeStr}}</td> 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 </tr> 84 </tr>
67 {{/each}} 85 {{/each}}
68 </script> 86 </script>
src/main/resources/static/real_control_v2/js/main.js
@@ -169,8 +169,8 @@ var disabled_submit_btn = function (form) { @@ -169,8 +169,8 @@ var disabled_submit_btn = function (form) {
169 function showUpdateDescription() { 169 function showUpdateDescription() {
170 //更新说明 170 //更新说明
171 var updateDescription = { 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 var storage = window.localStorage 176 var storage = window.localStorage
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback_v2/main.html
@@ -864,6 +864,8 @@ @@ -864,6 +864,8 @@
864 if(typeof(upDown) == "undefined") 864 if(typeof(upDown) == "undefined")
865 upDown = roadUpdown; 865 upDown = roadUpdown;
866 866
  867 + if(upDown!= 0 && upDown != 1)
  868 + return;
867 map.clearOverlays(); 869 map.clearOverlays();
868 parkPolygons = {};//清除停车场对照 870 parkPolygons = {};//清除停车场对照
869 //路段 871 //路段
src/test/resources/testdata/problem.properties
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 ##2=时刻表明细编辑功能,数据工具移到时刻表里,类似工具栏的样子 2 ##2=时刻表明细编辑功能,数据工具移到时刻表里,类似工具栏的样子
3 3=时刻表导入,可以选一个已经存在的时刻表导入,而不是excel文件 3 3=时刻表导入,可以选一个已经存在的时刻表导入,而不是excel文件
4 ##4=所有的删除,作废,都要有提示框操作 4 ##4=所有的删除,作废,都要有提示框操作
5 -5=排班计划错误提示,如果选的排班日期之前没有排班,提示错误,排班结果有重复与时刻表不符合,显示错误 5 +##5=排班计划错误提示,如果选的排班日期之前没有排班,提示错误,排班结果有重复与时刻表不符合,显示错误
6 ##6=调度执行日报,显示最近排班日期,修改操作强化 6 ##6=调度执行日报,显示最近排班日期,修改操作强化
7 7=警告功能,如时刻表选择相同的常规有效日,特殊有效日,车辆,人员配置重复等等 7 7=警告功能,如时刻表选择相同的常规有效日,特殊有效日,车辆,人员配置重复等等
8 8=时刻表明细编辑,颜色覆盖冲突 8 8=时刻表明细编辑,颜色覆盖冲突
@@ -31,4 +31,5 @@ @@ -31,4 +31,5 @@
31 ##30=时刻表公里数 三位数 31 ##30=时刻表公里数 三位数
32 32
33 31=规则修改,路牌范围,人员范围可以拖动 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,6 +7,13 @@ update bsth_c_s_sp_rule_rst a
7 set a.qyrq = (select qyrq from bsth_c_s_sr1_flat where id = a.rule_id) 7 set a.qyrq = (select qyrq from bsth_c_s_sr1_flat where id = a.rule_id)
8 where a.qyrq is null; 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 970 17 970
11 789 18 789
12 604 19 604