mirror of https://github.com/hykilpikonna/AquaDX
[O] Huge refactor
parent
fc8ecb7470
commit
e799b48877
|
@ -26,6 +26,7 @@ import java.nio.file.Path
|
|||
import java.time.LocalDate
|
||||
import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.util.*
|
||||
import kotlin.reflect.KCallable
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KMutableProperty1
|
||||
|
@ -40,6 +41,7 @@ typealias PV = PathVariable
|
|||
typealias API = RequestMapping
|
||||
typealias Str = String
|
||||
typealias Bool = Boolean
|
||||
typealias JavaSerializable = java.io.Serializable
|
||||
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.PROPERTY_GETTER)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
|
@ -154,6 +156,10 @@ operator fun <K, V> Map<K, V>.plus(map: Map<K, V>) =
|
|||
operator fun <K, V> MutableMap<K, V>.plusAssign(map: Map<K, V>) { putAll(map) }
|
||||
fun <T> MutableList<T>.popAll(list: List<T>) = list.also { removeAll(it) }
|
||||
fun <T> MutableList<T>.popAll(vararg items: T) = popAll(items.toList())
|
||||
inline fun <T> Iterable<T>.mapApply(block: T.() -> Unit) = map { it.apply(block) }
|
||||
|
||||
// Optionals
|
||||
operator fun <T> Optional<T>.invoke(): T? = orElse(null)
|
||||
|
||||
// Strings
|
||||
operator fun Str.get(range: IntRange) = substring(range.first, (range.last + 1).coerceAtMost(length))
|
||||
|
|
|
@ -105,66 +105,66 @@ public class ApiMaimai2PlayerDataController {
|
|||
}
|
||||
|
||||
@PostMapping("profile/username")
|
||||
public UserDetail updateName(@RequestBody Map<String, Object> request) {
|
||||
UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
public Mai2UserDetail updateName(@RequestBody Map<String, Object> request) {
|
||||
Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
profile.setUserName((String) request.get("userName"));
|
||||
return userDataRepository.save(profile);
|
||||
}
|
||||
|
||||
@PostMapping("profile/icon")
|
||||
public UserDetail updateIcon(@RequestBody Map<String, Object> request) {
|
||||
UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
public Mai2UserDetail updateIcon(@RequestBody Map<String, Object> request) {
|
||||
Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
profile.setIconId((Integer) request.get("iconId"));
|
||||
return userDataRepository.save(profile);
|
||||
}
|
||||
|
||||
@PostMapping("profile/plate")
|
||||
public UserDetail updatePlate(@RequestBody Map<String, Object> request) {
|
||||
UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
public Mai2UserDetail updatePlate(@RequestBody Map<String, Object> request) {
|
||||
Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
profile.setPlateId((Integer) request.get("plateId"));
|
||||
return userDataRepository.save(profile);
|
||||
}
|
||||
|
||||
@PostMapping("profile/frame")
|
||||
public UserDetail updateFrame(@RequestBody Map<String, Object> request) {
|
||||
UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
public Mai2UserDetail updateFrame(@RequestBody Map<String, Object> request) {
|
||||
Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
profile.setFrameId((Integer) request.get("frameId"));
|
||||
return userDataRepository.save(profile);
|
||||
}
|
||||
|
||||
@PostMapping("profile/title")
|
||||
public UserDetail updateTrophy(@RequestBody Map<String, Object> request) {
|
||||
UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
public Mai2UserDetail updateTrophy(@RequestBody Map<String, Object> request) {
|
||||
Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
profile.setTitleId((Integer) request.get("titleId"));
|
||||
return userDataRepository.save(profile);
|
||||
}
|
||||
|
||||
@PostMapping("profile/partner")
|
||||
public UserDetail updatePartner(@RequestBody Map<String, Object> request) {
|
||||
UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
public Mai2UserDetail updatePartner(@RequestBody Map<String, Object> request) {
|
||||
Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
profile.setPartnerId((Integer) request.get("partnerId"));
|
||||
return userDataRepository.save(profile);
|
||||
}
|
||||
|
||||
@GetMapping("character")
|
||||
public ReducedPageResponse<UserCharacter> getCharacter(@RequestParam long aimeId,
|
||||
@RequestParam(required = false, defaultValue = "0") int page,
|
||||
@RequestParam(required = false, defaultValue = "10") int size) {
|
||||
Page<UserCharacter> characters = userCharacterRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page, size));
|
||||
public ReducedPageResponse<Mai2UserCharacter> getCharacter(@RequestParam long aimeId,
|
||||
@RequestParam(required = false, defaultValue = "0") int page,
|
||||
@RequestParam(required = false, defaultValue = "10") int size) {
|
||||
Page<Mai2UserCharacter> characters = userCharacterRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page, size));
|
||||
return new ReducedPageResponse<>(characters.getContent(), characters.getPageable().getPageNumber(), characters.getTotalPages(), characters.getTotalElements());
|
||||
}
|
||||
|
||||
@GetMapping("activity")
|
||||
public List<UserAct> getActivities(@RequestParam long aimeId) {
|
||||
public List<Mai2UserAct> getActivities(@RequestParam long aimeId) {
|
||||
return userActRepository.findByUser_Card_ExtId(aimeId);
|
||||
}
|
||||
|
||||
@GetMapping("item")
|
||||
public ReducedPageResponse<UserItem> getItem(@RequestParam long aimeId,
|
||||
@RequestParam(required = false, defaultValue = "0") int page,
|
||||
@RequestParam(required = false, defaultValue = "10") int size,
|
||||
@RequestParam(required = false, defaultValue = "0") int ItemKind) {
|
||||
Page<UserItem> items;
|
||||
public ReducedPageResponse<Mai2UserItem> getItem(@RequestParam long aimeId,
|
||||
@RequestParam(required = false, defaultValue = "0") int page,
|
||||
@RequestParam(required = false, defaultValue = "10") int size,
|
||||
@RequestParam(required = false, defaultValue = "0") int ItemKind) {
|
||||
Page<Mai2UserItem> items;
|
||||
if(ItemKind == 0){
|
||||
items = userItemRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page, size));
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ public class ApiMaimai2PlayerDataController {
|
|||
|
||||
@PostMapping("item")
|
||||
public ResponseEntity<Object> updateItem(@RequestBody Map<String, Object> request) {
|
||||
UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
Integer itemKind = (Integer) request.get("itemKind");
|
||||
Integer itemId = (Integer) request.get("itemId");
|
||||
int stock = 1;
|
||||
|
@ -184,13 +184,14 @@ public class ApiMaimai2PlayerDataController {
|
|||
stock = (Integer) request.get("stock");
|
||||
}
|
||||
|
||||
Optional<UserItem> userItemOptional = userItemRepository.findByUserAndItemKindAndItemId(profile, itemKind, itemId);
|
||||
Optional<Mai2UserItem> userItemOptional = userItemRepository.findByUserAndItemKindAndItemId(profile, itemKind, itemId);
|
||||
|
||||
UserItem userItem;
|
||||
Mai2UserItem userItem;
|
||||
if (userItemOptional.isPresent()) {
|
||||
userItem = userItemOptional.get();
|
||||
} else {
|
||||
userItem = new UserItem(profile);
|
||||
userItem = new Mai2UserItem();
|
||||
userItem.setUser(profile);
|
||||
userItem.setItemId(itemId);
|
||||
userItem.setItemKind(itemKind);
|
||||
}
|
||||
|
@ -200,34 +201,34 @@ public class ApiMaimai2PlayerDataController {
|
|||
}
|
||||
|
||||
@GetMapping("recent")
|
||||
public ReducedPageResponse<UserPlaylog> getRecent(@RequestParam long aimeId,
|
||||
@RequestParam(required = false, defaultValue = "0") int page,
|
||||
@RequestParam(required = false, defaultValue = "10") int size) {
|
||||
Page<UserPlaylog> playlogs = userPlaylogRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page, size, Sort.Direction.DESC, "id"));
|
||||
public ReducedPageResponse<Mai2UserPlaylog> getRecent(@RequestParam long aimeId,
|
||||
@RequestParam(required = false, defaultValue = "0") int page,
|
||||
@RequestParam(required = false, defaultValue = "10") int size) {
|
||||
Page<Mai2UserPlaylog> playlogs = userPlaylogRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page, size, Sort.Direction.DESC, "id"));
|
||||
return new ReducedPageResponse<>(playlogs.getContent(), playlogs.getPageable().getPageNumber(), playlogs.getTotalPages(), playlogs.getTotalElements());
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("song/{id}")
|
||||
public List<UserMusicDetail> getSongDetail(@RequestParam long aimeId, @PathVariable int id) {
|
||||
public List<Mai2UserMusicDetail> getSongDetail(@RequestParam long aimeId, @PathVariable int id) {
|
||||
return userMusicDetailRepository.findByUser_Card_ExtIdAndMusicId(aimeId, id);
|
||||
}
|
||||
|
||||
@GetMapping("song/{id}/{level}")
|
||||
public List<UserPlaylog> getLevelPlaylog(@RequestParam long aimeId, @PathVariable int id, @PathVariable int level) {
|
||||
public List<Mai2UserPlaylog> getLevelPlaylog(@RequestParam long aimeId, @PathVariable int id, @PathVariable int level) {
|
||||
return userPlaylogRepository.findByUser_Card_ExtIdAndMusicIdAndLevel(aimeId, id, level);
|
||||
}
|
||||
|
||||
@GetMapping("options")
|
||||
public UserOption getOptions(@RequestParam long aimeId) {
|
||||
public Mai2UserOption getOptions(@RequestParam long aimeId) {
|
||||
return userOptionRepository.findSingleByUser_Card_ExtId(aimeId).orElseThrow();
|
||||
}
|
||||
|
||||
@PostMapping("options")
|
||||
public ResponseEntity<Object> updateOptions(@RequestBody Map<String, Object> request) {
|
||||
UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
UserOption userOption = objectMapper.convertValue(request.get("options"), UserOption.class);
|
||||
Mai2UserOption userOption = objectMapper.convertValue(request.get("options"), Mai2UserOption.class);
|
||||
userOption.setUser(profile);
|
||||
userOptionRepository.deleteByUser(profile);
|
||||
userOptionRepository.flush();
|
||||
|
@ -236,24 +237,26 @@ public class ApiMaimai2PlayerDataController {
|
|||
|
||||
@GetMapping("general")
|
||||
public ResponseEntity<Object> getGeneralData(@RequestParam long aimeId, @RequestParam String key) {
|
||||
Optional<UserGeneralData> userGeneralDataOptional = userGeneralDataRepository.findByUser_Card_ExtIdAndPropertyKey(aimeId, key);
|
||||
Optional<Mai2UserGeneralData> userGeneralDataOptional = userGeneralDataRepository.findByUser_Card_ExtIdAndPropertyKey(aimeId, key);
|
||||
return userGeneralDataOptional.<ResponseEntity<Object>>map(ResponseEntity::ok)
|
||||
.orElseGet(() -> ResponseEntity.status(HttpStatus.NOT_FOUND).body(new MessageResponse("User or value not found.")));
|
||||
}
|
||||
|
||||
@PostMapping("general")
|
||||
public ResponseEntity<Object> setGeneralData(@RequestBody Map<String, Object> request) {
|
||||
UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
||||
String key = (String) request.get("key");
|
||||
String value = (String) request.get("value");
|
||||
|
||||
Optional<UserGeneralData> userGeneralDataOptional = userGeneralDataRepository.findByUserAndPropertyKey(profile, key);
|
||||
UserGeneralData userGeneralData;
|
||||
Optional<Mai2UserGeneralData> userGeneralDataOptional = userGeneralDataRepository.findByUserAndPropertyKey(profile, key);
|
||||
Mai2UserGeneralData userGeneralData;
|
||||
if (userGeneralDataOptional.isPresent()) {
|
||||
userGeneralData = userGeneralDataOptional.get();
|
||||
}
|
||||
else {
|
||||
userGeneralData = new UserGeneralData(profile, key);
|
||||
userGeneralData = new Mai2UserGeneralData();
|
||||
userGeneralData.setUser(profile);
|
||||
userGeneralData.setPropertyKey(key);
|
||||
}
|
||||
userGeneralData.setPropertyValue(value);
|
||||
|
||||
|
@ -307,7 +310,7 @@ public class ApiMaimai2PlayerDataController {
|
|||
Card card;
|
||||
if (cardOptional.isPresent()) {
|
||||
card = cardOptional.get();
|
||||
Optional<UserDetail> existUserData = Optional.ofNullable(userDataRepository.findByCard(cardOptional.get()));
|
||||
Optional<Mai2UserDetail> existUserData = Optional.ofNullable(userDataRepository.findByCard(cardOptional.get()));
|
||||
if (existUserData.isPresent()) {
|
||||
// return ResponseEntity.status(HttpStatus.BAD_REQUEST)
|
||||
// .body(new MessageResponse("This card already has a maimai2 profile."));
|
||||
|
@ -354,7 +357,7 @@ public class ApiMaimai2PlayerDataController {
|
|||
card = cardService.registerByAccessCode(exUser.getAccessCode());
|
||||
}
|
||||
|
||||
UserDetail userData = mapper.convert(exUser, new TypeReference<>() {
|
||||
Mai2UserDetail userData = mapper.convert(exUser, new TypeReference<>() {
|
||||
});
|
||||
userData.setCard(card);
|
||||
userDataRepository.saveAndFlush(userData);
|
||||
|
@ -373,15 +376,15 @@ public class ApiMaimai2PlayerDataController {
|
|||
userChargeRepository.saveAll(data.getUserChargeList().stream().peek(x -> x.setUser(userData)).collect(Collectors.toList()));
|
||||
userCourseRepository.saveAll(data.getUserCourseList().stream().peek(x -> x.setUser(userData)).collect(Collectors.toList()));
|
||||
|
||||
UserExtend userExtend = data.getUserExtend();
|
||||
Mai2UserExtend userExtend = data.getUserExtend();
|
||||
userExtend.setUser(userData);
|
||||
userExtendRepository.save(userExtend);
|
||||
|
||||
UserOption userOption = data.getUserOption();
|
||||
Mai2UserOption userOption = data.getUserOption();
|
||||
userOption.setUser(userData);
|
||||
userOptionRepository.save(userOption);
|
||||
|
||||
UserUdemae userUdemae = data.getUserUdemae();
|
||||
Mai2UserUdemae userUdemae = data.getUserUdemae();
|
||||
userUdemae.setUser(userData);
|
||||
userUdemaeRepository.save(userUdemae);
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -17,21 +15,21 @@ import java.util.List;
|
|||
@NoArgsConstructor
|
||||
public class Maimai2DataExport {
|
||||
public String gameId = "SDEZ";
|
||||
public UserDetail userData;
|
||||
public UserExtend userExtend;
|
||||
public UserOption userOption;
|
||||
public List<MapEncountNpc> mapEncountNpcList;
|
||||
public List<UserAct> userActList;
|
||||
public List<UserCharacter> userCharacterList;
|
||||
public List<UserCharge> userChargeList;
|
||||
public List<UserCourse> userCourseList;
|
||||
public List<UserFavorite> userFavoriteList;
|
||||
public List<UserFriendSeasonRanking> userFriendSeasonRankingList;
|
||||
public List<UserGeneralData> userGeneralDataList;
|
||||
public List<UserItem> userItemList;
|
||||
public List<UserLoginBonus> userLoginBonusList;
|
||||
public List<UserMap> userMapList;
|
||||
public List<UserMusicDetail> userMusicDetailList;
|
||||
public List<UserPlaylog> userPlaylogList;
|
||||
public UserUdemae userUdemae;
|
||||
public Mai2UserDetail userData;
|
||||
public Mai2UserExtend userExtend;
|
||||
public Mai2UserOption userOption;
|
||||
public List<Mai2MapEncountNpc> mapEncountNpcList;
|
||||
public List<Mai2UserAct> userActList;
|
||||
public List<Mai2UserCharacter> userCharacterList;
|
||||
public List<Mai2UserCharge> userChargeList;
|
||||
public List<Mai2UserCourse> userCourseList;
|
||||
public List<Mai2UserFavorite> userFavoriteList;
|
||||
public List<Mai2UserFriendSeasonRanking> userFriendSeasonRankingList;
|
||||
public List<Mai2UserGeneralData> userGeneralDataList;
|
||||
public List<Mai2UserItem> userItemList;
|
||||
public List<Mai2UserLoginBonus> userLoginBonusList;
|
||||
public List<Mai2UserMap> userMapList;
|
||||
public List<Mai2UserMusicDetail> userMusicDetailList;
|
||||
public List<Mai2UserPlaylog> userPlaylogList;
|
||||
public Mai2UserUdemae userUdemae;
|
||||
}
|
||||
|
|
|
@ -16,22 +16,22 @@ import java.util.List;
|
|||
public class Maimai2DataImport {
|
||||
private String gameId;
|
||||
private ExternalUserData userData;
|
||||
private UserExtend userExtend;
|
||||
private UserOption userOption;
|
||||
private List<MapEncountNpc> mapEncountNpcList;
|
||||
private List<UserAct> userActList;
|
||||
private List<UserCharacter> userCharacterList;
|
||||
private List<UserCharge> userChargeList;
|
||||
private List<UserCourse> userCourseList;
|
||||
private List<UserFavorite> userFavoriteList;
|
||||
private List<UserFriendSeasonRanking> userFriendSeasonRankingList;
|
||||
private List<UserGeneralData> userGeneralDataList;
|
||||
private List<UserGhost> userGhostList;
|
||||
private List<UserItem> userItemList;
|
||||
private List<UserLoginBonus> userLoginBonusList;
|
||||
private List<UserMap> userMapList;
|
||||
private List<UserMusicDetail> userMusicDetailList;
|
||||
private List<UserPlaylog> userPlaylogList;
|
||||
private List<UserRate> userRateList;
|
||||
private UserUdemae userUdemae;
|
||||
private Mai2UserExtend userExtend;
|
||||
private Mai2UserOption userOption;
|
||||
private List<Mai2MapEncountNpc> mapEncountNpcList;
|
||||
private List<Mai2UserAct> userActList;
|
||||
private List<Mai2UserCharacter> userCharacterList;
|
||||
private List<Mai2UserCharge> userChargeList;
|
||||
private List<Mai2UserCourse> userCourseList;
|
||||
private List<Mai2UserFavorite> userFavoriteList;
|
||||
private List<Mai2UserFriendSeasonRanking> userFriendSeasonRankingList;
|
||||
private List<Mai2UserGeneralData> userGeneralDataList;
|
||||
private List<Mai2UserGhost> userGhostList;
|
||||
private List<Mai2UserItem> userItemList;
|
||||
private List<Mai2UserLoginBonus> userLoginBonusList;
|
||||
private List<Mai2UserMap> userMapList;
|
||||
private List<Mai2UserMusicDetail> userMusicDetailList;
|
||||
private List<Mai2UserPlaylog> userPlaylogList;
|
||||
private List<Mai2UserRate> userRateList;
|
||||
private Mai2UserUdemae userUdemae;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import kotlin.reflect.KClass
|
|||
data class ImportClass<T : Any>(
|
||||
val type: KClass<T>,
|
||||
val renames: Map<String, String?>? = null,
|
||||
val name: String = type.simpleName!!.lowercase()
|
||||
val name: String = type.simpleName!!.removePrefix("Mai2").lowercase()
|
||||
)
|
||||
|
||||
abstract class ImportController<T: Any>(
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package icu.samnyan.aqua.net.games
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import ext.JavaSerializable
|
||||
import icu.samnyan.aqua.sega.general.model.Card
|
||||
import jakarta.persistence.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
@ -104,15 +105,7 @@ open class BaseEntity(
|
|||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
var id: Long = 0
|
||||
)
|
||||
|
||||
@MappedSuperclass
|
||||
open class UserMappedEntity<T : IGenericUserData> : BaseEntity() {
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
open var user: T? = null
|
||||
}
|
||||
) : JavaSerializable
|
||||
|
||||
@NoRepositoryBean
|
||||
interface GenericUserDataRepo<T : IGenericUserData> : JpaRepository<T, Long> {
|
||||
|
|
|
@ -14,28 +14,28 @@ class Mai2Import : ImportController<Maimai2DataExport>(
|
|||
it.name.replace("List", "").lowercase()
|
||||
},
|
||||
renameTable = mapOf(
|
||||
"mai2_item_character" to ImportClass(UserCharacter::class),
|
||||
"mai2_item_charge" to ImportClass(UserCharge::class),
|
||||
"mai2_item_friend_season_ranking" to ImportClass(UserFriendSeasonRanking::class),
|
||||
"mai2_item_item" to ImportClass(UserItem::class, mapOf("isValid" to "valid")),
|
||||
"mai2_item_login_bonus" to ImportClass(UserLoginBonus::class),
|
||||
"mai2_item_map" to ImportClass(UserMap::class),
|
||||
"mai2_playlog" to ImportClass(UserPlaylog::class, mapOf("userId" to null)),
|
||||
"mai2_profile_activity" to ImportClass(UserAct::class, mapOf("activityId" to "id")),
|
||||
"mai2_profile_detail" to ImportClass(UserDetail::class,
|
||||
"mai2_item_character" to ImportClass(Mai2UserCharacter::class),
|
||||
"mai2_item_charge" to ImportClass(Mai2UserCharge::class),
|
||||
"mai2_item_friend_season_ranking" to ImportClass(Mai2UserFriendSeasonRanking::class),
|
||||
"mai2_item_item" to ImportClass(Mai2UserItem::class, mapOf("isValid" to "valid")),
|
||||
"mai2_item_login_bonus" to ImportClass(Mai2UserLoginBonus::class),
|
||||
"mai2_item_map" to ImportClass(Mai2UserMap::class),
|
||||
"mai2_playlog" to ImportClass(Mai2UserPlaylog::class, mapOf("userId" to null)),
|
||||
"mai2_profile_activity" to ImportClass(Mai2UserAct::class, mapOf("activityId" to "id")),
|
||||
"mai2_profile_detail" to ImportClass(Mai2UserDetail::class,
|
||||
mapOf("user" to null, "version" to null, "isNetMember" to null),
|
||||
name = "userdata"),
|
||||
"mai2_profile_extend" to ImportClass(UserExtend::class, mapOf("version" to null)),
|
||||
"mai2_profile_option" to ImportClass(UserOption::class, mapOf("version" to null)),
|
||||
"mai2_score_best" to ImportClass(UserMusicDetail::class),
|
||||
"mai2_score_course" to ImportClass(UserCourse::class),
|
||||
"mai2_profile_extend" to ImportClass(Mai2UserExtend::class, mapOf("version" to null)),
|
||||
"mai2_profile_option" to ImportClass(Mai2UserOption::class, mapOf("version" to null)),
|
||||
"mai2_score_best" to ImportClass(Mai2UserMusicDetail::class),
|
||||
"mai2_score_course" to ImportClass(Mai2UserCourse::class),
|
||||
// "mai2_profile_ghost" to ImportClass(UserGhost::class),
|
||||
// "mai2_profile_rating" to ImportClass(UserRating::class),
|
||||
// "mai2_profile_region" to ImportClass(UserRegion::class),
|
||||
)
|
||||
) {
|
||||
override fun createEmpty() = Maimai2DataExport("SDEZ", UserDetail(), UserExtend(), UserOption(),
|
||||
override fun createEmpty() = Maimai2DataExport("SDEZ", Mai2UserDetail(), Mai2UserExtend(), Mai2UserOption(),
|
||||
ArrayList(), ArrayList(), ArrayList(), ArrayList(), ArrayList(), ArrayList(),
|
||||
ArrayList(), ArrayList(), ArrayList(), ArrayList(), ArrayList(), ArrayList(),
|
||||
ArrayList(), UserUdemae())
|
||||
ArrayList(), Mai2UserUdemae())
|
||||
}
|
|
@ -7,7 +7,7 @@ import icu.samnyan.aqua.net.db.AquaUserServices
|
|||
import icu.samnyan.aqua.net.games.*
|
||||
import icu.samnyan.aqua.net.utils.*
|
||||
import icu.samnyan.aqua.sega.maimai2.model.*
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserDetail
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserDetail
|
||||
import org.springframework.transaction.PlatformTransactionManager
|
||||
import org.springframework.transaction.support.TransactionTemplate
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
@ -28,7 +28,7 @@ class Maimai2(
|
|||
val repos: Mai2Repos,
|
||||
val netProps: AquaNetProps,
|
||||
transManager: PlatformTransactionManager
|
||||
): GameApiController<UserDetail>("mai2", UserDetail::class) {
|
||||
): GameApiController<Mai2UserDetail>("mai2", Mai2UserDetail::class) {
|
||||
val trans = TransactionTemplate(transManager)
|
||||
|
||||
override suspend fun trend(@RP username: Str): List<TrendOut> = us.cardByName(username) { card ->
|
||||
|
@ -38,7 +38,7 @@ class Maimai2(
|
|||
|
||||
// Only show > S rank
|
||||
override val shownRanks = mai2Scores.filter { it.first >= 97 * 10000 }
|
||||
override val settableFields: Map<String, (UserDetail, String) -> Unit> by lazy { mapOf(
|
||||
override val settableFields: Map<String, (Mai2UserDetail, String) -> Unit> by lazy { mapOf(
|
||||
"userName" to { u, v -> u.userName = v
|
||||
if (!v.all { it in USERNAME_CHARS }) { 400 - "Invalid character in username" }
|
||||
},
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameSellingCardRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.gamedata.GameSellingCard;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameSellingCard;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -34,7 +34,7 @@ public class CMGetSellingCardHandler implements BaseHandler {
|
|||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
|
||||
List<GameSellingCard> sellingCardList = gameSellingCardRepository.findAll();
|
||||
List<Mai2GameSellingCard> sellingCardList = gameSellingCardRepository.findAll();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("length", sellingCardList.size());
|
||||
|
|
|
@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserCharacterRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserCharacter;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCharacter;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -34,7 +34,7 @@ public class CMGetUserCharacterHandler implements BaseHandler {
|
|||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
List<UserCharacter> userCharacterList = userCharacterRepository.findByUser_Card_ExtId(userId);
|
||||
List<Mai2UserCharacter> userCharacterList = userCharacterRepository.findByUser_Card_ExtId(userId);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("returnCode", 1);
|
||||
|
|
|
@ -2,7 +2,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
|||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -38,11 +38,11 @@ public class CMGetUserPreviewHandler implements BaseHandler {
|
|||
Long userId = ((Number) request.get("userId")).longValue();
|
||||
String segaIdAuthKey = String.valueOf(request.get("segaIdAuthKey"));
|
||||
|
||||
Optional<UserDetail> userDataOptional = userDataRepository.findByCardExtId(userId);
|
||||
Optional<Mai2UserDetail> userDataOptional = userDataRepository.findByCardExtId(userId);
|
||||
|
||||
if (userDataOptional.isPresent()) {
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
UserDetail user = userDataOptional.get();
|
||||
Mai2UserDetail user = userDataOptional.get();
|
||||
|
||||
resultMap.put("userName", user.getUserName());
|
||||
resultMap.put("rating", user.getPlayerRating());
|
||||
|
|
|
@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameChargeRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.gamedata.GameCharge;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameCharge;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -33,7 +33,7 @@ public class GetGameChargeHandler implements BaseHandler {
|
|||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
|
||||
List<GameCharge> gameChargeList = gameChargeRepository.findAll();
|
||||
List<Mai2GameCharge> gameChargeList = gameChargeRepository.findAll();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("length", gameChargeList.size());
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameEventRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.gamedata.GameEvent;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameEvent;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -36,7 +36,7 @@ public class GetGameEventHandler implements BaseHandler {
|
|||
int type = ((Number) request.get("type")).intValue();
|
||||
|
||||
// Not sure why maimai2 only do type=1 request
|
||||
List<GameEvent> gameEventList = gameEventRepository.findByTypeAndEnable(0, true);
|
||||
List<Mai2GameEvent> gameEventList = gameEventRepository.findByTypeAndEnable(0, true);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("type", type);
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserActRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserActivity;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserAct;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserAct;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -38,8 +38,8 @@ public class GetUserActivityHandler implements BaseHandler {
|
|||
|
||||
// kind 1 = playList, kind 2 = musicList
|
||||
// maimaiDX require these two
|
||||
List<UserAct> userPlayList = userActRepository.findByUser_Card_ExtIdAndKind(userId, 1);
|
||||
List<UserAct> userMusicList = userActRepository.findByUser_Card_ExtIdAndKind(userId, 2);
|
||||
List<Mai2UserAct> userPlayList = userActRepository.findByUser_Card_ExtIdAndKind(userId, 1);
|
||||
List<Mai2UserAct> userMusicList = userActRepository.findByUser_Card_ExtIdAndKind(userId, 2);
|
||||
|
||||
UserActivity userActivity = new UserActivity();
|
||||
userActivity.setMusicList(userMusicList);
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserCardRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserCard;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCard;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -40,7 +40,7 @@ public class GetUserCardHandler implements BaseHandler {
|
|||
|
||||
int pageNum = nextIndex / maxCount;
|
||||
|
||||
Page<UserCard> dbPage = userCardRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
Page<Mai2UserCard> dbPage = userCardRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
|
||||
int currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserCharacterRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserCharacter;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCharacter;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -34,7 +34,7 @@ public class GetUserCharacterHandler implements BaseHandler {
|
|||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
List<UserCharacter> userCharacterList = userCharacterRepository.findByUser_Card_ExtId(userId);
|
||||
List<Mai2UserCharacter> userCharacterList = userCharacterRepository.findByUser_Card_ExtId(userId);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
|
|
|
@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserChargeRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserCharge;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCharge;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -34,7 +34,7 @@ public class GetUserChargeHandler implements BaseHandler {
|
|||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
List<UserCharge> userChargeList = UserChargeRepository.findByUser_Card_ExtId(userId);
|
||||
List<Mai2UserCharge> userChargeList = UserChargeRepository.findByUser_Card_ExtId(userId);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
|
|
|
@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserCourseRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserCourse;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCourse;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -41,7 +41,7 @@ public class GetUserCourseHandler implements BaseHandler {
|
|||
|
||||
int pageNum = nextIndexVal / maxCount;
|
||||
|
||||
Page<UserCourse> dbPage = userCourseRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
Page<Mai2UserCourse> dbPage = userCourseRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
|
||||
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserDetail;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -33,7 +33,7 @@ public class GetUserDataHandler implements BaseHandler {
|
|||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
UserDetail userData = userDataRepository.findByCardExtId(userId).orElseThrow();
|
||||
Mai2UserDetail userData = userDataRepository.findByCardExtId(userId).orElseThrow();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
|
|
|
@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserExtendRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserExtend;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserExtend;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -33,7 +33,7 @@ public class GetUserExtendHandler implements BaseHandler {
|
|||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
UserExtend userExtend = userExtendRepository.findSingleByUser_Card_ExtId(userId).orElseThrow();
|
||||
Mai2UserExtend userExtend = userExtendRepository.findSingleByUser_Card_ExtId(userId).orElseThrow();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
|
|
|
@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserFavoriteRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserFavorite;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserFavorite;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -35,7 +35,7 @@ public class GetUserFavoriteHandler implements BaseHandler {
|
|||
long userId = ((Number) request.get("userId")).longValue();
|
||||
int itemKind = ((Number) request.get("itemKind")).intValue();
|
||||
|
||||
List<UserFavorite> userFavoriteList = userFavoriteRepository.findByUserIdAndItemKind(userId, itemKind);
|
||||
List<Mai2UserFavorite> userFavoriteList = userFavoriteRepository.findByUserIdAndItemKind(userId, itemKind);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
|
|
|
@ -2,7 +2,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
|||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserFavoriteItem;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserGeneralData;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserGeneralData;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserGeneralDataRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
|
@ -35,7 +35,7 @@ public class GetUserFavoriteItemHandler implements BaseHandler {
|
|||
long userId = ((Number) request.get("userId")).longValue();
|
||||
int kind = ((Number) request.get("kind")).intValue();
|
||||
|
||||
Optional<UserGeneralData> favOptional;
|
||||
Optional<Mai2UserGeneralData> favOptional;
|
||||
List<UserFavoriteItem> items = new LinkedList<>();
|
||||
switch (kind) {
|
||||
case 1:
|
||||
|
@ -50,7 +50,7 @@ public class GetUserFavoriteItemHandler implements BaseHandler {
|
|||
break;
|
||||
}
|
||||
if (favOptional.isPresent()) {
|
||||
String val = ((UserGeneralData) favOptional.get()).getPropertyValue();
|
||||
String val = ((Mai2UserGeneralData) favOptional.get()).getPropertyValue();
|
||||
if (StringUtils.isNotBlank(val)) {
|
||||
String[] records = val.split(",");
|
||||
int order = 0;
|
||||
|
|
|
@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserFriendSeasonRankingRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserFriendSeasonRanking;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserFriendSeasonRanking;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -39,7 +39,7 @@ public class GetUserFriendSeasonRankingHandler implements BaseHandler {
|
|||
|
||||
int pageNum = nextIndexVal / maxCount;
|
||||
|
||||
Page<UserFriendSeasonRanking> dbPage = userFriendSeasonRankingRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
Page<Mai2UserFriendSeasonRanking> dbPage = userFriendSeasonRankingRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
|
||||
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler
|
||||
|
||||
import icu.samnyan.aqua.net.games.mai2.Maimai2
|
||||
import icu.samnyan.aqua.sega.general.dao.CardRepository
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.general.dao.CardRepository
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserItem.Mai2ItemKind
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2ItemKind
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.data.domain.PageRequest
|
||||
|
|
|
@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserLoginBonusRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserLoginBonus;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserLoginBonus;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -39,7 +39,7 @@ public class GetUserLoginBonusHandler implements BaseHandler {
|
|||
|
||||
int pageNum = nextIndexVal / maxCount;
|
||||
|
||||
Page<UserLoginBonus> dbPage = userLoginBonusRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
Page<Mai2UserLoginBonus> dbPage = userLoginBonusRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
|
||||
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserMapRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserMap;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserMap;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -39,7 +39,7 @@ public class GetUserMapHandler implements BaseHandler {
|
|||
|
||||
int pageNum = nextIndexVal / maxCount;
|
||||
|
||||
Page<UserMap> dbPage = userMapRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
Page<Mai2UserMap> dbPage = userMapRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
|
||||
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserMusicDetailRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserMusic;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserMusicDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserMusicDetail;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -42,7 +42,7 @@ public class GetUserMusicHandler implements BaseHandler {
|
|||
|
||||
int pageNum = nextIndexVal / maxCount;
|
||||
|
||||
Page<UserMusicDetail> dbPage = userMusicDetailRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
Page<Mai2UserMusicDetail> dbPage = userMusicDetailRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
|
||||
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserOptionRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserOption;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserOption;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -33,7 +33,7 @@ public class GetUserOptionHandler implements BaseHandler {
|
|||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
UserOption userOption = userOptionRepository.findSingleByUser_Card_ExtId(userId).orElseThrow();
|
||||
Mai2UserOption userOption = userOptionRepository.findSingleByUser_Card_ExtId(userId).orElseThrow();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
|
|
|
@ -5,8 +5,8 @@ import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo;
|
|||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserOptionRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.GetUserPreviewResp;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserOption;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserOption;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -39,14 +39,14 @@ public class GetUserPreviewHandler implements BaseHandler {
|
|||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
Optional<UserDetail> userDataOptional = userDataRepository.findByCardExtId(userId);
|
||||
Optional<Mai2UserDetail> userDataOptional = userDataRepository.findByCardExtId(userId);
|
||||
|
||||
GetUserPreviewResp resp = new GetUserPreviewResp();
|
||||
resp.setUserId(userId);
|
||||
String json;
|
||||
if (userDataOptional.isPresent() && userDataOptional.get().getUserName() != null) {
|
||||
UserDetail user = userDataOptional.get();
|
||||
Optional<UserOption> userOptionOptional = userOptionRepository.findSingleByUser_Card_ExtId(userId);
|
||||
Mai2UserDetail user = userDataOptional.get();
|
||||
Optional<Mai2UserOption> userOptionOptional = userOptionRepository.findSingleByUser_Card_ExtId(userId);
|
||||
resp.setUserName(user.getUserName());
|
||||
resp.setLogin(false);
|
||||
resp.setLastGameId(user.getLastGameId());
|
||||
|
@ -64,7 +64,7 @@ public class GetUserPreviewHandler implements BaseHandler {
|
|||
resp.setIsNetMember(user.isNetMember());
|
||||
resp.setDailyBonusDate(user.getDailyBonusDate());
|
||||
if (userOptionOptional.isPresent()) {
|
||||
UserOption option = userOptionOptional.get();
|
||||
Mai2UserOption option = userOptionOptional.get();
|
||||
resp.setHeadPhoneVolume(option.getHeadPhoneVolume());
|
||||
resp.setDispRate(option.getDispRate());
|
||||
}
|
||||
|
|
|
@ -1,129 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserGeneralDataRepo;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserUdemaeRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRating;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserGeneralData;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserRate;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserUdemae;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserRatingHandler")
|
||||
public class GetUserRatingHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserRatingHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
private final Mai2UserGeneralDataRepo userGeneralDataRepository;
|
||||
private final Mai2UserUdemaeRepo userUdemaeRepository;
|
||||
private final Mai2UserDataRepo userDataRepository;
|
||||
|
||||
public GetUserRatingHandler(BasicMapper mapper, Mai2UserUdemaeRepo userUdemaeRepository, Mai2UserGeneralDataRepo userGeneralDataRepository,
|
||||
Mai2UserDataRepo userDataRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userGeneralDataRepository = userGeneralDataRepository;
|
||||
this.userUdemaeRepository = userUdemaeRepository;
|
||||
this.userDataRepository = userDataRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
Optional<UserGeneralData> recentOptional = userGeneralDataRepository.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating");
|
||||
Optional<UserGeneralData> recentNewOptional = userGeneralDataRepository.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_new");
|
||||
Optional<UserGeneralData> recentNextOptional = userGeneralDataRepository.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_next");
|
||||
Optional<UserGeneralData> recentNextNewOptional = userGeneralDataRepository.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_next_new");
|
||||
List<UserRate> emptyRating = new ArrayList<>();
|
||||
|
||||
UserRating userRating = new UserRating();
|
||||
|
||||
Optional<UserDetail> userDataOptional = userDataRepository.findByCardExtId(userId);
|
||||
if (userDataOptional.isPresent() && userDataOptional.get().getUserName() != null) {
|
||||
UserDetail user = userDataOptional.get();
|
||||
userRating.setRating(user.getPlayerRating());
|
||||
}
|
||||
|
||||
// Old charts (standard) = 25
|
||||
if (recentOptional.isPresent()) {
|
||||
String val = recentOptional.get().getPropertyValue();
|
||||
userRating.setRatingList(loadRateData(val));
|
||||
} else {
|
||||
userRating.setRatingList(emptyRating);
|
||||
}
|
||||
|
||||
// New charts (DX) = 15
|
||||
if (recentNewOptional.isPresent()) {
|
||||
String val = recentNewOptional.get().getPropertyValue();
|
||||
userRating.setNewRatingList(loadRateData(val));
|
||||
} else {
|
||||
userRating.setNewRatingList(emptyRating);
|
||||
}
|
||||
|
||||
// ??
|
||||
if (recentNextOptional.isPresent()) {
|
||||
String val = recentNextOptional.get().getPropertyValue();
|
||||
userRating.setNextRatingList(loadRateData(val));
|
||||
} else {
|
||||
userRating.setNextRatingList(emptyRating);
|
||||
}
|
||||
|
||||
if (recentNextNewOptional.isPresent()) {
|
||||
String val = recentNextNewOptional.get().getPropertyValue();
|
||||
userRating.setNextNewRatingList(loadRateData(val));
|
||||
} else {
|
||||
userRating.setNextNewRatingList(emptyRating);
|
||||
}
|
||||
|
||||
Optional<UserUdemae> optionalUserUdemae = userUdemaeRepository.findSingleByUser_Card_ExtId(userId);
|
||||
if (optionalUserUdemae.isPresent()) {
|
||||
UserUdemae userUdemae = optionalUserUdemae.get();
|
||||
userRating.setUdemae(userUdemae);
|
||||
} else {
|
||||
userRating.setUdemae(new UserUdemae());
|
||||
}
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("userRating", userRating);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
|
||||
private List<UserRate> loadRateData(String val) {
|
||||
List<UserRate> rateList = new LinkedList<>();
|
||||
|
||||
if(StringUtils.isNotBlank(val) && val.contains(",")) {
|
||||
String[] records = val.split(",");
|
||||
for (String record :
|
||||
records) {
|
||||
String[] value = record.split(":");
|
||||
rateList.add(new UserRate(
|
||||
Integer.parseInt(value[0]),
|
||||
Integer.parseInt(value[1]),
|
||||
Integer.parseInt(value[2]),
|
||||
Integer.parseInt(value[3])
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return rateList;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException
|
||||
import ext.invoke
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRating
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserRate
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserUdemae
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserRatingHandler")
|
||||
class GetUserRatingHandler(
|
||||
val mapper: BasicMapper,
|
||||
val repos: Mai2Repos
|
||||
) : BaseHandler {
|
||||
@Throws(JsonProcessingException::class)
|
||||
override fun handle(request: Map<String, Any>): String {
|
||||
val userId = (request["userId"] as Number?)!!.toLong()
|
||||
val empty: List<Mai2UserRate> = ArrayList()
|
||||
|
||||
val ur = UserRating()
|
||||
|
||||
repos.userData.findByCardExtId(userId)()?.let {
|
||||
ur.rating = it.playerRating
|
||||
}
|
||||
|
||||
// Old charts (standard) = 25
|
||||
ur.ratingList = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating")()
|
||||
?.let { loadRateData(it.propertyValue) } ?: empty
|
||||
|
||||
// New charts (DX) = 15
|
||||
ur.newRatingList = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_new")()
|
||||
?.let { loadRateData(it.propertyValue) } ?: empty
|
||||
|
||||
ur.nextRatingList = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_next")()
|
||||
?.let { loadRateData(it.propertyValue) } ?: empty
|
||||
|
||||
ur.nextNewRatingList = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_next_new")()
|
||||
?.let { loadRateData(it.propertyValue) } ?: empty
|
||||
|
||||
ur.udemae = repos.userUdemae.findSingleByUser_Card_ExtId(userId)() ?: Mai2UserUdemae()
|
||||
|
||||
val resultMap: MutableMap<String, Any> = LinkedHashMap()
|
||||
resultMap["userId"] = userId
|
||||
resultMap["userRating"] = ur
|
||||
|
||||
val json = mapper.write(resultMap)
|
||||
logger.info("Response: $json")
|
||||
return json
|
||||
}
|
||||
|
||||
fun loadRateData(value: String) = value.split(",").map {
|
||||
val (musicId, level, beforeRating, afterRating) = it.split(":")
|
||||
Mai2UserRate(musicId.toInt(), level.toInt(), beforeRating.toInt(), afterRating.toInt())
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val logger: Logger = LoggerFactory.getLogger(GetUserRatingHandler::class.java)
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRivalData;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserDetail;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
|
||||
@Component("Maimai2GetUserRivalDataHandler")
|
||||
|
@ -35,7 +35,7 @@ public class GetUserRivalDataHandler implements BaseHandler {
|
|||
long userId = ((Number) request.get("userId")).longValue();
|
||||
long rivalId = ((Number) request.get("rivalId")).intValue();
|
||||
|
||||
Optional<UserDetail> detailOptional = userDataRepository.findByCardExtId(rivalId);
|
||||
Optional<Mai2UserDetail> detailOptional = userDataRepository.findByCardExtId(rivalId);
|
||||
UserRivalData rivalData;
|
||||
if (detailOptional.isPresent()) {
|
||||
rivalData = new UserRivalData(rivalId, detailOptional.get().getUserName());
|
||||
|
|
|
@ -17,7 +17,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserMusicDetailRepo;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRivalMusic;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRivalMusicDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserMusicDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserMusicDetail;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
|
||||
@Component("Maimai2GetUserRivalMusicHandler")
|
||||
|
@ -38,10 +38,10 @@ public class GetUserRivalMusicHandler implements BaseHandler {
|
|||
long userId = ((Number) request.get("userId")).longValue();
|
||||
long rivalId = ((Number) request.get("rivalId")).intValue();
|
||||
|
||||
List<UserMusicDetail> details = userMusicDetailRepository.findByUser_Card_ExtId(rivalId);
|
||||
List<Mai2UserMusicDetail> details = userMusicDetailRepository.findByUser_Card_ExtId(rivalId);
|
||||
List<UserRivalMusic> userRivalMusicList = new LinkedList<UserRivalMusic>();
|
||||
Map<Integer, UserRivalMusic> userRivalMusicMap = new HashMap<Integer, UserRivalMusic>();
|
||||
for (UserMusicDetail detail : details) {
|
||||
for (Mai2UserMusicDetail detail : details) {
|
||||
int musicId = detail.getMusicId();
|
||||
UserRivalMusic info = userRivalMusicMap.getOrDefault(musicId, null);
|
||||
if (info == null) {
|
||||
|
|
|
@ -5,7 +5,7 @@ import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo
|
|||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserPlaylogRepo
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.maimai2.model.request.UploadUserPlaylog
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserPlaylog
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserPlaylog
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper
|
||||
import org.springframework.scheduling.annotation.Scheduled
|
||||
import org.springframework.stereotype.Component
|
||||
|
@ -20,7 +20,7 @@ class UploadUserPlaylogHandler(
|
|||
private val playlogRepo: Mai2UserPlaylogRepo,
|
||||
private val mapper: BasicMapper
|
||||
) : BaseHandler {
|
||||
data class BacklogEntry(val time: Long, val playlog: UserPlaylog)
|
||||
data class BacklogEntry(val time: Long, val playlog: Mai2UserPlaylog)
|
||||
companion object {
|
||||
@JvmStatic
|
||||
val playBacklog = mutableMapOf<Long, MutableList<BacklogEntry>>()
|
||||
|
|
|
@ -1,346 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.model.Card;
|
||||
import icu.samnyan.aqua.sega.general.service.CardService;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.*;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.request.UpsertUserAll;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.request.data.UserAll;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserActivity;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRating;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.*;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Component("Maimai2UpsertUserAllHandler")
|
||||
public class UpsertUserAllHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(UpsertUserAllHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final CardService cardService;
|
||||
|
||||
private final Mai2UserDataRepo userDataRepository;
|
||||
private final Mai2UserExtendRepo userExtendRepository;
|
||||
private final Mai2UserOptionRepo userOptionRepository;
|
||||
private final Mai2UserItemRepo userItemRepository;
|
||||
private final Mai2UserMusicDetailRepo userMusicDetailRepository;
|
||||
private final Mai2UserActRepo userActRepository;
|
||||
private final Mai2UserCharacterRepo userCharacterRepository;
|
||||
private final Mai2UserMapRepo userMapRepository;
|
||||
private final Mai2UserLoginBonusRepo userLoginBonusRepository;
|
||||
private final Mai2UserFavoriteRepo userFavoriteRepository;
|
||||
private final Mai2UserUdemaeRepo userUdemaeRepository;
|
||||
private final Mai2UserGeneralDataRepo userGeneralDataRepository;
|
||||
private final Mai2UserCourseRepo userCourseRepository;
|
||||
private final Mai2UserFriendSeasonRankingRepo userFriendSeasonRankingRepository;
|
||||
private final Mai2UserPlaylogRepo userPlaylogRepository;
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
|
||||
UpsertUserAll upsertUserAll = mapper.convert(request, UpsertUserAll.class);
|
||||
long userId = upsertUserAll.getUserId();
|
||||
UserAll userAll = upsertUserAll.getUpsertUserAll();
|
||||
|
||||
// If user is guest, just return OK response.
|
||||
if ((userId & 281474976710657L) == 281474976710657L) {
|
||||
return "{\"returnCode\":1,\"apiName\":\"com.sega.maimai2servlet.api.UpsertUserAllApi\"}";
|
||||
}
|
||||
|
||||
// UserData
|
||||
UserDetail userData;
|
||||
UserDetail newUserData;
|
||||
if (userAll.getUserData() == null) {
|
||||
return null;
|
||||
} else {
|
||||
newUserData = userAll.getUserData().get(0);
|
||||
Optional<UserDetail> userOptional = userDataRepository.findByCardExtId(userId);
|
||||
|
||||
if (userOptional.isPresent()) {
|
||||
userData = userOptional.get();
|
||||
} else {
|
||||
userData = new UserDetail();
|
||||
Card card = cardService.getCardByExtId(userId).orElseThrow();
|
||||
userData.setCard(card);
|
||||
}
|
||||
|
||||
newUserData.setId(userData.getId());
|
||||
newUserData.setCard(userData.getCard());
|
||||
// Decode Username
|
||||
String userName = new String(newUserData.getUserName());
|
||||
|
||||
newUserData.setUserName(userName);
|
||||
|
||||
// Set isNetMember value to 1, which enables some in-game features.
|
||||
newUserData.setNetMember(1);
|
||||
userDataRepository.saveAndFlush(newUserData);
|
||||
|
||||
// Check playlog backlog
|
||||
var backlog = UploadUserPlaylogHandler.getPlayBacklog();
|
||||
if (backlog.containsKey(userId))
|
||||
backlog.remove(userId).forEach(it -> {
|
||||
it.getPlaylog().setUser(newUserData);
|
||||
userPlaylogRepository.save(it.getPlaylog());
|
||||
});
|
||||
}
|
||||
|
||||
// UserExtend
|
||||
if (userAll.getUserExtend() != null) {
|
||||
UserExtend newUserExtend = userAll.getUserExtend().get(0);
|
||||
|
||||
Optional<UserExtend> userExtendOptional = userExtendRepository.findSingleByUser(newUserData);
|
||||
UserExtend userExtend = userExtendOptional.orElseGet(() -> new UserExtend(newUserData));
|
||||
|
||||
newUserExtend.setId(userExtend.getId());
|
||||
newUserExtend.setUser(userExtend.getUser());
|
||||
|
||||
userExtendRepository.save(newUserExtend);
|
||||
}
|
||||
|
||||
// UserOption
|
||||
if (userAll.getUserOption() != null) {
|
||||
UserOption newUserOption = userAll.getUserOption().get(0);
|
||||
|
||||
Optional<UserOption> userOptionOptional = userOptionRepository.findSingleByUser(newUserData);
|
||||
UserOption userOption = userOptionOptional.orElseGet(() -> new UserOption(newUserData));
|
||||
|
||||
newUserOption.setId(userOption.getId());
|
||||
newUserOption.setUser(userOption.getUser());
|
||||
|
||||
userOptionRepository.save(newUserOption);
|
||||
}
|
||||
|
||||
// UserCharacterList
|
||||
if (userAll.getUserCharacterList() != null) {
|
||||
List<UserCharacter> userCharacterList = userAll.getUserCharacterList();
|
||||
List<UserCharacter> newUserCharacterList = new ArrayList<>();
|
||||
for (UserCharacter newUserCharacter : userCharacterList) {
|
||||
int id = newUserCharacter.getCharacterId();
|
||||
|
||||
Optional<UserCharacter> characterOptional = userCharacterRepository.findByUserAndCharacterId(newUserData, id);
|
||||
UserCharacter userCharacter = characterOptional.orElseGet(() -> new UserCharacter(newUserData));
|
||||
|
||||
newUserCharacter.setId(userCharacter.getId());
|
||||
newUserCharacter.setUser(newUserData);
|
||||
newUserCharacterList.add(newUserCharacter);
|
||||
}
|
||||
userCharacterRepository.saveAll(newUserCharacterList);
|
||||
}
|
||||
|
||||
// UserGhost : worthless
|
||||
|
||||
// UserMapList
|
||||
if (userAll.getUserMapList() != null) {
|
||||
List<UserMap> userMapList = userAll.getUserMapList();
|
||||
List<UserMap> newUserMapList = new ArrayList<>();
|
||||
for (UserMap newUserMap : userMapList) {
|
||||
int mapId = newUserMap.getMapId();
|
||||
|
||||
Optional<UserMap> mapOptional = userMapRepository.findByUserAndMapId(newUserData, mapId);
|
||||
UserMap userMap = mapOptional.orElseGet(() -> new UserMap(newUserData));
|
||||
|
||||
newUserMap.setId(userMap.getId());
|
||||
newUserMap.setUser(newUserData);
|
||||
newUserMapList.add(newUserMap);
|
||||
}
|
||||
userMapRepository.saveAll(newUserMapList);
|
||||
}
|
||||
|
||||
// UserLoginBonusList
|
||||
if (userAll.getUserLoginBonusList() != null) {
|
||||
List<UserLoginBonus> userLoginBonusList = userAll.getUserLoginBonusList();
|
||||
List<UserLoginBonus> newUserLoginBonusList = new ArrayList<>();
|
||||
for (UserLoginBonus newUserLoginBonus : userLoginBonusList) {
|
||||
int bonusId = newUserLoginBonus.getBonusId();
|
||||
|
||||
Optional<UserLoginBonus> loginBonusOptional = userLoginBonusRepository.findByUserAndBonusId(newUserData, bonusId);
|
||||
UserLoginBonus userLoginBonus = loginBonusOptional.orElseGet(() -> new UserLoginBonus(newUserData));
|
||||
|
||||
newUserLoginBonus.setId(userLoginBonus.getId());
|
||||
newUserLoginBonus.setUser(newUserData);
|
||||
newUserLoginBonusList.add(newUserLoginBonus);
|
||||
}
|
||||
userLoginBonusRepository.saveAll(newUserLoginBonusList);
|
||||
}
|
||||
|
||||
// UserRatingList
|
||||
if (userAll.getUserRatingList() != null) {
|
||||
UserRating userRating = userAll.getUserRatingList().get(0);
|
||||
|
||||
//Udemae
|
||||
UserUdemae newUserUdemae = userRating.getUdemae();
|
||||
|
||||
Optional<UserUdemae> udemaeOptional = userUdemaeRepository.findSingleByUser(newUserData);
|
||||
UserUdemae userUdemae = udemaeOptional.orElseGet(() -> new UserUdemae(newUserData));
|
||||
|
||||
newUserUdemae.setId(userUdemae.getId());
|
||||
newUserUdemae.setUser(newUserData);
|
||||
|
||||
userUdemaeRepository.saveAndFlush(newUserUdemae);
|
||||
|
||||
/* UserRate:
|
||||
Let's save recent user rating as same as ongeki implementation.
|
||||
Previously saved rating will not compatible with this and will be lost, sorry.
|
||||
*/
|
||||
|
||||
this.saveGeneralData(userRating.getRatingList(), newUserData, "recent_rating");
|
||||
this.saveGeneralData(userRating.getNewRatingList(), newUserData, "recent_rating_new");
|
||||
this.saveGeneralData(userRating.getNextRatingList(), newUserData, "recent_rating_next");
|
||||
this.saveGeneralData(userRating.getNextNewRatingList(), newUserData, "recent_rating_next_new");
|
||||
}
|
||||
|
||||
// UserItemList
|
||||
if (userAll.getUserItemList() != null) {
|
||||
List<UserItem> userItemList = userAll.getUserItemList();
|
||||
List<UserItem> newUserItemList = new ArrayList<>();
|
||||
|
||||
for (UserItem newUserItem : userItemList) {
|
||||
int itemId = newUserItem.getItemId();
|
||||
int itemKind = newUserItem.getItemKind();
|
||||
|
||||
Optional<UserItem> itemOptional = userItemRepository.findByUserAndItemKindAndItemId(newUserData, itemKind, itemId);
|
||||
UserItem userItem = itemOptional.orElseGet(() -> new UserItem(newUserData));
|
||||
|
||||
newUserItem.setId(userItem.getId());
|
||||
newUserItem.setUser(newUserData);
|
||||
newUserItemList.add(newUserItem);
|
||||
|
||||
}
|
||||
userItemRepository.saveAll(newUserItemList);
|
||||
}
|
||||
|
||||
// UserMusicDetailList
|
||||
if (userAll.getUserMusicDetailList() != null) {
|
||||
List<UserMusicDetail> userMusicDetailList = userAll.getUserMusicDetailList();
|
||||
List<UserMusicDetail> newUserMusicDetailList = new ArrayList<>();
|
||||
|
||||
for (UserMusicDetail newUserMusicDetail : userMusicDetailList) {
|
||||
int musicId = newUserMusicDetail.getMusicId();
|
||||
int level = newUserMusicDetail.getLevel();
|
||||
|
||||
Optional<UserMusicDetail> musicDetailOptional = userMusicDetailRepository.findByUserAndMusicIdAndLevel(newUserData, musicId, level);
|
||||
UserMusicDetail userMusicDetail = musicDetailOptional.orElseGet(() -> new UserMusicDetail(newUserData));
|
||||
|
||||
newUserMusicDetail.setId(userMusicDetail.getId());
|
||||
newUserMusicDetail.setUser(newUserData);
|
||||
newUserMusicDetailList.add(newUserMusicDetail);
|
||||
}
|
||||
userMusicDetailRepository.saveAll(newUserMusicDetailList);
|
||||
}
|
||||
|
||||
// UserCourseList
|
||||
if (userAll.getUserCourseList() != null) {
|
||||
List<UserCourse> userCourseList = userAll.getUserCourseList();
|
||||
List<UserCourse> newUserCourseList = new ArrayList<>();
|
||||
|
||||
for (UserCourse newUserCourse : userCourseList) {
|
||||
int courseId = newUserCourse.getCourseId();
|
||||
|
||||
Optional<UserCourse> userCourseOptional = userCourseRepository.findByUserAndCourseId(newUserData, courseId);
|
||||
UserCourse userCourse = userCourseOptional.orElseGet(() -> new UserCourse(newUserData));
|
||||
|
||||
newUserCourse.setId(userCourse.getId());
|
||||
newUserCourse.setUser(newUserData);
|
||||
newUserCourseList.add(newUserCourse);
|
||||
}
|
||||
userCourseRepository.saveAll(newUserCourseList);
|
||||
}
|
||||
|
||||
// UserFriendSeasonRankingList
|
||||
if (userAll.getUserFriendSeasonRankingList() != null) {
|
||||
List<UserFriendSeasonRanking> userFriendSeasonRankingList = userAll.getUserFriendSeasonRankingList();
|
||||
List<UserFriendSeasonRanking> newUserFriendSeasonRankingList = new ArrayList<>();
|
||||
|
||||
for (UserFriendSeasonRanking newUserFriendSeasonRanking : userFriendSeasonRankingList) {
|
||||
int seasonId = newUserFriendSeasonRanking.getSeasonId();
|
||||
|
||||
Optional<UserFriendSeasonRanking> userFriendSeasonRankingOptional = userFriendSeasonRankingRepository.findByUserAndSeasonId(newUserData, seasonId);
|
||||
UserFriendSeasonRanking userFriendSeasonRanking = userFriendSeasonRankingOptional.orElseGet(() -> new UserFriendSeasonRanking(newUserData));
|
||||
|
||||
newUserFriendSeasonRanking.setId(userFriendSeasonRanking.getId());
|
||||
newUserFriendSeasonRanking.setUser(newUserData);
|
||||
newUserFriendSeasonRankingList.add(newUserFriendSeasonRanking);
|
||||
}
|
||||
userFriendSeasonRankingRepository.saveAll(newUserFriendSeasonRankingList);
|
||||
}
|
||||
|
||||
// UserFavoriteList
|
||||
if (userAll.getUserFavoriteList() != null) {
|
||||
List<UserFavorite> userFavoriteList = userAll.getUserFavoriteList();
|
||||
List<UserFavorite> newUserFavoriteList = new ArrayList<>();
|
||||
for (UserFavorite newUserFavorite : userFavoriteList) {
|
||||
int itemKind = newUserFavorite.getItemKind();
|
||||
|
||||
Optional<UserFavorite> favoriteOptional = userFavoriteRepository.findByUserAndItemKind(newUserData, itemKind);
|
||||
UserFavorite userFavorite = favoriteOptional.orElseGet(() -> new UserFavorite());
|
||||
|
||||
newUserFavorite.setId(userFavorite.getId());
|
||||
newUserFavorite.setUser(newUserData);
|
||||
newUserFavoriteList.add(newUserFavorite);
|
||||
}
|
||||
userFavoriteRepository.saveAll(newUserFavoriteList);
|
||||
}
|
||||
|
||||
// UserActivityList
|
||||
if (userAll.getUserActivityList() != null) {
|
||||
UserActivity userActivity = userAll.getUserActivityList().get(0);
|
||||
List<UserAct> newUserActList = new ArrayList<>();
|
||||
|
||||
List<List<UserAct>> activityList = new ArrayList<>();
|
||||
activityList.add(userActivity.getMusicList());
|
||||
activityList.add(userActivity.getPlayList());
|
||||
|
||||
for (List<UserAct> actList : activityList) {
|
||||
for (UserAct newUserAct : actList) {
|
||||
int kind = newUserAct.getKind();
|
||||
int id = newUserAct.getActivityId();
|
||||
|
||||
if (kind != 0 && id != 0) {
|
||||
Optional<UserAct> activityOptional = userActRepository.findByUserAndKindAndActivityId(newUserData, kind, id);
|
||||
UserAct userAct = activityOptional.orElseGet(() -> new UserAct(newUserData));
|
||||
|
||||
newUserAct.setId(userAct.getId());
|
||||
newUserAct.setUser(newUserData);
|
||||
newUserActList.add(newUserAct);
|
||||
}
|
||||
}
|
||||
}
|
||||
newUserActList.sort((a, b) -> Long.compare(b.getSortNumber(), a.getSortNumber()));
|
||||
userActRepository.saveAll(newUserActList);
|
||||
}
|
||||
|
||||
return "{\"returnCode\":1,\"apiName\":\"com.sega.maimai2servlet.api.UpsertUserAllApi\"}";
|
||||
}
|
||||
|
||||
private void saveGeneralData(List<UserRate> itemList, UserDetail newUserData, String key) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// Convert to a string
|
||||
for (UserRate item :
|
||||
itemList) {
|
||||
sb.append(item.getMusicId()).append(":").append(item.getLevel()).append(":").append(item.getRomVersion()).append(":").append(item.getAchievement());
|
||||
sb.append(",");
|
||||
}
|
||||
if (!sb.isEmpty()) {
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
}
|
||||
Optional<UserGeneralData> uOptional = userGeneralDataRepository.findByUserAndPropertyKey(newUserData, key);
|
||||
UserGeneralData userGeneralData = uOptional.orElseGet(() -> new UserGeneralData(newUserData, key));
|
||||
userGeneralData.setPropertyValue(sb.toString());
|
||||
userGeneralDataRepository.save(userGeneralData);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException
|
||||
import ext.invoke
|
||||
import ext.mapApply
|
||||
import ext.minus
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.general.service.CardService
|
||||
import icu.samnyan.aqua.sega.maimai2.handler.UploadUserPlaylogHandler.Companion.playBacklog
|
||||
import icu.samnyan.aqua.sega.maimai2.model.*
|
||||
import icu.samnyan.aqua.sega.maimai2.model.request.UpsertUserAll
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.*
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper
|
||||
import lombok.AllArgsConstructor
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Component("Maimai2UpsertUserAllHandler")
|
||||
class UpsertUserAllHandler(
|
||||
val mapper: BasicMapper,
|
||||
val cardService: CardService,
|
||||
val repos: Mai2Repos
|
||||
) : BaseHandler {
|
||||
val SUCCESS = """{"returnCode":1,"apiName":"com.sega.maimai2servlet.api.UpsertUserAllApi"}"""
|
||||
|
||||
@Throws(JsonProcessingException::class)
|
||||
override fun handle(request: Map<String, Any>): Any? {
|
||||
val upsertUserAll = mapper.convert(request, UpsertUserAll::class.java)
|
||||
val userId = upsertUserAll.userId
|
||||
val req = upsertUserAll.upsertUserAll
|
||||
|
||||
// If user is guest, just return OK response.
|
||||
if ((userId and 281474976710657L) == 281474976710657L) return SUCCESS
|
||||
|
||||
// UserData
|
||||
if (req.userData == null) 400 - "Invalid Request"
|
||||
|
||||
val userData = repos.userData.findByCardExtId(userId)()
|
||||
val u = repos.userData.saveAndFlush(req.userData[0].apply {
|
||||
id = userData?.id ?: 0
|
||||
card = userData?.card ?: cardService.getCardByExtId(userId).orElseThrow()
|
||||
isNetMember = 1
|
||||
})
|
||||
|
||||
// Check playlog backlog
|
||||
if (playBacklog.containsKey(userId)) playBacklog.remove(userId)?.forEach {
|
||||
repos.userPlaylog.save(it.playlog.apply { user = u })
|
||||
}
|
||||
|
||||
// Set users
|
||||
req.run { listOf(userExtend, userOption, userCharacterList, userMapList, userLoginBonusList, userItemList,
|
||||
userMusicDetailList, userCourseList, userFriendSeasonRankingList, userFavoriteList) }
|
||||
.forEach { it?.forEach { it?.user = u } }
|
||||
|
||||
req.userExtend?.getOrNull(0)?.let {
|
||||
repos.userExtend.save(it.apply { id = repos.userExtend.findSingleByUser(u)()?.id ?: 0 })
|
||||
}
|
||||
|
||||
req.userOption?.getOrNull(0)?.let {
|
||||
repos.userOption.save(it.apply { id = repos.userOption.findSingleByUser(u)()?.id ?: 0 })
|
||||
}
|
||||
|
||||
req.userCharacterList?.let { news ->
|
||||
repos.userCharacter.saveAll(news.mapApply {
|
||||
id = repos.userCharacter.findByUserAndCharacterId(u, characterId)()?.id ?: 0 }) }
|
||||
|
||||
req.userMapList?.let { news ->
|
||||
repos.userMap.saveAll(news.mapApply {
|
||||
id = repos.userMap.findByUserAndMapId(u, mapId)()?.id ?: 0 }) }
|
||||
|
||||
req.userLoginBonusList?.let { news ->
|
||||
repos.userLoginBonus.saveAll(news.mapApply {
|
||||
id = repos.userLoginBonus.findByUserAndBonusId(u, bonusId)()?.id ?: 0 }) }
|
||||
|
||||
req.userRatingList?.getOrNull(0)?.let { r ->
|
||||
repos.userUdemae.saveAndFlush(r.udemae.apply {
|
||||
id = repos.userUdemae.findSingleByUser(u)()?.id ?: 0
|
||||
user = u
|
||||
})
|
||||
|
||||
saveRating(r.ratingList, u, "recent_rating")
|
||||
saveRating(r.newRatingList, u, "recent_rating_new")
|
||||
saveRating(r.nextRatingList, u, "recent_rating_next")
|
||||
saveRating(r.nextNewRatingList, u, "recent_rating_next_new")
|
||||
}
|
||||
|
||||
req.userItemList?.let { news ->
|
||||
repos.userItem.saveAll(news.mapApply {
|
||||
id = repos.userItem.findByUserAndItemKindAndItemId(u, itemKind, itemId)()?.id ?: 0 }) }
|
||||
|
||||
req.userMusicDetailList?.let { news ->
|
||||
repos.userMusicDetail.saveAll(news.mapApply {
|
||||
id = repos.userMusicDetail.findByUserAndMusicIdAndLevel(u, musicId, level)()?.id ?: 0 }) }
|
||||
|
||||
req.userCourseList?.let { news ->
|
||||
repos.userCourse.saveAll(news.mapApply {
|
||||
id = repos.userCourse.findByUserAndCourseId(u, courseId)()?.id ?: 0 }) }
|
||||
|
||||
req.userFriendSeasonRankingList?.let { news ->
|
||||
repos.userFriendSeasonRanking.saveAll(news.mapApply {
|
||||
id = repos.userFriendSeasonRanking.findByUserAndSeasonId(u, seasonId)()?.id ?: 0 }) }
|
||||
|
||||
req.userFavoriteList?.let { news ->
|
||||
repos.userFavorite.saveAll(news.mapApply {
|
||||
id = repos.userFavorite.findByUserAndItemKind(u, itemKind)()?.id ?: 0 }) }
|
||||
|
||||
req.userActivityList?.let { news ->
|
||||
repos.userAct.saveAll(news.flatMap { listOf(it.musicList, it.playList) }.flatten()
|
||||
.filter { it.kind != 0 && it.activityId != 0 }
|
||||
.mapApply {
|
||||
id = repos.userAct.findByUserAndKindAndActivityId(u, kind, activityId)()?.id ?: 0
|
||||
user = u
|
||||
}.sortedBy { it.sortNumber })
|
||||
}
|
||||
|
||||
return SUCCESS
|
||||
}
|
||||
|
||||
fun saveRating(itemList: List<Mai2UserRate>, u: Mai2UserDetail, key: String) {
|
||||
val sb = itemList.joinToString(",") { "${it.musicId}:${it.level}:${it.romVersion}:${it.achievement}" }
|
||||
val data = repos.userGeneralData.findByUserAndPropertyKey(u, key)()
|
||||
?: Mai2UserGeneralData().apply { user = u; propertyKey = key }
|
||||
repos.userGeneralData.save(data.apply { propertyValue = sb })
|
||||
}
|
||||
|
||||
companion object {
|
||||
val logger: Logger = LoggerFactory.getLogger(UpsertUserAllHandler::class.java)
|
||||
}
|
||||
}
|
|
@ -7,9 +7,9 @@ import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo;
|
|||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserPrintDetailRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.request.UpsertUserPrint;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserCard;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserPrintDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCard;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserPrintDetail;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -45,9 +45,9 @@ public class UpsertUserPrintHandler implements BaseHandler {
|
|||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
UserDetail userData;
|
||||
Mai2UserDetail userData;
|
||||
|
||||
Optional<UserDetail> userOptional = userDataRepository.findByCardExtId(userId);
|
||||
Optional<Mai2UserDetail> userOptional = userDataRepository.findByCardExtId(userId);
|
||||
if (userOptional.isPresent()) {
|
||||
userData = userOptional.get();
|
||||
} else {
|
||||
|
@ -57,8 +57,8 @@ public class UpsertUserPrintHandler implements BaseHandler {
|
|||
|
||||
UpsertUserPrint upsertUserPrint = mapper.convert(request, UpsertUserPrint.class);
|
||||
|
||||
UserPrintDetail userPrintDetail = upsertUserPrint.getUserPrintDetail();
|
||||
UserCard newUserCard = userPrintDetail.getUserCard();
|
||||
Mai2UserPrintDetail userPrintDetail = upsertUserPrint.getUserPrintDetail();
|
||||
Mai2UserCard newUserCard = userPrintDetail.getUserCard();
|
||||
|
||||
newUserCard.setUser(userData);
|
||||
userPrintDetail.setUser(userData);
|
||||
|
@ -67,9 +67,9 @@ public class UpsertUserPrintHandler implements BaseHandler {
|
|||
newUserCard.setEndDate("2029-01-01 00:00:00.000000");
|
||||
userPrintDetail.setSerialId("FAKECARDIMAG12345678");
|
||||
|
||||
Optional<UserCard> userCardOptional = userCardRepository.findByUserAndCardId(newUserCard.getUser(), newUserCard.getCardId());
|
||||
Optional<Mai2UserCard> userCardOptional = userCardRepository.findByUserAndCardId(newUserCard.getUser(), newUserCard.getCardId());
|
||||
if (userCardOptional.isPresent()) {
|
||||
UserCard userCard = userCardOptional.get();
|
||||
Mai2UserCard userCard = userCardOptional.get();
|
||||
newUserCard.setId(userCard.getId());
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import icu.samnyan.aqua.net.games.BaseEntity
|
||||
import jakarta.persistence.Column
|
||||
import jakarta.persistence.Entity
|
||||
import jakarta.persistence.Table
|
||||
import lombok.Data
|
||||
import java.time.LocalDateTime
|
||||
|
||||
@Data @Entity
|
||||
@Table(name = "maimai2_game_event")
|
||||
class Mai2GameEvent : BaseEntity() {
|
||||
private val type = 0
|
||||
private val startDate: String? = null
|
||||
private val endDate: String? = null
|
||||
|
||||
@JsonIgnore
|
||||
private val enable = false
|
||||
}
|
||||
|
||||
@Data @Entity
|
||||
@Table(name = "maimai2_game_charge")
|
||||
class Mai2GameCharge : BaseEntity() {
|
||||
@Column(unique = true)
|
||||
var chargeId = 0L
|
||||
val orderId = 0L
|
||||
val price = 0
|
||||
val startDate: String? = null
|
||||
val endDate: String? = null
|
||||
}
|
||||
|
||||
@Data @Entity
|
||||
@Table(name = "maimai2_game_selling_card")
|
||||
class Mai2GameSellingCard : BaseEntity() {
|
||||
private val cardId = 0L
|
||||
private val startDate: LocalDateTime? = null
|
||||
private val endDate: LocalDateTime? = null
|
||||
private val noticeStartDate: LocalDateTime? = null
|
||||
private val noticeEndDate: LocalDateTime? = null
|
||||
}
|
|
@ -5,9 +5,6 @@ package icu.samnyan.aqua.sega.maimai2.model
|
|||
import icu.samnyan.aqua.net.games.GenericPlaylogRepo
|
||||
import icu.samnyan.aqua.net.games.GenericUserDataRepo
|
||||
import icu.samnyan.aqua.sega.general.model.Card
|
||||
import icu.samnyan.aqua.sega.maimai2.model.gamedata.GameCharge
|
||||
import icu.samnyan.aqua.sega.maimai2.model.gamedata.GameEvent
|
||||
import icu.samnyan.aqua.sega.maimai2.model.gamedata.GameSellingCard
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.*
|
||||
import org.springframework.data.domain.Page
|
||||
import org.springframework.data.domain.Pageable
|
||||
|
@ -19,99 +16,99 @@ import java.util.*
|
|||
|
||||
@NoRepositoryBean
|
||||
interface UserLinked<T>: JpaRepository<T, Long> {
|
||||
fun findByUser(user: UserDetail): List<T>
|
||||
fun findSingleByUser(user: UserDetail): Optional<T>
|
||||
fun findByUser(user: Mai2UserDetail): List<T>
|
||||
fun findSingleByUser(user: Mai2UserDetail): Optional<T>
|
||||
fun findByUser_Card_ExtId(userId: Long): List<T>
|
||||
fun findByUser_Card_ExtId(userId: Long, page: Pageable): Page<T>
|
||||
fun findSingleByUser_Card_ExtId(userId: Long): Optional<T>
|
||||
@Transactional
|
||||
fun deleteByUser(user: UserDetail)
|
||||
fun deleteByUser(user: Mai2UserDetail)
|
||||
}
|
||||
|
||||
interface Mai2MapEncountNpcRepo : UserLinked<MapEncountNpc>
|
||||
interface Mai2MapEncountNpcRepo : UserLinked<Mai2MapEncountNpc>
|
||||
|
||||
interface Mai2UserActRepo : UserLinked<UserAct> {
|
||||
fun findByUserAndKindAndActivityId(user: UserDetail, kind: Int, id: Int): Optional<UserAct>
|
||||
interface Mai2UserActRepo : UserLinked<Mai2UserAct> {
|
||||
fun findByUserAndKindAndActivityId(user: Mai2UserDetail, kind: Int, id: Int): Optional<Mai2UserAct>
|
||||
|
||||
fun findByUser_Card_ExtIdAndKind(userId: Long, kind: Int): List<UserAct>
|
||||
fun findByUser_Card_ExtIdAndKind(userId: Long, kind: Int): List<Mai2UserAct>
|
||||
}
|
||||
|
||||
interface Mai2UserCardRepo : UserLinked<UserCard> {
|
||||
fun findByUserAndCardId(user: UserDetail, cardId: Int): Optional<UserCard>
|
||||
interface Mai2UserCardRepo : UserLinked<Mai2UserCard> {
|
||||
fun findByUserAndCardId(user: Mai2UserDetail, cardId: Int): Optional<Mai2UserCard>
|
||||
}
|
||||
|
||||
interface Mai2UserCharacterRepo : UserLinked<UserCharacter> {
|
||||
fun findByUserAndCharacterId(user: UserDetail, characterId: Int): Optional<UserCharacter>
|
||||
interface Mai2UserCharacterRepo : UserLinked<Mai2UserCharacter> {
|
||||
fun findByUserAndCharacterId(user: Mai2UserDetail, characterId: Int): Optional<Mai2UserCharacter>
|
||||
}
|
||||
|
||||
interface Mai2UserChargeRepo : UserLinked<UserCharge>
|
||||
interface Mai2UserChargeRepo : UserLinked<Mai2UserCharge>
|
||||
|
||||
interface Mai2UserCourseRepo : UserLinked<UserCourse> {
|
||||
fun findByUserAndCourseId(user: UserDetail, courseId: Int): Optional<UserCourse>
|
||||
interface Mai2UserCourseRepo : UserLinked<Mai2UserCourse> {
|
||||
fun findByUserAndCourseId(user: Mai2UserDetail, courseId: Int): Optional<Mai2UserCourse>
|
||||
}
|
||||
|
||||
interface Mai2UserDataRepo : GenericUserDataRepo<UserDetail> {
|
||||
fun findByCardExtId(userId: Long): Optional<UserDetail>
|
||||
interface Mai2UserDataRepo : GenericUserDataRepo<Mai2UserDetail> {
|
||||
fun findByCardExtId(userId: Long): Optional<Mai2UserDetail>
|
||||
|
||||
@Transactional
|
||||
fun deleteByCard(card: Card)
|
||||
}
|
||||
|
||||
interface Mai2UserExtendRepo : UserLinked<UserExtend>
|
||||
interface Mai2UserExtendRepo : UserLinked<Mai2UserExtend>
|
||||
|
||||
interface Mai2UserFavoriteRepo : UserLinked<UserFavorite> {
|
||||
fun findByUserAndItemKind(user: UserDetail, kind: Int): Optional<UserFavorite>
|
||||
interface Mai2UserFavoriteRepo : UserLinked<Mai2UserFavorite> {
|
||||
fun findByUserAndItemKind(user: Mai2UserDetail, kind: Int): Optional<Mai2UserFavorite>
|
||||
|
||||
fun findByUserIdAndItemKind(userId: Long, kind: Int): List<UserFavorite>
|
||||
fun findByUserIdAndItemKind(userId: Long, kind: Int): List<Mai2UserFavorite>
|
||||
}
|
||||
|
||||
interface Mai2UserFriendSeasonRankingRepo : UserLinked<UserFriendSeasonRanking> {
|
||||
fun findByUserAndSeasonId(user: UserDetail, seasonId: Int): Optional<UserFriendSeasonRanking>
|
||||
interface Mai2UserFriendSeasonRankingRepo : UserLinked<Mai2UserFriendSeasonRanking> {
|
||||
fun findByUserAndSeasonId(user: Mai2UserDetail, seasonId: Int): Optional<Mai2UserFriendSeasonRanking>
|
||||
}
|
||||
|
||||
interface Mai2UserGeneralDataRepo : UserLinked<UserGeneralData> {
|
||||
fun findByUserAndPropertyKey(user: UserDetail, key: String): Optional<UserGeneralData>
|
||||
interface Mai2UserGeneralDataRepo : UserLinked<Mai2UserGeneralData> {
|
||||
fun findByUserAndPropertyKey(user: Mai2UserDetail, key: String): Optional<Mai2UserGeneralData>
|
||||
|
||||
fun findByUser_Card_ExtIdAndPropertyKey(userId: Long, key: String): Optional<UserGeneralData>
|
||||
fun findByUser_Card_ExtIdAndPropertyKey(userId: Long, key: String): Optional<Mai2UserGeneralData>
|
||||
}
|
||||
|
||||
interface Mai2UserItemRepo : UserLinked<UserItem> {
|
||||
fun findByUserAndItemKindAndItemId(user: UserDetail, itemKind: Int, itemId: Int): Optional<UserItem>
|
||||
interface Mai2UserItemRepo : UserLinked<Mai2UserItem> {
|
||||
fun findByUserAndItemKindAndItemId(user: Mai2UserDetail, itemKind: Int, itemId: Int): Optional<Mai2UserItem>
|
||||
|
||||
fun findByUser_Card_ExtIdAndItemKind(userId: Long, kind: Int, page: Pageable): Page<UserItem>
|
||||
fun findByUser_Card_ExtIdAndItemKind(userId: Long, kind: Int, page: Pageable): Page<Mai2UserItem>
|
||||
}
|
||||
|
||||
interface Mai2UserLoginBonusRepo : UserLinked<UserLoginBonus> {
|
||||
fun findByUserAndBonusId(user: UserDetail, bonusId: Int): Optional<UserLoginBonus>
|
||||
interface Mai2UserLoginBonusRepo : UserLinked<Mai2UserLoginBonus> {
|
||||
fun findByUserAndBonusId(user: Mai2UserDetail, bonusId: Int): Optional<Mai2UserLoginBonus>
|
||||
}
|
||||
|
||||
interface Mai2UserMapRepo : UserLinked<UserMap> {
|
||||
fun findByUserAndMapId(user: UserDetail, mapId: Int): Optional<UserMap>
|
||||
interface Mai2UserMapRepo : UserLinked<Mai2UserMap> {
|
||||
fun findByUserAndMapId(user: Mai2UserDetail, mapId: Int): Optional<Mai2UserMap>
|
||||
}
|
||||
|
||||
interface Mai2UserMusicDetailRepo : UserLinked<UserMusicDetail> {
|
||||
fun findByUser_Card_ExtIdAndMusicId(userId: Long, id: Int): List<UserMusicDetail>
|
||||
interface Mai2UserMusicDetailRepo : UserLinked<Mai2UserMusicDetail> {
|
||||
fun findByUser_Card_ExtIdAndMusicId(userId: Long, id: Int): List<Mai2UserMusicDetail>
|
||||
|
||||
fun findByUserAndMusicIdAndLevel(user: UserDetail, musicId: Int, level: Int): Optional<UserMusicDetail>
|
||||
fun findByUserAndMusicIdAndLevel(user: Mai2UserDetail, musicId: Int, level: Int): Optional<Mai2UserMusicDetail>
|
||||
}
|
||||
|
||||
interface Mai2UserOptionRepo : UserLinked<UserOption>
|
||||
interface Mai2UserOptionRepo : UserLinked<Mai2UserOption>
|
||||
|
||||
interface Mai2UserPlaylogRepo : GenericPlaylogRepo<UserPlaylog>, UserLinked<UserPlaylog> {
|
||||
fun findByUser_Card_ExtIdAndMusicIdAndLevel(userId: Long, musicId: Int, level: Int): List<UserPlaylog>
|
||||
interface Mai2UserPlaylogRepo : GenericPlaylogRepo<Mai2UserPlaylog>, UserLinked<Mai2UserPlaylog> {
|
||||
fun findByUser_Card_ExtIdAndMusicIdAndLevel(userId: Long, musicId: Int, level: Int): List<Mai2UserPlaylog>
|
||||
}
|
||||
|
||||
interface Mai2UserPrintDetailRepo : JpaRepository<UserPrintDetail, Long>
|
||||
interface Mai2UserPrintDetailRepo : JpaRepository<Mai2UserPrintDetail, Long>
|
||||
|
||||
interface Mai2UserUdemaeRepo : UserLinked<UserUdemae>
|
||||
interface Mai2UserUdemaeRepo : UserLinked<Mai2UserUdemae>
|
||||
|
||||
interface Mai2GameChargeRepo : JpaRepository<GameCharge, Long>
|
||||
interface Mai2GameChargeRepo : JpaRepository<Mai2GameCharge, Long>
|
||||
|
||||
interface Mai2GameEventRepo : JpaRepository<GameEvent, Int> {
|
||||
fun findByTypeAndEnable(type: Int, enable: Boolean): List<GameEvent>
|
||||
interface Mai2GameEventRepo : JpaRepository<Mai2GameEvent, Int> {
|
||||
fun findByTypeAndEnable(type: Int, enable: Boolean): List<Mai2GameEvent>
|
||||
}
|
||||
|
||||
interface Mai2GameSellingCardRepo : JpaRepository<GameSellingCard, Long>
|
||||
interface Mai2GameSellingCardRepo : JpaRepository<Mai2GameSellingCard, Long>
|
||||
|
||||
@Component
|
||||
class Mai2Repos(
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.gamedata
|
||||
|
||||
import icu.samnyan.aqua.net.games.BaseEntity
|
||||
import jakarta.persistence.Column
|
||||
import jakarta.persistence.Entity
|
||||
import jakarta.persistence.Table
|
||||
import lombok.AllArgsConstructor
|
||||
import lombok.Data
|
||||
import lombok.NoArgsConstructor
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2GameCharge")
|
||||
@Table(name = "maimai2_game_charge")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
class GameCharge : Serializable, BaseEntity() {
|
||||
val orderId = 0
|
||||
|
||||
@Column(unique = true)
|
||||
var chargeId = 0
|
||||
|
||||
val price = 0
|
||||
|
||||
val startDate: String? = null
|
||||
|
||||
val endDate: String? = null
|
||||
|
||||
companion object {
|
||||
const val serialVersionUID = 1L
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.gamedata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2GameEvent")
|
||||
@Table(name = "maimai2_game_event")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GameEvent implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
private int id;
|
||||
|
||||
private int type;
|
||||
|
||||
private String startDate;
|
||||
|
||||
private String endDate;
|
||||
|
||||
@JsonIgnore
|
||||
private boolean enable;
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.gamedata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2GameSellingCard")
|
||||
@Table(name = "maimai2_game_selling_card")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GameSellingCard implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private int id;
|
||||
private int cardId;
|
||||
private LocalDateTime startDate;
|
||||
private LocalDateTime endDate;
|
||||
private LocalDateTime noticeStartDate;
|
||||
private LocalDateTime noticeEndDate;
|
||||
}
|
|
@ -6,7 +6,7 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserPlaylog;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserPlaylog;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
|
@ -16,5 +16,5 @@ import icu.samnyan.aqua.sega.maimai2.model.userdata.UserPlaylog;
|
|||
@NoArgsConstructor
|
||||
public class UploadUserPlaylog implements Serializable {
|
||||
private long userId;
|
||||
private UserPlaylog userPlaylog;
|
||||
private Mai2UserPlaylog userPlaylog;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.request;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserPrintDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserPrintDetail;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@ -18,5 +18,5 @@ public class UpsertUserPrint implements Serializable {
|
|||
private long userId;
|
||||
private long orderId;
|
||||
private Map<String, Object> userPrintReserve;
|
||||
private UserPrintDetail userPrintDetail;
|
||||
private Mai2UserPrintDetail userPrintDetail;
|
||||
}
|
||||
|
|
|
@ -18,20 +18,20 @@ import java.util.Map;
|
|||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserAll implements Serializable {
|
||||
private List<UserDetail> userData;
|
||||
private List<UserExtend> userExtend;
|
||||
private List<UserOption> userOption;
|
||||
private List<UserCharacter> userCharacterList;
|
||||
private List<UserGhost> userGhost;
|
||||
private List<UserMap> userMapList;
|
||||
private List<UserLoginBonus> userLoginBonusList;
|
||||
private List<Mai2UserDetail> userData;
|
||||
private List<Mai2UserExtend> userExtend;
|
||||
private List<Mai2UserOption> userOption;
|
||||
private List<Mai2UserCharacter> userCharacterList;
|
||||
private List<Mai2UserGhost> userGhost;
|
||||
private List<Mai2UserMap> userMapList;
|
||||
private List<Mai2UserLoginBonus> userLoginBonusList;
|
||||
private List<UserRating> userRatingList;
|
||||
private List<UserItem> userItemList;
|
||||
private List<UserMusicDetail> userMusicDetailList;
|
||||
private List<UserCourse> userCourseList;
|
||||
private List<UserFriendSeasonRanking> userFriendSeasonRankingList;
|
||||
private List<UserCharge> userChargeList;
|
||||
private List<UserFavorite> userFavoriteList;
|
||||
private List<Mai2UserItem> userItemList;
|
||||
private List<Mai2UserMusicDetail> userMusicDetailList;
|
||||
private List<Mai2UserCourse> userCourseList;
|
||||
private List<Mai2UserFriendSeasonRanking> userFriendSeasonRankingList;
|
||||
private List<Mai2UserCharge> userChargeList;
|
||||
private List<Mai2UserFavorite> userFavoriteList;
|
||||
private List<UserActivity> userActivityList;
|
||||
private List<Map<String, Object>> userGamePlaylogList;
|
||||
private String isNewCharacterList;
|
||||
|
|
|
@ -2,7 +2,7 @@ package icu.samnyan.aqua.sega.maimai2.model.response.data;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserAct;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserAct;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@ -14,6 +14,6 @@ import lombok.NoArgsConstructor;
|
|||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserActivity {
|
||||
private List<UserAct> playList;
|
||||
private List<UserAct> musicList;
|
||||
private List<Mai2UserAct> playList;
|
||||
private List<Mai2UserAct> musicList;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package icu.samnyan.aqua.sega.maimai2.model.response.data;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserMusicDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserMusicDetail;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@ -14,5 +14,5 @@ import lombok.NoArgsConstructor;
|
|||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserMusic {
|
||||
private List<UserMusicDetail> userMusicDetailList;
|
||||
private List<Mai2UserMusicDetail> userMusicDetailList;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@ package icu.samnyan.aqua.sega.maimai2.model.response.data;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserRate;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserUdemae;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserRate;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserUdemae;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@ -16,9 +16,9 @@ import lombok.NoArgsConstructor;
|
|||
@NoArgsConstructor
|
||||
public class UserRating {
|
||||
private int rating;
|
||||
private List<UserRate> ratingList;
|
||||
private List<UserRate> newRatingList;
|
||||
private List<UserRate> nextRatingList;
|
||||
private List<UserRate> nextNewRatingList;
|
||||
private UserUdemae udemae;
|
||||
private List<Mai2UserRate> ratingList;
|
||||
private List<Mai2UserRate> newRatingList;
|
||||
private List<Mai2UserRate> nextRatingList;
|
||||
private List<Mai2UserRate> nextNewRatingList;
|
||||
private Mai2UserUdemae udemae;
|
||||
}
|
||||
|
|
|
@ -3,21 +3,16 @@ package icu.samnyan.aqua.sega.maimai2.model.userdata
|
|||
import com.fasterxml.jackson.annotation.JsonInclude
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize
|
||||
import ext.Str
|
||||
import icu.samnyan.aqua.net.games.BaseEntity
|
||||
import icu.samnyan.aqua.net.games.IGenericUserData
|
||||
import icu.samnyan.aqua.sega.general.model.Card
|
||||
import icu.samnyan.aqua.sega.maimai2.util.IntegerListConverter
|
||||
import icu.samnyan.aqua.sega.util.jackson.AccessCodeSerializer
|
||||
import jakarta.persistence.*
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2UserData")
|
||||
@Table(name = "maimai2_user_detail")
|
||||
class UserDetail(
|
||||
class Mai2UserDetail(
|
||||
@JsonSerialize(using = AccessCodeSerializer::class)
|
||||
@JsonProperty(value = "accessCode", access = JsonProperty.Access.READ_ONLY)
|
||||
@OneToOne
|
||||
|
@ -28,8 +23,8 @@ class UserDetail(
|
|||
|
||||
@JsonInclude
|
||||
@Transient
|
||||
var friendCode: Str = "",
|
||||
var isNetMember: Int = 0,
|
||||
var friendCode: String = "",
|
||||
var isNetMember: Int = 1,
|
||||
|
||||
@JsonInclude
|
||||
@Transient
|
||||
|
@ -153,7 +148,7 @@ class UserDetail(
|
|||
// TODO: Make these non-nullable with default value
|
||||
var currentPlayCount: Int? = 0,
|
||||
var renameCredit: Int? = 0
|
||||
) : Serializable, IGenericUserData, BaseEntity() {
|
||||
) : BaseEntity(), IGenericUserData {
|
||||
override val totalScore: Long
|
||||
get() = totalDeluxscore
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2MapEncountNpc")
|
||||
@Table(name = "maimai2_user_npc_encount")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class MapEncountNpc implements Serializable{
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
private int npcId;
|
||||
private int musicId;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "extend_id")
|
||||
private UserExtend userExtend;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2UserActivity")
|
||||
@Table(name = "maimai2_user_activity")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@JsonPropertyOrder({"kind", "id", "sortNumber", "param1", "param2", "param3", "param4"})
|
||||
public class UserAct implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
|
||||
private int kind;
|
||||
|
||||
@JsonProperty("id")
|
||||
private int activityId;
|
||||
|
||||
private long sortNumber;
|
||||
private int param1;
|
||||
private int param2;
|
||||
private int param3;
|
||||
private int param4;
|
||||
|
||||
public UserAct(UserDetail user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2UserCard")
|
||||
@Table(name = "maimai2_user_card")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserCard implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
|
||||
public int cardId;
|
||||
public int cardTypeId;
|
||||
public int charaId;
|
||||
public int mapId;
|
||||
public String startDate;
|
||||
public String endDate;
|
||||
|
||||
public UserCard(UserDetail user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2UserCharacter")
|
||||
@Table(name = "maimai2_user_character")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserCharacter implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
|
||||
private int characterId;
|
||||
@JsonInclude
|
||||
@Transient
|
||||
private int point = 0;
|
||||
@JsonInclude
|
||||
@Transient
|
||||
private int count = 0;
|
||||
private int level;
|
||||
@JsonInclude
|
||||
@Transient
|
||||
private int nextAwake = 0;
|
||||
@JsonInclude
|
||||
@Transient
|
||||
private int nextAwakePercent = 0;
|
||||
@JsonInclude
|
||||
@Transient
|
||||
private boolean favorite = false;
|
||||
private int awakening;
|
||||
private int useCount;
|
||||
|
||||
public UserCharacter(UserDetail user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2UserCharge")
|
||||
@Table(name = "maimai2_user_charge", uniqueConstraints = {@UniqueConstraint(columnNames = {"user_id", "charge_id"})})
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonPropertyOrder({"chargeId", "stock", "purchaseDate", "validDate"})
|
||||
public class UserCharge implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
|
||||
@Column(name = "charge_id")
|
||||
private int chargeId;
|
||||
|
||||
private int stock;
|
||||
|
||||
private String purchaseDate;
|
||||
|
||||
private String validDate;
|
||||
|
||||
public UserCharge(UserDetail user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "MaiMai2UserCourse")
|
||||
@Table(name = "maimai2_user_course")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserCourse implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
|
||||
private int courseId;
|
||||
@JsonProperty("isLastClear")
|
||||
private boolean isLastClear;
|
||||
private int totalRestlife;
|
||||
private int totalAchievement;
|
||||
private int totalDeluxscore;
|
||||
private int playCount;
|
||||
private String clearDate;
|
||||
private String lastPlayDate;
|
||||
private int bestAchievement;
|
||||
private String bestAchievementDate;
|
||||
private int bestDeluxscore;
|
||||
private String bestDeluxscoreDate;
|
||||
|
||||
public UserCourse(UserDetail user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,572 @@
|
|||
@file:Suppress("unused")
|
||||
|
||||
package icu.samnyan.aqua.sega.maimai2.model.userdata
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import com.fasterxml.jackson.annotation.JsonInclude
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder
|
||||
import icu.samnyan.aqua.net.games.BaseEntity
|
||||
import icu.samnyan.aqua.net.games.IGenericGamePlaylog
|
||||
import icu.samnyan.aqua.sega.maimai2.util.IntegerListConverter
|
||||
import jakarta.persistence.*
|
||||
import lombok.AllArgsConstructor
|
||||
import lombok.Data
|
||||
import lombok.NoArgsConstructor
|
||||
|
||||
@MappedSuperclass
|
||||
open class Mai2UserEntity : BaseEntity() {
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
open var user: Mai2UserDetail? = null
|
||||
}
|
||||
|
||||
|
||||
@Table(name = "maimai2_user_npc_encount")
|
||||
@Data @Entity
|
||||
class Mai2MapEncountNpc : Mai2UserEntity() {
|
||||
|
||||
var npcId = 0
|
||||
var musicId = 0
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "extend_id")
|
||||
var userExtend: Mai2UserExtend? = null
|
||||
}
|
||||
|
||||
@Table(name = "maimai2_user_activity")
|
||||
@Data @Entity
|
||||
@JsonPropertyOrder("kind", "id", "sortNumber", "param1", "param2", "param3", "param4")
|
||||
class Mai2UserAct : Mai2UserEntity() {
|
||||
var kind = 0
|
||||
|
||||
@JsonProperty("id")
|
||||
var activityId = 0
|
||||
|
||||
var sortNumber: Long = 0
|
||||
var param1 = 0
|
||||
var param2 = 0
|
||||
var param3 = 0
|
||||
var param4 = 0
|
||||
}
|
||||
|
||||
@Table(name = "maimai2_user_card")
|
||||
@Data @Entity
|
||||
class Mai2UserCard : Mai2UserEntity() {
|
||||
var cardId: Int = 0
|
||||
var cardTypeId: Int = 0
|
||||
var charaId: Int = 0
|
||||
var mapId: Int = 0
|
||||
var startDate: String? = null
|
||||
var endDate: String? = null
|
||||
}
|
||||
|
||||
@Table(name = "maimai2_user_character")
|
||||
@Data @Entity
|
||||
class Mai2UserCharacter : Mai2UserEntity() {
|
||||
var characterId = 0
|
||||
|
||||
@JsonInclude
|
||||
@Transient
|
||||
var point = 0
|
||||
|
||||
@JsonInclude
|
||||
@Transient
|
||||
var count = 0
|
||||
var level = 0
|
||||
|
||||
@JsonInclude
|
||||
@Transient
|
||||
var nextAwake = 0
|
||||
|
||||
@JsonInclude
|
||||
@Transient
|
||||
var nextAwakePercent = 0
|
||||
|
||||
@JsonInclude
|
||||
@Transient
|
||||
var favorite = false
|
||||
var awakening = 0
|
||||
var useCount = 0
|
||||
}
|
||||
|
||||
@Table(name = "maimai2_user_charge", uniqueConstraints = [UniqueConstraint(columnNames = ["user_id", "charge_id"])])
|
||||
@Data @Entity
|
||||
@JsonPropertyOrder("chargeId", "stock", "purchaseDate", "validDate")
|
||||
class Mai2UserCharge : Mai2UserEntity() {
|
||||
@Column(name = "charge_id")
|
||||
var chargeId = 0
|
||||
var stock = 0
|
||||
var purchaseDate: String? = null
|
||||
var validDate: String? = null
|
||||
}
|
||||
|
||||
@Table(name = "maimai2_user_course")
|
||||
@Data @Entity
|
||||
class Mai2UserCourse : Mai2UserEntity() {
|
||||
var courseId = 0
|
||||
|
||||
@JsonProperty("isLastClear")
|
||||
var isLastClear = false
|
||||
var totalRestlife = 0
|
||||
var totalAchievement = 0
|
||||
var totalDeluxscore = 0
|
||||
var playCount = 0
|
||||
var clearDate: String? = null
|
||||
var lastPlayDate: String? = null
|
||||
var bestAchievement = 0
|
||||
var bestAchievementDate: String? = null
|
||||
var bestDeluxscore = 0
|
||||
var bestDeluxscoreDate: String? = null
|
||||
}
|
||||
|
||||
@Table(name = "maimai2_user_extend")
|
||||
@Data @Entity
|
||||
@JsonPropertyOrder(
|
||||
"selectMusicId",
|
||||
"selectDifficultyId",
|
||||
"categoryIndex",
|
||||
"musicIndex",
|
||||
"extraFlag",
|
||||
"selectScoreType",
|
||||
"extendContentBit",
|
||||
"isPhotoAgree",
|
||||
"isGotoCodeRead",
|
||||
"selectResultDetails",
|
||||
"sortCategorySetting",
|
||||
"sortMusicSetting",
|
||||
"playStatusSetting",
|
||||
"selectedCardList",
|
||||
"encountMapNpcList"
|
||||
)
|
||||
class Mai2UserExtend : Mai2UserEntity() {
|
||||
var selectMusicId = 0
|
||||
var selectDifficultyId = 0
|
||||
var categoryIndex = 0
|
||||
var musicIndex = 0
|
||||
var extraFlag = 0
|
||||
var selectScoreType = 0
|
||||
var extendContentBit: Long = 0
|
||||
|
||||
@JsonProperty("isPhotoAgree")
|
||||
var isPhotoAgree = false
|
||||
|
||||
@JsonProperty("isGotoCodeRead")
|
||||
var isGotoCodeRead = false
|
||||
var selectResultDetails = false
|
||||
var sortCategorySetting = 0 //enum SortTabID
|
||||
var sortMusicSetting = 0 //enum SortMusicID
|
||||
var playStatusSetting = 0 //enum PlaystatusTabID
|
||||
var selectResultScoreViewType = 0
|
||||
|
||||
@Convert(converter = IntegerListConverter::class)
|
||||
var selectedCardList: List<Int>? = null
|
||||
|
||||
@OneToMany(mappedBy = "userExtend")
|
||||
var encountMapNpcList: List<Mai2MapEncountNpc> = ArrayList()
|
||||
}
|
||||
|
||||
@Table(name = "maimai2_user_favorite")
|
||||
@Data @Entity
|
||||
class Mai2UserFavorite : Mai2UserEntity() {
|
||||
@JsonProperty("userId")
|
||||
var favUserId: Long = 0
|
||||
var itemKind = 0
|
||||
|
||||
@Convert(converter = IntegerListConverter::class)
|
||||
var itemIdList: List<Int>? = null
|
||||
}
|
||||
|
||||
@Table(name = "maimai2_user_friend_season_ranking")
|
||||
@Data @Entity
|
||||
class Mai2UserFriendSeasonRanking : Mai2UserEntity() {
|
||||
var seasonId = 0
|
||||
var point = 0
|
||||
|
||||
@Column(name = "\"rank\"")
|
||||
var rank = 0
|
||||
var rewardGet = false
|
||||
var userName: String? = null
|
||||
var recordDate: String? = null
|
||||
}
|
||||
|
||||
/**
|
||||
* This is for storing some data only use in aqua
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Table(name = "maimai2_user_general_data")
|
||||
@Data @Entity
|
||||
class Mai2UserGeneralData : Mai2UserEntity() {
|
||||
var propertyKey = ""
|
||||
|
||||
@Column(columnDefinition = "TEXT")
|
||||
var propertyValue = ""
|
||||
}
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
class Mai2UserGhost {
|
||||
var name: String? = null
|
||||
var iconId = 0
|
||||
var plateId = 0
|
||||
var titleId = 0
|
||||
var rate = 0
|
||||
var udemaeRate = 0
|
||||
var courseRank = 0
|
||||
var classRank = 0
|
||||
var classValue = 0
|
||||
var playDatetime: String? = null
|
||||
var shopId = 0
|
||||
var regionCode = 0
|
||||
var typeId = 0
|
||||
var musicId = 0
|
||||
var difficulty = 0
|
||||
var version = 0
|
||||
var resultBitList: List<Byte>? = null
|
||||
var resultNum = 0
|
||||
var achievement = 0
|
||||
}
|
||||
|
||||
@Table(name = "maimai2_user_item")
|
||||
@Data @Entity
|
||||
class Mai2UserItem : Mai2UserEntity() {
|
||||
var itemKind = 0
|
||||
var itemId = 0
|
||||
var stock = 0
|
||||
var isValid = false
|
||||
}
|
||||
|
||||
@Suppress("EnumEntryName")
|
||||
enum class Mai2ItemKind(val id: Int) {
|
||||
plate(1),
|
||||
title(2),
|
||||
icon(3),
|
||||
musicUnlock(5),
|
||||
musicMasterUnlock(6),
|
||||
musicRemasterUnlock(7),
|
||||
musicStrongUnlock(8),
|
||||
chara(9),
|
||||
partner(10),
|
||||
frame(11),
|
||||
ticket(12);
|
||||
|
||||
companion object {
|
||||
val ALL: Map<Int, Mai2ItemKind> = Mai2ItemKind::class.java.enumConstants.associateBy { it.id }
|
||||
}
|
||||
}
|
||||
|
||||
@Table(name = "maimai2_user_login_bonus")
|
||||
@Data @Entity
|
||||
@JsonPropertyOrder("bonusId", "point", "isCurrent", "isComplete")
|
||||
class Mai2UserLoginBonus : Mai2UserEntity() {
|
||||
var bonusId = 0
|
||||
var point = 0
|
||||
|
||||
@JsonProperty("isCurrent")
|
||||
var isCurrent = false
|
||||
|
||||
@JsonProperty("isComplete")
|
||||
var isComplete = false
|
||||
}
|
||||
|
||||
@Table(name = "maimai2_user_map")
|
||||
@Data @Entity
|
||||
@JsonPropertyOrder("mapId", "distance", "isLock", "isClear", "isComplete")
|
||||
class Mai2UserMap : Mai2UserEntity() {
|
||||
var mapId = 0
|
||||
var distance = 0
|
||||
|
||||
@JsonProperty("isLock")
|
||||
var isLock = false
|
||||
|
||||
@JsonProperty("isClear")
|
||||
var isClear = false
|
||||
|
||||
@JsonProperty("isComplete")
|
||||
var isComplete = false
|
||||
}
|
||||
|
||||
@Table(name = "maimai2_user_music_detail")
|
||||
@Data @Entity
|
||||
class Mai2UserMusicDetail : Mai2UserEntity() {
|
||||
|
||||
var musicId = 0
|
||||
var level = 0
|
||||
var playCount = 0
|
||||
var achievement = 0
|
||||
var comboStatus = 0
|
||||
var syncStatus = 0
|
||||
var deluxscoreMax = 0
|
||||
var scoreRank = 0
|
||||
var extNum1 = 0
|
||||
}
|
||||
|
||||
@Table(name = "maimai2_user_option")
|
||||
@Data @Entity
|
||||
class Mai2UserOption : Mai2UserEntity() {
|
||||
var optionKind = 0
|
||||
var noteSpeed = 0
|
||||
var slideSpeed = 0
|
||||
var touchSpeed = 0
|
||||
var tapDesign = 0
|
||||
var holdDesign = 0
|
||||
var slideDesign = 0
|
||||
var starType = 0
|
||||
var outlineDesign = 0
|
||||
var noteSize = 0
|
||||
var slideSize = 0
|
||||
var touchSize = 0
|
||||
var starRotate = 0
|
||||
var dispCenter = 0
|
||||
var dispChain = 0
|
||||
var dispRate = 0
|
||||
var dispBar = 0
|
||||
var touchEffect = 0
|
||||
var submonitorAnimation = 0
|
||||
var submonitorAchive = 0
|
||||
var submonitorAppeal = 0
|
||||
var matching = 0
|
||||
var trackSkip = 0
|
||||
var brightness = 0
|
||||
var mirrorMode = 0
|
||||
var dispJudge = 0
|
||||
var dispJudgePos = 0
|
||||
var dispJudgeTouchPos = 0
|
||||
var adjustTiming = 0
|
||||
var judgeTiming = 0
|
||||
var ansVolume = 0
|
||||
var tapHoldVolume = 0
|
||||
var criticalSe = 0
|
||||
var tapSe = 0
|
||||
var breakSe = 0
|
||||
var breakVolume = 0
|
||||
var exSe = 0
|
||||
var exVolume = 0
|
||||
var slideSe = 0
|
||||
var slideVolume = 0
|
||||
var touchHoldVolume = 0
|
||||
var damageSeVolume = 0
|
||||
var headPhoneVolume = 0
|
||||
var sortTab = 0
|
||||
var sortMusic = 0
|
||||
var outFrameType = 0
|
||||
var breakSlideVolume = 0
|
||||
var touchVolume = 0
|
||||
}
|
||||
|
||||
@Table(name = "maimai2_user_playlog")
|
||||
@Data @Entity
|
||||
class Mai2UserPlaylog : Mai2UserEntity(), IGenericGamePlaylog {
|
||||
var orderId = 0
|
||||
var playlogId: Long = 0
|
||||
var version = 0
|
||||
var placeId = 0
|
||||
var placeName: String? = null
|
||||
var loginDate: Long = 0
|
||||
var playDate: String = ""
|
||||
override var userPlayDate: String = ""
|
||||
var type = 0
|
||||
override var musicId: Int = 0
|
||||
override var level: Int = 0
|
||||
var trackNo = 0
|
||||
var vsMode = 0
|
||||
var vsUserName: String? = null
|
||||
var vsStatus = 0
|
||||
var vsUserRating = 0
|
||||
var vsUserAchievement = 0
|
||||
var vsUserGradeRank = 0
|
||||
var vsRank = 0
|
||||
var playerNum = 0
|
||||
var playedUserId1: Long = 0
|
||||
var playedUserName1: String? = null
|
||||
var playedMusicLevel1 = 0
|
||||
var playedUserId2: Long = 0
|
||||
var playedUserName2: String? = null
|
||||
var playedMusicLevel2 = 0
|
||||
var playedUserId3: Long = 0
|
||||
var playedUserName3: String? = null
|
||||
var playedMusicLevel3 = 0
|
||||
var characterId1 = 0
|
||||
var characterLevel1 = 0
|
||||
var characterAwakening1 = 0
|
||||
var characterId2 = 0
|
||||
var characterLevel2 = 0
|
||||
var characterAwakening2 = 0
|
||||
var characterId3 = 0
|
||||
var characterLevel3 = 0
|
||||
var characterAwakening3 = 0
|
||||
var characterId4 = 0
|
||||
var characterLevel4 = 0
|
||||
var characterAwakening4 = 0
|
||||
var characterId5 = 0
|
||||
var characterLevel5 = 0
|
||||
var characterAwakening5 = 0
|
||||
override var achievement: Int = 0
|
||||
var deluxscore = 0
|
||||
var scoreRank = 0
|
||||
|
||||
// Maximum continuous combo that the player achieved in this play.
|
||||
override var maxCombo: Int = 0
|
||||
|
||||
// Maximum achievable combo in the song.
|
||||
var totalCombo = 0
|
||||
var maxSync = 0
|
||||
var totalSync = 0
|
||||
var tapCriticalPerfect = 0
|
||||
var tapPerfect = 0
|
||||
var tapGreat = 0
|
||||
var tapGood = 0
|
||||
var tapMiss = 0
|
||||
var holdCriticalPerfect = 0
|
||||
var holdPerfect = 0
|
||||
var holdGreat = 0
|
||||
var holdGood = 0
|
||||
var holdMiss = 0
|
||||
var slideCriticalPerfect = 0
|
||||
var slidePerfect = 0
|
||||
var slideGreat = 0
|
||||
var slideGood = 0
|
||||
var slideMiss = 0
|
||||
var touchCriticalPerfect = 0
|
||||
var touchPerfect = 0
|
||||
var touchGreat = 0
|
||||
var touchGood = 0
|
||||
var touchMiss = 0
|
||||
var breakCriticalPerfect = 0
|
||||
var breakPerfect = 0
|
||||
var breakGreat = 0
|
||||
var breakGood = 0
|
||||
var breakMiss = 0
|
||||
|
||||
@JsonProperty("isTap")
|
||||
var isTap = false
|
||||
|
||||
@JsonProperty("isHold")
|
||||
var isHold = false
|
||||
|
||||
@JsonProperty("isSlide")
|
||||
var isSlide = false
|
||||
|
||||
@JsonProperty("isTouch")
|
||||
var isTouch = false
|
||||
|
||||
@JsonProperty("isBreak")
|
||||
var isBreak = false
|
||||
|
||||
@JsonProperty("isCriticalDisp")
|
||||
var isCriticalDisp = false
|
||||
|
||||
@JsonProperty("isFastLateDisp")
|
||||
var isFastLateDisp = false
|
||||
var fastCount = 0
|
||||
var lateCount = 0
|
||||
|
||||
@JsonProperty("isAchieveNewRecord")
|
||||
var isAchieveNewRecord = false
|
||||
|
||||
@JsonProperty("isDeluxscoreNewRecord")
|
||||
var isDeluxscoreNewRecord = false
|
||||
var comboStatus = 0
|
||||
var syncStatus = 0
|
||||
|
||||
@JsonProperty("isClear")
|
||||
var isClear = false
|
||||
override var beforeRating: Int = 0
|
||||
override var afterRating: Int = 0
|
||||
var beforeGrade = 0
|
||||
var afterGrade = 0
|
||||
var afterGradeRank = 0
|
||||
var beforeDeluxRating = 0
|
||||
var afterDeluxRating = 0
|
||||
|
||||
@JsonProperty("isPlayTutorial")
|
||||
var isPlayTutorial = false
|
||||
|
||||
@JsonProperty("isEventMode")
|
||||
var isEventMode = false
|
||||
|
||||
@JsonProperty("isFreedomMode")
|
||||
var isFreedomMode = false
|
||||
var playMode = 0
|
||||
|
||||
@JsonProperty("isNewFree")
|
||||
var isNewFree = false
|
||||
|
||||
var trialPlayAchievement = 0
|
||||
var extNum1 = 0
|
||||
var extNum2 = 0
|
||||
var extNum4 = 0
|
||||
|
||||
@JsonProperty("extBool1")
|
||||
var extBool1 = false
|
||||
|
||||
override val isFullCombo: Boolean
|
||||
get() = maxCombo == totalCombo
|
||||
|
||||
override val isAllPerfect: Boolean
|
||||
get() = tapMiss + tapGood + tapGreat == 0 &&
|
||||
holdMiss + holdGood + holdGreat == 0 &&
|
||||
slideMiss + slideGood + slideGreat == 0 &&
|
||||
touchMiss + touchGood + touchGreat == 0 &&
|
||||
breakMiss + breakGood + breakGreat == 0
|
||||
}
|
||||
|
||||
@Table(name = "maimai2_user_print_detail")
|
||||
@Data @Entity
|
||||
class Mai2UserPrintDetail : Mai2UserEntity() {
|
||||
var orderId: Long = 0
|
||||
var printNumber = 0
|
||||
var printDate: String? = null
|
||||
var serialId: String? = null
|
||||
var placeId = 0
|
||||
var clientId: String? = null
|
||||
var printerSerialId: String? = null
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_card_id")
|
||||
var userCard: Mai2UserCard? = null
|
||||
var cardRomVersion = 0
|
||||
var isHolograph = false
|
||||
var printOption1 = false
|
||||
var printOption2 = false
|
||||
var printOption3 = false
|
||||
var printOption4 = false
|
||||
var printOption5 = false
|
||||
var printOption6 = false
|
||||
var printOption7 = false
|
||||
var printOption8 = false
|
||||
var printOption9 = false
|
||||
var printOption10 = false
|
||||
var created: String? = null
|
||||
}
|
||||
|
||||
data class Mai2UserRate(
|
||||
var musicId: Int = 0,
|
||||
var level: Int = 0,
|
||||
var romVersion: Int = 0,
|
||||
var achievement: Int = 0,
|
||||
)
|
||||
|
||||
@Table(name = "maimai2_user_udemae")
|
||||
@Data @Entity
|
||||
class Mai2UserUdemae : Mai2UserEntity() {
|
||||
var rate = 0
|
||||
var maxRate = 0
|
||||
var classValue = 0
|
||||
var maxClassValue = 0
|
||||
var totalWinNum = 0
|
||||
var totalLoseNum = 0
|
||||
var maxWinNum = 0
|
||||
var maxLoseNum = 0
|
||||
var winNum = 0
|
||||
var loseNum = 0
|
||||
var npcTotalWinNum = 0
|
||||
var npcTotalLoseNum = 0
|
||||
var npcMaxWinNum = 0
|
||||
var npcMaxLoseNum = 0
|
||||
var npcWinNum = 0
|
||||
var npcLoseNum = 0
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.util.IntegerListConverter;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2UserExtend")
|
||||
@Table(name = "maimai2_user_extend")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@JsonPropertyOrder({"selectMusicId", "selectDifficultyId", "categoryIndex", "musicIndex",
|
||||
"extraFlag", "selectScoreType", "extendContentBit", "isPhotoAgree", "isGotoCodeRead",
|
||||
"selectResultDetails", "sortCategorySetting", "sortMusicSetting", "playStatusSetting", "selectedCardList", "encountMapNpcList"})
|
||||
public class UserExtend implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
|
||||
private int selectMusicId;
|
||||
private int selectDifficultyId;
|
||||
private int categoryIndex;
|
||||
private int musicIndex;
|
||||
private int extraFlag;
|
||||
private int selectScoreType;
|
||||
private long extendContentBit;
|
||||
@JsonProperty("isPhotoAgree")
|
||||
private boolean isPhotoAgree;
|
||||
@JsonProperty("isGotoCodeRead")
|
||||
private boolean isGotoCodeRead;
|
||||
private boolean selectResultDetails;
|
||||
private int sortCategorySetting; //enum SortTabID
|
||||
private int sortMusicSetting; //enum SortMusicID
|
||||
private int playStatusSetting; //enum PlaystatusTabID
|
||||
private int selectResultScoreViewType;
|
||||
|
||||
@Convert(converter = IntegerListConverter.class)
|
||||
private List<Integer> selectedCardList;
|
||||
|
||||
@OneToMany(mappedBy = "userExtend")
|
||||
private List<MapEncountNpc> encountMapNpcList = new ArrayList<>();
|
||||
|
||||
public UserExtend(UserDetail user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.util.IntegerListConverter;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2UserFavorite")
|
||||
@Table(name = "maimai2_user_favorite")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserFavorite implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
|
||||
@JsonProperty("userId")
|
||||
private long favUserId;
|
||||
private int itemKind;
|
||||
|
||||
@Convert(converter = IntegerListConverter.class)
|
||||
private List<Integer> itemIdList;
|
||||
|
||||
public UserFavorite(UserDetail user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2UserFriendSeasonRanking")
|
||||
@Table(name = "maimai2_user_friend_season_ranking")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserFriendSeasonRanking implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
|
||||
private int seasonId;
|
||||
private int point;
|
||||
@Column(name = "\"rank\"")
|
||||
private int rank;
|
||||
private boolean rewardGet;
|
||||
private String userName;
|
||||
private String recordDate;
|
||||
|
||||
public UserFriendSeasonRanking(UserDetail user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* This is for storing some data only use in aqua
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2UserGeneralData")
|
||||
@Table(name = "maimai2_user_general_data")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserGeneralData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
|
||||
private String propertyKey;
|
||||
|
||||
@Column(columnDefinition = "TEXT")
|
||||
private String propertyValue;
|
||||
|
||||
public UserGeneralData(UserDetail userData, String key) {
|
||||
this.user = userData;
|
||||
this.propertyKey = key;
|
||||
this.propertyValue = "";
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserGhost {
|
||||
private String name;
|
||||
private int iconId;
|
||||
private int plateId;
|
||||
private int titleId;
|
||||
private int rate;
|
||||
private int udemaeRate;
|
||||
private int courseRank;
|
||||
private int classRank;
|
||||
private int classValue;
|
||||
private String playDatetime;
|
||||
private int shopId;
|
||||
private int regionCode;
|
||||
private int typeId;
|
||||
private int musicId;
|
||||
private int difficulty;
|
||||
private int version;
|
||||
private List<Byte> resultBitList;
|
||||
private int resultNum;
|
||||
private int achievement;
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2UserItem")
|
||||
@Table(name = "maimai2_user_item")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserItem implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
|
||||
private int itemKind;
|
||||
private int itemId;
|
||||
private int stock;
|
||||
private boolean isValid;
|
||||
|
||||
public UserItem(UserDetail user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public enum Mai2ItemKind {
|
||||
plate(1),
|
||||
title(2),
|
||||
icon(3),
|
||||
musicUnlock(5),
|
||||
musicMasterUnlock(6),
|
||||
musicRemasterUnlock(7),
|
||||
musicStrongUnlock(8),
|
||||
chara(9),
|
||||
partner(10),
|
||||
frame(11),
|
||||
ticket(12);
|
||||
|
||||
public final int value;
|
||||
|
||||
Mai2ItemKind(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static final Map<Integer, Mai2ItemKind> ALL = Arrays.stream(Mai2ItemKind.class.getEnumConstants())
|
||||
.map(k -> Map.entry(k.value, k)).collect(HashMap::new, (m, v) -> m.put(v.getKey(), v.getValue()), Map::putAll);
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2UserLoginBonus")
|
||||
@Table(name = "maimai2_user_login_bonus")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@JsonPropertyOrder({"bonusId", "point", "isCurrent", "isComplete"})
|
||||
public class UserLoginBonus implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
|
||||
private int bonusId;
|
||||
private int point;
|
||||
@JsonProperty("isCurrent")
|
||||
private boolean isCurrent;
|
||||
@JsonProperty("isComplete")
|
||||
private boolean isComplete;
|
||||
|
||||
public UserLoginBonus(UserDetail user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2UserMap")
|
||||
@Table(name = "maimai2_user_map")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@JsonPropertyOrder({"mapId", "distance", "isLock", "isClear", "isComplete"})
|
||||
public class UserMap implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
|
||||
private int mapId;
|
||||
private int distance;
|
||||
@JsonProperty("isLock")
|
||||
private boolean isLock;
|
||||
@JsonProperty("isClear")
|
||||
private boolean isClear;
|
||||
@JsonProperty("isComplete")
|
||||
private boolean isComplete;
|
||||
|
||||
public UserMap(UserDetail user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "MaiMai2UserMusicDetail")
|
||||
@Table(name = "maimai2_user_music_detail")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserMusicDetail implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
|
||||
private int musicId;
|
||||
private int level;
|
||||
private int playCount;
|
||||
private int achievement;
|
||||
private int comboStatus;
|
||||
private int syncStatus;
|
||||
private int deluxscoreMax;
|
||||
private int scoreRank;
|
||||
private int extNum1;
|
||||
|
||||
public UserMusicDetail(UserDetail user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2UserOption")
|
||||
@Table(name = "maimai2_user_option")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserOption implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
|
||||
private int optionKind;
|
||||
private int noteSpeed;
|
||||
private int slideSpeed;
|
||||
private int touchSpeed;
|
||||
private int tapDesign;
|
||||
private int holdDesign;
|
||||
private int slideDesign;
|
||||
private int starType;
|
||||
private int outlineDesign;
|
||||
private int noteSize;
|
||||
private int slideSize;
|
||||
private int touchSize;
|
||||
private int starRotate;
|
||||
private int dispCenter;
|
||||
private int dispChain;
|
||||
private int dispRate;
|
||||
private int dispBar;
|
||||
private int touchEffect;
|
||||
private int submonitorAnimation;
|
||||
private int submonitorAchive;
|
||||
private int submonitorAppeal;
|
||||
private int matching;
|
||||
private int trackSkip;
|
||||
private int brightness;
|
||||
private int mirrorMode;
|
||||
private int dispJudge;
|
||||
private int dispJudgePos;
|
||||
private int dispJudgeTouchPos;
|
||||
private int adjustTiming;
|
||||
private int judgeTiming;
|
||||
private int ansVolume;
|
||||
private int tapHoldVolume;
|
||||
private int criticalSe;
|
||||
private int tapSe;
|
||||
private int breakSe;
|
||||
private int breakVolume;
|
||||
private int exSe;
|
||||
private int exVolume;
|
||||
private int slideSe;
|
||||
private int slideVolume;
|
||||
private int touchHoldVolume;
|
||||
private int damageSeVolume;
|
||||
private int headPhoneVolume;
|
||||
private int sortTab;
|
||||
private int sortMusic;
|
||||
private int outFrameType;
|
||||
private int breakSlideVolume;
|
||||
private int touchVolume;
|
||||
|
||||
public UserOption(UserDetail user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
|
@ -1,279 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import icu.samnyan.aqua.net.games.IGenericGamePlaylog;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2UserPlaylog")
|
||||
@Table(name = "maimai2_user_playlog")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserPlaylog implements Serializable, IGenericGamePlaylog {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
|
||||
private int orderId;
|
||||
|
||||
private long playlogId;
|
||||
|
||||
private int version;
|
||||
|
||||
private int placeId;
|
||||
|
||||
private String placeName;
|
||||
|
||||
private long loginDate;
|
||||
|
||||
private String playDate;
|
||||
|
||||
private String userPlayDate;
|
||||
|
||||
private int type;
|
||||
|
||||
private int musicId;
|
||||
|
||||
private int level;
|
||||
|
||||
private int trackNo;
|
||||
|
||||
private int vsMode;
|
||||
|
||||
private String vsUserName;
|
||||
|
||||
private int vsStatus;
|
||||
|
||||
private int vsUserRating;
|
||||
|
||||
private int vsUserAchievement;
|
||||
|
||||
private int vsUserGradeRank;
|
||||
|
||||
private int vsRank;
|
||||
|
||||
private int playerNum;
|
||||
|
||||
private long playedUserId1;
|
||||
|
||||
private String playedUserName1;
|
||||
|
||||
private int playedMusicLevel1;
|
||||
|
||||
private long playedUserId2;
|
||||
|
||||
private String playedUserName2;
|
||||
|
||||
private int playedMusicLevel2;
|
||||
|
||||
private long playedUserId3;
|
||||
|
||||
private String playedUserName3;
|
||||
|
||||
private int playedMusicLevel3;
|
||||
|
||||
private int characterId1;
|
||||
|
||||
private int characterLevel1;
|
||||
|
||||
private int characterAwakening1;
|
||||
|
||||
private int characterId2;
|
||||
|
||||
private int characterLevel2;
|
||||
|
||||
private int characterAwakening2;
|
||||
|
||||
private int characterId3;
|
||||
|
||||
private int characterLevel3;
|
||||
|
||||
private int characterAwakening3;
|
||||
|
||||
private int characterId4;
|
||||
|
||||
private int characterLevel4;
|
||||
|
||||
private int characterAwakening4;
|
||||
|
||||
private int characterId5;
|
||||
|
||||
private int characterLevel5;
|
||||
|
||||
private int characterAwakening5;
|
||||
|
||||
private int achievement;
|
||||
|
||||
private int deluxscore;
|
||||
|
||||
private int scoreRank;
|
||||
|
||||
// Maximum continuous combo that the player achieved in this play.
|
||||
private int maxCombo;
|
||||
|
||||
// Maximum achievable combo in the song.
|
||||
private int totalCombo;
|
||||
|
||||
private int maxSync;
|
||||
|
||||
private int totalSync;
|
||||
|
||||
private int tapCriticalPerfect;
|
||||
|
||||
private int tapPerfect;
|
||||
|
||||
private int tapGreat;
|
||||
|
||||
private int tapGood;
|
||||
|
||||
private int tapMiss;
|
||||
|
||||
private int holdCriticalPerfect;
|
||||
|
||||
private int holdPerfect;
|
||||
|
||||
private int holdGreat;
|
||||
|
||||
private int holdGood;
|
||||
|
||||
private int holdMiss;
|
||||
|
||||
private int slideCriticalPerfect;
|
||||
|
||||
private int slidePerfect;
|
||||
|
||||
private int slideGreat;
|
||||
|
||||
private int slideGood;
|
||||
|
||||
private int slideMiss;
|
||||
|
||||
private int touchCriticalPerfect;
|
||||
|
||||
private int touchPerfect;
|
||||
|
||||
private int touchGreat;
|
||||
|
||||
private int touchGood;
|
||||
|
||||
private int touchMiss;
|
||||
|
||||
private int breakCriticalPerfect;
|
||||
|
||||
private int breakPerfect;
|
||||
|
||||
private int breakGreat;
|
||||
|
||||
private int breakGood;
|
||||
|
||||
private int breakMiss;
|
||||
|
||||
@JsonProperty("isTap")
|
||||
private boolean isTap;
|
||||
|
||||
@JsonProperty("isHold")
|
||||
private boolean isHold;
|
||||
|
||||
@JsonProperty("isSlide")
|
||||
private boolean isSlide;
|
||||
|
||||
@JsonProperty("isTouch")
|
||||
private boolean isTouch;
|
||||
|
||||
@JsonProperty("isBreak")
|
||||
private boolean isBreak;
|
||||
|
||||
@JsonProperty("isCriticalDisp")
|
||||
private boolean isCriticalDisp;
|
||||
|
||||
@JsonProperty("isFastLateDisp")
|
||||
private boolean isFastLateDisp;
|
||||
|
||||
private int fastCount;
|
||||
|
||||
private int lateCount;
|
||||
|
||||
@JsonProperty("isAchieveNewRecord")
|
||||
private boolean isAchieveNewRecord;
|
||||
|
||||
@JsonProperty("isDeluxscoreNewRecord")
|
||||
private boolean isDeluxscoreNewRecord;
|
||||
|
||||
private int comboStatus;
|
||||
|
||||
private int syncStatus;
|
||||
|
||||
@JsonProperty("isClear")
|
||||
private boolean isClear;
|
||||
|
||||
private int beforeRating;
|
||||
|
||||
private int afterRating;
|
||||
|
||||
private int beforeGrade;
|
||||
|
||||
private int afterGrade;
|
||||
|
||||
private int afterGradeRank;
|
||||
|
||||
private int beforeDeluxRating;
|
||||
|
||||
private int afterDeluxRating;
|
||||
|
||||
@JsonProperty("isPlayTutorial")
|
||||
private boolean isPlayTutorial;
|
||||
|
||||
@JsonProperty("isEventMode")
|
||||
private boolean isEventMode;
|
||||
|
||||
@JsonProperty("isFreedomMode")
|
||||
private boolean isFreedomMode;
|
||||
|
||||
private int playMode;
|
||||
|
||||
@JsonProperty("isNewFree")
|
||||
private boolean isNewFree;
|
||||
|
||||
private int trialPlayAchievement;
|
||||
|
||||
private int extNum1;
|
||||
|
||||
private int extNum2;
|
||||
|
||||
private int extNum4;
|
||||
|
||||
@JsonProperty("extBool1")
|
||||
private boolean extBool1;
|
||||
|
||||
@Override
|
||||
public boolean isFullCombo() {
|
||||
return maxCombo == totalCombo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllPerfect() {
|
||||
return tapMiss + tapGood + tapGreat == 0
|
||||
&& holdMiss + holdGood + holdGreat == 0
|
||||
&& slideMiss + slideGood + slideGreat == 0
|
||||
&& touchMiss + touchGood + touchGreat == 0
|
||||
&& breakMiss + breakGood + breakGreat == 0;
|
||||
}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2UserPrintDetail")
|
||||
@Table(name = "maimai2_user_print_detail")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserPrintDetail implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
private long orderId;
|
||||
private int printNumber;
|
||||
private String printDate;
|
||||
private String serialId;
|
||||
private int placeId;
|
||||
private String clientId;
|
||||
private String printerSerialId;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_card_id")
|
||||
private UserCard userCard;
|
||||
private int cardRomVersion;
|
||||
private boolean isHolograph;
|
||||
private boolean printOption1;
|
||||
private boolean printOption2;
|
||||
private boolean printOption3;
|
||||
private boolean printOption4;
|
||||
private boolean printOption5;
|
||||
private boolean printOption6;
|
||||
private boolean printOption7;
|
||||
private boolean printOption8;
|
||||
private boolean printOption9;
|
||||
private boolean printOption10;
|
||||
private String created;
|
||||
|
||||
public UserPrintDetail(UserDetail user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserRate {
|
||||
private int musicId;
|
||||
private int level;
|
||||
private int romVersion;
|
||||
private int achievement;
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.userdata;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "Maimai2UserUdemae")
|
||||
@Table(name = "maimai2_user_udemae")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserUdemae implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserDetail user;
|
||||
|
||||
private int rate;
|
||||
private int maxRate;
|
||||
private int classValue;
|
||||
private int maxClassValue;
|
||||
private int totalWinNum;
|
||||
private int totalLoseNum;
|
||||
private int maxWinNum;
|
||||
private int maxLoseNum;
|
||||
private int winNum;
|
||||
private int loseNum;
|
||||
private int npcTotalWinNum;
|
||||
private int npcTotalLoseNum;
|
||||
private int npcMaxWinNum;
|
||||
private int npcMaxLoseNum;
|
||||
private int npcWinNum;
|
||||
private int npcLoseNum;
|
||||
|
||||
public UserUdemae(UserDetail user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue