diff --git a/Dockerfile b/Dockerfile index 42ebea3..add202f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ ENV MONGODB_NAME=default ENV MRA_ADMIN=default ENV MRA_PW=default LABEL maintainer="lunaticbum " -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 diff --git a/src/main/kotlin/kr/lunaticbum/back/lun/controllers/BumsPrivate.kt b/src/main/kotlin/kr/lunaticbum/back/lun/controllers/BumsPrivate.kt new file mode 100644 index 0000000..aa70996 --- /dev/null +++ b/src/main/kotlin/kr/lunaticbum/back/lun/controllers/BumsPrivate.kt @@ -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 { + 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(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 + } + +} \ No newline at end of file diff --git a/src/main/kotlin/kr/lunaticbum/back/lun/model/BumsPrivate.kt b/src/main/kotlin/kr/lunaticbum/back/lun/model/BumsPrivate.kt new file mode 100644 index 0000000..2a7fe0b --- /dev/null +++ b/src/main/kotlin/kr/lunaticbum/back/lun/model/BumsPrivate.kt @@ -0,0 +1,4 @@ +package kr.lunaticbum.back.lun.model + +class BumsPrivate { +} \ No newline at end of file diff --git a/src/main/kotlin/kr/lunaticbum/back/lun/utils/LocationUtils.kt b/src/main/kotlin/kr/lunaticbum/back/lun/utils/LocationUtils.kt new file mode 100644 index 0000000..0d54256 --- /dev/null +++ b/src/main/kotlin/kr/lunaticbum/back/lun/utils/LocationUtils.kt @@ -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 \ No newline at end of file