Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] 스프린트 4 개발 산출물 #218

Merged
merged 40 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3a4d159
[UNI-237] fix: 대학교 및 건물 이름 순으로 조회하도록 수정 맟 페이지네이션 삭제 (#142)
mikekks Feb 15, 2025
c0682e1
[UNI-244] feat: 학교마다 좌표 및 폴리곤 반환 기능 구현 (#144)
mikekks Feb 15, 2025
0c358d1
[UNI-232] 길 찾기 알고리즘 마이그레이션 (다익스트라 -> A*) (#145)
thdgustjd1 Feb 15, 2025
8248f8d
[UNI-238] feat : 현재 버전과 특정 버전의 차이점 조회 API 구현 (#143)
thdgustjd1 Feb 15, 2025
9e52272
[UNI-249] feat: 현재 버전에 대한 버전 반환 기능 구현 (#149)
mikekks Feb 16, 2025
2731e23
[UNI-260] fix : CORS allowedHeaders에 Authorization 명시 (#152)
thdgustjd1 Feb 17, 2025
da0c94a
[UNI-260] fix: OPTIONS 메서드 허용 (#154)
mikekks Feb 17, 2025
bfe9e97
[UNI-264] refactor : aud 테이블에서 조회하던 쿼리문 최적화 (#156)
thdgustjd1 Feb 17, 2025
eb90381
[UNI-280] fix: oom 추적을 위한 추가 (#163)
mikekks Feb 17, 2025
3a0e5d8
[UNI-285] fix: revinfo 오류 해결 (#166)
mikekks Feb 17, 2025
ad35d7a
[UNI-285] fix: 컨테이너 수정 (#168)
mikekks Feb 17, 2025
5567bbc
[UNI-289] feat: 프로메테우스 추가 (#173)
mikekks Feb 18, 2025
5ad0b26
[UNI-287] fix: 특정 버전 이후 버전 시점부터 삭제하도록 수정 (#171)
mikekks Feb 18, 2025
1df849c
[UNI-294] feat: 음성인식 검색 구현 (#174)
mikekks Feb 18, 2025
2107280
[UNI-300] fix: 롤백 최신 버전 찾는 로직 오류 해결 (#177)
mikekks Feb 18, 2025
029d99b
[UNI-315] fix : assembleRoutes를 모든 노드와 간선이 연결되지 않은 그래프에서도 사용할 수 있도록 변…
thdgustjd1 Feb 19, 2025
88cc318
[UNI-316] refactor : 빌딩과 연결된 간선은 길 추가 시 크로스체크 하지 않도록 변경 (#182)
thdgustjd1 Feb 19, 2025
afb5d11
[UNI-323] feat : Stream + SSE로 대용량 조회 분할처리 로직 구현 (#184)
thdgustjd1 Feb 20, 2025
0419713
[UNI-218] refactor : 길 찾기 상세경로 좌회전,우회전 로직 수정 (#185)
thdgustjd1 Feb 20, 2025
3b14cb5
[UNI-328] feat : 길 추가 요청 응답값에 생성된 길 정보 제공 (#186)
thdgustjd1 Feb 20, 2025
6ce7eb4
[UNI-330] feat : SSE 요청 시 batchSize를 리턴하도록 구현 (#187)
thdgustjd1 Feb 20, 2025
c25a612
[UNI-344] fix : 도보에서는 위험요소도 반영되도록 변경 (#196)
thdgustjd1 Feb 20, 2025
08f8dd0
[UNI-333] 특정 버전 미만으로 롤백 방지 & 6km 이상 길 추가 방지 로직 작성 (#190)
thdgustjd1 Feb 20, 2025
2c36757
[UNI-352] refactor : DangerFactors 누락 추가 (#198)
thdgustjd1 Feb 20, 2025
884e2a7
[UNI-255] refactor: 캐시를 활용한 응답 시간 개선 & 직렬화 시간 개선 (#197)
mikekks Feb 20, 2025
814e668
[UNI-255-v4] refactor: 스트림 기반 redis 구현 및 경량객체 조회하도록 개선 (UNI-321) (#201)
mikekks Feb 21, 2025
ee8c15f
[UNI-355] fix : 빌딩노드 오류 해결 (#206)
thdgustjd1 Feb 21, 2025
ab8c655
[UNI-355] fix : 특정 버전에서 빌딩 노드 수정 (#207)
thdgustjd1 Feb 21, 2025
d1a0818
[UNI-351] fix : 체크포인트가 비워지지 않은 상황 해결 (#208)
thdgustjd1 Feb 21, 2025
af3dce3
[UNI-354] feat : 이벤트를 통한 Google API호출 + 배치로 처리하는 로직 작성 (#203)
thdgustjd1 Feb 21, 2025
4ad4a11
[UNI-364] refactor : 길 찾기 로직에서 cost산정방식 변경 & 로직 수정 (#213)
thdgustjd1 Feb 22, 2025
1090f4e
[UNI-340] refactor : Google API 비동기 처리 최적화 & Google API 호출 최대 개수 조정 (…
thdgustjd1 Feb 22, 2025
4532530
[UNI-355] fix: NotNull 문제 해결 (#217)
mikekks Feb 22, 2025
264cd20
[UNI-329] stream 사이즈 변경 & 배치사이즈 응답 로직 수정 (#219)
thdgustjd1 Feb 23, 2025
2839eaa
[UNI-199] fix: 로컬캐시 오류 해결 및 batch size 저장 로직 수정 (#223)
mikekks Feb 24, 2025
d32f963
[UNI-199-v2] fix: key 충돌 해결 (#224)
mikekks Feb 24, 2025
19ad5a8
[UNI-205] refactor : SSE 연결의 안정성이 불안정할때 대응하기 위한 Stream 방식 API 개발 (#230)
thdgustjd1 Feb 24, 2025
8ebc1ec
[UNI-115] feat : 학교마다 지정된 버전 미만으로는 조회되지 않도록 변경 (#231)
thdgustjd1 Feb 24, 2025
f017e01
[UNI-53] fix : 새로운 길에 너무 과한 가중치가 부여되지 않도록 수정 (#232)
thdgustjd1 Feb 25, 2025
96fefc3
[UNI-353] refactor : 사용하지 않는 코드 삭제 (#237)
thdgustjd1 Feb 25, 2025
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
4 changes: 3 additions & 1 deletion uniro_backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ COPY ${JAR_FILE} uniro-server.jar

ENV SPRING_PROFILE=${SPRING_PROFILE}

ENTRYPOINT ["java", "-Duser.timezone=Asia/Seoul","-Dspring.profiles.active=${SPRING_PROFILE}" ,"-jar" ,"uniro-server.jar"]
# JVM 메모리 설정 추가
ENTRYPOINT ["java", "-Duser.timezone=Asia/Seoul","-Dspring.profiles.active=${SPRING_PROFILE}","-XX:+HeapDumpOnOutOfMemoryError","-XX:HeapDumpPath=/tmp/heapdump.hprof", "-Xmx500m", "-jar", "uniro-server.jar"]

10 changes: 10 additions & 0 deletions uniro_backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ dependencies {
// actuator
implementation 'org.springframework.boot:spring-boot-starter-actuator'

// prometheus
implementation 'io.micrometer:micrometer-registry-prometheus'


// test container
testImplementation 'org.testcontainers:testcontainers:1.19.5'
testImplementation 'org.testcontainers:junit-jupiter:1.19.5'
Expand All @@ -84,6 +88,12 @@ dependencies {
implementation group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5'
implementation 'com.auth0:java-jwt:4.4.0'

// redis
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-hibernate6'
implementation 'com.alibaba.fastjson2:fastjson2-extension-spring6:2.0.55'
}

tasks.named('test') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableAsync;

@SpringBootApplication
@EnableJpaAuditing
@EnableAsync
public class UniroBackendApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

import static com.softeer5.uniro_backend.common.constant.UniroConst.*;

import java.time.LocalDateTime;

@Aspect
@Component
@Order(BEFORE_DEFAULT_ORDER)
Expand All @@ -22,6 +24,7 @@ public class RevisionOperationAspect {
@Around("@annotation(revisionOperation)")
public Object around(ProceedingJoinPoint joinPoint, RevisionOperation revisionOperation) throws Throwable {
RevisionOperationType opType = revisionOperation.value();
RevisionContext.setTimeStamp(LocalDateTime.now());

Object result;
switch (opType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public class ChangedRouteDTO {
@Schema(description = "현재", example = "")
private final RouteDifferInfo current;
@Schema(description = "해당 버전 (과거)", example = "")
private final RouteDifferInfo revision;
private final RouteDifferInfo difference;

public static ChangedRouteDTO of(Long id, RouteDifferInfo current, RouteDifferInfo revision) {
return new ChangedRouteDTO(id, current, revision);
public static ChangedRouteDTO of(Long id, RouteDifferInfo current, RouteDifferInfo difference) {
return new ChangedRouteDTO(id, current, difference);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.softeer5.uniro_backend.admin.dto.response;

import com.softeer5.uniro_backend.map.dto.response.GetAllRoutesResDTO;
import com.softeer5.uniro_backend.map.dto.response.AllRoutesInfo;
import com.softeer5.uniro_backend.map.dto.response.GetRiskRoutesResDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AccessLevel;
Expand All @@ -14,15 +14,15 @@
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public class GetAllRoutesByRevisionResDTO {
@Schema(description = "특정 버전에 존재하는 길&노드 스냅샷 정보", example = "")
private final GetAllRoutesResDTO routesInfo;
private final AllRoutesInfo routesInfo;
@Schema(description = "특정 버전에 존재하는 위험 요소 스냅샷 정보", example = "")
private final GetRiskRoutesResDTO getRiskRoutesResDTO;
@Schema(description = "삭제된 길&노드 정보 정보", example = "")
private final LostRoutesDTO lostRoutes;
@Schema(description = "현재 버전과 비교하여 변경된 주의/위험 요소 정보", example = "")
private final List<ChangedRouteDTO> changedList;

public static GetAllRoutesByRevisionResDTO of(GetAllRoutesResDTO routesInfo, GetRiskRoutesResDTO getRiskRoutesResDTO,
public static GetAllRoutesByRevisionResDTO of(AllRoutesInfo routesInfo, GetRiskRoutesResDTO getRiskRoutesResDTO,
LostRoutesDTO lostRoutes, List<ChangedRouteDTO> changedList) {
return new GetAllRoutesByRevisionResDTO(routesInfo, getRiskRoutesResDTO, lostRoutes, changedList);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.softeer5.uniro_backend.admin.repository;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.hibernate.envers.AuditReader;
import org.hibernate.envers.AuditReaderFactory;
Expand All @@ -21,10 +24,18 @@ public class NodeAuditRepository {

public List<Node> getAllNodesAtRevision(Long univId, Long versionId) {
AuditReader auditReader = AuditReaderFactory.get(entityManager);
return auditReader.createQuery()
.forEntitiesAtRevision(Node.class, versionId)
.add(AuditEntity.property("univId").eq(univId))
.getResultList();
List<Node> allRevisions = auditReader.createQuery()
.forRevisionsOfEntity(Node.class, true, true)
.add(AuditEntity.revisionNumber().le(versionId))
.add(AuditEntity.property("univId").eq(univId))
.addOrder(AuditEntity.revisionNumber().asc())
.getResultList();

Map<Long, Node> uniqueNodesMap = new HashMap<>();
for (Node node : allRevisions) {
uniqueNodesMap.put(node.getId(), node);
}
return new ArrayList<>(uniqueNodesMap.values());
}

public void deleteAllAfterVersionId(Long univId, Long versionId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

import java.util.Optional;

public interface RevInfoRepository extends JpaRepository<RevInfo,Long> {
List<RevInfo> findAllByUnivId(Long univId);
Expand All @@ -16,4 +16,8 @@ public interface RevInfoRepository extends JpaRepository<RevInfo,Long> {
@Transactional
@Query("DELETE FROM RevInfo r WHERE r.univId = :univId AND r.rev > :versionId")
void deleteAllAfterVersionId(Long univId, Long versionId);

Optional<RevInfo> findFirstByUnivIdOrderByRevDesc(Long univId);

Optional<RevInfo> findFirstByUnivIdAndRevAfter(Long univId, Long rev);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.softeer5.uniro_backend.admin.repository;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.hibernate.envers.AuditReader;
import org.hibernate.envers.AuditReaderFactory;
Expand All @@ -22,10 +25,18 @@ public class RouteAuditRepository {

public List<Route> getAllRoutesAtRevision(Long univId, Long versionId) {
AuditReader auditReader = AuditReaderFactory.get(entityManager);
return auditReader.createQuery()
.forEntitiesAtRevision(Route.class, versionId)
.add(AuditEntity.property("univId").eq(univId))
.getResultList();
List<Route> allRevisions = auditReader.createQuery()
.forRevisionsOfEntity(Route.class, true, true)
.add(AuditEntity.revisionNumber().le(versionId))
.add(AuditEntity.property("univId").eq(univId))
.addOrder(AuditEntity.revisionNumber().asc())
.getResultList();

Map<Long, Route> uniqueRoutesMap = new HashMap<>();
for (Route route : allRevisions) {
uniqueRoutesMap.put(route.getId(), route);
}
return new ArrayList<>(uniqueRoutesMap.values());
}

public void deleteAllAfterVersionId(Long univId, Long versionId) {
Expand All @@ -35,4 +46,19 @@ public void deleteAllAfterVersionId(Long univId, Long versionId) {
.executeUpdate();
}

public List<Route> findUpdatedRouteByUnivIdWithNodes(Long univId, Long versionId) {
AuditReader auditReader = AuditReaderFactory.get(entityManager);
List<Route> allRevisions = auditReader.createQuery()
.forRevisionsOfEntity(Route.class, true, true)
.add(AuditEntity.revisionNumber().gt(versionId))
.add(AuditEntity.property("univId").eq(univId))
.addOrder(AuditEntity.revisionNumber().asc())
.getResultList();

Map<Long, Route> uniqueRoutesMap = new HashMap<>();
for (Route route : allRevisions) {
uniqueRoutesMap.put(route.getId(), route);
}
return new ArrayList<>(uniqueRoutesMap.values());
}
}
Loading
Loading