mirror of
https://github.com/MewoLab/AquaDX.git
synced 2025-12-14 11:56:15 +08:00
Ongeki Refactor (#134)
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -83,3 +83,4 @@ src/main/resources/meta/*/*.json
|
||||
*.salive
|
||||
test-diff
|
||||
htmlReport
|
||||
docs/logs
|
||||
|
||||
13
docs/dev/kt.md
Normal file
13
docs/dev/kt.md
Normal file
@@ -0,0 +1,13 @@
|
||||
```regexp
|
||||
(var \w+) = 0
|
||||
$1: Int = 0
|
||||
|
||||
\= false
|
||||
: Bool = false
|
||||
|
||||
(var [\w: =?"]+[^,])\n
|
||||
$1,\n
|
||||
|
||||
(var \w+) \= \"\"
|
||||
$1: String = ""
|
||||
```
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import icu.samnyan.aqua.sega.general.dao.CardRepository
|
||||
import icu.samnyan.aqua.sega.general.model.Card
|
||||
import icu.samnyan.aqua.sega.general.service.CardService
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo
|
||||
import icu.samnyan.aqua.sega.ongeki.OgkUserDataRepo
|
||||
import icu.samnyan.aqua.sega.wacca.model.db.WcUserRepo
|
||||
import jakarta.persistence.EntityManager
|
||||
import org.springframework.scheduling.annotation.Scheduled
|
||||
@@ -176,7 +177,7 @@ class CardGameService(
|
||||
val maimai2: Mai2UserDataRepo,
|
||||
val chusan: Chu3UserDataRepo,
|
||||
val wacca: WcUserRepo,
|
||||
val ongeki: icu.samnyan.aqua.sega.ongeki.dao.userdata.UserDataRepository,
|
||||
val ongeki: OgkUserDataRepo,
|
||||
val diva: icu.samnyan.aqua.sega.diva.dao.userdata.PlayerProfileRepository,
|
||||
val safety: AquaNetSafetyService,
|
||||
val cardRepo: CardRepository,
|
||||
|
||||
@@ -3,7 +3,7 @@ package icu.samnyan.aqua.net.games.chu3
|
||||
import ext.API
|
||||
import ext.returns
|
||||
import ext.vars
|
||||
import icu.samnyan.aqua.api.model.resp.sega.chuni.v2.external.Chu3DataExport
|
||||
import icu.samnyan.aqua.net.games.IExportClass
|
||||
import icu.samnyan.aqua.net.games.ImportClass
|
||||
import icu.samnyan.aqua.net.games.ImportController
|
||||
import icu.samnyan.aqua.sega.chusan.model.Chu3Repos
|
||||
@@ -48,4 +48,23 @@ class Chu3Import(
|
||||
) {
|
||||
override fun createEmpty() = Chu3DataExport()
|
||||
override val userDataRepo = repos.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())
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package icu.samnyan.aqua.net.games.mai2
|
||||
import ext.API
|
||||
import ext.returns
|
||||
import ext.vars
|
||||
import icu.samnyan.aqua.api.model.resp.sega.maimai2.external.Maimai2DataExport
|
||||
import icu.samnyan.aqua.net.games.IExportClass
|
||||
import icu.samnyan.aqua.net.games.ImportClass
|
||||
import icu.samnyan.aqua.net.games.ImportController
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||
@@ -49,3 +49,29 @@ class Mai2Import(
|
||||
override fun createEmpty() = Maimai2DataExport()
|
||||
override val userDataRepo = repos.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())
|
||||
}
|
||||
@@ -4,21 +4,21 @@ import ext.API
|
||||
import icu.samnyan.aqua.net.db.AquaUserServices
|
||||
import icu.samnyan.aqua.net.games.*
|
||||
import icu.samnyan.aqua.net.utils.*
|
||||
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserDataRepository
|
||||
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserGeneralDataRepository
|
||||
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserMusicDetailRepository
|
||||
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserPlaylogRepository
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData
|
||||
import icu.samnyan.aqua.sega.ongeki.OgkUserDataRepo
|
||||
import icu.samnyan.aqua.sega.ongeki.OgkUserGeneralDataRepo
|
||||
import icu.samnyan.aqua.sega.ongeki.OgkUserMusicDetailRepo
|
||||
import icu.samnyan.aqua.sega.ongeki.OgkUserPlaylogRepo
|
||||
import icu.samnyan.aqua.sega.ongeki.model.UserData
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
@API("api/v2/game/ongeki")
|
||||
class Ongeki(
|
||||
override val us: AquaUserServices,
|
||||
override val playlogRepo: UserPlaylogRepository,
|
||||
override val userDataRepo: UserDataRepository,
|
||||
override val userMusicRepo: UserMusicDetailRepository,
|
||||
val userGeneralDataRepository: UserGeneralDataRepository
|
||||
override val playlogRepo: OgkUserPlaylogRepo,
|
||||
override val userDataRepo: OgkUserDataRepo,
|
||||
override val userMusicRepo: OgkUserMusicDetailRepo,
|
||||
val userGeneralDataRepository: OgkUserGeneralDataRepo
|
||||
): GameApiController<UserData>("ongeki", UserData::class) {
|
||||
override suspend fun trend(username: String) = us.cardByName(username) { card ->
|
||||
findTrend(playlogRepo.findByUser_Card_ExtId(card.extId)
|
||||
@@ -27,7 +27,10 @@ class Ongeki(
|
||||
|
||||
override val shownRanks = ongekiScores.filter { it.first >= 950000 }
|
||||
override val settableFields: Map<String, (UserData, String) -> Unit> by lazy { mapOf(
|
||||
"userName" to usernameCheck(SEGA_USERNAME_CAHRS)
|
||||
"userName" to usernameCheck(SEGA_USERNAME_CAHRS),
|
||||
|
||||
"lastRomVersion" to { u, v -> u.lastRomVersion = v },
|
||||
"lastDataVersion" to { u, v -> u.lastDataVersion = v },
|
||||
) }
|
||||
|
||||
override suspend fun userSummary(username: String, token: String?) = us.cardByName(username) { card ->
|
||||
|
||||
@@ -20,6 +20,8 @@ class Wacca(
|
||||
): GameApiController<WaccaUser>("wacca", WaccaUser::class) {
|
||||
override val settableFields: Map<String, (WaccaUser, String) -> Unit> by lazy { mapOf(
|
||||
"userName" to usernameCheck(WACCA_USERNAME_CHARS),
|
||||
|
||||
"lastRomVersion" to { u, v -> u.lastRomVersion = v },
|
||||
) }
|
||||
|
||||
override suspend fun trend(@RP username: String) = us.cardByName(username) { card ->
|
||||
|
||||
@@ -9,8 +9,8 @@ import icu.samnyan.aqua.sega.maimai2.model.request.Mai2UserAll
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserFavorite
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserItem
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserMusicDetail
|
||||
import icu.samnyan.aqua.sega.ongeki.model.request.UpsertUserAll
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserItem
|
||||
import icu.samnyan.aqua.sega.ongeki.model.OngekiUpsertUserAll
|
||||
import icu.samnyan.aqua.sega.ongeki.model.UserItem
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper
|
||||
import icu.samnyan.aqua.sega.util.jackson.IMapper
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper
|
||||
@@ -134,7 +134,7 @@ class OngekiDataBroker(allNet: AllNetClient, log: (String) -> Unit): DataBroker(
|
||||
override fun pull(): String {
|
||||
val (userId, paged) = prePull()
|
||||
|
||||
return UpsertUserAll().apply {
|
||||
return OngekiUpsertUserAll().apply {
|
||||
userData = ls("GetUserDataApi".get("userData", userId))
|
||||
userOption = ls("GetUserOptionApi".get("userOption", userId))
|
||||
userMusicItemList = "GetUserMusicItemApi".get("userMusicItemList", paged)
|
||||
|
||||
@@ -182,7 +182,7 @@ class AllNet(
|
||||
"SDHD" -> "chu3/$ver/"
|
||||
"SDGS" -> "chu3/$ver/" // International (c3exp)
|
||||
"SBZV" -> "diva/"
|
||||
"SDDT" -> "ongeki/"
|
||||
"SDDT" -> "ongeki/$ver/"
|
||||
"SDEY" -> "mai/"
|
||||
"SDGA" -> "mai2/" // International (Exp)
|
||||
"SDGB" -> "mai2/" // International (China) - TODO: Test it
|
||||
|
||||
@@ -37,6 +37,7 @@ class TokenChecker(
|
||||
|
||||
private val currentSession = ThreadLocal<KeychipSession?>()
|
||||
fun getCurrentSession() = currentSession.get()
|
||||
fun tokenShort() = getCurrentSession()?.token?.substring(0, 6) ?: "NO-TOKEN"
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,19 +59,19 @@ class ChusanController(
|
||||
}
|
||||
|
||||
if (api.startsWith("CM") && api !in handlers) api = api.removePrefix("CM")
|
||||
val token = TokenChecker.getCurrentSession()?.token?.substring(0, 6) ?: "NO-TOKEN"
|
||||
log.info("Chu3 < $api : ${data.toJson()} : [$token]")
|
||||
val token = TokenChecker.tokenShort()
|
||||
log.info("$token : $api < ${data.toJson()}")
|
||||
|
||||
val noop = """{"returnCode":"1","apiName":"$api"}"""
|
||||
if (api !in noopEndpoint && !handlers.containsKey(api)) {
|
||||
log.warn("Chu3 > $api not found")
|
||||
log.warn("$token : $api > not found")
|
||||
return noop
|
||||
}
|
||||
|
||||
// Only record the counter metrics if the API is known.
|
||||
Metrics.counter("aquadx_chusan_api_call", "api" to api).increment()
|
||||
if (api in noopEndpoint) {
|
||||
log.info("Chu3 > $api no-op")
|
||||
log.info("$token : $api > no-op")
|
||||
return noop
|
||||
}
|
||||
|
||||
@@ -79,14 +79,11 @@ class ChusanController(
|
||||
Metrics.timer("aquadx_chusan_api_latency", "api" to api).recordCallable {
|
||||
serialize(api, handlers[api]!!(ctx) ?: noop).also {
|
||||
if (api !in setOf("GetUserItemApi", "GetGameEventApi"))
|
||||
log.info("Chu3 > $api : $it")
|
||||
log.info("$token : $api > ${it.truncate(500)}")
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Metrics.counter(
|
||||
"aquadx_chusan_api_error",
|
||||
"api" to api, "error" to e.simpleDescribe()
|
||||
).increment()
|
||||
Metrics.counter("aquadx_chusan_api_error", "api" to api, "error" to e.simpleDescribe()).increment()
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ typealias SpecialHandler = RequestContext.() -> Any?
|
||||
fun BaseHandler.toSpecial() = { ctx: RequestContext -> handle(ctx.data) }
|
||||
|
||||
typealias PagedHandler = RequestContext.() -> List<Any>
|
||||
typealias PagedExtraHandler = RequestContext.() -> Pair<List<Any>, JDict>
|
||||
typealias AddFn = RequestContext.() -> PagedProcessor
|
||||
typealias PagePost = (MutJDict) -> Unit
|
||||
data class PagedProcessor(val add: JDict?, val fn: PagedHandler, var post: PagePost? = null)
|
||||
@@ -75,4 +76,21 @@ abstract class MeowApi(val serialize: (String, Any) -> String) {
|
||||
val minTime = millis() - (1000 * 60)
|
||||
pageCache.entries.removeIf { it.value.l < minTime }
|
||||
}
|
||||
|
||||
// Used because maimai and ongeki does not actually require paging implementation
|
||||
fun String.unpaged(key: String? = null, fn: PagedHandler) {
|
||||
val k = key ?: (this.replace("Get", "").firstCharLower() + "List")
|
||||
this {
|
||||
val l = fn(this)
|
||||
mapOf("userId" to uid, "nextIndex" to 0, "length" to l.size, k to l)
|
||||
}
|
||||
}
|
||||
|
||||
fun String.unpagedExtra(key: String? = null, fn: PagedExtraHandler) {
|
||||
val k = key ?: (this.replace("Get", "").firstCharLower() + "List")
|
||||
this {
|
||||
val (l, e) = fn(this)
|
||||
mapOf("userId" to uid, "nextIndex" to 0, "length" to l.size, k to l) + e
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,4 +15,9 @@ public class UserRecentRating {
|
||||
private int difficultId;
|
||||
private String romVersionCode;
|
||||
private int score;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return musicId + ":" + difficultId + ":" + score;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,21 +3,12 @@
|
||||
package icu.samnyan.aqua.sega.maimai2
|
||||
|
||||
import ext.*
|
||||
import icu.samnyan.aqua.sega.general.PagedHandler
|
||||
import icu.samnyan.aqua.sega.maimai2.model.UserRivalMusic
|
||||
import icu.samnyan.aqua.sega.maimai2.model.UserRivalMusicDetail
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserKaleidx
|
||||
import java.time.LocalDate
|
||||
|
||||
fun Maimai2ServletController.initApis() {
|
||||
// Used because maimai does not actually require paging implementation
|
||||
fun String.unpaged(key: String? = null, fn: PagedHandler) {
|
||||
val k = key ?: (this.replace("Get", "").firstCharLower() + "List")
|
||||
this {
|
||||
fn(this).let { mapOf("userId" to uid, "nextIndex" to 0, "length" to it.size, k to it) }
|
||||
}
|
||||
}
|
||||
|
||||
"GetUserExtend" { mapOf(
|
||||
"userId" to uid,
|
||||
"userExtend" to (db.userExtend.findSingleByUser_Card_ExtId(uid)() ?: (404 - "User not found"))
|
||||
|
||||
@@ -4,13 +4,13 @@ import ext.*
|
||||
import icu.samnyan.aqua.net.games.mai2.Maimai2
|
||||
import icu.samnyan.aqua.net.utils.ApiException
|
||||
import icu.samnyan.aqua.net.utils.simpleDescribe
|
||||
import icu.samnyan.aqua.sega.allnet.TokenChecker
|
||||
import icu.samnyan.aqua.sega.general.*
|
||||
import icu.samnyan.aqua.sega.maimai2.handler.*
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||
import icu.samnyan.aqua.spring.Metrics
|
||||
import io.ktor.client.request.*
|
||||
import jakarta.servlet.http.HttpServletRequest
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.web.bind.annotation.*
|
||||
import java.time.format.DateTimeFormatter
|
||||
import kotlin.reflect.full.declaredMemberProperties
|
||||
@@ -38,7 +38,7 @@ class Maimai2ServletController(
|
||||
): MeowApi(serialize = { _, resp -> if (resp is String) resp else resp.toJson() }) {
|
||||
|
||||
companion object {
|
||||
private val logger = LoggerFactory.getLogger(Maimai2ServletController::class.java)
|
||||
private val log = logger()
|
||||
private val empty = listOf<Any>()
|
||||
private val GAME_SETTING_DATE_FMT = DateTimeFormatter.ofPattern("2010-01-01 HH:mm:00.0")
|
||||
private val GAME_SETTING_TIME_FMT = DateTimeFormatter.ofPattern("HH:mm:00")
|
||||
@@ -67,10 +67,12 @@ class Maimai2ServletController(
|
||||
|
||||
@API("/{api}")
|
||||
fun handle(@PathVariable api: String, @RequestBody data: Map<String, Any>, req: HttpServletRequest): Any {
|
||||
logger.info("Mai2 < $api : ${data.toJson()}") // TODO: Optimize logging
|
||||
val token = TokenChecker.tokenShort()
|
||||
log.info("$token : $api < ${data.toJson()}")
|
||||
|
||||
val noop = """{"returnCode":1,"apiName":"com.sega.maimai2servlet.api.$api"}"""
|
||||
if (api !in noopEndpoint && !handlers.containsKey(api)) {
|
||||
logger.warn("Mai2 > $api not found")
|
||||
log.warn("$token : $api > not found")
|
||||
return noop
|
||||
}
|
||||
|
||||
@@ -78,7 +80,7 @@ class Maimai2ServletController(
|
||||
Metrics.counter("aquadx_maimai2_api_call", "api" to api).increment()
|
||||
|
||||
if (api in noopEndpoint) {
|
||||
logger.info("Mai2 > $api no-op")
|
||||
log.info("$token : $api > no-op")
|
||||
return noop
|
||||
}
|
||||
|
||||
@@ -86,7 +88,7 @@ class Maimai2ServletController(
|
||||
Metrics.timer("aquadx_maimai2_api_latency", "api" to api).recordCallable {
|
||||
val ctx = RequestContext(req, data.mut)
|
||||
serialize(api, handlers[api]!!(ctx) ?: noop).also {
|
||||
logger.info("Mai2 > $api : ${it.truncate(1000)}")
|
||||
log.info("$token : $api > ${it.truncate(500)}")
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
||||
72
src/main/java/icu/samnyan/aqua/sega/ongeki/OngekiApis.kt
Normal file
72
src/main/java/icu/samnyan/aqua/sega/ongeki/OngekiApis.kt
Normal file
@@ -0,0 +1,72 @@
|
||||
package icu.samnyan.aqua.sega.ongeki
|
||||
|
||||
import ext.empty
|
||||
import ext.int
|
||||
import ext.parsing
|
||||
import ext.plus
|
||||
|
||||
fun OngekiController.ongekiInit() {
|
||||
fun <T> List<T>.staticLst(key: String) = mapOf("length" to size, key to this)
|
||||
|
||||
initUser()
|
||||
initUpsertAll()
|
||||
|
||||
// Has type, but type is always 1
|
||||
"GetGameEvent".static {
|
||||
gdb.event.findAll().map {
|
||||
mapOf("id" to it.id, "type" to 1, "startDate" to "2005-01-01 00:00:00.0", "endDate" to "2099-01-01 05:00:00.0")
|
||||
}.staticLst("gameEventList") + mapOf("type" to 1)
|
||||
}
|
||||
|
||||
"GetGamePoint".static { gdb.point.findAll().staticLst("gamePointList") }
|
||||
"GetGamePresent".static { gdb.present.findAll().staticLst("gamePresentList") }
|
||||
"GetGameReward".static { gdb.reward.findAll().staticLst("gameRewardList") }
|
||||
|
||||
// Dummy endpoints
|
||||
"GetGameTechMusic".static { empty.staticLst("gameTechMusicList") }
|
||||
"GetGameMessage" { mapOf("type" to data["type"], "length" to 0, "gameMessageList" to empty) }
|
||||
"GetGameMusicReleaseState".static { mapOf("techScore" to 0, "cardNum" to 0) }
|
||||
|
||||
"GetGameIdlist" {
|
||||
// type 1: Music NG List, 2: Music Recommend List
|
||||
val type = parsing { data["type"]!!.int }
|
||||
empty.staticLst("gameIdlistList") + mapOf("type" to type)
|
||||
}
|
||||
|
||||
"GetGameRanking" {
|
||||
// type 1: Music current ranking, 2: Music past ranking
|
||||
val type = parsing { data["type"]!!.int }
|
||||
empty.staticLst("gameRankingList") + mapOf("type" to type)
|
||||
}
|
||||
|
||||
"GetGameSetting" {
|
||||
val ver = (data["version"] ?: "1.50.00")
|
||||
mapOf(
|
||||
"isAou" to false,
|
||||
"isDumpUpload" to false,
|
||||
"gameSetting" to mapOf(
|
||||
"dataVersion" to ver,
|
||||
"onlineDataVersion" to ver,
|
||||
"isMaintenance" to false,
|
||||
"requestInterval" to 10,
|
||||
"rebootStartTime" to "2020-01-01 23:59:00.0",
|
||||
"rebootEndTime" to "2020-01-01 23:59:00.0",
|
||||
"isBackgroundDistribute" to false,
|
||||
"maxCountCharacter" to 50,
|
||||
"maxCountCard" to 300,
|
||||
"maxCountItem" to 300,
|
||||
"maxCountMusic" to 50,
|
||||
"maxCountMusicItem" to 300,
|
||||
"maxCountRivalMusic" to 300
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
"GetClientBookkeeping" {
|
||||
empty.staticLst("clientBookkeepingList") + mapOf("placeId" to data["placeId"])
|
||||
}
|
||||
|
||||
"GetClientTestmode" {
|
||||
empty.staticLst("clientTestmodeList") + mapOf("placeId" to data["placeId"])
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package icu.samnyan.aqua.sega.ongeki
|
||||
|
||||
import ext.*
|
||||
import icu.samnyan.aqua.net.db.AquaUserServices
|
||||
import icu.samnyan.aqua.net.utils.simpleDescribe
|
||||
import icu.samnyan.aqua.sega.allnet.TokenChecker
|
||||
import icu.samnyan.aqua.sega.general.GameMusicPopularity
|
||||
import icu.samnyan.aqua.sega.general.MeowApi
|
||||
import icu.samnyan.aqua.sega.general.RequestContext
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper
|
||||
import icu.samnyan.aqua.spring.Metrics
|
||||
import jakarta.servlet.http.HttpServletRequest
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import kotlin.collections.set
|
||||
|
||||
@Suppress("unused")
|
||||
@RestController
|
||||
@API("/g/ongeki/{version}", "/g/ongeki")
|
||||
class OngekiController(
|
||||
val mapper: BasicMapper,
|
||||
val db: OngekiUserRepos,
|
||||
val gdb: OngekiGameRepos,
|
||||
val us: AquaUserServices,
|
||||
val pop: GameMusicPopularity,
|
||||
): MeowApi({ _, resp -> if (resp is String) resp else mapper.write(resp) }) {
|
||||
|
||||
val log = logger()
|
||||
|
||||
val noopEndpoint = setOf("ExtendLockTimeApi", "GameLoginApi", "GameLogoutApi", "RegisterPromotionCardApi",
|
||||
"UpsertClientBookkeepingApi", "UpsertClientDevelopApi", "UpsertClientErrorApi", "UpsertClientSettingApi",
|
||||
"UpsertClientTestmodeApi", "UpsertUserGplogApi", "Ping")
|
||||
|
||||
init { ongekiInit() }
|
||||
val handlers = initH
|
||||
|
||||
@API("/{api}")
|
||||
fun handle(@PV api: Str, @RB data: MutableMap<Str, Any>, @PV version: Str?, req: HttpServletRequest): Any {
|
||||
val ctx = RequestContext(req, data)
|
||||
version?.let { data["version"] = it }
|
||||
|
||||
val token = TokenChecker.tokenShort()
|
||||
log.info("$token : $api < ${data.toJson()}")
|
||||
|
||||
val noop = """{"returnCode":1,"apiName":"${api.substringBefore("Api").firstCharLower()}"}"""
|
||||
if (api !in noopEndpoint && !handlers.containsKey(api)) {
|
||||
log.warn("$token : $api > not found")
|
||||
return noop
|
||||
}
|
||||
|
||||
// Only record the counter metrics if the API is known.
|
||||
Metrics.counter("aquadx_ongeki_api_call", "api" to api).increment()
|
||||
if (api in noopEndpoint) {
|
||||
log.info("$token : $api > no-op")
|
||||
return noop
|
||||
}
|
||||
|
||||
return try {
|
||||
Metrics.timer("aquadx_ongeki_api_latency", "api" to api).recordCallable {
|
||||
serialize(api, handlers[api]!!(ctx) ?: noop).also {
|
||||
if (api !in setOf("GetUserItemApi", "GetGameEventApi"))
|
||||
log.info("$token : $api > ${it.truncate(500)}")
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Metrics.counter("aquadx_ongeki_api_error", "api" to api, "error" to e.simpleDescribe()).increment()
|
||||
throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
212
src/main/java/icu/samnyan/aqua/sega/ongeki/OngekiRepos.kt
Normal file
212
src/main/java/icu/samnyan/aqua/sega/ongeki/OngekiRepos.kt
Normal file
@@ -0,0 +1,212 @@
|
||||
@file:Suppress("FunctionName")
|
||||
package icu.samnyan.aqua.sega.ongeki
|
||||
|
||||
import icu.samnyan.aqua.net.games.GenericPlaylogRepo
|
||||
import icu.samnyan.aqua.net.games.GenericUserDataRepo
|
||||
import icu.samnyan.aqua.net.games.GenericUserMusicRepo
|
||||
import icu.samnyan.aqua.net.games.IUserRepo
|
||||
import icu.samnyan.aqua.sega.ongeki.model.*
|
||||
import icu.samnyan.aqua.sega.ongeki.model.UserEventMap
|
||||
import icu.samnyan.aqua.sega.ongeki.model.UserSkin
|
||||
import org.springframework.data.domain.Page
|
||||
import org.springframework.data.domain.Pageable
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import org.springframework.data.jpa.repository.Query
|
||||
import org.springframework.data.repository.NoRepositoryBean
|
||||
import org.springframework.stereotype.Component
|
||||
import java.util.*
|
||||
|
||||
|
||||
@NoRepositoryBean
|
||||
interface OngekiUserLinked<T> : IUserRepo<UserData, T> {
|
||||
fun findByUser_Card_ExtId(extId: Long): List<T>
|
||||
fun findSingleByUser_Card_ExtId(extId: Long): Optional<T>
|
||||
fun findByUser_Card_ExtId(extId: Long, pageable: Pageable): Page<T>
|
||||
}
|
||||
|
||||
interface OgkUserDataRepo : GenericUserDataRepo<UserData> {
|
||||
fun findByCard_ExtIdIn(userIds: Collection<Long>): List<UserData>
|
||||
}
|
||||
|
||||
interface OgkUserActivityRepo : OngekiUserLinked<UserActivity> {
|
||||
fun findByUserAndKindAndActivityId(userData: UserData, kind: Int, activityId: Int): Optional<UserActivity>
|
||||
fun findByUser_Card_ExtIdAndKindOrderBySortNumberDesc(userId: Long, kind: Int): List<UserActivity>
|
||||
}
|
||||
|
||||
interface OgkUserBossRepo : OngekiUserLinked<UserBoss> {
|
||||
fun findByUserAndMusicId(user: UserData, musicId: Int): Optional<UserBoss>
|
||||
}
|
||||
|
||||
interface OgkUserCardRepo : OngekiUserLinked<UserCard> {
|
||||
fun findByUserAndCardId(userData: UserData, cardId: Int): Optional<UserCard>
|
||||
}
|
||||
|
||||
interface OgkUserChapterRepo : OngekiUserLinked<UserChapter> {
|
||||
fun findByUserAndChapterId(userData: UserData, chapterId: Int): Optional<UserChapter>
|
||||
}
|
||||
|
||||
interface OgkUserCharacterRepo : OngekiUserLinked<UserCharacter> {
|
||||
fun findByUserAndCharacterId(userData: UserData, characterId: Int): Optional<UserCharacter>
|
||||
}
|
||||
|
||||
interface OgkUserDeckRepo : OngekiUserLinked<UserDeck> {
|
||||
fun findByUserAndDeckId(userData: UserData, deckId: Int): Optional<UserDeck>
|
||||
}
|
||||
|
||||
interface OgkUserEventMusicRepo : OngekiUserLinked<UserEventMusic> {
|
||||
fun findByUserAndEventIdAndTypeAndMusicId(
|
||||
userData: UserData,
|
||||
eventId: Int,
|
||||
type: Int,
|
||||
musicId: Int
|
||||
): Optional<UserEventMusic>
|
||||
}
|
||||
|
||||
interface OgkUserEventPointRepo : OngekiUserLinked<UserEventPoint> {
|
||||
fun findByUserAndEventId(userData: UserData, eventId: Int): Optional<UserEventPoint>
|
||||
|
||||
//@Query(value = "SELECT rank from (SELECT user_id , DENSE_RANK() OVER (ORDER BY point DESC) as rank from ongeki_user_event_point where event_id = :eventId) where user_id == :userId limit 1", nativeQuery = true)
|
||||
@Query("SELECT COUNT(u)+1 FROM OngekiUserEventPoint u WHERE u.eventId = :eventId AND u.point > (SELECT u2.point FROM OngekiUserEventPoint u2 WHERE u2.user.id = :userId AND u2.eventId = :eventId)")
|
||||
fun calculateRankByUserAndEventId(userId: Long, eventId: Int): Int
|
||||
}
|
||||
|
||||
interface OgkUserGeneralDataRepo : OngekiUserLinked<UserGeneralData> {
|
||||
fun findByUserAndPropertyKey(user: UserData, key: String): Optional<UserGeneralData>
|
||||
|
||||
fun findByUser_Card_ExtIdAndPropertyKey(userId: Long, key: String): Optional<UserGeneralData>
|
||||
}
|
||||
|
||||
interface OgkUserItemRepo : OngekiUserLinked<UserItem> {
|
||||
fun findByUserAndItemKindAndItemId(userData: UserData, itemKind: Int, itemId: Int): Optional<UserItem>
|
||||
|
||||
fun findByUser_Card_ExtIdAndItemKind(userId: Long, kind: Int, page: Pageable): Page<UserItem>
|
||||
fun findByUser_Card_ExtIdAndItemKind(userId: Long, kind: Int): List<UserItem>
|
||||
}
|
||||
|
||||
interface OgkUserKopRepo : OngekiUserLinked<UserKop> {
|
||||
fun findByUserAndKopIdAndAreaId(userData: UserData, kopId: Int, areaId: Int): Optional<UserKop>
|
||||
}
|
||||
|
||||
interface OgkUserLoginBonusRepo : OngekiUserLinked<UserLoginBonus> {
|
||||
fun findByUserAndBonusId(userData: UserData, bonusId: Int): Optional<UserLoginBonus>
|
||||
}
|
||||
|
||||
interface OgkUserMemoryChapterRepo : OngekiUserLinked<UserMemoryChapter> {
|
||||
fun findByUserAndChapterId(userData: UserData, chapterId: Int): Optional<UserMemoryChapter>
|
||||
}
|
||||
|
||||
interface OgkUserMissionPointRepo : OngekiUserLinked<UserMissionPoint> {
|
||||
fun findByUserAndEventId(userData: UserData, eventId: Int): Optional<UserMissionPoint>
|
||||
}
|
||||
|
||||
interface OgkUserMusicDetailRepo : OngekiUserLinked<UserMusicDetail>, GenericUserMusicRepo<UserMusicDetail> {
|
||||
fun findByUserAndMusicIdAndLevel(userData: UserData, musicId: Int, level: Int): Optional<UserMusicDetail>
|
||||
}
|
||||
|
||||
interface OgkUserMusicItemRepo : OngekiUserLinked<UserMusicItem> {
|
||||
fun findByUserAndMusicId(userData: UserData, musicId: Int): Optional<UserMusicItem>
|
||||
}
|
||||
|
||||
interface OgkUserOptionRepo : OngekiUserLinked<UserOption>
|
||||
|
||||
interface OgkUserPlaylogRepo : OngekiUserLinked<UserPlaylog>, GenericPlaylogRepo<UserPlaylog>
|
||||
|
||||
interface OgkUserRivalDataRepo : OngekiUserLinked<UserRival>
|
||||
|
||||
interface OgkUserScenarioRepo : OngekiUserLinked<UserScenario> {
|
||||
fun findByUserAndScenarioId(user: UserData, scenarioId: Int): Optional<UserScenario>
|
||||
}
|
||||
|
||||
interface OgkUserStoryRepo : OngekiUserLinked<UserStory> {
|
||||
fun findByUserAndStoryId(userData: UserData, storyId: Int): Optional<UserStory>
|
||||
}
|
||||
|
||||
interface OgkUserTechCountRepo : OngekiUserLinked<UserTechCount> {
|
||||
fun findByUserAndLevelId(user: UserData, levelId: Int): Optional<UserTechCount>
|
||||
}
|
||||
|
||||
interface OgkUserTechEventRepo : OngekiUserLinked<UserTechEvent> {
|
||||
fun findByUserAndEventId(userData: UserData, eventId: Int): Optional<UserTechEvent>
|
||||
}
|
||||
|
||||
interface OgkUserTradeItemRepo : OngekiUserLinked<UserTradeItem> {
|
||||
fun findByUser_Card_ExtIdAndChapterIdGreaterThanEqualAndChapterIdLessThanEqual(
|
||||
userId: Long,
|
||||
startChapterId: Int,
|
||||
endChapterId: Int
|
||||
): List<UserTradeItem>
|
||||
|
||||
fun findByUserAndChapterIdAndTradeItemId(
|
||||
userData: UserData,
|
||||
chapterId: Int,
|
||||
tradeItemId: Int
|
||||
): Optional<UserTradeItem>
|
||||
}
|
||||
|
||||
interface OgkUserTrainingRoomRepo : OngekiUserLinked<UserTrainingRoom> {
|
||||
fun findByUserAndRoomId(user: UserData, roomId: Int): Optional<UserTrainingRoom>
|
||||
}
|
||||
|
||||
// Re:Fresh
|
||||
interface OgkUserEventMapRepo : OngekiUserLinked<UserEventMap>
|
||||
interface OgkUserSkinRepo : OngekiUserLinked<UserSkin>
|
||||
|
||||
interface OgkGameCardRepo : JpaRepository<GameCard, Long>
|
||||
interface OgkGameCharaRepo : JpaRepository<GameChara, Long>
|
||||
interface OgkGameEventRepo : JpaRepository<GameEvent, Long>
|
||||
interface OgkGameMusicRepo : JpaRepository<GameMusic, Long>
|
||||
interface OgkGamePointRepo : JpaRepository<GamePoint, Long>
|
||||
interface OgkGamePresentRepo : JpaRepository<GamePresent, Long>
|
||||
interface OgkGameRewardRepo : JpaRepository<GameReward, Long>
|
||||
interface OgkGameSkillRepo : JpaRepository<GameSkill, Long>
|
||||
|
||||
@Component
|
||||
class OngekiUserRepos(
|
||||
val data: OgkUserDataRepo,
|
||||
val activity: OgkUserActivityRepo,
|
||||
val boss: OgkUserBossRepo,
|
||||
val card: OgkUserCardRepo,
|
||||
val chapter: OgkUserChapterRepo,
|
||||
val character: OgkUserCharacterRepo,
|
||||
val deck: OgkUserDeckRepo,
|
||||
val eventMusic: OgkUserEventMusicRepo,
|
||||
val eventPoint: OgkUserEventPointRepo,
|
||||
val generalData: OgkUserGeneralDataRepo,
|
||||
val item: OgkUserItemRepo,
|
||||
val kop: OgkUserKopRepo,
|
||||
val loginBonus: OgkUserLoginBonusRepo,
|
||||
val memoryChapter: OgkUserMemoryChapterRepo,
|
||||
val missionPoint: OgkUserMissionPointRepo,
|
||||
val musicDetail: OgkUserMusicDetailRepo,
|
||||
val musicItem: OgkUserMusicItemRepo,
|
||||
val option: OgkUserOptionRepo,
|
||||
val playlog: OgkUserPlaylogRepo,
|
||||
val rivalData: OgkUserRivalDataRepo,
|
||||
val scenario: OgkUserScenarioRepo,
|
||||
val story: OgkUserStoryRepo,
|
||||
val techCount: OgkUserTechCountRepo,
|
||||
val techEvent: OgkUserTechEventRepo,
|
||||
val tradeItem: OgkUserTradeItemRepo,
|
||||
val trainingRoom: OgkUserTrainingRoomRepo,
|
||||
val eventMap: OgkUserEventMapRepo,
|
||||
val skin: OgkUserSkinRepo,
|
||||
)
|
||||
|
||||
@Component
|
||||
class OngekiGameRepos(
|
||||
val card: OgkGameCardRepo,
|
||||
val chara: OgkGameCharaRepo,
|
||||
val event: OgkGameEventRepo,
|
||||
val music: OgkGameMusicRepo,
|
||||
val point: OgkGamePointRepo,
|
||||
val present: OgkGamePresentRepo,
|
||||
val reward: OgkGameRewardRepo,
|
||||
val skill: OgkGameSkillRepo,
|
||||
)
|
||||
|
||||
@Component
|
||||
class OngekiRepos(
|
||||
val u: OngekiUserRepos,
|
||||
val g: OngekiGameRepos,
|
||||
)
|
||||
|
||||
191
src/main/java/icu/samnyan/aqua/sega/ongeki/OngekiUpsertAllApi.kt
Normal file
191
src/main/java/icu/samnyan/aqua/sega/ongeki/OngekiUpsertAllApi.kt
Normal file
@@ -0,0 +1,191 @@
|
||||
package icu.samnyan.aqua.sega.ongeki
|
||||
|
||||
import ext.invoke
|
||||
import ext.mapApply
|
||||
import ext.minus
|
||||
import icu.samnyan.aqua.sega.ongeki.model.OngekiUpsertUserAll
|
||||
import icu.samnyan.aqua.sega.ongeki.model.UserData
|
||||
import icu.samnyan.aqua.sega.ongeki.model.UserGeneralData
|
||||
|
||||
|
||||
fun OngekiController.initUpsertAll() {
|
||||
fun saveGeneralData(items: List<Any>, u: UserData, key: String) {
|
||||
db.generalData.save(UserGeneralData().apply {
|
||||
id = db.generalData.findByUserAndPropertyKey(u, key)()?.id ?: 0
|
||||
user = u
|
||||
propertyKey = key
|
||||
propertyValue = items.joinToString(",")
|
||||
})
|
||||
}
|
||||
|
||||
"UpsertUserAll" api@ {
|
||||
val all: OngekiUpsertUserAll = mapper.convert(data["upsertUserAll"]!!)
|
||||
|
||||
// User data
|
||||
val oldUser = db.data.findByCard_ExtId(uid)()
|
||||
val u: UserData = all.userData?.get(0)?.apply {
|
||||
id = oldUser?.id ?: 0
|
||||
card = oldUser?.card ?: us.cardRepo.findByExtId(uid)() ?: (404 - "Card not found")
|
||||
|
||||
// Set eventWatchedDate with lastPlayDate, because client doesn't update it
|
||||
eventWatchedDate = oldUser?.lastPlayDate ?: ""
|
||||
cmEventWatchedDate = oldUser?.lastPlayDate ?: ""
|
||||
db.data.save(this)
|
||||
} ?: oldUser ?: return@api null
|
||||
|
||||
all.run {
|
||||
// Set users
|
||||
listOfNotNull(
|
||||
userOption, userPlaylogList, userActivityList, userMusicDetailList, userCharacterList, userCardList,
|
||||
userDeckList, userTrainingRoomList, userStoryList, userChapterList, userMemoryChapterList, userItemList,
|
||||
userMusicItemList, userLoginBonusList, userEventPointList, userMissionPointList, userBossList,
|
||||
userTechCountList, userScenarioList, userTradeItemList, userEventMusicList, userTechEventList, userKopList,
|
||||
userEventMap?.let { listOf(it) }
|
||||
).flatten().forEach { it.user = u }
|
||||
|
||||
// UserOption
|
||||
userOption?.get(0)?.let {
|
||||
db.option.save(it.apply {
|
||||
id = db.option.findSingleByUser(u)()?.id ?: 0 }) }
|
||||
|
||||
// UserEventMap
|
||||
userEventMap?.let {
|
||||
db.eventMap.save(it.apply {
|
||||
id = db.eventMap.findSingleByUser(u)()?.id ?: 0 }) }
|
||||
|
||||
// UserPlaylogList
|
||||
userPlaylogList?.let { db.playlog.saveAll(it) }
|
||||
|
||||
// UserSessionlogList, UserJewelboostlogLost doesn't need to be saved for a private server
|
||||
|
||||
// Ratings
|
||||
mapOf(
|
||||
"recent_rating_list" to userRecentRatingList, // This thing still need to save to solve the rating drop
|
||||
"battle_point_base" to userBpBaseList, // For calculating Battle point
|
||||
"rating_base_best" to userRatingBaseBestList, // This is the best rating of all charts. Best 30 + 10 after that.
|
||||
"rating_base_next" to userRatingBaseNextList,
|
||||
"rating_base_new_best" to userRatingBaseBestNewList, // This is the best rating of new charts. Best 15 + 10 after that.
|
||||
"rating_base_new_next" to userRatingBaseNextNewList,
|
||||
"rating_base_hot_best" to userRatingBaseHotList, // This is the recent best
|
||||
"rating_base_hot_next" to userRatingBaseHotNextList,
|
||||
|
||||
// Re:Fresh
|
||||
"new_rating_base_best" to userNewRatingBaseBestList,
|
||||
"new_rating_base_next_best" to userNewRatingBaseNextBestList,
|
||||
"new_rating_base_new_best" to userNewRatingBaseBestNewList,
|
||||
"new_rating_base_new_next_best" to userNewRatingBaseNextBestNewList,
|
||||
"new_rating_base_pscore" to userNewRatingBasePScoreList,
|
||||
"new_rating_base_next_pscore" to userNewRatingBaseNextPScoreList
|
||||
).forEach { (k, v) -> v?.let { saveGeneralData(it, u, k) } }
|
||||
|
||||
// UserActivityList
|
||||
userActivityList?.let { list ->
|
||||
db.activity.saveAll(list.distinctBy { it.activityId to it.kind }.mapApply {
|
||||
id = db.activity.findByUserAndKindAndActivityId(u, kind, activityId)()?.id ?: 0 }) }
|
||||
|
||||
// UserMusicDetailList
|
||||
userMusicDetailList?.let { list ->
|
||||
db.musicDetail.saveAll(list.distinctBy { it.musicId to it.level }.mapApply {
|
||||
id = db.musicDetail.findByUserAndMusicIdAndLevel(u, musicId, level)()?.id ?: 0 }) }
|
||||
|
||||
// UserCharacterList
|
||||
userCharacterList?.let { list ->
|
||||
db.character.saveAll(list.distinctBy { it.characterId }.mapApply {
|
||||
id = db.character.findByUserAndCharacterId(u, characterId)()?.id ?: 0 }) }
|
||||
|
||||
// UserCardList
|
||||
userCardList?.let { list ->
|
||||
db.card.saveAll(list.distinctBy { it.cardId }.mapApply {
|
||||
id = db.card.findByUserAndCardId(u, cardId)()?.id ?: 0 }) }
|
||||
|
||||
// UserDeckList
|
||||
userDeckList?.let { list ->
|
||||
db.deck.saveAll(list.distinctBy { it.deckId }.mapApply {
|
||||
id = db.deck.findByUserAndDeckId(u, deckId)()?.id ?: 0 }) }
|
||||
|
||||
// UserTrainingRoomList
|
||||
userTrainingRoomList?.let { list ->
|
||||
db.trainingRoom.saveAll(list.distinctBy { it.roomId }.mapApply {
|
||||
id = db.trainingRoom.findByUserAndRoomId(u, roomId)()?.id ?: 0 }) }
|
||||
|
||||
// UserStoryList
|
||||
userStoryList?.let { list ->
|
||||
db.story.saveAll(list.distinctBy { it.storyId }.mapApply {
|
||||
id = db.story.findByUserAndStoryId(u, storyId)()?.id ?: 0 }) }
|
||||
|
||||
// UserChapterList
|
||||
userChapterList?.let { list ->
|
||||
db.chapter.saveAll(list.distinctBy { it.chapterId }.mapApply {
|
||||
id = db.chapter.findByUserAndChapterId(u, chapterId)()?.id ?: 0 }) }
|
||||
|
||||
// UserMemoryChapterList
|
||||
userMemoryChapterList?.let { list ->
|
||||
db.memoryChapter.saveAll(list.distinctBy { it.chapterId }.mapApply {
|
||||
id = db.memoryChapter.findByUserAndChapterId(u, chapterId)()?.id ?: 0 }) }
|
||||
|
||||
// UserItemList
|
||||
userItemList?.let { list ->
|
||||
db.item.saveAll(list.distinctBy { it.itemKind to it.itemId }.mapApply {
|
||||
id = db.item.findByUserAndItemKindAndItemId(u, itemKind, itemId)()?.id ?: 0 }) }
|
||||
|
||||
// UserMusicItemList
|
||||
userMusicItemList?.let { list ->
|
||||
db.musicItem.saveAll(list.distinctBy { it.musicId }.mapApply {
|
||||
id = db.musicItem.findByUserAndMusicId(u, musicId)()?.id ?: 0 }) }
|
||||
|
||||
// UserLoginBonusList
|
||||
userLoginBonusList?.let { list ->
|
||||
db.loginBonus.saveAll(list.distinctBy { it.bonusId }.mapApply {
|
||||
id = db.loginBonus.findByUserAndBonusId(u, bonusId)()?.id ?: 0 }) }
|
||||
|
||||
// UserEventPointList
|
||||
userEventPointList?.let { list ->
|
||||
db.eventPoint.saveAll(list.distinctBy { it.eventId }.mapApply {
|
||||
id = db.eventPoint.findByUserAndEventId(u, eventId)()?.id ?: 0 }) }
|
||||
|
||||
// UserMissionPointList
|
||||
userMissionPointList?.let { list ->
|
||||
db.missionPoint.saveAll(list.distinctBy { it.eventId }.mapApply {
|
||||
id = db.missionPoint.findByUserAndEventId(u, eventId)()?.id ?: 0 }) }
|
||||
|
||||
// UserRatinglogList (For the highest rating of each version)
|
||||
|
||||
// UserBossList
|
||||
userBossList?.let { list ->
|
||||
db.boss.saveAll(list.distinctBy { it.musicId }.mapApply {
|
||||
id = db.boss.findByUserAndMusicId(u, musicId)()?.id ?: 0 }) }
|
||||
|
||||
// UserTechCountList
|
||||
userTechCountList?.let { list ->
|
||||
db.techCount.saveAll(list.distinctBy { it.levelId }.mapApply {
|
||||
id = db.techCount.findByUserAndLevelId(u, levelId)()?.id ?: 0 }) }
|
||||
|
||||
// UserScenarioList
|
||||
userScenarioList?.let { list ->
|
||||
db.scenario.saveAll(list.distinctBy { it.scenarioId }.mapApply {
|
||||
id = db.scenario.findByUserAndScenarioId(u, scenarioId)()?.id ?: 0 }) }
|
||||
|
||||
// UserTradeItemList
|
||||
userTradeItemList?.let { list ->
|
||||
db.tradeItem.saveAll(list.distinctBy { it.chapterId to it.tradeItemId }.mapApply {
|
||||
id = db.tradeItem.findByUserAndChapterIdAndTradeItemId(u, chapterId, tradeItemId)()?.id ?: 0 }) }
|
||||
|
||||
// UserEventMusicList
|
||||
userEventMusicList?.let { list ->
|
||||
db.eventMusic.saveAll(list.distinctBy { it.eventId to it.type to it.musicId }.mapApply {
|
||||
id = db.eventMusic.findByUserAndEventIdAndTypeAndMusicId(u, eventId, type, musicId)()?.id ?: 0 }) }
|
||||
|
||||
// UserTechEventList
|
||||
userTechEventList?.let { list ->
|
||||
db.techEvent.saveAll(list.distinctBy { it.eventId }.mapApply {
|
||||
id = db.techEvent.findByUserAndEventId(u, eventId)()?.id ?: 0 }) }
|
||||
|
||||
// UserKopList
|
||||
userKopList?.let { list ->
|
||||
db.kop.saveAll(list.distinctBy { it.kopId to it.areaId }.mapApply {
|
||||
id = db.kop.findByUserAndKopIdAndAreaId(u, kopId, areaId)()?.id ?: 0 }) }
|
||||
}
|
||||
|
||||
null
|
||||
}
|
||||
}
|
||||
167
src/main/java/icu/samnyan/aqua/sega/ongeki/OngekiUserApis.kt
Normal file
167
src/main/java/icu/samnyan/aqua/sega/ongeki/OngekiUserApis.kt
Normal file
@@ -0,0 +1,167 @@
|
||||
@file:Suppress("UNCHECKED_CAST")
|
||||
|
||||
package icu.samnyan.aqua.sega.ongeki
|
||||
|
||||
import ext.*
|
||||
import icu.samnyan.aqua.sega.general.model.response.UserRecentRating
|
||||
import icu.samnyan.aqua.sega.ongeki.model.OgkItemType
|
||||
import icu.samnyan.aqua.sega.ongeki.model.UserItem
|
||||
import org.springframework.data.domain.PageRequest
|
||||
import org.springframework.data.domain.Sort
|
||||
import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
||||
|
||||
fun OngekiController.initUser() {
|
||||
"GetUserData" { mapOf("userId" to uid, "userData" to db.data.findByCard_ExtId(uid)()) }
|
||||
|
||||
"GetUserOption" { mapOf("userId" to uid, "userOption" to db.option.findSingleByUser_Card_ExtId(uid)()) }
|
||||
"GetUserEventMap" { mapOf("userId" to uid, "userEventMap" to db.eventMap.findSingleByUser_Card_ExtId(uid)()) }
|
||||
|
||||
"GetUserTechEvent".unpaged { db.techEvent.findByUser_Card_ExtId(uid) }
|
||||
"GetUserBoss".unpaged { db.boss.findByUser_Card_ExtId(uid) }
|
||||
"GetUserCard".unpaged { db.card.findByUser_Card_ExtId(uid) }
|
||||
"GetUserChapter".unpaged { db.chapter.findByUser_Card_ExtId(uid) }
|
||||
"GetUserMemoryChapter".unpaged { db.memoryChapter.findByUser_Card_ExtId(uid) }
|
||||
"GetUserCharacter".unpaged { db.character.findByUser_Card_ExtId(uid) }
|
||||
"GetUserDeckByKey".unpaged("userDeckList") { db.deck.findByUser_Card_ExtId(uid) }
|
||||
"GetUserEventMusic".unpaged { db.eventMusic.findByUser_Card_ExtId(uid) }
|
||||
"GetUserEventPoint".unpaged { db.eventPoint.findByUser_Card_ExtId(uid) }
|
||||
"GetUserKop".unpaged { db.kop.findByUser_Card_ExtId(uid) }
|
||||
"GetUserLoginBonus".unpaged { db.loginBonus.findByUser_Card_ExtId(uid) }
|
||||
"GetUserMissionPoint".unpaged { db.missionPoint.findByUser_Card_ExtId(uid) }
|
||||
"GetUserMusicItem".unpaged { db.musicItem.findByUser_Card_ExtId(uid) }
|
||||
"GetUserRival".unpaged { db.rivalData.findByUser_Card_ExtId(uid) }
|
||||
"GetUserScenario".unpaged { db.scenario.findByUser_Card_ExtId(uid) }
|
||||
"GetUserSkin".unpaged { db.skin.findByUser_Card_ExtId(uid) }
|
||||
"GetUserStory".unpaged { db.story.findByUser_Card_ExtId(uid) }
|
||||
"GetUserTechCount".unpaged { db.techCount.findByUser_Card_ExtId(uid) }
|
||||
"GetUserTrainingRoomByKey".unpaged("userTrainingRoomList") { db.trainingRoom.findByUser_Card_ExtId(uid) }
|
||||
|
||||
"GetUserBpBase".unpaged { empty }
|
||||
"GetUserRatinglog".unpaged { empty }
|
||||
"GetUserRegion".unpaged { empty }
|
||||
|
||||
"GetUserTradeItem".unpaged {
|
||||
val start = parsing { data["startChapterId"]!!.int }
|
||||
val end = parsing { data["endChapterId"]!!.int }
|
||||
|
||||
db.tradeItem.findByUser_Card_ExtIdAndChapterIdGreaterThanEqualAndChapterIdLessThanEqual(uid, start, end)
|
||||
}
|
||||
|
||||
val dtPattern = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.0")
|
||||
|
||||
"GetUserTechEventRanking".unpaged {
|
||||
val time = LocalDateTime.now().format(dtPattern)
|
||||
|
||||
db.techEvent.findByUser_Card_ExtId(uid).map { mapOf(
|
||||
"eventId" to it.eventId,
|
||||
"date" to time,
|
||||
"rank" to 1,
|
||||
"totalTechScore" to it.totalTechScore,
|
||||
"totalPlatinumScore" to it.totalPlatinumScore
|
||||
) }
|
||||
}
|
||||
|
||||
"GetUserEventRanking".unpaged {
|
||||
val time = LocalDateTime.now().format(dtPattern)
|
||||
|
||||
db.eventPoint.findByUser_Card_ExtId(uid).map { mapOf(
|
||||
"eventId" to it.eventId,
|
||||
"type" to 1, // Latest ranking
|
||||
"date" to time,
|
||||
"rank" to db.eventPoint.calculateRankByUserAndEventId(uid, it.eventId),
|
||||
"point" to it.point
|
||||
) }
|
||||
}
|
||||
|
||||
"GetUserActivity".unpagedExtra {
|
||||
val kind = parsing { data["kind"]!!.int }
|
||||
db.activity.findByUser_Card_ExtIdAndKindOrderBySortNumberDesc(uid, kind)
|
||||
.take(if (kind == 1) 15 else 10) to mapOf("kind" to kind)
|
||||
}
|
||||
|
||||
"GetUserItem" {
|
||||
val kind = (parsing { data["nextIndex"]!!.long } / 10000000000L).toInt()
|
||||
var dat = db.item.findByUser_Card_ExtIdAndItemKind(uid, kind)
|
||||
|
||||
// Check if user have infinite kaika
|
||||
if (kind == OgkItemType.KaikaItem.ordinal) {
|
||||
val u = db.data.findByCard_ExtId(uid)()
|
||||
u?.card?.aquaUser?.gameOptions?.let {
|
||||
if (it.ongekiInfiniteKaika) {
|
||||
dat = listOf(UserItem().apply {
|
||||
user = u
|
||||
itemKind = OgkItemType.KaikaItem.ordinal
|
||||
itemId = 1
|
||||
stock = 999
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mapOf("userId" to uid, "length" to dat.size, "nextIndex" to -1, "itemKind" to kind, "userItemList" to dat)
|
||||
}
|
||||
|
||||
"GetUserMusic" {
|
||||
val dat = db.musicDetail.findByUser_Card_ExtId(uid).groupBy { it.musicId }
|
||||
.mapValues { mapOf("length" to it.value.size, "userMusicDetailList" to it.value) }
|
||||
.values.toList()
|
||||
mapOf("userId" to uid, "length" to dat.size, "nextIndex" to -1, "userMusicList" to dat)
|
||||
}
|
||||
|
||||
"GetUserPreview" api@ {
|
||||
val u = db.data.findByCard_ExtId(uid)() ?: return@api mapOf("userId" to uid, "lastPlayDate" to null)
|
||||
val o = db.option.findSingleByUser(u)()
|
||||
|
||||
mapOf(
|
||||
"userId" to uid, "isLogin" to false,
|
||||
|
||||
"userName" to u.userName, "reincarnationNum" to u.reincarnationNum,
|
||||
"level" to u.level, "exp" to u.exp, "playerRating" to u.playerRating, "newPlayerRating" to u.newPlayerRating,
|
||||
"lastGameId" to u.lastGameId, "lastRomVersion" to u.lastRomVersion, "lastDataVersion" to u.lastDataVersion,
|
||||
"lastPlayDate" to u.lastPlayDate, "lastLoginDate" to u.lastPlayDate,
|
||||
"nameplateId" to u.nameplateId, "trophyId" to u.trophyId, "cardId" to u.cardId,
|
||||
|
||||
"dispPlayerLv" to (o?.dispPlayerLv ?: 1),
|
||||
"dispRating" to (o?.dispRating ?: 1),
|
||||
"dispBP" to (o?.dispBP ?: 1),
|
||||
"headphone" to (o?.headphone ?: 0),
|
||||
|
||||
"lastEmoneyBrand" to 4,
|
||||
"lastEmoneyCredit" to 10000,
|
||||
|
||||
"banStatus" to 0,
|
||||
"isWarningConfirmed" to false,
|
||||
)
|
||||
}
|
||||
|
||||
"GetUserRecentRating".unpaged {
|
||||
db.generalData.findByUser_Card_ExtIdAndPropertyKey(uid, "recent_rating_list")()?.let { recent ->
|
||||
recent.propertyValue.split(',').dropLastWhile { it.isEmpty() }.map {
|
||||
val (m, d, s) = it.split(':').map { it.int }
|
||||
UserRecentRating(m, d, "1000000", s)
|
||||
}
|
||||
} ?: run {
|
||||
db.playlog.findByUser_Card_ExtId(uid, PageRequest.of(0, 30, Sort.by(Sort.Direction.DESC, "id"))).content
|
||||
.map { UserRecentRating(it.musicId, it.level, "1000000", it.techScore) }
|
||||
}
|
||||
}
|
||||
|
||||
"GetUserRivalData" {
|
||||
val idList = (data["userRivalList"] as Collection<JDict>)
|
||||
.map { it["rivalUserId"]!!.long }
|
||||
|
||||
db.data.findByCard_ExtIdIn(idList)
|
||||
.map { mapOf("rivalUserId" to it.card!!.extId, "rivalUserName" to it.userName) }
|
||||
}
|
||||
|
||||
"GetUserRivalMusic".unpagedExtra {
|
||||
val rivalUserId = (data["rivalUserId"] as Number).toLong()
|
||||
|
||||
val l = db.musicDetail.findByUser_Card_ExtId(rivalUserId).groupBy { it.musicId }
|
||||
.map { mapOf("userRivalMusicDetailList" to it.value, "length" to it.value.size) }
|
||||
|
||||
l to mapOf("rivalUserId" to rivalUserId)
|
||||
}
|
||||
}
|
||||
@@ -1,366 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.controller;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.ongeki.handler.impl.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/g/ongeki")
|
||||
@AllArgsConstructor
|
||||
public class OngekiController {
|
||||
|
||||
private final GetGameEventHandler getGameEventHandler;
|
||||
private final GetGameIdlistHandler getGameIdlistHandler;
|
||||
private final GetGameMessageHandler getGameMessageHandler;
|
||||
private final GetGamePointHandler getGamePointHandler;
|
||||
private final GetGamePresentHandler getGamePresentHandler;
|
||||
private final GetGameTechMusicHandler getGameTechMusicHandler;
|
||||
private final GetGameRankingHandler getGameRankingHandler;
|
||||
private final GetGameRewardHandler getGameRewardHandler;
|
||||
private final GetGameSettingHandler getGameSettingHandler;
|
||||
private final GetUserActivityHandler getUserActivityHandler;
|
||||
private final GetUserBossHandler getUserBossHandler;
|
||||
private final GetUserBpBaseHandler getUserBpBaseHandler;
|
||||
private final GetUserCardHandler getUserCardHandler;
|
||||
private final GetUserChapterHandler getUserChapterHandler;
|
||||
private final GetUserMemoryChapterHandler getUserMemoryChapterHandler;
|
||||
private final GetUserCharacterHandler getUserCharacterHandler;
|
||||
private final GetUserDataHandler getUserDataHandler;
|
||||
private final GetUserDeckByKeyHandler getUserDeckByKeyHandler;
|
||||
private final GetUserEventMapHandler getUserEventMapHandler;
|
||||
private final GetUserEventPointHandler getUserEventPointHandler;
|
||||
private final GetUserEventRankingHandler getUserEventRankingHandler;
|
||||
private final GetUserEventMusicHandler getUserEventMusicHandler;
|
||||
private final GetUserItemHandler getUserItemHandler;
|
||||
private final GetUserLoginBonusHandler getUserLoginBonusHandler;
|
||||
private final GetUserMissionPointHandler getUserMissionPointHandler;
|
||||
private final GetUserMusicHandler getUserMusicHandler;
|
||||
private final GetUserMusicItemHandler getUserMusicItemHandler;
|
||||
private final GetUserOptionHandler getUserOptionHandler;
|
||||
private final GetUserPreviewHandler getUserPreviewHandler;
|
||||
private final GetUserRatinglogListHandler getUserRatinglogListHandler;
|
||||
private final GetUserRecentRatingHandler getUserRecentRatingHandler;
|
||||
private final GetUserRegionHandler getUserRegionHandler;
|
||||
private final GetUserRivalHandler getUserRivalHandler;
|
||||
private final GetUserRivalMusicHandler getUserRivalMusicHandler;
|
||||
private final GetUserRivalDataHandler getUserRivalDataHandler;
|
||||
private final GetUserScenarioHandler getUserScenarioHandler;
|
||||
private final GetUserSkinHandler getUserSkinHandler;
|
||||
private final GetUserStoryHandler getUserStoryHandler;
|
||||
private final GetUserTechCountHandler getUserTechCountHandler;
|
||||
private final GetUserTechEventHandler getUserTechEventHandler;
|
||||
private final GetUserTechEventRankingHandler getUserTechEventRankingHandler;
|
||||
private final GetUserTradeItemHandler getUserTradeItemHandler;
|
||||
private final GetUserTrainingRoomByKeyHandler getUserTrainingRoomByKeyHandler;
|
||||
private final GetUserKopHandler getUserKopHandler;
|
||||
private final UpsertUserAllHandler upsertUserAllHandler;
|
||||
private final GetClientBookkeepingHandler getClientBookkeepingHandler;
|
||||
private final GetClientTestmodeHandler getClientTestmodeHandler;
|
||||
private final GetGameMusicReleaseStateHandler getGameMusicReleaseStateHandler;
|
||||
|
||||
@PostMapping("ExtendLockTimeApi")
|
||||
public String extendLockTime(@ModelAttribute Map<String, Object> request) {
|
||||
return "{\"returnCode\":1,\"apiName\":\"extendLockTime\"}";
|
||||
}
|
||||
|
||||
@PostMapping("GameLoginApi")
|
||||
public String gameLogin(@ModelAttribute Map<String, Object> request) {
|
||||
return "{\"returnCode\":1,\"apiName\":\"gameLogin\"}";
|
||||
}
|
||||
|
||||
@PostMapping("GameLogoutApi")
|
||||
public String gameLogout(@ModelAttribute Map<String, Object> request) {
|
||||
return "{\"returnCode\":1,\"apiName\": \"gameLogout\"}";
|
||||
}
|
||||
|
||||
@PostMapping("GetGameEventApi")
|
||||
public String getGameEvent(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getGameEventHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetGameIdlistApi")
|
||||
public String getGameIdList(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getGameIdlistHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetGameMessageApi")
|
||||
public String getGameMessage(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getGameMessageHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetGamePointApi")
|
||||
public String getGamePoint(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getGamePointHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetGamePresentApi")
|
||||
public String getGamePresent(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getGamePresentHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetGameTechMusicApi")
|
||||
public String getGameTechMusic(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getGameTechMusicHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetGameMusicReleaseStateApi")
|
||||
public String GetGameMusicReleaseState(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getGameMusicReleaseStateHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserTechEventApi")
|
||||
public String getUserTechEvent(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserTechEventHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserTechEventRankingApi")
|
||||
public String getUserTechEventRanking(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserTechEventRankingHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetGameRankingApi")
|
||||
public String getGameRanking(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getGameRankingHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetGameRewardApi")
|
||||
public String getGameReward(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getGameRewardHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetGameSettingApi")
|
||||
public String getGameSetting(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getGameSettingHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserActivityApi")
|
||||
public String getUserActivity(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserActivityHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserBossApi")
|
||||
public String getUserBoss(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserBossHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserBpBaseApi")
|
||||
public String getUserBpBase(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserBpBaseHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserCardApi")
|
||||
public String getUserCard(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserCardHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserChapterApi")
|
||||
public String getUserChapter(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserChapterHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserMemoryChapterApi")
|
||||
public String getUserMemoryChapter(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserMemoryChapterHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserCharacterApi")
|
||||
public String getUserCharacter(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserCharacterHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserDataApi")
|
||||
public String getUserData(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserDataHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserDeckByKeyApi")
|
||||
public String getUserDeckByKey(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserDeckByKeyHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserEventMapApi")
|
||||
public String getUserEventMap(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserEventMapHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserEventPointApi")
|
||||
public String getUserEventPoint(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserEventPointHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserEventMusicApi")
|
||||
public String getUserEventMusic(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserEventMusicHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserTradeItemApi")
|
||||
public String getUserTradeItem(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserTradeItemHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserEventRankingApi")
|
||||
public String getUserEventRanking(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserEventRankingHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserItemApi")
|
||||
public String getUserItem(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserItemHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserLoginBonusApi")
|
||||
public String getUserLoginBonus(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserLoginBonusHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserMissionPointApi")
|
||||
public String getUserMissionPoint(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserMissionPointHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserMusicApi")
|
||||
public String getUserMusic(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserMusicHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserMusicItemApi")
|
||||
public String getUserMusicItem(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserMusicItemHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserOptionApi")
|
||||
public String getUserOption(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserOptionHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserPreviewApi")
|
||||
public String getUserPreview(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserPreviewHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserRatinglogApi")
|
||||
public String getUserRatinglog(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserRatinglogListHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserRecentRatingApi")
|
||||
public String getUserRecentRating(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserRecentRatingHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserRegionApi")
|
||||
public String getUserRegion(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserRegionHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserRivalApi")
|
||||
public String getUserRival(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserRivalHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserRivalDataApi")
|
||||
public String getUserRivalData(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserRivalDataHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserRivalMusicApi")
|
||||
public String getUserRivalMusic(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserRivalMusicHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserScenarioApi")
|
||||
public String getUserScenario(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserScenarioHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserSkinApi")
|
||||
public String getUserSkin(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserSkinHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserStoryApi")
|
||||
public String getUserStory(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserStoryHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserTechCountApi")
|
||||
public String getUserTechCount(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserTechCountHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserTrainingRoomByKeyApi")
|
||||
public String getUserTrainingRoomByKey(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserTrainingRoomByKeyHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserKopApi")
|
||||
public String getUserKop(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserKopHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetClientBookkeepingApi")
|
||||
public String getClientBookkeeping(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getClientBookkeepingHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetClientTestmodeApi")
|
||||
public String getClientTestmode(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getClientTestmodeHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("RegisterPromotionCardApi")
|
||||
public String registerPromotionCard(@ModelAttribute Map<String, Object> request) {
|
||||
return "{\"returnCode\":1,\"apiName\":\"registerPromotionCard\"}";
|
||||
}
|
||||
|
||||
@PostMapping("UpsertClientBookkeepingApi")
|
||||
public String upsertClientBookkeeping(@ModelAttribute Map<String, Object> request) {
|
||||
return "{\"returnCode\":1},\"apiName\":\"upsertClientBookkeeping\"";
|
||||
}
|
||||
|
||||
@PostMapping("UpsertClientDevelopApi")
|
||||
public String upsertClientDevelop(@ModelAttribute Map<String, Object> request) {
|
||||
return "{\"returnCode\":1},\"apiName\":\"upsertClientDevelop\"";
|
||||
}
|
||||
|
||||
@PostMapping("UpsertClientErrorApi")
|
||||
public String upsertClientError(@ModelAttribute Map<String, Object> request) {
|
||||
return "{\"returnCode\":1,\"apiName\":\"upsertClientError\"}";
|
||||
}
|
||||
|
||||
@PostMapping("UpsertClientSettingApi")
|
||||
public String upsertClientSetting(@ModelAttribute Map<String, Object> request) {
|
||||
return "{\"returnCode\":1,\"apiName\":\"upsertClientSetting\"}";
|
||||
}
|
||||
|
||||
@PostMapping("UpsertClientTestmodeApi")
|
||||
public String upsertClientTestmode(@ModelAttribute Map<String, Object> request) {
|
||||
return "{\"returnCode\":1,\"apiName\":\"upsertClientTestmode\"}";
|
||||
}
|
||||
|
||||
@PostMapping("UpsertUserGplogApi")
|
||||
public String upsertUserGplog(@ModelAttribute Map<String, Object> request) {
|
||||
return "{\"returnCode\":1,\"apiName\":\"upsertUserGplog\"}";
|
||||
}
|
||||
|
||||
@PostMapping("UpsertUserAllApi")
|
||||
public String upsertUserAll(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return upsertUserAllHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("Ping")
|
||||
String ping(@ModelAttribute Map<String, Object> request) {
|
||||
return "{\"returnCode\":\"1\"}";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.controller;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@RestControllerAdvice(basePackages = "icu.samnyan.aqua.sega.ongeki")
|
||||
public class OngekiControllerAdvice {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(OngekiControllerAdvice.class);
|
||||
|
||||
|
||||
/**
|
||||
* Get the map object from json string
|
||||
*
|
||||
* @param request HttpServletRequest
|
||||
*/
|
||||
@ModelAttribute
|
||||
public Map<String, Object> preHandle(HttpServletRequest request) throws IOException {
|
||||
byte[] src = request.getInputStream().readAllBytes();
|
||||
String outputString = new String(src, StandardCharsets.UTF_8).trim();
|
||||
logger.info("Request " + request.getRequestURI() + ": " + outputString);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
return mapper.readValue(outputString, new TypeReference<>() {
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GameCard;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiGameCardRepository")
|
||||
public interface GameCardRepository extends JpaRepository<GameCard, Long> {
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GameChara;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiGameCharaRepository")
|
||||
public interface GameCharaRepository extends JpaRepository<GameChara, Long> {
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GameEvent;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiGameEventRepository")
|
||||
public interface GameEventRepository extends JpaRepository<GameEvent, Long> {
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GameMusic;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiGameMusicRepository")
|
||||
public interface GameMusicRepository extends JpaRepository<GameMusic, Long> {
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GamePoint;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiGamePointRepository")
|
||||
public interface GamePointRepository extends JpaRepository<GamePoint, Long> {
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GamePresent;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiGamePresentRepository")
|
||||
public interface GamePresentRepository extends JpaRepository<GamePresent, Long> {
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GameReward;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiGameRewardRepository")
|
||||
public interface GameRewardRepository extends JpaRepository<GameReward, Long> {
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GameSkill;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiGameSkillRepository")
|
||||
public interface GameSkillRepository extends JpaRepository<GameSkill, Long> {
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserActivity;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserActivityRepository")
|
||||
public interface UserActivityRepository extends JpaRepository<UserActivity, Long> {
|
||||
|
||||
List<UserActivity> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Optional<UserActivity> findByUserAndKindAndActivityId(UserData userData, int kind, int activityId);
|
||||
|
||||
List<UserActivity> findByUser_Card_ExtIdAndKindOrderBySortNumberDesc(long userId, int kind);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserBoss;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserBossRepository")
|
||||
public interface UserBossRepository extends JpaRepository<UserBoss, Long> {
|
||||
|
||||
List<UserBoss> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Optional<UserBoss> findByUserAndMusicId(UserData user, int musicId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserCard;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserCardRepository")
|
||||
public interface UserCardRepository extends JpaRepository<UserCard, Long> {
|
||||
|
||||
Optional<UserCard> findByUserAndCardId(UserData userData, int cardId);
|
||||
|
||||
Optional<UserCard> findByUser_Card_ExtIdAndCardId(long userId, int cardId);
|
||||
|
||||
List<UserCard> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Page<UserCard> findByUser_Card_ExtId(long userId, Pageable page);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserChapter;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserChapterRepository")
|
||||
public interface UserChapterRepository extends JpaRepository<UserChapter, Long> {
|
||||
|
||||
List<UserChapter> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Optional<UserChapter> findByUserAndChapterId(UserData userData, int chapterId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserCharacter;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserCharacterRepository")
|
||||
public interface UserCharacterRepository extends JpaRepository<UserCharacter, Long> {
|
||||
|
||||
List<UserCharacter> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Page<UserCharacter> findByUser_Card_ExtId(long userId, Pageable page);
|
||||
|
||||
Optional<UserCharacter> findByUserAndCharacterId(UserData userData, int characterId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata
|
||||
|
||||
import icu.samnyan.aqua.net.games.GenericUserDataRepo
|
||||
import icu.samnyan.aqua.sega.general.model.Card
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData
|
||||
import org.springframework.stereotype.Repository
|
||||
import org.springframework.transaction.annotation.Transactional
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserDataRepository")
|
||||
interface UserDataRepository : GenericUserDataRepo<UserData> {
|
||||
fun findByCard_ExtIdIn(userIds: Collection<Long>): List<UserData>
|
||||
|
||||
@Transactional
|
||||
fun deleteByCard(card: Card)
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserDeck;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserDeckRepository")
|
||||
public interface UserDeckRepository extends JpaRepository<UserDeck, Long> {
|
||||
|
||||
List<UserDeck> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Optional<UserDeck> findByUserAndDeckId(UserData userData, int deckId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserEventMap;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserEventMapRepository")
|
||||
public interface UserEventMapRepository extends JpaRepository<UserEventMap, Long> {
|
||||
|
||||
Optional<UserEventMap> findByUser(UserData userData);
|
||||
|
||||
Optional<UserEventMap> findByUser_Card_ExtId(long userId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserEventMusic;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserEventMusicRepository")
|
||||
public interface UserEventMusicRepository extends JpaRepository<UserEventMusic, Long> {
|
||||
|
||||
List<UserEventMusic> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Optional<UserEventMusic> findByUserAndEventIdAndTypeAndMusicId(UserData userData, int eventId, int type, int musicId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserEventPoint;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserEventPointRepository")
|
||||
public interface UserEventPointRepository extends JpaRepository<UserEventPoint, Long> {
|
||||
|
||||
List<UserEventPoint> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Optional<UserEventPoint> findByUserAndEventId(UserData userData, int eventId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
|
||||
//@Query(value = "SELECT rank from (SELECT user_id , DENSE_RANK() OVER (ORDER BY point DESC) as rank from ongeki_user_event_point where event_id = :eventId) where user_id == :userId limit 1", nativeQuery = true)
|
||||
@Query("SELECT COUNT(u)+1 FROM OngekiUserEventPoint u WHERE u.eventId = :eventId AND u.point > (SELECT u2.point FROM OngekiUserEventPoint u2 WHERE u2.user.id = :userId AND u2.eventId = :eventId)")
|
||||
int calculateRankByUserAndEventId(long userId, int eventId);
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserGeneralData;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserGeneralDataRepository")
|
||||
public interface UserGeneralDataRepository extends JpaRepository<UserGeneralData, Long> {
|
||||
|
||||
List<UserGeneralData> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Optional<UserGeneralData> findByUserAndPropertyKey(UserData user, String key);
|
||||
|
||||
Optional<UserGeneralData> findByUser_Card_ExtIdAndPropertyKey(long userId, String key);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserItem;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserItemRepository")
|
||||
public interface UserItemRepository extends JpaRepository<UserItem, Long> {
|
||||
|
||||
List<UserItem> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Page<UserItem> findByUser_Card_ExtId(long userId, Pageable page);
|
||||
|
||||
Optional<UserItem> findByUserAndItemKindAndItemId(UserData userData, int itemKind, int itemId);
|
||||
|
||||
Page<UserItem> findByUser_Card_ExtIdAndItemKind(long userId, int kind, Pageable page);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserKop;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserKopRepository")
|
||||
public interface UserKopRepository extends JpaRepository<UserKop, Long> {
|
||||
|
||||
List<UserKop> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Optional<UserKop> findByUserAndKopIdAndAreaId(UserData userData, int kopId, int areaId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserLoginBonus;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
public interface UserLoginBonusRepository extends JpaRepository<UserLoginBonus, Long> {
|
||||
|
||||
List<UserLoginBonus> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Optional<UserLoginBonus> findByUserAndBonusId(UserData userData, int bonusId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserMemoryChapter;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserMemoryChapterRepository")
|
||||
public interface UserMemoryChapterRepository extends JpaRepository<UserMemoryChapter, Long> {
|
||||
|
||||
List<UserMemoryChapter> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Optional<UserMemoryChapter> findByUserAndChapterId(UserData userData, int chapterId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserMissionPoint;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserMissionPointRepository")
|
||||
public interface UserMissionPointRepository extends JpaRepository<UserMissionPoint, Long> {
|
||||
|
||||
List<UserMissionPoint> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Optional<UserMissionPoint> findByUserAndEventId(UserData userData, int eventId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.net.games.GenericUserMusicRepo;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserMusicDetail;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserMusicDetailRepository")
|
||||
public interface UserMusicDetailRepository extends JpaRepository<UserMusicDetail, Long>, GenericUserMusicRepo<UserMusicDetail> {
|
||||
|
||||
List<UserMusicDetail> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Page<UserMusicDetail> findByUser_Card_ExtId(long userId, Pageable page);
|
||||
|
||||
List<UserMusicDetail> findByUser_Card_ExtIdAndMusicId(long userId, int id);
|
||||
|
||||
Optional<UserMusicDetail> findByUserAndMusicIdAndLevel(UserData userData, int musicId, int level);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserMusicItem;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserMusicItemRepository")
|
||||
public interface UserMusicItemRepository extends JpaRepository<UserMusicItem, Long> {
|
||||
|
||||
List<UserMusicItem> findByUser_Card_ExtId(long aimeId);
|
||||
|
||||
Page<UserMusicItem> findByUser_Card_ExtId(long userId, Pageable page);
|
||||
|
||||
Optional<UserMusicItem> findByUserAndMusicId(UserData userData, int musicId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserOption;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserOptionRepository")
|
||||
public interface UserOptionRepository extends JpaRepository<UserOption, Long> {
|
||||
|
||||
Optional<UserOption> findByUser(UserData userData);
|
||||
|
||||
Optional<UserOption> findByUser_Card_ExtId(long userId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata
|
||||
|
||||
import icu.samnyan.aqua.net.games.GenericPlaylogRepo
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserPlaylog
|
||||
import org.springframework.data.domain.Page
|
||||
import org.springframework.data.domain.Pageable
|
||||
import org.springframework.stereotype.Repository
|
||||
import org.springframework.transaction.annotation.Transactional
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserPlaylogRepository")
|
||||
interface UserPlaylogRepository : GenericPlaylogRepo<UserPlaylog> {
|
||||
fun findByUser_Card_ExtId(userId: Long): List<UserPlaylog>
|
||||
|
||||
fun findByUser_Card_ExtId(userId: Long, page: Pageable): Page<UserPlaylog>
|
||||
|
||||
fun findByUser_Card_ExtIdAndMusicIdAndLevel(userId: Long, musicId: Int, level: Int): List<UserPlaylog>
|
||||
|
||||
@Transactional
|
||||
fun deleteByUser(user: UserData)
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserRival;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dp (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserRivalDataRepository")
|
||||
public interface UserRivalDataRepository extends JpaRepository<UserRival, Long> {
|
||||
List<UserRival> findByUser_Card_ExtId(long userId);
|
||||
|
||||
@Transactional
|
||||
void removeByUser_Card_ExtIdAndRivalUserExtId(long userId,long rivalUserId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserScenario;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserScenarioRepository")
|
||||
public interface UserScenarioRepository extends JpaRepository<UserScenario, Long> {
|
||||
|
||||
List<UserScenario> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Optional<UserScenario> findByUserAndScenarioId(UserData user, int scenarioId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserSkin;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserSkinRepository")
|
||||
public interface UserSkinRepository extends JpaRepository<UserSkin, Long> {
|
||||
|
||||
List<UserSkin> findByUser_Card_ExtId(long userId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserStory;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserStoryRepository")
|
||||
public interface UserStoryRepository extends JpaRepository<UserStory, Long> {
|
||||
|
||||
List<UserStory> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Optional<UserStory> findByUserAndStoryId(UserData userData, int storyId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserTechCount;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserTechCountRepository")
|
||||
public interface UserTechCountRepository extends JpaRepository<UserTechCount, Long> {
|
||||
|
||||
List<UserTechCount> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Optional<UserTechCount> findByUserAndLevelId(UserData user, int levelId);
|
||||
|
||||
@Transactional
|
||||
void deleteByUser(UserData user);
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user