This commit is contained in:
lunaticbum
2024-10-10 17:37:22 +09:00
parent 86060d7471
commit a810db5d25
20 changed files with 40374 additions and 107 deletions
@@ -26,9 +26,9 @@ class BlogController() {
@Autowired
lateinit var logService: LogService
@GetMapping("/write")
@GetMapping("write")
fun writ() : ModelAndView{
val vm = ModelAndView("/content/blog/write")
val vm = ModelAndView("content/blog/write")
// when(System.currentTimeMillis() % 5L) {
// 0L -> vm.modelMap.put(EncTypeKey,"T4")
// 1L -> vm.modelMap.put(EncTypeKey,"T3")
@@ -39,6 +39,20 @@ class BlogController() {
return vm
}
@GetMapping("viewer/{blogId}")
fun viewer(@PathVariable blogId : String) : ModelAndView{
val vm = ModelAndView("content/blog/viewer")
// when(System.currentTimeMillis() % 5L) {
// 0L -> vm.modelMap.put(EncTypeKey,"T4")
// 1L -> vm.modelMap.put(EncTypeKey,"T3")
// 2L -> vm.modelMap.put(EncTypeKey,"T2")
// else -> vm.modelMap.put(EncTypeKey,"T0")
// }
return vm
}
@Value("\${image.upload.path}")
private val uploadPath: String? = null
@@ -47,13 +61,13 @@ class BlogController() {
@ResponseBody
@GetMapping("/post/images/{fileName}")
@GetMapping("post/images/{fileName}")
fun getImage(@PathVariable fileName : String) : Resource {
val imgUploadPath = ("file:" +uploadPath + File.separator + fileName)
return UrlResource.from(imgUploadPath)
}
@PostMapping("/post/imageUpload")
@PostMapping("post/imageUpload")
fun postImage(@RequestPart("file") upload: MultipartFile, res: HttpServletResponse, req: HttpServletRequest) : ResponseEntity<FileSaveResult> {
var lResultCode = 0
var lResultMsg = "Suscces"
@@ -3,9 +3,7 @@ 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.model.*
import kr.lunaticbum.back.lun.utils.LogService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.MediaType
@@ -24,17 +22,21 @@ class BumsPrivate {
@Autowired
lateinit var logService: LogService
@Autowired
lateinit var locationService: LocationLogService
@ResponseBody
@PostMapping("/save/loc.api")
@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)
val decodedBytes: ByteArray = Base64.getMimeDecoder().decode(jsonString)
String(decodedBytes).let {
Gson().fromJson<RequestModel>(it, RequestModel::class.java)?.let { model ->
Gson().fromJson<LocationLog>(it, LocationLog::class.java)?.let { model ->
logService.log(model.toString())
locationService.save(model)
}
}
val responce = ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(ResponceResult().apply {
@@ -33,13 +33,13 @@ class Telegram {
lateinit var logService: LogService
@ResponseBody
@GetMapping("/hello")
@GetMapping("hello")
fun hello(): String {
return "hello1212"
}
@ResponseBody
@PostMapping("/webhook")
@PostMapping("webhook")
fun test(httpServletRequest: HttpServletRequest, @RequestBody update : TelegramUpdate?) {
try {
logService.log("test strat ${update}")
@@ -38,10 +38,10 @@ class UserController {
@Autowired
lateinit var userManager: UserManager
@GetMapping("/join")
@GetMapping("join")
fun hello(httpServletRequest: HttpServletRequest): ModelAndView {
logService.log("onJoin")
val vm = ModelAndView("/content/user/join")
val vm = ModelAndView("content/user/join")
// when(System.currentTimeMillis() % 5L) {
// 0L -> vm.modelMap.put(EncTypeKey,"T4")
// 1L -> vm.modelMap.put(EncTypeKey,"T3")
@@ -57,10 +57,10 @@ class UserController {
return vm
}
@GetMapping("/login")
@GetMapping("login")
fun userLogin(httpServletRequest: HttpServletRequest): ModelAndView {
logService.log("onJoin")
val vm = ModelAndView("/content/user/login")
val vm = ModelAndView("content/user/login")
// when(System.currentTimeMillis() % 5L) {
// 0L -> vm.modelMap.put(EncTypeKey,"T4")
// 1L -> vm.modelMap.put(EncTypeKey,"T3")
@@ -74,7 +74,7 @@ class UserController {
@ResponseBody
@PostMapping("/login.ajax")
@PostMapping("login.ajax")
fun login(httpServletRequest: HttpServletRequest, @RequestBody jsonString: String) : ResponseEntity<ResponceResult> {
logService.log("${httpServletRequest.requestURI}")
logService.log(jsonString)
@@ -129,7 +129,7 @@ class UserController {
@ResponseBody
@PostMapping("/joinUser.ajax")
@PostMapping("joinUser.ajax")
fun joinUser(httpServletRequest: HttpServletRequest, @RequestBody jsonString: String) : ResponseEntity<ResponceResult> {
logService.log("${httpServletRequest.requestURI}")
logService.log(jsonString)
@@ -1,4 +1,91 @@
package kr.lunaticbum.back.lun.model
import kr.lunaticbum.back.lun.utils.LogService
import lombok.AllArgsConstructor
import lombok.Data
import lombok.NoArgsConstructor
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.data.mongodb.core.mapping.Document
import org.springframework.data.mongodb.repository.ReactiveMongoRepository
import org.springframework.stereotype.Repository
import org.springframework.stereotype.Service
import reactor.core.publisher.Mono
class BumsPrivate {
}
@Data
@NoArgsConstructor
@AllArgsConstructor
@Document(collection = "LocationLog")
class LocationLog {
var mFeatureName: String? = null
var mAddressLines: ArrayList<String> = arrayListOf()
var mAdminArea: String? = null
var mSubAdminArea: String? = null
var mLocality: String? = null
var mSubLocality: String? = null
var mThoroughfare: String? = null
var mSubThoroughfare: String? = null
var mPremises: String? = null
var mPostalCode: String? = null
var mCountryCode: String? = null
var mCountryName: String? = null
var mLatitude = 0.0
var mLongitude = 0.0
var mHasLatitude = false
var mHasLongitude = false
var mPhone: String? = null
var mUrl: String? = null
var time : Long = 0L
override fun toString(): String {
val buffer = StringBuffer()
buffer.append(mFeatureName).append("|").append("\n")
buffer.append(mAddressLines.joinToString(" , ")).append("|").append("\n")
buffer.append(mAdminArea).append("|").append("\n")
buffer.append(mSubAdminArea).append("|").append("\n")
buffer.append(mLocality).append("|").append("\n")
buffer.append(mSubLocality).append("|").append("\n")
buffer.append(mThoroughfare).append("|").append("\n")
buffer.append(mSubThoroughfare).append("|").append("\n")
buffer.append(mPremises).append("|").append("\n")
buffer.append(mPostalCode).append("|").append("\n")
buffer.append(mCountryCode).append("|").append("\n")
buffer.append(mCountryName).append("|").append("\n")
buffer.append(mLatitude).append("|").append("\n")
buffer.append(mLongitude).append("|").append("\n")
buffer.append(mPhone).append("|").append("\n")
buffer.append(mUrl).append("|").append("\n")
return buffer.toString()
}
}
@Repository
interface LocationLogRepository : ReactiveMongoRepository<LocationLog, String> {
fun save(log: LocationLog): Mono<LocationLog>
}
interface LocationService {
}
@Service
class LocationLogService : LocationService {
@Autowired
private lateinit var logService: LogService
@Autowired
private lateinit var logRepository: LocationLogRepository
fun save(log: LocationLog) {
println("saved msg before ${log}")
logRepository.save(log).subscribe( { println("saved msg after ${it}") },{e -> e.printStackTrace()},{
println("saved msg comp")
})
}
}