mirror of
https://github.com/MewoLab/AquaDX.git
synced 2025-10-25 12:02:40 +00:00
[O] DIVA repos > kt
This commit is contained in:
parent
acf76bd270
commit
32c3226db7
@ -228,6 +228,7 @@ fun Str.fromChusanUsername() = String(this.toByteArray(StandardCharsets.ISO_8859
|
||||
fun Str.truncate(len: Int) = if (this.length > len) this.take(len) + "..." else this
|
||||
val Str.some get() = ifBlank { null }
|
||||
val ByteArray.hexStr get() = toHexString()
|
||||
operator fun StringBuilder.plusAssign(other: String) { this.append(other) }
|
||||
|
||||
// Coroutine
|
||||
suspend fun <T> async(block: suspend kotlinx.coroutines.CoroutineScope.() -> T): T = withContext(Dispatchers.IO) { block() }
|
||||
|
||||
@ -8,6 +8,7 @@ import icu.samnyan.aqua.net.games.IUserData
|
||||
import icu.samnyan.aqua.net.utils.AquaNetProps
|
||||
import icu.samnyan.aqua.net.utils.SUCCESS
|
||||
import icu.samnyan.aqua.sega.chusan.model.Chu3UserDataRepo
|
||||
import icu.samnyan.aqua.sega.diva.PlayerProfileRepository
|
||||
import icu.samnyan.aqua.sega.general.dao.CardRepository
|
||||
import icu.samnyan.aqua.sega.general.model.Card
|
||||
import icu.samnyan.aqua.sega.general.service.CardService
|
||||
@ -19,7 +20,6 @@ import org.springframework.scheduling.annotation.Scheduled
|
||||
import org.springframework.stereotype.Service
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import java.time.LocalDateTime
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
import kotlin.random.Random
|
||||
|
||||
@RestController
|
||||
@ -204,7 +204,7 @@ class CardGameService(
|
||||
val chusan: Chu3UserDataRepo,
|
||||
val wacca: WcUserRepo,
|
||||
val ongeki: OgkUserDataRepo,
|
||||
val diva: icu.samnyan.aqua.sega.diva.dao.userdata.PlayerProfileRepository,
|
||||
val diva: PlayerProfileRepository,
|
||||
val safety: AquaNetSafetyService,
|
||||
val cardRepo: CardRepository,
|
||||
val em: EntityManager
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
package icu.samnyan.aqua.sega.diva.controller
|
||||
package icu.samnyan.aqua.sega.diva
|
||||
|
||||
import ext.MutJDict
|
||||
import ext.logger
|
||||
import icu.samnyan.aqua.sega.diva.handler.AttendHandler
|
||||
import icu.samnyan.aqua.sega.diva.handler.GameInitHandler
|
||||
import icu.samnyan.aqua.sega.diva.handler.PingHandler
|
||||
import icu.samnyan.aqua.sega.diva.handler.buildResultMap
|
||||
import icu.samnyan.aqua.sega.diva.handler.card.*
|
||||
import icu.samnyan.aqua.sega.diva.handler.databank.*
|
||||
import icu.samnyan.aqua.sega.diva.handler.ingame.*
|
||||
import icu.samnyan.aqua.sega.diva.handler.PingHandler
|
||||
import icu.samnyan.aqua.sega.diva.handler.user.*
|
||||
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
||||
import icu.samnyan.aqua.sega.diva.model.request.boot.GameInitRequest
|
||||
@ -188,4 +188,4 @@ class DivaController(
|
||||
.map { URLDecoder.decode(it, StandardCharsets.UTF_8) }
|
||||
.map { it.deArray() }
|
||||
}
|
||||
}
|
||||
}
|
||||
5
src/main/java/icu/samnyan/aqua/sega/diva/Exceptions.kt
Normal file
5
src/main/java/icu/samnyan/aqua/sega/diva/Exceptions.kt
Normal file
@ -0,0 +1,5 @@
|
||||
package icu.samnyan.aqua.sega.diva
|
||||
|
||||
class PvRecordDataException(message: String?) : RuntimeException(message)
|
||||
class SessionNotFoundException : RuntimeException()
|
||||
class ProfileNotFoundException : RuntimeException()
|
||||
173
src/main/java/icu/samnyan/aqua/sega/diva/Repos.kt
Normal file
173
src/main/java/icu/samnyan/aqua/sega/diva/Repos.kt
Normal file
@ -0,0 +1,173 @@
|
||||
package icu.samnyan.aqua.sega.diva
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Difficulty
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Edition
|
||||
import icu.samnyan.aqua.sega.diva.model.gamedata.*
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.*
|
||||
import org.springframework.data.domain.Page
|
||||
import org.springframework.data.domain.Pageable
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import org.springframework.data.jpa.repository.Query
|
||||
import org.springframework.data.repository.query.Param
|
||||
import org.springframework.stereotype.Component
|
||||
import org.springframework.stereotype.Repository
|
||||
import java.util.*
|
||||
|
||||
@Component
|
||||
class DivaGameRepos(
|
||||
val contest: ContestRepository,
|
||||
val customize: DivaCustomizeRepository,
|
||||
val module: DivaModuleRepository,
|
||||
val pv: DivaPvRepository,
|
||||
val festa: FestaRepository,
|
||||
val ngWords: NgWordsRepository,
|
||||
val pvEntry: PvEntryRepository
|
||||
)
|
||||
|
||||
@Component
|
||||
class DivaRepos(
|
||||
val g: DivaGameRepos,
|
||||
val gameSession: GameSessionRepository,
|
||||
val playLog: PlayLogRepository,
|
||||
val contest: PlayerContestRepository,
|
||||
val customize: PlayerCustomizeRepository,
|
||||
val inventory: PlayerInventoryRepository,
|
||||
val module: PlayerModuleRepository,
|
||||
val profile: PlayerProfileRepository,
|
||||
val pvCustomize: PlayerPvCustomizeRepository,
|
||||
val pvRecord: PlayerPvRecordRepository,
|
||||
val screenShot: PlayerScreenShotRepository
|
||||
)
|
||||
|
||||
@Repository
|
||||
interface ContestRepository : JpaRepository<Contest, Int> {
|
||||
fun findTop8ByEnable(enable: Boolean): MutableList<Contest>
|
||||
}
|
||||
|
||||
@Repository
|
||||
interface DivaCustomizeRepository : JpaRepository<DivaCustomize, Int>
|
||||
|
||||
@Repository
|
||||
interface DivaModuleRepository : JpaRepository<DivaModule, Int>
|
||||
|
||||
interface DivaPvRepository : JpaRepository<Pv, Int>
|
||||
|
||||
@Repository
|
||||
interface FestaRepository : JpaRepository<Festa, Int> {
|
||||
fun findTop2ByEnableOrderByCreateDateDesc(enable: Boolean): MutableList<Festa>
|
||||
}
|
||||
|
||||
@Repository
|
||||
interface NgWordsRepository : JpaRepository<NgWords, Int>
|
||||
|
||||
@Repository
|
||||
interface PvEntryRepository : JpaRepository<PvEntry, Int> {
|
||||
fun findByDifficulty(difficulty: Difficulty): MutableList<PvEntry>
|
||||
}
|
||||
|
||||
interface PlayerContestRepository : JpaRepository<PlayerContest, Long> {
|
||||
fun findByPdIdAndContestId(pdId: PlayerProfile, contestId: Int): Optional<PlayerContest>
|
||||
|
||||
fun findTop4ByPdIdOrderByLastUpdateTimeDesc(pdId: PlayerProfile): MutableList<PlayerContest>
|
||||
}
|
||||
|
||||
@Repository
|
||||
interface GameSessionRepository : JpaRepository<GameSession, Long> {
|
||||
fun findByPdId(profile: PlayerProfile): Optional<GameSession>
|
||||
}
|
||||
|
||||
@Repository
|
||||
interface PlayerCustomizeRepository : JpaRepository<PlayerCustomize, Long> {
|
||||
fun findByPdId(profile: PlayerProfile): MutableList<PlayerCustomize>
|
||||
|
||||
fun findByPdId_PdId(pdId: Long, page: Pageable): Page<PlayerCustomize>
|
||||
|
||||
fun findByPdIdAndCustomizeId(currentProfile: PlayerProfile, parseInt: Int): Optional<PlayerCustomize>
|
||||
}
|
||||
|
||||
@Repository
|
||||
interface PlayerInventoryRepository : JpaRepository<PlayerInventory, Long> {
|
||||
fun findByPdIdAndTypeAndValue(profile: PlayerProfile, type: String, value: String): Optional<PlayerInventory>
|
||||
}
|
||||
|
||||
@Repository
|
||||
interface PlayerProfileRepository : JpaRepository<PlayerProfile, Long> {
|
||||
fun findByPdId(pdId: Long): Optional<PlayerProfile>
|
||||
}
|
||||
|
||||
@Repository
|
||||
interface PlayerPvCustomizeRepository : JpaRepository<PlayerPvCustomize, Long> {
|
||||
fun findByPdIdAndPvId(profile: PlayerProfile, pvId: Int): Optional<PlayerPvCustomize>
|
||||
|
||||
fun findByPdId_PdIdAndPvId(pdId: Long, pvId: Int): Optional<PlayerPvCustomize>
|
||||
}
|
||||
|
||||
@Repository
|
||||
interface PlayerPvRecordRepository : JpaRepository<PlayerPvRecord, Long> {
|
||||
fun findByPdIdAndPvIdAndEditionAndDifficulty(
|
||||
profile: PlayerProfile,
|
||||
pvId: Int,
|
||||
edition: Edition,
|
||||
difficulty: Difficulty
|
||||
): Optional<PlayerPvRecord>
|
||||
|
||||
fun findByPdId_PdIdAndPvIdAndEditionAndDifficulty(
|
||||
pdId: Long,
|
||||
pvId: Int,
|
||||
edition: Edition,
|
||||
difficulty: Difficulty
|
||||
): Optional<PlayerPvRecord>
|
||||
|
||||
@Query(
|
||||
("SELECT COUNT(t1.id) as ranking from DivaPlayerPvRecord as t1 " +
|
||||
"where t1.maxScore >= (" +
|
||||
"SELECT maxScore from DivaPlayerPvRecord where pvId = :pvId and pdId = :pdId and edition = :edition and difficulty = :difficulty" +
|
||||
") and t1.pvId = :pvId and t1.edition = :edition and t1.difficulty = :difficulty")
|
||||
)
|
||||
fun rankByPvIdAndPdIdAndEditionAndDifficulty(
|
||||
@Param("pvId") pvId: Int,
|
||||
@Param("pdId") pdId: PlayerProfile,
|
||||
@Param("edition") edition: Edition,
|
||||
@Param("difficulty") difficulty: Difficulty
|
||||
): Int
|
||||
|
||||
fun findByPdId(profile: PlayerProfile): MutableList<PlayerPvRecord>
|
||||
|
||||
fun findByIdAndPdId_PdId(id: Long, pdId: Long): Optional<PlayerPvRecord>
|
||||
|
||||
fun findByPdIdAndEdition(profile: PlayerProfile, edition: Edition): MutableList<PlayerPvRecord>
|
||||
|
||||
fun findTop3ByPvIdAndEditionAndDifficultyOrderByMaxScoreDesc(
|
||||
pvId: Int,
|
||||
edition: Edition,
|
||||
difficulty: Difficulty
|
||||
): MutableList<PlayerPvRecord>
|
||||
|
||||
fun findByPvIdAndEditionAndDifficultyOrderByMaxScoreDesc(
|
||||
pvId: Int,
|
||||
edition: Edition,
|
||||
difficulty: Difficulty,
|
||||
page: Pageable
|
||||
): Page<PlayerPvRecord>
|
||||
|
||||
fun findByPdId_PdIdOrderByPvId(pdId: Long, page: Pageable): Page<PlayerPvRecord>
|
||||
|
||||
fun findByPdId_PdIdAndPvId(pdId: Long, pvId: Int): MutableList<PlayerPvRecord>
|
||||
}
|
||||
|
||||
interface PlayerScreenShotRepository : JpaRepository<PlayerScreenShot, Long> {
|
||||
fun findByPdId_PdId(pdId: Long): MutableList<PlayerScreenShot>
|
||||
fun findByFileName(fileName: String): Optional<PlayerScreenShot>
|
||||
}
|
||||
|
||||
@Repository
|
||||
interface PlayLogRepository : JpaRepository<PlayLog, Long> {
|
||||
fun findByPdId_PdIdOrderByDateTimeDesc(pdId: Long, page: Pageable): Page<PlayLog>
|
||||
}
|
||||
|
||||
@Repository
|
||||
interface PlayerModuleRepository : JpaRepository<PlayerModule, Long> {
|
||||
fun findByPdId(profile: PlayerProfile): MutableList<PlayerModule>
|
||||
|
||||
fun findByPdId_PdId(pdId: Long, pageable: Pageable): Page<PlayerModule>
|
||||
}
|
||||
@ -1,31 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.gamedata.*
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.*
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
@Component
|
||||
class DivaGameRepos(
|
||||
val contest: ContestRepository,
|
||||
val customize: DivaCustomizeRepository,
|
||||
val module: DivaModuleRepository,
|
||||
val pv: DivaPvRepository,
|
||||
val festa: FestaRepository,
|
||||
val ngWords: NgWordsRepository,
|
||||
val pvEntry: PvEntryRepository
|
||||
)
|
||||
|
||||
@Component
|
||||
class DivaRepos(
|
||||
val g: DivaGameRepos,
|
||||
val gameSession: GameSessionRepository,
|
||||
val playLog: PlayLogRepository,
|
||||
val contest: PlayerContestRepository,
|
||||
val customize: PlayerCustomizeRepository,
|
||||
val inventory: PlayerInventoryRepository,
|
||||
val module: PlayerModuleRepository,
|
||||
val profile: PlayerProfileRepository,
|
||||
val pvCustomize: PlayerPvCustomizeRepository,
|
||||
val pvRecord: PlayerPvRecordRepository,
|
||||
val screenShot: PlayerScreenShotRepository
|
||||
)
|
||||
@ -1,15 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.gamedata.Contest;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface ContestRepository extends JpaRepository<Contest, Integer> {
|
||||
List<Contest> findTop8ByEnable(boolean enable);
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.gamedata.DivaCustomize;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface DivaCustomizeRepository extends JpaRepository<DivaCustomize, Integer> {
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.gamedata.DivaModule;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface DivaModuleRepository extends JpaRepository<DivaModule, Integer> {
|
||||
Optional<DivaModule> findById(int id);
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.gamedata.Pv;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
public interface DivaPvRepository extends JpaRepository<Pv, Integer> {
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.gamedata.Festa;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface FestaRepository extends JpaRepository<Festa, Integer> {
|
||||
List<Festa> findTop2ByEnableOrderByCreateDateDesc(boolean enable);
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.gamedata.NgWords;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface NgWordsRepository extends JpaRepository<NgWords, Integer> {
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Difficulty;
|
||||
import icu.samnyan.aqua.sega.diva.model.gamedata.PvEntry;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface PvEntryRepository extends JpaRepository<PvEntry, Integer> {
|
||||
List<PvEntry> findByDifficulty(Difficulty difficulty);
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.GameSession;
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface GameSessionRepository extends JpaRepository<GameSession, Long> {
|
||||
Optional<GameSession> findByPdId(PlayerProfile profile);
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayLog;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface PlayLogRepository extends JpaRepository<PlayLog, Long> {
|
||||
Page<PlayLog> findByPdId_PdIdOrderByDateTimeDesc(long pdId, Pageable page);
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerContest;
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
public interface PlayerContestRepository extends JpaRepository<PlayerContest, Long> {
|
||||
Optional<PlayerContest> findByPdIdAndContestId(PlayerProfile pdId, int contestId);
|
||||
|
||||
List<PlayerContest> findTop4ByPdIdOrderByLastUpdateTimeDesc(PlayerProfile pdId);
|
||||
}
|
||||
@ -1,23 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerCustomize;
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface PlayerCustomizeRepository extends JpaRepository<PlayerCustomize, Long> {
|
||||
List<PlayerCustomize> findByPdId(PlayerProfile profile);
|
||||
|
||||
Page<PlayerCustomize> findByPdId_PdId(long pdId, Pageable page);
|
||||
|
||||
Optional<PlayerCustomize> findByPdIdAndCustomizeId(PlayerProfile currentProfile, int parseInt);
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerInventory;
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface PlayerInventoryRepository extends JpaRepository<PlayerInventory, Long> {
|
||||
Optional<PlayerInventory> findByPdIdAndTypeAndValue(PlayerProfile profile, String type, String value);
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerModule;
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface PlayerModuleRepository extends JpaRepository<PlayerModule, Long> {
|
||||
List<PlayerModule> findByPdId(PlayerProfile profile);
|
||||
|
||||
Page<PlayerModule> findByPdId_PdId(long pdId, Pageable pageable);
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface PlayerProfileRepository extends JpaRepository<PlayerProfile, Long> {
|
||||
|
||||
Optional<PlayerProfile> findByPdId(long pdId);
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile;
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerPvCustomize;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface PlayerPvCustomizeRepository extends JpaRepository<PlayerPvCustomize, Long> {
|
||||
Optional<PlayerPvCustomize> findByPdIdAndPvId(PlayerProfile profile, int pvId);
|
||||
|
||||
Optional<PlayerPvCustomize> findByPdId_PdIdAndPvId(long pdId, int pvId);
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Difficulty;
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Edition;
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile;
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerPvRecord;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface PlayerPvRecordRepository extends JpaRepository<PlayerPvRecord, Long> {
|
||||
Optional<PlayerPvRecord> findByPdIdAndPvIdAndEditionAndDifficulty(PlayerProfile profile, int pvId, Edition edition, Difficulty difficulty);
|
||||
|
||||
Optional<PlayerPvRecord> findByPdId_PdIdAndPvIdAndEditionAndDifficulty(long pdId, int pvId, Edition edition, Difficulty difficulty);
|
||||
|
||||
@Query("SELECT COUNT(t1.id) as ranking from DivaPlayerPvRecord as t1 " +
|
||||
"where t1.maxScore >= (" +
|
||||
"SELECT maxScore from DivaPlayerPvRecord where pvId = :pvId and pdId = :pdId and edition = :edition and difficulty = :difficulty" +
|
||||
") and t1.pvId = :pvId and t1.edition = :edition and t1.difficulty = :difficulty")
|
||||
Integer rankByPvIdAndPdIdAndEditionAndDifficulty(@Param("pvId") int pvId,
|
||||
@Param("pdId") PlayerProfile pdId,
|
||||
@Param("edition") Edition edition,
|
||||
@Param("difficulty") Difficulty difficulty
|
||||
);
|
||||
|
||||
List<PlayerPvRecord> findByPdId(PlayerProfile profile);
|
||||
|
||||
Optional<PlayerPvRecord> findByIdAndPdId_PdId(long id, long pdId);
|
||||
|
||||
List<PlayerPvRecord> findByPdIdAndEdition(PlayerProfile profile, Edition edition);
|
||||
|
||||
List<PlayerPvRecord> findTop3ByPvIdAndEditionAndDifficultyOrderByMaxScoreDesc(int pvId, Edition edition, Difficulty difficulty);
|
||||
|
||||
Page<PlayerPvRecord> findByPvIdAndEditionAndDifficultyOrderByMaxScoreDesc(int pvId, Edition edition, Difficulty difficulty, Pageable page);
|
||||
|
||||
Page<PlayerPvRecord> findByPdId_PdIdOrderByPvId(long pdId, Pageable page);
|
||||
|
||||
List<PlayerPvRecord> findByPdId_PdIdAndPvId(long pdId, int pvId);
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerScreenShot;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
public interface PlayerScreenShotRepository extends JpaRepository<PlayerScreenShot, Long> {
|
||||
List<PlayerScreenShot> findByPdId_PdId(long pdId);
|
||||
Optional<PlayerScreenShot> findByFileName(String fileName);
|
||||
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.exception;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
public class ProfileNotFoundException extends RuntimeException {
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.exception;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
public class PvRecordDataException extends RuntimeException {
|
||||
public PvRecordDataException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.exception;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
public class SessionNotFoundException extends RuntimeException {
|
||||
}
|
||||
@ -3,10 +3,6 @@ package icu.samnyan.aqua.sega.diva.handler
|
||||
import icu.samnyan.aqua.sega.diva.util.DivaMapper
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
operator fun StringBuilder.plusAssign(other: String) {
|
||||
this.append(other)
|
||||
}
|
||||
|
||||
fun buildResultMap(map: MutableMap<String, Any?>) =
|
||||
map.filterValues { it != null && !(it is String && it == "") }
|
||||
.map { (k, v) -> "$k=$v" }.joinToString("&")
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.card
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.DivaRepos
|
||||
import icu.samnyan.aqua.sega.diva.DivaRepos
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Result
|
||||
import icu.samnyan.aqua.sega.diva.model.common.StartMode
|
||||
import icu.samnyan.aqua.sega.diva.model.request.card.CardProcedureRequest
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.card
|
||||
|
||||
import ext.invoke
|
||||
import icu.samnyan.aqua.sega.diva.dao.DivaRepos
|
||||
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.exception.SessionNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.DivaRepos
|
||||
import icu.samnyan.aqua.sega.diva.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.SessionNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Result
|
||||
import icu.samnyan.aqua.sega.diva.model.request.card.ChangeNameRequest
|
||||
import icu.samnyan.aqua.sega.diva.model.response.card.ChangeNameResponse
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.card
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.DivaRepos
|
||||
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.exception.SessionNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.DivaRepos
|
||||
import icu.samnyan.aqua.sega.diva.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.SessionNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.model.common.PassStat
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Result
|
||||
import icu.samnyan.aqua.sega.diva.model.request.card.ChangePasswdRequest
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.databank
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.gamedata.ContestRepository
|
||||
import icu.samnyan.aqua.sega.diva.ContestRepository
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||
import icu.samnyan.aqua.sega.diva.model.gamedata.Contest
|
||||
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
||||
|
||||
@ -1,13 +1,11 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.databank
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.gamedata.DivaCustomizeRepository
|
||||
import icu.samnyan.aqua.sega.diva.DivaCustomizeRepository
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
||||
import icu.samnyan.aqua.sega.diva.model.response.databank.CstmzItmCtlgResponse
|
||||
import icu.samnyan.aqua.sega.diva.util.DivaDateTimeUtil
|
||||
import icu.samnyan.aqua.sega.diva.util.URIEncoder.encode
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
import java.time.LocalDateTime
|
||||
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.databank
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.gamedata.FestaRepository
|
||||
import icu.samnyan.aqua.sega.diva.FestaRepository
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||
import icu.samnyan.aqua.sega.diva.model.common.collection.FestaCollection
|
||||
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
||||
import icu.samnyan.aqua.sega.diva.model.response.databank.FestaInfoResponse
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
/**
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.databank
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerPvRecordRepository
|
||||
import icu.samnyan.aqua.sega.diva.PlayerPvRecordRepository
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Difficulty
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Edition
|
||||
|
||||
@ -1,14 +1,12 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.databank
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.gamedata.PvEntryRepository
|
||||
import icu.samnyan.aqua.sega.diva.PvEntryRepository
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Difficulty
|
||||
import icu.samnyan.aqua.sega.diva.model.gamedata.PvEntry
|
||||
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
||||
import icu.samnyan.aqua.sega.diva.model.response.databank.PvListResponse
|
||||
import icu.samnyan.aqua.sega.diva.util.URIEncoder.encode
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
@ -54,10 +52,10 @@ class PvListHandler(private val pvEntryRepository: PvEntryRepository) : BaseHand
|
||||
df.format(entry.playableEnd)
|
||||
}
|
||||
|
||||
private fun difficultyString(list: MutableList<PvEntry?>): String {
|
||||
private fun difficultyString(list: MutableList<PvEntry>): String {
|
||||
val sb = StringBuilder()
|
||||
list.forEach(Consumer { x: PvEntry? -> sb.append(encode(entryString(x!!))).append(",") })
|
||||
if (sb.length > 0) sb.deleteCharAt(sb.length - 1)
|
||||
list.forEach(Consumer { sb.append(encode(entryString(it))).append(",") })
|
||||
if (sb.isNotEmpty()) sb.deleteCharAt(sb.length - 1)
|
||||
return sb.toString()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.databank
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.gamedata.DivaModuleRepository
|
||||
import icu.samnyan.aqua.sega.diva.DivaModuleRepository
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
||||
import icu.samnyan.aqua.sega.diva.model.response.databank.ShopCatalogResponse
|
||||
import icu.samnyan.aqua.sega.diva.util.URIEncoder.encode
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
import java.time.LocalDateTime
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.ingame
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.gamedata.DivaCustomizeRepository
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.GameSessionRepository
|
||||
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.exception.SessionNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.DivaCustomizeRepository
|
||||
import icu.samnyan.aqua.sega.diva.GameSessionRepository
|
||||
import icu.samnyan.aqua.sega.diva.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.SessionNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Result
|
||||
import icu.samnyan.aqua.sega.diva.model.request.ingame.BuyCstmzItmRequest
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.ingame
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.gamedata.DivaModuleRepository
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.GameSessionRepository
|
||||
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.exception.SessionNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.DivaModuleRepository
|
||||
import icu.samnyan.aqua.sega.diva.GameSessionRepository
|
||||
import icu.samnyan.aqua.sega.diva.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.SessionNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Result
|
||||
import icu.samnyan.aqua.sega.diva.model.request.ingame.BuyModuleRequest
|
||||
@ -11,8 +11,6 @@ import icu.samnyan.aqua.sega.diva.model.response.ingame.BuyModuleResponse
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.GameSession
|
||||
import icu.samnyan.aqua.sega.diva.service.PlayerModuleService
|
||||
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
import java.util.function.Supplier
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.ingame
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerPvCustomizeRepository
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerPvRecordRepository
|
||||
import icu.samnyan.aqua.sega.diva.PlayerPvCustomizeRepository
|
||||
import icu.samnyan.aqua.sega.diva.PlayerPvRecordRepository
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Difficulty
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Edition
|
||||
@ -12,8 +12,6 @@ import icu.samnyan.aqua.sega.diva.model.userdata.PlayerPvRecord
|
||||
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService
|
||||
import icu.samnyan.aqua.sega.diva.util.DivaDateTimeUtil
|
||||
import icu.samnyan.aqua.sega.diva.util.URIEncoder.encode
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
import java.time.LocalDateTime
|
||||
import java.util.function.Supplier
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.ingame
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerPvCustomizeRepository
|
||||
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.PlayerPvCustomizeRepository
|
||||
import icu.samnyan.aqua.sega.diva.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Result
|
||||
import icu.samnyan.aqua.sega.diva.model.request.ingame.ShopExitRequest
|
||||
@ -9,8 +9,6 @@ import icu.samnyan.aqua.sega.diva.model.response.ingame.ShopExitResponse
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerPvCustomize
|
||||
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService
|
||||
import icu.samnyan.aqua.sega.diva.util.DivaStringUtils
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
import java.util.function.Supplier
|
||||
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
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.userdata.*
|
||||
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.exception.SessionNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.ContestRepository
|
||||
import icu.samnyan.aqua.sega.diva.GameSessionRepository
|
||||
import icu.samnyan.aqua.sega.diva.PlayLogRepository
|
||||
import icu.samnyan.aqua.sega.diva.PlayerContestRepository
|
||||
import icu.samnyan.aqua.sega.diva.PlayerCustomizeRepository
|
||||
import icu.samnyan.aqua.sega.diva.PlayerInventoryRepository
|
||||
import icu.samnyan.aqua.sega.diva.PlayerPvRecordRepository
|
||||
import icu.samnyan.aqua.sega.diva.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.SessionNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||
import icu.samnyan.aqua.sega.diva.model.common.*
|
||||
import icu.samnyan.aqua.sega.diva.model.request.ingame.StageResultRequest
|
||||
@ -13,8 +18,6 @@ import icu.samnyan.aqua.sega.diva.model.userdata.*
|
||||
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService
|
||||
import icu.samnyan.aqua.sega.diva.util.DivaCalculator
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
import java.lang.String
|
||||
import java.time.LocalDateTime
|
||||
@ -340,7 +343,7 @@ class StageResultHandler(
|
||||
)
|
||||
)
|
||||
}
|
||||
i = i + 6
|
||||
i += 6
|
||||
}
|
||||
return result
|
||||
}
|
||||
@ -374,20 +377,20 @@ class StageResultHandler(
|
||||
when (rewardValue[0]) {
|
||||
"-1" -> return null
|
||||
"0" -> {
|
||||
result.put("type", rewardValue[0])
|
||||
result.put("value", rewardValue[1])
|
||||
result.put("string1", "***")
|
||||
result.put("string2", "***")
|
||||
result["type"] = rewardValue[0]
|
||||
result["value"] = rewardValue[1]
|
||||
result["string1"] = "***"
|
||||
result["string2"] = "***"
|
||||
}
|
||||
|
||||
"1" -> {
|
||||
if (playerInventoryRepository.findByPdIdAndTypeAndValue(currentProfile, "SKIN", rewardValue[1])
|
||||
if (playerInventoryRepository.findByPdIdAndTypeAndValue(currentProfile!!, "SKIN", rewardValue[1]!!)
|
||||
.isPresent
|
||||
) {
|
||||
result.put("type", "-1")
|
||||
result.put("value", "-1")
|
||||
result.put("string1", "***")
|
||||
result.put("string2", "***")
|
||||
result["type"] = "-1"
|
||||
result["value"] = "-1"
|
||||
result["string1"] = "***"
|
||||
result["string2"] = "***"
|
||||
} else {
|
||||
playerInventoryRepository.save<PlayerInventory?>(
|
||||
PlayerInventory(
|
||||
@ -405,7 +408,7 @@ class StageResultHandler(
|
||||
}
|
||||
|
||||
"2" -> {
|
||||
if (playerInventoryRepository.findByPdIdAndTypeAndValue(currentProfile, "PLATE", rewardValue[1])
|
||||
if (playerInventoryRepository.findByPdIdAndTypeAndValue(currentProfile!!, "PLATE", rewardValue[1]!!)
|
||||
.isPresent
|
||||
) {
|
||||
result.put("type", "-1")
|
||||
@ -429,7 +432,7 @@ class StageResultHandler(
|
||||
}
|
||||
|
||||
"3" -> {
|
||||
if (playerCustomizeRepository.findByPdIdAndCustomizeId(currentProfile, rewardValue[1]!!.toInt())
|
||||
if (playerCustomizeRepository.findByPdIdAndCustomizeId(currentProfile!!, rewardValue[1]!!.toInt())
|
||||
.isPresent
|
||||
) {
|
||||
result.put("type", "-1")
|
||||
@ -437,7 +440,7 @@ class StageResultHandler(
|
||||
result.put("string1", "***")
|
||||
result.put("string2", "***")
|
||||
} else {
|
||||
playerCustomizeRepository.save<PlayerCustomize?>(
|
||||
playerCustomizeRepository.save(
|
||||
PlayerCustomize(
|
||||
currentProfile,
|
||||
rewardValue[1]!!.toInt()
|
||||
|
||||
@ -1,15 +1,13 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.ingame
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.GameSessionRepository
|
||||
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.exception.SessionNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.GameSessionRepository
|
||||
import icu.samnyan.aqua.sega.diva.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.SessionNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||
import icu.samnyan.aqua.sega.diva.model.request.ingame.StageStartRequest
|
||||
import icu.samnyan.aqua.sega.diva.model.response.BaseResponse
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.GameSession
|
||||
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
import java.util.function.Supplier
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
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.exception.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.PlayerScreenShotRepository
|
||||
import icu.samnyan.aqua.sega.diva.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||
import icu.samnyan.aqua.sega.diva.model.request.ingame.StoreSsRequest
|
||||
import icu.samnyan.aqua.sega.diva.model.response.BaseResponse
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.user
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.gamedata.ContestRepository
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.GameSessionRepository
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerContestRepository
|
||||
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.exception.SessionNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.ContestRepository
|
||||
import icu.samnyan.aqua.sega.diva.GameSessionRepository
|
||||
import icu.samnyan.aqua.sega.diva.PlayerContestRepository
|
||||
import icu.samnyan.aqua.sega.diva.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.SessionNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||
import icu.samnyan.aqua.sega.diva.model.common.ContestBorder
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Difficulty
|
||||
@ -16,8 +16,6 @@ import icu.samnyan.aqua.sega.diva.model.response.BaseResponse
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerContest
|
||||
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService
|
||||
import icu.samnyan.aqua.sega.diva.util.DivaStringUtils
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
import java.lang.String
|
||||
import java.time.LocalDateTime
|
||||
@ -69,7 +67,7 @@ class EndHandler(
|
||||
val contestRecord =
|
||||
playerContestRepository.findByPdIdAndContestId(profile, request.getCr_cid()).orElseGet(
|
||||
Supplier { PlayerContest(profile, request.getCr_cid()) })
|
||||
contestRecord.startCount = contestRecord.startCount + 1
|
||||
contestRecord.startCount += 1
|
||||
contestRecord.bestValue = max(contestRecord.bestValue, request.getCr_tv())
|
||||
contestRecord.resultRank = if (currentResultRank.value > contestRecord.resultRank
|
||||
.value
|
||||
|
||||
@ -1,14 +1,12 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.user
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.GameSessionRepository
|
||||
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.exception.SessionNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.GameSessionRepository
|
||||
import icu.samnyan.aqua.sega.diva.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.SessionNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||
import icu.samnyan.aqua.sega.diva.model.request.user.PdUnlockRequest
|
||||
import icu.samnyan.aqua.sega.diva.model.response.BaseResponse
|
||||
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
import java.util.function.Supplier
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
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.GameSessionRepository
|
||||
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.StartMode
|
||||
@ -24,7 +24,6 @@ class PreStartHandler(
|
||||
var logger = logger()
|
||||
fun handle(request: PreStartRequest): Any {
|
||||
val profileOptional = playerProfileService.findByPdId(request.aime_id)
|
||||
val response: PreStartResponse?
|
||||
if (profileOptional.isEmpty) {
|
||||
return PreStartResponse(
|
||||
request.cmd,
|
||||
@ -68,7 +67,7 @@ class PreStartHandler(
|
||||
profile.vocaloidPoints
|
||||
)
|
||||
|
||||
gameSessionRepository.save<GameSession?>(session)
|
||||
gameSessionRepository.save(session)
|
||||
|
||||
return PreStartResponse(
|
||||
request.cmd,
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.user
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||
import icu.samnyan.aqua.sega.diva.model.request.user.SpendCreditRequest
|
||||
import icu.samnyan.aqua.sega.diva.model.response.user.SpendCreditResponse
|
||||
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
import java.util.function.Supplier
|
||||
|
||||
|
||||
@ -1,11 +1,6 @@
|
||||
package icu.samnyan.aqua.sega.diva.handler.user
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.GameSessionRepository
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerContestRepository
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerPvRecordRepository
|
||||
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.exception.PvRecordDataException
|
||||
import icu.samnyan.aqua.sega.diva.exception.SessionNotFoundException
|
||||
import icu.samnyan.aqua.sega.diva.*
|
||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||
import icu.samnyan.aqua.sega.diva.model.common.*
|
||||
import icu.samnyan.aqua.sega.diva.model.common.collection.ClearSet
|
||||
@ -19,8 +14,6 @@ import icu.samnyan.aqua.sega.diva.model.userdata.PlayerPvRecord
|
||||
import icu.samnyan.aqua.sega.diva.service.PlayerCustomizeService
|
||||
import icu.samnyan.aqua.sega.diva.service.PlayerModuleService
|
||||
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
import java.time.LocalDateTime
|
||||
import java.util.*
|
||||
@ -41,13 +34,13 @@ class StartHandler(
|
||||
private val playerContestRepository: PlayerContestRepository
|
||||
) : BaseHandler() {
|
||||
fun handle(request: StartRequest): Any {
|
||||
val profile = playerProfileService.findByPdId(request.getPd_id()).orElseThrow<ProfileNotFoundException?>(
|
||||
val profile = playerProfileService.findByPdId(request.getPd_id()).orElseThrow<ProfileNotFoundException>(
|
||||
Supplier { ProfileNotFoundException() })
|
||||
val session = gameSessionRepository.findByPdId(profile)
|
||||
.orElseThrow(Supplier { SessionNotFoundException() })
|
||||
|
||||
session.startMode = StartMode.START
|
||||
gameSessionRepository.save<GameSession?>(session)
|
||||
gameSessionRepository.save<GameSession>(session)
|
||||
|
||||
val module_have = playerModuleService.getModuleHaveString(profile)
|
||||
val customize_have = playerCustomizeService.getModuleHaveString(profile)
|
||||
@ -123,18 +116,18 @@ class StartHandler(
|
||||
)
|
||||
}
|
||||
|
||||
private fun countClearStatus(profile: PlayerProfile?): String? {
|
||||
private fun countClearStatus(profile: PlayerProfile): String {
|
||||
val pvRecordList = playerPvRecordRepository.findByPdId(profile)
|
||||
val clearTally = ClearTally()
|
||||
pvRecordList.forEach(Consumer { x: PlayerPvRecord? ->
|
||||
when (x!!.edition) {
|
||||
pvRecordList.forEach(Consumer { x: PlayerPvRecord ->
|
||||
when (x.edition) {
|
||||
Edition.ORIGINAL -> {
|
||||
when (x.result) {
|
||||
ClearResult.CHEAP -> getDiff(x, clearTally)!!.addClear()
|
||||
ClearResult.STANDARD -> getDiff(x, clearTally)!!.addClear()
|
||||
ClearResult.GREAT -> getDiff(x, clearTally)!!.addGreat()
|
||||
ClearResult.EXCELLENT -> getDiff(x, clearTally)!!.addExcellent()
|
||||
ClearResult.PERFECT -> getDiff(x, clearTally)!!.addPerfect()
|
||||
ClearResult.CHEAP -> getDiff(x, clearTally).addClear()
|
||||
ClearResult.STANDARD -> getDiff(x, clearTally).addClear()
|
||||
ClearResult.GREAT -> getDiff(x, clearTally).addGreat()
|
||||
ClearResult.EXCELLENT -> getDiff(x, clearTally).addExcellent()
|
||||
ClearResult.PERFECT -> getDiff(x, clearTally).addPerfect()
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
@ -154,7 +147,7 @@ class StartHandler(
|
||||
return clearTally.toInternal()
|
||||
}
|
||||
|
||||
private fun getDiff(record: PlayerPvRecord, clearTally: ClearTally): ClearSet? {
|
||||
private fun getDiff(record: PlayerPvRecord, clearTally: ClearTally): ClearSet {
|
||||
when (record.difficulty) {
|
||||
Difficulty.EASY -> return clearTally.easy
|
||||
Difficulty.NORMAL -> return clearTally.normal
|
||||
@ -164,15 +157,15 @@ class StartHandler(
|
||||
}
|
||||
}
|
||||
|
||||
private fun getContestResult(profile: PlayerProfile?): MutableMap<String?, String?> {
|
||||
val cv_cid: MutableList<Int?> = LinkedList<Int?>()
|
||||
val cv_sc: MutableList<Int?> = LinkedList<Int?>()
|
||||
val cv_rr: MutableList<Int?> = LinkedList<Int?>()
|
||||
val cv_bv: MutableList<Int?> = LinkedList<Int?>()
|
||||
val cv_bf: MutableList<Int?> = LinkedList<Int?>()
|
||||
private fun getContestResult(profile: PlayerProfile): MutableMap<String, String> {
|
||||
val cv_cid: MutableList<Int> = LinkedList<Int>()
|
||||
val cv_sc: MutableList<Int> = LinkedList<Int>()
|
||||
val cv_rr: MutableList<Int> = LinkedList<Int>()
|
||||
val cv_bv: MutableList<Int> = LinkedList<Int>()
|
||||
val cv_bf: MutableList<Int> = LinkedList<Int>()
|
||||
val contestList = playerContestRepository.findTop4ByPdIdOrderByLastUpdateTimeDesc(profile)
|
||||
contestList.forEach(Consumer { x: PlayerContest? ->
|
||||
cv_cid.add(x!!.contestId)
|
||||
contestList.forEach(Consumer { x: PlayerContest ->
|
||||
cv_cid.add(x.contestId)
|
||||
cv_sc.add(x.startCount)
|
||||
cv_rr.add(x.resultRank.value)
|
||||
cv_bv.add(x.bestValue)
|
||||
@ -185,12 +178,12 @@ class StartHandler(
|
||||
cv_bv.add(-1)
|
||||
cv_bf.add(-1)
|
||||
}
|
||||
val result: MutableMap<String?, String?> = HashMap<String?, String?>()
|
||||
result["cv_cid"] = cv_cid.stream().map<String?> { obj: Int? -> obj.toString() }.collect(Collectors.joining(","))
|
||||
result["cv_sc"] = cv_sc.stream().map<String?> { obj: Int? -> obj.toString() }.collect(Collectors.joining(","))
|
||||
result["cv_rr"] = cv_rr.stream().map<String?> { obj: Int? -> obj.toString() }.collect(Collectors.joining(","))
|
||||
result["cv_bv"] = cv_bv.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(","))
|
||||
val result: MutableMap<String, String> = HashMap<String, String>()
|
||||
result["cv_cid"] = cv_cid.stream().map { it.toString() }.collect(Collectors.joining(","))
|
||||
result["cv_sc"] = cv_sc.stream().map { it.toString() }.collect(Collectors.joining(","))
|
||||
result["cv_rr"] = cv_rr.stream().map { it.toString() }.collect(Collectors.joining(","))
|
||||
result["cv_bv"] = cv_bv.stream().map { it.toString() }.collect(Collectors.joining(","))
|
||||
result["cv_bf"] = cv_bf.stream().map { it.toString() }.collect(Collectors.joining(","))
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.service;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerCustomizeRepository;
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerCustomize;
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
public class PlayerCustomizeService {
|
||||
|
||||
private final PlayerCustomizeRepository playerCustomizeRepository;
|
||||
|
||||
public PlayerCustomizeService(PlayerCustomizeRepository playerCustomizeRepository) {
|
||||
this.playerCustomizeRepository = playerCustomizeRepository;
|
||||
}
|
||||
|
||||
public PlayerCustomize buy(PlayerProfile profile, int customizeId) {
|
||||
return playerCustomizeRepository.save(new PlayerCustomize(profile, customizeId));
|
||||
}
|
||||
|
||||
public String getModuleHaveString(PlayerProfile profile) {
|
||||
List<PlayerCustomize> customizeList = playerCustomizeRepository.findByPdId(profile);
|
||||
BigInteger customize_have = new BigInteger("0");
|
||||
for (PlayerCustomize customize :
|
||||
customizeList) {
|
||||
customize_have = customize_have.or(BigInteger.valueOf(1).shiftLeft(customize.getCustomizeId()));
|
||||
}
|
||||
return StringUtils.leftPad(customize_have.toString(16), 250, "0");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package icu.samnyan.aqua.sega.diva.service
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.PlayerCustomizeRepository
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerCustomize
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
import org.springframework.stereotype.Service
|
||||
import java.math.BigInteger
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
class PlayerCustomizeService(val repo: PlayerCustomizeRepository) {
|
||||
fun buy(profile: PlayerProfile, customizeId: Int) = repo.save(PlayerCustomize(profile, customizeId))
|
||||
|
||||
fun getModuleHaveString(profile: PlayerProfile): String {
|
||||
val customizeList = repo.findByPdId(profile)
|
||||
var customize_have = BigInteger("0")
|
||||
for (customize in customizeList) {
|
||||
customize_have = customize_have.or(BigInteger.valueOf(1).shiftLeft(customize.customizeId))
|
||||
}
|
||||
return StringUtils.leftPad(customize_have.toString(16), 250, "0")
|
||||
}
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.service;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerModuleRepository;
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerModule;
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
public class PlayerModuleService {
|
||||
|
||||
private final PlayerModuleRepository playerModuleRepository;
|
||||
|
||||
public PlayerModuleService(PlayerModuleRepository playerModuleRepository) {
|
||||
this.playerModuleRepository = playerModuleRepository;
|
||||
}
|
||||
|
||||
public PlayerModule buy(PlayerProfile profile, int moduleId) {
|
||||
return playerModuleRepository.save(new PlayerModule(profile, moduleId));
|
||||
}
|
||||
|
||||
public String getModuleHaveString(PlayerProfile profile) {
|
||||
List<PlayerModule> moduleList = playerModuleRepository.findByPdId(profile);
|
||||
BigInteger module_have = new BigInteger("0");
|
||||
for (PlayerModule module :
|
||||
moduleList) {
|
||||
module_have = module_have.or(BigInteger.valueOf(1).shiftLeft(module.getModuleId()));
|
||||
}
|
||||
System.out.println(module_have.toString(2));
|
||||
return StringUtils.leftPad(module_have.toString(16), 250, "0").toUpperCase();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package icu.samnyan.aqua.sega.diva.service
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.PlayerModuleRepository
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerModule
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
import org.springframework.stereotype.Service
|
||||
import java.math.BigInteger
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
class PlayerModuleService(val repo: PlayerModuleRepository) {
|
||||
fun buy(profile: PlayerProfile, moduleId: Int) = repo.save(PlayerModule(profile, moduleId))
|
||||
|
||||
fun getModuleHaveString(profile: PlayerProfile): String {
|
||||
val moduleList = repo.findByPdId(profile)
|
||||
var module_have = BigInteger("0")
|
||||
for (module in moduleList) {
|
||||
module_have = module_have.or(BigInteger.valueOf(1).shiftLeft(module.moduleId))
|
||||
}
|
||||
println(module_have.toString(2))
|
||||
return StringUtils.leftPad(module_have.toString(16), 250, "0").uppercase(Locale.getDefault())
|
||||
}
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.diva.service;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerProfileRepository;
|
||||
import icu.samnyan.aqua.sega.diva.model.request.card.RegistrationRequest;
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
public class PlayerProfileService {
|
||||
|
||||
private final PlayerProfileRepository playerProfileRepository;
|
||||
|
||||
public PlayerProfileService(PlayerProfileRepository playerProfileRepository) {
|
||||
this.playerProfileRepository = playerProfileRepository;
|
||||
}
|
||||
|
||||
public Optional<PlayerProfile> findByPdId(long pdId) {
|
||||
return playerProfileRepository.findByPdId(pdId);
|
||||
}
|
||||
|
||||
public PlayerProfile register(RegistrationRequest request) {
|
||||
PlayerProfile profile = new PlayerProfile();
|
||||
profile.setPdId(request.getAime_id());
|
||||
profile.setPlayerName(request.getPlayer_name());
|
||||
|
||||
return playerProfileRepository.save(profile);
|
||||
}
|
||||
|
||||
public PlayerProfile save(PlayerProfile profile) {
|
||||
return playerProfileRepository.save(profile);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package icu.samnyan.aqua.sega.diva.service
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.PlayerProfileRepository
|
||||
import icu.samnyan.aqua.sega.diva.model.request.card.RegistrationRequest
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile
|
||||
import org.springframework.stereotype.Service
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
class PlayerProfileService(val repo: PlayerProfileRepository) {
|
||||
fun findByPdId(pdId: Long): Optional<PlayerProfile> = repo.findByPdId(pdId)
|
||||
|
||||
fun register(request: RegistrationRequest): PlayerProfile {
|
||||
val profile = PlayerProfile()
|
||||
profile.pdId = request.aime_id
|
||||
profile.playerName = request.player_name
|
||||
|
||||
return repo.save(profile)
|
||||
}
|
||||
|
||||
fun save(profile: PlayerProfile) = repo.save(profile)
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
package icu.samnyan.aqua.sega.diva.util;
|
||||
|
||||
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerPvRecordRepository;
|
||||
import icu.samnyan.aqua.sega.diva.PlayerPvRecordRepository;
|
||||
import icu.samnyan.aqua.sega.diva.model.common.Edition;
|
||||
import icu.samnyan.aqua.sega.diva.model.common.LevelInfo;
|
||||
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user