Commit 28aa3c68adc45901d64095584fbeeb305cbde440

Authored by 王通
1 parent 6c8e4046

1.线调页面加入RFID状态指示灯

Too many changes to show.

To preserve performance only 10 of 14 files are displayed.

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 + RfidDataLoaderThread rfidDataLoader;
  77 +
  78 + @Autowired
  79 + OfflineMonitorThread offlineMonitorThread;
  80 +
  81 + @Autowired
  82 + LineVersionsData lineVersionsData;
  83 +
  84 + /*@Autowired
  85 + FixedEnableVerionsThread fixedEnableVerionsThread;*/
  86 +
  87 + @Autowired
  88 + SafeDrivDataLoadThread safeDrivDataLoadThread;
  89 +
  90 + @Autowired
  91 + FixedCheckStationCodeThread fixedCheckStationCodeThread;
  92 +
  93 + private static long timeDiff;
  94 + private static long timeDiffTraffic;
  95 +
  96 + static {
  97 + // 早上2:20
  98 + timeDiff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis();
  99 + if (timeDiff < 0)
  100 + timeDiff += (1000 * 60 * 60 * 24);
  101 + // 早上07:00
  102 + timeDiffTraffic = (DateUtils.getTimestamp() + 1000 * 60 * 60 * 7) - System.currentTimeMillis();
  103 + if (timeDiffTraffic < 0)
  104 + timeDiffTraffic += (1000 * 60 * 60 * 24);
  105 + }
  106 +
  107 + @Override
  108 + public void run(String... strings) throws Exception {
  109 + try {
  110 + Tools tools = new Tools("application.properties");
  111 + String environment = tools.getValue("spring.profiles.active");
  112 + //预先加载基础的对照数据
  113 + basicDataLoader.loadAllData();
  114 + switch (environment){
  115 + case "dev":
  116 + devInit();
  117 + break;
  118 + case "prod":
  119 + prodInit();
  120 + break;
  121 + }
  122 + }catch (Exception e){
  123 + log.error("线调后台启动出现异常!!", e);
  124 + System.exit(1);
  125 + }
  126 + }
  127 +
  128 + @Autowired
  129 + DayOfSchedule dayOfSchedule;
  130 + public void devInit(){
  131 + log.info("devInit...");
  132 + ScheduledExecutorService sexec = Application.mainServices;
  133 + //抓取GPS数据
  134 + gpsDataLoader.setFlag(-1);
  135 + //dayOfSchedule.dataRecovery();
  136 + //sexec.scheduleWithFixedDelay(gpsDataLoader, 60, 4, TimeUnit.SECONDS);
  137 + //实际排班更新线程
  138 + //sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
  139 + //sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 30, TimeUnit.SECONDS);//检查班次误点
  140 + //sexec.scheduleWithFixedDelay(autoExecScanThread, 100, 50, TimeUnit.SECONDS);//班次自动执行
  141 + //WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的
  142 +
  143 + //sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 50, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码
  144 + //实际排班延迟入库线程
  145 + //sexec.scheduleWithFixedDelay(schedulePstThread, 60, 15, TimeUnit.SECONDS);
  146 + //班次修正日志延迟入库
  147 + //sexec.scheduleWithFixedDelay(seiPstThread, 60, 30, TimeUnit.SECONDS);
  148 + //调度指令延迟入库
  149 + //sexec.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS);
  150 + //线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作)
  151 + //sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);
  152 +
  153 + //安全驾驶
  154 + //sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 40, 30, TimeUnit.SECONDS);
  155 +
  156 + //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 20, 60 * 2 , TimeUnit.SECONDS);
  157 + }
  158 +
  159 + public void prodInit(){
  160 + log.info("prodInit...");
  161 + ScheduledExecutorService sexec = Application.mainServices;
  162 + //安全驾驶
  163 + sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS);
  164 +
  165 + /** 线调业务 */
  166 + sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程
  167 + sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点
  168 + sexec.scheduleWithFixedDelay(gpsDataLoader, 100, 2, TimeUnit.SECONDS);//抓取GPS数据
  169 + sexec.scheduleWithFixedDelay(rfidDataLoader, 5, 5, TimeUnit.SECONDS);//抓取RFID数据
  170 + sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码
  171 +
  172 + sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线
  173 + sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程
  174 + sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库
  175 + sexec.scheduleWithFixedDelay(directivesPstThread, 120, 60, TimeUnit.SECONDS);//调度指令延迟入库
  176 + sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作)
  177 + sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据
  178 + sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新
  179 + sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行
  180 + DirectivePushQueue.start();//消息队列 -指令,系统下发的
  181 + WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的
  182 +
  183 + /** 线调为其他程序提供的数据 --写入数据库 */
  184 + sexec.scheduleWithFixedDelay(fcxxUpdateThread, 160, 30, TimeUnit.SECONDS);//发车信息(发车屏、信息发布)
  185 + //线路首末班数据(网关用,班次更新时写入)
  186 + //com.bsth.data.schedule.f_a_l.FirstAndLastHandler
  187 + sexec.scheduleWithFixedDelay(schSiginUpdateDBThread, 160, 60 * 30, TimeUnit.SECONDS);//无法自动完成的班次信息(网关用,补信号)
  188 +
  189 + //运管处静态数据提交
  190 + log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处");
  191 + //sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
  192 + //计算油、公里加注
  193 + sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
  194 +
  195 + //线路版本更新
  196 + sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS);
  197 +
  198 + //线路版本更新
  199 + //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS);
  200 + }
  201 +}
... ...
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 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 35 \ No newline at end of file
... ...
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/websocket/dto/WsScheduleRealInfo.java
1   -package com.bsth.websocket.dto;
2   -
3   -import com.bsth.entity.realcontrol.ChildTaskPlan;
4   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
5   -
6   -import javax.persistence.FetchType;
7   -import javax.persistence.OneToMany;
8   -import javax.persistence.Transient;
9   -import java.util.*;
10   -
11   -/**
12   - * 精简字段的实际排班 entity
13   - * webSocket 传输用,去掉了页面不需要的一些字段
14   - * Created by panzhao on 2017/11/14.
15   - */
16   -public class WsScheduleRealInfo {
17   -
18   - public static WsScheduleRealInfo getInstance(ScheduleRealInfo sch){
19   - if(null == sch)
20   - return null;
21   - WsScheduleRealInfo wss = new WsScheduleRealInfo();
22   - wss.id = sch.getId();
23   - wss.scheduleDateStr = sch.getScheduleDateStr();
24   - wss.realExecDate = sch.getRealExecDate();
25   - wss.xlName = sch.getXlName();
26   - wss.xlBm = sch.getXlBm();
27   - wss.lpName = sch.getLpName();
28   - wss.clZbh = sch.getClZbh();
29   - wss.jGh = sch.getjGh();
30   - wss.jName = sch.getjName();
31   - wss.sGh = sch.getsGh();
32   - wss.sName = sch.getsName();
33   - wss.xlDir = sch.getXlDir();
34   - wss.qdzCode = sch.getQdzCode();
35   - wss.qdzName = sch.getQdzName();
36   - wss.zdzCode = sch.getZdzCode();
37   - wss.zdzName = sch.getZdzName();
38   - wss.fcsj = sch.getFcsj();
39   - wss.fcsjT = sch.getFcsjT();
40   - wss.zdsj = sch.getZdsj();
41   - wss.zdsjT = sch.getZdsjT();
42   - wss.jhlc = sch.getJhlc();
43   - wss.jhlcOrig = sch.getJhlcOrig();
44   - wss.bcsj = sch.getBcsj();
45   - wss.bcType = sch.getBcType();
46   - wss.majorStationName = sch.getMajorStationName();
47   - wss.fcsjActual = sch.getFcsjActual();
48   - wss.fcsjActualTime = sch.getFcsjActualTime();
49   - wss.zdsjActual = sch.getZdsjActual();
50   - wss.zdsjActualTime = sch.getZdsjActualTime();
51   - wss.status = sch.getStatus();
52   - wss.adjustExps = sch.getAdjustExps();
53   - wss.sflj = sch.isSflj();
54   - wss.late = sch.isLate();
55   - wss.late2 = sch.isLate2();
56   - wss.lateMinute = sch.getLateMinute();
57   - wss.remarks = sch.getRemarks();
58   - wss.dfsj = sch.getDfsj();
59   - wss.dfsjT = sch.getDfsjT();
60   - wss.directiveState = sch.getDirectiveState();
61   - wss.qdzArrDatejh = sch.getQdzArrDatejh();
62   - wss.qdzArrDatesj = sch.getQdzArrDatesj();
63   - wss.cTasks = sch.getcTasks();
64   - wss.gsName = sch.getGsName();
65   - wss.gsBm = sch.getGsBm();
66   - wss.fgsName = sch.getFgsName();
67   - wss.fgsBm = sch.getFgsBm();
68   - wss.ccService = sch.isCcService();
69   - return wss;
70   - }
71   -
72   -
73   - public static List<WsScheduleRealInfo> getMultiInstance(Collection<ScheduleRealInfo> list){
74   - List<WsScheduleRealInfo> rs = new ArrayList<>();
75   - for(ScheduleRealInfo sch : list){
76   - rs.add(getInstance(sch));
77   - }
78   - return rs;
79   - }
80   -
81   - /** 主键Id */
82   - private Long id;
83   -
84   - /** 排班日期字符串 YYYY-MM-DD */
85   - private String scheduleDateStr;
86   -
87   - /** 真实执行时间 yyyy-MM-dd */
88   - private String realExecDate;
89   -
90   - /** 线路名称 */
91   - private String xlName;
92   - /** 线路编码 */
93   - private String xlBm;
94   -
95   - /** 路牌名称 */
96   - private String lpName;
97   -
98   - /** 车辆自编号 */
99   - private String clZbh;
100   -
101   - /** 驾驶员工号 */
102   - private String jGh;
103   - /** 驾驶员名字 */
104   - private String jName;
105   - /** 售票员工号 */
106   - private String sGh;
107   - /** 售票员名字 */
108   - private String sName;
109   -
110   - /** 线路方向 */
111   - private String xlDir;
112   - /** 起点站code*/
113   - private String qdzCode;
114   - /** 起点站名字 */
115   - private String qdzName;
116   -
117   - /** 终点站code*/
118   - private String zdzCode;
119   - /** 终点站名字 */
120   - private String zdzName;
121   -
122   - /** 计划发车时间(格式 HH:mm) */
123   - private String fcsj;
124   - /** 计划发车时间戳*/
125   - @Transient
126   - private Long fcsjT;
127   -
128   - /** 计划终点时间(格式 HH:mm) */
129   - private String zdsj;
130   - /** 计划终点时间戳*/
131   - @Transient
132   - private Long zdsjT;
133   -
134   - /** 计划里程 */
135   - private Double jhlc;
136   -
137   - /** 原始计划里程 (原计调的数据) */
138   - private Double jhlcOrig;
139   - /** 班次历时 */
140   - private Integer bcsj;
141   -
142   - /**
143   - * 班次类型 TODO:正常班次、出场、进场、加油、区间班次、放空班次、放大站班次、两点间空驶
144   - */
145   - private String bcType;
146   -
147   - //放站班次 站点名称
148   - private String majorStationName;
149   -
150   - /** 实际发车时间*/
151   - private String fcsjActual;
152   - /** 实际发车时间戳*/
153   - @Transient
154   - private Long fcsjActualTime;
155   - /**实际终点时间 */
156   - private String zdsjActual;
157   - /** 实际终点时间戳*/
158   - @Transient
159   - private Long zdsjActualTime;
160   -
161   - /**班次状态 0 未执行 1 正在执行 2 已执行 -1 已烂班 */
162   - private int status;
163   -
164   - private String adjustExps;
165   -
166   - /** 是否是临加班次 */
167   - private boolean sflj;
168   -
169   - /** 是否误点 (应发未发)*/
170   - @Transient
171   - private boolean late;
172   -
173   - /** 是否误点 (应发未到) */
174   - @Transient
175   - private boolean late2;
176   - /** 误点停靠时间 */
177   - @Transient
178   - private float lateMinute;
179   -
180   - /** 备注*/
181   - private String remarks;
182   -
183   - /**待发时间(格式 HH:mm) */
184   - private String dfsj;
185   -
186   - /**待发时间戳 */
187   - @Transient
188   - private Long dfsjT;
189   -
190   - /** 指令下发状态 60: 已发送, 100: 设备确认收到, 200:驾驶员确认 0:失败 */
191   - private Integer directiveState = -1;
192   -
193   - /** 起点站计划到达时间 */
194   - @Transient
195   - private String qdzArrDatejh;
196   -
197   - /** 起点站实际到达时间 */
198   - @Transient
199   - private String qdzArrDatesj;
200   -
201   - /** 子任务 */
202   - @OneToMany(fetch = FetchType.LAZY, mappedBy = "schedule")
203   - private Set<ChildTaskPlan> cTasks = new HashSet<>();
204   -
205   - /** 关联的公司名称 */
206   - private String gsName;
207   - /** 关联的公司编码 */
208   - private String gsBm;
209   - /** 关联的分公司名称 */
210   - private String fgsName;
211   - /** 关联的分公司编码 */
212   - private String fgsBm;
213   -
214   - /**
215   - * 换车营运标记 true 表示该主任务由 【中途换车子任务】 级联生成
216   - */
217   - private boolean ccService;
218   -
219   - public Long getId() {
220   - return id;
221   - }
222   -
223   - public void setId(Long id) {
224   - this.id = id;
225   - }
226   -
227   - public String getScheduleDateStr() {
228   - return scheduleDateStr;
229   - }
230   -
231   - public void setScheduleDateStr(String scheduleDateStr) {
232   - this.scheduleDateStr = scheduleDateStr;
233   - }
234   -
235   - public String getRealExecDate() {
236   - return realExecDate;
237   - }
238   -
239   - public void setRealExecDate(String realExecDate) {
240   - this.realExecDate = realExecDate;
241   - }
242   -
243   - public String getXlName() {
244   - return xlName;
245   - }
246   -
247   - public void setXlName(String xlName) {
248   - this.xlName = xlName;
249   - }
250   -
251   - public String getXlBm() {
252   - return xlBm;
253   - }
254   -
255   - public void setXlBm(String xlBm) {
256   - this.xlBm = xlBm;
257   - }
258   -
259   - public String getLpName() {
260   - return lpName;
261   - }
262   -
263   - public void setLpName(String lpName) {
264   - this.lpName = lpName;
265   - }
266   -
267   - public String getClZbh() {
268   - return clZbh;
269   - }
270   -
271   - public void setClZbh(String clZbh) {
272   - this.clZbh = clZbh;
273   - }
274   -
275   - public String getjGh() {
276   - return jGh;
277   - }
278   -
279   - public void setjGh(String jGh) {
280   - this.jGh = jGh;
281   - }
282   -
283   - public String getjName() {
284   - return jName;
285   - }
286   -
287   - public void setjName(String jName) {
288   - this.jName = jName;
289   - }
290   -
291   - public String getsGh() {
292   - return sGh;
293   - }
294   -
295   - public void setsGh(String sGh) {
296   - this.sGh = sGh;
297   - }
298   -
299   - public String getsName() {
300   - return sName;
301   - }
302   -
303   - public void setsName(String sName) {
304   - this.sName = sName;
305   - }
306   -
307   - public String getXlDir() {
308   - return xlDir;
309   - }
310   -
311   - public void setXlDir(String xlDir) {
312   - this.xlDir = xlDir;
313   - }
314   -
315   - public String getQdzCode() {
316   - return qdzCode;
317   - }
318   -
319   - public void setQdzCode(String qdzCode) {
320   - this.qdzCode = qdzCode;
321   - }
322   -
323   - public String getQdzName() {
324   - return qdzName;
325   - }
326   -
327   - public void setQdzName(String qdzName) {
328   - this.qdzName = qdzName;
329   - }
330   -
331   - public String getZdzCode() {
332   - return zdzCode;
333   - }
334   -
335   - public void setZdzCode(String zdzCode) {
336   - this.zdzCode = zdzCode;
337   - }
338   -
339   - public String getZdzName() {
340   - return zdzName;
341   - }
342   -
343   - public void setZdzName(String zdzName) {
344   - this.zdzName = zdzName;
345   - }
346   -
347   - public String getFcsj() {
348   - return fcsj;
349   - }
350   -
351   - public void setFcsj(String fcsj) {
352   - this.fcsj = fcsj;
353   - }
354   -
355   - public Long getFcsjT() {
356   - return fcsjT;
357   - }
358   -
359   - public void setFcsjT(Long fcsjT) {
360   - this.fcsjT = fcsjT;
361   - }
362   -
363   - public String getZdsj() {
364   - return zdsj;
365   - }
366   -
367   - public void setZdsj(String zdsj) {
368   - this.zdsj = zdsj;
369   - }
370   -
371   - public Long getZdsjT() {
372   - return zdsjT;
373   - }
374   -
375   - public void setZdsjT(Long zdsjT) {
376   - this.zdsjT = zdsjT;
377   - }
378   -
379   - public Double getJhlc() {
380   - return jhlc;
381   - }
382   -
383   - public void setJhlc(Double jhlc) {
384   - this.jhlc = jhlc;
385   - }
386   -
387   - public Double getJhlcOrig() {
388   - return jhlcOrig;
389   - }
390   -
391   - public void setJhlcOrig(Double jhlcOrig) {
392   - this.jhlcOrig = jhlcOrig;
393   - }
394   -
395   - public Integer getBcsj() {
396   - return bcsj;
397   - }
398   -
399   - public void setBcsj(Integer bcsj) {
400   - this.bcsj = bcsj;
401   - }
402   -
403   - public String getBcType() {
404   - return bcType;
405   - }
406   -
407   - public void setBcType(String bcType) {
408   - this.bcType = bcType;
409   - }
410   -
411   - public String getMajorStationName() {
412   - return majorStationName;
413   - }
414   -
415   - public void setMajorStationName(String majorStationName) {
416   - this.majorStationName = majorStationName;
417   - }
418   -
419   - public String getFcsjActual() {
420   - return fcsjActual;
421   - }
422   -
423   - public void setFcsjActual(String fcsjActual) {
424   - this.fcsjActual = fcsjActual;
425   - }
426   -
427   - public Long getFcsjActualTime() {
428   - return fcsjActualTime;
429   - }
430   -
431   - public void setFcsjActualTime(Long fcsjActualTime) {
432   - this.fcsjActualTime = fcsjActualTime;
433   - }
434   -
435   - public String getZdsjActual() {
436   - return zdsjActual;
437   - }
438   -
439   - public void setZdsjActual(String zdsjActual) {
440   - this.zdsjActual = zdsjActual;
441   - }
442   -
443   - public Long getZdsjActualTime() {
444   - return zdsjActualTime;
445   - }
446   -
447   - public void setZdsjActualTime(Long zdsjActualTime) {
448   - this.zdsjActualTime = zdsjActualTime;
449   - }
450   -
451   - public int getStatus() {
452   - return status;
453   - }
454   -
455   - public void setStatus(int status) {
456   - this.status = status;
457   - }
458   -
459   - public String getAdjustExps() {
460   - return adjustExps;
461   - }
462   -
463   - public void setAdjustExps(String adjustExps) {
464   - this.adjustExps = adjustExps;
465   - }
466   -
467   - public boolean isSflj() {
468   - return sflj;
469   - }
470   -
471   - public void setSflj(boolean sflj) {
472   - this.sflj = sflj;
473   - }
474   -
475   - public boolean isLate() {
476   - return late;
477   - }
478   -
479   - public void setLate(boolean late) {
480   - this.late = late;
481   - }
482   -
483   - public boolean isLate2() {
484   - return late2;
485   - }
486   -
487   - public void setLate2(boolean late2) {
488   - this.late2 = late2;
489   - }
490   -
491   - public float getLateMinute() {
492   - return lateMinute;
493   - }
494   -
495   - public void setLateMinute(float lateMinute) {
496   - this.lateMinute = lateMinute;
497   - }
498   -
499   - public String getRemarks() {
500   - return remarks;
501   - }
502   -
503   - public void setRemarks(String remarks) {
504   - this.remarks = remarks;
505   - }
506   -
507   - public String getDfsj() {
508   - return dfsj;
509   - }
510   -
511   - public void setDfsj(String dfsj) {
512   - this.dfsj = dfsj;
513   - }
514   -
515   - public Long getDfsjT() {
516   - return dfsjT;
517   - }
518   -
519   - public void setDfsjT(Long dfsjT) {
520   - this.dfsjT = dfsjT;
521   - }
522   -
523   - public Integer getDirectiveState() {
524   - return directiveState;
525   - }
526   -
527   - public void setDirectiveState(Integer directiveState) {
528   - this.directiveState = directiveState;
529   - }
530   -
531   - public String getQdzArrDatejh() {
532   - return qdzArrDatejh;
533   - }
534   -
535   - public void setQdzArrDatejh(String qdzArrDatejh) {
536   - this.qdzArrDatejh = qdzArrDatejh;
537   - }
538   -
539   - public String getQdzArrDatesj() {
540   - return qdzArrDatesj;
541   - }
542   -
543   - public void setQdzArrDatesj(String qdzArrDatesj) {
544   - this.qdzArrDatesj = qdzArrDatesj;
545   - }
546   -
547   - public Set<ChildTaskPlan> getcTasks() {
548   - return cTasks;
549   - }
550   -
551   - public void setcTasks(Set<ChildTaskPlan> cTasks) {
552   - this.cTasks = cTasks;
553   - }
554   -
555   - public String getGsName() {
556   - return gsName;
557   - }
558   -
559   - public void setGsName(String gsName) {
560   - this.gsName = gsName;
561   - }
562   -
563   - public String getGsBm() {
564   - return gsBm;
565   - }
566   -
567   - public void setGsBm(String gsBm) {
568   - this.gsBm = gsBm;
569   - }
570   -
571   - public String getFgsName() {
572   - return fgsName;
573   - }
574   -
575   - public void setFgsName(String fgsName) {
576   - this.fgsName = fgsName;
577   - }
578   -
579   - public String getFgsBm() {
580   - return fgsBm;
581   - }
582   -
583   - public void setFgsBm(String fgsBm) {
584   - this.fgsBm = fgsBm;
585   - }
586   -
587   - public boolean isCcService() {
588   - return ccService;
589   - }
590   -
591   - public void setCcService(boolean ccService) {
592   - this.ccService = ccService;
593   - }
594   -}
  1 +package com.bsth.websocket.dto;
  2 +
  3 +import com.bsth.entity.realcontrol.ChildTaskPlan;
  4 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  5 +
  6 +import javax.persistence.FetchType;
  7 +import javax.persistence.OneToMany;
  8 +import javax.persistence.Transient;
  9 +import java.util.*;
  10 +
  11 +/**
  12 + * 精简字段的实际排班 entity
  13 + * webSocket 传输用,去掉了页面不需要的一些字段
  14 + * Created by panzhao on 2017/11/14.
  15 + */
  16 +public class WsScheduleRealInfo {
  17 +
  18 + public static WsScheduleRealInfo getInstance(ScheduleRealInfo sch){
  19 + if(null == sch)
  20 + return null;
  21 + WsScheduleRealInfo wss = new WsScheduleRealInfo();
  22 + wss.id = sch.getId();
  23 + wss.scheduleDateStr = sch.getScheduleDateStr();
  24 + wss.realExecDate = sch.getRealExecDate();
  25 + wss.xlName = sch.getXlName();
  26 + wss.xlBm = sch.getXlBm();
  27 + wss.lpName = sch.getLpName();
  28 + wss.clZbh = sch.getClZbh();
  29 + wss.jGh = sch.getjGh();
  30 + wss.jName = sch.getjName();
  31 + wss.sGh = sch.getsGh();
  32 + wss.sName = sch.getsName();
  33 + wss.xlDir = sch.getXlDir();
  34 + wss.qdzCode = sch.getQdzCode();
  35 + wss.qdzName = sch.getQdzName();
  36 + wss.zdzCode = sch.getZdzCode();
  37 + wss.zdzName = sch.getZdzName();
  38 + wss.fcsj = sch.getFcsj();
  39 + wss.fcsjT = sch.getFcsjT();
  40 + wss.zdsj = sch.getZdsj();
  41 + wss.zdsjT = sch.getZdsjT();
  42 + wss.jhlc = sch.getJhlc();
  43 + wss.jhlcOrig = sch.getJhlcOrig();
  44 + wss.bcsj = sch.getBcsj();
  45 + wss.bcType = sch.getBcType();
  46 + wss.majorStationName = sch.getMajorStationName();
  47 + wss.fcsjActual = sch.getFcsjActual();
  48 + wss.fcsjActualTime = sch.getFcsjActualTime();
  49 + wss.zdsjActual = sch.getZdsjActual();
  50 + wss.zdsjActualTime = sch.getZdsjActualTime();
  51 + wss.status = sch.getStatus();
  52 + wss.adjustExps = sch.getAdjustExps();
  53 + wss.sflj = sch.isSflj();
  54 + wss.late = sch.isLate();
  55 + wss.late2 = sch.isLate2();
  56 + wss.lateMinute = sch.getLateMinute();
  57 + wss.remarks = sch.getRemarks();
  58 + wss.dfsj = sch.getDfsj();
  59 + wss.dfsjT = sch.getDfsjT();
  60 + wss.directiveState = sch.getDirectiveState();
  61 + wss.qdzArrDatejh = sch.getQdzArrDatejh();
  62 + wss.qdzArrDatesj = sch.getQdzArrDatesj();
  63 + wss.cTasks = sch.getcTasks();
  64 + wss.gsName = sch.getGsName();
  65 + wss.gsBm = sch.getGsBm();
  66 + wss.fgsName = sch.getFgsName();
  67 + wss.fgsBm = sch.getFgsBm();
  68 + wss.ccService = sch.isCcService();
  69 + wss.rfidState = sch.getRfidState();
  70 + return wss;
  71 + }
  72 +
  73 +
  74 + public static List<WsScheduleRealInfo> getMultiInstance(Collection<ScheduleRealInfo> list){
  75 + List<WsScheduleRealInfo> rs = new ArrayList<>();
  76 + for(ScheduleRealInfo sch : list){
  77 + rs.add(getInstance(sch));
  78 + }
  79 + return rs;
  80 + }
  81 +
  82 + /** 主键Id */
  83 + private Long id;
  84 +
  85 + /** 排班日期字符串 YYYY-MM-DD */
  86 + private String scheduleDateStr;
  87 +
  88 + /** 真实执行时间 yyyy-MM-dd */
  89 + private String realExecDate;
  90 +
  91 + /** 线路名称 */
  92 + private String xlName;
  93 + /** 线路编码 */
  94 + private String xlBm;
  95 +
  96 + /** 路牌名称 */
  97 + private String lpName;
  98 +
  99 + /** 车辆自编号 */
  100 + private String clZbh;
  101 +
  102 + /** 驾驶员工号 */
  103 + private String jGh;
  104 + /** 驾驶员名字 */
  105 + private String jName;
  106 + /** 售票员工号 */
  107 + private String sGh;
  108 + /** 售票员名字 */
  109 + private String sName;
  110 +
  111 + /** 线路方向 */
  112 + private String xlDir;
  113 + /** 起点站code*/
  114 + private String qdzCode;
  115 + /** 起点站名字 */
  116 + private String qdzName;
  117 +
  118 + /** 终点站code*/
  119 + private String zdzCode;
  120 + /** 终点站名字 */
  121 + private String zdzName;
  122 +
  123 + /** 计划发车时间(格式 HH:mm) */
  124 + private String fcsj;
  125 + /** 计划发车时间戳*/
  126 + @Transient
  127 + private Long fcsjT;
  128 +
  129 + /** 计划终点时间(格式 HH:mm) */
  130 + private String zdsj;
  131 + /** 计划终点时间戳*/
  132 + @Transient
  133 + private Long zdsjT;
  134 +
  135 + /** 计划里程 */
  136 + private Double jhlc;
  137 +
  138 + /** 原始计划里程 (原计调的数据) */
  139 + private Double jhlcOrig;
  140 + /** 班次历时 */
  141 + private Integer bcsj;
  142 +
  143 + /**
  144 + * 班次类型 TODO:正常班次、出场、进场、加油、区间班次、放空班次、放大站班次、两点间空驶
  145 + */
  146 + private String bcType;
  147 +
  148 + //放站班次 站点名称
  149 + private String majorStationName;
  150 +
  151 + /** 实际发车时间*/
  152 + private String fcsjActual;
  153 + /** 实际发车时间戳*/
  154 + @Transient
  155 + private Long fcsjActualTime;
  156 + /**实际终点时间 */
  157 + private String zdsjActual;
  158 + /** 实际终点时间戳*/
  159 + @Transient
  160 + private Long zdsjActualTime;
  161 +
  162 + /**班次状态 0 未执行 1 正在执行 2 已执行 -1 已烂班 */
  163 + private int status;
  164 +
  165 + private String adjustExps;
  166 +
  167 + /** 是否是临加班次 */
  168 + private boolean sflj;
  169 +
  170 + /** 是否误点 (应发未发)*/
  171 + @Transient
  172 + private boolean late;
  173 +
  174 + /** 是否误点 (应发未到) */
  175 + @Transient
  176 + private boolean late2;
  177 + /** 误点停靠时间 */
  178 + @Transient
  179 + private float lateMinute;
  180 +
  181 + /** 备注*/
  182 + private String remarks;
  183 +
  184 + /**待发时间(格式 HH:mm) */
  185 + private String dfsj;
  186 +
  187 + /**待发时间戳 */
  188 + @Transient
  189 + private Long dfsjT;
  190 +
  191 + /** 指令下发状态 60: 已发送, 100: 设备确认收到, 200:驾驶员确认 0:失败 */
  192 + private Integer directiveState = -1;
  193 +
  194 + /** 起点站计划到达时间 */
  195 + @Transient
  196 + private String qdzArrDatejh;
  197 +
  198 + /** 起点站实际到达时间 */
  199 + @Transient
  200 + private String qdzArrDatesj;
  201 +
  202 + /** 子任务 */
  203 + @OneToMany(fetch = FetchType.LAZY, mappedBy = "schedule")
  204 + private Set<ChildTaskPlan> cTasks = new HashSet<>();
  205 +
  206 + /** 关联的公司名称 */
  207 + private String gsName;
  208 + /** 关联的公司编码 */
  209 + private String gsBm;
  210 + /** 关联的分公司名称 */
  211 + private String fgsName;
  212 + /** 关联的分公司编码 */
  213 + private String fgsBm;
  214 +
  215 + /**
  216 + * 换车营运标记 true 表示该主任务由 【中途换车子任务】 级联生成
  217 + */
  218 + private boolean ccService;
  219 + /**
  220 + * rfid状态
  221 + */
  222 + private int rfidState;
  223 +
  224 + public Long getId() {
  225 + return id;
  226 + }
  227 +
  228 + public void setId(Long id) {
  229 + this.id = id;
  230 + }
  231 +
  232 + public String getScheduleDateStr() {
  233 + return scheduleDateStr;
  234 + }
  235 +
  236 + public void setScheduleDateStr(String scheduleDateStr) {
  237 + this.scheduleDateStr = scheduleDateStr;
  238 + }
  239 +
  240 + public String getRealExecDate() {
  241 + return realExecDate;
  242 + }
  243 +
  244 + public void setRealExecDate(String realExecDate) {
  245 + this.realExecDate = realExecDate;
  246 + }
  247 +
  248 + public String getXlName() {
  249 + return xlName;
  250 + }
  251 +
  252 + public void setXlName(String xlName) {
  253 + this.xlName = xlName;
  254 + }
  255 +
  256 + public String getXlBm() {
  257 + return xlBm;
  258 + }
  259 +
  260 + public void setXlBm(String xlBm) {
  261 + this.xlBm = xlBm;
  262 + }
  263 +
  264 + public String getLpName() {
  265 + return lpName;
  266 + }
  267 +
  268 + public void setLpName(String lpName) {
  269 + this.lpName = lpName;
  270 + }
  271 +
  272 + public String getClZbh() {
  273 + return clZbh;
  274 + }
  275 +
  276 + public void setClZbh(String clZbh) {
  277 + this.clZbh = clZbh;
  278 + }
  279 +
  280 + public String getjGh() {
  281 + return jGh;
  282 + }
  283 +
  284 + public void setjGh(String jGh) {
  285 + this.jGh = jGh;
  286 + }
  287 +
  288 + public String getjName() {
  289 + return jName;
  290 + }
  291 +
  292 + public void setjName(String jName) {
  293 + this.jName = jName;
  294 + }
  295 +
  296 + public String getsGh() {
  297 + return sGh;
  298 + }
  299 +
  300 + public void setsGh(String sGh) {
  301 + this.sGh = sGh;
  302 + }
  303 +
  304 + public String getsName() {
  305 + return sName;
  306 + }
  307 +
  308 + public void setsName(String sName) {
  309 + this.sName = sName;
  310 + }
  311 +
  312 + public String getXlDir() {
  313 + return xlDir;
  314 + }
  315 +
  316 + public void setXlDir(String xlDir) {
  317 + this.xlDir = xlDir;
  318 + }
  319 +
  320 + public String getQdzCode() {
  321 + return qdzCode;
  322 + }
  323 +
  324 + public void setQdzCode(String qdzCode) {
  325 + this.qdzCode = qdzCode;
  326 + }
  327 +
  328 + public String getQdzName() {
  329 + return qdzName;
  330 + }
  331 +
  332 + public void setQdzName(String qdzName) {
  333 + this.qdzName = qdzName;
  334 + }
  335 +
  336 + public String getZdzCode() {
  337 + return zdzCode;
  338 + }
  339 +
  340 + public void setZdzCode(String zdzCode) {
  341 + this.zdzCode = zdzCode;
  342 + }
  343 +
  344 + public String getZdzName() {
  345 + return zdzName;
  346 + }
  347 +
  348 + public void setZdzName(String zdzName) {
  349 + this.zdzName = zdzName;
  350 + }
  351 +
  352 + public String getFcsj() {
  353 + return fcsj;
  354 + }
  355 +
  356 + public void setFcsj(String fcsj) {
  357 + this.fcsj = fcsj;
  358 + }
  359 +
  360 + public Long getFcsjT() {
  361 + return fcsjT;
  362 + }
  363 +
  364 + public void setFcsjT(Long fcsjT) {
  365 + this.fcsjT = fcsjT;
  366 + }
  367 +
  368 + public String getZdsj() {
  369 + return zdsj;
  370 + }
  371 +
  372 + public void setZdsj(String zdsj) {
  373 + this.zdsj = zdsj;
  374 + }
  375 +
  376 + public Long getZdsjT() {
  377 + return zdsjT;
  378 + }
  379 +
  380 + public void setZdsjT(Long zdsjT) {
  381 + this.zdsjT = zdsjT;
  382 + }
  383 +
  384 + public Double getJhlc() {
  385 + return jhlc;
  386 + }
  387 +
  388 + public void setJhlc(Double jhlc) {
  389 + this.jhlc = jhlc;
  390 + }
  391 +
  392 + public Double getJhlcOrig() {
  393 + return jhlcOrig;
  394 + }
  395 +
  396 + public void setJhlcOrig(Double jhlcOrig) {
  397 + this.jhlcOrig = jhlcOrig;
  398 + }
  399 +
  400 + public Integer getBcsj() {
  401 + return bcsj;
  402 + }
  403 +
  404 + public void setBcsj(Integer bcsj) {
  405 + this.bcsj = bcsj;
  406 + }
  407 +
  408 + public String getBcType() {
  409 + return bcType;
  410 + }
  411 +
  412 + public void setBcType(String bcType) {
  413 + this.bcType = bcType;
  414 + }
  415 +
  416 + public String getMajorStationName() {
  417 + return majorStationName;
  418 + }
  419 +
  420 + public void setMajorStationName(String majorStationName) {
  421 + this.majorStationName = majorStationName;
  422 + }
  423 +
  424 + public String getFcsjActual() {
  425 + return fcsjActual;
  426 + }
  427 +
  428 + public void setFcsjActual(String fcsjActual) {
  429 + this.fcsjActual = fcsjActual;
  430 + }
  431 +
  432 + public Long getFcsjActualTime() {
  433 + return fcsjActualTime;
  434 + }
  435 +
  436 + public void setFcsjActualTime(Long fcsjActualTime) {
  437 + this.fcsjActualTime = fcsjActualTime;
  438 + }
  439 +
  440 + public String getZdsjActual() {
  441 + return zdsjActual;
  442 + }
  443 +
  444 + public void setZdsjActual(String zdsjActual) {
  445 + this.zdsjActual = zdsjActual;
  446 + }
  447 +
  448 + public Long getZdsjActualTime() {
  449 + return zdsjActualTime;
  450 + }
  451 +
  452 + public void setZdsjActualTime(Long zdsjActualTime) {
  453 + this.zdsjActualTime = zdsjActualTime;
  454 + }
  455 +
  456 + public int getStatus() {
  457 + return status;
  458 + }
  459 +
  460 + public void setStatus(int status) {
  461 + this.status = status;
  462 + }
  463 +
  464 + public String getAdjustExps() {
  465 + return adjustExps;
  466 + }
  467 +
  468 + public void setAdjustExps(String adjustExps) {
  469 + this.adjustExps = adjustExps;
  470 + }
  471 +
  472 + public boolean isSflj() {
  473 + return sflj;
  474 + }
  475 +
  476 + public void setSflj(boolean sflj) {
  477 + this.sflj = sflj;
  478 + }
  479 +
  480 + public boolean isLate() {
  481 + return late;
  482 + }
  483 +
  484 + public void setLate(boolean late) {
  485 + this.late = late;
  486 + }
  487 +
  488 + public boolean isLate2() {
  489 + return late2;
  490 + }
  491 +
  492 + public void setLate2(boolean late2) {
  493 + this.late2 = late2;
  494 + }
  495 +
  496 + public float getLateMinute() {
  497 + return lateMinute;
  498 + }
  499 +
  500 + public void setLateMinute(float lateMinute) {
  501 + this.lateMinute = lateMinute;
  502 + }
  503 +
  504 + public String getRemarks() {
  505 + return remarks;
  506 + }
  507 +
  508 + public void setRemarks(String remarks) {
  509 + this.remarks = remarks;
  510 + }
  511 +
  512 + public String getDfsj() {
  513 + return dfsj;
  514 + }
  515 +
  516 + public void setDfsj(String dfsj) {
  517 + this.dfsj = dfsj;
  518 + }
  519 +
  520 + public Long getDfsjT() {
  521 + return dfsjT;
  522 + }
  523 +
  524 + public void setDfsjT(Long dfsjT) {
  525 + this.dfsjT = dfsjT;
  526 + }
  527 +
  528 + public Integer getDirectiveState() {
  529 + return directiveState;
  530 + }
  531 +
  532 + public void setDirectiveState(Integer directiveState) {
  533 + this.directiveState = directiveState;
  534 + }
  535 +
  536 + public String getQdzArrDatejh() {
  537 + return qdzArrDatejh;
  538 + }
  539 +
  540 + public void setQdzArrDatejh(String qdzArrDatejh) {
  541 + this.qdzArrDatejh = qdzArrDatejh;
  542 + }
  543 +
  544 + public String getQdzArrDatesj() {
  545 + return qdzArrDatesj;
  546 + }
  547 +
  548 + public void setQdzArrDatesj(String qdzArrDatesj) {
  549 + this.qdzArrDatesj = qdzArrDatesj;
  550 + }
  551 +
  552 + public Set<ChildTaskPlan> getcTasks() {
  553 + return cTasks;
  554 + }
  555 +
  556 + public void setcTasks(Set<ChildTaskPlan> cTasks) {
  557 + this.cTasks = cTasks;
  558 + }
  559 +
  560 + public String getGsName() {
  561 + return gsName;
  562 + }
  563 +
  564 + public void setGsName(String gsName) {
  565 + this.gsName = gsName;
  566 + }
  567 +
  568 + public String getGsBm() {
  569 + return gsBm;
  570 + }
  571 +
  572 + public void setGsBm(String gsBm) {
  573 + this.gsBm = gsBm;
  574 + }
  575 +
  576 + public String getFgsName() {
  577 + return fgsName;
  578 + }
  579 +
  580 + public void setFgsName(String fgsName) {
  581 + this.fgsName = fgsName;
  582 + }
  583 +
  584 + public String getFgsBm() {
  585 + return fgsBm;
  586 + }
  587 +
  588 + public void setFgsBm(String fgsBm) {
  589 + this.fgsBm = fgsBm;
  590 + }
  591 +
  592 + public boolean isCcService() {
  593 + return ccService;
  594 + }
  595 +
  596 + public void setCcService(boolean ccService) {
  597 + this.ccService = ccService;
  598 + }
  599 +
  600 + public int getRfidState() {
  601 + return rfidState;
  602 + }
  603 +
  604 + public void setRfidState(int rfidState) {
  605 + this.rfidState = rfidState;
  606 + }
  607 +}
... ...
src/main/java/com/bsth/websocket/handler/SendUtils.java
1   -package com.bsth.websocket.handler;
2   -
3   -import com.alibaba.fastjson.JSONObject;
4   -import com.bsth.data.BasicData;
5   -import com.bsth.data.LineConfigData;
6   -import com.bsth.data.gpsdata_v2.entity.GpsEntity;
7   -import com.bsth.data.safe_driv.SafeDriv;
8   -import com.bsth.entity.directive.D80;
9   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
10   -import com.bsth.websocket.dto.WsScheduleRealInfo;
11   -import com.fasterxml.jackson.core.JsonProcessingException;
12   -import com.fasterxml.jackson.databind.ObjectMapper;
13   -import org.apache.commons.lang3.StringUtils;
14   -import org.slf4j.Logger;
15   -import org.slf4j.LoggerFactory;
16   -import org.springframework.beans.factory.annotation.Autowired;
17   -import org.springframework.stereotype.Component;
18   -
19   -import java.text.SimpleDateFormat;
20   -import java.util.*;
21   -
22   -@Component
23   -public class SendUtils{
24   -
25   - @Autowired
26   - private RealControlSocketHandler socketHandler;
27   -
28   - @Autowired
29   - LineConfigData lineConfigData;
30   -
31   - private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
32   -
33   - private static Logger logger = LoggerFactory.getLogger(SendUtils.class);
34   -
35   - /**
36   - * @throws JsonProcessingException
37   - * TODO(推送发车信息)
38   - */
39   - public void sendFcsj(ScheduleRealInfo sch) {
40   -
41   - Map<String, Object> map = new HashMap<>();
42   - map.put("fn", "faChe");
43   - map.put("t", WsScheduleRealInfo.getInstance(sch));
44   - map.put("dataStr", sdf.format(new Date()));
45   -
46   - ObjectMapper mapper = new ObjectMapper();
47   -
48   - try {
49   - socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map));
50   - } catch (Exception e) {
51   - logger.error("", e);
52   - }
53   - }
54   -
55   - /**
56   - *
57   - * @Title: sendFcsjArtificial
58   - * @Description: TODO(要求页面刷新班次)
59   - * @throws
60   - */
61   - public void refreshSch(List<ScheduleRealInfo> list){
62   - if(null == list || list.size() == 0)
63   - return;
64   -
65   - Map<String, Object> map = new HashMap<>();
66   - map.put("fn", "refreshSch");
67   - map.put("ts", WsScheduleRealInfo.getMultiInstance(list));
68   -
69   - ObjectMapper mapper = new ObjectMapper();
70   -
71   - try {
72   - socketHandler.sendMessageToLine(list.get(0).getXlBm(), mapper.writeValueAsString(map));
73   - } catch (Exception e) {
74   - logger.error("", e);
75   - }
76   - }
77   -
78   - /**
79   - * @throws JsonProcessingException
80   - * @throws NumberFormatException @Title: sendFcsj @Description:
81   - * TODO(推送到达终点时间) @param @param schedule 班次 @throws
82   - */
83   - public void sendZdsj(ScheduleRealInfo sch, ScheduleRealInfo nextSch, int finish) {
84   -
85   - Map<String, Object> map = new HashMap<>();
86   - map.put("fn", "zhongDian");
87   - map.put("t", WsScheduleRealInfo.getInstance(sch));
88   - map.put("nt", WsScheduleRealInfo.getInstance(nextSch));
89   - map.put("finish", finish);
90   - map.put("dataStr", sdf.format(new Date()));
91   -
92   - ObjectMapper mapper = new ObjectMapper();
93   -
94   - try {
95   - socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map));
96   - } catch (Exception e) {
97   - logger.error("", e);
98   - }
99   - }
100   -
101   - /**
102   - * 推送班次信号状态
103   - * @param state
104   -
105   - public void sendSignalState(SignalState state){
106   - Map<String, Object> map = new HashMap<>();
107   - map.put("fn", "signal_state");
108   - map.put("data", state);
109   -
110   - ObjectMapper mapper = new ObjectMapper();
111   -
112   - try {
113   - socketHandler.sendMessageToLine(state.getLineCode(), mapper.writeValueAsString(map));
114   - } catch (Exception e) {
115   - logger.error("", e);
116   - }
117   - }*/
118   -
119   - /**
120   - *
121   - * @Title: sendDirectiveToPage
122   - * @Description: TODO(调度指令状态推送)
123   - */
124   - public void sendDirectiveToPage(ScheduleRealInfo sch) {
125   -
126   - Map<String, Object> map = new HashMap<>();
127   - map.put("fn", "directive");
128   - map.put("t", WsScheduleRealInfo.getInstance(sch));;
129   -
130   - ObjectMapper mapper = new ObjectMapper();
131   -
132   - try {
133   - socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map));
134   - } catch (JsonProcessingException e) {
135   - logger.error("", e);
136   - }
137   - }
138   -
139   - public void send80ToPage(D80 d80) {
140   - d80.getData().setNbbm(BasicData.deviceId2NbbmMap.get(d80.getDeviceId()));
141   - JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(d80));
142   - json.put("fn", "report80");
143   - socketHandler.sendMessageToLine(d80.getData().getLineId().toString(), json.toJSONString());
144   - }
145   -
146   - public void refreshSch(ScheduleRealInfo sch) {
147   - List<ScheduleRealInfo> list = new ArrayList<>();
148   - list.add(sch);
149   - refreshSch(list);
150   - }
151   -
152   - public void deviceOffline(GpsEntity gps){
153   - Map<String, Object> map = new HashMap<>();
154   - map.put("fn", "deviceOffline");
155   - map.put("gps", gps);
156   - ObjectMapper mapper = new ObjectMapper();
157   -
158   - try {
159   - socketHandler.sendMessageToLine(gps.getLineId().toString(), mapper.writeValueAsString(map));
160   - } catch (JsonProcessingException e) {
161   - logger.error("", e);
162   - }
163   - }
164   -
165   - public void sendSafeDriv(SafeDriv sd){
166   - Map<String, Object> map = new HashMap<>();
167   - map.put("fn", "safeDriv");
168   - map.put("t", sd);;
169   - ObjectMapper mapper = new ObjectMapper();
170   -
171   - try {
172   - socketHandler.sendMessageToLine(sd.getXlbm(), mapper.writeValueAsString(map));
173   - } catch (JsonProcessingException e) {
174   - logger.error("", e);
175   - }
176   - }
177   -
178   - /**
179   - * 通知客户端,开始进行误点调整
180   - * @param sch
181   - */
182   - public void sendAutoWdtz(ScheduleRealInfo sch, ScheduleRealInfo cancel){
183   - Map<String, Object> map = new HashMap<>();
184   - map.put("fn", "auto_wdtz");
185   - map.put("id", sch.getId());
186   - if(cancel != null)
187   - map.put("cancelId", cancel.getId());
188   - map.put("lineCode", sch.getXlBm());
189   - map.put("minute", sch.getLateMinute());
190   - ObjectMapper mapper = new ObjectMapper();
191   -
192   - try {
193   - socketHandler.sendMessageToLine(sch.getXlBm() ,mapper.writeValueAsString(map));
194   -
195   - } catch (JsonProcessingException e) {
196   - logger.error("", e);
197   - }
198   - }
199   -
200   - /**
201   - * 对所有线调用户进行广播
202   - * @param t
203   - */
204   - public void sendRadioText(String t, String lineCode){
205   - Map<String, Object> map = new HashMap<>();
206   - map.put("fn", "admin_radio_text");
207   - map.put("t", t);
208   - ObjectMapper mapper = new ObjectMapper();
209   -
210   - try {
211   - if(StringUtils.isNotEmpty(lineCode))
212   - socketHandler.sendMessageToLine(lineCode, mapper.writeValueAsString(map));
213   - else
214   - socketHandler.sendMessage(mapper.writeValueAsString(map));
215   - } catch (JsonProcessingException e) {
216   - logger.error("", e);
217   - }
218   - }
219   -}
  1 +package com.bsth.websocket.handler;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.bsth.data.BasicData;
  5 +import com.bsth.data.LineConfigData;
  6 +import com.bsth.data.gpsdata_v2.entity.GpsEntity;
  7 +import com.bsth.data.safe_driv.SafeDriv;
  8 +import com.bsth.entity.directive.D80;
  9 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  10 +import com.bsth.websocket.dto.WsScheduleRealInfo;
  11 +import com.fasterxml.jackson.core.JsonProcessingException;
  12 +import com.fasterxml.jackson.databind.ObjectMapper;
  13 +import org.apache.commons.lang3.StringUtils;
  14 +import org.slf4j.Logger;
  15 +import org.slf4j.LoggerFactory;
  16 +import org.springframework.beans.factory.annotation.Autowired;
  17 +import org.springframework.stereotype.Component;
  18 +
  19 +import java.text.SimpleDateFormat;
  20 +import java.util.*;
  21 +
  22 +@Component
  23 +public class SendUtils{
  24 +
  25 + @Autowired
  26 + private RealControlSocketHandler socketHandler;
  27 +
  28 + @Autowired
  29 + LineConfigData lineConfigData;
  30 +
  31 + private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
  32 +
  33 + private static Logger logger = LoggerFactory.getLogger(SendUtils.class);
  34 +
  35 + /**
  36 + * @throws JsonProcessingException
  37 + * TODO(推送发车信息)
  38 + */
  39 + public void sendFcsj(ScheduleRealInfo sch) {
  40 +
  41 + Map<String, Object> map = new HashMap<>();
  42 + map.put("fn", "faChe");
  43 + map.put("t", WsScheduleRealInfo.getInstance(sch));
  44 + map.put("dataStr", sdf.format(new Date()));
  45 +
  46 + ObjectMapper mapper = new ObjectMapper();
  47 +
  48 + try {
  49 + socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map));
  50 + } catch (Exception e) {
  51 + logger.error("", e);
  52 + }
  53 + }
  54 +
  55 + /**
  56 + *
  57 + * @Title: sendFcsjArtificial
  58 + * @Description: TODO(要求页面刷新班次)
  59 + * @throws
  60 + */
  61 + public void refreshSch(List<ScheduleRealInfo> list){
  62 + if(null == list || list.size() == 0)
  63 + return;
  64 +
  65 + Map<String, Object> map = new HashMap<>();
  66 + map.put("fn", "refreshSch");
  67 + map.put("ts", WsScheduleRealInfo.getMultiInstance(list));
  68 +
  69 + ObjectMapper mapper = new ObjectMapper();
  70 +
  71 + try {
  72 + socketHandler.sendMessageToLine(list.get(0).getXlBm(), mapper.writeValueAsString(map));
  73 + } catch (Exception e) {
  74 + logger.error("", e);
  75 + }
  76 + }
  77 +
  78 + /**
  79 + * @throws JsonProcessingException
  80 + * @throws NumberFormatException @Title: sendFcsj @Description:
  81 + * TODO(推送到达终点时间) @param @param schedule 班次 @throws
  82 + */
  83 + public void sendZdsj(ScheduleRealInfo sch, ScheduleRealInfo nextSch, int finish) {
  84 +
  85 + Map<String, Object> map = new HashMap<>();
  86 + map.put("fn", "zhongDian");
  87 + map.put("t", WsScheduleRealInfo.getInstance(sch));
  88 + map.put("nt", WsScheduleRealInfo.getInstance(nextSch));
  89 + map.put("finish", finish);
  90 + map.put("dataStr", sdf.format(new Date()));
  91 +
  92 + ObjectMapper mapper = new ObjectMapper();
  93 +
  94 + try {
  95 + socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map));
  96 + } catch (Exception e) {
  97 + logger.error("", e);
  98 + }
  99 + }
  100 +
  101 + /**
  102 + * 推送班次信号状态
  103 + * @param state
  104 +
  105 + public void sendSignalState(SignalState state){
  106 + Map<String, Object> map = new HashMap<>();
  107 + map.put("fn", "signal_state");
  108 + map.put("data", state);
  109 +
  110 + ObjectMapper mapper = new ObjectMapper();
  111 +
  112 + try {
  113 + socketHandler.sendMessageToLine(state.getLineCode(), mapper.writeValueAsString(map));
  114 + } catch (Exception e) {
  115 + logger.error("", e);
  116 + }
  117 + }*/
  118 +
  119 + /**
  120 + *
  121 + * @Title: sendDirectiveToPage
  122 + * @Description: TODO(调度指令状态推送)
  123 + */
  124 + public void sendDirectiveToPage(ScheduleRealInfo sch) {
  125 +
  126 + Map<String, Object> map = new HashMap<>();
  127 + map.put("fn", "directive");
  128 + map.put("t", WsScheduleRealInfo.getInstance(sch));;
  129 +
  130 + ObjectMapper mapper = new ObjectMapper();
  131 +
  132 + try {
  133 + socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map));
  134 + } catch (JsonProcessingException e) {
  135 + logger.error("", e);
  136 + }
  137 + }
  138 +
  139 + public void send80ToPage(D80 d80) {
  140 + d80.getData().setNbbm(BasicData.deviceId2NbbmMap.get(d80.getDeviceId()));
  141 + JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(d80));
  142 + json.put("fn", "report80");
  143 + socketHandler.sendMessageToLine(d80.getData().getLineId().toString(), json.toJSONString());
  144 + }
  145 +
  146 + public void refreshSch(ScheduleRealInfo sch) {
  147 + List<ScheduleRealInfo> list = new ArrayList<>();
  148 + list.add(sch);
  149 + refreshSch(list);
  150 + }
  151 +
  152 + public void deviceOffline(GpsEntity gps){
  153 + Map<String, Object> map = new HashMap<>();
  154 + map.put("fn", "deviceOffline");
  155 + map.put("gps", gps);
  156 + ObjectMapper mapper = new ObjectMapper();
  157 +
  158 + try {
  159 + socketHandler.sendMessageToLine(gps.getLineId().toString(), mapper.writeValueAsString(map));
  160 + } catch (JsonProcessingException e) {
  161 + logger.error("", e);
  162 + }
  163 + }
  164 +
  165 + public void sendSafeDriv(SafeDriv sd){
  166 + Map<String, Object> map = new HashMap<>();
  167 + map.put("fn", "safeDriv");
  168 + map.put("t", sd);;
  169 + ObjectMapper mapper = new ObjectMapper();
  170 +
  171 + try {
  172 + socketHandler.sendMessageToLine(sd.getXlbm(), mapper.writeValueAsString(map));
  173 + } catch (JsonProcessingException e) {
  174 + logger.error("", e);
  175 + }
  176 + }
  177 +
  178 + /**
  179 + * 通知客户端,开始进行误点调整
  180 + * @param sch
  181 + */
  182 + public void sendAutoWdtz(ScheduleRealInfo sch, ScheduleRealInfo cancel){
  183 + Map<String, Object> map = new HashMap<>();
  184 + map.put("fn", "auto_wdtz");
  185 + map.put("id", sch.getId());
  186 + if(cancel != null)
  187 + map.put("cancelId", cancel.getId());
  188 + map.put("lineCode", sch.getXlBm());
  189 + map.put("minute", sch.getLateMinute());
  190 + ObjectMapper mapper = new ObjectMapper();
  191 +
  192 + try {
  193 + socketHandler.sendMessageToLine(sch.getXlBm() ,mapper.writeValueAsString(map));
  194 +
  195 + } catch (JsonProcessingException e) {
  196 + logger.error("", e);
  197 + }
  198 + }
  199 +
  200 + /**
  201 + * 对所有线调用户进行广播
  202 + * @param t
  203 + */
  204 + public void sendRadioText(String t, String lineCode){
  205 + Map<String, Object> map = new HashMap<>();
  206 + map.put("fn", "admin_radio_text");
  207 + map.put("t", t);
  208 + ObjectMapper mapper = new ObjectMapper();
  209 +
  210 + try {
  211 + if(StringUtils.isNotEmpty(lineCode))
  212 + socketHandler.sendMessageToLine(lineCode, mapper.writeValueAsString(map));
  213 + else
  214 + socketHandler.sendMessage(mapper.writeValueAsString(map));
  215 + } catch (JsonProcessingException e) {
  216 + logger.error("", e);
  217 + }
  218 + }
  219 +
  220 + /**
  221 + * RFID有更新时发送数据至线调页面
  222 + * @param sch
  223 + */
  224 + public void sendRfid(ScheduleRealInfo sch) {
  225 + Map<String, Object> map = new HashMap<>();
  226 + map.put("fn", "rfid");
  227 + map.put("data", WsScheduleRealInfo.getInstance(sch));
  228 + ObjectMapper mapper = new ObjectMapper();
  229 +
  230 + try {
  231 + socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map));
  232 + } catch (JsonProcessingException e) {
  233 + logger.error("", e);
  234 + }
  235 + }
  236 +}
... ...