Skip to content

Commit

Permalink
Modify Amarense Diet URL
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Diger committed Mar 15, 2024
1 parent 796a20e commit ccfc1a0
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package univ.suwon.sulasang.component.consts

object AmaraenseuConst {
object AmarenseCenterConst {
internal const val URL = "https://www.suwon.ac.kr/index.html?menuno=1793"
internal const val TABLE_DOM = "table"
internal const val ROW_DOM = "tr"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.springframework.stereotype.Component
import org.springframework.transaction.annotation.Transactional
import univ.suwon.sulasang.common.common.util.StartEndDateConverter
import univ.suwon.sulasang.component.consts.AceEducationCenterConst
import univ.suwon.sulasang.component.consts.AmarenseCenterConst
import univ.suwon.sulasang.domain.diet.persistence.embbeded.DayOfWeeks
import univ.suwon.sulasang.domain.diet.service.amarence.CreateAmarenceCenterDietService
import univ.suwon.sulasang.domain.diet.service.amarence.CreateAmarenceCenterHolidayDietService
Expand All @@ -21,7 +22,7 @@ class AmarenseCenterCrawler(

@Transactional
fun execute() {
val doc = Jsoup.connect(AceEducationCenterConst.URL).get()
val doc = Jsoup.connect(AmarenseCenterConst.URL).get()
val mergedLocalDate = extractLocalDate(doc)

saveStudentDietsByDocAndLocalDate(doc, mergedLocalDate)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package univ.suwon.sulasang.emergency

import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import univ.suwon.sulasang.component.core.AceEducationCenterCrawler
import univ.suwon.sulasang.component.core.AmarenseCenterCrawler

@RestController
@RequestMapping("/v1/force/update")
class ForceCrawlingExecutor(
private val aceEducationCenterCrawler: AceEducationCenterCrawler,
private val amarenseCenterCrawler: AmarenseCenterCrawler
) {

@GetMapping("/aceeducationcenter")
fun forceUpdateAceEducationCenterDiet() {
aceEducationCenterCrawler.execute()
}

@GetMapping("/amarensecenter")
fun forceUpdateAmarenseCenterDiet() {
amarenseCenterCrawler.execute()
}
}
4 changes: 2 additions & 2 deletions sulasang-domain/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dependencies {
runtimeOnly("com.mysql:mysql-connector-j:8.0.32")

// jasypt
api("com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.5")
api("com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.3")

// querydsl
implementation ("com.querydsl:querydsl-jpa:5.0.0:jakarta")
Expand All @@ -24,4 +24,4 @@ tasks.bootJar {

tasks.jar {
enabled = true
}
}

0 comments on commit ccfc1a0

Please sign in to comment.