[ongeki] Add ongeki basic support and api endpoint.

pull/1/head
samnyan 2020-03-21 01:05:42 +09:00
parent c27a45a4d4
commit d3223309e3
91 changed files with 7322 additions and 16 deletions

View File

@ -0,0 +1,82 @@
package icu.samnyan.aqua.api.controller.sega.game.ongeki;
import icu.samnyan.aqua.sega.ongeki.dao.gamedata.*;
import icu.samnyan.aqua.sega.ongeki.model.gamedata.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@RestController
@RequestMapping("api/game/ongeki/data")
public class ApiOngekiGameDataController {
private final GameCardRepository gameCardRepository;
private final GameCharaRepository gameCharaRepository;
private final GameEventRepository gameEventRepository;
private final GameMusicRepository gameMusicRepository;
private final GameSkillRepository gameSkillRepository;
public ApiOngekiGameDataController(GameCardRepository gameCardRepository, GameCharaRepository gameCharaRepository, GameEventRepository gameEventRepository, GameMusicRepository gameMusicRepository, GameSkillRepository gameSkillRepository) {
this.gameCardRepository = gameCardRepository;
this.gameCharaRepository = gameCharaRepository;
this.gameEventRepository = gameEventRepository;
this.gameMusicRepository = gameMusicRepository;
this.gameSkillRepository = gameSkillRepository;
}
@GetMapping("cardList")
public List<GameCard> getCardList() {
return gameCardRepository.findAll();
}
@GetMapping("charaList")
public List<GameChara> getCharaList() {
return gameCharaRepository.findAll();
}
@GetMapping("eventList")
public List<GameEvent> getEventList() {
return gameEventRepository.findAll();
}
@GetMapping("musicList")
public List<GameMusic> getMusicList() {
return gameMusicRepository.findAll();
}
@GetMapping("skillList")
public List<GameSkill> getSkillList() {
return gameSkillRepository.findAll();
}
//
// @PostMapping("cardList")
// public List<GameCard> getCardList(@RequestBody List<GameCard> req) {
// return gameCardRepository.saveAll(req);
// }
//
// @PostMapping("charaList")
// public List<GameChara> getCharaList(@RequestBody List<GameChara> req) {
// return gameCharaRepository.saveAll(req);
// }
//
// @PostMapping("eventList")
// public List<GameEvent> getEventList(@RequestBody List<GameEvent> req) {
// return gameEventRepository.saveAll(req);
// }
//
// @PostMapping("musicList")
// public List<GameMusic> getMusicList(@RequestBody List<GameMusic> req) {
// return gameMusicRepository.saveAll(req);
// }
//
// @PostMapping("skillList")
// public List<GameSkill> getSkillList(@RequestBody List<GameSkill> req) {
// return gameSkillRepository.saveAll(req);
// }
}

View File

@ -0,0 +1,149 @@
package icu.samnyan.aqua.api.controller.sega.game.ongeki;
import com.fasterxml.jackson.core.type.TypeReference;
import icu.samnyan.aqua.api.model.ReducedPageResponse;
import icu.samnyan.aqua.api.model.resp.sega.ongeki.ProfileResp;
import icu.samnyan.aqua.api.util.ApiMapper;
import icu.samnyan.aqua.sega.ongeki.dao.gamedata.GameCardRepository;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.*;
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GameCard;
import icu.samnyan.aqua.sega.ongeki.model.userdata.*;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@RestController
@RequestMapping("api/game/ongeki")
public class ApiOngekiPlayerDataController {
private final ApiMapper mapper;
private final UserActivityRepository userActivityRepository;
private final UserCardRepository userCardRepository;
private final UserCharacterRepository userCharacterRepository;
private final UserDataRepository userDataRepository;
private final UserDeckRepository userDeckRepository;
private final UserEventPointRepository userEventPointRepository;
private final UserItemRepository userItemRepository;
private final UserMusicDetailRepository userMusicDetailRepository;
private final UserOptionRepository userOptionRepository;
private final UserPlaylogRepository userPlaylogRepository;
private final GameCardRepository gameCardRepository;
public ApiOngekiPlayerDataController(ApiMapper mapper, UserActivityRepository userActivityRepository, UserCardRepository userCardRepository, UserCharacterRepository userCharacterRepository, UserDataRepository userDataRepository, UserDeckRepository userDeckRepository, UserEventPointRepository userEventPointRepository, UserItemRepository userItemRepository, UserMusicDetailRepository userMusicDetailRepository, UserOptionRepository userOptionRepository, UserPlaylogRepository userPlaylogRepository, GameCardRepository gameCardRepository) {
this.mapper = mapper;
this.userActivityRepository = userActivityRepository;
this.userCardRepository = userCardRepository;
this.userCharacterRepository = userCharacterRepository;
this.userDataRepository = userDataRepository;
this.userDeckRepository = userDeckRepository;
this.userEventPointRepository = userEventPointRepository;
this.userItemRepository = userItemRepository;
this.userMusicDetailRepository = userMusicDetailRepository;
this.userOptionRepository = userOptionRepository;
this.userPlaylogRepository = userPlaylogRepository;
this.gameCardRepository = gameCardRepository;
}
@GetMapping("profile")
public ProfileResp getProfile(@RequestParam Integer aimeId) {
return mapper.convert(userDataRepository.findByCard_ExtId(aimeId).orElseThrow(), new TypeReference<>() {
});
}
@PostMapping("profile/userName")
public UserData updateName(@RequestBody Map<String, Object> request) {
UserData profile = userDataRepository.findByCard_ExtId((Integer) request.get("aimeId")).orElseThrow();
profile.setUserName((String) request.get("userName"));
return userDataRepository.save(profile);
}
@PostMapping("profile/plate")
public UserData updatePlate(@RequestBody Map<String, Object> request) {
UserData profile = userDataRepository.findByCard_ExtId((Integer) request.get("aimeId")).orElseThrow();
profile.setNameplateId((Integer) request.get("nameplateId"));
return userDataRepository.save(profile);
}
@PostMapping("profile/trophy")
public UserData updateTrophy(@RequestBody Map<String, Object> request) {
UserData profile = userDataRepository.findByCard_ExtId((Integer) request.get("aimeId")).orElseThrow();
profile.setTrophyId((Integer) request.get("trophyId"));
return userDataRepository.save(profile);
}
@PostMapping("profile/card")
public UserData updateCard(@RequestBody Map<String, Object> request) {
UserData profile = userDataRepository.findByCard_ExtId((Integer) request.get("aimeId")).orElseThrow();
profile.setCardId((Integer) request.get("cardId"));
return userDataRepository.save(profile);
}
@GetMapping("card")
public ReducedPageResponse<UserCard> getCard(@RequestParam Integer aimeId,
@RequestParam(required = false, defaultValue = "0") int page,
@RequestParam(required = false, defaultValue = "10") int size) {
Page<UserCard> cards = userCardRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page,size));
return new ReducedPageResponse<>(cards.getContent(), cards.getPageable().getPageNumber(), cards.getTotalPages(), cards.getTotalElements());
}
@PostMapping("insert")
public UserCard insertCard(@RequestBody Map<String, Object> request) {
UserData profile = userDataRepository.findByCard_ExtId((Integer) request.get("aimeId")).orElseThrow();
Integer cardId = (Integer) request.get("cardId");
GameCard card = gameCardRepository.findById(cardId.longValue()).orElseThrow();
return userCardRepository.save(new UserCard(
profile,
cardId,
card.getSkillId()
));
}
@GetMapping("character")
public ReducedPageResponse<UserCharacter> getCharacter(@RequestParam Integer aimeId,
@RequestParam(required = false, defaultValue = "0") int page,
@RequestParam(required = false, defaultValue = "10") int size) {
Page<UserCharacter> characters = userCharacterRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page,size));
return new ReducedPageResponse<>(characters.getContent(), characters.getPageable().getPageNumber(), characters.getTotalPages(), characters.getTotalElements());
}
@GetMapping("item")
public ReducedPageResponse<UserItem> getItem(@RequestParam Integer aimeId,
@RequestParam(required = false, defaultValue = "0") int page,
@RequestParam(required = false, defaultValue = "10") int size) {
Page<UserItem> items = userItemRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page,size));
return new ReducedPageResponse<>(items.getContent(), items.getPageable().getPageNumber(), items.getTotalPages(), items.getTotalElements());
}
@GetMapping("recent")
public ReducedPageResponse<UserPlaylog> getRecent(@RequestParam Integer aimeId,
@RequestParam(required = false, defaultValue = "0") int page,
@RequestParam(required = false, defaultValue = "10") int size) {
Page<UserPlaylog> playlogs = userPlaylogRepository.findByUser_Card_ExtId(aimeId,PageRequest.of(page,size, Sort.Direction.DESC, "id"));
return new ReducedPageResponse<>(playlogs.getContent(), playlogs.getPageable().getPageNumber(), playlogs.getTotalPages(), playlogs.getTotalElements());
}
@GetMapping("song/{id}")
public List<UserMusicDetail> getSongDetail(@RequestParam Integer aimeId, @PathVariable int id) {
return userMusicDetailRepository.findByUser_Card_ExtIdAndMusicId(aimeId, id);
}
@GetMapping("song/{id}/{level}")
public List<UserPlaylog> getLevelPlaylog(@RequestParam Integer aimeId, @PathVariable int id, @PathVariable int level) {
return userPlaylogRepository.findByUser_Card_ExtIdAndMusicIdAndLevel(aimeId, id, level);
}
@GetMapping("options")
public UserOption getOptions(@RequestParam Integer aimeId) {
return userOptionRepository.findByUser_Card_ExtId(aimeId).orElseThrow();
}
}

View File

@ -0,0 +1,69 @@
package icu.samnyan.aqua.api.model.resp.sega.ongeki;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ProfileResp {
private String userName;
private int level;
private long exp;
private long point;
private long totalPoint;
private int playCount;
private int jewelCount;
private int totalJewelCount;
private int playerRating;
private int highestRating;
private int battlePoint;
private int nameplateId;
private int trophyId;
private int cardId;
private int characterId;
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;
}

View File

@ -73,7 +73,7 @@ public class AllNetController {
case "SBZV":
return "http://" + HOST + ":" + PORT + "/diva/";
default:
return "http://" + HOST + ":" + PORT + "/";
return "http://" + HOST + ":" + PORT + "/ongeki/";
}
}

View File

@ -40,7 +40,7 @@ public class GetGameEventHandler implements BaseHandler {
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("type", type);
resultMap.put("length", 0);
resultMap.put("length", gameEventList.size());
resultMap.put("gameEventList", gameEventList);
String json = mapper.write(resultMap);

View File

@ -1,7 +1,7 @@
package icu.samnyan.aqua.sega.diva.filter;
import icu.samnyan.aqua.sega.chunithm.filter.ChuniRequestWrapper;
import icu.samnyan.aqua.sega.chunithm.filter.ChuniResponseWrapper;
import icu.samnyan.aqua.sega.general.filter.CompressRequestWrapper;
import icu.samnyan.aqua.sega.general.filter.CompressResponseWrapper;
import icu.samnyan.aqua.sega.util.Compression;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -37,8 +37,8 @@ public class DivaCompressionFilter extends OncePerRequestFilter {
reqResult = reqSrc;
}
ChuniRequestWrapper requestWrapper = new ChuniRequestWrapper(request, reqResult);
ChuniResponseWrapper responseWrapper = new ChuniResponseWrapper(response);
CompressRequestWrapper requestWrapper = new CompressRequestWrapper(request, reqResult);
CompressResponseWrapper responseWrapper = new CompressResponseWrapper(response);
filterChain.doFilter(requestWrapper, responseWrapper);
byte[] respSrc = responseWrapper.toByteArray();

View File

@ -1,4 +1,4 @@
package icu.samnyan.aqua.sega.chunithm.filter;
package icu.samnyan.aqua.sega.general.filter;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
@ -10,12 +10,12 @@ import java.io.IOException;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
public class ChuniRequestWrapper extends HttpServletRequestWrapper {
public class CompressRequestWrapper extends HttpServletRequestWrapper {
private ByteArrayInputStream input;
private ServletInputStream filterInput;
public ChuniRequestWrapper(HttpServletRequest request, byte[] input) {
public CompressRequestWrapper(HttpServletRequest request, byte[] input) {
super(request);
this.input = new ByteArrayInputStream(input);
}

View File

@ -1,4 +1,4 @@
package icu.samnyan.aqua.sega.chunithm.filter;
package icu.samnyan.aqua.sega.general.filter;
import javax.servlet.ServletOutputStream;
import javax.servlet.WriteListener;
@ -10,13 +10,13 @@ import java.io.IOException;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
public class ChuniResponseWrapper extends HttpServletResponseWrapper {
public class CompressResponseWrapper extends HttpServletResponseWrapper {
private ByteArrayOutputStream output;
private ServletOutputStream filterOutput;
public ChuniResponseWrapper(HttpServletResponse response) {
public CompressResponseWrapper(HttpServletResponse response) {
super(response);
output = new ByteArrayOutputStream();
}

View File

@ -1,4 +1,4 @@
package icu.samnyan.aqua.sega.chunithm.filter;
package icu.samnyan.aqua.sega.general.filter;
import icu.samnyan.aqua.sega.util.Compression;
import org.slf4j.Logger;
@ -11,6 +11,8 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* @author samnyan (privateamusement@protonmail.com)
@ -19,10 +21,18 @@ import java.io.IOException;
public class CompressionFilter extends OncePerRequestFilter {
private static final Logger logger = LoggerFactory.getLogger(CompressionFilter.class);
private final List<String> filterList;
public CompressionFilter() {
filterList = new ArrayList<>();
filterList.add("/ChuniServlet");
filterList.add("/ongeki");
}
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
logger.debug("Do compress filter");
String encoding = request.getHeader("content-encoding");
byte[] reqSrc = request.getInputStream().readAllBytes();
@ -33,8 +43,8 @@ public class CompressionFilter extends OncePerRequestFilter {
reqResult = reqSrc;
}
ChuniRequestWrapper requestWrapper = new ChuniRequestWrapper(request, reqResult);
ChuniResponseWrapper responseWrapper = new ChuniResponseWrapper(response);
CompressRequestWrapper requestWrapper = new CompressRequestWrapper(request, reqResult);
CompressResponseWrapper responseWrapper = new CompressResponseWrapper(response);
filterChain.doFilter(requestWrapper, responseWrapper);
@ -53,6 +63,13 @@ public class CompressionFilter extends OncePerRequestFilter {
@Override
protected boolean shouldNotFilter(HttpServletRequest request) throws ServletException {
String path = request.getServletPath();
return !path.startsWith("/ChuniServlet");
boolean notFilter = true;
for (String prefix : filterList) {
if (path.startsWith(prefix)) {
notFilter = false;
break;
}
}
return notFilter;
}
}

View File

@ -23,4 +23,8 @@ public class CardService {
public Optional<Card> getCardByExtId(String extId) {
return cardRepository.findByExtId(Integer.parseInt(extId));
}
public Optional<Card> getCardByExtId(int extId) {
return cardRepository.findByExtId(extId);
}
}

View File

@ -0,0 +1,280 @@
package icu.samnyan.aqua.sega.ongeki.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.handler.impl.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@RestController
@RequestMapping("ongeki")
public class OngekiController {
private final GetGameEventHandler getGameEventHandler;
private final GetGameIdlistHandler getGameIdlistHandler;
private final GetGameMessageHandler getGameMessageHandler;
private final GetGamePointHandler getGamePointHandler;
private final GetGamePresentHandler getGamePresentHandler;
private final GetGameRankingHandler getGameRankingHandler;
private final GetGameRewardHandler getGameRewardHandler;
private final GetGameSettingHandler getGameSettingHandler;
private final GetUserActivityHandler getUserActivityHandler;
private final GetUserBpBaseHandler getUserBpBaseHandler;
private final GetUserCardHandler getUserCardHandler;
private final GetUserChapterHandler getUserChapterHandler;
private final GetUserCharacterHandler getUserCharacterHandler;
private final GetUserDataHandler getUserDataHandler;
private final GetUserDeckByKeyHandler getUserDeckByKeyHandler;
private final GetUserEventPointHandler getUserEventPointHandler;
private final GetUserEventRankingHandler getUserEventRankingHandler;
private final GetUserItemHandler getUserItemHandler;
private final GetUserLoginBonusHandler getUserLoginBonusHandler;
private final GetUserMissionPointHandler getUserMissionPointHandler;
private final GetUserMusicHandler getUserMusicHandler;
private final GetUserMusicItemHandler getUserMusicItemHandler;
private final GetUserOptionHandler getUserOptionHandler;
private final GetUserPreviewHandler getUserPreviewHandler;
private final GetUserRatinglogListHandler getUserRatinglogListHandler;
private final GetUserRecentRatingHandler getUserRecentRatingHandler;
private final GetUserRegionHandler getUserRegionHandler;
private final GetUserStoryHandler getUserStoryHandler;
private final GetUserTrainingRoomByKeyHandler getUserTrainingRoomByKeyHandler;
private final UpsertUserAllHandler upsertUserAllHandler;
@Autowired
public OngekiController(GetGameEventHandler getGameEventHandler, GetGameIdlistHandler getGameIdlistHandler, GetGameMessageHandler getGameMessageHandler, GetGamePointHandler getGamePointHandler, GetGamePresentHandler getGamePresentHandler, GetGameRankingHandler getGameRankingHandler, GetGameRewardHandler getGameRewardHandler, GetGameSettingHandler getGameSettingHandler, GetUserActivityHandler getUserActivityHandler, GetUserBpBaseHandler getUserBpBaseHandler, GetUserCardHandler getUserCardHandler, GetUserChapterHandler getUserChapterHandler, GetUserCharacterHandler getUserCharacterHandler, GetUserDataHandler getUserDataHandler, GetUserDeckByKeyHandler getUserDeckByKeyHandler, GetUserEventPointHandler getUserEventPointHandler, GetUserEventRankingHandler getUserEventRankingHandler, GetUserItemHandler getUserItemHandler, GetUserLoginBonusHandler getUserLoginBonusHandler, GetUserMissionPointHandler getUserMissionPointHandler, GetUserMusicHandler getUserMusicHandler, GetUserMusicItemHandler getUserMusicItemHandler, GetUserOptionHandler getUserOptionHandler, GetUserPreviewHandler getUserPreviewHandler, GetUserRatinglogListHandler getUserRatinglogListHandler, GetUserRecentRatingHandler getUserRecentRatingHandler, GetUserRegionHandler getUserRegionHandler, GetUserStoryHandler getUserStoryHandler, GetUserTrainingRoomByKeyHandler getUserTrainingRoomByKeyHandler, UpsertUserAllHandler upsertUserAllHandler) {
this.getGameEventHandler = getGameEventHandler;
this.getGameIdlistHandler = getGameIdlistHandler;
this.getGameMessageHandler = getGameMessageHandler;
this.getGamePointHandler = getGamePointHandler;
this.getGamePresentHandler = getGamePresentHandler;
this.getGameRankingHandler = getGameRankingHandler;
this.getGameRewardHandler = getGameRewardHandler;
this.getGameSettingHandler = getGameSettingHandler;
this.getUserActivityHandler = getUserActivityHandler;
this.getUserBpBaseHandler = getUserBpBaseHandler;
this.getUserCardHandler = getUserCardHandler;
this.getUserChapterHandler = getUserChapterHandler;
this.getUserCharacterHandler = getUserCharacterHandler;
this.getUserDataHandler = getUserDataHandler;
this.getUserDeckByKeyHandler = getUserDeckByKeyHandler;
this.getUserEventPointHandler = getUserEventPointHandler;
this.getUserEventRankingHandler = getUserEventRankingHandler;
this.getUserItemHandler = getUserItemHandler;
this.getUserLoginBonusHandler = getUserLoginBonusHandler;
this.getUserMissionPointHandler = getUserMissionPointHandler;
this.getUserMusicHandler = getUserMusicHandler;
this.getUserMusicItemHandler = getUserMusicItemHandler;
this.getUserOptionHandler = getUserOptionHandler;
this.getUserPreviewHandler = getUserPreviewHandler;
this.getUserRatinglogListHandler = getUserRatinglogListHandler;
this.getUserRecentRatingHandler = getUserRecentRatingHandler;
this.getUserRegionHandler = getUserRegionHandler;
this.getUserStoryHandler = getUserStoryHandler;
this.getUserTrainingRoomByKeyHandler = getUserTrainingRoomByKeyHandler;
this.upsertUserAllHandler = upsertUserAllHandler;
}
@PostMapping("ExtendLockTimeApi")
String extendLockTime(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return "{\"returnCode\":1,\"apiName\":\"extendLockTime\"}";
}
@PostMapping("GameLoginApi")
String gameLogin(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return "{\"returnCode\":1,\"apiName\":\"gameLogin\"}";
}
@PostMapping("GameLogoutApi")
String gameLogout(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return "{\"returnCode\":1,\"apiName\": \"gameLogout\"}";
}
@PostMapping("GetGameEventApi")
String getGameEvent(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getGameEventHandler.handle(request);
}
@PostMapping("GetGameIdlistApi")
String getGameIdList(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getGameIdlistHandler.handle(request);
}
@PostMapping("GetGameMessageApi")
String getGameMessage(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getGameMessageHandler.handle(request);
}
@PostMapping("GetGamePointApi")
String getGamePoint(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getGamePointHandler.handle(request);
}
@PostMapping("GetGamePresentApi")
String getGamePresent(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getGamePresentHandler.handle(request);
}
@PostMapping("GetGameRankingApi")
String getGameRanking(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getGameRankingHandler.handle(request);
}
@PostMapping("GetGameRewardApi")
String getGameReward(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getGameRewardHandler.handle(request);
}
@PostMapping("GetGameSettingApi")
String getGameSetting(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getGameSettingHandler.handle(request);
}
@PostMapping("GetUserActivityApi")
String getUserActivity(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserActivityHandler.handle(request);
}
@PostMapping("GetUserBpBaseApi")
String getUserBpBase(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserBpBaseHandler.handle(request);
}
@PostMapping("GetUserCardApi")
String getUserCard(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserCardHandler.handle(request);
}
@PostMapping("GetUserChapterApi")
String getUserChapter(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserChapterHandler.handle(request);
}
@PostMapping("GetUserCharacterApi")
String getUserCharacter(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserCharacterHandler.handle(request);
}
@PostMapping("GetUserDataApi")
String getUserData(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserDataHandler.handle(request);
}
@PostMapping("GetUserDeckByKeyApi")
String getUserDeckByKey(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserDeckByKeyHandler.handle(request);
}
@PostMapping("GetUserEventPointApi")
String getUserEventPoint(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserEventPointHandler.handle(request);
}
@PostMapping("GetUserEventRankingApi")
String getUserEventRanking(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserEventRankingHandler.handle(request);
}
@PostMapping("GetUserItemApi")
String getUserItem(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserItemHandler.handle(request);
}
@PostMapping("GetUserLoginBonusApi")
String getUserLoginBonus(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserLoginBonusHandler.handle(request);
}
@PostMapping("GetUserMissionPointApi")
String getUserMissionPoint(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserMissionPointHandler.handle(request);
}
@PostMapping("GetUserMusicApi")
String getUserMusic(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserMusicHandler.handle(request);
}
@PostMapping("GetUserMusicItemApi")
String getUserMusicItem(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserMusicItemHandler.handle(request);
}
@PostMapping("GetUserOptionApi")
String getUserOption(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserOptionHandler.handle(request);
}
@PostMapping("GetUserPreviewApi")
String getUserPreview(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserPreviewHandler.handle(request);
}
@PostMapping("GetUserRatinglogApi")
String getUserRatinglog(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserRatinglogListHandler.handle(request);
}
@PostMapping("GetUserRecentRatingApi")
String getUserRecentRating(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserRecentRatingHandler.handle(request);
}
@PostMapping("GetUserRegionApi")
String getUserRegion(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserRegionHandler.handle(request);
}
@PostMapping("GetUserStoryApi")
String getUserStory(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserStoryHandler.handle(request);
}
@PostMapping("GetUserTrainingRoomByKeyApi")
String getUserTrainingRoomByKey(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserTrainingRoomByKeyHandler.handle(request);
}
@PostMapping("UpsertClientBookkeepingApi")
String upsertClientBookkeeping(@ModelAttribute Map<String, Object> request) {
return "{\"returnCode\":1},\"apiName\":\"upsertClientBookkeeping\"";
}
@PostMapping("UpsertClientDevelopApi")
String upsertClientDevelop(@ModelAttribute Map<String, Object> request) {
return "{\"returnCode\":1},\"apiName\":\"upsertClientDevelop\"";
}
@PostMapping("UpsertClientErrorApi")
String upsertClientError(@ModelAttribute Map<String, Object> request) {
return "{\"returnCode\":1,\"apiName\":\"upsertClientError\"}";
}
@PostMapping("UpsertClientSettingApi")
String upsertClientSetting(@ModelAttribute Map<String, Object> request) {
return "{\"returnCode\":1,\"apiName\":\"upsertClientSetting\"}";
}
@PostMapping("UpsertClientTestmodeApi")
String upsertClientTestmode(@ModelAttribute Map<String, Object> request) {
return "{\"returnCode\":1,\"apiName\":\"upsertClientTestmode\"}";
}
@PostMapping("UpsertUserGplogApi")
String upsertUserGplog(@ModelAttribute Map<String, Object> request) {
return "{\"returnCode\":1,\"apiName\":\"upsertUserGplog\"}";
}
@PostMapping("UpsertUserAllApi")
String upsertUserAll(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return upsertUserAllHandler.handle(request);
}
}

View File

@ -0,0 +1,39 @@
package icu.samnyan.aqua.sega.ongeki.controller;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@RestControllerAdvice(basePackages = "icu.samnyan.aqua.sega.ongeki")
public class OngekiControllerAdvice {
private static final Logger logger = LoggerFactory.getLogger(OngekiControllerAdvice.class);
/**
* Get the map object from json string
*
* @param request HttpServletRequest
*/
@ModelAttribute
public Map<String, Object> preHandle(HttpServletRequest request) throws IOException {
byte[] src = request.getInputStream().readAllBytes();
String outputString = new String(src, StandardCharsets.UTF_8).trim();
logger.info("Request " + request.getRequestURI() + ": " + outputString);
ObjectMapper mapper = new ObjectMapper();
return mapper.readValue(outputString, new TypeReference<>() {
});
}
}

View File

@ -0,0 +1,12 @@
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GameCard;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiGameCardRepository")
public interface GameCardRepository extends JpaRepository<GameCard, Long> {
}

View File

@ -0,0 +1,12 @@
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GameChara;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiGameCharaRepository")
public interface GameCharaRepository extends JpaRepository<GameChara, Long> {
}

View File

@ -0,0 +1,12 @@
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GameEvent;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiGameEventRepository")
public interface GameEventRepository extends JpaRepository<GameEvent, Long> {
}

View File

@ -0,0 +1,12 @@
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GameMusic;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiGameMusicRepository")
public interface GameMusicRepository extends JpaRepository<GameMusic, Long> {
}

View File

@ -0,0 +1,12 @@
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GameSkill;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiGameSkillRepository")
public interface GameSkillRepository extends JpaRepository<GameSkill, Long> {
}

View File

@ -0,0 +1,19 @@
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserActivity;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiUserActivityRepository")
public interface UserActivityRepository extends JpaRepository<UserActivity, Long> {
Optional<UserActivity> findByUserAndKindAndActivityId(UserData userData, int kind, int activityId);
List<UserActivity> findByUser_Card_ExtIdAndKindOrderBySortNumberDesc(int userId, int kind);
}

View File

@ -0,0 +1,20 @@
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserCard;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiUserCardRepository")
public interface UserCardRepository extends JpaRepository<UserCard, Long> {
Optional<UserCard> findByUserAndCardId(UserData userData, int cardId);
Page<UserCard> findByUser_Card_ExtId(int userId, Pageable page);
}

View File

@ -0,0 +1,19 @@
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserChapter;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiUserChapterRepository")
public interface UserChapterRepository extends JpaRepository<UserChapter, Long> {
Optional<UserChapter> findByUserAndChapterId(UserData userData, int chapterId);
List<UserChapter> findByUser_Card_ExtId(int userId);
}

View File

@ -0,0 +1,20 @@
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserCharacter;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiUserCharacterRepository")
public interface UserCharacterRepository extends JpaRepository<UserCharacter, Long> {
Optional<UserCharacter> findByUserAndCharacterId(UserData userData, int characterId);
Page<UserCharacter> findByUser_Card_ExtId(Integer userId, Pageable page);
}

View File

@ -0,0 +1,16 @@
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiUserDataRepository")
public interface UserDataRepository extends JpaRepository<UserData, Long> {
Optional<UserData> findByCard_ExtId(int aimeId);
}

View File

@ -0,0 +1,19 @@
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.UserDeck;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiUserDeckRepository")
public interface UserDeckRepository extends JpaRepository<UserDeck, Long> {
Optional<UserDeck> findByUserAndDeckId(UserData userData, int deckId);
List<UserDeck> findByUser_Card_ExtId(int userId);
}

View File

@ -0,0 +1,19 @@
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.UserEventPoint;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiUserEventPointRepository")
public interface UserEventPointRepository extends JpaRepository<UserEventPoint, Long> {
Optional<UserEventPoint> findByUserAndEventId(UserData userData, int eventId);
List<UserEventPoint> findByUser_Card_ExtId(int userId);
}

View File

@ -0,0 +1,22 @@
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.UserItem;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiUserItemRepository")
public interface UserItemRepository extends JpaRepository<UserItem, Long> {
Optional<UserItem> findByUserAndItemKindAndItemId(UserData userData, int itemKind, int itemId);
Page<UserItem> findByUser_Card_ExtIdAndItemKind(int userId, int kind, Pageable page);
Page<UserItem> findByUser_Card_ExtId(Integer aimeId, Pageable page);
}

View File

@ -0,0 +1,17 @@
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.UserLoginBonus;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
public interface UserLoginBonusRepository extends JpaRepository<UserLoginBonus, Long> {
Optional<UserLoginBonus> findByUserAndBonusId(UserData userData, int bonusId);
List<UserLoginBonus> findByUser_Card_ExtId(int userId);
}

View File

@ -0,0 +1,23 @@
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.UserMusicDetail;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiUserMusicDetailRepository")
public interface UserMusicDetailRepository extends JpaRepository<UserMusicDetail, Long> {
Optional<UserMusicDetail> findByUserAndMusicIdAndLevel(UserData userData, int musicId, int level);
Page<UserMusicDetail> findByUser_Card_ExtId(int userId, Pageable page);
List<UserMusicDetail> findByUser_Card_ExtIdAndMusicId(int userId, int id);
}

View File

@ -0,0 +1,20 @@
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.UserMusicItem;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiUserMusicItemRepository")
public interface UserMusicItemRepository extends JpaRepository<UserMusicItem, Long> {
Optional<UserMusicItem> findByUserAndMusicId(UserData userData, int musicId);
Page<UserMusicItem> findByUser_Card_ExtId(int userId, Pageable page);
}

View File

@ -0,0 +1,18 @@
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.UserOption;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiUserOptionRepository")
public interface UserOptionRepository extends JpaRepository<UserOption, Long> {
Optional<UserOption> findByUser(UserData userData);
Optional<UserOption> findByUser_Card_ExtId(int userId);
}

View File

@ -0,0 +1,19 @@
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserPlaylog;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiUserPlaylogRepository")
public interface UserPlaylogRepository extends JpaRepository<UserPlaylog, Long> {
Page<UserPlaylog> findByUser_Card_ExtId(Integer userId, Pageable page);
List<UserPlaylog> findByUser_Card_ExtIdAndMusicIdAndLevel(Integer userId, int musicId, int level);
}

View File

@ -0,0 +1,16 @@
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.UserStory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiUserStoryRepository")
public interface UserStoryRepository extends JpaRepository<UserStory, Long> {
Optional<UserStory> findByUserAndStoryId(UserData userData, int storyId);
}

View File

@ -0,0 +1,12 @@
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserTrainingRoom;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiUserTrainingRoomRepository")
public interface UserTrainingRoomRepository extends JpaRepository<UserTrainingRoom, Long> {
}

View File

@ -0,0 +1,13 @@
package icu.samnyan.aqua.sega.ongeki.handler;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
public interface BaseHandler {
String handle(Map<String, Object> request) throws JsonProcessingException;
}

View File

@ -0,0 +1,61 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.gamedata.GameEventRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GameEvent;
import icu.samnyan.aqua.sega.ongeki.model.response.data.GameEventItem;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetGameEventHandler")
public class GetGameEventHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetGameEventHandler.class);
private final BasicMapper mapper;
private final GameEventRepository gameEventRepository;
@Autowired
public GetGameEventHandler(BasicMapper mapper, GameEventRepository gameEventRepository) {
this.mapper = mapper;
this.gameEventRepository = gameEventRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer type = (Integer) request.get("type");
List<GameEvent> eventIdList = gameEventRepository.findAll();
List<GameEventItem> eventList = new ArrayList<>();
eventIdList.forEach(x -> {
eventList.add(new GameEventItem(
x.getId(),
type,
"2005-01-01 00:00:00.0",
"2099-01-01 00:00:00.0"
));
});
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("type", type);
resultMap.put("length", eventList.size());
resultMap.put("gameEventList", eventList);
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,56 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.response.data.GameIdListItem;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetGameIdlistHandler")
public class GetGameIdlistHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetGameIdlistHandler.class);
private final BasicMapper mapper;
@Autowired
public GetGameIdlistHandler(BasicMapper mapper) {
this.mapper = mapper;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer type = (Integer) request.get("type");
List<GameIdListItem> idList = new ArrayList<>();
if(type == 1) {
for (int i = 1; i <= 230; i++) {
idList.add(new GameIdListItem(i,type));
}
for (int i = 8000; i <= 8050; i++) {
idList.add(new GameIdListItem(i,type));
}
}
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("type", type);
resultMap.put("length", idList.size());
resultMap.put("gameIdlistList", idList);
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,45 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetGameMessageHHandler")
public class GetGameMessageHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetGameMessageHandler.class);
private final BasicMapper mapper;
@Autowired
public GetGameMessageHandler(BasicMapper mapper) {
this.mapper = mapper;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer type = (Integer) request.get("type");
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("type", type);
resultMap.put("length", 0);
resultMap.put("gameMessageList", new List[]{});
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,44 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetGamePointHandler")
public class GetGamePointHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetGamePointHandler.class);
private final BasicMapper mapper;
@Autowired
public GetGamePointHandler(BasicMapper mapper) {
this.mapper = mapper;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Boolean isAllGP = (Boolean) request.get("isAllGP");
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("length", 0);
resultMap.put("gamePointList", new List[]{});
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,44 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetGamePresentHandler")
public class GetGamePresentHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetGamePresentHandler.class);
private final BasicMapper mapper;
@Autowired
public GetGamePresentHandler(BasicMapper mapper) {
this.mapper = mapper;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
// Boolean isAllGP = (Boolean) request.get("isAllReward");
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("length", 0);
resultMap.put("gamePresentList", new List[]{});
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,44 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetGameRankingHandler")
public class GetGameRankingHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetGameRankingHandler.class);
private final BasicMapper mapper;
@Autowired
public GetGameRankingHandler(BasicMapper mapper) {
this.mapper = mapper;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer type = (Integer) request.get("type");
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("type", type);
resultMap.put("length", 0);
resultMap.put("gameRankingList", new List[]{});
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,44 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetGameRewardHandler")
public class GetGameRewardHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetGameRewardHandler.class);
private final BasicMapper mapper;
@Autowired
public GetGameRewardHandler(BasicMapper mapper) {
this.mapper = mapper;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Boolean isAllGP = (Boolean) request.get("isAllReward");
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("length", 0);
resultMap.put("gameRewardList", new List[]{});
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,57 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.response.GetGameSettingResp;
import icu.samnyan.aqua.sega.ongeki.model.response.data.GameSetting;
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.time.LocalDateTime;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetGameSettingHandler")
public class GetGameSettingHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetGameSettingHandler.class);
private final BasicMapper mapper;
@Autowired
public GetGameSettingHandler(BasicMapper mapper) {
this.mapper = mapper;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
GameSetting gameSetting = new GameSetting(
"1.05.00",
false,
10,
LocalDateTime.now().minusHours(5),
LocalDateTime.now().minusHours(2),
false,
300,
300,
300);
GetGameSettingResp resp = new GetGameSettingResp(
gameSetting,
false,
false
);
String json = mapper.write(resp);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,54 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserActivityRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserActivity;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserActivityHandler")
public class GetUserActivityHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserActivityHandler.class);
private final BasicMapper mapper;
private final UserActivityRepository userActivityRepository;
@Autowired
public GetUserActivityHandler(BasicMapper mapper, UserActivityRepository userActivityRepository) {
this.mapper = mapper;
this.userActivityRepository = userActivityRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Integer kind = (Integer) request.get("kind");
List<UserActivity> activityList = userActivityRepository.findByUser_Card_ExtIdAndKindOrderBySortNumberDesc(userId,kind);
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", activityList.size());
resultMap.put("kind", kind);
resultMap.put("userActivityList", activityList);
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,46 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* The game doesn't use this request. It will calculate from the music detail request.
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserBpBaseHandler")
public class GetUserBpBaseHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserBpBaseHandler.class);
private final BasicMapper mapper;
@Autowired
public GetUserBpBaseHandler(BasicMapper mapper) {
this.mapper = mapper;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", 0);
resultMap.put("userBpBaseList", new List[]{});
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,60 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserCardRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserCard;
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.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Component;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserCardHandler")
public class GetUserCardHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserCardHandler.class);
private final BasicMapper mapper;
private final UserCardRepository userCardRepository;
@Autowired
public GetUserCardHandler(BasicMapper mapper, UserCardRepository userCardRepository) {
this.mapper = mapper;
this.userCardRepository = userCardRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Integer maxCount = (Integer) request.get("maxCount");
Integer nextIndex = (Integer) request.get("nextIndex");
int pageNum = nextIndex / maxCount;
Page<UserCard> dbPage = userCardRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", dbPage.getNumberOfElements());
resultMap.put("nextIndex", dbPage.getNumberOfElements() < maxCount ? -1 : currentIndex);
resultMap.put("userCardList", dbPage.getContent());
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,51 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserChapterRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserChapter;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserChapterHandler")
public class GetUserChapterHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserChapterHandler.class);
private final BasicMapper mapper;
private final UserChapterRepository userChapterRepository;
@Autowired
public GetUserChapterHandler(BasicMapper mapper, UserChapterRepository userChapterRepository) {
this.mapper = mapper;
this.userChapterRepository = userChapterRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
List<UserChapter> chapterList = userChapterRepository.findByUser_Card_ExtId(userId);
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", chapterList.size());
resultMap.put("userChapterList", chapterList);
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,60 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserCharacterRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserCharacter;
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.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Component;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserCharacterHandler")
public class GetUserCharacterHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserCharacterHandler.class);
private final BasicMapper mapper;
private final UserCharacterRepository userCharacterRepository;
@Autowired
public GetUserCharacterHandler(BasicMapper mapper, UserCharacterRepository userCharacterRepository) {
this.mapper = mapper;
this.userCharacterRepository = userCharacterRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Integer maxCount = (Integer) request.get("maxCount");
Integer nextIndex = (Integer) request.get("nextIndex");
int pageNum = nextIndex / maxCount;
Page<UserCharacter> dbPage = userCharacterRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", dbPage.getNumberOfElements());
resultMap.put("nextIndex", dbPage.getNumberOfElements() < maxCount ? -1 : currentIndex);
resultMap.put("userCharacterList", dbPage.getContent());
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,55 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserDataRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.userdata.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.LinkedHashMap;
import java.util.Map;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserDataHandler")
public class GetUserDataHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserDataHandler.class);
private final BasicMapper mapper;
private final UserDataRepository userDataRepository;
@Autowired
public GetUserDataHandler(BasicMapper mapper, UserDataRepository userDataRepository) {
this.mapper = mapper;
this.userDataRepository = userDataRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Optional<UserData> userDataOptional = userDataRepository.findByCard_ExtId(userId);
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
if(userDataOptional.isPresent()) {
resultMap.put("userData", userDataOptional.get());
} else {
resultMap.put("userData",null);
}
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,52 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserDeckRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserDeck;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserDeckByKeyHandler")
public class GetUserDeckByKeyHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserDeckByKeyHandler.class);
private final BasicMapper mapper;
private final UserDeckRepository userDeckRepository;
@Autowired
public GetUserDeckByKeyHandler(BasicMapper mapper, UserDeckRepository userDeckRepository) {
this.mapper = mapper;
this.userDeckRepository = userDeckRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
List<UserDeck> deckList = userDeckRepository.findByUser_Card_ExtId(userId);
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", deckList.size());
resultMap.put("userDeckList", deckList);
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,52 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserEventPointRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserEventPoint;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserEventPointHandler")
public class GetUserEventPointHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserEventPointHandler.class);
private final BasicMapper mapper;
private final UserEventPointRepository userEventPointRepository;
@Autowired
public GetUserEventPointHandler(BasicMapper mapper, UserEventPointRepository userEventPointRepository) {
this.mapper = mapper;
this.userEventPointRepository = userEventPointRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
List<UserEventPoint> eventPointList = userEventPointRepository.findByUser_Card_ExtId(userId);
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", eventPointList.size());
resultMap.put("userEventPointList", eventPointList);
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,49 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserEventPointRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserEventRankingHandler")
public class GetUserEventRankingHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserEventRankingHandler.class);
private final BasicMapper mapper;
private final UserEventPointRepository userEventPointRepository;
@Autowired
public GetUserEventRankingHandler(BasicMapper mapper, UserEventPointRepository userEventPointRepository) {
this.mapper = mapper;
this.userEventPointRepository = userEventPointRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", 0);
resultMap.put("userEventRankingList", new List[]{});
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,65 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserItemRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserItem;
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.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Component;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserItemHandler")
public class GetUserItemHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserItemHandler.class);
private final BasicMapper mapper;
private final UserItemRepository userItemRepository;
@Autowired
public GetUserItemHandler(BasicMapper mapper, UserItemRepository userItemRepository) {
this.mapper = mapper;
this.userItemRepository = userItemRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Long nextIndexVal = (Long) request.get("nextIndex");
Integer maxCount = (Integer) request.get("maxCount");
Long mul = 10000000000L;
int kind = (int) (nextIndexVal / mul);
int nextIndex = (int) (nextIndexVal % mul);
int pageNum = nextIndex / maxCount;
Page<UserItem> dbPage = userItemRepository.findByUser_Card_ExtIdAndItemKind(userId, kind, PageRequest.of(pageNum, maxCount));
long currentIndex = kind * mul + maxCount * pageNum + dbPage.getNumberOfElements();
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", dbPage.getNumberOfElements());
resultMap.put("nextIndex", dbPage.getNumberOfElements() < maxCount ? -1 : currentIndex);
resultMap.put("itemKind", kind);
resultMap.put("userItemList", dbPage.getContent());
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,52 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserLoginBonusRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserLoginBonus;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserLoginBonusHandler")
public class GetUserLoginBonusHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserLoginBonusHandler.class);
private final BasicMapper mapper;
private final UserLoginBonusRepository userLoginBonusRepository;
@Autowired
public GetUserLoginBonusHandler(BasicMapper mapper, UserLoginBonusRepository userLoginBonusRepository) {
this.mapper = mapper;
this.userLoginBonusRepository = userLoginBonusRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
List<UserLoginBonus> loginBonusList = userLoginBonusRepository.findByUser_Card_ExtId(userId);
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", loginBonusList.size());
resultMap.put("userLoginBonusList", loginBonusList);
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,45 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserMissionPointHandler")
public class GetUserMissionPointHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserMissionPointHandler.class);
private final BasicMapper mapper;
@Autowired
public GetUserMissionPointHandler(BasicMapper mapper) {
this.mapper = mapper;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", 0);
resultMap.put("userMissionPointList", new List[]{});
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,74 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserMusicDetailRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.response.data.UserMusicListItem;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserMusicDetail;
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.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserMusicHandler")
public class GetUserMusicHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserMusicHandler.class);
private final BasicMapper mapper;
private final UserMusicDetailRepository userMusicDetailRepository;
@Autowired
public GetUserMusicHandler(BasicMapper mapper, UserMusicDetailRepository userMusicDetailRepository) {
this.mapper = mapper;
this.userMusicDetailRepository = userMusicDetailRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Integer maxCount = (Integer) request.get("maxCount");
Integer nextIndex = (Integer) request.get("nextIndex");
int pageNum = nextIndex / maxCount;
Page<UserMusicDetail> dbPage = userMusicDetailRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
Map<Integer, UserMusicListItem> userMusicMap = new LinkedHashMap<>();
dbPage.getContent().forEach(userMusicDetail -> {
UserMusicListItem list;
if (userMusicMap.containsKey(userMusicDetail.getMusicId())) {
list = userMusicMap.get(userMusicDetail.getMusicId());
} else {
list = new UserMusicListItem(0, new ArrayList<>());
userMusicMap.put(userMusicDetail.getMusicId(), list);
}
list.getUserMusicDetailList().add(userMusicDetail);
list.setLength(list.getUserMusicDetailList().size());
});
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", userMusicMap.size());
resultMap.put("nextIndex", dbPage.getNumberOfElements() < maxCount ? -1 : currentIndex);
resultMap.put("userMusicList", userMusicMap.values());
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,60 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserMusicItemRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserMusicItem;
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.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Component;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserMusicItemHandler")
public class GetUserMusicItemHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserMusicItemHandler.class);
private final BasicMapper mapper;
private final UserMusicItemRepository userMusicItemRepository;
@Autowired
public GetUserMusicItemHandler(BasicMapper mapper, UserMusicItemRepository userMusicItemRepository) {
this.mapper = mapper;
this.userMusicItemRepository = userMusicItemRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Integer maxCount = (Integer) request.get("maxCount");
Integer nextIndex = (Integer) request.get("nextIndex");
int pageNum = nextIndex / maxCount;
Page<UserMusicItem> dbPage = userMusicItemRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", dbPage.getNumberOfElements());
resultMap.put("nextIndex", dbPage.getNumberOfElements() < maxCount ? -1 : currentIndex);
resultMap.put("userMusicItemList", dbPage.getContent());
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,56 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserOptionRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserOption;
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.LinkedHashMap;
import java.util.Map;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserOptionHandler")
public class GetUserOptionHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserOptionHandler.class);
private final BasicMapper mapper;
private final UserOptionRepository userOptionRepository;
@Autowired
public GetUserOptionHandler(BasicMapper mapper, UserOptionRepository userOptionRepository) {
this.mapper = mapper;
this.userOptionRepository = userOptionRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Optional<UserOption> userOptionOptional = userOptionRepository.findByUser_Card_ExtId(userId);
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
if(userOptionOptional.isPresent()) {
resultMap.put("userOption", userOptionOptional.get());
} else {
resultMap.put("userOption", null);
}
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,101 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserDataRepository;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserOptionRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.response.GetUserPreviewResp;
import icu.samnyan.aqua.sega.ongeki.model.userdata.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.Map;
import java.util.Optional;
/**
* The handler for loading basic profile information.
* <p>
* return null if no profile exist
*
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserPreviewHandler")
public class GetUserPreviewHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserPreviewHandler.class);
private final BasicMapper mapper;
private final UserDataRepository userDataRepository;
private final UserOptionRepository userOptionRepository;
@Autowired
public GetUserPreviewHandler(BasicMapper mapper,
UserDataRepository userDataRepository, UserOptionRepository userOptionRepository) {
this.mapper = mapper;
this.userDataRepository = userDataRepository;
this.userOptionRepository = userOptionRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Optional<UserData> userData = userDataRepository.findByCard_ExtId(userId);
GetUserPreviewResp resp = new GetUserPreviewResp();
resp.setUserId(userId);
if (userData.isEmpty()) {
/**
* From BaseDialogController.cs
* <code>if (string.IsNullOrEmpty(instance.userPreview.lastPlayDate))</code>
* so send a null value will trigger new user register
*/
resp.setLastPlayDate(null);
} else {
UserData user = userData.get();
resp.setLogin(false);
resp.setLastLoginDate(user.getLastPlayDate());
resp.setUserName(user.getUserName());
resp.setReincarnationNum(user.getReincarnationNum());
resp.setLevel(user.getLevel());
resp.setExp(user.getExp());
resp.setPlayerRating(user.getPlayerRating());
resp.setLastGameId(user.getLastGameId());
resp.setLastRomVersion(user.getLastRomVersion());
resp.setLastDataVersion(user.getLastDataVersion());
resp.setLastPlayDate(user.getLastPlayDate());
resp.setNameplateId(user.getNameplateId());
resp.setTrophyId(user.getTrophyId());
resp.setCardId(user.getCardId());
resp.setDispPlayerLv(1);
resp.setDispRating(1);
resp.setDispBP(1);
resp.setHeadphone(0);
userOptionRepository.findByUser(user).ifPresent(x -> {
resp.setDispPlayerLv(x.getDispPlayerLv());
resp.setDispRating(x.getDispRating());
resp.setDispBP(x.getDispBP());
resp.setHeadphone(x.getHeadphone());
});
}
String json = mapper.write(resp);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,45 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserRatinglogHandler")
public class GetUserRatinglogListHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserRatinglogListHandler.class);
private final BasicMapper mapper;
@Autowired
public GetUserRatinglogListHandler(BasicMapper mapper) {
this.mapper = mapper;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", 0);
resultMap.put("userRatinglogList", new List[]{});
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,61 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.chunithm.model.response.data.UserRecentRating;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserPlaylogRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserPlaylog;
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.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Component;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserRecentRatingHandler")
public class GetUserRecentRatingHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserRecentRatingHandler.class);
private final BasicMapper mapper;
private final UserPlaylogRepository userPlaylogRepository;
@Autowired
public GetUserRecentRatingHandler(BasicMapper mapper, UserPlaylogRepository userPlaylogRepository) {
this.mapper = mapper;
this.userPlaylogRepository = userPlaylogRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Pageable page = PageRequest.of(0, 30, Sort.by(Sort.Direction.DESC, "id"));
List<UserPlaylog> playlogList = userPlaylogRepository.findByUser_Card_ExtId(userId, page).getContent();
List<UserRecentRating> ratingList = playlogList.stream().map(log -> new UserRecentRating(log.getMusicId(), log.getLevel(), "1000000", log.getTechScore()))
.collect(Collectors.toList());
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", ratingList.size());
resultMap.put("userRecentRatingList", ratingList);
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,45 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserRegionHandler")
public class GetUserRegionHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserRegionHandler.class);
private final BasicMapper mapper;
@Autowired
public GetUserRegionHandler(BasicMapper mapper) {
this.mapper = mapper;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", 0);
resultMap.put("userRegionList", new List[]{});
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,45 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserStoryHandler")
public class GetUserStoryHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserStoryHandler.class);
private final BasicMapper mapper;
@Autowired
public GetUserStoryHandler(BasicMapper mapper) {
this.mapper = mapper;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", 0);
resultMap.put("userStoryList", new List[]{});
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,45 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
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.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserTrainingRoomByKeyHandler")
public class GetUserTrainingRoomByKeyHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserTrainingRoomByKeyHandler.class);
private final BasicMapper mapper;
@Autowired
public GetUserTrainingRoomByKeyHandler(BasicMapper mapper) {
this.mapper = mapper;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", 0);
resultMap.put("userTrainingRoomList", new List[]{});
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,375 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
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.ongeki.dao.userdata.*;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
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 loading basic profile information.
* <p>
* return null if no profile exist
*
* @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 UserItemRepository userItemRepository;
private final UserMusicItemRepository userMusicItemRepository;
private final UserLoginBonusRepository userLoginBonusRepository;
private final UserEventPointRepository userEventPointRepository;
@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) {
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.userItemRepository = userItemRepository;
this.userMusicItemRepository = userMusicItemRepository;
this.userLoginBonusRepository = userLoginBonusRepository;
this.userEventPointRepository = userEventPointRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
Map<String, Object> upsertUserAll = (Map<String, Object>) request.get("upsertUserAll");
// UserData
UserData userData;
UserData newUserData;
if (!upsertUserAll.containsKey("userData")) {
return null;
} else {
Map<String, Object> userDataMap = ((List<Map<String, Object>>) upsertUserAll.get("userData")).get(0);
Optional<UserData> userOptional = userDataRepository.findByCard_ExtId(userId);
if(userOptional.isPresent()) {
userData = userOptional.get();
} else {
userData = new UserData();
Card card = cardService.getCardByExtId(userId).orElseThrow();
userData.setCard(card);
}
newUserData = mapper.convert(userDataMap, UserData.class);
newUserData.setId(userData.getId());
newUserData.setCard(userData.getCard());
userDataRepository.save(newUserData);
}
// UserOption
if (upsertUserAll.containsKey("userOption")) {
Map<String, Object> userOptionMap = ((List<Map<String, Object>>) upsertUserAll.get("userOption")).get(0);
Optional<UserOption> userOptionOptional = userOptionRepository.findByUser(newUserData);
UserOption userOption = userOptionOptional.orElseGet(() -> new UserOption(newUserData));
UserOption newUserOption = mapper.convert(userOptionMap, UserOption.class);
newUserOption.setId(userOption.getId());
newUserOption.setUser(userOption.getUser());
userOptionRepository.save(newUserOption);
}
// UserPlaylogList
if (upsertUserAll.containsKey("userPlaylogList")) {
List<Map<String, Object>> userPlaylogList = ((List<Map<String, Object>>) upsertUserAll.get("userPlaylogList"));
List<UserPlaylog> newUserPlaylogList = new ArrayList<>();
for (Map<String, Object> userPlayLogMap : userPlaylogList) {
UserPlaylog newUserPlaylog = mapper.convert(userPlayLogMap, UserPlaylog.class);
newUserPlaylog.setUser(newUserData);
newUserPlaylogList.add(newUserPlaylog);
}
userPlaylogRepository.saveAll(newUserPlaylogList);
}
// UserSessionlogList doesn't need to save for a private server
// UserActivityList
if (upsertUserAll.containsKey("userActivityList")) {
List<Map<String, Object>> userActivityList = ((List<Map<String, Object>>) upsertUserAll.get("userActivityList"));
List<UserActivity> newUserActivityList = new ArrayList<>();
for (Map<String, Object> userActivityMap : userActivityList) {
Integer kind = (Integer) userActivityMap.get("kind");
Integer id = (Integer) userActivityMap.get("id");
if(kind != 0 && id!=0) {
Optional<UserActivity> activityOptional = userActivityRepository.findByUserAndKindAndActivityId(newUserData, kind, id);
UserActivity userActivity = activityOptional.orElseGet(() -> new UserActivity(newUserData));
UserActivity newUserActivity = mapper.convert(userActivityMap, UserActivity.class);
newUserActivity.setId(userActivity.getId());
newUserActivity.setUser(newUserData);
newUserActivityList.add(newUserActivity);
}
}
userActivityRepository.saveAll(newUserActivityList);
}
// UserRecentRatingList
// This doesn't need to save. It can get from playlog
// UserBpBaseList
// From UserBatterPoint.cs, the game doesn't use the value here. So it doesn't need to save.
// userRatingBaseBestNewList
// userRatingBaseBestList
// userRatingBaseHotList
// userRatingBaseNextNewList
// userRatingBaseNextList
// userRatingBaseHotNextList
// UserMusicDetailList
if (upsertUserAll.containsKey("userMusicDetailList")) {
List<Map<String, Object>> userMusicDetailList = ((List<Map<String, Object>>) upsertUserAll.get("userMusicDetailList"));
List<UserMusicDetail> newUserMusicDetailList = new ArrayList<>();
for (Map<String, Object> userMusicDetailMap : userMusicDetailList) {
Integer musicId = (Integer) userMusicDetailMap.get("musicId");
Integer level = (Integer) userMusicDetailMap.get("level");
Optional<UserMusicDetail> musicDetailOptional = userMusicDetailRepository.findByUserAndMusicIdAndLevel(newUserData, musicId, level);
UserMusicDetail userMusicDetail = musicDetailOptional.orElseGet(() -> new UserMusicDetail(newUserData));
UserMusicDetail newUserMusicDetail = mapper.convert(userMusicDetailMap, UserMusicDetail.class);
newUserMusicDetail.setId(userMusicDetail.getId());
newUserMusicDetail.setUser(newUserData);
newUserMusicDetailList.add(newUserMusicDetail);
}
userMusicDetailRepository.saveAll(newUserMusicDetailList);
}
// UserCharacterList
if (upsertUserAll.containsKey("userCharacterList")) {
List<Map<String, Object>> userCharacterList = ((List<Map<String, Object>>) upsertUserAll.get("userCharacterList"));
List<UserCharacter> newUserCharacterList = new ArrayList<>();
for (Map<String, Object> userCharacterMap : userCharacterList) {
Integer characterId = (Integer) userCharacterMap.get("characterId");
Optional<UserCharacter> characterOptional = userCharacterRepository.findByUserAndCharacterId(newUserData, characterId);
UserCharacter userCharacter = characterOptional.orElseGet(() -> new UserCharacter(newUserData));
UserCharacter newUserCharacter = mapper.convert(userCharacterMap, UserCharacter.class);
newUserCharacter.setId(userCharacter.getId());
newUserCharacter.setUser(newUserData);
newUserCharacterList.add(newUserCharacter);
}
userCharacterRepository.saveAll(newUserCharacterList);
}
// UserCardList
if (upsertUserAll.containsKey("userCardList")) {
List<Map<String, Object>> userCardList = ((List<Map<String, Object>>) upsertUserAll.get("userCardList"));
List<UserCard> newUserCardList = new ArrayList<>();
for (Map<String, Object> userCardMap : userCardList) {
Integer cardId = (Integer) userCardMap.get("cardId");
Optional<UserCard> cardOptional = userCardRepository.findByUserAndCardId(newUserData, cardId);
UserCard userCard = cardOptional.orElseGet(() -> new UserCard(newUserData));
UserCard newUserCard = mapper.convert(userCardMap, UserCard.class);
newUserCard.setId(userCard.getId());
newUserCard.setUser(newUserData);
newUserCardList.add(newUserCard);
}
userCardRepository.saveAll(newUserCardList);
}
// UserDeckList
if (upsertUserAll.containsKey("userDeckList")) {
List<Map<String, Object>> userDeckList = ((List<Map<String, Object>>) upsertUserAll.get("userDeckList"));
List<UserDeck> newUserDeckList = new ArrayList<>();
for (Map<String, Object> userDeckMap : userDeckList) {
Integer deckId = (Integer) userDeckMap.get("deckId");
Optional<UserDeck> deckOptional = userDeckRepository.findByUserAndDeckId(newUserData, deckId);
UserDeck userDeck = deckOptional.orElseGet(() -> new UserDeck(newUserData));
UserDeck newUserDeck = mapper.convert(userDeckMap, UserDeck.class);
newUserDeck.setId(userDeck.getId());
newUserDeck.setUser(newUserData);
newUserDeckList.add(newUserDeck);
}
userDeckRepository.saveAll(newUserDeckList);
}
// TODO: userTrainingRoomList
// UserStoryList
if (upsertUserAll.containsKey("userStoryList")) {
List<Map<String, Object>> userStoryList = ((List<Map<String, Object>>) upsertUserAll.get("userStoryList"));
List<UserStory> newUserStoryList = new ArrayList<>();
for (Map<String, Object> userStoryMap : userStoryList) {
Integer storyId = (Integer) userStoryMap.get("storyId");
Optional<UserStory> storyOptional = userStoryRepository.findByUserAndStoryId(newUserData, storyId);
UserStory userStory = storyOptional.orElseGet(() -> new UserStory(newUserData));
UserStory newUserStory = mapper.convert(userStoryMap, UserStory.class);
newUserStory.setId(userStory.getId());
newUserStory.setUser(newUserData);
newUserStoryList.add(newUserStory);
}
userStoryRepository.saveAll(newUserStoryList);
}
// UserChapterList
if (upsertUserAll.containsKey("userChapterList")) {
List<Map<String, Object>> userChapterList = ((List<Map<String, Object>>) upsertUserAll.get("userChapterList"));
List<UserChapter> newUserChapterList = new ArrayList<>();
for (Map<String, Object> userChapterMap : userChapterList) {
Integer chapterId = (Integer) userChapterMap.get("chapterId");
Optional<UserChapter> chapterOptional = userChapterRepository.findByUserAndChapterId(newUserData, chapterId);
UserChapter userChapter = chapterOptional.orElseGet(() -> new UserChapter(newUserData));
UserChapter newUserChapter = mapper.convert(userChapterMap, UserChapter.class);
newUserChapter.setId(userChapter.getId());
newUserChapter.setUser(newUserData);
newUserChapterList.add(newUserChapter);
}
userChapterRepository.saveAll(newUserChapterList);
}
// UserItemList
if (upsertUserAll.containsKey("userItemList")) {
List<Map<String, Object>> userItemList = ((List<Map<String, Object>>) upsertUserAll.get("userItemList"));
List<UserItem> newUserItemList = new ArrayList<>();
for (Map<String, Object> userItemMap : userItemList) {
Integer itemKind = (Integer) userItemMap.get("itemKind");
Integer itemId = (Integer) userItemMap.get("itemId");
Optional<UserItem> itemOptional = userItemRepository.findByUserAndItemKindAndItemId(newUserData, itemKind, itemId);
UserItem userItem = itemOptional.orElseGet(() -> new UserItem(newUserData));
UserItem newUserItem = mapper.convert(userItemMap, UserItem.class);
newUserItem.setId(userItem.getId());
newUserItem.setUser(newUserData);
newUserItemList.add(newUserItem);
}
userItemRepository.saveAll(newUserItemList);
}
// UserMusicItemList
if (upsertUserAll.containsKey("userMusicItemList")) {
List<Map<String, Object>> userMusicItemList = ((List<Map<String, Object>>) upsertUserAll.get("userMusicItemList"));
List<UserMusicItem> newUserMusicItemList = new ArrayList<>();
for (Map<String, Object> userMusicItemMap : userMusicItemList) {
Integer musicId = (Integer) userMusicItemMap.get("musicId");
Optional<UserMusicItem> musicItemOptional = userMusicItemRepository.findByUserAndMusicId(newUserData, musicId);
UserMusicItem userMusicItem = musicItemOptional.orElseGet(() -> new UserMusicItem(newUserData));
UserMusicItem newUserMusicItem = mapper.convert(userMusicItemMap, UserMusicItem.class);
newUserMusicItem.setId(userMusicItem.getId());
newUserMusicItem.setUser(newUserData);
newUserMusicItemList.add(newUserMusicItem);
}
userMusicItemRepository.saveAll(newUserMusicItemList);
}
// userLoginBonusList
if (upsertUserAll.containsKey("userLoginBonusList")) {
List<Map<String, Object>> userLoginBonusList = ((List<Map<String, Object>>) upsertUserAll.get("userLoginBonusList"));
List<UserLoginBonus> newUserLoginBonusList = new ArrayList<>();
for (Map<String, Object> userLoginBonusMap : userLoginBonusList) {
Integer bonusId = (Integer) userLoginBonusMap.get("bonusId");
Optional<UserLoginBonus> loginBonusOptional = userLoginBonusRepository.findByUserAndBonusId(newUserData, bonusId);
UserLoginBonus userLoginBonus = loginBonusOptional.orElseGet(() -> new UserLoginBonus(newUserData));
UserLoginBonus newUserLoginBonus = mapper.convert(userLoginBonusMap, UserLoginBonus.class);
newUserLoginBonus.setId(userLoginBonus.getId());
newUserLoginBonus.setUser(newUserData);
newUserLoginBonusList.add(newUserLoginBonus);
}
userLoginBonusRepository.saveAll(newUserLoginBonusList);
}
// UserEventPointList
if (upsertUserAll.containsKey("userEventPointList")) {
List<Map<String, Object>> userEventPointList = ((List<Map<String, Object>>) upsertUserAll.get("userEventPointList"));
List<UserEventPoint> newUserEventPointList = new ArrayList<>();
for (Map<String, Object> userEventPointMap : userEventPointList) {
Integer eventId = (Integer) userEventPointMap.get("eventId");
Optional<UserEventPoint> eventPointOptional = userEventPointRepository.findByUserAndEventId(newUserData, eventId);
UserEventPoint userEventPoint = eventPointOptional.orElseGet(() -> new UserEventPoint(newUserData));
UserEventPoint newUserEventPoint = mapper.convert(userEventPointMap, UserEventPoint.class);
newUserEventPoint.setId(userEventPoint.getId());
newUserEventPoint.setUser(newUserData);
newUserEventPointList.add(newUserEventPoint);
}
userEventPointRepository.saveAll(newUserEventPointList);
}
// UserMissionPointList
// UserRatinglogList
String json = mapper.write(new CodeResp(1,"upsertUserAll"));
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,52 @@
package icu.samnyan.aqua.sega.ongeki.model.gamedata;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiGameCard")
@Table(name = "ongeki_game_card")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class GameCard implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private long id;
private String name;
private String nickName;
private String attribute;
private int charaId;
private String school;
private String gakunen;
private String rarity;
// csv
private String levelParam;
private int skillId;
private int choKaikaSkillId;
private String cardNumber;
private String version;
}

View File

@ -0,0 +1,33 @@
package icu.samnyan.aqua.sega.ongeki.model.gamedata;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiGameChara")
@Table(name = "ongeki_game_chara")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class GameChara implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private long id;
private String name;
private String cv;
private int modelId;
}

View File

@ -0,0 +1,26 @@
package icu.samnyan.aqua.sega.ongeki.model.gamedata;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiGameEvent")
@Table(name = "ongeki_game_event")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class GameEvent implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private long id;
}

View File

@ -0,0 +1,49 @@
package icu.samnyan.aqua.sega.ongeki.model.gamedata;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiGameMusic")
@Table(name = "ongeki_game_music")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class GameMusic implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private long id;
private String name;
private String sortName;
private String artistName;
private String genre;
private int bossCardId;
private int bossLevel;
private String level0;
private String level1;
private String level2;
private String level3;
private String level4;
}

View File

@ -0,0 +1,33 @@
package icu.samnyan.aqua.sega.ongeki.model.gamedata;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiGameSkill")
@Table(name = "ongeki_game_skill")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class GameSkill implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private long id;
private String name;
private String category;
private String info;
}

View File

@ -0,0 +1,16 @@
package icu.samnyan.aqua.sega.ongeki.model.response;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CodeResp {
private int returnCode;
private String apiName;
}

View File

@ -0,0 +1,21 @@
package icu.samnyan.aqua.sega.ongeki.model.response;
import com.fasterxml.jackson.annotation.JsonProperty;
import icu.samnyan.aqua.sega.ongeki.model.response.data.GameSetting;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GetGameSettingResp {
private GameSetting gameSetting;
@JsonProperty("isDumpUpload")
private boolean isDumpUpload;
@JsonProperty("isAou")
private boolean isAou;
}

View File

@ -0,0 +1,37 @@
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 Integer 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 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;
}

View File

@ -0,0 +1,55 @@
package icu.samnyan.aqua.sega.ongeki.model.userdata;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiUserActivity")
@Table(name = "ongeki_user_activity", uniqueConstraints = {@UniqueConstraint(columnNames = {"user_id", "kind", "activity_id"})})
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonPropertyOrder({"kind", "id", "sortNumber", "param1", "param2", "param3", "param4"})
public class UserActivity 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 kind;
@JsonProperty("id")
@Column(name = "activity_id")
private int activityId;
private int sortNumber;
private int param1;
private int param2;
private int param3;
private int param4;
public UserActivity(UserData userData) {
user = userData;
}
}

View File

@ -0,0 +1,73 @@
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 javax.persistence.*;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiUserCard")
@Table(name = "ongeki_user_card")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserCard 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 cardId = -1;
private int digitalStock = 1;
private int analogStock = 0;
private int level = 0;
private int maxLevel = 10;
private int exp = 0;
private int printCount = 0;
private int useCount = 0;
@JsonProperty("isNew")
private boolean isNew = true;
private String kaikaDate = "0000-00-00 00:00:00.0";
private String choKaikaDate = "0000-00-00 00:00:00.0";
private int skillId;
@JsonProperty("isAcquired")
private boolean isAcquired = true;
private String created = "0000-00-00 00:00:00.0";
public UserCard(UserData userData) {
this.user = userData;
}
public UserCard(UserData userData, int cardId, int skillId) {
this.user = userData;
this.cardId = cardId;
this.skillId = skillId;
}
}

View File

@ -0,0 +1,55 @@
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 javax.persistence.*;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiUserChapter")
@Table(name = "ongeki_user_chapter")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserChapter 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;
@JsonProperty("isStoryWatched")
private boolean isStoryWatched;
@JsonProperty("isClear")
private boolean isClear;
private int skipTiming1;
private int skipTiming2;
public UserChapter(UserData userData) {
this.user = userData;
}
}

View File

@ -0,0 +1,52 @@
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 javax.persistence.*;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiUserCharacter")
@Table(name = "ongeki_user_character")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserCharacter 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 characterId;
private int playCount;
private int intimateLevel;
private int intimateCount;
private int intimateCountRewarded;
private String intimateCountDate;
@JsonProperty("isNew")
private boolean isNew;
public UserCharacter(UserData userData) {
this.user = userData;
}
}

View File

@ -0,0 +1,144 @@
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.sega.general.model.Card;
import icu.samnyan.aqua.sega.util.jackson.AccessCodeSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.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 {
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
@JoinColumn(name = "aime_card_id")
private Card card;
// Access code in 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 playerRating;
private int highestRating;
private int battlePoint;
private int nameplateId;
private int trophyId;
private int cardId;
private int characterId;
private int tabSetting;
private int tabSortSetting;
private int cardCategorySetting;
private int cardSortSetting;
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 String eventWatchedDate;
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;
private String lastClientId;
private int lastUsedDeckId;
private int lastPlayMusicLevel;
}

View File

@ -0,0 +1,44 @@
package icu.samnyan.aqua.sega.ongeki.model.userdata;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiUserDeck")
@Table(name = "ongeki_user_deck")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserDeck 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 deckId;
private int cardId1;
private int cardId2;
private int cardId3;
public UserDeck(UserData userData) {
this.user = userData;
}
}

View File

@ -0,0 +1,44 @@
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 javax.persistence.*;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiUserEventPoint")
@Table(name = "ongeki_user_event_point")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserEventPoint 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 long point;
@JsonProperty("isRankingRewarded")
private boolean isRankingRewarded;
public UserEventPoint(UserData userData) {
this.user = userData;
}
}

View File

@ -0,0 +1,46 @@
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 javax.persistence.*;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiUserItem")
@Table(name = "ongeki_user_item")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserItem 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 itemKind;
private int itemId;
private int stock;
@JsonProperty("isValid")
private boolean isValid;
public UserItem(UserData userData) {
this.user = userData;
}
}

View File

@ -0,0 +1,40 @@
package icu.samnyan.aqua.sega.ongeki.model.userdata;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiUserLoginBonus")
@Table(name = "ongeki_user_login_bonus")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserLoginBonus 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 bonusId;
private int bonusCount;
public UserLoginBonus(UserData userData) {
this.user = userData;
}
}

View File

@ -0,0 +1,68 @@
package icu.samnyan.aqua.sega.ongeki.model.userdata;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.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 {
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 maxComboCount;
private int maxOverKill;
private int maxTeamOverKill;
private boolean isFullBell;
private boolean isFullCombo;
private boolean isAllBreake;
private boolean isLock;
private int clearStatus;
private boolean isStoryWatched;
public UserMusicDetail(UserData userData) {
this.user = userData;
}
}

View File

@ -0,0 +1,40 @@
package icu.samnyan.aqua.sega.ongeki.model.userdata;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiUserMusicItem")
@Table(name = "ongeki_user_music_item")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserMusicItem 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 musicId;
private int status;
public UserMusicItem(UserData userData) {
this.user = userData;
}
}

View File

@ -0,0 +1,100 @@
package icu.samnyan.aqua.sega.ongeki.model.userdata;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.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 abort;
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 colorLane;
private int colorSide;
private int effectDamage;
private int effectPos;
private int judgeDisp;
private int judgePos;
private int judgeBreak;
private int judgeHit;
private int matching;
private int dispPlayerLv;
private int dispRating;
private int dispBP;
private int headphone;
public UserOption(UserData userData) {
this.user = userData;
}
}

View File

@ -0,0 +1,151 @@
package icu.samnyan.aqua.sega.ongeki.model.userdata;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiUserPlaylog")
@Table(name = "ongeki_user_playlog")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserPlaylog 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 sortNumber;
private int placeId;
private String placeName;
private String playDate;
private String userPlayDate;
private int musicId;
private int level;
private int playKind;
private int eventId;
private String eventName;
private int eventPoint;
private int playedUserId1;
private int playedUserId2;
private int playedUserId3;
private String playedUserName1;
private String playedUserName2;
private String playedUserName3;
private int playedMusicLevel1;
private int playedMusicLevel2;
private int playedMusicLevel3;
private int cardId1;
private int cardId2;
private int cardId3;
private int cardLevel1;
private int cardLevel2;
private int cardLevel3;
private int cardAttack1;
private int cardAttack2;
private int cardAttack3;
private int bossCharaId;
private int bossLevel;
private int bossAttribute;
private int clearStatus;
private int techScore;
private int techScoreRank;
private int battleScore;
private int battleScoreRank;
private int maxCombo;
private int judgeMiss;
private int judgeHit;
private int judgeBreak;
private int judgeCriticalBreak;
private int rateTap;
private int rateHold;
private int rateFlick;
private int rateSideTap;
private int rateSideHold;
private int bellCount;
private int totalBellCount;
private int damageCount;
private int overDamage;
private boolean isTechNewRecord;
private boolean isBattleNewRecord;
private boolean isOverDamageNewRecord;
private boolean isFullCombo;
private boolean isFullBell;
private boolean isAllBreak;
private int playerRating;
private int battlePoint;
}

View File

@ -0,0 +1,40 @@
package icu.samnyan.aqua.sega.ongeki.model.userdata;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiUserStory")
@Table(name = "ongeki_user_story")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserStory 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 storyId;
private int lastChapterId;
public UserStory(UserData userData) {
this.user = userData;
}
}

View File

@ -0,0 +1,41 @@
package icu.samnyan.aqua.sega.ongeki.model.userdata;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiTrainingRoom")
@Table(name = "ongeki_user_training_room")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserTrainingRoom 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;
public String authKey;
public int roomId;
public int cardId;
public String valueDate;
}

View File

@ -0,0 +1,50 @@
package icu.samnyan.aqua.sega.util.jackson;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component
public class BasicMapper {
private final ObjectMapper mapper;
public BasicMapper() {
mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(SerializationFeature.WRITE_ENUMS_USING_INDEX, true);
SimpleModule module = new SimpleModule();
module.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.0")));
module.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.0")));
mapper.registerModule(module);
}
public String write(Object o) throws JsonProcessingException {
return mapper.writeValueAsString(o);
}
public <T> T convert(Map<String, Object> map, Class<T> toClass) {
return mapper.convertValue(map, toClass);
}
public LinkedHashMap<String, Object> toMap(Object object) {
return mapper.convertValue(object, new TypeReference<>() {
});
}
}

View File

@ -0,0 +1,353 @@
create table ongeki_user_data
(
id bigint auto_increment
primary key,
battle_point int not null,
card_category_setting int not null,
card_id int not null,
card_sort_setting int not null,
character_id int not null,
compatible_cm_version varchar(255) null,
event_watched_date varchar(255) null,
exp bigint not null,
first_data_version varchar(255) null,
first_game_id varchar(255) null,
first_play_date varchar(255) null,
first_rom_version varchar(255) null,
first_tutorial_cancel_num int not null,
highest_rating int not null,
jewel_count int not null,
last_all_net_id int not null,
last_client_id varchar(255) null,
last_data_version varchar(255) null,
last_game_id varchar(255) null,
last_place_id int not null,
last_place_name varchar(255) null,
last_play_date varchar(255) null,
last_play_music_level int not null,
last_region_id int not null,
last_region_name varchar(255) null,
last_rom_version varchar(255) null,
last_used_deck_id int not null,
level int not null,
nameplate_id int not null,
play_count int not null,
played_tutorial_bit int not null,
player_rating int not null,
point bigint not null,
reincarnation_num int not null,
sum_battle_advanced_high_score bigint not null,
sum_battle_basic_high_score bigint not null,
sum_battle_expert_high_score bigint not null,
sum_battle_high_score bigint not null,
sum_battle_lunatic_high_score bigint not null,
sum_battle_master_high_score bigint not null,
sum_tech_advanced_high_score bigint not null,
sum_tech_basic_high_score bigint not null,
sum_tech_expert_high_score bigint not null,
sum_tech_high_score bigint not null,
sum_tech_lunatic_high_score bigint not null,
sum_tech_master_high_score bigint not null,
tab_setting int not null,
tab_sort_setting int not null,
total_jewel_count int not null,
total_point bigint not null,
trophy_id int not null,
user_name varchar(255) null,
aime_card_id bigint null,
constraint FKpbyt2rg48gq371c7pbn04r3vq
foreign key (aime_card_id) references sega_card (id)
);
create table ongeki_user_activity
(
id bigint auto_increment
primary key,
activity_id int null,
kind int not null,
param1 int not null,
param2 int not null,
param3 int not null,
param4 int not null,
sort_number int not null,
user_id bigint null,
constraint UK8upnsa6nokvlfrshwa45mn62i
unique (user_id, kind, activity_id),
constraint FKj1v48sg7iyelf1v95hdnnvvej
foreign key (user_id) references ongeki_user_data (id)
);
create table ongeki_user_card
(
id bigint auto_increment
primary key,
analog_stock int not null,
card_id int not null,
cho_kaika_date varchar(255) null,
created varchar(255) null,
digital_stock int not null,
exp int not null,
is_acquired bit not null,
is_new bit not null,
kaika_date varchar(255) null,
level int not null,
max_level int not null,
print_count int not null,
skill_id int not null,
use_count int not null,
user_id bigint null,
constraint FK24hse5iqkcc9pr5uosdmj4tf1
foreign key (user_id) references ongeki_user_data (id)
);
create table ongeki_user_chapter
(
id bigint auto_increment
primary key,
chapter_id int not null,
is_clear bit not null,
is_story_watched bit not null,
jewel_count int not null,
last_play_music_category int not null,
last_play_music_id int not null,
skip_timing1 int not null,
skip_timing2 int not null,
user_id bigint null,
constraint FK15v21ek6k2v978bs9gli88qxv
foreign key (user_id) references ongeki_user_data (id)
);
create table ongeki_user_character
(
id bigint auto_increment
primary key,
character_id int not null,
intimate_count int not null,
intimate_count_date varchar(255) null,
intimate_count_rewarded int not null,
intimate_level int not null,
is_new bit not null,
play_count int not null,
user_id bigint null,
constraint FKbe1tydupjuaerig417kawumvn
foreign key (user_id) references ongeki_user_data (id)
);
create table ongeki_user_deck
(
id bigint auto_increment
primary key,
card_id1 int not null,
card_id2 int not null,
card_id3 int not null,
deck_id int not null,
user_id bigint null,
constraint FKd4g23ogtcs3u7ft88v28px21u
foreign key (user_id) references ongeki_user_data (id)
);
create table ongeki_user_event_point
(
id bigint auto_increment
primary key,
event_id int not null,
is_ranking_rewarded bit not null,
point bigint not null,
user_id bigint null,
constraint FK867x07l202cic4k1tj3fthhqb
foreign key (user_id) references ongeki_user_data (id)
);
create table ongeki_user_item
(
id bigint auto_increment
primary key,
is_valid bit not null,
item_id int not null,
item_kind int not null,
stock int not null,
user_id bigint null,
constraint FKt4t8o65rovcopdpvf1o21hwj5
foreign key (user_id) references ongeki_user_data (id)
);
create table ongeki_user_login_bonus
(
id bigint auto_increment
primary key,
bonus_count int not null,
bonus_id int not null,
user_id bigint null,
constraint FKnxfh42w1oeia9ccmrx4sx701j
foreign key (user_id) references ongeki_user_data (id)
);
create table ongeki_user_music_detail
(
id bigint auto_increment
primary key,
battle_score_max int not null,
battle_score_rank int not null,
clear_status int not null,
is_all_breake bit not null,
is_full_bell bit not null,
is_full_combo bit not null,
is_lock bit not null,
is_story_watched bit not null,
level int not null,
max_combo_count int not null,
max_over_kill int not null,
max_team_over_kill int not null,
music_id int not null,
play_count int not null,
tech_score_max int not null,
tech_score_rank int not null,
user_id bigint null,
constraint FKe3ixhshy6d323i6eq6oc4n7c3
foreign key (user_id) references ongeki_user_data (id)
);
create table ongeki_user_music_item
(
id bigint auto_increment
primary key,
music_id int not null,
status int not null,
user_id bigint null,
constraint FK5eo7lmbf3xkwl3yln76k0v6k3
foreign key (user_id) references ongeki_user_data (id)
);
create table ongeki_user_option
(
id bigint auto_increment
primary key,
abort int not null,
color_field int not null,
color_lane int not null,
color_lane_bright int not null,
color_side int not null,
dispbp int not null,
disp_player_lv int not null,
disp_rating int not null,
effect_damage int not null,
effect_pos int not null,
headphone int not null,
judge_break int not null,
judge_disp int not null,
judge_hit int not null,
judge_pos int not null,
judge_timing int not null,
matching int not null,
mirror int not null,
option_set int not null,
speed int not null,
tap_sound int not null,
vol_all int not null,
vol_bell int not null,
vol_cr_tap int not null,
vol_damage int not null,
vol_enemy int not null,
vol_flick int not null,
vol_guide int not null,
vol_hold int not null,
vol_side int not null,
vol_skill int not null,
vol_tap int not null,
user_id bigint null,
constraint FKbnoj66ua8ce2i90i13br6dg9h
foreign key (user_id) references ongeki_user_data (id)
);
create table ongeki_user_playlog
(
id bigint auto_increment
primary key,
battle_point int not null,
battle_score int not null,
battle_score_rank int not null,
bell_count int not null,
boss_attribute int not null,
boss_chara_id int not null,
boss_level int not null,
card_attack1 int not null,
card_attack2 int not null,
card_attack3 int not null,
card_id1 int not null,
card_id2 int not null,
card_id3 int not null,
card_level1 int not null,
card_level2 int not null,
card_level3 int not null,
clear_status int not null,
damage_count int not null,
event_id int not null,
event_name varchar(255) null,
event_point int not null,
is_all_break bit not null,
is_battle_new_record bit not null,
is_full_bell bit not null,
is_full_combo bit not null,
is_over_damage_new_record bit not null,
is_tech_new_record bit not null,
judge_break int not null,
judge_critical_break int not null,
judge_hit int not null,
judge_miss int not null,
level int not null,
max_combo int not null,
music_id int not null,
over_damage int not null,
place_id int not null,
place_name varchar(255) null,
play_date varchar(255) null,
play_kind int not null,
played_music_level1 int not null,
played_music_level2 int not null,
played_music_level3 int not null,
played_user_id1 int not null,
played_user_id2 int not null,
played_user_id3 int not null,
played_user_name1 varchar(255) null,
played_user_name2 varchar(255) null,
played_user_name3 varchar(255) null,
player_rating int not null,
rate_flick int not null,
rate_hold int not null,
rate_side_hold int not null,
rate_side_tap int not null,
rate_tap int not null,
sort_number int not null,
tech_score int not null,
tech_score_rank int not null,
total_bell_count int not null,
user_play_date varchar(255) null,
user_id bigint null,
constraint FKltrwbtx3jfv3gdlk11q4fl311
foreign key (user_id) references ongeki_user_data (id)
);
create table ongeki_user_story
(
id bigint auto_increment
primary key,
last_chapter_id int not null,
story_id int not null,
user_id bigint null,
constraint FKrjs8eu3c3ottsk9ogqf0s6p44
foreign key (user_id) references ongeki_user_data (id)
);
create table ongeki_user_training_room
(
id bigint auto_increment
primary key,
auth_key varchar(255) null,
card_id int not null,
room_id int not null,
value_date varchar(255) null,
user_id bigint null,
constraint FK6ixn4aqiny02kxt4kq0tu8fk
foreign key (user_id) references ongeki_user_data (id)
);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,433 @@
-- Table: ongeki_user_data
CREATE TABLE ongeki_user_data
(
id INTEGER,
battle_point INTEGER NOT NULL,
card_category_setting INTEGER NOT NULL,
card_id INTEGER NOT NULL,
card_sort_setting INTEGER NOT NULL,
character_id INTEGER NOT NULL,
compatible_cm_version VARCHAR(255),
event_watched_date VARCHAR(255),
exp BIGINT NOT NULL,
first_data_version VARCHAR(255),
first_game_id VARCHAR(255),
first_play_date VARCHAR(255),
first_rom_version VARCHAR(255),
first_tutorial_cancel_num INTEGER NOT NULL,
highest_rating INTEGER NOT NULL,
jewel_count INTEGER NOT NULL,
last_all_net_id INTEGER NOT NULL,
last_client_id VARCHAR(255),
last_data_version VARCHAR(255),
last_game_id VARCHAR(255),
last_place_id INTEGER NOT NULL,
last_place_name VARCHAR(255),
last_play_date VARCHAR(255),
last_play_music_level INTEGER NOT NULL,
last_region_id INTEGER NOT NULL,
last_region_name VARCHAR(255),
last_rom_version VARCHAR(255),
last_used_deck_id INTEGER NOT NULL,
level INTEGER NOT NULL,
nameplate_id INTEGER NOT NULL,
play_count INTEGER NOT NULL,
played_tutorial_bit INTEGER NOT NULL,
player_rating INTEGER NOT NULL,
point BIGINT NOT NULL,
reincarnation_num INTEGER NOT NULL,
sum_battle_advanced_high_score BIGINT NOT NULL,
sum_battle_basic_high_score BIGINT NOT NULL,
sum_battle_expert_high_score BIGINT NOT NULL,
sum_battle_high_score BIGINT NOT NULL,
sum_battle_lunatic_high_score BIGINT NOT NULL,
sum_battle_master_high_score BIGINT NOT NULL,
sum_tech_advanced_high_score BIGINT NOT NULL,
sum_tech_basic_high_score BIGINT NOT NULL,
sum_tech_expert_high_score BIGINT NOT NULL,
sum_tech_high_score BIGINT NOT NULL,
sum_tech_lunatic_high_score BIGINT NOT NULL,
sum_tech_master_high_score BIGINT NOT NULL,
tab_setting INTEGER NOT NULL,
tab_sort_setting INTEGER NOT NULL,
total_jewel_count INTEGER NOT NULL,
total_point BIGINT NOT NULL,
trophy_id INTEGER NOT NULL,
user_name VARCHAR(255),
aime_card_id BIGINT,
PRIMARY KEY (
id
)
);
-- Table: ongeki_user_activity
CREATE TABLE ongeki_user_activity
(
id INTEGER,
activity_id INTEGER,
kind INTEGER NOT NULL,
param1 INTEGER NOT NULL,
param2 INTEGER NOT NULL,
param3 INTEGER NOT NULL,
param4 INTEGER NOT NULL,
sort_number INTEGER NOT NULL,
user_id BIGINT,
"" REFERENCES ongeki_user_data (id) ON DELETE CASCADE,
PRIMARY KEY (
id
),
CONSTRAINT ongeki_user_activity_uq UNIQUE (
activity_id,
kind,
user_id
) ON CONFLICT REPLACE
);
-- Table: ongeki_user_card
CREATE TABLE ongeki_user_card
(
id INTEGER,
analog_stock INTEGER NOT NULL,
card_id INTEGER NOT NULL,
cho_kaika_date VARCHAR(255),
created VARCHAR(255),
digital_stock INTEGER NOT NULL,
exp INTEGER NOT NULL,
is_acquired BOOLEAN NOT NULL,
is_new BOOLEAN NOT NULL,
kaika_date VARCHAR(255),
level INTEGER NOT NULL,
max_level INTEGER NOT NULL,
print_count INTEGER NOT NULL,
skill_id INTEGER NOT NULL,
use_count INTEGER NOT NULL,
user_id BIGINT REFERENCES ongeki_user_data (id) ON DELETE CASCADE,
PRIMARY KEY (
id
),
CONSTRAINT ongeki_user_card_uq UNIQUE (
card_id,
user_id
) ON CONFLICT REPLACE
);
-- Table: ongeki_user_chapter
CREATE TABLE ongeki_user_chapter
(
id INTEGER,
chapter_id INTEGER NOT NULL,
is_clear BOOLEAN NOT NULL,
is_story_watched BOOLEAN NOT NULL,
jewel_count INTEGER NOT NULL,
last_play_music_category INTEGER NOT NULL,
last_play_music_id INTEGER NOT NULL,
skip_timing1 INTEGER NOT NULL,
skip_timing2 INTEGER NOT NULL,
user_id BIGINT REFERENCES ongeki_user_data (id) ON DELETE CASCADE,
PRIMARY KEY (
id
),
CONSTRAINT ongeki_user_chapter_uq UNIQUE (
chapter_id,
user_id
) ON CONFLICT REPLACE
);
-- Table: ongeki_user_character
CREATE TABLE ongeki_user_character
(
id INTEGER,
character_id INTEGER NOT NULL,
intimate_count INTEGER NOT NULL,
intimate_count_date VARCHAR(255),
intimate_count_rewarded INTEGER NOT NULL,
intimate_level INTEGER NOT NULL,
is_new BOOLEAN NOT NULL,
play_count INTEGER NOT NULL,
user_id BIGINT REFERENCES ongeki_user_data (id) ON DELETE CASCADE,
PRIMARY KEY (
id
),
CONSTRAINT ongeki_user_character_uq UNIQUE (
character_id,
user_id
) ON CONFLICT REPLACE
);
-- Table: ongeki_user_deck
CREATE TABLE ongeki_user_deck
(
id INTEGER,
card_id1 INTEGER NOT NULL,
card_id2 INTEGER NOT NULL,
card_id3 INTEGER NOT NULL,
deck_id INTEGER NOT NULL,
user_id BIGINT REFERENCES ongeki_user_data (id) ON DELETE CASCADE,
PRIMARY KEY (
id
),
CONSTRAINT ongeki_user_deck_uq UNIQUE (
deck_id,
user_id
) ON CONFLICT REPLACE
);
-- Table: ongeki_user_event_point
CREATE TABLE ongeki_user_event_point
(
id INTEGER,
event_id INTEGER NOT NULL,
is_ranking_rewarded BOOLEAN NOT NULL,
point BIGINT NOT NULL,
user_id BIGINT REFERENCES ongeki_user_data (id) ON DELETE CASCADE,
PRIMARY KEY (
id
),
CONSTRAINT ongeki_user_event_point_uq UNIQUE (
event_id,
user_id
) ON CONFLICT REPLACE
);
-- Table: ongeki_user_item
CREATE TABLE ongeki_user_item
(
id INTEGER,
is_valid BOOLEAN NOT NULL,
item_id INTEGER NOT NULL,
item_kind INTEGER NOT NULL,
stock INTEGER NOT NULL,
user_id BIGINT REFERENCES ongeki_user_data (id) ON DELETE CASCADE,
PRIMARY KEY (
id
),
CONSTRAINT ongeki_user_item_uq UNIQUE (
item_id,
item_kind,
user_id
) ON CONFLICT REPLACE
);
-- Table: ongeki_user_music_detail
CREATE TABLE ongeki_user_music_detail
(
id INTEGER,
battle_score_max INTEGER NOT NULL,
battle_score_rank INTEGER NOT NULL,
clear_status INTEGER NOT NULL,
is_all_breake BOOLEAN NOT NULL,
is_full_bell BOOLEAN NOT NULL,
is_full_combo BOOLEAN NOT NULL,
is_lock BOOLEAN NOT NULL,
is_story_watched BOOLEAN NOT NULL,
level INTEGER NOT NULL,
max_combo_count INTEGER NOT NULL,
max_over_kill INTEGER NOT NULL,
max_team_over_kill INTEGER NOT NULL,
music_id INTEGER NOT NULL,
play_count INTEGER NOT NULL,
tech_score_max INTEGER NOT NULL,
tech_score_rank INTEGER NOT NULL,
user_id BIGINT REFERENCES ongeki_user_data (id) ON DELETE CASCADE,
PRIMARY KEY (
id
),
CONSTRAINT ongeki_user_music_detail_uq UNIQUE (
level,
music_id,
user_id
) ON CONFLICT REPLACE
);
-- Table: ongeki_user_music_item
CREATE TABLE ongeki_user_music_item
(
id INTEGER,
music_id INTEGER NOT NULL,
status INTEGER NOT NULL,
user_id BIGINT REFERENCES ongeki_user_data (id) ON DELETE CASCADE,
PRIMARY KEY (
id
),
CONSTRAINT ongeki_user_music_item_uq UNIQUE (
music_id,
user_id
) ON CONFLICT REPLACE
);
-- Table: ongeki_user_option
CREATE TABLE ongeki_user_option
(
id INTEGER,
"abort" INTEGER NOT NULL,
color_field INTEGER NOT NULL,
color_lane INTEGER NOT NULL,
color_lane_bright INTEGER NOT NULL,
color_side INTEGER NOT NULL,
dispbp INTEGER NOT NULL,
disp_player_lv INTEGER NOT NULL,
disp_rating INTEGER NOT NULL,
effect_damage INTEGER NOT NULL,
effect_pos INTEGER NOT NULL,
headphone INTEGER NOT NULL,
judge_break INTEGER NOT NULL,
judge_disp INTEGER NOT NULL,
judge_hit INTEGER NOT NULL,
judge_pos INTEGER NOT NULL,
judge_timing INTEGER NOT NULL,
matching INTEGER NOT NULL,
mirror INTEGER NOT NULL,
option_set INTEGER NOT NULL,
speed INTEGER NOT NULL,
tap_sound INTEGER NOT NULL,
vol_all INTEGER NOT NULL,
vol_bell INTEGER NOT NULL,
vol_cr_tap INTEGER NOT NULL,
vol_damage INTEGER NOT NULL,
vol_enemy INTEGER NOT NULL,
vol_flick INTEGER NOT NULL,
vol_guide INTEGER NOT NULL,
vol_hold INTEGER NOT NULL,
vol_side INTEGER NOT NULL,
vol_skill INTEGER NOT NULL,
vol_tap INTEGER NOT NULL,
user_id BIGINT REFERENCES ongeki_user_data (id) ON DELETE CASCADE
UNIQUE ON CONFLICT REPLACE,
PRIMARY KEY (
id
)
);
-- Table: ongeki_user_playlog
CREATE TABLE ongeki_user_playlog
(
id INTEGER,
battle_point INTEGER NOT NULL,
battle_score INTEGER NOT NULL,
battle_score_rank INTEGER NOT NULL,
bell_count INTEGER NOT NULL,
boss_attribute INTEGER NOT NULL,
boss_chara_id INTEGER NOT NULL,
boss_level INTEGER NOT NULL,
card_attack1 INTEGER NOT NULL,
card_attack2 INTEGER NOT NULL,
card_attack3 INTEGER NOT NULL,
card_id1 INTEGER NOT NULL,
card_id2 INTEGER NOT NULL,
card_id3 INTEGER NOT NULL,
card_level1 INTEGER NOT NULL,
card_level2 INTEGER NOT NULL,
card_level3 INTEGER NOT NULL,
clear_status INTEGER NOT NULL,
damage_count INTEGER NOT NULL,
event_id INTEGER NOT NULL,
event_name VARCHAR(255),
event_point INTEGER NOT NULL,
is_all_break BOOLEAN NOT NULL,
is_battle_new_record BOOLEAN NOT NULL,
is_full_bell BOOLEAN NOT NULL,
is_full_combo BOOLEAN NOT NULL,
is_over_damage_new_record BOOLEAN NOT NULL,
is_tech_new_record BOOLEAN NOT NULL,
judge_break INTEGER NOT NULL,
judge_critical_break INTEGER NOT NULL,
judge_hit INTEGER NOT NULL,
judge_miss INTEGER NOT NULL,
level INTEGER NOT NULL,
max_combo INTEGER NOT NULL,
music_id INTEGER NOT NULL,
over_damage INTEGER NOT NULL,
place_id INTEGER NOT NULL,
place_name VARCHAR(255),
play_date VARCHAR(255),
play_kind INTEGER NOT NULL,
played_music_level1 INTEGER NOT NULL,
played_music_level2 INTEGER NOT NULL,
played_music_level3 INTEGER NOT NULL,
played_user_id1 INTEGER NOT NULL,
played_user_id2 INTEGER NOT NULL,
played_user_id3 INTEGER NOT NULL,
played_user_name1 VARCHAR(255),
played_user_name2 VARCHAR(255),
played_user_name3 VARCHAR(255),
player_rating INTEGER NOT NULL,
rate_flick INTEGER NOT NULL,
rate_hold INTEGER NOT NULL,
rate_side_hold INTEGER NOT NULL,
rate_side_tap INTEGER NOT NULL,
rate_tap INTEGER NOT NULL,
sort_number INTEGER NOT NULL,
tech_score INTEGER NOT NULL,
tech_score_rank INTEGER NOT NULL,
total_bell_count INTEGER NOT NULL,
user_play_date VARCHAR(255),
user_id BIGINT REFERENCES ongeki_user_data (id) ON DELETE CASCADE,
PRIMARY KEY (
id
)
);
-- Table: ongeki_user_story
CREATE TABLE ongeki_user_story
(
id INTEGER,
last_chapter_id INTEGER NOT NULL,
story_id INTEGER NOT NULL,
user_id BIGINT REFERENCES ongeki_user_data (id) ON DELETE CASCADE,
PRIMARY KEY (
id
),
CONSTRAINT ongeki_user_story_uq UNIQUE (
story_id,
user_id
) ON CONFLICT REPLACE
);
-- Table: ongeki_user_training_room
CREATE TABLE ongeki_user_training_room
(
id INTEGER,
auth_key VARCHAR(255),
card_id INTEGER NOT NULL,
room_id INTEGER NOT NULL,
value_date VARCHAR(255),
user_id BIGINT REFERENCES ongeki_user_data (id) ON DELETE CASCADE,
PRIMARY KEY (
id
),
CONSTRAINT ongeki_user_training_room_uq UNIQUE (
card_id,
room_id,
user_id
) ON CONFLICT REPLACE
);
-- Table: ongeki_user_login_bonus
CREATE TABLE ongeki_user_login_bonus
(
id INTEGER,
bonus_id INTEGER NOT NULL,
bonus_count INTEGER NOT NULL,
user_id BIGINT REFERENCES ongeki_user_data (id) ON DELETE CASCADE,
PRIMARY KEY (
id
),
CONSTRAINT ongeki_user_login_bonus_uq UNIQUE (
bonus_id,
user_id
) ON CONFLICT REPLACE
);

File diff suppressed because it is too large Load Diff