From 1df5b4e8ba6491c1f09862a7ac3ad676c4195fb3 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Wed, 26 Mar 2025 17:18:08 -0400 Subject: [PATCH] [-] Remove old aqua apis --- .../samnyan/aqua/api/config/WebConfig.java | 49 -- .../api/controller/ApiControllerAdvice.java | 19 - .../controller/general/StaticController.java | 38 -- .../controller/sega/ApiAimeController.java | 31 - .../v1/ApiChuniV1GameDataController.java | 44 -- .../v1/ApiChuniV1PlayerDataController.java | 421 ------------- .../game/diva/ApiDivaGameDataController.java | 44 -- .../diva/ApiDivaPlayerDataController.java | 276 --------- .../ApiMaimai2PlayerDataController.java | 396 ------------ .../ongeki/ApiOngekiGameDataController.java | 76 --- .../ongeki/ApiOngekiPlayerDataController.java | 576 ------------------ .../manage/ApiChuniV1ManageController.java | 83 --- .../sega/manage/ApiDivaManageController.java | 139 ----- .../aqua/api/model/MessageResponse.java | 23 - .../aqua/api/model/ObjectMessageResponse.java | 27 - .../aqua/api/model/ReducedPageResponse.java | 25 - .../api/model/req/sega/diva/DatePair.java | 21 - .../api/model/req/sega/diva/ModuleEntry.java | 29 - .../api/model/req/sega/diva/PvListEntry.java | 25 - .../model/req/sega/diva/PvListRequest.java | 28 - .../model/resp/sega/chuni/v1/ProfileResp.java | 60 -- .../model/resp/sega/chuni/v1/RatingItem.java | 28 - .../model/resp/sega/chuni/v1/RecentResp.java | 87 --- .../model/resp/sega/chuni/v1/ScoreResp.java | 48 -- .../chuni/v1/external/ChuniDataExport.java | 32 - .../chuni/v1/external/ChuniDataImport.java | 32 - .../chuni/v1/external/ExternalUserData.java | 119 ---- .../model/resp/sega/chuni/v2/RatingItem.java | 28 - .../model/resp/sega/chuni/v2/RecentResp.java | 89 --- .../model/resp/sega/chuni/v2/ScoreResp.java | 48 -- .../sega/chuni/v2/external/Chu3DataExport.kt | 23 - .../chuni/v2/external/ChuniDataImport.java | 30 - .../chuni/v2/external/ExternalUserData.java | 119 ---- .../api/model/resp/sega/diva/PlayerInfo.java | 13 - .../model/resp/sega/diva/PvRankRecord.java | 16 - .../model/resp/sega/maimai2/PhotoResp.java | 15 - .../model/resp/sega/maimai2/ProfileResp.java | 62 -- .../maimai2/external/ExternalUserData.java | 96 --- .../maimai2/external/Maimai2DataExport.kt | 30 - .../maimai2/external/Maimai2DataImport.java | 37 -- .../model/resp/sega/ongeki/ProfileResp.java | 69 --- .../ongeki/external/ExternalUserData.java | 137 ----- .../ongeki/external/OngekiDataExport.java | 44 -- .../ongeki/external/OngekiDataImport.java | 44 -- .../icu/samnyan/aqua/api/util/ApiMapper.java | 35 -- 45 files changed, 3711 deletions(-) delete mode 100644 src/main/java/icu/samnyan/aqua/api/config/WebConfig.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/controller/ApiControllerAdvice.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/controller/general/StaticController.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/controller/sega/ApiAimeController.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/controller/sega/game/chuni/v1/ApiChuniV1GameDataController.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/controller/sega/game/chuni/v1/ApiChuniV1PlayerDataController.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/controller/sega/game/diva/ApiDivaGameDataController.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/controller/sega/game/diva/ApiDivaPlayerDataController.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/controller/sega/game/maimai2/ApiMaimai2PlayerDataController.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/controller/sega/game/ongeki/ApiOngekiGameDataController.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/controller/sega/game/ongeki/ApiOngekiPlayerDataController.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/controller/sega/manage/ApiChuniV1ManageController.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/controller/sega/manage/ApiDivaManageController.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/MessageResponse.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/ObjectMessageResponse.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/ReducedPageResponse.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/req/sega/diva/DatePair.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/req/sega/diva/ModuleEntry.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/req/sega/diva/PvListEntry.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/req/sega/diva/PvListRequest.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/ProfileResp.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/RatingItem.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/RecentResp.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/ScoreResp.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/external/ChuniDataExport.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/external/ChuniDataImport.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/external/ExternalUserData.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/RatingItem.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/RecentResp.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/ScoreResp.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/external/Chu3DataExport.kt delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/external/ChuniDataImport.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/external/ExternalUserData.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/diva/PlayerInfo.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/diva/PvRankRecord.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/PhotoResp.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/ProfileResp.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/external/ExternalUserData.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/external/Maimai2DataExport.kt delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/external/Maimai2DataImport.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/ongeki/ProfileResp.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/ongeki/external/ExternalUserData.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/ongeki/external/OngekiDataExport.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/model/resp/sega/ongeki/external/OngekiDataImport.java delete mode 100644 src/main/java/icu/samnyan/aqua/api/util/ApiMapper.java diff --git a/src/main/java/icu/samnyan/aqua/api/config/WebConfig.java b/src/main/java/icu/samnyan/aqua/api/config/WebConfig.java deleted file mode 100644 index 3f5cc7c3..00000000 --- a/src/main/java/icu/samnyan/aqua/api/config/WebConfig.java +++ /dev/null @@ -1,49 +0,0 @@ -package icu.samnyan.aqua.api.config; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.io.FileSystemResource; -import org.springframework.core.io.Resource; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import org.springframework.web.servlet.resource.PathResourceResolver; - -import java.io.IOException; - -@Configuration -public class WebConfig implements WebMvcConfigurer { - - private final boolean AQUAVIEWER_ENABLED; - - public WebConfig(@Value("${aquaviewer.server.enable}") boolean AQUAVIEWER_ENABLED) { - this.AQUAVIEWER_ENABLED = AQUAVIEWER_ENABLED; - } - - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - - if (AQUAVIEWER_ENABLED) { - // Static assets (images), this priority must be higher than routes - registry.addResourceHandler("/web/assets/**") - .addResourceLocations("file:web/assets/") - .setCachePeriod(10) - .resourceChain(true) - .addResolver(new PathResourceResolver()); - - // For angularjs html5 routes - registry.addResourceHandler("/web/**", "/web/", "/web") - .addResourceLocations("file:web/") - .setCachePeriod(10) - .resourceChain(true) - .addResolver(new PathResourceResolver() { - @Override - protected Resource getResource(String resourcePath, Resource location) throws IOException { - Resource requestedResource = location.createRelative(resourcePath); - return requestedResource.exists() && requestedResource.isReadable() ? requestedResource - : new FileSystemResource("web/index.html"); - } - }); - } - } - -} \ No newline at end of file diff --git a/src/main/java/icu/samnyan/aqua/api/controller/ApiControllerAdvice.java b/src/main/java/icu/samnyan/aqua/api/controller/ApiControllerAdvice.java deleted file mode 100644 index 8bfeb1d4..00000000 --- a/src/main/java/icu/samnyan/aqua/api/controller/ApiControllerAdvice.java +++ /dev/null @@ -1,19 +0,0 @@ -package icu.samnyan.aqua.api.controller; - -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.RestControllerAdvice; - -import java.util.NoSuchElementException; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@RestControllerAdvice(basePackages = "icu.samnyan.aqua.api") -public class ApiControllerAdvice { - - @ExceptionHandler(NoSuchElementException.class) - public ResponseEntity noSuchElement() { - return ResponseEntity.notFound().build(); - } -} diff --git a/src/main/java/icu/samnyan/aqua/api/controller/general/StaticController.java b/src/main/java/icu/samnyan/aqua/api/controller/general/StaticController.java deleted file mode 100644 index 15a3cbaa..00000000 --- a/src/main/java/icu/samnyan/aqua/api/controller/general/StaticController.java +++ /dev/null @@ -1,38 +0,0 @@ -package icu.samnyan.aqua.api.controller.general; - -import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerScreenShotRepository; -import icu.samnyan.aqua.sega.diva.model.userdata.PlayerScreenShot; -import lombok.AllArgsConstructor; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.core.io.FileSystemResource; -import org.springframework.core.io.Resource; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.nio.file.Paths; -import java.util.Optional; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@RestController -@RequestMapping("api/static") -@ConditionalOnProperty(prefix = "aquaviewer.api", name = "enabled", havingValue = "true") -@AllArgsConstructor -public class StaticController { - private final PlayerScreenShotRepository playerScreenShotRepository; - - @GetMapping(value = "screenshot/{filename}", produces = MediaType.IMAGE_JPEG_VALUE) - public ResponseEntity getScreenshotFile(@PathVariable String filename) { - Optional ss = playerScreenShotRepository.findByFileName(filename); - if (ss.isPresent()) { - return ResponseEntity.ok(new FileSystemResource(Paths.get("data/" + ss.get().getFileName()))); - } else { - return ResponseEntity.notFound().build(); - } - } -} diff --git a/src/main/java/icu/samnyan/aqua/api/controller/sega/ApiAimeController.java b/src/main/java/icu/samnyan/aqua/api/controller/sega/ApiAimeController.java deleted file mode 100644 index da1bd71d..00000000 --- a/src/main/java/icu/samnyan/aqua/api/controller/sega/ApiAimeController.java +++ /dev/null @@ -1,31 +0,0 @@ -package icu.samnyan.aqua.api.controller.sega; - -import icu.samnyan.aqua.sega.general.model.Card; -import icu.samnyan.aqua.sega.general.service.CardService; -import lombok.AllArgsConstructor; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.Map; -import java.util.Optional; - -/** - * General Aime actions endpoint - * @author samnyan (privateamusement@protonmail.com) - */ -@RestController -@RequestMapping("api/sega/aime") -@ConditionalOnProperty(prefix = "aquaviewer.api", name = "enabled", havingValue = "true") -@AllArgsConstructor -public class ApiAimeController { - - private final CardService cardService; - - @PostMapping("getByAccessCode") - public Optional getByAccessCode(@RequestBody Map request) { - return cardService.getCardByAccessCode(request.get("accessCode").replaceAll("-", "").replaceAll(" ", "")); - } -} diff --git a/src/main/java/icu/samnyan/aqua/api/controller/sega/game/chuni/v1/ApiChuniV1GameDataController.java b/src/main/java/icu/samnyan/aqua/api/controller/sega/game/chuni/v1/ApiChuniV1GameDataController.java deleted file mode 100644 index 17a03a83..00000000 --- a/src/main/java/icu/samnyan/aqua/api/controller/sega/game/chuni/v1/ApiChuniV1GameDataController.java +++ /dev/null @@ -1,44 +0,0 @@ -package icu.samnyan.aqua.api.controller.sega.game.chuni.v1; - -import icu.samnyan.aqua.sega.chunithm.dao.gamedata.GameCharacterRepository; -import icu.samnyan.aqua.sega.chunithm.dao.gamedata.GameCharacterSkillRepository; -import icu.samnyan.aqua.sega.chunithm.model.gamedata.Character; -import icu.samnyan.aqua.sega.chunithm.model.gamedata.CharacterSkill; -import icu.samnyan.aqua.sega.chunithm.model.gamedata.Music; -import icu.samnyan.aqua.sega.chunithm.service.GameMusicService; -import lombok.AllArgsConstructor; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -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/chuni/v1/data") -@ConditionalOnProperty(prefix = "aquaviewer.api", name = "enabled", havingValue = "true") -@AllArgsConstructor -public class ApiChuniV1GameDataController { - - private final GameMusicService gameMusicService; - private final GameCharacterRepository gameCharacterRepository; - private final GameCharacterSkillRepository gameCharacterSkillRepository; - - @GetMapping("music") - public List getMusic() { - return gameMusicService.getAll(); - } - - @GetMapping("character") - public List getCharacter() { - return gameCharacterRepository.findAll(); - } - - @GetMapping("skill") - public List getSkill() { - return gameCharacterSkillRepository.findAll(); - } -} diff --git a/src/main/java/icu/samnyan/aqua/api/controller/sega/game/chuni/v1/ApiChuniV1PlayerDataController.java b/src/main/java/icu/samnyan/aqua/api/controller/sega/game/chuni/v1/ApiChuniV1PlayerDataController.java deleted file mode 100644 index 78f3a953..00000000 --- a/src/main/java/icu/samnyan/aqua/api/controller/sega/game/chuni/v1/ApiChuniV1PlayerDataController.java +++ /dev/null @@ -1,421 +0,0 @@ -package icu.samnyan.aqua.api.controller.sega.game.chuni.v1; - -import com.fasterxml.jackson.core.type.TypeReference; -import icu.samnyan.aqua.api.model.MessageResponse; -import icu.samnyan.aqua.api.model.ReducedPageResponse; -import icu.samnyan.aqua.api.model.resp.sega.chuni.v1.ProfileResp; -import icu.samnyan.aqua.api.model.resp.sega.chuni.v1.RatingItem; -import icu.samnyan.aqua.api.model.resp.sega.chuni.v1.RecentResp; -import icu.samnyan.aqua.api.model.resp.sega.chuni.v1.external.ChuniDataExport; -import icu.samnyan.aqua.api.model.resp.sega.chuni.v1.external.ChuniDataImport; -import icu.samnyan.aqua.api.model.resp.sega.chuni.v1.external.ExternalUserData; -import icu.samnyan.aqua.api.util.ApiMapper; -import icu.samnyan.aqua.sega.chunithm.model.gamedata.Level; -import icu.samnyan.aqua.sega.chunithm.model.gamedata.Music; -import icu.samnyan.aqua.sega.chunithm.model.userdata.*; -import icu.samnyan.aqua.sega.chunithm.service.*; -import icu.samnyan.aqua.sega.general.model.Card; -import icu.samnyan.aqua.sega.general.service.CardService; -import icu.samnyan.aqua.sega.util.VersionInfo; -import icu.samnyan.aqua.sega.util.VersionUtil; -import lombok.AllArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; -import org.springframework.data.domain.Sort; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import java.util.*; -import java.util.stream.Collectors; - -/** - * For all aimeId parameter, should use String - * @author samnyan (privateamusement@protonmail.com) - */ -@RestController -@RequestMapping("api/game/chuni/v1") -@ConditionalOnProperty(prefix = "aquaviewer.api", name = "enabled", havingValue = "true") -@AllArgsConstructor -public class ApiChuniV1PlayerDataController { - - private static final Logger logger = LoggerFactory.getLogger(ApiChuniV1PlayerDataController.class); - - private final ApiMapper mapper; - - private final CardService cardService; - - private final UserActivityService userActivityService; - private final UserCharacterService userCharacterService; - private final UserChargeService userChargeService; - private final UserCourseService userCourseService; - private final UserDataService userDataService; - private final UserDataExService userDataExService; - private final UserDuelService userDuelService; - private final UserGameOptionService userGameOptionService; - private final UserGameOptionExService userGameOptionExService; - private final UserItemService userItemService; - private final UserMapService userMapService; - private final UserMusicDetailService userMusicDetailService; - private final UserPlaylogService userPlaylogService; - private final UserGeneralDataService userGeneralDataService; - - private final GameMusicService gameMusicService; - - // Keep it here for legacy - @GetMapping("music") - public List getMusicList() { - return gameMusicService.getAll(); - } - - /** - * Get Basic info - * - * @return - */ - @GetMapping("profile") - public ProfileResp getProfile(@RequestParam String aimeId) { - ProfileResp resp = mapper.convert(userDataService.getUserByExtId(aimeId).orElseThrow(), new TypeReference<>() { - }); - UserCourse course = userCourseService.getByUserId(aimeId) - .stream() - .filter(UserCourse::isClear) - .max(Comparator.comparingInt(UserCourse::getClassId)) - .orElseGet(() -> new UserCourse(0)); - resp.setCourseClass(course.getClassId()); - return resp; - } - - @PutMapping("profile/userName") - public UserData updateName(@RequestBody Map request) { - UserData profile = userDataService.getUserByExtId((String) request.get("aimeId")).orElseThrow(); - profile.setUserName((String) request.get("userName")); - return userDataService.saveUserData(profile); - } - - @PutMapping("profile/plate") - public UserData updatePlate(@RequestBody Map request) { - UserData profile = userDataService.getUserByExtId((String) request.get("aimeId")).orElseThrow(); - profile.setNameplateId((Integer) request.get("nameplateId")); - profile.setFrameId((Integer) request.get("frameId")); - return userDataService.saveUserData(profile); - } - - @PutMapping("profile/privacy") - public ResponseEntity updatePrivacy(@RequestBody Map request) { - UserData profile = userDataService.getUserByExtId((String) request.get("aimeId")).orElseThrow(); - UserGameOption option = userGameOptionService.getByUser(profile).orElseThrow(); - int privacy = (Integer) request.get("privacy"); - if (privacy != 1 && privacy != 0) { - return ResponseEntity.badRequest().body(new MessageResponse("Wrong data")); - } - option.setPrivacy(privacy); - return ResponseEntity.ok(userDataService.saveUserData(profile)); - } - - @GetMapping("recent") - public ReducedPageResponse getRecentPlay(@RequestParam String aimeId, - @RequestParam(required = false, defaultValue = "0") int page, - @RequestParam(required = false, defaultValue = "10") int size) { - Page playLogs = userPlaylogService.getRecentPlays(aimeId, PageRequest.of(page, size, Sort.by(Sort.Direction.DESC, "userPlayDate"))); - return new ReducedPageResponse<>(mapper.convert(playLogs.getContent(), new TypeReference<>() { - }), playLogs.getPageable().getPageNumber(), playLogs.getTotalPages(), playLogs.getTotalElements()); - } - - @GetMapping("rating") - public List getRating(@RequestParam String aimeId) { - - Map musicMap = gameMusicService.getIdMap(); - List details = userMusicDetailService.getByUserId(aimeId); - - var user = userDataService.getUserByExtId(aimeId).orElseThrow(); - var version = VersionUtil.parseVersion(user.getLastRomVersion()); - - List result = new ArrayList<>(); - for (UserMusicDetail detail : details) { - Music music = musicMap.get(detail.getMusicId()); - if (music != null) { - Level level = music.getLevels().get(detail.getLevel()); - if (level != null) { - int levelBase = level.getLevel() * 100 + level.getLevelDecimal(); - int score = detail.getScoreMax(); - int rating = calculateRating(levelBase, score, version); - result.add(new RatingItem(music.getMusicId(), music.getName(), music.getArtistName(), level.getDiff(), score, levelBase, rating)); - } - } - } - - return result.stream() - .filter(detail -> detail.getLevel() != 4) - .sorted(Comparator.comparingInt(RatingItem::getRating).reversed()) - .limit(30) - .collect(Collectors.toList()); - } - - @GetMapping("rating/recent") - public List getRecentRating(@RequestParam String aimeId) { - Map musicMap = gameMusicService.getIdMap(); - Optional recentOptional = userGeneralDataService.getByUserIdAndKey(aimeId, "recent_rating_list"); - - - var user = userDataService.getUserByExtId(aimeId).orElseThrow(); - var version = VersionUtil.parseVersion(user.getLastRomVersion()); - - List result = new LinkedList<>(); - if (recentOptional.isPresent()) { - // Read from recent_rating_list - String val = recentOptional.get().getPropertyValue(); - if (StringUtils.isNotBlank(val) && val.contains(",")) { - String[] records = val.split(","); - for (String record : - records) { - String[] value = record.split(":"); - Music music = musicMap.get(Integer.parseInt(value[0])); - if (music != null) { - Level level = music.getLevels().get(Integer.parseInt(value[1])); - if (level != null) { - int levelBase = getLevelBase(level.getLevel(), level.getLevelDecimal()); - int score = Integer.parseInt(value[2]); - int rating = calculateRating(levelBase, score, version); - result.add(new RatingItem(music.getMusicId(), music.getName(), music.getArtistName(), level.getDiff(), score, levelBase, rating)); - } - } - } - } - } else { - // Use old method - List logList = userPlaylogService.getRecent30Plays(aimeId); - for (UserPlaylog log : logList) { - Music music = musicMap.get(log.getMusicId()); - if (music != null) { - Level level = music.getLevels().get(log.getLevel()); - if (level != null) { - int levelBase = getLevelBase(level.getLevel(), level.getLevelDecimal()); - int score = log.getScore(); - int rating = calculateRating(levelBase, score, version); - result.add(new RatingItem(music.getMusicId(), music.getName(), music.getArtistName(), level.getDiff(), score, levelBase, rating)); - } - } - } - } - - return result.stream() - .filter(detail -> detail.getLevel() != 4) - .sorted(Comparator.comparingInt(RatingItem::getRating).reversed()) - .limit(10) - .collect(Collectors.toList()); - } - - @GetMapping("song/{id}") - public List getSongDetail(@RequestParam String aimeId, @PathVariable int id) { - return userMusicDetailService.getByUserIdAndMusicId(aimeId, id); - } - - @GetMapping("song/{id}/{level}") - public List getLevelPlaylog(@RequestParam String aimeId, @PathVariable int id, @PathVariable int level) { - return userPlaylogService.getByUserIdAndMusicIdAndLevel(aimeId, id, level); - } - - @GetMapping("character") - public ReducedPageResponse getCharacter(@RequestParam String aimeId, - @RequestParam(required = false, defaultValue = "0") int page, - @RequestParam(required = false, defaultValue = "10") int size) { - Page characters = userCharacterService.getByUserId(aimeId, page, size); - return new ReducedPageResponse<>(characters.getContent(), characters.getPageable().getPageNumber(), characters.getTotalPages(), characters.getTotalElements()); - } - - @PostMapping("character") - public ResponseEntity updateCharacter(@RequestBody Map request) { - UserData profile = userDataService.getUserByExtId((String) request.get("aimeId")).orElseThrow(); - Integer characterId = (Integer) request.get("characterId"); - Optional characterOptional = userCharacterService.getByUserAndCharacterId(profile, characterId); - UserCharacter character; - if(characterOptional.isPresent()) { - character = characterOptional.get(); - } else { - character = new UserCharacter(profile); - character.setCharacterId(characterId); - } - if(request.containsKey("level")) { - character.setLevel((Integer) request.get("level")); - } - - return ResponseEntity.ok(userCharacterService.save(character)); - } - - @GetMapping("course") - public List getCourse(@RequestParam String aimeId) { - return userCourseService.getByUserId(aimeId); - } - - @GetMapping("duel") - public List getDuel(@RequestParam String aimeId) { - return userDuelService.getByUserId(aimeId); - } - - @GetMapping("item") - public ReducedPageResponse getItem(@RequestParam String aimeId, - @RequestParam(required = false, defaultValue = "0") int page, - @RequestParam(required = false, defaultValue = "10") int size) { - Page items = userItemService.getByUserId(aimeId, page, size); - return new ReducedPageResponse<>(items.getContent(), items.getPageable().getPageNumber(), items.getTotalPages(), items.getTotalElements()); - } - - @PostMapping("item") - public ResponseEntity updateItem(@RequestBody Map request) { - UserData profile = userDataService.getUserByExtId((String) request.get("aimeId")).orElseThrow(); - Integer itemId = (Integer) request.get("itemId"); - Integer itemKind = (Integer) request.get("itemKind"); - Optional itemOptional = userItemService.getByUserAndItemIdAndKind(profile, itemId,itemKind); - UserItem item; - if(itemOptional.isPresent()) { - item = itemOptional.get(); - } else { - item = new UserItem(profile); - item.setItemId(itemId); - item.setItemKind(itemKind); - } - if(request.containsKey("stock")) { - item.setStock((Integer) request.get("stock")); - } - return ResponseEntity.ok(userItemService.save(item)); - } - - @GetMapping("general") - public ResponseEntity getGeneralData(@RequestParam String aimeId, @RequestParam String key) { - Optional userGeneralDataOptional = userGeneralDataService.getByUserIdAndKey(aimeId,key); - return userGeneralDataOptional.>map(ResponseEntity::ok) - .orElseGet(() -> ResponseEntity.status(HttpStatus.NOT_FOUND).body(new MessageResponse("User or value not found."))); - } - - @GetMapping("export") - public ResponseEntity exportAllUserData(@RequestParam String aimeId) { - ChuniDataExport data = new ChuniDataExport(); - try { - data.setGameId("SDBT"); - data.setUserData(userDataService.getUserByExtId(aimeId).orElseThrow()); - data.setUserActivityList(userActivityService.getByUserId(aimeId)); - data.setUserCharacterList(userCharacterService.getByUserId(aimeId)); - data.setUserChargeList(userChargeService.getByUserId(aimeId)); - data.setUserCourseList(userCourseService.getByUserId(aimeId)); - data.setUserDataEx(userDataExService.getByExtId(aimeId).orElseThrow()); - data.setUserDuelList(userDuelService.getByUserId(aimeId)); - data.setUserGameOption(userGameOptionService.getByUserId(aimeId).orElseThrow()); - data.setUserGameOptionEx(userGameOptionExService.getByUserId(aimeId).orElseThrow()); - data.setUserItemList(userItemService.getByUserId(aimeId)); - data.setUserMapList(userMapService.getByUserId(aimeId)); - data.setUserMusicDetailList(userMusicDetailService.getByUserId(aimeId)); - data.setUserPlaylogList(userPlaylogService.getByUserId(aimeId)); - } catch (NoSuchElementException e) { - return ResponseEntity.status(HttpStatus.NOT_FOUND) - .body(new MessageResponse("User not found")); - } catch (Exception e) { - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) - .body(new MessageResponse("Error during data export. Reason: " + e.getMessage())); - } - // Set filename - HttpHeaders headers = new HttpHeaders(); - headers.set("content-disposition", "attachment; filename=chuni_" + aimeId + "_exported.json"); - return new ResponseEntity<>(data, headers, HttpStatus.OK); - } - - @PostMapping("import") - public ResponseEntity importAllUserData(@RequestBody ChuniDataImport data) { - if(!data.getGameId().equals("SDBT")) { - return ResponseEntity.unprocessableEntity().body(new MessageResponse("Wrong Game Profile, Expected 'SDBT', Get " + data.getGameId())); - } - - ExternalUserData exUser = data.getUserData(); - - Optional cardOptional = cardService.getCardByAccessCode(exUser.getAccessCode()); - Card card; - if (cardOptional.isPresent()) { - if (userDataService.getUserByCard(cardOptional.get()).isPresent()) { - return ResponseEntity.status(HttpStatus.BAD_REQUEST) - .body(new MessageResponse("This card already has a chunithm profile.")); - } else { - card = cardOptional.get(); - } - } else { - card = cardService.registerByAccessCode(exUser.getAccessCode()); - } - - UserData userData = mapper.convert(exUser, new TypeReference<>() { - }); - userData.setCard(card); - userDataService.saveAndFlushUserData(userData); - - List userActivityList = data.getUserActivityList(); - userActivityList.forEach(x -> x.setUser(userData)); - userActivityService.saveAll(userActivityList); - - List userCharacterList = data.getUserCharacterList(); - userCharacterList.forEach(x -> x.setUser(userData)); - userCharacterService.saveAll(userCharacterList); - - List userChargeList = data.getUserChargeList(); - userCharacterList.forEach(x -> x.setUser(userData)); - userChargeService.saveAll(userChargeList); - - List userCourseList = data.getUserCourseList(); - userCourseList.forEach(x -> x.setUser(userData)); - userCourseService.saveAll(userCourseList); - - UserDataEx userDataEx = data.getUserDataEx(); - userDataEx.setUser(userData); - userDataExService.save(userDataEx); - - List userDuelList = data.getUserDuelList(); - userDuelList.forEach(x -> x.setUser(userData)); - userDuelService.saveAll(userDuelList); - - UserGameOption userGameOption = data.getUserGameOption(); - userGameOption.setUser(userData); - userGameOptionService.save(userGameOption); - - UserGameOptionEx userGameOptionEx = data.getUserGameOptionEx(); - userGameOptionEx.setUser(userData); - userGameOptionExService.save(userGameOptionEx); - - List userItemList = data.getUserItemList(); - userItemList.forEach(x -> x.setUser(userData)); - userItemService.saveAll(userItemList); - - List userMapList = data.getUserMapList(); - userMapList.forEach(x -> x.setUser(userData)); - userMapService.saveAll(userMapList); - - List userMusicDetailList = data.getUserMusicDetailList(); - userMusicDetailList.forEach(x -> x.setUser(userData)); - userMusicDetailService.saveAll(userMusicDetailList); - - List userPlaylogList = data.getUserPlaylogList(); - userPlaylogList.forEach(x -> x.setUser(userData)); - userPlaylogService.saveAll(userPlaylogList); - - return ResponseEntity.ok(new MessageResponse("Import successfully, aimeId: " + card.getExtId())); - } - - private int getLevelBase(int level, int levelDecimal) { - return level * 100 + levelDecimal; - } - - private int calculateRating(int levelBase, int score, VersionInfo version) { - if (score >= 1007500) return levelBase + 200; - if (score >= 1005000) return levelBase + 150 + (score - 1005000) * 10 / 500; - if (score >= 1000000) return levelBase + 100 + (score - 1000000) * 5 / 500; - if (score >= 975000) return levelBase + (score - 975000) * 2 / 500; - if (score >= 950000 && version.getMinorVersion() < 35) return levelBase - 150 + (score - 950000) * 3 / 500; - if (score >= 925000) return levelBase - 300 + (score - 925000) * 3 / 500; - if (score >= 900000) return levelBase - 500 + (score - 900000) * 4 / 500; - if (score >= 800000) - return ((levelBase - 500) / 2 + (score - 800000) * ((levelBase - 500) / 2) / (100000)); - return 0; - } -} diff --git a/src/main/java/icu/samnyan/aqua/api/controller/sega/game/diva/ApiDivaGameDataController.java b/src/main/java/icu/samnyan/aqua/api/controller/sega/game/diva/ApiDivaGameDataController.java deleted file mode 100644 index fc7a0c3b..00000000 --- a/src/main/java/icu/samnyan/aqua/api/controller/sega/game/diva/ApiDivaGameDataController.java +++ /dev/null @@ -1,44 +0,0 @@ -package icu.samnyan.aqua.api.controller.sega.game.diva; - -import icu.samnyan.aqua.sega.diva.dao.gamedata.DivaCustomizeRepository; -import icu.samnyan.aqua.sega.diva.dao.gamedata.DivaModuleRepository; -import icu.samnyan.aqua.sega.diva.dao.gamedata.DivaPvRepository; -import icu.samnyan.aqua.sega.diva.model.gamedata.DivaCustomize; -import icu.samnyan.aqua.sega.diva.model.gamedata.DivaModule; -import icu.samnyan.aqua.sega.diva.model.gamedata.Pv; -import lombok.AllArgsConstructor; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -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/diva/data") -@ConditionalOnProperty(prefix = "aquaviewer.api", name = "enabled", havingValue = "true") -@AllArgsConstructor -public class ApiDivaGameDataController { - - private final DivaModuleRepository divaModuleRepository; - private final DivaCustomizeRepository divaCustomizeRepository; - private final DivaPvRepository divaPvRepository; - - @GetMapping(value = "musicList") - public List musicList() { - return divaPvRepository.findAll(); - } - - @GetMapping(value = "moduleList") - public List moduleList() { - return divaModuleRepository.findAll(); - } - - @GetMapping(value = "customizeList") - public List customizeList() { - return divaCustomizeRepository.findAll(); - } -} diff --git a/src/main/java/icu/samnyan/aqua/api/controller/sega/game/diva/ApiDivaPlayerDataController.java b/src/main/java/icu/samnyan/aqua/api/controller/sega/game/diva/ApiDivaPlayerDataController.java deleted file mode 100644 index 11e0d9f4..00000000 --- a/src/main/java/icu/samnyan/aqua/api/controller/sega/game/diva/ApiDivaPlayerDataController.java +++ /dev/null @@ -1,276 +0,0 @@ -package icu.samnyan.aqua.api.controller.sega.game.diva; - -import icu.samnyan.aqua.api.model.MessageResponse; -import icu.samnyan.aqua.api.model.ReducedPageResponse; -import icu.samnyan.aqua.api.model.resp.sega.diva.PvRankRecord; -import icu.samnyan.aqua.sega.diva.dao.userdata.*; -import icu.samnyan.aqua.sega.diva.model.common.Difficulty; -import icu.samnyan.aqua.sega.diva.model.common.Edition; -import icu.samnyan.aqua.sega.diva.model.userdata.*; -import icu.samnyan.aqua.sega.diva.service.PlayerProfileService; -import lombok.AllArgsConstructor; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import java.util.*; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@RestController -@RequestMapping("api/game/diva") -@ConditionalOnProperty(prefix = "aquaviewer.api", name = "enabled", havingValue = "true") -@AllArgsConstructor -public class ApiDivaPlayerDataController { - - private final PlayerProfileService playerProfileService; - - private final GameSessionRepository gameSessionRepository; - private final PlayLogRepository playLogRepository; - private final PlayerPvRecordRepository playerPvRecordRepository; - private final PlayerPvCustomizeRepository playerPvCustomizeRepository; - private final PlayerModuleRepository playerModuleRepository; - private final PlayerCustomizeRepository playerCustomizeRepository; - private final PlayerScreenShotRepository playerScreenShotRepository; - - @PostMapping("forceUnlock") - public ResponseEntity forceUnlock(@RequestParam long pdId) { - PlayerProfile profile = playerProfileService.findByPdId(pdId).orElseThrow(); - Optional session = gameSessionRepository.findByPdId(profile); - if(session.isPresent()) { - gameSessionRepository.delete(session.get()); - return ResponseEntity.ok(new MessageResponse("Session deleted.")); - } else { - return ResponseEntity.status(HttpStatus.FORBIDDEN).body(new MessageResponse("Session doesn't exist.")); - } - } - - @GetMapping("playerInfo") - public Optional getPlayerInfo(@RequestParam long pdId) { - return playerProfileService.findByPdId(pdId); - } - - @GetMapping("playerInfo/rival") - public Map getRivalInfo(@RequestParam long pdId) { - var rId = playerProfileService.findByPdId(pdId).orElseThrow().getRivalPdId(); - Map result = new HashMap<>(); - if (rId == -1) { - result.put("rival", "Not Set"); - } else { - Optional profile = playerProfileService.findByPdId(rId); - if (profile.isPresent()) { - result.put("rival", profile.get().getPlayerName()); - } else { - result.put("rival", "Player Not Found"); - } - } - return result; - } - - @PutMapping("playerInfo/rival") - public PlayerProfile updateRivalWithId(@RequestBody Map request) { - PlayerProfile profile = playerProfileService.findByPdId((Integer) request.get("pdId")).orElseThrow(); - profile.setRivalPdId((Integer) request.get("rivalId")); - return playerProfileService.save(profile); - } - - @PutMapping("playerInfo/rival/byRecord") - public PlayerProfile updateRivalWithRecord(@RequestBody Map request) { - PlayerProfile profile = playerProfileService.findByPdId((Integer) request.get("pdId")).orElseThrow(); - PlayerPvRecord record = playerPvRecordRepository.findById(((Integer) request.get("recordId")).longValue()).orElseThrow(); - profile.setRivalPdId(record.getPdId().getPdId()); - return playerProfileService.save(profile); - } - - @PutMapping("playerInfo/playerName") - public PlayerProfile updateName(@RequestBody Map request) { - PlayerProfile profile = playerProfileService.findByPdId((Integer) request.get("pdId")).orElseThrow(); - profile.setPlayerName((String) request.get("playerName")); - return playerProfileService.save(profile); - } - - @PutMapping("playerInfo/title") - public PlayerProfile updateTitle(@RequestBody Map request) { - PlayerProfile profile = playerProfileService.findByPdId((Integer) request.get("pdId")).orElseThrow(); - profile.setLevelTitle((String) request.get("title")); - return playerProfileService.save(profile); - } - - @PutMapping("playerInfo/plate") - public PlayerProfile updatePlate(@RequestBody Map request) { - PlayerProfile profile = playerProfileService.findByPdId((Integer) request.get("pdId")).orElseThrow(); - profile.setPlateId((Integer) request.get("plateId")); - profile.setPlateEffectId((Integer) request.get("plateEffectId")); - return playerProfileService.save(profile); - } - - @PutMapping("playerInfo/commonModule") - public PlayerProfile updateModule(@RequestBody Map request) { - PlayerProfile profile = playerProfileService.findByPdId((Integer) request.get("pdId")).orElseThrow(); - profile.setCommonModule((String) request.get("commonModule")); - return playerProfileService.save(profile); - } - - @PutMapping("playerInfo/commonCustomize") - public PlayerProfile updateCustomize(@RequestBody Map request) { - PlayerProfile profile = playerProfileService.findByPdId((Integer) request.get("pdId")).orElseThrow(); - profile.setCommonCustomizeItems((String) request.get("commonCustomize")); - return playerProfileService.save(profile); - } - - @PutMapping("playerInfo/commonSkin") - public PlayerProfile updateSkin(@RequestBody Map request) { - PlayerProfile profile = playerProfileService.findByPdId((Integer) request.get("pdId")).orElseThrow(); - profile.setCommonSkin((Integer) request.get("skinId")); - return playerProfileService.save(profile); - } - - @PutMapping("playerInfo/myList") - public PlayerProfile updateMyList(@RequestBody Map request) { - PlayerProfile profile = playerProfileService.findByPdId((Integer) request.get("pdId")).orElseThrow(); - switch ((Integer) request.get("myListId")) { - case 0: - profile.setMyList0((String) request.get("myListData")); - break; - case 1: - profile.setMyList1((String) request.get("myListData")); - break; - case 2: - profile.setMyList2((String) request.get("myListData")); - break; - } - return playerProfileService.save(profile); - } - - @PutMapping("playerInfo/se") - public PlayerProfile updateSe(@RequestBody Map request) { - PlayerProfile profile = playerProfileService.findByPdId((Integer) request.get("pdId")).orElseThrow(); - profile.setButtonSe((Integer) request.get("buttonSe")); - profile.setChainSlideSe((Integer) request.get("chainSlideSe")); - profile.setSlideSe((Integer) request.get("slideSe")); - profile.setSliderTouchSe((Integer) request.get("sliderTouchSe")); - return playerProfileService.save(profile); - } - - @PutMapping("playerInfo/display") - public PlayerProfile updateDisplay(@RequestBody Map request) { - PlayerProfile profile = playerProfileService.findByPdId((Integer) request.get("pdId")).orElseThrow(); - profile.setShowInterimRanking((Boolean) request.get("showInterimRanking")); - profile.setShowClearStatus((Boolean) request.get("showClearStatus")); - profile.setShowGreatBorder((Boolean) request.get("showGreatBorder")); - profile.setShowExcellentBorder((Boolean) request.get("showExcellentBorder")); - profile.setShowRivalBorder((Boolean) request.get("showRivalBorder")); - profile.setShowRgoSetting((Boolean) request.get("showRgoSetting")); - return playerProfileService.save(profile); - } - - @GetMapping("playLog") - public ReducedPageResponse getPlayLogs(@RequestParam long pdId, - @RequestParam(required = false, defaultValue = "0") int page, - @RequestParam(required = false, defaultValue = "10") int size) { - Page playLogs = playLogRepository.findByPdId_PdIdOrderByDateTimeDesc(pdId, PageRequest.of(page, size)); - return new ReducedPageResponse<>(playLogs.getContent(), playLogs.getPageable().getPageNumber(), playLogs.getTotalPages(), playLogs.getTotalElements()); - } - - /** - * PvRecord - */ - - @GetMapping("pvRecord") - public ReducedPageResponse getPvRecords(@RequestParam long pdId, - @RequestParam(required = false, defaultValue = "0") int page, - @RequestParam(required = false, defaultValue = "10") int size) { - Page pvRecords = playerPvRecordRepository.findByPdId_PdIdOrderByPvId(pdId, PageRequest.of(page, size)); - return new ReducedPageResponse<>(pvRecords.getContent(), pvRecords.getPageable().getPageNumber(), pvRecords.getTotalPages(), pvRecords.getTotalElements()); - } - - @GetMapping("pvRecord/{pvId}") - public Map getPvRecord(@RequestParam long pdId, @PathVariable int pvId) { - Map resultMap = new HashMap<>(); - resultMap.put("records", playerPvRecordRepository.findByPdId_PdIdAndPvId(pdId, pvId)); - playerPvCustomizeRepository.findByPdId_PdIdAndPvId(pdId, pvId).ifPresent(x -> resultMap.put("customize", x)); - return resultMap; - } - - @PutMapping("pvRecord/{pvId}") - public PlayerPvCustomize updatePvCustomize(@RequestBody Map request, @PathVariable int pvId) { - PlayerProfile profile = playerProfileService.findByPdId((Integer) request.get("pdId")).orElseThrow(); - PlayerPvCustomize playerPvCustomize = playerPvCustomizeRepository.findByPdIdAndPvId(profile, pvId) - .orElseGet(() -> new PlayerPvCustomize(profile, pvId)); - playerPvCustomize.setModule((String) request.get("module")); - playerPvCustomize.setCustomize((String) request.get("customize")); - playerPvCustomize.setCustomizeFlag((String) request.get("customizeFlag")); - playerPvCustomize.setSkin((Integer) request.get("skin")); - playerPvCustomize.setButtonSe((Integer) request.get("buttonSe")); - playerPvCustomize.setSlideSe((Integer) request.get("slideSe")); - playerPvCustomize.setChainSlideSe((Integer) request.get("chainSlideSe")); - playerPvCustomize.setSliderTouchSe((Integer) request.get("sliderTouchSe")); - return playerPvCustomizeRepository.save(playerPvCustomize); - } - - @GetMapping("pvRecord/{pvId}/ranking/{difficulty}") - public ReducedPageResponse getPvRanking(@PathVariable int pvId, - @PathVariable String difficulty, - @RequestParam(required = false, defaultValue = "0") int page, - @RequestParam(required = false, defaultValue = "10") int size) { - Difficulty diff = null; - Edition edition = Edition.ORIGINAL; - switch (difficulty) { - case "EASY": - diff = Difficulty.EASY; - break; - case "NORMAL": - diff = Difficulty.NORMAL; - break; - case "HARD": - diff = Difficulty.HARD; - break; - case "EXTREME": - diff = Difficulty.EXTREME; - break; - case "EXTRA_EXTREME": { - diff = Difficulty.EXTREME; - edition = Edition.EXTRA; - break; - } - } - if(diff != null) { - Page pvRecords = playerPvRecordRepository.findByPvIdAndEditionAndDifficultyOrderByMaxScoreDesc(pvId, edition,diff, PageRequest.of(page, size)); - - List rankList = new LinkedList<>(); - - pvRecords.forEach(x ->{ - rankList.add(new PvRankRecord(x.getId(),x.getPdId().getPlayerName(),x.getMaxScore(),x.getMaxAttain())); - }); - - return new ReducedPageResponse<>(rankList, pvRecords.getPageable().getPageNumber(), pvRecords.getTotalPages(), pvRecords.getTotalElements()); - } - return null; - } - - @GetMapping("module") - public ReducedPageResponse getModules(@RequestParam long pdId, - @RequestParam(required = false, defaultValue = "0") int page, - @RequestParam(required = false, defaultValue = "10") int size) { - Page modules = playerModuleRepository.findByPdId_PdId(pdId, PageRequest.of(page, size)); - return new ReducedPageResponse<>(modules.getContent(), modules.getPageable().getPageNumber(), modules.getTotalPages(), modules.getTotalElements()); - } - - @GetMapping("customize") - public ReducedPageResponse getCustomizes(@RequestParam long pdId, - @RequestParam(required = false, defaultValue = "0") int page, - @RequestParam(required = false, defaultValue = "10") int size) { - Page customizes = playerCustomizeRepository.findByPdId_PdId(pdId, PageRequest.of(page, size)); - return new ReducedPageResponse<>(customizes.getContent(), customizes.getPageable().getPageNumber(), customizes.getTotalPages(), customizes.getTotalElements()); - } - - @GetMapping("screenshot") - public List getScreenshotList(@RequestParam long pdId) { - return playerScreenShotRepository.findByPdId_PdId(pdId); - } - -} diff --git a/src/main/java/icu/samnyan/aqua/api/controller/sega/game/maimai2/ApiMaimai2PlayerDataController.java b/src/main/java/icu/samnyan/aqua/api/controller/sega/game/maimai2/ApiMaimai2PlayerDataController.java deleted file mode 100644 index 34503765..00000000 --- a/src/main/java/icu/samnyan/aqua/api/controller/sega/game/maimai2/ApiMaimai2PlayerDataController.java +++ /dev/null @@ -1,396 +0,0 @@ -package icu.samnyan.aqua.api.controller.sega.game.maimai2; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import icu.samnyan.aqua.api.model.MessageResponse; -import icu.samnyan.aqua.api.model.ReducedPageResponse; -import icu.samnyan.aqua.api.model.resp.sega.maimai2.PhotoResp; -import icu.samnyan.aqua.api.model.resp.sega.maimai2.ProfileResp; -import icu.samnyan.aqua.api.model.resp.sega.maimai2.external.ExternalUserData; -import icu.samnyan.aqua.api.model.resp.sega.maimai2.external.Maimai2DataExport; -import icu.samnyan.aqua.api.model.resp.sega.maimai2.external.Maimai2DataImport; -import icu.samnyan.aqua.api.util.ApiMapper; -import icu.samnyan.aqua.sega.general.model.Card; -import icu.samnyan.aqua.sega.general.service.CardService; -import icu.samnyan.aqua.sega.maimai2.model.*; -import icu.samnyan.aqua.sega.maimai2.model.userdata.*; -import lombok.AllArgsConstructor; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; -import org.springframework.data.domain.Sort; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@RestController -@RequestMapping("api/game/maimai2") -@ConditionalOnProperty(prefix = "aquaviewer.api", name = "enabled", havingValue = "true") -@AllArgsConstructor -public class ApiMaimai2PlayerDataController { - - private final ApiMapper mapper; - - private final CardService cardService; - - private final Mai2UserActRepo userActRepository; - private final Mai2UserCharacterRepo userCharacterRepository; - private final Mai2UserDataRepo userDataRepository; - private final Mai2UserItemRepo userItemRepository; - private final Mai2UserLoginBonusRepo userLoginBonusRepository; - private final Mai2UserMusicDetailRepo userMusicDetailRepository; - private final Mai2UserOptionRepo userOptionRepository; - private final Mai2UserPlaylogRepo userPlaylogRepository; - private final Mai2UserGeneralDataRepo userGeneralDataRepository; - private final Mai2MapEncountNpcRepo mapEncountNpcRepository; - private final Mai2UserChargeRepo userChargeRepository; - private final Mai2UserCourseRepo userCourseRepository; - private final Mai2UserExtendRepo userExtendRepository; - private final Mai2UserFavoriteRepo userFavoriteRepository; - private final Mai2UserFriendSeasonRankingRepo userFriendSeasonRankingRepository; - private final Mai2UserMapRepo userMapRepository; - private final Mai2UserUdemaeRepo userUdemaeRepository; - - @GetMapping("config/userPhoto/divMaxLength") - public long getConfigUserPhotoDivMaxLength(@Value("${game.maimai2.userPhoto.divMaxLength:32}") long divMaxLength) { - return divMaxLength; - } - - @GetMapping("userPhoto") - public PhotoResp getUserPhoto(@RequestParam long aimeId, - @RequestParam(required = false, defaultValue = "0") int imageIndex) { - List matchedFiles = new ArrayList<>(); - PhotoResp Photo = new PhotoResp(); - try (Stream paths = Files.walk(Paths.get("data"))) { - matchedFiles = paths - .filter(Files::isRegularFile) - .filter(path -> path.getFileName().toString().endsWith(".jpg")) - .filter(path -> { - String fileName = path.getFileName().toString(); - String[] parts = fileName.split("-"); - return parts.length > 0 && parts[0].equals(String.valueOf(aimeId)); - }) - .map(Path::getFileName) - .map(Path::toString) - .sorted(Comparator.reverseOrder()) - .toList(); - Photo.setTotalImage(matchedFiles.size()); - Photo.setImageIndex(imageIndex); - if(matchedFiles.size() > imageIndex) { - byte[] targetImageContent = Files.readAllBytes(Paths.get("data/" + matchedFiles.get(imageIndex))); - String divData = Base64.getEncoder().encodeToString(targetImageContent); - Photo.setDivData(divData); - Photo.setFileName(matchedFiles.get(imageIndex)); - } - } - catch (Exception e) { - } - return Photo; - } - - @GetMapping("profile") - public ProfileResp getProfile(@RequestParam long aimeId) { - return mapper.convert(userDataRepository.findByCardExtId(aimeId).orElseThrow(), new TypeReference<>() { - }); - } - - @PostMapping("profile/username") - public Mai2UserDetail updateName(@RequestBody Map request) { - Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow(); - profile.setUserName((String) request.get("userName")); - return userDataRepository.save(profile); - } - - @PostMapping("profile/icon") - public Mai2UserDetail updateIcon(@RequestBody Map request) { - Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow(); - profile.setIconId((Integer) request.get("iconId")); - return userDataRepository.save(profile); - } - - @PostMapping("profile/plate") - public Mai2UserDetail updatePlate(@RequestBody Map request) { - Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow(); - profile.setPlateId((Integer) request.get("plateId")); - return userDataRepository.save(profile); - } - - @PostMapping("profile/frame") - public Mai2UserDetail updateFrame(@RequestBody Map request) { - Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow(); - profile.setFrameId((Integer) request.get("frameId")); - return userDataRepository.save(profile); - } - - @PostMapping("profile/title") - public Mai2UserDetail updateTrophy(@RequestBody Map request) { - Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow(); - profile.setTitleId((Integer) request.get("titleId")); - return userDataRepository.save(profile); - } - - @PostMapping("profile/partner") - public Mai2UserDetail updatePartner(@RequestBody Map request) { - Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow(); - profile.setPartnerId((Integer) request.get("partnerId")); - return userDataRepository.save(profile); - } - - @GetMapping("character") - public ReducedPageResponse getCharacter(@RequestParam long aimeId, - @RequestParam(required = false, defaultValue = "0") int page, - @RequestParam(required = false, defaultValue = "10") int size) { - Page characters = userCharacterRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page, size)); - return new ReducedPageResponse<>(characters.getContent(), characters.getPageable().getPageNumber(), characters.getTotalPages(), characters.getTotalElements()); - } - - @GetMapping("activity") - public List getActivities(@RequestParam long aimeId) { - return userActRepository.findByUser_Card_ExtId(aimeId); - } - - @GetMapping("item") - public ReducedPageResponse getItem(@RequestParam long aimeId, - @RequestParam(required = false, defaultValue = "0") int page, - @RequestParam(required = false, defaultValue = "10") int size, - @RequestParam(required = false, defaultValue = "0") int ItemKind) { - Page items; - if(ItemKind == 0){ - items = userItemRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page, size)); - } - else{ - items = userItemRepository.findByUser_Card_ExtIdAndItemKind(aimeId, ItemKind, PageRequest.of(page, size)); - } - return new ReducedPageResponse<>(items.getContent(), items.getPageable().getPageNumber(), items.getTotalPages(), items.getTotalElements()); - } - - @PostMapping("item") - public ResponseEntity updateItem(@RequestBody Map request) { - Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow(); - Integer itemKind = (Integer) request.get("itemKind"); - Integer itemId = (Integer) request.get("itemId"); - int stock = 1; - if (request.containsKey("stock")) { - stock = (Integer) request.get("stock"); - } - - Optional userItemOptional = userItemRepository.findByUserAndItemKindAndItemId(profile, itemKind, itemId); - - Mai2UserItem userItem; - if (userItemOptional.isPresent()) { - userItem = userItemOptional.get(); - } else { - userItem = new Mai2UserItem(); - userItem.setUser(profile); - userItem.setItemId(itemId); - userItem.setItemKind(itemKind); - } - userItem.setStock(stock); - userItem.setValid(true); - return ResponseEntity.ok(userItemRepository.save(userItem)); - } - - @GetMapping("recent") - public ReducedPageResponse getRecent(@RequestParam long aimeId, - @RequestParam(required = false, defaultValue = "0") int page, - @RequestParam(required = false, defaultValue = "10") int size) { - Page 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 getSongDetail(@RequestParam long aimeId, @PathVariable int id) { - return userMusicDetailRepository.findByUser_Card_ExtIdAndMusicId(aimeId, id); - } - - @GetMapping("song/{id}/{level}") - public List getLevelPlaylog(@RequestParam long aimeId, @PathVariable int id, @PathVariable int level) { - return userPlaylogRepository.findByUser_Card_ExtIdAndMusicIdAndLevel(aimeId, id, level); - } - - @GetMapping("options") - public Mai2UserOption getOptions(@RequestParam long aimeId) { - return userOptionRepository.findSingleByUser_Card_ExtId(aimeId).orElseThrow(); - } - - @PostMapping("options") - public ResponseEntity updateOptions(@RequestBody Map request) { - Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow(); - ObjectMapper objectMapper = new ObjectMapper(); - Mai2UserOption userOption = objectMapper.convertValue(request.get("options"), Mai2UserOption.class); - userOption.setUser(profile); - userOptionRepository.deleteByUser(profile); - userOptionRepository.flush(); - return ResponseEntity.ok(userOptionRepository.save(userOption)); - } - - @GetMapping("general") - public ResponseEntity getGeneralData(@RequestParam long aimeId, @RequestParam String key) { - Optional userGeneralDataOptional = userGeneralDataRepository.findByUser_Card_ExtIdAndPropertyKey(aimeId, key); - return userGeneralDataOptional.>map(ResponseEntity::ok) - .orElseGet(() -> ResponseEntity.status(HttpStatus.NOT_FOUND).body(new MessageResponse("User or value not found."))); - } - - @PostMapping("general") - public ResponseEntity setGeneralData(@RequestBody Map request) { - Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow(); - String key = (String) request.get("key"); - String value = (String) request.get("value"); - - Optional userGeneralDataOptional = userGeneralDataRepository.findByUserAndPropertyKey(profile, key); - Mai2UserGeneralData userGeneralData; - if (userGeneralDataOptional.isPresent()) { - userGeneralData = userGeneralDataOptional.get(); - } - else { - userGeneralData = new Mai2UserGeneralData(); - userGeneralData.setUser(profile); - userGeneralData.setPropertyKey(key); - } - userGeneralData.setPropertyValue(value); - - return ResponseEntity.ok(userGeneralDataRepository.save(userGeneralData)); - } - - @GetMapping("export") - public ResponseEntity exportAllUserData(@RequestParam long aimeId) { - Maimai2DataExport data = new Maimai2DataExport(); - try { - data.setGameId("SDEZ"); - data.setUserData(userDataRepository.findByCardExtId(aimeId).orElseThrow()); - data.setUserExtend(userExtendRepository.findSingleByUser_Card_ExtId(aimeId).orElseThrow()); - data.setUserOption(userOptionRepository.findSingleByUser_Card_ExtId(aimeId).orElseThrow()); - data.setUserUdemae(userUdemaeRepository.findSingleByUser_Card_ExtId(aimeId).orElseThrow()); - data.setUserCharacterList(userCharacterRepository.findByUser_Card_ExtId(aimeId)); - data.setUserGeneralDataList(userGeneralDataRepository.findByUser_Card_ExtId(aimeId)); - data.setUserItemList(userItemRepository.findByUser_Card_ExtId(aimeId)); - data.setUserLoginBonusList(userLoginBonusRepository.findByUser_Card_ExtId(aimeId)); - data.setUserMusicDetailList(userMusicDetailRepository.findByUser_Card_ExtId(aimeId)); - data.setUserPlaylogList(userPlaylogRepository.findByUserCardExtId(aimeId)); - data.setMapEncountNpcList(mapEncountNpcRepository.findByUser_Card_ExtId(aimeId)); - data.setUserActList(userActRepository.findByUser_Card_ExtId(aimeId)); - data.setUserChargeList(userChargeRepository.findByUser_Card_ExtId(aimeId)); - data.setUserCourseList(userCourseRepository.findByUser_Card_ExtId(aimeId)); - data.setUserFavoriteList(userFavoriteRepository.findByUser_Card_ExtId(aimeId)); - data.setUserFriendSeasonRankingList(userFriendSeasonRankingRepository.findByUser_Card_ExtId(aimeId)); - data.setUserMapList(userMapRepository.findByUser_Card_ExtId(aimeId)); - } catch (NoSuchElementException e) { - return ResponseEntity.status(HttpStatus.NOT_FOUND) - .body(new MessageResponse("User not found")); - } catch (Exception e) { - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) - .body(new MessageResponse("Error during data export. Reason: " + e.getMessage())); - } - // Set filename - HttpHeaders headers = new HttpHeaders(); - headers.set("content-disposition", "attachment; filename=maimai2_" + aimeId + "_exported.json"); - return new ResponseEntity<>(data, headers, HttpStatus.OK); - } - - @PostMapping("import") - public ResponseEntity importAllUserData(@RequestBody Maimai2DataImport data) { - if (!data.getGameId().equals("SDEZ")) { - return ResponseEntity.unprocessableEntity().body(new MessageResponse("Wrong Game Profile, Expected 'SDEZ', Get " + data.getGameId())); - } - - ExternalUserData exUser = data.getUserData(); - - Optional cardOptional = cardService.getCardByAccessCode(exUser.getAccessCode()); - Card card; - if (cardOptional.isPresent()) { - card = cardOptional.get(); - Optional existUserData = Optional.ofNullable(userDataRepository.findByCard(cardOptional.get())); - if (existUserData.isPresent()) { -// return ResponseEntity.status(HttpStatus.BAD_REQUEST) -// .body(new MessageResponse("This card already has a maimai2 profile.")); - // delete all same card data - userFavoriteRepository.deleteByUser(existUserData.get()); - userFavoriteRepository.flush(); - userFriendSeasonRankingRepository.deleteByUser(existUserData.get()); - userFriendSeasonRankingRepository.flush(); - userMapRepository.deleteByUser(existUserData.get()); - userMapRepository.flush(); - userUdemaeRepository.deleteByUser(existUserData.get()); - userUdemaeRepository.flush(); - userGeneralDataRepository.deleteByUser(existUserData.get()); - userGeneralDataRepository.flush(); - userItemRepository.deleteByUser(existUserData.get()); - userItemRepository.flush(); - userLoginBonusRepository.deleteByUser(existUserData.get()); - userLoginBonusRepository.flush(); - userMusicDetailRepository.deleteByUser(existUserData.get()); - userMusicDetailRepository.flush(); - userOptionRepository.deleteByUser(existUserData.get()); - userOptionRepository.flush(); - userPlaylogRepository.deleteByUser(existUserData.get()); - userPlaylogRepository.flush(); - userCharacterRepository.deleteByUser(existUserData.get()); - userCharacterRepository.flush(); - mapEncountNpcRepository.deleteByUser(existUserData.get()); - mapEncountNpcRepository.flush(); - userActRepository.deleteByUser(existUserData.get()); - userActRepository.flush(); - userChargeRepository.deleteByUser(existUserData.get()); - userChargeRepository.flush(); - userCourseRepository.deleteByUser(existUserData.get()); - userCourseRepository.flush(); - userExtendRepository.deleteByUser(existUserData.get()); - userExtendRepository.flush(); - userOptionRepository.deleteByUser(existUserData.get()); - userOptionRepository.flush(); - - userDataRepository.deleteByCard(card); - userDataRepository.flush(); - } - } else { - card = cardService.registerByAccessCode(exUser.getAccessCode()); - } - - Mai2UserDetail userData = mapper.convert(exUser, new TypeReference<>() { - }); - userData.setCard(card); - userDataRepository.saveAndFlush(userData); - - userFavoriteRepository.saveAll(data.getUserFavoriteList().stream().peek(x -> x.setUser(userData)).collect(Collectors.toList())); - userFriendSeasonRankingRepository.saveAll(data.getUserFriendSeasonRankingList().stream().peek(x -> x.setUser(userData)).collect(Collectors.toList())); - userMapRepository.saveAll(data.getUserMapList().stream().peek(x -> x.setUser(userData)).collect(Collectors.toList())); - userGeneralDataRepository.saveAll(data.getUserGeneralDataList().stream().peek(x -> x.setUser(userData)).collect(Collectors.toList())); - userItemRepository.saveAll(data.getUserItemList().stream().peek(x -> x.setUser(userData)).collect(Collectors.toList())); - userLoginBonusRepository.saveAll(data.getUserLoginBonusList().stream().peek(x -> x.setUser(userData)).collect(Collectors.toList())); - userMusicDetailRepository.saveAll(data.getUserMusicDetailList().stream().peek(x -> x.setUser(userData)).collect(Collectors.toList())); - userPlaylogRepository.saveAll(data.getUserPlaylogList().stream().peek(x -> x.setUser(userData)).collect(Collectors.toList())); - userCharacterRepository.saveAll(data.getUserCharacterList().stream().peek(x -> x.setUser(userData)).collect(Collectors.toList())); - mapEncountNpcRepository.saveAll(data.getMapEncountNpcList().stream().peek(x -> x.setUser(userData)).collect(Collectors.toList())); - userActRepository.saveAll(data.getUserActList().stream().peek(x -> x.setUser(userData)).collect(Collectors.toList())); - userChargeRepository.saveAll(data.getUserChargeList().stream().peek(x -> x.setUser(userData)).collect(Collectors.toList())); - userCourseRepository.saveAll(data.getUserCourseList().stream().peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - Mai2UserExtend userExtend = data.getUserExtend(); - userExtend.setUser(userData); - userExtendRepository.save(userExtend); - - Mai2UserOption userOption = data.getUserOption(); - userOption.setUser(userData); - userOptionRepository.save(userOption); - - Mai2UserUdemae userUdemae = data.getUserUdemae(); - userUdemae.setUser(userData); - userUdemaeRepository.save(userUdemae); - - return ResponseEntity.ok(new MessageResponse("Import successfully, aimeId: " + card.getExtId())); - } - -} diff --git a/src/main/java/icu/samnyan/aqua/api/controller/sega/game/ongeki/ApiOngekiGameDataController.java b/src/main/java/icu/samnyan/aqua/api/controller/sega/game/ongeki/ApiOngekiGameDataController.java deleted file mode 100644 index 8256e8f2..00000000 --- a/src/main/java/icu/samnyan/aqua/api/controller/sega/game/ongeki/ApiOngekiGameDataController.java +++ /dev/null @@ -1,76 +0,0 @@ -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 lombok.AllArgsConstructor; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@RestController -@RequestMapping("api/game/ongeki/data") -@ConditionalOnProperty(prefix = "aquaviewer.api", name = "enabled", havingValue = "true") -@AllArgsConstructor -public class ApiOngekiGameDataController { - - private final GameCardRepository gameCardRepository; - private final GameCharaRepository gameCharaRepository; - private final GameEventRepository gameEventRepository; - private final GameMusicRepository gameMusicRepository; - private final GameSkillRepository gameSkillRepository; - - @GetMapping("cardList") - public List getCardList() { - return gameCardRepository.findAll(); - } - - @GetMapping("charaList") - public List getCharaList() { - return gameCharaRepository.findAll(); - } - - @GetMapping("eventList") - public List getEventList() { - return gameEventRepository.findAll(); - } - - @GetMapping("musicList") - public List getMusicList() { - return gameMusicRepository.findAll(); - } - - @GetMapping("skillList") - public List getSkillList() { - return gameSkillRepository.findAll(); - } - - @PostMapping("cardList") - public List getCardList(@RequestBody List req) { - return gameCardRepository.saveAll(req); - } - - @PostMapping("charaList") - public List getCharaList(@RequestBody List req) { - return gameCharaRepository.saveAll(req); - } - - @PostMapping("eventList") - public List getEventList(@RequestBody List req) { - return gameEventRepository.saveAll(req); - } - - @PostMapping("musicList") - public List getMusicList(@RequestBody List req) { - return gameMusicRepository.saveAll(req); - } - - @PostMapping("skillList") - public List getSkillList(@RequestBody List req) { - return gameSkillRepository.saveAll(req); - } - -} diff --git a/src/main/java/icu/samnyan/aqua/api/controller/sega/game/ongeki/ApiOngekiPlayerDataController.java b/src/main/java/icu/samnyan/aqua/api/controller/sega/game/ongeki/ApiOngekiPlayerDataController.java deleted file mode 100644 index 958bd3a2..00000000 --- a/src/main/java/icu/samnyan/aqua/api/controller/sega/game/ongeki/ApiOngekiPlayerDataController.java +++ /dev/null @@ -1,576 +0,0 @@ -package icu.samnyan.aqua.api.controller.sega.game.ongeki; - -import com.fasterxml.jackson.core.type.TypeReference; -import icu.samnyan.aqua.api.model.MessageResponse; -import icu.samnyan.aqua.api.model.ObjectMessageResponse; -import icu.samnyan.aqua.api.model.ReducedPageResponse; -import icu.samnyan.aqua.api.model.resp.sega.ongeki.ProfileResp; -import icu.samnyan.aqua.api.model.resp.sega.ongeki.external.ExternalUserData; -import icu.samnyan.aqua.api.model.resp.sega.ongeki.external.OngekiDataExport; -import icu.samnyan.aqua.api.model.resp.sega.ongeki.external.OngekiDataImport; -import icu.samnyan.aqua.api.util.ApiMapper; -import icu.samnyan.aqua.sega.general.model.Card; -import icu.samnyan.aqua.sega.general.service.CardService; -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.response.data.UserRivalData; -import icu.samnyan.aqua.sega.ongeki.model.userdata.*; -import lombok.AllArgsConstructor; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; -import org.springframework.data.domain.Sort; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@RestController -@RequestMapping("api/game/ongeki") -@ConditionalOnProperty(prefix = "aquaviewer.api", name = "enabled", havingValue = "true") -@AllArgsConstructor -public class ApiOngekiPlayerDataController { - - private final ApiMapper mapper; - - private static DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.0"); - - private final CardService cardService; - - private final UserActivityRepository userActivityRepository; - private final UserCardRepository userCardRepository; - private final UserChapterRepository userChapterRepository; - private final UserCharacterRepository userCharacterRepository; - private final UserDataRepository userDataRepository; - private final UserDeckRepository userDeckRepository; - private final UserEventPointRepository userEventPointRepository; - private final UserItemRepository userItemRepository; - private final UserLoginBonusRepository userLoginBonusRepository; - private final UserMissionPointRepository userMissionPointRepository; - private final UserMusicDetailRepository userMusicDetailRepository; - private final UserMusicItemRepository userMusicItemRepository; - private final UserOptionRepository userOptionRepository; - private final UserPlaylogRepository userPlaylogRepository; - private final UserStoryRepository userStoryRepository; - private final UserTrainingRoomRepository userTrainingRoomRepository; - private final UserGeneralDataRepository userGeneralDataRepository; - private final UserTradeItemRepository userTradeItemRepository; - private final UserEventMusicRepository userEventMusicRepository; - private final UserTechEventRepository userTechEventRepository; - private final UserKopRepository userKopRepository; - private final UserRivalDataRepository userRivalDataRepository; - - private final UserMemoryChapterRepository userMemoryChapterRepository; - - private final UserScenarioRepository userScenarioRepository; - - private final UserBossRepository userBossRepository; - - private final UserTechCountRepository userTechCountRepository; - - private final GameCardRepository gameCardRepository; - - @GetMapping("profile") - public ProfileResp getProfile(@RequestParam long aimeId) { - return mapper.convert(userDataRepository.findByCard_ExtId(aimeId).orElseThrow(), new TypeReference<>() { - }); - } - - @PostMapping("profile/userName") - public UserData updateName(@RequestBody Map request) { - UserData profile = userDataRepository.findByCard_ExtId(((Number) request.get("aimeId")).longValue()).orElseThrow(); - profile.setUserName((String) request.get("userName")); - return userDataRepository.save(profile); - } - - @PostMapping("profile/plate") - public UserData updatePlate(@RequestBody Map request) { - UserData profile = userDataRepository.findByCard_ExtId(((Number) request.get("aimeId")).longValue()).orElseThrow(); - profile.setNameplateId((Integer) request.get("nameplateId")); - return userDataRepository.save(profile); - } - - @PostMapping("profile/trophy") - public UserData updateTrophy(@RequestBody Map request) { - UserData profile = userDataRepository.findByCard_ExtId(((Number) request.get("aimeId")).longValue()).orElseThrow(); - profile.setTrophyId((Integer) request.get("trophyId")); - return userDataRepository.save(profile); - } - - @PostMapping("profile/card") - public UserData updateCard(@RequestBody Map request) { - UserData profile = userDataRepository.findByCard_ExtId(((Number) request.get("aimeId")).longValue()).orElseThrow(); - profile.setCardId((Integer) request.get("cardId")); - return userDataRepository.save(profile); - } - - @GetMapping("card") - public ReducedPageResponse getCard(@RequestParam long aimeId, - @RequestParam(required = false, defaultValue = "0") int page, - @RequestParam(required = false, defaultValue = "10") int size) { - Page cards = userCardRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page, size, Sort.Direction.DESC, "id")); - return new ReducedPageResponse<>(cards.getContent(), cards.getPageable().getPageNumber(), cards.getTotalPages(), cards.getTotalElements()); - } - - /** - * Force insert a card. This will use to create a new card or update a currently existed card star level. - * - * @param request Map of aimeId and cardId - * @return result UserCard or error message - */ - @PostMapping("card") - public ResponseEntity insertCard(@RequestBody Map request) { - UserData profile = userDataRepository.findByCard_ExtId(((Number) request.get("aimeId")).longValue()).orElseThrow(); - Integer cardId = (Integer) request.get("cardId"); - Optional userCardOptional = userCardRepository.findByUserAndCardId(profile, cardId); - if (userCardOptional.isPresent()) { - UserCard card = userCardOptional.get(); - if (card.getDigitalStock() < 5) { - card.setDigitalStock(card.getDigitalStock() + 1); - card.setMaxLevel(card.getMaxLevel() + 5); - return ResponseEntity.ok(userCardRepository.save(card)); - } else { - // If digital stock is larger than 5, check if this card is N card. - Optional gameCard = gameCardRepository.findById((long) card.getCardId()); - if (gameCard.isPresent()) { - if (gameCard.get().getRarity().equals("N")) { - card.setDigitalStock(card.getDigitalStock() + 1); - card.setMaxLevel(card.getMaxLevel() + 5); - return ResponseEntity.ok(userCardRepository.save(card)); - } else { - return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(new MessageResponse("This card has reached max limit.")); - } - } else { - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) - .body(new MessageResponse("Card info not found on server, not allow to edit with api, please make edit to database directly.")); - } - } - } - GameCard card = gameCardRepository.findById(cardId.longValue()).orElseThrow(); - return ResponseEntity.ok( - userCardRepository.save( - new UserCard( - profile, - cardId, - card.getSkillId(), - LocalDateTime.now().format(df)) - )); - } - - @PostMapping("card/{cardId}/kaika") - public ResponseEntity kaikaCard(@RequestParam long aimeId, @PathVariable Integer cardId) { - Optional userCardOptional = userCardRepository.findByUser_Card_ExtIdAndCardId(aimeId, cardId); - if (userCardOptional.isEmpty()) { - return ResponseEntity.status(HttpStatus.NOT_FOUND).body(new MessageResponse("Card not found.")); - } else { - UserCard card = userCardOptional.get(); - if (!card.getKaikaDate().equals("0000-00-00 00:00:00.0")) { - return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(new MessageResponse("No, you have done this before.")); - } else { - card.setKaikaDate(LocalDateTime.now().format(df)); - card.setMaxLevel(card.getMaxLevel() + 40); - card.setPrintCount(card.getPrintCount() + 1); - return ResponseEntity.ok(userCardRepository.save(card)); - } - } - } - - @PostMapping("card/{cardId}/choKaika") - public ResponseEntity choKaikaCard(@RequestParam long aimeId, @PathVariable Integer cardId) { - Optional userCardOptional = userCardRepository.findByUser_Card_ExtIdAndCardId(aimeId, cardId); - if (userCardOptional.isEmpty()) { - return ResponseEntity.status(HttpStatus.NOT_FOUND).body(new MessageResponse("Card not found.")); - } else { - UserCard card = userCardOptional.get(); - Optional gameCard = gameCardRepository.findById((long) card.getCardId()); - if (gameCard.isPresent()) { - if (gameCard.get().getRarity().equals("N")) { - card.setMaxLevel(100); - card.setLevel(100); - card.setDigitalStock(11); - } else { - card.setMaxLevel(70); - card.setLevel(70); - card.setDigitalStock(5); - } - } else { - card.setMaxLevel(70); - card.setLevel(70); - card.setDigitalStock(5); - } - if (card.getKaikaDate().equals("0000-00-00 00:00:00.0")) { - card.setKaikaDate(LocalDateTime.now().format(df)); - } - card.setChoKaikaDate(LocalDateTime.now().format(df)); - card.setPrintCount(card.getPrintCount() + 1); - return ResponseEntity.ok(userCardRepository.save(card)); - } - } - - @GetMapping("character") - public ReducedPageResponse getCharacter(@RequestParam long aimeId, - @RequestParam(required = false, defaultValue = "0") int page, - @RequestParam(required = false, defaultValue = "10") int size) { - Page characters = userCharacterRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page, size)); - return new ReducedPageResponse<>(characters.getContent(), characters.getPageable().getPageNumber(), characters.getTotalPages(), characters.getTotalElements()); - } - - @GetMapping("activity") - public List getActivities(@RequestParam long aimeId) { - return userActivityRepository.findByUser_Card_ExtId(aimeId); - } - - @PostMapping("activity") - public ResponseEntity updateActivities(@RequestBody Map request) { - UserData profile = userDataRepository.findByCard_ExtId(((Number) request.get("aimeId")).longValue()).orElseThrow(); - Integer activityId = (Integer) request.get("id"); - Integer kind = (Integer) request.get("kind"); - Integer sortNumber = (Integer) request.get("sortNumber"); - Integer param1 = (Integer) request.get("param1"); - Integer param2 = (Integer) request.get("param2"); - Integer param3 = (Integer) request.get("param3"); - Integer param4 = (Integer) request.get("param4"); - - Optional userActivityOptional = userActivityRepository.findByUserAndKindAndActivityId(profile, kind, activityId); - - UserActivity userActivity; - if (userActivityOptional.isPresent()) { - userActivity = userActivityOptional.get(); - } else { - userActivity = new UserActivity(profile); - userActivity.setActivityId(activityId); - userActivity.setKind(kind); - userActivity.setSortNumber(sortNumber); - } - userActivity.setParam1(param1); - userActivity.setParam2(param2); - userActivity.setParam3(param3); - userActivity.setParam4(param4); - return ResponseEntity.ok(userActivityRepository.save(userActivity)); - } - - @GetMapping("item") - public ReducedPageResponse getItem(@RequestParam long aimeId, - @RequestParam(required = false, defaultValue = "0") int page, - @RequestParam(required = false, defaultValue = "10") int size) { - Page items = userItemRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page, size)); - return new ReducedPageResponse<>(items.getContent(), items.getPageable().getPageNumber(), items.getTotalPages(), items.getTotalElements()); - } - - @PostMapping("item") - public ResponseEntity updateItem(@RequestBody Map request) { - UserData profile = userDataRepository.findByCard_ExtId(((Number) request.get("aimeId")).longValue()).orElseThrow(); - Integer itemKind = (Integer) request.get("itemKind"); - Integer itemId = (Integer) request.get("itemId"); - int stock = 1; - if (request.containsKey("stock")) { - stock = (Integer) request.get("stock"); - } - - Optional userItemOptional = userItemRepository.findByUserAndItemKindAndItemId(profile, itemKind, itemId); - - UserItem userItem; - if (userItemOptional.isPresent()) { - userItem = userItemOptional.get(); - } else { - userItem = new UserItem(profile); - userItem.setItemId(itemId); - userItem.setItemKind(itemKind); - } - userItem.setStock(stock); - userItem.setValid(true); - return ResponseEntity.ok(userItemRepository.save(userItem)); - } - - @GetMapping("recent") - public ReducedPageResponse getRecent(@RequestParam long aimeId, - @RequestParam(required = false, defaultValue = "0") int page, - @RequestParam(required = false, defaultValue = "10") int size) { - Page 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 getSongDetail(@RequestParam long aimeId, @PathVariable int id) { - return userMusicDetailRepository.findByUser_Card_ExtIdAndMusicId(aimeId, id); - } - - @GetMapping("song/{id}/{level}") - public List getLevelPlaylog(@RequestParam long aimeId, @PathVariable int id, @PathVariable int level) { - return userPlaylogRepository.findByUser_Card_ExtIdAndMusicIdAndLevel(aimeId, id, level); - } - - @GetMapping("rival") - public List getRival(@RequestParam long aimeId) { - var rivalUserIds = userRivalDataRepository.findByUser_Card_ExtId(aimeId) - .stream() - .map(x -> x.getRivalUserExtId()) - .collect(Collectors.toList()); - - var rivalDataList = userDataRepository.findByCard_ExtIdIn(rivalUserIds) - .stream() - .map(x -> new UserRivalData(x.getCard().getExtId(), x.getUserName())) - .collect(Collectors.toList()); - - return rivalDataList; - } - - @DeleteMapping("rival") - public MessageResponse deleteRival(@RequestParam long aimeId, @RequestParam long rivalAimeId) { - userRivalDataRepository.removeByUser_Card_ExtIdAndRivalUserExtId(aimeId, rivalAimeId); - return new MessageResponse(); - } - - @PostMapping("rival") - public ObjectMessageResponse addRival(@RequestParam long aimeId, @RequestParam long rivalAimeId, @Value("${game.ongeki.rival.rivals-max-count:10}") long addMaxCount) { - //check limit - if (addMaxCount >= 0 && userRivalDataRepository.findByUser_Card_ExtId(aimeId).size() >= addMaxCount) { - return new ObjectMessageResponse<>(String.format("Size of rival list is limited in %d", addMaxCount)); - } - - var userOpt = userDataRepository.findByCard_ExtId(aimeId); - if (userOpt.isEmpty()) - return new ObjectMessageResponse<>("Current user isn't ongeki player."); - var user = userOpt.get(); - var rivalUserOpt = userDataRepository.findByCard_ExtId(rivalAimeId); - if (rivalUserOpt.isEmpty()) - return new ObjectMessageResponse<>("Rival user isn't ongeki player."); - var rivalUser = rivalUserOpt.get(); - - if(user == rivalUser) - return new ObjectMessageResponse<>("Can't add yourself as an rival."); - - var rival = new UserRival(); - rival.setUser(user); - rival.setRivalUserExtId(rivalUser.getCard().getExtId()); - - userRivalDataRepository.save(rival); - return new ObjectMessageResponse<>(new UserRivalData(rivalUser.getCard().getExtId(), rivalUser.getUserName())); - } - - @GetMapping("options") - public UserOption getOptions(@RequestParam long aimeId) { - return userOptionRepository.findByUser_Card_ExtId(aimeId).orElseThrow(); - } - - @GetMapping("general") - public ResponseEntity getGeneralData(@RequestParam long aimeId, @RequestParam String key) { - Optional userGeneralDataOptional = userGeneralDataRepository.findByUser_Card_ExtIdAndPropertyKey(aimeId, key); - return userGeneralDataOptional.>map(ResponseEntity::ok) - .orElseGet(() -> ResponseEntity.status(HttpStatus.NOT_FOUND).body(new MessageResponse("User or value not found."))); - } - - @GetMapping("export") - public ResponseEntity exportAllUserData(@RequestParam long aimeId) { - OngekiDataExport data = new OngekiDataExport(); - try { - data.setGameId("SDDT"); - data.setUserData(userDataRepository.findByCard_ExtId(aimeId).orElseThrow()); - data.setUserActivityList(userActivityRepository.findByUser_Card_ExtId(aimeId)); - data.setUserCardList(userCardRepository.findByUser_Card_ExtId(aimeId)); - data.setUserChapterList(userChapterRepository.findByUser_Card_ExtId(aimeId)); - data.setUserCharacterList(userCharacterRepository.findByUser_Card_ExtId(aimeId)); - data.setUserDeckList(userDeckRepository.findByUser_Card_ExtId(aimeId)); - data.setUserEventPointList(userEventPointRepository.findByUser_Card_ExtId(aimeId)); - data.setUserGeneralDataList(userGeneralDataRepository.findByUser_Card_ExtId(aimeId)); - data.setUserItemList(userItemRepository.findByUser_Card_ExtId(aimeId)); - data.setUserLoginBonusList(userLoginBonusRepository.findByUser_Card_ExtId(aimeId)); - data.setUserMissionPointList(userMissionPointRepository.findByUser_Card_ExtId(aimeId)); - data.setUserMusicDetailList(userMusicDetailRepository.findByUser_Card_ExtId(aimeId)); - data.setUserMusicItemList(userMusicItemRepository.findByUser_Card_ExtId(aimeId)); - data.setUserOption(userOptionRepository.findByUser_Card_ExtId(aimeId).orElseThrow()); - data.setUserPlaylogList(userPlaylogRepository.findByUser_Card_ExtId(aimeId)); - data.setUserStoryList(userStoryRepository.findByUser_Card_ExtId(aimeId)); - data.setUserTrainingRoomList(userTrainingRoomRepository.findByUser_Card_ExtId(aimeId)); - data.setUserTradeItemList(userTradeItemRepository.findByUser_Card_ExtId(aimeId)); - data.setUserEventMusicList(userEventMusicRepository.findByUser_Card_ExtId(aimeId)); - data.setUserTechEventList(userTechEventRepository.findByUser_Card_ExtId(aimeId)); - data.setUserKopList(userKopRepository.findByUser_Card_ExtId(aimeId)); - data.setUserMemoryChapterList(userMemoryChapterRepository.findByUser_Card_ExtId(aimeId)); - data.setUserScenarioList(userScenarioRepository.findByUser_Card_ExtId(aimeId)); - data.setUserBossList(userBossRepository.findByUser_Card_ExtId(aimeId)); - data.setUserTechCountList(userTechCountRepository.findByUser_Card_ExtId(aimeId)); - data.setUserRivalList(userRivalDataRepository.findByUser_Card_ExtId(aimeId)); - } catch (NoSuchElementException e) { - return ResponseEntity.status(HttpStatus.NOT_FOUND) - .body(new MessageResponse("User not found")); - } catch (Exception e) { - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) - .body(new MessageResponse("Error during data export. Reason: " + e.getMessage())); - } - // Set filename - HttpHeaders headers = new HttpHeaders(); - headers.set("content-disposition", "attachment; filename=ongeki_" + aimeId + "_exported.json"); - return new ResponseEntity<>(data, headers, HttpStatus.OK); - } - - @PostMapping("import") - public ResponseEntity importAllUserData(@RequestBody OngekiDataImport data) { - if (!data.getGameId().equals("SDDT")) { - return ResponseEntity.unprocessableEntity().body(new MessageResponse("Wrong Game Profile, Expected 'SDDT', Get " + data.getGameId())); - } - - ExternalUserData exUser = data.getUserData(); - - Optional cardOptional = cardService.getCardByAccessCode(exUser.getAccessCode()); - Card card; - if (cardOptional.isPresent()) { - card = cardOptional.get(); - Optional existUserData = Optional.ofNullable(userDataRepository.findByCard(cardOptional.get())); - if (existUserData.isPresent()) { -// return ResponseEntity.status(HttpStatus.BAD_REQUEST) -// .body(new MessageResponse("This card already has a ongeki profile.")); - // delete all same card data - userActivityRepository.deleteByUser(existUserData.get()); - userActivityRepository.flush(); - userCardRepository.deleteByUser(existUserData.get()); - userCardRepository.flush(); - userChapterRepository.deleteByUser(existUserData.get()); - userChapterRepository.flush(); - userCharacterRepository.deleteByUser(existUserData.get()); - userCharacterRepository.flush(); - userDeckRepository.deleteByUser(existUserData.get()); - userDeckRepository.flush(); - userEventPointRepository.deleteByUser(existUserData.get()); - userEventPointRepository.flush(); - userGeneralDataRepository.deleteByUser(existUserData.get()); - userGeneralDataRepository.flush(); - userItemRepository.deleteByUser(existUserData.get()); - userItemRepository.flush(); - userLoginBonusRepository.deleteByUser(existUserData.get()); - userLoginBonusRepository.flush(); - userMissionPointRepository.deleteByUser(existUserData.get()); - userMissionPointRepository.flush(); - userMusicDetailRepository.deleteByUser(existUserData.get()); - userMusicDetailRepository.flush(); - userMusicItemRepository.deleteByUser(existUserData.get()); - userMusicItemRepository.flush(); - userOptionRepository.deleteByUser(existUserData.get()); - userOptionRepository.flush(); - userPlaylogRepository.deleteByUser(existUserData.get()); - userPlaylogRepository.flush(); - userStoryRepository.deleteByUser(existUserData.get()); - userStoryRepository.flush(); - userTrainingRoomRepository.deleteByUser(existUserData.get()); - userTrainingRoomRepository.flush(); - userTradeItemRepository.deleteByUser(existUserData.get()); - userTradeItemRepository.flush(); - userEventMusicRepository.deleteByUser(existUserData.get()); - userEventMusicRepository.flush(); - userTechEventRepository.deleteByUser(existUserData.get()); - userTechEventRepository.flush(); - userKopRepository.deleteByUser(existUserData.get()); - userKopRepository.flush(); - userMemoryChapterRepository.deleteByUser(existUserData.get()); - userMemoryChapterRepository.flush(); - userScenarioRepository.deleteByUser(existUserData.get()); - userScenarioRepository.flush(); - userBossRepository.deleteByUser(existUserData.get()); - userBossRepository.flush(); - userTechCountRepository.deleteByUser(existUserData.get()); - userTechCountRepository.flush(); - userRivalDataRepository.deleteByUser(existUserData.get()); - userRivalDataRepository.flush(); - - userDataRepository.deleteByCard(card); - userDataRepository.flush(); - } - } else { - card = cardService.registerByAccessCode(exUser.getAccessCode()); - } - - UserData userData = mapper.convert(exUser, new TypeReference<>() { - }); - userData.setCard(card); - userDataRepository.saveAndFlush(userData); - - userActivityRepository.saveAll(data.getUserActivityList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userCardRepository.saveAll(data.getUserCardList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userChapterRepository.saveAll(data.getUserChapterList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userCharacterRepository.saveAll(data.getUserCharacterList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userDeckRepository.saveAll(data.getUserDeckList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userEventPointRepository.saveAll(data.getUserEventPointList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userGeneralDataRepository.saveAll(data.getUserGeneralDataList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userItemRepository.saveAll(data.getUserItemList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userLoginBonusRepository.saveAll(data.getUserLoginBonusList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userMissionPointRepository.saveAll(data.getUserMissionPointList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userMusicDetailRepository.saveAll(data.getUserMusicDetailList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userMusicItemRepository.saveAll(data.getUserMusicItemList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - UserOption userOption = data.getUserOption(); - userOption.setUser(userData); - userOptionRepository.save(userOption); - userPlaylogRepository.saveAll(data.getUserPlaylogList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userStoryRepository.saveAll(data.getUserStoryList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userTrainingRoomRepository.saveAll(data.getUserTrainingRoomList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userTradeItemRepository.saveAll(data.getUserTradeItemList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userEventMusicRepository.saveAll(data.getUserEventMusicList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userTechEventRepository.saveAll(data.getUserTechEventList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userKopRepository.saveAll(data.getUserKopList().stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userMemoryChapterRepository.saveAll(Optional.ofNullable(data.getUserMemoryChapterList()).orElse(Collections.emptyList()).stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userScenarioRepository.saveAll(Optional.ofNullable(data.getUserScenarioList()).orElse(Collections.emptyList()).stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userBossRepository.saveAll(Optional.ofNullable(data.getUserBossList()).orElse(Collections.emptyList()).stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userTechCountRepository.saveAll(Optional.ofNullable(data.getUserTechCountList()).orElse(Collections.emptyList()).stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - userRivalDataRepository.saveAll(Optional.ofNullable(data.getUserRivalList()).orElse(Collections.emptyList()).stream() - .peek(x -> x.setUser(userData)).collect(Collectors.toList())); - - return ResponseEntity.ok(new MessageResponse("Import successfully, aimeId: " + card.getExtId())); - } - -} diff --git a/src/main/java/icu/samnyan/aqua/api/controller/sega/manage/ApiChuniV1ManageController.java b/src/main/java/icu/samnyan/aqua/api/controller/sega/manage/ApiChuniV1ManageController.java deleted file mode 100644 index 00ead66a..00000000 --- a/src/main/java/icu/samnyan/aqua/api/controller/sega/manage/ApiChuniV1ManageController.java +++ /dev/null @@ -1,83 +0,0 @@ -package icu.samnyan.aqua.api.controller.sega.manage; - -import icu.samnyan.aqua.sega.chunithm.model.gamedata.Level; -import icu.samnyan.aqua.sega.chunithm.model.gamedata.Music; -import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData; -import icu.samnyan.aqua.sega.chunithm.model.userdata.UserMusicDetail; -import icu.samnyan.aqua.sega.chunithm.service.GameMusicService; -import icu.samnyan.aqua.sega.chunithm.service.UserDataService; -import icu.samnyan.aqua.sega.chunithm.service.UserMusicDetailService; -import lombok.AllArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Optional; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@RestController -@RequestMapping("api/manage/chuni/v1") -@ConditionalOnProperty(prefix = "aquaviewer.api", name = "enabled", havingValue = "true") -@AllArgsConstructor -public class ApiChuniV1ManageController { - - private static final Logger logger = LoggerFactory.getLogger(ApiChuniV1ManageController.class); - - private final UserDataService userDataService; - - private final UserMusicDetailService userMusicDetailService; - - private final GameMusicService gameMusicService; - - /** - * A request to fill fake score to all chart. only use for testing - * @param aimeId The internal id of a card - * @return Run result status - */ -// @PostMapping("fill") - public ResponseEntity fillMockData(@RequestParam String aimeId) { - UserData profile = userDataService.getUserByExtId(aimeId).orElseThrow(); - List musicList = gameMusicService.getAll(); - List detailList = new ArrayList<>(); - musicList.forEach(x -> { - Collection levels = x.getLevels().values(); - levels.forEach(l -> { - Optional userMusicDetailOptional = userMusicDetailService.getByUserAndMusicIdAndLevel(profile, x.getMusicId(), l.getDiff()); - if (userMusicDetailOptional.isEmpty()) { - UserMusicDetail temp = new UserMusicDetail( - x.getMusicId(), - l.getDiff(), - 1, - 980000, - 0, - 0, - 0, - 5, - 0, - false, - false, - false, - 0, - 0, - 8, - false - ); - temp.setUser(profile); - detailList.add(temp); - } - }); - }); - userMusicDetailService.saveAll(detailList); - return ResponseEntity.ok("OK"); - } - -} diff --git a/src/main/java/icu/samnyan/aqua/api/controller/sega/manage/ApiDivaManageController.java b/src/main/java/icu/samnyan/aqua/api/controller/sega/manage/ApiDivaManageController.java deleted file mode 100644 index f9dac249..00000000 --- a/src/main/java/icu/samnyan/aqua/api/controller/sega/manage/ApiDivaManageController.java +++ /dev/null @@ -1,139 +0,0 @@ -package icu.samnyan.aqua.api.controller.sega.manage; - -import icu.samnyan.aqua.api.model.MessageResponse; -import icu.samnyan.aqua.api.model.req.sega.diva.ModuleEntry; -import icu.samnyan.aqua.api.model.req.sega.diva.PvListEntry; -import icu.samnyan.aqua.api.model.req.sega.diva.PvListRequest; -import icu.samnyan.aqua.sega.diva.dao.gamedata.*; -import icu.samnyan.aqua.sega.diva.model.common.Difficulty; -import icu.samnyan.aqua.sega.diva.model.common.Edition; -import icu.samnyan.aqua.sega.diva.model.gamedata.*; -import icu.samnyan.aqua.sega.general.dao.PropertyEntryRepository; -import icu.samnyan.aqua.sega.general.model.PropertyEntry; -import lombok.AllArgsConstructor; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.web.bind.annotation.*; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@RestController -@RequestMapping("api/manage/diva/") -@ConditionalOnProperty(prefix = "aquaviewer.api", name = "enabled", havingValue = "true") -@AllArgsConstructor -public class ApiDivaManageController { - - private final PvEntryRepository pvEntryRepository; - private final DivaModuleRepository moduleRepository; - private final DivaCustomizeRepository customizeRepository; - private final FestaRepository festaRepository; - private final ContestRepository contestRepository; - private final PropertyEntryRepository propertyEntryRepository; - - @PostMapping("pvList") - public List updatePvList(@RequestBody PvListRequest request) { - request.getEasy().forEach(x -> savePv(x, Difficulty.EASY)); - request.getNormal().forEach(x -> savePv(x, Difficulty.NORMAL)); - request.getHard().forEach(x -> savePv(x, Difficulty.HARD)); - request.getExtreme().forEach(x -> savePv(x, Difficulty.EXTREME)); - return pvEntryRepository.findAll(); - } - - @PostMapping("module") - public List updateModuleList(@RequestBody List request) { - List moduleList = new ArrayList<>(); - request.forEach(x -> moduleList.add(new DivaModule(x.getID(), x.getName(), x.getPrice(), x.getReleaseDate(), x.getEndDate(), x.getSortOrder()))); - return moduleRepository.saveAll(moduleList); - } - - @PostMapping("item") - public List updateItemList(@RequestBody List request) { - List itemList = new ArrayList<>(); - request.forEach(x -> itemList.add(new DivaCustomize(x.getID(), x.getName(), x.getPrice(), x.getReleaseDate(), x.getEndDate(), x.getSortOrder()))); - return customizeRepository.saveAll(itemList); - } - - private void savePv(PvListEntry x, Difficulty difficulty) { - pvEntryRepository.save(new PvEntry(x.getPVID(), - difficulty, - x.getVersion(), - Edition.fromValue(x.getEdition()), - x.getAdvDemo().getStart(), - x.getAdvDemo().getEnd(), - x.getPlayable().getStart(), - x.getPlayable().getEnd() - )); - } - - @GetMapping("festa") - public List getFesta() { - return festaRepository.findAll(); - } - - @PutMapping("festa") - public Festa updateFesta(@RequestBody Festa festa) { - return festaRepository.save(festa); - } - - @DeleteMapping("festa/{id}") - public MessageResponse getFesta(@PathVariable int id) { - festaRepository.deleteById(id); - return new MessageResponse("Deleted " + id); - } - - @GetMapping("contest") - public List getContest() { - return contestRepository.findAll(); - } - - @PutMapping("contest") - public Contest updateContest(@RequestBody Contest contest) { - return contestRepository.save(contest); - } - - @DeleteMapping("contest/{id}") - public MessageResponse deleteContest(@PathVariable int id) { - contestRepository.deleteById(id); - return new MessageResponse("Deleted " + id); - } - - @GetMapping("news") - public Optional getNews() { - return propertyEntryRepository.findByPropertyKey("diva_news"); - } - - @PutMapping("news") - public PropertyEntry updateNews(@RequestBody PropertyEntry property) { - PropertyEntry entry = propertyEntryRepository.findByPropertyKey("diva_news") - .orElseGet(() -> new PropertyEntry("diva_news")); - entry.setPropertyValue(property.getPropertyValue()); - return propertyEntryRepository.save(entry); - } - - @GetMapping("warning") - public Optional getWarning() { - return propertyEntryRepository.findByPropertyKey("diva_warning"); - } - - @PutMapping("warning") - public PropertyEntry updateWarning(@RequestBody PropertyEntry property) { - PropertyEntry entry = propertyEntryRepository.findByPropertyKey("diva_warning") - .orElseGet(() -> new PropertyEntry("diva_warning")); - entry.setPropertyValue(property.getPropertyValue()); - return propertyEntryRepository.save(entry); - } - - @GetMapping("module") - public List getModule() { - return moduleRepository.findAll(); - } - - @GetMapping("customize") - public List getCustomize() { - return customizeRepository.findAll(); - } -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/MessageResponse.java b/src/main/java/icu/samnyan/aqua/api/model/MessageResponse.java deleted file mode 100644 index a19a9348..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/MessageResponse.java +++ /dev/null @@ -1,23 +0,0 @@ -package icu.samnyan.aqua.api.model; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -public class MessageResponse { - private String message = "ok"; - - public MessageResponse(String message) { - this.message = message; - } - - public MessageResponse() { - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/ObjectMessageResponse.java b/src/main/java/icu/samnyan/aqua/api/model/ObjectMessageResponse.java deleted file mode 100644 index b669131d..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/ObjectMessageResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -package icu.samnyan.aqua.api.model; - -public class ObjectMessageResponse extends MessageResponse { - private T data; - - public ObjectMessageResponse(String message) { - super(message); - } - - public ObjectMessageResponse(T data) { - super(); - setData(data); - } - - public ObjectMessageResponse(T data, String message) { - super(message); - setData(data); - } - - public T getData() { - return data; - } - - public void setData(T data) { - this.data = data; - } -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/ReducedPageResponse.java b/src/main/java/icu/samnyan/aqua/api/model/ReducedPageResponse.java deleted file mode 100644 index 3eed2fc0..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/ReducedPageResponse.java +++ /dev/null @@ -1,25 +0,0 @@ -package icu.samnyan.aqua.api.model; - -import lombok.Getter; -import lombok.Setter; - -import java.util.Collection; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Getter -@Setter -public class ReducedPageResponse { - private Collection content; - private Integer page; - private Integer totalPages; - private Long totalElements; - - public ReducedPageResponse(Collection content, Integer page, Integer totalPages, Long totalElements) { - this.content = content; - this.page = page; - this.totalPages = totalPages; - this.totalElements = totalElements; - } -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/req/sega/diva/DatePair.java b/src/main/java/icu/samnyan/aqua/api/model/req/sega/diva/DatePair.java deleted file mode 100644 index 3e0fa29b..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/req/sega/diva/DatePair.java +++ /dev/null @@ -1,21 +0,0 @@ -package icu.samnyan.aqua.api.model.req.sega.diva; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.time.LocalDateTime; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class DatePair { - @JsonProperty("Start") - private LocalDateTime Start; - @JsonProperty("End") - private LocalDateTime End; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/req/sega/diva/ModuleEntry.java b/src/main/java/icu/samnyan/aqua/api/model/req/sega/diva/ModuleEntry.java deleted file mode 100644 index 5b9295ed..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/req/sega/diva/ModuleEntry.java +++ /dev/null @@ -1,29 +0,0 @@ -package icu.samnyan.aqua.api.model.req.sega.diva; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.time.LocalDateTime; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ModuleEntry { - @JsonProperty("ID") - private int ID; - @JsonProperty("Name") - private String Name; - @JsonProperty("Price") - private int Price; - @JsonProperty("ReleaseDate") - private LocalDateTime ReleaseDate; - @JsonProperty("EndDate") - private LocalDateTime EndDate; - @JsonProperty("SortOrder") - private int SortOrder; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/req/sega/diva/PvListEntry.java b/src/main/java/icu/samnyan/aqua/api/model/req/sega/diva/PvListEntry.java deleted file mode 100644 index 8cb7acaa..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/req/sega/diva/PvListEntry.java +++ /dev/null @@ -1,25 +0,0 @@ -package icu.samnyan.aqua.api.model.req.sega.diva; - -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 PvListEntry { - @JsonProperty("PVID") - private int PVID; - @JsonProperty("Version") - private int Version; - @JsonProperty("Edition") - private int Edition; - @JsonProperty("AdvDemo") - private DatePair AdvDemo; - @JsonProperty("Playable") - private DatePair Playable; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/req/sega/diva/PvListRequest.java b/src/main/java/icu/samnyan/aqua/api/model/req/sega/diva/PvListRequest.java deleted file mode 100644 index e89eef73..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/req/sega/diva/PvListRequest.java +++ /dev/null @@ -1,28 +0,0 @@ -package icu.samnyan.aqua.api.model.req.sega.diva; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.time.LocalDateTime; -import java.util.List; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class PvListRequest { - @JsonProperty("CreationDate") - private LocalDateTime CreationDate; - @JsonProperty("Easy") - private List Easy; - @JsonProperty("Normal") - private List Normal; - @JsonProperty("Hard") - private List Hard; - @JsonProperty("Extreme") - private List Extreme; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/ProfileResp.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/ProfileResp.java deleted file mode 100644 index fdc98db1..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/ProfileResp.java +++ /dev/null @@ -1,60 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.chuni.v1; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.time.LocalDateTime; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ProfileResp { - - private String userName; - - private int level; - - private String exp; - - private long point; - - private long totalPoint; - - private int playCount; - - private int playerRating; - - private int highestRating; - - private int nameplateId; - - private int frameId; - - private int characterId; - - private int trophyId; - - private int totalMapNum; - - private long totalHiScore; - - private long totalBasicHighScore; - - private long totalAdvancedHighScore; - - private long totalExpertHighScore; - - private long totalMasterHighScore; - - private int friendCount; - - private LocalDateTime firstPlayDate; - - private LocalDateTime lastPlayDate; - - private int courseClass; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/RatingItem.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/RatingItem.java deleted file mode 100644 index 38b9860e..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/RatingItem.java +++ /dev/null @@ -1,28 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.chuni.v1; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class RatingItem { - - private int musicId; - - private String musicName; - - private String artistName; - - private int level; - - private int score; - - private int ratingBase; - - private int rating; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/RecentResp.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/RecentResp.java deleted file mode 100644 index c2479ea4..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/RecentResp.java +++ /dev/null @@ -1,87 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.chuni.v1; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.time.LocalDateTime; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class RecentResp { - - private LocalDateTime playDate; - - private LocalDateTime userPlayDate; - - private int musicId; - - private int level; - - private int customId; - - private int playedCustom1; - - private int playedCustom2; - - private int playedCustom3; - - private int track; - - private int score; - - private int rank; - - private int maxCombo; - - private int maxChain; - - private int rateTap; - - private int rateHold; - - private int rateSlide; - - private int rateAir; - - private int rateFlick; - - private int judgeGuilty; - - private int judgeAttack; - - private int judgeJustice; - - private int judgeCritical; - - private int playerRating; - - @JsonProperty("isNewRecord") - private boolean isNewRecord; - - @JsonProperty("isFullCombo") - private boolean isFullCombo; - - private int fullChainKind; - - @JsonProperty("isAllJustice") - private boolean isAllJustice; - - private int characterId; - - private int skillId; - - private int playKind; - - @JsonProperty("isClear") - private boolean isClear; - - private int skillLevel; - - private int skillEffect; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/ScoreResp.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/ScoreResp.java deleted file mode 100644 index 42865443..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/ScoreResp.java +++ /dev/null @@ -1,48 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.chuni.v1; - -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 ScoreResp { - - private int musicId; - - private int level; - - private int playCount; - - private int scoreMax; - - private int resRequestCount; - - private int resAcceptCount; - - private int resSuccessCount; - - private int missCount; - - private int maxComboCount; - - @JsonProperty("isFullCombo") - private boolean isFullCombo; - - @JsonProperty("isAllJustice") - private boolean isAllJustice; - - @JsonProperty("isSuccess") - private boolean isSuccess; - - private int fullChain; - - private int maxChain; - - private int scoreRank; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/external/ChuniDataExport.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/external/ChuniDataExport.java deleted file mode 100644 index 97c92304..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/external/ChuniDataExport.java +++ /dev/null @@ -1,32 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.chuni.v1.external; - -import icu.samnyan.aqua.sega.chunithm.model.userdata.*; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; - -/** - * This class is use for exporting CHUNITHM profile - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ChuniDataExport { - private String gameId = "SDBT"; - private UserData userData; - private List userActivityList; - private List userCharacterList; - private List userChargeList; - private List userCourseList; - private UserDataEx userDataEx; - private List userDuelList; - private UserGameOption userGameOption; - private UserGameOptionEx userGameOptionEx; - private List userItemList; - private List userMapList; - private List userMusicDetailList; - private List userPlaylogList; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/external/ChuniDataImport.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/external/ChuniDataImport.java deleted file mode 100644 index 227b2c19..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/external/ChuniDataImport.java +++ /dev/null @@ -1,32 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.chuni.v1.external; - -import icu.samnyan.aqua.sega.chunithm.model.userdata.*; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; - -/** - * This class is use for importing CHUNITHM profile - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ChuniDataImport { - private String gameId; - private ExternalUserData userData; - private List userActivityList; - private List userCharacterList; - private List userChargeList; - private List userCourseList; - private UserDataEx userDataEx; - private List userDuelList; - private UserGameOption userGameOption; - private UserGameOptionEx userGameOptionEx; - private List userItemList; - private List userMapList; - private List userMusicDetailList; - private List userPlaylogList; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/external/ExternalUserData.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/external/ExternalUserData.java deleted file mode 100644 index ee3f8645..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v1/external/ExternalUserData.java +++ /dev/null @@ -1,119 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.chuni.v1.external; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.time.LocalDateTime; - -/** - * This class is use for exported UserData class. Using access code as identifier - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ExternalUserData { - - // Access Code of the card - private String accessCode; - - private String userName; - - private LocalDateTime lastLoginDate; - - private boolean isWebJoin; - - private String webLimitDate; - - private int level; - - private int reincarnationNum; - - private String exp; - - private long point; - - private long totalPoint; - - private int playCount; - - private int multiPlayCount; - - private int multiWinCount; - - private int requestResCount; - - private int acceptResCount; - - private int successResCount; - - private int playerRating; - - private int highestRating; - - private int nameplateId; - - private int frameId; - - private int characterId; - - private int trophyId; - - private int playedTutorialBit; - - private int firstTutorialCancelNum; - - private int masterTutorialCancelNum; - - private int totalRepertoireCount; - - private int totalMapNum; - - private long totalHiScore; - - private long totalBasicHighScore; - - private long totalAdvancedHighScore; - - private long totalExpertHighScore; - - private long totalMasterHighScore; - - private LocalDateTime eventWatchedDate; - - private int friendCount; - - @JsonProperty("isMaimai") - private boolean isMaimai; - - private String firstGameId; - - private String firstRomVersion; - - private String firstDataVersion; - - private LocalDateTime firstPlayDate; - - private String lastGameId; - - private String lastRomVersion; - - private String lastDataVersion; - - private LocalDateTime lastPlayDate; - - private int lastPlaceId; - - private String lastPlaceName; - - private String lastRegionId; - - private String lastRegionName; - - private String lastAllNetId; - - @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) - private String lastClientId; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/RatingItem.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/RatingItem.java deleted file mode 100644 index 55b25917..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/RatingItem.java +++ /dev/null @@ -1,28 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.chuni.v2; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class RatingItem { - - private int musicId; - - private String musicName; - - private String artistName; - - private int level; - - private int score; - - private int ratingBase; - - private int rating; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/RecentResp.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/RecentResp.java deleted file mode 100644 index 58213aae..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/RecentResp.java +++ /dev/null @@ -1,89 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.chuni.v2; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.time.LocalDateTime; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class RecentResp { - - private LocalDateTime playDate; - - private LocalDateTime userPlayDate; - - private int musicId; - - private int level; - - private int customId; - - private int playedCustom1; - - private int playedCustom2; - - private int playedCustom3; - - private int track; - - private int score; - - private int rank; - - private int maxCombo; - - private int maxChain; - - private int rateTap; - - private int rateHold; - - private int rateSlide; - - private int rateAir; - - private int rateFlick; - - private int judgeGuilty; - - private int judgeAttack; - - private int judgeJustice; - - private int judgeCritical; - - private int judgeHeaven; - - private int playerRating; - - @JsonProperty("isNewRecord") - private boolean isNewRecord; - - @JsonProperty("isFullCombo") - private boolean isFullCombo; - - private int fullChainKind; - - @JsonProperty("isAllJustice") - private boolean isAllJustice; - - private int characterId; - - private int skillId; - - private int playKind; - - @JsonProperty("isClear") - private boolean isClear; - - private int skillLevel; - - private int skillEffect; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/ScoreResp.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/ScoreResp.java deleted file mode 100644 index 1156f004..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/ScoreResp.java +++ /dev/null @@ -1,48 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.chuni.v2; - -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 ScoreResp { - - private int musicId; - - private int level; - - private int playCount; - - private int scoreMax; - - private int resRequestCount; - - private int resAcceptCount; - - private int resSuccessCount; - - private int missCount; - - private int maxComboCount; - - @JsonProperty("isFullCombo") - private boolean isFullCombo; - - @JsonProperty("isAllJustice") - private boolean isAllJustice; - - @JsonProperty("isSuccess") - private boolean isSuccess; - - private int fullChain; - - private int maxChain; - - private int scoreRank; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/external/Chu3DataExport.kt b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/external/Chu3DataExport.kt deleted file mode 100644 index cdde0ac4..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/external/Chu3DataExport.kt +++ /dev/null @@ -1,23 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.chuni.v2.external - -import icu.samnyan.aqua.net.games.IExportClass -import icu.samnyan.aqua.sega.chusan.model.userdata.* - -data class Chu3DataExport( - override var gameId: String = "SDHD", - override var userData: Chu3UserData, - var userGameOption: UserGameOption, - var userActivityList: List, - var userCharacterList: List, - var userChargeList: List, - var userCourseList: List, - var userDuelList: List, - var userItemList: List, - var userMapList: List, - var userMusicDetailList: List, - var userPlaylogList: List, -): IExportClass { - constructor() : this("SDHD", - Chu3UserData(), UserGameOption(), ArrayList(), ArrayList(), ArrayList(), ArrayList(), ArrayList(), ArrayList(), ArrayList(), ArrayList(), ArrayList()) -} - diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/external/ChuniDataImport.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/external/ChuniDataImport.java deleted file mode 100644 index 83e7b21f..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/external/ChuniDataImport.java +++ /dev/null @@ -1,30 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.chuni.v2.external; - -import icu.samnyan.aqua.sega.chusan.model.userdata.*; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; - -/** - * This class is use for importing chusan profile - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ChuniDataImport { - private String gameId; - private ExternalUserData userData; - private List userActivityList; - private List userCharacterList; - private List userChargeList; - private List userCourseList; - private List userDuelList; - private UserGameOption userGameOption; - private List userItemList; - private List userMapList; - private List userMusicDetailList; - private List userPlaylogList; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/external/ExternalUserData.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/external/ExternalUserData.java deleted file mode 100644 index 1c74eea3..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/chuni/v2/external/ExternalUserData.java +++ /dev/null @@ -1,119 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.chuni.v2.external; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.time.LocalDateTime; - -/** - * This class is use for exported UserData class. Using access code as identifier - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ExternalUserData { - - // Access Code of the card - private String accessCode; - - private String userName; - - private LocalDateTime lastLoginDate; - - private boolean isWebJoin; - - private String webLimitDate; - - private int level; - - private int reincarnationNum; - - private String exp; - - private long point; - - private long totalPoint; - - private int playCount; - - private int multiPlayCount; - - private int multiWinCount; - - private int requestResCount; - - private int acceptResCount; - - private int successResCount; - - private int playerRating; - - private int highestRating; - - private int nameplateId; - - private int frameId; - - private int characterId; - - private int trophyId; - - private int playedTutorialBit; - - private int firstTutorialCancelNum; - - private int masterTutorialCancelNum; - - private int totalRepertoireCount; - - private int totalMapNum; - - private long totalHiScore; - - private long totalBasicHighScore; - - private long totalAdvancedHighScore; - - private long totalExpertHighScore; - - private long totalMasterHighScore; - - private LocalDateTime eventWatchedDate; - - private int friendCount; - - @JsonProperty("isMaimai") - private boolean isMaimai; - - private String firstGameId; - - private String firstRomVersion; - - private String firstDataVersion; - - private LocalDateTime firstPlayDate; - - private String lastGameId; - - private String lastRomVersion; - - private String lastDataVersion; - - private LocalDateTime lastPlayDate; - - private int lastPlaceId; - - private String lastPlaceName; - - private String lastRegionId; - - private String lastRegionName; - - private String lastAllNetId; - - @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) - private String lastClientId; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/diva/PlayerInfo.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/diva/PlayerInfo.java deleted file mode 100644 index 420a6050..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/diva/PlayerInfo.java +++ /dev/null @@ -1,13 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.diva; - -import lombok.Data; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -public class PlayerInfo { - private long pdId; - private String playerName; - private int vocaloidPoints; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/diva/PvRankRecord.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/diva/PvRankRecord.java deleted file mode 100644 index 3a59d8d4..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/diva/PvRankRecord.java +++ /dev/null @@ -1,16 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.diva; - -import lombok.AllArgsConstructor; -import lombok.Data; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -public class PvRankRecord { - private long id; - private String playerName; - private int score; - private int attain; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/PhotoResp.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/PhotoResp.java deleted file mode 100644 index a57b97f7..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/PhotoResp.java +++ /dev/null @@ -1,15 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.maimai2; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class PhotoResp { - private int imageIndex; - private int totalImage; - private String fileName; - private String divData; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/ProfileResp.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/ProfileResp.java deleted file mode 100644 index d4386c9a..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/ProfileResp.java +++ /dev/null @@ -1,62 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.maimai2; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ProfileResp { - - private String userName; - private int iconId; - private int plateId; - private int titleId; - private int partnerId; - private int frameId; - private int selectMapId; - private int totalAwake; - private int gradeRating; - private int musicRating; - private int playerRating; - private int highestRating; - private int gradeRank; - private int classRank; - private int courseRank; - private List charaSlot; - private List charaLockSlot; - private int playCount; - private String eventWatchedDate; - private String lastRomVersion; - private String lastDataVersion; - private String lastPlayDate; - private int playVsCount; - private int playSyncCount; - private int winCount; - private int helpCount; - private int comboCount; - private long totalDeluxscore; - private long totalBasicDeluxscore; - private long totalAdvancedDeluxscore; - private long totalExpertDeluxscore; - private long totalMasterDeluxscore; - private long totalReMasterDeluxscore; - private int totalSync; - private int totalBasicSync; - private int totalAdvancedSync; - private int totalExpertSync; - private int totalMasterSync; - private int totalReMasterSync; - private long totalAchievement; - private long totalBasicAchievement; - private long totalAdvancedAchievement; - private long totalExpertAchievement; - private long totalMasterAchievement; - private long totalReMasterAchievement; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/external/ExternalUserData.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/external/ExternalUserData.java deleted file mode 100644 index 291b74d3..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/external/ExternalUserData.java +++ /dev/null @@ -1,96 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.maimai2.external; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.List; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -public class ExternalUserData implements Serializable { - - private String accessCode; - private String userName; - private int isNetMember; - private int iconId; - private int plateId; - private int titleId; - private int partnerId; - private int frameId; - private int selectMapId; - private int totalAwake; - private int gradeRating; - private int musicRating; - private int playerRating; - private int highestRating; - private int gradeRank; - private int classRank; - private int courseRank; - private List charaSlot; - private List charaLockSlot; - private long contentBit; - private int playCount; - private String eventWatchedDate; - private String lastGameId; - private String lastRomVersion; - private String lastDataVersion; - private String lastLoginDate; - private String lastPlayDate; - private int lastPlayCredit; - private int lastPlayMode; - private int lastPlaceId; - private String lastPlaceName; - private int lastAllNetId; - private int lastRegionId; - private String lastRegionName; - @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) - private String lastClientId; - private String lastCountryCode; - private int lastSelectEMoney; - private int lastSelectTicket; - private int lastSelectCourse; - private int lastCountCourse; - private String firstGameId; - private String firstRomVersion; - private String firstDataVersion; - private String firstPlayDate; - private String compatibleCmVersion; - private String dailyBonusDate; - private String dailyCourseBonusDate; - private String lastPairLoginDate; - private String lastTrialPlayDate; - private int playVsCount; - private int playSyncCount; - private int winCount; - private int helpCount; - private int comboCount; - private long totalDeluxscore; - private long totalBasicDeluxscore; - private long totalAdvancedDeluxscore; - private long totalExpertDeluxscore; - private long totalMasterDeluxscore; - private long totalReMasterDeluxscore; - private int totalSync; - private int totalBasicSync; - private int totalAdvancedSync; - private int totalExpertSync; - private int totalMasterSync; - private int totalReMasterSync; - private long totalAchievement; - private long totalBasicAchievement; - private long totalAdvancedAchievement; - private long totalExpertAchievement; - private long totalMasterAchievement; - private long totalReMasterAchievement; - private long playerOldRating; - private long playerNewRating; - private int banState; - private long dateTime; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/external/Maimai2DataExport.kt b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/external/Maimai2DataExport.kt deleted file mode 100644 index 4fac9419..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/external/Maimai2DataExport.kt +++ /dev/null @@ -1,30 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.maimai2.external - -import icu.samnyan.aqua.net.games.IExportClass -import icu.samnyan.aqua.sega.maimai2.model.userdata.* - -data class Maimai2DataExport( - override var userData: Mai2UserDetail, - var userExtend: Mai2UserExtend, - var userOption: Mai2UserOption, - var userUdemae: Mai2UserUdemae, - var mapEncountNpcList: List, - var userActList: List, - var userCharacterList: List, - var userChargeList: List, - var userCourseList: List, - var userFavoriteList: List, - var userFriendSeasonRankingList: List, - var userGeneralDataList: List, - var userItemList: List, - var userLoginBonusList: List, - var userMapList: List, - var userMusicDetailList: List, - var userPlaylogList: List, - override var gameId: String = "SDEZ", -): IExportClass { - constructor() : this(Mai2UserDetail(), Mai2UserExtend(), Mai2UserOption(), Mai2UserUdemae(), - mutableListOf(), mutableListOf(), mutableListOf(), mutableListOf(), mutableListOf(), mutableListOf(), - mutableListOf(), mutableListOf(), mutableListOf(), mutableListOf(), mutableListOf(), mutableListOf(), - mutableListOf()) -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/external/Maimai2DataImport.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/external/Maimai2DataImport.java deleted file mode 100644 index 271c5b5d..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/maimai2/external/Maimai2DataImport.java +++ /dev/null @@ -1,37 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.maimai2.external; - -import icu.samnyan.aqua.sega.maimai2.model.userdata.*; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class Maimai2DataImport { - private String gameId; - private ExternalUserData userData; - private Mai2UserExtend userExtend; - private Mai2UserOption userOption; - private List mapEncountNpcList; - private List userActList; - private List userCharacterList; - private List userChargeList; - private List userCourseList; - private List userFavoriteList; - private List userFriendSeasonRankingList; - private List userGeneralDataList; - private List userGhostList; - private List userItemList; - private List userLoginBonusList; - private List userMapList; - private List userMusicDetailList; - private List userPlaylogList; - private List userRateList; - private Mai2UserUdemae userUdemae; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/ongeki/ProfileResp.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/ongeki/ProfileResp.java deleted file mode 100644 index 61a7a705..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/ongeki/ProfileResp.java +++ /dev/null @@ -1,69 +0,0 @@ -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; - -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/ongeki/external/ExternalUserData.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/ongeki/external/ExternalUserData.java deleted file mode 100644 index 1212e44e..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/ongeki/external/ExternalUserData.java +++ /dev/null @@ -1,137 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.ongeki.external; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -public class ExternalUserData implements Serializable { - - private String accessCode; - - private String userName; - - private int level; - - private int reincarnationNum; - - private long exp; - - private long point; - - private long totalPoint; - - private int playCount; - - private int jewelCount; - - private int totalJewelCount; - - private int medalCount; - - private int playerRating; - - private int highestRating; - - private int battlePoint; - - private int bestBattlePoint; - - private int overDamageBattlePoint; - - 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 rivalScoreCategorySetting; - - private int playedTutorialBit; - - private int firstTutorialCancelNum; - - private long sumTechHighScore; - - private long sumTechBasicHighScore; - - private long sumTechAdvancedHighScore; - - private long sumTechExpertHighScore; - - private long sumTechMasterHighScore; - - private long sumTechLunaticHighScore; - - private long sumBattleHighScore; - - private long sumBattleBasicHighScore; - - private long sumBattleAdvancedHighScore; - - private long sumBattleExpertHighScore; - - private long sumBattleMasterHighScore; - - private long sumBattleLunaticHighScore; - - private String eventWatchedDate; - - private String cmEventWatchedDate; - - private String firstGameId; - - private String firstRomVersion; - - private String firstDataVersion; - - private String firstPlayDate; - - private String lastGameId; - - private String lastRomVersion; - - private String lastDataVersion; - - private String compatibleCmVersion; - - private String lastPlayDate; - - private int lastPlaceId; - - private String lastPlaceName; - - private int lastRegionId; - - private String lastRegionName; - - private int lastAllNetId; - - @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) - private String lastClientId; - - private int lastUsedDeckId; - - private int lastPlayMusicLevel; - - private int lastEmoneyBrand; - -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/ongeki/external/OngekiDataExport.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/ongeki/external/OngekiDataExport.java deleted file mode 100644 index c37d90d7..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/ongeki/external/OngekiDataExport.java +++ /dev/null @@ -1,44 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.ongeki.external; - -import icu.samnyan.aqua.sega.ongeki.model.userdata.*; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class OngekiDataExport { - private String gameId = "SDDT"; - private UserData userData; - private List userActivityList; - private List userCardList; - private List userChapterList; - private List userCharacterList; - private List userDeckList; - private List userEventPointList; - private List userGeneralDataList; - private List userItemList; - private List userLoginBonusList; - private List userMissionPointList; - private List userMusicDetailList; - private List userMusicItemList; - private UserOption userOption; - private List userPlaylogList; - private List userStoryList; - private List userTrainingRoomList; - private List userTradeItemList; - private List userEventMusicList; - private List userTechEventList; - private List userKopList; - private List userMemoryChapterList; - private List userScenarioList; - private List userBossList; - private List userTechCountList; - private List userRivalList; -} diff --git a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/ongeki/external/OngekiDataImport.java b/src/main/java/icu/samnyan/aqua/api/model/resp/sega/ongeki/external/OngekiDataImport.java deleted file mode 100644 index 1b2b241d..00000000 --- a/src/main/java/icu/samnyan/aqua/api/model/resp/sega/ongeki/external/OngekiDataImport.java +++ /dev/null @@ -1,44 +0,0 @@ -package icu.samnyan.aqua.api.model.resp.sega.ongeki.external; - -import icu.samnyan.aqua.sega.ongeki.model.userdata.*; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class OngekiDataImport { - private String gameId; - private ExternalUserData userData; - private List userActivityList; - private List userCardList; - private List userChapterList; - private List userCharacterList; - private List userDeckList; - private List userEventPointList; - private List userGeneralDataList; - private List userItemList; - private List userLoginBonusList; - private List userMissionPointList; - private List userMusicDetailList; - private List userMusicItemList; - private UserOption userOption; - private List userPlaylogList; - private List userStoryList; - private List userTrainingRoomList; - private List userTradeItemList; - private List userEventMusicList; - private List userTechEventList; - private List userKopList; - private List userMemoryChapterList; - private List userScenarioList; - private List userBossList; - private List userTechCountList; - private List userRivalList; -} diff --git a/src/main/java/icu/samnyan/aqua/api/util/ApiMapper.java b/src/main/java/icu/samnyan/aqua/api/util/ApiMapper.java deleted file mode 100644 index 2a9588d4..00000000 --- a/src/main/java/icu/samnyan/aqua/api/util/ApiMapper.java +++ /dev/null @@ -1,35 +0,0 @@ -package icu.samnyan.aqua.api.util; - -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.module.SimpleModule; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import org.springframework.stereotype.Component; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Component -public class ApiMapper { - - private final ObjectMapper mapper; - - public ApiMapper() { - mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - SimpleModule module = new SimpleModule(); - mapper.registerModule(new JavaTimeModule()); - mapper.registerModule(module); - } - - public String write(Object o) throws JsonProcessingException { - return mapper.writeValueAsString(o); - - } - - public T convert(Object object, TypeReference toClass) { - return mapper.convertValue(object, toClass); - } -}