diff --git a/README.md b/README.md
new file mode 100644
index 00000000..81f83b46
--- /dev/null
+++ b/README.md
@@ -0,0 +1,190 @@
+# WaybleποΈ
+
+
+**μ¬μ©μλ₯Ό μν λ§μΆ€ν 배리μ΄ν리 μλΉμ€ Wayble**
+
+> λͺ¨λμ νΈλ¦¬ν μ΄λμ μν λ§μΆ€ν κ²½λ‘ νμ λ° μ₯μ μΆμ² μλΉμ€
+> μ₯μ μ νλ³Β·μ΄λ μλ¨λ³ μ΅μ νλ κ²½λ‘ μλ΄μ μ κ·Όμ± μ 보 곡μ νλ«νΌ, Waybleμμ λ§λ보μΈμ!
+
+
+
+
+### [π οΈWayble μλΉμ€ λ§ν¬ λ°λ‘κ°κΈ°](https://wayble.site)
+### [π¬Wayble λ
Έμ
λ§ν¬ λ°λ‘κ°κΈ°](https://www.notion.so/wayble-20475cf0b87b806d9473feb579ab23e0)
+
+### π Content
+- [π ν μκ°](#ν-μκ°)
+- [π κΈ°μ μ€ν](#κΈ°μ -μ€ν)
+- [π μλΉμ€ κ³ μ λ°°κ²½](#μλΉμ€-κ³ μ-λ°°κ²½)
+- [π μ£Όμ κΈ°λ₯](#μ£Όμ-κΈ°λ₯)
+- [π μμΈ κΈ°λ₯](#μμΈ-κΈ°λ₯)
+- [π BE ν΄λ ꡬ쑰](#BE-ν΄λ-ꡬ쑰)
+- [π BE μμ€ν
ꡬμ±λ](#BE-μμ€ν
-ꡬμ±)
+- [π λ°μ΄ν°λ² μ΄μ€ ꡬ쑰](#λ°μ΄ν°λ² μ΄μ€-ꡬ쑰)
+- [π api λͺ
μΈ](#api-λͺ
μΈ)
+
+
+
+
+
+
+## π ν μκ°
+> Team
+> κΈ°μΉλ―Ό μν¨μΈ μ μΉμΈ μ΄μμ€ μ£Όμ λΉ
+
+
+| κΈ°μΉλ―Ό (Lead) | μν¨μΈ | μ μΉμΈ | μ΄μμ€ | μ£Όμ λΉ |
+| ---------------------------------------- | ------------------------------------ | -------------------------------------- | ------------------------------------------------ | -------------------------------------- |
+|  |  || | 
+| BE | BE | BE | BE | BE |
+| [@KiSeungMin](https://github.com/KiSeungMin) |[@hyoinYang](https://github.com/hyoinYang)|[@seung-in-Yoo](https://github.com/seung-in-Yoo) | [@wonjun-lee-fcwj245](https://github.com/wonjun-lee-fcwj245) |[@zyovn](https://github.com/zyovn) |
+
+
+
+## π κΈ°μ μ€ν
+
+| Category | Stack |
+| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Framework / Runtime |   |
+| Programming Language |  |
+| Database / Search |    |
+| Infrastructure |      |
+| API / Data |   |
+| Authentication |  |
+| CI/CD |  |
+| Version Control |   |
+
+
+
+## π μλΉμ€ κ³ μ λ°°κ²½
+### π νλ‘μ νΈ κ°μ
+
+WAYBLEμ μ₯μ μΈΒ·κ΅ν΅μ½μ μ¬μ©μλ₯Ό μν΄ λ§μΆ€ν κ²½λ‘ νμ, μ κ·Όμ± νν° κΈ°λ° μ₯μ μΆμ², μ κ·Όμ± λ¦¬λ·° 곡μ κΈ°λ₯μ μ 곡νλ 배리μ΄ν리 μ§λ μλΉμ€μ
λλ€.
+μ¬μ©μμ μ₯μ μ νκ³Ό μ΄λ μλ¨ μ€μ μ λ°λΌ μ΅μ νλ κ²½λ‘λ₯Ό μλ΄νκ³ , λꡬλ μ κ·Όμ± μ 보λ₯Ό λ±λ‘Β·νμΈνμ¬ λͺ¨λμ μ΄λκΆμ 보μ₯ν©λλ€.
+
+### π¦ κΈ°νμ μμ
+μ μ₯μ μΈμ μ£Όλ³μμ μμ£Ό 보μ΄μ§ μμκΉ?
+κ΅ν΅μλ¨ μ΄μ©μ μ΄λ €μ
+μΆ©λΆν 보μ₯λμ§ μλ μν μ κ·Όμ±
+λΆμ‘±ν μ΄λ νΈμ μλΉμ€
+μ₯μ μΈ μΈν°λ·°μμ λμ¨ λͺ©μ리
+
+> "λ§€μΌ λκ°μ μλΉμ κ°μ.",
+> "νλ£¨κ° κ³νλλ‘ λμ§ μμμ.",
+> "μλ¦¬λ² μ΄ν° μμΉ μ λ³΄κ° λΆμ νν΄μ μ΄λμ΄ νλ€μ΄μ."
+
+κΈ°μ‘΄ μ§λ μλΉμ€μλ μλ¦¬λ² μ΄ν°Β·κ²½μ¬λ‘Β·μ₯μ μΈ νμ₯μ€ λ± μ₯μ μΈλ€μ μν νμ€ν μ λ³΄κ° λΆμΆ©λΆνκ³ ,
+μ₯μ μ νλ³ κ²½λ‘ μλ΄, μ₯μ μΈλ€λ§μ μ κ·Όμ± λ¦¬λ·° 곡μ κΈ°λ₯λ± νΈμμ±μ΄ μ 곡λμ§ μμ΅λλ€.
+
+### π‘ μλΉμ€ μκ°
+
+**WAYBLEμ**
+- μ₯μ μ νκ³Ό μ΄λ μλ¨ μ€μ μ λ°λΌ UIΒ·μλ΄ μ 보 μλ μ΅μ ν
+- μ κ·Όμ± νν° κΈ°λ° μ₯μ κ²μΒ·μΆμ²
+- μ₯μ μΈλ€μ κΈ°λ°μΌλ‘ ν μ°Έμ¬ν μ κ·Όμ± λ¦¬λ·° 곡μ
+- μ₯μ μΈμ μ΄λ κ²½ν κ°μ λ° λ§λͺ»νλ μ¬μν λΆνΈ ν΄μ
+λ₯Ό λͺ©νλ‘ νλ 배리μ΄ν리 μ§λ νλ«νΌμ
λλ€.
+
+### π― μλΉμ€ λͺ©ν
+
+**μ₯μ μ νΒ·μ΄λ μλ¨λ³ μ΅μ νλ κ²½λ‘ νμ**
+
+**μ κ·Όμ± νν° κΈ°λ° μ₯μ μΆμ²**
+
+**μ₯μ μΈ μ°Έμ¬ν μ κ·Όμ± μ 보 μμ§Β·κ³΅μ **
+
+(μ±μ°κΈ°)
+
+
+
+## π μ£Όμ κΈ°λ₯
+**1. μ§λ κΈ°λ° μ κ·Ό κ°λ₯ μ₯μ κ²μ**
+
+μλ¦¬λ² μ΄ν°, κ²½μ¬λ‘, μ₯μ μΈ νμ₯μ€ λ± μ₯μ μΈλ€μ΄ νμμ μΌλ‘ μκ³ μΆμ΄νλ μ 보λ€λ‘ μ₯μ νν°λ§
+μμΉ κΈ°λ° μΆμ²
+
+**2. λ§μΆ€ν κ²½λ‘ μλ΄**
+
+μ₯μ μ νλ³ κ²½λ‘ μ΅μ ν (ν 체μ΄, μκ°μ₯μ , μ§μ μ₯μ λ±)
+
+μ¨μ΄λΈ λ§μ»€ (κ²½μ¬λ‘, ν μ²΄μ΄ μΆ©μ κΈ° λ±)μ νμ©νμ¬ μ»€μ€ν
μΆμ² κ²½λ‘ μ 곡
+
+λμ€κ΅ν΅ κ²½λ‘μμ μ₯μ μΈλ€μκ² νμν μ 보(μ§νμ² μ-μλ¦¬λ² μ΄ν° μμΉ λ±, λ²μ€-μ μλ²μ€ μ¬λΆ λ±) μ 곡
+
+**3. μ κ·Όμ± λ¦¬λ·° μμ±Β·μ΄λ**
+
+μ΄μ©μκ° λ¨κΈ΄ μ κ·Όμ± μ€μ¬ 리뷰 νμΈ
+
+**4. λ§μ΄ νλ μ΄μ€**
+
+λλ§μ μ₯μ μ¨μ΄λΈμ‘΄ 리μ€νΈ μ μ₯
+
+μ μ₯ν μ₯μλ³ μ¨μ΄λΈμ‘΄ μ‘°ν λ° μμ
+
+(μ±μ°κΈ°)
+
+
+
+## ποΈλ°μ΄ν°λ² μ΄μ€ ꡬ쑰
+
+
+
+
+
+
+## π΄ν΄λ ꡬ쑰
+```
+wayble-server/
+βββ java/
+β βββ com/
+β βββ wayble/
+β βββ server/
+β βββ admin/ # κ΄λ¦¬μ κ΄λ ¨ κΈ°λ₯
+β βββ auth/ # μΈμ¦ λ° μΈκ° κ΄λ ¨ κΈ°λ₯
+β βββ aws/ # AWS μ°λ (S3, CloudWatch λ±)
+β βββ common/ # κ³΅ν΅ μ νΈ, μμΈ μ²λ¦¬ λ±
+β βββ direction/ # κΈΈμ°ΎκΈ° λ° κ²½λ‘ μλ΄
+β βββ explore/ # νμ λ° μΆμ² κ΄λ ¨
+β βββ logging/ # λ‘κΉ
μ€μ
+β βββ review/ # 리뷰 μμ± λ° μ‘°ν
+β βββ user/ # μ μ κ΄λ ¨ κΈ°λ₯
+β βββ wayblezone/ # μ¨μ΄λΈμ‘΄ κ΄λ ¨ κΈ°λ₯
+β βββ ServerApplication.java
+β
+βββ resources/
+β βββ data/ # λ°μ΄ν° κ΄λ ¨ 리μμ€
+β βββ elasticsearch/ # Elasticsearch κ΄λ ¨ μ€μ
+β βββ templates/ # ν
νλ¦Ώ νμΌ
+β βββ application.properties # Spring Boot νκ²½ μ€μ
+β βββ application_secret.yml # λ―Όκ° μ 보 μ€μ
+β βββ keystore.p12 # HTTPS μΈμ¦μ
+β βββ logback-spring.xml
+β βββ seocho_pedestrian.json # μμ΄κ΅¬ 보νμ λ°μ΄ν°
+β βββ wayble_markers.json # μ¨μ΄λΈ λ§μ»€ λ°μ΄ν°
+β
+βββ test/ # ν
μ€νΈ κ΄λ ¨
+β
+βββ wrapper/
+βββ .gitattributes
+βββ .gitignore
+βββ .coderabbit.yml
+βββ application.yml
+βββ build.gradle
+βββ docker-compose.yml
+βββ docker-els.yml
+βββ Dockerfile
+βββ Dockerfile.elasticsearch
+βββ gradlew
+```
+
+
+## πμμ€ν
ꡬμ±λ
+
+
+
+
+## βοΈAPI λͺ
μΈ
+
+#### [π οΈWayble κΈ°λ₯λͺ
μΈ λ§ν¬](https://www.notion.so/API-21d75cf0b87b80248a0ec55c6134ad20)
+
+
diff --git a/src/main/java/com/wayble/server/common/config/WebClientConfig.java b/src/main/java/com/wayble/server/common/config/WebClientConfig.java
index 8a8d4380..acbbf298 100644
--- a/src/main/java/com/wayble/server/common/config/WebClientConfig.java
+++ b/src/main/java/com/wayble/server/common/config/WebClientConfig.java
@@ -31,6 +31,11 @@ public WebClient tMapWebClient() {
public WebClient kricWebClient() {
return WebClient.builder()
.baseUrl(kricProperties.baseUrl())
+ .codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(2 * 1024 * 1024))
+ .filter((request, next) -> next.exchange(request)
+ .timeout(java.time.Duration.ofSeconds(15))
+ .retryWhen(reactor.util.retry.Retry.backoff(3, java.time.Duration.ofSeconds(1))
+ .filter(throwable -> throwable instanceof org.springframework.web.reactive.function.client.WebClientRequestException)))
.build();
}
}
diff --git a/src/main/java/com/wayble/server/direction/dto/response/TransportationResponseDto.java b/src/main/java/com/wayble/server/direction/dto/response/TransportationResponseDto.java
index 1cb9c64b..9ade2ec5 100644
--- a/src/main/java/com/wayble/server/direction/dto/response/TransportationResponseDto.java
+++ b/src/main/java/com/wayble/server/direction/dto/response/TransportationResponseDto.java
@@ -20,7 +20,7 @@ public record Step(
DirectionType mode, // μ: START, WALK, SUBWAY, BUS, FINISH
@Nullable List moveInfo, // κ°μ StepμΌλ‘ μ΄λν μ λ₯μ₯(Node) μ 보 (μ€κ° μ λ₯μ₯λ§)
@Nullable String routeName,
- Integer moveNumber, // κ°μ Step(route)λ‘ μ΄λν νμ
+ Integer moveNumber, // κ°μ Step(route)λ‘ μ΄λν νμ λλ WALK stepμ κ²½μ° κ±°λ¦¬(λ―Έν° λ¨μ)
@Nullable BusInfo busInfo, // λ²μ€μΌ κ²½μ°μλ§ μμ±, μ΄μΈμ κ²½μ° null
@Nullable SubwayInfo subwayInfo, // μ§νμ² μΌ κ²½μ°μλ§ μμ±, μ΄μΈμ κ²½μ° null
String from,
@@ -43,8 +43,8 @@ public record BusInfo(
){}
public record SubwayInfo(
- List wheelchair,
- List elevator,
+ List wheelchair,
+ List elevator,
Boolean accessibleRestroom
) {}
@@ -55,8 +55,8 @@ public record LocationInfo(
// μ§νμ² μμ€ μ 보 λ¬Άμ (μλΉμ€ λ΄λΆμμ μ¬μ©)
public record NodeInfo(
- List wheelchair,
- List elevator,
+ List wheelchair,
+ List elevator,
Boolean accessibleRestroom
) {}
}
diff --git a/src/main/java/com/wayble/server/direction/entity/transportation/Facility.java b/src/main/java/com/wayble/server/direction/entity/transportation/Facility.java
index c4e62daf..88e58c22 100644
--- a/src/main/java/com/wayble/server/direction/entity/transportation/Facility.java
+++ b/src/main/java/com/wayble/server/direction/entity/transportation/Facility.java
@@ -16,7 +16,6 @@
@Table(name = "facility")
public class Facility {
@Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name="stationName")
diff --git a/src/main/java/com/wayble/server/direction/entity/transportation/Route.java b/src/main/java/com/wayble/server/direction/entity/transportation/Route.java
index 38caac82..d35c1714 100644
--- a/src/main/java/com/wayble/server/direction/entity/transportation/Route.java
+++ b/src/main/java/com/wayble/server/direction/entity/transportation/Route.java
@@ -6,6 +6,8 @@
import jakarta.persistence.*;
import lombok.*;
+import java.util.List;
+
@Entity
@Getter
@Builder(access = AccessLevel.PRIVATE)
@@ -33,4 +35,8 @@ public class Route {
@ManyToOne
@JoinColumn(name = "end_node_id")
private Node endNode;
+
+ // ν μ²΄μ΄ μ 보
+ @OneToMany(mappedBy = "route", fetch = FetchType.LAZY)
+ private List wheelchairs;
}
diff --git a/src/main/java/com/wayble/server/direction/entity/transportation/Wheelchair.java b/src/main/java/com/wayble/server/direction/entity/transportation/Wheelchair.java
new file mode 100644
index 00000000..0a21f445
--- /dev/null
+++ b/src/main/java/com/wayble/server/direction/entity/transportation/Wheelchair.java
@@ -0,0 +1,24 @@
+package com.wayble.server.direction.entity.transportation;
+
+import jakarta.persistence.*;
+import lombok.*;
+
+@Entity
+@Getter
+@Builder
+@AllArgsConstructor(access = AccessLevel.PROTECTED)
+@NoArgsConstructor(access = AccessLevel.PROTECTED)
+@Table(name = "wheelchair")
+public class Wheelchair {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Long id;
+
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "route_id", nullable = false)
+ private Route route;
+
+ @Column(name = "wheelchair_location", nullable = false)
+ private String wheelchairLocation; // 1-4 λ±
+
+}
diff --git a/src/main/java/com/wayble/server/direction/external/kric/dto/KricToiletRawBody.java b/src/main/java/com/wayble/server/direction/external/kric/dto/KricToiletRawBody.java
deleted file mode 100644
index 3af1db3f..00000000
--- a/src/main/java/com/wayble/server/direction/external/kric/dto/KricToiletRawBody.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.wayble.server.direction.external.kric.dto;
-
-import java.util.List;
-
-public record KricToiletRawBody(
- List item
-) {}
diff --git a/src/main/java/com/wayble/server/direction/external/kric/dto/KricToiletRawItem.java b/src/main/java/com/wayble/server/direction/external/kric/dto/KricToiletRawItem.java
index ddd6f918..43d676de 100644
--- a/src/main/java/com/wayble/server/direction/external/kric/dto/KricToiletRawItem.java
+++ b/src/main/java/com/wayble/server/direction/external/kric/dto/KricToiletRawItem.java
@@ -3,6 +3,15 @@
import lombok.Getter;
public record KricToiletRawItem(
+ String railOprIsttCd,
+ String lnCd,
String stinCd,
- String toltNum
+ String grndDvNm,
+ String stinFlor,
+ String gateInotDvNm,
+ String exitNo,
+ String dtlLoc,
+ String mlFmlDvNm,
+ String toltNum,
+ String diapExchNum
) {}
diff --git a/src/main/java/com/wayble/server/direction/external/kric/dto/KricToiletRawResponse.java b/src/main/java/com/wayble/server/direction/external/kric/dto/KricToiletRawResponse.java
index b0b3faac..26ecde7d 100644
--- a/src/main/java/com/wayble/server/direction/external/kric/dto/KricToiletRawResponse.java
+++ b/src/main/java/com/wayble/server/direction/external/kric/dto/KricToiletRawResponse.java
@@ -3,5 +3,5 @@
import java.util.List;
public record KricToiletRawResponse(
- KricToiletRawBody body
+ List body
) {}
\ No newline at end of file
diff --git a/src/main/java/com/wayble/server/direction/repository/FacilityRepository.java b/src/main/java/com/wayble/server/direction/repository/FacilityRepository.java
index 7fe4a12d..d8a12c9c 100644
--- a/src/main/java/com/wayble/server/direction/repository/FacilityRepository.java
+++ b/src/main/java/com/wayble/server/direction/repository/FacilityRepository.java
@@ -6,7 +6,12 @@
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
public interface FacilityRepository extends JpaRepository {
- Optional findByNodeId(Long nodeId);
+ @Query("SELECT f FROM Facility f " +
+ "LEFT JOIN FETCH f.lifts " +
+ "WHERE f.id = :nodeId")
+ Optional findByNodeId(@Param("nodeId") Long nodeId);
}
diff --git a/src/main/java/com/wayble/server/direction/repository/WheelchairInfoRepository.java b/src/main/java/com/wayble/server/direction/repository/WheelchairInfoRepository.java
new file mode 100644
index 00000000..007fd898
--- /dev/null
+++ b/src/main/java/com/wayble/server/direction/repository/WheelchairInfoRepository.java
@@ -0,0 +1,15 @@
+package com.wayble.server.direction.repository;
+
+import com.wayble.server.direction.entity.transportation.Wheelchair;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
+import java.util.Optional;
+
+public interface WheelchairInfoRepository extends JpaRepository {
+
+ @Query("SELECT w FROM Wheelchair w WHERE w.route.routeId = :routeId")
+ List findByRouteId(@Param("routeId") Long routeId);
+}
diff --git a/src/main/java/com/wayble/server/direction/service/FacilityService.java b/src/main/java/com/wayble/server/direction/service/FacilityService.java
index fbd4450c..25f9f000 100644
--- a/src/main/java/com/wayble/server/direction/service/FacilityService.java
+++ b/src/main/java/com/wayble/server/direction/service/FacilityService.java
@@ -2,9 +2,13 @@
import com.wayble.server.direction.dto.response.TransportationResponseDto;
import com.wayble.server.direction.entity.transportation.Facility;
+import com.wayble.server.direction.entity.transportation.Node;
+import com.wayble.server.direction.entity.transportation.Wheelchair;
import com.wayble.server.direction.external.kric.dto.KricToiletRawItem;
import com.wayble.server.direction.external.kric.dto.KricToiletRawResponse;
import com.wayble.server.direction.repository.FacilityRepository;
+import com.wayble.server.direction.repository.NodeRepository;
+import com.wayble.server.direction.repository.WheelchairInfoRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -17,7 +21,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.stream.Collectors;
+import java.util.Optional;
@Service
@@ -25,38 +29,49 @@
@RequiredArgsConstructor
public class FacilityService {
private final FacilityRepository facilityRepository;
+ private final NodeRepository nodeRepository;
+ private final WheelchairInfoRepository wheelchairInfoRepository;
private final WebClient kricWebClient;
private final KricProperties kricProperties;
- public TransportationResponseDto.NodeInfo getNodeInfo(Long nodeId){
- Facility facility = facilityRepository.findByNodeId(nodeId).orElse(null);
- List wheelchair = new ArrayList<>();
- List elevator = new ArrayList<>();
+ public TransportationResponseDto.NodeInfo getNodeInfo(Long nodeId, Long routeId) {
+ List wheelchair = new ArrayList<>();
+ List elevator = new ArrayList<>();
Boolean accessibleRestroom = false;
- if (facility != null) {
- if (facility.getLifts() != null) {
- wheelchair = facility.getLifts().stream()
- .map(lift -> new TransportationResponseDto.LocationInfo(
- lift.getLatitude(),
- lift.getLongitude()
- ))
- .toList();
+ Optional nodeOpt = nodeRepository.findById(nodeId);
+
+ if (nodeOpt.isPresent()) {
+ Node node = nodeOpt.get();
+
+ if (routeId != null) {
+ List wheelchairs = wheelchairInfoRepository.findByRouteId(routeId);
+ for (Wheelchair wheelchairInfo : wheelchairs) {
+ String location = wheelchairInfo.getWheelchairLocation();
+ if (location != null && !location.trim().isEmpty()) {
+ wheelchair.add(location.trim());
+ }
+ }
}
-
- if (facility.getElevators() != null) {
- elevator = facility.getElevators().stream()
- .map(elev -> new TransportationResponseDto.LocationInfo(
- elev.getLatitude(),
- elev.getLongitude()
- ))
- .toList();
+
+ elevator = new ArrayList<>();
+
+ Facility facility = facilityRepository.findByNodeId(nodeId).orElse(null);
+ if (facility != null) {
+ String stinCd = facility.getStinCd();
+ String railOprLsttCd = facility.getRailOprLsttCd();
+ String lnCd = facility.getLnCd();
+
+ if (stinCd != null && railOprLsttCd != null && lnCd != null) {
+ Map toiletInfo = getToiletInfo(facility);
+ accessibleRestroom = toiletInfo.getOrDefault(stinCd, false);
+ } else {
+ log.error("Facility μ 보 λλ½ - nodeId: {}, stinCd: {}, railOprLsttCd: {}, lnCd: {}",
+ nodeId, stinCd, railOprLsttCd, lnCd);
+ }
+ } else {
+ log.error("Facility μ 보 μμ - nodeId: {}", nodeId);
}
-
- // Get toilet information
- Map toiletInfo = getToiletInfo(facility);
- String stinCd = facility.getStinCd();
- accessibleRestroom = toiletInfo.getOrDefault(stinCd, false);
}
return new TransportationResponseDto.NodeInfo(
@@ -66,11 +81,13 @@ public TransportationResponseDto.NodeInfo getNodeInfo(Long nodeId){
);
}
- private Map getToiletInfo(Facility facility){
- String uri = UriComponentsBuilder.fromPath("/api/vulnerableUserInfo/stationDisabledToilet")
+
+
+ private Map getToiletInfo(Facility facility) {
+ String uri = UriComponentsBuilder.fromPath("/openapi/vulnerableUserInfo/stationDisabledToilet")
.queryParam("serviceKey", kricProperties.key())
.queryParam("format", "json")
- .queryParam("railOprLsttCd", facility.getRailOprLsttCd())
+ .queryParam("railOprIsttCd", facility.getRailOprLsttCd())
.queryParam("lnCd", facility.getLnCd())
.queryParam("stinCd", facility.getStinCd())
.toUriString();
@@ -83,25 +100,34 @@ private Map getToiletInfo(Facility facility){
.retrieve()
.bodyToMono(KricToiletRawResponse.class)
.block();
-
- items = response.body().item();
-
- } catch(Exception e){
- log.info("μμ¬ νμ₯μ€ api νΈμΆ μ€ μλ¬ λ°μ: {}: {}", uri, e.getCause());
+
+ if (response == null || response.body() == null) {
+ return new HashMap<>();
+ }
+
+ items = response.body();
+ if (items == null) {
+ return new HashMap<>();
+ }
+ } catch(Exception e) {
+ log.error("KRIC API νΈμΆ μ€ν¨ - stinCd: {}, railOprIsttCd: {}, lnCd: {}, error: {}",
+ facility.getStinCd(), facility.getRailOprLsttCd(), facility.getLnCd(), e.getMessage(), e);
return new HashMap<>();
}
- // μλ³λ‘ νμ₯μ€ μ‘΄μ¬ μ¬λΆ μΆμΆ (μ€λ³΅ μ κ±°)
Map stationToiletMap = new HashMap<>();
- for (KricToiletRawItem item : items) {
- String stinCd = item.stinCd();
- int toiletCount = 0;
- try {
- toiletCount = Integer.parseInt(item.toltNum());
- } catch (NumberFormatException e) {
- log.warn("μ§νμ² μ ν μ΄λ κ°μ νμ± μ€ν¨. μ§νμ² μ λ²νΈ {}: {}", stinCd, item.toltNum(), e);
+ if (items != null) {
+ for (KricToiletRawItem item : items) {
+ String stinCd = item.stinCd();
+ int toiletCount = 0;
+ try {
+ toiletCount = Integer.parseInt(item.toltNum());
+ } catch (NumberFormatException e) {
+ log.warn("μ₯μ μΈ νμ₯μ€ μ 보 νμ± μ€ν¨. stinCd: {}, toltNum: {}", stinCd, item.toltNum());
+ }
+ boolean hasToilet = stationToiletMap.getOrDefault(stinCd, false) || toiletCount > 0;
+ stationToiletMap.put(stinCd, hasToilet);
}
- stationToiletMap.put(stinCd, stationToiletMap.getOrDefault(stinCd, false) || toiletCount > 0);
}
return stationToiletMap;
diff --git a/src/main/java/com/wayble/server/direction/service/TransportationService.java b/src/main/java/com/wayble/server/direction/service/TransportationService.java
index 50e4759d..ecb9a886 100644
--- a/src/main/java/com/wayble/server/direction/service/TransportationService.java
+++ b/src/main/java/com/wayble/server/direction/service/TransportationService.java
@@ -277,7 +277,7 @@ private boolean areRoutesIdentical(List route1,
}
private List> filterAndSortRoutes(List> routes) {
- return routes.stream()
+ return routes.stream()
.filter(route -> {
// λμ€κ΅ν΅ ν¬ν¨ μ¬λΆ νμΈ
boolean hasPublicTransport = route.stream()
@@ -287,9 +287,9 @@ private List> filterAndSortRoutes(List>comparingInt(this::calculateTransferCount)
@@ -590,8 +590,20 @@ private List mergeConsecutiveRoutes(List p
String toName = getNodeName(pathEdges.get(j - 1).getEndNode());
if (currentType == DirectionType.WALK) {
+ int walkDistance = 0; // λ―Έν° λ¨μ
+ Node walkStartNode = pathEdges.get(i).getStartNode();
+ Node walkEndNode = pathEdges.get(j - 1).getEndNode();
+
+ if (walkStartNode != null && walkEndNode != null) {
+ double distanceKm = haversine(
+ walkStartNode.getLatitude(), walkStartNode.getLongitude(),
+ walkEndNode.getLatitude(), walkEndNode.getLongitude()
+ );
+ walkDistance = (int) (distanceKm * 1000); // kmλ₯Ό mλ‘ λ³ν
+ }
+
mergedSteps.add(new TransportationResponseDto.Step(
- DirectionType.WALK, null, null, 0, null, null, fromName, toName
+ DirectionType.WALK, null, null, walkDistance, null, null, fromName, toName
));
i = j;
continue;
@@ -623,20 +635,27 @@ private List mergeConsecutiveRoutes(List p
}
}
} catch (Exception e) {
- log.info("λ²μ€ μ 보 μ‘°ν μ€ν¨: {}", e.getMessage());
- }
+ log.error("λ²μ€ μ 보 μ‘°ν μ€ν¨: {}", e.getMessage());
+ }
} else if (currentType == DirectionType.SUBWAY) {
try {
if (currentEdge.getStartNode() != null) {
- TransportationResponseDto.NodeInfo nodeInfo = facilityService.getNodeInfo(currentEdge.getStartNode().getId());
+ TransportationResponseDto.NodeInfo nodeInfo = facilityService.getNodeInfo(currentEdge.getStartNode().getId(), currentEdge.getRoute().getRouteId());
+
subwayInfo = new TransportationResponseDto.SubwayInfo(
nodeInfo.wheelchair(),
nodeInfo.elevator(),
nodeInfo.accessibleRestroom()
);
+ } else {
+ subwayInfo = new TransportationResponseDto.SubwayInfo(
+ new ArrayList<>(),
+ new ArrayList<>(),
+ false
+ );
}
} catch (Exception e) {
- log.info("μ§νμ² μ 보 μ‘°ν μ€ν¨: {}", e.getMessage());
+ log.error("μ§νμ² μ 보 μ‘°ν μ€ν¨: {}", e.getMessage());
subwayInfo = new TransportationResponseDto.SubwayInfo(
new ArrayList<>(),
new ArrayList<>(),
@@ -716,18 +735,26 @@ private Node findNearestNode(List nodes, double lat, double lon) {
private int calculateTransferCount(List steps) {
int transferCount = 0;
- for (int i = 0; i < steps.size() - 1; i++) {
- TransportationResponseDto.Step currentStep = steps.get(i);
- TransportationResponseDto.Step nextStep = steps.get(i + 1);
-
- if (currentStep.mode() != DirectionType.WALK && nextStep.mode() != DirectionType.WALK) {
- if (currentStep.mode() == nextStep.mode() &&
- currentStep.routeName() != null && nextStep.routeName() != null &&
- !currentStep.routeName().equals(nextStep.routeName())) {
- transferCount++;
- } else if (currentStep.mode() != nextStep.mode()) {
- transferCount++;
+ DirectionType previousMode = null;
+ String previousRouteName = null;
+
+ for (TransportationResponseDto.Step step : steps) {
+ if (step.mode() != DirectionType.WALK && step.mode() != DirectionType.FROM_WAYPOINT && step.mode() != DirectionType.TO_WAYPOINT) {
+ if (previousMode != null) {
+ if (previousMode == step.mode() &&
+ previousRouteName != null && step.routeName() != null &&
+ !previousRouteName.equals(step.routeName())) {
+ transferCount++;
+ } else if (previousMode == step.mode() &&
+ previousRouteName != null && step.routeName() != null &&
+ previousRouteName.equals(step.routeName())) {
+ transferCount++;
+ } else if (previousMode != step.mode()) {
+ transferCount++;
+ }
}
+ previousMode = step.mode();
+ previousRouteName = step.routeName();
}
}
return transferCount;