From d8de5c47f360711d3518a733edb7a633ccf958c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A7=84=EC=A3=BC=EC=9B=90?= <84346055+jinjoo-lab@users.noreply.github.com> Date: Mon, 18 Sep 2023 11:00:38 +0900 Subject: [PATCH] [ADD] --- backend/build.gradle | 2 +- .../config/properties/PropertiesConfig.java | 3 ++- ...thClient.java => SearchCarPathClient.java} | 14 +++++------ .../path/client/SearchPedPathClient.java | 25 +++++++++++++++++++ .../path/controller/PathController.java | 6 ++--- .../path/dto/client/{ => car}/Position.java | 2 +- .../{ => car}/ResponsePositionFormat.java | 2 +- .../dto/client/{ => car}/RouteUnitEnt.java | 2 +- .../SearchCarPathRequest.java} | 4 +-- .../SearchCarPathResponse.java} | 4 +-- .../dto/client/{ => car}/SearchPathFuel.java | 2 +- .../client/{ => car}/SearchPathOption.java | 2 +- .../dto/client/{ => car}/SectionUnit.java | 2 +- .../path/dto/client/{ => car}/Summary.java | 2 +- .../domain/path/dto/client/ped/Geometry.java | 12 +++++++++ .../dto/client/ped/SearchPedPathRequest.java | 17 +++++++++++++ .../dto/client/ped/SearchPedPathResponse.java | 13 ++++++++++ .../domain/path/service/PathService.java | 10 ++++---- .../global/properties/TmapProperties.java | 12 +++++++++ 19 files changed, 108 insertions(+), 28 deletions(-) rename backend/src/main/java/com/twtw/backend/domain/path/client/{SearchPathClient.java => SearchCarPathClient.java} (77%) create mode 100644 backend/src/main/java/com/twtw/backend/domain/path/client/SearchPedPathClient.java rename backend/src/main/java/com/twtw/backend/domain/path/dto/client/{ => car}/Position.java (78%) rename backend/src/main/java/com/twtw/backend/domain/path/dto/client/{ => car}/ResponsePositionFormat.java (85%) rename backend/src/main/java/com/twtw/backend/domain/path/dto/client/{ => car}/RouteUnitEnt.java (82%) rename backend/src/main/java/com/twtw/backend/domain/path/dto/client/{SearchPathRequest.java => car/SearchCarPathRequest.java} (77%) rename backend/src/main/java/com/twtw/backend/domain/path/dto/client/{SearchPathResponse.java => car/SearchCarPathResponse.java} (76%) rename backend/src/main/java/com/twtw/backend/domain/path/dto/client/{ => car}/SearchPathFuel.java (85%) rename backend/src/main/java/com/twtw/backend/domain/path/dto/client/{ => car}/SearchPathOption.java (90%) rename backend/src/main/java/com/twtw/backend/domain/path/dto/client/{ => car}/SectionUnit.java (85%) rename backend/src/main/java/com/twtw/backend/domain/path/dto/client/{ => car}/Summary.java (90%) create mode 100644 backend/src/main/java/com/twtw/backend/domain/path/dto/client/ped/Geometry.java create mode 100644 backend/src/main/java/com/twtw/backend/domain/path/dto/client/ped/SearchPedPathRequest.java create mode 100644 backend/src/main/java/com/twtw/backend/domain/path/dto/client/ped/SearchPedPathResponse.java create mode 100644 backend/src/main/java/com/twtw/backend/global/properties/TmapProperties.java diff --git a/backend/build.gradle b/backend/build.gradle index 4f3f0148..f56c54cf 100644 --- a/backend/build.gradle +++ b/backend/build.gradle @@ -37,7 +37,7 @@ dependencies { implementation 'io.jsonwebtoken:jjwt-impl:0.11.5' implementation 'io.jsonwebtoken:jjwt-jackson:0.11.5' implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' - implementation 'org.springframework.boot:spring-boot-configuration-processor' + annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' compileOnly 'org.projectlombok:lombok' runtimeOnly 'org.mariadb.jdbc:mariadb-java-client' runtimeOnly 'com.h2database:h2:1.4.200' diff --git a/backend/src/main/java/com/twtw/backend/config/properties/PropertiesConfig.java b/backend/src/main/java/com/twtw/backend/config/properties/PropertiesConfig.java index fd975e8d..1860ee14 100644 --- a/backend/src/main/java/com/twtw/backend/config/properties/PropertiesConfig.java +++ b/backend/src/main/java/com/twtw/backend/config/properties/PropertiesConfig.java @@ -3,9 +3,10 @@ import com.twtw.backend.global.properties.KakaoProperties; import com.twtw.backend.global.properties.NaverProperties; +import com.twtw.backend.global.properties.TmapProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Configuration; @Configuration -@EnableConfigurationProperties({NaverProperties.class, KakaoProperties.class}) +@EnableConfigurationProperties({NaverProperties.class, KakaoProperties.class, TmapProperties.class}) public class PropertiesConfig {} diff --git a/backend/src/main/java/com/twtw/backend/domain/path/client/SearchPathClient.java b/backend/src/main/java/com/twtw/backend/domain/path/client/SearchCarPathClient.java similarity index 77% rename from backend/src/main/java/com/twtw/backend/domain/path/client/SearchPathClient.java rename to backend/src/main/java/com/twtw/backend/domain/path/client/SearchCarPathClient.java index 3d158c48..87ca25cd 100644 --- a/backend/src/main/java/com/twtw/backend/domain/path/client/SearchPathClient.java +++ b/backend/src/main/java/com/twtw/backend/domain/path/client/SearchCarPathClient.java @@ -1,7 +1,7 @@ package com.twtw.backend.domain.path.client; -import com.twtw.backend.domain.path.dto.client.SearchPathRequest; -import com.twtw.backend.domain.path.dto.client.SearchPathResponse; +import com.twtw.backend.domain.path.dto.client.car.SearchCarPathRequest; +import com.twtw.backend.domain.path.dto.client.car.SearchCarPathResponse; import com.twtw.backend.global.client.MapClient; import com.twtw.backend.global.exception.WebClientResponseException; import com.twtw.backend.global.properties.NaverProperties; @@ -15,17 +15,17 @@ import java.nio.charset.StandardCharsets; @Component -public class SearchPathClient implements MapClient { +public class SearchCarPathClient implements MapClient { private final WebClient webClient; private final NaverProperties naverProperties; - public SearchPathClient(final WebClient webClient, final NaverProperties naverProperties) { + public SearchCarPathClient(final WebClient webClient, final NaverProperties naverProperties) { this.webClient = webClient; this.naverProperties = naverProperties; } /*상세 검색을 위한 변경 필요*/ - private URI getPathUri(final SearchPathRequest request, final UriBuilder uriBuilder) { + private URI getPathUri(final SearchCarPathRequest request, final UriBuilder uriBuilder) { final UriBuilder builder = uriBuilder @@ -47,7 +47,7 @@ private URI getPathUri(final SearchPathRequest request, final UriBuilder uriBuil } @Override - public SearchPathResponse request(final SearchPathRequest request) { + public SearchCarPathResponse request(final SearchCarPathRequest request) { return webClient .get() .uri(uri -> getPathUri(request, uri)) @@ -56,7 +56,7 @@ public SearchPathResponse request(final SearchPathRequest request) { .header(naverProperties.getHeaderClientId(), naverProperties.getId()) .header(naverProperties.getHeaderClientSecret(), naverProperties.getSecret()) .retrieve() - .bodyToMono(SearchPathResponse.class) + .bodyToMono(SearchCarPathResponse.class) .blockOptional() .orElseThrow(WebClientResponseException::new); } diff --git a/backend/src/main/java/com/twtw/backend/domain/path/client/SearchPedPathClient.java b/backend/src/main/java/com/twtw/backend/domain/path/client/SearchPedPathClient.java new file mode 100644 index 00000000..147d6380 --- /dev/null +++ b/backend/src/main/java/com/twtw/backend/domain/path/client/SearchPedPathClient.java @@ -0,0 +1,25 @@ +package com.twtw.backend.domain.path.client; + +import com.twtw.backend.domain.path.dto.client.ped.SearchPedPathRequest; +import com.twtw.backend.domain.path.dto.client.ped.SearchPedPathResponse; +import com.twtw.backend.global.client.MapClient; +import com.twtw.backend.global.properties.TmapProperties; +import org.springframework.stereotype.Component; +import org.springframework.web.reactive.function.client.WebClient; + +@Component +public class SearchPedPathClient implements MapClient { + + private final WebClient webClient; + private final TmapProperties tmapProperties; + + public SearchPedPathClient(final WebClient webClient,final TmapProperties tmapProperties){ + this.webClient = webClient; + this.tmapProperties = tmapProperties; + } + + @Override + public SearchPedPathResponse request(SearchPedPathRequest request) { + return null; + } +} diff --git a/backend/src/main/java/com/twtw/backend/domain/path/controller/PathController.java b/backend/src/main/java/com/twtw/backend/domain/path/controller/PathController.java index 35a7877a..c7ab659e 100644 --- a/backend/src/main/java/com/twtw/backend/domain/path/controller/PathController.java +++ b/backend/src/main/java/com/twtw/backend/domain/path/controller/PathController.java @@ -1,7 +1,7 @@ package com.twtw.backend.domain.path.controller; -import com.twtw.backend.domain.path.dto.client.SearchPathRequest; -import com.twtw.backend.domain.path.dto.client.SearchPathResponse; +import com.twtw.backend.domain.path.dto.client.car.SearchCarPathRequest; +import com.twtw.backend.domain.path.dto.client.car.SearchCarPathResponse; import com.twtw.backend.domain.path.service.PathService; import org.springframework.http.ResponseEntity; @@ -18,7 +18,7 @@ public PathController(PathService pathService) { /*response 변경*/ @PostMapping("/search") - public ResponseEntity searchPath(@RequestBody SearchPathRequest request) { + public ResponseEntity searchPath(@RequestBody SearchCarPathRequest request) { return ResponseEntity.ok(pathService.searchPath(request)); } } diff --git a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/Position.java b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/Position.java similarity index 78% rename from backend/src/main/java/com/twtw/backend/domain/path/dto/client/Position.java rename to backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/Position.java index 87b09afc..dcf895bb 100644 --- a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/Position.java +++ b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/Position.java @@ -1,4 +1,4 @@ -package com.twtw.backend.domain.path.dto.client; +package com.twtw.backend.domain.path.dto.client.car; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/ResponsePositionFormat.java b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/ResponsePositionFormat.java similarity index 85% rename from backend/src/main/java/com/twtw/backend/domain/path/dto/client/ResponsePositionFormat.java rename to backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/ResponsePositionFormat.java index d8d96621..085f23ab 100644 --- a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/ResponsePositionFormat.java +++ b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/ResponsePositionFormat.java @@ -1,4 +1,4 @@ -package com.twtw.backend.domain.path.dto.client; +package com.twtw.backend.domain.path.dto.client.car; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/RouteUnitEnt.java b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/RouteUnitEnt.java similarity index 82% rename from backend/src/main/java/com/twtw/backend/domain/path/dto/client/RouteUnitEnt.java rename to backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/RouteUnitEnt.java index 70649d06..91d1e11f 100644 --- a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/RouteUnitEnt.java +++ b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/RouteUnitEnt.java @@ -1,4 +1,4 @@ -package com.twtw.backend.domain.path.dto.client; +package com.twtw.backend.domain.path.dto.client.car; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/SearchPathRequest.java b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/SearchCarPathRequest.java similarity index 77% rename from backend/src/main/java/com/twtw/backend/domain/path/dto/client/SearchPathRequest.java rename to backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/SearchCarPathRequest.java index d0372f69..5a34affd 100644 --- a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/SearchPathRequest.java +++ b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/SearchCarPathRequest.java @@ -1,4 +1,4 @@ -package com.twtw.backend.domain.path.dto.client; +package com.twtw.backend.domain.path.dto.client.car; import lombok.AllArgsConstructor; import lombok.Getter; @@ -7,7 +7,7 @@ @Getter @NoArgsConstructor @AllArgsConstructor -public class SearchPathRequest { +public class SearchCarPathRequest { private String start; private String end; private String way; diff --git a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/SearchPathResponse.java b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/SearchCarPathResponse.java similarity index 76% rename from backend/src/main/java/com/twtw/backend/domain/path/dto/client/SearchPathResponse.java rename to backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/SearchCarPathResponse.java index 33f96753..78f97cd1 100644 --- a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/SearchPathResponse.java +++ b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/SearchCarPathResponse.java @@ -1,4 +1,4 @@ -package com.twtw.backend.domain.path.dto.client; +package com.twtw.backend.domain.path.dto.client.car; import lombok.AllArgsConstructor; import lombok.Getter; @@ -9,7 +9,7 @@ @Getter @NoArgsConstructor @AllArgsConstructor -public class SearchPathResponse { +public class SearchCarPathResponse { private int code; private String message; private String currentDateTime; diff --git a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/SearchPathFuel.java b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/SearchPathFuel.java similarity index 85% rename from backend/src/main/java/com/twtw/backend/domain/path/dto/client/SearchPathFuel.java rename to backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/SearchPathFuel.java index dc25996e..9ad85b51 100644 --- a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/SearchPathFuel.java +++ b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/SearchPathFuel.java @@ -1,4 +1,4 @@ -package com.twtw.backend.domain.path.dto.client; +package com.twtw.backend.domain.path.dto.client.car; import lombok.RequiredArgsConstructor; diff --git a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/SearchPathOption.java b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/SearchPathOption.java similarity index 90% rename from backend/src/main/java/com/twtw/backend/domain/path/dto/client/SearchPathOption.java rename to backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/SearchPathOption.java index abdfd009..13c83936 100644 --- a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/SearchPathOption.java +++ b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/SearchPathOption.java @@ -1,4 +1,4 @@ -package com.twtw.backend.domain.path.dto.client; +package com.twtw.backend.domain.path.dto.client.car; import lombok.RequiredArgsConstructor; diff --git a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/SectionUnit.java b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/SectionUnit.java similarity index 85% rename from backend/src/main/java/com/twtw/backend/domain/path/dto/client/SectionUnit.java rename to backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/SectionUnit.java index f9fabfd8..05ddc179 100644 --- a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/SectionUnit.java +++ b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/SectionUnit.java @@ -1,4 +1,4 @@ -package com.twtw.backend.domain.path.dto.client; +package com.twtw.backend.domain.path.dto.client.car; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/Summary.java b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/Summary.java similarity index 90% rename from backend/src/main/java/com/twtw/backend/domain/path/dto/client/Summary.java rename to backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/Summary.java index 4960346a..f08ed91c 100644 --- a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/Summary.java +++ b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/Summary.java @@ -1,4 +1,4 @@ -package com.twtw.backend.domain.path.dto.client; +package com.twtw.backend.domain.path.dto.client.car; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/ped/Geometry.java b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/ped/Geometry.java new file mode 100644 index 00000000..c1bd4fba --- /dev/null +++ b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/ped/Geometry.java @@ -0,0 +1,12 @@ +package com.twtw.backend.domain.path.dto.client.ped; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@NoArgsConstructor +@AllArgsConstructor +public class Geometry { + private String type; +} diff --git a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/ped/SearchPedPathRequest.java b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/ped/SearchPedPathRequest.java new file mode 100644 index 00000000..ac6cc7f8 --- /dev/null +++ b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/ped/SearchPedPathRequest.java @@ -0,0 +1,17 @@ +package com.twtw.backend.domain.path.dto.client.ped; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@NoArgsConstructor +@AllArgsConstructor +public class SearchPedPathRequest { + private String startX; + private String startY; + private String endX; + private String endY; + private String startName; + private String endName; +} diff --git a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/ped/SearchPedPathResponse.java b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/ped/SearchPedPathResponse.java new file mode 100644 index 00000000..710596c0 --- /dev/null +++ b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/ped/SearchPedPathResponse.java @@ -0,0 +1,13 @@ +package com.twtw.backend.domain.path.dto.client.ped; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@NoArgsConstructor +@AllArgsConstructor +public class SearchPedPathResponse { + private String type; + +} diff --git a/backend/src/main/java/com/twtw/backend/domain/path/service/PathService.java b/backend/src/main/java/com/twtw/backend/domain/path/service/PathService.java index 879165f8..4b47db65 100644 --- a/backend/src/main/java/com/twtw/backend/domain/path/service/PathService.java +++ b/backend/src/main/java/com/twtw/backend/domain/path/service/PathService.java @@ -1,20 +1,20 @@ package com.twtw.backend.domain.path.service; -import com.twtw.backend.domain.path.dto.client.SearchPathRequest; -import com.twtw.backend.domain.path.dto.client.SearchPathResponse; +import com.twtw.backend.domain.path.dto.client.car.SearchCarPathRequest; +import com.twtw.backend.domain.path.dto.client.car.SearchCarPathResponse; import com.twtw.backend.global.client.MapClient; import org.springframework.stereotype.Service; @Service public class PathService { - private final MapClient client; + private final MapClient client; - public PathService(MapClient client) { + public PathService(MapClient client) { this.client = client; } - public SearchPathResponse searchPath(final SearchPathRequest request) { + public SearchCarPathResponse searchPath(final SearchCarPathRequest request) { return this.client.request(request); } } diff --git a/backend/src/main/java/com/twtw/backend/global/properties/TmapProperties.java b/backend/src/main/java/com/twtw/backend/global/properties/TmapProperties.java new file mode 100644 index 00000000..da4805a9 --- /dev/null +++ b/backend/src/main/java/com/twtw/backend/global/properties/TmapProperties.java @@ -0,0 +1,12 @@ +package com.twtw.backend.global.properties; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.boot.context.properties.ConfigurationProperties; + +@Getter +@RequiredArgsConstructor +@ConfigurationProperties(prefix = "tmap") +public class TmapProperties { + private final String appKey; +}