Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Optional;

import com.assu.server.domain.admin.entity.Admin;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
Expand All @@ -27,8 +28,6 @@ List<Admin> findMatchingAdmins(@Param("university") University university,
@Param("department") Department department,
@Param("major") Major major);

Optional<Admin> findByName(String name);

// 후보 수 카운트: 해당 partner와 ACTIVE 제휴가 없는 admin 수
@Query(value = """
SELECT COUNT(*)
Expand Down Expand Up @@ -65,7 +64,7 @@ List<Admin> findPartnerWithOffset(@Param("partnerId") Long partnerId,
WHERE a.point IS NOT NULL
AND function('ST_Contains', function('ST_GeomFromText', :wkt, 4326), a.point) = true
""")
List<Admin> findAllWithinViewportWithMember(@Param("wkt") String wkt);
List<Admin> findAllWithinViewportWithMember(@Param("wkt") String wkt, Pageable pageable);

@Query("""
SELECT DISTINCT a
Expand All @@ -74,6 +73,7 @@ AND function('ST_Contains', function('ST_GeomFromText', :wkt, 4326), a.point) =
WHERE LOWER(a.name) LIKE LOWER(CONCAT('%', :keyword, '%'))
""")
List<Admin> searchAdminByKeywordWithMember(
@Param("keyword") String keyword
@Param("keyword") String keyword,
Pageable pageable
);
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.assu.server.domain.admin.service;
import com.assu.server.domain.admin.dto.AdminResponseDTO;

import java.util.List;

import com.assu.server.domain.admin.dto.AdminResponseDTO;
import com.assu.server.domain.admin.entity.Admin;
import com.assu.server.domain.user.entity.enums.Department;
import com.assu.server.domain.user.entity.enums.Major;
import com.assu.server.domain.user.entity.enums.University;

import java.util.List;

public interface AdminService {
List<Admin> findMatchingAdmins(University university, Department department, Major major);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package com.assu.server.domain.admin.service;

import java.util.List;
import org.springframework.stereotype.Service;
import com.assu.server.domain.admin.dto.AdminResponseDTO;
import com.assu.server.domain.admin.entity.Admin;
import com.assu.server.domain.admin.repository.AdminRepository;
import com.assu.server.domain.user.entity.enums.Department;
import com.assu.server.domain.user.entity.enums.Major;
import lombok.RequiredArgsConstructor;
import com.assu.server.domain.partner.entity.Partner;
import com.assu.server.domain.partner.repository.PartnerRepository;
import com.assu.server.domain.user.entity.enums.Department;
import com.assu.server.domain.user.entity.enums.Major;
import com.assu.server.domain.user.entity.enums.University;
import com.assu.server.global.apiPayload.code.status.ErrorStatus;
import com.assu.server.global.exception.DatabaseException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

@Service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package com.assu.server.domain.map.controller;

import com.assu.server.domain.common.enums.UserRole;
import com.assu.server.domain.map.dto.AdminMapResponseDTO;
import com.assu.server.domain.map.dto.MapRequestDTO;
import com.assu.server.domain.map.dto.PartnerMapResponseDTO;
import com.assu.server.domain.map.dto.PlaceSuggestionDTO;
import com.assu.server.domain.map.dto.StoreMapResponseDTO;
import com.assu.server.domain.map.dto.*;
import com.assu.server.domain.map.service.MapService;
import com.assu.server.domain.map.service.PlaceSearchService;
import com.assu.server.global.apiPayload.BaseResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,43 @@
import com.assu.server.domain.admin.entity.Admin;
import com.assu.server.domain.partnership.entity.Paper;
import com.assu.server.infra.s3.AmazonS3Manager;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;

import java.time.LocalDate;

public record AdminMapResponseDTO(
Long adminId,
String name,
String address,
boolean isPartnered,
@Schema(description = "관리자 ID", example = "101")
@NotNull Long adminId,

@Schema(description = "관리자 이름", example = "숭실대학교 총학생회")
@NotNull String name,

@Schema(description = "관리자 주소", example = "서울특별시 동작구 상도로")
@NotNull String address,

@Schema(description = "제휴업체와 제휴여부", example = "true")
@NotNull boolean isPartnered,

@Schema(description = "제휴 ID", example = "101")
Long partnershipId,

@Schema(description = "제휴 시작일", example = "2024-01-01")
LocalDate partnershipStartDate,

@Schema(description = "제휴 마감일", example = "2024-12-31")
LocalDate partnershipEndDate,
Double latitude,
Double longitude,

@Schema(description = "관리자 위도", example = "57.56")
@NotNull Double latitude,

@Schema(description = "관리자 경도", example = "37.38")
@NotNull Double longitude,

@Schema(description = "관리자 카카오맵 Url", example = "https://www.beer.co.kr")
String profileUrl,

@Schema(description = "관리자 전화번호", example = "010-1234-5678")
String phoneNumber
) {
public static AdminMapResponseDTO of(Admin admin, Paper activePaper, AmazonS3Manager s3Manager) {
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/com/assu/server/domain/map/dto/MapRequestDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@
import jakarta.validation.constraints.NotNull;

public record MapRequestDTO(
@Schema(description = "화면 좌상단 경도")
@Schema(description = "화면 좌상단 경도", example = "126.95")
@NotNull(message = "경도를 입력해주세요.")
double lng1,

@Schema(description = "화면 좌상단 위도")
@Schema(description = "화면 좌상단 위도", example = "37.51")
@NotNull(message = "위도를 입력해주세요.")
double lat1,

@Schema(description = "화면 우상단 경도")
@Schema(description = "화면 우상단 경도", example = "126.97")
@NotNull(message = "경도를 입력해주세요.")
double lng2,

@Schema(description = "화면 우상단 위도")
@Schema(description = "화면 우상단 위도", example = "37.51")
@NotNull(message = "위도를 입력해주세요.")
double lat2,

@Schema(description = "화면 우하단 경도")
@Schema(description = "화면 우하단 경도", example = "126.97")
@NotNull(message = "경도를 입력해주세요.")
double lng3,

@Schema(description = "화면 우하단 위도")
@Schema(description = "화면 우하단 위도", example = "37.49")
@NotNull(message = "위도를 입력해주세요.")
double lat3,

@Schema(description = "화면 좌하단 경도")
@Schema(description = "화면 좌하단 경도", example = "126.95")
@NotNull(message = "경도를 입력해주세요.")
double lng4,

@Schema(description = "화면 좌하단 위도")
@Schema(description = "화면 좌하단 위도", example = "37.49")
@NotNull(message = "위도를 입력해주세요.")
double lat4
) {}
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,43 @@
import com.assu.server.domain.partner.entity.Partner;
import com.assu.server.domain.partnership.entity.Paper;
import com.assu.server.infra.s3.AmazonS3Manager;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;

import java.time.LocalDate;

public record PartnerMapResponseDTO(
Long partnerId,
String name,
String address,
boolean isPartnered,
@Schema(description = "파트너 ID", example = "101")
@NotNull Long partnerId,

@Schema(description = "제휴업체 이름", example = "역전할머니맥주 숭실대점")
@NotNull String name,

@Schema(description = "제휴업체 주소", example = "서울특별시 동작구 상도로")
@NotNull String address,

@Schema(description = "제휴업체와 제휴여부", example = "true")
@NotNull boolean isPartnered,

@Schema(description = "제휴 ID", example = "101")
Long partnershipId,

@Schema(description = "제휴 시작일", example = "2024-01-01")
LocalDate partnershipStartDate,

@Schema(description = "제휴 마감일", example = "2024-12-31")
LocalDate partnershipEndDate,
Double latitude,
Double longitude,

@Schema(description = "제휴업체 위도", example = "37.50")
@NotNull Double latitude,

@Schema(description = "제휴업체 경도", example = "126.96")
@NotNull Double longitude,

@Schema(description = "제휴업체 프로필 Url", example = "https://www.beer.co.kr")
String profileUrl,

@Schema(description = "제휴업체 전화번호", example = "010-1234-5678")
String phoneNumber
) {
public static PartnerMapResponseDTO of(Partner partner, Paper activePaper, AmazonS3Manager s3Manager) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
package com.assu.server.domain.map.dto;

import io.swagger.v3.oas.annotations.media.Schema;

public record PlaceSuggestionDTO(
@Schema(description = "장소 ID", example = "12345678")
String placeId,

@Schema(description = "장소 이름", example = "숭실대학교")
String name,

@Schema(description = "장소 카테고리", example = "대학교")
String category,

@Schema(description = "장소 지번 주소", example = "서울특별시 동작구 상도로 369")
String address,

@Schema(description = "장소 도로명 주소", example = "서울특별시 동작구 상도로 369")
String roadAddress,

@Schema(description = "장소 전화번호", example = "02-820-0114")
String phone,

@Schema(description = "카카오맵 장소 Url", example = "https://place.map.kakao.com/12345678")
String placeUrl,

@Schema(description = "장소 위도", example = "37.50")
Double latitude,

@Schema(description = "장소 경도", example = "126.96")
Double longitude,

@Schema(description = "현재 위치로부터의 거리 (m)", example = "100")
Integer distance
) {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.assu.server.domain.map.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

@Getter
Expand All @@ -8,10 +9,21 @@
@AllArgsConstructor
@Builder
public class SelectedPlacePayload {
@Schema(description = "장소 ID", example = "12345678")
private String placeId;

@Schema(description = "장소 이름", example = "숭실대학교")
private String name;

@Schema(description = "장소 지번 주소", example = "서울특별시 동작구 상도로 369")
private String address;

@Schema(description = "장소 도로명 주소", example = "서울특별시 동작구 상도로 369")
private String roadAddress;

@Schema(description = "장소 위도", example = "37.50")
private Double latitude;

@Schema(description = "장소 경도", example = "126.96")
private Double longitude;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,53 @@

import com.assu.server.domain.store.entity.Store;
import com.assu.server.infra.s3.AmazonS3Manager;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;

public record StoreMapResponseDTO(
Long storeId,
String name,
String address,
@Schema(description = "가게 ID", example = "201")
@NotNull Long storeId,

@Schema(description = "가게 이름", example = "숭실마트")
@NotNull String name,

@Schema(description = "가게 주소", example = "서울특별시 동작구 상도로")
@NotNull String address,

@Schema(description = "가게 평점", example = "4")
Integer rate,
boolean hasPartner,
Double latitude,
Double longitude,

@Schema(description = "제휴업체인지 여부 (관련 Paper가 없으면 false)", example = "true")
@NotNull boolean hasPartner,

@Schema(description = "가게 위도", example = "37.50")
@NotNull Double latitude,

@Schema(description = "가게 경도", example = "126.96")
@NotNull Double longitude,

@Schema(description = "가게 프로필 Url", example = "https://www.beer.co.kr")
String profileUrl,

@Schema(description = "가게 전화번호", example = "010-1234-5678")
String phoneNumber,
Long adminId1,

@Schema(description = "관리자1 ID", example = "101")
@NotNull Long adminId1,

@Schema(description = "관리자2 ID", example = "102")
Long adminId2,
String adminName1,

@Schema(description = "관리자1 이름", example = "숭실대학교 총학생회")
@NotNull String adminName1,

@Schema(description = "관리자2 이름", example = "숭실대학교 IT대학 학생회")
String adminName2,
String benefit1,

@Schema(description = "제휴 혜택1", example = "음료 10% 할인")
@NotNull String benefit1,

@Schema(description = "제휴 혜택2", example = "버터구이 오징어 제공")
String benefit2
) {
public static StoreMapResponseDTO of(
Expand Down
Loading