mirror of https://github.com/hykilpikonna/AquaDX
[-] Remove old aqua apis
parent
ff9ee24894
commit
1df5b4e8ba
|
@ -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");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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<Object> noSuchElement() {
|
|
||||||
return ResponseEntity.notFound().build();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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<Resource> getScreenshotFile(@PathVariable String filename) {
|
|
||||||
Optional<PlayerScreenShot> ss = playerScreenShotRepository.findByFileName(filename);
|
|
||||||
if (ss.isPresent()) {
|
|
||||||
return ResponseEntity.ok(new FileSystemResource(Paths.get("data/" + ss.get().getFileName())));
|
|
||||||
} else {
|
|
||||||
return ResponseEntity.notFound().build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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<Card> getByAccessCode(@RequestBody Map<String, String> request) {
|
|
||||||
return cardService.getCardByAccessCode(request.get("accessCode").replaceAll("-", "").replaceAll(" ", ""));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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<Music> getMusic() {
|
|
||||||
return gameMusicService.getAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("character")
|
|
||||||
public List<Character> getCharacter() {
|
|
||||||
return gameCharacterRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("skill")
|
|
||||||
public List<CharacterSkill> getSkill() {
|
|
||||||
return gameCharacterSkillRepository.findAll();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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<Music> 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<String, Object> 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<String, Object> 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<Object> updatePrivacy(@RequestBody Map<String, Object> 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<RecentResp> getRecentPlay(@RequestParam String aimeId,
|
|
||||||
@RequestParam(required = false, defaultValue = "0") int page,
|
|
||||||
@RequestParam(required = false, defaultValue = "10") int size) {
|
|
||||||
Page<UserPlaylog> 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<RatingItem> getRating(@RequestParam String aimeId) {
|
|
||||||
|
|
||||||
Map<Integer, Music> musicMap = gameMusicService.getIdMap();
|
|
||||||
List<UserMusicDetail> details = userMusicDetailService.getByUserId(aimeId);
|
|
||||||
|
|
||||||
var user = userDataService.getUserByExtId(aimeId).orElseThrow();
|
|
||||||
var version = VersionUtil.parseVersion(user.getLastRomVersion());
|
|
||||||
|
|
||||||
List<RatingItem> 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<RatingItem> getRecentRating(@RequestParam String aimeId) {
|
|
||||||
Map<Integer, Music> musicMap = gameMusicService.getIdMap();
|
|
||||||
Optional<UserGeneralData> recentOptional = userGeneralDataService.getByUserIdAndKey(aimeId, "recent_rating_list");
|
|
||||||
|
|
||||||
|
|
||||||
var user = userDataService.getUserByExtId(aimeId).orElseThrow();
|
|
||||||
var version = VersionUtil.parseVersion(user.getLastRomVersion());
|
|
||||||
|
|
||||||
List<RatingItem> 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<UserPlaylog> 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<UserMusicDetail> getSongDetail(@RequestParam String aimeId, @PathVariable int id) {
|
|
||||||
return userMusicDetailService.getByUserIdAndMusicId(aimeId, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("song/{id}/{level}")
|
|
||||||
public List<UserPlaylog> getLevelPlaylog(@RequestParam String aimeId, @PathVariable int id, @PathVariable int level) {
|
|
||||||
return userPlaylogService.getByUserIdAndMusicIdAndLevel(aimeId, id, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("character")
|
|
||||||
public ReducedPageResponse<UserCharacter> getCharacter(@RequestParam String aimeId,
|
|
||||||
@RequestParam(required = false, defaultValue = "0") int page,
|
|
||||||
@RequestParam(required = false, defaultValue = "10") int size) {
|
|
||||||
Page<UserCharacter> characters = userCharacterService.getByUserId(aimeId, page, size);
|
|
||||||
return new ReducedPageResponse<>(characters.getContent(), characters.getPageable().getPageNumber(), characters.getTotalPages(), characters.getTotalElements());
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("character")
|
|
||||||
public ResponseEntity<Object> updateCharacter(@RequestBody Map<String, Object> request) {
|
|
||||||
UserData profile = userDataService.getUserByExtId((String) request.get("aimeId")).orElseThrow();
|
|
||||||
Integer characterId = (Integer) request.get("characterId");
|
|
||||||
Optional<UserCharacter> 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<UserCourse> getCourse(@RequestParam String aimeId) {
|
|
||||||
return userCourseService.getByUserId(aimeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("duel")
|
|
||||||
public List<UserDuel> getDuel(@RequestParam String aimeId) {
|
|
||||||
return userDuelService.getByUserId(aimeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("item")
|
|
||||||
public ReducedPageResponse<UserItem> getItem(@RequestParam String aimeId,
|
|
||||||
@RequestParam(required = false, defaultValue = "0") int page,
|
|
||||||
@RequestParam(required = false, defaultValue = "10") int size) {
|
|
||||||
Page<UserItem> items = userItemService.getByUserId(aimeId, page, size);
|
|
||||||
return new ReducedPageResponse<>(items.getContent(), items.getPageable().getPageNumber(), items.getTotalPages(), items.getTotalElements());
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("item")
|
|
||||||
public ResponseEntity<Object> updateItem(@RequestBody Map<String, Object> request) {
|
|
||||||
UserData profile = userDataService.getUserByExtId((String) request.get("aimeId")).orElseThrow();
|
|
||||||
Integer itemId = (Integer) request.get("itemId");
|
|
||||||
Integer itemKind = (Integer) request.get("itemKind");
|
|
||||||
Optional<UserItem> 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<Object> getGeneralData(@RequestParam String aimeId, @RequestParam String key) {
|
|
||||||
Optional<UserGeneralData> userGeneralDataOptional = userGeneralDataService.getByUserIdAndKey(aimeId,key);
|
|
||||||
return userGeneralDataOptional.<ResponseEntity<Object>>map(ResponseEntity::ok)
|
|
||||||
.orElseGet(() -> ResponseEntity.status(HttpStatus.NOT_FOUND).body(new MessageResponse("User or value not found.")));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("export")
|
|
||||||
public ResponseEntity<Object> 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<Object> 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<Card> 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<UserActivity> userActivityList = data.getUserActivityList();
|
|
||||||
userActivityList.forEach(x -> x.setUser(userData));
|
|
||||||
userActivityService.saveAll(userActivityList);
|
|
||||||
|
|
||||||
List<UserCharacter> userCharacterList = data.getUserCharacterList();
|
|
||||||
userCharacterList.forEach(x -> x.setUser(userData));
|
|
||||||
userCharacterService.saveAll(userCharacterList);
|
|
||||||
|
|
||||||
List<UserCharge> userChargeList = data.getUserChargeList();
|
|
||||||
userCharacterList.forEach(x -> x.setUser(userData));
|
|
||||||
userChargeService.saveAll(userChargeList);
|
|
||||||
|
|
||||||
List<UserCourse> userCourseList = data.getUserCourseList();
|
|
||||||
userCourseList.forEach(x -> x.setUser(userData));
|
|
||||||
userCourseService.saveAll(userCourseList);
|
|
||||||
|
|
||||||
UserDataEx userDataEx = data.getUserDataEx();
|
|
||||||
userDataEx.setUser(userData);
|
|
||||||
userDataExService.save(userDataEx);
|
|
||||||
|
|
||||||
List<UserDuel> 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<UserItem> userItemList = data.getUserItemList();
|
|
||||||
userItemList.forEach(x -> x.setUser(userData));
|
|
||||||
userItemService.saveAll(userItemList);
|
|
||||||
|
|
||||||
List<UserMap> userMapList = data.getUserMapList();
|
|
||||||
userMapList.forEach(x -> x.setUser(userData));
|
|
||||||
userMapService.saveAll(userMapList);
|
|
||||||
|
|
||||||
List<UserMusicDetail> userMusicDetailList = data.getUserMusicDetailList();
|
|
||||||
userMusicDetailList.forEach(x -> x.setUser(userData));
|
|
||||||
userMusicDetailService.saveAll(userMusicDetailList);
|
|
||||||
|
|
||||||
List<UserPlaylog> 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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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<Pv> musicList() {
|
|
||||||
return divaPvRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping(value = "moduleList")
|
|
||||||
public List<DivaModule> moduleList() {
|
|
||||||
return divaModuleRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping(value = "customizeList")
|
|
||||||
public List<DivaCustomize> customizeList() {
|
|
||||||
return divaCustomizeRepository.findAll();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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<MessageResponse> forceUnlock(@RequestParam long pdId) {
|
|
||||||
PlayerProfile profile = playerProfileService.findByPdId(pdId).orElseThrow();
|
|
||||||
Optional<GameSession> 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<PlayerProfile> getPlayerInfo(@RequestParam long pdId) {
|
|
||||||
return playerProfileService.findByPdId(pdId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("playerInfo/rival")
|
|
||||||
public Map<String, String> getRivalInfo(@RequestParam long pdId) {
|
|
||||||
var rId = playerProfileService.findByPdId(pdId).orElseThrow().getRivalPdId();
|
|
||||||
Map<String, String> result = new HashMap<>();
|
|
||||||
if (rId == -1) {
|
|
||||||
result.put("rival", "Not Set");
|
|
||||||
} else {
|
|
||||||
Optional<PlayerProfile> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<PlayLog> getPlayLogs(@RequestParam long pdId,
|
|
||||||
@RequestParam(required = false, defaultValue = "0") int page,
|
|
||||||
@RequestParam(required = false, defaultValue = "10") int size) {
|
|
||||||
Page<PlayLog> 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<PlayerPvRecord> getPvRecords(@RequestParam long pdId,
|
|
||||||
@RequestParam(required = false, defaultValue = "0") int page,
|
|
||||||
@RequestParam(required = false, defaultValue = "10") int size) {
|
|
||||||
Page<PlayerPvRecord> 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<String, Object> getPvRecord(@RequestParam long pdId, @PathVariable int pvId) {
|
|
||||||
Map<String, Object> 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<String, Object> 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<PvRankRecord> 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<PlayerPvRecord> pvRecords = playerPvRecordRepository.findByPvIdAndEditionAndDifficultyOrderByMaxScoreDesc(pvId, edition,diff, PageRequest.of(page, size));
|
|
||||||
|
|
||||||
List<PvRankRecord> 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<PlayerModule> getModules(@RequestParam long pdId,
|
|
||||||
@RequestParam(required = false, defaultValue = "0") int page,
|
|
||||||
@RequestParam(required = false, defaultValue = "10") int size) {
|
|
||||||
Page<PlayerModule> 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<PlayerCustomize> getCustomizes(@RequestParam long pdId,
|
|
||||||
@RequestParam(required = false, defaultValue = "0") int page,
|
|
||||||
@RequestParam(required = false, defaultValue = "10") int size) {
|
|
||||||
Page<PlayerCustomize> 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<PlayerScreenShot> getScreenshotList(@RequestParam long pdId) {
|
|
||||||
return playerScreenShotRepository.findByPdId_PdId(pdId);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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<String> matchedFiles = new ArrayList<>();
|
|
||||||
PhotoResp Photo = new PhotoResp();
|
|
||||||
try (Stream<Path> 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<String, Object> request) {
|
|
||||||
Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
|
||||||
profile.setUserName((String) request.get("userName"));
|
|
||||||
return userDataRepository.save(profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("profile/icon")
|
|
||||||
public Mai2UserDetail updateIcon(@RequestBody Map<String, Object> request) {
|
|
||||||
Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
|
||||||
profile.setIconId((Integer) request.get("iconId"));
|
|
||||||
return userDataRepository.save(profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("profile/plate")
|
|
||||||
public Mai2UserDetail updatePlate(@RequestBody Map<String, Object> request) {
|
|
||||||
Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
|
||||||
profile.setPlateId((Integer) request.get("plateId"));
|
|
||||||
return userDataRepository.save(profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("profile/frame")
|
|
||||||
public Mai2UserDetail updateFrame(@RequestBody Map<String, Object> request) {
|
|
||||||
Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
|
||||||
profile.setFrameId((Integer) request.get("frameId"));
|
|
||||||
return userDataRepository.save(profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("profile/title")
|
|
||||||
public Mai2UserDetail updateTrophy(@RequestBody Map<String, Object> request) {
|
|
||||||
Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
|
||||||
profile.setTitleId((Integer) request.get("titleId"));
|
|
||||||
return userDataRepository.save(profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("profile/partner")
|
|
||||||
public Mai2UserDetail updatePartner(@RequestBody Map<String, Object> request) {
|
|
||||||
Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
|
||||||
profile.setPartnerId((Integer) request.get("partnerId"));
|
|
||||||
return userDataRepository.save(profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("character")
|
|
||||||
public ReducedPageResponse<Mai2UserCharacter> getCharacter(@RequestParam long aimeId,
|
|
||||||
@RequestParam(required = false, defaultValue = "0") int page,
|
|
||||||
@RequestParam(required = false, defaultValue = "10") int size) {
|
|
||||||
Page<Mai2UserCharacter> characters = userCharacterRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page, size));
|
|
||||||
return new ReducedPageResponse<>(characters.getContent(), characters.getPageable().getPageNumber(), characters.getTotalPages(), characters.getTotalElements());
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("activity")
|
|
||||||
public List<Mai2UserAct> getActivities(@RequestParam long aimeId) {
|
|
||||||
return userActRepository.findByUser_Card_ExtId(aimeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("item")
|
|
||||||
public ReducedPageResponse<Mai2UserItem> getItem(@RequestParam long aimeId,
|
|
||||||
@RequestParam(required = false, defaultValue = "0") int page,
|
|
||||||
@RequestParam(required = false, defaultValue = "10") int size,
|
|
||||||
@RequestParam(required = false, defaultValue = "0") int ItemKind) {
|
|
||||||
Page<Mai2UserItem> items;
|
|
||||||
if(ItemKind == 0){
|
|
||||||
items = userItemRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page, size));
|
|
||||||
}
|
|
||||||
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<Object> updateItem(@RequestBody Map<String, Object> 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<Mai2UserItem> 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<Mai2UserPlaylog> getRecent(@RequestParam long aimeId,
|
|
||||||
@RequestParam(required = false, defaultValue = "0") int page,
|
|
||||||
@RequestParam(required = false, defaultValue = "10") int size) {
|
|
||||||
Page<Mai2UserPlaylog> playlogs = userPlaylogRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page, size, Sort.Direction.DESC, "id"));
|
|
||||||
return new ReducedPageResponse<>(playlogs.getContent(), playlogs.getPageable().getPageNumber(), playlogs.getTotalPages(), playlogs.getTotalElements());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("song/{id}")
|
|
||||||
public List<Mai2UserMusicDetail> getSongDetail(@RequestParam long aimeId, @PathVariable int id) {
|
|
||||||
return userMusicDetailRepository.findByUser_Card_ExtIdAndMusicId(aimeId, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("song/{id}/{level}")
|
|
||||||
public List<Mai2UserPlaylog> getLevelPlaylog(@RequestParam long aimeId, @PathVariable int id, @PathVariable int level) {
|
|
||||||
return userPlaylogRepository.findByUser_Card_ExtIdAndMusicIdAndLevel(aimeId, id, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("options")
|
|
||||||
public Mai2UserOption getOptions(@RequestParam long aimeId) {
|
|
||||||
return userOptionRepository.findSingleByUser_Card_ExtId(aimeId).orElseThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("options")
|
|
||||||
public ResponseEntity<Object> updateOptions(@RequestBody Map<String, Object> 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<Object> getGeneralData(@RequestParam long aimeId, @RequestParam String key) {
|
|
||||||
Optional<Mai2UserGeneralData> userGeneralDataOptional = userGeneralDataRepository.findByUser_Card_ExtIdAndPropertyKey(aimeId, key);
|
|
||||||
return userGeneralDataOptional.<ResponseEntity<Object>>map(ResponseEntity::ok)
|
|
||||||
.orElseGet(() -> ResponseEntity.status(HttpStatus.NOT_FOUND).body(new MessageResponse("User or value not found.")));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("general")
|
|
||||||
public ResponseEntity<Object> setGeneralData(@RequestBody Map<String, Object> request) {
|
|
||||||
Mai2UserDetail profile = userDataRepository.findByCardExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
|
||||||
String key = (String) request.get("key");
|
|
||||||
String value = (String) request.get("value");
|
|
||||||
|
|
||||||
Optional<Mai2UserGeneralData> 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<Object> 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<Object> 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<Card> cardOptional = cardService.getCardByAccessCode(exUser.getAccessCode());
|
|
||||||
Card card;
|
|
||||||
if (cardOptional.isPresent()) {
|
|
||||||
card = cardOptional.get();
|
|
||||||
Optional<Mai2UserDetail> existUserData = Optional.ofNullable(userDataRepository.findByCard(cardOptional.get()));
|
|
||||||
if (existUserData.isPresent()) {
|
|
||||||
// return ResponseEntity.status(HttpStatus.BAD_REQUEST)
|
|
||||||
// .body(new MessageResponse("This card already has a maimai2 profile."));
|
|
||||||
// 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()));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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<GameCard> getCardList() {
|
|
||||||
return gameCardRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("charaList")
|
|
||||||
public List<GameChara> getCharaList() {
|
|
||||||
return gameCharaRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("eventList")
|
|
||||||
public List<GameEvent> getEventList() {
|
|
||||||
return gameEventRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("musicList")
|
|
||||||
public List<GameMusic> getMusicList() {
|
|
||||||
return gameMusicRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("skillList")
|
|
||||||
public List<GameSkill> getSkillList() {
|
|
||||||
return gameSkillRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("cardList")
|
|
||||||
public List<GameCard> getCardList(@RequestBody List<GameCard> req) {
|
|
||||||
return gameCardRepository.saveAll(req);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("charaList")
|
|
||||||
public List<GameChara> getCharaList(@RequestBody List<GameChara> req) {
|
|
||||||
return gameCharaRepository.saveAll(req);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("eventList")
|
|
||||||
public List<GameEvent> getEventList(@RequestBody List<GameEvent> req) {
|
|
||||||
return gameEventRepository.saveAll(req);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("musicList")
|
|
||||||
public List<GameMusic> getMusicList(@RequestBody List<GameMusic> req) {
|
|
||||||
return gameMusicRepository.saveAll(req);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("skillList")
|
|
||||||
public List<GameSkill> getSkillList(@RequestBody List<GameSkill> req) {
|
|
||||||
return gameSkillRepository.saveAll(req);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<UserCard> getCard(@RequestParam long aimeId,
|
|
||||||
@RequestParam(required = false, defaultValue = "0") int page,
|
|
||||||
@RequestParam(required = false, defaultValue = "10") int size) {
|
|
||||||
Page<UserCard> cards = userCardRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page, size, 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<Object> insertCard(@RequestBody Map<String, Object> request) {
|
|
||||||
UserData profile = userDataRepository.findByCard_ExtId(((Number) request.get("aimeId")).longValue()).orElseThrow();
|
|
||||||
Integer cardId = (Integer) request.get("cardId");
|
|
||||||
Optional<UserCard> 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> 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<Object> kaikaCard(@RequestParam long aimeId, @PathVariable Integer cardId) {
|
|
||||||
Optional<UserCard> 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<Object> choKaikaCard(@RequestParam long aimeId, @PathVariable Integer cardId) {
|
|
||||||
Optional<UserCard> 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> 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<UserCharacter> getCharacter(@RequestParam long aimeId,
|
|
||||||
@RequestParam(required = false, defaultValue = "0") int page,
|
|
||||||
@RequestParam(required = false, defaultValue = "10") int size) {
|
|
||||||
Page<UserCharacter> characters = userCharacterRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page, size));
|
|
||||||
return new ReducedPageResponse<>(characters.getContent(), characters.getPageable().getPageNumber(), characters.getTotalPages(), characters.getTotalElements());
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("activity")
|
|
||||||
public List<UserActivity> getActivities(@RequestParam long aimeId) {
|
|
||||||
return userActivityRepository.findByUser_Card_ExtId(aimeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("activity")
|
|
||||||
public ResponseEntity<Object> updateActivities(@RequestBody Map<String, Object> 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<UserActivity> 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<UserItem> getItem(@RequestParam long aimeId,
|
|
||||||
@RequestParam(required = false, defaultValue = "0") int page,
|
|
||||||
@RequestParam(required = false, defaultValue = "10") int size) {
|
|
||||||
Page<UserItem> items = userItemRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page, size));
|
|
||||||
return new ReducedPageResponse<>(items.getContent(), items.getPageable().getPageNumber(), items.getTotalPages(), items.getTotalElements());
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("item")
|
|
||||||
public ResponseEntity<Object> updateItem(@RequestBody Map<String, Object> 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<UserItem> 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<UserPlaylog> getRecent(@RequestParam long aimeId,
|
|
||||||
@RequestParam(required = false, defaultValue = "0") int page,
|
|
||||||
@RequestParam(required = false, defaultValue = "10") int size) {
|
|
||||||
Page<UserPlaylog> playlogs = userPlaylogRepository.findByUser_Card_ExtId(aimeId, PageRequest.of(page, size, Sort.Direction.DESC, "id"));
|
|
||||||
return new ReducedPageResponse<>(playlogs.getContent(), playlogs.getPageable().getPageNumber(), playlogs.getTotalPages(), playlogs.getTotalElements());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("song/{id}")
|
|
||||||
public List<UserMusicDetail> getSongDetail(@RequestParam long aimeId, @PathVariable int id) {
|
|
||||||
return userMusicDetailRepository.findByUser_Card_ExtIdAndMusicId(aimeId, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("song/{id}/{level}")
|
|
||||||
public List<UserPlaylog> getLevelPlaylog(@RequestParam long aimeId, @PathVariable int id, @PathVariable int level) {
|
|
||||||
return userPlaylogRepository.findByUser_Card_ExtIdAndMusicIdAndLevel(aimeId, id, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("rival")
|
|
||||||
public List<UserRivalData> 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<UserRivalData> 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<Object> getGeneralData(@RequestParam long aimeId, @RequestParam String key) {
|
|
||||||
Optional<UserGeneralData> userGeneralDataOptional = userGeneralDataRepository.findByUser_Card_ExtIdAndPropertyKey(aimeId, key);
|
|
||||||
return userGeneralDataOptional.<ResponseEntity<Object>>map(ResponseEntity::ok)
|
|
||||||
.orElseGet(() -> ResponseEntity.status(HttpStatus.NOT_FOUND).body(new MessageResponse("User or value not found.")));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("export")
|
|
||||||
public ResponseEntity<Object> 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<Object> 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<Card> cardOptional = cardService.getCardByAccessCode(exUser.getAccessCode());
|
|
||||||
Card card;
|
|
||||||
if (cardOptional.isPresent()) {
|
|
||||||
card = cardOptional.get();
|
|
||||||
Optional<UserData> 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()));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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<Object> fillMockData(@RequestParam String aimeId) {
|
|
||||||
UserData profile = userDataService.getUserByExtId(aimeId).orElseThrow();
|
|
||||||
List<Music> musicList = gameMusicService.getAll();
|
|
||||||
List<UserMusicDetail> detailList = new ArrayList<>();
|
|
||||||
musicList.forEach(x -> {
|
|
||||||
Collection<Level> levels = x.getLevels().values();
|
|
||||||
levels.forEach(l -> {
|
|
||||||
Optional<UserMusicDetail> 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");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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<PvEntry> 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<DivaModule> updateModuleList(@RequestBody List<ModuleEntry> request) {
|
|
||||||
List<DivaModule> 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<DivaCustomize> updateItemList(@RequestBody List<ModuleEntry> request) {
|
|
||||||
List<DivaCustomize> 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<Festa> 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<Contest> 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<PropertyEntry> 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<PropertyEntry> 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<DivaModule> getModule() {
|
|
||||||
return moduleRepository.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("customize")
|
|
||||||
public List<DivaCustomize> getCustomize() {
|
|
||||||
return customizeRepository.findAll();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package icu.samnyan.aqua.api.model;
|
|
||||||
|
|
||||||
public class ObjectMessageResponse<T> 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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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<T> {
|
|
||||||
private Collection<T> content;
|
|
||||||
private Integer page;
|
|
||||||
private Integer totalPages;
|
|
||||||
private Long totalElements;
|
|
||||||
|
|
||||||
public ReducedPageResponse(Collection<T> content, Integer page, Integer totalPages, Long totalElements) {
|
|
||||||
this.content = content;
|
|
||||||
this.page = page;
|
|
||||||
this.totalPages = totalPages;
|
|
||||||
this.totalElements = totalElements;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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<PvListEntry> Easy;
|
|
||||||
@JsonProperty("Normal")
|
|
||||||
private List<PvListEntry> Normal;
|
|
||||||
@JsonProperty("Hard")
|
|
||||||
private List<PvListEntry> Hard;
|
|
||||||
@JsonProperty("Extreme")
|
|
||||||
private List<PvListEntry> Extreme;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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<UserActivity> userActivityList;
|
|
||||||
private List<UserCharacter> userCharacterList;
|
|
||||||
private List<UserCharge> userChargeList;
|
|
||||||
private List<UserCourse> userCourseList;
|
|
||||||
private UserDataEx userDataEx;
|
|
||||||
private List<UserDuel> userDuelList;
|
|
||||||
private UserGameOption userGameOption;
|
|
||||||
private UserGameOptionEx userGameOptionEx;
|
|
||||||
private List<UserItem> userItemList;
|
|
||||||
private List<UserMap> userMapList;
|
|
||||||
private List<UserMusicDetail> userMusicDetailList;
|
|
||||||
private List<UserPlaylog> userPlaylogList;
|
|
||||||
}
|
|
|
@ -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<UserActivity> userActivityList;
|
|
||||||
private List<UserCharacter> userCharacterList;
|
|
||||||
private List<UserCharge> userChargeList;
|
|
||||||
private List<UserCourse> userCourseList;
|
|
||||||
private UserDataEx userDataEx;
|
|
||||||
private List<UserDuel> userDuelList;
|
|
||||||
private UserGameOption userGameOption;
|
|
||||||
private UserGameOptionEx userGameOptionEx;
|
|
||||||
private List<UserItem> userItemList;
|
|
||||||
private List<UserMap> userMapList;
|
|
||||||
private List<UserMusicDetail> userMusicDetailList;
|
|
||||||
private List<UserPlaylog> userPlaylogList;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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<Chu3UserActivity>,
|
|
||||||
var userCharacterList: List<UserCharacter>,
|
|
||||||
var userChargeList: List<UserCharge>,
|
|
||||||
var userCourseList: List<UserCourse>,
|
|
||||||
var userDuelList: List<UserDuel>,
|
|
||||||
var userItemList: List<Chu3UserItem>,
|
|
||||||
var userMapList: List<UserMap>,
|
|
||||||
var userMusicDetailList: List<UserMusicDetail>,
|
|
||||||
var userPlaylogList: List<UserPlaylog>,
|
|
||||||
): IExportClass<Chu3UserData> {
|
|
||||||
constructor() : this("SDHD",
|
|
||||||
Chu3UserData(), UserGameOption(), ArrayList(), ArrayList(), ArrayList(), ArrayList(), ArrayList(), ArrayList(), ArrayList(), ArrayList(), ArrayList())
|
|
||||||
}
|
|
||||||
|
|
|
@ -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<Chu3UserActivity> userActivityList;
|
|
||||||
private List<UserCharacter> userCharacterList;
|
|
||||||
private List<UserCharge> userChargeList;
|
|
||||||
private List<UserCourse> userCourseList;
|
|
||||||
private List<UserDuel> userDuelList;
|
|
||||||
private UserGameOption userGameOption;
|
|
||||||
private List<Chu3UserItem> userItemList;
|
|
||||||
private List<UserMap> userMapList;
|
|
||||||
private List<UserMusicDetail> userMusicDetailList;
|
|
||||||
private List<UserPlaylog> userPlaylogList;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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<Integer> charaSlot;
|
|
||||||
private List<Integer> 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;
|
|
||||||
}
|
|
|
@ -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<Integer> charaSlot;
|
|
||||||
private List<Integer> 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;
|
|
||||||
}
|
|
|
@ -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<Mai2MapEncountNpc>,
|
|
||||||
var userActList: List<Mai2UserAct>,
|
|
||||||
var userCharacterList: List<Mai2UserCharacter>,
|
|
||||||
var userChargeList: List<Mai2UserCharge>,
|
|
||||||
var userCourseList: List<Mai2UserCourse>,
|
|
||||||
var userFavoriteList: List<Mai2UserFavorite>,
|
|
||||||
var userFriendSeasonRankingList: List<Mai2UserFriendSeasonRanking>,
|
|
||||||
var userGeneralDataList: List<Mai2UserGeneralData>,
|
|
||||||
var userItemList: List<Mai2UserItem>,
|
|
||||||
var userLoginBonusList: List<Mai2UserLoginBonus>,
|
|
||||||
var userMapList: List<Mai2UserMap>,
|
|
||||||
var userMusicDetailList: List<Mai2UserMusicDetail>,
|
|
||||||
var userPlaylogList: List<Mai2UserPlaylog>,
|
|
||||||
override var gameId: String = "SDEZ",
|
|
||||||
): IExportClass<Mai2UserDetail> {
|
|
||||||
constructor() : this(Mai2UserDetail(), Mai2UserExtend(), Mai2UserOption(), Mai2UserUdemae(),
|
|
||||||
mutableListOf(), mutableListOf(), mutableListOf(), mutableListOf(), mutableListOf(), mutableListOf(),
|
|
||||||
mutableListOf(), mutableListOf(), mutableListOf(), mutableListOf(), mutableListOf(), mutableListOf(),
|
|
||||||
mutableListOf())
|
|
||||||
}
|
|
|
@ -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<Mai2MapEncountNpc> mapEncountNpcList;
|
|
||||||
private List<Mai2UserAct> userActList;
|
|
||||||
private List<Mai2UserCharacter> userCharacterList;
|
|
||||||
private List<Mai2UserCharge> userChargeList;
|
|
||||||
private List<Mai2UserCourse> userCourseList;
|
|
||||||
private List<Mai2UserFavorite> userFavoriteList;
|
|
||||||
private List<Mai2UserFriendSeasonRanking> userFriendSeasonRankingList;
|
|
||||||
private List<Mai2UserGeneralData> userGeneralDataList;
|
|
||||||
private List<Mai2UserGhost> userGhostList;
|
|
||||||
private List<Mai2UserItem> userItemList;
|
|
||||||
private List<Mai2UserLoginBonus> userLoginBonusList;
|
|
||||||
private List<Mai2UserMap> userMapList;
|
|
||||||
private List<Mai2UserMusicDetail> userMusicDetailList;
|
|
||||||
private List<Mai2UserPlaylog> userPlaylogList;
|
|
||||||
private List<Mai2UserRate> userRateList;
|
|
||||||
private Mai2UserUdemae userUdemae;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
|
|
||||||
}
|
|
|
@ -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<UserActivity> userActivityList;
|
|
||||||
private List<UserCard> userCardList;
|
|
||||||
private List<UserChapter> userChapterList;
|
|
||||||
private List<UserCharacter> userCharacterList;
|
|
||||||
private List<UserDeck> userDeckList;
|
|
||||||
private List<UserEventPoint> userEventPointList;
|
|
||||||
private List<UserGeneralData> userGeneralDataList;
|
|
||||||
private List<UserItem> userItemList;
|
|
||||||
private List<UserLoginBonus> userLoginBonusList;
|
|
||||||
private List<UserMissionPoint> userMissionPointList;
|
|
||||||
private List<UserMusicDetail> userMusicDetailList;
|
|
||||||
private List<UserMusicItem> userMusicItemList;
|
|
||||||
private UserOption userOption;
|
|
||||||
private List<UserPlaylog> userPlaylogList;
|
|
||||||
private List<UserStory> userStoryList;
|
|
||||||
private List<UserTrainingRoom> userTrainingRoomList;
|
|
||||||
private List<UserTradeItem> userTradeItemList;
|
|
||||||
private List<UserEventMusic> userEventMusicList;
|
|
||||||
private List<UserTechEvent> userTechEventList;
|
|
||||||
private List<UserKop> userKopList;
|
|
||||||
private List<UserMemoryChapter> userMemoryChapterList;
|
|
||||||
private List<UserScenario> userScenarioList;
|
|
||||||
private List<UserBoss> userBossList;
|
|
||||||
private List<UserTechCount> userTechCountList;
|
|
||||||
private List<UserRival> userRivalList;
|
|
||||||
}
|
|
|
@ -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<UserActivity> userActivityList;
|
|
||||||
private List<UserCard> userCardList;
|
|
||||||
private List<UserChapter> userChapterList;
|
|
||||||
private List<UserCharacter> userCharacterList;
|
|
||||||
private List<UserDeck> userDeckList;
|
|
||||||
private List<UserEventPoint> userEventPointList;
|
|
||||||
private List<UserGeneralData> userGeneralDataList;
|
|
||||||
private List<UserItem> userItemList;
|
|
||||||
private List<UserLoginBonus> userLoginBonusList;
|
|
||||||
private List<UserMissionPoint> userMissionPointList;
|
|
||||||
private List<UserMusicDetail> userMusicDetailList;
|
|
||||||
private List<UserMusicItem> userMusicItemList;
|
|
||||||
private UserOption userOption;
|
|
||||||
private List<UserPlaylog> userPlaylogList;
|
|
||||||
private List<UserStory> userStoryList;
|
|
||||||
private List<UserTrainingRoom> userTrainingRoomList;
|
|
||||||
private List<UserTradeItem> userTradeItemList;
|
|
||||||
private List<UserEventMusic> userEventMusicList;
|
|
||||||
private List<UserTechEvent> userTechEventList;
|
|
||||||
private List<UserKop> userKopList;
|
|
||||||
private List<UserMemoryChapter> userMemoryChapterList;
|
|
||||||
private List<UserScenario> userScenarioList;
|
|
||||||
private List<UserBoss> userBossList;
|
|
||||||
private List<UserTechCount> userTechCountList;
|
|
||||||
private List<UserRival> userRivalList;
|
|
||||||
}
|
|
|
@ -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> T convert(Object object, TypeReference<T> toClass) {
|
|
||||||
return mapper.convertValue(object, toClass);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue