Commit 4878b5a12062f414962fdccb0037a1d189062485
1 parent
03e6def0
1
Showing
1 changed file
with
27 additions
and
0 deletions
src/main/java/com/bsth/controller/realcontrol/ServiceDataInterface.java
| ... | ... | @@ -13,9 +13,12 @@ import com.bsth.data.gpsdata_v2.GpsRealData; |
| 13 | 13 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; |
| 14 | 14 | import com.bsth.data.schedule.DayOfSchedule; |
| 15 | 15 | import com.bsth.data.schedule.external.TccExternalService; |
| 16 | +import com.bsth.entity.Line; | |
| 16 | 17 | import com.bsth.entity.directive.D60; |
| 17 | 18 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 19 | +import com.bsth.repository.LineRepository; | |
| 18 | 20 | import com.bsth.repository.directive.D60Repository; |
| 21 | +import com.bsth.service.LineService; | |
| 19 | 22 | import com.bsth.websocket.handler.SendUtils; |
| 20 | 23 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 21 | 24 | import com.google.common.base.Splitter; |
| ... | ... | @@ -59,6 +62,13 @@ public class ServiceDataInterface { |
| 59 | 62 | @Autowired |
| 60 | 63 | private SendUtils sendUtils; |
| 61 | 64 | |
| 65 | + | |
| 66 | + @Autowired | |
| 67 | + LineRepository lineRepository; | |
| 68 | + | |
| 69 | + @Autowired | |
| 70 | + private LineService service; | |
| 71 | + | |
| 62 | 72 | /** |
| 63 | 73 | * 获取车辆 和 当前执行班次对照信息 |
| 64 | 74 | * |
| ... | ... | @@ -324,9 +334,26 @@ public class ServiceDataInterface { |
| 324 | 334 | |
| 325 | 335 | ObjectMapper mapper = new ObjectMapper(); |
| 326 | 336 | try { |
| 337 | + List<Map<String,String>> emergencyList = new ArrayList(); | |
| 338 | + List<Map<String,String>> emergencyListAll = new ArrayList(); | |
| 327 | 339 | List<Map> maps = mapper.readValue(jsonStr,mapper.getTypeFactory().constructParametricType(List.class, Map.class)); |
| 328 | 340 | for (Map map : maps) { |
| 329 | 341 | sendUtils.sendContingencyPlan(map); |
| 342 | + emergencyList.add((Map<String, String>) map.get("emergencyLine")); | |
| 343 | + } | |
| 344 | + | |
| 345 | + for (Map.Entry<String, String> m : BasicData.lineCode2NameMap.entrySet()){ | |
| 346 | + for (Map<String,String> emer : emergencyList){ | |
| 347 | + for (Map.Entry<String,String> t : emer.entrySet()){ | |
| 348 | + if(m.getKey().equals(t.getKey())){ | |
| 349 | + emergencyListAll.add(emer); // | |
| 350 | + Line line = lineRepository.findById(Integer.parseInt(t.getKey())).get(); | |
| 351 | + line.setName(t.getValue()); | |
| 352 | + Map<String, Object> status = service.update(line); | |
| 353 | + logger.info("应急接口修改线路名称-----------------------"+status.get("status")); | |
| 354 | + } | |
| 355 | + } | |
| 356 | + } | |
| 330 | 357 | } |
| 331 | 358 | } catch (IOException e) { |
| 332 | 359 | result.put("errCode", 502); | ... | ... |