From 562cbf6b4e046738f9fe9d486cdfd10cafe300a7 Mon Sep 17 00:00:00 2001 From: Ga Dong Sik <62535229+Nesquitto@users.noreply.github.com> Date: Tue, 6 Feb 2024 00:38:38 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[SPR-112]=20feat:=20aos=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=EC=97=90=20=EB=94=B0=EB=A5=B8=20dto=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/routeversion/RouteVersionService.java | 6 +++--- .../domain/routeversion/dto/RouteVersionResponseDto.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/climeet/climeet_backend/domain/routeversion/RouteVersionService.java b/src/main/java/com/climeet/climeet_backend/domain/routeversion/RouteVersionService.java index cadbee6c..21e211bb 100644 --- a/src/main/java/com/climeet/climeet_backend/domain/routeversion/RouteVersionService.java +++ b/src/main/java/com/climeet/climeet_backend/domain/routeversion/RouteVersionService.java @@ -136,11 +136,11 @@ public RouteVersionFilteringKeyResponse getRouteVersionFilteringKey(Long gymId, .map(SectorDetailResponse::toDto).toList(); List difficultyMappingDetailResponses = difficultyList.stream() .map(DifficultyMappingDetailResponse::toDto).toList(); - List floorList = sectorList.stream() - .map(Sector::getFloor).distinct().sorted().toList(); + int maxFloor = sectorList.stream() + .mapToInt(Sector::getFloor).max().orElse(0); return RouteVersionFilteringKeyResponse.toDto(climbingGym, sectorDetailResponses, - difficultyMappingDetailResponses, floorList, routeVersion); + difficultyMappingDetailResponses, maxFloor, routeVersion); } public PageResponseDto> getRouteVersionFilteringRouteList(Long gymId, diff --git a/src/main/java/com/climeet/climeet_backend/domain/routeversion/dto/RouteVersionResponseDto.java b/src/main/java/com/climeet/climeet_backend/domain/routeversion/dto/RouteVersionResponseDto.java index a082aaf8..545d6da7 100644 --- a/src/main/java/com/climeet/climeet_backend/domain/routeversion/dto/RouteVersionResponseDto.java +++ b/src/main/java/com/climeet/climeet_backend/domain/routeversion/dto/RouteVersionResponseDto.java @@ -24,11 +24,11 @@ public static class RouteVersionFilteringKeyResponse { private String layoutImageUrl; private List sectorList; private List difficultyList; - private List floorList; + private int maxFloor; public static RouteVersionFilteringKeyResponse toDto(ClimbingGym climbingGym, List sectorList, - List difficultyList, List floorList, + List difficultyList, int maxFloor, RouteVersion routeVersion) { return RouteVersionFilteringKeyResponse.builder() .gymId(climbingGym.getId()) @@ -36,7 +36,7 @@ public static RouteVersionFilteringKeyResponse toDto(ClimbingGym climbingGym, .layoutImageUrl(routeVersion.getLayoutImageUrl()) .sectorList(sectorList) .difficultyList(difficultyList) - .floorList(floorList) + .maxFloor(maxFloor) .build(); } } From 7a6a90aa103c22918fe3006694232cbea3745170 Mon Sep 17 00:00:00 2001 From: Ga Dong Sik <62535229+Nesquitto@users.noreply.github.com> Date: Tue, 6 Feb 2024 01:12:20 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[SPR-112]=20feat:=20Route,=20SectorList?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=8B=A8=EC=9D=BC=20=EA=B0=92=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20&=20Dto=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../routeversion/RouteVersionService.java | 26 +++++++++---------- .../dto/RouteVersionRequestDto.java | 12 ++++----- .../domain/sector/dto/SectorResponseDto.java | 2 ++ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/climeet/climeet_backend/domain/routeversion/RouteVersionService.java b/src/main/java/com/climeet/climeet_backend/domain/routeversion/RouteVersionService.java index 21e211bb..376b7887 100644 --- a/src/main/java/com/climeet/climeet_backend/domain/routeversion/RouteVersionService.java +++ b/src/main/java/com/climeet/climeet_backend/domain/routeversion/RouteVersionService.java @@ -21,7 +21,6 @@ import com.climeet.climeet_backend.global.response.code.status.ErrorStatus; import com.climeet.climeet_backend.global.response.exception.GeneralException; import com.climeet.climeet_backend.global.s3.S3Service; -import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.Optional; @@ -165,28 +164,27 @@ public PageResponseDto> getRouteVersionFilteringRouteL } // floor Filter 적용 - if (getFilteredRouteVersionRequest.getFloorList().length != 0) { + if (getFilteredRouteVersionRequest.getFloor() != null) { routeList = routeList.stream() - .filter(route -> Arrays.stream(getFilteredRouteVersionRequest.getFloorList()) - .anyMatch(floor -> floor == route.getSector().getFloor()) - ).toList(); + .filter(route -> route.getSector().getFloor() + == getFilteredRouteVersionRequest.getFloor()) + .toList(); } // sector Filter 적용 - if (getFilteredRouteVersionRequest.getSectorIdList().length != 0) { + if (getFilteredRouteVersionRequest.getSectorId() != null) { routeList = routeList.stream() - .filter(route -> Arrays.stream(getFilteredRouteVersionRequest.getSectorIdList()) - .anyMatch(sectorId -> sectorId == route.getSector().getId()) - ).toList(); + .filter(route -> route.getSector().getId() + == getFilteredRouteVersionRequest.getSectorId()) + .toList(); } // difficulty Filter 적용 - if (getFilteredRouteVersionRequest.getDifficultyList().length != 0) { + if (getFilteredRouteVersionRequest.getDifficulty() != null) { routeList = routeList.stream() - .filter(route -> Arrays.stream(getFilteredRouteVersionRequest.getDifficultyList()) - .anyMatch( - difficulty -> difficulty == route.getDifficultyMapping().getDifficulty()) - ).toList(); + .filter(route -> route.getDifficultyMapping().getDifficulty() + == getFilteredRouteVersionRequest.getDifficulty()) + .toList(); } List routeDetailResponseList = routeList.stream() diff --git a/src/main/java/com/climeet/climeet_backend/domain/routeversion/dto/RouteVersionRequestDto.java b/src/main/java/com/climeet/climeet_backend/domain/routeversion/dto/RouteVersionRequestDto.java index f20e4831..b821e6b5 100644 --- a/src/main/java/com/climeet/climeet_backend/domain/routeversion/dto/RouteVersionRequestDto.java +++ b/src/main/java/com/climeet/climeet_backend/domain/routeversion/dto/RouteVersionRequestDto.java @@ -24,17 +24,17 @@ public static class GetFilteredRouteVersionRequest { private int page; private int size; - private int[] floorList = null; - private Long[] sectorIdList = null; - private int[] difficultyList = null; + private Integer floor; + private Long sectorId; + private Integer difficulty; @DateTimeFormat(pattern = "yyyy-MM-dd") private LocalDate timePoint; public GetFilteredRouteVersionRequest() { - this.floorList = new int[0]; - this.sectorIdList = new Long[0]; - this.difficultyList = new int[0]; + this.floor = null; + this.sectorId = null; + this.difficulty = null; this.timePoint = LocalDate.now(); } } diff --git a/src/main/java/com/climeet/climeet_backend/domain/sector/dto/SectorResponseDto.java b/src/main/java/com/climeet/climeet_backend/domain/sector/dto/SectorResponseDto.java index 9a6f4a1a..1e1d9e1b 100644 --- a/src/main/java/com/climeet/climeet_backend/domain/sector/dto/SectorResponseDto.java +++ b/src/main/java/com/climeet/climeet_backend/domain/sector/dto/SectorResponseDto.java @@ -16,12 +16,14 @@ public class SectorResponseDto { @AllArgsConstructor public static class SectorDetailResponse { + private Long sectorId; private String name; private int floor; private String sectorImageUrl; public static SectorDetailResponse toDto(Sector sector) { return SectorDetailResponse.builder() + .sectorId(sector.getId()) .name(sector.getSectorName()) .floor(sector.getFloor()) .sectorImageUrl(sector.getSectorImageUrl())