Commit 617a41f814ab5fc54a69078aef556b5712b1b564
1 parent
530d9354
1.调度系统加入进出场私自绕改道提示
Showing
8 changed files
with
155 additions
and
1 deletions
src/main/java/com/bsth/data/BasicData.java
| ... | ... | @@ -73,6 +73,9 @@ public class BasicData { |
| 73 | 73 | //线路编码和名称对照 |
| 74 | 74 | public static Map<String, String> lineCode2NameMap; |
| 75 | 75 | |
| 76 | + //名称和线路编码对照 | |
| 77 | + public static Map<String, String> lineName2CodeMap; | |
| 78 | + | |
| 76 | 79 | public static Map<String, String> lineCodeAllNameMap; |
| 77 | 80 | //停车场 |
| 78 | 81 | public static List<String> parkCodeList; |
| ... | ... | @@ -331,6 +334,7 @@ public class BasicData { |
| 331 | 334 | Line line; |
| 332 | 335 | BiMap<Integer, String> biMap = HashBiMap.create(); |
| 333 | 336 | Map<String, String> code2name = new HashMap<>(); |
| 337 | + Map<String, String> name2code = new HashMap<>(); | |
| 334 | 338 | Map<Integer, String> id2SHcode = new HashMap<Integer, String>(); |
| 335 | 339 | Map<String, String> code2SHcode = new HashMap<String, String>(); |
| 336 | 340 | Map<String, Integer> tempStationName2YgcNumber = new HashMap<String, Integer>(); |
| ... | ... | @@ -364,6 +368,7 @@ public class BasicData { |
| 364 | 368 | line = iterator.next(); |
| 365 | 369 | biMap.put(line.getId(), line.getLineCode()); |
| 366 | 370 | code2name.put(line.getLineCode(), line.getName()); |
| 371 | + name2code.put(line.getName(), line.getLineCode()); | |
| 367 | 372 | id2SHcode.put(line.getId(), line.getShanghaiLinecode()); |
| 368 | 373 | code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode()); |
| 369 | 374 | } |
| ... | ... | @@ -374,6 +379,7 @@ public class BasicData { |
| 374 | 379 | |
| 375 | 380 | lineId2CodeMap = biMap; |
| 376 | 381 | lineCode2NameMap = code2name; |
| 382 | + lineName2CodeMap = name2code; | |
| 377 | 383 | lineId2ShangHaiCodeMap = id2SHcode; |
| 378 | 384 | lineCode2ShangHaiCodeMap = code2SHcode; |
| 379 | 385 | stationName2YgcNumber = tempStationName2YgcNumber; | ... | ... |
src/main/java/com/bsth/message/entity/InoutPark.java
0 → 100644
| 1 | +package com.bsth.message.entity; | |
| 2 | + | |
| 3 | +import com.bsth.data.BasicData; | |
| 4 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * @author Hill | |
| 8 | + */ | |
| 9 | +@JsonIgnoreProperties(ignoreUnknown = true) | |
| 10 | +public class InoutPark { | |
| 11 | + | |
| 12 | + /** | |
| 13 | + * 线路名 | |
| 14 | + */ | |
| 15 | + private String line; | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 线路代码 | |
| 19 | + */ | |
| 20 | + private String lineId; | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 车辆编码 | |
| 24 | + */ | |
| 25 | + private String nbbm; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 发现时间(或发车时间) | |
| 29 | + */ | |
| 30 | + private String findTime; | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 进场/出场(绕改道) | |
| 34 | + */ | |
| 35 | + private String errType; | |
| 36 | + | |
| 37 | + public String getLine() { | |
| 38 | + return line; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public void setLine(String line) { | |
| 42 | + this.line = line; | |
| 43 | + this.lineId = BasicData.lineName2CodeMap.get(line); | |
| 44 | + } | |
| 45 | + | |
| 46 | + public String getLineId() { | |
| 47 | + return lineId; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public String getNbbm() { | |
| 51 | + return nbbm; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public void setNbbm(String nbbm) { | |
| 55 | + this.nbbm = nbbm; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public String getFindTime() { | |
| 59 | + return findTime; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public void setFindTime(String findTime) { | |
| 63 | + this.findTime = findTime; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public String getErrType() { | |
| 67 | + return errType; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public void setErrType(String errType) { | |
| 71 | + this.errType = errType; | |
| 72 | + } | |
| 73 | +} | ... | ... |
src/main/java/com/bsth/message/handler/MessageHandler.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.message.handler; |
| 3 | 3 | import com.bsth.message.buffer.CarEnergyBuffer; |
| 4 | 4 | import com.bsth.message.entity.CarEnergy; |
| 5 | 5 | import com.bsth.message.entity.CarErrorStop; |
| 6 | +import com.bsth.message.entity.InoutPark; | |
| 6 | 7 | import com.bsth.websocket.handler.SendUtils; |
| 7 | 8 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -50,4 +51,16 @@ public class MessageHandler { |
| 50 | 51 | e.printStackTrace(); |
| 51 | 52 | } |
| 52 | 53 | } |
| 54 | + | |
| 55 | + @KafkaListener(topics="schedule-mainsys-inoutpark") | |
| 56 | + public void receivedInoutPark(Message<String> message) { | |
| 57 | + try { | |
| 58 | + List<InoutPark> inoutParkList = mapper.readValue(message.getPayload(), mapper.getTypeFactory().constructParametricType(List.class, InoutPark.class)); | |
| 59 | + for (InoutPark inoutPark : inoutParkList) { | |
| 60 | + sendUtils.sendInoutPark(inoutPark); | |
| 61 | + } | |
| 62 | + } catch (IOException e) { | |
| 63 | + e.printStackTrace(); | |
| 64 | + } | |
| 65 | + } | |
| 53 | 66 | } | ... | ... |
src/main/java/com/bsth/websocket/handler/SendUtils.java
| ... | ... | @@ -9,6 +9,7 @@ import com.bsth.data.safe_driv.SafeDriv; |
| 9 | 9 | import com.bsth.entity.directive.D80; |
| 10 | 10 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 11 | 11 | import com.bsth.message.entity.CarErrorStop; |
| 12 | +import com.bsth.message.entity.InoutPark; | |
| 12 | 13 | import com.bsth.websocket.dto.WsScheduleRealInfo; |
| 13 | 14 | import com.fasterxml.jackson.core.JsonProcessingException; |
| 14 | 15 | import com.fasterxml.jackson.databind.ObjectMapper; |
| ... | ... | @@ -287,4 +288,22 @@ public class SendUtils{ |
| 287 | 288 | logger.error("sendCarErrorStop", e); |
| 288 | 289 | } |
| 289 | 290 | } |
| 291 | + | |
| 292 | + /** | |
| 293 | + * 将车辆进出场私自绕改道发送至线调页面 | |
| 294 | + */ | |
| 295 | + public void sendInoutPark(InoutPark inoutPark) { | |
| 296 | + Map<String, Object> map = new HashMap<>(); | |
| 297 | + map.put("fn", "inoutPark"); | |
| 298 | + map.put("data", inoutPark); | |
| 299 | + ObjectMapper mapper = new ObjectMapper(); | |
| 300 | + | |
| 301 | + try { | |
| 302 | + if (inoutPark.getLineId() != null) { | |
| 303 | + socketHandler.sendMessageToLine(inoutPark.getLineId(), mapper.writeValueAsString(map)); | |
| 304 | + } | |
| 305 | + } catch (JsonProcessingException e) { | |
| 306 | + logger.error("sendInoutPark", e); | |
| 307 | + } | |
| 308 | + } | |
| 290 | 309 | } | ... | ... |
src/main/resources/static/real_control_v2/js/platform/inoutPark.js
0 → 100644
| 1 | +/** | |
| 2 | + * 车辆异常停车相关 | |
| 3 | + */ | |
| 4 | +var gb_inoutpark = (function () { | |
| 5 | + var $wrap = $('.multi_plat_msg_pop_wrap'); | |
| 6 | + var max = 5; | |
| 7 | + | |
| 8 | + var pop = function (data) { | |
| 9 | + //时间格式化 | |
| 10 | + data.type = 'inoutpark'; | |
| 11 | + | |
| 12 | + var htmlStr = template('inoutpark_plat_msg_template', data); | |
| 13 | + var items = $wrap.find('.multi_plat_msg_pop'), len = items.length; | |
| 14 | + if (len >= max) | |
| 15 | + $wrap.find('.multi_plat_msg_pop:lt(' + (len - max) + ')').remove(); | |
| 16 | + | |
| 17 | + $wrap.append(htmlStr); | |
| 18 | + }; | |
| 19 | + | |
| 20 | + return { | |
| 21 | + pop: pop | |
| 22 | + } | |
| 23 | +})(); | |
| 0 | 24 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/js/safe_driv/safeDriv.js
src/main/resources/static/real_control_v2/js/websocket/sch_websocket.js
| ... | ... | @@ -204,6 +204,10 @@ var gb_sch_websocket = (function () { |
| 204 | 204 | gb_carerrorstop.pop(msg.data); |
| 205 | 205 | }; |
| 206 | 206 | |
| 207 | + var inoutPark = function (msg) { | |
| 208 | + gb_inoutpark.pop(msg.data); | |
| 209 | + } | |
| 210 | + | |
| 207 | 211 | var msgHandle = { |
| 208 | 212 | report80: report80, |
| 209 | 213 | faChe: faChe, |
| ... | ... | @@ -218,7 +222,8 @@ var gb_sch_websocket = (function () { |
| 218 | 222 | rfid: refreshRfid, |
| 219 | 223 | contingencyPlan: contingencyPlan, |
| 220 | 224 | maintenancePlan: maintenancePlan, |
| 221 | - carErrorStop: carErrorStop | |
| 225 | + carErrorStop: carErrorStop, | |
| 226 | + inoutPark: inoutPark | |
| 222 | 227 | }; |
| 223 | 228 | |
| 224 | 229 | function currentSecond() { | ... | ... |
src/main/resources/static/real_control_v2/main.html
| ... | ... | @@ -266,11 +266,22 @@ |
| 266 | 266 | </div> |
| 267 | 267 | </div> |
| 268 | 268 | </script> |
| 269 | +<script id="inoutpark_plat_msg_template" type="text/html"> | |
| 270 | + <div class="multi_plat_msg_pop uk-animation-slide-bottom" style="background-color: #FF7F24;" data-type="{{type}}" data-zbh="{{nbbm}}"> | |
| 271 | + <div> | |
| 272 | + <span class="title">{{errType}}私自绕改道</span> | |
| 273 | + <br/> | |
| 274 | + <span class="text"> {{line}} {{nbbm}} 在 {{findTime}} {{errType}}私自绕改道,<br/>请到运管中心处理</span> | |
| 275 | + <span class="desc" style="color: #ffffff">--浦东公交运管中心管理系统</span> | |
| 276 | + </div> | |
| 277 | + </div> | |
| 278 | +</script> | |
| 269 | 279 | |
| 270 | 280 | <script src="/real_control_v2/js/safe_driv/safeDriv.js" merge="custom_js"></script> |
| 271 | 281 | <script src="/real_control_v2/js/con_plan/conPlan.js" merge="custom_js"></script> |
| 272 | 282 | <script src="/real_control_v2/js/mt_plan/mtPlan.js" merge="custom_js"></script> |
| 273 | 283 | <script src="/real_control_v2/js/platform/carErrorStop.js" merge="custom_js"></script> |
| 284 | +<script src="/real_control_v2/js/platform/inoutPark.js" merge="custom_js"></script> | |
| 274 | 285 | <!-- #### 安全驾驶 end ### --> |
| 275 | 286 | |
| 276 | 287 | <!-- 打电话 --> | ... | ... |