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,9 +13,12 @@ import com.bsth.data.gpsdata_v2.GpsRealData; | ||
| 13 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; | 13 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; |
| 14 | import com.bsth.data.schedule.DayOfSchedule; | 14 | import com.bsth.data.schedule.DayOfSchedule; |
| 15 | import com.bsth.data.schedule.external.TccExternalService; | 15 | import com.bsth.data.schedule.external.TccExternalService; |
| 16 | +import com.bsth.entity.Line; | ||
| 16 | import com.bsth.entity.directive.D60; | 17 | import com.bsth.entity.directive.D60; |
| 17 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 18 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 19 | +import com.bsth.repository.LineRepository; | ||
| 18 | import com.bsth.repository.directive.D60Repository; | 20 | import com.bsth.repository.directive.D60Repository; |
| 21 | +import com.bsth.service.LineService; | ||
| 19 | import com.bsth.websocket.handler.SendUtils; | 22 | import com.bsth.websocket.handler.SendUtils; |
| 20 | import com.fasterxml.jackson.databind.ObjectMapper; | 23 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 21 | import com.google.common.base.Splitter; | 24 | import com.google.common.base.Splitter; |
| @@ -59,6 +62,13 @@ public class ServiceDataInterface { | @@ -59,6 +62,13 @@ public class ServiceDataInterface { | ||
| 59 | @Autowired | 62 | @Autowired |
| 60 | private SendUtils sendUtils; | 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,9 +334,26 @@ public class ServiceDataInterface { | ||
| 324 | 334 | ||
| 325 | ObjectMapper mapper = new ObjectMapper(); | 335 | ObjectMapper mapper = new ObjectMapper(); |
| 326 | try { | 336 | try { |
| 337 | + List<Map<String,String>> emergencyList = new ArrayList(); | ||
| 338 | + List<Map<String,String>> emergencyListAll = new ArrayList(); | ||
| 327 | List<Map> maps = mapper.readValue(jsonStr,mapper.getTypeFactory().constructParametricType(List.class, Map.class)); | 339 | List<Map> maps = mapper.readValue(jsonStr,mapper.getTypeFactory().constructParametricType(List.class, Map.class)); |
| 328 | for (Map map : maps) { | 340 | for (Map map : maps) { |
| 329 | sendUtils.sendContingencyPlan(map); | 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 | } catch (IOException e) { | 358 | } catch (IOException e) { |
| 332 | result.put("errCode", 502); | 359 | result.put("errCode", 502); |