Commit c2f9e8ab73cec342ff43a4ce971c01525bc84e3c

Authored by 游瑞烽
2 parents 0404bddb ce780d26

Merge branch 'pudong' into pudong_test

# Conflicts:
#	src/main/java/com/bsth/XDApplication.java
#	src/main/java/com/bsth/data/gpsdata_v2/DataHandleProcess.java

Too many changes to show.

To preserve performance only 23 of 64 files are displayed.

@@ -194,6 +194,12 @@ @@ -194,6 +194,12 @@
194 <groupId>net.sourceforge.jexcelapi</groupId> 194 <groupId>net.sourceforge.jexcelapi</groupId>
195 <artifactId>jxl</artifactId> 195 <artifactId>jxl</artifactId>
196 <version>2.6.12</version> 196 <version>2.6.12</version>
  197 + <exclusions>
  198 + <exclusion>
  199 + <groupId>log4j</groupId>
  200 + <artifactId>log4j</artifactId>
  201 + </exclusion>
  202 + </exclusions>
197 </dependency> 203 </dependency>
198 <dependency> 204 <dependency>
199 <groupId>rhino</groupId> 205 <groupId>rhino</groupId>
@@ -320,6 +326,10 @@ @@ -320,6 +326,10 @@
320 <version>3.4.5</version> 326 <version>3.4.5</version>
321 <exclusions> 327 <exclusions>
322 <exclusion> 328 <exclusion>
  329 + <groupId>log4j</groupId>
  330 + <artifactId>log4j</artifactId>
  331 + </exclusion>
  332 + <exclusion>
323 <groupId>org.slf4j</groupId> 333 <groupId>org.slf4j</groupId>
324 <artifactId>slf4j-log4j12</artifactId> 334 <artifactId>slf4j-log4j12</artifactId>
325 </exclusion> 335 </exclusion>
@@ -330,6 +340,12 @@ @@ -330,6 +340,12 @@
330 <groupId>com.101tec</groupId> 340 <groupId>com.101tec</groupId>
331 <artifactId>zkclient</artifactId> 341 <artifactId>zkclient</artifactId>
332 <version>0.3</version> 342 <version>0.3</version>
  343 + <exclusions>
  344 + <exclusion>
  345 + <groupId>log4j</groupId>
  346 + <artifactId>log4j</artifactId>
  347 + </exclusion>
  348 + </exclusions>
333 </dependency> 349 </dependency>
334 350
335 <!-- plan common工程依赖 --> 351 <!-- plan common工程依赖 -->
src/main/java/com/bsth/XDApplication.java
1 -package com.bsth;  
2 -  
3 -import com.bsth.data.BasicData;  
4 -import com.bsth.data.LineVersionsData;  
5 -import com.bsth.data.ThreadMonotor;  
6 -import com.bsth.data.car_out_info.UpdateDBThread;  
7 -import com.bsth.data.directive.DirectivesPstThread;  
8 -import com.bsth.data.forecast.SampleTimeDataLoader;  
9 -import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;  
10 -import com.bsth.data.gpsdata_v2.thread.OfflineMonitorThread;  
11 -import com.bsth.data.msg_queue.DirectivePushQueue;  
12 -import com.bsth.data.msg_queue.WebSocketPushQueue;  
13 -import com.bsth.data.safe_driv.SafeDrivDataLoadThread;  
14 -import com.bsth.data.schedule.DayOfSchedule;  
15 -import com.bsth.data.schedule.auto_exec.AutoExecScanThread;  
16 -import com.bsth.data.schedule.e_state_check.thread.FixedCheckStationCodeThread;  
17 -import com.bsth.data.schedule.edit_logs.SeiPstThread;  
18 -import com.bsth.data.schedule.late_adjust.ScheduleLateThread;  
19 -import com.bsth.data.schedule.signal.SchSiginUpdateDBThread;  
20 -import com.bsth.data.schedule.thread.CalcOilThread;  
21 -import com.bsth.data.schedule.thread.SchedulePstThread;  
22 -import com.bsth.data.schedule.thread.ScheduleRefreshThread;  
23 -import com.bsth.data.schedule.thread.SubmitToTrafficManage;  
24 -import com.bsth.util.DateUtils;  
25 -import com.bsth.util.Tools;  
26 -import org.slf4j.Logger;  
27 -import org.slf4j.LoggerFactory;  
28 -import org.springframework.beans.factory.annotation.Autowired;  
29 -import org.springframework.boot.CommandLineRunner;  
30 -import org.springframework.stereotype.Component;  
31 -  
32 -import java.util.concurrent.ScheduledExecutorService;  
33 -import java.util.concurrent.TimeUnit;  
34 -  
35 -/**  
36 - * 线调大部分服务都在这里启动  
37 - * Created by panzhao on 2017/5/14.  
38 - */  
39 -@Component  
40 -public class XDApplication implements CommandLineRunner {  
41 -  
42 - Logger log = LoggerFactory.getLogger(this.getClass());  
43 -  
44 - @Autowired  
45 - BasicData.BasicDataLoader basicDataLoader;  
46 - @Autowired  
47 - UpdateDBThread fcxxUpdateThread;  
48 - @Autowired  
49 - ScheduleRefreshThread scheduleRefreshThread;  
50 - @Autowired  
51 - SchedulePstThread schedulePstThread;  
52 - @Autowired  
53 - ScheduleLateThread scheduleLateThread;  
54 - @Autowired  
55 - SubmitToTrafficManage submitToTrafficManage;  
56 - @Autowired  
57 - CalcOilThread calcOilThread;  
58 - @Autowired  
59 - DirectivesPstThread directivesPstThread;  
60 - @Autowired  
61 - ThreadMonotor threadMonotor;  
62 - @Autowired  
63 - SeiPstThread seiPstThread;  
64 - @Autowired  
65 - SampleTimeDataLoader sampleTimeDataLoader;  
66 - @Autowired  
67 - SchSiginUpdateDBThread schSiginUpdateDBThread;  
68 - @Autowired  
69 - AutoExecScanThread autoExecScanThread;  
70 -  
71 - @Autowired  
72 - GpsDataLoaderThread gpsDataLoader;  
73 -  
74 - @Autowired  
75 - OfflineMonitorThread offlineMonitorThread;  
76 -  
77 - @Autowired  
78 - LineVersionsData lineVersionsData;  
79 -  
80 - /*@Autowired  
81 - FixedEnableVerionsThread fixedEnableVerionsThread;*/  
82 -  
83 - @Autowired  
84 - SafeDrivDataLoadThread safeDrivDataLoadThread;  
85 -  
86 - @Autowired  
87 - FixedCheckStationCodeThread fixedCheckStationCodeThread;  
88 -  
89 - private static long timeDiff;  
90 - private static long timeDiffTraffic;  
91 -  
92 - static {  
93 - // 早上2:20  
94 - timeDiff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis();  
95 - if (timeDiff < 0)  
96 - timeDiff += (1000 * 60 * 60 * 24);  
97 - // 早上07:00  
98 - timeDiffTraffic = (DateUtils.getTimestamp() + 1000 * 60 * 60 * 7) - System.currentTimeMillis();  
99 - if (timeDiffTraffic < 0)  
100 - timeDiffTraffic += (1000 * 60 * 60 * 24);  
101 - }  
102 -  
103 - @Override  
104 - public void run(String... strings) throws Exception {  
105 - try {  
106 - Tools tools = new Tools("application.properties");  
107 - String environment = tools.getValue("spring.profiles.active");  
108 - //预先加载基础的对照数据  
109 - basicDataLoader.loadAllData();  
110 - switch (environment){  
111 - case "dev":  
112 - devInit();  
113 - break;  
114 - case "prod":  
115 - prodInit();  
116 - break;  
117 - }  
118 - }catch (Exception e){  
119 - log.error("线调后台启动出现异常!!", e);  
120 - System.exit(1);  
121 - }  
122 - }  
123 -  
124 - @Autowired  
125 - DayOfSchedule dayOfSchedule;  
126 - public void devInit(){  
127 - log.info("devInit...");  
128 - ScheduledExecutorService sexec = Application.mainServices;  
129 - //抓取GPS数据  
130 - gpsDataLoader.setFlag(-1);  
131 - //dayOfSchedule.dataRecovery();  
132 - //sexec.scheduleWithFixedDelay(gpsDataLoader, 60, 4, TimeUnit.SECONDS);  
133 - //实际排班更新线程  
134 - //sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);  
135 - //sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 30, TimeUnit.SECONDS);//检查班次误点  
136 - //sexec.scheduleWithFixedDelay(autoExecScanThread, 100, 50, TimeUnit.SECONDS);//班次自动执行  
137 - //WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的  
138 -  
139 - //sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 50, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码  
140 - //实际排班延迟入库线程  
141 - //sexec.scheduleWithFixedDelay(schedulePstThread, 60, 15, TimeUnit.SECONDS);  
142 - //班次修正日志延迟入库  
143 - //sexec.scheduleWithFixedDelay(seiPstThread, 60, 30, TimeUnit.SECONDS);  
144 - //调度指令延迟入库  
145 - //sexec.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS);  
146 - //线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作)  
147 - //sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);  
148 -  
149 - //安全驾驶  
150 - //sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 40, 30, TimeUnit.SECONDS);  
151 -  
152 - //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 20, 60 * 2 , TimeUnit.SECONDS);  
153 - }  
154 -  
155 - public void prodInit(){  
156 - log.info("prodInit...");  
157 - ScheduledExecutorService sexec = Application.mainServices;  
158 - //安全驾驶  
159 - sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS);  
160 -  
161 - /** 线调业务 */  
162 - sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程  
163 - sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点  
164 - sexec.scheduleWithFixedDelay(gpsDataLoader, 100, 2, TimeUnit.SECONDS);//抓取GPS数据  
165 - sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码  
166 -  
167 - sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线  
168 - sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程  
169 - sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库  
170 - sexec.scheduleWithFixedDelay(directivesPstThread, 120, 60, TimeUnit.SECONDS);//调度指令延迟入库  
171 - sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作)  
172 - sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据  
173 - sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新  
174 - sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行  
175 - //DirectivePushQueue.start();//消息队列 -指令,系统下发的  
176 - WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的  
177 -  
178 - /** 线调为其他程序提供的数据 --写入数据库 */  
179 - //sexec.scheduleWithFixedDelay(fcxxUpdateThread, 160, 30, TimeUnit.SECONDS);//发车信息(发车屏、信息发布)  
180 - //线路首末班数据(网关用,班次更新时写入)  
181 - //com.bsth.data.schedule.f_a_l.FirstAndLastHandler  
182 - //sexec.scheduleWithFixedDelay(schSiginUpdateDBThread, 160, 60 * 30, TimeUnit.SECONDS);//无法自动完成的班次信息(网关用,补信号)  
183 -  
184 - //运管处静态数据提交  
185 - //log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处");  
186 - //sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS);  
187 - //计算油、公里加注  
188 - sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);  
189 -  
190 - //线路版本更新  
191 - sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS);  
192 -  
193 - //线路版本更新  
194 - //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS);  
195 - }  
196 -} 1 +package com.bsth;
  2 +
  3 +import com.bsth.data.BasicData;
  4 +import com.bsth.data.LineVersionsData;
  5 +import com.bsth.data.ThreadMonotor;
  6 +import com.bsth.data.car_out_info.UpdateDBThread;
  7 +import com.bsth.data.directive.DirectivesPstThread;
  8 +import com.bsth.data.forecast.SampleTimeDataLoader;
  9 +import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
  10 +import com.bsth.data.gpsdata_v2.thread.OfflineMonitorThread;
  11 +import com.bsth.data.gpsdata_v2.thread.RfidDataLoaderThread;
  12 +import com.bsth.data.msg_queue.DirectivePushQueue;
  13 +import com.bsth.data.msg_queue.WebSocketPushQueue;
  14 +import com.bsth.data.safe_driv.SafeDrivDataLoadThread;
  15 +import com.bsth.data.schedule.DayOfSchedule;
  16 +import com.bsth.data.schedule.auto_exec.AutoExecScanThread;
  17 +import com.bsth.data.schedule.e_state_check.thread.FixedCheckStationCodeThread;
  18 +import com.bsth.data.schedule.edit_logs.SeiPstThread;
  19 +import com.bsth.data.schedule.late_adjust.ScheduleLateThread;
  20 +import com.bsth.data.schedule.signal.SchSiginUpdateDBThread;
  21 +import com.bsth.data.schedule.thread.CalcOilThread;
  22 +import com.bsth.data.schedule.thread.SchedulePstThread;
  23 +import com.bsth.data.schedule.thread.ScheduleRefreshThread;
  24 +import com.bsth.data.schedule.thread.SubmitToTrafficManage;
  25 +import com.bsth.util.DateUtils;
  26 +import com.bsth.util.Tools;
  27 +import org.slf4j.Logger;
  28 +import org.slf4j.LoggerFactory;
  29 +import org.springframework.beans.factory.annotation.Autowired;
  30 +import org.springframework.boot.CommandLineRunner;
  31 +import org.springframework.stereotype.Component;
  32 +
  33 +import java.util.concurrent.ScheduledExecutorService;
  34 +import java.util.concurrent.TimeUnit;
  35 +
  36 +/**
  37 + * 线调大部分服务都在这里启动
  38 + * Created by panzhao on 2017/5/14.
  39 + */
  40 +@Component
  41 +public class XDApplication implements CommandLineRunner {
  42 +
  43 + Logger log = LoggerFactory.getLogger(this.getClass());
  44 +
  45 + @Autowired
  46 + BasicData.BasicDataLoader basicDataLoader;
  47 + @Autowired
  48 + UpdateDBThread fcxxUpdateThread;
  49 + @Autowired
  50 + ScheduleRefreshThread scheduleRefreshThread;
  51 + @Autowired
  52 + SchedulePstThread schedulePstThread;
  53 + @Autowired
  54 + ScheduleLateThread scheduleLateThread;
  55 + @Autowired
  56 + SubmitToTrafficManage submitToTrafficManage;
  57 + @Autowired
  58 + CalcOilThread calcOilThread;
  59 + @Autowired
  60 + DirectivesPstThread directivesPstThread;
  61 + @Autowired
  62 + ThreadMonotor threadMonotor;
  63 + @Autowired
  64 + SeiPstThread seiPstThread;
  65 + @Autowired
  66 + SampleTimeDataLoader sampleTimeDataLoader;
  67 + @Autowired
  68 + SchSiginUpdateDBThread schSiginUpdateDBThread;
  69 + @Autowired
  70 + AutoExecScanThread autoExecScanThread;
  71 +
  72 + @Autowired
  73 + GpsDataLoaderThread gpsDataLoader;
  74 +
  75 + @Autowired
  76 + OfflineMonitorThread offlineMonitorThread;
  77 +
  78 + @Autowired
  79 + LineVersionsData lineVersionsData;
  80 +
  81 + /*@Autowired
  82 + FixedEnableVerionsThread fixedEnableVerionsThread;*/
  83 +
  84 + @Autowired
  85 + SafeDrivDataLoadThread safeDrivDataLoadThread;
  86 +
  87 + @Autowired
  88 + FixedCheckStationCodeThread fixedCheckStationCodeThread;
  89 +
  90 + private static long timeDiff;
  91 + private static long timeDiffTraffic;
  92 +
  93 + static {
  94 + // 早上2:20
  95 + timeDiff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis();
  96 + if (timeDiff < 0)
  97 + timeDiff += (1000 * 60 * 60 * 24);
  98 + // 早上07:00
  99 + timeDiffTraffic = (DateUtils.getTimestamp() + 1000 * 60 * 60 * 7) - System.currentTimeMillis();
  100 + if (timeDiffTraffic < 0)
  101 + timeDiffTraffic += (1000 * 60 * 60 * 24);
  102 + }
  103 +
  104 + @Override
  105 + public void run(String... strings) throws Exception {
  106 + try {
  107 + Tools tools = new Tools("application.properties");
  108 + String environment = tools.getValue("spring.profiles.active");
  109 + //预先加载基础的对照数据
  110 + basicDataLoader.loadAllData();
  111 + switch (environment){
  112 + case "dev":
  113 + devInit();
  114 + break;
  115 + case "prod":
  116 + prodInit();
  117 + break;
  118 + }
  119 + }catch (Exception e){
  120 + log.error("线调后台启动出现异常!!", e);
  121 + System.exit(1);
  122 + }
  123 + }
  124 +
  125 + @Autowired
  126 + DayOfSchedule dayOfSchedule;
  127 + public void devInit(){
  128 + log.info("devInit...");
  129 + ScheduledExecutorService sexec = Application.mainServices;
  130 + //抓取GPS数据
  131 + gpsDataLoader.setFlag(-1);
  132 + //dayOfSchedule.dataRecovery();
  133 + //sexec.scheduleWithFixedDelay(gpsDataLoader, 60, 4, TimeUnit.SECONDS);
  134 + //实际排班更新线程
  135 + //sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
  136 + //sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 30, TimeUnit.SECONDS);//检查班次误点
  137 + //sexec.scheduleWithFixedDelay(autoExecScanThread, 100, 50, TimeUnit.SECONDS);//班次自动执行
  138 + //WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的
  139 +
  140 + //sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 50, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码
  141 + //实际排班延迟入库线程
  142 + //sexec.scheduleWithFixedDelay(schedulePstThread, 60, 15, TimeUnit.SECONDS);
  143 + //班次修正日志延迟入库
  144 + //sexec.scheduleWithFixedDelay(seiPstThread, 60, 30, TimeUnit.SECONDS);
  145 + //调度指令延迟入库
  146 + //sexec.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS);
  147 + //线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作)
  148 + //sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);
  149 +
  150 + //安全驾驶
  151 + //sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 40, 30, TimeUnit.SECONDS);
  152 +
  153 + //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 20, 60 * 2 , TimeUnit.SECONDS);
  154 + }
  155 +
  156 + public void prodInit(){
  157 + log.info("prodInit...");
  158 + ScheduledExecutorService sexec = Application.mainServices;
  159 + //安全驾驶
  160 + sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS);
  161 +
  162 + /** 线调业务 */
  163 + sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程
  164 + sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点
  165 + sexec.scheduleWithFixedDelay(gpsDataLoader, 100, 2, TimeUnit.SECONDS);//抓取GPS数据
  166 + sexec.scheduleWithFixedDelay(rfidDataLoader, 5, 5, TimeUnit.SECONDS);//抓取RFID数据
  167 + sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码
  168 +
  169 + sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线
  170 + sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程
  171 + sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库
  172 + sexec.scheduleWithFixedDelay(directivesPstThread, 120, 60, TimeUnit.SECONDS);//调度指令延迟入库
  173 + sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作)
  174 + sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据
  175 + sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新
  176 + sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行
  177 + //DirectivePushQueue.start();//消息队列 -指令,系统下发的
  178 + WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的
  179 +
  180 + /** 线调为其他程序提供的数据 --写入数据库 */
  181 + //sexec.scheduleWithFixedDelay(fcxxUpdateThread, 160, 30, TimeUnit.SECONDS);//发车信息(发车屏、信息发布)
  182 + //线路首末班数据(网关用,班次更新时写入)
  183 + //com.bsth.data.schedule.f_a_l.FirstAndLastHandler
  184 + //sexec.scheduleWithFixedDelay(schSiginUpdateDBThread, 160, 60 * 30, TimeUnit.SECONDS);//无法自动完成的班次信息(网关用,补信号)
  185 +
  186 + //运管处静态数据提交
  187 + //log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处");
  188 + //sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
  189 + //计算油、公里加注
  190 + sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
  191 +
  192 + //线路版本更新
  193 + sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS);
  194 +
  195 + //线路版本更新
  196 + //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS);
  197 + }
  198 +}
src/main/java/com/bsth/controller/calc/CalcIntervalController.java
@@ -41,6 +41,13 @@ public class CalcIntervalController extends BaseController&lt;CalcInterval,Integer @@ -41,6 +41,13 @@ public class CalcIntervalController extends BaseController&lt;CalcInterval,Integer
41 return list; 41 return list;
42 } 42 }
43 43
  44 + @RequestMapping(value="/exportDetail")
  45 + public List<Map<String,Object>> exportDetail(@RequestParam Map<String, Object> map){
  46 + List<Map<String,Object>> list=new ArrayList<Map<String,Object>>();
  47 + list=calcIntervalService.exportDetail(map);
  48 + return list;
  49 + }
  50 +
44 @RequestMapping(value="/sumInterval") 51 @RequestMapping(value="/sumInterval")
45 public List<Map<String,Object>> sumInterval(@RequestParam Map<String, Object> map){ 52 public List<Map<String,Object>> sumInterval(@RequestParam Map<String, Object> map){
46 List<Map<String, Object>> list=calcIntervalService.sumInterval(map); 53 List<Map<String, Object>> list=calcIntervalService.sumInterval(map);
src/main/java/com/bsth/controller/calc/CalcWaybillController.java
@@ -317,4 +317,8 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt; @@ -317,4 +317,8 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt;
317 return calcWaybillService.getBusMileage(line, date, date2, xlName, zt, by, type); 317 return calcWaybillService.getBusMileage(line, date, date2, xlName, zt, by, type);
318 } 318 }
319 319
  320 + @RequestMapping(value="/calcDetailMonthly")
  321 + public List<List<String>> calcDetailMonthly(@RequestParam Map<String, Object> map){
  322 + return calcWaybillService.calcDetailMonthly(map);
  323 + }
320 } 324 }
src/main/java/com/bsth/controller/realcontrol/AdminUtilsController.java
1 -package com.bsth.controller.realcontrol;  
2 -  
3 -import java.text.SimpleDateFormat;  
4 -import java.util.Date;  
5 -import java.util.HashMap;  
6 -import java.util.List;  
7 -import java.util.Map;  
8 -  
9 -import org.slf4j.Logger;  
10 -import org.slf4j.LoggerFactory;  
11 -import org.springframework.beans.factory.annotation.Autowired;  
12 -import org.springframework.web.bind.annotation.RequestMapping;  
13 -import org.springframework.web.bind.annotation.RequestParam;  
14 -import org.springframework.web.bind.annotation.RestController;  
15 -  
16 -import com.bsth.common.ResponseCode;  
17 -import com.bsth.data.directive.DayOfDirectives;  
18 -import com.bsth.data.directive.DirectivesPstThread;  
19 -import com.bsth.data.gpsdata_v2.cache.GeoCacheData;  
20 -import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;  
21 -import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;  
22 -import com.bsth.data.msg_queue.DirectivePushQueue;  
23 -import com.bsth.data.msg_queue.WebSocketPushQueue;  
24 -import com.bsth.data.pilot80.PilotReport;  
25 -import com.bsth.data.schedule.DayOfSchedule;  
26 -import com.bsth.entity.realcontrol.ScheduleRealInfo;  
27 -import com.bsth.websocket.handler.SendUtils;  
28 -  
29 -import ch.qos.logback.classic.Level;  
30 -import ch.qos.logback.classic.LoggerContext;  
31 -  
32 -/**  
33 - * Created by panzhao on 2017/4/14.  
34 - */  
35 -@RestController  
36 -@RequestMapping("adminUtils")  
37 -public class AdminUtilsController {  
38 -  
39 -  
40 - Logger logger = LoggerFactory.getLogger(this.getClass());  
41 -  
42 - @Autowired  
43 - DayOfSchedule dayOfSchedule;  
44 -  
45 - @Autowired  
46 - GeoCacheData geoCacheData;  
47 -  
48 - @Autowired  
49 - DayOfDirectives dayOfDirectives;  
50 -  
51 - @Autowired  
52 - SendUtils sendUtils;  
53 -  
54 - @Autowired  
55 - PilotReport pilotReport;  
56 -  
57 - /**  
58 - * 出现重复班次的车辆  
59 - *  
60 - * @param  
61 - * @RequestMapping(value = "/schRepeat", method = RequestMethod.POST)  
62 - * public void schRepeat(@RequestParam String nbbm){  
63 - * logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测...");  
64 - * List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm);  
65 - * logger.info("检测前,车辆班次数量:" + list.size());  
66 - * <p>  
67 - * Map<Long, ScheduleRealInfo> map = new HashMap<>();  
68 - * for(ScheduleRealInfo sch : list){  
69 - * if(map.containsKey(sch.getId())){  
70 - * logger.info("检测到重复ID: " + sch.getId());  
71 - * }  
72 - * map.put(sch.getId(), sch);  
73 - * }  
74 - * <p>  
75 - * logger.info("检测后,车辆班次数量:" + list.size());  
76 - * if(map.values().size() > 0){  
77 - * dayOfSchedule.replaceByNbbm(nbbm, map.values());  
78 - * }  
79 - * }  
80 - */  
81 -  
82 -/* @RequestMapping(value = "/directivePushQueue")  
83 - public void directivePushQueue(){  
84 - DirectivePushQueue.start();  
85 - }*/  
86 - @RequestMapping(value = "/directiveQueueSize")  
87 - public void directiveQueueSize() {  
88 - DirectivePushQueue.size();  
89 - }  
90 -  
91 - /*@RequestMapping(value = "/webSocketPushQueue")  
92 - public void webSocketPushQueue(){  
93 - WebSocketPushQueue.start();  
94 - }*/  
95 -  
96 - @RequestMapping(value = "/webSocketQueueSize")  
97 - public void webSocketQueueSize() {  
98 - WebSocketPushQueue.size();  
99 - }  
100 -  
101 - @RequestMapping(value = "/setHttpFlag")  
102 - public void setHttpFlag(@RequestParam int flag) {  
103 - if (flag != 0 && flag != -1)  
104 - return;  
105 - GpsDataLoaderThread.setFlag(flag);  
106 - }  
107 -  
108 - @RequestMapping(value = "/updateCacheBuff")  
109 - public void updateCacheBuff() {  
110 - geoCacheData.loadData();  
111 - }  
112 -  
113 - @RequestMapping(value = "/reCalcLpSch")  
114 - public void reCalcLpSch() {  
115 - dayOfSchedule._test_reCalcLpSch();  
116 - }  
117 -  
118 - @RequestMapping(value = "/findSchByLpName")  
119 - public List<ScheduleRealInfo> findSchByLpName(@RequestParam String lpName) {  
120 - return dayOfSchedule.getLpScheduleMap().get(lpName);  
121 - }  
122 -  
123 - @RequestMapping(value = "/findSchByNbbm")  
124 - public List<ScheduleRealInfo> findSchByNbbm(@RequestParam String nbbm) {  
125 - return dayOfSchedule.findByNbbm(nbbm);  
126 - }  
127 -  
128 - @RequestMapping(value = "/removeExecPlan")  
129 - public int removeExecPlan(@RequestParam String nbbm) {  
130 - dayOfSchedule.removeExecPlan(nbbm);  
131 - return 1;  
132 - }  
133 -  
134 - @RequestMapping(value = "/sch_re_calc_id_maps")  
135 - public int reCalcIdMaps() {  
136 - return dayOfSchedule.reCalcIdMaps();  
137 - }  
138 -  
139 - @RequestMapping(value = "/sch_size_string")  
140 - public String schSizeString() {  
141 - return dayOfSchedule.sizeString();  
142 - }  
143 -  
144 - @RequestMapping(value = "/containerSize")  
145 - public Map<String, Integer> containerSize() {  
146 - Map<String, Integer> rs = new HashMap<>();  
147 - rs.put("60_size", dayOfDirectives.all60().size());  
148 - rs.put("80_size", pilotReport.findAll().size());  
149 - rs.put("nbbm_sch_size", dayOfSchedule.findAll().size());  
150 - rs.put("lp_sch_size", dayOfSchedule.findAllByLpContainer().size());  
151 - rs.put("id_sch_size", dayOfSchedule.findAllByIdContainer().size());  
152 - rs.put("pst_sch_size", dayOfSchedule.getPstSize());  
153 - rs.put("speeds_size", OverspeedProcess.size());  
154 - return rs;  
155 - }  
156 -  
157 - @RequestMapping(value = "/websocketRadioText")  
158 - public int radioText(String t, String lineCode) {  
159 - sendUtils.sendRadioText(t, lineCode);  
160 - return 0;  
161 - }  
162 -  
163 - @Autowired  
164 - DirectivesPstThread directivesPstThread;  
165 -  
166 - @RequestMapping(value = "/_sd_60_pst")  
167 - public void sd_60_pst() {  
168 - logger.info("手动入库指令....");  
169 - directivesPstThread.run();  
170 - }  
171 -  
172 - /**  
173 - * 删除班次,删除内存中未清理掉的非当天的班次  
174 - * @createDate 2019.05.13  
175 - * @author zhangxianzhou  
176 - * @param id 线路id  
177 - * @return 被删除的班次信息  
178 - */  
179 - @RequestMapping("/deleteSchduleBC")  
180 - public Map<String, Object> deleteSchduleBC(Long id) {  
181 - Map<String, Object> rs = new HashMap<>();  
182 - rs.put("status", ResponseCode.ERROR);  
183 - ScheduleRealInfo sch = null;  
184 - try {  
185 - sch = dayOfSchedule.get(id);  
186 - if (sch == null) {  
187 - rs.put("msg", "无效的id号");  
188 - return rs;  
189 - }  
190 -  
191 - //内存中删除  
192 - dayOfSchedule.deleteBC(sch);  
193 - rs.put("delete", sch);  
194 - rs.put("status", ResponseCode.SUCCESS);  
195 -  
196 - } catch (Exception e) {  
197 - logger.error("", e);  
198 - rs.put("msg", e.getMessage());  
199 - sch.setDeleted(false);  
200 - }  
201 -  
202 - return rs;  
203 - }  
204 -  
205 - @RequestMapping("/changeLogLevel")  
206 - public Map<String, Object> changeLogLevel(@RequestParam String level) {  
207 - Map<String, Object> rs = new HashMap<>();  
208 - rs.put("errCode", 1);  
209 - LoggerContext context = (LoggerContext)LoggerFactory.getILoggerFactory();  
210 - context.getLogger("root").setLevel(Level.toLevel(level));  
211 - rs.put("errCode", 0);  
212 - rs.put("errMsg", "成功");  
213 -  
214 - return rs;  
215 - } 1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import java.text.SimpleDateFormat;
  4 +import java.util.*;
  5 +
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestParam;
  11 +import org.springframework.web.bind.annotation.RestController;
  12 +
  13 +import com.bsth.common.ResponseCode;
  14 +import com.bsth.data.directive.DayOfDirectives;
  15 +import com.bsth.data.directive.DirectivesPstThread;
  16 +import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
  17 +import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
  18 +import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
  19 +import com.bsth.data.msg_queue.DirectivePushQueue;
  20 +import com.bsth.data.msg_queue.WebSocketPushQueue;
  21 +import com.bsth.data.pilot80.PilotReport;
  22 +import com.bsth.data.schedule.DayOfSchedule;
  23 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  24 +import com.bsth.websocket.handler.SendUtils;
  25 +
  26 +import ch.qos.logback.classic.Level;
  27 +import ch.qos.logback.classic.LoggerContext;
  28 +
  29 +/**
  30 + * Created by panzhao on 2017/4/14.
  31 + */
  32 +@RestController
  33 +@RequestMapping("adminUtils")
  34 +public class AdminUtilsController {
  35 +
  36 +
  37 + Logger logger = LoggerFactory.getLogger(this.getClass());
  38 +
  39 + @Autowired
  40 + DayOfSchedule dayOfSchedule;
  41 +
  42 + @Autowired
  43 + GeoCacheData geoCacheData;
  44 +
  45 + @Autowired
  46 + DayOfDirectives dayOfDirectives;
  47 +
  48 + @Autowired
  49 + SendUtils sendUtils;
  50 +
  51 + @Autowired
  52 + PilotReport pilotReport;
  53 +
  54 + /**
  55 + * 出现重复班次的车辆
  56 + *
  57 + * @param
  58 + * @RequestMapping(value = "/schRepeat", method = RequestMethod.POST)
  59 + * public void schRepeat(@RequestParam String nbbm){
  60 + * logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测...");
  61 + * List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm);
  62 + * logger.info("检测前,车辆班次数量:" + list.size());
  63 + * <p>
  64 + * Map<Long, ScheduleRealInfo> map = new HashMap<>();
  65 + * for(ScheduleRealInfo sch : list){
  66 + * if(map.containsKey(sch.getId())){
  67 + * logger.info("检测到重复ID: " + sch.getId());
  68 + * }
  69 + * map.put(sch.getId(), sch);
  70 + * }
  71 + * <p>
  72 + * logger.info("检测后,车辆班次数量:" + list.size());
  73 + * if(map.values().size() > 0){
  74 + * dayOfSchedule.replaceByNbbm(nbbm, map.values());
  75 + * }
  76 + * }
  77 + */
  78 +
  79 +/* @RequestMapping(value = "/directivePushQueue")
  80 + public void directivePushQueue(){
  81 + DirectivePushQueue.start();
  82 + }*/
  83 + @RequestMapping(value = "/directiveQueueSize")
  84 + public void directiveQueueSize() {
  85 + DirectivePushQueue.size();
  86 + }
  87 +
  88 + /*@RequestMapping(value = "/webSocketPushQueue")
  89 + public void webSocketPushQueue(){
  90 + WebSocketPushQueue.start();
  91 + }*/
  92 +
  93 + @RequestMapping(value = "/webSocketQueueSize")
  94 + public void webSocketQueueSize() {
  95 + WebSocketPushQueue.size();
  96 + }
  97 +
  98 + @RequestMapping(value = "/setHttpFlag")
  99 + public void setHttpFlag(@RequestParam int flag) {
  100 + if (flag != 0 && flag != -1)
  101 + return;
  102 + GpsDataLoaderThread.setFlag(flag);
  103 + }
  104 +
  105 + @RequestMapping(value = "/updateCacheBuff")
  106 + public void updateCacheBuff() {
  107 + geoCacheData.loadData();
  108 + }
  109 +
  110 + @RequestMapping(value = "/reCalcLpSch")
  111 + public void reCalcLpSch() {
  112 + dayOfSchedule._test_reCalcLpSch();
  113 + }
  114 +
  115 + @RequestMapping(value = "/findSchByLpName")
  116 + public List<ScheduleRealInfo> findSchByLpName(@RequestParam String lpName) {
  117 + return dayOfSchedule.getLpScheduleMap().get(lpName);
  118 + }
  119 +
  120 + @RequestMapping(value = "/findSchByNbbm")
  121 + public List<ScheduleRealInfo> findSchByNbbm(@RequestParam String nbbm) {
  122 + return dayOfSchedule.findByNbbm(nbbm);
  123 + }
  124 +
  125 + @RequestMapping(value = "/executeCurr")
  126 + public ScheduleRealInfo executeCurr(@RequestParam String nbbm) {
  127 + return dayOfSchedule.executeCurr(nbbm);
  128 + };
  129 +
  130 + @RequestMapping(value = "/reCalcExecPlan4Nbbm")
  131 + public void reCalcExecPlan4Nbbm(@RequestParam String nbbm) {
  132 + dayOfSchedule.reCalcExecPlan(nbbm);
  133 + };
  134 +
  135 + @RequestMapping(value = "/reCalcExecPlan4Line")
  136 + public void reCalcExecPlan4Line(@RequestParam String lineCode) {
  137 + Set<String> nbbms = dayOfSchedule.findCarByLineCode(lineCode);
  138 + for (String nbbm : nbbms) {
  139 + dayOfSchedule.reCalcExecPlan(nbbm);
  140 + }
  141 + };
  142 +
  143 + @RequestMapping(value = "/removeExecPlan")
  144 + public int removeExecPlan(@RequestParam String nbbm) {
  145 + dayOfSchedule.removeExecPlan(nbbm);
  146 + return 1;
  147 + }
  148 +
  149 + @RequestMapping(value = "/sch_re_calc_id_maps")
  150 + public int reCalcIdMaps() {
  151 + return dayOfSchedule.reCalcIdMaps();
  152 + }
  153 +
  154 + @RequestMapping(value = "/sch_size_string")
  155 + public String schSizeString() {
  156 + return dayOfSchedule.sizeString();
  157 + }
  158 +
  159 + @RequestMapping(value = "/containerSize")
  160 + public Map<String, Integer> containerSize() {
  161 + Map<String, Integer> rs = new HashMap<>();
  162 + rs.put("60_size", dayOfDirectives.all60().size());
  163 + rs.put("80_size", pilotReport.findAll().size());
  164 + rs.put("nbbm_sch_size", dayOfSchedule.findAll().size());
  165 + rs.put("lp_sch_size", dayOfSchedule.findAllByLpContainer().size());
  166 + rs.put("id_sch_size", dayOfSchedule.findAllByIdContainer().size());
  167 + rs.put("pst_sch_size", dayOfSchedule.getPstSize());
  168 + rs.put("speeds_size", OverspeedProcess.size());
  169 + return rs;
  170 + }
  171 +
  172 + @RequestMapping(value = "/websocketRadioText")
  173 + public int radioText(String t, String lineCode) {
  174 + sendUtils.sendRadioText(t, lineCode);
  175 + return 0;
  176 + }
  177 +
  178 + @Autowired
  179 + DirectivesPstThread directivesPstThread;
  180 +
  181 + @RequestMapping(value = "/_sd_60_pst")
  182 + public void sd_60_pst() {
  183 + logger.info("手动入库指令....");
  184 + directivesPstThread.run();
  185 + }
  186 +
  187 + /**
  188 + * 删除班次,删除内存中未清理掉的非当天的班次
  189 + * @createDate 2019.05.13
  190 + * @author zhangxianzhou
  191 + * @param id 线路id
  192 + * @return 被删除的班次信息
  193 + */
  194 + @RequestMapping("/deleteSchduleBC")
  195 + public Map<String, Object> deleteSchduleBC(Long id) {
  196 + Map<String, Object> rs = new HashMap<>();
  197 + rs.put("status", ResponseCode.ERROR);
  198 + ScheduleRealInfo sch = null;
  199 + try {
  200 + sch = dayOfSchedule.get(id);
  201 + if (sch == null) {
  202 + rs.put("msg", "无效的id号");
  203 + return rs;
  204 + }
  205 +
  206 + //内存中删除
  207 + dayOfSchedule.deleteBC(sch);
  208 + rs.put("delete", sch);
  209 + rs.put("status", ResponseCode.SUCCESS);
  210 +
  211 + } catch (Exception e) {
  212 + logger.error("", e);
  213 + rs.put("msg", e.getMessage());
  214 + sch.setDeleted(false);
  215 + }
  216 +
  217 + return rs;
  218 + }
  219 +
  220 + @RequestMapping("/changeLogLevel")
  221 + public Map<String, Object> changeLogLevel(@RequestParam String level) {
  222 + Map<String, Object> rs = new HashMap<>();
  223 + rs.put("errCode", 1);
  224 + LoggerContext context = (LoggerContext)LoggerFactory.getILoggerFactory();
  225 + context.getLogger("root").setLevel(Level.toLevel(level));
  226 + rs.put("errCode", 0);
  227 + rs.put("errMsg", "成功");
  228 +
  229 + return rs;
  230 + }
216 } 231 }
217 \ No newline at end of file 232 \ No newline at end of file
src/main/java/com/bsth/controller/realcontrol/ReportRegisterController.java
@@ -36,7 +36,8 @@ public class ReportRegisterController extends BaseController&lt;ReportRegister, Lon @@ -36,7 +36,8 @@ public class ReportRegisterController extends BaseController&lt;ReportRegister, Lon
36 36
37 Logger log = LoggerFactory.getLogger(this.getClass()); 37 Logger log = LoggerFactory.getLogger(this.getClass());
38 38
39 - final static String url = "http://114.80.178.13/complaint/TsReport/input.do"; 39 + final static String url = "http://61.171.28.220:8018/complaint/TsReport/input.do";
  40 +// final static String url = "http://114.80.178.13/complaint/TsReport/input.do";
40 // final static String url = "http://192.168.168.228:8080/complaint/TsReport/input.do"; 41 // final static String url = "http://192.168.168.228:8080/complaint/TsReport/input.do";
41 42
42 @Autowired 43 @Autowired
src/main/java/com/bsth/controller/report/ReportController.java
@@ -377,4 +377,16 @@ public class ReportController { @@ -377,4 +377,16 @@ public class ReportController {
377 377
378 return service.singleEnergy(map); 378 return service.singleEnergy(map);
379 } 379 }
  380 +
  381 + /**
  382 + * @Description :TODO(路单线路明细月报表导出数据)
  383 + *
  384 + * @param map <tables>
  385 + *
  386 + * @return Map<String, Object>
  387 + */
  388 + @RequestMapping(value = "/calcDetailMonthlyE" , method = RequestMethod.POST)
  389 + public Map<String, Object> calcDetailMonthlyE(@RequestParam Map<String,Object> map) {
  390 + return service.calcDetailMonthlyE(map);
  391 + }
380 } 392 }
src/main/java/com/bsth/data/gpsdata_v2/DataHandleProcess.java
1 -package com.bsth.data.gpsdata_v2;  
2 -  
3 -import com.alibaba.fastjson.JSON;  
4 -import com.bsth.data.gpsdata_v2.cache.GpsCacheData;  
5 -import com.bsth.data.gpsdata_v2.entity.GpsEntity;  
6 -import com.bsth.data.gpsdata_v2.handlers.*;  
7 -import com.bsth.email.SendEmailController;  
8 -import com.bsth.email.entity.EmailBean;  
9 -import com.google.common.collect.ArrayListMultimap;  
10 -import org.apache.commons.lang3.StringUtils;  
11 -import org.slf4j.Logger;  
12 -import org.slf4j.LoggerFactory;  
13 -import org.springframework.beans.factory.annotation.Autowired;  
14 -import org.springframework.stereotype.Component;  
15 -  
16 -import java.util.*;  
17 -import java.util.concurrent.CountDownLatch;  
18 -import java.util.concurrent.ExecutorService;  
19 -import java.util.concurrent.Executors;  
20 -import java.util.concurrent.ThreadFactory;  
21 -import java.util.concurrent.TimeUnit;  
22 -  
23 -/**  
24 - * 实时信号数据处理  
25 - * Created by panzhao on 2017/11/15.  
26 - */  
27 -@Component  
28 -public class DataHandleProcess {  
29 -  
30 - @Autowired  
31 - GpsStateProcess gpsStateProcess;  
32 - @Autowired  
33 - StationInsideProcess stationInsideProcess;  
34 - @Autowired  
35 - AbnormalStateProcess abnormalStateProcess;  
36 - @Autowired  
37 - InStationProcess inStationProcess;  
38 - @Autowired  
39 - OutStationProcess outStationProcess;  
40 - @Autowired  
41 - ReverseRouteProcess reverseRouteProcess;  
42 - @Autowired  
43 - GpsRealData gpsRealData;  
44 - // 发送邮件  
45 - @Autowired  
46 - private SendEmailController sendEmailController;  
47 -  
48 -  
49 - static Logger logger = LoggerFactory.getLogger(DataHandleProcess.class);  
50 -  
51 - final static int POOL_SIZE = 20;  
52 -  
53 - static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1, new ThreadFactory() {  
54 -  
55 - @Override  
56 - public Thread newThread(Runnable r) {  
57 - // TODO Auto-generated method stub  
58 - Thread t = new Thread(r);  
59 - t.setName("GPSProcessor");  
60 -  
61 - return t;  
62 - }  
63 -  
64 - });  
65 - public static CountDownLatch count;  
66 -  
67 - static long lastTime;  
68 -  
69 - public static boolean isBlock() {  
70 - return System.currentTimeMillis() - lastTime > 1000 * 30;  
71 - }  
72 -  
73 - private void shutdownAndAwaitTermination(ExecutorService pool) {  
74 - pool.shutdown();  
75 - try {  
76 - if (!pool.awaitTermination(500, TimeUnit.MILLISECONDS)) {  
77 - pool.shutdownNow();  
78 - }  
79 - if (!pool.awaitTermination(500, TimeUnit.MILLISECONDS)) {  
80 - logger.error("线程池无法正常终止");  
81 - }  
82 - } catch (InterruptedException e) {  
83 - pool.shutdown();  
84 - Thread.currentThread().interrupt();  
85 - }  
86 - }  
87 -  
88 - public void handle(List<GpsEntity> list) {  
89 - try {  
90 - if (list.size() == 0)  
91 - return;  
92 - lastTime = System.currentTimeMillis();  
93 - //按设备号分组数据(一个设备的多条数据,必须在一个线程里跑)  
94 - ArrayListMultimap multimap = ArrayListMultimap.create();  
95 - for (GpsEntity gps : list) {  
96 - multimap.put(gps.getDeviceId(), gps);  
97 - }  
98 - List<String> deviceList = new ArrayList<>(multimap.keySet());  
99 -  
100 - //数据均分给线程  
101 - ArrayListMultimap dataListMap = ArrayListMultimap.create();  
102 - int size = deviceList.size(), threadIndex = 0, threadSize = size / POOL_SIZE;  
103 - if(threadSize==0)  
104 - threadSize = size;  
105 - for (int i = 0; i < size; i++) {  
106 - if (i % threadSize == 0)  
107 - threadIndex++;  
108 - dataListMap.putAll(threadIndex, multimap.get(deviceList.get(i)));  
109 - }  
110 - Set<Integer> ks = dataListMap.keySet();  
111 - logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size());  
112 - count = new CountDownLatch(ks.size());  
113 -  
114 - //logger.info(JSON.toJSONString(ks));  
115 - for (Integer index : ks) {  
116 - threadPool.execute(new SignalHandleThread(dataListMap.get(index), count));  
117 - }  
118 -  
119 -  
120 - //等待子线程结束  
121 - boolean isNormal = count.await(5, TimeUnit.SECONDS);  
122 - if (!isNormal) {  
123 - try {  
124 - shutdownAndAwaitTermination(threadPool);  
125 - threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1, new ThreadFactory() {  
126 -  
127 - @Override  
128 - public Thread newThread(Runnable r) {  
129 - // TODO Auto-generated method stub  
130 - Thread t = new Thread(r);  
131 - t.setName("GPSProcessor");  
132 -  
133 - return t;  
134 - }  
135 -  
136 - });  
137 - //发送邮件  
138 - EmailBean mail = new EmailBean();  
139 - mail.setSubject("线调GPS处理");  
140 - mail.setContent("GPS处理超时,检查线程栈文件信息<br/>");  
141 - sendEmailController.sendMail("113252620@qq.com", mail);  
142 - logger.info("DataHandlerProcess:邮件发送成功!");  
143 - } catch (Exception e){  
144 - logger.error("DataHandlerProcess:邮件发送失败!",e);  
145 - }  
146 - }  
147 -  
148 - //加入实时gps对照  
149 - for (GpsEntity gps : list)  
150 - gpsRealData.put(gps);  
151 -  
152 - logger.info("time , " + (System.currentTimeMillis() - lastTime));  
153 - } catch (Exception e) {  
154 - logger.error("", e);  
155 - }  
156 - }  
157 -  
158 - static GpsComp comp = new GpsComp();  
159 -  
160 - public class SignalHandleThread implements Runnable {  
161 -  
162 - List<GpsEntity> list;  
163 - CountDownLatch count;  
164 -  
165 - SignalHandleThread(List<GpsEntity> gpsList, CountDownLatch count) {  
166 - this.list = gpsList;  
167 - this.count = count;  
168 - }  
169 -  
170 - @Override  
171 - public void run() {  
172 - try {  
173 - Collections.sort(list, comp);  
174 - GpsEntity gps;  
175 - for(int i = 0,len = list.size(); i< len ;i ++){  
176 - if (Thread.currentThread().isInterrupted()) break;  
177 - gps = list.get(i);  
178 -  
179 - try {  
180 - if (StringUtils.isEmpty(gps.getNbbm()))  
181 - continue;  
182 - if (Math.abs(gps.getTimestamp() - gps.getServerTimestamp()) > 1000 * 60 * 20)  
183 - continue;  
184 -  
185 - gpsStateProcess.process(gps);//状态处理  
186 - stationInsideProcess.process(gps);//场站内外判定  
187 - reverseRouteProcess.process(gps);//反向路由处理  
188 - abnormalStateProcess.process(gps);//超速越界  
189 -  
190 - inStationProcess.process(gps);//进站  
191 - outStationProcess.process(gps);//出站  
192 -  
193 -  
194 - GpsCacheData.putGps(gps);//历史gps缓存  
195 - } catch (Throwable e) {  
196 - logger.error("", e);  
197 - }  
198 - }  
199 - } finally {  
200 - if (count != null)  
201 - count.countDown();  
202 - }  
203 - }  
204 - }  
205 -  
206 - public static class GpsComp implements Comparator<GpsEntity> {  
207 -  
208 - @Override  
209 - public int compare(GpsEntity g1, GpsEntity g2) {  
210 - return g1.getTimestamp().compareTo(g2.getTimestamp());  
211 - }  
212 - } 1 +package com.bsth.data.gpsdata_v2;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.bsth.data.gpsdata_v2.cache.GpsCacheData;
  5 +import com.bsth.data.gpsdata_v2.entity.GpsEntity;
  6 +import com.bsth.data.gpsdata_v2.handlers.*;
  7 +import com.bsth.email.SendEmailController;
  8 +import com.bsth.email.entity.EmailBean;
  9 +import com.fasterxml.jackson.databind.ObjectMapper;
  10 +import com.google.common.collect.ArrayListMultimap;
  11 +import org.apache.commons.lang3.StringUtils;
  12 +import org.slf4j.Logger;
  13 +import org.slf4j.LoggerFactory;
  14 +import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.stereotype.Component;
  16 +
  17 +import java.util.*;
  18 +import java.util.concurrent.CountDownLatch;
  19 +import java.util.concurrent.ExecutorService;
  20 +import java.util.concurrent.Executors;
  21 +import java.util.concurrent.ThreadFactory;
  22 +import java.util.concurrent.TimeUnit;
  23 +
  24 +/**
  25 + * 实时信号数据处理
  26 + * Created by panzhao on 2017/11/15.
  27 + */
  28 +@Component
  29 +public class DataHandleProcess {
  30 +
  31 + @Autowired
  32 + GpsStateProcess gpsStateProcess;
  33 + @Autowired
  34 + StationInsideProcess stationInsideProcess;
  35 + @Autowired
  36 + AbnormalStateProcess abnormalStateProcess;
  37 + @Autowired
  38 + InStationProcess inStationProcess;
  39 + @Autowired
  40 + OutStationProcess outStationProcess;
  41 + @Autowired
  42 + ReverseRouteProcess reverseRouteProcess;
  43 + @Autowired
  44 + GpsRealData gpsRealData;
  45 + // 发送邮件
  46 + @Autowired
  47 + private SendEmailController sendEmailController;
  48 +
  49 +
  50 + static Logger logger = LoggerFactory.getLogger(DataHandleProcess.class);
  51 +
  52 + final static int POOL_SIZE = 20;
  53 +
  54 + static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1, new ThreadFactory() {
  55 +
  56 + @Override
  57 + public Thread newThread(Runnable r) {
  58 + // TODO Auto-generated method stub
  59 + Thread t = new Thread(r);
  60 + t.setName("GPSProcessor");
  61 +
  62 + return t;
  63 + }
  64 +
  65 + });
  66 +
  67 + static long lastTime;
  68 +
  69 + public static boolean isBlock() {
  70 + return System.currentTimeMillis() - lastTime > 1000 * 30;
  71 + }
  72 +
  73 + public void handle(List<GpsEntity> list) {
  74 + try {
  75 + if (list.size() == 0)
  76 + return;
  77 + lastTime = System.currentTimeMillis();
  78 + //按设备号分组数据(一个设备的多条数据,必须在一个线程里跑)
  79 + ArrayListMultimap multimap = ArrayListMultimap.create();
  80 + for (GpsEntity gps : list) {
  81 + multimap.put(gps.getDeviceId(), gps);
  82 + }
  83 + List<String> deviceList = new ArrayList<>(multimap.keySet());
  84 +
  85 + //数据均分给线程
  86 + ArrayListMultimap dataListMap = ArrayListMultimap.create();
  87 + int size = deviceList.size(), threadIndex = 0, threadSize = size / POOL_SIZE;
  88 + if(threadSize==0)
  89 + threadSize = size;
  90 + for (int i = 0; i < size; i++) {
  91 + if (i % threadSize == 0)
  92 + threadIndex++;
  93 + dataListMap.putAll(threadIndex, multimap.get(deviceList.get(i)));
  94 + }
  95 + Set<Integer> ks = dataListMap.keySet();
  96 + logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size());
  97 + CountDownLatch count = new CountDownLatch(ks.size());
  98 +
  99 + logger.info(JSON.toJSONString(ks));
  100 + for (Integer index : ks) {
  101 + threadPool.execute(new SignalHandleThread(dataListMap.get(index), count));
  102 + }
  103 +
  104 +
  105 + //等待子线程结束
  106 + boolean isNormal = count.await(5000, TimeUnit.MILLISECONDS);
  107 + if (!isNormal) {
  108 + try {
  109 + //发送邮件
  110 + EmailBean mail = new EmailBean();
  111 + mail.setSubject("线调GPS处理");
  112 + mail.setContent("GPS处理超时,检查日志信息<br/>");
  113 + sendEmailController.sendMail("113252620@qq.com", mail);
  114 + logger.info(new ObjectMapper().writeValueAsString(list));
  115 + logger.info("DataHandlerProcess:邮件发送成功!");
  116 + } catch (Exception e){
  117 + logger.error("DataHandlerProcess:邮件发送失败!",e);
  118 + }
  119 + }
  120 +
  121 + //加入实时gps对照
  122 + for (GpsEntity gps : list)
  123 + gpsRealData.put(gps);
  124 +
  125 + logger.info("time , " + (System.currentTimeMillis() - lastTime));
  126 + } catch (Exception e) {
  127 + logger.error("", e);
  128 + }
  129 + }
  130 +
  131 + static GpsComp comp = new GpsComp();
  132 +
  133 + public class SignalHandleThread implements Runnable {
  134 +
  135 + List<GpsEntity> list;
  136 + CountDownLatch count;
  137 +
  138 + SignalHandleThread(List<GpsEntity> gpsList, CountDownLatch count) {
  139 + this.list = gpsList;
  140 + this.count = count;
  141 + }
  142 +
  143 + @Override
  144 + public void run() {
  145 + long start = System.currentTimeMillis();
  146 + try {
  147 + Collections.sort(list, comp);
  148 + GpsEntity gps;
  149 + for(int i = 0,len = list.size(); i< len ;i ++){
  150 + if (Thread.currentThread().isInterrupted()) break;
  151 + gps = list.get(i);
  152 +
  153 + try {
  154 + if (StringUtils.isEmpty(gps.getNbbm()))
  155 + continue;
  156 + if (Math.abs(gps.getTimestamp() - gps.getServerTimestamp()) > 1000 * 60 * 20)
  157 + continue;
  158 +
  159 + gpsStateProcess.process(gps);//状态处理
  160 + stationInsideProcess.process(gps);//场站内外判定
  161 + reverseRouteProcess.process(gps);//反向路由处理
  162 + abnormalStateProcess.process(gps);//超速越界
  163 +
  164 + inStationProcess.process(gps);//进站
  165 + outStationProcess.process(gps);//出站
  166 +
  167 +
  168 + GpsCacheData.putGps(gps);//历史gps缓存
  169 + } catch (Throwable e) {
  170 + logger.error("SignalHandleThread.run1", e);
  171 + }
  172 + }
  173 + } catch (Exception e) {
  174 + logger.error("SignalHandleThread.run2", e);
  175 + } finally {
  176 + if (count != null)
  177 + count.countDown();
  178 +
  179 + StringBuilder sb = new StringBuilder();
  180 + sb.append("list size:").append(list.size()).append(" cost:").append(System.currentTimeMillis() - start);
  181 + logger.info(sb.toString());
  182 + }
  183 + }
  184 + }
  185 +
  186 + public static class GpsComp implements Comparator<GpsEntity> {
  187 +
  188 + @Override
  189 + public int compare(GpsEntity g1, GpsEntity g2) {
  190 + return g1.getTimestamp().compareTo(g2.getTimestamp());
  191 + }
  192 + }
213 } 193 }
214 \ No newline at end of file 194 \ No newline at end of file
src/main/java/com/bsth/data/gpsdata_v2/cache/GpsCacheData.java
1 -package com.bsth.data.gpsdata_v2.cache;  
2 -  
3 -import com.bsth.data.gpsdata_v2.entity.GpsEntity;  
4 -import com.bsth.data.gpsdata_v2.entity.StationRoute;  
5 -import com.bsth.data.gpsdata_v2.entity.trail.GpsExecTrail;  
6 -import com.bsth.data.gpsdata_v2.utils.CircleQueue;  
7 -import com.google.common.collect.ArrayListMultimap;  
8 -import org.slf4j.Logger;  
9 -import org.slf4j.LoggerFactory;  
10 -  
11 -import java.util.*;  
12 -import java.util.concurrent.ConcurrentHashMap;  
13 -import java.util.concurrent.ConcurrentMap;  
14 -  
15 -/**  
16 - * gps 数据缓存  
17 - * Created by panzhao on 2017/11/15.  
18 - */  
19 -public class GpsCacheData {  
20 -  
21 - /**  
22 - * 每辆车缓存最后200条gps  
23 - */  
24 - private static final int CACHE_SIZE = 200;  
25 - private static ConcurrentMap<String, CircleQueue<GpsEntity>> gpsCacheMap = new ConcurrentHashMap<>();  
26 -  
27 - /**  
28 - * 车辆执行班次的详细 进出站数据  
29 - */  
30 - private static ArrayListMultimap<String, GpsExecTrail> trailListMultimap = ArrayListMultimap.create();  
31 -  
32 - static Logger logger = LoggerFactory.getLogger(GpsCacheData.class);  
33 -  
34 - public static CircleQueue<GpsEntity> getGps(String device) {  
35 - return gpsCacheMap.get(device);  
36 - }  
37 -  
38 - /**  
39 - * 清除车辆的轨迹数据  
40 - * @param nbbm  
41 - */  
42 - public static void remove(String nbbm){  
43 - //logger.info("清除车辆到离站轨迹, " + nbbm);  
44 - trailListMultimap.removeAll(nbbm);  
45 - }  
46 -  
47 - public static GpsExecTrail gpsExecTrail(String nbbm){  
48 - List<GpsExecTrail> list = trailListMultimap.get(nbbm);  
49 -  
50 - GpsExecTrail trail;  
51 - if(null == list || list.size() == 0  
52 - || list.get(list.size() - 1).isEnd()){  
53 - trail = new GpsExecTrail();  
54 -  
55 - trailListMultimap.put(nbbm, trail);  
56 - }  
57 - else{  
58 - trail = list.get(list.size() - 1);  
59 - }  
60 -  
61 - return trail;  
62 - }  
63 -  
64 - public static void out(GpsEntity gps){  
65 - GpsExecTrail trail = gpsExecTrail(gps.getNbbm());  
66 - trail.getSrs().add(gps);  
67 -  
68 - }  
69 -  
70 - public static void in(GpsEntity gps, boolean end){  
71 - GpsExecTrail trail = gpsExecTrail(gps.getNbbm());  
72 - trail.getSrs().add(gps);  
73 - trail.setEnd(end);  
74 - }  
75 -  
76 - public static GpsEntity getPrev(GpsEntity gps){  
77 - CircleQueue<GpsEntity> queue = gpsCacheMap.get(gps.getDeviceId());  
78 - if(queue != null)  
79 - return queue.getTail();  
80 - return null;  
81 - }  
82 -  
83 - public static void putGps(GpsEntity gps) {  
84 - CircleQueue<GpsEntity> queue = gpsCacheMap.get(gps.getDeviceId());  
85 - if (queue == null) {  
86 - queue = new CircleQueue<>(CACHE_SIZE);  
87 - gpsCacheMap.put(gps.getDeviceId(), queue);  
88 - }  
89 - queue.add(gps);  
90 - }  
91 -  
92 - public static void clear(String deviceId) {  
93 - try {  
94 - CircleQueue<GpsEntity> queue = gpsCacheMap.get(deviceId);  
95 - if (queue != null)  
96 - queue.clear();  
97 - } catch (Exception e) {  
98 - logger.error("", e);  
99 - }  
100 - }  
101 -  
102 - public static StationRoute prevStation(GpsEntity gps) {  
103 - List<GpsExecTrail> trails = trailListMultimap.get(gps.getNbbm());  
104 - if(null == trails || trails.size() == 0)  
105 - return null;  
106 -  
107 - GpsEntity prev;  
108 - for(int i = trails.size() - 1; i > 0; i--){  
109 - prev = trails.get(i).getSrs().peekLast();  
110 -  
111 - if(prev != null){  
112 - return GeoCacheData.getRouteCode(prev);  
113 - }  
114 - }  
115 - return null;  
116 - }  
117 -  
118 - /**  
119 - * 最后一段轨迹  
120 - * @param gps  
121 - * @return  
122 - */  
123 - public static int lastInTrailsSize(GpsEntity gps) {  
124 - //int size = 0;  
125 - List<GpsExecTrail> trails = trailListMultimap.get(gps.getNbbm());  
126 - if(null == trails || trails.size() == 0)  
127 - return 0;  
128 -  
129 - GpsExecTrail gs = trails.get(trails.size() - 1);  
130 - if(gs.isEnd())  
131 - return 0;  
132 -  
133 - Set<String> set = new HashSet<>();  
134 - for(GpsEntity g : gs.getSrs()){  
135 - if(g.getInstation() == 1)  
136 - set.add(g.getStation().getName());  
137 - }  
138 - return set.size();  
139 - }  
140 -  
141 - public static List<StationRoute> prevMultiStation(GpsEntity gps) {  
142 - List<StationRoute> rs = new ArrayList<>();  
143 - List<GpsExecTrail> trails = trailListMultimap.get(gps.getNbbm());  
144 - if(null == trails || trails.size() == 0)  
145 - return null;  
146 -  
147 - for(int i = trails.size() - 1; i > 0; i--){  
148 - rs.addAll(searchLinked(trails.get(i).getSrs(), gps.getUpDown()));  
149 - if(rs.size() > 3)  
150 - break;  
151 - }  
152 - return rs;  
153 - }  
154 -  
155 - private static List<StationRoute> searchLinked(LinkedList<GpsEntity> list, int upDown){  
156 - List<StationRoute> rs = new ArrayList<>();  
157 -  
158 - GpsEntity gps;  
159 - int prevCode=0;  
160 - for(int i = list.size() - 1; i > 0; i --){  
161 - gps = list.get(i);  
162 - if(gps.getInstation()!=1)  
163 - continue;  
164 -  
165 - if(gps.getUpDown() != upDown)  
166 - break;  
167 -  
168 - if(gps.getStation().getRouteSort() != prevCode)  
169 - rs.add(gps.getStation());  
170 -  
171 - prevCode = gps.getStation().getRouteSort();  
172 -  
173 - if(rs.size() >= 3)  
174 - break;  
175 - }  
176 - return rs;  
177 - }  
178 -} 1 +package com.bsth.data.gpsdata_v2.cache;
  2 +
  3 +import com.bsth.data.gpsdata_v2.entity.GpsEntity;
  4 +import com.bsth.data.gpsdata_v2.entity.StationRoute;
  5 +import com.bsth.data.gpsdata_v2.entity.trail.GpsExecTrail;
  6 +import com.bsth.data.gpsdata_v2.utils.CircleQueue;
  7 +import com.google.common.collect.ArrayListMultimap;
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
  10 +
  11 +import java.util.*;
  12 +import java.util.concurrent.ConcurrentHashMap;
  13 +import java.util.concurrent.ConcurrentMap;
  14 +import java.util.concurrent.CopyOnWriteArrayList;
  15 +
  16 +/**
  17 + * gps 数据缓存
  18 + * Created by panzhao on 2017/11/15.
  19 + */
  20 +public class GpsCacheData {
  21 +
  22 + /**
  23 + * 每辆车缓存最后200条gps
  24 + */
  25 + private static final int CACHE_SIZE = 200;
  26 + private static ConcurrentMap<String, CircleQueue<GpsEntity>> gpsCacheMap = new ConcurrentHashMap<>();
  27 +
  28 + /**
  29 + * 车辆执行班次的详细 进出站数据
  30 + */
  31 + //private static ArrayListMultimap<String, GpsExecTrail> trailListMultimap = ArrayListMultimap.create();
  32 + private static Map<String, List<GpsExecTrail>> trailListMultimap = new ConcurrentHashMap<>();
  33 +
  34 + static Logger logger = LoggerFactory.getLogger(GpsCacheData.class);
  35 +
  36 + public static CircleQueue<GpsEntity> getGps(String device) {
  37 + return gpsCacheMap.get(device);
  38 + }
  39 +
  40 + /**
  41 + * 清除车辆的轨迹数据
  42 + * @param nbbm
  43 + */
  44 + public static void remove(String nbbm){
  45 + //logger.info("清除车辆到离站轨迹, " + nbbm);
  46 + trailListMultimap.remove(nbbm);
  47 + }
  48 +
  49 + public static GpsExecTrail gpsExecTrail(String nbbm){
  50 + List<GpsExecTrail> list = trailListMultimap.get(nbbm);
  51 +
  52 + GpsExecTrail trail;
  53 + if (null == list || list.size() == 0 || list.get(list.size() - 1).isEnd()) {
  54 + if (null == list) {
  55 + list = new CopyOnWriteArrayList<>();
  56 + trailListMultimap.put(nbbm, list);
  57 + }
  58 + trail = new GpsExecTrail();
  59 + list.add(trail);
  60 + } else{
  61 + trail = list.get(list.size() - 1);
  62 + }
  63 +
  64 + return trail;
  65 + }
  66 +
  67 + public static void out(GpsEntity gps){
  68 + GpsExecTrail trail = gpsExecTrail(gps.getNbbm());
  69 + trail.getSrs().add(gps);
  70 +
  71 + }
  72 +
  73 + public static void in(GpsEntity gps, boolean end){
  74 + GpsExecTrail trail = gpsExecTrail(gps.getNbbm());
  75 + trail.getSrs().add(gps);
  76 + trail.setEnd(end);
  77 + }
  78 +
  79 + public static GpsEntity getPrev(GpsEntity gps){
  80 + CircleQueue<GpsEntity> queue = gpsCacheMap.get(gps.getDeviceId());
  81 + if(queue != null)
  82 + return queue.getTail();
  83 + return null;
  84 + }
  85 +
  86 + public static void putGps(GpsEntity gps) {
  87 + CircleQueue<GpsEntity> queue = gpsCacheMap.get(gps.getDeviceId());
  88 + if (queue == null) {
  89 + queue = new CircleQueue<>(CACHE_SIZE);
  90 + gpsCacheMap.put(gps.getDeviceId(), queue);
  91 + }
  92 + queue.add(gps);
  93 + }
  94 +
  95 + public static void clear(String deviceId) {
  96 + try {
  97 + CircleQueue<GpsEntity> queue = gpsCacheMap.get(deviceId);
  98 + if (queue != null)
  99 + queue.clear();
  100 + } catch (Exception e) {
  101 + logger.error("", e);
  102 + }
  103 + }
  104 +
  105 + public static StationRoute prevStation(GpsEntity gps) {
  106 + List<GpsExecTrail> trails = trailListMultimap.get(gps.getNbbm());
  107 + if(null == trails || trails.size() == 0)
  108 + return null;
  109 +
  110 + GpsEntity prev;
  111 + for(int i = trails.size() - 1; i > 0; i--){
  112 + prev = trails.get(i).getSrs().peekLast();
  113 +
  114 + if(prev != null){
  115 + return GeoCacheData.getRouteCode(prev);
  116 + }
  117 + }
  118 + return null;
  119 + }
  120 +
  121 + /**
  122 + * 最后一段轨迹
  123 + * @param gps
  124 + * @return
  125 + */
  126 + public static int lastInTrailsSize(GpsEntity gps) {
  127 + //int size = 0;
  128 + List<GpsExecTrail> trails = trailListMultimap.get(gps.getNbbm());
  129 + if(null == trails || trails.size() == 0)
  130 + return 0;
  131 +
  132 + GpsExecTrail gs = trails.get(trails.size() - 1);
  133 + if(gs.isEnd())
  134 + return 0;
  135 +
  136 + Set<String> set = new HashSet<>();
  137 + for(GpsEntity g : gs.getSrs()){
  138 + if(g.getInstation() == 1)
  139 + set.add(g.getStation().getName());
  140 + }
  141 + return set.size();
  142 + }
  143 +
  144 + public static List<StationRoute> prevMultiStation(GpsEntity gps) {
  145 + List<StationRoute> rs = new ArrayList<>();
  146 + List<GpsExecTrail> trails = trailListMultimap.get(gps.getNbbm());
  147 + if(null == trails || trails.size() == 0)
  148 + return null;
  149 +
  150 + for(int i = trails.size() - 1; i > 0; i--){
  151 + rs.addAll(searchLinked(trails.get(i).getSrs(), gps.getUpDown()));
  152 + if(rs.size() > 3)
  153 + break;
  154 + }
  155 + return rs;
  156 + }
  157 +
  158 + private static List<StationRoute> searchLinked(LinkedList<GpsEntity> list, int upDown){
  159 + List<StationRoute> rs = new ArrayList<>();
  160 +
  161 + GpsEntity gps;
  162 + int prevCode=0;
  163 + for(int i = list.size() - 1; i > 0; i --){
  164 + gps = list.get(i);
  165 + if(gps.getInstation()!=1)
  166 + continue;
  167 +
  168 + if(gps.getUpDown() != upDown)
  169 + break;
  170 +
  171 + if(gps.getStation().getRouteSort() != prevCode)
  172 + rs.add(gps.getStation());
  173 +
  174 + prevCode = gps.getStation().getRouteSort();
  175 +
  176 + if(rs.size() >= 3)
  177 + break;
  178 + }
  179 + return rs;
  180 + }
  181 +}
src/main/java/com/bsth/data/gpsdata_v2/rfid/RfidHttpLoader.java 0 → 100644
  1 +package com.bsth.data.gpsdata_v2.rfid;
  2 +
  3 +import com.bsth.data.gpsdata_v2.rfid.entity.RfidInfo;
  4 +import com.bsth.util.ConfigUtil;
  5 +import com.fasterxml.jackson.databind.ObjectMapper;
  6 +import org.apache.tomcat.util.http.fileupload.IOUtils;
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +
  10 +import java.io.ByteArrayOutputStream;
  11 +import java.io.IOException;
  12 +import java.io.InputStream;
  13 +import java.io.OutputStream;
  14 +import java.net.HttpURLConnection;
  15 +import java.net.URL;
  16 +import java.util.ArrayList;
  17 +import java.util.List;
  18 +
  19 +/**
  20 + * @author hill
  21 + * @date
  22 + */
  23 +public class RfidHttpLoader {
  24 +
  25 + private final static Logger log = LoggerFactory.getLogger(RfidHttpLoader.class);
  26 +
  27 + private static String RFID_URL = ConfigUtil.get("http.rfid.url");
  28 +
  29 + public static List<RfidInfo> load() {
  30 + List<RfidInfo> result = new ArrayList<>();
  31 +
  32 + InputStream in = null;
  33 + OutputStream out = null;
  34 + HttpURLConnection con = null;
  35 + long start = System.currentTimeMillis();
  36 + try {
  37 + con = (HttpURLConnection)new URL(RFID_URL).openConnection();
  38 + con.setRequestMethod("GET");
  39 + con.setRequestProperty("keep-alive", "true");
  40 + con.setRequestProperty("accept", "application/json");
  41 + con.setRequestProperty("content-type", "application/json");
  42 + con.setDoInput(true);
  43 + con.setDoOutput(true);
  44 + con.setReadTimeout(5000);
  45 + con.setConnectTimeout(5000);
  46 +
  47 + in = con.getInputStream();
  48 + ByteArrayOutputStream bout = new ByteArrayOutputStream();
  49 + IOUtils.copy(in, bout); bout.close();
  50 + if (con.getResponseCode() == 200) {
  51 + ObjectMapper mapper = new ObjectMapper();
  52 + List<RfidInfo> list = mapper.readValue(bout.toByteArray(), mapper.getTypeFactory().constructParametrizedType(List.class, List.class, RfidInfo.class));
  53 + if (list != null) {
  54 + result.addAll(list);
  55 + }
  56 + } else {
  57 + log.info(new String(bout.toByteArray()));
  58 + }
  59 + } catch (Exception e) {
  60 + log.error("处理异常", e);
  61 + } finally {
  62 + con.disconnect();
  63 + try {
  64 + if (in != null) {
  65 + in.close();
  66 + }
  67 + if (out != null) {
  68 + out.close();
  69 + }
  70 + } catch (IOException e) {
  71 + // TODO Auto-generated catch block
  72 + e.printStackTrace();
  73 + }
  74 + }
  75 +
  76 + return result;
  77 + }
  78 +}
src/main/java/com/bsth/data/gpsdata_v2/rfid/entity/EmployeeCard.java 0 → 100644
  1 +package com.bsth.data.gpsdata_v2.rfid.entity;
  2 +
  3 +/**
  4 + * @author hill
  5 + * @date
  6 + */
  7 +public class EmployeeCard {
  8 +
  9 + private String licenseUid;
  10 +
  11 + private String licenseNo;
  12 +
  13 + private int counter;
  14 +
  15 + public String getLicenseUid() {
  16 + return licenseUid;
  17 + }
  18 +
  19 + public void setLicenseUid(String licenseUid) {
  20 + this.licenseUid = licenseUid;
  21 + }
  22 +
  23 + public String getLicenseNo() {
  24 + return licenseNo;
  25 + }
  26 +
  27 + public void setLicenseNo(String licenseNo) {
  28 + this.licenseNo = licenseNo;
  29 + }
  30 +
  31 + public int getCounter() {
  32 + return counter;
  33 + }
  34 +
  35 + public void setCounter(int counter) {
  36 + this.counter = counter;
  37 + }
  38 +}
src/main/java/com/bsth/data/gpsdata_v2/rfid/entity/InoutStation.java 0 → 100644
  1 +package com.bsth.data.gpsdata_v2.rfid.entity;
  2 +
  3 +/**
  4 + * @author hill
  5 + * @date
  6 + */
  7 +public class InoutStation {
  8 +
  9 + private String nbbm;
  10 +
  11 + //进出站 1进 0出
  12 + private int inout;
  13 +
  14 + private long timestamp;
  15 +
  16 + public String getNbbm() {
  17 + return nbbm;
  18 + }
  19 +
  20 + public void setNbbm(String nbbm) {
  21 + this.nbbm = nbbm;
  22 + }
  23 +
  24 + public int getInout() {
  25 + return inout;
  26 + }
  27 +
  28 + public void setInout(int inout) {
  29 + this.inout = inout;
  30 + }
  31 +
  32 + public long getTimestamp() {
  33 + return timestamp;
  34 + }
  35 +
  36 + public void setTimestamp(long timestamp) {
  37 + this.timestamp = timestamp;
  38 + }
  39 +}
src/main/java/com/bsth/data/gpsdata_v2/rfid/entity/RfidInfo.java 0 → 100644
  1 +package com.bsth.data.gpsdata_v2.rfid.entity;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  4 +
  5 +import java.util.Date;
  6 +
  7 +@JsonIgnoreProperties(ignoreUnknown = true)
  8 +public class RfidInfo {
  9 +
  10 + // 车卡(副证 UID)
  11 + private String labelid;
  12 + // 标签状态
  13 + private int labelstate;
  14 + // 插卡状态
  15 + private int addIn;
  16 + // 车辆内部编码
  17 + private String nbbm;
  18 + // 时标时间
  19 + private Date recogTime;
  20 + // 线路编码
  21 + private String xlbm;
  22 + // 线路名称
  23 + private String xlmc;
  24 + // 员工工号
  25 + private String yggh;
  26 + // 站点编号(基站编号)
  27 + private String stationCode;
  28 + // 站点名称(基站名称)
  29 + private String stationName;
  30 + // 人卡信息
  31 + private EmployeeCard employeeCard;
  32 + // 进出信息
  33 + private InoutStation inoutStation;
  34 +
  35 + public String getLabelid() {
  36 + return labelid;
  37 + }
  38 +
  39 + public void setLabelid(String labelid) {
  40 + this.labelid = labelid;
  41 + }
  42 +
  43 + public int getLabelstate() {
  44 + return labelstate;
  45 + }
  46 +
  47 + public void setLabelstate(int labelstate) {
  48 + this.labelstate = labelstate;
  49 + }
  50 +
  51 + public int getAddIn() {
  52 + return addIn;
  53 + }
  54 +
  55 + public void setAddIn(int addIn) {
  56 + this.addIn = addIn;
  57 + }
  58 +
  59 + public String getNbbm() {
  60 + return nbbm;
  61 + }
  62 +
  63 + public void setNbbm(String nbbm) {
  64 + this.nbbm = nbbm;
  65 + }
  66 +
  67 + public Date getRecogTime() {
  68 + return recogTime;
  69 + }
  70 +
  71 + public void setRecogTime(Date recogTime) {
  72 + this.recogTime = recogTime;
  73 + }
  74 +
  75 + public String getXlbm() {
  76 + return xlbm;
  77 + }
  78 +
  79 + public void setXlbm(String xlbm) {
  80 + this.xlbm = xlbm;
  81 + }
  82 +
  83 + public String getXlmc() {
  84 + return xlmc;
  85 + }
  86 +
  87 + public void setXlmc(String xlmc) {
  88 + this.xlmc = xlmc;
  89 + }
  90 +
  91 + public String getYggh() {
  92 + return yggh;
  93 + }
  94 +
  95 + public void setYggh(String yggh) {
  96 + this.yggh = yggh;
  97 + }
  98 +
  99 + public String getStationCode() {
  100 + return stationCode;
  101 + }
  102 +
  103 + public void setStationCode(String stationCode) {
  104 + this.stationCode = stationCode;
  105 + }
  106 +
  107 + public String getStationName() {
  108 + return stationName;
  109 + }
  110 +
  111 + public void setStationName(String stationName) {
  112 + this.stationName = stationName;
  113 + }
  114 +
  115 + public EmployeeCard getEmployeeCard() {
  116 + return employeeCard;
  117 + }
  118 +
  119 + public void setEmployeeCard(EmployeeCard employeeCard) {
  120 + this.employeeCard = employeeCard;
  121 + }
  122 +
  123 + public InoutStation getInoutStation() {
  124 + return inoutStation;
  125 + }
  126 +
  127 + public void setInoutStation(InoutStation inoutStation) {
  128 + this.inoutStation = inoutStation;
  129 + }
  130 +}
src/main/java/com/bsth/data/gpsdata_v2/rfid/handle/RfidDataHandler.java 0 → 100644
  1 +package com.bsth.data.gpsdata_v2.rfid.handle;
  2 +
  3 +import com.bsth.data.gpsdata_v2.rfid.entity.RfidInfo;
  4 +import com.bsth.data.gpsdata_v2.rfid.entity.RfidInoutStation;
  5 +import com.bsth.data.gpsdata_v2.status_manager.GpsStatusManager;
  6 +import com.bsth.data.msg_queue.DirectivePushQueue;
  7 +import com.bsth.data.schedule.DayOfSchedule;
  8 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  9 +import com.bsth.websocket.handler.SendUtils;
  10 +import org.apache.commons.lang3.StringUtils;
  11 +import org.slf4j.Logger;
  12 +import org.slf4j.LoggerFactory;
  13 +import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.stereotype.Component;
  15 +
  16 +import java.util.Iterator;
  17 +import java.util.List;
  18 +import java.util.Map;
  19 +import java.util.concurrent.ConcurrentHashMap;
  20 +
  21 +/**
  22 + * RFID信号处理
  23 + * Created by panzhao on 2017/11/22.
  24 + */
  25 +@Component
  26 +public class RfidDataHandler {
  27 +
  28 + @Autowired
  29 + private SendUtils sendUtils;
  30 +
  31 + @Autowired
  32 + private DayOfSchedule dayOfSchedule;
  33 +
  34 + private final static Logger logger = LoggerFactory.getLogger(RfidDataHandler.class);
  35 +
  36 + private Map<String, RfidInfo> nbbm2rfid = new ConcurrentHashMap<>();
  37 +
  38 + /**
  39 + *
  40 + * @param list
  41 + */
  42 + public void handle(List<RfidInfo> list){
  43 + for (RfidInfo ri : list) {
  44 + RfidInfo rfidInfo = nbbm2rfid.get(ri.getNbbm());
  45 + if (rfidInfo == null || rfidInfo.getRecogTime().getTime() != ri.getRecogTime().getTime()) {
  46 + nbbm2rfid.put(ri.getNbbm(), ri);
  47 + ScheduleRealInfo scheduleRealInfo = dayOfSchedule.executeCurr(ri.getNbbm());
  48 + if (scheduleRealInfo == null) {
  49 + continue;
  50 + }
  51 + int state = 0;
  52 + if (ri.getLabelid() != null) {
  53 + state |= 1;
  54 + }
  55 + if (ri.getEmployeeCard() != null) {
  56 + state |= 2;
  57 + }
  58 + if (scheduleRealInfo.getRfidState() != state) {
  59 + scheduleRealInfo.setRfidState(state);
  60 + sendUtils.sendRfid(scheduleRealInfo);
  61 + }
  62 + }
  63 + }
  64 +
  65 + checkValid();
  66 + }
  67 +
  68 + /**
  69 + * 检查rfid状态是否有效,超过5分钟的rfid信号标记为无效
  70 + */
  71 + private void checkValid() {
  72 + Iterator<Map.Entry<String, RfidInfo>> iterator = nbbm2rfid.entrySet().iterator();
  73 + for (;iterator.hasNext();) {
  74 + Map.Entry<String, RfidInfo> entry = iterator.next();
  75 + RfidInfo ri = entry.getValue();
  76 + if (ri.getRecogTime() != null && ri.getRecogTime().getTime() < System.currentTimeMillis() - 300000) {
  77 + ScheduleRealInfo scheduleRealInfo = dayOfSchedule.executeCurr(ri.getNbbm());
  78 + if (scheduleRealInfo == null) {
  79 + continue;
  80 + }
  81 + if (scheduleRealInfo.getRfidState() != 0) {
  82 + scheduleRealInfo.setRfidState(0);
  83 + sendUtils.sendRfid(scheduleRealInfo);
  84 + }
  85 + }
  86 + }
  87 + }
  88 +}
0 \ No newline at end of file 89 \ No newline at end of file
src/main/java/com/bsth/data/gpsdata_v2/thread/RfidDataLoaderThread.java 0 → 100644
  1 +package com.bsth.data.gpsdata_v2.thread;
  2 +
  3 +import com.bsth.data.gpsdata_v2.DataHandleProcess;
  4 +import com.bsth.data.gpsdata_v2.rfid.RfidHttpLoader;
  5 +import com.bsth.data.gpsdata_v2.rfid.entity.RfidInfo;
  6 +import com.bsth.data.gpsdata_v2.rfid.handle.RfidDataHandler;
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.stereotype.Component;
  11 +
  12 +import java.util.List;
  13 +
  14 +@Component
  15 +public class RfidDataLoaderThread extends Thread {
  16 +
  17 + private final static Logger logger = LoggerFactory.getLogger(RfidDataLoaderThread.class);
  18 +
  19 + @Autowired
  20 + RfidDataHandler handleProcess;
  21 +
  22 + @Override
  23 + public void run() {
  24 + try {
  25 + List<RfidInfo> list = RfidHttpLoader.load();
  26 +
  27 + if (null != list && list.size() > 0) {
  28 + handleProcess.handle(list);
  29 + }
  30 + } catch (Exception e) {
  31 + logger.error("", e);
  32 + }
  33 + }
  34 +}
0 \ No newline at end of file 35 \ No newline at end of file
src/main/java/com/bsth/data/safe_driv/SafeDrivCenter.java
@@ -45,8 +45,10 @@ public class SafeDrivCenter implements ApplicationContextAware { @@ -45,8 +45,10 @@ public class SafeDrivCenter implements ApplicationContextAware {
45 private static DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS"); 45 private static DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS");
46 public static void put(SafeDriv sd){ 46 public static void put(SafeDriv sd){
47 sd.setTs(fmt.parseMillis(sd.getStartime())); 47 sd.setTs(fmt.parseMillis(sd.getStartime()));
48 -  
49 - if(sd.getYczltype().indexOf("A") == -1) 48 + if(Integer.parseInt(sd.getYczltype()) == 5 && Integer.parseInt(sd.getJctype()) == 4
  49 + || Integer.parseInt(sd.getYczltype()) == 6 && Integer.parseInt(sd.getJctype()) == 4)
  50 + sd.setJctype("B" + sd.getJctype());
  51 + else if(sd.getYczltype().indexOf("A") == -1)
50 sd.setYczltype("A" + sd.getYczltype()); 52 sd.setYczltype("A" + sd.getYczltype());
51 53
52 //SafeDriv old = safeMap.get(sd.getClzbh()); 54 //SafeDriv old = safeMap.get(sd.getClzbh());
src/main/java/com/bsth/data/safe_driv/SafeDrivDataLoadThread.java
@@ -33,7 +33,7 @@ public class SafeDrivDataLoadThread extends Thread { @@ -33,7 +33,7 @@ public class SafeDrivDataLoadThread extends Thread {
33 static BufferedReader br; 33 static BufferedReader br;
34 34
35 static { 35 static {
36 - url = "http://211.95.61.66:9007/bsth-safedriving/Crlcxb/realtimeInterface.do"; 36 + url = "http://211.95.61.66:9008/safedriving/realtimeInterface";
37 httpClient = HttpClients.createDefault(); 37 httpClient = HttpClients.createDefault();
38 get = new HttpGet(url); 38 get = new HttpGet(url);
39 requestConfig = RequestConfig.custom() 39 requestConfig = RequestConfig.custom()
src/main/java/com/bsth/entity/calc/CalcInterval.java
@@ -33,8 +33,10 @@ public class CalcInterval { @@ -33,8 +33,10 @@ public class CalcInterval {
33 private String xlName; 33 private String xlName;
34 /*大间隔等级*/ 34 /*大间隔等级*/
35 private String level; 35 private String level;
36 - /*等级具体时间*/  
37 - private Double levelTime; 36 + /*等级具体时间(高峰)*/
  37 + private double levelTime;
  38 + /*等级具体时间(低谷)*/
  39 + private double levelTime2;
38 /*全日大间隔次数*/ 40 /*全日大间隔次数*/
39 private Integer djgAll; 41 private Integer djgAll;
40 /*高峰大间隔次数*/ 42 /*高峰大间隔次数*/
@@ -45,14 +47,22 @@ public class CalcInterval { @@ -45,14 +47,22 @@ public class CalcInterval {
45 private Integer djgWgf; 47 private Integer djgWgf;
46 /*低谷大间隔次数*/ 48 /*低谷大间隔次数*/
47 private Integer djgDg; 49 private Integer djgDg;
  50 + /*班次数*/
  51 + private Integer bcs;
48 /*最大间隔时间*/ 52 /*最大间隔时间*/
49 private Integer djgTime; 53 private Integer djgTime;
50 - /*全日班次数*/  
51 - private Integer bcs;  
52 /*数据创建时间*/ 54 /*数据创建时间*/
53 private Date createtime; 55 private Date createtime;
54 /*数据修改时间*/ 56 /*数据修改时间*/
55 private Date updatetime; 57 private Date updatetime;
  58 + /*高峰大间隔标准*/
  59 + private Integer gfMax;
  60 + /*低谷大间隔标准*/
  61 + private Integer dgMax;
  62 + /*夜班大间隔标准*/
  63 + private Integer ybMax;
  64 + /*是否营运线路 */
  65 + private boolean sfyy;
56 66
57 /*公司名字*/ 67 /*公司名字*/
58 @Transient 68 @Transient
@@ -60,6 +70,7 @@ public class CalcInterval { @@ -60,6 +70,7 @@ public class CalcInterval {
60 /*分公司名字*/ 70 /*分公司名字*/
61 @Transient 71 @Transient
62 private String fgsname; 72 private String fgsname;
  73 +
63 public Long getId() { 74 public Long getId() {
64 return id; 75 return id;
65 } 76 }
@@ -102,10 +113,10 @@ public class CalcInterval { @@ -102,10 +113,10 @@ public class CalcInterval {
102 public void setLevel(String level) { 113 public void setLevel(String level) {
103 this.level = level; 114 this.level = level;
104 } 115 }
105 - public Double getLevelTime() { 116 + public double getLevelTime() {
106 return levelTime; 117 return levelTime;
107 } 118 }
108 - public void setLevelTime(Double levelTime) { 119 + public void setLevelTime(double levelTime) {
109 this.levelTime = levelTime; 120 this.levelTime = levelTime;
110 } 121 }
111 public Integer getDjgAll() { 122 public Integer getDjgAll() {
@@ -139,18 +150,18 @@ public class CalcInterval { @@ -139,18 +150,18 @@ public class CalcInterval {
139 public void setDjgDg(Integer djgDg) { 150 public void setDjgDg(Integer djgDg) {
140 this.djgDg = djgDg; 151 this.djgDg = djgDg;
141 } 152 }
142 - public Integer getDjgTime() {  
143 - return djgTime;  
144 - }  
145 - public void setDjgTime(Integer djgTime) {  
146 - this.djgTime = djgTime;  
147 - }  
148 public Integer getBcs() { 153 public Integer getBcs() {
149 return bcs; 154 return bcs;
150 } 155 }
151 public void setBcs(Integer bcs) { 156 public void setBcs(Integer bcs) {
152 this.bcs = bcs; 157 this.bcs = bcs;
153 } 158 }
  159 + public Integer getDjgTime() {
  160 + return djgTime;
  161 + }
  162 + public void setDjgTime(Integer djgTime) {
  163 + this.djgTime = djgTime;
  164 + }
154 public Date getCreatetime() { 165 public Date getCreatetime() {
155 return createtime; 166 return createtime;
156 } 167 }
@@ -163,6 +174,36 @@ public class CalcInterval { @@ -163,6 +174,36 @@ public class CalcInterval {
163 public void setUpdatetime(Date updatetime) { 174 public void setUpdatetime(Date updatetime) {
164 this.updatetime = updatetime; 175 this.updatetime = updatetime;
165 } 176 }
  177 + public double getLevelTime2() {
  178 + return levelTime2;
  179 + }
  180 + public void setLevelTime2(double levelTime2) {
  181 + this.levelTime2 = levelTime2;
  182 + }
  183 + public Integer getGfMax() {
  184 + return gfMax;
  185 + }
  186 + public void setGfMax(Integer gfMax) {
  187 + this.gfMax = gfMax;
  188 + }
  189 + public Integer getDgMax() {
  190 + return dgMax;
  191 + }
  192 + public void setDgMax(Integer dgMax) {
  193 + this.dgMax = dgMax;
  194 + }
  195 + public Integer getYbMax() {
  196 + return ybMax;
  197 + }
  198 + public void setYbMax(Integer ybMax) {
  199 + this.ybMax = ybMax;
  200 + }
  201 + public boolean isSfyy() {
  202 + return sfyy;
  203 + }
  204 + public void setSfyy(boolean sfyy) {
  205 + this.sfyy = sfyy;
  206 + }
166 public String getGsname() { 207 public String getGsname() {
167 return BasicData.businessCodeNameMap.get(this.gsbm); 208 return BasicData.businessCodeNameMap.get(this.gsbm);
168 } 209 }
@@ -176,5 +217,4 @@ public class CalcInterval { @@ -176,5 +217,4 @@ public class CalcInterval {
176 this.fgsname = fgsname; 217 this.fgsname = fgsname;
177 } 218 }
178 219
179 -  
180 } 220 }
src/main/java/com/bsth/entity/calc/CalcWaybillDetail.java 0 → 100644
  1 +package com.bsth.entity.calc;
  2 +
  3 +import java.util.Date;
  4 +// calcDetailMonthly.html 返回类
  5 +public class CalcWaybillDetail {
  6 + private Long id;
  7 + /* 公司代码*/
  8 + private String gsdm;
  9 + /* 公司名称*/
  10 + private String gsname;
  11 + /* 分公司代码*/
  12 + private String fgsdm;
  13 + /* 分公司名称*/
  14 + private String fgsname;
  15 + /* 日期*/
  16 + private Date rq;
  17 + /* 日期字符串*/
  18 + private String rqStr;
  19 + /* 线路编码*/
  20 + private String xl;
  21 + /* 线路名称*/
  22 + private String xlName;
  23 + /* 车辆自编号*/
  24 + private String cl;
  25 + /* 路牌名字*/
  26 + private String lp;
  27 + /* 驾驶员工号*/
  28 + private String jGh;
  29 + /* 驾驶员名字*/
  30 + private String jName;
  31 + /* 售票员工号*/
  32 + private String sGh;
  33 + /* 售票员名字*/
  34 + private String sName;
  35 + /* 计划营运班次*/
  36 + private int jhyybc=0;
  37 + /* 计划早高峰营运班次*/
  38 + private int jhyybczgf=0;
  39 + /* 计划晚高峰营运班次*/
  40 + private int jhyybcwgf=0;
  41 + /* 计划非营运班次*/
  42 + private int jhfyybc=0;
  43 + /* 计划营运里程*/
  44 + private Double jhyylc=0.0;
  45 + /* 计划非营运里程*/
  46 + private Double jhfyylc=0.0;
  47 + /* 实际营运班次*/
  48 + private int sjyybc=0;
  49 + /* 实际早高峰营运班次*/
  50 + private int sjyybczgf=0;
  51 + /* 实际晚高峰营运班次*/
  52 + private int sjyybcwgf=0;
  53 + /* 实际非营运班次*/
  54 + private int sjfyybc=0;
  55 + /* 实际营运里程*/
  56 + private Double sjyylc=0.0;
  57 + /* 实际非营运里程*/
  58 + private Double sjfyylc=0.0;
  59 + /* 临加班次*/
  60 + private int ljbc=0;
  61 + /* 临加早高峰班次*/
  62 + private int ljbczgf=0;
  63 + /* 临加晚高峰班次*/
  64 + private int ljbcwgf=0;
  65 + /* 临加营运里程*/
  66 + private Double ljyylc=0.0;
  67 + /* 临加非营运里程*/
  68 + private Double ljfyylc=0.0;
  69 + /* 烂班班次*/
  70 + private int lbbc=0;
  71 + /* 烂班里程*/
  72 + private Double lblc=0.0;
  73 +
  74 +
  75 + // 总里程
  76 + private Double zlc=0.0;
  77 + private Double czlc=0.0;
  78 + private Double jzlc=0.0;
  79 + // 出场油量
  80 + private Double czyl=0.0;
  81 + // 进场油量
  82 + private Double jzyl=0.0;
  83 + // 加注量
  84 + private Double jzl=0.0;
  85 + // 加注量 0号柴油
  86 + private Double jzl0=0.0;
  87 + // 加注量 -10#号柴油
  88 + private Double jzl10=0.0;
  89 + // 油耗
  90 + private Double yh=0.0;
  91 + // 百公里油耗
  92 + private Double bglyh=0.0;
  93 + // 损耗
  94 + private Double sh=0.0;
  95 + // 燃油类型
  96 + private String rylx;
  97 +
  98 + //出站存电
  99 + private Double czcd=0.0;
  100 + //进站存电
  101 + private Double jzcd=0.0;
  102 + //充电量
  103 + private Double cdl=0.0;
  104 + //耗电
  105 + private Double hd=0.0;
  106 + //百公里耗电
  107 + private Double bglhd=0.0;
  108 +
  109 + // 天数记录
  110 + private int ts;
  111 +
  112 + /* 创建时间*/
  113 + private Date createTime;
  114 + /* 修改时间*/
  115 + private Date updateTime;
  116 + public Long getId() {
  117 + return id;
  118 + }
  119 + public void setId(Long id) {
  120 + this.id = id;
  121 + }
  122 + public String getGsdm() {
  123 + return gsdm;
  124 + }
  125 + public void setGsdm(String gsdm) {
  126 + this.gsdm = gsdm;
  127 + }
  128 + public String getGsname() {
  129 + return gsname;
  130 + }
  131 + public void setGsname(String gsname) {
  132 + this.gsname = gsname;
  133 + }
  134 + public String getFgsdm() {
  135 + return fgsdm;
  136 + }
  137 + public void setFgsdm(String fgsdm) {
  138 + this.fgsdm = fgsdm;
  139 + }
  140 + public String getFgsname() {
  141 + return fgsname;
  142 + }
  143 + public void setFgsname(String fgsname) {
  144 + this.fgsname = fgsname;
  145 + }
  146 + public Date getRq() {
  147 + return rq;
  148 + }
  149 + public void setRq(Date rq) {
  150 + this.rq = rq;
  151 + }
  152 + public String getRqStr() {
  153 + return rqStr;
  154 + }
  155 + public void setRqStr(String rqStr) {
  156 + this.rqStr = rqStr;
  157 + }
  158 + public String getXl() {
  159 + return xl;
  160 + }
  161 + public void setXl(String xl) {
  162 + this.xl = xl;
  163 + }
  164 + public String getXlName() {
  165 + return xlName;
  166 + }
  167 + public void setXlName(String xlName) {
  168 + this.xlName = xlName;
  169 + }
  170 + public String getCl() {
  171 + return cl;
  172 + }
  173 + public void setCl(String cl) {
  174 + this.cl = cl;
  175 + }
  176 + public String getLp() {
  177 + return lp;
  178 + }
  179 + public void setLp(String lp) {
  180 + this.lp = lp;
  181 + }
  182 + public String getjGh() {
  183 + return jGh;
  184 + }
  185 + public void setjGh(String jGh) {
  186 + this.jGh = jGh;
  187 + }
  188 + public String getjName() {
  189 + return jName;
  190 + }
  191 + public void setjName(String jName) {
  192 + this.jName = jName;
  193 + }
  194 + public String getsGh() {
  195 + return sGh;
  196 + }
  197 + public void setsGh(String sGh) {
  198 + this.sGh = sGh;
  199 + }
  200 + public String getsName() {
  201 + return sName;
  202 + }
  203 + public void setsName(String sName) {
  204 + this.sName = sName;
  205 + }
  206 + public int getJhyybc() {
  207 + return jhyybc;
  208 + }
  209 + public void setJhyybc(int jhyybc) {
  210 + this.jhyybc = jhyybc;
  211 + }
  212 + public int getJhyybczgf() {
  213 + return jhyybczgf;
  214 + }
  215 + public void setJhyybczgf(int jhyybczgf) {
  216 + this.jhyybczgf = jhyybczgf;
  217 + }
  218 + public int getJhyybcwgf() {
  219 + return jhyybcwgf;
  220 + }
  221 + public void setJhyybcwgf(int jhyybcwgf) {
  222 + this.jhyybcwgf = jhyybcwgf;
  223 + }
  224 + public int getJhfyybc() {
  225 + return jhfyybc;
  226 + }
  227 + public void setJhfyybc(int jhfyybc) {
  228 + this.jhfyybc = jhfyybc;
  229 + }
  230 + public Double getJhyylc() {
  231 + return jhyylc;
  232 + }
  233 + public void setJhyylc(Double jhyylc) {
  234 + this.jhyylc = jhyylc;
  235 + }
  236 + public Double getJhfyylc() {
  237 + return jhfyylc;
  238 + }
  239 + public void setJhfyylc(Double jhfyylc) {
  240 + this.jhfyylc = jhfyylc;
  241 + }
  242 + public int getSjyybc() {
  243 + return sjyybc;
  244 + }
  245 + public void setSjyybc(int sjyybc) {
  246 + this.sjyybc = sjyybc;
  247 + }
  248 + public int getSjyybczgf() {
  249 + return sjyybczgf;
  250 + }
  251 + public void setSjyybczgf(int sjyybczgf) {
  252 + this.sjyybczgf = sjyybczgf;
  253 + }
  254 + public int getSjyybcwgf() {
  255 + return sjyybcwgf;
  256 + }
  257 + public void setSjyybcwgf(int sjyybcwgf) {
  258 + this.sjyybcwgf = sjyybcwgf;
  259 + }
  260 + public int getSjfyybc() {
  261 + return sjfyybc;
  262 + }
  263 + public void setSjfyybc(int sjfyybc) {
  264 + this.sjfyybc = sjfyybc;
  265 + }
  266 + public Double getSjyylc() {
  267 + return sjyylc;
  268 + }
  269 + public void setSjyylc(Double sjyylc) {
  270 + this.sjyylc = sjyylc;
  271 + }
  272 + public Double getSjfyylc() {
  273 + return sjfyylc;
  274 + }
  275 + public void setSjfyylc(Double sjfyylc) {
  276 + this.sjfyylc = sjfyylc;
  277 + }
  278 + public int getLjbc() {
  279 + return ljbc;
  280 + }
  281 + public void setLjbc(int ljbc) {
  282 + this.ljbc = ljbc;
  283 + }
  284 + public int getLjbczgf() {
  285 + return ljbczgf;
  286 + }
  287 + public void setLjbczgf(int ljbczgf) {
  288 + this.ljbczgf = ljbczgf;
  289 + }
  290 + public int getLjbcwgf() {
  291 + return ljbcwgf;
  292 + }
  293 + public void setLjbcwgf(int ljbcwgf) {
  294 + this.ljbcwgf = ljbcwgf;
  295 + }
  296 + public Double getLjyylc() {
  297 + return ljyylc;
  298 + }
  299 + public void setLjyylc(Double ljyylc) {
  300 + this.ljyylc = ljyylc;
  301 + }
  302 + public Double getLjfyylc() {
  303 + return ljfyylc;
  304 + }
  305 + public void setLjfyylc(Double ljfyylc) {
  306 + this.ljfyylc = ljfyylc;
  307 + }
  308 + public int getLbbc() {
  309 + return lbbc;
  310 + }
  311 + public void setLbbc(int lbbc) {
  312 + this.lbbc = lbbc;
  313 + }
  314 + public Double getLblc() {
  315 + return lblc;
  316 + }
  317 + public void setLblc(Double lblc) {
  318 + this.lblc = lblc;
  319 + }
  320 +
  321 + public Double getZlc() {
  322 + return zlc;
  323 + }
  324 +
  325 + public void setZlc(Double zlc) {
  326 + this.zlc = zlc;
  327 + }
  328 +
  329 + public Double getCzlc() {
  330 + return czlc;
  331 + }
  332 +
  333 + public void setCzlc(Double czlc) {
  334 + this.czlc = czlc;
  335 + }
  336 +
  337 + public Double getJzlc() {
  338 + return jzlc;
  339 + }
  340 +
  341 + public void setJzlc(Double jzlc) {
  342 + this.jzlc = jzlc;
  343 + }
  344 +
  345 + public Double getCzyl() {
  346 + return czyl;
  347 + }
  348 +
  349 + public void setCzyl(Double czyl) {
  350 + this.czyl = czyl;
  351 + }
  352 +
  353 + public Double getJzyl() {
  354 + return jzyl;
  355 + }
  356 +
  357 + public void setJzyl(Double jzyl) {
  358 + this.jzyl = jzyl;
  359 + }
  360 +
  361 + public Double getJzl() {
  362 + return jzl;
  363 + }
  364 +
  365 + public Double getJzl0() {
  366 + return jzl0;
  367 + }
  368 +
  369 + public void setJzl0(Double jzl0) {
  370 + this.jzl0 = jzl0;
  371 + }
  372 +
  373 + public Double getJzl10() {
  374 + return jzl10;
  375 + }
  376 +
  377 + public void setJzl10(Double jzl10) {
  378 + this.jzl10 = jzl10;
  379 + }
  380 +
  381 + public void setJzl(Double jzl) {
  382 + this.jzl = jzl;
  383 + }
  384 +
  385 + public Double getYh() {
  386 + return yh;
  387 + }
  388 +
  389 + public void setYh(Double yh) {
  390 + this.yh = yh;
  391 + }
  392 +
  393 + public Double getBglyh() {
  394 + return bglyh;
  395 + }
  396 +
  397 + public void setBglyh(Double bglyh) {
  398 + this.bglyh = bglyh;
  399 + }
  400 +
  401 + public Double getSh() {
  402 + return sh;
  403 + }
  404 +
  405 + public void setSh(Double sh) {
  406 + this.sh = sh;
  407 + }
  408 +
  409 + public String getRylx() {
  410 + return rylx;
  411 + }
  412 +
  413 + public void setRylx(String rylx) {
  414 + this.rylx = rylx;
  415 + }
  416 +
  417 + public Double getCzcd() {
  418 + return czcd;
  419 + }
  420 +
  421 + public void setCzcd(Double czcd) {
  422 + this.czcd = czcd;
  423 + }
  424 +
  425 + public Double getJzcd() {
  426 + return jzcd;
  427 + }
  428 +
  429 + public void setJzcd(Double jzcd) {
  430 + this.jzcd = jzcd;
  431 + }
  432 +
  433 + public Double getCdl() {
  434 + return cdl;
  435 + }
  436 +
  437 + public void setCdl(Double cdl) {
  438 + this.cdl = cdl;
  439 + }
  440 +
  441 + public Double getHd() {
  442 + return hd;
  443 + }
  444 +
  445 + public void setHd(Double hd) {
  446 + this.hd = hd;
  447 + }
  448 +
  449 + public Double getBglhd() {
  450 + return bglhd;
  451 + }
  452 +
  453 + public void setBglhd(Double bglhd) {
  454 + this.bglhd = bglhd;
  455 + }
  456 +
  457 + public int getTs() {
  458 + return ts;
  459 + }
  460 +
  461 + public void setTs(int ts) {
  462 + this.ts = ts;
  463 + }
  464 +
  465 + public Date getCreateTime() {
  466 + return createTime;
  467 + }
  468 + public void setCreateTime(Date createTime) {
  469 + this.createTime = createTime;
  470 + }
  471 + public Date getUpdateTime() {
  472 + return updateTime;
  473 + }
  474 + public void setUpdateTime(Date updateTime) {
  475 + this.updateTime = updateTime;
  476 + }
  477 +
  478 +
  479 +
  480 +}
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
1 -package com.bsth.entity.realcontrol;  
2 -  
3 -import com.bsth.entity.sys.SysUser;  
4 -import com.fasterxml.jackson.annotation.JsonIgnore;  
5 -import org.apache.commons.lang3.StringUtils;  
6 -import org.joda.time.format.DateTimeFormat;  
7 -import org.joda.time.format.DateTimeFormatter;  
8 -  
9 -import javax.persistence.*;  
10 -import java.util.Date;  
11 -import java.util.HashSet;  
12 -import java.util.Set;  
13 -  
14 -/**  
15 - * 实际排班计划明细。  
16 - */  
17 -@Entity  
18 -@Table(name = "bsth_c_s_sp_info_real")  
19 -@NamedEntityGraphs({  
20 - @NamedEntityGraph(name = "scheduleRealInfo_cTasks", attributeNodes = {  
21 - @NamedAttributeNode("cTasks")  
22 - })  
23 -})  
24 -public class ScheduleRealInfo {  
25 - /** 主键Id */  
26 - @Id  
27 - private Long id;  
28 -  
29 - /** 计划ID */  
30 - private Long spId;  
31 -  
32 - /** 排班计划日期 --no webSocket */  
33 - private Date scheduleDate;  
34 - /** 排班日期字符串 YYYY-MM-DD */  
35 - private String scheduleDateStr;  
36 -  
37 - /** 真实执行时间 yyyy-MM-dd */  
38 - private String realExecDate;  
39 -  
40 - /** 线路名称 */  
41 - private String xlName;  
42 - /** 线路编码 */  
43 - private String xlBm;  
44 -  
45 - /** 路牌名称 */  
46 - private String lpName;  
47 -  
48 - /** 车辆自编号 */  
49 - private String clZbh;  
50 -  
51 - /** 驾驶员工号 */  
52 - private String jGh;  
53 - /** 驾驶员名字 */  
54 - private String jName;  
55 - /** 售票员工号 */  
56 - private String sGh;  
57 - /** 售票员名字 */  
58 - private String sName;  
59 -  
60 - /** 线路方向 */  
61 - private String xlDir;  
62 - /** 起点站code*/  
63 - private String qdzCode;  
64 - /** 起点站名字 */  
65 - private String qdzName;  
66 -  
67 - /** 终点站code*/  
68 - private String zdzCode;  
69 - /** 终点站名字 */  
70 - private String zdzName;  
71 -  
72 - /** 计划发车时间(格式 HH:mm) */  
73 - private String fcsj;  
74 - /** 计划发车时间戳*/  
75 - @Transient  
76 - private Long fcsjT;  
77 -  
78 - /** 计划终点时间(格式 HH:mm) */  
79 - private String zdsj;  
80 - /** 计划终点时间戳*/  
81 - @Transient  
82 - private Long zdsjT;  
83 -  
84 - /** 发车顺序号 --no webSocket*/  
85 - private Integer fcno;  
86 - /** 对应班次数 --no webSocket*/  
87 - private Integer bcs;  
88 - /** 计划里程 */  
89 - private Double jhlc;  
90 -  
91 - /** 原始计划里程 (原计调的数据) */  
92 - private Double jhlcOrig;  
93 -  
94 - /** 实际里程 --no webSocket*/  
95 - @Transient  
96 - @JsonIgnore  
97 - private Double realMileage;  
98 -  
99 - /** 实际里程 --no webSocket */  
100 - @Transient  
101 - private String sjlc;  
102 - /** 班次历时 */  
103 - private Integer bcsj;  
104 -  
105 - /**  
106 - * 班次类型 TODO:正常班次、出场、进场、加油、区间班次、放空班次、放大站班次、两点间空驶  
107 - */  
108 - private String bcType;  
109 -  
110 - //放站班次 站点名称  
111 - private String majorStationName;  
112 -  
113 - /** 创建人 */  
114 - @JsonIgnore  
115 - @ManyToOne(fetch = FetchType.LAZY)  
116 - private SysUser createBy;  
117 - /** 修改人 */  
118 - @JsonIgnore  
119 - @ManyToOne(fetch = FetchType.LAZY)  
120 - private SysUser updateBy;  
121 - /** 创建日期 */  
122 - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")  
123 - private Date createDate;  
124 - /** 修改日期 */  
125 - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")  
126 - private Date updateDate;  
127 -  
128 - /** 实际发车时间*/  
129 - private String fcsjActual;  
130 - /** 实际发车时间戳*/  
131 - @Transient  
132 - private Long fcsjActualTime;  
133 - /**实际终点时间 */  
134 - private String zdsjActual;  
135 - /** 实际终点时间戳*/  
136 - @Transient  
137 - private Long zdsjActualTime;  
138 -  
139 - /**班次状态 0 未执行 1 正在执行 2 已执行 -1 已烂班 */  
140 - private int status;  
141 -  
142 - private String adjustExps;  
143 -  
144 - /** 是否是临加班次 */  
145 - private boolean sflj;  
146 -  
147 - /** 是否误点 (应发未发)*/  
148 - @Transient  
149 - private boolean late;  
150 -  
151 - /** 是否误点 (应发未到) */  
152 - @Transient  
153 - private boolean late2;  
154 - /** 误点停靠时间 */  
155 - @Transient  
156 - private float lateMinute;  
157 -  
158 - /** 备注*/  
159 - private String remarks;  
160 -  
161 - /** 原计划排班备注 --no webSocket */  
162 - @Transient  
163 - private String remark;  
164 -  
165 - /**待发时间(格式 HH:mm) */  
166 - private String dfsj;  
167 -  
168 - /**待发时间戳 */  
169 - @Transient  
170 - private Long dfsjT;  
171 -  
172 - /** 指令下发状态 60: 已发送, 100: 设备确认收到, 200:驾驶员确认 0:失败 */  
173 - private Integer directiveState = -1;  
174 -  
175 - /** 起点站计划到达时间 */  
176 - @Transient  
177 - private String qdzArrDatejh;  
178 -  
179 - /** 起点站实际到达时间 */  
180 - @Transient  
181 - private String qdzArrDatesj;  
182 -  
183 - /** 子任务 */  
184 - @OneToMany(fetch = FetchType.LAZY, mappedBy = "schedule")  
185 - private Set<ChildTaskPlan> cTasks = new HashSet<>();  
186 -  
187 - /** 关联的公司名称 */  
188 - private String gsName;  
189 - /** 关联的公司编码 */  
190 - private String gsBm;  
191 - /** 关联的分公司名称 */  
192 - private String fgsName;  
193 - /** 关联的分公司编码 */  
194 - private String fgsBm;  
195 - /** 出场顺序号 */  
196 - private Integer ccno;  
197 -  
198 - //待发调试(是否自动调整)  
199 - private boolean dfAuto;  
200 - //是否有GPS信号  
201 - private boolean online;  
202 -  
203 - /** 是否有补发GPS信号 */  
204 - private boolean reissue;  
205 -  
206 - /** 发车屏 发车顺序号,不持久化,会动态变化 --no webSocket*/  
207 - @Transient  
208 - private int fcpSn;  
209 -  
210 - /** 标记班次已被删除 */  
211 - @Transient  
212 - @JsonIgnore  
213 - private boolean deleted;  
214 -  
215 - @Transient  
216 - @JsonIgnore  
217 - private int saveFailCount=0;  
218 -  
219 - /** 是否需要补充GPS信号 (网关提交至运管处动态数据用) 1: 能发车, 2:能到达 3: 补发过*/  
220 - private int siginCompate;  
221 -  
222 - /**  
223 - * 漂移状态  
224 - * 1: 发车漂移  
225 - * 2:到站漂移  
226 - * 3:中途漂移  
227 - */  
228 - private Integer driftStatus = 0;  
229 -  
230 - /**  
231 - * 换车营运标记 true 表示该主任务由 【中途换车子任务】 级联生成  
232 - */  
233 - private boolean ccService;  
234 - private Integer lpChange;  
235 -  
236 - public Integer getLpChange() {  
237 - return lpChange;  
238 - }  
239 -  
240 - public void setLpChange(Integer lpChange) {  
241 - this.lpChange = lpChange;  
242 - }  
243 -  
244 - public boolean isDfAuto() {  
245 - return dfAuto;  
246 - }  
247 -  
248 - public void setDfAuto(boolean dfAuto) {  
249 - this.dfAuto = dfAuto;  
250 - }  
251 -  
252 - public boolean isOnline() {  
253 - return online;  
254 - }  
255 -  
256 - public void setOnline(boolean online) {  
257 - this.online = online;  
258 - }  
259 -  
260 - public String getQdzArrDatejh() {  
261 - return qdzArrDatejh;  
262 - }  
263 -  
264 - public void setQdzArrDatejh(String qdzArrDatejh) {  
265 - this.qdzArrDatejh = qdzArrDatejh;  
266 - }  
267 -  
268 - public String getQdzArrDatesj() {  
269 - return qdzArrDatesj;  
270 - }  
271 -  
272 - public void setQdzArrDatesj(String qdzArrDatesj) {  
273 - this.qdzArrDatesj = qdzArrDatesj;  
274 - }  
275 -  
276 - public void setcTasks(Set<ChildTaskPlan> cTasks) {  
277 - this.cTasks = cTasks;  
278 - }  
279 -  
280 - public String getGsName() {  
281 - return gsName;  
282 - }  
283 -  
284 - public void setGsName(String gsName) {  
285 - this.gsName = gsName;  
286 - }  
287 -  
288 - public String getGsBm() {  
289 - return gsBm;  
290 - }  
291 -  
292 - public void setGsBm(String gsBm) {  
293 - this.gsBm = gsBm;  
294 - }  
295 -  
296 - public String getFgsName() {  
297 - return fgsName;  
298 - }  
299 -  
300 - public void setFgsName(String fgsName) {  
301 - this.fgsName = fgsName;  
302 - }  
303 -  
304 - public String getFgsBm() {  
305 - return fgsBm;  
306 - }  
307 -  
308 - public void setFgsBm(String fgsBm) {  
309 - this.fgsBm = fgsBm;  
310 - }  
311 -  
312 - public Integer getCcno() {  
313 - return ccno;  
314 - }  
315 -  
316 - public void setCcno(Integer ccno) {  
317 - this.ccno = ccno;  
318 - }  
319 -  
320 -  
321 - /** ----------------  
322 - @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)  
323 - private RealTimeModel sjfcModel;  
324 - @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)  
325 - private RealTimeModel sjddModel;  
326 - */  
327 - public void addRemarks(String remark){  
328 - if(StringUtils.isBlank(remark))  
329 - return;  
330 - String old = this.getRemarks();  
331 - if(StringUtils.isBlank(old))  
332 - old = "";  
333 -  
334 - old += remark + ";";  
335 - this.setRemarks(old);  
336 -  
337 - }  
338 -  
339 - public Long getId() {  
340 - return id;  
341 - }  
342 -  
343 - public void setId(Long id) {  
344 - this.id = id;  
345 - }  
346 -  
347 - public Date getScheduleDate() {  
348 - return scheduleDate;  
349 - }  
350 -  
351 - public void setScheduleDate(Date scheduleDate) {  
352 - this.scheduleDate = scheduleDate;  
353 - }  
354 -  
355 - public String getXlName() {  
356 - return xlName;  
357 - }  
358 -  
359 - public void setXlName(String xlName) {  
360 - this.xlName = xlName;  
361 - }  
362 -  
363 - public String getXlBm() {  
364 - return xlBm;  
365 - }  
366 -  
367 - public void setXlBm(String xlBm) {  
368 - this.xlBm = xlBm;  
369 - }  
370 -  
371 - public String getLpName() {  
372 - return lpName;  
373 - }  
374 -  
375 - public void setLpName(String lpName) {  
376 - this.lpName = lpName;  
377 - }  
378 -  
379 - public String getClZbh() {  
380 - return clZbh;  
381 - }  
382 -  
383 - public void setClZbh(String clZbh) {  
384 - this.clZbh = clZbh;  
385 - }  
386 -  
387 - public String getjGh() {  
388 - return jGh;  
389 - }  
390 -  
391 - public void setjGh(String jGh) {  
392 - this.jGh = jGh;  
393 - }  
394 -  
395 - public String getjName() {  
396 - return jName;  
397 - }  
398 -  
399 - public void setjName(String jName) {  
400 - this.jName = jName;  
401 - }  
402 -  
403 - public String getsGh() {  
404 - if(sGh == null)  
405 - return "";  
406 - return sGh;  
407 - }  
408 -  
409 - public void setsGh(String sGh) {  
410 - this.sGh = sGh;  
411 - }  
412 -  
413 - public String getsName() {  
414 - if(sGh == null)  
415 - return "";  
416 - return sName;  
417 - }  
418 -  
419 - public void setsName(String sName) {  
420 - this.sName = sName;  
421 - }  
422 -  
423 - public String getXlDir() {  
424 - return xlDir;  
425 - }  
426 -  
427 - public void setXlDir(String xlDir) {  
428 - this.xlDir = xlDir;  
429 - }  
430 -  
431 - public String getQdzCode() {  
432 - return qdzCode;  
433 - }  
434 -  
435 - public void setQdzCode(String qdzCode) {  
436 - this.qdzCode = qdzCode;  
437 - }  
438 -  
439 - public String getQdzName() {  
440 - return qdzName;  
441 - }  
442 -  
443 - public void setQdzName(String qdzName) {  
444 - this.qdzName = qdzName;  
445 - }  
446 -  
447 - public String getZdzCode() {  
448 - return zdzCode;  
449 - }  
450 -  
451 - public void setZdzCode(String zdzCode) {  
452 - this.zdzCode = zdzCode;  
453 - }  
454 -  
455 - public String getZdzName() {  
456 - return zdzName;  
457 - }  
458 -  
459 - public void setZdzName(String zdzName) {  
460 - this.zdzName = zdzName;  
461 - }  
462 -  
463 - public String getFcsj() {  
464 - return fcsj;  
465 - }  
466 -  
467 - public void setFcsj(String fcsj) {  
468 - this.fcsj = fcsj;  
469 - }  
470 -  
471 - public Long getFcsjT() {  
472 - return fcsjT;  
473 - }  
474 -  
475 - public void setFcsjT(Long fcsjT) {  
476 - this.fcsjT = fcsjT;  
477 - }  
478 -  
479 - public String getZdsj() {  
480 - return zdsj;  
481 - }  
482 -  
483 - public void setZdsj(String zdsj) {  
484 - this.zdsj = zdsj;  
485 - }  
486 -  
487 - public Long getZdsjT() {  
488 - return zdsjT;  
489 - }  
490 -  
491 - public void setZdsjT(Long zdsjT) {  
492 - this.zdsjT = zdsjT;  
493 - }  
494 -  
495 - public Integer getFcno() {  
496 - return fcno;  
497 - }  
498 -  
499 - public void setFcno(Integer fcno) {  
500 - this.fcno = fcno;  
501 - }  
502 -  
503 - public Integer getBcs() {  
504 - return bcs;  
505 - }  
506 -  
507 - public void setBcs(Integer bcs) {  
508 - this.bcs = bcs;  
509 - }  
510 -  
511 - public Double getJhlc() {  
512 - return jhlc;  
513 - }  
514 -  
515 - public void setJhlc(Double jhlc) {  
516 - this.jhlc = jhlc;  
517 - //临加班次 计划公里 和 实际计划公里一样  
518 - if(this.isSflj())  
519 - this.setJhlcOrig(this.getJhlc());  
520 - }  
521 -  
522 - public String getSjlc() {  
523 - return sjlc;  
524 - }  
525 -  
526 - public void setSjlc(String sjlc) {  
527 - this.sjlc = sjlc;  
528 - }  
529 -  
530 - public Integer getBcsj() {  
531 - return bcsj;  
532 - }  
533 -  
534 - public void setBcsj(Integer bcsj) {  
535 - this.bcsj = bcsj;  
536 - }  
537 -  
538 - public String getBcType() {  
539 - return bcType;  
540 - }  
541 -  
542 - public void setBcType(String bcType) {  
543 - this.bcType = bcType;  
544 - }  
545 -  
546 - public SysUser getCreateBy() {  
547 - return createBy;  
548 - }  
549 -  
550 - public void setCreateBy(SysUser createBy) {  
551 - this.createBy = createBy;  
552 - }  
553 -  
554 - public SysUser getUpdateBy() {  
555 - return updateBy;  
556 - }  
557 -  
558 - public void setUpdateBy(SysUser updateBy) {  
559 - this.updateBy = updateBy;  
560 - }  
561 -  
562 - public Date getCreateDate() {  
563 - return createDate;  
564 - }  
565 -  
566 - public void setCreateDate(Date createDate) {  
567 - this.createDate = createDate;  
568 - }  
569 -  
570 - public Date getUpdateDate() {  
571 - return updateDate;  
572 - }  
573 -  
574 - public void setUpdateDate(Date updateDate) {  
575 - this.updateDate = updateDate;  
576 - }  
577 -  
578 - public String getFcsjActual() {  
579 - return fcsjActual;  
580 - }  
581 -  
582 - public void setFcsjActual(String fcsjActual) {  
583 - this.fcsjActual = fcsjActual;  
584 - }  
585 -  
586 - public Long getFcsjActualTime() {  
587 - return fcsjActualTime;  
588 - }  
589 -  
590 - public void setFcsjActualTime(Long fcsjActualTime) {  
591 - this.fcsjActualTime = fcsjActualTime;  
592 - }  
593 -  
594 - public String getZdsjActual() {  
595 - return zdsjActual;  
596 - }  
597 -  
598 - public void setZdsjActual(String zdsjActual) {  
599 - this.zdsjActual = zdsjActual;  
600 - }  
601 -  
602 - public Long getZdsjActualTime() {  
603 - return zdsjActualTime;  
604 - }  
605 -  
606 - public void setZdsjActualTime(Long zdsjActualTime) {  
607 - this.zdsjActualTime = zdsjActualTime;  
608 - }  
609 -  
610 - public int getStatus() {  
611 - return status;  
612 - }  
613 -  
614 - public void setStatus(int status) {  
615 - this.status = status;  
616 - }  
617 -  
618 - public String getRemarks() {  
619 - return remarks;  
620 - }  
621 -  
622 - public void setRemarks(String remarks) {  
623 - this.remarks = remarks;  
624 - }  
625 -  
626 - public String getDfsj() {  
627 - return dfsj;  
628 - }  
629 -  
630 - public void setDfsj(String dfsj) {  
631 - this.dfsj = dfsj;  
632 - }  
633 -  
634 - public Long getDfsjT() {  
635 - return dfsjT;  
636 - }  
637 -  
638 - public void setDfsjT(Long dfsjT) {  
639 - this.dfsjT = dfsjT;  
640 - }  
641 -  
642 -  
643 - @Transient  
644 - private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm");  
645 - @Transient  
646 - private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");  
647 -  
648 - public void setDfsjAll(Long dfsjT) {  
649 - this.dfsjT = dfsjT;  
650 - this.dfsj = fmtHHmm.print(this.dfsjT);  
651 - }  
652 -  
653 - public void setDfsjAll(String dfsj) {  
654 - this.dfsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + dfsj);  
655 - this.dfsj = dfsj;  
656 - }  
657 -  
658 - public void calcEndTime(){  
659 - //计划终点时间  
660 - if(this.getBcsj() != null){  
661 - //this.setZdsjT(this.getDfsjT() + (this.getBcsj() * 60 * 1000));  
662 - this.setZdsjT(this.getFcsjT() + (this.getBcsj() * 60 * 1000));//计划终点时间不变  
663 - this.setZdsj(fmtHHmm.print(this.zdsjT));  
664 - }  
665 - }  
666 -  
667 - public Integer getDirectiveState() {  
668 - return directiveState;  
669 - }  
670 -  
671 - public void setDirectiveState(Integer directiveState) {  
672 - this.directiveState = directiveState;  
673 - }  
674 -  
675 - @Override  
676 - public boolean equals(Object obj) {  
677 - try{  
678 - return this.id.equals(((ScheduleRealInfo)obj).getId());  
679 - }catch(Exception e){  
680 - return false;  
681 - }  
682 - }  
683 -  
684 - @Override  
685 - public int hashCode() {  
686 - return ("schedule_" + this.id).hashCode();  
687 - }  
688 -  
689 - public boolean isSflj() {  
690 - return sflj;  
691 - }  
692 -  
693 - public void setSflj(boolean sflj) {  
694 - this.sflj = sflj;  
695 - }  
696 -  
697 - /**  
698 - *  
699 - * @Title: setFcsjAll  
700 - * @Description: TODO(设置计划发车时间)  
701 - * @throws  
702 - */  
703 - public void setFcsjAll(String fcsj){  
704 - this.fcsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + fcsj);  
705 - this.fcsj = fcsj;  
706 - }  
707 -  
708 - /**  
709 - *  
710 - * @Title: setFcsjAll  
711 - * @Description: TODO(设置计划发车时间)  
712 - * @throws  
713 - */  
714 - public void setFcsjAll(Long fcsjT){  
715 - this.fcsjT = fcsjT;  
716 - this.fcsj = fmtHHmm.print(fcsjT);  
717 - }  
718 -  
719 - /**  
720 - *  
721 - * @Title: setFcsjActualAll  
722 - * @Description: TODO(设置实际发车时间 字符串)  
723 - * @throws  
724 - */  
725 - public void setFcsjActualAll(String fcsjActual){  
726 - this.fcsjActualTime = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + fcsjActual);  
727 - this.fcsjActual = fcsjActual;  
728 - calcStatus();  
729 - }  
730 -  
731 - /**  
732 - *  
733 - * @Title: setFcsjActualAll  
734 - * @Description: TODO(设置实际发车时间 时间戳)  
735 - * @throws  
736 - */  
737 - public void setFcsjActualAll(Long t){  
738 -  
739 - this.fcsjActualTime = t;  
740 - if(null == t)  
741 - this.fcsjActual = null;  
742 - else  
743 - this.fcsjActual = fmtHHmm.print(t);  
744 -  
745 - //更新班次状态  
746 - calcStatus();  
747 - }  
748 -  
749 - /**  
750 - *  
751 - * @Title: setFcsjActualAll  
752 - * @Description: TODO(设置实际终点时间)  
753 - * @throws  
754 - */  
755 - public void setZdsjActualAll(Long t){  
756 - this.zdsjActualTime = t;  
757 -  
758 - if(null == t)  
759 - this.zdsjActual = null;  
760 - else  
761 - this.zdsjActual = fmtHHmm.print(t);  
762 -  
763 - //更新班次状态  
764 - calcStatus();  
765 - }  
766 -  
767 - /**  
768 - *  
769 - * @Title: setFcsjActualAll  
770 - * @Description: TODO(设置实际终点时间)  
771 - * @throws  
772 - */  
773 - public void setZdsjActualAll(String zdsjActual){  
774 - this.zdsjActualTime = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + zdsjActual);  
775 - this.zdsjActual = zdsjActual;  
776 -  
777 - calcStatus();  
778 - }  
779 -  
780 - public Long getSpId() {  
781 - return spId;  
782 - }  
783 -  
784 - public void setSpId(Long spId) {  
785 - this.spId = spId;  
786 - }  
787 -  
788 - public String getRealExecDate() {  
789 - return realExecDate;  
790 - }  
791 -  
792 - public void setRealExecDate(String realExecDate) {  
793 - this.realExecDate = realExecDate;  
794 - }  
795 -  
796 - public void calcStatus() {  
797 - if(this.status == -1)  
798 - return;  
799 -  
800 - this.status = 0;  
801 - if(StringUtils.isNotBlank(this.fcsjActual)){  
802 - this.status = 1;  
803 -  
804 - //进出场班次并且没有计划里程的  
805 - if((this.bcType.equals("out") || this.bcType.equals("in"))  
806 - && this.jhlc == null){  
807 - this.status = 2;  
808 - }  
809 - }  
810 - if(StringUtils.isNotBlank(this.zdsjActual))  
811 - this.status = 2;  
812 - }  
813 -  
814 - public void destroy(){  
815 - this.jhlc = 0.0;  
816 - if(this.isSflj())  
817 - this.jhlcOrig = 0.0;  
818 - this.status = -1;  
819 - this.clearFcsjActual();  
820 - }  
821 -  
822 - public boolean isDestroy(){  
823 - return this.status == -1;  
824 - }  
825 -  
826 -/* public boolean isNotDestroy(){  
827 - return this.status != -1;  
828 - }*/  
829 -  
830 - public Set<ChildTaskPlan> getcTasks() {  
831 - return cTasks;  
832 - }  
833 -  
834 -/* public void setcTasks(Set<ChildTaskPlan> cTasks) {  
835 - this.cTasks = cTasks;  
836 - }*/  
837 -  
838 - public String getScheduleDateStr() {  
839 - return scheduleDateStr;  
840 - }  
841 -  
842 - public void setScheduleDateStr(String scheduleDateStr) {  
843 - this.scheduleDateStr = scheduleDateStr;  
844 - }  
845 -  
846 - public void clearFcsjActual(){  
847 - this.setFcsjActual(null);  
848 - this.setFcsjActualTime(null);  
849 - this.calcStatus();  
850 - }  
851 -  
852 - //清除实际终点时间  
853 - public void clearZdsjActual(){  
854 - this.setZdsjActual(null);  
855 - this.setZdsjActualTime(null);  
856 -  
857 - calcStatus();  
858 - }  
859 -  
860 - public boolean isLate() {  
861 - return late;  
862 - }  
863 -  
864 - public void setLate(boolean late) {  
865 - this.late = late;  
866 - }  
867 -  
868 - public String getAdjustExps() {  
869 - return adjustExps;  
870 - }  
871 -  
872 - public void setAdjustExps(String adjustExps) {  
873 - this.adjustExps = adjustExps;  
874 - }  
875 -  
876 - public boolean isReissue() {  
877 - return reissue;  
878 - }  
879 -  
880 - public void setReissue(boolean reissue) {  
881 - this.reissue = reissue;  
882 - }  
883 -  
884 - public Double getRealMileage() {  
885 - return realMileage;  
886 - }  
887 -  
888 - public void setRealMileage(Double realMileage) {  
889 - this.realMileage = realMileage;  
890 - }  
891 -  
892 - public Double getJhlcOrig() {  
893 - return jhlcOrig;  
894 - }  
895 -  
896 - public void setJhlcOrig(Double jhlcOrig) {  
897 - this.jhlcOrig = jhlcOrig;  
898 - }  
899 -  
900 - public void reCalcLate() {  
901 - if(this.getStatus() == 0  
902 - && this.getFcsjActual() == null  
903 - && this.dfsjT < System.currentTimeMillis()){  
904 - this.setLate(true);  
905 - }  
906 - else  
907 - this.setLate(false);  
908 - }  
909 -  
910 - public String getRemark() {  
911 - return remark;  
912 - }  
913 -  
914 - public void setRemark(String remark) {  
915 - this.remark = remark;  
916 - }  
917 -  
918 - public float getLateMinute() {  
919 - return lateMinute;  
920 - }  
921 -  
922 - public void setLateMinute(float lateMinute) {  
923 - this.lateMinute = lateMinute;  
924 - }  
925 -  
926 - public boolean isLate2() {  
927 - return late2;  
928 - }  
929 -  
930 - public void setLate2(boolean late2) {  
931 - this.late2 = late2;  
932 - }  
933 -  
934 - public int getFcpSn() {  
935 - return fcpSn;  
936 - }  
937 -  
938 - public void setFcpSn(int fcpSn) {  
939 - this.fcpSn = fcpSn;  
940 - }  
941 -  
942 - public boolean _isInout(){  
943 - return this.getBcType().equals("out") || this.getBcType().equals("in");  
944 - }  
945 -  
946 - public boolean isDeleted() {  
947 - return deleted;  
948 - }  
949 -  
950 - public void setDeleted(boolean deleted) {  
951 - this.deleted = deleted;  
952 - }  
953 -  
954 - public int getSaveFailCount() {  
955 - return saveFailCount;  
956 - }  
957 -  
958 - public void setSaveFailCount(int saveFailCount) {  
959 - this.saveFailCount = saveFailCount;  
960 - }  
961 -  
962 - public int getSiginCompate() {  
963 - return siginCompate;  
964 - }  
965 -  
966 - public void setSiginCompate(int siginCompate) {  
967 - this.siginCompate = siginCompate;  
968 - }  
969 -  
970 - public Integer getDriftStatus() {  
971 - return driftStatus;  
972 - }  
973 -  
974 - public void setDriftStatus(Integer driftStatus) {  
975 - this.driftStatus = driftStatus;  
976 - }  
977 -  
978 - public boolean isCcService() {  
979 - return ccService;  
980 - }  
981 -  
982 - public void setCcService(boolean ccService) {  
983 - this.ccService = ccService;  
984 - }  
985 -  
986 - public String getMajorStationName() {  
987 - return majorStationName;  
988 - }  
989 -  
990 - public void setMajorStationName(String majorStationName) {  
991 - this.majorStationName = majorStationName;  
992 - }  
993 -} 1 +package com.bsth.entity.realcontrol;
  2 +
  3 +import com.bsth.entity.sys.SysUser;
  4 +import com.fasterxml.jackson.annotation.JsonIgnore;
  5 +import org.apache.commons.lang3.StringUtils;
  6 +import org.joda.time.format.DateTimeFormat;
  7 +import org.joda.time.format.DateTimeFormatter;
  8 +
  9 +import javax.persistence.*;
  10 +import java.util.Date;
  11 +import java.util.HashSet;
  12 +import java.util.Set;
  13 +
  14 +/**
  15 + * 实际排班计划明细。
  16 + */
  17 +@Entity
  18 +@Table(name = "bsth_c_s_sp_info_real")
  19 +@NamedEntityGraphs({
  20 + @NamedEntityGraph(name = "scheduleRealInfo_cTasks", attributeNodes = {
  21 + @NamedAttributeNode("cTasks")
  22 + })
  23 +})
  24 +public class ScheduleRealInfo {
  25 + /** 主键Id */
  26 + @Id
  27 + private Long id;
  28 +
  29 + /** 计划ID */
  30 + private Long spId;
  31 +
  32 + /** 排班计划日期 --no webSocket */
  33 + private Date scheduleDate;
  34 + /** 排班日期字符串 YYYY-MM-DD */
  35 + private String scheduleDateStr;
  36 +
  37 + /** 真实执行时间 yyyy-MM-dd */
  38 + private String realExecDate;
  39 +
  40 + /** 线路名称 */
  41 + private String xlName;
  42 + /** 线路编码 */
  43 + private String xlBm;
  44 +
  45 + /** 路牌名称 */
  46 + private String lpName;
  47 +
  48 + /** 车辆自编号 */
  49 + private String clZbh;
  50 +
  51 + /** 驾驶员工号 */
  52 + private String jGh;
  53 + /** 驾驶员名字 */
  54 + private String jName;
  55 + /** 售票员工号 */
  56 + private String sGh;
  57 + /** 售票员名字 */
  58 + private String sName;
  59 +
  60 + /** 线路方向 */
  61 + private String xlDir;
  62 + /** 起点站code*/
  63 + private String qdzCode;
  64 + /** 起点站名字 */
  65 + private String qdzName;
  66 +
  67 + /** 终点站code*/
  68 + private String zdzCode;
  69 + /** 终点站名字 */
  70 + private String zdzName;
  71 +
  72 + /** 计划发车时间(格式 HH:mm) */
  73 + private String fcsj;
  74 + /** 计划发车时间戳*/
  75 + @Transient
  76 + private Long fcsjT;
  77 +
  78 + /** 计划终点时间(格式 HH:mm) */
  79 + private String zdsj;
  80 + /** 计划终点时间戳*/
  81 + @Transient
  82 + private Long zdsjT;
  83 +
  84 + /** 发车顺序号 --no webSocket*/
  85 + private Integer fcno;
  86 + /** 对应班次数 --no webSocket*/
  87 + private Integer bcs;
  88 + /** 计划里程 */
  89 + private Double jhlc;
  90 +
  91 + /** 原始计划里程 (原计调的数据) */
  92 + private Double jhlcOrig;
  93 +
  94 + /** 实际里程 --no webSocket*/
  95 + @Transient
  96 + @JsonIgnore
  97 + private Double realMileage;
  98 +
  99 + /** 实际里程 --no webSocket */
  100 + @Transient
  101 + private String sjlc;
  102 + /** 班次历时 */
  103 + private Integer bcsj;
  104 +
  105 + /**
  106 + * 班次类型 TODO:正常班次、出场、进场、加油、区间班次、放空班次、放大站班次、两点间空驶
  107 + */
  108 + private String bcType;
  109 +
  110 + //放站班次 站点名称
  111 + private String majorStationName;
  112 +
  113 + /** 创建人 */
  114 + @JsonIgnore
  115 + @ManyToOne(fetch = FetchType.LAZY)
  116 + private SysUser createBy;
  117 + /** 修改人 */
  118 + @JsonIgnore
  119 + @ManyToOne(fetch = FetchType.LAZY)
  120 + private SysUser updateBy;
  121 + /** 创建日期 */
  122 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  123 + private Date createDate;
  124 + /** 修改日期 */
  125 + @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  126 + private Date updateDate;
  127 +
  128 + /** 实际发车时间*/
  129 + private String fcsjActual;
  130 + /** 实际发车时间戳*/
  131 + @Transient
  132 + private Long fcsjActualTime;
  133 + /**实际终点时间 */
  134 + private String zdsjActual;
  135 + /** 实际终点时间戳*/
  136 + @Transient
  137 + private Long zdsjActualTime;
  138 +
  139 + /**班次状态 0 未执行 1 正在执行 2 已执行 -1 已烂班 */
  140 + private int status;
  141 +
  142 + private String adjustExps;
  143 +
  144 + /** 是否是临加班次 */
  145 + private boolean sflj;
  146 +
  147 + /** 是否误点 (应发未发)*/
  148 + @Transient
  149 + private boolean late;
  150 +
  151 + /** 是否误点 (应发未到) */
  152 + @Transient
  153 + private boolean late2;
  154 + /** 误点停靠时间 */
  155 + @Transient
  156 + private float lateMinute;
  157 +
  158 + /** 备注*/
  159 + private String remarks;
  160 +
  161 + /** 原计划排班备注 --no webSocket */
  162 + @Transient
  163 + private String remark;
  164 +
  165 + /**待发时间(格式 HH:mm) */
  166 + private String dfsj;
  167 +
  168 + /**待发时间戳 */
  169 + @Transient
  170 + private Long dfsjT;
  171 +
  172 + /** 指令下发状态 60: 已发送, 100: 设备确认收到, 200:驾驶员确认 0:失败 */
  173 + private Integer directiveState = -1;
  174 +
  175 + /** 起点站计划到达时间 */
  176 + @Transient
  177 + private String qdzArrDatejh;
  178 +
  179 + /** 起点站实际到达时间 */
  180 + @Transient
  181 + private String qdzArrDatesj;
  182 +
  183 + /** 子任务 */
  184 + @OneToMany(fetch = FetchType.LAZY, mappedBy = "schedule")
  185 + private Set<ChildTaskPlan> cTasks = new HashSet<>();
  186 +
  187 + /** 关联的公司名称 */
  188 + private String gsName;
  189 + /** 关联的公司编码 */
  190 + private String gsBm;
  191 + /** 关联的分公司名称 */
  192 + private String fgsName;
  193 + /** 关联的分公司编码 */
  194 + private String fgsBm;
  195 + /** 出场顺序号 */
  196 + private Integer ccno;
  197 +
  198 + //待发调试(是否自动调整)
  199 + private boolean dfAuto;
  200 + //是否有GPS信号
  201 + private boolean online;
  202 +
  203 + /** 是否有补发GPS信号 */
  204 + private boolean reissue;
  205 +
  206 + /** 发车屏 发车顺序号,不持久化,会动态变化 --no webSocket*/
  207 + @Transient
  208 + private int fcpSn;
  209 +
  210 + /** 标记班次已被删除 */
  211 + @Transient
  212 + @JsonIgnore
  213 + private boolean deleted;
  214 +
  215 + @Transient
  216 + @JsonIgnore
  217 + private int saveFailCount=0;
  218 +
  219 + /** 是否需要补充GPS信号 (网关提交至运管处动态数据用) 1: 能发车, 2:能到达 3: 补发过*/
  220 + private int siginCompate;
  221 +
  222 + /**
  223 + * 漂移状态
  224 + * 1: 发车漂移
  225 + * 2:到站漂移
  226 + * 3:中途漂移
  227 + */
  228 + private Integer driftStatus = 0;
  229 +
  230 + /**
  231 + * 换车营运标记 true 表示该主任务由 【中途换车子任务】 级联生成
  232 + */
  233 + private boolean ccService;
  234 + private Integer lpChange;
  235 +
  236 + /**
  237 + * rfid状态
  238 + */
  239 + private int rfidState;
  240 +
  241 + public Integer getLpChange() {
  242 + return lpChange;
  243 + }
  244 +
  245 + public void setLpChange(Integer lpChange) {
  246 + this.lpChange = lpChange;
  247 + }
  248 +
  249 + public boolean isDfAuto() {
  250 + return dfAuto;
  251 + }
  252 +
  253 + public void setDfAuto(boolean dfAuto) {
  254 + this.dfAuto = dfAuto;
  255 + }
  256 +
  257 + public boolean isOnline() {
  258 + return online;
  259 + }
  260 +
  261 + public void setOnline(boolean online) {
  262 + this.online = online;
  263 + }
  264 +
  265 + public String getQdzArrDatejh() {
  266 + return qdzArrDatejh;
  267 + }
  268 +
  269 + public void setQdzArrDatejh(String qdzArrDatejh) {
  270 + this.qdzArrDatejh = qdzArrDatejh;
  271 + }
  272 +
  273 + public String getQdzArrDatesj() {
  274 + return qdzArrDatesj;
  275 + }
  276 +
  277 + public void setQdzArrDatesj(String qdzArrDatesj) {
  278 + this.qdzArrDatesj = qdzArrDatesj;
  279 + }
  280 +
  281 + public void setcTasks(Set<ChildTaskPlan> cTasks) {
  282 + this.cTasks = cTasks;
  283 + }
  284 +
  285 + public String getGsName() {
  286 + return gsName;
  287 + }
  288 +
  289 + public void setGsName(String gsName) {
  290 + this.gsName = gsName;
  291 + }
  292 +
  293 + public String getGsBm() {
  294 + return gsBm;
  295 + }
  296 +
  297 + public void setGsBm(String gsBm) {
  298 + this.gsBm = gsBm;
  299 + }
  300 +
  301 + public String getFgsName() {
  302 + return fgsName;
  303 + }
  304 +
  305 + public void setFgsName(String fgsName) {
  306 + this.fgsName = fgsName;
  307 + }
  308 +
  309 + public String getFgsBm() {
  310 + return fgsBm;
  311 + }
  312 +
  313 + public void setFgsBm(String fgsBm) {
  314 + this.fgsBm = fgsBm;
  315 + }
  316 +
  317 + public Integer getCcno() {
  318 + return ccno;
  319 + }
  320 +
  321 + public void setCcno(Integer ccno) {
  322 + this.ccno = ccno;
  323 + }
  324 +
  325 +
  326 + /** ----------------
  327 + @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
  328 + private RealTimeModel sjfcModel;
  329 + @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
  330 + private RealTimeModel sjddModel;
  331 + */
  332 + public void addRemarks(String remark){
  333 + if(StringUtils.isBlank(remark))
  334 + return;
  335 + String old = this.getRemarks();
  336 + if(StringUtils.isBlank(old))
  337 + old = "";
  338 +
  339 + old += remark + ";";
  340 + this.setRemarks(old);
  341 +
  342 + }
  343 +
  344 + public Long getId() {
  345 + return id;
  346 + }
  347 +
  348 + public void setId(Long id) {
  349 + this.id = id;
  350 + }
  351 +
  352 + public Date getScheduleDate() {
  353 + return scheduleDate;
  354 + }
  355 +
  356 + public void setScheduleDate(Date scheduleDate) {
  357 + this.scheduleDate = scheduleDate;
  358 + }
  359 +
  360 + public String getXlName() {
  361 + return xlName;
  362 + }
  363 +
  364 + public void setXlName(String xlName) {
  365 + this.xlName = xlName;
  366 + }
  367 +
  368 + public String getXlBm() {
  369 + return xlBm;
  370 + }
  371 +
  372 + public void setXlBm(String xlBm) {
  373 + this.xlBm = xlBm;
  374 + }
  375 +
  376 + public String getLpName() {
  377 + return lpName;
  378 + }
  379 +
  380 + public void setLpName(String lpName) {
  381 + this.lpName = lpName;
  382 + }
  383 +
  384 + public String getClZbh() {
  385 + return clZbh;
  386 + }
  387 +
  388 + public void setClZbh(String clZbh) {
  389 + this.clZbh = clZbh;
  390 + }
  391 +
  392 + public String getjGh() {
  393 + return jGh;
  394 + }
  395 +
  396 + public void setjGh(String jGh) {
  397 + this.jGh = jGh;
  398 + }
  399 +
  400 + public String getjName() {
  401 + return jName;
  402 + }
  403 +
  404 + public void setjName(String jName) {
  405 + this.jName = jName;
  406 + }
  407 +
  408 + public String getsGh() {
  409 + if(sGh == null)
  410 + return "";
  411 + return sGh;
  412 + }
  413 +
  414 + public void setsGh(String sGh) {
  415 + this.sGh = sGh;
  416 + }
  417 +
  418 + public String getsName() {
  419 + if(sGh == null)
  420 + return "";
  421 + return sName;
  422 + }
  423 +
  424 + public void setsName(String sName) {
  425 + this.sName = sName;
  426 + }
  427 +
  428 + public String getXlDir() {
  429 + return xlDir;
  430 + }
  431 +
  432 + public void setXlDir(String xlDir) {
  433 + this.xlDir = xlDir;
  434 + }
  435 +
  436 + public String getQdzCode() {
  437 + return qdzCode;
  438 + }
  439 +
  440 + public void setQdzCode(String qdzCode) {
  441 + this.qdzCode = qdzCode;
  442 + }
  443 +
  444 + public String getQdzName() {
  445 + return qdzName;
  446 + }
  447 +
  448 + public void setQdzName(String qdzName) {
  449 + this.qdzName = qdzName;
  450 + }
  451 +
  452 + public String getZdzCode() {
  453 + return zdzCode;
  454 + }
  455 +
  456 + public void setZdzCode(String zdzCode) {
  457 + this.zdzCode = zdzCode;
  458 + }
  459 +
  460 + public String getZdzName() {
  461 + return zdzName;
  462 + }
  463 +
  464 + public void setZdzName(String zdzName) {
  465 + this.zdzName = zdzName;
  466 + }
  467 +
  468 + public String getFcsj() {
  469 + return fcsj;
  470 + }
  471 +
  472 + public void setFcsj(String fcsj) {
  473 + this.fcsj = fcsj;
  474 + }
  475 +
  476 + public Long getFcsjT() {
  477 + return fcsjT;
  478 + }
  479 +
  480 + public void setFcsjT(Long fcsjT) {
  481 + this.fcsjT = fcsjT;
  482 + }
  483 +
  484 + public String getZdsj() {
  485 + return zdsj;
  486 + }
  487 +
  488 + public void setZdsj(String zdsj) {
  489 + this.zdsj = zdsj;
  490 + }
  491 +
  492 + public Long getZdsjT() {
  493 + return zdsjT;
  494 + }
  495 +
  496 + public void setZdsjT(Long zdsjT) {
  497 + this.zdsjT = zdsjT;
  498 + }
  499 +
  500 + public Integer getFcno() {
  501 + return fcno;
  502 + }
  503 +
  504 + public void setFcno(Integer fcno) {
  505 + this.fcno = fcno;
  506 + }
  507 +
  508 + public Integer getBcs() {
  509 + return bcs;
  510 + }
  511 +
  512 + public void setBcs(Integer bcs) {
  513 + this.bcs = bcs;
  514 + }
  515 +
  516 + public Double getJhlc() {
  517 + return jhlc;
  518 + }
  519 +
  520 + public void setJhlc(Double jhlc) {
  521 + this.jhlc = jhlc;
  522 + //临加班次 计划公里 和 实际计划公里一样
  523 + if(this.isSflj())
  524 + this.setJhlcOrig(this.getJhlc());
  525 + }
  526 +
  527 + public String getSjlc() {
  528 + return sjlc;
  529 + }
  530 +
  531 + public void setSjlc(String sjlc) {
  532 + this.sjlc = sjlc;
  533 + }
  534 +
  535 + public Integer getBcsj() {
  536 + return bcsj;
  537 + }
  538 +
  539 + public void setBcsj(Integer bcsj) {
  540 + this.bcsj = bcsj;
  541 + }
  542 +
  543 + public String getBcType() {
  544 + return bcType;
  545 + }
  546 +
  547 + public void setBcType(String bcType) {
  548 + this.bcType = bcType;
  549 + }
  550 +
  551 + public SysUser getCreateBy() {
  552 + return createBy;
  553 + }
  554 +
  555 + public void setCreateBy(SysUser createBy) {
  556 + this.createBy = createBy;
  557 + }
  558 +
  559 + public SysUser getUpdateBy() {
  560 + return updateBy;
  561 + }
  562 +
  563 + public void setUpdateBy(SysUser updateBy) {
  564 + this.updateBy = updateBy;
  565 + }
  566 +
  567 + public Date getCreateDate() {
  568 + return createDate;
  569 + }
  570 +
  571 + public void setCreateDate(Date createDate) {
  572 + this.createDate = createDate;
  573 + }
  574 +
  575 + public Date getUpdateDate() {
  576 + return updateDate;
  577 + }
  578 +
  579 + public void setUpdateDate(Date updateDate) {
  580 + this.updateDate = updateDate;
  581 + }
  582 +
  583 + public String getFcsjActual() {
  584 + return fcsjActual;
  585 + }
  586 +
  587 + public void setFcsjActual(String fcsjActual) {
  588 + this.fcsjActual = fcsjActual;
  589 + }
  590 +
  591 + public Long getFcsjActualTime() {
  592 + return fcsjActualTime;
  593 + }
  594 +
  595 + public void setFcsjActualTime(Long fcsjActualTime) {
  596 + this.fcsjActualTime = fcsjActualTime;
  597 + }
  598 +
  599 + public String getZdsjActual() {
  600 + return zdsjActual;
  601 + }
  602 +
  603 + public void setZdsjActual(String zdsjActual) {
  604 + this.zdsjActual = zdsjActual;
  605 + }
  606 +
  607 + public Long getZdsjActualTime() {
  608 + return zdsjActualTime;
  609 + }
  610 +
  611 + public void setZdsjActualTime(Long zdsjActualTime) {
  612 + this.zdsjActualTime = zdsjActualTime;
  613 + }
  614 +
  615 + public int getStatus() {
  616 + return status;
  617 + }
  618 +
  619 + public void setStatus(int status) {
  620 + this.status = status;
  621 + }
  622 +
  623 + public String getRemarks() {
  624 + return remarks;
  625 + }
  626 +
  627 + public void setRemarks(String remarks) {
  628 + this.remarks = remarks;
  629 + }
  630 +
  631 + public String getDfsj() {
  632 + return dfsj;
  633 + }
  634 +
  635 + public void setDfsj(String dfsj) {
  636 + this.dfsj = dfsj;
  637 + }
  638 +
  639 + public Long getDfsjT() {
  640 + return dfsjT;
  641 + }
  642 +
  643 + public void setDfsjT(Long dfsjT) {
  644 + this.dfsjT = dfsjT;
  645 + }
  646 +
  647 +
  648 + @Transient
  649 + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm");
  650 + @Transient
  651 + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
  652 +
  653 + public void setDfsjAll(Long dfsjT) {
  654 + this.dfsjT = dfsjT;
  655 + this.dfsj = fmtHHmm.print(this.dfsjT);
  656 + }
  657 +
  658 + public void setDfsjAll(String dfsj) {
  659 + this.dfsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + dfsj);
  660 + this.dfsj = dfsj;
  661 + }
  662 +
  663 + public void calcEndTime(){
  664 + //计划终点时间
  665 + if(this.getBcsj() != null){
  666 + //this.setZdsjT(this.getDfsjT() + (this.getBcsj() * 60 * 1000));
  667 + this.setZdsjT(this.getFcsjT() + (this.getBcsj() * 60 * 1000));//计划终点时间不变
  668 + this.setZdsj(fmtHHmm.print(this.zdsjT));
  669 + }
  670 + }
  671 +
  672 + public Integer getDirectiveState() {
  673 + return directiveState;
  674 + }
  675 +
  676 + public void setDirectiveState(Integer directiveState) {
  677 + this.directiveState = directiveState;
  678 + }
  679 +
  680 + @Override
  681 + public boolean equals(Object obj) {
  682 + try{
  683 + return this.id.equals(((ScheduleRealInfo)obj).getId());
  684 + }catch(Exception e){
  685 + return false;
  686 + }
  687 + }
  688 +
  689 + @Override
  690 + public int hashCode() {
  691 + return ("schedule_" + this.id).hashCode();
  692 + }
  693 +
  694 + public boolean isSflj() {
  695 + return sflj;
  696 + }
  697 +
  698 + public void setSflj(boolean sflj) {
  699 + this.sflj = sflj;
  700 + }
  701 +
  702 + /**
  703 + *
  704 + * @Title: setFcsjAll
  705 + * @Description: TODO(设置计划发车时间)
  706 + * @throws
  707 + */
  708 + public void setFcsjAll(String fcsj){
  709 + this.fcsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + fcsj);
  710 + this.fcsj = fcsj;
  711 + }
  712 +
  713 + /**
  714 + *
  715 + * @Title: setFcsjAll
  716 + * @Description: TODO(设置计划发车时间)
  717 + * @throws
  718 + */
  719 + public void setFcsjAll(Long fcsjT){
  720 + this.fcsjT = fcsjT;
  721 + this.fcsj = fmtHHmm.print(fcsjT);
  722 + }
  723 +
  724 + /**
  725 + *
  726 + * @Title: setFcsjActualAll
  727 + * @Description: TODO(设置实际发车时间 字符串)
  728 + * @throws
  729 + */
  730 + public void setFcsjActualAll(String fcsjActual){
  731 + this.fcsjActualTime = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + fcsjActual);
  732 + this.fcsjActual = fcsjActual;
  733 + calcStatus();
  734 + }
  735 +
  736 + /**
  737 + *
  738 + * @Title: setFcsjActualAll
  739 + * @Description: TODO(设置实际发车时间 时间戳)
  740 + * @throws
  741 + */
  742 + public void setFcsjActualAll(Long t){
  743 +
  744 + this.fcsjActualTime = t;
  745 + if(null == t)
  746 + this.fcsjActual = null;
  747 + else
  748 + this.fcsjActual = fmtHHmm.print(t);
  749 +
  750 + //更新班次状态
  751 + calcStatus();
  752 + }
  753 +
  754 + /**
  755 + *
  756 + * @Title: setFcsjActualAll
  757 + * @Description: TODO(设置实际终点时间)
  758 + * @throws
  759 + */
  760 + public void setZdsjActualAll(Long t){
  761 + this.zdsjActualTime = t;
  762 +
  763 + if(null == t)
  764 + this.zdsjActual = null;
  765 + else
  766 + this.zdsjActual = fmtHHmm.print(t);
  767 +
  768 + //更新班次状态
  769 + calcStatus();
  770 + }
  771 +
  772 + /**
  773 + *
  774 + * @Title: setFcsjActualAll
  775 + * @Description: TODO(设置实际终点时间)
  776 + * @throws
  777 + */
  778 + public void setZdsjActualAll(String zdsjActual){
  779 + this.zdsjActualTime = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + zdsjActual);
  780 + this.zdsjActual = zdsjActual;
  781 +
  782 + calcStatus();
  783 + }
  784 +
  785 + public Long getSpId() {
  786 + return spId;
  787 + }
  788 +
  789 + public void setSpId(Long spId) {
  790 + this.spId = spId;
  791 + }
  792 +
  793 + public String getRealExecDate() {
  794 + return realExecDate;
  795 + }
  796 +
  797 + public void setRealExecDate(String realExecDate) {
  798 + this.realExecDate = realExecDate;
  799 + }
  800 +
  801 + public void calcStatus() {
  802 + if(this.status == -1)
  803 + return;
  804 +
  805 + this.status = 0;
  806 + if(StringUtils.isNotBlank(this.fcsjActual)){
  807 + this.status = 1;
  808 +
  809 + //进出场班次并且没有计划里程的
  810 + if((this.bcType.equals("out") || this.bcType.equals("in"))
  811 + && this.jhlc == null){
  812 + this.status = 2;
  813 + }
  814 + }
  815 + if(StringUtils.isNotBlank(this.zdsjActual))
  816 + this.status = 2;
  817 + }
  818 +
  819 + public void destroy(){
  820 + this.jhlc = 0.0;
  821 + if(this.isSflj())
  822 + this.jhlcOrig = 0.0;
  823 + this.status = -1;
  824 + this.clearFcsjActual();
  825 + }
  826 +
  827 + public boolean isDestroy(){
  828 + return this.status == -1;
  829 + }
  830 +
  831 +/* public boolean isNotDestroy(){
  832 + return this.status != -1;
  833 + }*/
  834 +
  835 + public Set<ChildTaskPlan> getcTasks() {
  836 + return cTasks;
  837 + }
  838 +
  839 +/* public void setcTasks(Set<ChildTaskPlan> cTasks) {
  840 + this.cTasks = cTasks;
  841 + }*/
  842 +
  843 + public String getScheduleDateStr() {
  844 + return scheduleDateStr;
  845 + }
  846 +
  847 + public void setScheduleDateStr(String scheduleDateStr) {
  848 + this.scheduleDateStr = scheduleDateStr;
  849 + }
  850 +
  851 + public void clearFcsjActual(){
  852 + this.setFcsjActual(null);
  853 + this.setFcsjActualTime(null);
  854 + this.calcStatus();
  855 + }
  856 +
  857 + //清除实际终点时间
  858 + public void clearZdsjActual(){
  859 + this.setZdsjActual(null);
  860 + this.setZdsjActualTime(null);
  861 +
  862 + calcStatus();
  863 + }
  864 +
  865 + public boolean isLate() {
  866 + return late;
  867 + }
  868 +
  869 + public void setLate(boolean late) {
  870 + this.late = late;
  871 + }
  872 +
  873 + public String getAdjustExps() {
  874 + return adjustExps;
  875 + }
  876 +
  877 + public void setAdjustExps(String adjustExps) {
  878 + this.adjustExps = adjustExps;
  879 + }
  880 +
  881 + public boolean isReissue() {
  882 + return reissue;
  883 + }
  884 +
  885 + public void setReissue(boolean reissue) {
  886 + this.reissue = reissue;
  887 + }
  888 +
  889 + public Double getRealMileage() {
  890 + return realMileage;
  891 + }
  892 +
  893 + public void setRealMileage(Double realMileage) {
  894 + this.realMileage = realMileage;
  895 + }
  896 +
  897 + public Double getJhlcOrig() {
  898 + return jhlcOrig;
  899 + }
  900 +
  901 + public void setJhlcOrig(Double jhlcOrig) {
  902 + this.jhlcOrig = jhlcOrig;
  903 + }
  904 +
  905 + public void reCalcLate() {
  906 + if(this.getStatus() == 0
  907 + && this.getFcsjActual() == null
  908 + && this.dfsjT < System.currentTimeMillis()){
  909 + this.setLate(true);
  910 + }
  911 + else
  912 + this.setLate(false);
  913 + }
  914 +
  915 + public String getRemark() {
  916 + return remark;
  917 + }
  918 +
  919 + public void setRemark(String remark) {
  920 + this.remark = remark;
  921 + }
  922 +
  923 + public float getLateMinute() {
  924 + return lateMinute;
  925 + }
  926 +
  927 + public void setLateMinute(float lateMinute) {
  928 + this.lateMinute = lateMinute;
  929 + }
  930 +
  931 + public boolean isLate2() {
  932 + return late2;
  933 + }
  934 +
  935 + public void setLate2(boolean late2) {
  936 + this.late2 = late2;
  937 + }
  938 +
  939 + public int getFcpSn() {
  940 + return fcpSn;
  941 + }
  942 +
  943 + public void setFcpSn(int fcpSn) {
  944 + this.fcpSn = fcpSn;
  945 + }
  946 +
  947 + public boolean _isInout(){
  948 + return this.getBcType().equals("out") || this.getBcType().equals("in");
  949 + }
  950 +
  951 + public boolean isDeleted() {
  952 + return deleted;
  953 + }
  954 +
  955 + public void setDeleted(boolean deleted) {
  956 + this.deleted = deleted;
  957 + }
  958 +
  959 + public int getSaveFailCount() {
  960 + return saveFailCount;
  961 + }
  962 +
  963 + public void setSaveFailCount(int saveFailCount) {
  964 + this.saveFailCount = saveFailCount;
  965 + }
  966 +
  967 + public int getSiginCompate() {
  968 + return siginCompate;
  969 + }
  970 +
  971 + public void setSiginCompate(int siginCompate) {
  972 + this.siginCompate = siginCompate;
  973 + }
  974 +
  975 + public Integer getDriftStatus() {
  976 + return driftStatus;
  977 + }
  978 +
  979 + public void setDriftStatus(Integer driftStatus) {
  980 + this.driftStatus = driftStatus;
  981 + }
  982 +
  983 + public boolean isCcService() {
  984 + return ccService;
  985 + }
  986 +
  987 + public void setCcService(boolean ccService) {
  988 + this.ccService = ccService;
  989 + }
  990 +
  991 + public String getMajorStationName() {
  992 + return majorStationName;
  993 + }
  994 +
  995 + public void setMajorStationName(String majorStationName) {
  996 + this.majorStationName = majorStationName;
  997 + }
  998 +
  999 + public int getRfidState() {
  1000 + return rfidState;
  1001 + }
  1002 +
  1003 + public void setRfidState(int rfidState) {
  1004 + this.rfidState = rfidState;
  1005 + }
  1006 +}
src/main/java/com/bsth/repository/calc/CalcWaybillRepository.java
@@ -72,4 +72,21 @@ public interface CalcWaybillRepository extends BaseRepository&lt;CalcWaybill, Integ @@ -72,4 +72,21 @@ public interface CalcWaybillRepository extends BaseRepository&lt;CalcWaybill, Integ
72 + " and c.cl in (select s.carCode from Cars s where s.sfdc = ?7) order by c.xl") 72 + " and c.cl in (select s.carCode from Cars s where s.sfdc = ?7) order by c.xl")
73 List<CalcWaybill> scheduleByZbh(String line,String date,String date2,String gsdm,String fgsdm,String zbh,Boolean sfdc); 73 List<CalcWaybill> scheduleByZbh(String line,String date,String date2,String gsdm,String fgsdm,String zbh,Boolean sfdc);
74 74
  75 +
  76 + //按照时间段统计,公司下线路 (驾驶员)
  77 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% order by c.jGh,c.xl,c.rq")
  78 + List<CalcWaybill> scheduleByJsy2(String line,String date,String date2,String gsdm,String fgsdm);
  79 + //按照时间段统计,公司下线路 (售票员) coalesce(c.sGh,'')
  80 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and c.sGh <> null and c.sGh <> '' order by c.sGh,c.xl,c.rq")
  81 + List<CalcWaybill> scheduleBySpy2(String line,String date,String date2,String gsdm,String fgsdm);
  82 + //按照时间段统计,公司下线路 (车辆自编号)
  83 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% order by c.cl,c.xl,c.rq")
  84 + List<CalcWaybill> scheduleByZbh2(String line,String date,String date2,String gsdm,String fgsdm);
  85 + //按照时间段统计,公司下线路 排序不同
  86 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% order by c.xl,c.rq")
  87 + List<CalcWaybill> scheduleByDateAndLineTjPx(String line,String date,String date2,String gsdm,String fgsdm);
  88 + //按照时间段统计,单条线路 排序不同
  89 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl = ?1 and c.rqStr between ?2 and ?3 order by c.xl,c.rq")
  90 + List<CalcWaybill> scheduleByDateAndLineTjPx2(String line,String date,String date2);
  91 +
75 } 92 }
src/main/java/com/bsth/service/calc/CalcIntervalService.java
@@ -17,6 +17,8 @@ public interface CalcIntervalService extends BaseService&lt;CalcInterval,Integer&gt; { @@ -17,6 +17,8 @@ public interface CalcIntervalService extends BaseService&lt;CalcInterval,Integer&gt; {
17 List<Map<String,Object>> interval(Map<String, Object> map); 17 List<Map<String,Object>> interval(Map<String, Object> map);
18 //根据预统计表查询 18 //根据预统计表查询
19 List<Map<String,Object>> intervalDetail(Map<String, Object> map); 19 List<Map<String,Object>> intervalDetail(Map<String, Object> map);
  20 + //导出全部天数大间隔详细
  21 + List<Map<String,Object>> exportDetail(Map<String, Object> map);
20 //大间隔统计表(大间隔发生次数统计表) 22 //大间隔统计表(大间隔发生次数统计表)
21 List<Map<String,Object>> sumInterval(Map<String, Object> map); 23 List<Map<String,Object>> sumInterval(Map<String, Object> map);
22 24
src/main/java/com/bsth/service/calc/CalcWaybillService.java
@@ -41,5 +41,6 @@ public interface CalcWaybillService extends BaseService&lt;CalcWaybill, Integer&gt; { @@ -41,5 +41,6 @@ public interface CalcWaybillService extends BaseService&lt;CalcWaybill, Integer&gt; {
41 List<Map<String, Object>> getLineMileage(String gsdm, String fgsdm, String line, String date, String date2, String xlName, String zt, String by, String type); 41 List<Map<String, Object>> getLineMileage(String gsdm, String fgsdm, String line, String date, String date2, String xlName, String zt, String by, String type);
42 42
43 List<Map<String, Object>> getBusMileage(String line, String date, String date2, String xlName, String zt, String by, String type); 43 List<Map<String, Object>> getBusMileage(String line, String date, String date2, String xlName, String zt, String by, String type);
44 - 44 +
  45 + List<List<String>> calcDetailMonthly(Map<String, Object> map);
45 } 46 }