mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-11 21:57:26 +08:00
[O] DIVA kt > better kt
This commit is contained in:
@@ -6,8 +6,6 @@ import icu.samnyan.aqua.sega.diva.model.gamedata.Contest
|
|||||||
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
||||||
import icu.samnyan.aqua.sega.diva.model.response.databank.ContestInfoResponse
|
import icu.samnyan.aqua.sega.diva.model.response.databank.ContestInfoResponse
|
||||||
import icu.samnyan.aqua.sega.diva.util.URIEncoder.encode
|
import icu.samnyan.aqua.sega.diva.util.URIEncoder.encode
|
||||||
import org.slf4j.Logger
|
|
||||||
import org.slf4j.LoggerFactory
|
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
@@ -36,8 +34,4 @@ class ContestInfoHandler(private val contestRepository: ContestRepository) : Bas
|
|||||||
ci_str
|
ci_str
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(CmPlyInfoHandler::class.java)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,21 +19,12 @@ class CstmzItmCtlgHandler(private val customizeRepository: DivaCustomizeReposito
|
|||||||
fun handle(request: BaseRequest): Any {
|
fun handle(request: BaseRequest): Any {
|
||||||
val customizeList = customizeRepository.findAll()
|
val customizeList = customizeRepository.findAll()
|
||||||
|
|
||||||
val response = CstmzItmCtlgResponse(
|
return CstmzItmCtlgResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
DivaDateTimeUtil.getString(LocalDateTime.now()),
|
DivaDateTimeUtil.getString(LocalDateTime.now()),
|
||||||
encode(customizeList.map { it.toInternal() }.joinToString(",") { encode(it) })
|
encode(customizeList.map { it.toInternal() }.joinToString(",") { encode(it) })
|
||||||
)
|
)
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(CstmzItmCtlgHandler::class.java)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
|||||||
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
||||||
import icu.samnyan.aqua.sega.diva.model.response.databank.CstmzItmNgMdlListResponse
|
import icu.samnyan.aqua.sega.diva.model.response.databank.CstmzItmNgMdlListResponse
|
||||||
import icu.samnyan.aqua.sega.diva.util.DivaDateTimeUtil
|
import icu.samnyan.aqua.sega.diva.util.DivaDateTimeUtil
|
||||||
import org.slf4j.Logger
|
|
||||||
import org.slf4j.LoggerFactory
|
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
@@ -14,22 +12,11 @@ import java.time.LocalDateTime
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
class CstmzItmNgMdlListHandler : BaseHandler() {
|
class CstmzItmNgMdlListHandler : BaseHandler() {
|
||||||
fun handle(request: BaseRequest): Any {
|
fun handle(request: BaseRequest) = CstmzItmNgMdlListResponse(
|
||||||
val response = CstmzItmNgMdlListResponse(
|
request.cmd,
|
||||||
request.cmd,
|
request.req_id,
|
||||||
request.req_id,
|
"ok",
|
||||||
"ok",
|
DivaDateTimeUtil.getString(LocalDateTime.now()),
|
||||||
DivaDateTimeUtil.getString(LocalDateTime.now()),
|
"***"
|
||||||
"***"
|
)
|
||||||
)
|
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(CstmzItmCtlgHandler::class.java)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class FestaInfoHandler(private val festaRepository: FestaRepository) : BaseHandl
|
|||||||
val festaList = festaRepository.findTop2ByEnableOrderByCreateDateDesc(true)
|
val festaList = festaRepository.findTop2ByEnableOrderByCreateDateDesc(true)
|
||||||
val collection = FestaCollection(festaList)
|
val collection = FestaCollection(festaList)
|
||||||
|
|
||||||
val response = FestaInfoResponse(
|
return FestaInfoResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
@@ -34,14 +34,5 @@ class FestaInfoHandler(private val festaRepository: FestaRepository) : BaseHandl
|
|||||||
collection.ends,
|
collection.ends,
|
||||||
collection.lastUpdateTime
|
collection.lastUpdateTime
|
||||||
)
|
)
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(FestaInfoHandler::class.java)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package icu.samnyan.aqua.sega.diva.handler.databank
|
|||||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||||
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
||||||
import icu.samnyan.aqua.sega.diva.model.response.BaseResponse
|
import icu.samnyan.aqua.sega.diva.model.response.BaseResponse
|
||||||
import org.slf4j.Logger
|
|
||||||
import org.slf4j.LoggerFactory
|
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -12,20 +10,9 @@ import org.springframework.stereotype.Component
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
class NgWordHandler : BaseHandler() {
|
class NgWordHandler : BaseHandler() {
|
||||||
fun handle(request: BaseRequest): Any {
|
fun handle(request: BaseRequest) = BaseResponse(
|
||||||
val response = BaseResponse(
|
request.cmd,
|
||||||
request.cmd,
|
request.req_id,
|
||||||
request.req_id,
|
"ok"
|
||||||
"ok"
|
)
|
||||||
)
|
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(NgWordHandler::class.java)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package icu.samnyan.aqua.sega.diva.handler.databank
|
|||||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||||
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
||||||
import icu.samnyan.aqua.sega.diva.model.response.databank.NvRankingResponse
|
import icu.samnyan.aqua.sega.diva.model.response.databank.NvRankingResponse
|
||||||
import org.slf4j.Logger
|
|
||||||
import org.slf4j.LoggerFactory
|
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -12,24 +10,13 @@ import org.springframework.stereotype.Component
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
class NvRankingHandler : BaseHandler() {
|
class NvRankingHandler : BaseHandler() {
|
||||||
fun handle(request: BaseRequest): Any {
|
fun handle(request: BaseRequest) = NvRankingResponse(
|
||||||
val response = NvRankingResponse(
|
request.cmd,
|
||||||
request.cmd,
|
request.req_id,
|
||||||
request.req_id,
|
"ok",
|
||||||
"ok",
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null
|
||||||
null
|
)
|
||||||
)
|
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(NvRankingHandler::class.java)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import icu.samnyan.aqua.sega.diva.model.common.collection.PsRankingCollection
|
|||||||
import icu.samnyan.aqua.sega.diva.model.request.databank.PsRankingRequest
|
import icu.samnyan.aqua.sega.diva.model.request.databank.PsRankingRequest
|
||||||
import icu.samnyan.aqua.sega.diva.model.response.databank.PsRankingResponse
|
import icu.samnyan.aqua.sega.diva.model.response.databank.PsRankingResponse
|
||||||
import icu.samnyan.aqua.sega.diva.util.URIEncoder.encode
|
import icu.samnyan.aqua.sega.diva.util.URIEncoder.encode
|
||||||
import org.slf4j.Logger
|
|
||||||
import org.slf4j.LoggerFactory
|
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -80,7 +78,7 @@ class PsRankingHandler(private val playerPvRecordRepository: PlayerPvRecordRepos
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val response = PsRankingResponse(
|
return PsRankingResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
@@ -98,14 +96,5 @@ class PsRankingHandler(private val playerPvRecordRepository: PlayerPvRecordRepos
|
|||||||
name2.stream().map<String?> { obj: String? -> obj.toString() }.collect(Collectors.joining(",")),
|
name2.stream().map<String?> { obj: String? -> obj.toString() }.collect(Collectors.joining(",")),
|
||||||
name3.stream().map<String?> { obj: String? -> obj.toString() }.collect(Collectors.joining(","))
|
name3.stream().map<String?> { obj: String? -> obj.toString() }.collect(Collectors.joining(","))
|
||||||
)
|
)
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(PsRankingHandler::class.java)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,22 +14,11 @@ import java.time.LocalDateTime
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
class PstdHCtrlHandler : BaseHandler() {
|
class PstdHCtrlHandler : BaseHandler() {
|
||||||
fun handle(request: BaseRequest): Any {
|
fun handle(request: BaseRequest) = PstdHCtrlResponse(
|
||||||
val response = PstdHCtrlResponse(
|
request.cmd,
|
||||||
request.cmd,
|
request.req_id,
|
||||||
request.req_id,
|
"ok",
|
||||||
"ok",
|
DivaDateTimeUtil.getString(LocalDateTime.now()),
|
||||||
DivaDateTimeUtil.getString(LocalDateTime.now()),
|
"***,***"
|
||||||
"***,***"
|
)
|
||||||
)
|
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(PstdHCtrlHandler::class.java)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
|||||||
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
||||||
import icu.samnyan.aqua.sega.diva.model.response.databank.PstdItemNgLstResponse
|
import icu.samnyan.aqua.sega.diva.model.response.databank.PstdItemNgLstResponse
|
||||||
import icu.samnyan.aqua.sega.diva.util.DivaDateTimeUtil
|
import icu.samnyan.aqua.sega.diva.util.DivaDateTimeUtil
|
||||||
import org.slf4j.Logger
|
|
||||||
import org.slf4j.LoggerFactory
|
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
@@ -14,23 +12,12 @@ import java.time.LocalDateTime
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
class PstdItemNgLstHandler : BaseHandler() {
|
class PstdItemNgLstHandler : BaseHandler() {
|
||||||
fun handle(request: BaseRequest): Any {
|
fun handle(request: BaseRequest) = PstdItemNgLstResponse(
|
||||||
val response = PstdItemNgLstResponse(
|
request.cmd,
|
||||||
request.cmd,
|
request.req_id,
|
||||||
request.req_id,
|
"ok",
|
||||||
"ok",
|
DivaDateTimeUtil.getString(LocalDateTime.now()),
|
||||||
DivaDateTimeUtil.getString(LocalDateTime.now()),
|
"***",
|
||||||
"***",
|
"***"
|
||||||
"***"
|
)
|
||||||
)
|
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(PstdItemNgLstHandler::class.java)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,22 +14,11 @@ import java.time.LocalDateTime
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
class PvDefChrLstHandler : BaseHandler() {
|
class PvDefChrLstHandler : BaseHandler() {
|
||||||
fun handle(request: BaseRequest): Any {
|
fun handle(request: BaseRequest) = PvDefChrLstResponse(
|
||||||
val response = PvDefChrLstResponse(
|
request.cmd,
|
||||||
request.cmd,
|
request.req_id,
|
||||||
request.req_id,
|
"ok",
|
||||||
"ok",
|
DivaDateTimeUtil.getString(LocalDateTime.now()),
|
||||||
DivaDateTimeUtil.getString(LocalDateTime.now()),
|
"***"
|
||||||
"***"
|
)
|
||||||
)
|
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(PvDefChrLstHandler::class.java)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,18 +35,13 @@ class PvListHandler(private val pvEntryRepository: PvEntryRepository) : BaseHand
|
|||||||
sb.append(encode(difficultyString(extremeList))).append(",")
|
sb.append(encode(difficultyString(extremeList))).append(",")
|
||||||
sb.append("%2A%2A%2A")
|
sb.append("%2A%2A%2A")
|
||||||
|
|
||||||
val response = PvListResponse(
|
return PvListResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
LocalDateTime.now(),
|
LocalDateTime.now(),
|
||||||
sb.toString()
|
sb.toString()
|
||||||
)
|
)
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun entryString(entry: PvEntry): String {
|
private fun entryString(entry: PvEntry): String {
|
||||||
@@ -65,8 +60,4 @@ class PvListHandler(private val pvEntryRepository: PvEntryRepository) : BaseHand
|
|||||||
if (sb.length > 0) sb.deleteCharAt(sb.length - 1)
|
if (sb.length > 0) sb.deleteCharAt(sb.length - 1)
|
||||||
return sb.toString()
|
return sb.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(BannerDataHandler::class.java)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
|||||||
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
||||||
import icu.samnyan.aqua.sega.diva.model.response.databank.PvNgMdlLstResponse
|
import icu.samnyan.aqua.sega.diva.model.response.databank.PvNgMdlLstResponse
|
||||||
import icu.samnyan.aqua.sega.diva.util.DivaDateTimeUtil
|
import icu.samnyan.aqua.sega.diva.util.DivaDateTimeUtil
|
||||||
import org.slf4j.Logger
|
|
||||||
import org.slf4j.LoggerFactory
|
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
@@ -14,22 +12,11 @@ import java.time.LocalDateTime
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
class PvNgMdlLstHandler : BaseHandler() {
|
class PvNgMdlLstHandler : BaseHandler() {
|
||||||
fun handle(request: BaseRequest): Any {
|
fun handle(request: BaseRequest) = PvNgMdlLstResponse(
|
||||||
val response = PvNgMdlLstResponse(
|
request.cmd,
|
||||||
request.cmd,
|
request.req_id,
|
||||||
request.req_id,
|
"ok",
|
||||||
"ok",
|
DivaDateTimeUtil.getString(LocalDateTime.now()),
|
||||||
DivaDateTimeUtil.getString(LocalDateTime.now()),
|
"***"
|
||||||
"***"
|
)
|
||||||
)
|
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(PvNgMdlLstHandler::class.java)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
|||||||
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
||||||
import icu.samnyan.aqua.sega.diva.model.response.databank.QstInfResponse
|
import icu.samnyan.aqua.sega.diva.model.response.databank.QstInfResponse
|
||||||
import icu.samnyan.aqua.sega.diva.util.DivaDateTimeUtil
|
import icu.samnyan.aqua.sega.diva.util.DivaDateTimeUtil
|
||||||
import org.slf4j.Logger
|
|
||||||
import org.slf4j.LoggerFactory
|
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
@@ -14,23 +12,12 @@ import java.time.LocalDateTime
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
class QstInfHandler : BaseHandler() {
|
class QstInfHandler : BaseHandler() {
|
||||||
fun handle(request: BaseRequest): Any {
|
fun handle(request: BaseRequest) = QstInfResponse(
|
||||||
val response = QstInfResponse(
|
request.cmd,
|
||||||
request.cmd,
|
request.req_id,
|
||||||
request.req_id,
|
"ok",
|
||||||
"ok",
|
DivaDateTimeUtil.getString(LocalDateTime.now()),
|
||||||
DivaDateTimeUtil.getString(LocalDateTime.now()),
|
null,
|
||||||
null,
|
null
|
||||||
null
|
)
|
||||||
)
|
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(QstInfHandler::class.java)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
|||||||
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
||||||
import icu.samnyan.aqua.sega.diva.model.response.databank.RmtWpLstResponse
|
import icu.samnyan.aqua.sega.diva.model.response.databank.RmtWpLstResponse
|
||||||
import icu.samnyan.aqua.sega.diva.util.DivaDateTimeUtil
|
import icu.samnyan.aqua.sega.diva.util.DivaDateTimeUtil
|
||||||
import org.slf4j.Logger
|
|
||||||
import org.slf4j.LoggerFactory
|
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
@@ -14,22 +12,11 @@ import java.time.LocalDateTime
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
class RmtWpLstHandler : BaseHandler() {
|
class RmtWpLstHandler : BaseHandler() {
|
||||||
fun handle(request: BaseRequest): Any {
|
fun handle(request: BaseRequest) = RmtWpLstResponse(
|
||||||
val response = RmtWpLstResponse(
|
request.cmd,
|
||||||
request.cmd,
|
request.req_id,
|
||||||
request.req_id,
|
"ok",
|
||||||
"ok",
|
DivaDateTimeUtil.getString(LocalDateTime.now()),
|
||||||
DivaDateTimeUtil.getString(LocalDateTime.now()),
|
"***"
|
||||||
"***"
|
)
|
||||||
)
|
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(QstInfHandler::class.java)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,21 +18,12 @@ class ShopCatalogHandler(private val moduleRepository: DivaModuleRepository) : B
|
|||||||
fun handle(request: BaseRequest): Any {
|
fun handle(request: BaseRequest): Any {
|
||||||
val moduleList = moduleRepository.findAll()
|
val moduleList = moduleRepository.findAll()
|
||||||
|
|
||||||
val response = ShopCatalogResponse(
|
return ShopCatalogResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
LocalDateTime.now(),
|
LocalDateTime.now(),
|
||||||
encode(moduleList.map { it.toInternal() }.joinToString(",") { encode(it) })
|
encode(moduleList.map { it.toInternal() }.joinToString(",") { encode(it) })
|
||||||
)
|
)
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(ShopCatalogHandler::class.java)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ import icu.samnyan.aqua.sega.diva.model.response.ingame.BuyCstmzItmResponse
|
|||||||
import icu.samnyan.aqua.sega.diva.model.userdata.GameSession
|
import icu.samnyan.aqua.sega.diva.model.userdata.GameSession
|
||||||
import icu.samnyan.aqua.sega.diva.service.PlayerCustomizeService
|
import icu.samnyan.aqua.sega.diva.service.PlayerCustomizeService
|
||||||
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService
|
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService
|
||||||
import org.slf4j.Logger
|
|
||||||
import org.slf4j.LoggerFactory
|
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import java.util.function.Supplier
|
import java.util.function.Supplier
|
||||||
|
|
||||||
@@ -27,17 +25,16 @@ class BuyCstmzItmHandler(
|
|||||||
private val gameSessionRepository: GameSessionRepository
|
private val gameSessionRepository: GameSessionRepository
|
||||||
) : BaseHandler() {
|
) : BaseHandler() {
|
||||||
fun handle(request: BuyCstmzItmRequest): Any {
|
fun handle(request: BuyCstmzItmRequest): Any {
|
||||||
val profile = playerProfileService.findByPdId(request.pd_id).orElseThrow<ProfileNotFoundException?>(
|
val profile = playerProfileService.findByPdId(request.pd_id).orElseThrow(
|
||||||
Supplier { ProfileNotFoundException() })
|
Supplier { ProfileNotFoundException() })
|
||||||
|
|
||||||
val session = gameSessionRepository.findByPdId(profile)
|
val session = gameSessionRepository.findByPdId(profile)
|
||||||
.orElseThrow<SessionNotFoundException?>(Supplier { SessionNotFoundException() })
|
.orElseThrow(Supplier { SessionNotFoundException() })
|
||||||
|
|
||||||
val customizeOptional = divaCustomizeRepository.findById(request.cstmz_itm_id)
|
val customizeOptional = divaCustomizeRepository.findById(request.cstmz_itm_id)
|
||||||
|
|
||||||
val response: BuyCstmzItmResponse?
|
|
||||||
if (customizeOptional.isEmpty) {
|
if (customizeOptional.isEmpty) {
|
||||||
response = BuyCstmzItmResponse(
|
return BuyCstmzItmResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
@@ -45,7 +42,7 @@ class BuyCstmzItmHandler(
|
|||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
if (session.vp < customizeOptional.get().price) {
|
if (session.vp < customizeOptional.get().price) {
|
||||||
response = BuyCstmzItmResponse(
|
return BuyCstmzItmResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
@@ -56,7 +53,7 @@ class BuyCstmzItmHandler(
|
|||||||
session.vp = session.vp - customizeOptional.get().price
|
session.vp = session.vp - customizeOptional.get().price
|
||||||
gameSessionRepository.save<GameSession?>(session)
|
gameSessionRepository.save<GameSession?>(session)
|
||||||
|
|
||||||
response = BuyCstmzItmResponse(
|
return BuyCstmzItmResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
@@ -67,14 +64,5 @@ class BuyCstmzItmHandler(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(BuyCstmzItmHandler::class.java)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class BuyModuleHandler(
|
|||||||
|
|
||||||
val response: BuyModuleResponse?
|
val response: BuyModuleResponse?
|
||||||
if (moduleOptional.isEmpty) {
|
if (moduleOptional.isEmpty) {
|
||||||
response = BuyModuleResponse(
|
return BuyModuleResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
@@ -45,7 +45,7 @@ class BuyModuleHandler(
|
|||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
if (session.vp < moduleOptional.get().price) {
|
if (session.vp < moduleOptional.get().price) {
|
||||||
response = BuyModuleResponse(
|
return BuyModuleResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
@@ -56,7 +56,7 @@ class BuyModuleHandler(
|
|||||||
session.vp = session.vp - moduleOptional.get().price
|
session.vp = session.vp - moduleOptional.get().price
|
||||||
gameSessionRepository.save<GameSession?>(session)
|
gameSessionRepository.save<GameSession?>(session)
|
||||||
|
|
||||||
response = BuyModuleResponse(
|
return BuyModuleResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
@@ -67,14 +67,5 @@ class BuyModuleHandler(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(BuyModuleHandler::class.java)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class GetPvPdHandler(
|
|||||||
pd.deleteCharAt(pd.length - 1)
|
pd.deleteCharAt(pd.length - 1)
|
||||||
|
|
||||||
|
|
||||||
val response = GetPvPdResponse(
|
return GetPvPdResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
@@ -108,11 +108,6 @@ class GetPvPdHandler(
|
|||||||
false,
|
false,
|
||||||
DivaDateTimeUtil.getString(LocalDateTime.now())
|
DivaDateTimeUtil.getString(LocalDateTime.now())
|
||||||
)
|
)
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -149,8 +144,4 @@ class GetPvPdHandler(
|
|||||||
record.rgoPurchased + "," +
|
record.rgoPurchased + "," +
|
||||||
record.rgoPlayed
|
record.rgoPlayed
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(GetPvPdHandler::class.java)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,20 +44,11 @@ class ShopExitHandler(
|
|||||||
|
|
||||||
playerProfileService.save(profile)
|
playerProfileService.save(profile)
|
||||||
pvCustomizeRepository.save<PlayerPvCustomize?>(customize)
|
pvCustomizeRepository.save<PlayerPvCustomize?>(customize)
|
||||||
val response = ShopExitResponse(
|
return ShopExitResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
Result.SUCCESS
|
Result.SUCCESS
|
||||||
)
|
)
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(ShopExitHandler::class.java)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package icu.samnyan.aqua.sega.diva.handler.ingame
|
package icu.samnyan.aqua.sega.diva.handler.ingame
|
||||||
|
|
||||||
|
import ext.logger
|
||||||
import icu.samnyan.aqua.sega.diva.dao.gamedata.ContestRepository
|
import icu.samnyan.aqua.sega.diva.dao.gamedata.ContestRepository
|
||||||
import icu.samnyan.aqua.sega.diva.dao.userdata.*
|
import icu.samnyan.aqua.sega.diva.dao.userdata.*
|
||||||
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException
|
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException
|
||||||
@@ -42,6 +43,7 @@ class StageResultHandler(
|
|||||||
private val divaCalculator: DivaCalculator
|
private val divaCalculator: DivaCalculator
|
||||||
) : BaseHandler() {
|
) : BaseHandler() {
|
||||||
private var currentProfile: PlayerProfile? = null
|
private var currentProfile: PlayerProfile? = null
|
||||||
|
val logger = logger()
|
||||||
|
|
||||||
fun handle(request: StageResultRequest): Any {
|
fun handle(request: StageResultRequest): Any {
|
||||||
val response: StageResultResponse?
|
val response: StageResultResponse?
|
||||||
@@ -210,7 +212,7 @@ class StageResultHandler(
|
|||||||
gameSessionRepository.save<GameSession?>(session)
|
gameSessionRepository.save<GameSession?>(session)
|
||||||
|
|
||||||
|
|
||||||
response = StageResultResponse(
|
return StageResultResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
@@ -260,17 +262,12 @@ class StageResultHandler(
|
|||||||
"-1,-1,-1,-1,-1"
|
"-1,-1,-1,-1,-1"
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
response = StageResultResponse(
|
return StageResultResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok"
|
"ok"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getLog(request: StageResultRequest, profile: PlayerProfile?, i: Int): PlayLog {
|
private fun getLog(request: StageResultRequest, profile: PlayerProfile?, i: Int): PlayLog {
|
||||||
@@ -458,8 +455,4 @@ class StageResultHandler(
|
|||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(StageResultHandler::class.java)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,19 +46,10 @@ class StageStartHandler(
|
|||||||
gameSessionRepository.save<GameSession?>(session)
|
gameSessionRepository.save<GameSession?>(session)
|
||||||
}
|
}
|
||||||
|
|
||||||
val response = BaseResponse(
|
return BaseResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok"
|
"ok"
|
||||||
)
|
)
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(StageResultHandler::class.java)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package icu.samnyan.aqua.sega.diva.handler.ingame
|
package icu.samnyan.aqua.sega.diva.handler.ingame
|
||||||
|
|
||||||
|
import ext.logger
|
||||||
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerScreenShotRepository
|
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerScreenShotRepository
|
||||||
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException
|
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException
|
||||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||||
@@ -8,8 +9,6 @@ import icu.samnyan.aqua.sega.diva.model.response.BaseResponse
|
|||||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerScreenShot
|
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerScreenShot
|
||||||
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService
|
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService
|
||||||
import icu.samnyan.aqua.sega.diva.util.DivaStringUtils
|
import icu.samnyan.aqua.sega.diva.util.DivaStringUtils
|
||||||
import org.slf4j.Logger
|
|
||||||
import org.slf4j.LoggerFactory
|
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import org.springframework.web.multipart.MultipartFile
|
import org.springframework.web.multipart.MultipartFile
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
@@ -27,6 +26,7 @@ class StoreSsHandler(
|
|||||||
private val playerProfileService: PlayerProfileService,
|
private val playerProfileService: PlayerProfileService,
|
||||||
private val screenShotRepository: PlayerScreenShotRepository
|
private val screenShotRepository: PlayerScreenShotRepository
|
||||||
) : BaseHandler() {
|
) : BaseHandler() {
|
||||||
|
val logger = logger()
|
||||||
fun handle(request: StoreSsRequest, file: MultipartFile): Any {
|
fun handle(request: StoreSsRequest, file: MultipartFile): Any {
|
||||||
val profile = playerProfileService.findByPdId(request.pd_id).orElseThrow<ProfileNotFoundException?>(
|
val profile = playerProfileService.findByPdId(request.pd_id).orElseThrow<ProfileNotFoundException?>(
|
||||||
Supplier { ProfileNotFoundException() })
|
Supplier { ProfileNotFoundException() })
|
||||||
@@ -46,7 +46,7 @@ class StoreSsHandler(
|
|||||||
)
|
)
|
||||||
screenShotRepository.save<PlayerScreenShot?>(ss)
|
screenShotRepository.save<PlayerScreenShot?>(ss)
|
||||||
|
|
||||||
response = BaseResponse(
|
return BaseResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok"
|
"ok"
|
||||||
@@ -54,20 +54,11 @@ class StoreSsHandler(
|
|||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
logger.error("Screenshot save failed", e)
|
logger.error("Screenshot save failed", e)
|
||||||
|
|
||||||
response = BaseResponse(
|
return BaseResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"0"
|
"0"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(StoreSsHandler::class.java)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,16 +89,11 @@ class EndHandler(
|
|||||||
gameSessionRepository.delete(session)
|
gameSessionRepository.delete(session)
|
||||||
|
|
||||||
|
|
||||||
val response = BaseResponse(
|
return BaseResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok"
|
"ok"
|
||||||
)
|
)
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getContestRank(contest: Contest, value: Int): ContestBorder {
|
private fun getContestRank(contest: Contest, value: Int): ContestBorder {
|
||||||
@@ -107,8 +102,4 @@ class EndHandler(
|
|||||||
if (value >= contest.bronzeBorders) return ContestBorder.BRONZE
|
if (value >= contest.bronzeBorders) return ContestBorder.BRONZE
|
||||||
return ContestBorder.NONE
|
return ContestBorder.NONE
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(EndHandler::class.java)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,19 +28,10 @@ class PdUnlockHandler(
|
|||||||
|
|
||||||
gameSessionRepository.delete(session)
|
gameSessionRepository.delete(session)
|
||||||
|
|
||||||
val response = BaseResponse(
|
return BaseResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok"
|
"ok"
|
||||||
)
|
)
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(PdUnlockHandler::class.java)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package icu.samnyan.aqua.sega.diva.handler.user
|
package icu.samnyan.aqua.sega.diva.handler.user
|
||||||
|
|
||||||
|
import ext.logger
|
||||||
import icu.samnyan.aqua.sega.diva.dao.userdata.GameSessionRepository
|
import icu.samnyan.aqua.sega.diva.dao.userdata.GameSessionRepository
|
||||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||||
import icu.samnyan.aqua.sega.diva.model.common.PreStartResult
|
import icu.samnyan.aqua.sega.diva.model.common.PreStartResult
|
||||||
@@ -8,8 +9,6 @@ import icu.samnyan.aqua.sega.diva.model.request.user.PreStartRequest
|
|||||||
import icu.samnyan.aqua.sega.diva.model.response.user.PreStartResponse
|
import icu.samnyan.aqua.sega.diva.model.response.user.PreStartResponse
|
||||||
import icu.samnyan.aqua.sega.diva.model.userdata.GameSession
|
import icu.samnyan.aqua.sega.diva.model.userdata.GameSession
|
||||||
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService
|
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService
|
||||||
import org.slf4j.Logger
|
|
||||||
import org.slf4j.LoggerFactory
|
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.util.concurrent.ThreadLocalRandom
|
import java.util.concurrent.ThreadLocalRandom
|
||||||
@@ -22,21 +21,17 @@ class PreStartHandler(
|
|||||||
private val playerProfileService: PlayerProfileService,
|
private val playerProfileService: PlayerProfileService,
|
||||||
private val gameSessionRepository: GameSessionRepository
|
private val gameSessionRepository: GameSessionRepository
|
||||||
) : BaseHandler() {
|
) : BaseHandler() {
|
||||||
|
var logger = logger()
|
||||||
fun handle(request: PreStartRequest): Any {
|
fun handle(request: PreStartRequest): Any {
|
||||||
val profileOptional = playerProfileService.findByPdId(request.aime_id)
|
val profileOptional = playerProfileService.findByPdId(request.aime_id)
|
||||||
val response: PreStartResponse?
|
val response: PreStartResponse?
|
||||||
if (profileOptional.isEmpty) {
|
if (profileOptional.isEmpty) {
|
||||||
response = PreStartResponse(
|
return PreStartResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
PreStartResult.NEW_REGISTRATION
|
PreStartResult.NEW_REGISTRATION
|
||||||
)
|
)
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
} else {
|
} else {
|
||||||
val profile = profileOptional.get()
|
val profile = profileOptional.get()
|
||||||
|
|
||||||
@@ -46,17 +41,12 @@ class PreStartHandler(
|
|||||||
if (!session.lastUpdateTime
|
if (!session.lastUpdateTime
|
||||||
.isBefore(LocalDateTime.now().minusMinutes(5)) && session.startMode == StartMode.START
|
.isBefore(LocalDateTime.now().minusMinutes(5)) && session.startMode == StartMode.START
|
||||||
) {
|
) {
|
||||||
response = PreStartResponse(
|
return PreStartResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
PreStartResult.ALREADY_PLAYING
|
PreStartResult.ALREADY_PLAYING
|
||||||
)
|
)
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
} else {
|
} else {
|
||||||
gameSessionRepository.delete(session)
|
gameSessionRepository.delete(session)
|
||||||
}
|
}
|
||||||
@@ -80,7 +70,7 @@ class PreStartHandler(
|
|||||||
|
|
||||||
gameSessionRepository.save<GameSession?>(session)
|
gameSessionRepository.save<GameSession?>(session)
|
||||||
|
|
||||||
response = PreStartResponse(
|
return PreStartResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
@@ -104,15 +94,6 @@ class PreStartHandler(
|
|||||||
profile.vocaloidPoints,
|
profile.vocaloidPoints,
|
||||||
profile.passwordStatus
|
profile.passwordStatus
|
||||||
)
|
)
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(PreStartHandler::class.java)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class SpendCreditHandler(private val playerProfileService: PlayerProfileService)
|
|||||||
val profile = playerProfileService.findByPdId(request.pd_id).orElseThrow<ProfileNotFoundException?>(
|
val profile = playerProfileService.findByPdId(request.pd_id).orElseThrow<ProfileNotFoundException?>(
|
||||||
Supplier { ProfileNotFoundException() })
|
Supplier { ProfileNotFoundException() })
|
||||||
|
|
||||||
val response = SpendCreditResponse(
|
return SpendCreditResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
@@ -30,14 +30,5 @@ class SpendCreditHandler(private val playerProfileService: PlayerProfileService)
|
|||||||
profile.plateEffectId,
|
profile.plateEffectId,
|
||||||
profile.plateId
|
profile.plateId
|
||||||
)
|
)
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(SpendCreditHandler::class.java)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class StartHandler(
|
|||||||
border = border or ((if (profile.isShowExcellentBorder) 1 else 0) shl 1)
|
border = border or ((if (profile.isShowExcellentBorder) 1 else 0) shl 1)
|
||||||
border = border or ((if (profile.isShowRivalBorder) 1 else 0) shl 2)
|
border = border or ((if (profile.isShowRivalBorder) 1 else 0) shl 2)
|
||||||
|
|
||||||
val response = StartResponse(
|
return StartResponse(
|
||||||
request.cmd,
|
request.cmd,
|
||||||
request.req_id,
|
request.req_id,
|
||||||
"ok",
|
"ok",
|
||||||
@@ -121,11 +121,6 @@ class StartHandler(
|
|||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
|
|
||||||
val resp = this.build(mapper.toMap(response))
|
|
||||||
logger.info("Response: {}", resp)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun countClearStatus(profile: PlayerProfile?): String? {
|
private fun countClearStatus(profile: PlayerProfile?): String? {
|
||||||
@@ -198,8 +193,4 @@ class StartHandler(
|
|||||||
result["cv_bf"] = cv_bf.stream().map<String?> { obj: Int? -> obj.toString() }.collect(Collectors.joining(","))
|
result["cv_bf"] = cv_bf.stream().map<String?> { obj: Int? -> obj.toString() }.collect(Collectors.joining(","))
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger: Logger = LoggerFactory.getLogger(StartHandler::class.java)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user