..
This commit is contained in:
parent
9e4597890b
commit
1a2b5376ea
@ -9,7 +9,7 @@ ENV MONGODB_NAME=default
|
||||
ENV MRA_ADMIN=default
|
||||
ENV MRA_PW=default
|
||||
LABEL maintainer="lunaticbum <lunaticbum@gmail.com>"
|
||||
LABEL version="0.0.4"
|
||||
LABEL version="0.0.5"
|
||||
LABEL description="Spring Boot Jar Test"
|
||||
|
||||
ARG JAR_FILE=build/libs/lun-0.0.5-SNAPSHOT.jar
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
package kr.lunaticbum.back.lun.controllers
|
||||
|
||||
import com.google.gson.Gson
|
||||
import jakarta.servlet.http.HttpServletRequest
|
||||
import kr.lunaticbum.back.lun.configs.GlobalEnvironment
|
||||
import kr.lunaticbum.back.lun.model.RequestModel
|
||||
import kr.lunaticbum.back.lun.model.ResponceResult
|
||||
import kr.lunaticbum.back.lun.model.User
|
||||
import kr.lunaticbum.back.lun.utils.LogService
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.http.MediaType
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.security.core.userdetails.UserDetails
|
||||
import org.springframework.web.bind.annotation.*
|
||||
import java.util.*
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("bums")
|
||||
class BumsPrivate {
|
||||
@Autowired
|
||||
lateinit var globalEvv : GlobalEnvironment
|
||||
|
||||
@Autowired
|
||||
lateinit var logService: LogService
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("save/loc.api")
|
||||
fun login(httpServletRequest: HttpServletRequest, @RequestBody jsonString: String) : ResponseEntity<ResponceResult> {
|
||||
logService.log("${httpServletRequest.requestURI}")
|
||||
logService.log(jsonString)
|
||||
var lResultCode = 0
|
||||
var lResultMsg = "Suscces"
|
||||
val decodedBytes: ByteArray = Base64.getDecoder().decode(jsonString)
|
||||
String(decodedBytes).let {
|
||||
Gson().fromJson<RequestModel>(it, RequestModel::class.java)?.let { model ->
|
||||
|
||||
}
|
||||
}
|
||||
val responce = ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(ResponceResult().apply {
|
||||
this.resultCode = lResultCode
|
||||
this.resultMsg = lResultMsg
|
||||
})
|
||||
return responce
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package kr.lunaticbum.back.lun.model
|
||||
|
||||
class BumsPrivate {
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package kr.lunaticbum.back.lun.utils
|
||||
|
||||
import kotlin.math.cos
|
||||
|
||||
val EARTH_RADIUS_METERS = 6371000
|
||||
val LATITUDE_DEGREE_PER_METER: Double = 1.0 / (2 * Math.PI * EARTH_RADIUS_METERS / 360)
|
||||
|
||||
fun latitudeRange(latitude: Double, radiusInMeters: Int): DoubleArray {
|
||||
val degreeRange = radiusInMeters * LATITUDE_DEGREE_PER_METER
|
||||
|
||||
val minLatitude = latitude - degreeRange
|
||||
val maxLatitude = latitude + degreeRange
|
||||
|
||||
return doubleArrayOf(minLatitude, maxLatitude)
|
||||
}
|
||||
|
||||
fun longitudeRange(latitude: Double, longitude: Double, radiusInMeters: Int): DoubleArray {
|
||||
val longitudeDegreePerMeter: Double = 360 / (2 * Math.PI * EARTH_RADIUS_METERS * cos(Math.toRadians(latitude)))
|
||||
val degreeRange = longitudeDegreePerMeter * radiusInMeters
|
||||
|
||||
val minLongitude = longitude - degreeRange
|
||||
val maxLongitude = longitude + degreeRange
|
||||
|
||||
return doubleArrayOf(minLongitude, maxLongitude)
|
||||
}
|
||||
|
||||
//https://jinkpark.tistory.com/296
|
||||
//https://develoyummer.tistory.com/103
|
||||
//https://ghj1001020.tistory.com/300
|
||||
Loading…
x
Reference in New Issue
Block a user