Commit 5f4f3979ccfa803e2188f03372d90547c34686d5

Authored by yiming
1 parent 5da44207

线调客流展示

src/main/java/com/bsth/controller/gps/GpsController.java
... ... @@ -5,6 +5,7 @@ import com.bsth.data.gpsdata_v2.GpsRealData;
5 5 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
6 6 import com.bsth.data.gpsdata_v2.handlers.overspeed.GpsOverspeed;
7 7 import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
  8 +import com.bsth.data.kl.KlData;
8 9 import com.bsth.data.schedule.e_state_check.ScheduleStationCodeChecker;
9 10 import com.bsth.data.schedule.e_state_check.entity.SCodeInfo;
10 11 import com.bsth.service.gps.GpsService;
... ... @@ -62,6 +63,9 @@ public class GpsController {
62 63 //班次站点检查信息
63 64 List<SCodeInfo> scis = ScheduleStationCodeChecker.findByLineIdx(lineArray);
64 65  
  66 + for (GpsEntity gpsEntity : gpsList) {
  67 + gpsEntity.setKl(KlData.getKl(gpsEntity.getDeviceId()));
  68 + }
65 69 rs.put("gpsList", gpsList);
66 70 rs.put("overspeedList", overspeedList);
67 71 rs.put("scis", scis);
... ...
src/main/java/com/bsth/data/gpsdata_v2/entity/GpsEntity.java
1   -package com.bsth.data.gpsdata_v2.entity;
2   -
3   -import com.fasterxml.jackson.annotation.JsonIgnore;
4   -
5   -/**
6   - *
7   - * @ClassName: GpsRealData
8   - * @Description: TODO(HTTP接口的实时GPS数据)
9   - * @author PanZhao
10   - * @date 2016年5月11日 下午4:32:07
11   - *
12   - */
13   -public class GpsEntity implements Cloneable{
14   -
15   - /** 公司代码 */
16   - @JsonIgnore
17   - private Short companyCode;
18   -
19   - /** 线路编码 */
20   - private String lineId;
21   -
22   - /** 设备编码 */
23   - private String deviceId;
24   -
25   - /** 停车场编码 */
26   - private String carparkNo;
27   -
28   - /** 站点编码 */
29   - private String stopNo;
30   -
31   - /** 站点名称 */
32   - private String stationName;
33   -
34   - /** 到站时间 */
35   - @JsonIgnore
36   - private long arrTime;
37   -
38   - /** 经度 */
39   - private Float lon;
40   -
41   - /** 纬度 */
42   - private Float lat;
43   -
44   - /** GPS发送时间戳 */
45   - private Long timestamp;
46   -
47   - /** 网关收到时间 */
48   - private Long serverTimestamp;
49   -
50   - /** 速度 */
51   - private Float speed;
52   -
53   - /** 方向(角度) */
54   - private float direction;
55   -
56   - /** 营运状态( 0 营运 ,1 非营运, -1 无效) */
57   - private Integer state;
58   -
59   - /** 上下行(0 上行 , 1 下行 , -1 无效) */
60   - private Byte upDown;
61   -
62   - /**
63   - * 设备原始走向_营运状态
64   - * 当设备状态和系统不一致时,该字段有值
65   - */
66   - private String origStateStr;
67   -
68   - /** 车辆内部编码 */
69   - private String nbbm;
70   -
71   - /** 预计到达终点时间 */
72   - private Float expectStopTime;
73   -
74   - /** 当前执行班次ID */
75   - private Long schId;
76   -
77   - private int version;
78   -
79   - /** 0: 站外 1:站内 2:场内 */
80   - private int instation;
81   -
82   - /** 站点信息,站内时有值 */
83   - @JsonIgnore
84   - private StationRoute station;
85   -
86   - /**
87   - * 前置约束 -站点编码
88   - */
89   - @JsonIgnore
90   - private String premiseCode;
91   -
92   - /** 状态 */
93   - private String signalState = "normal";
94   -
95   - /** 异常状态 */
96   - private String abnormalStatus;
97   -
98   - /** 越界距离 */
99   - private double outOfBoundDistance;
100   -
101   - /** gps是否有效 设备端发送的状态 */
102   - private int valid;
103   -
104   - /**
105   - * 数据来源
106   - * 1:网关
107   - * 0:转发
108   - */
109   - private int source = -1;
110   -
111   - private String remark;
112   - private String planCode;
113   -
114   - private String dvrcode;
115   -
116   - public Object clone() {
117   - try {
118   - return super.clone();
119   - } catch (CloneNotSupportedException e) {
120   - return null;
121   - }
122   - }
123   -
124   - public String getDvrcode() {
125   - return dvrcode;
126   - }
127   -
128   - public void setDvrcode(String dvrcode) {
129   - this.dvrcode = dvrcode;
130   - }
131   -
132   - public String getDeviceId() {
133   - return deviceId;
134   - }
135   -
136   - public void setDeviceId(String deviceId) {
137   - this.deviceId = deviceId;
138   - }
139   -
140   - public String getCarparkNo() {
141   - return carparkNo;
142   - }
143   -
144   - public void setCarparkNo(String carparkNo) {
145   - this.carparkNo = carparkNo;
146   - }
147   -
148   - public String getStopNo() {
149   - return stopNo;
150   - }
151   -
152   - public void setStopNo(String stopNo) {
153   - this.stopNo = stopNo;
154   - }
155   -
156   - public Float getLon() {
157   - return lon;
158   - }
159   -
160   - public void setLon(Float lon) {
161   - this.lon = lon;
162   - }
163   -
164   - public Float getLat() {
165   - return lat;
166   - }
167   -
168   - public void setLat(Float lat) {
169   - this.lat = lat;
170   - }
171   -
172   - public Long getTimestamp() {
173   - return timestamp;
174   - }
175   -
176   - public void setTimestamp(Long timestamp) {
177   - this.timestamp = timestamp;
178   - }
179   -
180   -
181   - public Integer getState() {
182   - return state;
183   - }
184   -
185   - public void setState(Integer state) {
186   - this.state = state;
187   - }
188   -
189   - public String getNbbm() {
190   - return nbbm;
191   - }
192   -
193   - public void setNbbm(String nbbm) {
194   - this.nbbm = nbbm;
195   - }
196   -
197   - public String getStationName() {
198   - return stationName;
199   - }
200   -
201   - public void setStationName(String stationName) {
202   - this.stationName = stationName;
203   - }
204   -
205   - public long getArrTime() {
206   - return arrTime;
207   - }
208   -
209   - public void setArrTime(long arrTime) {
210   - this.arrTime = arrTime;
211   - }
212   -
213   - public Float getExpectStopTime() {
214   - return expectStopTime;
215   - }
216   -
217   - public void setExpectStopTime(Float expectStopTime) {
218   - this.expectStopTime = expectStopTime;
219   - }
220   -
221   - public String getLineId() {
222   - return lineId;
223   - }
224   -
225   - public void setLineId(String lineId) {
226   - this.lineId = lineId;
227   - }
228   -
229   - public Long getSchId() {
230   - return schId;
231   - }
232   -
233   - public void setSchId(Long schId) {
234   - this.schId = schId;
235   - }
236   -
237   -
238   - public int getVersion() {
239   - return version;
240   - }
241   -
242   - public void setVersion(int version) {
243   - this.version = version;
244   - }
245   -
246   - public StationRoute getStation() {
247   - return station;
248   - }
249   -
250   - public void setStation(StationRoute station) {
251   - this.station = station;
252   - }
253   -
254   - public String getSignalState() {
255   - return signalState;
256   - }
257   -
258   - public void setSignalState(String signalState) {
259   - this.signalState = signalState;
260   - }
261   -
262   - public int getInstation() {
263   - return instation;
264   - }
265   -
266   - public void setInstation(int instation) {
267   - this.instation = instation;
268   - }
269   -
270   - public String getAbnormalStatus() {
271   - return abnormalStatus;
272   - }
273   -
274   - public void setAbnormalStatus(String abnormalStatus) {
275   - this.abnormalStatus = abnormalStatus;
276   - }
277   -
278   - public double getOutOfBoundDistance() {
279   - return outOfBoundDistance;
280   - }
281   -
282   - public void setOutOfBoundDistance(double outOfBoundDistance) {
283   - this.outOfBoundDistance = outOfBoundDistance;
284   - }
285   -
286   - public int getValid() {
287   - return valid;
288   - }
289   -
290   - public void setValid(int valid) {
291   - this.valid = valid;
292   - }
293   -
294   -
295   -
296   - public short getCompanyCode() {
297   - return companyCode;
298   - }
299   -
300   - public void setCompanyCode(short companyCode) {
301   - this.companyCode = companyCode;
302   - }
303   -
304   - public Byte getUpDown() {
305   - return upDown;
306   - }
307   -
308   - public void setUpDown(Byte upDown) {
309   - this.upDown = upDown;
310   - }
311   -
312   -
313   - public float getDirection() {
314   - return direction;
315   - }
316   -
317   - public void setDirection(float direction) {
318   - this.direction = direction;
319   - }
320   -
321   - public Float getSpeed() {
322   - return speed;
323   - }
324   -
325   - public void setSpeed(Float speed) {
326   - this.speed = speed;
327   - }
328   -
329   - public int getSource() {
330   - return source;
331   - }
332   -
333   - public void setSource(int source) {
334   - this.source = source;
335   - }
336   -
337   - public void offline(){
338   - this.setAbnormalStatus("offline");
339   - }
340   -
341   -/* public boolean isOnline(){
342   - if(isOffline())
343   - return false;
344   -
345   - long t = System.currentTimeMillis();
346   -
347   - if((t - this.getServerTimestamp()) > 1000 * 60 * 2){
348   - return false;
349   - }
350   -
351   - if((this.getServerTimestamp() - t) > 1000 * 60 * 3){
352   - return false;
353   - }
354   - return true;
355   - }*/
356   -
357   - /**
358   - * 是否营运
359   - * @return
360   - */
361   - public boolean isService(){
362   - return state!=null && state==0;
363   - }
364   -
365   - public boolean isOffline(){
366   - return this.getAbnormalStatus() != null && this.getAbnormalStatus().equals("offline");
367   - }
368   -
369   - public Long getServerTimestamp() {
370   - return serverTimestamp;
371   - }
372   -
373   - public void setServerTimestamp(Long serverTimestamp) {
374   - this.serverTimestamp = serverTimestamp;
375   - }
376   -
377   - public String getPremiseCode() {
378   - return premiseCode;
379   - }
380   -
381   - public void setPremiseCode(String premiseCode) {
382   - this.premiseCode = premiseCode;
383   - }
384   -
385   - public String getRemark() {
386   - return remark;
387   - }
388   -
389   - public void setRemark(String remark) {
390   - this.remark = remark;
391   - }
392   -
393   - public String getPlanCode() {
394   - return planCode;
395   - }
396   -
397   - public void setPlanCode(String planCode) {
398   - this.planCode = planCode;
399   - }
400   -
401   - public String getOrigStateStr() {
402   - return origStateStr;
403   - }
404   -
405   - public void setOrigStateStr(String origStateStr) {
406   - this.origStateStr = origStateStr;
407   - }
408   -}
  1 +package com.bsth.data.gpsdata_v2.entity;
  2 +
  3 +import com.bsth.entity.Kl;
  4 +import com.fasterxml.jackson.annotation.JsonIgnore;
  5 +
  6 +/**
  7 + *
  8 + * @ClassName: GpsRealData
  9 + * @Description: TODO(HTTP接口的实时GPS数据)
  10 + * @author PanZhao
  11 + * @date 2016年5月11日 下午4:32:07
  12 + *
  13 + */
  14 +public class GpsEntity implements Cloneable{
  15 +
  16 + /** 公司代码 */
  17 + @JsonIgnore
  18 + private Short companyCode;
  19 +
  20 + /** 线路编码 */
  21 + private String lineId;
  22 +
  23 + /** 设备编码 */
  24 + private String deviceId;
  25 +
  26 + /** 停车场编码 */
  27 + private String carparkNo;
  28 +
  29 + /** 站点编码 */
  30 + private String stopNo;
  31 +
  32 + /** 站点名称 */
  33 + private String stationName;
  34 +
  35 + /** 到站时间 */
  36 + @JsonIgnore
  37 + private long arrTime;
  38 +
  39 + /** 经度 */
  40 + private Float lon;
  41 +
  42 + /** 纬度 */
  43 + private Float lat;
  44 +
  45 + /** GPS发送时间戳 */
  46 + private Long timestamp;
  47 +
  48 + /** 网关收到时间 */
  49 + private Long serverTimestamp;
  50 +
  51 + /** 速度 */
  52 + private Float speed;
  53 +
  54 + /** 方向(角度) */
  55 + private float direction;
  56 +
  57 + /** 营运状态( 0 营运 ,1 非营运, -1 无效) */
  58 + private Integer state;
  59 +
  60 + /** 上下行(0 上行 , 1 下行 , -1 无效) */
  61 + private Byte upDown;
  62 +
  63 + /**
  64 + * 设备原始走向_营运状态
  65 + * 当设备状态和系统不一致时,该字段有值
  66 + */
  67 + private String origStateStr;
  68 +
  69 + /** 车辆内部编码 */
  70 + private String nbbm;
  71 +
  72 + /** 预计到达终点时间 */
  73 + private Float expectStopTime;
  74 +
  75 + /** 当前执行班次ID */
  76 + private Long schId;
  77 +
  78 + private int version;
  79 +
  80 + /** 0: 站外 1:站内 2:场内 */
  81 + private int instation;
  82 +
  83 + /** 站点信息,站内时有值 */
  84 + @JsonIgnore
  85 + private StationRoute station;
  86 +
  87 + /**
  88 + * 前置约束 -站点编码
  89 + */
  90 + @JsonIgnore
  91 + private String premiseCode;
  92 +
  93 + /** 状态 */
  94 + private String signalState = "normal";
  95 +
  96 + /** 异常状态 */
  97 + private String abnormalStatus;
  98 +
  99 + /** 越界距离 */
  100 + private double outOfBoundDistance;
  101 +
  102 + /** gps是否有效 设备端发送的状态 */
  103 + private int valid;
  104 +
  105 + /**
  106 + * 数据来源
  107 + * 1:网关
  108 + * 0:转发
  109 + */
  110 + private int source = -1;
  111 +
  112 + private String remark;
  113 + private String planCode;
  114 +
  115 + private String dvrcode;
  116 +
  117 + private Kl kl;
  118 + public Object clone() {
  119 + try {
  120 + return super.clone();
  121 + } catch (CloneNotSupportedException e) {
  122 + return null;
  123 + }
  124 + }
  125 +
  126 + public String getDvrcode() {
  127 + return dvrcode;
  128 + }
  129 +
  130 + public void setDvrcode(String dvrcode) {
  131 + this.dvrcode = dvrcode;
  132 + }
  133 +
  134 + public String getDeviceId() {
  135 + return deviceId;
  136 + }
  137 +
  138 + public void setDeviceId(String deviceId) {
  139 + this.deviceId = deviceId;
  140 + }
  141 +
  142 + public String getCarparkNo() {
  143 + return carparkNo;
  144 + }
  145 +
  146 + public void setCarparkNo(String carparkNo) {
  147 + this.carparkNo = carparkNo;
  148 + }
  149 +
  150 + public String getStopNo() {
  151 + return stopNo;
  152 + }
  153 +
  154 + public void setStopNo(String stopNo) {
  155 + this.stopNo = stopNo;
  156 + }
  157 +
  158 + public Float getLon() {
  159 + return lon;
  160 + }
  161 +
  162 + public void setLon(Float lon) {
  163 + this.lon = lon;
  164 + }
  165 +
  166 + public Float getLat() {
  167 + return lat;
  168 + }
  169 +
  170 + public void setLat(Float lat) {
  171 + this.lat = lat;
  172 + }
  173 +
  174 + public Long getTimestamp() {
  175 + return timestamp;
  176 + }
  177 +
  178 + public void setTimestamp(Long timestamp) {
  179 + this.timestamp = timestamp;
  180 + }
  181 +
  182 +
  183 + public Integer getState() {
  184 + return state;
  185 + }
  186 +
  187 + public void setState(Integer state) {
  188 + this.state = state;
  189 + }
  190 +
  191 + public String getNbbm() {
  192 + return nbbm;
  193 + }
  194 +
  195 + public void setNbbm(String nbbm) {
  196 + this.nbbm = nbbm;
  197 + }
  198 +
  199 + public String getStationName() {
  200 + return stationName;
  201 + }
  202 +
  203 + public void setStationName(String stationName) {
  204 + this.stationName = stationName;
  205 + }
  206 +
  207 + public long getArrTime() {
  208 + return arrTime;
  209 + }
  210 +
  211 + public void setArrTime(long arrTime) {
  212 + this.arrTime = arrTime;
  213 + }
  214 +
  215 + public Float getExpectStopTime() {
  216 + return expectStopTime;
  217 + }
  218 +
  219 + public void setExpectStopTime(Float expectStopTime) {
  220 + this.expectStopTime = expectStopTime;
  221 + }
  222 +
  223 + public String getLineId() {
  224 + return lineId;
  225 + }
  226 +
  227 + public void setLineId(String lineId) {
  228 + this.lineId = lineId;
  229 + }
  230 +
  231 + public Long getSchId() {
  232 + return schId;
  233 + }
  234 +
  235 + public void setSchId(Long schId) {
  236 + this.schId = schId;
  237 + }
  238 +
  239 +
  240 + public int getVersion() {
  241 + return version;
  242 + }
  243 +
  244 + public void setVersion(int version) {
  245 + this.version = version;
  246 + }
  247 +
  248 + public StationRoute getStation() {
  249 + return station;
  250 + }
  251 +
  252 + public void setStation(StationRoute station) {
  253 + this.station = station;
  254 + }
  255 +
  256 + public String getSignalState() {
  257 + return signalState;
  258 + }
  259 +
  260 + public void setSignalState(String signalState) {
  261 + this.signalState = signalState;
  262 + }
  263 +
  264 + public int getInstation() {
  265 + return instation;
  266 + }
  267 +
  268 + public void setInstation(int instation) {
  269 + this.instation = instation;
  270 + }
  271 +
  272 + public String getAbnormalStatus() {
  273 + return abnormalStatus;
  274 + }
  275 +
  276 + public void setAbnormalStatus(String abnormalStatus) {
  277 + this.abnormalStatus = abnormalStatus;
  278 + }
  279 +
  280 + public double getOutOfBoundDistance() {
  281 + return outOfBoundDistance;
  282 + }
  283 +
  284 + public void setOutOfBoundDistance(double outOfBoundDistance) {
  285 + this.outOfBoundDistance = outOfBoundDistance;
  286 + }
  287 +
  288 + public int getValid() {
  289 + return valid;
  290 + }
  291 +
  292 + public void setValid(int valid) {
  293 + this.valid = valid;
  294 + }
  295 +
  296 +
  297 +
  298 + public short getCompanyCode() {
  299 + return companyCode;
  300 + }
  301 +
  302 + public void setCompanyCode(short companyCode) {
  303 + this.companyCode = companyCode;
  304 + }
  305 +
  306 + public Byte getUpDown() {
  307 + return upDown;
  308 + }
  309 +
  310 + public void setUpDown(Byte upDown) {
  311 + this.upDown = upDown;
  312 + }
  313 +
  314 +
  315 + public float getDirection() {
  316 + return direction;
  317 + }
  318 +
  319 + public void setDirection(float direction) {
  320 + this.direction = direction;
  321 + }
  322 +
  323 + public Float getSpeed() {
  324 + return speed;
  325 + }
  326 +
  327 + public void setSpeed(Float speed) {
  328 + this.speed = speed;
  329 + }
  330 +
  331 + public int getSource() {
  332 + return source;
  333 + }
  334 +
  335 + public void setSource(int source) {
  336 + this.source = source;
  337 + }
  338 +
  339 + public void offline(){
  340 + this.setAbnormalStatus("offline");
  341 + }
  342 +
  343 +/* public boolean isOnline(){
  344 + if(isOffline())
  345 + return false;
  346 +
  347 + long t = System.currentTimeMillis();
  348 +
  349 + if((t - this.getServerTimestamp()) > 1000 * 60 * 2){
  350 + return false;
  351 + }
  352 +
  353 + if((this.getServerTimestamp() - t) > 1000 * 60 * 3){
  354 + return false;
  355 + }
  356 + return true;
  357 + }*/
  358 +
  359 + /**
  360 + * 是否营运
  361 + * @return
  362 + */
  363 + public boolean isService(){
  364 + return state!=null && state==0;
  365 + }
  366 +
  367 + public boolean isOffline(){
  368 + return this.getAbnormalStatus() != null && this.getAbnormalStatus().equals("offline");
  369 + }
  370 +
  371 + public Long getServerTimestamp() {
  372 + return serverTimestamp;
  373 + }
  374 +
  375 + public void setServerTimestamp(Long serverTimestamp) {
  376 + this.serverTimestamp = serverTimestamp;
  377 + }
  378 +
  379 + public String getPremiseCode() {
  380 + return premiseCode;
  381 + }
  382 +
  383 + public void setPremiseCode(String premiseCode) {
  384 + this.premiseCode = premiseCode;
  385 + }
  386 +
  387 + public String getRemark() {
  388 + return remark;
  389 + }
  390 +
  391 + public void setRemark(String remark) {
  392 + this.remark = remark;
  393 + }
  394 +
  395 + public String getPlanCode() {
  396 + return planCode;
  397 + }
  398 +
  399 + public void setPlanCode(String planCode) {
  400 + this.planCode = planCode;
  401 + }
  402 +
  403 + public String getOrigStateStr() {
  404 + return origStateStr;
  405 + }
  406 +
  407 + public void setOrigStateStr(String origStateStr) {
  408 + this.origStateStr = origStateStr;
  409 + }
  410 + public Kl getKl() {
  411 + return kl;
  412 + }
  413 +
  414 + public void setKl(Kl kl) {
  415 + this.kl = kl;
  416 + }
  417 +}
... ...
src/main/java/com/bsth/data/kl/KlData.java 0 → 100644
  1 +package com.bsth.data.kl;
  2 +
  3 +import com.bsth.entity.Kl;
  4 +import com.bsth.service.Kl.KlService;
  5 +import org.slf4j.Logger;
  6 +import org.slf4j.LoggerFactory;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.beans.factory.annotation.Value;
  9 +import org.springframework.scheduling.annotation.Scheduled;
  10 +import org.springframework.stereotype.Component;
  11 +import java.util.*;
  12 +
  13 +/**
  14 + * @author ym
  15 + * @ClassName: KlData
  16 + * @Description: TODO(客流数据加载定时器)
  17 + * @date 2024年7月18日09:59:40
  18 + */
  19 +@Component
  20 +public class KlData {
  21 +
  22 + static Logger logger = LoggerFactory.getLogger(KlData.class);
  23 +
  24 + //客流数据
  25 + private static Map<String, Kl> KlData = new HashMap<>();
  26 +
  27 + @Autowired
  28 + private KlService klService;
  29 +
  30 + @Value("${passengerFlow.url}")
  31 + private String url;
  32 +
  33 + @Scheduled(cron = "0/10 * * * * ?")
  34 + public void loadKl() {
  35 + Map<String,Kl> map= new HashMap<>();
  36 + List<Kl> list = klService.loadKl();
  37 + for (Kl kl : list) {
  38 + String photo=kl.getPhoto();
  39 + kl.setPhoto(url+photo);
  40 + map.put(kl.getDeviceId(),kl);
  41 + }
  42 + KlData =map;
  43 + }
  44 +
  45 + public static Kl getKl(String deviceId){
  46 + //return KlData.get( KlData.keySet().toArray()[0]);
  47 + return KlData.get(deviceId);
  48 + }
  49 +
  50 +
  51 +}
0 52 \ No newline at end of file
... ...
src/main/java/com/bsth/entity/Kl.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +public class Kl {
  4 +
  5 + private String lineCode;
  6 + private String lineName;
  7 + private String deviceId;
  8 + private String stopNo;
  9 + private String stationName;
  10 + private String upDown;
  11 + private String photo;
  12 + private String num;
  13 + private String createDate;
  14 +
  15 + public String getLineCode() {
  16 + return lineCode;
  17 + }
  18 +
  19 + public void setLineCode(String lineCode) {
  20 + this.lineCode = lineCode;
  21 + }
  22 +
  23 + public String getDeviceId() {
  24 + return deviceId;
  25 + }
  26 +
  27 + public void setDeviceId(String deviceId) {
  28 + this.deviceId = deviceId;
  29 + }
  30 +
  31 + public String getStopNo() {
  32 + return stopNo;
  33 + }
  34 +
  35 + public void setStopNo(String stopNo) {
  36 + this.stopNo = stopNo;
  37 + }
  38 +
  39 + public String getUpDown() {
  40 + return upDown;
  41 + }
  42 +
  43 + public void setUpDown(String upDown) {
  44 + this.upDown = upDown;
  45 + }
  46 +
  47 + public String getPhoto() {
  48 + return photo;
  49 + }
  50 +
  51 + public void setPhoto(String photo) {
  52 + this.photo = photo;
  53 + }
  54 +
  55 + public String getNum() {
  56 + return num;
  57 + }
  58 +
  59 + public void setNum(String num) {
  60 + this.num = num;
  61 + }
  62 +
  63 + public String getCreateDate() {
  64 + return createDate;
  65 + }
  66 +
  67 + public void setCreateDate(String createDate) {
  68 + this.createDate = createDate;
  69 + }
  70 +
  71 + public String getLineName() {
  72 + return lineName;
  73 + }
  74 +
  75 + public void setLineName(String lineName) {
  76 + this.lineName = lineName;
  77 + }
  78 +
  79 + public String getStationName() {
  80 + return stationName;
  81 + }
  82 +
  83 + public void setStationName(String stationName) {
  84 + this.stationName = stationName;
  85 + }
  86 +}
... ...
src/main/java/com/bsth/service/Kl/KlService.java 0 → 100644
  1 +package com.bsth.service.Kl;
  2 +
  3 +import com.bsth.entity.Kl;
  4 +import com.bsth.entity.logger.Logger_MileModify;
  5 +import com.bsth.service.BaseService;
  6 +
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +
  10 +
  11 +public interface KlService {
  12 + Map<String, Object> query(Map<String, Object> map);
  13 +
  14 + List<Kl> loadKl();
  15 +}
... ...
src/main/java/com/bsth/service/Kl/impl/KlServiceImpl.java 0 → 100644
  1 +package com.bsth.service.Kl.impl;
  2 +
  3 +
  4 +
  5 +import com.bsth.entity.Kl;
  6 +import com.bsth.service.Kl.KlService;
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.beans.factory.annotation.Value;
  11 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  12 +import org.springframework.jdbc.core.JdbcTemplate;
  13 +import org.springframework.stereotype.Service;
  14 +import java.time.LocalDate;
  15 +import java.time.LocalDateTime;
  16 +import java.time.format.DateTimeFormatter;
  17 +import java.util.*;
  18 +
  19 +@Service
  20 +public class KlServiceImpl implements KlService {
  21 +
  22 + Logger logger = LoggerFactory.getLogger(this.getClass());
  23 +
  24 + @Autowired
  25 + JdbcTemplate jdbcTemplate;
  26 +
  27 + private static DateTimeFormatter dtf=DateTimeFormatter.ofPattern("yyyy-MM-dd");
  28 +
  29 + @Value("${passengerFlow.url}")
  30 + private String url;
  31 +
  32 + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
  33 +
  34 + @Override
  35 + public Map<String, Object> query(Map<String, Object> map) {
  36 + Map<String, Object> modelMap = new HashMap<>();
  37 + try {
  38 + StringBuffer sql=new StringBuffer("SELECT * FROM bsth_c_kl where 1=1 ");
  39 + if(map.get("line")!=null && !map.get("line").equals("")){
  40 + sql.append(" and line_code ='"+map.get("line")+"'");
  41 + }
  42 + if(map.get("deviceId_like")!=null && !map.get("deviceId_like").equals("")){
  43 + sql.append(" and deviceId like '%"+map.get("deviceId_like")+"%'");
  44 + }
  45 + String date = LocalDate.now().format(dtf);
  46 + if(map.get("date")!=null){
  47 + date=map.get("date").toString();
  48 + }
  49 + sql.append(" and createDate >='"+date+" 00:00:00'");
  50 + sql.append(" and createDate <='"+date+" 23:59:59'");
  51 + List<Map<String,Object>> query = jdbcTemplate.queryForList(sql.toString());
  52 + Integer page = Integer.valueOf(map.containsKey("page")?map.get("page").toString():"0");
  53 + int end = (page+1)*10>query.size()?query.size():(page+1)*10;
  54 + List<Map<String,Object>> result=query.subList(page*10, end);
  55 + for (Map<String, Object> m : result) {
  56 + m.put("time",m.get("createDate").toString().substring(0,19));
  57 + m.put("photo",url+m.get("photo"));
  58 + }
  59 + modelMap.put("dataList", result);
  60 + modelMap.put("totalPages", query.size()%10>0?query.size()/10+1:query.size()/10);
  61 + modelMap.put("code","00");
  62 + return modelMap;
  63 + } catch (Exception e) {
  64 + logger.error("客流查询异常", e);
  65 + modelMap.put("code","502");
  66 + return modelMap;
  67 + }
  68 + }
  69 +
  70 + @Override
  71 + public List<Kl> loadKl() {
  72 + List<Kl> list = new ArrayList<>();
  73 + try {
  74 + LocalDateTime localDateTime = LocalDateTime.now().minusMinutes(3);
  75 + String time = localDateTime.format(dateTimeFormatter);
  76 + StringBuffer sql=new StringBuffer("select * from bsth_c_kl where createDate>='" +time+
  77 + "' and id in(SELECT max(id) from bsth_c_kl GROUP BY deviceId)");
  78 + list = jdbcTemplate.query(sql.toString(), BeanPropertyRowMapper.newInstance(Kl.class));
  79 + } catch (Exception e) {
  80 + logger.error("客流信息加载异常", e);
  81 + }
  82 + return list;
  83 + }
  84 +
  85 +
  86 +}
... ...
src/main/resources/application-test.properties
... ... @@ -40,4 +40,5 @@ sso.http.url.auth= http://10.10.200.142:9112/prod-api/system/utilitySystem/check
40 40 dc.imgurl= E:/klimg
41 41 dc.profile= profile
42 42  
43   -baidu.ak=AYiBOs3f9qBQFhdKFsaboX6CfObmKwRP
44 43 \ No newline at end of file
  44 +baidu.ak=AYiBOs3f9qBQFhdKFsaboX6CfObmKwRP
  45 +passengerFlow.url = http://127.0.0.1:9999/images/
45 46 \ No newline at end of file
... ...
src/main/resources/static/assets/img/ss.jpg 0 → 100644

8.34 KB

src/main/resources/static/assets/img/ss.png 0 → 100644

2.03 KB

src/main/resources/static/assets/img/yb.jpg 0 → 100644

8.96 KB

src/main/resources/static/assets/img/yb.png 0 → 100644

3.21 KB

src/main/resources/static/assets/img/yj.jpg 0 → 100644

8.99 KB

src/main/resources/static/assets/img/yj.png 0 → 100644

2.74 KB

src/main/resources/static/pages/permission/authorize_all/user_auth.html
... ... @@ -79,6 +79,7 @@
79 79 <li><label><input class="uk-checkbox" type="checkbox" data-event="fbzdzx_config"> 翻班与自动执行</label></li>
80 80 <li><label><input class="uk-checkbox" type="checkbox" data-event="tts_config"> TTS</label></li>
81 81 <li><label><input class="uk-checkbox" type="checkbox" data-event="signal_state"> 信号标记</label></li>
  82 + <li><label><input class="uk-checkbox" type="checkbox" data-event="kl_config"> 客流信息</label></li>
82 83 </ul>
83 84 </div>
84 85 <div>
... ...
src/main/resources/static/real_control_v2/css/main.css
... ... @@ -220,6 +220,15 @@ svg.line-chart g.num-number &gt; text {
220 220 z-index: 99;
221 221 }
222 222  
  223 +svg.line-chart g.gps-wrap > image[updown="0"] {
  224 + width:17px;
  225 + height:15px;
  226 + z-index: 0;
  227 +}
  228 +svg.line-chart g.gps-wrap > image[updown="1"] {
  229 + width:17px;
  230 + height:15px;
  231 +}
223 232 svg.line-chart g.gps-wrap > rect[updown="0"] {
224 233 stroke: rgb(62, 80, 179);
225 234 fill: rgb(62, 80, 179);
... ... @@ -997,64 +1006,6 @@ option.oil_station_opt {
997 1006 margin-right: 5px;
998 1007 }
999 1008  
1000   -
1001   -.multi_plat_msg_pops .tests {
1002   - display: block;
1003   -}
1004   -
1005   -
1006   -/** 智能调度 */
1007   -.multi_plat_msg_pop_zndd {
1008   - position: absolute;
1009   - right: 12px;
1010   - bottom: 12px;
1011   - z-index: 99;
1012   -}
1013   -
1014   -/** 催發 */
1015   -.multi_plat_msg_pop_cf {
1016   - position: absolute;
1017   - right: 12px;
1018   - bottom: 12px;
1019   - z-index: 99;
1020   - background: #ffffff
1021   -}
1022   -
1023   - .multi_plat_msg_pops {
1024   - color: grey;
1025   - margin: 7px 0;
1026   - padding: 7px 12px;
1027   - cursor: pointer;
1028   - min-width: 200px;
1029   - box-sizing: border-box;
1030   - min-height: 60px;
1031   - border-radius: 5px;
1032   - background-color: #e0effd;
1033   -}
1034   -
1035   -
1036   -.multi_plat_msg_pops .desc {
1037   - display: block;
1038   - font-size: 12px;
1039   - color: #ff9d9d;
1040   - text-align: right;
1041   - margin-right: 5px;
1042   -}
1043   -.multi_plat_msg_pops .time {
1044   - display: block;
1045   - font-size: 12px;
1046   - color: darkgray;
1047   - margin-right: 5px;
1048   -}
1049   -.multi_plat_msg_pops .reminder {
1050   - display: block;
1051   - font-size: 15px;
1052   - color: red;
1053   - margin-right: 5px;
1054   -}
1055   -
1056   -
1057   -
1058 1009 /** 嵌入表单modal滚动条样式 */
1059 1010 #formFragmentModal::-webkit-scrollbar {
1060 1011 width: 10px;
... ...
src/main/resources/static/real_control_v2/fragments/home/tooltip.html
... ... @@ -51,6 +51,18 @@
51 51 <div>
52 52 预计 {{expectStopTime}} 分钟到达终点</div>
53 53 {{/if}}
  54 + {{if kl !=null}}
  55 + <div><span class="field">人数:</span>{{kl.num}}</div>
  56 + {{/if}}
  57 + {{if kl !=null && kl.num <= 5}}
  58 + <div><span class="field">状态:</span><a href="javascript:;" style="color:green" onclick="javascript:gb_map_play_back.showPhoto('{{kl.photo}}');">舒适</a></div>
  59 + {{/if}}
  60 + {{if kl !=null && kl.num > 5 && kl.num <= 10}}
  61 + <div><span class="field">状态:</span><a href="javascript:;" style="color:chocolate" onclick="javascript:gb_map_play_back.showPhoto('{{kl.photo}}');">一般</a></div>
  62 + {{/if}}
  63 + {{if kl !=null && kl.num > 10}}
  64 + <div><span class="field">状态:</span><a href="javascript:;" style="color:red" onclick="javascript:gb_map_play_back.showPhoto('{{kl.photo}}');">拥挤</a></div>
  65 + {{/if}}
54 66 </div>
55 67  
56 68 <div class="tip_map_wrap"></div>
... ...
src/main/resources/static/real_control_v2/fragments/north/nav/kl_config.html 0 → 100644
  1 +<div class="uk-modal ct-form-modal" id="kl_config-modal">
  2 + <div class="uk-modal-dialog" style="width: 530px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>客流显示设置</h2></div>
  6 +
  7 + <p style="border-bottom: 1px solid #efefef;color: grey;padding-bottom: 9px;">
  8 + <small>
  9 + <i class="uk-icon-question-circle"> </i>
  10 + 设置项将会保存在本地客户端,清理缓存和更换电脑会重置.</small>
  11 + </p>
  12 + <form class="uk-form uk-form-horizontal">
  13 + <div class="uk-grid">
  14 + <div class="uk-width-2-3 uk-container-center">
  15 + <div class="uk-form-row">
  16 + <label class="uk-form-label">是否启用</label>
  17 + <div class="uk-form-controls">
  18 + <select name="enable">
  19 + <option value="1">启用</option>
  20 + <option value="0">禁用</option>
  21 + </select>
  22 + </div>
  23 + </div>
  24 + </div>
  25 + </div>
  26 +
  27 + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
  28 + <button type="button" class="uk-button uk-modal-close">取消</button>
  29 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
  30 + </div>
  31 + </form>
  32 + </div>
  33 +
  34 + <script>
  35 + var storage = window.localStorage;
  36 + (function() {
  37 + var modal = '#kl_config-modal';
  38 + var f = $('form', modal);
  39 +
  40 + $(modal).on('init', function(e, data) {
  41 + e.stopPropagation();
  42 + var locStatus=0;
  43 + if( storage.getItem("kl_state_enable")==1){
  44 + locStatus=1;
  45 + }
  46 + $('[name=enable]', f).val(locStatus);
  47 + });
  48 +
  49 + f.formValidation(gb_form_validation_opts);
  50 + f.on('success.form.fv', function(e) {
  51 + e.preventDefault();
  52 + var data = $(this).serializeJSON();
  53 + storage.setItem("kl_state_enable", data.enable);
  54 + UIkit.modal(modal).hide();
  55 + });
  56 +
  57 + })();
  58 + </script>
  59 +</div>
0 60 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/js/data/json/north_toolbar.json
... ... @@ -191,6 +191,11 @@
191 191 "id": 4.4,
192 192 "text": "翻班与自动执行",
193 193 "event": "fbzdzx_config"
  194 + },
  195 + {
  196 + "id": 4.5,
  197 + "text": "客流信息",
  198 + "event": "kl_config"
194 199 }
195 200  
196 201 ]
... ...
src/main/resources/static/real_control_v2/js/north/toolbar.js
... ... @@ -122,6 +122,9 @@ var gb_northToolbar = (function () {
122 122 line_config: function () {
123 123 open_modal('/real_control_v2/fragments/north/nav/line_config/line_config.html', {}, modal_opts);
124 124 },
  125 + kl_config: function () {
  126 + open_modal('/real_control_v2/fragments/north/nav/kl_config.html', {}, modal_opts);
  127 + },
125 128 // bcgxsj_config: function () {
126 129 // open_modal('/real_control_v2/fragments/north/nav/line_config/bcgxsj_config.html', {}, modal_opts);
127 130 // },
... ...
src/main/resources/static/real_control_v2/js/utils/svg_chart.js
... ... @@ -220,6 +220,23 @@ var gb_svg_chart = (function () {
220 220  
221 221 return gps.upDown == 0 ? cy - 22 - (index * 17) : cy + 6 + (index * 19);
222 222 },
  223 + gx2 = function (gps, svg, wrapId) {
  224 + var circle = get_circle(gps.stopNo + '_' + gps.upDown, svg);
  225 + if (!circle) return -100;
  226 +
  227 + var x = circle.attr('cx') - 16.5,
  228 + s = circle_spaces[wrapId] / 2;
  229 + // console.log('ss', gps.lineId + '=' + s);
  230 + //s = 5;
  231 + if(gps['instation']==0)
  232 + x = (gps['upDown']==0?x+s:x-s);
  233 + if(gps['abnormalClaszz']==false){//为越速掉设置偏移
  234 + x+=30;
  235 + }else {
  236 + x+=41;
  237 + }
  238 + return x;
  239 + },
223 240 ups_gps = function (d) {
224 241 return d.gpsUps;
225 242 },
... ... @@ -276,11 +293,54 @@ var gb_svg_chart = (function () {
276 293 //update tip position
277 294 gb_svg_tooltip.update(e);
278 295 },
  296 + gps_update_point2 = function (e, svg, wrapId,state) {
  297 + var x,e1;
  298 + e1 = e;
  299 + if(animation)
  300 + e1 = e.transition();
  301 + e1.attr('x', function (d) {
  302 + x = gx2(d, svg, wrapId);
  303 + if(x == -100)
  304 + $(this).css('transition-duration', 0).hide();
  305 + else
  306 + $(this).show();//找不到停靠点,直接隐藏
  307 + if(state==0)
  308 + $(this).css('transition-duration', 0).hide();
  309 + return x;
  310 + })
  311 + .attr('y', function (d) {
  312 + return gy(d, svg);
  313 + })
  314 + .attr('updown', function (d) {
  315 + return d.upDown;
  316 + })
  317 + .attr('xlink:href', function (d) {
  318 + var img ='';
  319 + if(d['kl'] != undefined && d['kl']['num']<=5){
  320 + img ='/assets/img/ss.png';
  321 + }else if(d['kl'] != undefined && d['kl']['num']>5 && d['kl']['num']<=10){
  322 + img ='/assets/img/yb.png';
  323 + }else if(d['kl'] != undefined && d['kl']['num']>10){
  324 + img ='/assets/img/yj.png';
  325 + }
  326 + return img;
  327 + });
  328 + e.classed({'abnormal': function (d) {
  329 + return d.abnormalClaszz;
  330 + }, 'offline': function (d) {
  331 + return d['abnormalStatus']=='offline';
  332 + }});
  333 + //update tip position
  334 + gb_svg_tooltip.update(e);
  335 + },
279 336 rct_id = function (d) {
280 337 return 'rct_' + d.deviceId;
281 338 },
282 339 tx_id = function (d) {
283 340 return 'tx_' + d.deviceId;
  341 + },
  342 + img_id = function (d) {
  343 + return 'img_' + d.deviceId;
284 344 };
285 345  
286 346 var setGps = function (lineCode) {
... ... @@ -347,6 +407,14 @@ var gb_svg_chart = (function () {
347 407 ts.enter().append('text').attr('_id', tx_id);
348 408 ts.text(g_text)
349 409 gps_update_point(ts, svg, wrapId);
  410 +
  411 + var imageState=0;
  412 + if(window.localStorage.getItem("kl_state_enable") == 1){
  413 + imageState=1;
  414 + }
  415 + var imgs = gps_cont.selectAll('image').data(data, gps_key);
  416 + imgs.enter().append('image').attr('_id', img_id);
  417 + gps_update_point2(imgs, svg, wrapId,imageState);
350 418 };
351 419  
352 420 var marker_clusterer = function (svg, lineCode) {
... ... @@ -375,7 +443,7 @@ var gb_svg_chart = (function () {
375 443 var svg = d3.select(svg);
376 444 //hide old element
377 445 $.each(gpsArr, function (i, d) {
378   - $('rect[_id=rct_' + d + '],text[_id=tx_' + d + ']').attr('class', 'merge_hide');
  446 + $('rect[_id=rct_' + d + '],text[_id=tx_' + d + '],image[_id=img_' + d + ']').attr('class', 'merge_hide');
379 447 });
380 448  
381 449 var mergerG = svg.selectAll('g.marker-clusterer').append('g').attr('_id', 'merger_' + stopNo)
... ...
src/main/resources/static/real_control_v2/mapmonitor/fragments/map_infowindow.html
... ... @@ -33,10 +33,17 @@
33 33 <p>经度:{{lon}}</p>
34 34 <p>纬度:{{lat}}</p>
35 35  
36   - <p class="date-str">{{dateStr}}</p>
37   - <hr>
38   - {{if expectStopTime!=null}}
39   - <a href="javascript:;" style="color: #07D;margin-right: 7px;">预计 {{expectStopTime}} 分钟到达终点</a>
  36 + {{if kl !=null}}
  37 + <p>人数:{{kl.num}}</p>
  38 + {{/if}}
  39 + {{if kl !=null && kl.num <= 5}}
  40 + <p>状态:<a href="javascript:;" style="color:green" onclick="javascript:gb_map_play_back.showPhoto('{{kl.photo}}');">舒适</a></p>
  41 + {{/if}}
  42 + {{if kl !=null && kl.num > 5 && kl.num <= 10}}
  43 + <p>状态:<a href="javascript:;" style="color:chocolate" onclick="javascript:gb_map_play_back.showPhoto('{{kl.photo}}');">一般</a></p>
  44 + {{/if}}
  45 + {{if kl !=null && kl.num > 10}}
  46 + <p>状态:<a href="javascript:;" style="color:red" onclick="javascript:gb_map_play_back.showPhoto('{{kl.photo}}');">拥挤</a></p>
40 47 {{/if}}
41 48 <a href="javascript:;" style="float: left;" onclick="javascript:window.open('http://58.34.52.130:4490/transport_server/dvr_monitor2.html?userid=4&zbh={{nbbm}}');">DVR</a>
42 49 <a href="W9:{{dvrcode}}@139.196.29.203?method=call" style="margin-left: 50px;" >拨打电话</a>
... ...
src/main/resources/static/real_control_v2/mapmonitor/js/playback.js
... ... @@ -105,10 +105,17 @@ var gb_map_play_back = (function () {
105 105 function base64(string) {
106 106 return window.btoa(unescape(encodeURIComponent(string)));
107 107 }
108   -
  108 + var showPhoto = function (photo) {
  109 + console.log("showPhoto");
  110 + var lightbox = UIkit.lightbox.create([
  111 + {source: photo,type:'image'}
  112 + ], {keyboard: false});
  113 + lightbox.show();
  114 + };
109 115 return {
110 116 initParams: initParams,
111 117 listToExcel: listToExcel,
112   - setParam: setParam
  118 + setParam: setParam,
  119 + showPhoto:showPhoto
113 120 }
114 121 })();
115 122 \ No newline at end of file
... ...