mirror of https://github.com/hykilpikonna/AquaDX
[+] Ongeki: Solve Re:Fresh conflicts
parent
278b0205fc
commit
a2b27090db
|
@ -6,6 +6,8 @@ import icu.samnyan.aqua.net.games.GenericUserDataRepo
|
||||||
import icu.samnyan.aqua.net.games.GenericUserMusicRepo
|
import icu.samnyan.aqua.net.games.GenericUserMusicRepo
|
||||||
import icu.samnyan.aqua.net.games.IUserRepo
|
import icu.samnyan.aqua.net.games.IUserRepo
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.*
|
import icu.samnyan.aqua.sega.ongeki.model.*
|
||||||
|
import icu.samnyan.aqua.sega.ongeki.model.UserEventMap
|
||||||
|
import icu.samnyan.aqua.sega.ongeki.model.UserSkin
|
||||||
import org.springframework.data.domain.Page
|
import org.springframework.data.domain.Page
|
||||||
import org.springframework.data.domain.Pageable
|
import org.springframework.data.domain.Pageable
|
||||||
import org.springframework.data.jpa.repository.JpaRepository
|
import org.springframework.data.jpa.repository.JpaRepository
|
||||||
|
@ -144,6 +146,10 @@ interface OgkUserTrainingRoomRepo : OngekiUserLinked<UserTrainingRoom> {
|
||||||
fun findByUserAndRoomId(user: UserData, roomId: Int): Optional<UserTrainingRoom>
|
fun findByUserAndRoomId(user: UserData, roomId: Int): Optional<UserTrainingRoom>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Re:Fresh
|
||||||
|
interface OgkUserEventMapRepo : OngekiUserLinked<UserEventMap>
|
||||||
|
interface OgkUserSkinRepo : OngekiUserLinked<UserSkin>
|
||||||
|
|
||||||
interface OgkGameCardRepo : JpaRepository<GameCard, Long>
|
interface OgkGameCardRepo : JpaRepository<GameCard, Long>
|
||||||
interface OgkGameCharaRepo : JpaRepository<GameChara, Long>
|
interface OgkGameCharaRepo : JpaRepository<GameChara, Long>
|
||||||
interface OgkGameEventRepo : JpaRepository<GameEvent, Long>
|
interface OgkGameEventRepo : JpaRepository<GameEvent, Long>
|
||||||
|
@ -181,6 +187,8 @@ class OngekiUserRepos(
|
||||||
val techEvent: OgkUserTechEventRepo,
|
val techEvent: OgkUserTechEventRepo,
|
||||||
val tradeItem: OgkUserTradeItemRepo,
|
val tradeItem: OgkUserTradeItemRepo,
|
||||||
val trainingRoom: OgkUserTrainingRoomRepo,
|
val trainingRoom: OgkUserTrainingRoomRepo,
|
||||||
|
val eventMap: OgkUserEventMapRepo,
|
||||||
|
val skin: OgkUserSkinRepo,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
|
||||||
|
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserEventMap;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
|
||||||
*/
|
|
||||||
@Repository("OngekiUserEventMapRepository")
|
|
||||||
public interface UserEventMapRepository extends JpaRepository<UserEventMap, Long> {
|
|
||||||
|
|
||||||
Optional<UserEventMap> findByUser(UserData userData);
|
|
||||||
|
|
||||||
Optional<UserEventMap> findByUser_Card_ExtId(long userId);
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
void deleteByUser(UserData user);
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
|
||||||
|
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserSkin;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
|
||||||
*/
|
|
||||||
@Repository("OngekiUserSkinRepository")
|
|
||||||
public interface UserSkinRepository extends JpaRepository<UserSkin, Long> {
|
|
||||||
|
|
||||||
List<UserSkin> findByUser_Card_ExtId(long userId);
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
void deleteByUser(UserData user);
|
|
||||||
}
|
|
|
@ -2,7 +2,7 @@ package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||||
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserEventMapRepository;
|
import icu.samnyan.aqua.sega.ongeki.OgkUserEventMapRepo;
|
||||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -22,10 +22,10 @@ public class GetUserEventMapHandler implements BaseHandler {
|
||||||
|
|
||||||
private final BasicMapper mapper;
|
private final BasicMapper mapper;
|
||||||
|
|
||||||
private final UserEventMapRepository userEventMapRepository;
|
private final OgkUserEventMapRepo userEventMapRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public GetUserEventMapHandler(BasicMapper mapper, UserEventMapRepository userEventMapRepository) {
|
public GetUserEventMapHandler(BasicMapper mapper, OgkUserEventMapRepo userEventMapRepository) {
|
||||||
this.mapper = mapper;
|
this.mapper = mapper;
|
||||||
this.userEventMapRepository = userEventMapRepository;
|
this.userEventMapRepository = userEventMapRepository;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||||
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserSkinRepository;
|
import icu.samnyan.aqua.sega.ongeki.OgkUserSkinRepo;
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserSkin;
|
import icu.samnyan.aqua.sega.ongeki.model.UserSkin;
|
||||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -24,10 +24,10 @@ public class GetUserSkinHandler implements BaseHandler {
|
||||||
|
|
||||||
private final BasicMapper mapper;
|
private final BasicMapper mapper;
|
||||||
|
|
||||||
private final UserSkinRepository userSkinRepository;
|
private final OgkUserSkinRepo userSkinRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public GetUserSkinHandler(BasicMapper mapper, UserSkinRepository userSkinRepository) {
|
public GetUserSkinHandler(BasicMapper mapper, OgkUserSkinRepo userSkinRepository) {
|
||||||
this.mapper = mapper;
|
this.mapper = mapper;
|
||||||
this.userSkinRepository = userSkinRepository;
|
this.userSkinRepository = userSkinRepository;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,634 +0,0 @@
|
||||||
package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
|
||||||
import icu.samnyan.aqua.sega.general.model.Card;
|
|
||||||
import icu.samnyan.aqua.sega.general.model.response.UserRecentRating;
|
|
||||||
import icu.samnyan.aqua.sega.general.service.CardService;
|
|
||||||
import icu.samnyan.aqua.sega.ongeki.dao.userdata.*;
|
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.gamedata.OngekiFumenScore;
|
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.request.UpsertUserAll;
|
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.response.CodeResp;
|
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.*;
|
|
||||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The handler for saving all data of a ONGEKI profile
|
|
||||||
*
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
|
||||||
*/
|
|
||||||
@Component("OngekiUserAllHandler")
|
|
||||||
public class UpsertUserAllHandler implements BaseHandler {
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(UpsertUserAllHandler.class);
|
|
||||||
|
|
||||||
private final BasicMapper mapper;
|
|
||||||
|
|
||||||
private final CardService cardService;
|
|
||||||
|
|
||||||
private final UserDataRepository userDataRepository;
|
|
||||||
private final UserOptionRepository userOptionRepository;
|
|
||||||
private final UserPlaylogRepository userPlaylogRepository;
|
|
||||||
private final UserActivityRepository userActivityRepository;
|
|
||||||
private final UserMusicDetailRepository userMusicDetailRepository;
|
|
||||||
private final UserCharacterRepository userCharacterRepository;
|
|
||||||
private final UserCardRepository userCardRepository;
|
|
||||||
private final UserDeckRepository userDeckRepository;
|
|
||||||
private final UserStoryRepository userStoryRepository;
|
|
||||||
private final UserChapterRepository userChapterRepository;
|
|
||||||
private final UserMemoryChapterRepository userMemoryChapterRepository;
|
|
||||||
private final UserItemRepository userItemRepository;
|
|
||||||
private final UserMusicItemRepository userMusicItemRepository;
|
|
||||||
private final UserLoginBonusRepository userLoginBonusRepository;
|
|
||||||
private final UserEventPointRepository userEventPointRepository;
|
|
||||||
private final UserMissionPointRepository userMissionPointRepository;
|
|
||||||
private final UserTrainingRoomRepository userTrainingRoomRepository;
|
|
||||||
private final UserGeneralDataRepository userGeneralDataRepository;
|
|
||||||
private final UserBossRepository userBossRepository;
|
|
||||||
private final UserScenarioRepository userScenarioRepository;
|
|
||||||
private final UserTechCountRepository userTechCountRepository;
|
|
||||||
private final UserTradeItemRepository userTradeItemRepository;
|
|
||||||
private final UserEventMusicRepository userEventMusicRepository;
|
|
||||||
private final UserTechEventRepository userTechEventRepository;
|
|
||||||
private final UserKopRepository userKopRepository;
|
|
||||||
private final UserEventMapRepository userEventMapRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public UpsertUserAllHandler(BasicMapper mapper,
|
|
||||||
CardService cardService, UserDataRepository userDataRepository, UserOptionRepository userOptionRepository, UserPlaylogRepository userPlaylogRepository, UserActivityRepository userActivityRepository, UserMusicDetailRepository userMusicDetailRepository, UserCharacterRepository userCharacterRepository, UserCardRepository userCardRepository, UserDeckRepository userDeckRepository, UserStoryRepository userStoryRepository, UserChapterRepository userChapterRepository, UserItemRepository userItemRepository, UserMusicItemRepository userMusicItemRepository, UserLoginBonusRepository userLoginBonusRepository, UserEventPointRepository userEventPointRepository, UserMissionPointRepository userMissionPointRepository, UserTrainingRoomRepository userTrainingRoomRepository, UserGeneralDataRepository userGeneralDataRepository, UserBossRepository userBossRepository, UserScenarioRepository userScenarioRepository, UserTechCountRepository userTechCountRepository, UserTradeItemRepository userTradeItemRepository, UserEventMusicRepository userEventMusicRepository, UserTechEventRepository userTechEventRepository, UserKopRepository userKopRepository, UserMemoryChapterRepository userMemoryChapterRepository, UserEventMapRepository userEventMapRepository) {
|
|
||||||
this.mapper = mapper;
|
|
||||||
this.cardService = cardService;
|
|
||||||
this.userDataRepository = userDataRepository;
|
|
||||||
this.userOptionRepository = userOptionRepository;
|
|
||||||
this.userPlaylogRepository = userPlaylogRepository;
|
|
||||||
this.userActivityRepository = userActivityRepository;
|
|
||||||
this.userMusicDetailRepository = userMusicDetailRepository;
|
|
||||||
this.userCharacterRepository = userCharacterRepository;
|
|
||||||
this.userCardRepository = userCardRepository;
|
|
||||||
this.userDeckRepository = userDeckRepository;
|
|
||||||
this.userStoryRepository = userStoryRepository;
|
|
||||||
this.userChapterRepository = userChapterRepository;
|
|
||||||
this.userMemoryChapterRepository = userMemoryChapterRepository;
|
|
||||||
this.userItemRepository = userItemRepository;
|
|
||||||
this.userMusicItemRepository = userMusicItemRepository;
|
|
||||||
this.userLoginBonusRepository = userLoginBonusRepository;
|
|
||||||
this.userEventPointRepository = userEventPointRepository;
|
|
||||||
this.userMissionPointRepository = userMissionPointRepository;
|
|
||||||
this.userTrainingRoomRepository = userTrainingRoomRepository;
|
|
||||||
this.userGeneralDataRepository = userGeneralDataRepository;
|
|
||||||
this.userBossRepository = userBossRepository;
|
|
||||||
this.userScenarioRepository = userScenarioRepository;
|
|
||||||
this.userTechCountRepository = userTechCountRepository;
|
|
||||||
this.userTradeItemRepository = userTradeItemRepository;
|
|
||||||
this.userEventMusicRepository = userEventMusicRepository;
|
|
||||||
this.userTechEventRepository = userTechEventRepository;
|
|
||||||
this.userKopRepository = userKopRepository;
|
|
||||||
this.userEventMapRepository = userEventMapRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String handle(Map<String, ?> request) throws JsonProcessingException {
|
|
||||||
long userId = ((Number) request.get("userId")).longValue();
|
|
||||||
UpsertUserAll upsertUserAll = mapper.convert(request.get("upsertUserAll"), UpsertUserAll.class);
|
|
||||||
|
|
||||||
// All the field should exist, no need to check now.
|
|
||||||
// UserData
|
|
||||||
UserData newUserData;
|
|
||||||
{
|
|
||||||
UserData userData;
|
|
||||||
|
|
||||||
Optional<UserData> userOptional = userDataRepository.findByCard_ExtId(userId);
|
|
||||||
|
|
||||||
// UserData might be empty on later runs
|
|
||||||
if (userOptional.isEmpty() && upsertUserAll.getUserData().isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (userOptional.isPresent()) {
|
|
||||||
userData = userOptional.get();
|
|
||||||
} else {
|
|
||||||
userData = new UserData();
|
|
||||||
Card card = cardService.getCardByExtId(userId).orElseThrow();
|
|
||||||
userData.setCard(card);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If new data exists, use new data. Otherwise, use old data
|
|
||||||
newUserData = !upsertUserAll.getUserData().isEmpty() ? upsertUserAll.getUserData().getFirst() : userData;
|
|
||||||
|
|
||||||
newUserData.setId(userData.getId());
|
|
||||||
newUserData.setCard(userData.getCard());
|
|
||||||
|
|
||||||
// Set eventWatchedDate with lastPlayDate, because client doesn't update it
|
|
||||||
newUserData.setEventWatchedDate(userData.getLastPlayDate());
|
|
||||||
newUserData.setCmEventWatchedDate(userData.getLastPlayDate());
|
|
||||||
|
|
||||||
userDataRepository.save(newUserData);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// UserOption
|
|
||||||
UserOption newUserOption = upsertUserAll.getUserOption().getFirst();
|
|
||||||
|
|
||||||
Optional<UserOption> userOptionOptional = userOptionRepository.findByUser(newUserData);
|
|
||||||
UserOption userOption = userOptionOptional.orElseGet(() -> new UserOption(newUserData));
|
|
||||||
|
|
||||||
newUserOption.setId(userOption.getId());
|
|
||||||
newUserOption.setUser(userOption.getUser());
|
|
||||||
|
|
||||||
userOptionRepository.save(newUserOption);
|
|
||||||
|
|
||||||
|
|
||||||
// UserPlaylogList
|
|
||||||
List<UserPlaylog> userPlaylogList = upsertUserAll.getUserPlaylogList();
|
|
||||||
List<UserPlaylog> newUserPlaylogList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (UserPlaylog newUserPlaylog : userPlaylogList) {
|
|
||||||
newUserPlaylog.setUser(newUserData);
|
|
||||||
newUserPlaylogList.add(newUserPlaylog);
|
|
||||||
}
|
|
||||||
|
|
||||||
userPlaylogRepository.saveAll(newUserPlaylogList);
|
|
||||||
|
|
||||||
|
|
||||||
// UserSessionlogList, UserJewelboostlogLost doesn't need to be saved for a private server
|
|
||||||
|
|
||||||
|
|
||||||
// UserActivityList
|
|
||||||
List<UserActivity> userActivityList = upsertUserAll.getUserActivityList();
|
|
||||||
List<UserActivity> newUserActivityList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (UserActivity newUserActivity : userActivityList) {
|
|
||||||
int kind = newUserActivity.getKind();
|
|
||||||
int id = newUserActivity.getActivityId();
|
|
||||||
|
|
||||||
if (kind != 0 && id != 0) {
|
|
||||||
Optional<UserActivity> activityOptional = userActivityRepository.findByUserAndKindAndActivityId(newUserData, kind, id);
|
|
||||||
UserActivity userActivity = activityOptional.orElseGet(() -> new UserActivity(newUserData));
|
|
||||||
|
|
||||||
newUserActivity.setId(userActivity.getId());
|
|
||||||
newUserActivity.setUser(newUserData);
|
|
||||||
newUserActivityList.add(newUserActivity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
newUserActivityList.sort((a, b) -> Integer.compare(b.getSortNumber(), a.getSortNumber()));
|
|
||||||
userActivityRepository.saveAll(newUserActivityList);
|
|
||||||
|
|
||||||
|
|
||||||
// UserRecentRatingList
|
|
||||||
// This thing still need to save to solve the rating drop
|
|
||||||
this.saveRecentRatingData(upsertUserAll.getUserRecentRatingList(), newUserData, "recent_rating_list");
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The rating and battle point calculation is little bit complex.
|
|
||||||
* So I just create a UserGeneralData class to store this value
|
|
||||||
* into a csv format for convenience
|
|
||||||
*/
|
|
||||||
// UserBpBaseList (For calculating Battle point)
|
|
||||||
this.saveRecentRatingData(upsertUserAll.getUserBpBaseList(), newUserData, "battle_point_base");
|
|
||||||
|
|
||||||
|
|
||||||
// This is the best rating of all charts. Best 30 + 10 after that.
|
|
||||||
// userRatingBaseBestList
|
|
||||||
this.saveRecentRatingData(upsertUserAll.getUserRatingBaseBestList(), newUserData, "rating_base_best");
|
|
||||||
|
|
||||||
|
|
||||||
// userRatingBaseNextList
|
|
||||||
this.saveRecentRatingData(upsertUserAll.getUserRatingBaseNextList(), newUserData, "rating_base_next");
|
|
||||||
|
|
||||||
|
|
||||||
// This is the best rating of new charts. Best 15 + 10 after that.
|
|
||||||
// New chart means same version
|
|
||||||
// userRatingBaseBestNewList
|
|
||||||
this.saveRecentRatingData(upsertUserAll.getUserRatingBaseBestNewList(), newUserData, "rating_base_new_best");
|
|
||||||
|
|
||||||
// userRatingBaseNextNewList
|
|
||||||
this.saveRecentRatingData(upsertUserAll.getUserRatingBaseNextNewList(), newUserData, "rating_base_new_next");
|
|
||||||
|
|
||||||
// This is the recent best
|
|
||||||
// userRatingBaseHotList
|
|
||||||
this.saveRecentRatingData(upsertUserAll.getUserRatingBaseHotList(), newUserData, "rating_base_hot_best");
|
|
||||||
|
|
||||||
// userRatingBaseHotNextList
|
|
||||||
this.saveRecentRatingData(upsertUserAll.getUserRatingBaseHotNextList(), newUserData, "rating_base_hot_next");
|
|
||||||
|
|
||||||
this.saveFumenScoreData(upsertUserAll.getUserNewRatingBaseBestList(), newUserData, "new_rating_base_best");
|
|
||||||
|
|
||||||
this.saveFumenScoreData(upsertUserAll.getUserNewRatingBaseNextBestList(), newUserData, "new_rating_base_next_best");
|
|
||||||
|
|
||||||
this.saveFumenScoreData(upsertUserAll.getUserNewRatingBaseBestNewList(), newUserData, "new_rating_base_new_best");
|
|
||||||
|
|
||||||
this.saveFumenScoreData(upsertUserAll.getUserNewRatingBaseNextBestNewList(), newUserData, "new_rating_base_new_next_best");
|
|
||||||
|
|
||||||
this.saveFumenScoreData(upsertUserAll.getUserNewRatingBasePScoreList(), newUserData, "new_rating_base_pscore");
|
|
||||||
|
|
||||||
this.saveFumenScoreData(upsertUserAll.getUserNewRatingBaseNextPScoreList(), newUserData, "new_rating_base_next_pscore");
|
|
||||||
|
|
||||||
// UserMusicDetailList
|
|
||||||
List<UserMusicDetail> userMusicDetailList = upsertUserAll.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);
|
|
||||||
|
|
||||||
|
|
||||||
// UserCharacterList
|
|
||||||
List<UserCharacter> userCharacterList = upsertUserAll.getUserCharacterList();
|
|
||||||
List<UserCharacter> newUserCharacterList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (UserCharacter newUserCharacter : userCharacterList) {
|
|
||||||
int characterId = newUserCharacter.getCharacterId();
|
|
||||||
|
|
||||||
Optional<UserCharacter> characterOptional = userCharacterRepository.findByUserAndCharacterId(newUserData, characterId);
|
|
||||||
UserCharacter userCharacter = characterOptional.orElseGet(() -> new UserCharacter(newUserData));
|
|
||||||
|
|
||||||
newUserCharacter.setId(userCharacter.getId());
|
|
||||||
newUserCharacter.setUser(newUserData);
|
|
||||||
newUserCharacterList.add(newUserCharacter);
|
|
||||||
}
|
|
||||||
userCharacterRepository.saveAll(newUserCharacterList);
|
|
||||||
|
|
||||||
// UserCardList
|
|
||||||
List<UserCard> userCardList = upsertUserAll.getUserCardList();
|
|
||||||
List<UserCard> newUserCardList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (UserCard newUserCard : userCardList) {
|
|
||||||
int cardId = newUserCard.getCardId();
|
|
||||||
|
|
||||||
Optional<UserCard> cardOptional = userCardRepository.findByUserAndCardId(newUserData, cardId);
|
|
||||||
UserCard userCard = cardOptional.orElseGet(() -> new UserCard(newUserData));
|
|
||||||
|
|
||||||
newUserCard.setId(userCard.getId());
|
|
||||||
newUserCard.setUser(newUserData);
|
|
||||||
newUserCardList.add(newUserCard);
|
|
||||||
}
|
|
||||||
userCardRepository.saveAll(newUserCardList);
|
|
||||||
|
|
||||||
|
|
||||||
// UserDeckList
|
|
||||||
List<UserDeck> userDeckList = upsertUserAll.getUserDeckList();
|
|
||||||
List<UserDeck> newUserDeckList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (UserDeck newUserDeck : userDeckList) {
|
|
||||||
int deckId = newUserDeck.getDeckId();
|
|
||||||
|
|
||||||
Optional<UserDeck> deckOptional = userDeckRepository.findByUserAndDeckId(newUserData, deckId);
|
|
||||||
UserDeck userDeck = deckOptional.orElseGet(() -> new UserDeck(newUserData));
|
|
||||||
|
|
||||||
newUserDeck.setId(userDeck.getId());
|
|
||||||
newUserDeck.setUser(newUserData);
|
|
||||||
newUserDeckList.add(newUserDeck);
|
|
||||||
}
|
|
||||||
userDeckRepository.saveAll(newUserDeckList);
|
|
||||||
|
|
||||||
|
|
||||||
// userTrainingRoomList
|
|
||||||
List<UserTrainingRoom> userTrainingRoomList = upsertUserAll.getUserTrainingRoomList();
|
|
||||||
List<UserTrainingRoom> newUserTrainingRoomList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (UserTrainingRoom newUserTrainingRoom : userTrainingRoomList) {
|
|
||||||
int roomId = newUserTrainingRoom.getRoomId();
|
|
||||||
|
|
||||||
Optional<UserTrainingRoom> trainingRoomOptional = userTrainingRoomRepository.findByUserAndRoomId(newUserData, roomId);
|
|
||||||
UserTrainingRoom trainingRoom = trainingRoomOptional.orElseGet(() -> new UserTrainingRoom(newUserData));
|
|
||||||
|
|
||||||
newUserTrainingRoom.setId(trainingRoom.getId());
|
|
||||||
newUserTrainingRoom.setUser(newUserData);
|
|
||||||
newUserTrainingRoomList.add(newUserTrainingRoom);
|
|
||||||
}
|
|
||||||
userTrainingRoomRepository.saveAll(newUserTrainingRoomList);
|
|
||||||
|
|
||||||
|
|
||||||
// UserStoryList
|
|
||||||
List<UserStory> userStoryList = upsertUserAll.getUserStoryList();
|
|
||||||
List<UserStory> newUserStoryList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (UserStory newUserStory : userStoryList) {
|
|
||||||
int storyId = newUserStory.getStoryId();
|
|
||||||
|
|
||||||
Optional<UserStory> storyOptional = userStoryRepository.findByUserAndStoryId(newUserData, storyId);
|
|
||||||
UserStory userStory = storyOptional.orElseGet(() -> new UserStory(newUserData));
|
|
||||||
|
|
||||||
newUserStory.setId(userStory.getId());
|
|
||||||
newUserStory.setUser(newUserData);
|
|
||||||
newUserStoryList.add(newUserStory);
|
|
||||||
}
|
|
||||||
userStoryRepository.saveAll(newUserStoryList);
|
|
||||||
|
|
||||||
|
|
||||||
// UserChapterList
|
|
||||||
List<UserChapter> userChapterList = upsertUserAll.getUserChapterList();
|
|
||||||
List<UserChapter> newUserChapterList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (UserChapter newUserChapter : userChapterList) {
|
|
||||||
int chapterId = newUserChapter.getChapterId();
|
|
||||||
|
|
||||||
Optional<UserChapter> chapterOptional = userChapterRepository.findByUserAndChapterId(newUserData, chapterId);
|
|
||||||
UserChapter userChapter = chapterOptional.orElseGet(() -> new UserChapter(newUserData));
|
|
||||||
|
|
||||||
newUserChapter.setId(userChapter.getId());
|
|
||||||
newUserChapter.setUser(newUserData);
|
|
||||||
newUserChapterList.add(newUserChapter);
|
|
||||||
}
|
|
||||||
userChapterRepository.saveAll(newUserChapterList);
|
|
||||||
|
|
||||||
|
|
||||||
// UserMemoryChapterList
|
|
||||||
List<UserMemoryChapter> userMemoryChapterList = upsertUserAll.getUserMemoryChapterList();
|
|
||||||
|
|
||||||
if (userMemoryChapterList != null) {
|
|
||||||
List<UserMemoryChapter> newUserMemoryChapterList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (UserMemoryChapter newUserMemoryChapter : userMemoryChapterList) {
|
|
||||||
int chapterId = newUserMemoryChapter.getChapterId();
|
|
||||||
|
|
||||||
Optional<UserMemoryChapter> chapterOptional = userMemoryChapterRepository.findByUserAndChapterId(newUserData, chapterId);
|
|
||||||
UserMemoryChapter userChapter = chapterOptional.orElseGet(() -> new UserMemoryChapter(newUserData));
|
|
||||||
|
|
||||||
newUserMemoryChapter.setId(userChapter.getId());
|
|
||||||
newUserMemoryChapter.setUser(newUserData);
|
|
||||||
newUserMemoryChapterList.add(newUserMemoryChapter);
|
|
||||||
}
|
|
||||||
userMemoryChapterRepository.saveAll(newUserMemoryChapterList);
|
|
||||||
}
|
|
||||||
|
|
||||||
// UserItemList
|
|
||||||
List<UserItem> userItemList = upsertUserAll.getUserItemList();
|
|
||||||
List<UserItem> newUserItemList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (UserItem newUserItem : userItemList) {
|
|
||||||
int itemKind = newUserItem.getItemKind();
|
|
||||||
int itemId = newUserItem.getItemId();
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
// UserMusicItemList
|
|
||||||
List<UserMusicItem> userMusicItemList = upsertUserAll.getUserMusicItemList();
|
|
||||||
List<UserMusicItem> newUserMusicItemList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (UserMusicItem newUserMusicItem : userMusicItemList) {
|
|
||||||
int musicId = newUserMusicItem.getMusicId();
|
|
||||||
|
|
||||||
Optional<UserMusicItem> musicItemOptional = userMusicItemRepository.findByUserAndMusicId(newUserData, musicId);
|
|
||||||
UserMusicItem userMusicItem = musicItemOptional.orElseGet(() -> new UserMusicItem(newUserData));
|
|
||||||
|
|
||||||
newUserMusicItem.setId(userMusicItem.getId());
|
|
||||||
newUserMusicItem.setUser(newUserData);
|
|
||||||
newUserMusicItemList.add(newUserMusicItem);
|
|
||||||
}
|
|
||||||
userMusicItemRepository.saveAll(newUserMusicItemList);
|
|
||||||
|
|
||||||
|
|
||||||
// userLoginBonusList
|
|
||||||
List<UserLoginBonus> userLoginBonusList = upsertUserAll.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);
|
|
||||||
|
|
||||||
|
|
||||||
// UserEventPointList
|
|
||||||
List<UserEventPoint> userEventPointList = upsertUserAll.getUserEventPointList();
|
|
||||||
List<UserEventPoint> newUserEventPointList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (UserEventPoint newUserEventPoint : userEventPointList) {
|
|
||||||
int eventId = newUserEventPoint.getEventId();
|
|
||||||
|
|
||||||
Optional<UserEventPoint> eventPointOptional = userEventPointRepository.findByUserAndEventId(newUserData, eventId);
|
|
||||||
UserEventPoint userEventPoint = eventPointOptional.orElseGet(() -> new UserEventPoint(newUserData));
|
|
||||||
|
|
||||||
newUserEventPoint.setId(userEventPoint.getId());
|
|
||||||
newUserEventPoint.setUser(newUserData);
|
|
||||||
newUserEventPointList.add(newUserEventPoint);
|
|
||||||
}
|
|
||||||
userEventPointRepository.saveAll(newUserEventPointList);
|
|
||||||
|
|
||||||
|
|
||||||
// UserMissionPointList
|
|
||||||
List<UserMissionPoint> userMissionPointList = upsertUserAll.getUserMissionPointList();
|
|
||||||
List<UserMissionPoint> newUserMissionPointList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (UserMissionPoint newUserMissionPoint : userMissionPointList) {
|
|
||||||
int eventId = newUserMissionPoint.getEventId();
|
|
||||||
|
|
||||||
Optional<UserMissionPoint> userMissionPointOptional = userMissionPointRepository.findByUserAndEventId(newUserData, eventId);
|
|
||||||
UserMissionPoint userMissionPoint = userMissionPointOptional.orElseGet(() -> new UserMissionPoint(newUserData));
|
|
||||||
|
|
||||||
newUserMissionPoint.setId(userMissionPoint.getId());
|
|
||||||
newUserMissionPoint.setUser(newUserData);
|
|
||||||
newUserMissionPointList.add(newUserMissionPoint);
|
|
||||||
}
|
|
||||||
userMissionPointRepository.saveAll(newUserMissionPointList);
|
|
||||||
|
|
||||||
// UserRatinglogList (For the highest rating of each version)
|
|
||||||
|
|
||||||
// UserBossList
|
|
||||||
List<UserBoss> userBossList = upsertUserAll.getUserBossList();
|
|
||||||
if (userBossList != null) {
|
|
||||||
List<UserBoss> newUserBossList = new ArrayList<>();
|
|
||||||
for (UserBoss newUserBoss : userBossList) {
|
|
||||||
int musicId = newUserBoss.getMusicId();
|
|
||||||
|
|
||||||
Optional<UserBoss> userBossOptional = userBossRepository.findByUserAndMusicId(newUserData, musicId);
|
|
||||||
UserBoss userBoss = userBossOptional.orElseGet(() -> new UserBoss(newUserData));
|
|
||||||
|
|
||||||
newUserBoss.setId(userBoss.getId());
|
|
||||||
newUserBoss.setUser(userBoss.getUser());
|
|
||||||
newUserBossList.add(newUserBoss);
|
|
||||||
}
|
|
||||||
userBossRepository.saveAll(newUserBossList);
|
|
||||||
}
|
|
||||||
|
|
||||||
// UserTechCountList
|
|
||||||
List<UserTechCount> userTechCountList = upsertUserAll.getUserTechCountList();
|
|
||||||
if (userTechCountList != null) {
|
|
||||||
List<UserTechCount> newUserTechCountList = new ArrayList<>();
|
|
||||||
for (UserTechCount newUserTechCount : userTechCountList) {
|
|
||||||
int levelId = newUserTechCount.getLevelId();
|
|
||||||
|
|
||||||
Optional<UserTechCount> userTechCountOptional = userTechCountRepository.findByUserAndLevelId(newUserData, levelId);
|
|
||||||
UserTechCount userTechCount = userTechCountOptional.orElseGet(() -> new UserTechCount(newUserData));
|
|
||||||
|
|
||||||
newUserTechCount.setId(userTechCount.getId());
|
|
||||||
newUserTechCount.setUser(userTechCount.getUser());
|
|
||||||
newUserTechCountList.add(newUserTechCount);
|
|
||||||
}
|
|
||||||
userTechCountRepository.saveAll(newUserTechCountList);
|
|
||||||
}
|
|
||||||
|
|
||||||
// UserScenarioList
|
|
||||||
List<UserScenario> userScenarioList = upsertUserAll.getUserScenarioList();
|
|
||||||
if (userScenarioList != null) {
|
|
||||||
List<UserScenario> newUserScenarioList = new ArrayList<>();
|
|
||||||
for (UserScenario newUserScenario : userScenarioList) {
|
|
||||||
int scenarioId = newUserScenario.getScenarioId();
|
|
||||||
|
|
||||||
Optional<UserScenario> userScenarioOptional = userScenarioRepository.findByUserAndScenarioId(newUserData, scenarioId);
|
|
||||||
UserScenario userScenario = userScenarioOptional.orElseGet(() -> new UserScenario(newUserData));
|
|
||||||
|
|
||||||
newUserScenario.setId(userScenario.getId());
|
|
||||||
newUserScenario.setUser(userScenario.getUser());
|
|
||||||
newUserScenarioList.add(newUserScenario);
|
|
||||||
}
|
|
||||||
userScenarioRepository.saveAll(newUserScenarioList);
|
|
||||||
}
|
|
||||||
|
|
||||||
// UserTradeItemList
|
|
||||||
List<UserTradeItem> userTradeItemList = upsertUserAll.getUserTradeItemList();
|
|
||||||
List<UserTradeItem> newUserTradeItemList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (UserTradeItem newUserTradeItem : userTradeItemList) {
|
|
||||||
int chapterId = newUserTradeItem.getChapterId();
|
|
||||||
int tradeItemId = newUserTradeItem.getTradeItemId();
|
|
||||||
|
|
||||||
Optional<UserTradeItem> tradeItemOptional = userTradeItemRepository.findByUserAndChapterIdAndTradeItemId(newUserData, chapterId, tradeItemId);
|
|
||||||
UserTradeItem userTradeItem = tradeItemOptional.orElseGet(() -> new UserTradeItem(newUserData));
|
|
||||||
|
|
||||||
newUserTradeItem.setId(userTradeItem.getId());
|
|
||||||
newUserTradeItem.setUser(newUserData);
|
|
||||||
newUserTradeItemList.add(newUserTradeItem);
|
|
||||||
}
|
|
||||||
userTradeItemRepository.saveAll(newUserTradeItemList);
|
|
||||||
|
|
||||||
// UserEventMusicList
|
|
||||||
List<UserEventMusic> userEventMusicList = upsertUserAll.getUserEventMusicList();
|
|
||||||
List<UserEventMusic> newUserEventMusicList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (UserEventMusic newUserEventMusic : userEventMusicList) {
|
|
||||||
int eventId = newUserEventMusic.getEventId();
|
|
||||||
int type = newUserEventMusic.getType();
|
|
||||||
int musicId = newUserEventMusic.getMusicId();
|
|
||||||
|
|
||||||
Optional<UserEventMusic> eventMusicOptional = userEventMusicRepository.findByUserAndEventIdAndTypeAndMusicId(newUserData, eventId, type, musicId);
|
|
||||||
UserEventMusic userEventMusic = eventMusicOptional.orElseGet(() -> new UserEventMusic(newUserData));
|
|
||||||
|
|
||||||
newUserEventMusic.setId(userEventMusic.getId());
|
|
||||||
newUserEventMusic.setUser(newUserData);
|
|
||||||
newUserEventMusicList.add(newUserEventMusic);
|
|
||||||
}
|
|
||||||
userEventMusicRepository.saveAll(newUserEventMusicList);
|
|
||||||
|
|
||||||
// UserTechEventList
|
|
||||||
List<UserTechEvent> userTechEventList = upsertUserAll.getUserTechEventList();
|
|
||||||
List<UserTechEvent> newUserTechEventList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (UserTechEvent newUserTechEvent : userTechEventList) {
|
|
||||||
int eventId = newUserTechEvent.getEventId();
|
|
||||||
|
|
||||||
Optional<UserTechEvent> techEventOptional = userTechEventRepository.findByUserAndEventId(newUserData, eventId);
|
|
||||||
UserTechEvent userTechEvent = techEventOptional.orElseGet(() -> new UserTechEvent(newUserData));
|
|
||||||
|
|
||||||
newUserTechEvent.setId(userTechEvent.getId());
|
|
||||||
newUserTechEvent.setUser(newUserData);
|
|
||||||
newUserTechEventList.add(newUserTechEvent);
|
|
||||||
}
|
|
||||||
userTechEventRepository.saveAll(newUserTechEventList);
|
|
||||||
|
|
||||||
// UserKopList
|
|
||||||
List<UserKop> userKopList = upsertUserAll.getUserKopList();
|
|
||||||
List<UserKop> newUserKopList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (UserKop newUserKop : userKopList) {
|
|
||||||
int kopId = newUserKop.getKopId();
|
|
||||||
int areaId = newUserKop.getAreaId();
|
|
||||||
|
|
||||||
Optional<UserKop> kopOptional = userKopRepository.findByUserAndKopIdAndAreaId(newUserData, kopId, areaId);
|
|
||||||
UserKop userKop = kopOptional.orElseGet(() -> new UserKop(newUserData));
|
|
||||||
|
|
||||||
newUserKop.setId(userKop.getId());
|
|
||||||
newUserKop.setUser(newUserData);
|
|
||||||
newUserKopList.add(newUserKop);
|
|
||||||
}
|
|
||||||
userKopRepository.saveAll(newUserKopList);
|
|
||||||
|
|
||||||
// UserEventMap
|
|
||||||
UserEventMap newUserEventMap = upsertUserAll.getUserEventMap();
|
|
||||||
if (newUserEventMap != null) {
|
|
||||||
Optional<UserEventMap> userEventOptional = userEventMapRepository.findByUser(newUserData);
|
|
||||||
UserEventMap userEventMap = userEventOptional.orElseGet(() -> new UserEventMap(newUserData));
|
|
||||||
|
|
||||||
newUserEventMap.setId(userEventMap.getId());
|
|
||||||
newUserEventMap.setUser(newUserData);
|
|
||||||
userEventMapRepository.save(newUserEventMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
String json = mapper.write(new CodeResp(1, "upsertUserAll"));
|
|
||||||
logger.info("Response: " + json);
|
|
||||||
return json;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void saveRecentRatingData(List<UserRecentRating> itemList, UserData newUserData, String key) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
// Convert to a string
|
|
||||||
for (UserRecentRating item :
|
|
||||||
itemList) {
|
|
||||||
sb.append(item.getMusicId()).append(":").append(item.getDifficultId()).append(":").append(item.getScore());
|
|
||||||
sb.append(",");
|
|
||||||
}
|
|
||||||
if (!sb.isEmpty()) {
|
|
||||||
sb.deleteCharAt(sb.length() - 1);
|
|
||||||
}
|
|
||||||
saveGeneralData(newUserData, key, sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void saveFumenScoreData(List<OngekiFumenScore> itemList, UserData newUserData, String key) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
for (OngekiFumenScore item : itemList) {
|
|
||||||
sb.append(item.getMusicId()).append(":")
|
|
||||||
.append(item.getDifficultId()).append(":")
|
|
||||||
.append(item.getScore()).append(":")
|
|
||||||
.append(item.getPlatinumScoreStar()).append(":")
|
|
||||||
.append(item.getPlatinumScoreMax());
|
|
||||||
sb.append(",");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sb.isEmpty()) {
|
|
||||||
sb.deleteCharAt(sb.length() - 1);
|
|
||||||
}
|
|
||||||
saveGeneralData(newUserData, key, sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void saveGeneralData(UserData newUserData, String key, String data) {
|
|
||||||
Optional<UserGeneralData> uOptional = userGeneralDataRepository.findByUserAndPropertyKey(newUserData, key);
|
|
||||||
UserGeneralData userGeneralData = uOptional.orElseGet(() -> new UserGeneralData(newUserData, key));
|
|
||||||
userGeneralData.setPropertyValue(data);
|
|
||||||
userGeneralDataRepository.save(userGeneralData);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -4,12 +4,13 @@ import ext.logger
|
||||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||||
import icu.samnyan.aqua.sega.general.model.response.UserRecentRating
|
import icu.samnyan.aqua.sega.general.model.response.UserRecentRating
|
||||||
import icu.samnyan.aqua.sega.general.service.CardService
|
import icu.samnyan.aqua.sega.general.service.CardService
|
||||||
import icu.samnyan.aqua.sega.ongeki.*
|
import icu.samnyan.aqua.sega.ongeki.OngekiUserRepos
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.*
|
import icu.samnyan.aqua.sega.ongeki.model.*
|
||||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper
|
import icu.samnyan.aqua.sega.util.jackson.BasicMapper
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The handler for saving all data of a ONGEKI profile
|
* The handler for saving all data of a ONGEKI profile
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
* @author samnyan (privateamusement@protonmail.com)
|
||||||
|
@ -18,35 +19,11 @@ import org.springframework.stereotype.Component
|
||||||
class UpsertUserAllHandler @Autowired constructor(
|
class UpsertUserAllHandler @Autowired constructor(
|
||||||
private val mapper: BasicMapper,
|
private val mapper: BasicMapper,
|
||||||
private val cardService: CardService,
|
private val cardService: CardService,
|
||||||
private val userDataRepository: OgkUserDataRepo,
|
val db: OngekiUserRepos
|
||||||
private val userOptionRepository: OgkUserOptionRepo,
|
|
||||||
private val userPlaylogRepository: OgkUserPlaylogRepo,
|
|
||||||
private val userActivityRepository: OgkUserActivityRepo,
|
|
||||||
private val userMusicDetailRepository: OgkUserMusicDetailRepo,
|
|
||||||
private val userCharacterRepository: OgkUserCharacterRepo,
|
|
||||||
private val userCardRepository: OgkUserCardRepo,
|
|
||||||
private val userDeckRepository: OgkUserDeckRepo,
|
|
||||||
private val userStoryRepository: OgkUserStoryRepo,
|
|
||||||
private val userChapterRepository: OgkUserChapterRepo,
|
|
||||||
private val userItemRepository: OgkUserItemRepo,
|
|
||||||
private val userMusicItemRepository: OgkUserMusicItemRepo,
|
|
||||||
private val userLoginBonusRepository: OgkUserLoginBonusRepo,
|
|
||||||
private val userEventPointRepository: OgkUserEventPointRepo,
|
|
||||||
private val userMissionPointRepository: OgkUserMissionPointRepo,
|
|
||||||
private val userTrainingRoomRepository: OgkUserTrainingRoomRepo,
|
|
||||||
private val userGeneralDataRepository: OgkUserGeneralDataRepo,
|
|
||||||
private val userBossRepository: OgkUserBossRepo,
|
|
||||||
private val userScenarioRepository: OgkUserScenarioRepo,
|
|
||||||
private val userTechCountRepository: OgkUserTechCountRepo,
|
|
||||||
private val userTradeItemRepository: OgkUserTradeItemRepo,
|
|
||||||
private val userEventMusicRepository: OgkUserEventMusicRepo,
|
|
||||||
private val userTechEventRepository: OgkUserTechEventRepo,
|
|
||||||
private val userKopRepository: OgkUserKopRepo,
|
|
||||||
private val userMemoryChapterRepository: OgkUserMemoryChapterRepo
|
|
||||||
) : BaseHandler {
|
) : BaseHandler {
|
||||||
override fun handle(request: Map<String, Any>): String? {
|
override fun handle(request: Map<String, Any>): String? {
|
||||||
val userId = (request["userId"] as Number).toLong()
|
val userId = (request["userId"] as Number).toLong()
|
||||||
val upsertUserAll = mapper.convert(
|
val all = mapper.convert(
|
||||||
request["upsertUserAll"]!!,
|
request["upsertUserAll"]!!,
|
||||||
UpsertUserAll::class.java
|
UpsertUserAll::class.java
|
||||||
)
|
)
|
||||||
|
@ -56,10 +33,10 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
val u: UserData
|
val u: UserData
|
||||||
run {
|
run {
|
||||||
val userData: UserData
|
val userData: UserData
|
||||||
val userOptional = userDataRepository.findByCard_ExtId(userId)
|
val userOptional = db.data.findByCard_ExtId(userId)
|
||||||
|
|
||||||
// UserData might be empty on later runs
|
// UserData might be empty on later runs
|
||||||
if (userOptional.isEmpty && upsertUserAll.userData.isNullOrEmpty()) {
|
if (userOptional.isEmpty && all.userData.isNullOrEmpty()) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +49,7 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
// If new data exists, use new data. Otherwise, use old data
|
// If new data exists, use new data. Otherwise, use old data
|
||||||
u = if (!upsertUserAll.userData.isNullOrEmpty()) upsertUserAll.userData!![0] else userData
|
u = if (!all.userData.isNullOrEmpty()) all.userData!![0] else userData
|
||||||
|
|
||||||
u.id = userData.id
|
u.id = userData.id
|
||||||
u.card = userData.card
|
u.card = userData.card
|
||||||
|
@ -80,24 +57,24 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
// Set eventWatchedDate with lastPlayDate, because client doesn't update it
|
// Set eventWatchedDate with lastPlayDate, because client doesn't update it
|
||||||
u.eventWatchedDate = userData.lastPlayDate
|
u.eventWatchedDate = userData.lastPlayDate
|
||||||
u.cmEventWatchedDate = userData.lastPlayDate
|
u.cmEventWatchedDate = userData.lastPlayDate
|
||||||
userDataRepository.save(u)
|
db.data.save(u)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// UserOption
|
// UserOption
|
||||||
val newUserOption = upsertUserAll.userOption!![0]
|
val newUserOption = all.userOption!![0]
|
||||||
|
|
||||||
val userOptionOptional = userOptionRepository.findSingleByUser(u)
|
val userOptionOptional = db.option.findSingleByUser(u)
|
||||||
val userOption = userOptionOptional.orElseGet { UserOption().apply { user = u } }
|
val userOption = userOptionOptional.orElseGet { UserOption().apply { user = u } }
|
||||||
|
|
||||||
newUserOption.id = userOption.id
|
newUserOption.id = userOption.id
|
||||||
newUserOption.user = userOption.user
|
newUserOption.user = userOption.user
|
||||||
|
|
||||||
userOptionRepository.save(newUserOption)
|
db.option.save(newUserOption)
|
||||||
|
|
||||||
|
|
||||||
// UserPlaylogList
|
// UserPlaylogList
|
||||||
val userPlaylogList = upsertUserAll.userPlaylogList
|
val userPlaylogList = all.userPlaylogList
|
||||||
val newUserPlaylogList: MutableList<UserPlaylog> = ArrayList()
|
val newUserPlaylogList: MutableList<UserPlaylog> = ArrayList()
|
||||||
|
|
||||||
if (userPlaylogList != null) {
|
if (userPlaylogList != null) {
|
||||||
|
@ -107,14 +84,14 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
userPlaylogRepository.saveAll(newUserPlaylogList)
|
db.playlog.saveAll(newUserPlaylogList)
|
||||||
|
|
||||||
|
|
||||||
// UserSessionlogList, UserJewelboostlogLost doesn't need to be saved for a private server
|
// UserSessionlogList, UserJewelboostlogLost doesn't need to be saved for a private server
|
||||||
|
|
||||||
|
|
||||||
// UserActivityList
|
// UserActivityList
|
||||||
val userActivityList = upsertUserAll.userActivityList
|
val userActivityList = all.userActivityList
|
||||||
val newUserActivityList: MutableList<UserActivity> = ArrayList()
|
val newUserActivityList: MutableList<UserActivity> = ArrayList()
|
||||||
|
|
||||||
if (userActivityList != null) {
|
if (userActivityList != null) {
|
||||||
|
@ -123,7 +100,7 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
val id = newUserActivity.activityId
|
val id = newUserActivity.activityId
|
||||||
|
|
||||||
if (kind != 0 && id != 0) {
|
if (kind != 0 && id != 0) {
|
||||||
val activityOptional = userActivityRepository.findByUserAndKindAndActivityId(u, kind, id)
|
val activityOptional = db.activity.findByUserAndKindAndActivityId(u, kind, id)
|
||||||
val userActivity = activityOptional.orElseGet {
|
val userActivity = activityOptional.orElseGet {
|
||||||
UserActivity().apply { user = u }
|
UserActivity().apply { user = u }
|
||||||
}
|
}
|
||||||
|
@ -135,12 +112,12 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newUserActivityList.sortWith { a, b -> b.sortNumber.compareTo(a.sortNumber) }
|
newUserActivityList.sortWith { a, b -> b.sortNumber.compareTo(a.sortNumber) }
|
||||||
userActivityRepository.saveAll(newUserActivityList)
|
db.activity.saveAll(newUserActivityList)
|
||||||
|
|
||||||
|
|
||||||
// UserRecentRatingList
|
// UserRecentRatingList
|
||||||
// This thing still need to save to solve the rating drop
|
// This thing still need to save to solve the rating drop
|
||||||
upsertUserAll.userRecentRatingList?.let { this.saveGeneralData(it, u, "recent_rating_list") }
|
all.userRecentRatingList?.let { this.saveRecentRatingData(it, u, "recent_rating_list") }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The rating and battle point calculation is little bit complex.
|
* The rating and battle point calculation is little bit complex.
|
||||||
|
@ -148,35 +125,40 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
* into a csv format for convenience
|
* into a csv format for convenience
|
||||||
*/
|
*/
|
||||||
// UserBpBaseList (For calculating Battle point)
|
// UserBpBaseList (For calculating Battle point)
|
||||||
upsertUserAll.userBpBaseList?.let { this.saveGeneralData(it, u, "battle_point_base") }
|
all.userBpBaseList?.let { this.saveRecentRatingData(it, u, "battle_point_base") }
|
||||||
|
|
||||||
|
|
||||||
// This is the best rating of all charts. Best 30 + 10 after that.
|
// This is the best rating of all charts. Best 30 + 10 after that.
|
||||||
// userRatingBaseBestList
|
// userRatingBaseBestList
|
||||||
upsertUserAll.userRatingBaseBestList?.let { this.saveGeneralData(it, u, "rating_base_best") }
|
all.userRatingBaseBestList?.let { this.saveRecentRatingData(it, u, "rating_base_best") }
|
||||||
|
|
||||||
|
|
||||||
// userRatingBaseNextList
|
// userRatingBaseNextList
|
||||||
upsertUserAll.userRatingBaseNextList?.let { this.saveGeneralData(it, u, "rating_base_next") }
|
all.userRatingBaseNextList?.let { this.saveRecentRatingData(it, u, "rating_base_next") }
|
||||||
|
|
||||||
// This is the best rating of new charts. Best 15 + 10 after that.
|
// This is the best rating of new charts. Best 15 + 10 after that.
|
||||||
// New chart means same version
|
// New chart means same version
|
||||||
// userRatingBaseBestNewList
|
// userRatingBaseBestNewList
|
||||||
upsertUserAll.userRatingBaseBestNewList?.let { this.saveGeneralData(it, u, "rating_base_new_best") }
|
all.userRatingBaseBestNewList?.let { this.saveRecentRatingData(it, u, "rating_base_new_best") }
|
||||||
|
|
||||||
// userRatingBaseNextNewList
|
// userRatingBaseNextNewList
|
||||||
upsertUserAll.userRatingBaseNextNewList?.let { this.saveGeneralData(it, u, "rating_base_new_next") }
|
all.userRatingBaseNextNewList?.let { this.saveRecentRatingData(it, u, "rating_base_new_next") }
|
||||||
|
|
||||||
// This is the recent best
|
// This is the recent best
|
||||||
// userRatingBaseHotList
|
// userRatingBaseHotList
|
||||||
upsertUserAll.userRatingBaseHotList?.let { this.saveGeneralData(it, u, "rating_base_hot_best") }
|
all.userRatingBaseHotList?.let { this.saveRecentRatingData(it, u, "rating_base_hot_best") }
|
||||||
|
|
||||||
// userRatingBaseHotNextList
|
// userRatingBaseHotNextList
|
||||||
upsertUserAll.userRatingBaseHotNextList?.let { this.saveGeneralData(it, u, "rating_base_hot_next") }
|
all.userRatingBaseHotNextList?.let { this.saveRecentRatingData(it, u, "rating_base_hot_next") }
|
||||||
|
|
||||||
|
// Re:Fresh
|
||||||
|
all.userNewRatingBaseBestList?.let { this.saveFumenScoreData(it, u, "new_rating_base_best") }
|
||||||
|
all.userNewRatingBaseNextBestList?.let { this.saveFumenScoreData(it, u, "new_rating_base_next_best") }
|
||||||
|
all.userNewRatingBaseBestNewList?.let { this.saveFumenScoreData(it, u, "new_rating_base_new_best") }
|
||||||
|
all.userNewRatingBaseNextBestNewList?.let { this.saveFumenScoreData(it, u, "new_rating_base_new_next_best") }
|
||||||
|
all.userNewRatingBasePScoreList?.let { this.saveFumenScoreData(it, u, "new_rating_base_pscore") }
|
||||||
|
all.userNewRatingBaseNextPScoreList?.let { this.saveFumenScoreData(it, u, "new_rating_base_next_pscore") }
|
||||||
|
|
||||||
// UserMusicDetailList
|
// UserMusicDetailList
|
||||||
val userMusicDetailList = upsertUserAll.userMusicDetailList
|
val userMusicDetailList = all.userMusicDetailList
|
||||||
val newUserMusicDetailList: MutableList<UserMusicDetail> = ArrayList()
|
val newUserMusicDetailList: MutableList<UserMusicDetail> = ArrayList()
|
||||||
|
|
||||||
if (userMusicDetailList != null) {
|
if (userMusicDetailList != null) {
|
||||||
|
@ -185,7 +167,7 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
val level = newUserMusicDetail.level
|
val level = newUserMusicDetail.level
|
||||||
|
|
||||||
val musicDetailOptional =
|
val musicDetailOptional =
|
||||||
userMusicDetailRepository.findByUserAndMusicIdAndLevel(u, musicId, level)
|
db.musicDetail.findByUserAndMusicIdAndLevel(u, musicId, level)
|
||||||
val userMusicDetail = musicDetailOptional.orElseGet {
|
val userMusicDetail = musicDetailOptional.orElseGet {
|
||||||
UserMusicDetail().apply { user = u }
|
UserMusicDetail().apply { user = u }
|
||||||
}
|
}
|
||||||
|
@ -195,18 +177,18 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
newUserMusicDetailList.add(newUserMusicDetail)
|
newUserMusicDetailList.add(newUserMusicDetail)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userMusicDetailRepository.saveAll(newUserMusicDetailList)
|
db.musicDetail.saveAll(newUserMusicDetailList)
|
||||||
|
|
||||||
|
|
||||||
// UserCharacterList
|
// UserCharacterList
|
||||||
val userCharacterList = upsertUserAll.userCharacterList
|
val userCharacterList = all.userCharacterList
|
||||||
val newUserCharacterList: MutableList<UserCharacter> = ArrayList()
|
val newUserCharacterList: MutableList<UserCharacter> = ArrayList()
|
||||||
|
|
||||||
if (userCharacterList != null) {
|
if (userCharacterList != null) {
|
||||||
for (newUserCharacter in userCharacterList) {
|
for (newUserCharacter in userCharacterList) {
|
||||||
val characterId = newUserCharacter.characterId
|
val characterId = newUserCharacter.characterId
|
||||||
|
|
||||||
val characterOptional = userCharacterRepository.findByUserAndCharacterId(u, characterId)
|
val characterOptional = db.character.findByUserAndCharacterId(u, characterId)
|
||||||
val userCharacter = characterOptional.orElseGet {
|
val userCharacter = characterOptional.orElseGet {
|
||||||
UserCharacter().apply { user = u }
|
UserCharacter().apply { user = u }
|
||||||
}
|
}
|
||||||
|
@ -216,17 +198,17 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
newUserCharacterList.add(newUserCharacter)
|
newUserCharacterList.add(newUserCharacter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userCharacterRepository.saveAll(newUserCharacterList)
|
db.character.saveAll(newUserCharacterList)
|
||||||
|
|
||||||
// UserCardList
|
// UserCardList
|
||||||
val userCardList = upsertUserAll.userCardList
|
val userCardList = all.userCardList
|
||||||
val newUserCardList: MutableList<UserCard> = ArrayList()
|
val newUserCardList: MutableList<UserCard> = ArrayList()
|
||||||
|
|
||||||
if (userCardList != null) {
|
if (userCardList != null) {
|
||||||
for (newUserCard in userCardList) {
|
for (newUserCard in userCardList) {
|
||||||
val cardId = newUserCard.cardId
|
val cardId = newUserCard.cardId
|
||||||
|
|
||||||
val cardOptional = userCardRepository.findByUserAndCardId(u, cardId)
|
val cardOptional = db.card.findByUserAndCardId(u, cardId)
|
||||||
val userCard = cardOptional.orElseGet { UserCard().apply { user = u } }
|
val userCard = cardOptional.orElseGet { UserCard().apply { user = u } }
|
||||||
|
|
||||||
newUserCard.id = userCard.id
|
newUserCard.id = userCard.id
|
||||||
|
@ -234,18 +216,18 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
newUserCardList.add(newUserCard)
|
newUserCardList.add(newUserCard)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userCardRepository.saveAll(newUserCardList)
|
db.card.saveAll(newUserCardList)
|
||||||
|
|
||||||
|
|
||||||
// UserDeckList
|
// UserDeckList
|
||||||
val userDeckList = upsertUserAll.userDeckList
|
val userDeckList = all.userDeckList
|
||||||
val newUserDeckList: MutableList<UserDeck> = ArrayList()
|
val newUserDeckList: MutableList<UserDeck> = ArrayList()
|
||||||
|
|
||||||
if (userDeckList != null) {
|
if (userDeckList != null) {
|
||||||
for (newUserDeck in userDeckList) {
|
for (newUserDeck in userDeckList) {
|
||||||
val deckId = newUserDeck.deckId
|
val deckId = newUserDeck.deckId
|
||||||
|
|
||||||
val deckOptional = userDeckRepository.findByUserAndDeckId(u, deckId)
|
val deckOptional = db.deck.findByUserAndDeckId(u, deckId)
|
||||||
val userDeck = deckOptional.orElseGet { UserDeck().apply { user = u } }
|
val userDeck = deckOptional.orElseGet { UserDeck().apply { user = u } }
|
||||||
|
|
||||||
newUserDeck.id = userDeck.id
|
newUserDeck.id = userDeck.id
|
||||||
|
@ -253,18 +235,18 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
newUserDeckList.add(newUserDeck)
|
newUserDeckList.add(newUserDeck)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userDeckRepository.saveAll(newUserDeckList)
|
db.deck.saveAll(newUserDeckList)
|
||||||
|
|
||||||
|
|
||||||
// userTrainingRoomList
|
// userTrainingRoomList
|
||||||
val userTrainingRoomList = upsertUserAll.userTrainingRoomList
|
val userTrainingRoomList = all.userTrainingRoomList
|
||||||
val newUserTrainingRoomList: MutableList<UserTrainingRoom> = ArrayList()
|
val newUserTrainingRoomList: MutableList<UserTrainingRoom> = ArrayList()
|
||||||
|
|
||||||
if (userTrainingRoomList != null) {
|
if (userTrainingRoomList != null) {
|
||||||
for (newUserTrainingRoom in userTrainingRoomList) {
|
for (newUserTrainingRoom in userTrainingRoomList) {
|
||||||
val roomId = newUserTrainingRoom.roomId
|
val roomId = newUserTrainingRoom.roomId
|
||||||
|
|
||||||
val trainingRoomOptional = userTrainingRoomRepository.findByUserAndRoomId(u, roomId)
|
val trainingRoomOptional = db.trainingRoom.findByUserAndRoomId(u, roomId)
|
||||||
val trainingRoom = trainingRoomOptional.orElseGet { UserTrainingRoom().apply { user = u } }
|
val trainingRoom = trainingRoomOptional.orElseGet { UserTrainingRoom().apply { user = u } }
|
||||||
|
|
||||||
newUserTrainingRoom.id = trainingRoom.id
|
newUserTrainingRoom.id = trainingRoom.id
|
||||||
|
@ -272,18 +254,18 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
newUserTrainingRoomList.add(newUserTrainingRoom)
|
newUserTrainingRoomList.add(newUserTrainingRoom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userTrainingRoomRepository.saveAll(newUserTrainingRoomList)
|
db.trainingRoom.saveAll(newUserTrainingRoomList)
|
||||||
|
|
||||||
|
|
||||||
// UserStoryList
|
// UserStoryList
|
||||||
val userStoryList = upsertUserAll.userStoryList
|
val userStoryList = all.userStoryList
|
||||||
val newUserStoryList: MutableList<UserStory> = ArrayList()
|
val newUserStoryList: MutableList<UserStory> = ArrayList()
|
||||||
|
|
||||||
if (userStoryList != null) {
|
if (userStoryList != null) {
|
||||||
for (newUserStory in userStoryList) {
|
for (newUserStory in userStoryList) {
|
||||||
val storyId = newUserStory.storyId
|
val storyId = newUserStory.storyId
|
||||||
|
|
||||||
val storyOptional = userStoryRepository.findByUserAndStoryId(u, storyId)
|
val storyOptional = db.story.findByUserAndStoryId(u, storyId)
|
||||||
val userStory = storyOptional.orElseGet { UserStory().apply { user = u } }
|
val userStory = storyOptional.orElseGet { UserStory().apply { user = u } }
|
||||||
|
|
||||||
newUserStory.id = userStory.id
|
newUserStory.id = userStory.id
|
||||||
|
@ -291,18 +273,18 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
newUserStoryList.add(newUserStory)
|
newUserStoryList.add(newUserStory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userStoryRepository.saveAll(newUserStoryList)
|
db.story.saveAll(newUserStoryList)
|
||||||
|
|
||||||
|
|
||||||
// UserChapterList
|
// UserChapterList
|
||||||
val userChapterList = upsertUserAll.userChapterList
|
val userChapterList = all.userChapterList
|
||||||
val newUserChapterList: MutableList<UserChapter> = ArrayList()
|
val newUserChapterList: MutableList<UserChapter> = ArrayList()
|
||||||
|
|
||||||
if (userChapterList != null) {
|
if (userChapterList != null) {
|
||||||
for (newUserChapter in userChapterList) {
|
for (newUserChapter in userChapterList) {
|
||||||
val chapterId = newUserChapter.chapterId
|
val chapterId = newUserChapter.chapterId
|
||||||
|
|
||||||
val chapterOptional = userChapterRepository.findByUserAndChapterId(u, chapterId)
|
val chapterOptional = db.chapter.findByUserAndChapterId(u, chapterId)
|
||||||
val userChapter = chapterOptional.orElseGet { UserChapter().apply { user = u } }
|
val userChapter = chapterOptional.orElseGet { UserChapter().apply { user = u } }
|
||||||
|
|
||||||
newUserChapter.id = userChapter.id
|
newUserChapter.id = userChapter.id
|
||||||
|
@ -310,11 +292,11 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
newUserChapterList.add(newUserChapter)
|
newUserChapterList.add(newUserChapter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userChapterRepository.saveAll(newUserChapterList)
|
db.chapter.saveAll(newUserChapterList)
|
||||||
|
|
||||||
|
|
||||||
// UserMemoryChapterList
|
// UserMemoryChapterList
|
||||||
val userMemoryChapterList = upsertUserAll.userMemoryChapterList
|
val userMemoryChapterList = all.userMemoryChapterList
|
||||||
|
|
||||||
if (userMemoryChapterList != null) {
|
if (userMemoryChapterList != null) {
|
||||||
val newUserMemoryChapterList: MutableList<UserMemoryChapter> = ArrayList()
|
val newUserMemoryChapterList: MutableList<UserMemoryChapter> = ArrayList()
|
||||||
|
@ -322,18 +304,18 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
for (newUserMemoryChapter in userMemoryChapterList) {
|
for (newUserMemoryChapter in userMemoryChapterList) {
|
||||||
val chapterId = newUserMemoryChapter.chapterId
|
val chapterId = newUserMemoryChapter.chapterId
|
||||||
|
|
||||||
val chapterOptional = userMemoryChapterRepository.findByUserAndChapterId(u, chapterId)
|
val chapterOptional = db.memoryChapter.findByUserAndChapterId(u, chapterId)
|
||||||
val userChapter = chapterOptional.orElseGet { UserMemoryChapter().apply { user = u } }
|
val userChapter = chapterOptional.orElseGet { UserMemoryChapter().apply { user = u } }
|
||||||
|
|
||||||
newUserMemoryChapter.id = userChapter.id
|
newUserMemoryChapter.id = userChapter.id
|
||||||
newUserMemoryChapter.user = u
|
newUserMemoryChapter.user = u
|
||||||
newUserMemoryChapterList.add(newUserMemoryChapter)
|
newUserMemoryChapterList.add(newUserMemoryChapter)
|
||||||
}
|
}
|
||||||
userMemoryChapterRepository.saveAll(newUserMemoryChapterList)
|
db.memoryChapter.saveAll(newUserMemoryChapterList)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserItemList
|
// UserItemList
|
||||||
val userItemList = upsertUserAll.userItemList
|
val userItemList = all.userItemList
|
||||||
val newUserItemList: MutableList<UserItem> = ArrayList()
|
val newUserItemList: MutableList<UserItem> = ArrayList()
|
||||||
|
|
||||||
if (userItemList != null) {
|
if (userItemList != null) {
|
||||||
|
@ -341,7 +323,7 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
val itemKind = newUserItem.itemKind
|
val itemKind = newUserItem.itemKind
|
||||||
val itemId = newUserItem.itemId
|
val itemId = newUserItem.itemId
|
||||||
|
|
||||||
val itemOptional = userItemRepository.findByUserAndItemKindAndItemId(u, itemKind, itemId)
|
val itemOptional = db.item.findByUserAndItemKindAndItemId(u, itemKind, itemId)
|
||||||
val userItem = itemOptional.orElseGet { UserItem().apply { user = u } }
|
val userItem = itemOptional.orElseGet { UserItem().apply { user = u } }
|
||||||
|
|
||||||
newUserItem.id = userItem.id
|
newUserItem.id = userItem.id
|
||||||
|
@ -349,17 +331,17 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
newUserItemList.add(newUserItem)
|
newUserItemList.add(newUserItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userItemRepository.saveAll(newUserItemList)
|
db.item.saveAll(newUserItemList)
|
||||||
|
|
||||||
// UserMusicItemList
|
// UserMusicItemList
|
||||||
val userMusicItemList = upsertUserAll.userMusicItemList
|
val userMusicItemList = all.userMusicItemList
|
||||||
val newUserMusicItemList: MutableList<UserMusicItem> = ArrayList()
|
val newUserMusicItemList: MutableList<UserMusicItem> = ArrayList()
|
||||||
|
|
||||||
if (userMusicItemList != null) {
|
if (userMusicItemList != null) {
|
||||||
for (newUserMusicItem in userMusicItemList) {
|
for (newUserMusicItem in userMusicItemList) {
|
||||||
val musicId = newUserMusicItem.musicId
|
val musicId = newUserMusicItem.musicId
|
||||||
|
|
||||||
val musicItemOptional = userMusicItemRepository.findByUserAndMusicId(u, musicId)
|
val musicItemOptional = db.musicItem.findByUserAndMusicId(u, musicId)
|
||||||
val userMusicItem = musicItemOptional.orElseGet { UserMusicItem().apply { user = u } }
|
val userMusicItem = musicItemOptional.orElseGet { UserMusicItem().apply { user = u } }
|
||||||
|
|
||||||
newUserMusicItem.id = userMusicItem.id
|
newUserMusicItem.id = userMusicItem.id
|
||||||
|
@ -367,18 +349,18 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
newUserMusicItemList.add(newUserMusicItem)
|
newUserMusicItemList.add(newUserMusicItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userMusicItemRepository.saveAll(newUserMusicItemList)
|
db.musicItem.saveAll(newUserMusicItemList)
|
||||||
|
|
||||||
|
|
||||||
// userLoginBonusList
|
// userLoginBonusList
|
||||||
val userLoginBonusList = upsertUserAll.userLoginBonusList
|
val userLoginBonusList = all.userLoginBonusList
|
||||||
val newUserLoginBonusList: MutableList<UserLoginBonus> = ArrayList()
|
val newUserLoginBonusList: MutableList<UserLoginBonus> = ArrayList()
|
||||||
|
|
||||||
if (userLoginBonusList != null) {
|
if (userLoginBonusList != null) {
|
||||||
for (newUserLoginBonus in userLoginBonusList) {
|
for (newUserLoginBonus in userLoginBonusList) {
|
||||||
val bonusId = newUserLoginBonus.bonusId
|
val bonusId = newUserLoginBonus.bonusId
|
||||||
|
|
||||||
val loginBonusOptional = userLoginBonusRepository.findByUserAndBonusId(u, bonusId)
|
val loginBonusOptional = db.loginBonus.findByUserAndBonusId(u, bonusId)
|
||||||
val userLoginBonus = loginBonusOptional.orElseGet {
|
val userLoginBonus = loginBonusOptional.orElseGet {
|
||||||
UserLoginBonus().apply { user = u }
|
UserLoginBonus().apply { user = u }
|
||||||
}
|
}
|
||||||
|
@ -388,18 +370,18 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
newUserLoginBonusList.add(newUserLoginBonus)
|
newUserLoginBonusList.add(newUserLoginBonus)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userLoginBonusRepository.saveAll(newUserLoginBonusList)
|
db.loginBonus.saveAll(newUserLoginBonusList)
|
||||||
|
|
||||||
|
|
||||||
// UserEventPointList
|
// UserEventPointList
|
||||||
val userEventPointList = upsertUserAll.userEventPointList
|
val userEventPointList = all.userEventPointList
|
||||||
val newUserEventPointList: MutableList<UserEventPoint> = ArrayList()
|
val newUserEventPointList: MutableList<UserEventPoint> = ArrayList()
|
||||||
|
|
||||||
if (userEventPointList != null) {
|
if (userEventPointList != null) {
|
||||||
for (newUserEventPoint in userEventPointList) {
|
for (newUserEventPoint in userEventPointList) {
|
||||||
val eventId = newUserEventPoint.eventId
|
val eventId = newUserEventPoint.eventId
|
||||||
|
|
||||||
val eventPointOptional = userEventPointRepository.findByUserAndEventId(u, eventId)
|
val eventPointOptional = db.eventPoint.findByUserAndEventId(u, eventId)
|
||||||
val userEventPoint = eventPointOptional.orElseGet { UserEventPoint().apply { user = u } }
|
val userEventPoint = eventPointOptional.orElseGet { UserEventPoint().apply { user = u } }
|
||||||
|
|
||||||
newUserEventPoint.id = userEventPoint.id
|
newUserEventPoint.id = userEventPoint.id
|
||||||
|
@ -407,18 +389,18 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
newUserEventPointList.add(newUserEventPoint)
|
newUserEventPointList.add(newUserEventPoint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userEventPointRepository.saveAll(newUserEventPointList)
|
db.eventPoint.saveAll(newUserEventPointList)
|
||||||
|
|
||||||
|
|
||||||
// UserMissionPointList
|
// UserMissionPointList
|
||||||
val userMissionPointList = upsertUserAll.userMissionPointList
|
val userMissionPointList = all.userMissionPointList
|
||||||
val newUserMissionPointList: MutableList<UserMissionPoint> = ArrayList()
|
val newUserMissionPointList: MutableList<UserMissionPoint> = ArrayList()
|
||||||
|
|
||||||
if (userMissionPointList != null) {
|
if (userMissionPointList != null) {
|
||||||
for (newUserMissionPoint in userMissionPointList) {
|
for (newUserMissionPoint in userMissionPointList) {
|
||||||
val eventId = newUserMissionPoint.eventId
|
val eventId = newUserMissionPoint.eventId
|
||||||
|
|
||||||
val userMissionPointOptional = userMissionPointRepository.findByUserAndEventId(u, eventId)
|
val userMissionPointOptional = db.missionPoint.findByUserAndEventId(u, eventId)
|
||||||
val userMissionPoint = userMissionPointOptional.orElseGet { UserMissionPoint().apply { user = u } }
|
val userMissionPoint = userMissionPointOptional.orElseGet { UserMissionPoint().apply { user = u } }
|
||||||
|
|
||||||
newUserMissionPoint.id = userMissionPoint.id
|
newUserMissionPoint.id = userMissionPoint.id
|
||||||
|
@ -426,18 +408,18 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
newUserMissionPointList.add(newUserMissionPoint)
|
newUserMissionPointList.add(newUserMissionPoint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userMissionPointRepository.saveAll(newUserMissionPointList)
|
db.missionPoint.saveAll(newUserMissionPointList)
|
||||||
|
|
||||||
// UserRatinglogList (For the highest rating of each version)
|
// UserRatinglogList (For the highest rating of each version)
|
||||||
|
|
||||||
// UserBossList
|
// UserBossList
|
||||||
val userBossList = upsertUserAll.userBossList
|
val userBossList = all.userBossList
|
||||||
if (userBossList != null) {
|
if (userBossList != null) {
|
||||||
val newUserBossList: MutableList<UserBoss> = ArrayList()
|
val newUserBossList: MutableList<UserBoss> = ArrayList()
|
||||||
for (newUserBoss in userBossList) {
|
for (newUserBoss in userBossList) {
|
||||||
val musicId = newUserBoss.musicId
|
val musicId = newUserBoss.musicId
|
||||||
|
|
||||||
val userBossOptional = userBossRepository.findByUserAndMusicId(u, musicId)
|
val userBossOptional = db.boss.findByUserAndMusicId(u, musicId)
|
||||||
val userBoss = userBossOptional.orElseGet {
|
val userBoss = userBossOptional.orElseGet {
|
||||||
UserBoss().apply { user = u }
|
UserBoss().apply { user = u }
|
||||||
}
|
}
|
||||||
|
@ -446,45 +428,45 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
newUserBoss.user = userBoss.user
|
newUserBoss.user = userBoss.user
|
||||||
newUserBossList.add(newUserBoss)
|
newUserBossList.add(newUserBoss)
|
||||||
}
|
}
|
||||||
userBossRepository.saveAll(newUserBossList)
|
db.boss.saveAll(newUserBossList)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserTechCountList
|
// UserTechCountList
|
||||||
val userTechCountList = upsertUserAll.userTechCountList
|
val userTechCountList = all.userTechCountList
|
||||||
if (userTechCountList != null) {
|
if (userTechCountList != null) {
|
||||||
val newUserTechCountList: MutableList<UserTechCount> = ArrayList()
|
val newUserTechCountList: MutableList<UserTechCount> = ArrayList()
|
||||||
for (newUserTechCount in userTechCountList) {
|
for (newUserTechCount in userTechCountList) {
|
||||||
val levelId = newUserTechCount.levelId
|
val levelId = newUserTechCount.levelId
|
||||||
|
|
||||||
val userTechCountOptional = userTechCountRepository.findByUserAndLevelId(u, levelId)
|
val userTechCountOptional = db.techCount.findByUserAndLevelId(u, levelId)
|
||||||
val userTechCount = userTechCountOptional.orElseGet { UserTechCount().apply { user = u } }
|
val userTechCount = userTechCountOptional.orElseGet { UserTechCount().apply { user = u } }
|
||||||
|
|
||||||
newUserTechCount.id = userTechCount.id
|
newUserTechCount.id = userTechCount.id
|
||||||
newUserTechCount.user = userTechCount.user
|
newUserTechCount.user = userTechCount.user
|
||||||
newUserTechCountList.add(newUserTechCount)
|
newUserTechCountList.add(newUserTechCount)
|
||||||
}
|
}
|
||||||
userTechCountRepository.saveAll(newUserTechCountList)
|
db.techCount.saveAll(newUserTechCountList)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserScenarioList
|
// UserScenarioList
|
||||||
val userScenarioList = upsertUserAll.userScenarioList
|
val userScenarioList = all.userScenarioList
|
||||||
if (userScenarioList != null) {
|
if (userScenarioList != null) {
|
||||||
val newUserScenarioList: MutableList<UserScenario> = ArrayList()
|
val newUserScenarioList: MutableList<UserScenario> = ArrayList()
|
||||||
for (newUserScenario in userScenarioList) {
|
for (newUserScenario in userScenarioList) {
|
||||||
val scenarioId = newUserScenario.scenarioId
|
val scenarioId = newUserScenario.scenarioId
|
||||||
|
|
||||||
val userScenarioOptional = userScenarioRepository.findByUserAndScenarioId(u, scenarioId)
|
val userScenarioOptional = db.scenario.findByUserAndScenarioId(u, scenarioId)
|
||||||
val userScenario = userScenarioOptional.orElseGet { UserScenario().apply { user = u } }
|
val userScenario = userScenarioOptional.orElseGet { UserScenario().apply { user = u } }
|
||||||
|
|
||||||
newUserScenario.id = userScenario.id
|
newUserScenario.id = userScenario.id
|
||||||
newUserScenario.user = userScenario.user
|
newUserScenario.user = userScenario.user
|
||||||
newUserScenarioList.add(newUserScenario)
|
newUserScenarioList.add(newUserScenario)
|
||||||
}
|
}
|
||||||
userScenarioRepository.saveAll(newUserScenarioList)
|
db.scenario.saveAll(newUserScenarioList)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserTradeItemList
|
// UserTradeItemList
|
||||||
val userTradeItemList = upsertUserAll.userTradeItemList
|
val userTradeItemList = all.userTradeItemList
|
||||||
val newUserTradeItemList: MutableList<UserTradeItem> = ArrayList()
|
val newUserTradeItemList: MutableList<UserTradeItem> = ArrayList()
|
||||||
|
|
||||||
if (userTradeItemList != null) {
|
if (userTradeItemList != null) {
|
||||||
|
@ -493,7 +475,7 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
val tradeItemId = newUserTradeItem.tradeItemId
|
val tradeItemId = newUserTradeItem.tradeItemId
|
||||||
|
|
||||||
val tradeItemOptional =
|
val tradeItemOptional =
|
||||||
userTradeItemRepository.findByUserAndChapterIdAndTradeItemId(u, chapterId, tradeItemId)
|
db.tradeItem.findByUserAndChapterIdAndTradeItemId(u, chapterId, tradeItemId)
|
||||||
val userTradeItem = tradeItemOptional.orElseGet { UserTradeItem().apply { user = u } }
|
val userTradeItem = tradeItemOptional.orElseGet { UserTradeItem().apply { user = u } }
|
||||||
|
|
||||||
newUserTradeItem.id = userTradeItem.id
|
newUserTradeItem.id = userTradeItem.id
|
||||||
|
@ -501,10 +483,10 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
newUserTradeItemList.add(newUserTradeItem)
|
newUserTradeItemList.add(newUserTradeItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userTradeItemRepository.saveAll(newUserTradeItemList)
|
db.tradeItem.saveAll(newUserTradeItemList)
|
||||||
|
|
||||||
// UserEventMusicList
|
// UserEventMusicList
|
||||||
val userEventMusicList = upsertUserAll.userEventMusicList
|
val userEventMusicList = all.userEventMusicList
|
||||||
val newUserEventMusicList: MutableList<UserEventMusic> = ArrayList()
|
val newUserEventMusicList: MutableList<UserEventMusic> = ArrayList()
|
||||||
|
|
||||||
if (userEventMusicList != null) {
|
if (userEventMusicList != null) {
|
||||||
|
@ -514,7 +496,7 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
val musicId = newUserEventMusic.musicId
|
val musicId = newUserEventMusic.musicId
|
||||||
|
|
||||||
val eventMusicOptional =
|
val eventMusicOptional =
|
||||||
userEventMusicRepository.findByUserAndEventIdAndTypeAndMusicId(u, eventId, type, musicId)
|
db.eventMusic.findByUserAndEventIdAndTypeAndMusicId(u, eventId, type, musicId)
|
||||||
val userEventMusic = eventMusicOptional.orElseGet { UserEventMusic().apply { user = u } }
|
val userEventMusic = eventMusicOptional.orElseGet { UserEventMusic().apply { user = u } }
|
||||||
|
|
||||||
newUserEventMusic.id = userEventMusic.id
|
newUserEventMusic.id = userEventMusic.id
|
||||||
|
@ -522,17 +504,17 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
newUserEventMusicList.add(newUserEventMusic)
|
newUserEventMusicList.add(newUserEventMusic)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userEventMusicRepository.saveAll(newUserEventMusicList)
|
db.eventMusic.saveAll(newUserEventMusicList)
|
||||||
|
|
||||||
// UserTechEventList
|
// UserTechEventList
|
||||||
val userTechEventList = upsertUserAll.userTechEventList
|
val userTechEventList = all.userTechEventList
|
||||||
val newUserTechEventList: MutableList<UserTechEvent> = ArrayList()
|
val newUserTechEventList: MutableList<UserTechEvent> = ArrayList()
|
||||||
|
|
||||||
if (userTechEventList != null) {
|
if (userTechEventList != null) {
|
||||||
for (newUserTechEvent in userTechEventList) {
|
for (newUserTechEvent in userTechEventList) {
|
||||||
val eventId = newUserTechEvent.eventId
|
val eventId = newUserTechEvent.eventId
|
||||||
|
|
||||||
val techEventOptional = userTechEventRepository.findByUserAndEventId(u, eventId)
|
val techEventOptional = db.techEvent.findByUserAndEventId(u, eventId)
|
||||||
val userTechEvent = techEventOptional.orElseGet { UserTechEvent().apply { user = u } }
|
val userTechEvent = techEventOptional.orElseGet { UserTechEvent().apply { user = u } }
|
||||||
|
|
||||||
newUserTechEvent.id = userTechEvent.id
|
newUserTechEvent.id = userTechEvent.id
|
||||||
|
@ -540,10 +522,10 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
newUserTechEventList.add(newUserTechEvent)
|
newUserTechEventList.add(newUserTechEvent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userTechEventRepository.saveAll(newUserTechEventList)
|
db.techEvent.saveAll(newUserTechEventList)
|
||||||
|
|
||||||
// UserKopList
|
// UserKopList
|
||||||
val userKopList = upsertUserAll.userKopList
|
val userKopList = all.userKopList
|
||||||
val newUserKopList: MutableList<UserKop> = ArrayList()
|
val newUserKopList: MutableList<UserKop> = ArrayList()
|
||||||
|
|
||||||
if (userKopList != null) {
|
if (userKopList != null) {
|
||||||
|
@ -551,7 +533,7 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
val kopId = newUserKop.kopId
|
val kopId = newUserKop.kopId
|
||||||
val areaId = newUserKop.areaId
|
val areaId = newUserKop.areaId
|
||||||
|
|
||||||
val kopOptional = userKopRepository.findByUserAndKopIdAndAreaId(u, kopId, areaId)
|
val kopOptional = db.kop.findByUserAndKopIdAndAreaId(u, kopId, areaId)
|
||||||
val userKop = kopOptional.orElseGet { UserKop().apply { user = u } }
|
val userKop = kopOptional.orElseGet { UserKop().apply { user = u } }
|
||||||
|
|
||||||
newUserKop.id = userKop.id
|
newUserKop.id = userKop.id
|
||||||
|
@ -559,32 +541,60 @@ class UpsertUserAllHandler @Autowired constructor(
|
||||||
newUserKopList.add(newUserKop)
|
newUserKopList.add(newUserKop)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userKopRepository.saveAll(newUserKopList)
|
db.kop.saveAll(newUserKopList)
|
||||||
|
|
||||||
|
// UserEventMap
|
||||||
|
val newUserEventMap = all.userEventMap
|
||||||
|
if (newUserEventMap != null) {
|
||||||
|
val userEventOptional = db.eventMap.findSingleByUser(u)
|
||||||
|
val userEventMap: UserEventMap = userEventOptional.orElseGet { UserEventMap().apply { user = u } }
|
||||||
|
|
||||||
|
newUserEventMap.id = userEventMap.id
|
||||||
|
newUserEventMap.user = u
|
||||||
|
db.eventMap.save(newUserEventMap)
|
||||||
|
}
|
||||||
|
|
||||||
val json = mapper.write(CodeResp(1, "upsertUserAll"))
|
val json = mapper.write(CodeResp(1, "upsertUserAll"))
|
||||||
logger.info("Response: $json")
|
logger.info("Response: $json")
|
||||||
return json
|
return json
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun saveGeneralData(itemList: List<UserRecentRating>, newUserData: UserData, key: String) {
|
private fun saveRecentRatingData(itemList: List<UserRecentRating>, newUserData: UserData, key: String) {
|
||||||
val sb = StringBuilder()
|
val sb = StringBuilder()
|
||||||
// Convert to a string
|
// Convert to a string
|
||||||
for (item in itemList) {
|
for (item in itemList) {
|
||||||
sb.append(item.musicId).append(":").append(item.difficultId).append(":").append(item.score)
|
sb.append(item.musicId).append(":").append(item.difficultId).append(":").append(item.score)
|
||||||
sb.append(",")
|
sb.append(",")
|
||||||
}
|
}
|
||||||
if (sb.length > 0) {
|
if (sb.isNotEmpty()) { sb.deleteCharAt(sb.length - 1) }
|
||||||
sb.deleteCharAt(sb.length - 1)
|
saveGeneralData(newUserData, key, sb.toString())
|
||||||
}
|
}
|
||||||
val uOptional = userGeneralDataRepository.findByUserAndPropertyKey(newUserData, key)
|
|
||||||
|
private fun saveFumenScoreData(itemList: List<OngekiFumenScore>, newUserData: UserData, key: String) {
|
||||||
|
val sb = StringBuilder()
|
||||||
|
for (item in itemList) {
|
||||||
|
sb.append(item.musicId).append(":")
|
||||||
|
.append(item.difficultId).append(":")
|
||||||
|
.append(item.score).append(":")
|
||||||
|
.append(item.platinumScoreStar).append(":")
|
||||||
|
.append(item.platinumScoreMax)
|
||||||
|
sb.append(",")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sb.isNotEmpty()) { sb.deleteCharAt(sb.length - 1) }
|
||||||
|
saveGeneralData(newUserData, key, sb.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun saveGeneralData(newUserData: UserData, key: String, data: String) {
|
||||||
|
val uOptional = db.generalData.findByUserAndPropertyKey(newUserData, key)
|
||||||
val userGeneralData = uOptional.orElseGet {
|
val userGeneralData = uOptional.orElseGet {
|
||||||
UserGeneralData().apply {
|
UserGeneralData().apply {
|
||||||
user = newUserData
|
user = newUserData
|
||||||
propertyKey = key
|
propertyKey = key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userGeneralData.propertyValue = sb.toString()
|
userGeneralData.propertyValue = data
|
||||||
userGeneralDataRepository.save(userGeneralData)
|
db.generalData.save(userGeneralData)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -7,6 +7,15 @@ class CodeResp(
|
||||||
var apiName: String? = null,
|
var apiName: String? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class OngekiFumenScore(
|
||||||
|
var musicId: Int = 0,
|
||||||
|
var difficultId: Int = 0,
|
||||||
|
var romVersionCode: String? = null,
|
||||||
|
var score: Int = 0,
|
||||||
|
var platinumScoreMax: Int = 0,
|
||||||
|
var platinumScoreStar: Int = 0,
|
||||||
|
)
|
||||||
|
|
||||||
class GetUserPreviewResp(
|
class GetUserPreviewResp(
|
||||||
var userId: Long = 0,
|
var userId: Long = 0,
|
||||||
var isLogin: Bool = false,
|
var isLogin: Bool = false,
|
||||||
|
@ -16,6 +25,7 @@ class GetUserPreviewResp(
|
||||||
var level: Int = 0,
|
var level: Int = 0,
|
||||||
var exp: Long = 0,
|
var exp: Long = 0,
|
||||||
var playerRating: Long = 0,
|
var playerRating: Long = 0,
|
||||||
|
var newPlayerRating: Long = 0,
|
||||||
var lastGameId: String = "",
|
var lastGameId: String = "",
|
||||||
var lastRomVersion: String = "",
|
var lastRomVersion: String = "",
|
||||||
var lastDataVersion: String = "",
|
var lastDataVersion: String = "",
|
||||||
|
|
|
@ -93,6 +93,17 @@ class UserData : IUserData {
|
||||||
var lastPlayMusicLevel = 0
|
var lastPlayMusicLevel = 0
|
||||||
var lastEmoneyBrand = 0
|
var lastEmoneyBrand = 0
|
||||||
|
|
||||||
|
// Re:Fresh
|
||||||
|
var shizukuCount = 0
|
||||||
|
var newPlayerRating = 0
|
||||||
|
var newHighestRating = 0
|
||||||
|
var sumPlatinumScoreStar = 0
|
||||||
|
var sumBasicPlatinumScoreStar = 0
|
||||||
|
var sumAdvancedPlatinumScoreStar = 0
|
||||||
|
var sumExpertPlatinumScoreStar = 0
|
||||||
|
var sumMasterPlatinumScoreStar = 0
|
||||||
|
var sumLunaticPlatinumScoreStar = 0
|
||||||
|
|
||||||
override val totalScore get() = sumTechHighScore
|
override val totalScore get() = sumTechHighScore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,6 +265,9 @@ class UserMemoryChapter : OngekiUserEntity() {
|
||||||
var isClear = false
|
var isClear = false
|
||||||
var gaugeId = 0
|
var gaugeId = 0
|
||||||
var gaugeNum = 0
|
var gaugeNum = 0
|
||||||
|
|
||||||
|
// Re:Fresh
|
||||||
|
var isEndingWatched = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity(name = "OngekiUserMissionPoint")
|
@Entity(name = "OngekiUserMissionPoint")
|
||||||
|
@ -283,6 +297,9 @@ class UserMusicDetail : OngekiUserEntity(), IGenericUserMusic {
|
||||||
var isLock = false
|
var isLock = false
|
||||||
var clearStatus = 0
|
var clearStatus = 0
|
||||||
var isStoryWatched = false
|
var isStoryWatched = false
|
||||||
|
|
||||||
|
// Re:Fresh
|
||||||
|
var platinumScoreStar = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity(name = "OngekiUserMusicItem")
|
@Entity(name = "OngekiUserMusicItem")
|
||||||
|
@ -332,6 +349,9 @@ class UserOption : OngekiUserEntity() {
|
||||||
var dispRating = 0
|
var dispRating = 0
|
||||||
var dispBP = 0
|
var dispBP = 0
|
||||||
var headphone = 0
|
var headphone = 0
|
||||||
|
|
||||||
|
// Re:Fresh
|
||||||
|
var effectAttack = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -471,3 +491,28 @@ class UserTrainingRoom : OngekiUserEntity() {
|
||||||
var cardId: Int = 0
|
var cardId: Int = 0
|
||||||
var valueDate: String = ""
|
var valueDate: String = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Re:Fresh
|
||||||
|
@Entity(name = "OngekiUserEventMap")
|
||||||
|
@Table(name = "ongeki_user_event_map")
|
||||||
|
class UserEventMap : OngekiUserEntity() {
|
||||||
|
var eventId = 0
|
||||||
|
var mapId = 0
|
||||||
|
var mapData: String? = null
|
||||||
|
var totalPoint = 0
|
||||||
|
var totalUsePoint = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author samnyan (privateamusement@protonmail.com)
|
||||||
|
*/
|
||||||
|
@Entity(name = "OngekiUserSkin")
|
||||||
|
@Table(name = "ongeki_user_skin")
|
||||||
|
class UserSkin : OngekiUserEntity() {
|
||||||
|
// TODO: should be updated on net when changing skin
|
||||||
|
var isValid = false
|
||||||
|
var deckId = 0
|
||||||
|
var cardId1 = 0
|
||||||
|
var cardId2 = 0
|
||||||
|
var cardId3 = 0
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ class UpsertUserAll {
|
||||||
var userJewelboostlogList: List<Map<String, Any>>? = null
|
var userJewelboostlogList: List<Map<String, Any>>? = null
|
||||||
var userSessionlogList: List<Map<String, Any>>? = null
|
var userSessionlogList: List<Map<String, Any>>? = null
|
||||||
var userActivityList: List<UserActivity>? = null
|
var userActivityList: List<UserActivity>? = null
|
||||||
|
|
||||||
var userRecentRatingList: List<UserRecentRating>? = null
|
var userRecentRatingList: List<UserRecentRating>? = null
|
||||||
var userBpBaseList: List<UserRecentRating>? = null
|
var userBpBaseList: List<UserRecentRating>? = null
|
||||||
var userRatingBaseBestNewList: List<UserRecentRating>? = null
|
var userRatingBaseBestNewList: List<UserRecentRating>? = null
|
||||||
|
@ -16,6 +17,7 @@ class UpsertUserAll {
|
||||||
var userRatingBaseNextNewList: List<UserRecentRating>? = null
|
var userRatingBaseNextNewList: List<UserRecentRating>? = null
|
||||||
var userRatingBaseNextList: List<UserRecentRating>? = null
|
var userRatingBaseNextList: List<UserRecentRating>? = null
|
||||||
var userRatingBaseHotNextList: List<UserRecentRating>? = null
|
var userRatingBaseHotNextList: List<UserRecentRating>? = null
|
||||||
|
|
||||||
var userMusicDetailList: List<UserMusicDetail>? = null
|
var userMusicDetailList: List<UserMusicDetail>? = null
|
||||||
var userCharacterList: List<UserCharacter>? = null
|
var userCharacterList: List<UserCharacter>? = null
|
||||||
var userCardList: List<UserCard>? = null
|
var userCardList: List<UserCard>? = null
|
||||||
|
@ -59,4 +61,13 @@ class UpsertUserAll {
|
||||||
var isNewEventMusicList: String? = null
|
var isNewEventMusicList: String? = null
|
||||||
var isNewTechEventList: String? = null
|
var isNewTechEventList: String? = null
|
||||||
var isNewKopList: String? = null
|
var isNewKopList: String? = null
|
||||||
|
|
||||||
|
// Re:Fresh
|
||||||
|
var userNewRatingBasePScoreList: List<OngekiFumenScore>? = null
|
||||||
|
var userNewRatingBaseBestList: List<OngekiFumenScore>? = null
|
||||||
|
var userNewRatingBaseBestNewList: List<OngekiFumenScore>? = null
|
||||||
|
var userNewRatingBaseNextPScoreList: List<OngekiFumenScore>? = null
|
||||||
|
var userNewRatingBaseNextBestList: List<OngekiFumenScore>? = null
|
||||||
|
var userNewRatingBaseNextBestNewList: List<OngekiFumenScore>? = null
|
||||||
|
var userEventMap: UserEventMap? = null
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
package icu.samnyan.aqua.sega.ongeki.model.gamedata;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class OngekiFumenScore {
|
|
||||||
private int musicId;
|
|
||||||
private int difficultId;
|
|
||||||
private String romVersionCode;
|
|
||||||
private int score;
|
|
||||||
public int platinumScoreMax;
|
|
||||||
public int platinumScoreStar;
|
|
||||||
}
|
|
|
@ -1,42 +0,0 @@
|
||||||
package icu.samnyan.aqua.sega.ongeki.model.response;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class GetUserPreviewResp {
|
|
||||||
|
|
||||||
private long userId = 0;
|
|
||||||
@JsonProperty("isLogin")
|
|
||||||
private boolean isLogin = false;
|
|
||||||
private String lastLoginDate = null;
|
|
||||||
private String userName = "";
|
|
||||||
private int reincarnationNum = 0;
|
|
||||||
private int level = 0;
|
|
||||||
private long exp = 0;
|
|
||||||
private long playerRating = 0;
|
|
||||||
private long newPlayerRating = 0;
|
|
||||||
private String lastGameId = "";
|
|
||||||
private String lastRomVersion = "";
|
|
||||||
private String lastDataVersion = "";
|
|
||||||
private String lastPlayDate = null;
|
|
||||||
private int nameplateId = 0;
|
|
||||||
private int trophyId = 0;
|
|
||||||
private int cardId = 0;
|
|
||||||
private int dispPlayerLv = 0;
|
|
||||||
private int dispRating = 0;
|
|
||||||
private int dispBP = 0;
|
|
||||||
private int headphone = 0;
|
|
||||||
private int banStatus = 0;
|
|
||||||
@JsonProperty("isWarningConfirmed")
|
|
||||||
private boolean isWarningConfirmed = false;
|
|
||||||
private int lastEmoneyBrand = 0;
|
|
||||||
private int lastEmoneyCredit = 0;
|
|
||||||
}
|
|
|
@ -1,183 +0,0 @@
|
||||||
package icu.samnyan.aqua.sega.ongeki.model.userdata;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
||||||
import icu.samnyan.aqua.net.games.IUserData;
|
|
||||||
import icu.samnyan.aqua.sega.general.model.Card;
|
|
||||||
import icu.samnyan.aqua.sega.util.jackson.AccessCodeSerializer;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
|
||||||
*/
|
|
||||||
@Entity(name = "OngekiUserData")
|
|
||||||
@Table(name = "ongeki_user_data")
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class UserData implements Serializable, IUserData {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@JsonIgnore
|
|
||||||
private long id;
|
|
||||||
|
|
||||||
@JsonSerialize(using = AccessCodeSerializer.class)
|
|
||||||
@JsonProperty(value = "accessCode", access = JsonProperty.Access.READ_ONLY)
|
|
||||||
@OneToOne(fetch = FetchType.LAZY)
|
|
||||||
@JoinColumn(name = "aime_card_id", unique = true)
|
|
||||||
private Card card;
|
|
||||||
|
|
||||||
private String userName;
|
|
||||||
|
|
||||||
private int level;
|
|
||||||
|
|
||||||
private int reincarnationNum;
|
|
||||||
|
|
||||||
private long exp;
|
|
||||||
|
|
||||||
private long point;
|
|
||||||
|
|
||||||
private long totalPoint;
|
|
||||||
|
|
||||||
private int playCount;
|
|
||||||
|
|
||||||
private int jewelCount;
|
|
||||||
|
|
||||||
private int totalJewelCount;
|
|
||||||
|
|
||||||
private int medalCount;
|
|
||||||
|
|
||||||
private int shizukuCount;
|
|
||||||
|
|
||||||
private int playerRating;
|
|
||||||
|
|
||||||
private int highestRating;
|
|
||||||
|
|
||||||
private int newPlayerRating;
|
|
||||||
|
|
||||||
private int newHighestRating;
|
|
||||||
|
|
||||||
private int battlePoint;
|
|
||||||
|
|
||||||
private int bestBattlePoint;
|
|
||||||
|
|
||||||
private int overDamageBattlePoint;
|
|
||||||
|
|
||||||
@JsonProperty("isDialogWatchedSuggestMemory")
|
|
||||||
private boolean isDialogWatchedSuggestMemory;
|
|
||||||
|
|
||||||
private int nameplateId;
|
|
||||||
|
|
||||||
private int trophyId;
|
|
||||||
|
|
||||||
private int cardId;
|
|
||||||
|
|
||||||
private int characterId;
|
|
||||||
|
|
||||||
private int characterVoiceNo;
|
|
||||||
|
|
||||||
private int tabSetting;
|
|
||||||
|
|
||||||
private int tabSortSetting;
|
|
||||||
|
|
||||||
private int cardCategorySetting;
|
|
||||||
|
|
||||||
private int cardSortSetting;
|
|
||||||
|
|
||||||
private int rivalScoreCategorySetting;
|
|
||||||
|
|
||||||
private int playedTutorialBit;
|
|
||||||
|
|
||||||
private int firstTutorialCancelNum;
|
|
||||||
|
|
||||||
private long sumTechHighScore;
|
|
||||||
|
|
||||||
private long sumTechBasicHighScore;
|
|
||||||
|
|
||||||
private long sumTechAdvancedHighScore;
|
|
||||||
|
|
||||||
private long sumTechExpertHighScore;
|
|
||||||
|
|
||||||
private long sumTechMasterHighScore;
|
|
||||||
|
|
||||||
private long sumTechLunaticHighScore;
|
|
||||||
|
|
||||||
private long sumBattleHighScore;
|
|
||||||
|
|
||||||
private long sumBattleBasicHighScore;
|
|
||||||
|
|
||||||
private long sumBattleAdvancedHighScore;
|
|
||||||
|
|
||||||
private long sumBattleExpertHighScore;
|
|
||||||
|
|
||||||
private long sumBattleMasterHighScore;
|
|
||||||
|
|
||||||
private long sumBattleLunaticHighScore;
|
|
||||||
|
|
||||||
private int sumPlatinumScoreStar;
|
|
||||||
|
|
||||||
private int sumBasicPlatinumScoreStar;
|
|
||||||
|
|
||||||
private int sumAdvancedPlatinumScoreStar;
|
|
||||||
|
|
||||||
private int sumExpertPlatinumScoreStar;
|
|
||||||
|
|
||||||
private int sumMasterPlatinumScoreStar;
|
|
||||||
|
|
||||||
private int sumLunaticPlatinumScoreStar;
|
|
||||||
|
|
||||||
private String eventWatchedDate;
|
|
||||||
|
|
||||||
private String cmEventWatchedDate;
|
|
||||||
|
|
||||||
private String firstGameId;
|
|
||||||
|
|
||||||
private String firstRomVersion;
|
|
||||||
|
|
||||||
private String firstDataVersion;
|
|
||||||
|
|
||||||
private String firstPlayDate;
|
|
||||||
|
|
||||||
private String lastGameId;
|
|
||||||
|
|
||||||
private String lastRomVersion;
|
|
||||||
|
|
||||||
private String lastDataVersion;
|
|
||||||
|
|
||||||
private String compatibleCmVersion;
|
|
||||||
|
|
||||||
private String lastPlayDate;
|
|
||||||
|
|
||||||
private int lastPlaceId;
|
|
||||||
|
|
||||||
private String lastPlaceName;
|
|
||||||
|
|
||||||
private int lastRegionId;
|
|
||||||
|
|
||||||
private String lastRegionName;
|
|
||||||
|
|
||||||
private int lastAllNetId;
|
|
||||||
|
|
||||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
|
||||||
private String lastClientId;
|
|
||||||
|
|
||||||
private int lastUsedDeckId;
|
|
||||||
|
|
||||||
private int lastPlayMusicLevel;
|
|
||||||
|
|
||||||
private int lastEmoneyBrand;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getTotalScore() {
|
|
||||||
return sumTechHighScore;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
package icu.samnyan.aqua.sega.ongeki.model.userdata;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
|
||||||
*/
|
|
||||||
@Entity(name = "OngekiUserEventMap")
|
|
||||||
@Table(name = "ongeki_user_event_map")
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class UserEventMap implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@JsonIgnore
|
|
||||||
private long id;
|
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "user_id")
|
|
||||||
private UserData user;
|
|
||||||
|
|
||||||
private int eventId;
|
|
||||||
|
|
||||||
private int mapId;
|
|
||||||
|
|
||||||
private String mapData;
|
|
||||||
|
|
||||||
private int totalPoint;
|
|
||||||
|
|
||||||
private int totalUsePoint;
|
|
||||||
|
|
||||||
public UserEventMap(UserData userData) {
|
|
||||||
this.user = userData;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,66 +0,0 @@
|
||||||
package icu.samnyan.aqua.sega.ongeki.model.userdata;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
|
||||||
*/
|
|
||||||
@Entity(name = "OngekiUserMemoryChapter")
|
|
||||||
@Table(name = "ongeki_user_memory_chapter")
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class UserMemoryChapter implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@JsonIgnore
|
|
||||||
private long id;
|
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "user_id")
|
|
||||||
private UserData user;
|
|
||||||
|
|
||||||
private int chapterId;
|
|
||||||
|
|
||||||
private int jewelCount;
|
|
||||||
|
|
||||||
private int lastPlayMusicCategory;
|
|
||||||
|
|
||||||
private int lastPlayMusicId;
|
|
||||||
|
|
||||||
private int lastPlayMusicLevel;
|
|
||||||
|
|
||||||
@JsonProperty("isDialogWatched")
|
|
||||||
private boolean isDialogWatched;
|
|
||||||
|
|
||||||
@JsonProperty("isStoryWatched")
|
|
||||||
private boolean isStoryWatched;
|
|
||||||
|
|
||||||
@JsonProperty("isBossWatched")
|
|
||||||
private boolean isBossWatched;
|
|
||||||
|
|
||||||
@JsonProperty("isEndingWatched")
|
|
||||||
private boolean isEndingWatched;
|
|
||||||
|
|
||||||
@JsonProperty("isClear")
|
|
||||||
private boolean isClear;
|
|
||||||
|
|
||||||
private int gaugeId;
|
|
||||||
|
|
||||||
private int gaugeNum;
|
|
||||||
|
|
||||||
public UserMemoryChapter(UserData userData) {
|
|
||||||
this.user = userData;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,78 +0,0 @@
|
||||||
package icu.samnyan.aqua.sega.ongeki.model.userdata;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import icu.samnyan.aqua.net.games.IGenericUserMusic;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
|
||||||
*/
|
|
||||||
@Entity(name = "OngekiUserMusicDetail")
|
|
||||||
@Table(name = "ongeki_user_music_detail")
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class UserMusicDetail implements Serializable, IGenericUserMusic {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@JsonIgnore
|
|
||||||
private long id;
|
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "user_id")
|
|
||||||
private UserData user;
|
|
||||||
|
|
||||||
private int musicId;
|
|
||||||
|
|
||||||
private int level;
|
|
||||||
|
|
||||||
private int playCount;
|
|
||||||
|
|
||||||
private int techScoreMax;
|
|
||||||
|
|
||||||
private int techScoreRank;
|
|
||||||
|
|
||||||
private int battleScoreMax;
|
|
||||||
|
|
||||||
private int battleScoreRank;
|
|
||||||
|
|
||||||
private int platinumScoreMax;
|
|
||||||
|
|
||||||
private int platinumScoreStar;
|
|
||||||
|
|
||||||
private int maxComboCount;
|
|
||||||
|
|
||||||
private int maxOverKill;
|
|
||||||
|
|
||||||
private int maxTeamOverKill;
|
|
||||||
|
|
||||||
@JsonProperty("isFullBell")
|
|
||||||
private boolean isFullBell;
|
|
||||||
|
|
||||||
@JsonProperty("isFullCombo")
|
|
||||||
private boolean isFullCombo;
|
|
||||||
|
|
||||||
@JsonProperty("isAllBreake")
|
|
||||||
private boolean isAllBreake;
|
|
||||||
|
|
||||||
@JsonProperty("isLock")
|
|
||||||
private boolean isLock;
|
|
||||||
|
|
||||||
private int clearStatus;
|
|
||||||
|
|
||||||
private boolean isStoryWatched;
|
|
||||||
|
|
||||||
public UserMusicDetail(UserData userData) {
|
|
||||||
this.user = userData;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,112 +0,0 @@
|
||||||
package icu.samnyan.aqua.sega.ongeki.model.userdata;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
|
||||||
*/
|
|
||||||
@Entity(name = "OngekiUserOption")
|
|
||||||
@Table(name = "ongeki_user_option")
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class UserOption implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@JsonIgnore
|
|
||||||
private long id;
|
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "user_id")
|
|
||||||
private UserData user;
|
|
||||||
|
|
||||||
private int optionSet;
|
|
||||||
|
|
||||||
private int speed;
|
|
||||||
|
|
||||||
private int mirror;
|
|
||||||
|
|
||||||
private int judgeTiming;
|
|
||||||
|
|
||||||
private int judgeAdjustment;
|
|
||||||
|
|
||||||
private int abort;
|
|
||||||
|
|
||||||
private int stealthField;
|
|
||||||
|
|
||||||
private int tapSound;
|
|
||||||
|
|
||||||
private int volGuide;
|
|
||||||
|
|
||||||
private int volAll;
|
|
||||||
|
|
||||||
private int volTap;
|
|
||||||
|
|
||||||
private int volCrTap;
|
|
||||||
|
|
||||||
private int volHold;
|
|
||||||
|
|
||||||
private int volSide;
|
|
||||||
|
|
||||||
private int volFlick;
|
|
||||||
|
|
||||||
private int volBell;
|
|
||||||
|
|
||||||
private int volEnemy;
|
|
||||||
|
|
||||||
private int volSkill;
|
|
||||||
|
|
||||||
private int volDamage;
|
|
||||||
|
|
||||||
private int colorField;
|
|
||||||
|
|
||||||
private int colorLaneBright;
|
|
||||||
|
|
||||||
private int colorWallBright;
|
|
||||||
|
|
||||||
private int colorLane;
|
|
||||||
|
|
||||||
private int colorSide;
|
|
||||||
|
|
||||||
private int effectDamage;
|
|
||||||
|
|
||||||
private int effectPos;
|
|
||||||
|
|
||||||
private int effectAttack;
|
|
||||||
|
|
||||||
private int judgeDisp;
|
|
||||||
|
|
||||||
private int judgePos;
|
|
||||||
|
|
||||||
private int judgeBreak;
|
|
||||||
|
|
||||||
private int judgeHit;
|
|
||||||
|
|
||||||
private int platinumBreakDisp;
|
|
||||||
|
|
||||||
private int judgeCriticalBreak;
|
|
||||||
|
|
||||||
private int matching;
|
|
||||||
|
|
||||||
private int dispPlayerLv;
|
|
||||||
|
|
||||||
private int dispRating;
|
|
||||||
|
|
||||||
private int dispBP;
|
|
||||||
|
|
||||||
private int headphone;
|
|
||||||
|
|
||||||
public UserOption(UserData userData) {
|
|
||||||
this.user = userData;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
package icu.samnyan.aqua.sega.ongeki.model.userdata;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
|
||||||
*/
|
|
||||||
@Entity(name = "OngekiUserSkin")
|
|
||||||
@Table(name = "ongeki_user_skin")
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class UserSkin implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@JsonIgnore
|
|
||||||
private long id;
|
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "user_id")
|
|
||||||
private UserData user;
|
|
||||||
|
|
||||||
//TODO: should be updated on net when changing skin
|
|
||||||
private boolean isValid;
|
|
||||||
|
|
||||||
private int deckId;
|
|
||||||
|
|
||||||
private int cardId1;
|
|
||||||
|
|
||||||
private int cardId2;
|
|
||||||
|
|
||||||
private int cardId3;
|
|
||||||
|
|
||||||
public UserSkin(UserData userData) {
|
|
||||||
this.user = userData;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue