-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from hubo-gillajabi/HUBOBE-14-be-날씨-정보-크롤링
Hubobe 14 be 날씨 정보 크롤링
- Loading branch information
Showing
97 changed files
with
2,366 additions
and
961 deletions.
There are no files selected for viewing
Submodule BE-hubo-gillajabi-resources
updated
from 5ea7ac to de8c99
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 0 additions & 41 deletions
41
src/main/java/com/hubo/gillajabi/crawl/application/presenation/CrawlController.java
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
src/main/java/com/hubo/gillajabi/crawl/application/presenation/RoadCrawlController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.hubo.gillajabi.crawl.application.presenation; | ||
|
||
|
||
import com.hubo.gillajabi.crawl.application.response.RoadCrawlResponse; | ||
import com.hubo.gillajabi.crawl.application.service.RoadCrawlFacadeService; | ||
import com.hubo.gillajabi.crawl.domain.constant.CityCrawlName; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequestMapping("/api/road/crawl") | ||
@RequiredArgsConstructor | ||
@Tag(name = "Road crawl 컨트롤러", description = "관리자 공공데이터 포털 호출 api(길 관련)") | ||
public class RoadCrawlController { | ||
|
||
private final RoadCrawlFacadeService roadCrawlFacadeService; | ||
|
||
@Operation(summary = "전국 길 크롤링 ", description = "만약 해당 정보가 존재한다면 생략합니다.") | ||
@PostMapping("/courses") | ||
public ResponseEntity<RoadCrawlResponse.CourseResult> startCrawlingCurse(@Valid @RequestParam CityCrawlName cityCrawlName) { | ||
|
||
RoadCrawlResponse.CourseResult response = roadCrawlFacadeService.getCourse(cityCrawlName); | ||
|
||
return ResponseEntity.ok().body(response); | ||
} | ||
|
||
@Operation(summary = "전국 길 테마 크롤링", description = "전국 길 테마 크롤링 (ex: 남파랑길)") | ||
@PostMapping("/themes") | ||
public ResponseEntity<RoadCrawlResponse.ThemeResult> startCrawlingTheme(@Valid @RequestParam CityCrawlName cityCrawlName) { | ||
|
||
RoadCrawlResponse.ThemeResult response = roadCrawlFacadeService.getTheme(cityCrawlName); | ||
|
||
return ResponseEntity.ok().body(response); | ||
} | ||
} | ||
|
||
|
46 changes: 46 additions & 0 deletions
46
src/main/java/com/hubo/gillajabi/crawl/application/presenation/WeatherCrawlController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.hubo.gillajabi.crawl.application.presenation; | ||
|
||
import com.hubo.gillajabi.crawl.domain.service.WeatherCrawlService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequestMapping("/api/weather/crawl") | ||
@RequiredArgsConstructor | ||
@Tag(name = "Weather crawl 컨트롤러 ", description = "관리자 공공 데이터 포털 호출 api(날씨 관련)") | ||
public class WeatherCrawlController { | ||
|
||
private final WeatherCrawlService weatherCrawlService; | ||
|
||
@Operation(summary = "전국 날씨 크롤링 (당일) ", description = "전국 날씨를 3일치를 들고 옵니다.") | ||
@PostMapping("/current") | ||
public ResponseEntity<?> startWeatherCurrentCrawl() { | ||
|
||
weatherCrawlService.currentCrawl(); | ||
|
||
return ResponseEntity.ok().build(); | ||
} | ||
|
||
@Operation(summary = "전국 날씨 크롤링 (일주일) ", description = "3일 이후 부터 ~7일까지의 날씨 정보를 크롤링합니다.") | ||
@PostMapping("/medium-term") | ||
public ResponseEntity<?> startWeatherMediumTermCrawl() { | ||
|
||
weatherCrawlService.weatherMediumTermCrawl(); | ||
|
||
return ResponseEntity.ok().build(); | ||
} | ||
|
||
@Operation(summary = "전국 기상 특보 크롤링 (지금 현재) ", description = "미구현") | ||
@PostMapping("/weather_alert") | ||
public ResponseEntity<?> startWeatherAlertCrawl() { | ||
|
||
weatherCrawlService.alertCrawl(); | ||
|
||
return ResponseEntity.status(500).body("미구현"); | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
src/main/java/com/hubo/gillajabi/crawl/application/service/BusanCourseHandler.java
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
src/main/java/com/hubo/gillajabi/crawl/application/service/BusanThemeHandler.java
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
src/main/java/com/hubo/gillajabi/crawl/application/service/CrawlFacadeService.java
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
src/main/java/com/hubo/gillajabi/crawl/application/service/DuruCourseHandler.java
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
src/main/java/com/hubo/gillajabi/crawl/application/service/DuruThemeHandler.java
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
src/main/java/com/hubo/gillajabi/crawl/application/service/RoadCrawlFacadeService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.hubo.gillajabi.crawl.application.service; | ||
|
||
|
||
import com.hubo.gillajabi.crawl.application.response.RoadCrawlResponse; | ||
import com.hubo.gillajabi.crawl.domain.constant.CityCrawlName; | ||
import com.hubo.gillajabi.crawl.domain.service.busan.RoadBusanThemeHandler; | ||
import com.hubo.gillajabi.crawl.domain.service.busan.RoadCrawlBusanCourseHandler; | ||
import com.hubo.gillajabi.crawl.domain.service.duru.RoadCourseDuruHandler; | ||
import com.hubo.gillajabi.crawl.domain.service.duru.RoadThemeDuruHandler; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class RoadCrawlFacadeService { | ||
|
||
private final RoadCourseDuruHandler roadCourseDuruHandler; | ||
private final RoadCrawlBusanCourseHandler roadCrawlBusanCourseHandler; | ||
private final RoadThemeDuruHandler roadThemeDuruHandler; | ||
private final RoadBusanThemeHandler roadBusanThemeHandler; | ||
|
||
public RoadCrawlResponse.CourseResult getCourse(final CityCrawlName cityCrawlName) { | ||
return switch (cityCrawlName) { | ||
case DURU -> roadCourseDuruHandler.handle(); | ||
case BUSAN -> roadCrawlBusanCourseHandler.handle(); | ||
}; | ||
} | ||
|
||
public RoadCrawlResponse.ThemeResult getTheme(final CityCrawlName cityCrawlName) { | ||
return switch (cityCrawlName) { | ||
case DURU -> roadThemeDuruHandler.handle(); | ||
case BUSAN -> roadBusanThemeHandler.handle(); | ||
}; | ||
} | ||
} | ||
|
||
|
||
|
||
|
4 changes: 2 additions & 2 deletions
4
...ajabi/crawl/domain/constant/CityName.java → .../crawl/domain/constant/CityCrawlName.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
src/main/java/com/hubo/gillajabi/crawl/domain/constant/CrawlType.java
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
src/main/java/com/hubo/gillajabi/crawl/domain/constant/CycleType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/java/com/hubo/gillajabi/crawl/domain/constant/ForecastType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.hubo.gillajabi.crawl.domain.constant; | ||
|
||
public enum ForecastType { | ||
CURRENT, // 당일 예보 | ||
MEDIUM_TERM, // 중기 예보 | ||
WEATHER_ALERT // 기상 특보 | ||
} |
Oops, something went wrong.