forked from Cookies_Github_mirror/AquaDX
[O] Huge refactor
This commit is contained in:
@@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameSellingCardRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.gamedata.GameSellingCard;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameSellingCard;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -34,7 +34,7 @@ public class CMGetSellingCardHandler implements BaseHandler {
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
|
||||
List<GameSellingCard> sellingCardList = gameSellingCardRepository.findAll();
|
||||
List<Mai2GameSellingCard> sellingCardList = gameSellingCardRepository.findAll();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("length", sellingCardList.size());
|
||||
|
||||
@@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserCharacterRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserCharacter;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCharacter;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -34,7 +34,7 @@ public class CMGetUserCharacterHandler implements BaseHandler {
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
List<UserCharacter> userCharacterList = userCharacterRepository.findByUser_Card_ExtId(userId);
|
||||
List<Mai2UserCharacter> userCharacterList = userCharacterRepository.findByUser_Card_ExtId(userId);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("returnCode", 1);
|
||||
|
||||
@@ -2,7 +2,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
@@ -38,11 +38,11 @@ public class CMGetUserPreviewHandler implements BaseHandler {
|
||||
Long userId = ((Number) request.get("userId")).longValue();
|
||||
String segaIdAuthKey = String.valueOf(request.get("segaIdAuthKey"));
|
||||
|
||||
Optional<UserDetail> userDataOptional = userDataRepository.findByCardExtId(userId);
|
||||
Optional<Mai2UserDetail> userDataOptional = userDataRepository.findByCardExtId(userId);
|
||||
|
||||
if (userDataOptional.isPresent()) {
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
UserDetail user = userDataOptional.get();
|
||||
Mai2UserDetail user = userDataOptional.get();
|
||||
|
||||
resultMap.put("userName", user.getUserName());
|
||||
resultMap.put("rating", user.getPlayerRating());
|
||||
|
||||
@@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameChargeRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.gamedata.GameCharge;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameCharge;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -33,7 +33,7 @@ public class GetGameChargeHandler implements BaseHandler {
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
|
||||
List<GameCharge> gameChargeList = gameChargeRepository.findAll();
|
||||
List<Mai2GameCharge> gameChargeList = gameChargeRepository.findAll();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("length", gameChargeList.size());
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameEventRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.gamedata.GameEvent;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameEvent;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -36,7 +36,7 @@ public class GetGameEventHandler implements BaseHandler {
|
||||
int type = ((Number) request.get("type")).intValue();
|
||||
|
||||
// Not sure why maimai2 only do type=1 request
|
||||
List<GameEvent> gameEventList = gameEventRepository.findByTypeAndEnable(0, true);
|
||||
List<Mai2GameEvent> gameEventList = gameEventRepository.findByTypeAndEnable(0, true);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("type", type);
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserActRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserActivity;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserAct;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserAct;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -38,8 +38,8 @@ public class GetUserActivityHandler implements BaseHandler {
|
||||
|
||||
// kind 1 = playList, kind 2 = musicList
|
||||
// maimaiDX require these two
|
||||
List<UserAct> userPlayList = userActRepository.findByUser_Card_ExtIdAndKind(userId, 1);
|
||||
List<UserAct> userMusicList = userActRepository.findByUser_Card_ExtIdAndKind(userId, 2);
|
||||
List<Mai2UserAct> userPlayList = userActRepository.findByUser_Card_ExtIdAndKind(userId, 1);
|
||||
List<Mai2UserAct> userMusicList = userActRepository.findByUser_Card_ExtIdAndKind(userId, 2);
|
||||
|
||||
UserActivity userActivity = new UserActivity();
|
||||
userActivity.setMusicList(userMusicList);
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserCardRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserCard;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCard;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -40,7 +40,7 @@ public class GetUserCardHandler implements BaseHandler {
|
||||
|
||||
int pageNum = nextIndex / maxCount;
|
||||
|
||||
Page<UserCard> dbPage = userCardRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
Page<Mai2UserCard> dbPage = userCardRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
|
||||
int currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserCharacterRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserCharacter;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCharacter;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -34,7 +34,7 @@ public class GetUserCharacterHandler implements BaseHandler {
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
List<UserCharacter> userCharacterList = userCharacterRepository.findByUser_Card_ExtId(userId);
|
||||
List<Mai2UserCharacter> userCharacterList = userCharacterRepository.findByUser_Card_ExtId(userId);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
|
||||
@@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserChargeRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserCharge;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCharge;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -34,7 +34,7 @@ public class GetUserChargeHandler implements BaseHandler {
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
List<UserCharge> userChargeList = UserChargeRepository.findByUser_Card_ExtId(userId);
|
||||
List<Mai2UserCharge> userChargeList = UserChargeRepository.findByUser_Card_ExtId(userId);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
|
||||
@@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserCourseRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserCourse;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCourse;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -41,7 +41,7 @@ public class GetUserCourseHandler implements BaseHandler {
|
||||
|
||||
int pageNum = nextIndexVal / maxCount;
|
||||
|
||||
Page<UserCourse> dbPage = userCourseRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
Page<Mai2UserCourse> dbPage = userCourseRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
|
||||
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserDetail;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -33,7 +33,7 @@ public class GetUserDataHandler implements BaseHandler {
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
UserDetail userData = userDataRepository.findByCardExtId(userId).orElseThrow();
|
||||
Mai2UserDetail userData = userDataRepository.findByCardExtId(userId).orElseThrow();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
|
||||
@@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserExtendRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserExtend;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserExtend;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -33,7 +33,7 @@ public class GetUserExtendHandler implements BaseHandler {
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
UserExtend userExtend = userExtendRepository.findSingleByUser_Card_ExtId(userId).orElseThrow();
|
||||
Mai2UserExtend userExtend = userExtendRepository.findSingleByUser_Card_ExtId(userId).orElseThrow();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
|
||||
@@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserFavoriteRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserFavorite;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserFavorite;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -35,7 +35,7 @@ public class GetUserFavoriteHandler implements BaseHandler {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
int itemKind = ((Number) request.get("itemKind")).intValue();
|
||||
|
||||
List<UserFavorite> userFavoriteList = userFavoriteRepository.findByUserIdAndItemKind(userId, itemKind);
|
||||
List<Mai2UserFavorite> userFavoriteList = userFavoriteRepository.findByUserIdAndItemKind(userId, itemKind);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
|
||||
@@ -2,7 +2,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserFavoriteItem;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserGeneralData;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserGeneralData;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserGeneralDataRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
@@ -35,7 +35,7 @@ public class GetUserFavoriteItemHandler implements BaseHandler {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
int kind = ((Number) request.get("kind")).intValue();
|
||||
|
||||
Optional<UserGeneralData> favOptional;
|
||||
Optional<Mai2UserGeneralData> favOptional;
|
||||
List<UserFavoriteItem> items = new LinkedList<>();
|
||||
switch (kind) {
|
||||
case 1:
|
||||
@@ -50,7 +50,7 @@ public class GetUserFavoriteItemHandler implements BaseHandler {
|
||||
break;
|
||||
}
|
||||
if (favOptional.isPresent()) {
|
||||
String val = ((UserGeneralData) favOptional.get()).getPropertyValue();
|
||||
String val = ((Mai2UserGeneralData) favOptional.get()).getPropertyValue();
|
||||
if (StringUtils.isNotBlank(val)) {
|
||||
String[] records = val.split(",");
|
||||
int order = 0;
|
||||
|
||||
@@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserFriendSeasonRankingRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserFriendSeasonRanking;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserFriendSeasonRanking;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -39,7 +39,7 @@ public class GetUserFriendSeasonRankingHandler implements BaseHandler {
|
||||
|
||||
int pageNum = nextIndexVal / maxCount;
|
||||
|
||||
Page<UserFriendSeasonRanking> dbPage = userFriendSeasonRankingRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
Page<Mai2UserFriendSeasonRanking> dbPage = userFriendSeasonRankingRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
|
||||
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package icu.samnyan.aqua.sega.maimai2.handler
|
||||
|
||||
import icu.samnyan.aqua.net.games.mai2.Maimai2
|
||||
import icu.samnyan.aqua.sega.general.dao.CardRepository
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.general.dao.CardRepository
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserItem.Mai2ItemKind
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2ItemKind
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.data.domain.PageRequest
|
||||
|
||||
@@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserLoginBonusRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserLoginBonus;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserLoginBonus;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -39,7 +39,7 @@ public class GetUserLoginBonusHandler implements BaseHandler {
|
||||
|
||||
int pageNum = nextIndexVal / maxCount;
|
||||
|
||||
Page<UserLoginBonus> dbPage = userLoginBonusRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
Page<Mai2UserLoginBonus> dbPage = userLoginBonusRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
|
||||
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserMapRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserMap;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserMap;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -39,7 +39,7 @@ public class GetUserMapHandler implements BaseHandler {
|
||||
|
||||
int pageNum = nextIndexVal / maxCount;
|
||||
|
||||
Page<UserMap> dbPage = userMapRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
Page<Mai2UserMap> dbPage = userMapRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
|
||||
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserMusicDetailRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserMusic;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserMusicDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserMusicDetail;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -42,7 +42,7 @@ public class GetUserMusicHandler implements BaseHandler {
|
||||
|
||||
int pageNum = nextIndexVal / maxCount;
|
||||
|
||||
Page<UserMusicDetail> dbPage = userMusicDetailRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
Page<Mai2UserMusicDetail> dbPage = userMusicDetailRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
|
||||
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserOptionRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserOption;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserOption;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -33,7 +33,7 @@ public class GetUserOptionHandler implements BaseHandler {
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
UserOption userOption = userOptionRepository.findSingleByUser_Card_ExtId(userId).orElseThrow();
|
||||
Mai2UserOption userOption = userOptionRepository.findSingleByUser_Card_ExtId(userId).orElseThrow();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
|
||||
@@ -5,8 +5,8 @@ import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserOptionRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.GetUserPreviewResp;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserOption;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserOption;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -39,14 +39,14 @@ public class GetUserPreviewHandler implements BaseHandler {
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
Optional<UserDetail> userDataOptional = userDataRepository.findByCardExtId(userId);
|
||||
Optional<Mai2UserDetail> userDataOptional = userDataRepository.findByCardExtId(userId);
|
||||
|
||||
GetUserPreviewResp resp = new GetUserPreviewResp();
|
||||
resp.setUserId(userId);
|
||||
String json;
|
||||
if (userDataOptional.isPresent() && userDataOptional.get().getUserName() != null) {
|
||||
UserDetail user = userDataOptional.get();
|
||||
Optional<UserOption> userOptionOptional = userOptionRepository.findSingleByUser_Card_ExtId(userId);
|
||||
Mai2UserDetail user = userDataOptional.get();
|
||||
Optional<Mai2UserOption> userOptionOptional = userOptionRepository.findSingleByUser_Card_ExtId(userId);
|
||||
resp.setUserName(user.getUserName());
|
||||
resp.setLogin(false);
|
||||
resp.setLastGameId(user.getLastGameId());
|
||||
@@ -64,7 +64,7 @@ public class GetUserPreviewHandler implements BaseHandler {
|
||||
resp.setIsNetMember(user.isNetMember());
|
||||
resp.setDailyBonusDate(user.getDailyBonusDate());
|
||||
if (userOptionOptional.isPresent()) {
|
||||
UserOption option = userOptionOptional.get();
|
||||
Mai2UserOption option = userOptionOptional.get();
|
||||
resp.setHeadPhoneVolume(option.getHeadPhoneVolume());
|
||||
resp.setDispRate(option.getDispRate());
|
||||
}
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserGeneralDataRepo;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserUdemaeRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRating;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserGeneralData;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserRate;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserUdemae;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserRatingHandler")
|
||||
public class GetUserRatingHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserRatingHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
private final Mai2UserGeneralDataRepo userGeneralDataRepository;
|
||||
private final Mai2UserUdemaeRepo userUdemaeRepository;
|
||||
private final Mai2UserDataRepo userDataRepository;
|
||||
|
||||
public GetUserRatingHandler(BasicMapper mapper, Mai2UserUdemaeRepo userUdemaeRepository, Mai2UserGeneralDataRepo userGeneralDataRepository,
|
||||
Mai2UserDataRepo userDataRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userGeneralDataRepository = userGeneralDataRepository;
|
||||
this.userUdemaeRepository = userUdemaeRepository;
|
||||
this.userDataRepository = userDataRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
Optional<UserGeneralData> recentOptional = userGeneralDataRepository.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating");
|
||||
Optional<UserGeneralData> recentNewOptional = userGeneralDataRepository.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_new");
|
||||
Optional<UserGeneralData> recentNextOptional = userGeneralDataRepository.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_next");
|
||||
Optional<UserGeneralData> recentNextNewOptional = userGeneralDataRepository.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_next_new");
|
||||
List<UserRate> emptyRating = new ArrayList<>();
|
||||
|
||||
UserRating userRating = new UserRating();
|
||||
|
||||
Optional<UserDetail> userDataOptional = userDataRepository.findByCardExtId(userId);
|
||||
if (userDataOptional.isPresent() && userDataOptional.get().getUserName() != null) {
|
||||
UserDetail user = userDataOptional.get();
|
||||
userRating.setRating(user.getPlayerRating());
|
||||
}
|
||||
|
||||
// Old charts (standard) = 25
|
||||
if (recentOptional.isPresent()) {
|
||||
String val = recentOptional.get().getPropertyValue();
|
||||
userRating.setRatingList(loadRateData(val));
|
||||
} else {
|
||||
userRating.setRatingList(emptyRating);
|
||||
}
|
||||
|
||||
// New charts (DX) = 15
|
||||
if (recentNewOptional.isPresent()) {
|
||||
String val = recentNewOptional.get().getPropertyValue();
|
||||
userRating.setNewRatingList(loadRateData(val));
|
||||
} else {
|
||||
userRating.setNewRatingList(emptyRating);
|
||||
}
|
||||
|
||||
// ??
|
||||
if (recentNextOptional.isPresent()) {
|
||||
String val = recentNextOptional.get().getPropertyValue();
|
||||
userRating.setNextRatingList(loadRateData(val));
|
||||
} else {
|
||||
userRating.setNextRatingList(emptyRating);
|
||||
}
|
||||
|
||||
if (recentNextNewOptional.isPresent()) {
|
||||
String val = recentNextNewOptional.get().getPropertyValue();
|
||||
userRating.setNextNewRatingList(loadRateData(val));
|
||||
} else {
|
||||
userRating.setNextNewRatingList(emptyRating);
|
||||
}
|
||||
|
||||
Optional<UserUdemae> optionalUserUdemae = userUdemaeRepository.findSingleByUser_Card_ExtId(userId);
|
||||
if (optionalUserUdemae.isPresent()) {
|
||||
UserUdemae userUdemae = optionalUserUdemae.get();
|
||||
userRating.setUdemae(userUdemae);
|
||||
} else {
|
||||
userRating.setUdemae(new UserUdemae());
|
||||
}
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("userRating", userRating);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
|
||||
private List<UserRate> loadRateData(String val) {
|
||||
List<UserRate> rateList = new LinkedList<>();
|
||||
|
||||
if(StringUtils.isNotBlank(val) && val.contains(",")) {
|
||||
String[] records = val.split(",");
|
||||
for (String record :
|
||||
records) {
|
||||
String[] value = record.split(":");
|
||||
rateList.add(new UserRate(
|
||||
Integer.parseInt(value[0]),
|
||||
Integer.parseInt(value[1]),
|
||||
Integer.parseInt(value[2]),
|
||||
Integer.parseInt(value[3])
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return rateList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package icu.samnyan.aqua.sega.maimai2.handler
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException
|
||||
import ext.invoke
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRating
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserRate
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserUdemae
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserRatingHandler")
|
||||
class GetUserRatingHandler(
|
||||
val mapper: BasicMapper,
|
||||
val repos: Mai2Repos
|
||||
) : BaseHandler {
|
||||
@Throws(JsonProcessingException::class)
|
||||
override fun handle(request: Map<String, Any>): String {
|
||||
val userId = (request["userId"] as Number?)!!.toLong()
|
||||
val empty: List<Mai2UserRate> = ArrayList()
|
||||
|
||||
val ur = UserRating()
|
||||
|
||||
repos.userData.findByCardExtId(userId)()?.let {
|
||||
ur.rating = it.playerRating
|
||||
}
|
||||
|
||||
// Old charts (standard) = 25
|
||||
ur.ratingList = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating")()
|
||||
?.let { loadRateData(it.propertyValue) } ?: empty
|
||||
|
||||
// New charts (DX) = 15
|
||||
ur.newRatingList = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_new")()
|
||||
?.let { loadRateData(it.propertyValue) } ?: empty
|
||||
|
||||
ur.nextRatingList = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_next")()
|
||||
?.let { loadRateData(it.propertyValue) } ?: empty
|
||||
|
||||
ur.nextNewRatingList = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_next_new")()
|
||||
?.let { loadRateData(it.propertyValue) } ?: empty
|
||||
|
||||
ur.udemae = repos.userUdemae.findSingleByUser_Card_ExtId(userId)() ?: Mai2UserUdemae()
|
||||
|
||||
val resultMap: MutableMap<String, Any> = LinkedHashMap()
|
||||
resultMap["userId"] = userId
|
||||
resultMap["userRating"] = ur
|
||||
|
||||
val json = mapper.write(resultMap)
|
||||
logger.info("Response: $json")
|
||||
return json
|
||||
}
|
||||
|
||||
fun loadRateData(value: String) = value.split(",").map {
|
||||
val (musicId, level, beforeRating, afterRating) = it.split(":")
|
||||
Mai2UserRate(musicId.toInt(), level.toInt(), beforeRating.toInt(), afterRating.toInt())
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val logger: Logger = LoggerFactory.getLogger(GetUserRatingHandler::class.java)
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRivalData;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserDetail;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
|
||||
@Component("Maimai2GetUserRivalDataHandler")
|
||||
@@ -35,7 +35,7 @@ public class GetUserRivalDataHandler implements BaseHandler {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
long rivalId = ((Number) request.get("rivalId")).intValue();
|
||||
|
||||
Optional<UserDetail> detailOptional = userDataRepository.findByCardExtId(rivalId);
|
||||
Optional<Mai2UserDetail> detailOptional = userDataRepository.findByCardExtId(rivalId);
|
||||
UserRivalData rivalData;
|
||||
if (detailOptional.isPresent()) {
|
||||
rivalData = new UserRivalData(rivalId, detailOptional.get().getUserName());
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserMusicDetailRepo;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRivalMusic;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRivalMusicDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserMusicDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserMusicDetail;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
|
||||
@Component("Maimai2GetUserRivalMusicHandler")
|
||||
@@ -38,10 +38,10 @@ public class GetUserRivalMusicHandler implements BaseHandler {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
long rivalId = ((Number) request.get("rivalId")).intValue();
|
||||
|
||||
List<UserMusicDetail> details = userMusicDetailRepository.findByUser_Card_ExtId(rivalId);
|
||||
List<Mai2UserMusicDetail> details = userMusicDetailRepository.findByUser_Card_ExtId(rivalId);
|
||||
List<UserRivalMusic> userRivalMusicList = new LinkedList<UserRivalMusic>();
|
||||
Map<Integer, UserRivalMusic> userRivalMusicMap = new HashMap<Integer, UserRivalMusic>();
|
||||
for (UserMusicDetail detail : details) {
|
||||
for (Mai2UserMusicDetail detail : details) {
|
||||
int musicId = detail.getMusicId();
|
||||
UserRivalMusic info = userRivalMusicMap.getOrDefault(musicId, null);
|
||||
if (info == null) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserPlaylogRepo
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.maimai2.model.request.UploadUserPlaylog
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserPlaylog
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserPlaylog
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper
|
||||
import org.springframework.scheduling.annotation.Scheduled
|
||||
import org.springframework.stereotype.Component
|
||||
@@ -20,7 +20,7 @@ class UploadUserPlaylogHandler(
|
||||
private val playlogRepo: Mai2UserPlaylogRepo,
|
||||
private val mapper: BasicMapper
|
||||
) : BaseHandler {
|
||||
data class BacklogEntry(val time: Long, val playlog: UserPlaylog)
|
||||
data class BacklogEntry(val time: Long, val playlog: Mai2UserPlaylog)
|
||||
companion object {
|
||||
@JvmStatic
|
||||
val playBacklog = mutableMapOf<Long, MutableList<BacklogEntry>>()
|
||||
|
||||
@@ -1,346 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.model.Card;
|
||||
import icu.samnyan.aqua.sega.general.service.CardService;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.*;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.request.UpsertUserAll;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.request.data.UserAll;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserActivity;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRating;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.*;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Component("Maimai2UpsertUserAllHandler")
|
||||
public class UpsertUserAllHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(UpsertUserAllHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final CardService cardService;
|
||||
|
||||
private final Mai2UserDataRepo userDataRepository;
|
||||
private final Mai2UserExtendRepo userExtendRepository;
|
||||
private final Mai2UserOptionRepo userOptionRepository;
|
||||
private final Mai2UserItemRepo userItemRepository;
|
||||
private final Mai2UserMusicDetailRepo userMusicDetailRepository;
|
||||
private final Mai2UserActRepo userActRepository;
|
||||
private final Mai2UserCharacterRepo userCharacterRepository;
|
||||
private final Mai2UserMapRepo userMapRepository;
|
||||
private final Mai2UserLoginBonusRepo userLoginBonusRepository;
|
||||
private final Mai2UserFavoriteRepo userFavoriteRepository;
|
||||
private final Mai2UserUdemaeRepo userUdemaeRepository;
|
||||
private final Mai2UserGeneralDataRepo userGeneralDataRepository;
|
||||
private final Mai2UserCourseRepo userCourseRepository;
|
||||
private final Mai2UserFriendSeasonRankingRepo userFriendSeasonRankingRepository;
|
||||
private final Mai2UserPlaylogRepo userPlaylogRepository;
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
|
||||
UpsertUserAll upsertUserAll = mapper.convert(request, UpsertUserAll.class);
|
||||
long userId = upsertUserAll.getUserId();
|
||||
UserAll userAll = upsertUserAll.getUpsertUserAll();
|
||||
|
||||
// If user is guest, just return OK response.
|
||||
if ((userId & 281474976710657L) == 281474976710657L) {
|
||||
return "{\"returnCode\":1,\"apiName\":\"com.sega.maimai2servlet.api.UpsertUserAllApi\"}";
|
||||
}
|
||||
|
||||
// UserData
|
||||
UserDetail userData;
|
||||
UserDetail newUserData;
|
||||
if (userAll.getUserData() == null) {
|
||||
return null;
|
||||
} else {
|
||||
newUserData = userAll.getUserData().get(0);
|
||||
Optional<UserDetail> userOptional = userDataRepository.findByCardExtId(userId);
|
||||
|
||||
if (userOptional.isPresent()) {
|
||||
userData = userOptional.get();
|
||||
} else {
|
||||
userData = new UserDetail();
|
||||
Card card = cardService.getCardByExtId(userId).orElseThrow();
|
||||
userData.setCard(card);
|
||||
}
|
||||
|
||||
newUserData.setId(userData.getId());
|
||||
newUserData.setCard(userData.getCard());
|
||||
// Decode Username
|
||||
String userName = new String(newUserData.getUserName());
|
||||
|
||||
newUserData.setUserName(userName);
|
||||
|
||||
// Set isNetMember value to 1, which enables some in-game features.
|
||||
newUserData.setNetMember(1);
|
||||
userDataRepository.saveAndFlush(newUserData);
|
||||
|
||||
// Check playlog backlog
|
||||
var backlog = UploadUserPlaylogHandler.getPlayBacklog();
|
||||
if (backlog.containsKey(userId))
|
||||
backlog.remove(userId).forEach(it -> {
|
||||
it.getPlaylog().setUser(newUserData);
|
||||
userPlaylogRepository.save(it.getPlaylog());
|
||||
});
|
||||
}
|
||||
|
||||
// UserExtend
|
||||
if (userAll.getUserExtend() != null) {
|
||||
UserExtend newUserExtend = userAll.getUserExtend().get(0);
|
||||
|
||||
Optional<UserExtend> userExtendOptional = userExtendRepository.findSingleByUser(newUserData);
|
||||
UserExtend userExtend = userExtendOptional.orElseGet(() -> new UserExtend(newUserData));
|
||||
|
||||
newUserExtend.setId(userExtend.getId());
|
||||
newUserExtend.setUser(userExtend.getUser());
|
||||
|
||||
userExtendRepository.save(newUserExtend);
|
||||
}
|
||||
|
||||
// UserOption
|
||||
if (userAll.getUserOption() != null) {
|
||||
UserOption newUserOption = userAll.getUserOption().get(0);
|
||||
|
||||
Optional<UserOption> userOptionOptional = userOptionRepository.findSingleByUser(newUserData);
|
||||
UserOption userOption = userOptionOptional.orElseGet(() -> new UserOption(newUserData));
|
||||
|
||||
newUserOption.setId(userOption.getId());
|
||||
newUserOption.setUser(userOption.getUser());
|
||||
|
||||
userOptionRepository.save(newUserOption);
|
||||
}
|
||||
|
||||
// UserCharacterList
|
||||
if (userAll.getUserCharacterList() != null) {
|
||||
List<UserCharacter> userCharacterList = userAll.getUserCharacterList();
|
||||
List<UserCharacter> newUserCharacterList = new ArrayList<>();
|
||||
for (UserCharacter newUserCharacter : userCharacterList) {
|
||||
int id = newUserCharacter.getCharacterId();
|
||||
|
||||
Optional<UserCharacter> characterOptional = userCharacterRepository.findByUserAndCharacterId(newUserData, id);
|
||||
UserCharacter userCharacter = characterOptional.orElseGet(() -> new UserCharacter(newUserData));
|
||||
|
||||
newUserCharacter.setId(userCharacter.getId());
|
||||
newUserCharacter.setUser(newUserData);
|
||||
newUserCharacterList.add(newUserCharacter);
|
||||
}
|
||||
userCharacterRepository.saveAll(newUserCharacterList);
|
||||
}
|
||||
|
||||
// UserGhost : worthless
|
||||
|
||||
// UserMapList
|
||||
if (userAll.getUserMapList() != null) {
|
||||
List<UserMap> userMapList = userAll.getUserMapList();
|
||||
List<UserMap> newUserMapList = new ArrayList<>();
|
||||
for (UserMap newUserMap : userMapList) {
|
||||
int mapId = newUserMap.getMapId();
|
||||
|
||||
Optional<UserMap> mapOptional = userMapRepository.findByUserAndMapId(newUserData, mapId);
|
||||
UserMap userMap = mapOptional.orElseGet(() -> new UserMap(newUserData));
|
||||
|
||||
newUserMap.setId(userMap.getId());
|
||||
newUserMap.setUser(newUserData);
|
||||
newUserMapList.add(newUserMap);
|
||||
}
|
||||
userMapRepository.saveAll(newUserMapList);
|
||||
}
|
||||
|
||||
// UserLoginBonusList
|
||||
if (userAll.getUserLoginBonusList() != null) {
|
||||
List<UserLoginBonus> userLoginBonusList = userAll.getUserLoginBonusList();
|
||||
List<UserLoginBonus> newUserLoginBonusList = new ArrayList<>();
|
||||
for (UserLoginBonus newUserLoginBonus : userLoginBonusList) {
|
||||
int bonusId = newUserLoginBonus.getBonusId();
|
||||
|
||||
Optional<UserLoginBonus> loginBonusOptional = userLoginBonusRepository.findByUserAndBonusId(newUserData, bonusId);
|
||||
UserLoginBonus userLoginBonus = loginBonusOptional.orElseGet(() -> new UserLoginBonus(newUserData));
|
||||
|
||||
newUserLoginBonus.setId(userLoginBonus.getId());
|
||||
newUserLoginBonus.setUser(newUserData);
|
||||
newUserLoginBonusList.add(newUserLoginBonus);
|
||||
}
|
||||
userLoginBonusRepository.saveAll(newUserLoginBonusList);
|
||||
}
|
||||
|
||||
// UserRatingList
|
||||
if (userAll.getUserRatingList() != null) {
|
||||
UserRating userRating = userAll.getUserRatingList().get(0);
|
||||
|
||||
//Udemae
|
||||
UserUdemae newUserUdemae = userRating.getUdemae();
|
||||
|
||||
Optional<UserUdemae> udemaeOptional = userUdemaeRepository.findSingleByUser(newUserData);
|
||||
UserUdemae userUdemae = udemaeOptional.orElseGet(() -> new UserUdemae(newUserData));
|
||||
|
||||
newUserUdemae.setId(userUdemae.getId());
|
||||
newUserUdemae.setUser(newUserData);
|
||||
|
||||
userUdemaeRepository.saveAndFlush(newUserUdemae);
|
||||
|
||||
/* UserRate:
|
||||
Let's save recent user rating as same as ongeki implementation.
|
||||
Previously saved rating will not compatible with this and will be lost, sorry.
|
||||
*/
|
||||
|
||||
this.saveGeneralData(userRating.getRatingList(), newUserData, "recent_rating");
|
||||
this.saveGeneralData(userRating.getNewRatingList(), newUserData, "recent_rating_new");
|
||||
this.saveGeneralData(userRating.getNextRatingList(), newUserData, "recent_rating_next");
|
||||
this.saveGeneralData(userRating.getNextNewRatingList(), newUserData, "recent_rating_next_new");
|
||||
}
|
||||
|
||||
// UserItemList
|
||||
if (userAll.getUserItemList() != null) {
|
||||
List<UserItem> userItemList = userAll.getUserItemList();
|
||||
List<UserItem> newUserItemList = new ArrayList<>();
|
||||
|
||||
for (UserItem newUserItem : userItemList) {
|
||||
int itemId = newUserItem.getItemId();
|
||||
int itemKind = newUserItem.getItemKind();
|
||||
|
||||
Optional<UserItem> itemOptional = userItemRepository.findByUserAndItemKindAndItemId(newUserData, itemKind, itemId);
|
||||
UserItem userItem = itemOptional.orElseGet(() -> new UserItem(newUserData));
|
||||
|
||||
newUserItem.setId(userItem.getId());
|
||||
newUserItem.setUser(newUserData);
|
||||
newUserItemList.add(newUserItem);
|
||||
|
||||
}
|
||||
userItemRepository.saveAll(newUserItemList);
|
||||
}
|
||||
|
||||
// UserMusicDetailList
|
||||
if (userAll.getUserMusicDetailList() != null) {
|
||||
List<UserMusicDetail> userMusicDetailList = userAll.getUserMusicDetailList();
|
||||
List<UserMusicDetail> newUserMusicDetailList = new ArrayList<>();
|
||||
|
||||
for (UserMusicDetail newUserMusicDetail : userMusicDetailList) {
|
||||
int musicId = newUserMusicDetail.getMusicId();
|
||||
int level = newUserMusicDetail.getLevel();
|
||||
|
||||
Optional<UserMusicDetail> musicDetailOptional = userMusicDetailRepository.findByUserAndMusicIdAndLevel(newUserData, musicId, level);
|
||||
UserMusicDetail userMusicDetail = musicDetailOptional.orElseGet(() -> new UserMusicDetail(newUserData));
|
||||
|
||||
newUserMusicDetail.setId(userMusicDetail.getId());
|
||||
newUserMusicDetail.setUser(newUserData);
|
||||
newUserMusicDetailList.add(newUserMusicDetail);
|
||||
}
|
||||
userMusicDetailRepository.saveAll(newUserMusicDetailList);
|
||||
}
|
||||
|
||||
// UserCourseList
|
||||
if (userAll.getUserCourseList() != null) {
|
||||
List<UserCourse> userCourseList = userAll.getUserCourseList();
|
||||
List<UserCourse> newUserCourseList = new ArrayList<>();
|
||||
|
||||
for (UserCourse newUserCourse : userCourseList) {
|
||||
int courseId = newUserCourse.getCourseId();
|
||||
|
||||
Optional<UserCourse> userCourseOptional = userCourseRepository.findByUserAndCourseId(newUserData, courseId);
|
||||
UserCourse userCourse = userCourseOptional.orElseGet(() -> new UserCourse(newUserData));
|
||||
|
||||
newUserCourse.setId(userCourse.getId());
|
||||
newUserCourse.setUser(newUserData);
|
||||
newUserCourseList.add(newUserCourse);
|
||||
}
|
||||
userCourseRepository.saveAll(newUserCourseList);
|
||||
}
|
||||
|
||||
// UserFriendSeasonRankingList
|
||||
if (userAll.getUserFriendSeasonRankingList() != null) {
|
||||
List<UserFriendSeasonRanking> userFriendSeasonRankingList = userAll.getUserFriendSeasonRankingList();
|
||||
List<UserFriendSeasonRanking> newUserFriendSeasonRankingList = new ArrayList<>();
|
||||
|
||||
for (UserFriendSeasonRanking newUserFriendSeasonRanking : userFriendSeasonRankingList) {
|
||||
int seasonId = newUserFriendSeasonRanking.getSeasonId();
|
||||
|
||||
Optional<UserFriendSeasonRanking> userFriendSeasonRankingOptional = userFriendSeasonRankingRepository.findByUserAndSeasonId(newUserData, seasonId);
|
||||
UserFriendSeasonRanking userFriendSeasonRanking = userFriendSeasonRankingOptional.orElseGet(() -> new UserFriendSeasonRanking(newUserData));
|
||||
|
||||
newUserFriendSeasonRanking.setId(userFriendSeasonRanking.getId());
|
||||
newUserFriendSeasonRanking.setUser(newUserData);
|
||||
newUserFriendSeasonRankingList.add(newUserFriendSeasonRanking);
|
||||
}
|
||||
userFriendSeasonRankingRepository.saveAll(newUserFriendSeasonRankingList);
|
||||
}
|
||||
|
||||
// UserFavoriteList
|
||||
if (userAll.getUserFavoriteList() != null) {
|
||||
List<UserFavorite> userFavoriteList = userAll.getUserFavoriteList();
|
||||
List<UserFavorite> newUserFavoriteList = new ArrayList<>();
|
||||
for (UserFavorite newUserFavorite : userFavoriteList) {
|
||||
int itemKind = newUserFavorite.getItemKind();
|
||||
|
||||
Optional<UserFavorite> favoriteOptional = userFavoriteRepository.findByUserAndItemKind(newUserData, itemKind);
|
||||
UserFavorite userFavorite = favoriteOptional.orElseGet(() -> new UserFavorite());
|
||||
|
||||
newUserFavorite.setId(userFavorite.getId());
|
||||
newUserFavorite.setUser(newUserData);
|
||||
newUserFavoriteList.add(newUserFavorite);
|
||||
}
|
||||
userFavoriteRepository.saveAll(newUserFavoriteList);
|
||||
}
|
||||
|
||||
// UserActivityList
|
||||
if (userAll.getUserActivityList() != null) {
|
||||
UserActivity userActivity = userAll.getUserActivityList().get(0);
|
||||
List<UserAct> newUserActList = new ArrayList<>();
|
||||
|
||||
List<List<UserAct>> activityList = new ArrayList<>();
|
||||
activityList.add(userActivity.getMusicList());
|
||||
activityList.add(userActivity.getPlayList());
|
||||
|
||||
for (List<UserAct> actList : activityList) {
|
||||
for (UserAct newUserAct : actList) {
|
||||
int kind = newUserAct.getKind();
|
||||
int id = newUserAct.getActivityId();
|
||||
|
||||
if (kind != 0 && id != 0) {
|
||||
Optional<UserAct> activityOptional = userActRepository.findByUserAndKindAndActivityId(newUserData, kind, id);
|
||||
UserAct userAct = activityOptional.orElseGet(() -> new UserAct(newUserData));
|
||||
|
||||
newUserAct.setId(userAct.getId());
|
||||
newUserAct.setUser(newUserData);
|
||||
newUserActList.add(newUserAct);
|
||||
}
|
||||
}
|
||||
}
|
||||
newUserActList.sort((a, b) -> Long.compare(b.getSortNumber(), a.getSortNumber()));
|
||||
userActRepository.saveAll(newUserActList);
|
||||
}
|
||||
|
||||
return "{\"returnCode\":1,\"apiName\":\"com.sega.maimai2servlet.api.UpsertUserAllApi\"}";
|
||||
}
|
||||
|
||||
private void saveGeneralData(List<UserRate> itemList, UserDetail newUserData, String key) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// Convert to a string
|
||||
for (UserRate item :
|
||||
itemList) {
|
||||
sb.append(item.getMusicId()).append(":").append(item.getLevel()).append(":").append(item.getRomVersion()).append(":").append(item.getAchievement());
|
||||
sb.append(",");
|
||||
}
|
||||
if (!sb.isEmpty()) {
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
}
|
||||
Optional<UserGeneralData> uOptional = userGeneralDataRepository.findByUserAndPropertyKey(newUserData, key);
|
||||
UserGeneralData userGeneralData = uOptional.orElseGet(() -> new UserGeneralData(newUserData, key));
|
||||
userGeneralData.setPropertyValue(sb.toString());
|
||||
userGeneralDataRepository.save(userGeneralData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package icu.samnyan.aqua.sega.maimai2.handler
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException
|
||||
import ext.invoke
|
||||
import ext.mapApply
|
||||
import ext.minus
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.general.service.CardService
|
||||
import icu.samnyan.aqua.sega.maimai2.handler.UploadUserPlaylogHandler.Companion.playBacklog
|
||||
import icu.samnyan.aqua.sega.maimai2.model.*
|
||||
import icu.samnyan.aqua.sega.maimai2.model.request.UpsertUserAll
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.*
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper
|
||||
import lombok.AllArgsConstructor
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Component("Maimai2UpsertUserAllHandler")
|
||||
class UpsertUserAllHandler(
|
||||
val mapper: BasicMapper,
|
||||
val cardService: CardService,
|
||||
val repos: Mai2Repos
|
||||
) : BaseHandler {
|
||||
val SUCCESS = """{"returnCode":1,"apiName":"com.sega.maimai2servlet.api.UpsertUserAllApi"}"""
|
||||
|
||||
@Throws(JsonProcessingException::class)
|
||||
override fun handle(request: Map<String, Any>): Any? {
|
||||
val upsertUserAll = mapper.convert(request, UpsertUserAll::class.java)
|
||||
val userId = upsertUserAll.userId
|
||||
val req = upsertUserAll.upsertUserAll
|
||||
|
||||
// If user is guest, just return OK response.
|
||||
if ((userId and 281474976710657L) == 281474976710657L) return SUCCESS
|
||||
|
||||
// UserData
|
||||
if (req.userData == null) 400 - "Invalid Request"
|
||||
|
||||
val userData = repos.userData.findByCardExtId(userId)()
|
||||
val u = repos.userData.saveAndFlush(req.userData[0].apply {
|
||||
id = userData?.id ?: 0
|
||||
card = userData?.card ?: cardService.getCardByExtId(userId).orElseThrow()
|
||||
isNetMember = 1
|
||||
})
|
||||
|
||||
// Check playlog backlog
|
||||
if (playBacklog.containsKey(userId)) playBacklog.remove(userId)?.forEach {
|
||||
repos.userPlaylog.save(it.playlog.apply { user = u })
|
||||
}
|
||||
|
||||
// Set users
|
||||
req.run { listOf(userExtend, userOption, userCharacterList, userMapList, userLoginBonusList, userItemList,
|
||||
userMusicDetailList, userCourseList, userFriendSeasonRankingList, userFavoriteList) }
|
||||
.forEach { it?.forEach { it?.user = u } }
|
||||
|
||||
req.userExtend?.getOrNull(0)?.let {
|
||||
repos.userExtend.save(it.apply { id = repos.userExtend.findSingleByUser(u)()?.id ?: 0 })
|
||||
}
|
||||
|
||||
req.userOption?.getOrNull(0)?.let {
|
||||
repos.userOption.save(it.apply { id = repos.userOption.findSingleByUser(u)()?.id ?: 0 })
|
||||
}
|
||||
|
||||
req.userCharacterList?.let { news ->
|
||||
repos.userCharacter.saveAll(news.mapApply {
|
||||
id = repos.userCharacter.findByUserAndCharacterId(u, characterId)()?.id ?: 0 }) }
|
||||
|
||||
req.userMapList?.let { news ->
|
||||
repos.userMap.saveAll(news.mapApply {
|
||||
id = repos.userMap.findByUserAndMapId(u, mapId)()?.id ?: 0 }) }
|
||||
|
||||
req.userLoginBonusList?.let { news ->
|
||||
repos.userLoginBonus.saveAll(news.mapApply {
|
||||
id = repos.userLoginBonus.findByUserAndBonusId(u, bonusId)()?.id ?: 0 }) }
|
||||
|
||||
req.userRatingList?.getOrNull(0)?.let { r ->
|
||||
repos.userUdemae.saveAndFlush(r.udemae.apply {
|
||||
id = repos.userUdemae.findSingleByUser(u)()?.id ?: 0
|
||||
user = u
|
||||
})
|
||||
|
||||
saveRating(r.ratingList, u, "recent_rating")
|
||||
saveRating(r.newRatingList, u, "recent_rating_new")
|
||||
saveRating(r.nextRatingList, u, "recent_rating_next")
|
||||
saveRating(r.nextNewRatingList, u, "recent_rating_next_new")
|
||||
}
|
||||
|
||||
req.userItemList?.let { news ->
|
||||
repos.userItem.saveAll(news.mapApply {
|
||||
id = repos.userItem.findByUserAndItemKindAndItemId(u, itemKind, itemId)()?.id ?: 0 }) }
|
||||
|
||||
req.userMusicDetailList?.let { news ->
|
||||
repos.userMusicDetail.saveAll(news.mapApply {
|
||||
id = repos.userMusicDetail.findByUserAndMusicIdAndLevel(u, musicId, level)()?.id ?: 0 }) }
|
||||
|
||||
req.userCourseList?.let { news ->
|
||||
repos.userCourse.saveAll(news.mapApply {
|
||||
id = repos.userCourse.findByUserAndCourseId(u, courseId)()?.id ?: 0 }) }
|
||||
|
||||
req.userFriendSeasonRankingList?.let { news ->
|
||||
repos.userFriendSeasonRanking.saveAll(news.mapApply {
|
||||
id = repos.userFriendSeasonRanking.findByUserAndSeasonId(u, seasonId)()?.id ?: 0 }) }
|
||||
|
||||
req.userFavoriteList?.let { news ->
|
||||
repos.userFavorite.saveAll(news.mapApply {
|
||||
id = repos.userFavorite.findByUserAndItemKind(u, itemKind)()?.id ?: 0 }) }
|
||||
|
||||
req.userActivityList?.let { news ->
|
||||
repos.userAct.saveAll(news.flatMap { listOf(it.musicList, it.playList) }.flatten()
|
||||
.filter { it.kind != 0 && it.activityId != 0 }
|
||||
.mapApply {
|
||||
id = repos.userAct.findByUserAndKindAndActivityId(u, kind, activityId)()?.id ?: 0
|
||||
user = u
|
||||
}.sortedBy { it.sortNumber })
|
||||
}
|
||||
|
||||
return SUCCESS
|
||||
}
|
||||
|
||||
fun saveRating(itemList: List<Mai2UserRate>, u: Mai2UserDetail, key: String) {
|
||||
val sb = itemList.joinToString(",") { "${it.musicId}:${it.level}:${it.romVersion}:${it.achievement}" }
|
||||
val data = repos.userGeneralData.findByUserAndPropertyKey(u, key)()
|
||||
?: Mai2UserGeneralData().apply { user = u; propertyKey = key }
|
||||
repos.userGeneralData.save(data.apply { propertyValue = sb })
|
||||
}
|
||||
|
||||
companion object {
|
||||
val logger: Logger = LoggerFactory.getLogger(UpsertUserAllHandler::class.java)
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,9 @@ import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserPrintDetailRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.request.UpsertUserPrint;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserCard;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.UserPrintDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCard;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserPrintDetail;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -45,9 +45,9 @@ public class UpsertUserPrintHandler implements BaseHandler {
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
UserDetail userData;
|
||||
Mai2UserDetail userData;
|
||||
|
||||
Optional<UserDetail> userOptional = userDataRepository.findByCardExtId(userId);
|
||||
Optional<Mai2UserDetail> userOptional = userDataRepository.findByCardExtId(userId);
|
||||
if (userOptional.isPresent()) {
|
||||
userData = userOptional.get();
|
||||
} else {
|
||||
@@ -57,8 +57,8 @@ public class UpsertUserPrintHandler implements BaseHandler {
|
||||
|
||||
UpsertUserPrint upsertUserPrint = mapper.convert(request, UpsertUserPrint.class);
|
||||
|
||||
UserPrintDetail userPrintDetail = upsertUserPrint.getUserPrintDetail();
|
||||
UserCard newUserCard = userPrintDetail.getUserCard();
|
||||
Mai2UserPrintDetail userPrintDetail = upsertUserPrint.getUserPrintDetail();
|
||||
Mai2UserCard newUserCard = userPrintDetail.getUserCard();
|
||||
|
||||
newUserCard.setUser(userData);
|
||||
userPrintDetail.setUser(userData);
|
||||
@@ -67,9 +67,9 @@ public class UpsertUserPrintHandler implements BaseHandler {
|
||||
newUserCard.setEndDate("2029-01-01 00:00:00.000000");
|
||||
userPrintDetail.setSerialId("FAKECARDIMAG12345678");
|
||||
|
||||
Optional<UserCard> userCardOptional = userCardRepository.findByUserAndCardId(newUserCard.getUser(), newUserCard.getCardId());
|
||||
Optional<Mai2UserCard> userCardOptional = userCardRepository.findByUserAndCardId(newUserCard.getUser(), newUserCard.getCardId());
|
||||
if (userCardOptional.isPresent()) {
|
||||
UserCard userCard = userCardOptional.get();
|
||||
Mai2UserCard userCard = userCardOptional.get();
|
||||
newUserCard.setId(userCard.getId());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user