Commit 44810397e25ed206429e46e7564ecebda03e7cad

Authored by 潘钊
2 parents 93ec3e87 3b0f5480

Merge branch 'minhang' into qingpu

# Conflicts:
#	README.md
#	src/main/java/com/bsth/data/gpsdata/GpsRealData.java
#	src/main/resources/ms-jdbc.properties
Showing 65 changed files with 2097 additions and 1320 deletions

Too many changes to show.

To preserve performance only 65 of 68 files are displayed.

README.md
1 -<<<<<<< HEAD  
2 -公交调度系统BS版 0.1  
3 -======  
4 -----------  
5 -## 目录  
6 ----------  
7 - * [字典表](#字典表)  
8 - * [动态jpa查询实现](#动态jpa查询实现)  
9 - * [车载 gps 相关数据](#gps)  
10 - * [实时gps数据接口 http](#实时gps接口)  
11 - * [进出站数据表结构](#进站数据)  
12 - * [异常警报表结构](#异常警报)  
13 - * [大间隔](#大间隔)  
14 - * [超速](#超速)  
15 - * [越界](#越界)  
16 - * [越站](#越站)  
17 - * [聚集](#聚集)  
18 - * [掉线](#掉线)  
19 - * [调度消息下发接口HTTP](#调度消息下发接口)  
20 - * [调度消息上传接口HTTP](#调度消息上传接口)  
21 -  
22 -----------  
23 -  
24 -## 字典表  
25 -----------  
26 -字典操作全部由前端负责,主要有2种。  
27 -  
28 -1、转换字典代码。  
29 - 当pjax的`pjax:success`事件被触发(片段加载完成)  
30 - 扫描容器内所有有 `$(".nt-dictionary")` 元素进行字典转换  
31 -``` html  
32 ---dom标签为span div p h1 h2 h3 h4 h5 h6 等等文本元素时,如下写法,text为要转换的代码  
33 -<span class="nt-dictionary" data-group="ScheduleType">out</span>  
34 ---to  
35 -<span>出场</span>  
36 -  
37 -<!- dom标签为input时,如下 data-code为要转换的代码 -->  
38 -<input class="nt-dictionary" data-group="ScheduleType" data-code="out">  
39 ---to  
40 -<input value="出场">  
41 -  
42 -<!- dom标签为select时 如下 data-code为要选中的项 -->  
43 -<select class="nt-dictionary" data-group="ScheduleType" data-code="out"></select>  
44 ---to  
45 -<select>  
46 - <option value="normal">正常班次</option>  
47 - <option value="out" selected>出场</option>  
48 - <option value="in">进场</option>  
49 - <option value="oil">加油</option>  
50 - <option value="temp">临加</option>  
51 - <option value="region">区间</option>  
52 - <option value="venting">放空</option>  
53 - <option value="major">放大站</option>  
54 -</select>  
55 -```  
56 -*原标签的class 除nt-dictionary 外,其余均会被保留*  
57 -  
58 -2、dictionary.js提供如下方法自行使用  
59 -| 方法名 | 参数|返回|  
60 -| ---- | ---- | ---- | ---- |  
61 -| groups (获取所有字典组) | 无| | {LineTrend: 线路走向, ScheduleType: 班次类型} |  
62 -| getByGroup (获取字典组下的字典)| (group) |{0: 上行, 1: 下行}|  
63 -| transformCode (转换字典代码)| (group, code) | 上行 |  
64 -  
65 -## 动态jpa查询实现  
66 -----------  
67 -*参考调度系统枚举com.bsth.entity.search.SearchOperator*  
68 -  
69 -  
70 -## gps  
71 -----------  
72 -### 实时gps接口  
73 -  
74 -所有在线GPS: [http://192.168.168.192:8080/transport_server/rtgps](http://192.168.168.192:8080/transport_server/rtgps/)  
75 -根据设备号查询:[http://192.168.168.192:8080/transport_server/rtgps/05B01901](http://192.168.168.192:8080/transport_server/rtgps/05B01901)  
76 -  
77 -<span style="color: red">Response</span>:  
78 -```json  
79 -{  
80 - "data":[  
81 - {  
82 - "companyCode":5,  
83 - "lineId":10329,  
84 - "deviceId":"05B01901",  
85 - "carparkNo":"00000000",  
86 - "stopNo":"7C890002",  
87 - "lon":121.549866,  
88 - "lat":31.238798,  
89 - "timestamp":1397104499000,  
90 - "speed":42.0,  
91 - "direction":245.9,  
92 - "state":0,  
93 - "upDown":0  
94 - }]  
95 -}  
96 -```  
97 -  
98 -| -- | --|--|  
99 -| ---- | ---- | ---- |  
100 -| companyCode | int | 公司代码 |  
101 -| lineId | int | 线路编码 |  
102 -| deviceId | String | 设备编号 |  
103 -| carparkNo | String | 停车场编码 |  
104 -| stopNo | String | 站点编码 |  
105 -| lon | float | 经度 |  
106 -| lat | float | 纬度 |  
107 -| timestamp | long | 时间戳 |  
108 -| speed | float | 速度|  
109 -| direction | float | 方向(角度) |  
110 -| state | int | 营运状态( 0 营运 ,1 非营运, -1 无效) |  
111 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效)|  
112 -  
113 -  
114 -### 进站数据  
115 -----------  
116 -表名:  
117 -  
118 -| .. | .. | .. |  
119 -| ---- | ---- | ---- |  
120 -| id | int | 主键 |  
121 -| deviceId | String | 设备号 |  
122 -| lineId | int | 线路编码 |  
123 -| stopNo | long | 站点编码 |  
124 -| timestamp | long | 时间戳 |  
125 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
126 -| createDate | Date | 创建时间 |  
127 -  
128 -  
129 -### 异常警报  
130 -----------  
131 -  
132 -### 大间隔  
133 -----------  
134 -表名:  
135 -  
136 -| .. | .. | .. |  
137 -| ---- | ---- | ---- |  
138 -| id | int | 主键 |  
139 -| line | int | 线路编码 |  
140 -| station | String | 站点编码 |  
141 -| cVehicle | String | 当前车辆编码 |  
142 -| lastVehicle | String | 上一个车辆编码 |  
143 -| interval | long | 间隔时间(秒) |  
144 -| timestamp | long | 时间戳 |  
145 -| createDate | Date | 创建时间 |  
146 -  
147 -### 超速  
148 -----------  
149 -表名:  
150 -  
151 -| .. | .. | .. |  
152 -| ---- | ---- | ---- |  
153 -| id | int | 主键 |  
154 -| vehicle | String | 车辆编码 |  
155 -| line | int | 线路编码 |  
156 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
157 -| lon | float | 经度 |  
158 -| lat | float | 纬度|  
159 -| speed | float | 速度 |  
160 -| timestamp | long | 时间戳 |  
161 -| createDate | Date | 时间 |  
162 -  
163 -### 越界  
164 -----------  
165 -表名:  
166 -  
167 -| .. | .. | .. |  
168 -| ---- | ---- | ---- |  
169 -| id | int | 主键 |  
170 -| vehicle | String | 车辆编码 |  
171 -| line | int | 线路编码 |  
172 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
173 -| lon | float | 经度 |  
174 -| lat | float | 纬度|  
175 -| location | String | 越界位置(由线调页面进行初始转换)意思是该字段默认为空,页面第一次查看时会写入值|  
176 -| timestamp | long | 时间戳 |  
177 -| createDate | Date | 时间 |  
178 -  
179 -  
180 -### 越站  
181 -----------  
182 -表名:  
183 -  
184 -| .. | .. | .. |  
185 -| ---- | ---- | ---- |  
186 -| id | int | 主键 |  
187 -| line | int | 线路编码 |  
188 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
189 -| station | String | 站点编码 |  
190 -| vehicle | String | 车辆编码 |  
191 -| inData | Date | 进站时间 |  
192 -| outDate | Date | 出站时间 |  
193 -  
194 -  
195 -### 聚集  
196 -----------  
197 -表名:  
198 -  
199 -| .. | .. | .. |  
200 -| ---- | ---- | ---- |  
201 -| id | int | 主键 |  
202 -| line | int | 线路编码 |  
203 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
204 -| stations | String | 站点(多个用 , 号分隔。应该是连续站点) |  
205 -| vehicles | String | 车辆编码(多个用 , 号分隔) |  
206 -| timestamp | long | 时间戳 |  
207 -| createDate | Date | 时间 |  
208 -  
209 -  
210 -### 掉线  
211 -----------  
212 -表名:  
213 -  
214 -| .. | .. | .. |  
215 -| ---- | ---- | ---- |  
216 -| id | int | 主键 |  
217 -| line | int | 线路编码 |  
218 -| upDown | int | 上下行(0 上行 , 1 下行 , -1 无效) |  
219 -| vehicle | String | 车辆编码 |  
220 -| lon | float | 经度 |  
221 -| lat | float | 纬度|  
222 -| timestamp | long | 时间戳 |  
223 -| createDate | Date | 时间 |  
224 -  
225 -  
226 -### 调度消息下发接口  
227 -----------  
228 -[http://192.168.168.192:8080/transport_server/message](http://192.168.168.192:8080/transport_server/message/)  
229 -  
230 -<span style="color: red">Request</span>:  
231 -```json  
232 -{  
233 - "deviceId":12345,  
234 - "timestamp":44324,  
235 - "operCode":0x60,  
236 - "data":{  
237 - "companyCode":22,  
238 - "deviceId":"029L2222",  
239 - "timestamp":134326,  
240 - "instructType":00,  
241 - "dispatchInstruct":0x00,  
242 - "msgId":12345,  
243 - "alarmTime":201606012000,  
244 - "serviceState":00000000,  
245 - "txtContent":"你好"  
246 - }  
247 -}  
248 -```  
249 -| .. | .. | .. |  
250 -| ---- | ---- | ---- |  
251 -| deviceId | string | 设备编号 |  
252 -| timestamp | long | 时间戳(ms) |  
253 -| operCode | short | 一级协议 |  
254 -| data.companyCode | short | 公司代码 |  
255 -| data.deviceId | string | 设备编号 |  
256 -| data.timestamp | long | 时间戳 |  
257 -| data.instructType | short | 保留 默认0 |  
258 -| data.dispatchInstruct | short | 调度指令 调度指令。0X00表示信息短语,0X01表示取消上次指令+调度指令(闹钟有效),0x02表示为调度指令(闹钟有效); 0x03表示运营状态指令(闹钟无效);0x04表示其他指令。|  
259 -| data.msgId | long | 同上 |  
260 -| data.alarmTime | long | 闹钟 MMddhhmm|  
261 -| data.serviceState | long | 多状态字节   先由车载发起车辆故障、事故报告、扣证、纠纷、加油等审请,经调度确认后,下发调度指令与运营状态。当调度指令为0X00终端需要提示信息。当调度指令为0x01和0x02,终端需要收到后提示信息。并且必须在闹钟结束后进行终端相关状态更新。在闹钟时间前120秒开始提示。当调度指令为0x03,收到后进行终端相关状态更新,终端不需要提示信息。当调度指令为0x04,暂不需要提示信息。|  
262 -| data.txtContent | string | 下发的消息文本 |  
263 -```json  
264 -{  
265 - "deviceId":12345,  
266 - "timestamp":44324,  
267 - "operCode":0x64,  
268 - "data":{  
269 - "cityCode":22,  
270 - "deviceId":"029L2222",  
271 - "lineId":"134326"  
272 - }  
273 -}  
274 -```  
275 -| .. | .. | .. |  
276 -| ---- | ---- | ---- |  
277 -| deviceId | string | 设备编号 |  
278 -| timestamp | long | 时间戳(ms) |  
279 -| operCode | short | 一级协议 |  
280 -| data.cityCode | short | 城市区号 |  
281 -| data.deviceId | string | 设备编号 |  
282 -| data.lineId | string | 线路编号 6位 不足6位前面补0 如编号890 用000890表示 |  
283 -  
284 -```json  
285 -{  
286 - "deviceId":12345,  
287 - "timestamp":44324,  
288 - "operCode":0xC0,  
289 - "data":{  
290 - "operCode":0x86,  
291 - "requestAck":0x06  
292 - }  
293 -}  
294 -```  
295 -| .. | .. | .. |  
296 -| ---- | ---- | ---- |  
297 -| deviceId | string | 设备编号 |  
298 -| timestamp | long | 时间戳(ms) |  
299 -| operCode | short | 一级协议 |  
300 -| data.operCode | short | 二级协议 |  
301 -| data.requestAck | short | 请求应答字 0x06同意 0x15不同意|  
302 -  
303 -<span style="color: red">Response</span>:  
304 -```json  
305 -{  
306 - "errCode":0  
307 -}  
308 -```  
309 -  
310 -  
311 -### 调度消息上传接口  
312 -----------  
313 -上行POST地址:[http://192.168.168.120:9088/control/upstream](http://192.168.168.120:9088/control/upstream)  
314 -<span style="color: red">Request</span>:  
315 -```json  
316 -{  
317 - "deviceId":12345,  
318 - "timestamp":44324,  
319 - "status":0,  
320 - "operCode":0x80,  
321 - "data":{  
322 - "operCode":0x26,  
323 - "requestCode":22  
324 - }  
325 -}  
326 -```  
327 -| .. | .. | .. |  
328 -| ---- | ---- | ---- |  
329 -| deviceId | string | 设备编号 |  
330 -| timestamp | long | 时间戳(ms) |  
331 -| status | int | 0x80时无数据 0表示失败 1表示成功或设备确认 2表示驾驶员阅读 |  
332 -| operCode | short | 一级协议 消息确认将无数据 |  
333 -| data.operCode | short | 二级协议 |  
334 -| data.requestCode | short | 请求代码0xa1 恢复运营 0xa2 申请调档 0xa3 出场请求 0xa5 进场请求 0xa7 加油请求 0x50 车辆故障 0x70 路阻报告 0x60 事故报告 0x11 扣证纠纷 0x12 报警 |  
335 -<span style="color: red">Response</span>:  
336 -```json  
337 -{  
338 - "errCode":0  
339 -}  
340 -```  
341 -=======  
342 -公交调度系统BS版 0.1 1 +公交调度系统BS版 0.1
343 ====== 2 ======
344 ---------- 3 ----------
345 ## 目录 4 ## 目录
@@ -704,5 +363,4 @@ @@ -704,5 +363,4 @@
704 | direction | float | 角度0-359 | 363 | direction | float | 角度0-359 |
705 | inTemp | int | 车内温度 | 364 | inTemp | int | 车内温度 |
706 | serviceState | long | 设备状态字 | 365 | serviceState | long | 设备状态字 |
707 -| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 |  
708 ->>>>>>> PSM-9 366 +| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 |
709 \ No newline at end of file 367 \ No newline at end of file
@@ -185,6 +185,18 @@ @@ -185,6 +185,18 @@
185 <artifactId>kaptcha</artifactId> 185 <artifactId>kaptcha</artifactId>
186 <version>0.0.9</version> 186 <version>0.0.9</version>
187 </dependency> 187 </dependency>
  188 +
  189 + <dependency>
  190 + <groupId>commons-codec</groupId>
  191 + <artifactId>commons-codec</artifactId>
  192 + <version>1.4</version>
  193 + <scope>compile</scope>
  194 + </dependency>
  195 + <dependency>
  196 + <groupId>org.bouncycastle</groupId>
  197 + <artifactId>bcprov-jdk15on</artifactId>
  198 + <version>1.52</version>
  199 + </dependency>
188 </dependencies> 200 </dependencies>
189 201
190 <dependencyManagement> 202 <dependencyManagement>
src/main/java/com/bsth/Application.java
@@ -16,7 +16,7 @@ import org.springframework.context.annotation.Primary; @@ -16,7 +16,7 @@ import org.springframework.context.annotation.Primary;
16 @SpringBootApplication 16 @SpringBootApplication
17 public class Application extends SpringBootServletInitializer { 17 public class Application extends SpringBootServletInitializer {
18 18
19 - public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(8); 19 + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(11);
20 20
21 @Override 21 @Override
22 protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 22 protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
src/main/java/com/bsth/controller/directive/DirectiveController.java
@@ -62,8 +62,8 @@ public class DirectiveController { @@ -62,8 +62,8 @@ public class DirectiveController {
62 * @param @param lineId 新线路编码 62 * @param @param lineId 新线路编码
63 * @throws 63 * @throws
64 */ 64 */
65 - @RequestMapping(value = "/lineChnage", method = RequestMethod.GET)  
66 - public int lineChange(@RequestParam String nbbm, @RequestParam Integer lineId){ 65 + @RequestMapping(value = "/lineChnage", method = RequestMethod.POST)
  66 + public int lineChange(@RequestParam String nbbm, @RequestParam String lineId){
67 SysUser user = SecurityUtils.getCurrentUser(); 67 SysUser user = SecurityUtils.getCurrentUser();
68 return directiveService.lineChange(nbbm, lineId, user.getUserName()); 68 return directiveService.lineChange(nbbm, lineId, user.getUserName());
69 } 69 }
src/main/java/com/bsth/controller/directive/UpstreamEntrance.java
@@ -3,7 +3,6 @@ package com.bsth.controller.directive; @@ -3,7 +3,6 @@ package com.bsth.controller.directive;
3 import org.slf4j.Logger; 3 import org.slf4j.Logger;
4 import org.slf4j.LoggerFactory; 4 import org.slf4j.LoggerFactory;
5 import org.springframework.beans.factory.annotation.Autowired; 5 import org.springframework.beans.factory.annotation.Autowired;
6 -import org.springframework.context.annotation.Scope;  
7 import org.springframework.web.bind.annotation.RequestMapping; 6 import org.springframework.web.bind.annotation.RequestMapping;
8 import org.springframework.web.bind.annotation.RequestMethod; 7 import org.springframework.web.bind.annotation.RequestMethod;
9 import org.springframework.web.bind.annotation.RequestParam; 8 import org.springframework.web.bind.annotation.RequestParam;
@@ -26,7 +25,6 @@ import com.bsth.entity.directive.DirectiveReponse; @@ -26,7 +25,6 @@ import com.bsth.entity.directive.DirectiveReponse;
26 */ 25 */
27 @RestController 26 @RestController
28 @RequestMapping("/control") 27 @RequestMapping("/control")
29 -@Scope("prototype")  
30 public class UpstreamEntrance { 28 public class UpstreamEntrance {
31 29
32 Logger logger = LoggerFactory.getLogger(this.getClass()); 30 Logger logger = LoggerFactory.getLogger(this.getClass());
src/main/java/com/bsth/controller/forecast/SampleController.java
@@ -2,7 +2,11 @@ package com.bsth.controller.forecast; @@ -2,7 +2,11 @@ package com.bsth.controller.forecast;
2 2
3 import java.io.UnsupportedEncodingException; 3 import java.io.UnsupportedEncodingException;
4 import java.net.URLDecoder; 4 import java.net.URLDecoder;
  5 +import java.util.HashMap;
  6 +import java.util.Map;
5 7
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
6 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RequestMapping;
8 import org.springframework.web.bind.annotation.RequestParam; 12 import org.springframework.web.bind.annotation.RequestParam;
@@ -10,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController; @@ -10,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
10 14
11 import com.alibaba.fastjson.JSON; 15 import com.alibaba.fastjson.JSON;
12 import com.alibaba.fastjson.JSONObject; 16 import com.alibaba.fastjson.JSONObject;
  17 +import com.bsth.common.ResponseCode;
13 import com.bsth.controller.BaseController; 18 import com.bsth.controller.BaseController;
14 import com.bsth.controller.forecast.dto.CreateSampleParam; 19 import com.bsth.controller.forecast.dto.CreateSampleParam;
15 import com.bsth.entity.forecast.Sample; 20 import com.bsth.entity.forecast.Sample;
@@ -22,16 +27,20 @@ public class SampleController extends BaseController&lt;Sample, Long&gt;{ @@ -22,16 +27,20 @@ public class SampleController extends BaseController&lt;Sample, Long&gt;{
22 @Autowired 27 @Autowired
23 SampleService sampleService; 28 SampleService sampleService;
24 29
  30 + Logger loger = LoggerFactory.getLogger(this.getClass());
  31 +
25 @RequestMapping("/create/gps") 32 @RequestMapping("/create/gps")
26 - public int createDataByGps(@RequestParam String data){  
27 - 33 + public Map<String, Object> createDataByGps(@RequestParam String data){
  34 + Map<String, Object> rs = new HashMap<>();
28 try { 35 try {
29 data = URLDecoder.decode(data, "utf-8"); 36 data = URLDecoder.decode(data, "utf-8");
30 CreateSampleParam param = JSONObject.toJavaObject(JSON.parseObject(data), CreateSampleParam.class); 37 CreateSampleParam param = JSONObject.toJavaObject(JSON.parseObject(data), CreateSampleParam.class);
31 - System.out.println(param); 38 +
  39 + rs = sampleService.createDataByGps(param);
32 } catch (UnsupportedEncodingException e) { 40 } catch (UnsupportedEncodingException e) {
33 - e.printStackTrace(); 41 + loger.info("", e);
  42 + rs.put("status", ResponseCode.ERROR);
34 } 43 }
35 - return 0; 44 + return rs;
36 } 45 }
37 } 46 }
src/main/java/com/bsth/controller/gps/GpsController.java
@@ -26,12 +26,12 @@ public class GpsController { @@ -26,12 +26,12 @@ public class GpsController {
26 GpsService gpsService; 26 GpsService gpsService;
27 27
28 @RequestMapping(value = "/real/line/{lineCode}") 28 @RequestMapping(value = "/real/line/{lineCode}")
29 - public List<GpsEntity> findByLineCode(@PathVariable("lineCode") Integer lineCode) {  
30 - return gpsRealData.get(lineCode); 29 + public List<GpsEntity> findByLineCode(@PathVariable("lineCode") String lineCode) {
  30 + return gpsRealData.getByLine(lineCode);
31 } 31 }
32 32
33 @RequestMapping(value = "/real/line") 33 @RequestMapping(value = "/real/line")
34 - public List<GpsEntity> findByLineCode(@RequestParam String lineCodes) { 34 + public List<GpsEntity> findByLineCodes(@RequestParam String lineCodes) {
35 return gpsRealData.get(Splitter.on(",").splitToList(lineCodes)); 35 return gpsRealData.get(Splitter.on(",").splitToList(lineCodes));
36 } 36 }
37 37
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
1 package com.bsth.controller.realcontrol; 1 package com.bsth.controller.realcontrol;
2 2
  3 +import java.io.UnsupportedEncodingException;
  4 +import java.net.URLDecoder;
3 import java.util.Collection; 5 import java.util.Collection;
4 import java.util.List; 6 import java.util.List;
5 import java.util.Map; 7 import java.util.Map;
6 8
  9 +import org.apache.commons.lang3.StringEscapeUtils;
7 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.web.bind.annotation.PathVariable; 11 import org.springframework.web.bind.annotation.PathVariable;
9 import org.springframework.web.bind.annotation.RequestMapping; 12 import org.springframework.web.bind.annotation.RequestMapping;
@@ -223,6 +226,8 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -223,6 +226,8 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
223 */ 226 */
224 @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST) 227 @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST)
225 public Map<String, Object> outgoAdjustAll(@RequestParam String params){ 228 public Map<String, Object> outgoAdjustAll(@RequestParam String params){
  229 + //反转义
  230 + params = StringEscapeUtils.unescapeHtml4(params);
226 return scheduleRealInfoService.outgoAdjustAll(params); 231 return scheduleRealInfoService.outgoAdjustAll(params);
227 } 232 }
228 233
@@ -257,7 +262,7 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -257,7 +262,7 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
257 * @throws 262 * @throws
258 */ 263 */
259 @RequestMapping(value = "/findRouteByLine") 264 @RequestMapping(value = "/findRouteByLine")
260 - public Map<String, Object> findRouteByLine(@RequestParam Integer lineCode){ 265 + public Map<String, Object> findRouteByLine(@RequestParam String lineCode){
261 return scheduleRealInfoService.findRouteByLine(lineCode); 266 return scheduleRealInfoService.findRouteByLine(lineCode);
262 } 267 }
263 268
src/main/java/com/bsth/controller/sys/UserController.java
@@ -7,7 +7,6 @@ import javax.servlet.http.HttpServletRequest; @@ -7,7 +7,6 @@ import javax.servlet.http.HttpServletRequest;
7 import javax.servlet.http.HttpSession; 7 import javax.servlet.http.HttpSession;
8 8
9 import org.apache.commons.lang3.StringUtils; 9 import org.apache.commons.lang3.StringUtils;
10 -import org.apache.commons.net.util.Base64;  
11 import org.slf4j.Logger; 10 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory; 11 import org.slf4j.LoggerFactory;
13 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,6 +21,7 @@ import org.springframework.web.bind.annotation.RestController; @@ -22,6 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
22 import com.bsth.common.Constants; 21 import com.bsth.common.Constants;
23 import com.bsth.common.ResponseCode; 22 import com.bsth.common.ResponseCode;
24 import com.bsth.controller.BaseController; 23 import com.bsth.controller.BaseController;
  24 +import com.bsth.controller.sys.util.RSAUtils;
25 import com.bsth.entity.sys.SysUser; 25 import com.bsth.entity.sys.SysUser;
26 import com.bsth.security.util.SecurityUtils; 26 import com.bsth.security.util.SecurityUtils;
27 import com.bsth.service.sys.SysUserService; 27 import com.bsth.service.sys.SysUserService;
@@ -35,12 +35,21 @@ public class UserController extends BaseController&lt;SysUser, Integer&gt; { @@ -35,12 +35,21 @@ public class UserController extends BaseController&lt;SysUser, Integer&gt; {
35 @Autowired 35 @Autowired
36 SysUserService sysUserService; 36 SysUserService sysUserService;
37 37
  38 + @RequestMapping(value = "/login/jCryptionKey")
  39 + public Map<String, Object> jCryptionKey(HttpServletRequest request){
  40 + //公匙返回页面
  41 + Map<String, Object> rs = new HashMap<>();
  42 + rs.put("publickey", RSAUtils.generateBase64PublicKey());
  43 + return rs;
  44 + }
  45 +
38 //需要验证码的账号 46 //需要验证码的账号
39 public static Map<String, Integer> captchaMap = new HashMap<>(); 47 public static Map<String, Integer> captchaMap = new HashMap<>();
40 48
41 @RequestMapping(value = "/login", method = RequestMethod.POST) 49 @RequestMapping(value = "/login", method = RequestMethod.POST)
42 public Map<String, Object> login(HttpServletRequest request, @RequestParam String userName, 50 public Map<String, Object> login(HttpServletRequest request, @RequestParam String userName,
43 - @RequestParam String password) { 51 + @RequestParam String password, String captcha) {
  52 +
44 Map<String, Object> rs = new HashMap<>(); 53 Map<String, Object> rs = new HashMap<>();
45 rs.put("status", ResponseCode.ERROR); 54 rs.put("status", ResponseCode.ERROR);
46 try { 55 try {
@@ -51,32 +60,26 @@ public class UserController extends BaseController&lt;SysUser, Integer&gt; { @@ -51,32 +60,26 @@ public class UserController extends BaseController&lt;SysUser, Integer&gt; {
51 //校验验证码 60 //校验验证码
52 String verCode = (String) session 61 String verCode = (String) session
53 .getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY); 62 .getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY);
54 - String captcha = request.getParameter("captcha");  
55 63
56 - if(StringUtils.isBlank(captcha)){  
57 - rs.put("msg", "请输入验证码");  
58 - return rs;  
59 - } 64 + if(StringUtils.isBlank(captcha))
  65 + return put(rs, "msg", "请输入验证码");
60 66
61 - if(!verCode.equals(captcha)){  
62 - rs.put("msg", "验证码有误,请刷新后重新输入");  
63 - return rs;  
64 - } 67 + if(!verCode.equals(captcha))
  68 + return put(rs, "msg", "验证码有误,请刷新后重新输入");
65 } 69 }
66 70
  71 + //解密RSA
  72 + userName = RSAUtils.decryptBase64(userName);
  73 + password = RSAUtils.decryptBase64(password);
  74 +
67 SysUser user = sysUserService.findByUserName(userName); 75 SysUser user = sysUserService.findByUserName(userName);
68 - if (null == user) {  
69 - rs.put("msg", "不存在的用户");  
70 - return rs;  
71 - } 76 + if (null == user)
  77 + return put(rs, "msg", "不存在的用户");
72 78
73 - if (!user.isEnabled()) {  
74 - rs.put("msg", "该用户已被锁定,请联系管理员");  
75 - return rs;  
76 - } 79 + if (!user.isEnabled())
  80 + return put(rs, "msg", "该用户已被锁定,请联系管理员");
77 81
78 // 校验密码 82 // 校验密码
79 - password = fourDecodeBase64(password);  
80 boolean matchStatus = new BCryptPasswordEncoder(4).matches(password, user.getPassword()); 83 boolean matchStatus = new BCryptPasswordEncoder(4).matches(password, user.getPassword());
81 if (!matchStatus) { 84 if (!matchStatus) {
82 rs.put("msg", "密码有误"); 85 rs.put("msg", "密码有误");
@@ -109,9 +112,10 @@ public class UserController extends BaseController&lt;SysUser, Integer&gt; { @@ -109,9 +112,10 @@ public class UserController extends BaseController&lt;SysUser, Integer&gt; {
109 Integer size = captchaMap.get(userName); 112 Integer size = captchaMap.get(userName);
110 return size == null?0:size; 113 return size == null?0:size;
111 } 114 }
112 -  
113 - private String fourDecodeBase64(String t) {  
114 - return new String(Base64.decodeBase64(Base64.decodeBase64(Base64.decodeBase64(Base64.decodeBase64(t))))); 115 +
  116 + public Map<String, Object> put(Map<String, Object> rs, String key, Object val){
  117 + rs.put(key, val);
  118 + return rs;
115 } 119 }
116 120
117 /** 121 /**
src/main/java/com/bsth/controller/sys/util/RSAUtils.java 0 → 100644
  1 +package com.bsth.controller.sys.util;
  2 +
  3 +import java.security.KeyPair;
  4 +import java.security.KeyPairGenerator;
  5 +import java.security.SecureRandom;
  6 +import java.security.Security;
  7 +import java.security.interfaces.RSAPrivateKey;
  8 +import java.security.interfaces.RSAPublicKey;
  9 +
  10 +import javax.crypto.Cipher;
  11 +
  12 +import org.apache.commons.net.util.Base64;
  13 +
  14 +public class RSAUtils {
  15 + private static final KeyPair keyPair = initKey();
  16 +
  17 + private static KeyPair initKey(){
  18 + try {
  19 + Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
  20 + SecureRandom random = new SecureRandom();
  21 + KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", "BC");
  22 + generator.initialize(1024, random);
  23 + return generator.generateKeyPair();
  24 + }catch (Exception e) {
  25 + throw new RuntimeException(e);
  26 + }
  27 + }
  28 +
  29 + /**
  30 + * 生成public key
  31 + * @return
  32 + */
  33 + public static String generateBase64PublicKey(){
  34 + RSAPublicKey key = (RSAPublicKey)keyPair.getPublic();
  35 + return new String(Base64.encodeBase64(key.getEncoded()));
  36 + }
  37 +
  38 + /**
  39 + * 解密
  40 + * @param string
  41 + * @return
  42 + */
  43 + public static String decryptBase64(String string) {
  44 + return new String(decrypt(Base64.decodeBase64(string)));
  45 + }
  46 +
  47 + private static byte[] decrypt(byte[] string) {
  48 + try {
  49 + Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
  50 + Cipher cipher = Cipher.getInstance("RSA/None/PKCS1Padding", "BC");
  51 + RSAPrivateKey pbk = (RSAPrivateKey)keyPair.getPrivate();
  52 + cipher.init(Cipher.DECRYPT_MODE, pbk);
  53 + byte[] plainText = cipher.doFinal(string);
  54 + return plainText;
  55 + }catch (Exception e) {
  56 + throw new RuntimeException(e);
  57 + }
  58 + }
  59 +}
src/main/java/com/bsth/data/BasicData.java
@@ -57,7 +57,7 @@ public class BasicData implements CommandLineRunner{ @@ -57,7 +57,7 @@ public class BasicData implements CommandLineRunner{
57 public static TreeMultimap<String, String> lineCode2SocketUserMap = TreeMultimap.create(); 57 public static TreeMultimap<String, String> lineCode2SocketUserMap = TreeMultimap.create();
58 58
59 //线路ID和code 对照 59 //线路ID和code 对照
60 - public static BiMap<Integer, Integer> lineId2CodeMap; 60 + public static BiMap<Integer, String> lineId2CodeMap;
61 61
62 //线路编码和名称对照 62 //线路编码和名称对照
63 public static Map<String, String> lineCode2NameMap; 63 public static Map<String, String> lineCode2NameMap;
@@ -127,7 +127,7 @@ public class BasicData implements CommandLineRunner{ @@ -127,7 +127,7 @@ public class BasicData implements CommandLineRunner{
127 127
128 128
129 private void loadStationRouteInfo() { 129 private void loadStationRouteInfo() {
130 - Iterator<StationRoute> iterator = stationRouteRepository.findAll().iterator(); 130 + Iterator<StationRoute> iterator = stationRouteRepository.findAllEffective().iterator();
131 Map<String, Integer> map = new HashMap<>(); 131 Map<String, Integer> map = new HashMap<>();
132 StationRoute route; 132 StationRoute route;
133 133
@@ -211,12 +211,12 @@ public class BasicData implements CommandLineRunner{ @@ -211,12 +211,12 @@ public class BasicData implements CommandLineRunner{
211 Iterator<Line> iterator = lineRepository.findAll().iterator(); 211 Iterator<Line> iterator = lineRepository.findAll().iterator();
212 212
213 Line line; 213 Line line;
214 - BiMap<Integer, Integer> biMap = HashBiMap.create(); 214 + BiMap<Integer, String> biMap = HashBiMap.create();
215 Map<String, String> code2name = new HashMap<>(); 215 Map<String, String> code2name = new HashMap<>();
216 216
217 while(iterator.hasNext()){ 217 while(iterator.hasNext()){
218 line = iterator.next(); 218 line = iterator.next();
219 - biMap.put(line.getId(), Integer.parseInt(line.getLineCode())); 219 + biMap.put(line.getId(), line.getLineCode());
220 code2name.put(line.getLineCode(), line.getName()); 220 code2name.put(line.getLineCode(), line.getName());
221 } 221 }
222 222
src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java
@@ -50,7 +50,8 @@ public class ArrivalData_GPS implements CommandLineRunner{ @@ -50,7 +50,8 @@ public class ArrivalData_GPS implements CommandLineRunner{
50 50
51 @Override 51 @Override
52 public void run(String... arg0) throws Exception { 52 public void run(String... arg0) throws Exception {
53 - Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 30, 12, TimeUnit.SECONDS); 53 + logger.info("ArrivalData_GPS,30,10");
  54 + Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 30, 10, TimeUnit.SECONDS);
54 } 55 }
55 56
56 @Component 57 @Component
@@ -88,6 +89,7 @@ public class ArrivalData_GPS implements CommandLineRunner{ @@ -88,6 +89,7 @@ public class ArrivalData_GPS implements CommandLineRunner{
88 } 89 }
89 //从专业的角度分析一下数据 90 //从专业的角度分析一下数据
90 analyseData.analyse(carSet); 91 analyseData.analyse(carSet);
  92 +
91 //开始匹配 93 //开始匹配
92 Arrival2Schedule.start(carSet); 94 Arrival2Schedule.start(carSet);
93 }catch(Exception e){ 95 }catch(Exception e){
src/main/java/com/bsth/data/arrival/ArrivalEntity.java
1 package com.bsth.data.arrival; 1 package com.bsth.data.arrival;
2 2
  3 +import java.text.SimpleDateFormat;
3 import java.util.Date; 4 import java.util.Date;
4 5
5 import com.bsth.data.BasicData; 6 import com.bsth.data.BasicData;
6 -import com.bsth.util.DateUtils;  
7 7
8 /** 8 /**
9 * 9 *
@@ -88,7 +88,8 @@ public class ArrivalEntity { @@ -88,7 +88,8 @@ public class ArrivalEntity {
88 @Override 88 @Override
89 public String toString() { 89 public String toString() {
90 try { 90 try {
91 - return "["+BasicData.deviceId2NbbmMap.get(this.deviceId)+", "+DateUtils.sdfHHmm.format(new Date(this.ts)) 91 + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm");
  92 + return "["+BasicData.deviceId2NbbmMap.get(this.deviceId)+", "+sdfHHmm.format(new Date(this.ts))
92 +","+(this.getUpDown()==0?"上行":"下行")+","+(this.inOut==0?"进":"出")+","+this.stopNo+" ("+this.stopName+")]"; 93 +","+(this.getUpDown()==0?"上行":"下行")+","+(this.inOut==0?"进":"出")+","+this.stopNo+" ("+this.stopName+")]";
93 } catch (Exception e) { 94 } catch (Exception e) {
94 return ""; 95 return "";
src/main/java/com/bsth/data/arrival/DataLoader.java
@@ -141,6 +141,41 @@ public class DataLoader { @@ -141,6 +141,41 @@ public class DataLoader {
141 return list; 141 return list;
142 } 142 }
143 143
  144 + /**
  145 + *
  146 + * @Title: loadByLineAndStartTime
  147 + * @Description: TODO(根据线路,走向和时间戳加载数据)
  148 + */
  149 + public List<ArrivalEntity> loadByLineAndTime(String lineCode, int updown, long st, long et){
  150 + Calendar cal = Calendar.getInstance();
  151 + cal.setTimeInMillis(st);
  152 + int weeks_year = cal.get(Calendar.WEEK_OF_YEAR);
  153 +
  154 + Connection conn = null;
  155 + PreparedStatement ps = null;
  156 + ResultSet rs = null;
  157 +
  158 + List<ArrivalEntity> list = new ArrayList<>();
  159 + String sql = "select * from bsth_c_arrival_info where weeks_year=? and line_id=? and up_down=? and in_out=0 AND create_timestamp > ? AND create_timestamp <=? AND ABS(create_timestamp - ts) < 3600000 order by ts";
  160 + try{
  161 + conn = DBUtils_MS.getConnection();
  162 + ps = conn.prepareStatement(sql);
  163 + ps.setInt(1, weeks_year);
  164 + ps.setString(2, lineCode);
  165 + ps.setInt(3, updown);
  166 + ps.setLong(4, st);
  167 + ps.setLong(5, et);
  168 + rs = ps.executeQuery();
  169 +
  170 + list = resultSet2Set(rs);
  171 + }catch(Exception e){
  172 + logger.error("", e);
  173 + }finally {
  174 + DBUtils_MS.close(rs, ps, conn);
  175 + }
  176 + return list;
  177 + }
  178 +
144 public List<ArrivalEntity> resultSet2Set(ResultSet rs) throws SQLException{ 179 public List<ArrivalEntity> resultSet2Set(ResultSet rs) throws SQLException{
145 List<ArrivalEntity> list = new ArrayList<>(); 180 List<ArrivalEntity> list = new ArrayList<>();
146 181
src/main/java/com/bsth/data/directive/DirectiveCreator.java
@@ -43,7 +43,7 @@ public class DirectiveCreator { @@ -43,7 +43,7 @@ public class DirectiveCreator {
43 * @return Directive60 返回类型 43 * @return Directive60 返回类型
44 * @throws 44 * @throws
45 */ 45 */
46 - public static D60 createD60(String nbbm, String text, Short dispatchInstruct, int upDown, int state) { 46 + public D60 createD60(String nbbm, String text, Short dispatchInstruct, int upDown, int state) {
47 Long timestamp = System.currentTimeMillis(); 47 Long timestamp = System.currentTimeMillis();
48 48
49 Short company = Short.parseShort(BasicData.nbbm2CompanyCodeMap.get(nbbm)); 49 Short company = Short.parseShort(BasicData.nbbm2CompanyCodeMap.get(nbbm));
@@ -81,7 +81,7 @@ public class DirectiveCreator { @@ -81,7 +81,7 @@ public class DirectiveCreator {
81 } 81 }
82 82
83 83
84 - public static D60 createD60_02(String nbbm, String text, int upDown, int state, Date alarmTime){ 84 + public D60 createD60_02(String nbbm, String text, int upDown, int state, Date alarmTime){
85 SimpleDateFormat sdfMMddHHmm = new SimpleDateFormat("MMddHHmm"); 85 SimpleDateFormat sdfMMddHHmm = new SimpleDateFormat("MMddHHmm");
86 86
87 Long timestamp = System.currentTimeMillis(); 87 Long timestamp = System.currentTimeMillis();
@@ -129,19 +129,16 @@ public class DirectiveCreator { @@ -129,19 +129,16 @@ public class DirectiveCreator {
129 * @param @param t 时间戳 129 * @param @param t 时间戳
130 * @throws 130 * @throws
131 */ 131 */
132 - public static D64 createD64(String nbbm, Integer lineCode, long t){ 132 + public D64 createD64(String nbbm, String lineCode, long t){
133 String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); 133 String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm);
134 134
135 D64 change = new D64(); 135 D64 change = new D64();
136 D64Data data = new D64Data(); 136 D64Data data = new D64Data();
137 data.setCityCode(cityCode); 137 data.setCityCode(cityCode);
138 data.setDeviceId(deviceId); 138 data.setDeviceId(deviceId);
  139 +
139 //线路编码补满6位数 140 //线路编码补满6位数
140 - if(lineCode > 999999){  
141 - logger.error("线路编码不能超过6位,code:" + lineCode);  
142 - return null;  
143 - }  
144 - String lineCodeStr = String.format("%06d", lineCode); 141 + String lineCodeStr = padLeft(lineCode, 6, '0');
145 data.setLineId(lineCodeStr); 142 data.setLineId(lineCodeStr);
146 143
147 change.setDeviceId(deviceId); 144 change.setDeviceId(deviceId);
@@ -160,7 +157,7 @@ public class DirectiveCreator { @@ -160,7 +157,7 @@ public class DirectiveCreator {
160 * @param @param lineId 线路ID 157 * @param @param lineId 线路ID
161 * @throws 158 * @throws
162 */ 159 */
163 - public static String createDeviceRefreshData(String deviceId, Integer lineCode) { 160 + public String createDeviceRefreshData(String deviceId, String lineCode) {
164 Long t = System.currentTimeMillis(); 161 Long t = System.currentTimeMillis();
165 Map<String, Object> param = new HashMap<>(); 162 Map<String, Object> param = new HashMap<>();
166 param.put("deviceId", deviceId); 163 param.put("deviceId", deviceId);
@@ -175,11 +172,7 @@ public class DirectiveCreator { @@ -175,11 +172,7 @@ public class DirectiveCreator {
175 data.put("centerId", 1); 172 data.put("centerId", 1);
176 173
177 //线路编码补满6位数 174 //线路编码补满6位数
178 - if(lineCode > 999999){  
179 - logger.error("线路编码不能超过6位,code:" + lineCode);  
180 - return null;  
181 - }  
182 - String lineCodeStr = String.format("%06d", lineCode); 175 + String lineCodeStr = padLeft(lineCode, 6, '0');
183 176
184 data.put("lineId", lineCodeStr); 177 data.put("lineId", lineCodeStr);
185 data.put("lineVersion", 0); 178 data.put("lineVersion", 0);
@@ -189,7 +182,15 @@ public class DirectiveCreator { @@ -189,7 +182,15 @@ public class DirectiveCreator {
189 return JSON.toJSONString(param); 182 return JSON.toJSONString(param);
190 } 183 }
191 184
192 - public static void main(String[] args) {  
193 - System.out.println(String.format("%06d", "1025"));  
194 - } 185 + public String padLeft(String oriStr,int len,char alexin){
  186 + String str = "";
  187 + int strlen = oriStr.length();
  188 + if(strlen < len){
  189 + for(int i=0;i<len-strlen;i++){
  190 + str = str+alexin;
  191 + }
  192 + }
  193 + str = str + oriStr;
  194 + return str;
  195 + }
195 } 196 }
src/main/java/com/bsth/data/forecast/ForecastRealServer.java 0 → 100644
  1 +package com.bsth.data.forecast;
  2 +
  3 +import java.text.DecimalFormat;
  4 +import java.util.ArrayList;
  5 +import java.util.HashMap;
  6 +import java.util.List;
  7 +import java.util.Map;
  8 +import java.util.concurrent.TimeUnit;
  9 +
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.boot.CommandLineRunner;
  14 +import org.springframework.stereotype.Component;
  15 +
  16 +import com.bsth.Application;
  17 +import com.bsth.data.forecast.entity.ForecastResult;
  18 +import com.bsth.data.forecast.entity.ForecastResult.ForecastResultItem;
  19 +import com.bsth.data.forecast.entity.SimpleRoute;
  20 +import com.bsth.data.forecast.entity.SimpleRoute.TimeRange;
  21 +import com.bsth.data.gpsdata.GpsEntity;
  22 +import com.bsth.data.gpsdata.GpsRealData;
  23 +import com.bsth.data.schedule.DayOfSchedule;
  24 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  25 +import com.google.common.collect.ArrayListMultimap;
  26 +
  27 +/**
  28 + *
  29 + * @ClassName: SampleTimeData
  30 + * @Description: TODO(实时到离站预测)
  31 + * @author PanZhao
  32 + * @date 2016年9月18日 上午10:15:17
  33 + *
  34 + */
  35 +@Component
  36 +public class ForecastRealServer implements CommandLineRunner {
  37 +
  38 + @Autowired
  39 + SampleTimeDataLoader dataLoader;
  40 +
  41 + @Autowired
  42 + DayOfSchedule dayOfSchedule;
  43 +
  44 + @Autowired
  45 + GpsRealData gpsRealData;
  46 +
  47 + Logger logger = LoggerFactory.getLogger(this.getClass());
  48 +
  49 + //车辆 ——> 预测终点时间
  50 + //static Map<String, Float> forecastMap = new HashMap<>();
  51 + //线路_上下行 ——> 封装耗时数据的路由链
  52 + public static ArrayListMultimap<String, SimpleRoute> lineSampleMap;
  53 + //车辆 ——> 预测结果
  54 + public static Map<String, ForecastResult> forecastMap;
  55 +
  56 + static{
  57 + lineSampleMap = ArrayListMultimap.create();
  58 + forecastMap = new HashMap<>();
  59 + }
  60 +
  61 + @Override
  62 + public void run(String... arg0) throws Exception {
  63 + //2小时更新一次站点间耗时数据
  64 + Application.mainServices.scheduleWithFixedDelay(dataLoader, 12, 120 * 60, TimeUnit.SECONDS);
  65 + }
  66 +
  67 + /**
  68 + *
  69 + * @Title: forecast
  70 + * @Description: TODO(预测后续时间)
  71 + * @param @param nbbm 车辆自编号
  72 + */
  73 +/* public void forecast(String nbbm){
  74 + logger.info("预测," + nbbm);
  75 + //当前执行班次
  76 + ScheduleRealInfo sch = dayOfSchedule.execPlamMap().get(nbbm);
  77 + if(null == sch)
  78 + return;
  79 +
  80 + //车辆当前位置
  81 + //GpsEntity gps = gpsRealData.findByDeviceId(BasicData.deviceId2NbbmMap.inverse().get(sch.getClZbh()));
  82 + GpsEntity gps = gpsRealData.findByDeviceId(BasicData.deviceId2NbbmMap.inverse().get(nbbm));
  83 + forecast(nbbm, gps);
  84 + }*/
  85 +
  86 + public void forecast(String nbbm, GpsEntity gps){
  87 + try{
  88 + long t = System.currentTimeMillis();
  89 + //终点站
  90 + String eStation = null;
  91 + //当前执行班次
  92 + ScheduleRealInfo sch = dayOfSchedule.execPlamMap().get(nbbm);
  93 + if(null != sch)
  94 + eStation = sch.getZdzCode();
  95 +
  96 + //预测结果
  97 + ForecastResult forecastRes = new ForecastResult();
  98 + forecastRes.setStation(gps.getStopNo());
  99 + forecastRes.setArrTime(gps.getArrTime());
  100 + forecastRes.setFollows(
  101 + calc(gps.getLineId()
  102 + ,gps.getUpDown()
  103 + , gps.getStopNo(), eStation
  104 + , t - gps.getArrTime()));
  105 +
  106 + forecastMap.put(nbbm, forecastRes);
  107 + //GPS附加预计终点时间
  108 + gps.setExpectStopTime(expectStopTime(nbbm));
  109 + }catch(Exception e){
  110 + logger.error("", e);
  111 + }
  112 + }
  113 +
  114 + /**
  115 + *
  116 + * @Title: expectStopTime
  117 + * @Description: TODO(预计到达终点时间)
  118 + */
  119 + public Float expectStopTime(String nbbm){
  120 + long t = System.currentTimeMillis()
  121 + ,diff = 0L
  122 + ,firstExpTime;
  123 +
  124 + Float rs = null;
  125 + ForecastResult forecastRes = forecastMap.get(nbbm);
  126 + if(null == forecastRes)
  127 + return rs;
  128 +
  129 + List<ForecastResultItem> trs = forecastRes.getFollows();
  130 + if(null != trs && trs.size() > 0){
  131 +
  132 + //当前时间已超过第一个预计到站时间,后续预测时间补上差值
  133 + firstExpTime = trs.get(0).getTime();
  134 + if(firstExpTime < t)
  135 + diff = t - firstExpTime;
  136 +
  137 + rs = ((float)((trs.get(trs.size() - 1).getTime()) - t + diff)) / 1000 / 60;
  138 + }
  139 +
  140 + //保留2位小数
  141 + if(null != rs)
  142 + rs = Float.parseFloat(new DecimalFormat(".00").format(rs));
  143 +
  144 + return rs;
  145 + }
  146 +
  147 + /**
  148 + *
  149 + * @Title: expectDetail
  150 + * @Description: TODO(预测明细)
  151 + */
  152 + public List<TimeRange> expectDetail(String nbbm){
  153 +
  154 + return null;
  155 + }
  156 +
  157 +
  158 + public List<ForecastResultItem> calc(String lineCode, int updown , String sStation, String eStation, long diff){
  159 + long t = System.currentTimeMillis()
  160 + , ct = t - diff;
  161 +
  162 + List<SimpleRoute> srs = lineSampleMap.get(lineCode + "_" + updown);
  163 + SimpleRoute curr;
  164 + int len = srs.size();
  165 +
  166 + List<ForecastResultItem> rs = null;
  167 + ForecastResultItem frItem;
  168 +
  169 + for(int i = 0; i < len; i ++){
  170 + curr = srs.get(i);
  171 +
  172 + if(curr.stationCode.equals(sStation)){
  173 + rs = new ArrayList<>();
  174 + continue;
  175 + }
  176 +
  177 + if(null == rs)
  178 + continue;
  179 +
  180 + frItem = new ForecastResultItem();
  181 + frItem.setStationId(curr.stationCode);
  182 + frItem.setStationName(curr.stationName);
  183 + if(null == curr.ranges || curr.ranges.size() == 0)
  184 + break;
  185 +
  186 + //从多个时区耗时中选择一个
  187 + for(TimeRange tr : curr.ranges){
  188 + if(tr.startTime < t){
  189 + ct += ((long)(tr.runTime * 60 * 1000));
  190 + frItem.setTime(ct);
  191 + break;
  192 + }
  193 + }
  194 +
  195 + if(null != eStation && eStation.equals(curr.stationCode))
  196 + break;
  197 +
  198 + rs.add(frItem);
  199 + }
  200 +
  201 + return rs;
  202 + }
  203 +}
src/main/java/com/bsth/data/forecast/SampleTimeDataLoader.java 0 → 100644
  1 +package com.bsth.data.forecast;
  2 +
  3 +import java.text.SimpleDateFormat;
  4 +import java.util.ArrayList;
  5 +import java.util.Collections;
  6 +import java.util.Comparator;
  7 +import java.util.Date;
  8 +import java.util.Iterator;
  9 +import java.util.List;
  10 +import java.util.Set;
  11 +
  12 +import org.slf4j.Logger;
  13 +import org.slf4j.LoggerFactory;
  14 +import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.stereotype.Component;
  16 +
  17 +import com.bsth.data.forecast.entity.SimpleRoute;
  18 +import com.bsth.data.forecast.entity.SimpleRoute.TimeRange;
  19 +import com.bsth.entity.StationRoute;
  20 +import com.bsth.entity.forecast.Sample;
  21 +import com.bsth.repository.StationRouteRepository;
  22 +import com.bsth.repository.forecast.SampleRepository;
  23 +import com.google.common.collect.ArrayListMultimap;
  24 +
  25 +/**
  26 + *
  27 + * @Title: loadData
  28 + * @Description: TODO(从数据库加载数据)
  29 + */
  30 +@Component
  31 +public class SampleTimeDataLoader extends Thread {
  32 +
  33 + @Autowired
  34 + SampleRepository sampleRepository;
  35 +
  36 + @Autowired
  37 + StationRouteRepository stationRouteRepository;
  38 +
  39 + // 当天日期
  40 + String rq;
  41 +
  42 + SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");
  43 +
  44 + Logger logger = LoggerFactory.getLogger(this.getClass());
  45 +
  46 + @Override
  47 + public void run() {
  48 + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");
  49 + rq = sdfyyyyMMdd.format(new Date());
  50 +
  51 + Iterator<Sample> iterator = sampleRepository.findAll().iterator();
  52 + ArrayListMultimap<String, Sample> sampleMap = ArrayListMultimap.create();
  53 +
  54 + Sample sample;
  55 + String key;
  56 + while (iterator.hasNext()) {
  57 + sample = iterator.next();
  58 + key = sample.getLineCode() + "_" + sample.getUpdown() + "_" + sample.getsStation() + "_"
  59 + + sample.geteStation();
  60 + sampleMap.put(key, sample);
  61 + }
  62 +
  63 + // 加载全部路由信息
  64 + List<StationRoute> allRoutes = stationRouteRepository.findAllEffective();
  65 + // 线路和走向分组
  66 + ArrayListMultimap<String, StationRoute> groupMap = ArrayListMultimap.create();
  67 + for (StationRoute sr : allRoutes)
  68 + groupMap.put(sr.getLineCode() + "_" + sr.getDirections(), sr);
  69 +
  70 + ArrayListMultimap<String, SimpleRoute> lineSampleMapCopy = ArrayListMultimap.create();
  71 + // 排序路由链并附加各个时区耗时信息
  72 + StationRouteComp comp = new StationRouteComp();
  73 + Set<String> kys = groupMap.keySet();
  74 + List<StationRoute> routeList;
  75 + StationRoute sRoute;
  76 +
  77 + List<Sample> sapList;
  78 + for (String k : kys) {
  79 + routeList = groupMap.get(k);
  80 + // 排序
  81 + Collections.sort(routeList, comp);
  82 +
  83 + for (int i = 1; i < routeList.size(); i++) {
  84 + sRoute = routeList.get(i);
  85 +
  86 + sapList = sampleMap.get(k + "_" +routeList.get(i - 1).getStationCode() + "_" + sRoute.getStationCode());
  87 +
  88 + lineSampleMapCopy.put(k, createSimpleRoute(sRoute, sapList));
  89 + }
  90 + }
  91 +
  92 + ForecastRealServer.lineSampleMap = lineSampleMapCopy;
  93 + logger.info("SampleTimeDataLoader.... over...");
  94 + }
  95 +
  96 + private SimpleRoute createSimpleRoute(StationRoute sRoute, List<Sample> list) {
  97 + SimpleRoute simple = new SimpleRoute();
  98 +
  99 + simple.stationCode = sRoute.getStationCode();
  100 + simple.ranges = new ArrayList<>();
  101 +
  102 + try{
  103 + TimeRange tg;
  104 + for (Sample s : list) {
  105 + tg = new TimeRange();
  106 + tg.startTime = sdfyyyyMMddHHmm.parse(rq + s.getsDate()).getTime();
  107 + tg.endTime = sdfyyyyMMddHHmm.parse(rq + s.geteDate()).getTime();
  108 + tg.runTime = s.getRunTime();
  109 + simple.ranges.add(tg);
  110 + }
  111 +
  112 + //排序
  113 + Collections.sort(simple.ranges);
  114 + }catch(Exception e){
  115 + logger.error("", e);
  116 + }
  117 + return simple;
  118 + }
  119 +
  120 + public static class StationRouteComp implements Comparator<StationRoute> {
  121 +
  122 + @Override
  123 + public int compare(StationRoute o1, StationRoute o2) {
  124 + return o1.getStationRouteCode() - o2.getStationRouteCode();
  125 + }
  126 + }
  127 +}
src/main/java/com/bsth/data/forecast/entity/ForecastResult.java 0 → 100644
  1 +package com.bsth.data.forecast.entity;
  2 +
  3 +import java.util.List;
  4 +
  5 +/**
  6 + *
  7 + * @ClassName: ForecastResult
  8 + * @Description: TODO(预测结果)
  9 + * @author PanZhao
  10 + * @date 2016年9月19日 上午11:09:28
  11 + *
  12 + */
  13 +public class ForecastResult {
  14 +
  15 + /** 当前站 */
  16 + private String station;
  17 +
  18 + /** 到站时间 */
  19 + private long arrTime;
  20 +
  21 + /** 后续站点预测明细 */
  22 + private List<ForecastResultItem> follows;
  23 +
  24 + /** 预计到达终点时间(分钟) */
  25 + private Float stopTime;
  26 +
  27 + public static class ForecastResultItem {
  28 +
  29 + /** 站点ID */
  30 + private String stationId;
  31 +
  32 + /** 站点名称 */
  33 + private String stationName;
  34 +
  35 + /** 时间戳 */
  36 + private long time;
  37 +
  38 + public String getStationId() {
  39 + return stationId;
  40 + }
  41 +
  42 + public void setStationId(String stationId) {
  43 + this.stationId = stationId;
  44 + }
  45 +
  46 + public String getStationName() {
  47 + return stationName;
  48 + }
  49 +
  50 + public void setStationName(String stationName) {
  51 + this.stationName = stationName;
  52 + }
  53 +
  54 + public long getTime() {
  55 + return time;
  56 + }
  57 +
  58 + public void setTime(long time) {
  59 + this.time = time;
  60 + }
  61 + }
  62 +
  63 + public String getStation() {
  64 + return station;
  65 + }
  66 +
  67 + public void setStation(String station) {
  68 + this.station = station;
  69 + }
  70 +
  71 + public long getArrTime() {
  72 + return arrTime;
  73 + }
  74 +
  75 + public void setArrTime(long arrTime) {
  76 + this.arrTime = arrTime;
  77 + }
  78 +
  79 + public Float getStopTime() {
  80 + return stopTime;
  81 + }
  82 +
  83 + public void setStopTime(Float stopTime) {
  84 + this.stopTime = stopTime;
  85 + }
  86 +
  87 + public List<ForecastResultItem> getFollows() {
  88 + return follows;
  89 + }
  90 +
  91 + public void setFollows(List<ForecastResultItem> follows) {
  92 + this.follows = follows;
  93 + }
  94 +}
src/main/java/com/bsth/data/forecast/entity/SimpleRoute.java 0 → 100644
  1 +package com.bsth.data.forecast.entity;
  2 +
  3 +import java.util.List;
  4 +
  5 +/**
  6 + *
  7 + * @ClassName: SimpleStationRoute
  8 + * @Description: TODO(简单的路由耗时封装)
  9 + * @author PanZhao
  10 + * @date 2016年9月18日 上午10:51:56
  11 + *
  12 + */
  13 +public class SimpleRoute {
  14 +
  15 + /** 站点编码 */
  16 + public String stationCode;
  17 +
  18 + /** 站点名称 */
  19 + public String stationName;
  20 +
  21 + public List<TimeRange> ranges;
  22 +
  23 + public static class TimeRange implements Comparable<TimeRange>{
  24 +
  25 + /** 开始时间 */
  26 + public long startTime;
  27 +
  28 + /** 截止时间 */
  29 + public long endTime;
  30 +
  31 + /** 运行时间 */
  32 + public float runTime;
  33 +
  34 + @Override
  35 + public int compareTo(TimeRange o) {
  36 + return (int) (o.startTime - this.startTime);
  37 + }
  38 + }
  39 +}
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
@@ -14,7 +14,7 @@ public class GpsEntity { @@ -14,7 +14,7 @@ public class GpsEntity {
14 private Integer companyCode; 14 private Integer companyCode;
15 15
16 /** 线路编码 */ 16 /** 线路编码 */
17 - private Integer lineId; 17 + private String lineId;
18 18
19 /** 设备编码 */ 19 /** 设备编码 */
20 private String deviceId; 20 private String deviceId;
@@ -24,6 +24,12 @@ public class GpsEntity { @@ -24,6 +24,12 @@ public class GpsEntity {
24 24
25 /** 站点编码 */ 25 /** 站点编码 */
26 private String stopNo; 26 private String stopNo;
  27 +
  28 + /** 站点名称 */
  29 + private String stationName;
  30 +
  31 + /** 到站时间 */
  32 + private long arrTime;
27 33
28 /** 经度 */ 34 /** 经度 */
29 private Float lon; 35 private Float lon;
@@ -49,17 +55,14 @@ public class GpsEntity { @@ -49,17 +55,14 @@ public class GpsEntity {
49 /** 车辆内部编码 */ 55 /** 车辆内部编码 */
50 private String nbbm; 56 private String nbbm;
51 57
52 - /** 站点名称 */  
53 - private String stationName;  
54 -  
55 - /** 当前班次ID */  
56 - private Long currSchId;  
57 -  
58 - /** 下一个班次ID */  
59 - private Long nextSchId; 58 + /** 预计到达终点时间 */
  59 + private Float expectStopTime;
60 60
61 /** 设备是否在线 */ 61 /** 设备是否在线 */
62 private boolean online; 62 private boolean online;
  63 +
  64 + /** 当前执行班次ID */
  65 + private Long schId;
63 66
64 public Integer getCompanyCode() { 67 public Integer getCompanyCode() {
65 return companyCode; 68 return companyCode;
@@ -69,14 +72,6 @@ public class GpsEntity { @@ -69,14 +72,6 @@ public class GpsEntity {
69 this.companyCode = companyCode; 72 this.companyCode = companyCode;
70 } 73 }
71 74
72 - public Integer getLineId() {  
73 - return lineId;  
74 - }  
75 -  
76 - public void setLineId(Integer lineId) {  
77 - this.lineId = lineId;  
78 - }  
79 -  
80 public String getDeviceId() { 75 public String getDeviceId() {
81 return deviceId; 76 return deviceId;
82 } 77 }
@@ -156,22 +151,6 @@ public class GpsEntity { @@ -156,22 +151,6 @@ public class GpsEntity {
156 public void setUpDown(Integer upDown) { 151 public void setUpDown(Integer upDown) {
157 this.upDown = upDown; 152 this.upDown = upDown;
158 } 153 }
159 -  
160 - public Long getCurrSchId() {  
161 - return currSchId;  
162 - }  
163 -  
164 - public void setCurrSchId(Long currSchId) {  
165 - this.currSchId = currSchId;  
166 - }  
167 -  
168 - public Long getNextSchId() {  
169 - return nextSchId;  
170 - }  
171 -  
172 - public void setNextSchId(Long nextSchId) {  
173 - this.nextSchId = nextSchId;  
174 - }  
175 154
176 public String getNbbm() { 155 public String getNbbm() {
177 return nbbm; 156 return nbbm;
@@ -196,4 +175,36 @@ public class GpsEntity { @@ -196,4 +175,36 @@ public class GpsEntity {
196 public void setOnline(boolean online) { 175 public void setOnline(boolean online) {
197 this.online = online; 176 this.online = online;
198 } 177 }
  178 +
  179 + public long getArrTime() {
  180 + return arrTime;
  181 + }
  182 +
  183 + public void setArrTime(long arrTime) {
  184 + this.arrTime = arrTime;
  185 + }
  186 +
  187 + public Float getExpectStopTime() {
  188 + return expectStopTime;
  189 + }
  190 +
  191 + public void setExpectStopTime(Float expectStopTime) {
  192 + this.expectStopTime = expectStopTime;
  193 + }
  194 +
  195 + public String getLineId() {
  196 + return lineId;
  197 + }
  198 +
  199 + public void setLineId(String lineId) {
  200 + this.lineId = lineId;
  201 + }
  202 +
  203 + public Long getSchId() {
  204 + return schId;
  205 + }
  206 +
  207 + public void setSchId(Long schId) {
  208 + this.schId = schId;
  209 + }
199 } 210 }
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
@@ -25,6 +25,9 @@ import com.alibaba.fastjson.JSON; @@ -25,6 +25,9 @@ import com.alibaba.fastjson.JSON;
25 import com.alibaba.fastjson.JSONObject; 25 import com.alibaba.fastjson.JSONObject;
26 import com.bsth.Application; 26 import com.bsth.Application;
27 import com.bsth.data.BasicData; 27 import com.bsth.data.BasicData;
  28 +import com.bsth.data.forecast.ForecastRealServer;
  29 +import com.bsth.data.schedule.DayOfSchedule;
  30 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
28 import com.bsth.util.ConfigUtil; 31 import com.bsth.util.ConfigUtil;
29 import com.google.common.collect.TreeMultimap; 32 import com.google.common.collect.TreeMultimap;
30 33
@@ -44,7 +47,7 @@ public class GpsRealData implements CommandLineRunner{ @@ -44,7 +47,7 @@ public class GpsRealData implements CommandLineRunner{
44 private static Map<String, GpsEntity> gpsMap; 47 private static Map<String, GpsEntity> gpsMap;
45 48
46 //按线路分组设备号 49 //按线路分组设备号
47 - private static TreeMultimap<Integer, String> lineCode2Devices; 50 + private static TreeMultimap<String, String> lineCode2Devices;
48 51
49 // 网关数据接口地址 52 // 网关数据接口地址
50 private static String url; 53 private static String url;
@@ -52,6 +55,11 @@ public class GpsRealData implements CommandLineRunner{ @@ -52,6 +55,11 @@ public class GpsRealData implements CommandLineRunner{
52 @Autowired 55 @Autowired
53 GpsDataLoader gpsDataLoader; 56 GpsDataLoader gpsDataLoader;
54 57
  58 + @Autowired
  59 + DayOfSchedule dayOfSchedule;
  60 +
  61 + @Autowired
  62 + ForecastRealServer forecastRealServer;
55 /** 63 /**
56 * 构造函数 64 * 构造函数
57 */ 65 */
@@ -64,11 +72,25 @@ public class GpsRealData implements CommandLineRunner{ @@ -64,11 +72,25 @@ public class GpsRealData implements CommandLineRunner{
64 @Override 72 @Override
65 public void run(String... arg0) throws Exception { 73 public void run(String... arg0) throws Exception {
66 logger.info("gpsDataLoader,20,6"); 74 logger.info("gpsDataLoader,20,6");
67 - Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 6, TimeUnit.SECONDS); 75 + Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 7, TimeUnit.SECONDS);
68 } 76 }
69 77
70 - public static GpsEntity add(GpsEntity gps) { 78 + public GpsEntity add(GpsEntity gps) {
71 String device = gps.getDeviceId(); 79 String device = gps.getDeviceId();
  80 + GpsEntity old = gpsMap.get(device);
  81 +
  82 + //定时定距数据附带站点编码改变
  83 + if(null == old || !old.getStopNo().equals(gps.getStopNo())){
  84 + gps.setArrTime(gps.getTimestamp());
  85 + //预测到达终点时间
  86 + forecastRealServer.forecast(gps.getNbbm(), gps);
  87 + }
  88 + else{
  89 + gps.setArrTime(old.getArrTime());
  90 + //不预测, 重新计算终点时间
  91 + gps.setExpectStopTime(forecastRealServer.expectStopTime(gps.getNbbm()));
  92 + }
  93 +
72 gpsMap.put(device, gps); 94 gpsMap.put(device, gps);
73 lineCode2Devices.put(gps.getLineId(), device); 95 lineCode2Devices.put(gps.getLineId(), device);
74 return gps; 96 return gps;
@@ -86,12 +108,18 @@ public class GpsRealData implements CommandLineRunner{ @@ -86,12 +108,18 @@ public class GpsRealData implements CommandLineRunner{
86 * 108 *
87 * @Title: get @Description: TODO(线路编码获取GPS集合) @throws 109 * @Title: get @Description: TODO(线路编码获取GPS集合) @throws
88 */ 110 */
89 - public List<GpsEntity> get(Integer lineCode) { 111 + public List<GpsEntity> getByLine(String lineCode) {
90 NavigableSet<String> set = lineCode2Devices.get(lineCode); 112 NavigableSet<String> set = lineCode2Devices.get(lineCode);
91 113
92 List<GpsEntity> rs = new ArrayList<>(); 114 List<GpsEntity> rs = new ArrayList<>();
  115 + GpsEntity gps;
  116 + ScheduleRealInfo sch;
93 for(String device : set){ 117 for(String device : set){
94 - rs.add(gpsMap.get(device)); 118 + gps = gpsMap.get(device);
  119 + sch = dayOfSchedule.execPlamMap().get(gps.getNbbm());
  120 + if(null != sch)
  121 + gps.setSchId(sch.getId());
  122 + rs.add(gps);
95 } 123 }
96 124
97 return rs; 125 return rs;
@@ -101,7 +129,7 @@ public class GpsRealData implements CommandLineRunner{ @@ -101,7 +129,7 @@ public class GpsRealData implements CommandLineRunner{
101 List<GpsEntity> list = new ArrayList<>(); 129 List<GpsEntity> list = new ArrayList<>();
102 130
103 for(String code : pArray) 131 for(String code : pArray)
104 - list.addAll(get(Integer.parseInt(code))); 132 + list.addAll(getByLine(code));
105 return list; 133 return list;
106 } 134 }
107 135
@@ -113,6 +141,9 @@ public class GpsRealData implements CommandLineRunner{ @@ -113,6 +141,9 @@ public class GpsRealData implements CommandLineRunner{
113 public static class GpsDataLoader extends Thread{ 141 public static class GpsDataLoader extends Thread{
114 142
115 Logger logger = LoggerFactory.getLogger(GpsDataLoader.class); 143 Logger logger = LoggerFactory.getLogger(GpsDataLoader.class);
  144 +
  145 + @Autowired
  146 + GpsRealData gpsRealData;
116 147
117 @Override 148 @Override
118 public void run() { 149 public void run() {
@@ -130,7 +161,7 @@ public class GpsRealData implements CommandLineRunner{ @@ -130,7 +161,7 @@ public class GpsRealData implements CommandLineRunner{
130 try { 161 try {
131 httpClient = HttpClients.createDefault(); 162 httpClient = HttpClients.createDefault();
132 HttpGet get = new HttpGet(url); 163 HttpGet get = new HttpGet(url);
133 - 164 +
134 response = httpClient.execute(get); 165 response = httpClient.execute(get);
135 166
136 HttpEntity entity = response.getEntity(); 167 HttpEntity entity = response.getEntity();
@@ -156,7 +187,7 @@ public class GpsRealData implements CommandLineRunner{ @@ -156,7 +187,7 @@ public class GpsRealData implements CommandLineRunner{
156 187
157 gps.setNbbm(nbbm); 188 gps.setNbbm(nbbm);
158 gps.setStationName(BasicData.stationCode2NameMap.get(gps.getStopNo())); 189 gps.setStationName(BasicData.stationCode2NameMap.get(gps.getStopNo()));
159 - add(gps); 190 + gpsRealData.add(gps);
160 } 191 }
161 } else 192 } else
162 logger.error("result is null"); 193 logger.error("result is null");
src/main/java/com/bsth/data/match/Arrival2Schedule.java
@@ -158,11 +158,7 @@ public class Arrival2Schedule implements ApplicationContextAware { @@ -158,11 +158,7 @@ public class Arrival2Schedule implements ApplicationContextAware {
158 158
159 //漂移判定 159 //漂移判定
160 if(driftCheck(mr, arr)){ 160 if(driftCheck(mr, arr)){
161 - mr.sch.setFcsjActualAll(mr.ts);  
162 - //通知客户端  
163 - sendUtils.sendFcsj(mr.sch);  
164 - //持久化  
165 - dayOfSchedule.save(mr.sch); 161 + carOut(mr);
166 } 162 }
167 } 163 }
168 } 164 }
@@ -203,26 +199,58 @@ public class Arrival2Schedule implements ApplicationContextAware { @@ -203,26 +199,58 @@ public class Arrival2Schedule implements ApplicationContextAware {
203 //排序后的第一个 就是最合适的匹配 199 //排序后的第一个 就是最合适的匹配
204 Collections.sort(mrs, mrComparator); 200 Collections.sort(mrs, mrComparator);
205 mr = mrs.get(0); 201 mr = mrs.get(0);
206 - mr.sch.setZdsjActualAll(mr.ts); 202 + carInStop(mr);
  203 + }
  204 + }
  205 +
  206 + /**
  207 + *
  208 + * @Title: carOut
  209 + * @Description: TODO(车辆发出)
  210 + */
  211 + public void carOut(MatchResult mr){
  212 + //设置发车时间
  213 + mr.sch.setFcsjActualAll(mr.ts);
  214 + //通知客户端
  215 + sendUtils.sendFcsj(mr.sch);
  216 + //持久化
  217 + dayOfSchedule.save(mr.sch);
  218 + //车辆当前执行班次
  219 + dayOfSchedule.addExecPlan(mr.sch);
  220 + }
  221 +
  222 + /**
  223 + *
  224 + * @Title: carInStop
  225 + * @Description: TODO(车辆进入终点站)
  226 + */
  227 + public void carInStop(MatchResult mr){
  228 + mr.sch.setZdsjActualAll(mr.ts);
  229 +
  230 + int doneSum = dayOfSchedule.doneSum(mr.sch.getClZbh());
  231 + ScheduleRealInfo next = dayOfSchedule.next(mr.sch);
  232 + if(null != next){
  233 + next.setQdzArrDateSJ(mr.sch.getZdsjActual());
  234 + //下发调度指令
  235 + directiveService.send60Dispatch(next, doneSum, "到站@系统");
207 236
208 - int doneSum = dayOfSchedule.doneSum(mr.sch.getClZbh());  
209 - ScheduleRealInfo next = dayOfSchedule.next(mr.sch);  
210 - if(null != next){  
211 - next.setQdzArrDateSJ(mr.sch.getZdsjActual());  
212 - //下发调度指令  
213 - directiveService.send60Dispatch(next, doneSum, "到站@系统");  
214 -  
215 - //起点既停车场的进场班次  
216 - if(next.getBcType().equals("in") && next.getJhlc() == null)  
217 - next.setFcsjActualAll(mr.ts);  
218 - }  
219 - else//下发文本指令(已结束运营)  
220 - directiveService.send60Phrase(nbbm, "到达终点 " + mr.sch.getZdzName() + ",已完成当日所有排班。", "系统");  
221 - //通知客户端  
222 - sendUtils.sendZdsj(mr.sch, next, doneSum);  
223 - //持久化  
224 - dayOfSchedule.save(mr.sch); 237 + //完成“起点既停车场”的进场班次
  238 + if(next.getBcType().equals("in") && next.getJhlc() == null)
  239 + next.setFcsjActualAll(mr.ts);
  240 +
  241 + //套跑 -下发线路切换指令
  242 + if(!next.getXlBm().equals(mr.sch.getXlBm()))
  243 + directiveService.lineChange(next.getClZbh(), next.getXlBm(), "套跑@系统");
225 } 244 }
  245 + else//下发文本指令(已结束运营)
  246 + directiveService.send60Phrase(nbbm, "到达终点 " + mr.sch.getZdzName() + ",已完成当日所有排班。", "系统");
  247 + //通知客户端
  248 + sendUtils.sendZdsj(mr.sch, next, doneSum);
  249 + //持久化
  250 + dayOfSchedule.save(mr.sch);
  251 + logger.info(mr.sch.getClZbh() + "移除正在执行班次," + mr.sch.getFcsj());
  252 + //移除车辆正在执行班次索引
  253 + dayOfSchedule.removeExecPlan(mr.sch.getClZbh());
226 } 254 }
227 255
228 /** 256 /**
src/main/java/com/bsth/data/match/Arrival2Schedule_old.java deleted 100644 → 0
1 -package com.bsth.data.match;  
2 -//package com.bsth.data.match;  
3 -//  
4 -//import java.util.ArrayList;  
5 -//import java.util.Collections;  
6 -//import java.util.List;  
7 -//import java.util.Set;  
8 -//  
9 -//import org.slf4j.Logger;  
10 -//import org.slf4j.LoggerFactory;  
11 -//import org.springframework.beans.BeansException;  
12 -//import org.springframework.context.ApplicationContext;  
13 -//import org.springframework.context.ApplicationContextAware;  
14 -//import org.springframework.stereotype.Component;  
15 -//  
16 -//import com.bsth.data.arrival.ArrivalComparator;  
17 -//import com.bsth.data.arrival.ArrivalData_GPS;  
18 -//import com.bsth.data.arrival.ArrivalEntity;  
19 -//import com.bsth.data.schedule.DayOfSchedule;  
20 -//import com.bsth.data.schedule.ScheduleComparator;  
21 -//import com.bsth.entity.realcontrol.ScheduleRealInfo;  
22 -//import com.bsth.service.directive.DirectiveService;  
23 -//import com.bsth.websocket.handler.SendUtils;  
24 -//  
25 -///**  
26 -// *  
27 -// * @ClassName: Arrival2Schedule  
28 -// * @Description: TODO(进出数据匹配班次)  
29 -// * @author PanZhao  
30 -// * @date 2016年8月10日 下午2:26:22  
31 -// *  
32 -// */  
33 -//@Component  
34 -//public class Arrival2Schedule implements ApplicationContextAware{  
35 -//  
36 -// private static ScheduleComparator.FCSJ schComparator;  
37 -// private static ArrivalComparator arrComparator;  
38 -// private static SendUtils sendUtils;  
39 -// private static DayOfSchedule dayOfSchedule;  
40 -// private static DirectiveService directiveService;  
41 -//  
42 -// private final static long MAX_RANGE = 1000 * 60 * 60 * 1L;  
43 -//  
44 -// static{  
45 -// schComparator = new ScheduleComparator.FCSJ();  
46 -// arrComparator = new ArrivalComparator();  
47 -// }  
48 -//  
49 -// static Logger logger = LoggerFactory.getLogger(Arrival2Schedule.class);  
50 -//  
51 -// /**  
52 -// *  
53 -// * @Title: start  
54 -// * @Description: TODO(开始)  
55 -// * @param @param cars 需要匹配的车辆集合  
56 -// */  
57 -// public static void start(Set<String> cars){  
58 -//  
59 -// for(String car : cars){  
60 -// new GpsMatchThread(car).start();  
61 -// }  
62 -// }  
63 -//  
64 -// public static class GpsMatchThread extends Thread{  
65 -//  
66 -// String nbbm;  
67 -// public GpsMatchThread(String nbbm){  
68 -// this.nbbm = nbbm;  
69 -// }  
70 -//  
71 -// @Override  
72 -// public void run() {  
73 -// //班次列表  
74 -// List<ScheduleRealInfo> schList = dayOfSchedule.findByNbbm(nbbm);  
75 -// //进出起终点数据  
76 -// List<ArrivalEntity> arrList = ArrivalData_GPS.getIncrement(nbbm);  
77 -// logger.info("####匹配进出站增量数据 " + arrList.size());  
78 -// //排序  
79 -// Collections.sort(schList, schComparator);  
80 -// Collections.sort(arrList, arrComparator);  
81 -//  
82 -// int si = lastMatchPoint(schList);  
83 -// int ai = afterByTime(arrList, lastMatchTime(schList.get(si)));  
84 -//  
85 -// //按起始索引开始匹配  
86 -// match(arrList, ai, schList, si);  
87 -// }  
88 -//  
89 -// public void match(List<ArrivalEntity> arrList, int ai, List<ScheduleRealInfo> schList, int si){  
90 -//  
91 -// int sLen = schList.size();  
92 -// for(; si < sLen; si ++)  
93 -// match(arrList, ai, schList.get(si));  
94 -// }  
95 -//  
96 -// public void match(List<ArrivalEntity> arrList, int ai, ScheduleRealInfo sch){  
97 -// //烂班不参与  
98 -// if(sch.isDestroy())  
99 -// return;  
100 -//  
101 -// int aLen = arrList.size();  
102 -//  
103 -// List<MatchResult> inRsList = new ArrayList<>()  
104 -// ,outRsList = new ArrayList<>();  
105 -//  
106 -// MatchResult mrs;  
107 -// for(;ai < aLen; ai ++){  
108 -// mrs = match(arrList.get(ai), sch);  
109 -// if(!mrs.success)  
110 -// continue;  
111 -//  
112 -// if(mrs.inOut == 0)  
113 -// inRsList.add(mrs);  
114 -// else if(mrs.inOut == 1)  
115 -// outRsList.add(mrs);  
116 -// }  
117 -//  
118 -// if(outRsList.size() > 0){  
119 -// //排序后的第一个 就是最合适的匹配  
120 -// Collections.sort(outRsList, new MatchResultComparator());  
121 -// mrs = outRsList.get(0);  
122 -//  
123 -// mrs.sch.setFcsjActualAll(mrs.ts);  
124 -// //通知客户端  
125 -// sendUtils.sendFcsj(mrs.sch);  
126 -// //持久化  
127 -// dayOfSchedule.save(mrs.sch);  
128 -// }  
129 -//  
130 -// if(inRsList.size() > 0){  
131 -// //排序后的第一个 就是最合适的匹配  
132 -// Collections.sort(inRsList, new MatchResultComparator());  
133 -// mrs = inRsList.get(0);  
134 -//  
135 -// /*if(!dayOfSchedule.validEndTime(mrs.sch, mrs.ts)){  
136 -// return;  
137 -// }*/  
138 -//  
139 -// mrs.sch.setZdsjActualAll(mrs.ts);  
140 -// int doneSum = dayOfSchedule.doneSum(mrs.sch.getClZbh());  
141 -// ScheduleRealInfo next = dayOfSchedule.next(mrs.sch);  
142 -// if(null != next){  
143 -// next.setQdzArrDateSJ(mrs.sch.getZdsjActual());  
144 -// //下发调度指令  
145 -// directiveService.send60Dispatch(next, doneSum, "系统");  
146 -// }  
147 -// else{  
148 -// //下发文本指令(已结束运营)  
149 -// directiveService.send60Phrase(nbbm, "到达终点 " + mrs.sch.getZdzName() + ",已完成当日所有排班。", "系统");  
150 -// }  
151 -// //通知客户端  
152 -// sendUtils.sendZdsj(mrs.sch, next, doneSum);  
153 -// //持久化  
154 -// dayOfSchedule.save(mrs.sch);  
155 -// }  
156 -// }  
157 -//  
158 -// public MatchResult match(ArrivalEntity arr, ScheduleRealInfo sch){  
159 -// MatchResult mrs = new MatchResult();  
160 -// mrs.inOut = arr.getInOut();  
161 -// mrs.sch = sch;  
162 -// mrs.ts = arr.getTs();  
163 -//  
164 -// if(Integer.parseInt(sch.getXlDir()) != arr.getUpDown()){  
165 -// return mrs;  
166 -// }  
167 -//  
168 -// if(arr.getInOut() == 1){  
169 -// if(sch.getFcsjActual() == null  
170 -// && sch.getQdzCode().equals(arr.getStopNo())  
171 -// && dayOfSchedule.validStartTime(sch, arr.getTs())){  
172 -//  
173 -// mrs.diff = arr.getTs() - sch.getDfsjT();  
174 -// if(Math.abs(mrs.diff) < MAX_RANGE)  
175 -// mrs.success = true;  
176 -// }  
177 -// }  
178 -// else if(arr.getInOut() == 0 && sch.getZdsj() != null){  
179 -// if(sch.getZdsjActual() == null  
180 -// && sch.getZdzCode().equals(arr.getStopNo())  
181 -// && dayOfSchedule.validEndTime(sch, arr.getTs())){  
182 -//  
183 -// mrs.diff = arr.getTs() - sch.getZdsjT();  
184 -// if(Math.abs(mrs.diff) < MAX_RANGE)  
185 -// mrs.success = true;  
186 -// }  
187 -// }  
188 -//  
189 -// return mrs;  
190 -// }  
191 -//  
192 -// /**  
193 -// *  
194 -// * @Title: lastMatchPoint  
195 -// * @Description: TODO(最后一个已实发的班次索引)  
196 -// */  
197 -// public int lastMatchPoint(List<ScheduleRealInfo> schList){  
198 -// int len = schList.size()  
199 -// ,rs = 0;  
200 -//  
201 -// ScheduleRealInfo sch;  
202 -// for(int i = len - 2; i >= 0; i --){  
203 -// sch = schList.get(i);  
204 -// if(sch.getFcsjActual() != null){  
205 -// rs = i;  
206 -// if(sch.getStatus() == 2)  
207 -// rs ++;  
208 -// break;  
209 -// }  
210 -// }  
211 -// return rs;  
212 -// }  
213 -//  
214 -// public long lastMatchTime(ScheduleRealInfo sch){  
215 -// Long t = 0L;  
216 -// if(null != sch.getFcsjActualTime())  
217 -// t = sch.getFcsjActualTime();  
218 -// if(null != sch.getZdsjActualTime())  
219 -// t = sch.getZdsjActualTime();  
220 -// return t;  
221 -// }  
222 -//  
223 -// /**  
224 -// *  
225 -// * @Title: afterByTime  
226 -// * @Description: TODO(参数时间戳之后的起始索引)  
227 -// */  
228 -// public int afterByTime(List<ArrivalEntity> arrList, long t){  
229 -// int len = arrList.size()  
230 -// ,rs = len - 1;  
231 -//  
232 -// for(int i = 0; i < len; i ++){  
233 -// if(arrList.get(i).getTs() > t){  
234 -// rs = i;  
235 -// break;  
236 -// }  
237 -// }  
238 -// return rs;  
239 -// }  
240 -// }  
241 -//  
242 -// @Override  
243 -// public void setApplicationContext(ApplicationContext arg0) throws BeansException {  
244 -// sendUtils = arg0.getBean(SendUtils.class);  
245 -// dayOfSchedule = arg0.getBean(DayOfSchedule.class);  
246 -// directiveService = arg0.getBean(DirectiveService.class);  
247 -// }  
248 -//}  
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
1 package com.bsth.data.schedule; 1 package com.bsth.data.schedule;
2 2
3 import java.text.ParseException; 3 import java.text.ParseException;
  4 +import java.text.SimpleDateFormat;
4 import java.util.ArrayList; 5 import java.util.ArrayList;
5 import java.util.Collection; 6 import java.util.Collection;
6 import java.util.Collections; 7 import java.util.Collections;
@@ -23,8 +24,11 @@ import org.springframework.stereotype.Component; @@ -23,8 +24,11 @@ import org.springframework.stereotype.Component;
23 import com.alibaba.fastjson.JSON; 24 import com.alibaba.fastjson.JSON;
24 import com.alibaba.fastjson.JSONArray; 25 import com.alibaba.fastjson.JSONArray;
25 import com.bsth.Application; 26 import com.bsth.Application;
  27 +import com.bsth.data.BasicData;
26 import com.bsth.data.LineConfigData; 28 import com.bsth.data.LineConfigData;
27 import com.bsth.data.directive.FirstScheduleCheckThread; 29 import com.bsth.data.directive.FirstScheduleCheckThread;
  30 +import com.bsth.data.gpsdata.GpsEntity;
  31 +import com.bsth.data.gpsdata.GpsRealData;
28 import com.bsth.data.schedule.thread.ScheduleLateThread; 32 import com.bsth.data.schedule.thread.ScheduleLateThread;
29 import com.bsth.data.schedule.thread.SchedulePstThread; 33 import com.bsth.data.schedule.thread.SchedulePstThread;
30 import com.bsth.data.schedule.thread.ScheduleRefreshThread; 34 import com.bsth.data.schedule.thread.ScheduleRefreshThread;
@@ -60,6 +64,9 @@ public class DayOfSchedule implements CommandLineRunner { @@ -60,6 +64,9 @@ public class DayOfSchedule implements CommandLineRunner {
60 64
61 // 车辆和排班起终点站对照(包括进出的停车场,区间起终点) 65 // 车辆和排班起终点站对照(包括进出的停车场,区间起终点)
62 private static TreeMultimap<String, String> nbbm2SEStationMap; 66 private static TreeMultimap<String, String> nbbm2SEStationMap;
  67 +
  68 + //车辆 ——> 当前执行班次
  69 + private static Map<String, ScheduleRealInfo> carExecutePlanMap;
63 70
64 // 持久化缓冲区 71 // 持久化缓冲区
65 public static LinkedList<ScheduleRealInfo> pstBuffer; 72 public static LinkedList<ScheduleRealInfo> pstBuffer;
@@ -81,6 +88,9 @@ public class DayOfSchedule implements CommandLineRunner { @@ -81,6 +88,9 @@ public class DayOfSchedule implements CommandLineRunner {
81 88
82 @Autowired 89 @Autowired
83 SendUtils sendUtils; 90 SendUtils sendUtils;
  91 +
  92 + @Autowired
  93 + GpsRealData gpsRealData;
84 94
85 /** 线路当前使用的排班的日期 */ 95 /** 线路当前使用的排班的日期 */
86 public static Map<String, String> currSchDateMap; 96 public static Map<String, String> currSchDateMap;
@@ -92,6 +102,7 @@ public class DayOfSchedule implements CommandLineRunner { @@ -92,6 +102,7 @@ public class DayOfSchedule implements CommandLineRunner {
92 schFCSJComparator = new ScheduleComparator.FCSJ(); 102 schFCSJComparator = new ScheduleComparator.FCSJ();
93 currSchDateMap = new HashMap<>(); 103 currSchDateMap = new HashMap<>();
94 nbbm2SEStationMap = TreeMultimap.create(); 104 nbbm2SEStationMap = TreeMultimap.create();
  105 + carExecutePlanMap = new HashMap<>();
95 } 106 }
96 107
97 @Autowired 108 @Autowired
@@ -130,7 +141,9 @@ public class DayOfSchedule implements CommandLineRunner { @@ -130,7 +141,9 @@ public class DayOfSchedule implements CommandLineRunner {
130 public String calcSchDate(String lineCode) { 141 public String calcSchDate(String lineCode) {
131 LineConfig conf = lineConfigData.get(lineCode); 142 LineConfig conf = lineConfigData.get(lineCode);
132 long ct = System.currentTimeMillis(); 143 long ct = System.currentTimeMillis();
133 - String schDate = DateUtils.sdfyyyyMMdd.format(new Date(ct)); 144 +
  145 + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");
  146 + String schDate = sdfyyyyMMdd.format(new Date(ct));
134 // 小于当天起始运营时间,则取前一天的排班 147 // 小于当天起始运营时间,则取前一天的排班
135 if (ct < conf.getCurrStartTime()) 148 if (ct < conf.getCurrStartTime())
136 schDate = DateUtils.subtractDay(schDate, 1); 149 schDate = DateUtils.subtractDay(schDate, 1);
@@ -283,7 +296,10 @@ public class DayOfSchedule implements CommandLineRunner { @@ -283,7 +296,10 @@ public class DayOfSchedule implements CommandLineRunner {
283 296
284 try { 297 try {
285 Map<String, Object> data = new HashMap<>(); 298 Map<String, Object> data = new HashMap<>();
286 - data.put("scheduleDate_eq", DateUtils.sdfyyyyMMdd.parse(schDate)); 299 + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd")
  300 + ,sdfHHmm = new SimpleDateFormat("HH:mm");
  301 +
  302 + data.put("scheduleDate_eq", sdfyyyyMMdd.parse(schDate));
287 data.put("xlBm_eq", lineCode); 303 data.put("xlBm_eq", lineCode);
288 304
289 // 查询计划排班 305 // 查询计划排班
@@ -293,13 +309,13 @@ public class DayOfSchedule implements CommandLineRunner { @@ -293,13 +309,13 @@ public class DayOfSchedule implements CommandLineRunner {
293 realList = JSONArray.parseArray(JSON.toJSONString(planItr), ScheduleRealInfo.class); 309 realList = JSONArray.parseArray(JSON.toJSONString(planItr), ScheduleRealInfo.class);
294 310
295 for (ScheduleRealInfo sch : realList) { 311 for (ScheduleRealInfo sch : realList) {
296 - sch.setScheduleDateStr(DateUtils.sdfyyyyMMdd.format(sch.getScheduleDate())); 312 + sch.setScheduleDateStr(sdfyyyyMMdd.format(sch.getScheduleDate()));
297 sch.setRealExecDate(sch.getScheduleDateStr()); 313 sch.setRealExecDate(sch.getScheduleDateStr());
298 // 计划终点时间 314 // 计划终点时间
299 if (sch.getBcsj() != null) { 315 if (sch.getBcsj() != null) {
300 try{ 316 try{
301 - sch.setZdsjT(DateUtils.sdfHHmm.parse(sch.getFcsj()).getTime() + (sch.getBcsj() * 60 * 1000));  
302 - sch.setZdsj(DateUtils.sdfHHmm.format(sch.getZdsjT())); 317 + sch.setZdsjT(sdfHHmm.parse(sch.getFcsj()).getTime() + (sch.getBcsj() * 60 * 1000));
  318 + sch.setZdsj(sdfHHmm.format(sch.getZdsjT()));
303 sch.setLate(false); 319 sch.setLate(false);
304 }catch(ParseException pe){ 320 }catch(ParseException pe){
305 logger.error("loadPlanSch... 计算终点时间失败..."); 321 logger.error("loadPlanSch... 计算终点时间失败...");
@@ -326,10 +342,11 @@ public class DayOfSchedule implements CommandLineRunner { @@ -326,10 +342,11 @@ public class DayOfSchedule implements CommandLineRunner {
326 id = 0L; 342 id = 0L;
327 id++; 343 id++;
328 344
  345 + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");
329 for (ScheduleRealInfo item : list) { 346 for (ScheduleRealInfo item : list) {
330 item.setSpId(item.getId());// 保留原始的计划ID 347 item.setSpId(item.getId());// 保留原始的计划ID
331 item.setId(id++);// 设置ID 348 item.setId(id++);// 设置ID
332 - item.setScheduleDateStr(DateUtils.sdfyyyyMMdd.format(item.getScheduleDate())); 349 + item.setScheduleDateStr(sdfyyyyMMdd.format(item.getScheduleDate()));
333 } 350 }
334 351
335 // 入库 352 // 入库
@@ -596,4 +613,44 @@ public class DayOfSchedule implements CommandLineRunner { @@ -596,4 +613,44 @@ public class DayOfSchedule implements CommandLineRunner {
596 public Collection<ScheduleRealInfo> findAll(){ 613 public Collection<ScheduleRealInfo> findAll(){
597 return nbbmScheduleMap.values(); 614 return nbbmScheduleMap.values();
598 } 615 }
  616 +
  617 + public void addExecPlan(ScheduleRealInfo sch){
  618 + carExecutePlanMap.put(sch.getClZbh(), sch);
  619 + }
  620 +
  621 + public void removeExecPlan(String clzbh){
  622 + carExecutePlanMap.remove(clzbh);
  623 + }
  624 +
  625 + public Map<String, ScheduleRealInfo> execPlamMap(){
  626 + return carExecutePlanMap;
  627 + }
  628 +
  629 + /**
  630 + *
  631 + * @Title: linkToSchPlan
  632 + * @Description: TODO(车辆关联到班次)
  633 + */
  634 +/* public void linkToSchPlan(String nbbm) {
  635 + //当前GPS状态
  636 + GpsEntity gps = gpsRealData.get(BasicData.deviceId2NbbmMap.inverse().get(nbbm));
  637 + if(null == gps)
  638 + return;
  639 +
  640 + //班次集合
  641 + List<ScheduleRealInfo> schArr = nbbmScheduleMap.get(nbbm);
  642 +
  643 + for(ScheduleRealInfo sch : schArr){
  644 + if(sch.getStatus() == 2)
  645 + continue;
  646 + if(sch.isDestroy())
  647 + continue;
  648 + if(!sch.getXlBm().equals(gps.getLineId())
  649 + || Integer.parseInt(sch.getXlDir()) != gps.getUpDown().intValue())
  650 + continue;
  651 +
  652 + addExecPlan(sch);
  653 + break;
  654 + }
  655 + }*/
599 } 656 }
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
1 package com.bsth.data.schedule; 1 package com.bsth.data.schedule;
2 2
3 import java.text.ParseException; 3 import java.text.ParseException;
  4 +import java.text.SimpleDateFormat;
4 import java.util.Collections; 5 import java.util.Collections;
5 import java.util.Date; 6 import java.util.Date;
6 import java.util.List; 7 import java.util.List;
@@ -13,7 +14,6 @@ import org.springframework.stereotype.Component; @@ -13,7 +14,6 @@ import org.springframework.stereotype.Component;
13 import com.bsth.data.LineConfigData; 14 import com.bsth.data.LineConfigData;
14 import com.bsth.entity.realcontrol.LineConfig; 15 import com.bsth.entity.realcontrol.LineConfig;
15 import com.bsth.entity.realcontrol.ScheduleRealInfo; 16 import com.bsth.entity.realcontrol.ScheduleRealInfo;
16 -import com.bsth.util.DateUtils;  
17 17
18 /** 18 /**
19 * 19 *
@@ -48,11 +48,13 @@ public class SchAttrCalculator { @@ -48,11 +48,13 @@ public class SchAttrCalculator {
48 * 早于线路开始运营时间的,加一天 48 * 早于线路开始运营时间的,加一天
49 * 如该线路 2点开始运营,2016-08-23的班次,则 2016-08-23 0:25 的班次应该调整成 2016-08-24 0:25 49 * 如该线路 2点开始运营,2016-08-23的班次,则 2016-08-23 0:25 的班次应该调整成 2016-08-24 0:25
50 */ 50 */
51 - long st = DateUtils.sdfyyyyMMddHHmm.parse(sch.getScheduleDateStr() + conf.getStartOpt()).getTime(); 51 + SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm")
  52 + ,sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");
  53 + long st = sdfyyyyMMddHHmm.parse(sch.getScheduleDateStr() + conf.getStartOpt()).getTime();
52 if (st > sch.getFcsjT()) 54 if (st > sch.getFcsjT())
53 sch.setFcsjAll(sch.getFcsjT() + DAY_TIME); 55 sch.setFcsjAll(sch.getFcsjT() + DAY_TIME);
54 56
55 - sch.setRealExecDate(DateUtils.sdfyyyyMMdd.format(new Date(sch.getFcsjT()))); 57 + sch.setRealExecDate(sdfyyyyMMdd.format(new Date(sch.getFcsjT())));
56 } catch (Exception e) { 58 } catch (Exception e) {
57 logger.error("", e); 59 logger.error("", e);
58 } 60 }
@@ -69,11 +71,12 @@ public class SchAttrCalculator { @@ -69,11 +71,12 @@ public class SchAttrCalculator {
69 // 生成时间戳 71 // 生成时间戳
70 calcTimestamp(sch); 72 calcTimestamp(sch);
71 73
  74 + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm");
72 // 计划终点时间 75 // 计划终点时间
73 if (sch.getBcsj() != null) { 76 if (sch.getBcsj() != null) {
74 Date zdDate = new Date(sch.getDfsjT() + (sch.getBcsj() * 60 * 1000)); 77 Date zdDate = new Date(sch.getDfsjT() + (sch.getBcsj() * 60 * 1000));
75 sch.setZdsjT(zdDate.getTime()); 78 sch.setZdsjT(zdDate.getTime());
76 - sch.setZdsj(DateUtils.sdfHHmm.format(zdDate)); 79 + sch.setZdsj(sdfHHmm.format(zdDate));
77 } 80 }
78 } catch (ParseException e) { 81 } catch (ParseException e) {
79 logger.error("", e); 82 logger.error("", e);
@@ -132,7 +135,8 @@ public class SchAttrCalculator { @@ -132,7 +135,8 @@ public class SchAttrCalculator {
132 } 135 }
133 136
134 public SchAttrCalculator calcFcsjTime(ScheduleRealInfo sch) throws ParseException { 137 public SchAttrCalculator calcFcsjTime(ScheduleRealInfo sch) throws ParseException {
135 - sch.setFcsjT(DateUtils.sdfyyyyMMddHHmm.parse(sch.getRealExecDate() + sch.getFcsj()).getTime()); 138 + SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");
  139 + sch.setFcsjT(sdfyyyyMMddHHmm.parse(sch.getRealExecDate() + sch.getFcsj()).getTime());
136 return this; 140 return this;
137 } 141 }
138 142
src/main/java/com/bsth/entity/StationRoute.java
@@ -21,7 +21,8 @@ import java.util.Date; @@ -21,7 +21,8 @@ import java.util.Date;
21 @Table(name = "bsth_c_stationroute") 21 @Table(name = "bsth_c_stationroute")
22 @NamedEntityGraphs({ 22 @NamedEntityGraphs({
23 @NamedEntityGraph(name = "stationRoute_station", attributeNodes = { 23 @NamedEntityGraph(name = "stationRoute_station", attributeNodes = {
24 - @NamedAttributeNode("station") 24 + @NamedAttributeNode("station"),
  25 + @NamedAttributeNode("line")
25 }) 26 })
26 }) 27 })
27 public class StationRoute { 28 public class StationRoute {
src/main/java/com/bsth/entity/forecast/Sample.java
1 package com.bsth.entity.forecast; 1 package com.bsth.entity.forecast;
2 2
3 3
  4 +import java.text.SimpleDateFormat;
  5 +import java.util.Date;
  6 +
4 import javax.persistence.Entity; 7 import javax.persistence.Entity;
5 import javax.persistence.GeneratedValue; 8 import javax.persistence.GeneratedValue;
6 import javax.persistence.Id; 9 import javax.persistence.Id;
7 import javax.persistence.Table; 10 import javax.persistence.Table;
8 import javax.persistence.Transient; 11 import javax.persistence.Transient;
9 12
  13 +import org.slf4j.Logger;
  14 +import org.slf4j.LoggerFactory;
  15 +
  16 +import com.bsth.data.arrival.ArrivalEntity;
  17 +
10 /** 18 /**
11 * 19 *
12 * @ClassName: Sample 20 * @ClassName: Sample
@@ -19,11 +27,36 @@ import javax.persistence.Transient; @@ -19,11 +27,36 @@ import javax.persistence.Transient;
19 @Table(name = "bsth_forecast_sample") 27 @Table(name = "bsth_forecast_sample")
20 public class Sample { 28 public class Sample {
21 29
  30 + @Transient
  31 + static Logger logger = LoggerFactory.getLogger(Sample.class);
  32 +
  33 + public Sample(ArrivalEntity prve, ArrivalEntity curr) {
  34 + //SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm");
  35 +
  36 + this.setsStation(prve.getStopNo());
  37 + this.seteStation(curr.getStopNo());
  38 + this.setsTime(prve.getTs());
  39 + this.seteTime(curr.getTs());
  40 + //this.setsDate(sdfHHmm.format(new Date(prve.getTs())));
  41 + //this.seteDate(sdfHHmm.format(new Date(curr.getTs())));
  42 +
  43 + /*try{
  44 + this.setsTime(sdfHHmm.parse(this.sDate).getTime());
  45 + this.seteTime(sdfHHmm.parse(this.eDate).getTime());
  46 + }catch(Exception e){
  47 + logger.error("", e);
  48 + }*/
  49 + Long diff = (curr.getTs() - prve.getTs());
  50 + this.setRunTime(Float.parseFloat(diff.toString()) / 1000 / 60);
  51 + }
  52 +
  53 + public Sample(){}
  54 +
22 @Id 55 @Id
23 @GeneratedValue 56 @GeneratedValue
24 private Long id; 57 private Long id;
25 58
26 - private Integer lineCode; 59 + private String lineCode;
27 60
28 // 开始时间 61 // 开始时间
29 private String sDate; 62 private String sDate;
@@ -135,11 +168,11 @@ public class Sample { @@ -135,11 +168,11 @@ public class Sample {
135 this.runTime = runTime; 168 this.runTime = runTime;
136 } 169 }
137 170
138 - public Integer getLineCode() { 171 + public String getLineCode() {
139 return lineCode; 172 return lineCode;
140 } 173 }
141 174
142 - public void setLineCode(Integer lineCode) { 175 + public void setLineCode(String lineCode) {
143 this.lineCode = lineCode; 176 this.lineCode = lineCode;
144 } 177 }
145 178
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
1 package com.bsth.entity.realcontrol; 1 package com.bsth.entity.realcontrol;
2 2
3 import java.text.ParseException; 3 import java.text.ParseException;
  4 +import java.text.SimpleDateFormat;
4 import java.util.Date; 5 import java.util.Date;
5 import java.util.HashSet; 6 import java.util.HashSet;
6 import java.util.Set; 7 import java.util.Set;
@@ -137,7 +138,9 @@ public class LineConfig { @@ -137,7 +138,9 @@ public class LineConfig {
137 public long getCurrStartTime() { 138 public long getCurrStartTime() {
138 Date d = null; 139 Date d = null;
139 try { 140 try {
140 - d = DateUtils.sdfyyyyMMddHHmm.parse(DateUtils.sdfyyyyMMdd.format(new Date()) + this.startOpt); 141 + SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm")
  142 + ,sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");
  143 + d = sdfyyyyMMddHHmm.parse(sdfyyyyMMdd.format(new Date()) + this.startOpt);
141 } catch (ParseException e) { 144 } catch (ParseException e) {
142 e.printStackTrace(); 145 e.printStackTrace();
143 } 146 }
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
1 package com.bsth.entity.realcontrol; 1 package com.bsth.entity.realcontrol;
2 2
3 import com.bsth.entity.sys.SysUser; 3 import com.bsth.entity.sys.SysUser;
4 -import com.bsth.util.DateUtils;  
5 import com.fasterxml.jackson.annotation.JsonIgnore; 4 import com.fasterxml.jackson.annotation.JsonIgnore;
6 5
7 import javax.persistence.*; 6 import javax.persistence.*;
@@ -9,6 +8,7 @@ import javax.persistence.*; @@ -9,6 +8,7 @@ import javax.persistence.*;
9 import org.apache.commons.lang3.StringUtils; 8 import org.apache.commons.lang3.StringUtils;
10 9
11 import java.text.ParseException; 10 import java.text.ParseException;
  11 +import java.text.SimpleDateFormat;
12 import java.util.Date; 12 import java.util.Date;
13 import java.util.HashSet; 13 import java.util.HashSet;
14 import java.util.Set; 14 import java.util.Set;
@@ -510,13 +510,15 @@ public class ScheduleRealInfo { @@ -510,13 +510,15 @@ public class ScheduleRealInfo {
510 510
511 public void setDfsjAll(Long dfsjT) { 511 public void setDfsjAll(Long dfsjT) {
512 this.dfsjT = dfsjT; 512 this.dfsjT = dfsjT;
513 - this.dfsj = DateUtils.sdfHHmm.format(new Date(this.dfsjT)); 513 + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm");
  514 + this.dfsj = sdfHHmm.format(new Date(this.dfsjT));
514 } 515 }
515 516
516 public void setDfsjAll(String dfsj) { 517 public void setDfsjAll(String dfsj) {
517 518
518 try { 519 try {
519 - this.dfsjT = DateUtils.sdfyyyyMMddHHmm.parse(this.realExecDate + dfsj).getTime(); 520 + SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");
  521 + this.dfsjT = sdfyyyyMMddHHmm.parse(this.realExecDate + dfsj).getTime();
520 this.dfsj = dfsj; 522 this.dfsj = dfsj;
521 } catch (ParseException e) { 523 } catch (ParseException e) {
522 e.printStackTrace(); 524 e.printStackTrace();
@@ -525,10 +527,11 @@ public class ScheduleRealInfo { @@ -525,10 +527,11 @@ public class ScheduleRealInfo {
525 527
526 public void calcEndTime(){ 528 public void calcEndTime(){
527 //计划终点时间 529 //计划终点时间
  530 + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm");
528 if(this.getBcsj() != null){ 531 if(this.getBcsj() != null){
529 Date zdDate = new Date(this.getDfsjT() + (this.getBcsj() * 60 * 1000)); 532 Date zdDate = new Date(this.getDfsjT() + (this.getBcsj() * 60 * 1000));
530 this.setZdsjT(zdDate.getTime()); 533 this.setZdsjT(zdDate.getTime());
531 - this.setZdsj(DateUtils.sdfHHmm.format(zdDate)); 534 + this.setZdsj(sdfHHmm.format(zdDate));
532 } 535 }
533 } 536 }
534 537
@@ -581,7 +584,8 @@ public class ScheduleRealInfo { @@ -581,7 +584,8 @@ public class ScheduleRealInfo {
581 */ 584 */
582 public void setFcsjAll(String fcsj){ 585 public void setFcsjAll(String fcsj){
583 try { 586 try {
584 - this.fcsjT = DateUtils.sdfyyyyMMddHHmm.parse(this.realExecDate + fcsj).getTime(); 587 + SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");
  588 + this.fcsjT = sdfyyyyMMddHHmm.parse(this.realExecDate + fcsj).getTime();
585 this.fcsj = fcsj; 589 this.fcsj = fcsj;
586 } catch (ParseException e) { 590 } catch (ParseException e) {
587 e.printStackTrace(); 591 e.printStackTrace();
@@ -596,7 +600,8 @@ public class ScheduleRealInfo { @@ -596,7 +600,8 @@ public class ScheduleRealInfo {
596 */ 600 */
597 public void setFcsjAll(Long fcsjT){ 601 public void setFcsjAll(Long fcsjT){
598 this.fcsjT = fcsjT; 602 this.fcsjT = fcsjT;
599 - this.fcsj = DateUtils.sdfHHmm.format(new Date(fcsjT)); 603 + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm");
  604 + this.fcsj = sdfHHmm.format(new Date(fcsjT));
600 } 605 }
601 606
602 /** 607 /**
@@ -607,7 +612,8 @@ public class ScheduleRealInfo { @@ -607,7 +612,8 @@ public class ScheduleRealInfo {
607 */ 612 */
608 public void setFcsjActualAll(String fcsjActual){ 613 public void setFcsjActualAll(String fcsjActual){
609 try { 614 try {
610 - this.fcsjActualTime = DateUtils.sdfyyyyMMddHHmm.parse(this.realExecDate + fcsjActual).getTime(); 615 + SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");
  616 + this.fcsjActualTime = sdfyyyyMMddHHmm.parse(this.realExecDate + fcsjActual).getTime();
611 this.fcsjActual = fcsjActual; 617 this.fcsjActual = fcsjActual;
612 618
613 calcStatus(); 619 calcStatus();
@@ -624,7 +630,8 @@ public class ScheduleRealInfo { @@ -624,7 +630,8 @@ public class ScheduleRealInfo {
624 */ 630 */
625 public void setFcsjActualAll(Long t){ 631 public void setFcsjActualAll(Long t){
626 this.fcsjActualTime = t; 632 this.fcsjActualTime = t;
627 - this.fcsjActual = DateUtils.sdfHHmm.format(new Date(t)); 633 + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm");
  634 + this.fcsjActual = sdfHHmm.format(new Date(t));
628 635
629 //更新班次状态 636 //更新班次状态
630 calcStatus(); 637 calcStatus();
@@ -638,7 +645,8 @@ public class ScheduleRealInfo { @@ -638,7 +645,8 @@ public class ScheduleRealInfo {
638 */ 645 */
639 public void setZdsjActualAll(Long t){ 646 public void setZdsjActualAll(Long t){
640 this.zdsjActualTime = t; 647 this.zdsjActualTime = t;
641 - this.zdsjActual = DateUtils.sdfHHmm.format(new Date(t)); 648 + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm");
  649 + this.zdsjActual = sdfHHmm.format(new Date(t));
642 650
643 //更新班次状态 651 //更新班次状态
644 calcStatus(); 652 calcStatus();
@@ -653,7 +661,8 @@ public class ScheduleRealInfo { @@ -653,7 +661,8 @@ public class ScheduleRealInfo {
653 */ 661 */
654 public void setZdsjActualAll(String zdsjActual){ 662 public void setZdsjActualAll(String zdsjActual){
655 try { 663 try {
656 - this.zdsjActualTime = DateUtils.sdfyyyyMMddHHmm.parse(this.realExecDate + zdsjActual).getTime(); 664 + SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");
  665 + this.zdsjActualTime = sdfyyyyMMddHHmm.parse(this.realExecDate + zdsjActual).getTime();
657 this.zdsjActual = zdsjActual; 666 this.zdsjActual = zdsjActual;
658 667
659 calcStatus(); 668 calcStatus();
src/main/java/com/bsth/repository/StationRouteRepository.java
@@ -6,6 +6,7 @@ import java.util.Map; @@ -6,6 +6,7 @@ import java.util.Map;
6 import com.bsth.entity.schedule.CarConfigInfo; 6 import com.bsth.entity.schedule.CarConfigInfo;
7 import org.springframework.data.domain.Page; 7 import org.springframework.data.domain.Page;
8 import org.springframework.data.domain.Pageable; 8 import org.springframework.data.domain.Pageable;
  9 +import org.springframework.data.domain.Sort;
9 import org.springframework.data.jpa.domain.Specification; 10 import org.springframework.data.jpa.domain.Specification;
10 import org.springframework.data.jpa.repository.EntityGraph; 11 import org.springframework.data.jpa.repository.EntityGraph;
11 import org.springframework.data.jpa.repository.Modifying; 12 import org.springframework.data.jpa.repository.Modifying;
@@ -229,8 +230,24 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int @@ -229,8 +230,24 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
229 230
230 @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH) 231 @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH)
231 @Query("select s from StationRoute s where s.destroy=0") 232 @Query("select s from StationRoute s where s.destroy=0")
232 - List<StationRoute> findAll2(); 233 + List<StationRoute> findAllEffective();
233 234
234 - @Query("select new map(sr.station.id as stationid, sr.stationName as stationname) from StationRoute sr where sr.line.id=?1 and sr.directions=?2") 235 + @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH)
  236 + @Override
  237 + Page<StationRoute> findAll(Specification<StationRoute> spec, Pageable pageable);
  238 +
  239 + @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH)
  240 + @Override
  241 + List<StationRoute> findAll(Specification<StationRoute> spec);
  242 +
  243 + @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH)
  244 + @Override
  245 + List<StationRoute> findAll(Specification<StationRoute> spec, Sort sort);
  246 +
  247 +
  248 + @Query("select new map(sr.station.id as stationid, sr.stationName as stationname) from StationRoute sr where sr.line.id=?1 and sr.directions=?2")
235 List<Map<String, Object>> findStations(Integer xlid, Integer xldir); 249 List<Map<String, Object>> findStations(Integer xlid, Integer xldir);
  250 +
  251 + @Query("select r from StationRoute r where r.lineCode=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode")
  252 + List<StationRoute> findByLine(String lineCode, int updown);
236 } 253 }
src/main/java/com/bsth/repository/forecast/SampleRepository.java
@@ -15,5 +15,5 @@ public interface SampleRepository extends BaseRepository&lt;Sample, Long&gt;{ @@ -15,5 +15,5 @@ public interface SampleRepository extends BaseRepository&lt;Sample, Long&gt;{
15 @Transactional 15 @Transactional
16 @Modifying 16 @Modifying
17 @Query("delete Sample where lineCode=?1 and updown=?2") 17 @Query("delete Sample where lineCode=?1 and updown=?2")
18 - void deleteByLineAndUpdown(Integer lineCode, int updown); 18 + void deleteByLineAndUpdown(String lineCode, int updown);
19 } 19 }
src/main/java/com/bsth/security/WebSecurityConfig.java
@@ -13,12 +13,10 @@ import org.springframework.security.core.session.SessionRegistry; @@ -13,12 +13,10 @@ import org.springframework.security.core.session.SessionRegistry;
13 import org.springframework.security.core.session.SessionRegistryImpl; 13 import org.springframework.security.core.session.SessionRegistryImpl;
14 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 14 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
15 import org.springframework.security.web.access.intercept.FilterSecurityInterceptor; 15 import org.springframework.security.web.access.intercept.FilterSecurityInterceptor;
16 -import org.springframework.security.web.authentication.logout.LogoutHandler;  
17 import org.springframework.security.web.session.HttpSessionEventPublisher; 16 import org.springframework.security.web.session.HttpSessionEventPublisher;
18 17
19 import com.bsth.common.Constants; 18 import com.bsth.common.Constants;
20 import com.bsth.security.filter.LoginInterceptor; 19 import com.bsth.security.filter.LoginInterceptor;
21 -import com.bsth.security.handler.CustomLogoutHandler;  
22 20
23 @Configuration 21 @Configuration
24 @EnableWebSecurity 22 @EnableWebSecurity
@@ -59,7 +57,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @@ -59,7 +57,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
59 //.failureUrl(Constants.LOGIN_PAGE + "?error=true")登录失败跳转的链接 57 //.failureUrl(Constants.LOGIN_PAGE + "?error=true")登录失败跳转的链接
60 //.successHandler(loginSuccessHandler())登录成功后处理 58 //.successHandler(loginSuccessHandler())登录成功后处理
61 .and().logout() 59 .and().logout()
62 - .addLogoutHandler(logoutHandler()) 60 + //.addLogoutHandler(logoutHandler())
63 //禁用CXRF 61 //禁用CXRF
64 .and().csrf().disable() 62 .and().csrf().disable()
65 //禁用匿名用户功能 63 //禁用匿名用户功能
@@ -92,10 +90,10 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @@ -92,10 +90,10 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
92 return new LoginSuccessHandler(); 90 return new LoginSuccessHandler();
93 }*/ 91 }*/
94 92
95 - @Bean 93 +/* @Bean
96 public LogoutHandler logoutHandler(){ 94 public LogoutHandler logoutHandler(){
97 return new CustomLogoutHandler(); 95 return new CustomLogoutHandler();
98 - } 96 + }*/
99 97
100 @Bean 98 @Bean
101 public SessionRegistry sessionRegistry() { 99 public SessionRegistry sessionRegistry() {
src/main/java/com/bsth/security/handler/CustomLogoutHandler.java
1 -package com.bsth.security.handler;  
2 -  
3 -import javax.servlet.http.HttpServletRequest;  
4 -import javax.servlet.http.HttpServletResponse;  
5 -  
6 -import org.springframework.security.core.Authentication;  
7 -import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;  
8 -  
9 -import com.bsth.entity.sys.SysUser;  
10 -  
11 -public class CustomLogoutHandler extends SecurityContextLogoutHandler{  
12 -  
13 - @Override  
14 - public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {  
15 - SysUser user = (SysUser) authentication.getPrincipal();  
16 - System.out.println(user.getName() + "注销...");  
17 - //日志记录  
18 -  
19 - super.logout(request, response, authentication);  
20 - }  
21 -} 1 +//package com.bsth.security.handler;
  2 +//
  3 +//import javax.servlet.http.HttpServletRequest;
  4 +//import javax.servlet.http.HttpServletResponse;
  5 +//
  6 +//import org.springframework.security.core.Authentication;
  7 +//import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
  8 +//
  9 +//import com.bsth.entity.sys.SysUser;
  10 +//
  11 +//public class CustomLogoutHandler extends SecurityContextLogoutHandler{
  12 +//
  13 +// @Override
  14 +// public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
  15 +// SysUser user = (SysUser) authentication.getPrincipal();
  16 +// System.out.println(user.getName() + "注销...");
  17 +// //日志记录
  18 +//
  19 +// super.logout(request, response, authentication);
  20 +// }
  21 +//}
src/main/java/com/bsth/service/directive/DirectiveService.java
@@ -53,7 +53,7 @@ public interface DirectiveService extends BaseService&lt;D60, Integer&gt;{ @@ -53,7 +53,7 @@ public interface DirectiveService extends BaseService&lt;D60, Integer&gt;{
53 * @param @param lineId 新线路编码 53 * @param @param lineId 新线路编码
54 * @throws 54 * @throws
55 */ 55 */
56 - int lineChange(String nbbm, Integer lineId, String sender); 56 + int lineChange(String nbbm, String lineId, String sender);
57 57
58 /** 58 /**
59 * 59 *
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
@@ -38,7 +38,6 @@ import com.bsth.repository.directive.D64Repository; @@ -38,7 +38,6 @@ import com.bsth.repository.directive.D64Repository;
38 import com.bsth.repository.directive.D80Repository; 38 import com.bsth.repository.directive.D80Repository;
39 import com.bsth.security.util.SecurityUtils; 39 import com.bsth.security.util.SecurityUtils;
40 import com.bsth.service.impl.BaseServiceImpl; 40 import com.bsth.service.impl.BaseServiceImpl;
41 -import com.bsth.util.DateUtils;  
42 import com.bsth.websocket.handler.RealControlSocketHandler; 41 import com.bsth.websocket.handler.RealControlSocketHandler;
43 import com.fasterxml.jackson.core.JsonProcessingException; 42 import com.fasterxml.jackson.core.JsonProcessingException;
44 import com.fasterxml.jackson.databind.ObjectMapper; 43 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -119,7 +118,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -119,7 +118,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
119 118
120 //下发0x02指令 调度指令(闹钟有效) 119 //下发0x02指令 调度指令(闹钟有效)
121 Long alarmTime = System.currentTimeMillis() + 1000 * 30; 120 Long alarmTime = System.currentTimeMillis() + 1000 * 30;
122 - d60 = DirectiveCreator.createD60_02(sch.getClZbh(), text, Integer.parseInt(sch.getXlDir()) 121 + d60 = new DirectiveCreator().createD60_02(sch.getClZbh(), text, Integer.parseInt(sch.getXlDir())
123 , 0, new Date(alarmTime)); 122 , 0, new Date(alarmTime));
124 } catch (Exception e) { 123 } catch (Exception e) {
125 logger.error("生成调度指令时出现异常", e); 124 logger.error("生成调度指令时出现异常", e);
@@ -193,7 +192,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -193,7 +192,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
193 logger.info("切换运营状态, nbbm: " + nbbm + " ,state: " + state + " ,upDown:" + upDown); 192 logger.info("切换运营状态, nbbm: " + nbbm + " ,state: " + state + " ,upDown:" + upDown);
194 193
195 String text = "切换为 " + (upDown == 0 ? "上行" : "下行") + (state == 0 ? "营运" : "未营运"); 194 String text = "切换为 " + (upDown == 0 ? "上行" : "下行") + (state == 0 ? "营运" : "未营运");
196 - D60 d60 = DirectiveCreator.createD60(nbbm, text, (short) 0x03, upDown, state); 195 + D60 d60 = new DirectiveCreator().createD60(nbbm, text, (short) 0x03, upDown, state);
197 196
198 if (null == d60) 197 if (null == d60)
199 return -1; 198 return -1;
@@ -220,10 +219,12 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -220,10 +219,12 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
220 * 线路切换 219 * 线路切换
221 */ 220 */
222 @Override 221 @Override
223 - public int lineChange(String nbbm, Integer lineCode, String sender) { 222 + public int lineChange(String nbbm, String lineCode, String sender) {
  223 + DirectiveCreator crt = new DirectiveCreator();
  224 +
224 Long t = System.currentTimeMillis(); 225 Long t = System.currentTimeMillis();
225 //生成64数据包 226 //生成64数据包
226 - D64 d64 = DirectiveCreator.createD64(nbbm, lineCode, t); 227 + D64 d64 = crt.createD64(nbbm, lineCode, t);
227 228
228 if(null != sender) 229 if(null != sender)
229 d64.setSender(sender); 230 d64.setSender(sender);
@@ -238,7 +239,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -238,7 +239,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
238 239
239 // 通知设备刷新线路文件,忽略结果 240 // 通知设备刷新线路文件,忽略结果
240 if (code == 0) 241 if (code == 0)
241 - GatewayHttpUtils.postJson(DirectiveCreator.createDeviceRefreshData(deviceId, lineCode)); 242 + GatewayHttpUtils.postJson(crt.createDeviceRefreshData(deviceId, lineCode));
242 else 243 else
243 d64.setErrorText("[刷新线路文件] 网关通讯失败, code: " + code); 244 d64.setErrorText("[刷新线路文件] 网关通讯失败, code: " + code);
244 245
@@ -278,7 +279,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -278,7 +279,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
278 state = 0; 279 state = 0;
279 } 280 }
280 281
281 - return DirectiveCreator.createD60(nbbm, text, dispatchInstruct, upDown, state); 282 + return new DirectiveCreator().createD60(nbbm, text, dispatchInstruct, upDown, state);
282 } 283 }
283 284
284 @Override 285 @Override
@@ -397,10 +398,11 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -397,10 +398,11 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
397 398
398 List<Directive> rs = list.subList(s, e); 399 List<Directive> rs = list.subList(s, e);
399 400
  401 + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm");
400 // 时间格式化,车辆自编号转换 402 // 时间格式化,车辆自编号转换
401 for (Directive d : rs) { 403 for (Directive d : rs) {
402 if (d.getTimeHHmm() == null) 404 if (d.getTimeHHmm() == null)
403 - d.setTimeHHmm(DateUtils.sdfHHmm.format(new Date(d.getTimestamp()))); 405 + d.setTimeHHmm(sdfHHmm.format(new Date(d.getTimestamp())));
404 if (d.getNbbm() == null) 406 if (d.getNbbm() == null)
405 d.setNbbm(BasicData.deviceId2NbbmMap.get(d.getDeviceId())); 407 d.setNbbm(BasicData.deviceId2NbbmMap.get(d.getDeviceId()));
406 } 408 }
@@ -449,9 +451,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -449,9 +451,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
449 if (e > count) 451 if (e > count)
450 e = count; 452 e = count;
451 453
  454 + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm");
452 List<D80> rs = d80s.subList(s, e); 455 List<D80> rs = d80s.subList(s, e);
453 for(D80 d80 : rs){ 456 for(D80 d80 : rs){
454 - d80.setTimeStr(DateUtils.sdfHHmm.format(new Date(d80.getTimestamp()))); 457 + d80.setTimeStr(sdfHHmm.format(new Date(d80.getTimestamp())));
455 } 458 }
456 459
457 Map<String, Object> rsMap = new HashMap<>(); 460 Map<String, Object> rsMap = new HashMap<>();
src/main/java/com/bsth/service/forecast/SampleService.java
1 package com.bsth.service.forecast; 1 package com.bsth.service.forecast;
2 2
  3 +import java.util.Map;
  4 +
  5 +import com.bsth.controller.forecast.dto.CreateSampleParam;
3 import com.bsth.entity.forecast.Sample; 6 import com.bsth.entity.forecast.Sample;
4 import com.bsth.service.BaseService; 7 import com.bsth.service.BaseService;
5 8
6 public interface SampleService extends BaseService<Sample, Long>{ 9 public interface SampleService extends BaseService<Sample, Long>{
7 10
8 - int createDataByGps(String lineCode, Integer updown); 11 + Map<String, Object> createDataByGps(CreateSampleParam param);
9 12
10 } 13 }
src/main/java/com/bsth/service/forecast/SampleServiceImpl.java
1 package com.bsth.service.forecast; 1 package com.bsth.service.forecast;
2 2
  3 +import java.text.SimpleDateFormat;
  4 +import java.util.ArrayList;
  5 +import java.util.Collections;
  6 +import java.util.Comparator;
  7 +import java.util.HashMap;
3 import java.util.Iterator; 8 import java.util.Iterator;
  9 +import java.util.List;
4 import java.util.Map; 10 import java.util.Map;
5 11
6 import javax.transaction.Transactional; 12 import javax.transaction.Transactional;
7 13
  14 +import org.slf4j.Logger;
  15 +import org.slf4j.LoggerFactory;
8 import org.springframework.beans.factory.annotation.Autowired; 16 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.stereotype.Service; 17 import org.springframework.stereotype.Service;
10 18
  19 +import com.bsth.common.ResponseCode;
  20 +import com.bsth.controller.forecast.dto.CreateSampleParam;
11 import com.bsth.data.BasicData; 21 import com.bsth.data.BasicData;
  22 +import com.bsth.data.arrival.ArrivalEntity;
  23 +import com.bsth.data.arrival.DataLoader;
12 import com.bsth.entity.forecast.Sample; 24 import com.bsth.entity.forecast.Sample;
13 import com.bsth.repository.forecast.SampleRepository; 25 import com.bsth.repository.forecast.SampleRepository;
  26 +import com.bsth.service.forecast.util.CreateByArrivalData;
14 import com.bsth.service.impl.BaseServiceImpl; 27 import com.bsth.service.impl.BaseServiceImpl;
15 28
16 @Service 29 @Service
@@ -19,10 +32,16 @@ public class SampleServiceImpl extends BaseServiceImpl&lt;Sample, Long&gt; implements @@ -19,10 +32,16 @@ public class SampleServiceImpl extends BaseServiceImpl&lt;Sample, Long&gt; implements
19 @Autowired 32 @Autowired
20 SampleRepository sampleRepository; 33 SampleRepository sampleRepository;
21 34
  35 + @Autowired
  36 + CreateByArrivalData createByArrivalData;
  37 +
  38 + Logger logger = LoggerFactory.getLogger(this.getClass());
  39 +
22 @Override 40 @Override
23 public Iterable<Sample> list(Map<String, Object> map) { 41 public Iterable<Sample> list(Map<String, Object> map) {
24 Iterable<Sample> rs = super.list(map); 42 Iterable<Sample> rs = super.list(map);
25 43
  44 + List<Sample> rsList = new ArrayList<>();
26 //转换站点名称 45 //转换站点名称
27 Iterator<Sample> iterator = rs.iterator(); 46 Iterator<Sample> iterator = rs.iterator();
28 Sample s; 47 Sample s;
@@ -30,16 +49,63 @@ public class SampleServiceImpl extends BaseServiceImpl&lt;Sample, Long&gt; implements @@ -30,16 +49,63 @@ public class SampleServiceImpl extends BaseServiceImpl&lt;Sample, Long&gt; implements
30 s = iterator.next(); 49 s = iterator.next();
31 s.setsName(BasicData.stationCode2NameMap.get(s.getsStation())); 50 s.setsName(BasicData.stationCode2NameMap.get(s.getsStation()));
32 s.seteName(BasicData.stationCode2NameMap.get(s.geteStation())); 51 s.seteName(BasicData.stationCode2NameMap.get(s.geteStation()));
  52 +
  53 + rsList.add(s);
33 } 54 }
34 - return rs; 55 +
  56 + //排序
  57 + Collections.sort(rsList, new Comparator<Sample>() {
  58 + @Override
  59 + public int compare(Sample arg0, Sample arg1) {
  60 + return arg0.geteDate().compareTo(arg1.geteDate());
  61 + }
  62 + });
  63 +
  64 + return rsList;
  65 + }
  66 +
  67 + @Override
  68 + public Map<String, Object> save(Sample t) {
  69 + if(null == t.getId())
  70 + t.setTag(t.getTag() + t.getsDate() + " - " + t.geteDate());
  71 + return super.save(t);
35 } 72 }
36 73
37 @Transactional 74 @Transactional
38 @Override 75 @Override
39 - public int createDataByGps(String lineCode, Integer updown) {  
40 - //删除原有数据  
41 - sampleRepository.deleteByLineAndUpdown(Integer.parseInt(lineCode), updown); 76 + public Map<String, Object> createDataByGps(CreateSampleParam param) {
  77 + Map<String, Object> rs = new HashMap<>();
  78 + try{
  79 + //删除原有数据
  80 + sampleRepository.deleteByLineAndUpdown(param.getLineCode(), param.getUpdown());
  81 +
  82 + //查询到离站数据
  83 + DataLoader loader = new DataLoader();
  84 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  85 +
  86 + long st = sdf.parse(param.getStartDate()).getTime()
  87 + ,et = sdf.parse(param.getEndDate()).getTime()
  88 + ,i = st
  89 + ,range = 1000 * 60 * 60 * 24;
  90 +
  91 + logger.info("初始值:" + 1500 * (int)((et - st) / range));
  92 + List<ArrivalEntity> all = new ArrayList<>(1500 * (int)((et - st) / range));
  93 + for(; i < et; i += range)
  94 + all.addAll(loader.loadByLineAndTime(param.getLineCode(), param.getUpdown() , i, i + range));
  95 +
  96 + logger.info("实际数据量:" + all.size());
  97 +
  98 + List<Sample> resList = createByArrivalData.create(all, param);
  99 +
  100 + //入库
  101 + sampleRepository.save(resList);
  102 +
  103 + rs.put("status", ResponseCode.SUCCESS);
  104 + }catch(Exception e){
  105 + logger.error("" , e);
  106 + rs.put("status", ResponseCode.ERROR);
  107 + }
42 108
43 - return 0; 109 + return rs;
44 } 110 }
45 } 111 }
src/main/java/com/bsth/service/forecast/util/CreateByArrivalData.java 0 → 100644
  1 +package com.bsth.service.forecast.util;
  2 +
  3 +import java.text.DecimalFormat;
  4 +import java.text.ParseException;
  5 +import java.text.SimpleDateFormat;
  6 +import java.util.ArrayList;
  7 +import java.util.Collections;
  8 +import java.util.Comparator;
  9 +import java.util.Date;
  10 +import java.util.HashMap;
  11 +import java.util.List;
  12 +import java.util.Map;
  13 +import java.util.Set;
  14 +
  15 +import org.slf4j.Logger;
  16 +import org.slf4j.LoggerFactory;
  17 +import org.springframework.beans.factory.annotation.Autowired;
  18 +import org.springframework.context.annotation.Scope;
  19 +import org.springframework.stereotype.Component;
  20 +
  21 +import com.bsth.controller.forecast.dto.CreateSampleParam;
  22 +import com.bsth.controller.forecast.dto.CreateSampleParam.TimeRange;
  23 +import com.bsth.data.arrival.ArrivalComparator;
  24 +import com.bsth.data.arrival.ArrivalEntity;
  25 +import com.bsth.entity.StationRoute;
  26 +import com.bsth.entity.forecast.Sample;
  27 +import com.bsth.repository.StationRouteRepository;
  28 +import com.google.common.collect.ArrayListMultimap;
  29 +
  30 +/**
  31 + *
  32 + * @ClassName: CreateByArrivalData
  33 + * @Description: TODO(根据到离站数据生成线路站点间耗时)
  34 + * @author PanZhao
  35 + * @date 2016年9月17日 下午2:33:20
  36 + *
  37 + */
  38 +@Component
  39 +@Scope("prototype")
  40 +public class CreateByArrivalData {
  41 +
  42 + @Autowired
  43 + StationRouteRepository routeRepository;
  44 +
  45 + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd")
  46 + ,sdfHHmm = new SimpleDateFormat("HH:mm")
  47 + ,sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm");
  48 +
  49 + String rq = sdfyyyyMMdd.format(new Date());
  50 +
  51 + Logger logger = LoggerFactory.getLogger(this.getClass());
  52 +
  53 + /**
  54 + *
  55 + * @Title: create
  56 + * @Description: TODO(到离站数据 生成站点耗时)
  57 + * @throws
  58 + */
  59 + public List<Sample> create(List<ArrivalEntity> all, CreateSampleParam param) {
  60 + List<Sample> rs = new ArrayList<>();
  61 + try{
  62 + //路由
  63 + List<StationRoute> routes = routeRepository.findByLine(param.getLineCode(), param.getUpdown());
  64 + //按顺序索引路由
  65 + Map<String, Integer> rMap = new HashMap<>();
  66 + for(int i = 0; i < routes.size(); i ++){
  67 + //起点站不要
  68 + if(routes.get(i).getStationMark().equals("B"))
  69 + continue;
  70 + rMap.put(routes.get(i).getStationCode(), i);
  71 + }
  72 +
  73 + Collections.sort(all, new ArrivalComparator());
  74 +
  75 + //所有的站点耗时数据
  76 + List<Sample> sampleList = calcTimeArray(rMap, all);
  77 + //时区分组,取值
  78 + Set<TimeRange> rgs = param.getTimeRange();
  79 +
  80 + //生成数据
  81 + for(TimeRange rg : rgs)
  82 + rs.addAll(calcCenterVal(sampleList, rg, param.getUpdown()));
  83 + }catch(Exception e){
  84 + logger.error("", e);
  85 + }
  86 +
  87 + return rs;
  88 + }
  89 +
  90 + private List<Sample> calcTimeArray(Map<String, Integer> rMap, List<ArrivalEntity> arrs) throws ParseException {
  91 +
  92 + //车辆和所在站点对照
  93 + Map<String, ArrivalEntity> carMap = new HashMap<>();
  94 +
  95 + int size = arrs.size();
  96 + ArrivalEntity curr, old;
  97 + String device;
  98 +
  99 + List<Sample> sampleList = new ArrayList<>();
  100 + Sample sample;
  101 + for(int i = 0; i < size; i ++){
  102 + curr = arrs.get(i);
  103 + device = curr.getDeviceId();
  104 + old = carMap.get(device);
  105 +
  106 + carMap.put(device, curr);
  107 +
  108 + if(null == old || null == rMap.get(curr.getStopNo())
  109 + || null == rMap.get(old.getStopNo())
  110 + //跨天的数据不要
  111 + || !sdfyyyyMMdd.format(new Date(old.getTs())).equals(sdfyyyyMMdd.format(new Date(curr.getTs()))))
  112 + continue;
  113 +
  114 + //连续站点
  115 + if(rMap.get(curr.getStopNo())
  116 + - rMap.get(old.getStopNo()) == 1){
  117 +
  118 + sample = new Sample(old, curr);
  119 + //将日期全部拉到同一天
  120 + sample.setLineCode(old.getLineCode());
  121 + sample.setsTime(sdfyyyyMMddHHmm.parse(rq + sdfHHmm.format(sample.getsTime())).getTime());
  122 + sample.seteTime(sdfyyyyMMddHHmm.parse(rq + sdfHHmm.format(sample.geteTime())).getTime());
  123 + //sample.setsDate(sdfHHmm.format(new Date(sample.getsTime())));
  124 + //sample.seteDate(sdfHHmm.format(new Date(sample.geteTime())));
  125 + sampleList.add(sample);
  126 +
  127 + }
  128 + carMap.put(device, curr);
  129 + }
  130 + return sampleList;
  131 + }
  132 +
  133 +
  134 + private List<Sample> calcCenterVal(List<Sample> all, TimeRange rg, Integer updown){
  135 + List<Sample> subList = new ArrayList<>()
  136 + ,rsList = new ArrayList<>();
  137 +
  138 + try{
  139 + Collections.sort(all, new SampleComp2());
  140 + //按时区分组数据
  141 + long st = sdfyyyyMMddHHmm.parse(rq + rg.getS()).getTime()
  142 + ,et = sdfyyyyMMddHHmm.parse(rq + rg.getE()).getTime();
  143 + for(Sample s : all){
  144 + if(s.geteTime() > st && s.geteTime() < et)
  145 + subList.add(s);
  146 + else if(s.geteTime() > et)
  147 + break;
  148 + }
  149 +
  150 + //按站点分组数据
  151 + ArrayListMultimap<String, Sample> arrMap = ArrayListMultimap.create();
  152 + for(Sample s : subList)
  153 + arrMap.put(s.getsStation() + "_" + s.geteStation(), s);
  154 +
  155 + //每个站点间取出一个占比最大的数值
  156 + Set<String> keys = arrMap.keySet();
  157 + Sample sample;
  158 + for(String k : keys){
  159 + sample = maxRatioVal(arrMap.get(k));
  160 +
  161 + sample.setTag(rg.getTag() + rg.getS() + " - " + rg.getE());
  162 + sample.setsDate(rg.getS());
  163 + sample.seteDate(rg.getE());
  164 + sample.setUpdown(updown);
  165 + rsList.add(sample);
  166 + }
  167 +
  168 + }catch(Exception e){
  169 + logger.error("", e);
  170 + }
  171 + return rsList;
  172 + }
  173 +
  174 + /**
  175 + *
  176 + * @Title: maxRatioVal
  177 + * @Description: TODO(从一组数值中取出占比最大的值)
  178 + */
  179 + public Sample maxRatioVal(List<Sample> list){
  180 + //StringBuilder valStr = new StringBuilder();
  181 + if(list.size() == 0)
  182 + return null;
  183 + //排序
  184 + Collections.sort(list, new SampleComp());
  185 +
  186 + ArrayListMultimap<String, Sample> arrMap = ArrayListMultimap.create();
  187 + //1.5分钟范围分组
  188 + int range = 15
  189 + ,curr = (int)(list.get(0).getRunTime() * 10);
  190 +
  191 + for(Sample s : list){
  192 + if(s.getRunTime() * 10 > curr + range){
  193 + curr += range;
  194 + }
  195 + arrMap.put(curr + "_" + curr + range, s);
  196 + //valStr.append(s.getRunTime() + ",");
  197 + }
  198 +
  199 + //数值最多的分组,求个平均值
  200 + String maxKey = maxKey(arrMap);
  201 + float absVal = abs(arrMap.get(maxKey));
  202 +
  203 + Sample rs = list.get(0);
  204 +
  205 + DecimalFormat dformat=new DecimalFormat(".00");
  206 + rs.setRunTime(Float.parseFloat(dformat.format(absVal)));
  207 +
  208 + //logger.info("全部:[ " + valStr + "] ,计算的中间值:" + absVal);
  209 + return rs;
  210 + }
  211 +
  212 + private String maxKey(ArrayListMultimap<String, Sample> arrMap){
  213 + String maxKey = null;
  214 + int size = 0;
  215 + Set<String> kys = arrMap.keySet();
  216 + for(String k : kys){
  217 + if(null != maxKey && arrMap.get(k).size() < size)
  218 + continue;
  219 +
  220 + size = arrMap.get(k).size();
  221 + maxKey = k;
  222 + }
  223 + return maxKey;
  224 + }
  225 +
  226 + private float abs(List<Sample> list){
  227 + float sum = 0;
  228 +
  229 + for(Sample s : list)
  230 + sum += s.getRunTime();
  231 +
  232 + return sum / list.size();
  233 + }
  234 +
  235 + public static class SampleComp implements Comparator<Sample>{
  236 +
  237 + @Override
  238 + public int compare(Sample arg0, Sample arg1) {
  239 + return (int)(arg0.getRunTime() * 10 - arg1.getRunTime() * 10);
  240 + }
  241 + }
  242 +
  243 + public static class SampleComp2 implements Comparator<Sample>{
  244 +
  245 + @Override
  246 + public int compare(Sample arg0, Sample arg1) {
  247 + return (int)(arg0.geteTime() - arg1.geteTime());
  248 + }
  249 + }
  250 +}
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
@@ -80,7 +80,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -80,7 +80,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
80 80
81 Map<String, Object> outgoAdjustAll(String params); 81 Map<String, Object> outgoAdjustAll(String params);
82 82
83 - Map<String, Object> findRouteByLine(Integer lineCode); 83 + Map<String, Object> findRouteByLine(String lineCode);
84 84
85 List<Map<String,String>> findLine(String line); 85 List<Map<String,String>> findLine(String line);
86 86
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -310,8 +310,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -310,8 +310,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
310 SysUser user = SecurityUtils.getCurrentUser(); 310 SysUser user = SecurityUtils.getCurrentUser();
311 String schDate = DayOfSchedule.currSchDateMap.get(t.getXlBm()); 311 String schDate = DayOfSchedule.currSchDateMap.get(t.getXlBm());
312 312
  313 + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");
313 t.setScheduleDateStr(schDate); 314 t.setScheduleDateStr(schDate);
314 - t.setScheduleDate(DateUtils.sdfyyyyMMdd.parse(schDate)); 315 + t.setScheduleDate(sdfyyyyMMdd.parse(schDate));
315 t.setRealExecDate(schDate); 316 t.setRealExecDate(schDate);
316 t.setCreateBy(user); 317 t.setCreateBy(user);
317 t.setSflj(true); 318 t.setSflj(true);
@@ -899,7 +900,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -899,7 +900,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
899 } 900 }
900 901
901 @Override 902 @Override
902 - public Map<String, Object> findRouteByLine(Integer lineCode) { 903 + public Map<String, Object> findRouteByLine(String lineCode) {
903 Map<String, Object> map = new HashMap<>(); 904 Map<String, Object> map = new HashMap<>();
904 //上行 905 //上行
905 Integer lineId = BasicData.lineId2CodeMap.inverse().get(lineCode); 906 Integer lineId = BasicData.lineId2CodeMap.inverse().get(lineCode);
src/main/java/com/bsth/util/DateUtils.java
@@ -96,7 +96,7 @@ public class DateUtils { @@ -96,7 +96,7 @@ public class DateUtils {
96 return (int) (cal.getTimeInMillis() / 1000); 96 return (int) (cal.getTimeInMillis() / 1000);
97 } 97 }
98 98
99 - public static SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm") 99 + private static SimpleDateFormat sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm")
100 ,sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd") 100 ,sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd")
101 ,sdfHHmm = new SimpleDateFormat("HH:mm"); 101 ,sdfHHmm = new SimpleDateFormat("HH:mm");
102 public static long getTimesByHHmm(String str) throws ParseException{ 102 public static long getTimesByHHmm(String str) throws ParseException{
src/main/resources/application-dev.properties
@@ -26,6 +26,6 @@ spring.datasource.validation-query=select 1 @@ -26,6 +26,6 @@ spring.datasource.validation-query=select 1
26 ## 26 ##
27 #222.66.0.204:5555 27 #222.66.0.204:5555
28 ##\u5B9E\u65F6gps 28 ##\u5B9E\u65F6gps
29 -http.gps.real.url= http://192.168.168.192:8080/transport_server/rtgps/ 29 +http.gps.real.url= http://27.115.69.123:8800/transport_server/rtgps/
30 ##\u6D88\u606F\u4E0B\u53D1 30 ##\u6D88\u606F\u4E0B\u53D1
31 -http.send.directive = http://192.168.168.192:8080/transport_server/message/  
32 \ No newline at end of file 31 \ No newline at end of file
  32 +http.send.directive = http://192.168.168.201:9090/transport_server/message/
33 \ No newline at end of file 33 \ No newline at end of file
src/main/resources/ms-jdbc.properties
1 ms.mysql.driver= com.mysql.jdbc.Driver 1 ms.mysql.driver= com.mysql.jdbc.Driver
2 -ms.mysql.url= jdbc:mysql://192.168.40.82:3306/ms?useUnicode=true&characterEncoding=utf-8  
3 -ms.mysql.username= root  
4 -ms.mysql.password= 123456  
5 -  
6 -#ms.mysql.url= jdbc:mysql://127.0.0.1:3306/ms?useUnicode=true&characterEncoding=utf-8 2 +#ms.mysql.url= jdbc:mysql://192.168.40.82:3306/ms?useUnicode=true&characterEncoding=utf-8
7 #ms.mysql.username= root 3 #ms.mysql.username= root
8 -#ms.mysql.password= panzhao 4 +#ms.mysql.password= 123456
  5 +
  6 +ms.mysql.url= jdbc:mysql://127.0.0.1:3306/ms?useUnicode=true&characterEncoding=utf-8
  7 +ms.mysql.username= root
  8 +ms.mysql.password= panzhao
src/main/resources/static/assets/plugins/jquery.base64.min.js deleted 100644 → 0
1 -"use strict";jQuery.base64=(function($){var _PADCHAR="=",_ALPHA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_VERSION="1.0";function _getbyte64(s,i){var idx=_ALPHA.indexOf(s.charAt(i));if(idx===-1){throw"Cannot decode base64"}return idx}function _decode(s){var pads=0,i,b10,imax=s.length,x=[];s=String(s);if(imax===0){return s}if(imax%4!==0){throw"Cannot decode base64"}if(s.charAt(imax-1)===_PADCHAR){pads=1;if(s.charAt(imax-2)===_PADCHAR){pads=2}imax-=4}for(i=0;i<imax;i+=4){b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12)|(_getbyte64(s,i+2)<<6)|_getbyte64(s,i+3);x.push(String.fromCharCode(b10>>16,(b10>>8)&255,b10&255))}switch(pads){case 1:b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12)|(_getbyte64(s,i+2)<<6);x.push(String.fromCharCode(b10>>16,(b10>>8)&255));break;case 2:b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12);x.push(String.fromCharCode(b10>>16));break}return x.join("")}function _getbyte(s,i){var x=s.charCodeAt(i);if(x>255){throw"INVALID_CHARACTER_ERR: DOM Exception 5"}return x}function _encode(s){if(arguments.length!==1){throw"SyntaxError: exactly one argument required"}s=String(s);var i,b10,x=[],imax=s.length-s.length%3;if(s.length===0){return s}for(i=0;i<imax;i+=3){b10=(_getbyte(s,i)<<16)|(_getbyte(s,i+1)<<8)|_getbyte(s,i+2);x.push(_ALPHA.charAt(b10>>18));x.push(_ALPHA.charAt((b10>>12)&63));x.push(_ALPHA.charAt((b10>>6)&63));x.push(_ALPHA.charAt(b10&63))}switch(s.length-imax){case 1:b10=_getbyte(s,i)<<16;x.push(_ALPHA.charAt(b10>>18)+_ALPHA.charAt((b10>>12)&63)+_PADCHAR+_PADCHAR);break;case 2:b10=(_getbyte(s,i)<<16)|(_getbyte(s,i+1)<<8);x.push(_ALPHA.charAt(b10>>18)+_ALPHA.charAt((b10>>12)&63)+_ALPHA.charAt((b10>>6)&63)+_PADCHAR);break}return x.join("")}return{decode:_decode,encode:_encode,VERSION:_VERSION}}(jQuery));  
2 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/static/assets/plugins/jsencrypt.min.js 0 → 100644
  1 +/*! JSEncrypt v2.3.1 | https://npmcdn.com/jsencrypt@2.3.1/LICENSE.txt */
  2 +!function(t,e){"function"==typeof define&&define.amd?define(["exports"],e):e("object"==typeof exports&&"string"!=typeof exports.nodeName?module.exports:t)}(this,function(t){function e(t,e,i){null!=t&&("number"==typeof t?this.fromNumber(t,e,i):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function i(){return new e(null)}function r(t,e,i,r,s,n){for(;--n>=0;){var o=e*this[t++]+i[r]+s;s=Math.floor(o/67108864),i[r++]=67108863&o}return s}function s(t,e,i,r,s,n){for(var o=32767&e,h=e>>15;--n>=0;){var a=32767&this[t],u=this[t++]>>15,c=h*a+u*o;a=o*a+((32767&c)<<15)+i[r]+(1073741823&s),s=(a>>>30)+(c>>>15)+h*u+(s>>>30),i[r++]=1073741823&a}return s}function n(t,e,i,r,s,n){for(var o=16383&e,h=e>>14;--n>=0;){var a=16383&this[t],u=this[t++]>>14,c=h*a+u*o;a=o*a+((16383&c)<<14)+i[r]+s,s=(a>>28)+(c>>14)+h*u,i[r++]=268435455&a}return s}function o(t){return Be.charAt(t)}function h(t,e){var i=Ke[t.charCodeAt(e)];return null==i?-1:i}function a(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function u(t){this.t=1,this.s=0>t?-1:0,t>0?this[0]=t:-1>t?this[0]=t+this.DV:this.t=0}function c(t){var e=i();return e.fromInt(t),e}function f(t,i){var r;if(16==i)r=4;else if(8==i)r=3;else if(256==i)r=8;else if(2==i)r=1;else if(32==i)r=5;else{if(4!=i)return void this.fromRadix(t,i);r=2}this.t=0,this.s=0;for(var s=t.length,n=!1,o=0;--s>=0;){var a=8==r?255&t[s]:h(t,s);0>a?"-"==t.charAt(s)&&(n=!0):(n=!1,0==o?this[this.t++]=a:o+r>this.DB?(this[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this[this.t++]=a>>this.DB-o):this[this.t-1]|=a<<o,o+=r,o>=this.DB&&(o-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),n&&e.ZERO.subTo(this,this)}function p(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}function l(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var i,r=(1<<e)-1,s=!1,n="",h=this.t,a=this.DB-h*this.DB%e;if(h-- >0)for(a<this.DB&&(i=this[h]>>a)>0&&(s=!0,n=o(i));h>=0;)e>a?(i=(this[h]&(1<<a)-1)<<e-a,i|=this[--h]>>(a+=this.DB-e)):(i=this[h]>>(a-=e)&r,0>=a&&(a+=this.DB,--h)),i>0&&(s=!0),s&&(n+=o(i));return s?n:"0"}function d(){var t=i();return e.ZERO.subTo(this,t),t}function g(){return this.s<0?this.negate():this}function m(t){var e=this.s-t.s;if(0!=e)return e;var i=this.t;if(e=i-t.t,0!=e)return this.s<0?-e:e;for(;--i>=0;)if(0!=(e=this[i]-t[i]))return e;return 0}function y(t){var e,i=1;return 0!=(e=t>>>16)&&(t=e,i+=16),0!=(e=t>>8)&&(t=e,i+=8),0!=(e=t>>4)&&(t=e,i+=4),0!=(e=t>>2)&&(t=e,i+=2),0!=(e=t>>1)&&(t=e,i+=1),i}function b(){return this.t<=0?0:this.DB*(this.t-1)+y(this[this.t-1]^this.s&this.DM)}function T(t,e){var i;for(i=this.t-1;i>=0;--i)e[i+t]=this[i];for(i=t-1;i>=0;--i)e[i]=0;e.t=this.t+t,e.s=this.s}function S(t,e){for(var i=t;i<this.t;++i)e[i-t]=this[i];e.t=Math.max(this.t-t,0),e.s=this.s}function R(t,e){var i,r=t%this.DB,s=this.DB-r,n=(1<<s)-1,o=Math.floor(t/this.DB),h=this.s<<r&this.DM;for(i=this.t-1;i>=0;--i)e[i+o+1]=this[i]>>s|h,h=(this[i]&n)<<r;for(i=o-1;i>=0;--i)e[i]=0;e[o]=h,e.t=this.t+o+1,e.s=this.s,e.clamp()}function E(t,e){e.s=this.s;var i=Math.floor(t/this.DB);if(i>=this.t)return void(e.t=0);var r=t%this.DB,s=this.DB-r,n=(1<<r)-1;e[0]=this[i]>>r;for(var o=i+1;o<this.t;++o)e[o-i-1]|=(this[o]&n)<<s,e[o-i]=this[o]>>r;r>0&&(e[this.t-i-1]|=(this.s&n)<<s),e.t=this.t-i,e.clamp()}function D(t,e){for(var i=0,r=0,s=Math.min(t.t,this.t);s>i;)r+=this[i]-t[i],e[i++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;i<this.t;)r+=this[i],e[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<t.t;)r-=t[i],e[i++]=r&this.DM,r>>=this.DB;r-=t.s}e.s=0>r?-1:0,-1>r?e[i++]=this.DV+r:r>0&&(e[i++]=r),e.t=i,e.clamp()}function w(t,i){var r=this.abs(),s=t.abs(),n=r.t;for(i.t=n+s.t;--n>=0;)i[n]=0;for(n=0;n<s.t;++n)i[n+r.t]=r.am(0,s[n],i,n,0,r.t);i.s=0,i.clamp(),this.s!=t.s&&e.ZERO.subTo(i,i)}function x(t){for(var e=this.abs(),i=t.t=2*e.t;--i>=0;)t[i]=0;for(i=0;i<e.t-1;++i){var r=e.am(i,e[i],t,2*i,0,1);(t[i+e.t]+=e.am(i+1,2*e[i],t,2*i+1,r,e.t-i-1))>=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(i,e[i],t,2*i,0,1)),t.s=0,t.clamp()}function B(t,r,s){var n=t.abs();if(!(n.t<=0)){var o=this.abs();if(o.t<n.t)return null!=r&&r.fromInt(0),void(null!=s&&this.copyTo(s));null==s&&(s=i());var h=i(),a=this.s,u=t.s,c=this.DB-y(n[n.t-1]);c>0?(n.lShiftTo(c,h),o.lShiftTo(c,s)):(n.copyTo(h),o.copyTo(s));var f=h.t,p=h[f-1];if(0!=p){var l=p*(1<<this.F1)+(f>1?h[f-2]>>this.F2:0),d=this.FV/l,g=(1<<this.F1)/l,m=1<<this.F2,v=s.t,b=v-f,T=null==r?i():r;for(h.dlShiftTo(b,T),s.compareTo(T)>=0&&(s[s.t++]=1,s.subTo(T,s)),e.ONE.dlShiftTo(f,T),T.subTo(h,h);h.t<f;)h[h.t++]=0;for(;--b>=0;){var S=s[--v]==p?this.DM:Math.floor(s[v]*d+(s[v-1]+m)*g);if((s[v]+=h.am(0,S,s,b,0,f))<S)for(h.dlShiftTo(b,T),s.subTo(T,s);s[v]<--S;)s.subTo(T,s)}null!=r&&(s.drShiftTo(f,r),a!=u&&e.ZERO.subTo(r,r)),s.t=f,s.clamp(),c>0&&s.rShiftTo(c,s),0>a&&e.ZERO.subTo(s,s)}}}function K(t){var r=i();return this.abs().divRemTo(t,null,r),this.s<0&&r.compareTo(e.ZERO)>0&&t.subTo(r,r),r}function A(t){this.m=t}function U(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function O(t){return t}function V(t){t.divRemTo(this.m,null,t)}function N(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function J(t,e){t.squareTo(e),this.reduce(e)}function I(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return e=e*(2-(15&t)*e)&15,e=e*(2-(255&t)*e)&255,e=e*(2-((65535&t)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function P(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function M(t){var r=i();return t.abs().dlShiftTo(this.m.t,r),r.divRemTo(this.m,null,r),t.s<0&&r.compareTo(e.ZERO)>0&&this.m.subTo(r,r),r}function L(t){var e=i();return t.copyTo(e),this.reduce(e),e}function q(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var i=32767&t[e],r=i*this.mpl+((i*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(i=e+this.m.t,t[i]+=this.m.am(0,r,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function C(t,e){t.squareTo(e),this.reduce(e)}function H(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function j(){return 0==(this.t>0?1&this[0]:this.s)}function k(t,r){if(t>4294967295||1>t)return e.ONE;var s=i(),n=i(),o=r.convert(this),h=y(t)-1;for(o.copyTo(s);--h>=0;)if(r.sqrTo(s,n),(t&1<<h)>0)r.mulTo(n,o,s);else{var a=s;s=n,n=a}return r.revert(s)}function F(t,e){var i;return i=256>t||e.isEven()?new A(e):new P(e),this.exp(t,i)}
  3 +// Copyright (c) 2005-2009 Tom Wu
  4 +// All Rights Reserved.
  5 +// See "LICENSE" for details.
  6 +function _(){var t=i();return this.copyTo(t),t}function z(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function Z(){return 0==this.t?this.s:this[0]<<24>>24}function G(){return 0==this.t?this.s:this[0]<<16>>16}function $(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function Y(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function W(t){if(null==t&&(t=10),0==this.signum()||2>t||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),s=c(r),n=i(),o=i(),h="";for(this.divRemTo(s,n,o);n.signum()>0;)h=(r+o.intValue()).toString(t).substr(1)+h,n.divRemTo(s,n,o);return o.intValue().toString(t)+h}function Q(t,i){this.fromInt(0),null==i&&(i=10);for(var r=this.chunkSize(i),s=Math.pow(i,r),n=!1,o=0,a=0,u=0;u<t.length;++u){var c=h(t,u);0>c?"-"==t.charAt(u)&&0==this.signum()&&(n=!0):(a=i*a+c,++o>=r&&(this.dMultiply(s),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(i,o)),this.dAddOffset(a,0)),n&&e.ZERO.subTo(this,this)}function X(t,i,r){if("number"==typeof i)if(2>t)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),ht,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this);else{var s=new Array,n=7&t;s.length=(t>>3)+1,i.nextBytes(s),n>0?s[0]&=(1<<n)-1:s[0]=0,this.fromString(s,256)}}function tt(){var t=this.t,e=new Array;e[0]=this.s;var i,r=this.DB-t*this.DB%8,s=0;if(t-- >0)for(r<this.DB&&(i=this[t]>>r)!=(this.s&this.DM)>>r&&(e[s++]=i|this.s<<this.DB-r);t>=0;)8>r?(i=(this[t]&(1<<r)-1)<<8-r,i|=this[--t]>>(r+=this.DB-8)):(i=this[t]>>(r-=8)&255,0>=r&&(r+=this.DB,--t)),0!=(128&i)&&(i|=-256),0==s&&(128&this.s)!=(128&i)&&++s,(s>0||i!=this.s)&&(e[s++]=i);return e}function et(t){return 0==this.compareTo(t)}function it(t){return this.compareTo(t)<0?this:t}function rt(t){return this.compareTo(t)>0?this:t}function st(t,e,i){var r,s,n=Math.min(t.t,this.t);for(r=0;n>r;++r)i[r]=e(this[r],t[r]);if(t.t<this.t){for(s=t.s&this.DM,r=n;r<this.t;++r)i[r]=e(this[r],s);i.t=this.t}else{for(s=this.s&this.DM,r=n;r<t.t;++r)i[r]=e(s,t[r]);i.t=t.t}i.s=e(this.s,t.s),i.clamp()}function nt(t,e){return t&e}function ot(t){var e=i();return this.bitwiseTo(t,nt,e),e}function ht(t,e){return t|e}function at(t){var e=i();return this.bitwiseTo(t,ht,e),e}function ut(t,e){return t^e}function ct(t){var e=i();return this.bitwiseTo(t,ut,e),e}function ft(t,e){return t&~e}function pt(t){var e=i();return this.bitwiseTo(t,ft,e),e}function lt(){for(var t=i(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t}function dt(t){var e=i();return 0>t?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function gt(t){var e=i();return 0>t?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function mt(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function yt(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+mt(this[t]);return this.s<0?this.t*this.DB:-1}function vt(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function bt(){for(var t=0,e=this.s&this.DM,i=0;i<this.t;++i)t+=vt(this[i]^e);return t}function Tt(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)}function St(t,i){var r=e.ONE.shiftLeft(t);return this.bitwiseTo(r,i,r),r}function Rt(t){return this.changeBit(t,ht)}function Et(t){return this.changeBit(t,ft)}function Dt(t){return this.changeBit(t,ut)}function wt(t,e){for(var i=0,r=0,s=Math.min(t.t,this.t);s>i;)r+=this[i]+t[i],e[i++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;i<this.t;)r+=this[i],e[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<t.t;)r+=t[i],e[i++]=r&this.DM,r>>=this.DB;r+=t.s}e.s=0>r?-1:0,r>0?e[i++]=r:-1>r&&(e[i++]=this.DV+r),e.t=i,e.clamp()}function xt(t){var e=i();return this.addTo(t,e),e}function Bt(t){var e=i();return this.subTo(t,e),e}function Kt(t){var e=i();return this.multiplyTo(t,e),e}function At(){var t=i();return this.squareTo(t),t}function Ut(t){var e=i();return this.divRemTo(t,e,null),e}function Ot(t){var e=i();return this.divRemTo(t,null,e),e}function Vt(t){var e=i(),r=i();return this.divRemTo(t,e,r),new Array(e,r)}function Nt(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function Jt(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}function It(){}function Pt(t){return t}function Mt(t,e,i){t.multiplyTo(e,i)}function Lt(t,e){t.squareTo(e)}function qt(t){return this.exp(t,new It)}function Ct(t,e,i){var r=Math.min(this.t+t.t,e);for(i.s=0,i.t=r;r>0;)i[--r]=0;var s;for(s=i.t-this.t;s>r;++r)i[r+this.t]=this.am(0,t[r],i,r,0,this.t);for(s=Math.min(t.t,e);s>r;++r)this.am(0,t[r],i,r,0,e-r);i.clamp()}function Ht(t,e,i){--e;var r=i.t=this.t+t.t-e;for(i.s=0;--r>=0;)i[r]=0;for(r=Math.max(e-this.t,0);r<t.t;++r)i[this.t+r-e]=this.am(e-r,t[r],i,0,0,this.t+r-e);i.clamp(),i.drShiftTo(1,i)}function jt(t){this.r2=i(),this.q3=i(),e.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function kt(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=i();return t.copyTo(e),this.reduce(e),e}function Ft(t){return t}function _t(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function zt(t,e){t.squareTo(e),this.reduce(e)}function Zt(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function Gt(t,e){var r,s,n=t.bitLength(),o=c(1);if(0>=n)return o;r=18>n?1:48>n?3:144>n?4:768>n?5:6,s=8>n?new A(e):e.isEven()?new jt(e):new P(e);var h=new Array,a=3,u=r-1,f=(1<<r)-1;if(h[1]=s.convert(this),r>1){var p=i();for(s.sqrTo(h[1],p);f>=a;)h[a]=i(),s.mulTo(p,h[a-2],h[a]),a+=2}var l,d,g=t.t-1,m=!0,v=i();for(n=y(t[g])-1;g>=0;){for(n>=u?l=t[g]>>n-u&f:(l=(t[g]&(1<<n+1)-1)<<u-n,g>0&&(l|=t[g-1]>>this.DB+n-u)),a=r;0==(1&l);)l>>=1,--a;if((n-=a)<0&&(n+=this.DB,--g),m)h[l].copyTo(o),m=!1;else{for(;a>1;)s.sqrTo(o,v),s.sqrTo(v,o),a-=2;a>0?s.sqrTo(o,v):(d=o,o=v,v=d),s.mulTo(v,h[l],o)}for(;g>=0&&0==(t[g]&1<<n);)s.sqrTo(o,v),d=o,o=v,v=d,--n<0&&(n=this.DB-1,--g)}return s.revert(o)}function $t(t){var e=this.s<0?this.negate():this.clone(),i=t.s<0?t.negate():t.clone();if(e.compareTo(i)<0){var r=e;e=i,i=r}var s=e.getLowestSetBit(),n=i.getLowestSetBit();if(0>n)return e;for(n>s&&(n=s),n>0&&(e.rShiftTo(n,e),i.rShiftTo(n,i));e.signum()>0;)(s=e.getLowestSetBit())>0&&e.rShiftTo(s,e),(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),e.compareTo(i)>=0?(e.subTo(i,e),e.rShiftTo(1,e)):(i.subTo(e,i),i.rShiftTo(1,i));return n>0&&i.lShiftTo(n,i),i}function Yt(t){if(0>=t)return 0;var e=this.DV%t,i=this.s<0?t-1:0;if(this.t>0)if(0==e)i=this[0]%t;else for(var r=this.t-1;r>=0;--r)i=(e*i+this[r])%t;return i}function Wt(t){var i=t.isEven();if(this.isEven()&&i||0==t.signum())return e.ZERO;for(var r=t.clone(),s=this.clone(),n=c(1),o=c(0),h=c(0),a=c(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),i?(n.isEven()&&o.isEven()||(n.addTo(this,n),o.subTo(t,o)),n.rShiftTo(1,n)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;s.isEven();)s.rShiftTo(1,s),i?(h.isEven()&&a.isEven()||(h.addTo(this,h),a.subTo(t,a)),h.rShiftTo(1,h)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(s)>=0?(r.subTo(s,r),i&&n.subTo(h,n),o.subTo(a,o)):(s.subTo(r,s),i&&h.subTo(n,h),a.subTo(o,a))}return 0!=s.compareTo(e.ONE)?e.ZERO:a.compareTo(t)>=0?a.subtract(t):a.signum()<0?(a.addTo(t,a),a.signum()<0?a.add(t):a):a}function Qt(t){var e,i=this.abs();if(1==i.t&&i[0]<=Ae[Ae.length-1]){for(e=0;e<Ae.length;++e)if(i[0]==Ae[e])return!0;return!1}if(i.isEven())return!1;for(e=1;e<Ae.length;){for(var r=Ae[e],s=e+1;s<Ae.length&&Ue>r;)r*=Ae[s++];for(r=i.modInt(r);s>e;)if(r%Ae[e++]==0)return!1}return i.millerRabin(t)}function Xt(t){var r=this.subtract(e.ONE),s=r.getLowestSetBit();if(0>=s)return!1;var n=r.shiftRight(s);t=t+1>>1,t>Ae.length&&(t=Ae.length);for(var o=i(),h=0;t>h;++h){o.fromInt(Ae[Math.floor(Math.random()*Ae.length)]);var a=o.modPow(n,this);if(0!=a.compareTo(e.ONE)&&0!=a.compareTo(r)){for(var u=1;u++<s&&0!=a.compareTo(r);)if(a=a.modPowInt(2,this),0==a.compareTo(e.ONE))return!1;if(0!=a.compareTo(r))return!1}}return!0}function te(){this.i=0,this.j=0,this.S=new Array}function ee(t){var e,i,r;for(e=0;256>e;++e)this.S[e]=e;for(i=0,e=0;256>e;++e)i=i+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[i],this.S[i]=r;this.i=0,this.j=0}function ie(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]}function re(){return new te}function se(){if(null==Oe){for(Oe=re();Je>Ne;){var t=Math.floor(65536*Math.random());Ve[Ne++]=255&t}for(Oe.init(Ve),Ne=0;Ne<Ve.length;++Ne)Ve[Ne]=0;Ne=0}return Oe.next()}function ne(t){var e;for(e=0;e<t.length;++e)t[e]=se()}function oe(){}function he(t,i){return new e(t,i)}function ae(t,i){if(i<t.length+11)return console.error("Message too long for RSA"),null;for(var r=new Array,s=t.length-1;s>=0&&i>0;){var n=t.charCodeAt(s--);128>n?r[--i]=n:n>127&&2048>n?(r[--i]=63&n|128,r[--i]=n>>6|192):(r[--i]=63&n|128,r[--i]=n>>6&63|128,r[--i]=n>>12|224)}r[--i]=0;for(var o=new oe,h=new Array;i>2;){for(h[0]=0;0==h[0];)o.nextBytes(h);r[--i]=h[0]}return r[--i]=2,r[--i]=0,new e(r)}function ue(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function ce(t,e){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=he(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")}function fe(t){return t.modPowInt(this.e,this.n)}function pe(t){var e=ae(t,this.n.bitLength()+7>>3);if(null==e)return null;var i=this.doPublic(e);if(null==i)return null;var r=i.toString(16);return 0==(1&r.length)?r:"0"+r}function le(t,e){for(var i=t.toByteArray(),r=0;r<i.length&&0==i[r];)++r;if(i.length-r!=e-1||2!=i[r])return null;for(++r;0!=i[r];)if(++r>=i.length)return null;for(var s="";++r<i.length;){var n=255&i[r];128>n?s+=String.fromCharCode(n):n>191&&224>n?(s+=String.fromCharCode((31&n)<<6|63&i[r+1]),++r):(s+=String.fromCharCode((15&n)<<12|(63&i[r+1])<<6|63&i[r+2]),r+=2)}return s}function de(t,e,i){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=he(t,16),this.e=parseInt(e,16),this.d=he(i,16)):console.error("Invalid RSA private key")}function ge(t,e,i,r,s,n,o,h){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=he(t,16),this.e=parseInt(e,16),this.d=he(i,16),this.p=he(r,16),this.q=he(s,16),this.dmp1=he(n,16),this.dmq1=he(o,16),this.coeff=he(h,16)):console.error("Invalid RSA private key")}function me(t,i){var r=new oe,s=t>>1;this.e=parseInt(i,16);for(var n=new e(i,16);;){for(;this.p=new e(t-s,1,r),0!=this.p.subtract(e.ONE).gcd(n).compareTo(e.ONE)||!this.p.isProbablePrime(10););for(;this.q=new e(s,1,r),0!=this.q.subtract(e.ONE).gcd(n).compareTo(e.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var h=this.p.subtract(e.ONE),a=this.q.subtract(e.ONE),u=h.multiply(a);if(0==u.gcd(n).compareTo(e.ONE)){this.n=this.p.multiply(this.q),this.d=n.modInverse(u),this.dmp1=this.d.mod(h),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}}function ye(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),i=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(i)<0;)e=e.add(this.p);return e.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i)}function ve(t){var e=he(t,16),i=this.doPrivate(e);return null==i?null:le(i,this.n.bitLength()+7>>3)}function be(t){var e,i,r="";for(e=0;e+3<=t.length;e+=3)i=parseInt(t.substring(e,e+3),16),r+=Le.charAt(i>>6)+Le.charAt(63&i);for(e+1==t.length?(i=parseInt(t.substring(e,e+1),16),r+=Le.charAt(i<<2)):e+2==t.length&&(i=parseInt(t.substring(e,e+2),16),r+=Le.charAt(i>>2)+Le.charAt((3&i)<<4));(3&r.length)>0;)r+=qe;return r}function Te(t){var e,i,r="",s=0;for(e=0;e<t.length&&t.charAt(e)!=qe;++e)v=Le.indexOf(t.charAt(e)),v<0||(0==s?(r+=o(v>>2),i=3&v,s=1):1==s?(r+=o(i<<2|v>>4),i=15&v,s=2):2==s?(r+=o(i),r+=o(v>>2),i=3&v,s=3):(r+=o(i<<2|v>>4),r+=o(15&v),s=0));return 1==s&&(r+=o(i<<2)),r}
  7 +// Copyright (c) 2005 Tom Wu
  8 +// All Rights Reserved.
  9 +// See "LICENSE" for details.
  10 +var Se,Re=0xdeadbeefcafe,Ee=15715070==(16777215&Re);Ee&&"Microsoft Internet Explorer"==navigator.appName?(e.prototype.am=s,Se=30):Ee&&"Netscape"!=navigator.appName?(e.prototype.am=r,Se=26):(e.prototype.am=n,Se=28),e.prototype.DB=Se,e.prototype.DM=(1<<Se)-1,e.prototype.DV=1<<Se;var De=52;e.prototype.FV=Math.pow(2,De),e.prototype.F1=De-Se,e.prototype.F2=2*Se-De;var we,xe,Be="0123456789abcdefghijklmnopqrstuvwxyz",Ke=new Array;for(we="0".charCodeAt(0),xe=0;9>=xe;++xe)Ke[we++]=xe;for(we="a".charCodeAt(0),xe=10;36>xe;++xe)Ke[we++]=xe;for(we="A".charCodeAt(0),xe=10;36>xe;++xe)Ke[we++]=xe;A.prototype.convert=U,A.prototype.revert=O,A.prototype.reduce=V,A.prototype.mulTo=N,A.prototype.sqrTo=J,P.prototype.convert=M,P.prototype.revert=L,P.prototype.reduce=q,P.prototype.mulTo=H,P.prototype.sqrTo=C,e.prototype.copyTo=a,e.prototype.fromInt=u,e.prototype.fromString=f,e.prototype.clamp=p,e.prototype.dlShiftTo=T,e.prototype.drShiftTo=S,e.prototype.lShiftTo=R,e.prototype.rShiftTo=E,e.prototype.subTo=D,e.prototype.multiplyTo=w,e.prototype.squareTo=x,e.prototype.divRemTo=B,e.prototype.invDigit=I,e.prototype.isEven=j,e.prototype.exp=k,e.prototype.toString=l,e.prototype.negate=d,e.prototype.abs=g,e.prototype.compareTo=m,e.prototype.bitLength=b,e.prototype.mod=K,e.prototype.modPowInt=F,e.ZERO=c(0),e.ONE=c(1),It.prototype.convert=Pt,It.prototype.revert=Pt,It.prototype.mulTo=Mt,It.prototype.sqrTo=Lt,jt.prototype.convert=kt,jt.prototype.revert=Ft,jt.prototype.reduce=_t,jt.prototype.mulTo=Zt,jt.prototype.sqrTo=zt;var Ae=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Ue=(1<<26)/Ae[Ae.length-1];e.prototype.chunkSize=$,e.prototype.toRadix=W,e.prototype.fromRadix=Q,e.prototype.fromNumber=X,e.prototype.bitwiseTo=st,e.prototype.changeBit=St,e.prototype.addTo=wt,e.prototype.dMultiply=Nt,e.prototype.dAddOffset=Jt,e.prototype.multiplyLowerTo=Ct,e.prototype.multiplyUpperTo=Ht,e.prototype.modInt=Yt,e.prototype.millerRabin=Xt,e.prototype.clone=_,e.prototype.intValue=z,e.prototype.byteValue=Z,e.prototype.shortValue=G,e.prototype.signum=Y,e.prototype.toByteArray=tt,e.prototype.equals=et,e.prototype.min=it,e.prototype.max=rt,e.prototype.and=ot,e.prototype.or=at,e.prototype.xor=ct,e.prototype.andNot=pt,e.prototype.not=lt,e.prototype.shiftLeft=dt,e.prototype.shiftRight=gt,e.prototype.getLowestSetBit=yt,e.prototype.bitCount=bt,e.prototype.testBit=Tt,e.prototype.setBit=Rt,e.prototype.clearBit=Et,e.prototype.flipBit=Dt,e.prototype.add=xt,e.prototype.subtract=Bt,e.prototype.multiply=Kt,e.prototype.divide=Ut,e.prototype.remainder=Ot,e.prototype.divideAndRemainder=Vt,e.prototype.modPow=Gt,e.prototype.modInverse=Wt,e.prototype.pow=qt,e.prototype.gcd=$t,e.prototype.isProbablePrime=Qt,e.prototype.square=At,te.prototype.init=ee,te.prototype.next=ie;var Oe,Ve,Ne,Je=256;if(null==Ve){Ve=new Array,Ne=0;var Ie;if(window.crypto&&window.crypto.getRandomValues){var Pe=new Uint32Array(256);for(window.crypto.getRandomValues(Pe),Ie=0;Ie<Pe.length;++Ie)Ve[Ne++]=255&Pe[Ie]}var Me=function(t){if(this.count=this.count||0,this.count>=256||Ne>=Je)return void(window.removeEventListener?window.removeEventListener("mousemove",Me,!1):window.detachEvent&&window.detachEvent("onmousemove",Me));try{var e=t.x+t.y;Ve[Ne++]=255&e,this.count+=1}catch(i){}};window.addEventListener?window.addEventListener("mousemove",Me,!1):window.attachEvent&&window.attachEvent("onmousemove",Me)}oe.prototype.nextBytes=ne,ue.prototype.doPublic=fe,ue.prototype.setPublic=ce,ue.prototype.encrypt=pe,ue.prototype.doPrivate=ye,ue.prototype.setPrivate=de,ue.prototype.setPrivateEx=ge,ue.prototype.generate=me,ue.prototype.decrypt=ve,
  11 +// Copyright (c) 2011 Kevin M Burns Jr.
  12 +// All Rights Reserved.
  13 +// See "LICENSE" for details.
  14 +//
  15 +// Extension to jsbn which adds facilities for asynchronous RSA key generation
  16 +// Primarily created to avoid execution timeout on mobile devices
  17 +//
  18 +// http://www-cs-students.stanford.edu/~tjw/jsbn/
  19 +//
  20 +// ---
  21 +function(){var t=function(t,r,s){var n=new oe,o=t>>1;this.e=parseInt(r,16);var h=new e(r,16),a=this,u=function(){var r=function(){if(a.p.compareTo(a.q)<=0){var t=a.p;a.p=a.q,a.q=t}var i=a.p.subtract(e.ONE),r=a.q.subtract(e.ONE),n=i.multiply(r);0==n.gcd(h).compareTo(e.ONE)?(a.n=a.p.multiply(a.q),a.d=h.modInverse(n),a.dmp1=a.d.mod(i),a.dmq1=a.d.mod(r),a.coeff=a.q.modInverse(a.p),setTimeout(function(){s()},0)):setTimeout(u,0)},c=function(){a.q=i(),a.q.fromNumberAsync(o,1,n,function(){a.q.subtract(e.ONE).gcda(h,function(t){0==t.compareTo(e.ONE)&&a.q.isProbablePrime(10)?setTimeout(r,0):setTimeout(c,0)})})},f=function(){a.p=i(),a.p.fromNumberAsync(t-o,1,n,function(){a.p.subtract(e.ONE).gcda(h,function(t){0==t.compareTo(e.ONE)&&a.p.isProbablePrime(10)?setTimeout(c,0):setTimeout(f,0)})})};setTimeout(f,0)};setTimeout(u,0)};ue.prototype.generateAsync=t;var r=function(t,e){var i=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(i.compareTo(r)<0){var s=i;i=r,r=s}var n=i.getLowestSetBit(),o=r.getLowestSetBit();if(0>o)return void e(i);o>n&&(o=n),o>0&&(i.rShiftTo(o,i),r.rShiftTo(o,r));var h=function(){(n=i.getLowestSetBit())>0&&i.rShiftTo(n,i),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),i.compareTo(r)>=0?(i.subTo(r,i),i.rShiftTo(1,i)):(r.subTo(i,r),r.rShiftTo(1,r)),i.signum()>0?setTimeout(h,0):(o>0&&r.lShiftTo(o,r),setTimeout(function(){e(r)},0))};setTimeout(h,10)};e.prototype.gcda=r;var s=function(t,i,r,s){if("number"==typeof i)if(2>t)this.fromInt(1);else{this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),ht,this),this.isEven()&&this.dAddOffset(1,0);var n=this,o=function(){n.dAddOffset(2,0),n.bitLength()>t&&n.subTo(e.ONE.shiftLeft(t-1),n),n.isProbablePrime(i)?setTimeout(function(){s()},0):setTimeout(o,0)};setTimeout(o,0)}else{var h=new Array,a=7&t;h.length=(t>>3)+1,i.nextBytes(h),a>0?h[0]&=(1<<a)-1:h[0]=0,this.fromString(h,256)}};e.prototype.fromNumberAsync=s}();var Le="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",qe="=",Ce=Ce||{};Ce.env=Ce.env||{};var He=Ce,je=Object.prototype,ke="[object Function]",Fe=["toString","valueOf"];Ce.env.parseUA=function(t){var e,i=function(t){var e=0;return parseFloat(t.replace(/\./g,function(){return 1==e++?"":"."}))},r=navigator,s={ie:0,opera:0,gecko:0,webkit:0,chrome:0,mobile:null,air:0,ipad:0,iphone:0,ipod:0,ios:null,android:0,webos:0,caja:r&&r.cajaVersion,secure:!1,os:null},n=t||navigator&&navigator.userAgent,o=window&&window.location,h=o&&o.href;return s.secure=h&&0===h.toLowerCase().indexOf("https"),n&&(/windows|win32/i.test(n)?s.os="windows":/macintosh/i.test(n)?s.os="macintosh":/rhino/i.test(n)&&(s.os="rhino"),/KHTML/.test(n)&&(s.webkit=1),e=n.match(/AppleWebKit\/([^\s]*)/),e&&e[1]&&(s.webkit=i(e[1]),/ Mobile\//.test(n)?(s.mobile="Apple",e=n.match(/OS ([^\s]*)/),e&&e[1]&&(e=i(e[1].replace("_","."))),s.ios=e,s.ipad=s.ipod=s.iphone=0,e=n.match(/iPad|iPod|iPhone/),e&&e[0]&&(s[e[0].toLowerCase()]=s.ios)):(e=n.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/),e&&(s.mobile=e[0]),/webOS/.test(n)&&(s.mobile="WebOS",e=n.match(/webOS\/([^\s]*);/),e&&e[1]&&(s.webos=i(e[1]))),/ Android/.test(n)&&(s.mobile="Android",e=n.match(/Android ([^\s]*);/),e&&e[1]&&(s.android=i(e[1])))),e=n.match(/Chrome\/([^\s]*)/),e&&e[1]?s.chrome=i(e[1]):(e=n.match(/AdobeAIR\/([^\s]*)/),e&&(s.air=e[0]))),s.webkit||(e=n.match(/Opera[\s\/]([^\s]*)/),e&&e[1]?(s.opera=i(e[1]),e=n.match(/Version\/([^\s]*)/),e&&e[1]&&(s.opera=i(e[1])),e=n.match(/Opera Mini[^;]*/),e&&(s.mobile=e[0])):(e=n.match(/MSIE\s([^;]*)/),e&&e[1]?s.ie=i(e[1]):(e=n.match(/Gecko\/([^\s]*)/),e&&(s.gecko=1,e=n.match(/rv:([^\s\)]*)/),e&&e[1]&&(s.gecko=i(e[1]))))))),s},Ce.env.ua=Ce.env.parseUA(),Ce.isFunction=function(t){return"function"==typeof t||je.toString.apply(t)===ke},Ce._IEEnumFix=Ce.env.ua.ie?function(t,e){var i,r,s;for(i=0;i<Fe.length;i+=1)r=Fe[i],s=e[r],He.isFunction(s)&&s!=je[r]&&(t[r]=s)}:function(){},Ce.extend=function(t,e,i){if(!e||!t)throw new Error("extend failed, please check that all dependencies are included.");var r,s=function(){};if(s.prototype=e.prototype,t.prototype=new s,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==je.constructor&&(e.prototype.constructor=e),i){for(r in i)He.hasOwnProperty(i,r)&&(t.prototype[r]=i[r]);He._IEEnumFix(t.prototype,i)}},/*
  22 + * asn1.js - ASN.1 DER encoder classes
  23 + *
  24 + * Copyright (c) 2013 Kenji Urushima (kenji.urushima@gmail.com)
  25 + *
  26 + * This software is licensed under the terms of the MIT License.
  27 + * http://kjur.github.com/jsrsasign/license
  28 + *
  29 + * The above copyright and license notice shall be
  30 + * included in all copies or substantial portions of the Software.
  31 + */
  32 +/**
  33 + * @fileOverview
  34 + * @name asn1-1.0.js
  35 + * @author Kenji Urushima kenji.urushima@gmail.com
  36 + * @version 1.0.2 (2013-May-30)
  37 + * @since 2.1
  38 + * @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
  39 + */
  40 +"undefined"!=typeof KJUR&&KJUR||(KJUR={}),"undefined"!=typeof KJUR.asn1&&KJUR.asn1||(KJUR.asn1={}),KJUR.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var i=t.toString(16);if("-"!=i.substr(0,1))i.length%2==1?i="0"+i:i.match(/^[0-7]/)||(i="00"+i);else{var r=i.substr(1),s=r.length;s%2==1?s+=1:i.match(/^[0-7]/)||(s+=2);for(var n="",o=0;s>o;o++)n+="f";var h=new e(n,16),a=h.xor(t).add(e.ONE);i=a.toString(16).replace(/^-/,"")}return i},this.getPEMStringFromHex=function(t,e){var i=CryptoJS.enc.Hex.parse(t),r=CryptoJS.enc.Base64.stringify(i),s=r.replace(/(.{64})/g,"$1\r\n");return s=s.replace(/\r\n$/,""),"-----BEGIN "+e+"-----\r\n"+s+"\r\n-----END "+e+"-----\r\n"}},KJUR.asn1.ASN1Object=function(){var t="";this.getLengthHexFromValue=function(){if("undefined"==typeof this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+t.length+",v="+this.hV;var e=this.hV.length/2,i=e.toString(16);if(i.length%2==1&&(i="0"+i),128>e)return i;var r=i.length/2;if(r>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);var s=128+r;return s.toString(16)+i},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},KJUR.asn1.DERAbstractString=function(t){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof t&&("undefined"!=typeof t.str?this.setString(t.str):"undefined"!=typeof t.hex&&this.setStringHex(t.hex))},Ce.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object),KJUR.asn1.DERAbstractTime=function(t){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);this.localDateToUTC=function(t){utc=t.getTime()+6e4*t.getTimezoneOffset();var e=new Date(utc);return e},this.formatDate=function(t,e){var i=this.zeroPadding,r=this.localDateToUTC(t),s=String(r.getFullYear());"utc"==e&&(s=s.substr(2,2));var n=i(String(r.getMonth()+1),2),o=i(String(r.getDate()),2),h=i(String(r.getHours()),2),a=i(String(r.getMinutes()),2),u=i(String(r.getSeconds()),2);return s+n+o+h+a+u+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setByDateValue=function(t,e,i,r,s,n){var o=new Date(Date.UTC(t,e-1,i,r,s,n,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},Ce.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object),KJUR.asn1.DERAbstractStructured=function(t){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,"undefined"!=typeof t&&"undefined"!=typeof t.array&&(this.asn1Array=t.array)},Ce.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object),KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},Ce.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object),KJUR.asn1.DERInteger=function(t){KJUR.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var i=new e(String(t),10);this.setByBigInteger(i)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof t&&("undefined"!=typeof t.bigint?this.setByBigInteger(t.bigint):"undefined"!=typeof t["int"]?this.setByInteger(t["int"]):"undefined"!=typeof t.hex&&this.setValueHex(t.hex))},Ce.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object),KJUR.asn1.DERBitString=function(t){KJUR.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(0>t||t>7)throw"unused bits shall be from 0 to 7: u = "+t;var i="0"+t;this.hTLV=null,this.isModified=!0,this.hV=i+e},this.setByBinaryString=function(t){t=t.replace(/0+$/,"");var e=8-t.length%8;8==e&&(e=0);for(var i=0;e>=i;i++)t+="0";for(var r="",i=0;i<t.length-1;i+=8){var s=t.substr(i,8),n=parseInt(s,2).toString(16);1==n.length&&(n="0"+n),r+=n}this.hTLV=null,this.isModified=!0,this.hV="0"+e+r},this.setByBooleanArray=function(t){for(var e="",i=0;i<t.length;i++)e+=1==t[i]?"1":"0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),i=0;t>i;i++)e[i]=!1;return e},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof t&&("undefined"!=typeof t.hex?this.setHexValueIncludingUnusedBits(t.hex):"undefined"!=typeof t.bin?this.setByBinaryString(t.bin):"undefined"!=typeof t.array&&this.setByBooleanArray(t.array))},Ce.extend(KJUR.asn1.DERBitString,KJUR.asn1.ASN1Object),KJUR.asn1.DEROctetString=function(t){KJUR.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},Ce.extend(KJUR.asn1.DEROctetString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERNull=function(){KJUR.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},Ce.extend(KJUR.asn1.DERNull,KJUR.asn1.ASN1Object),KJUR.asn1.DERObjectIdentifier=function(t){var i=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",s=new e(t,10),n=s.toString(2),o=7-n.length%7;7==o&&(o=0);for(var h="",a=0;o>a;a++)h+="0";n=h+n;for(var a=0;a<n.length-1;a+=7){var u=n.substr(a,7);a!=n.length-7&&(u="1"+u),r+=i(parseInt(u,2))}return r};KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var e="",s=t.split("."),n=40*parseInt(s[0])+parseInt(s[1]);e+=i(n),s.splice(0,2);for(var o=0;o<s.length;o++)e+=r(s[o]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueName=function(t){if("undefined"==typeof KJUR.asn1.x509.OID.name2oidList[t])throw"DERObjectIdentifier oidName undefined: "+t;var e=KJUR.asn1.x509.OID.name2oidList[t];this.setValueOidString(e)},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof t&&("undefined"!=typeof t.oid?this.setValueOidString(t.oid):"undefined"!=typeof t.hex?this.setValueHex(t.hex):"undefined"!=typeof t.name&&this.setValueName(t.name))},Ce.extend(KJUR.asn1.DERObjectIdentifier,KJUR.asn1.ASN1Object),KJUR.asn1.DERUTF8String=function(t){KJUR.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},Ce.extend(KJUR.asn1.DERUTF8String,KJUR.asn1.DERAbstractString),KJUR.asn1.DERNumericString=function(t){KJUR.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},Ce.extend(KJUR.asn1.DERNumericString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERPrintableString=function(t){KJUR.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},Ce.extend(KJUR.asn1.DERPrintableString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERTeletexString=function(t){KJUR.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},Ce.extend(KJUR.asn1.DERTeletexString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERIA5String=function(t){KJUR.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},Ce.extend(KJUR.asn1.DERIA5String,KJUR.asn1.DERAbstractString),KJUR.asn1.DERUTCTime=function(t){KJUR.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},"undefined"!=typeof t&&("undefined"!=typeof t.str?this.setString(t.str):"undefined"!=typeof t.hex?this.setStringHex(t.hex):"undefined"!=typeof t.date&&this.setByDate(t.date))},Ce.extend(KJUR.asn1.DERUTCTime,KJUR.asn1.DERAbstractTime),KJUR.asn1.DERGeneralizedTime=function(t){KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen"),this.hV=stohex(this.s)},"undefined"!=typeof t&&("undefined"!=typeof t.str?this.setString(t.str):"undefined"!=typeof t.hex?this.setStringHex(t.hex):"undefined"!=typeof t.date&&this.setByDate(t.date))},Ce.extend(KJUR.asn1.DERGeneralizedTime,KJUR.asn1.DERAbstractTime),KJUR.asn1.DERSequence=function(t){KJUR.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++){var i=this.asn1Array[e];t+=i.getEncodedHex()}return this.hV=t,this.hV}},Ce.extend(KJUR.asn1.DERSequence,KJUR.asn1.DERAbstractStructured),KJUR.asn1.DERSet=function(t){KJUR.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var i=this.asn1Array[e];t.push(i.getEncodedHex())}return t.sort(),this.hV=t.join(""),this.hV}},Ce.extend(KJUR.asn1.DERSet,KJUR.asn1.DERAbstractStructured),KJUR.asn1.DERTaggedObject=function(t){KJUR.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,i){this.hT=e,this.isExplicit=t,this.asn1Object=i,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=i.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof t&&("undefined"!=typeof t.tag&&(this.hT=t.tag),"undefined"!=typeof t.explicit&&(this.isExplicit=t.explicit),"undefined"!=typeof t.obj&&(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},Ce.extend(KJUR.asn1.DERTaggedObject,KJUR.asn1.ASN1Object),
  41 +// Copyright (c) 2008-2013 Lapo Luchini <lapo@lapo.it>
  42 +// copyright notice and this permission notice appear in all copies.
  43 +//
  44 +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  45 +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  46 +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  47 +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  48 +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  49 +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  50 +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  51 +function(t){"use strict";var e,i={};i.decode=function(i){var r;if(e===t){var s="0123456789ABCDEF",n=" \f\n\r  \u2028\u2029";for(e=[],r=0;16>r;++r)e[s.charAt(r)]=r;for(s=s.toLowerCase(),r=10;16>r;++r)e[s.charAt(r)]=r;for(r=0;r<n.length;++r)e[n.charAt(r)]=-1}var o=[],h=0,a=0;for(r=0;r<i.length;++r){var u=i.charAt(r);if("="==u)break;if(u=e[u],-1!=u){if(u===t)throw"Illegal character at offset "+r;h|=u,++a>=2?(o[o.length]=h,h=0,a=0):h<<=4}}if(a)throw"Hex encoding incomplete: 4 bits missing";return o},window.Hex=i}(),
  52 +// Copyright (c) 2008-2013 Lapo Luchini <lapo@lapo.it>
  53 +// copyright notice and this permission notice appear in all copies.
  54 +//
  55 +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  56 +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  57 +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  58 +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  59 +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  60 +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  61 +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  62 +function(t){"use strict";var e,i={};i.decode=function(i){var r;if(e===t){var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="= \f\n\r  \u2028\u2029";for(e=[],r=0;64>r;++r)e[s.charAt(r)]=r;for(r=0;r<n.length;++r)e[n.charAt(r)]=-1}var o=[],h=0,a=0;for(r=0;r<i.length;++r){var u=i.charAt(r);if("="==u)break;if(u=e[u],-1!=u){if(u===t)throw"Illegal character at offset "+r;h|=u,++a>=4?(o[o.length]=h>>16,o[o.length]=h>>8&255,o[o.length]=255&h,h=0,a=0):h<<=6}}switch(a){case 1:throw"Base64 encoding incomplete: at least 2 bits missing";case 2:o[o.length]=h>>10;break;case 3:o[o.length]=h>>16,o[o.length]=h>>8&255}return o},i.re=/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,i.unarmor=function(t){var e=i.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw"RegExp out of sync";t=e[2]}return i.decode(t)},window.Base64=i}(),
  63 +// Copyright (c) 2008-2013 Lapo Luchini <lapo@lapo.it>
  64 +// copyright notice and this permission notice appear in all copies.
  65 +//
  66 +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  67 +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  68 +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  69 +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  70 +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  71 +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  72 +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  73 +function(t){"use strict";function e(t,i){t instanceof e?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=i)}function i(t,e,i,r,s){this.stream=t,this.header=e,this.length=i,this.tag=r,this.sub=s}var r=100,s="…",n={tag:function(t,e){var i=document.createElement(t);return i.className=e,i},text:function(t){return document.createTextNode(t)}};e.prototype.get=function(e){if(e===t&&(e=this.pos++),e>=this.enc.length)throw"Requesting byte offset "+e+" on a stream of length "+this.enc.length;return this.enc[e]},e.prototype.hexDigits="0123456789ABCDEF",e.prototype.hexByte=function(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)},e.prototype.hexDump=function(t,e,i){for(var r="",s=t;e>s;++s)if(r+=this.hexByte(this.get(s)),i!==!0)switch(15&s){case 7:r+=" ";break;case 15:r+="\n";break;default:r+=" "}return r},e.prototype.parseStringISO=function(t,e){for(var i="",r=t;e>r;++r)i+=String.fromCharCode(this.get(r));return i},e.prototype.parseStringUTF=function(t,e){for(var i="",r=t;e>r;){var s=this.get(r++);i+=128>s?String.fromCharCode(s):s>191&&224>s?String.fromCharCode((31&s)<<6|63&this.get(r++)):String.fromCharCode((15&s)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return i},e.prototype.parseStringBMP=function(t,e){for(var i="",r=t;e>r;r+=2){var s=this.get(r),n=this.get(r+1);i+=String.fromCharCode((s<<8)+n)}return i},e.prototype.reTime=/^((?:1[89]|2\d)?\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,e.prototype.parseTime=function(t,e){var i=this.parseStringISO(t,e),r=this.reTime.exec(i);return r?(i=r[1]+"-"+r[2]+"-"+r[3]+" "+r[4],r[5]&&(i+=":"+r[5],r[6]&&(i+=":"+r[6],r[7]&&(i+="."+r[7]))),r[8]&&(i+=" UTC","Z"!=r[8]&&(i+=r[8],r[9]&&(i+=":"+r[9]))),i):"Unrecognized time: "+i},e.prototype.parseInteger=function(t,e){var i=e-t;if(i>4){i<<=3;var r=this.get(t);if(0===r)i-=8;else for(;128>r;)r<<=1,--i;return"("+i+" bit)"}for(var s=0,n=t;e>n;++n)s=s<<8|this.get(n);return s},e.prototype.parseBitString=function(t,e){var i=this.get(t),r=(e-t-1<<3)-i,s="("+r+" bit)";if(20>=r){var n=i;s+=" ";for(var o=e-1;o>t;--o){for(var h=this.get(o),a=n;8>a;++a)s+=h>>a&1?"1":"0";n=0}}return s},e.prototype.parseOctetString=function(t,e){var i=e-t,n="("+i+" byte) ";i>r&&(e=t+r);for(var o=t;e>o;++o)n+=this.hexByte(this.get(o));return i>r&&(n+=s),n},e.prototype.parseOID=function(t,e){for(var i="",r=0,s=0,n=t;e>n;++n){var o=this.get(n);if(r=r<<7|127&o,s+=7,!(128&o)){if(""===i){var h=80>r?40>r?0:1:2;i=h+"."+(r-40*h)}else i+="."+(s>=31?"bigint":r);r=s=0}}return i},i.prototype.typeName=function(){if(this.tag===t)return"unknown";var e=this.tag>>6,i=(this.tag>>5&1,31&this.tag);switch(e){case 0:switch(i){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString";default:return"Universal_"+i.toString(16)}case 1:return"Application_"+i.toString(16);case 2:return"["+i+"]";case 3:return"Private_"+i.toString(16)}},i.prototype.reSeemsASCII=/^[ -~]+$/,i.prototype.content=function(){if(this.tag===t)return null;var e=this.tag>>6,i=31&this.tag,n=this.posContent(),o=Math.abs(this.length);if(0!==e){if(null!==this.sub)return"("+this.sub.length+" elem)";var h=this.stream.parseStringISO(n,n+Math.min(o,r));return this.reSeemsASCII.test(h)?h.substring(0,2*r)+(h.length>2*r?s:""):this.stream.parseOctetString(n,n+o)}switch(i){case 1:return 0===this.stream.get(n)?"false":"true";case 2:return this.stream.parseInteger(n,n+o);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(n,n+o);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(n,n+o);case 6:return this.stream.parseOID(n,n+o);case 16:case 17:return"("+this.sub.length+" elem)";case 12:return this.stream.parseStringUTF(n,n+o);case 18:case 19:case 20:case 21:case 22:case 26:return this.stream.parseStringISO(n,n+o);case 30:return this.stream.parseStringBMP(n,n+o);case 23:case 24:return this.stream.parseTime(n,n+o)}return null},i.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},i.prototype.print=function(e){if(e===t&&(e=""),document.writeln(e+this),null!==this.sub){e+=" ";for(var i=0,r=this.sub.length;r>i;++i)this.sub[i].print(e)}},i.prototype.toPrettyString=function(e){e===t&&(e="");var i=e+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(i+="+"),i+=this.length,32&this.tag?i+=" (constructed)":3!=this.tag&&4!=this.tag||null===this.sub||(i+=" (encapsulates)"),i+="\n",null!==this.sub){e+=" ";for(var r=0,s=this.sub.length;s>r;++r)i+=this.sub[r].toPrettyString(e)}return i},i.prototype.toDOM=function(){var t=n.tag("div","node");t.asn1=this;var e=n.tag("div","head"),i=this.typeName().replace(/_/g," ");e.innerHTML=i;var r=this.content();if(null!==r){r=String(r).replace(/</g,"&lt;");var s=n.tag("span","preview");s.appendChild(n.text(r)),e.appendChild(s)}t.appendChild(e),this.node=t,this.head=e;var o=n.tag("div","value");if(i="Offset: "+this.stream.pos+"<br/>",i+="Length: "+this.header+"+",i+=this.length>=0?this.length:-this.length+" (undefined)",32&this.tag?i+="<br/>(constructed)":3!=this.tag&&4!=this.tag||null===this.sub||(i+="<br/>(encapsulates)"),null!==r&&(i+="<br/>Value:<br/><b>"+r+"</b>","object"==typeof oids&&6==this.tag)){var h=oids[r];h&&(h.d&&(i+="<br/>"+h.d),h.c&&(i+="<br/>"+h.c),h.w&&(i+="<br/>(warning!)"))}o.innerHTML=i,t.appendChild(o);var a=n.tag("div","sub");if(null!==this.sub)for(var u=0,c=this.sub.length;c>u;++u)a.appendChild(this.sub[u].toDOM());return t.appendChild(a),e.onclick=function(){t.className="node collapsed"==t.className?"node":"node collapsed"},t},i.prototype.posStart=function(){return this.stream.pos},i.prototype.posContent=function(){return this.stream.pos+this.header},i.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},i.prototype.fakeHover=function(t){this.node.className+=" hover",t&&(this.head.className+=" hover")},i.prototype.fakeOut=function(t){var e=/ ?hover/;this.node.className=this.node.className.replace(e,""),t&&(this.head.className=this.head.className.replace(e,""))},i.prototype.toHexDOM_sub=function(t,e,i,r,s){if(!(r>=s)){var o=n.tag("span",e);o.appendChild(n.text(i.hexDump(r,s))),t.appendChild(o)}},i.prototype.toHexDOM=function(e){var i=n.tag("span","hex");if(e===t&&(e=i),this.head.hexNode=i,this.head.onmouseover=function(){this.hexNode.className="hexCurrent"},this.head.onmouseout=function(){this.hexNode.className="hex"},i.asn1=this,i.onmouseover=function(){var t=!e.selected;t&&(e.selected=this.asn1,this.className="hexCurrent"),this.asn1.fakeHover(t)},i.onmouseout=function(){var t=e.selected==this.asn1;this.asn1.fakeOut(t),t&&(e.selected=null,this.className="hex")},this.toHexDOM_sub(i,"tag",this.stream,this.posStart(),this.posStart()+1),this.toHexDOM_sub(i,this.length>=0?"dlen":"ulen",this.stream,this.posStart()+1,this.posContent()),null===this.sub)i.appendChild(n.text(this.stream.hexDump(this.posContent(),this.posEnd())));else if(this.sub.length>0){var r=this.sub[0],s=this.sub[this.sub.length-1];this.toHexDOM_sub(i,"intro",this.stream,this.posContent(),r.posStart());for(var o=0,h=this.sub.length;h>o;++o)i.appendChild(this.sub[o].toHexDOM(e));this.toHexDOM_sub(i,"outro",this.stream,s.posEnd(),this.posEnd())}return i},i.prototype.toHexString=function(t){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},i.decodeLength=function(t){var e=t.get(),i=127&e;if(i==e)return i;if(i>3)throw"Length over 24 bits not supported at position "+(t.pos-1);if(0===i)return-1;e=0;for(var r=0;i>r;++r)e=e<<8|t.get();return e},i.hasContent=function(t,r,s){if(32&t)return!0;if(3>t||t>4)return!1;var n=new e(s);3==t&&n.get();var o=n.get();if(o>>6&1)return!1;try{var h=i.decodeLength(n);return n.pos-s.pos+h==r}catch(a){return!1}},i.decode=function(t){t instanceof e||(t=new e(t,0));var r=new e(t),s=t.get(),n=i.decodeLength(t),o=t.pos-r.pos,h=null;if(i.hasContent(s,n,t)){var a=t.pos;if(3==s&&t.get(),h=[],n>=0){for(var u=a+n;t.pos<u;)h[h.length]=i.decode(t);if(t.pos!=u)throw"Content size is not correct for container starting at offset "+a}else try{for(;;){var c=i.decode(t);if(0===c.tag)break;h[h.length]=c}n=a-t.pos}catch(f){throw"Exception while decoding undefined length content: "+f}}else t.pos+=n;return new i(r,o,n,s,h)},i.test=function(){for(var t=[{value:[39],expected:39},{value:[129,201],expected:201},{value:[131,254,220,186],expected:16702650}],r=0,s=t.length;s>r;++r){var n=new e(t[r].value,0),o=i.decodeLength(n);o!=t[r].expected&&document.write("In test["+r+"] expected "+t[r].expected+" got "+o+"\n")}},window.ASN1=i}(),ASN1.prototype.getHexStringValue=function(){var t=this.toHexString(),e=2*this.header,i=2*this.length;return t.substr(e,i)},ue.prototype.parseKey=function(t){try{var e=0,i=0,r=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/,s=r.test(t)?Hex.decode(t):Base64.unarmor(t),n=ASN1.decode(s);if(3===n.sub.length&&(n=n.sub[2].sub[0]),9===n.sub.length){e=n.sub[1].getHexStringValue(),this.n=he(e,16),i=n.sub[2].getHexStringValue(),this.e=parseInt(i,16);var o=n.sub[3].getHexStringValue();this.d=he(o,16);var h=n.sub[4].getHexStringValue();this.p=he(h,16);var a=n.sub[5].getHexStringValue();this.q=he(a,16);var u=n.sub[6].getHexStringValue();this.dmp1=he(u,16);var c=n.sub[7].getHexStringValue();this.dmq1=he(c,16);var f=n.sub[8].getHexStringValue();this.coeff=he(f,16)}else{if(2!==n.sub.length)return!1;var p=n.sub[1],l=p.sub[0];e=l.sub[0].getHexStringValue(),this.n=he(e,16),i=l.sub[1].getHexStringValue(),this.e=parseInt(i,16)}return!0}catch(d){return!1}},ue.prototype.getPrivateBaseKey=function(){var t={array:[new KJUR.asn1.DERInteger({"int":0}),new KJUR.asn1.DERInteger({bigint:this.n}),new KJUR.asn1.DERInteger({"int":this.e}),new KJUR.asn1.DERInteger({bigint:this.d}),new KJUR.asn1.DERInteger({bigint:this.p}),new KJUR.asn1.DERInteger({bigint:this.q}),new KJUR.asn1.DERInteger({bigint:this.dmp1}),new KJUR.asn1.DERInteger({bigint:this.dmq1}),new KJUR.asn1.DERInteger({bigint:this.coeff})]},e=new KJUR.asn1.DERSequence(t);return e.getEncodedHex()},ue.prototype.getPrivateBaseKeyB64=function(){return be(this.getPrivateBaseKey())},ue.prototype.getPublicBaseKey=function(){var t={array:[new KJUR.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new KJUR.asn1.DERNull]},e=new KJUR.asn1.DERSequence(t);t={array:[new KJUR.asn1.DERInteger({bigint:this.n}),new KJUR.asn1.DERInteger({"int":this.e})]};var i=new KJUR.asn1.DERSequence(t);t={hex:"00"+i.getEncodedHex()};var r=new KJUR.asn1.DERBitString(t);t={array:[e,r]};var s=new KJUR.asn1.DERSequence(t);return s.getEncodedHex()},ue.prototype.getPublicBaseKeyB64=function(){return be(this.getPublicBaseKey())},ue.prototype.wordwrap=function(t,e){if(e=e||64,!t)return t;var i="(.{1,"+e+"})( +|$\n?)|(.{1,"+e+"})";return t.match(RegExp(i,"g")).join("\n")},ue.prototype.getPrivateKey=function(){var t="-----BEGIN RSA PRIVATE KEY-----\n";return t+=this.wordwrap(this.getPrivateBaseKeyB64())+"\n",t+="-----END RSA PRIVATE KEY-----"},ue.prototype.getPublicKey=function(){var t="-----BEGIN PUBLIC KEY-----\n";return t+=this.wordwrap(this.getPublicBaseKeyB64())+"\n",t+="-----END PUBLIC KEY-----"},ue.prototype.hasPublicKeyProperty=function(t){return t=t||{},t.hasOwnProperty("n")&&t.hasOwnProperty("e")},ue.prototype.hasPrivateKeyProperty=function(t){return t=t||{},t.hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")},ue.prototype.parsePropertiesFrom=function(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)};var _e=function(t){ue.call(this),t&&("string"==typeof t?this.parseKey(t):(this.hasPrivateKeyProperty(t)||this.hasPublicKeyProperty(t))&&this.parsePropertiesFrom(t))};_e.prototype=new ue,_e.prototype.constructor=_e;var ze=function(t){t=t||{},this.default_key_size=parseInt(t.default_key_size)||1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null};ze.prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new _e(t)},ze.prototype.setPrivateKey=function(t){this.setKey(t)},ze.prototype.setPublicKey=function(t){this.setKey(t)},ze.prototype.decrypt=function(t){try{return this.getKey().decrypt(Te(t))}catch(e){return!1}},ze.prototype.encrypt=function(t){try{return be(this.getKey().encrypt(t))}catch(e){return!1}},ze.prototype.getKey=function(t){if(!this.key){if(this.key=new _e,t&&"[object Function]"==={}.toString.call(t))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},ze.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},ze.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},ze.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},ze.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},ze.version="2.3.1",t.JSEncrypt=ze});
0 \ No newline at end of file 74 \ No newline at end of file
src/main/resources/static/index.html
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 -<html> 2 +<html lang="zh">
3 <head> 3 <head>
  4 +<meta name="renderer" content="webkit" />
  5 +<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
4 <meta charset="UTF-8"> 6 <meta charset="UTF-8">
5 <title>调度系统</title> 7 <title>调度系统</title>
6 -<meta name=”renderer” content=”webkit”>  
7 -<meta http-equiv=”X-UA-Compatible” content=”IE=Edge,chrome=1″ >  
8 8
9 <meta http-equiv="Pragma" content="no-cache"> 9 <meta http-equiv="Pragma" content="no-cache">
10 <meta http-equiv="Cache-control" content="no-cache"> 10 <meta http-equiv="Cache-control" content="no-cache">
src/main/resources/static/login.html
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 -<html lang="en"> 2 +<html lang="zh">
3 <head> 3 <head>
  4 +<meta name="renderer" content="webkit" />
  5 +<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
4 <meta charset="utf-8" /> 6 <meta charset="utf-8" />
5 <title>登录</title> 7 <title>登录</title>
6 <link 8 <link
@@ -158,10 +160,23 @@ h3.logo-text{ @@ -158,10 +160,23 @@ h3.logo-text{
158 font-family: 华文楷体,华文细黑; 160 font-family: 华文楷体,华文细黑;
159 font-size: 28px; 161 font-size: 28px;
160 } 162 }
  163 +
  164 +.warn-note{
  165 + width: 100%;
  166 + position: absolute;
  167 + top: 0;
  168 + z-index: 2;
  169 + text-align: center;
  170 + background: #ff4646;
  171 + color: white;
  172 + padding: 12px;
  173 + display: none;
  174 +}
161 </style> 175 </style>
162 </head> 176 </head>
163 177
164 <body> 178 <body>
  179 + <div class="warn-note">警告!系统目前仅在 WebKit 内核下完成兼容性测试,请使用 Google Chrome 浏览器进入系统。</div>
165 <div class="wrapper ng-scope"> 180 <div class="wrapper ng-scope">
166 <div id="loginPanel" class="dialog dialog-shadow"> 181 <div id="loginPanel" class="dialog dialog-shadow">
167 <br> 182 <br>
@@ -196,7 +211,7 @@ h3.logo-text{ @@ -196,7 +211,7 @@ h3.logo-text{
196 </form> 211 </form>
197 <br><br> 212 <br><br>
198 <div class="form-actions" > 213 <div class="form-actions" >
199 - <button type="button" class="btn blue-steel" id="loginBtn" disabled="disabled">登录</button> 214 + <button class="btn blue-steel" id="loginBtn" disabled="disabled">登录</button>
200 </div> 215 </div>
201 216
202 <div class="alert alert-danger"></div> 217 <div class="alert alert-danger"></div>
@@ -207,9 +222,13 @@ h3.logo-text{ @@ -207,9 +222,13 @@ h3.logo-text{
207 222
208 <!-- jQuery --> 223 <!-- jQuery -->
209 <script src="/metronic_v4.5.4/plugins/jquery.min.js" ></script> 224 <script src="/metronic_v4.5.4/plugins/jquery.min.js" ></script>
210 -<script src="/assets/plugins/jquery.base64.min.js" ></script>  
211 - 225 +<script src="/assets/plugins/jsencrypt.min.js" ></script>
212 <script> 226 <script>
  227 +window.onload=function(){
  228 + var body=document.getElementsByTagName("body")[0];
  229 + if(typeof body.style.WebkitAnimation=="undefined")
  230 + $('.warn-note').fadeIn();
  231 +}
213 !function(){ 232 !function(){
214 var form = $('#loginPanel form') 233 var form = $('#loginPanel form')
215 ,nameInput = $('input[name=userName]', form) 234 ,nameInput = $('input[name=userName]', form)
@@ -217,6 +236,13 @@ h3.logo-text{ @@ -217,6 +236,13 @@ h3.logo-text{
217 ,msgAlert = $('#loginPanel .alert-danger'); 236 ,msgAlert = $('#loginPanel .alert-danger');
218 237
219 $('input', form).on('keyup', checkBtnStatus); 238 $('input', form).on('keyup', checkBtnStatus);
  239 +
  240 + var keys;
  241 + $.get('/user/login/jCryptionKey', function(data){
  242 + keys = data.publickey;
  243 + });
  244 +
  245 +
220 246
221 function checkBtnStatus(){ 247 function checkBtnStatus(){
222 var es = $('input:visible', form); 248 var es = $('input:visible', form);
@@ -257,8 +283,14 @@ h3.logo-text{ @@ -257,8 +283,14 @@ h3.logo-text{
257 $('#loginBtn').on('click', function(){ 283 $('#loginBtn').on('click', function(){
258 if(lock || $(this).attr('disabled')) return; 284 if(lock || $(this).attr('disabled')) return;
259 var userName = nameInput.val() 285 var userName = nameInput.val()
260 - ,pwd = fourBase64(pwdInput.val()); 286 + ,pwd = pwdInput.val();
261 287
  288 + //RSA加密
  289 + var encrypt = new JSEncrypt();
  290 + encrypt.setPublicKey(keys);
  291 + userName = encrypt.encrypt(userName);
  292 + pwd = encrypt.encrypt(pwd);
  293 + //登录
262 login(userName, pwd); 294 login(userName, pwd);
263 }); 295 });
264 296
@@ -266,6 +298,7 @@ h3.logo-text{ @@ -266,6 +298,7 @@ h3.logo-text{
266 function login(userName, pwd){ 298 function login(userName, pwd){
267 lock = true; 299 lock = true;
268 $('#loginBtn').attr('disabled', 'disabled'); 300 $('#loginBtn').attr('disabled', 'disabled');
  301 +
269 var params = { 302 var params = {
270 userName: userName, 303 userName: userName,
271 password: pwd, 304 password: pwd,
@@ -340,11 +373,6 @@ h3.logo-text{ @@ -340,11 +373,6 @@ h3.logo-text{
340 $(this).attr('src', '/captcha.jpg?t=' + Math.random()); 373 $(this).attr('src', '/captcha.jpg?t=' + Math.random());
341 }); 374 });
342 375
343 - function fourBase64(t){  
344 - var ed = $.base64.encode;  
345 - return ed(ed(ed(ed(t))));  
346 - }  
347 -  
348 function error(rs){ 376 function error(rs){
349 return rs.status == 'ERROR' || rs.status == 500; 377 return rs.status == 'ERROR' || rs.status == 500;
350 } 378 }
src/main/resources/static/pages/control/line/child_pages/child_task.html
@@ -176,7 +176,7 @@ $(function(){ @@ -176,7 +176,7 @@ $(function(){
176 var scheduleIdMap; 176 var scheduleIdMap;
177 177
178 //滚动时固定表头 178 //滚动时固定表头
179 - $('.custom-table-panel').on('scroll', function(){ 179 + $('#childTaskDiv .custom-table-panel').on('scroll', function(){
180 var top = $(this).scrollTop() 180 var top = $(this).scrollTop()
181 ,$header = $(this).find('.custom-table-header'); 181 ,$header = $(this).find('.custom-table-header');
182 $header.css('top', top); 182 $header.css('top', top);
src/main/resources/static/pages/control/line/css/lineControl.css
@@ -267,8 +267,8 @@ body{ @@ -267,8 +267,8 @@ body{
267 } 267 }
268 268
269 .portlet-fullscreen .nav-tabs > li > a:hover 269 .portlet-fullscreen .nav-tabs > li > a:hover
270 -,.portlet-fullscreen .nav-tabs > li > a:active{  
271 - border: none; 270 +/* ,.portlet-fullscreen .nav-tabs > li > a:active */{
  271 + border: none;
272 background: #0E5384; 272 background: #0E5384;
273 } 273 }
274 274
@@ -279,10 +279,11 @@ body{ @@ -279,10 +279,11 @@ body{
279 .portlet-fullscreen .nav-tabs>li.active>a{ 279 .portlet-fullscreen .nav-tabs>li.active>a{
280 background: #FFFFFF; 280 background: #FFFFFF;
281 color: #0A3F64; 281 color: #0A3F64;
282 - border: 1px solid #FFFFFF; 282 + border: none;
283 border-radius: 5px 5px 0 0 !important; 283 border-radius: 5px 5px 0 0 !important;
284 } 284 }
285 285
  286 +
286 .portlet-fullscreen .nav-tabs { 287 .portlet-fullscreen .nav-tabs {
287 /* border-bottom: 1px solid #337AB7; */ 288 /* border-bottom: 1px solid #337AB7; */
288 } 289 }
@@ -397,7 +398,7 @@ body{ @@ -397,7 +398,7 @@ body{
397 .card_wrap .line_chart .top .center{ 398 .card_wrap .line_chart .top .center{
398 height: 100%; 399 height: 100%;
399 font-size: 15px; 400 font-size: 15px;
400 - color: #5E96D2; 401 + color: #babdbd;
401 padding: 10px 0px; 402 padding: 10px 0px;
402 width: auto; 403 width: auto;
403 float: left; 404 float: left;
@@ -644,16 +645,24 @@ body{ @@ -644,16 +645,24 @@ body{
644 height: 25px; 645 height: 25px;
645 fill: rgba(253, 253, 253, 0.17); 646 fill: rgba(253, 253, 253, 0.17);
646 rx: 5px; 647 rx: 5px;
647 - stroke: #26c281;  
648 } 648 }
649 649
650 .vehci-g.up text, 650 .vehci-g.up text,
651 .vehci-g.down text{ 651 .vehci-g.down text{
652 - stroke: #26c281;  
653 font-size: 12px; 652 font-size: 12px;
654 cursor: default; 653 cursor: default;
655 } 654 }
656 655
  656 +.vehci-g.up text,
  657 +.vehci-g.up rect{
  658 + stroke: #337ac4;
  659 +}
  660 +
  661 +.vehci-g.down text,
  662 +.vehci-g.down rect{
  663 + stroke: #e43a45;
  664 +}
  665 +
657 .vehci-g.updown-error rect, 666 .vehci-g.updown-error rect,
658 .vehci-g.updown-error text{ 667 .vehci-g.updown-error text{
659 stroke: #CACA17; 668 stroke: #CACA17;
@@ -1035,7 +1044,8 @@ height: 400px; @@ -1035,7 +1044,8 @@ height: 400px;
1035 } 1044 }
1036 1045
1037 .station_text { 1046 .station_text {
1038 - letter-spacing: -2.6px; 1047 + /* letter-spacing: -2.6px; */
  1048 + font-family: 华文细黑,华文黑体,宋体;
1039 } 1049 }
1040 } 1050 }
1041 1051
@@ -1577,7 +1587,11 @@ height: 400px; @@ -1577,7 +1587,11 @@ height: 400px;
1577 ::-webkit-scrollbar { 1587 ::-webkit-scrollbar {
1578 width: 15px; 1588 width: 15px;
1579 height: 16px; 1589 height: 16px;
1580 -} 1590 +}
  1591 +
  1592 +#tab_home .custom-table-panel::-webkit-scrollbar{
  1593 + border-top: 1px solid #e7ecf1;
  1594 +}
1581 1595
1582 ::-webkit-scrollbar-track, 1596 ::-webkit-scrollbar-track,
1583 ::-webkit-scrollbar-thumb { 1597 ::-webkit-scrollbar-thumb {
@@ -2588,4 +2602,65 @@ tr.child_task td:nth-child(1):AFTER{ @@ -2588,4 +2602,65 @@ tr.child_task td:nth-child(1):AFTER{
2588 font-size: 10px; 2602 font-size: 10px;
2589 color: #bdbdbd; 2603 color: #bdbdbd;
2590 margin-left: 3px; 2604 margin-left: 3px;
  2605 +}
  2606 +
  2607 +.card_wrap .custom-table-panel{
  2608 + height: calc(100% - 40px);
  2609 +}
  2610 +
  2611 +#tab_home .card_wrap table tr td{
  2612 + white-space: nowrap;
  2613 + overflow: hidden;
  2614 + text-overflow: ellipsis;
  2615 + cursor: pointer;
  2616 +}
  2617 +.sm-text{
  2618 + font-size: 12px;
  2619 + color: #9a9a9a;
  2620 +}
  2621 +
  2622 +td.lt-no-data{
  2623 + text-align: left;
  2624 + font-size: 12px !important;
  2625 + color: #ff7676;
  2626 + text-indent: 8px;
  2627 +}
  2628 +
  2629 +tr._home_tr_active td.lt-no-data{
  2630 + color: #ffffff;
  2631 +}
  2632 +
  2633 +tr._home_tr_active {
  2634 + background: #6a96c5;
  2635 + color: #ffffff;
  2636 +}
  2637 +
  2638 +tr._home_tr_active .sm-text{
  2639 + color: #ded8d8;
  2640 +}
  2641 +
  2642 +abbr.abnormal{
  2643 + color: red;
  2644 +}
  2645 +
  2646 +tr._home_tr_active abbr.abnormal{
  2647 + color: #ffffff;
  2648 +}
  2649 +
  2650 +.line_chart:BEFORE {
  2651 + content: "\f178";
  2652 + font: normal normal normal 14px/1 FontAwesome;
  2653 + position: absolute;
  2654 + top: 20px;
  2655 + left: 20px;
  2656 + color: #d0d0d0;
  2657 +}
  2658 +
  2659 +.line_chart:AFTER {
  2660 + content: "\f177";
  2661 + font: normal normal normal 14px/1 FontAwesome;
  2662 + position: absolute;
  2663 + bottom: 20px;
  2664 + right: 20px;
  2665 + color: #d0d0d0;
2591 } 2666 }
2592 \ No newline at end of file 2667 \ No newline at end of file
src/main/resources/static/pages/control/line/index.html
@@ -25,11 +25,39 @@ @@ -25,11 +25,39 @@
25 </div> 25 </div>
26 <div class="actions col_hide_1280" > 26 <div class="actions col_hide_1280" >
27 <div class="btn-group"> 27 <div class="btn-group">
28 - <button type="button" class="btn btn-default" id="deviceReport">  
29 - <i class="fa fa-code-fork"></i> 设备上报</button>  
30 -  
31 - <button type="button" class="btn btn-default" id="msgAndDirect">  
32 - <i class="fa fa-bell"></i> 调度指令</button> 28 +
  29 + <div class="btn-group">
  30 + <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" >
  31 + <i class="fa fa-database"></i> &nbsp;基础数据
  32 + <i class="fa fa-angle-down"></i>
  33 + </button>
  34 + <ul class="dropdown-menu">
  35 + <li>
  36 + <a href="javascript:;" id=""> 车辆配置 </a>
  37 + </li>
  38 + <li>
  39 + <a href="javascript:;" id=""> 人员配置 </a>
  40 + </li>
  41 + </ul>
  42 + </div>
  43 +
  44 + <div class="btn-group">
  45 + <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" >
  46 + <i class="fa fa-bus"></i> &nbsp;车载设备
  47 + <i class="fa fa-angle-down"></i>
  48 + </button>
  49 + <ul class="dropdown-menu">
  50 + <li>
  51 + <a href="javascript:;" id="deviceConfig"> 设备管理 </a>
  52 + </li>
  53 + <li>
  54 + <a href="javascript:;" id="deviceReport"> 设备上报记录 </a>
  55 + </li>
  56 + <li>
  57 + <a href="javascript:;" id="msgAndDirect"> 指令下发记录 </a>
  58 + </li>
  59 + </ul>
  60 + </div>
33 61
34 <div class="btn-group"> 62 <div class="btn-group">
35 <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" > 63 <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" >
@@ -174,7 +202,7 @@ @@ -174,7 +202,7 @@
174 </li> 202 </li>
175 <li class="menu-item submenu"> 203 <li class="menu-item submenu">
176 <button type="button" class="menu-btn"> 204 <button type="button" class="menu-btn">
177 - <span class="menu-text">车辆状态发送</span> 205 + <span class="menu-text">车辆状态切换</span>
178 </button> 206 </button>
179 <menu class="menu"> 207 <menu class="menu">
180 <li class="menu-item"> 208 <li class="menu-item">
src/main/resources/static/pages/control/line/js/data.js
@@ -9,7 +9,7 @@ var _data = (function(){ @@ -9,7 +9,7 @@ var _data = (function(){
9 //实时GPS数据 9 //实时GPS数据
10 var allGps = {}; 10 var allGps = {};
11 //10秒刷新一次实时GPS 11 //10秒刷新一次实时GPS
12 - var realGpsT = 1000 * 10; 12 + var realGpsT = 1000 * 8;
13 13
14 var dateStr = moment().format('YYYY-MM-DD'); 14 var dateStr = moment().format('YYYY-MM-DD');
15 //实际排班 15 //实际排班
@@ -33,26 +33,6 @@ var _data = (function(){ @@ -33,26 +33,6 @@ var _data = (function(){
33 } 33 }
34 34
35 var dataObject = { 35 var dataObject = {
36 - /*//班次发车  
37 - setFcsj: function(schId, fcsj, fcsjT){  
38 - schedules[schId].fcsjActual = fcsj;  
39 - schedules[schId].fcsjActualTime = fcsjT;  
40 - },*/  
41 - //根据线路编码获取上行和下行班次  
42 - /*findByLineAll: function(xlbm){  
43 - var array = [],sch;  
44 - for(var id in schedules){  
45 - sch = schedules[id];  
46 - if(sch.xlBm == xlbm)  
47 - array.push(e);  
48 - }  
49 - //排序  
50 - array.sort(function(a, b){  
51 - return a.fcsjT - b.fcsjT;  
52 - });  
53 -  
54 - return array;  
55 - },*/  
56 //根据线路和上下行获取计划排班 36 //根据线路和上下行获取计划排班
57 findSchByLine: function(xlbm, upDown){ 37 findSchByLine: function(xlbm, upDown){
58 var array = []; 38 var array = [];
@@ -160,14 +140,10 @@ var _data = (function(){ @@ -160,14 +140,10 @@ var _data = (function(){
160 attachSchedulInfo: function(gpsArray){ 140 attachSchedulInfo: function(gpsArray){
161 $.each(gpsArray, function(){ 141 $.each(gpsArray, function(){
162 gps = this; 142 gps = this;
163 - if(gps.currSchId)  
164 - gps.currSch = schedules[gps.currSchId];  
165 - if(gps.nextSchId)  
166 - gps.nextSch = schedules[gps.nextSchId]; 143 + if(gps.schId)
  144 + gps.sch = schedules[gps.schId];
167 145
168 }); 146 });
169 -  
170 - return gpsArray;  
171 } 147 }
172 //查询站点路由 148 //查询站点路由
173 ,queryStationRoute : function(lineId,container, cb, width){ 149 ,queryStationRoute : function(lineId,container, cb, width){
@@ -273,8 +249,9 @@ var _data = (function(){ @@ -273,8 +249,9 @@ var _data = (function(){
273 } 249 }
274 250
275 function refreshGpsProxy(){ 251 function refreshGpsProxy(){
276 - refreshGps(function(add, up){  
277 - $('#tab_home,#tab_map #mapContainer').trigger('gps_refresh', [add, up]); 252 + refreshGps(function(all){
  253 + //触发元素刷新事件
  254 + $('#tab_home,#tab_map #mapContainer').trigger('gps_refresh', [all]);
278 }); 255 });
279 } 256 }
280 var upSort = function(a, b){ 257 var upSort = function(a, b){
@@ -316,22 +293,49 @@ var _data = (function(){ @@ -316,22 +293,49 @@ var _data = (function(){
316 if(!gpsList || gpsList.length == 0) 293 if(!gpsList || gpsList.length == 0)
317 return; 294 return;
318 295
319 - var prve = allGps  
320 - ,addArray = []  
321 - ,upArray = []  
322 - ,oldGps; 296 + //var prve = allGps
  297 + //,addArray = []
  298 + //,upArray = []
  299 + // ,oldGps;
323 for(var i = 0, gps; gps=gpsList[i++];){ 300 for(var i = 0, gps; gps=gpsList[i++];){
324 - oldGps = prve[gps.deviceId]; 301 + /*oldGps = prve[gps.deviceId];
325 if(!oldGps){ 302 if(!oldGps){
326 addArray.push(gps); 303 addArray.push(gps);
327 } 304 }
328 else if(gps.timestamp > oldGps.timestamp){ 305 else if(gps.timestamp > oldGps.timestamp){
329 //更新 306 //更新
330 upArray.push(gps); 307 upArray.push(gps);
331 - } 308 + }*/
  309 + //addArray.push(gps);
  310 +/* if(prve[gps.deviceId] &&
  311 + gps.timestamp == prve[gps.deviceId].timestamp)
  312 + continue;*/
  313 + //异常状态检查
  314 + abnormalCheck(gps);
  315 + //关联班次信息
  316 + if(gps.schId)
  317 + gps.sch = schedules[gps.schId];
  318 +
332 allGps[gps.deviceId] = gps; 319 allGps[gps.deviceId] = gps;
333 } 320 }
334 - cb && cb(addArray, upArray); 321 + //cb && cb(addArray, upArray);
  322 + cb && cb(allGps);
  323 + }
  324 +
  325 + function abnormalCheck(gps){
  326 + var routes = stationRoute[gps.lineId][gps.upDown]
  327 + ,rs;
  328 + $.each(routes , function(){
  329 + if(this.stationCode == gps.stopNo){
  330 + rs = 1;
  331 + return false;
  332 + }
  333 + });
  334 +
  335 + if(!rs){
  336 + gps.abnormal = true;
  337 + gps.abnormalText = '走向异常?';
  338 + }
335 } 339 }
336 340
337 function getGpsError(jqXHR, textStatus){ 341 function getGpsError(jqXHR, textStatus){
src/main/resources/static/pages/control/line/js/drawSvg.js
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 var drawSvg = (function(){ 5 var drawSvg = (function(){
6 6
7 var mt = 44//顶部距离 7 var mt = 44//顶部距离
8 - ,p = 112//上下行之间的间隔 132 8 + ,p = 116//上下行之间的间隔
9 ,x = d3.scale.linear() 9 ,x = d3.scale.linear()
10 ,w 10 ,w
11 ,homeSvgMapp = {} 11 ,homeSvgMapp = {}
@@ -69,12 +69,14 @@ var drawSvg = (function(){ @@ -69,12 +69,14 @@ var drawSvg = (function(){
69 init: function(lineId, data, container, w, mtop){ 69 init: function(lineId, data, container, w, mtop){
70 if(!data || data.length == 0) 70 if(!data || data.length == 0)
71 return; 71 return;
72 - 72 +
73 mt = mtop; 73 mt = mtop;
74 - //起终点站 74 + //索引起终点站
75 $.each(data, function(){ 75 $.each(data, function(){
76 - if(this.stationMark == 'B' || this.stationMark == 'E' ) 76 + if(this.stationMark == 'B' || this.stationMark == 'E' ){
77 seGps[lineId + '_' + this.id[0]] = []; 77 seGps[lineId + '_' + this.id[0]] = [];
  78 + seGps[lineId + '_' + this.id[1]] = [];
  79 + }
78 }); 80 });
79 81
80 var svg = d3.select('#' + container).append('svg') 82 var svg = d3.select('#' + container).append('svg')
@@ -94,22 +96,6 @@ var drawSvg = (function(){ @@ -94,22 +96,6 @@ var drawSvg = (function(){
94 //下行线条 96 //下行线条
95 drawPath(svg, data, 'down', 10); 97 drawPath(svg, data, 'down', 10);
96 98
97 -/* //左弧线 path  
98 - svg.append('path')  
99 - .attr('d', function(){  
100 - var cx = x(0) - 8;  
101 - return arcPath(cx , mt + 5,cx - 20);  
102 - })  
103 - .attr('class', 'up_path arc');  
104 -  
105 - //右弧线 path  
106 - svg.append('path')  
107 - .attr('d', function(){  
108 - var cx = x(dLen - 1) + 8;  
109 - return arcPath(cx , mt + 5,cx + 20);  
110 - })  
111 - .attr('class', 'down_path arc');*/  
112 -  
113 var g = svg.append('g').selectAll('g') 99 var g = svg.append('g').selectAll('g')
114 .data(data) 100 .data(data)
115 .enter() 101 .enter()
@@ -183,12 +169,11 @@ var drawSvg = (function(){ @@ -183,12 +169,11 @@ var drawSvg = (function(){
183 if(!gpsArray || gpsArray.length == 0) 169 if(!gpsArray || gpsArray.length == 0)
184 return; 170 return;
185 171
186 - //console.log('len', gpsArray.length);  
187 //暂时先清空重新画 172 //暂时先清空重新画
188 var fGps = gpsArray[0]; 173 var fGps = gpsArray[0];
189 var hSvg = homeSvgMapp[fGps.lineId] 174 var hSvg = homeSvgMapp[fGps.lineId]
190 ,aSvg = aloneSvgMapp[fGps.lineId]; 175 ,aSvg = aloneSvgMapp[fGps.lineId];
191 - //svg.selectAll('.vehci-g').remove(); 176 +
192 if(fGps.upDown == 0){ 177 if(fGps.upDown == 0){
193 hSvg.selectAll('.vehci-g.up').remove(); 178 hSvg.selectAll('.vehci-g.up').remove();
194 hSvg.selectAll('.start.park').remove(); 179 hSvg.selectAll('.start.park').remove();
@@ -205,8 +190,9 @@ var drawSvg = (function(){ @@ -205,8 +190,9 @@ var drawSvg = (function(){
205 } 190 }
206 191
207 for(var i = 0, gps; gps = gpsArray[i ++];){ 192 for(var i = 0, gps; gps = gpsArray[i ++];){
  193 + //首页svg
208 drawGpsToSvg(gps, hSvg); 194 drawGpsToSvg(gps, hSvg);
209 - 195 + //单线路svg
210 drawGpsToSvg(gps, aSvg, true); 196 drawGpsToSvg(gps, aSvg, true);
211 } 197 }
212 198
@@ -215,25 +201,28 @@ var drawSvg = (function(){ @@ -215,25 +201,28 @@ var drawSvg = (function(){
215 for(var eid in seGps){ 201 for(var eid in seGps){
216 len = seGps[eid].length; 202 len = seGps[eid].length;
217 if(len > 0){ 203 if(len > 0){
218 - var a_e = $('#' + eid, aSvg[0])  
219 - ,a_x = parseInt(a_e.attr('cx'))  
220 - ,a_y = parseInt(a_e.attr('cy'));  
221 - tempStartAndStop(aSvg, eid, a_e, a_x, a_y);  
222 - 204 + //首页svg
223 var h_e = $('#' + eid, hSvg[0]) 205 var h_e = $('#' + eid, hSvg[0])
224 ,h_x = parseInt(h_e.attr('cx')) 206 ,h_x = parseInt(h_e.attr('cx'))
225 ,h_y = parseInt(h_e.attr('cy')); 207 ,h_y = parseInt(h_e.attr('cy'));
226 tempStartAndStop(hSvg, eid ,h_e , h_x, h_y); 208 tempStartAndStop(hSvg, eid ,h_e , h_x, h_y);
  209 + //单线路svg
  210 + var a_e = $('#' + eid, aSvg[0])
  211 + ,a_x = parseInt(a_e.attr('cx'))
  212 + ,a_y = parseInt(a_e.attr('cy'));
  213 + tempStartAndStop(aSvg, eid, a_e, a_x, a_y);
227 } 214 }
228 } 215 }
229 216
230 function tempStartAndStop(svg, eid, e, x, y){ 217 function tempStartAndStop(svg, eid, e, x, y){
  218 + var se = e.attr('class').indexOf('start') != -1?'start':'end';
231 219
232 - var gs = svg.append('g').classed({'start': e.attr('class').indexOf('start') != -1, 'park': true}) 220 + var gs = svg.append('g').attr('class', se + ' park')
233 .selectAll('g').data(seGps[eid]).enter().append('g'); 221 .selectAll('g').data(seGps[eid]).enter().append('g');
234 222
  223 +
235 //Y轴居中 224 //Y轴居中
236 - y = (y + 66) - len * 13; 225 + //y = (y + 66) - len * 13;
237 gs.append('rect') 226 gs.append('rect')
238 .attr('x', x + 15) 227 .attr('x', x + 15)
239 .attr('y', function(d, i){ 228 .attr('y', function(d, i){
@@ -297,6 +286,7 @@ var drawSvg = (function(){ @@ -297,6 +286,7 @@ var drawSvg = (function(){
297 } 286 }
298 }; 287 };
299 288
  289 + //flag 2张svg , 起终点只画一次
300 function drawGpsToSvg(gps, svg, flag){ 290 function drawGpsToSvg(gps, svg, flag){
301 var stionId = gps.lineId + '_' + gps.stopNo 291 var stionId = gps.lineId + '_' + gps.stopNo
302 ,station = $('#' + stionId, svg[0])/* 292 ,station = $('#' + stionId, svg[0])/*
src/main/resources/static/pages/control/line/js/home.js
@@ -35,10 +35,17 @@ var _home = (function() { @@ -35,10 +35,17 @@ var _home = (function() {
35 $('.card_wrap').css('height', ah / 3); 35 $('.card_wrap').css('height', ah / 3);
36 36
37 // 滚动条 37 // 滚动条
38 - $('.card_wrap .table_wrap').slimscroll({ 38 + /*$('.card_wrap .table_wrap').slimscroll({
39 height : '187px', 39 height : '187px',
40 alwaysVisible : true, 40 alwaysVisible : true,
41 opacity : .8 41 opacity : .8
  42 + });*/
  43 +
  44 + //table 滚动时固定表头
  45 + $('#tab_home .custom-table-panel').on('scroll', function(){
  46 + var top = $(this).scrollTop()
  47 + ,$header = $(this).find('.custom-table-header');
  48 + $header.css('top', top);
42 }); 49 });
43 50
44 // SVG线路图 51 // SVG线路图
@@ -54,19 +61,20 @@ var _home = (function() { @@ -54,19 +61,20 @@ var _home = (function() {
54 // 模拟图GPS刷新事件 61 // 模拟图GPS刷新事件
55 $('#tab_home').on( 62 $('#tab_home').on(
56 'gps_refresh', 63 'gps_refresh',
57 - function(e, add, up) { 64 + function(e, allGps) {
58 // 现在先每次全量画 65 // 现在先每次全量画
59 - var list = _data.findAllGps();  
60 - _data.attachSchedulInfo(list); 66 + //var list = _data.findAllGps();
  67 + //allGps = _data.attachSchedulInfo(allGps);
61 68
62 // drawSvg.drawVehicle(list); 69 // drawSvg.drawVehicle(list);
63 // 按线路分组 70 // 按线路分组
64 - var listMap = groupByLine(list);  
65 - 71 + var listMap = groupByLine(allGps);
  72 +
66 for ( var key in listMap) { 73 for ( var key in listMap) {
67 var htmlStr = template('home_table_temp', { 74 var htmlStr = template('home_table_temp', {
68 list : listMap[key] 75 list : listMap[key]
69 }); 76 });
  77 + //表格
70 $('#tab_' + key).find('tbody').html(htmlStr); 78 $('#tab_' + key).find('tbody').html(htmlStr);
71 // 更新badge 79 // 更新badge
72 $('#' + key + '_badge').text( 80 $('#' + key + '_badge').text(
@@ -84,7 +92,7 @@ var _home = (function() { @@ -84,7 +92,7 @@ var _home = (function() {
84 $('.load-anim').fadeOut(800); 92 $('.load-anim').fadeOut(800);
85 $('menu.menu').show(); 93 $('menu.menu').show();
86 }, 400); 94 }, 400);
87 - 95 +/*
88 setTimeout(function() { 96 setTimeout(function() {
89 // 提示文本 97 // 提示文本
90 var promptFlag = storage.getItem('promptFlag_0913'); 98 var promptFlag = storage.getItem('promptFlag_0913');
@@ -97,7 +105,7 @@ var _home = (function() { @@ -97,7 +105,7 @@ var _home = (function() {
97 storage.setItem('promptFlag_0913', 1); 105 storage.setItem('promptFlag_0913', 1);
98 } 106 }
99 }, 1500); 107 }, 1500);
100 - } 108 +*/ }
101 } 109 }
102 110
103 function gpslistToMap(gpslist){ 111 function gpslistToMap(gpslist){
@@ -117,10 +125,23 @@ var _home = (function() { @@ -117,10 +125,23 @@ var _home = (function() {
117 125
118 rs[key].push(this); 126 rs[key].push(this);
119 }); 127 });
  128 +
  129 + //排序
  130 + for(var k in rs){
  131 + rs[k].sort(gpsSort);
  132 + }
120 return rs; 133 return rs;
121 } 134 }
122 135
123 - 136 + function gpsSort(a, b){
  137 + if(!a.expectStopTime)
  138 + return 1;
  139 + if(!b.expectStopTime)
  140 + return 0;
  141 +
  142 + return a.expectStopTime - b.expectStopTime;
  143 + }
  144 +
124 countDown('home.js'); 145 countDown('home.js');
125 return homeObject; 146 return homeObject;
126 })(); 147 })();
127 \ No newline at end of file 148 \ No newline at end of file
src/main/resources/static/pages/control/line/js/homeMenu.js
@@ -34,7 +34,12 @@ var _home_menu = (function(){ @@ -34,7 +34,12 @@ var _home_menu = (function(){
34 $('#homeMenu').removeClass('show-menu'); 34 $('#homeMenu').removeClass('show-menu');
35 }); 35 });
36 }); 36 });
37 - 37 + //点击选中
  38 + $('.portlet-fullscreen').on('click', '.vehicDataTable tr td', function(e){
  39 + e.preventDefault();
  40 + $('.vehicDataTable tr._home_tr_active').removeClass('_home_tr_active');
  41 + $(this).parent().addClass('_home_tr_active');
  42 + });
38 43
39 function showMenu(x, y) { 44 function showMenu(x, y) {
40 var menu = $('#homeMenu'), 45 var menu = $('#homeMenu'),
src/main/resources/static/pages/control/line/js/main.js
1 var _main = (function(){ 1 var _main = (function(){
2 -  
3 -/*setTimeout(function(){  
4 - //生成头部选项卡  
5 - var topTabs = '', tabPanels = '';  
6 - $.each(_data.getLines(), function(i, line){  
7 - topTabs += '<li ><a data-id="'+line.lineCode+'" href="#tab_line_'+line.lineCode+'" data-toggle="tab" '+  
8 - 'aria-expanded="false"> '+line.name+'<span>(<zz>0</zz>,<zz>0</zz> <zz>托管</zz>)</span> </a></li>';  
9 -  
10 - tabPanels += '<div class="tab-pane fade tab_line" data-id="'+line.lineCode+'" id="tab_line_'+line.lineCode+'"></div>';  
11 -  
12 - });  
13 - $('#top-tabs-wrap .nav-tabs').append(topTabs);  
14 - $('#top-tabs-wrap .tab-content').append(tabPanels);  
15 -  
16 - //加载地图页数据  
17 - $('#tab_map').load('/pages/mapmonitor/real/real.html');  
18 -  
19 - //初始化单线路调度页面  
20 - _alone.init(function(){  
21 - //初始化信使  
22 - _messenger.init();  
23 - //初始化主页  
24 - homeObject.init();  
25 -  
26 - $.each(_data.getLines(), function(){  
27 - //计算应发未发数量  
28 - _messenger.setYFWFNum(this.lineCode);  
29 - });  
30 - });  
31 -  
32 - //监控模式下,拦截post请求  
33 - if(operationMode == 0){  
34 - $(document).on('ajaxSend', interceptPOST);  
35 - }  
36 -  
37 -}, 200)*/  
38 2
39 -  
40 - /*var startEp = EventProxy.create("template", function (template, data, l10n) {  
41 - _.template(template, data, l10n);  
42 - });*/  
43 var initEp; 3 var initEp;
44 var mainInstance = { 4 var mainInstance = {
45 start: function(){ 5 start: function(){
src/main/resources/static/pages/control/line/temps/home_tp.html
@@ -27,26 +27,42 @@ @@ -27,26 +27,42 @@
27 27
28 </div> 28 </div>
29 </div> 29 </div>
30 - <table class="table table-striped table-bordered table-advance"  
31 - style="table-layout: fixed;">  
32 - <thead>  
33 - <tr>  
34 - <th style="width: 22%;">车辆编码</th>  
35 - <th style="width: 17%;">路牌</th>  
36 - <th style="width: 17%;">速度</th>  
37 - <th style="width: 22%;">终点时间</th>  
38 - <th style="width: 22%;" class="col_hide_1680">下一班</th>  
39 - </tr>  
40 - </thead>  
41 - </table>  
42 - <div class="table_wrap">  
43 - <table  
44 - class="table table-striped table-bordered table-advance table-hover vehicDataTable"  
45 - style="table-layout: fixed;" id="tab_{{lineObj.lineCode}}_0">  
46 - <tbody>  
47 - </tbody>  
48 - </table> 30 + <div class="custom-table-panel">
  31 + <div style="height: 33px;position: relative;">
  32 + <div class="custom-table-header" style="min-width: 700px;">
  33 + <table class="table table-bordered table-advance" >
  34 + <thead>
  35 + <tr>
  36 + <th width="14%">车辆编码</th>
  37 + <th width="8%">速度</th>
  38 + <th width="14%">终点时间</th>
  39 + <th width="16%">当前站点</th>
  40 + <th width="16%">终点站</th>
  41 + <th width="11%">计划终点</th>
  42 + <th width="10%">驾驶员</th>
  43 + <th width="10%">售票员</th>
  44 + </tr>
  45 + </thead>
  46 + </table>
  47 + </div>
  48 + </div>
  49 + <div class="custom-table-body" style="min-width: 700px;">
  50 + <table class="table table-bordered vehicDataTable" id="tab_{{lineObj.lineCode}}_0">
  51 + <colgroup>
  52 + <col width="14%"></col>
  53 + <col width="8%"></col>
  54 + <col width="14%"></col>
  55 + <col width="16%"></col>
  56 + <col width="16%"></col>
  57 + <col width="11%"></col>
  58 + <col width="10%"></col>
  59 + <col width="10%"></col>
  60 + </colgroup>
  61 + <tbody></tbody>
  62 + </table>
  63 + </div>
49 </div> 64 </div>
  65 +
50 </div> 66 </div>
51 <div class="col-lg-8 line_chart" id="line_chart_{{lineObj.lineCode}}"> 67 <div class="col-lg-8 line_chart" id="line_chart_{{lineObj.lineCode}}">
52 <div class="top"> 68 <div class="top">
@@ -74,25 +90,40 @@ @@ -74,25 +90,40 @@
74 </ul>--> 90 </ul>-->
75 </div> 91 </div>
76 </div> 92 </div>
77 - <table class="table table-striped table-bordered table-advance"  
78 - style="table-layout: fixed;">  
79 - <thead>  
80 - <tr>  
81 - <th style="width: 22%;">车辆编码</th>  
82 - <th style="width: 17%;">路牌</th>  
83 - <th style="width: 17%;">速度</th>  
84 - <th style="width: 22%;">终点时间</th>  
85 - <th style="width: 22%;" class="col_hide_1680">下一班</th>  
86 - </tr>  
87 - </thead>  
88 - </table>  
89 - <div class="table_wrap">  
90 - <table  
91 - class="table table-striped table-bordered table-advance table-hover vehicDataTable"  
92 - style="table-layout: fixed;" id="tab_{{lineObj.lineCode}}_1">  
93 - <tbody>  
94 - </tbody>  
95 - </table> 93 + <div class="custom-table-panel">
  94 + <div style="height: 33px;position: relative;">
  95 + <div class="custom-table-header" style="min-width: 700px;">
  96 + <table class="table table-bordered table-advance" >
  97 + <thead>
  98 + <tr>
  99 + <th width="14%">车辆编码</th>
  100 + <th width="8%">速度</th>
  101 + <th width="14%">终点时间</th>
  102 + <th width="16%">当前站点</th>
  103 + <th width="16%">终点站</th>
  104 + <th width="11%">计划终点</th>
  105 + <th width="10%">驾驶员</th>
  106 + <th width="10%">售票员</th>
  107 + </tr>
  108 + </thead>
  109 + </table>
  110 + </div>
  111 + </div>
  112 + <div class="custom-table-body" style="min-width: 700px;">
  113 + <table class="table table-bordered vehicDataTable" id="tab_{{lineObj.lineCode}}_1">
  114 + <colgroup>
  115 + <col width="14%"></col>
  116 + <col width="8%"></col>
  117 + <col width="14%"></col>
  118 + <col width="16%"></col>
  119 + <col width="16%"></col>
  120 + <col width="11%"></col>
  121 + <col width="10%"></col>
  122 + <col width="10%"></col>
  123 + </colgroup>
  124 + <tbody></tbody>
  125 + </table>
  126 + </div>
96 </div> 127 </div>
97 </div> 128 </div>
98 </div> 129 </div>
@@ -122,23 +153,30 @@ @@ -122,23 +153,30 @@
122 <script id="home_table_temp" type="text/html"> 153 <script id="home_table_temp" type="text/html">
123 {{each list as obj i}} 154 {{each list as obj i}}
124 <tr data-nbbm="{{obj.nbbm}}" data-device="{{obj.deviceId}}"> 155 <tr data-nbbm="{{obj.nbbm}}" data-device="{{obj.deviceId}}">
125 - <td style="width: 22%;"> {{obj.nbbm}} </td>  
126 - <td style="width: 17%;">  
127 - {{if obj.currSch != null}}  
128 - {{obj.currSch.lpName}} 156 + <td title="{{obj.nbbm}}">
  157 + {{if !obj.abnormal}}
  158 + {{obj.nbbm}}
  159 + {{else}}
  160 + <abbr class="abnormal" title="{{obj.abnormalText}}">{{obj.nbbm}}</abbr>
  161 + {{/if}}
  162 + </td>
  163 + <td> {{obj.speed}} </td>
  164 + <td>
  165 + {{if obj.expectStopTime != null}}
  166 + {{obj.expectStopTime}} <span class="sm-text">分钟</span>
129 {{else}} 167 {{else}}
130 - 168 + <span class="sm-text">无</span>
131 {{/if}} 169 {{/if}}
132 </td> 170 </td>
133 - <td style="width: 17%;"> {{obj.speed}} </td>  
134 - <td style="width: 22%;" > 暂无 </td>  
135 - <td style="width: 22%;" class="col_hide_1680">  
136 -{{if obj.nextSch != null}}  
137 - {{obj.nextSch.dfsj}}  
138 -{{else}}  
139 - 无  
140 -{{/if}}  
141 - </td> 171 + <td title="{{obj.stationName}}"> {{obj.stationName}} </td>
  172 + {{if obj.sch != null}}
  173 + <td title="{{obj.sch.zdzName}}"> {{obj.sch.zdzName}} </td>
  174 + <td>{{obj.sch.zdsj}}</td>
  175 + <td> {{obj.sch.jName}} </td>
  176 + <td> {{obj.sch.sName}} </td>
  177 + {{else}}
  178 + <td colspan=4 class="lt-no-data">无班次信息</td>
  179 + {{/if}}
142 </tr> 180 </tr>
143 {{/each}} 181 {{/each}}
144 </script> 182 </script>
src/main/resources/static/pages/control/line/temps/tooltip_tp.html
@@ -9,14 +9,7 @@ @@ -9,14 +9,7 @@
9 <div><a href="javascript:;" data-for="station" class="tip_modal">{{stationName}}</a></div> 9 <div><a href="javascript:;" data-for="station" class="tip_modal">{{stationName}}</a></div>
10 <div>速度:{{speed}}</div> 10 <div>速度:{{speed}}</div>
11 <hr > 11 <hr >
12 - <div>预计 ? 分钟后到达<a href="javascript:;" data-for="station" class="tip_modal">下一站</a></div>  
13 - <div>终点站:  
14 - <a href="javascript:;" data-for="station" >  
15 - {{if currSch != null}}  
16 - {{currSch.zdzName}}  
17 - {{/if}}  
18 -  
19 - </a></div> 12 + <div>预计 {{expectStopTime}} 分钟到达终点</div>
20 <hr > 13 <hr >
21 <div class="subtitle">{{fromNow}}更新(在线)</div> 14 <div class="subtitle">{{fromNow}}更新(在线)</div>
22 <div class="subtitle" style="margin-top: 8px;"> 15 <div class="subtitle" style="margin-top: 8px;">
src/main/resources/static/pages/forecast/sample/css/main.css
@@ -311,4 +311,16 @@ rect.f_rect{ @@ -311,4 +311,16 @@ rect.f_rect{
311 overflow-x: hidden; 311 overflow-x: hidden;
312 padding-right: 15px; 312 padding-right: 15px;
313 margin: 15px 0px; 313 margin: 15px 0px;
314 -}  
315 \ No newline at end of file 314 \ No newline at end of file
  315 +}
  316 +
  317 +#forecast_sample_modal ul.tabs-left li{
  318 +}
  319 +
  320 +#forecast_sample_modal span.desc {
  321 + color: #5580a5;
  322 + text-align: left;
  323 + font-size: 12px;
  324 +}
  325 +#forecast_sample_modal ul.tabs-left li.active span.desc{
  326 + color: #989292;
  327 +}
src/main/resources/static/pages/forecast/sample/js/svg.js
@@ -7,7 +7,8 @@ var sampleSvg = (function(){ @@ -7,7 +7,8 @@ var sampleSvg = (function(){
7 , margin 7 , margin
8 , _opt 8 , _opt
9 , svg 9 , svg
10 - , _data; 10 + , _data
  11 + ,defaultTag;
11 12
12 var stationMapp = {}; 13 var stationMapp = {};
13 //路由 14 //路由
@@ -70,7 +71,7 @@ var sampleSvg = (function(){ @@ -70,7 +71,7 @@ var sampleSvg = (function(){
70 }); 71 });
71 72
72 var h = rts[rts.length - 1].cy + 50; 73 var h = rts[rts.length - 1].cy + 50;
73 - svg.style('height', h).style('opacity', 0); 74 + svg.style('height', h)/*.style('opacity', 0)*/;
74 $('#svgWrap').css('height', h + 6); 75 $('#svgWrap').css('height', h + 6);
75 76
76 //画线 77 //画线
@@ -97,7 +98,7 @@ var sampleSvg = (function(){ @@ -97,7 +98,7 @@ var sampleSvg = (function(){
97 showTags(); 98 showTags();
98 99
99 //d3 anim 100 //d3 anim
100 - svg.transition().delay(100).style('opacity', 1); 101 + //svg.transition().delay(100).style('opacity', 1);
101 } 102 }
102 103
103 //tag 点击事件 104 //tag 点击事件
@@ -141,7 +142,7 @@ var sampleSvg = (function(){ @@ -141,7 +142,7 @@ var sampleSvg = (function(){
141 .attr('x', function(d){return d.cp[0]}) 142 .attr('x', function(d){return d.cp[0]})
142 .attr('y', function(d){return d.cp[1]}) 143 .attr('y', function(d){return d.cp[1]})
143 .attr('class', 'f_text') 144 .attr('class', 'f_text')
144 - .text(function(d){return d.runTime + 'm'}); 145 + .text(function(d){return d.runTime + ''});
145 } 146 }
146 147
147 148
@@ -151,24 +152,35 @@ var sampleSvg = (function(){ @@ -151,24 +152,35 @@ var sampleSvg = (function(){
151 } 152 }
152 153
153 function showTags(){ 154 function showTags(){
  155 + var index = layer.msg('加载中', {icon: 16, time: 0,shade:0.3});
154 //查询 耗时信息 156 //查询 耗时信息
155 $.get('/sample/all', {'lineCode_eq': _opt.lineCode, 'updown_eq': _opt.updown}, function(rs){ 157 $.get('/sample/all', {'lineCode_eq': _opt.lineCode, 'updown_eq': _opt.updown}, function(rs){
156 //按tag分组数据 158 //按tag分组数据
157 _data = {}; 159 _data = {};
158 - var tags = '';// 160 + var tags = '', ct;//
159 $.each(rs, function(i, d){ 161 $.each(rs, function(i, d){
160 - if(!_data[d.tag]){  
161 - _data[d.tag] = [];  
162 - tags += '<a class="tag" title="'+d.tag+'">'+(d.tag + ' ' + d.sDate + ' - ' + d.eDate)+'</a>'; 162 + ct = cutTag(d.tag);
  163 + if(!_data[ct]){
  164 + _data[ct] = [];
  165 + tags += '<a class="tag" title="'+ct+'">'+ d.tag +'</a>';
163 } 166 }
164 - _data[d.tag].push(d); 167 + _data[ct].push(d);
165 }); 168 });
166 169
167 var wrap = $('#trafficChart .sample_tags'); 170 var wrap = $('#trafficChart .sample_tags');
168 wrap.find('a.tag').remove(); 171 wrap.find('a.tag').remove();
169 wrap.append(tags); 172 wrap.append(tags);
170 - //选中第一个tag  
171 - $('#trafficChart .sample_tags a.tag:eq(0)').click(); 173 +
  174 + if(defaultTag){
  175 + $(defaultTag).click();
  176 + defaultTag = null;
  177 + }
  178 + else{
  179 + //选中第一个tag
  180 + $('#trafficChart .sample_tags a.tag:eq(0)').click();
  181 + }
  182 +
  183 + layer.close(index);
172 }); 184 });
173 } 185 }
174 186
@@ -185,7 +197,7 @@ var sampleSvg = (function(){ @@ -185,7 +197,7 @@ var sampleSvg = (function(){
185 $.get('/pages/forecast/sample/modal.html', function(rs){ 197 $.get('/pages/forecast/sample/modal.html', function(rs){
186 var index = layer.open({ 198 var index = layer.open({
187 type: 1, 199 type: 1,
188 - area: '550px', 200 + area: '560px',
189 content: rs, 201 content: rs,
190 shift: 5, 202 shift: 5,
191 title: '人工编辑', 203 title: '人工编辑',
@@ -200,7 +212,8 @@ var sampleSvg = (function(){ @@ -200,7 +212,8 @@ var sampleSvg = (function(){
200 212
201 var drawObject = { 213 var drawObject = {
202 draw: draw , 214 draw: draw ,
203 - popAddModal: popAddModal 215 + popAddModal: popAddModal,
  216 + setDefaultTag: function(tag){defaultTag = tag; return drawObject;}
204 } 217 }
205 218
206 //分析path d 路径中间点 219 //分析path d 路径中间点
@@ -230,5 +243,9 @@ var sampleSvg = (function(){ @@ -230,5 +243,9 @@ var sampleSvg = (function(){
230 return cp; 243 return cp;
231 } 244 }
232 245
  246 + function cutTag(tag){
  247 + return tag.replace(new RegExp(/:/g),'').replace(new RegExp(/ /g),'').replace(new RegExp(/-/g) ,'');
  248 + }
  249 +
233 return drawObject; 250 return drawObject;
234 })(); 251 })();
235 \ No newline at end of file 252 \ No newline at end of file
src/main/resources/static/pages/forecast/sample/main.html
@@ -264,8 +264,10 @@ @@ -264,8 +264,10 @@
264 delete param.dr_etime; 264 delete param.dr_etime;
265 param.timeRange = timeRange; 265 param.timeRange = timeRange;
266 266
267 - $.post('/sample/create/gps', {data: encodeURI(JSON.stringify(param))}, function(rs){  
268 - console.log(rs); 267 + layer.msg('服务器正在处理数据,请稍等...', {icon: 16, shade: 0.3});
  268 + $post('/sample/create/gps', {data: encodeURI(JSON.stringify(param))}, function(rs){
  269 + layer.closeAll();
  270 + drawSvg();
269 }); 271 });
270 } 272 }
271 }catch (e){ 273 }catch (e){
src/main/resources/static/pages/forecast/sample/modal.html
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 <ul class="nav nav-tabs tabs-left"> 8 <ul class="nav nav-tabs tabs-left">
9 {{each data as obj i}} 9 {{each data as obj i}}
10 <li > 10 <li >
11 - <a href="#tab_sample_{{i}}" data-toggle="tab" title="{{obj.t}}"> {{obj.t}} </a> 11 + <a href="#tab_sample_{{i}}" data-toggle="tab" title="{{obj.t}}"> {{#obj.escapeTag}} </a>
12 </li> 12 </li>
13 {{/each}} 13 {{/each}}
14 <li ><a href="#tab_sample_add" data-toggle="tab" style="font-size: 12px;color: red;"> <i class="fa fa-plus"></i> 新增 </a></li> 14 <li ><a href="#tab_sample_add" data-toggle="tab" style="font-size: 12px;color: red;"> <i class="fa fa-plus"></i> 新增 </a></li>
@@ -89,9 +89,9 @@ @@ -89,9 +89,9 @@
89 <label class="col-md-3 control-label">时区:</label> 89 <label class="col-md-3 control-label">时区:</label>
90 <div class="col-md-9"> 90 <div class="col-md-9">
91 <select class="form-control" name="tag" style="width:100%;" multiple required> 91 <select class="form-control" name="tag" style="width:100%;" multiple required>
92 - <option value="早高峰">早高峰</option>  
93 - <option value="平峰">平峰</option>  
94 - <option value="晚高峰">晚高峰</option> 92 + {{each tsArray as t i}}
  93 + <option value="{{t}}">{{t}}</option>
  94 + {{/each}}
95 </select> 95 </select>
96 </div> 96 </div>
97 </div> 97 </div>
@@ -129,9 +129,12 @@ @@ -129,9 +129,12 @@
129 <script> 129 <script>
130 !function(){ 130 !function(){
131 var _data,_opt,id, currentData, layero, drawObject; 131 var _data,_opt,id, currentData, layero, drawObject;
132 - var tagRange = {'早高峰': {s: '06:31', e: '08:30'}, '平峰': {s: '08:31', e: '16:00'}, '晚高峰': {s: '16:01', e: '18:00'}}; 132 + var tagRange = {};
133 133
134 $('#forecast_sample_modal').on('init', function(e, rs){ 134 $('#forecast_sample_modal').on('init', function(e, rs){
  135 + //提取出tag Range
  136 + var tsArray = extractTag(rs._data);
  137 +
135 _data = rs._data; 138 _data = rs._data;
136 _opt = rs._opt; 139 _opt = rs._opt;
137 drawObject = rs.drawObject; 140 drawObject = rs.drawObject;
@@ -147,8 +150,14 @@ @@ -147,8 +150,14 @@
147 var eid = id, sid = _prve.stationCode; 150 var eid = id, sid = _prve.stationCode;
148 var sampData = searchData(sid, eid); 151 var sampData = searchData(sid, eid);
149 var baseData = {sid: sid, eid: eid, sName: toName(sid), eName: toName(eid)}; 152 var baseData = {sid: sid, eid: eid, sName: toName(sid), eName: toName(eid)};
150 - console.log('baseData', baseData);  
151 - var html = template('forecast_sample_tab_detail_temp', {data: sampData, base: baseData}); 153 +
  154 + //tag加换行符
  155 + $.each(sampData, function(){
  156 + var t = this.d.tag.replace(new RegExp(/ /g),'');
  157 + this.escapeTag = t.substr(0, t.length - 11) + '<br>' + '<span class="desc">' + t.substr(t.length - 11, 11) + '</span>';
  158 + });
  159 +
  160 + var html = template('forecast_sample_tab_detail_temp', {data: sampData, base: baseData, tsArray: tsArray});
152 $('#forecast_sample_modal .row').html(html); 161 $('#forecast_sample_modal .row').html(html);
153 //默认选中tab 162 //默认选中tab
154 defaultSelect(rs.tag); 163 defaultSelect(rs.tag);
@@ -180,6 +189,10 @@ @@ -180,6 +189,10 @@
180 $post('/sample', param, function(){ 189 $post('/sample', param, function(){
181 layer.closeAll(); 190 layer.closeAll();
182 layer.msg('保存成功!'); 191 layer.msg('保存成功!');
  192 +
  193 + if(rs.tag)
  194 + drawObject.setDefaultTag('#trafficChart .sample_tags a.tag[title='+rs.tag+']');
  195 +
183 drawObject.draw(_opt); 196 drawObject.draw(_opt);
184 }); 197 });
185 } 198 }
@@ -294,5 +307,23 @@ @@ -294,5 +307,23 @@
294 } 307 }
295 return rs; 308 return rs;
296 } 309 }
  310 +
  311 + function extractTag(_data){
  312 + var rs = [];
  313 + var len, t, s, e;
  314 + for(var key in _data){
  315 + len = key.length;
  316 + t = key.substring(0, len - 8);
  317 + s = key.substring(len - 8, len - 4);
  318 + e = key.substring(len - 4, len);
  319 +
  320 + s = s.substr(0, 2) + ':' + s.substr(2);
  321 + e = e.substr(0, 2) + ':' + e.substr(2);
  322 + tagRange[t] = {s: s, e: e};
  323 + rs.push(t);
  324 + }
  325 +
  326 + return rs;
  327 + }
297 }(); 328 }();
298 </script> 329 </script>
299 \ No newline at end of file 330 \ No newline at end of file
src/main/resources/static/pages/mapmonitor/alone/wrap.html
@@ -32,8 +32,8 @@ @@ -32,8 +32,8 @@
32 } 32 }
33 33
34 function refreshGpsProxy(){ 34 function refreshGpsProxy(){
35 - refreshGps(function(add, up){  
36 - $('#tab_map #mapContainer').trigger('gps_refresh', [add, up]); 35 + refreshGps(function(all){
  36 + $('#tab_map #mapContainer').trigger('gps_refresh', [all]);
37 }); 37 });
38 } 38 }
39 function refreshGps(cb){ 39 function refreshGps(cb){
@@ -48,23 +48,11 @@ @@ -48,23 +48,11 @@
48 function getGpsSuccess(gpsList){ 48 function getGpsSuccess(gpsList){
49 if(!gpsList || gpsList.length == 0) 49 if(!gpsList || gpsList.length == 0)
50 return; 50 return;
51 -  
52 - var prve = allGps  
53 - ,addArray = []  
54 - ,upArray = []  
55 - ,oldGps; 51 +
56 for(var i = 0, gps; gps=gpsList[i++];){ 52 for(var i = 0, gps; gps=gpsList[i++];){
57 - oldGps = prve[gps.deviceId];  
58 - if(!oldGps){  
59 - addArray.push(gps);  
60 - }  
61 - else if(gps.timestamp > oldGps.timestamp){  
62 - //更新  
63 - upArray.push(gps);  
64 - }  
65 allGps[gps.deviceId] = gps; 53 allGps[gps.deviceId] = gps;
66 } 54 }
67 - cb && cb(addArray, upArray); 55 + cb && cb(allGps);
68 } 56 }
69 57
70 function getGpsError(jqXHR, textStatus){ 58 function getGpsError(jqXHR, textStatus){
src/main/resources/static/pages/mapmonitor/real/real.html
@@ -124,19 +124,18 @@ CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) { @@ -124,19 +124,18 @@ CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) {
124 } 124 }
125 125
126 //GPS刷新事件 126 //GPS刷新事件
127 -$('#mapContainer').on('gps_refresh', function(e, add, up){ 127 +$('#mapContainer').on('gps_refresh', function(e, all){
128 if($(this).is(":hidden")) 128 if($(this).is(":hidden"))
129 return; 129 return;
130 - var all = add ,gps; 130 +/* var all = add ,gps;
131 if(up) 131 if(up)
132 - all = all.concat(up); 132 + all = all.concat(up); */
133 133
134 $.each(all, function(){ 134 $.each(all, function(){
135 consts.allGps[this.deviceId] = this; 135 consts.allGps[this.deviceId] = this;
136 }); 136 });
137 137
138 var type = $('.mapTools .item.active').data('click'); 138 var type = $('.mapTools .item.active').data('click');
139 - console.log(type);  
140 switch (type) { 139 switch (type) {
141 case 'vehicle': 140 case 'vehicle':
142 lineGroup.gpsRefresh(); 141 lineGroup.gpsRefresh();
src/main/resources/static/pages/scheduleApp/module/common/dt/MyEmployeeGroupWrapTemplate.html
1 -<div name="{{$saEmployeegroupCtrl.$name_attr}}"  
2 - ng-model="$saEmployeegroupCtrl.$$internalmodel">  
3 -  
4 - <style>  
5 - .employee-select {  
6 - min-height: 180px;  
7 - border: 1px solid #ddd;  
8 - }  
9 - .employee-select .employee-input {  
10 - margin: 5px 5px 0px 5px;  
11 - padding-left: 0;  
12 - }  
13 - .employee-select .employee-select-cont {  
14 - text-align: left;  
15 - min-height: 60px;  
16 - padding-right: 0px;  
17 - }  
18 - .employee-select .employee-select-body {  
19 - margin-top: 5px;  
20 - overflow: auto;  
21 - width: auto;  
22 - min-height: 5px;  
23 - }  
24 - .employee-select .employee {  
25 - display: inline-block;  
26 - padding: 8px;  
27 - min-width: 50px;  
28 - text-align: center;  
29 - border: 1px solid #C1C1C1;  
30 - color: #666;  
31 - border-radius: 5px !important;  
32 - margin: 5px;  
33 - }  
34 - .employee-select .employee.active {  
35 - color: white;  
36 - background: #5A81A7;  
37 - border: 1px solid #5A81A7;  
38 - }  
39 - .employee-select .employee.start {  
40 - color: white;  
41 - background: #32C5D2;  
42 - border: 1px solid #32C5D2;  
43 - }  
44 -  
45 - .employee-select .employeeGroup {  
46 - display: inline-block;  
47 - padding: 8px;  
48 - min-width: 50px;  
49 - text-align: center;  
50 - border: 1px solid #C1C1C1;  
51 - color: #666;  
52 - border-radius: 5px !important;  
53 - margin: 5px;  
54 - }  
55 - .employee-select .employeeGroup.active {  
56 - color: white;  
57 - background: #8DA29F;  
58 - border: 1px solid #8DA29F;  
59 - min-width: 100px;  
60 - max-width: 200px;  
61 - }  
62 - .employee-select .employeeGroup.start {  
63 - color: white;  
64 - background: #32C5D2;  
65 - border: 1px solid #32C5D2;  
66 - min-width: 100px;  
67 - max-width: 200px;  
68 - }  
69 -  
70 -  
71 - </style>  
72 -  
73 - <div class="col-md-12 employee-select">  
74 - <div class="col-md-12 employee-input">  
75 - <div class="col-md-9">  
76 - 人员列表,共{{$saEmployeegroupCtrl.$$data.length}}组  
77 -  
78 - </div>  
79 - <div class="checkbox col-md-3" style="min-height: 19px; color: black;">  
80 - <label>  
81 - <input type="checkbox" ng-model="$saEmployeegroupCtrl.$$isFB"/>  
82 - 是否分班  
83 - </label>  
84 - </div>  
85 -  
86 - </div>  
87 - <div class="col-md-12 employee-select-cont">  
88 - <div class="employee-select-body">  
89 - <div class="employee active"  
90 - ng-repeat="$d in $saEmployeegroupCtrl.$$data track by $index"  
91 - ng-click="$saEmployeegroupCtrl.$$internal_rylist_click($index)">  
92 - <span ng-if="$d.spy">  
93 - {{$d.jsy}}-{{$d.spy}}  
94 - <i class="fa fa-ticket" aria-hidden="true"></i>  
95 - </span>  
96 - <span ng-if="!$d.spy">  
97 - <i class="fa fa-bus" aria-hidden="true"></i>  
98 - {{$d.jsy}}  
99 - </span>  
100 - </div>  
101 - </div>  
102 - </div>  
103 -  
104 - <!-- 不分班 -->  
105 - <div class="col-md-12 employee-input" ng-if="!$saEmployeegroupCtrl.$$isFB">  
106 - <div class="col-md-12">  
107 - 已经选中的人员列表,共{{$saEmployeegroupCtrl.$$dataSelected.length}}组,  
108 - 初始人员,{{$saEmployeegroupCtrl.$$dataSelectedStart == undefined ? "未选择" : "第" + ($saEmployeegroupCtrl.$$dataSelectedStart + 1) + "组"}}  
109 - </div>  
110 - </div>  
111 - <div class="col-md-12 employee-select-cont" ng-if="!$saEmployeegroupCtrl.$$isFB">  
112 - <div class="employee-select-body">  
113 - <div ng-class="{employee: true, active: true, start: $d.isstart}"  
114 - ng-repeat="$d in $saEmployeegroupCtrl.$$dataSelected track by $index"  
115 - ng-click="$saEmployeegroupCtrl.$$internal_selrylist_click($index)"  
116 - ng-dblclick="$saEmployeegroupCtrl.$$internal_selrylist_dbclick($index)">  
117 - <span ng-if="$d.spy">  
118 - {{$d.jsy}}-{{$d.spy}}  
119 - <i class="fa fa-ticket" aria-hidden="true"></i>  
120 - </span>  
121 - <span ng-if="!$d.spy">  
122 - <i class="fa fa-bus" aria-hidden="true"></i>  
123 - {{$d.jsy}}  
124 - </span>  
125 -  
126 - </div>  
127 - </div>  
128 - </div>  
129 -  
130 - <!-- 分班 -->  
131 - <div class="col-md-12 employee-input" ng-if="$saEmployeegroupCtrl.$$isFB">  
132 - <div class="col-md-12">  
133 - 已经选中的分班人员列表,共{{$saEmployeegroupCtrl.$$dataFBSelected.length}}组,  
134 - 初始分班人员,{{$saEmployeegroupCtrl.$$dataFBSelectedStart == undefined ? "未选择" : "第" + ($saEmployeegroupCtrl.$$dataFBSelectedStart + 1) + "组"}}  
135 - </div>  
136 - </div>  
137 - <div class="col-md-12 employee-select-cont" ng-if="$saEmployeegroupCtrl.$$isFB">  
138 - <div class="employee-select-body">  
139 - <div ng-class="{employeeGroup: true, active: true, start: $d.isstart}"  
140 - ng-repeat="$d in $saEmployeegroupCtrl.$$dataFBSelected track by $index"  
141 - ng-click="$saEmployeegroupCtrl.$$internal_selrygrouplist_click($index)"  
142 - ng-dblclick="$saEmployeegroupCtrl.$$internal_selrygrouplist_dbclick($index)">  
143 -  
144 - <div>  
145 - <i class="fa fa-sun-o" aria-hidden="true"></i>  
146 - <div ng-class="{employee: true, active: true, start: $d.group[0].isselected}"  
147 - ng-click="$saEmployeegroupCtrl.$$internal_selrygroup_click($index, 0, $event)"  
148 - ng-if="$d.group[0].spy">  
149 - <i class="fa fa-bus" aria-hidden="true"></i>  
150 - {{$d.group[0].jsy}}  
151 - -  
152 - <i class="fa fa-ticket" aria-hidden="true"></i>  
153 - {{$d.group[0].spy}}  
154 - </div>  
155 - <div ng-class="{employee: true, active: true, start: $d.group[0].isselected}"  
156 - ng-click="$saEmployeegroupCtrl.$$internal_selrygroup_click($index, 0, $event)"  
157 - ng-if="!$d.group[0].spy">  
158 - <i class="fa fa-bus" aria-hidden="true"></i>  
159 - {{$d.group[0].jsy}}  
160 - </div>  
161 - </div>  
162 -  
163 - <div>  
164 - <i class="fa fa-moon-o" aria-hidden="true"></i>  
165 - <div ng-class="{employee: true, active: true, start: $d.group[1].isselected}"  
166 - ng-click="$saEmployeegroupCtrl.$$internal_selrygroup_click($index, 1, $event)"  
167 - ng-if="$d.group[1].spy">  
168 - <i class="fa fa-bus" aria-hidden="true"></i>  
169 - {{$d.group[1].jsy}}  
170 - -  
171 - <i class="fa fa-ticket" aria-hidden="true"></i>  
172 - {{$d.group[1].spy}}  
173 - </div>  
174 - <div ng-class="{employee: true, active: true, start: $d.group[1].isselected}"  
175 - ng-click="$saEmployeegroupCtrl.$$internal_selrygroup_click($index, 1, $event)"  
176 - ng-if="!$d.group[1].spy">  
177 - <i class="fa fa-bus" aria-hidden="true"></i>  
178 - {{$d.group[1].jsy}}  
179 - </div>  
180 - </div>  
181 -  
182 -  
183 - </div>  
184 -  
185 - </div>  
186 - </div>  
187 -  
188 -  
189 -  
190 - </div>  
191 - 1 +<div name="{{$saEmployeegroupCtrl.$name_attr}}"
  2 + ng-model="$saEmployeegroupCtrl.$$internalmodel">
  3 +
  4 + <style>
  5 + .employee-select {
  6 + min-height: 180px;
  7 + border: 1px solid #ddd;
  8 + }
  9 + .employee-select .employee-input {
  10 + margin: 5px 5px 0px 5px;
  11 + padding-left: 0;
  12 + }
  13 + .employee-select .employee-select-cont {
  14 + text-align: left;
  15 + min-height: 60px;
  16 + padding-right: 0px;
  17 + }
  18 + .employee-select .employee-select-body {
  19 + margin-top: 5px;
  20 + overflow: auto;
  21 + width: auto;
  22 + min-height: 5px;
  23 + }
  24 + .employee-select .employee {
  25 + display: inline-block;
  26 + padding: 8px;
  27 + min-width: 50px;
  28 + text-align: center;
  29 + border: 1px solid #C1C1C1;
  30 + color: #666;
  31 + border-radius: 5px !important;
  32 + margin: 5px;
  33 + }
  34 + .employee-select .employee.active {
  35 + color: white;
  36 + background: #5A81A7;
  37 + border: 1px solid #5A81A7;
  38 + }
  39 + .employee-select .employee.start {
  40 + color: white;
  41 + background: #32C5D2;
  42 + border: 1px solid #32C5D2;
  43 + }
  44 +
  45 + .employee-select .employeeGroup {
  46 + display: inline-block;
  47 + padding: 8px;
  48 + min-width: 50px;
  49 + text-align: center;
  50 + border: 1px solid #C1C1C1;
  51 + color: #666;
  52 + border-radius: 5px !important;
  53 + margin: 5px;
  54 + }
  55 + .employee-select .employeeGroup.active {
  56 + color: white;
  57 + background: #8DA29F;
  58 + border: 1px solid #8DA29F;
  59 + min-width: 100px;
  60 + max-width: 200px;
  61 + }
  62 + .employee-select .employeeGroup.start {
  63 + color: white;
  64 + background: #32C5D2;
  65 + border: 1px solid #32C5D2;
  66 + min-width: 100px;
  67 + max-width: 200px;
  68 + }
  69 +
  70 +
  71 + </style>
  72 +
  73 + <div class="col-md-12 employee-select">
  74 + <div class="col-md-12 employee-input">
  75 + <div class="col-md-9">
  76 + 人员列表,共{{$saEmployeegroupCtrl.$$data.length}}组
  77 +
  78 + </div>
  79 + <div class="checkbox col-md-3" style="min-height: 19px; color: black;">
  80 + <label>
  81 + <input type="checkbox" ng-model="$saEmployeegroupCtrl.$$isFB"/>
  82 + 是否分班
  83 + </label>
  84 + </div>
  85 +
  86 + </div>
  87 + <div class="col-md-12 employee-select-cont">
  88 + <div class="employee-select-body">
  89 + <div class="employee active"
  90 + ng-repeat="$d in $saEmployeegroupCtrl.$$data track by $index"
  91 + ng-click="$saEmployeegroupCtrl.$$internal_rylist_click($index)">
  92 + <span ng-if="$d.spy">
  93 + {{$d.jsy}}-{{$d.spy}}
  94 + <i class="fa fa-ticket" aria-hidden="true"></i>
  95 + </span>
  96 + <span ng-if="!$d.spy">
  97 + <i class="fa fa-bus" aria-hidden="true"></i>
  98 + {{$d.jsy}}
  99 + </span>
  100 + </div>
  101 + </div>
  102 + </div>
  103 +
  104 + <!-- 不分班 -->
  105 + <div class="col-md-12 employee-input" ng-if="!$saEmployeegroupCtrl.$$isFB">
  106 + <div class="col-md-12">
  107 + 已经选中的人员列表,共{{$saEmployeegroupCtrl.$$dataSelected.length}}组,
  108 + 初始人员,{{$saEmployeegroupCtrl.$$dataSelectedStart == undefined ? "未选择" : "第" + ($saEmployeegroupCtrl.$$dataSelectedStart + 1) + "组"}}
  109 + </div>
  110 + </div>
  111 + <div class="col-md-12 employee-select-cont" ng-if="!$saEmployeegroupCtrl.$$isFB">
  112 + <div class="employee-select-body">
  113 + <div ng-class="{employee: true, active: true, start: $d.isstart}"
  114 + ng-repeat="$d in $saEmployeegroupCtrl.$$dataSelected track by $index"
  115 + ng-click="$saEmployeegroupCtrl.$$internal_selrylist_click($index)"
  116 + ng-dblclick="$saEmployeegroupCtrl.$$internal_selrylist_dbclick($index)">
  117 + <span ng-if="$d.spy">
  118 + {{$d.jsy}}-{{$d.spy}}
  119 + <i class="fa fa-ticket" aria-hidden="true"></i>
  120 + </span>
  121 + <span ng-if="!$d.spy">
  122 + <i class="fa fa-bus" aria-hidden="true"></i>
  123 + {{$d.jsy}}
  124 + </span>
  125 +
  126 + </div>
  127 + </div>
  128 + </div>
  129 +
  130 + <!-- 分班 -->
  131 + <div class="col-md-12 employee-input" ng-if="$saEmployeegroupCtrl.$$isFB">
  132 + <div class="col-md-12">
  133 + 已经选中的分班人员列表,共{{$saEmployeegroupCtrl.$$dataFBSelected.length}}组,
  134 + 初始分班人员,{{$saEmployeegroupCtrl.$$dataFBSelectedStart == undefined ? "未选择" : "第" + ($saEmployeegroupCtrl.$$dataFBSelectedStart + 1) + "组"}}
  135 + </div>
  136 + </div>
  137 + <div class="col-md-12 employee-select-cont" ng-if="$saEmployeegroupCtrl.$$isFB">
  138 + <div class="employee-select-body">
  139 + <div ng-class="{employeeGroup: true, active: true, start: $d.isstart}"
  140 + ng-repeat="$d in $saEmployeegroupCtrl.$$dataFBSelected track by $index"
  141 + ng-click="$saEmployeegroupCtrl.$$internal_selrygrouplist_click($index)"
  142 + ng-dblclick="$saEmployeegroupCtrl.$$internal_selrygrouplist_dbclick($index)">
  143 +
  144 + <div>
  145 + <i class="fa fa-sun-o" aria-hidden="true"></i>
  146 + <div ng-class="{employee: true, active: true, start: $d.group[0].isselected}"
  147 + ng-click="$saEmployeegroupCtrl.$$internal_selrygroup_click($index, 0, $event)"
  148 + ng-if="$d.group[0].spy">
  149 + <i class="fa fa-bus" aria-hidden="true"></i>
  150 + {{$d.group[0].jsy}}
  151 + -
  152 + <i class="fa fa-ticket" aria-hidden="true"></i>
  153 + {{$d.group[0].spy}}
  154 + </div>
  155 + <div ng-class="{employee: true, active: true, start: $d.group[0].isselected}"
  156 + ng-click="$saEmployeegroupCtrl.$$internal_selrygroup_click($index, 0, $event)"
  157 + ng-if="!$d.group[0].spy">
  158 + <i class="fa fa-bus" aria-hidden="true"></i>
  159 + {{$d.group[0].jsy}}
  160 + </div>
  161 + </div>
  162 +
  163 + <div>
  164 + <i class="fa fa-moon-o" aria-hidden="true"></i>
  165 + <div ng-class="{employee: true, active: true, start: $d.group[1].isselected}"
  166 + ng-click="$saEmployeegroupCtrl.$$internal_selrygroup_click($index, 1, $event)"
  167 + ng-if="$d.group[1].spy">
  168 + <i class="fa fa-bus" aria-hidden="true"></i>
  169 + {{$d.group[1].jsy}}
  170 + -
  171 + <i class="fa fa-ticket" aria-hidden="true"></i>
  172 + {{$d.group[1].spy}}
  173 + </div>
  174 + <div ng-class="{employee: true, active: true, start: $d.group[1].isselected}"
  175 + ng-click="$saEmployeegroupCtrl.$$internal_selrygroup_click($index, 1, $event)"
  176 + ng-if="!$d.group[1].spy">
  177 + <i class="fa fa-bus" aria-hidden="true"></i>
  178 + {{$d.group[1].jsy}}
  179 + </div>
  180 + </div>
  181 +
  182 +
  183 + </div>
  184 +
  185 + </div>
  186 + </div>
  187 +
  188 +
  189 +
  190 + </div>
  191 +
192 </div> 192 </div>
193 \ No newline at end of file 193 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/dt/MyGuideboardGroupWrapTemplate.html
1 -<div name="{{$saGuideboardgroupCtrl.$name_attr}}"  
2 - ng-model="$saGuideboardgroupCtrl.$$internalmodel">  
3 -  
4 - <style>  
5 - .guideboard-select {  
6 - min-height: 180px;  
7 - border: 1px solid #ddd;  
8 - }  
9 - .guideboard-select .guideboard-input {  
10 - margin: 5px 5px 0px 5px;  
11 - padding-left: 0;  
12 - }  
13 - .guideboard-select .guideboard-select-cont {  
14 - text-align: left;  
15 - min-height: 60px;  
16 - padding-right: 0px;  
17 - }  
18 - .guideboard-select .guideboard-select-body {  
19 - margin-top: 5px;  
20 - overflow: auto;  
21 - width: auto;  
22 - min-height: 5px;  
23 - }  
24 - .guideboard-select .guideboard {  
25 - display: inline-block;  
26 - padding: 8px;  
27 - min-width: 50px;  
28 - text-align: center;  
29 - border: 1px solid #C1C1C1;  
30 - color: #666;  
31 - border-radius: 5px !important;  
32 - margin: 5px;  
33 - }  
34 - .guideboard-select .guideboard.active {  
35 - color: white;  
36 - background: #4095E8;  
37 - border: 1px solid #4095E8;  
38 - }  
39 - .guideboard-select .guideboard.start {  
40 - color: white;  
41 - background: #32C5D2;  
42 - border: 1px solid #32C5D2;  
43 - }  
44 -  
45 - </style>  
46 -  
47 - <div class="col-md-12 guideboard-select">  
48 - <div class="col-md-12 guideboard-input">  
49 - <div class="col-md-9">  
50 - 路牌列表,共{{$saGuideboardgroupCtrl.$$data.length}}个  
51 - </div>  
52 - </div>  
53 - <div class="col-md-12 guideboard-select-cont">  
54 - <div class="guideboard-select-body">  
55 - <div class="guideboard active"  
56 - ng-repeat="$d in $saGuideboardgroupCtrl.$$data track by $index"  
57 - ng-click="$saGuideboardgroupCtrl.$$internal_lplist_click($index)">  
58 - <i class="fa fa-map-signs" aria-hidden="true"></i>  
59 - {{$d.lpname}}  
60 - </div>  
61 - </div>  
62 - </div>  
63 - <div class="col-md-12 guideboard-input">  
64 - <div class="col-md-12">  
65 - 已经选中的路牌列表,共{{$saGuideboardgroupCtrl.$$dataSelected.length}}个,  
66 - 初始路牌,{{$saGuideboardgroupCtrl.$$dataSelectedStart == undefined ? "未选择" : "第" + ($saGuideboardgroupCtrl.$$dataSelectedStart + 1) + "个"}}  
67 - </div>  
68 - </div>  
69 - <div class="col-md-12 guideboard-select-cont">  
70 - <div class="guideboard-select-body">  
71 - <div ng-class="{guideboard: true, active: true, start: $d.isstart}"  
72 - ng-repeat="$d in $saGuideboardgroupCtrl.$$dataSelected track by $index"  
73 - ng-click="$saGuideboardgroupCtrl.$$internal_sellplist_click($index)"  
74 - ng-dblclick="$saGuideboardgroupCtrl.$$internal_sellplist_dbclick($index)">  
75 - <i class="fa fa-map-signs" aria-hidden="true"></i>  
76 - {{$d.lpname}}  
77 - </div>  
78 - </div>  
79 - </div>  
80 - </div>  
81 - 1 +<div name="{{$saGuideboardgroupCtrl.$name_attr}}"
  2 + ng-model="$saGuideboardgroupCtrl.$$internalmodel">
  3 +
  4 + <style>
  5 + .guideboard-select {
  6 + min-height: 180px;
  7 + border: 1px solid #ddd;
  8 + }
  9 + .guideboard-select .guideboard-input {
  10 + margin: 5px 5px 0px 5px;
  11 + padding-left: 0;
  12 + }
  13 + .guideboard-select .guideboard-select-cont {
  14 + text-align: left;
  15 + min-height: 60px;
  16 + padding-right: 0px;
  17 + }
  18 + .guideboard-select .guideboard-select-body {
  19 + margin-top: 5px;
  20 + overflow: auto;
  21 + width: auto;
  22 + min-height: 5px;
  23 + }
  24 + .guideboard-select .guideboard {
  25 + display: inline-block;
  26 + padding: 8px;
  27 + min-width: 50px;
  28 + text-align: center;
  29 + border: 1px solid #C1C1C1;
  30 + color: #666;
  31 + border-radius: 5px !important;
  32 + margin: 5px;
  33 + }
  34 + .guideboard-select .guideboard.active {
  35 + color: white;
  36 + background: #4095E8;
  37 + border: 1px solid #4095E8;
  38 + }
  39 + .guideboard-select .guideboard.start {
  40 + color: white;
  41 + background: #32C5D2;
  42 + border: 1px solid #32C5D2;
  43 + }
  44 +
  45 + </style>
  46 +
  47 + <div class="col-md-12 guideboard-select">
  48 + <div class="col-md-12 guideboard-input">
  49 + <div class="col-md-9">
  50 + 路牌列表,共{{$saGuideboardgroupCtrl.$$data.length}}个
  51 + </div>
  52 + </div>
  53 + <div class="col-md-12 guideboard-select-cont">
  54 + <div class="guideboard-select-body">
  55 + <div class="guideboard active"
  56 + ng-repeat="$d in $saGuideboardgroupCtrl.$$data track by $index"
  57 + ng-click="$saGuideboardgroupCtrl.$$internal_lplist_click($index)">
  58 + <i class="fa fa-map-signs" aria-hidden="true"></i>
  59 + {{$d.lpname}}
  60 + </div>
  61 + </div>
  62 + </div>
  63 + <div class="col-md-12 guideboard-input">
  64 + <div class="col-md-12">
  65 + 已经选中的路牌列表,共{{$saGuideboardgroupCtrl.$$dataSelected.length}}个,
  66 + 初始路牌,{{$saGuideboardgroupCtrl.$$dataSelectedStart == undefined ? "未选择" : "第" + ($saGuideboardgroupCtrl.$$dataSelectedStart + 1) + "个"}}
  67 + </div>
  68 + </div>
  69 + <div class="col-md-12 guideboard-select-cont">
  70 + <div class="guideboard-select-body">
  71 + <div ng-class="{guideboard: true, active: true, start: $d.isstart}"
  72 + ng-repeat="$d in $saGuideboardgroupCtrl.$$dataSelected track by $index"
  73 + ng-click="$saGuideboardgroupCtrl.$$internal_sellplist_click($index)"
  74 + ng-dblclick="$saGuideboardgroupCtrl.$$internal_sellplist_dbclick($index)">
  75 + <i class="fa fa-map-signs" aria-hidden="true"></i>
  76 + {{$d.lpname}}
  77 + </div>
  78 + </div>
  79 + </div>
  80 + </div>
  81 +
82 </div> 82 </div>
83 \ No newline at end of file 83 \ No newline at end of file