@Test public void testSaveBusRouteFromCollection() { long start = System.currentTimeMillis(); List<BusRoute> list = iCollectInfoService.getBusRouteList(); for (BusRoute route : list) { if (route != null) { BusStation s1 = route.getStartStation(); BusStation s2 = route.getEndStation(); if (s1 != null && !"".equals(s1.getName())) { try { s1 = iBusStationService.findBusStation(s1.getName()); } catch (Exception e) { e.printStackTrace(); } route.setStartStation(s1); } if (s2 != null && !"".equals(s2.getName())) { try { s2 = iBusStationService.findBusStation(s2.getName()); } catch (Exception e) { e.printStackTrace(); } route.setEndStation(s2); } System.out.println(route); try { iBusRouteService.persist(route); } catch (Exception e) { e.printStackTrace(); } } } long end = System.currentTimeMillis(); System.out.println((end - start) / 1000f); }
@Test public void testGetBusListByStation() { BusStation s = null; try { s = iBusStationService.findBusStation("武科大新校区"); } catch (Exception e) { e.printStackTrace(); } if (s != null) { Set<BusRoute> set = s.getRouteStartStations(); for (BusRoute b : set) { System.out.println(b); } } }