...
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package kr.lunaticbum.back.lun.controllers
|
||||
|
||||
import com.drew.imaging.ImageMetadataReader
|
||||
import com.drew.metadata.Metadata
|
||||
import com.google.gson.Gson
|
||||
import jakarta.servlet.http.HttpServletRequest
|
||||
import jakarta.servlet.http.HttpServletResponse
|
||||
@@ -7,7 +9,6 @@ import kr.lunaticbum.back.lun.configs.GlobalEnvironment
|
||||
import kr.lunaticbum.back.lun.model.CurrentWeather
|
||||
import kr.lunaticbum.back.lun.model.FileSaveResult
|
||||
import kr.lunaticbum.back.lun.model.LocationLogService
|
||||
import kr.lunaticbum.back.lun.model.ResponceResult
|
||||
import kr.lunaticbum.back.lun.utils.LogService
|
||||
import kr.lunaticbum.back.lun.utils.getFileExtension
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
@@ -156,6 +157,13 @@ class BlogController() {
|
||||
// printWriter.flush()
|
||||
logService.log("imgUploadPath $imgUploadPath")
|
||||
logService.log("imgUploadPath ${File(imgUploadPath).exists()}")
|
||||
val metadata: Metadata? = ImageMetadataReader.readMetadata(File(imgUploadPath))
|
||||
metadata?.let {
|
||||
it.directories?.forEach { directory ->
|
||||
logService.log(directory.name)
|
||||
logService.log(directory.tags.map { tag -> logService.log("tag.tagName >>> ${tag.tagName} || tag.description ${tag.description}")}.joinToString(" \n"))
|
||||
}
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
} finally {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package kr.lunaticbum.back.lun.controllers
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import org.springframework.web.servlet.ModelAndView
|
||||
|
||||
@RestController
|
||||
@RequestMapping()
|
||||
class Home {
|
||||
|
||||
@GetMapping("/","/home")
|
||||
fun home() : ModelAndView {
|
||||
val vm = ModelAndView("content/blog/write")
|
||||
return vm
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import org.springframework.context.annotation.Bean
|
||||
import org.springframework.scheduling.annotation.Scheduled
|
||||
import org.springframework.web.bind.annotation.*
|
||||
import org.springframework.web.reactive.function.client.WebClient
|
||||
import java.math.BigDecimal
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
@@ -139,7 +140,7 @@ class Telegram {
|
||||
Gson().fromJson(result, CurrentWeather::class.java)?.let { sss ->
|
||||
val client = WebClient.create()
|
||||
client.get()
|
||||
.uri("https://api.telegram.org/${globalEvv.telegramBotKey}/sendMessage?chat_id=${globalEvv.telegramMyId}&text=${sss.getSummaryInfo()}")
|
||||
.uri("https://api.telegram.org/${globalEvv.telegramBotKey}/sendMessage?chat_id=${globalEvv.telegramMyId}&text=${sss.getSummaryInfo(BigDecimal(it.mLatitude).setScale(5).toString(),BigDecimal(it.mLongitude).setScale(5).toString())}")
|
||||
.retrieve()
|
||||
.bodyToMono(String::class.java).block() ?: "FAIL"
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ class UserController {
|
||||
logService.log(file.absolutePath)
|
||||
vm.modelMap.put(EncTypeKey,EncType11)
|
||||
vm.modelMap.put(ApiKeyWordKey,"JOIN")
|
||||
vm.modelMap.put("title","회원이 들어는 구나~!!")
|
||||
return vm
|
||||
}
|
||||
|
||||
@@ -120,7 +121,8 @@ class UserController {
|
||||
}
|
||||
}
|
||||
}
|
||||
val responce = ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(ResponceResult().apply {
|
||||
val responce = ResponseEntity.ok().headers {
|
||||
}.contentType(MediaType.APPLICATION_JSON).body(ResponceResult().apply {
|
||||
this.resultCode = lResultCode
|
||||
this.resultMsg = lResultMsg
|
||||
})
|
||||
|
||||
@@ -52,7 +52,6 @@ class Location {
|
||||
class CurrentWeather {
|
||||
var location: Location? = null
|
||||
var current: Current? = null
|
||||
|
||||
fun getSummaryInfo() = "지역:${this.location?.name}\n날씨:${this.current?.condition?.text}\n온도:${this.current?.temp_c}\n습도:${this.current?.humidity}\n" +
|
||||
"체감온도:${this.current?.feelslike_c}\nhttps://www.accuweather.com/ko/search-locations?query=${this.location?.lat},${this.location?.lon}"
|
||||
fun getSummaryInfo(lat : String,lon : String) = "지역:${this.location?.name}\n날씨:${this.current?.condition?.text}\n온도:${this.current?.temp_c}\n습도:${this.current?.humidity}\n" +
|
||||
"체감온도:${this.current?.feelslike_c}\nhttps://www.accuweather.com/ko/search-locations?query=${lat},${lon}"
|
||||
}
|
||||
Reference in New Issue
Block a user