diff --git a/src/main/java/team/free/freeway/api/dto/value/ElevatorLocation.java b/src/main/java/team/free/freeway/api/dto/value/ElevatorLocation.java index 5a3c8a7..3b7d41e 100644 --- a/src/main/java/team/free/freeway/api/dto/value/ElevatorLocation.java +++ b/src/main/java/team/free/freeway/api/dto/value/ElevatorLocation.java @@ -13,7 +13,7 @@ public class ElevatorLocation { @JsonAlias(value = "NODE_WKT") private String wellKnowText; - @JsonAlias(value = "SW_NM") + @JsonAlias(value = "SBWY_STN_NM") private String stationName; public Coordinate extractCoordinate() { diff --git a/src/main/java/team/free/freeway/api/dto/value/ElevatorStatusInfo.java b/src/main/java/team/free/freeway/api/dto/value/ElevatorStatusInfo.java index fb0774d..0b0341b 100644 --- a/src/main/java/team/free/freeway/api/dto/value/ElevatorStatusInfo.java +++ b/src/main/java/team/free/freeway/api/dto/value/ElevatorStatusInfo.java @@ -11,22 +11,22 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public class ElevatorStatusInfo { - @JsonAlias(value = "STATION_NM") + @JsonAlias(value = "STN_NM") private String stationName; - @JsonAlias(value = "FACI_NM") + @JsonAlias(value = "ELVTR_NM") private String elevatorName; - @JsonAlias(value = "STUP_LCTN") + @JsonAlias(value = "OPR_SEC") private String elevatorFloor; - @JsonAlias(value = "LOCATION") + @JsonAlias(value = "INSTL_PSTN") private String location; @JsonAlias(value = "USE_YN") private String status; - @JsonAlias(value = "GUBUN") + @JsonAlias(value = "ELVTR_SE") private String category; } diff --git a/src/main/java/team/free/freeway/api/dto/value/StationContact.java b/src/main/java/team/free/freeway/api/dto/value/StationContact.java index 79fab26..9764bb8 100644 --- a/src/main/java/team/free/freeway/api/dto/value/StationContact.java +++ b/src/main/java/team/free/freeway/api/dto/value/StationContact.java @@ -9,10 +9,10 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public class StationContact { - @JsonAlias(value = "LINE") + @JsonAlias(value = "SBWY_ROUT_LN") private String lineName; - @JsonAlias(value = "STATN_NM") + @JsonAlias(value = "SBWY_STNS_NM") private String stationName; @JsonAlias(value = "TELNO") diff --git a/src/main/java/team/free/freeway/api/dto/value/StationImage.java b/src/main/java/team/free/freeway/api/dto/value/StationImage.java index 504316b..e952599 100644 --- a/src/main/java/team/free/freeway/api/dto/value/StationImage.java +++ b/src/main/java/team/free/freeway/api/dto/value/StationImage.java @@ -9,12 +9,12 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public class StationImage { - @JsonAlias(value = "STN_NM") + @JsonAlias(value = "STTN") private String stationName; - @JsonAlias(value = "STN_LINE") + @JsonAlias(value = "SBWY_ROUT_LN") private String lineId; - @JsonAlias(value = "STN_IMG_URL") + @JsonAlias(value = "IMG_LINK") private String stationImageUrl; } diff --git a/src/main/java/team/free/freeway/init/ElevatorInitializer.java b/src/main/java/team/free/freeway/init/ElevatorInitializer.java index 753eea2..51db373 100644 --- a/src/main/java/team/free/freeway/init/ElevatorInitializer.java +++ b/src/main/java/team/free/freeway/init/ElevatorInitializer.java @@ -3,6 +3,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import team.free.freeway.api.SeoulOpenAPIManager; import team.free.freeway.api.dto.value.ElevatorLocation; import team.free.freeway.api.dto.value.ElevatorStatusInfo; @@ -49,8 +50,8 @@ private Map> createElevatorLocationMap(List specificElevatorLocationList = - elevatorLocationMap.getOrDefault(stationName, new ArrayList<>()); + List specificElevatorLocationList = elevatorLocationMap + .getOrDefault(stationName, new ArrayList<>()); specificElevatorLocationList.add(elevatorLocation); elevatorLocationMap.put(stationName, specificElevatorLocationList); } @@ -60,7 +61,7 @@ private Map> createElevatorLocationMap(List> elevatorLocationMap, Station station) { List elevatorLocationList = elevatorLocationMap.get(station.getName()); - if (elevatorLocationList == null || elevatorLocationList.isEmpty()) { + if (CollectionUtils.isEmpty(elevatorLocationList)) { return; } diff --git a/src/main/java/team/free/freeway/init/StationInitializer.java b/src/main/java/team/free/freeway/init/StationInitializer.java index b99cebe..2582d3a 100644 --- a/src/main/java/team/free/freeway/init/StationInitializer.java +++ b/src/main/java/team/free/freeway/init/StationInitializer.java @@ -1,6 +1,7 @@ package team.free.freeway.init; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; @@ -28,13 +29,14 @@ import static team.free.freeway.init.constant.StationExcelIndex.LINE_NAME_INDEX; import static team.free.freeway.init.constant.StationExcelIndex.STATION_NAME_INDEX; +@Slf4j @Transactional @RequiredArgsConstructor @Component public class StationInitializer { - private static final String STATION_CODE_INFO_PATH = "/Users/jcw/Develop/Free-Way/src/main/resources/station_code.xlsx"; - private static final String NEXT_STATION_INFO_PATH = "/Users/jcw/Develop/Free-Way/src/main/resources/next_station.xlsx"; + private static final String STATION_CODE_INFO_PATH = "/Users/jcw1031/Develop/TeamProject/Free-Way/src/main/resources/station_code.xlsx"; + private static final String NEXT_STATION_INFO_PATH = "/Users/jcw1031/Develop/TeamProject/Free-Way/src/main/resources/next_station.xlsx"; private final KakaoAPIManager kakaoAPIManager; private final StationRepository stationRepository; @@ -51,8 +53,9 @@ public void initializeStation() throws IOException { String stationName = row.getCell(STATION_NAME_INDEX).toString(); stationName = StationNameUtils.getPureStationName(stationName); + log.info("지하철역 이름: {}, 호선: {}", stationName, lineName); Location location = kakaoAPIManager.getStationLocationInfo(stationName, lineName); - if (!location.getAddress().startsWith("서울")) { + if (location == null || !location.getAddress().startsWith("서울")) { continue; }