Skip to content

Commit

Permalink
🚀 [Deploy] - 실시간 날씨 정보 API 구현 (#40)
Browse files Browse the repository at this point in the history
* Feat: customException 구현

* Feat: responseDto 구현

* Feat: 내 근처 킥보드 주차장 찾기 API 구현

* Fix: BoardingRecord 도메인 수정

* Feat: Spring Security, JWT Cookie, 소셜 로그인 기능 구현

* Feat: Spring Security, JWT Cookie, 소셜 로그인 기능 구현

* Fix: 코드 에러 수정

* Refactor: 아직 사용하지 않는 코드 삭제

* Feat: oauth2 의존성 추가

* Chore: Credentials 추가

* ✨ [Feature] - 서버 날짜 설정 및 유저 닉네임 설정 (#15)

* Feat: 스프링 서버 시간 한국으로 설정

* Feat: 사용자 닉네임 지정 로직 추가

* Fix: 초기 포인트 설정

* Fix: nickname 에러 수정 (#18)

* Fix: BoardingRecord 도메인 수정

* Feat: 디펜던시 추가

* Feat: ErrorCode 추가

* Feat: Image API 구현

* Feat: WebClientConfig 구현

* Feat: S3ClientConfig 구현

* Feat: BoardingRecord API 구현

* Feat: 주차장 예측 결과 관련 기능 추가

* Feat: 탑승 기록 저장 API 구현

* Fix: 디렉토리 경로 수정

* Feat: 코드 리팩터링 진행

* Chore: Credentials 수정 (#29)

* !HOTFIX: 서브 모듈 컨플릭트 해결

* ✨ [Feature] - Reissue 토큰 기능 추가 (#31)

* Chore: Credentials 수정

* Feat: Reissue 토큰 기능 구현

* Chore: Credentials 추가

* Fix: JsonProperty 추가

* Fix: ResponseDto 필드변수 이름 수정

* Fix: ResponseDto 필드변수 이름 수정 (#35)

* Feat: District 도메인 생성

* Feat: District 도메인 컬럼 추가

* Feat: District API 구현

* Feat: District API 관련 DTO 구현

* Feat: District API 관련 DTO 구현

* Feat: RestTemplateService 구현

* Fix: ResponseDto 필드변수 이름 수정 (#38)

* Feat: 실시간 날씨 확인 DTO 구현

* Feat: 실시간 날씨 확인 API 구현

* Fix: 변수명 수정

---------

Co-authored-by: JeongHeumChoi <[email protected]>
Co-authored-by: JeongHeumChoi <[email protected]>
  • Loading branch information
3 people authored May 9, 2024
1 parent 53c6146 commit f0bb8b6
Show file tree
Hide file tree
Showing 20 changed files with 483 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class BoardingRecordController {
@PostMapping("/boarding-record")
public ResponseDto<?> saveBoardingRecord (
@UserId Long userId,
@RequestPart(value = "image", required = false) MultipartFile multipartFile,
@RequestPart(value = "image") MultipartFile multipartFile,
@RequestPart(value = "dto") BoardingRecordRequest boardingRecordRequest
) throws IOException {
Long imageId = imageService.saveImage(multipartFile);
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/ice/spot/controller/DistrictController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package ice.spot.controller;

import ice.spot.annotation.UserId;
import ice.spot.domain.District;
import ice.spot.dto.district.response.TemperatureResponse;
import ice.spot.dto.global.ResponseDto;
import ice.spot.service.DistrictService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/district")
public class DistrictController {
private final DistrictService districtService;

@GetMapping("/location")
public ResponseDto<?> getLocation(@RequestParam Double lat, @RequestParam Double lon) {
return ResponseDto.ok(districtService.getLocation(lat, lon));
}

@GetMapping("/temperature")
public ResponseDto<?> getTemperatureAndHumidity(@RequestParam Double lat, @RequestParam Double lon) {
return ResponseDto.ok(districtService.getTemperatureAndHumidity(lat, lon));
}

@GetMapping("/point")
public ResponseDto<?> getPointAndDust(@UserId Long userId, @RequestParam Double lat, @RequestParam Double lon) {
return ResponseDto.ok(districtService.getPointAndDust(userId, lat, lon));
}
}
37 changes: 37 additions & 0 deletions src/main/java/ice/spot/domain/District.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package ice.spot.domain;

import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "district")
public class District {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(name = "territory")
private String territory;

@Column(name = "address")
private String address;

@Column(name = "detail_address")
private String detailAddress;

@Column(name = "grid_x")
private Integer gridX;

@Column(name = "grid_y")
private Integer gridY;

@Column(name = "lat")
private Double lat;

@Column(name = "lon")
private Double lon;
}
16 changes: 16 additions & 0 deletions src/main/java/ice/spot/dto/district/response/LocationResponse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package ice.spot.dto.district.response;

import com.fasterxml.jackson.annotation.JsonProperty;

public record LocationResponse(
@JsonProperty("location")
String location
) {
public LocationResponse(String location) {
this.location = location;
}

public static LocationResponse of(String location) {
return new LocationResponse(location);
}
}
17 changes: 17 additions & 0 deletions src/main/java/ice/spot/dto/district/response/PointResponse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package ice.spot.dto.district.response;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Builder;

@Builder
public record PointResponse(
@JsonProperty("point")
Long point,

@JsonProperty("pm10")
Double pm10,

@JsonProperty("pm25")
Double pm25
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package ice.spot.dto.district.response;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Builder;

@Builder
public record TemperatureResponse (
@JsonProperty("temperature")
Double temperature,

@JsonProperty("humidity")
Double humidity
) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package ice.spot.dto.district.response.dust;

import lombok.Builder;

@Builder
public record DustResponse(
Double pm10,

Double pm25
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package ice.spot.dto.district.response.dust;

import com.fasterxml.jackson.annotation.JsonProperty;

public record DustResultResponse(
@JsonProperty("RealtimeCityAir")
RealtimeCityAirResponse realtimeCityAirResponse
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package ice.spot.dto.district.response.dust;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

public record RealtimeCityAirResponse(
@JsonProperty("list_total_count")
Integer count,

@JsonProperty("RESULT")
ResultResponse resultResponse,

@JsonProperty("row")
List<RowResponse> rowResponses
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package ice.spot.dto.district.response.dust;

import com.fasterxml.jackson.annotation.JsonProperty;

public record ResultResponse(
@JsonProperty("CODE")
String code,

@JsonProperty("MESSAGE")
String message
) {
}
42 changes: 42 additions & 0 deletions src/main/java/ice/spot/dto/district/response/dust/RowResponse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package ice.spot.dto.district.response.dust;

import com.fasterxml.jackson.annotation.JsonProperty;

public record RowResponse(
@JsonProperty("MSRDT")
String MSRDT,

@JsonProperty("MSRRGN_NM")
String MSRRGN_NM,

@JsonProperty("MSRSTE_NM")
String MSRSTE_NM,

@JsonProperty("PM10")
Double PM10,

@JsonProperty("PM25")
Double PM25,

@JsonProperty("O3")
Double O3,

@JsonProperty("NO2")
Double NO2,

@JsonProperty("CO")
Double CO,

@JsonProperty("SO2")
Double SO2,

@JsonProperty("IDEX_NM")
String IDEX_NM,

@JsonProperty("IDEX_MVL")
Double IDEX_MVL,

@JsonProperty("ARPLT_MAIN")
String ARPLT_MAIN
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package ice.spot.dto.district.response.weather;

import com.fasterxml.jackson.annotation.JsonProperty;

public record RealtimeWeatherResponse(
@JsonProperty("header")
WeatherHeader weatherHeader,

@JsonProperty("body")
WeatherBody weatherBody
) {
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package ice.spot.dto.district.response.weather;

import com.fasterxml.jackson.annotation.JsonProperty;

public record WeatherBody(
@JsonProperty("dataType")
String dataType,

@JsonProperty("items")
WeatherItemListResponse weatherItemListResponse,

@JsonProperty("pageNo")
Integer pageNo,

@JsonProperty("numOfRows")
Integer numOfRows,

@JsonProperty("totalCount")
Integer totalCount
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package ice.spot.dto.district.response.weather;

import com.fasterxml.jackson.annotation.JsonProperty;

public record WeatherHeader(
@JsonProperty("resultCode")
String resultCode,

@JsonProperty("resultMsg")
String resultMsg
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package ice.spot.dto.district.response.weather;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

public record WeatherItemListResponse(
@JsonProperty("item")
List<WeatherItemResponse> weatherItemResponses
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package ice.spot.dto.district.response.weather;

import com.fasterxml.jackson.annotation.JsonProperty;

public record WeatherItemResponse(
@JsonProperty("baseDate")
String baseDate,

@JsonProperty("baseTime")
String baseTime,

@JsonProperty("category")
String category,

@JsonProperty("nx")
Integer nx,

@JsonProperty("ny")
Integer ny,

@JsonProperty("obsrValue")
String obsrValue
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package ice.spot.dto.district.response.weather;

import com.fasterxml.jackson.annotation.JsonProperty;

public record WeatherResultResponse(
@JsonProperty("response")
RealtimeWeatherResponse realtimeWeatherResponse
) {
}
7 changes: 7 additions & 0 deletions src/main/java/ice/spot/repository/DistrictRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package ice.spot.repository;

import ice.spot.domain.District;
import org.springframework.data.jpa.repository.JpaRepository;

public interface DistrictRepository extends JpaRepository<District, Long> {
}
Loading

0 comments on commit f0bb8b6

Please sign in to comment.