forked from Cookies_Github_mirror/AquaDX
Initial Commit
This commit is contained in:
@@ -0,0 +1,249 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.controller;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.impl.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("ChuniServlet")
|
||||
public class ChuniServletController {
|
||||
|
||||
private final GameLoginHandler gameLoginHandler;
|
||||
private final GameLogoutHandler gameLogoutHandler;
|
||||
private final GetGameChargeHandler getGameChargeHandler;
|
||||
private final GetGameEventHandler getGameEventHandler;
|
||||
private final GetGameIdlistHandler getGameIdlistHandler;
|
||||
private final GetGameMessageHandler getGameMessageHandler;
|
||||
private final GetGameRankingHandler getGameRankingHandler;
|
||||
private final GetGameSaleHandler getGameSaleHandler;
|
||||
private final GetGameSettingHandler getGameSettingHandler;
|
||||
private final GetUserActivityHandler getUserActivityHandler;
|
||||
private final GetUserCharacterHandler getUserCharacterHandler;
|
||||
private final GetUserChargeHandler getUserChargeHandler;
|
||||
private final GetUserCourseHandler getUserCourseHandler;
|
||||
private final GetUserDataExHandler getUserDataExHandler;
|
||||
private final GetUserDataHandler getUserDataHandler;
|
||||
private final GetUserDuelHandler getUserDuelHandler;
|
||||
private final GetUserItemHandler getUserItemHandler;
|
||||
private final GetUserMapHandler getUserMapHandler;
|
||||
private final GetUserMusicHandler getUserMusicHandler;
|
||||
private final GetUserOptionExHandler getUserOptionExHandler;
|
||||
private final GetUserOptionHandler getUserOptionHandler;
|
||||
private final GetUserPreviewHandler getUserPreviewHandler;
|
||||
private final GetUserRecentRatingHandler getUserRecentRatingHandler;
|
||||
private final GetUserRegionHandler getUserRegionHandler;
|
||||
private final UpsertClientBookkeepingHandler upsertClientBookkeepingHandler;
|
||||
private final UpsertClientDevelopHandler upsertClientDevelopHandler;
|
||||
private final UpsertClientErrorHandler upsertClientErrorHandler;
|
||||
private final UpsertClientSettingHandler upsertClientSettingHandler;
|
||||
private final UpsertClientTestmodeHandler upsertClientTestmodeHandler;
|
||||
private final UpsertUserAllHandler upsertUserAllHandler;
|
||||
private final UpsertUserChargelogHandler upsertUserChargelogHandler;
|
||||
|
||||
@Autowired
|
||||
public ChuniServletController(GameLoginHandler gameLoginHandler, GameLogoutHandler gameLogoutHandler, GetGameChargeHandler getGameChargeHandler, GetGameEventHandler getGameEventHandler, GetGameIdlistHandler getGameIdlistHandler, GetGameMessageHandler getGameMessageHandler, GetGameRankingHandler getGameRankingHandler, GetGameSaleHandler getGameSaleHandler, GetGameSettingHandler getGameSettingHandler, GetUserActivityHandler getUserActivityHandler, GetUserCharacterHandler getUserCharacterHandler, GetUserChargeHandler getUserChargeHandler, GetUserCourseHandler getUserCourseHandler, GetUserDataExHandler getUserDataExHandler, GetUserDataHandler getUserDataHandler, GetUserDuelHandler getUserDuelHandler, GetUserItemHandler getUserItemHandler, GetUserMapHandler getUserMapHandler, GetUserMusicHandler getUserMusicHandler, GetUserOptionExHandler getUserOptionExHandler, GetUserOptionHandler getUserOptionHandler, GetUserPreviewHandler getUserPreviewHandler, GetUserRecentRatingHandler getUserRecentRatingHandler, GetUserRegionHandler getUserRegionHandler, UpsertClientBookkeepingHandler upsertClientBookkeepingHandler, UpsertClientDevelopHandler upsertClientDevelopHandler, UpsertClientErrorHandler upsertClientErrorHandler, UpsertClientSettingHandler upsertClientSettingHandler, UpsertClientTestmodeHandler upsertClientTestmodeHandler, UpsertUserAllHandler upsertUserAllHandler, UpsertUserChargelogHandler upsertUserChargelogHandler) {
|
||||
this.gameLoginHandler = gameLoginHandler;
|
||||
this.gameLogoutHandler = gameLogoutHandler;
|
||||
this.getGameChargeHandler = getGameChargeHandler;
|
||||
this.getGameEventHandler = getGameEventHandler;
|
||||
this.getGameIdlistHandler = getGameIdlistHandler;
|
||||
this.getGameMessageHandler = getGameMessageHandler;
|
||||
this.getGameRankingHandler = getGameRankingHandler;
|
||||
this.getGameSaleHandler = getGameSaleHandler;
|
||||
this.getGameSettingHandler = getGameSettingHandler;
|
||||
this.getUserActivityHandler = getUserActivityHandler;
|
||||
this.getUserCharacterHandler = getUserCharacterHandler;
|
||||
this.getUserChargeHandler = getUserChargeHandler;
|
||||
this.getUserCourseHandler = getUserCourseHandler;
|
||||
this.getUserDataExHandler = getUserDataExHandler;
|
||||
this.getUserDataHandler = getUserDataHandler;
|
||||
this.getUserDuelHandler = getUserDuelHandler;
|
||||
this.getUserItemHandler = getUserItemHandler;
|
||||
this.getUserMapHandler = getUserMapHandler;
|
||||
this.getUserMusicHandler = getUserMusicHandler;
|
||||
this.getUserOptionExHandler = getUserOptionExHandler;
|
||||
this.getUserOptionHandler = getUserOptionHandler;
|
||||
this.getUserPreviewHandler = getUserPreviewHandler;
|
||||
this.getUserRecentRatingHandler = getUserRecentRatingHandler;
|
||||
this.getUserRegionHandler = getUserRegionHandler;
|
||||
this.upsertClientBookkeepingHandler = upsertClientBookkeepingHandler;
|
||||
this.upsertClientDevelopHandler = upsertClientDevelopHandler;
|
||||
this.upsertClientErrorHandler = upsertClientErrorHandler;
|
||||
this.upsertClientSettingHandler = upsertClientSettingHandler;
|
||||
this.upsertClientTestmodeHandler = upsertClientTestmodeHandler;
|
||||
this.upsertUserAllHandler = upsertUserAllHandler;
|
||||
this.upsertUserChargelogHandler = upsertUserChargelogHandler;
|
||||
}
|
||||
|
||||
@PostMapping("GameLoginApi")
|
||||
String gameLogin(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return gameLoginHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GameLogoutApi")
|
||||
String gameLogout(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return gameLogoutHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetGameChargeApi")
|
||||
String getGameCharge(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getGameChargeHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetGameEventApi")
|
||||
String getGameEvent(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getGameEventHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetGameIdlistApi")
|
||||
String getGameIdList(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getGameIdlistHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetGameMessageApi")
|
||||
String getGameMessage(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getGameMessageHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetGameRankingApi")
|
||||
String getGameRanking(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getGameRankingHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetGameSaleApi")
|
||||
String getGameSale(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getGameSaleHandler.handle(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* The game start up request
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("GetGameSettingApi")
|
||||
String getGameSetting(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getGameSettingHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserActivityApi")
|
||||
String getUserActivity(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserActivityHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserCharacterApi")
|
||||
String getUserCharacter(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserCharacterHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserChargeApi")
|
||||
String getUserCharge(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserChargeHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserCourseApi")
|
||||
String getUserCourse(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserCourseHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserDataApi")
|
||||
String getUserData(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserDataHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserDataExApi")
|
||||
String getUserDataEx(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserDataExHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserDuelApi")
|
||||
String getUserDuel(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserDuelHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserItemApi")
|
||||
String getUserItem(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserItemHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserMapApi")
|
||||
String getUserMap(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserMapHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserMusicApi")
|
||||
String getUserMusic(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserMusicHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserOptionApi")
|
||||
String getUserOption(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserOptionHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserOptionExApi")
|
||||
String getUserOptionEx(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserOptionExHandler.handle(request);
|
||||
}
|
||||
|
||||
// Call when login. Return null if no profile exist
|
||||
@PostMapping("GetUserPreviewApi")
|
||||
String getUserPreview(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserPreviewHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserRecentRatingApi")
|
||||
String getUserRecentRating(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserRecentRatingHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("GetUserRegionApi")
|
||||
String getUserRegion(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return getUserRegionHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("UpsertClientBookkeepingApi")
|
||||
String upsertClientBookkeeping(@ModelAttribute Map<String, Object> request) {
|
||||
return "{\"returnCode\":\"1\"}";
|
||||
}
|
||||
|
||||
@PostMapping("UpsertClientDevelopApi")
|
||||
String upsertClientDevelop(@ModelAttribute Map<String, Object> request) {
|
||||
return "{\"returnCode\":\"1\"}";
|
||||
}
|
||||
|
||||
@PostMapping("UpsertClientErrorApi")
|
||||
String upsertClientError(@ModelAttribute Map<String, Object> request) {
|
||||
return "{\"returnCode\":\"1\"}";
|
||||
}
|
||||
|
||||
@PostMapping("UpsertClientSettingApi")
|
||||
String upsertClientSetting(@ModelAttribute Map<String, Object> request) {
|
||||
return "{\"returnCode\":\"1\"}";
|
||||
}
|
||||
|
||||
@PostMapping("UpsertClientTestmodeApi")
|
||||
String upsertClientTestmode(@ModelAttribute Map<String, Object> request) {
|
||||
return "{\"returnCode\":\"1\"}";
|
||||
}
|
||||
|
||||
@PostMapping("UpsertUserAllApi")
|
||||
String upsertUserAll(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return upsertUserAllHandler.handle(request);
|
||||
}
|
||||
|
||||
@PostMapping("UpsertUserChargelogApi")
|
||||
String upsertUserChargelog(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||
return upsertUserChargelogHandler.handle(request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.controller;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@RestControllerAdvice(basePackages = "icu.samnyan.aqua.sega.chunithm")
|
||||
public class ChuniServletControllerAdvice {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ChuniServletControllerAdvice.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<>() {
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.gamedata.GameCharge;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface GameChargeRepository extends JpaRepository<GameCharge, Long> {
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.gamedata.GameEvent;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface GameEventRepository extends JpaRepository<GameEvent, Integer> {
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.gamedata.GameMessage;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface GameMessageRepository extends JpaRepository<GameMessage, Integer> {
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.gamedata.Music;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface GameMusicRepository extends JpaRepository<Music, Long> {
|
||||
|
||||
Optional<Music> findByMusicId(int musicId);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserActivity;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface UserActivityRepository extends JpaRepository<UserActivity, Long> {
|
||||
|
||||
Optional<UserActivity> findTopByUserAndActivityIdAndKindOrderByIdDesc(UserData user, int activityId, int kind);
|
||||
|
||||
List<UserActivity> findAllByUser_Card_ExtIdAndKindOrderBySortNumberDesc(long extId, int kind);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserCharacter;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface UserCharacterRepository extends JpaRepository<UserCharacter, Long> {
|
||||
|
||||
Optional<UserCharacter> findTopByUserAndCharacterIdOrderByIdDesc(UserData user, int characterId);
|
||||
|
||||
Page<UserCharacter> findByUser_Card_ExtId(long parseLong, Pageable pageable);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserCharge;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface UserChargeRepository extends JpaRepository<UserCharge, Long> {
|
||||
List<UserCharge> findByUser_Card_ExtId(long userId);
|
||||
|
||||
Optional<UserCharge> findByUserAndChargeId(UserData extId, int chargeId);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserCourse;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface UserCourseRepository extends JpaRepository<UserCourse, Long> {
|
||||
Optional<UserCourse> findTopByUserAndCourseIdOrderByIdDesc(UserData user, int courseId);
|
||||
|
||||
Page<UserCourse> findByUser_Card_ExtId(long aimeId, Pageable page);
|
||||
|
||||
List<UserCourse> findByUser_Card_ExtId(long aimeId);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserDataEx;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface UserDataExRepository extends JpaRepository<UserDataEx, Long> {
|
||||
|
||||
Optional<UserDataEx> findByUser(UserData user);
|
||||
|
||||
Optional<UserDataEx> findByUser_Card_ExtId(long userId);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.general.model.Card;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface UserDataRepository extends JpaRepository<UserData, Long> {
|
||||
|
||||
Optional<UserData> findByCard(Card card);
|
||||
|
||||
Optional<UserData> findByCard_ExtId(long extId);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserDuel;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface UserDuelRepository extends JpaRepository<UserDuel, Long> {
|
||||
|
||||
Optional<UserDuel> findTopByUserAndDuelIdOrderByIdDesc(UserData user, int duelId);
|
||||
|
||||
List<UserDuel> findByUser_Card_ExtId(long extId);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserGameOptionEx;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface UserGameOptionExRepository extends JpaRepository<UserGameOptionEx, Long> {
|
||||
Optional<UserGameOptionEx> findByUser(UserData user);
|
||||
|
||||
Optional<UserGameOptionEx> findByUser_Card_ExtId(long parseLong);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserGameOption;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface UserGameOptionRepository extends JpaRepository<UserGameOption, Long> {
|
||||
|
||||
Optional<UserGameOption> findByUser(UserData user);
|
||||
|
||||
Optional<UserGameOption> findByUser_Card_ExtId(long extId);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserItem;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface UserItemRepository extends JpaRepository<UserItem, Long> {
|
||||
|
||||
Optional<UserItem> findTopByUserAndItemIdOrderByIdDesc(UserData user, int itemId);
|
||||
|
||||
Page<UserItem> findAllByUser_Card_ExtIdAndItemKind(long extId, int itemKind, Pageable pageable);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserMap;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface UserMapRepository extends JpaRepository<UserMap, Long> {
|
||||
List<UserMap> findAllByUser(UserData user);
|
||||
|
||||
List<UserMap> findAllByUser_Card_ExtId(long extId);
|
||||
|
||||
Optional<UserMap> findTopByUserAndMapIdOrderByIdDesc(UserData user, int mapId);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserMusicDetail;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface UserMusicDetailRepository extends JpaRepository<UserMusicDetail, Long> {
|
||||
|
||||
Optional<UserMusicDetail> findTopByUserAndMusicIdAndLevelOrderByIdDesc(UserData user, int musicId, int level);
|
||||
|
||||
List<UserMusicDetail> findByUser_Card_ExtId(long parseLong);
|
||||
|
||||
Page<UserMusicDetail> findByUser_Card_ExtId(long aimeId, Pageable page);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserPlaylog;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository
|
||||
public interface UserPlaylogRepository extends JpaRepository<UserPlaylog, Long> {
|
||||
List<UserPlaylog> findByUser_Card_ExtIdAndLevelNot(long extId, int levelNot, Pageable page);
|
||||
|
||||
List<UserPlaylog> findByUser_Card_ExtId(long parseLong, Pageable page);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.filter;
|
||||
|
||||
import javax.servlet.ReadListener;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletRequestWrapper;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
public class ChuniRequestWrapper extends HttpServletRequestWrapper {
|
||||
|
||||
private ByteArrayInputStream input;
|
||||
private ServletInputStream filterInput;
|
||||
|
||||
public ChuniRequestWrapper(HttpServletRequest request, byte[] input) {
|
||||
super(request);
|
||||
this.input = new ByteArrayInputStream(input);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ServletInputStream getInputStream() throws IOException {
|
||||
if (filterInput == null) {
|
||||
filterInput = new ServletInputStream() {
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadListener(ReadListener readListener) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return input.read();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
return filterInput;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.filter;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.WriteListener;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpServletResponseWrapper;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
public class ChuniResponseWrapper extends HttpServletResponseWrapper {
|
||||
|
||||
private ByteArrayOutputStream output;
|
||||
private ServletOutputStream filterOutput;
|
||||
|
||||
|
||||
ChuniResponseWrapper(HttpServletResponse response) {
|
||||
super(response);
|
||||
output = new ByteArrayOutputStream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletOutputStream getOutputStream() throws IOException {
|
||||
if (filterOutput == null) {
|
||||
filterOutput = new ServletOutputStream() {
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWriteListener(WriteListener writeListener) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
output.write(b);
|
||||
}
|
||||
};
|
||||
}
|
||||
return filterOutput;
|
||||
}
|
||||
|
||||
byte[] toByteArray() {
|
||||
return output.toByteArray();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.filter;
|
||||
|
||||
import icu.samnyan.aqua.sega.util.Compression;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class CompressionFilter extends OncePerRequestFilter {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CompressionFilter.class);
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||
|
||||
String encoding = request.getHeader("content-encoding");
|
||||
byte[] reqSrc = request.getInputStream().readAllBytes();
|
||||
|
||||
byte[] reqResult;
|
||||
if (encoding != null && encoding.equals("deflate")) {
|
||||
reqResult = Compression.decompress(reqSrc);
|
||||
} else {
|
||||
reqResult = reqSrc;
|
||||
}
|
||||
|
||||
ChuniRequestWrapper requestWrapper = new ChuniRequestWrapper(request, reqResult);
|
||||
ChuniResponseWrapper responseWrapper = new ChuniResponseWrapper(response);
|
||||
|
||||
filterChain.doFilter(requestWrapper, responseWrapper);
|
||||
|
||||
byte[] respSrc = responseWrapper.toByteArray();
|
||||
byte[] respResult = Compression.compress(respSrc);
|
||||
|
||||
|
||||
response.setContentLength(respResult.length);
|
||||
response.setContentType("application/json; charset=utf-8");
|
||||
response.addHeader("Content-Encoding", "deflate");
|
||||
|
||||
response.getOutputStream().write(respResult);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldNotFilter(HttpServletRequest request) throws ServletException {
|
||||
String path = request.getServletPath();
|
||||
return !path.startsWith("/ChuniServlet");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
public interface BaseHandler {
|
||||
|
||||
String handle(Map<String, Object> request) throws JsonProcessingException;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.response.CodeResp;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserDataService;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GameLoginHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GameLoginHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserDataService userDataService;
|
||||
|
||||
public GameLoginHandler(StringMapper mapper, UserDataService userDataService) {
|
||||
this.mapper = mapper;
|
||||
this.userDataService = userDataService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
Optional<UserData> userDataOptional = userDataService.getUserByExtId(userId);
|
||||
userDataOptional.ifPresent(userDataService::updateLoginTime);
|
||||
|
||||
String json = mapper.write(new CodeResp(1));
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.response.CodeResp;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GameLogoutHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GameLogoutHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
public GameLogoutHandler(StringMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
|
||||
String json = mapper.write(new CodeResp(1));
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.dao.gamedata.GameChargeRepository;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.gamedata.GameCharge;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetGameChargeHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetGameChargeHandler.class);
|
||||
private final GameChargeRepository gameChargeRepository;
|
||||
private final StringMapper mapper;
|
||||
|
||||
@Autowired
|
||||
public GetGameChargeHandler(GameChargeRepository gameChargeRepository, StringMapper mapper) {
|
||||
this.gameChargeRepository = gameChargeRepository;
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
|
||||
List<GameCharge> gameChargeList = gameChargeRepository.findAll();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("length", gameChargeList.size());
|
||||
resultMap.put("gameChargeList", gameChargeList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.dao.gamedata.GameEventRepository;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.gamedata.GameEvent;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetGameEventHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetGameEventHandler.class);
|
||||
|
||||
private final GameEventRepository gameEventRepository;
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
@Autowired
|
||||
public GetGameEventHandler(GameEventRepository gameEventRepository, StringMapper mapper) {
|
||||
this.gameEventRepository = gameEventRepository;
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String type = (String) request.get("type");
|
||||
|
||||
List<GameEvent> gameEventList = gameEventRepository.findAll();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("type", type);
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("gameEventList", gameEventList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetGameIdlistHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetGameIdlistHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
@Autowired
|
||||
public GetGameIdlistHandler(StringMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String type = (String) request.get("type");
|
||||
|
||||
List<Object> gameIdlistList = new ArrayList<>();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("type", type);
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("gameIdlistList", gameIdlistList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.dao.gamedata.GameMessageRepository;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.gamedata.GameMessage;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetGameMessageHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetGameMessageHandler.class);
|
||||
|
||||
private final GameMessageRepository gameMessageRepository;
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
@Autowired
|
||||
public GetGameMessageHandler(GameMessageRepository gameMessageRepository, StringMapper mapper) {
|
||||
this.gameMessageRepository = gameMessageRepository;
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String type = (String) request.get("type");
|
||||
|
||||
List<GameMessage> gameMessageList = gameMessageRepository.findAll();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("type", type);
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("gameMessageList", gameMessageList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetGameRankingHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetGameRankingHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
@Autowired
|
||||
public GetGameRankingHandler(StringMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String type = (String) request.get("type");
|
||||
|
||||
List<Object> gameRankingList = new ArrayList<>();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("type", type);
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("gameRankingList", gameRankingList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.response.data.GameSale;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetGameSaleHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetGameSaleHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
@Autowired
|
||||
public GetGameSaleHandler(StringMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String type = (String) request.get("type");
|
||||
|
||||
List<GameSale> gameSaleList = new ArrayList<>();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("type", type);
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("gameSaleList", gameSaleList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.response.GetGameSettingResp;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.response.data.GameSetting;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetGameSettingHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetGameSettingHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
@Autowired
|
||||
public GetGameSettingHandler(StringMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
|
||||
GameSetting gameSetting = new GameSetting(
|
||||
1,
|
||||
false,
|
||||
10,
|
||||
0,
|
||||
0,
|
||||
false,
|
||||
999,
|
||||
999,
|
||||
999);
|
||||
|
||||
GetGameSettingResp resp = new GetGameSettingResp(
|
||||
gameSetting,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
String json = mapper.write(resp);
|
||||
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserActivity;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserActivityService;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetUserActivityHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserActivityHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserActivityService userActivityService;
|
||||
|
||||
@Autowired
|
||||
public GetUserActivityHandler(StringMapper mapper, UserActivityService userActivityService) {
|
||||
this.mapper = mapper;
|
||||
this.userActivityService = userActivityService;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
String kind = (String) request.get("kind");
|
||||
|
||||
List<UserActivity> userActivityList = userActivityService.getAllByUserIdAndKind(userId, kind);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("length", userActivityList.size());
|
||||
resultMap.put("kind", kind);
|
||||
resultMap.put("userActivityList", userActivityList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserCharacter;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserCharacterService;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetUserCharacterHandler implements BaseHandler {
|
||||
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserCharacterHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserCharacterService userCharacterService;
|
||||
|
||||
|
||||
@Autowired
|
||||
public GetUserCharacterHandler(StringMapper mapper, UserCharacterService userCharacterService) {
|
||||
this.mapper = mapper;
|
||||
this.userCharacterService = userCharacterService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
int nextIndex = Integer.parseInt((String) request.get("nextIndex"));
|
||||
int maxCount = Integer.parseInt((String) request.get("maxCount"));
|
||||
|
||||
int pageNum = nextIndex / maxCount;
|
||||
|
||||
Page<UserCharacter> dbPage = userCharacterService.getByUser(userId, pageNum, maxCount);
|
||||
|
||||
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("length", dbPage.getNumberOfElements());
|
||||
resultMap.put("nextIndex", dbPage.getNumberOfElements() < maxCount ? -1 : currentIndex);
|
||||
resultMap.put("userCharacterList", dbPage.getContent());
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserCharge;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserChargeService;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetUserChargeHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserChargeHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserChargeService userChargeService;
|
||||
|
||||
@Autowired
|
||||
public GetUserChargeHandler(StringMapper mapper, UserChargeService userChargeService) {
|
||||
this.mapper = mapper;
|
||||
this.userChargeService = userChargeService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
|
||||
List<UserCharge> userChargeList = userChargeService.getByUserId(userId);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("length", userChargeList.size());
|
||||
resultMap.put("userChargeList", userChargeList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserCourse;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserCourseService;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetUserCourseHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserCourseHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserCourseService userCourseService;
|
||||
|
||||
@Autowired
|
||||
public GetUserCourseHandler(StringMapper mapper, UserCourseService userCourseService) {
|
||||
this.mapper = mapper;
|
||||
this.userCourseService = userCourseService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
|
||||
int nextIndex = Integer.parseInt((String) request.get("nextIndex"));
|
||||
int maxCount = Integer.parseInt((String) request.get("maxCount"));
|
||||
|
||||
int pageNum = nextIndex / maxCount;
|
||||
|
||||
Page<UserCourse> dbPage = userCourseService.getByUser(userId, pageNum, maxCount);
|
||||
|
||||
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("length", dbPage.getNumberOfElements());
|
||||
resultMap.put("nextIndex", dbPage.getNumberOfElements() < maxCount ? -1 : currentIndex);
|
||||
resultMap.put("userCourseList", dbPage.getContent());
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserDataEx;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserDataExService;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetUserDataExHandler implements BaseHandler {
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserDataExHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserDataExService userDataExService;
|
||||
|
||||
@Autowired
|
||||
public GetUserDataExHandler(StringMapper mapper, UserDataExService userDataExService) {
|
||||
this.mapper = mapper;
|
||||
this.userDataExService = userDataExService;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
Optional<UserDataEx> userDataExOptional = userDataExService.getUserByExtId(userId);
|
||||
|
||||
if (userDataExOptional.isPresent()) {
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("userDataEx", userDataExOptional.get());
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserDataService;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetUserDataHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserDataHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserDataService userDataService;
|
||||
|
||||
@Autowired
|
||||
public GetUserDataHandler(StringMapper mapper, UserDataService userDataService) {
|
||||
this.mapper = mapper;
|
||||
this.userDataService = userDataService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
Optional<UserData> userDataOptional = userDataService.getUserByExtId(userId);
|
||||
|
||||
if (userDataOptional.isPresent()) {
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("userData", userDataOptional.get());
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserDuel;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserDuelService;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetUserDuelHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserDuelHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserDuelService userDuelService;
|
||||
|
||||
@Autowired
|
||||
public GetUserDuelHandler(StringMapper mapper, UserDuelService userDuelService) {
|
||||
this.mapper = mapper;
|
||||
this.userDuelService = userDuelService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
String duelId = (String) request.get("duelId");
|
||||
String isAllDuel = (String) request.get("isAllDuel");
|
||||
|
||||
// TODO:
|
||||
|
||||
List<UserDuel> userDuelList = userDuelService.getByUser(userId);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("length", userDuelList.size());
|
||||
resultMap.put("userDuelList", userDuelList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserItem;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserItemService;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Handler for getting user item.
|
||||
* This get call before profile create.
|
||||
*
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetUserItemHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserItemHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserItemService userItemService;
|
||||
|
||||
public GetUserItemHandler(StringMapper mapper, UserItemService userItemService) {
|
||||
this.mapper = mapper;
|
||||
this.userItemService = userItemService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
Long nextIndexVal = Long.parseLong((String) request.get("nextIndex"));
|
||||
int maxCount = Integer.parseInt((String) request.get("maxCount"));
|
||||
|
||||
Long mul = 10000000000L;
|
||||
|
||||
int kind = (int) (nextIndexVal / mul);
|
||||
int nextIndex = (int) (nextIndexVal % mul);
|
||||
int pageNum = nextIndex / maxCount;
|
||||
|
||||
Page<UserItem> userItemPage = userItemService.getByUserAndItemKind(userId, kind, pageNum, maxCount);
|
||||
|
||||
List<UserItem> userItemList = userItemPage.getContent();
|
||||
|
||||
long currentIndex = kind * mul + maxCount * pageNum + userItemPage.getNumberOfElements();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("length", userItemPage.getNumberOfElements());
|
||||
resultMap.put("nextIndex", userItemPage.getNumberOfElements() < maxCount ? -1 : currentIndex);
|
||||
resultMap.put("itemKind", kind);
|
||||
resultMap.put("userItemList", userItemList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserMap;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserMapService;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetUserMapHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserItemHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserMapService userMapService;
|
||||
|
||||
@Autowired
|
||||
public GetUserMapHandler(StringMapper mapper, UserMapService userMapService) {
|
||||
this.mapper = mapper;
|
||||
this.userMapService = userMapService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
|
||||
List<UserMap> userMapList = userMapService.getByUser(userId);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("length", userMapList.size());
|
||||
resultMap.put("userMapList", userMapList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.response.data.UserMusicListItem;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserMusicDetail;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.GameMusicService;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserMusicDetailService;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Response:
|
||||
*
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetUserMusicHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserMusicHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserMusicDetailService userMusicDetailService;
|
||||
|
||||
private final GameMusicService gameMusicService;
|
||||
|
||||
@Autowired
|
||||
public GetUserMusicHandler(StringMapper mapper, UserMusicDetailService userMusicDetailService, GameMusicService gameMusicService) {
|
||||
this.mapper = mapper;
|
||||
this.userMusicDetailService = userMusicDetailService;
|
||||
this.gameMusicService = gameMusicService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
int nextIndex = Integer.parseInt((String) request.get("nextIndex"));
|
||||
int maxCount = Integer.parseInt((String) request.get("maxCount"));
|
||||
|
||||
|
||||
List<UserMusicDetail> userMusicDetailList = userMusicDetailService.getByUser(userId);
|
||||
|
||||
|
||||
Map<Integer, Map<Integer, UserMusicDetail>> allMusicMap = new LinkedHashMap<>();
|
||||
|
||||
userMusicDetailList.forEach(userMusicDetail -> {
|
||||
|
||||
int musicId = userMusicDetail.getMusicId();
|
||||
int level = userMusicDetail.getLevel();
|
||||
|
||||
if (allMusicMap.containsKey(musicId)) {
|
||||
allMusicMap.get(musicId).put(level, userMusicDetail);
|
||||
} else {
|
||||
Map<Integer, UserMusicDetail> levelMap = new HashMap<>();
|
||||
levelMap.put(level, userMusicDetail);
|
||||
allMusicMap.put(musicId, levelMap);
|
||||
}
|
||||
});
|
||||
|
||||
// Convert to result format
|
||||
// Result Map
|
||||
Map<Integer, UserMusicListItem> userMusicMap = new LinkedHashMap<>();
|
||||
|
||||
allMusicMap.forEach((mid, lvMap) -> {
|
||||
UserMusicListItem list;
|
||||
if (userMusicMap.containsKey(mid)) {
|
||||
list = userMusicMap.get(mid);
|
||||
} else {
|
||||
list = new UserMusicListItem(0, new ArrayList<>());
|
||||
userMusicMap.put(mid, list);
|
||||
}
|
||||
list.getUserMusicDetailList().addAll(lvMap.values());
|
||||
list.setLength(lvMap.size());
|
||||
});
|
||||
|
||||
List<UserMusicListItem> result = userMusicMap.values().stream().skip(nextIndex).limit(maxCount).collect(Collectors.toList());
|
||||
|
||||
|
||||
long currentIndex = result.size();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("length", result.size());
|
||||
resultMap.put("nextIndex", allMusicMap.size() < maxCount ? -1 : currentIndex);
|
||||
resultMap.put("userMusicList", result);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserGameOptionEx;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserGameOptionExService;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetUserOptionExHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserOptionExHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserGameOptionExService userGameOptionExService;
|
||||
|
||||
@Autowired
|
||||
public GetUserOptionExHandler(StringMapper mapper, UserGameOptionExService userGameOptionExService) {
|
||||
this.mapper = mapper;
|
||||
this.userGameOptionExService = userGameOptionExService;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
Optional<UserGameOptionEx> userGameOptionEx = userGameOptionExService.getByUserId(userId);
|
||||
|
||||
if (userGameOptionEx.isPresent()) {
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("userGameOptionEx", userGameOptionEx.get());
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserGameOption;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserGameOptionService;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetUserOptionHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserOptionHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserGameOptionService userGameOptionService;
|
||||
|
||||
@Autowired
|
||||
public GetUserOptionHandler(StringMapper mapper, UserGameOptionService userGameOptionService) {
|
||||
this.mapper = mapper;
|
||||
this.userGameOptionService = userGameOptionService;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
Optional<UserGameOption> userGameOption = userGameOptionService.getByUserId(userId);
|
||||
|
||||
if (userGameOption.isPresent()) {
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("userGameOption", userGameOption.get());
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.response.GetUserPreviewResp;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserCharacter;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserGameOption;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserCharacterService;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserDataService;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserGameOptionService;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* The handler for loading basic profile information.
|
||||
* <p>
|
||||
* return null if no profile exist
|
||||
*
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetUserPreviewHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserPreviewHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserDataService userDataService;
|
||||
private final UserCharacterService userCharacterService;
|
||||
private final UserGameOptionService userGameOptionService;
|
||||
|
||||
@Autowired
|
||||
public GetUserPreviewHandler(StringMapper mapper, UserDataService userDataService, UserCharacterService userCharacterService, UserGameOptionService userGameOptionService) {
|
||||
this.mapper = mapper;
|
||||
this.userDataService = userDataService;
|
||||
this.userCharacterService = userCharacterService;
|
||||
this.userGameOptionService = userGameOptionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
|
||||
Optional<UserData> userData = userDataService.getUserByExtId(userId);
|
||||
|
||||
if (userData.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
UserData user = userData.get();
|
||||
|
||||
GetUserPreviewResp resp = new GetUserPreviewResp();
|
||||
resp.setUserId(userId);
|
||||
resp.setLogin(false);
|
||||
resp.setLastLoginDate(user.getLastLoginDate());
|
||||
resp.setUserName(user.getUserName());
|
||||
resp.setReincarnationNum(user.getReincarnationNum());
|
||||
resp.setLevel(user.getLevel());
|
||||
resp.setExp(user.getExp());
|
||||
resp.setPlayerRating(user.getPlayerRating());
|
||||
resp.setLastGameId(user.getLastGameId());
|
||||
resp.setLastRomVersion(user.getLastRomVersion());
|
||||
resp.setLastDataVersion(user.getLastDataVersion());
|
||||
resp.setLastPlayDate(user.getLastPlayDate());
|
||||
resp.setTrophyId(user.getTrophyId());
|
||||
|
||||
Optional<UserCharacter> userCharacterOptional = userCharacterService.getByUserAndCharacterId(user, user.getCharacterId());
|
||||
userCharacterOptional.ifPresent(resp::setUserCharacter);
|
||||
|
||||
Optional<UserGameOption> userGameOptionOptional = userGameOptionService.getByUser(user);
|
||||
userGameOptionOptional.ifPresent(userGameOption -> {
|
||||
resp.setPlayerLevel(userGameOption.getPlayerLevel());
|
||||
resp.setRating(userGameOption.getRating());
|
||||
resp.setHeadphone(userGameOption.getHeadphone());
|
||||
});
|
||||
|
||||
String json = mapper.write(resp);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.response.data.UserRecentRating;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserPlaylog;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserPlaylogService;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Return the recent play to calculate rating. Rating base on top 30 songs plus top 10 in recent 30 plays.
|
||||
*
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetUserRecentRatingHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserRecentRatingHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserPlaylogService userPlaylogService;
|
||||
|
||||
@Autowired
|
||||
public GetUserRecentRatingHandler(StringMapper mapper, UserPlaylogService userPlaylogService) {
|
||||
this.mapper = mapper;
|
||||
this.userPlaylogService = userPlaylogService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
|
||||
List<UserPlaylog> top = userPlaylogService.getRecent30Plays(userId);
|
||||
List<UserRecentRating> rating = top.stream().map(log -> new UserRecentRating(log.getMusicId(), log.getLevel(), "1030000", log.getScore()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("length", rating.size());
|
||||
resultMap.put("userRecentRatingList", rating);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class GetUserRegionHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserRegionHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
@Autowired
|
||||
public GetUserRegionHandler(StringMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
|
||||
List<Object> userRegionList = new ArrayList<>();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("userRegionList", userRegionList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class UpsertClientBookkeepingHandler {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class UpsertClientDevelopHandler {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class UpsertClientErrorHandler {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class UpsertClientSettingHandler {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class UpsertClientTestmodeHandler {
|
||||
}
|
||||
@@ -0,0 +1,350 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.response.CodeResp;
|
||||
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.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* The handler for save user data. Only send in the end of the session.
|
||||
*
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class UpsertUserAllHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(UpsertUserAllHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final CardService cardService;
|
||||
|
||||
private final UserDataService userDataService;
|
||||
private final UserCharacterService userCharacterService;
|
||||
private final UserGameOptionService userGameOptionService;
|
||||
private final UserGameOptionExService userGameOptionExService;
|
||||
private final UserMapService userMapService;
|
||||
private final UserItemService userItemService;
|
||||
private final UserMusicDetailService userMusicDetailService;
|
||||
private final UserActivityService userActivityService;
|
||||
private final UserPlaylogService userPlaylogService;
|
||||
private final UserChargeService userChargeService;
|
||||
private final UserDataExService userDataExService;
|
||||
private final UserCourseService userCourseService;
|
||||
private final UserDuelService userDuelService;
|
||||
|
||||
@Autowired
|
||||
public UpsertUserAllHandler(StringMapper mapper, CardService cardService, UserDataService userDataService, UserCharacterService userCharacterService, UserGameOptionService userGameOptionService, UserGameOptionExService userGameOptionExService, UserMapService userMapService, UserItemService userItemService, UserMusicDetailService userMusicDetailService, UserActivityService userActivityService, UserPlaylogService userPlaylogService, UserChargeService userChargeService, UserDataExService userDataExService, UserCourseService userCourseService, UserDuelService userDuelService) {
|
||||
this.mapper = mapper;
|
||||
this.cardService = cardService;
|
||||
this.userDataService = userDataService;
|
||||
this.userCharacterService = userCharacterService;
|
||||
this.userGameOptionService = userGameOptionService;
|
||||
this.userGameOptionExService = userGameOptionExService;
|
||||
this.userMapService = userMapService;
|
||||
this.userItemService = userItemService;
|
||||
this.userMusicDetailService = userMusicDetailService;
|
||||
this.userActivityService = userActivityService;
|
||||
this.userPlaylogService = userPlaylogService;
|
||||
this.userChargeService = userChargeService;
|
||||
this.userDataExService = userDataExService;
|
||||
this.userCourseService = userCourseService;
|
||||
this.userDuelService = userDuelService;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
Map<String, Object> upsertUserAll = (Map<String, Object>) request.get("upsertUserAll");
|
||||
|
||||
// Not all field will be sent. Check if they are exist first.
|
||||
|
||||
UserData userData;
|
||||
UserData newUserData;
|
||||
// UserData
|
||||
if (!upsertUserAll.containsKey("userData")) {
|
||||
return null;
|
||||
} else {
|
||||
Map<String, Object> userDataMap = ((List<Map<String, Object>>) upsertUserAll.get("userData")).get(0);
|
||||
|
||||
Optional<UserData> userOptional = userDataService.getUserByExtId(userId);
|
||||
|
||||
|
||||
if (userOptional.isPresent()) {
|
||||
userData = userOptional.get();
|
||||
} else {
|
||||
userData = new UserData();
|
||||
Card card = cardService.getCardByExtId(userId).orElseThrow();
|
||||
userData.setCard(card);
|
||||
}
|
||||
|
||||
// Map the map to object
|
||||
newUserData = mapper.convert(userDataMap, UserData.class);
|
||||
|
||||
newUserData.setId(userData.getId());
|
||||
newUserData.setCard(userData.getCard());
|
||||
|
||||
|
||||
// Decode Username
|
||||
String userName = new String(newUserData.getUserName()
|
||||
.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
|
||||
|
||||
|
||||
newUserData.setUserName(userName);
|
||||
userDataService.saveAndFlushUserData(newUserData);
|
||||
}
|
||||
|
||||
// userGameOption
|
||||
if (upsertUserAll.containsKey("userGameOption")) {
|
||||
Map<String, Object> userGameOptionMap = ((List<Map<String, Object>>) upsertUserAll.get("userGameOption")).get(0);
|
||||
|
||||
Optional<UserGameOption> userGameOptionOptional = userGameOptionService.getByUser(newUserData);
|
||||
|
||||
UserGameOption userGameOption = userGameOptionOptional.orElseGet(() -> new UserGameOption(newUserData));
|
||||
|
||||
UserGameOption newUserGameOption = mapper.convert(userGameOptionMap, UserGameOption.class);
|
||||
newUserGameOption.setId(userGameOption.getId());
|
||||
newUserGameOption.setUser(userGameOption.getUser());
|
||||
|
||||
userGameOptionService.save(newUserGameOption);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// userGameOptionEx
|
||||
if (upsertUserAll.containsKey("userGameOptionEx")) {
|
||||
Map<String, Object> userGameOptionExMap = ((List<Map<String, Object>>) upsertUserAll.get("userGameOptionEx")).get(0);
|
||||
|
||||
Optional<UserGameOptionEx> userGameOptionExOptional = userGameOptionExService.getByUser(newUserData);
|
||||
UserGameOptionEx userGameOptionEx = userGameOptionExOptional.orElseGet(() -> new UserGameOptionEx(newUserData));
|
||||
|
||||
UserGameOptionEx newUserGameOptionEx = mapper.convert(userGameOptionExMap, UserGameOptionEx.class);
|
||||
newUserGameOptionEx.setId(userGameOptionEx.getId());
|
||||
newUserGameOptionEx.setUser(userGameOptionEx.getUser());
|
||||
|
||||
userGameOptionExService.save(newUserGameOptionEx);
|
||||
}
|
||||
|
||||
// userMapList
|
||||
if (upsertUserAll.containsKey("userMapList")) {
|
||||
|
||||
int mapPos = 0;
|
||||
|
||||
List<Map<String, Object>> userMapList = (List<Map<String, Object>>) upsertUserAll.get("userMapList");
|
||||
Map<String, UserMap> newUserMapMap = new HashMap<>();
|
||||
|
||||
userMapList.forEach(userMapListMap -> {
|
||||
String mapId = (String) userMapListMap.get("mapId");
|
||||
UserMap userMap;
|
||||
Optional<UserMap> userMapOptional = userMapService.getByUserAndMapId(newUserData, mapId);
|
||||
userMap = userMapOptional.orElseGet(() -> new UserMap(newUserData));
|
||||
|
||||
|
||||
UserMap newUserMap = mapper.convert(userMapListMap, UserMap.class);
|
||||
newUserMap.setId(userMap.getId());
|
||||
newUserMap.setUser(userMap.getUser());
|
||||
|
||||
newUserMapMap.put(mapId, newUserMap);
|
||||
|
||||
});
|
||||
userMapService.saveAll(newUserMapMap.values());
|
||||
}
|
||||
|
||||
// userCharacterList
|
||||
if (upsertUserAll.containsKey("userCharacterList")) {
|
||||
|
||||
List<Map<String, Object>> userCharacterList = (List<Map<String, Object>>) upsertUserAll.get("userCharacterList");
|
||||
Map<String, UserCharacter> newCharacterMap = new HashMap<>();
|
||||
|
||||
userCharacterList.forEach(userCharacterMap -> {
|
||||
String characterId = (String) userCharacterMap.get("characterId");
|
||||
|
||||
Optional<UserCharacter> userCharacterOptional = userCharacterService.getByUserAndCharacterId(newUserData, characterId);
|
||||
UserCharacter userCharacter = userCharacterOptional.orElseGet(() -> new UserCharacter(newUserData));
|
||||
|
||||
UserCharacter newUserCharacter = mapper.convert(userCharacterMap, UserCharacter.class);
|
||||
newUserCharacter.setId(userCharacter.getId());
|
||||
newUserCharacter.setUser(userCharacter.getUser());
|
||||
|
||||
newCharacterMap.put(characterId, newUserCharacter);
|
||||
});
|
||||
userCharacterService.saveAll(newCharacterMap.values());
|
||||
}
|
||||
|
||||
// userItemList
|
||||
if (upsertUserAll.containsKey("userItemList")) {
|
||||
|
||||
List<Map<String, Object>> userItemList = (List<Map<String, Object>>) upsertUserAll.get("userItemList");
|
||||
Map<String, UserItem> newUserItemMap = new HashMap<>();
|
||||
|
||||
userItemList.forEach(userItemMap -> {
|
||||
String itemId = (String) userItemMap.get("itemId");
|
||||
|
||||
|
||||
Optional<UserItem> userItemOptional = userItemService.getByUserAndItemId(newUserData, itemId);
|
||||
UserItem userItem = userItemOptional.orElseGet(() -> new UserItem(newUserData));
|
||||
|
||||
UserItem newUserItem = mapper.convert(userItemMap, UserItem.class);
|
||||
newUserItem.setId(userItem.getId());
|
||||
newUserItem.setUser(userItem.getUser());
|
||||
|
||||
newUserItemMap.put(itemId, newUserItem);
|
||||
});
|
||||
userItemService.saveAll(newUserItemMap.values());
|
||||
}
|
||||
|
||||
// userMusicDetailList
|
||||
if (upsertUserAll.containsKey("userMusicDetailList")) {
|
||||
|
||||
List<Map<String, Object>> userMusicDetailList = (List<Map<String, Object>>) upsertUserAll.get("userMusicDetailList");
|
||||
Map<String, UserMusicDetail> newUserMusicDetailMap = new HashMap<>();
|
||||
|
||||
userMusicDetailList.forEach(userMusicDetailMap -> {
|
||||
String musicId = (String) userMusicDetailMap.get("musicId");
|
||||
String level = (String) userMusicDetailMap.get("level");
|
||||
|
||||
Optional<UserMusicDetail> userMusicDetailOptional = userMusicDetailService.getByUserAndMusicIdAndLevel(newUserData, musicId, level);
|
||||
UserMusicDetail userMusicDetail = userMusicDetailOptional.orElseGet(() -> new UserMusicDetail(newUserData));
|
||||
|
||||
UserMusicDetail newUserMusicDetail = mapper.convert(userMusicDetailMap, UserMusicDetail.class);
|
||||
newUserMusicDetail.setId(userMusicDetail.getId());
|
||||
newUserMusicDetail.setUser(userMusicDetail.getUser());
|
||||
|
||||
newUserMusicDetailMap.put(musicId + "," + level, newUserMusicDetail);
|
||||
|
||||
});
|
||||
userMusicDetailService.saveAll(newUserMusicDetailMap.values());
|
||||
|
||||
}
|
||||
|
||||
// userActivityList
|
||||
if (upsertUserAll.containsKey("userActivityList")) {
|
||||
|
||||
List<Map<String, Object>> userActivityList = (List<Map<String, Object>>) upsertUserAll.get("userActivityList");
|
||||
userActivityList.forEach(userActivityMap -> {
|
||||
// No need to rename to activityId. jackson auto handle that
|
||||
String activityId = (String) userActivityMap.get("id");
|
||||
String kind = (String) userActivityMap.get("kind");
|
||||
|
||||
Optional<UserActivity> userActivityOptional = userActivityService.getByUserAndActivityIdAndKind(newUserData, activityId, kind);
|
||||
UserActivity userActivity = userActivityOptional.orElseGet(() -> new UserActivity(newUserData));
|
||||
|
||||
UserActivity newUserActivity = mapper.convert(userActivityMap, UserActivity.class);
|
||||
newUserActivity.setId(userActivity.getId());
|
||||
newUserActivity.setUser(userActivity.getUser());
|
||||
|
||||
userActivityService.save(newUserActivity);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// userRecentRatingList
|
||||
|
||||
// userChargeList
|
||||
|
||||
if (upsertUserAll.containsKey("userChargeList")) {
|
||||
List<Map<String, Object>> userChargeList = (List<Map<String, Object>>) upsertUserAll.get("userChargeList");
|
||||
List<UserCharge> newUserChargeList = new ArrayList<>();
|
||||
userChargeList.forEach(userChargeMap -> {
|
||||
String chargeId = (String) userChargeMap.get("chargeId");
|
||||
|
||||
Optional<UserCharge> userChargeOptional = userChargeService.getByUserAndChargeId(newUserData, chargeId);
|
||||
UserCharge userCharge = userChargeOptional.orElseGet(() -> new UserCharge(newUserData));
|
||||
|
||||
UserCharge newUserCharge = mapper.convert(userChargeMap, UserCharge.class);
|
||||
newUserCharge.setId(userCharge.getId());
|
||||
newUserCharge.setUser(userCharge.getUser());
|
||||
newUserChargeList.add(newUserCharge);
|
||||
});
|
||||
|
||||
userChargeService.saveAll(newUserChargeList);
|
||||
}
|
||||
|
||||
// userPlaylogList
|
||||
if (upsertUserAll.containsKey("userPlaylogList")) {
|
||||
|
||||
List<Map<String, Object>> userPlaylogList = (List<Map<String, Object>>) upsertUserAll.get("userPlaylogList");
|
||||
List<UserPlaylog> newUserPlaylogList = new ArrayList<>();
|
||||
userPlaylogList.forEach(userPlayLogMap -> {
|
||||
|
||||
UserPlaylog newUserPlaylog = mapper.convert(userPlayLogMap, UserPlaylog.class);
|
||||
newUserPlaylog.setUser(newUserData);
|
||||
|
||||
newUserPlaylogList.add(newUserPlaylog);
|
||||
});
|
||||
|
||||
if (newUserPlaylogList.size() > 0) userPlaylogService.saveAll(newUserPlaylogList);
|
||||
}
|
||||
|
||||
|
||||
// userCourseList
|
||||
if (upsertUserAll.containsKey("userCourseList")) {
|
||||
List<Map<String, Object>> userCourseList = (List<Map<String, Object>>) upsertUserAll.get("userCourseList");
|
||||
|
||||
userCourseList.forEach(userCourseMap -> {
|
||||
String courseId = (String) userCourseMap.get("courseId");
|
||||
|
||||
Optional<UserCourse> userCourseOptional = userCourseService.getByUserAndCourseId(newUserData, courseId);
|
||||
UserCourse userCourse = userCourseOptional.orElseGet(() -> new UserCourse(newUserData));
|
||||
|
||||
UserCourse newUserCourse = mapper.convert(userCourseMap, UserCourse.class);
|
||||
newUserCourse.setId(userCourse.getId());
|
||||
newUserCourse.setUser(userCourse.getUser());
|
||||
|
||||
userCourseService.save(newUserCourse);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// userDataEx
|
||||
if (upsertUserAll.containsKey("userDataEx")) {
|
||||
Map<String, Object> userDataExMap = ((List<Map<String, Object>>) upsertUserAll.get("userDataEx")).get(0);
|
||||
|
||||
Optional<UserDataEx> userDataExOptional = userDataExService.getByUser(newUserData);
|
||||
UserDataEx userDataEx = userDataExOptional.orElseGet(() -> new UserDataEx(newUserData));
|
||||
|
||||
UserDataEx newUserDataEx = mapper.convert(userDataExMap, UserDataEx.class);
|
||||
newUserDataEx.setId(userDataEx.getId());
|
||||
newUserDataEx.setUser(userDataEx.getUser());
|
||||
|
||||
userDataExService.save(newUserDataEx);
|
||||
}
|
||||
|
||||
// userDuelList
|
||||
if (upsertUserAll.containsKey("userDuelList")) {
|
||||
|
||||
List<Map<String, Object>> userDuelList = (List<Map<String, Object>>) upsertUserAll.get("userDuelList");
|
||||
Map<String, UserDuel> newUserDuelMap = new HashMap<>();
|
||||
userDuelList.forEach(userDuelMap -> {
|
||||
String duelId = (String) userDuelMap.get("duelId");
|
||||
|
||||
Optional<UserDuel> userDuelOptional = userDuelService.getByUserAndDuelId(newUserData, duelId);
|
||||
UserDuel userDuel = userDuelOptional.orElseGet(() -> new UserDuel(newUserData));
|
||||
|
||||
UserDuel newUserDuel = mapper.convert(userDuelMap, UserDuel.class);
|
||||
newUserDuel.setId(userDuel.getId());
|
||||
newUserDuel.setUser(userDuel.getUser());
|
||||
|
||||
newUserDuelMap.put(duelId, newUserDuel);
|
||||
});
|
||||
|
||||
userDuelService.saveAll(newUserDuelMap.values());
|
||||
}
|
||||
|
||||
String json = mapper.write(new CodeResp(1));
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.response.CodeResp;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserCharge;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserChargeService;
|
||||
import icu.samnyan.aqua.sega.chunithm.service.UserDataService;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
public class UpsertUserChargelogHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(UpsertUserChargelogHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserDataService userDataService;
|
||||
private final UserChargeService userChargeService;
|
||||
|
||||
public UpsertUserChargelogHandler(StringMapper mapper, UserDataService userDataService, UserChargeService userChargeService) {
|
||||
this.mapper = mapper;
|
||||
this.userDataService = userDataService;
|
||||
this.userChargeService = userChargeService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
UserData user = userDataService.getUserByExtId(userId).orElseThrow();
|
||||
|
||||
Map<String, Object> userChargeMap = (Map<String, Object>) request.get("userCharge");
|
||||
String chargeId = (String) userChargeMap.get("chargeId");
|
||||
UserCharge charge = mapper.convert(userChargeMap, UserCharge.class);
|
||||
|
||||
UserCharge userCharge = userChargeService.getByUserAndChargeId(user, chargeId).orElseGet(() -> new UserCharge(user));
|
||||
userCharge.setChargeId(charge.getChargeId());
|
||||
userCharge.setStock(charge.getStock());
|
||||
userCharge.setPurchaseDate(charge.getPurchaseDate());
|
||||
userCharge.setValidDate(charge.getValidDate());
|
||||
userCharge.setParam1(charge.getParam1());
|
||||
userCharge.setParam2(charge.getParam2());
|
||||
userCharge.setParamDate(charge.getParamDate());
|
||||
|
||||
userChargeService.save(userCharge);
|
||||
|
||||
String json = mapper.write(new CodeResp(1));
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.gamedata;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
public enum Diff {
|
||||
|
||||
BASIC("BASIC"),
|
||||
ADVANCED("ADVANCED"),
|
||||
EXPERT("EXPERT"),
|
||||
MASTER("MASTER"),
|
||||
WE("WORLD'S END");
|
||||
|
||||
private String displayName;
|
||||
|
||||
Diff(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public String displayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.gamedata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniGameCharge")
|
||||
@Table(name = "chuni_game_charge")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GameCharge implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
private int orderId;
|
||||
|
||||
@Column(unique = true)
|
||||
private int chargeId;
|
||||
|
||||
private int price;
|
||||
|
||||
private LocalDateTime startDate;
|
||||
|
||||
private LocalDateTime endDate;
|
||||
|
||||
private int salePrice;
|
||||
|
||||
private LocalDateTime saleStartDate;
|
||||
|
||||
private LocalDateTime saleEndDate;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.gamedata;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniGameEvent")
|
||||
@Table(name = "chuni_game_event")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GameEvent implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
private int id;
|
||||
|
||||
private int type;
|
||||
|
||||
private LocalDateTime startDate;
|
||||
|
||||
private LocalDateTime endDate;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.gamedata;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniGameMessage")
|
||||
@Table(name = "chuni_game_message")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GameMessage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
private int id;
|
||||
|
||||
private int type;
|
||||
|
||||
private String message;
|
||||
|
||||
private LocalDateTime startDate;
|
||||
|
||||
private LocalDateTime endDate;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.gamedata;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
public enum Genre {
|
||||
POPS_ANIME("POPS & ANIME"),
|
||||
RESERVE("Reserve"),
|
||||
NICONICO("niconico"),
|
||||
TOUHOU("東方Project"),
|
||||
RESERVE2("Reserve2"),
|
||||
ORIGINAL("Original"),
|
||||
VARIETY("Variety"),
|
||||
IRODORI("イロドリミドリ"),
|
||||
KOTONOHA("言ノ葉Project");
|
||||
|
||||
|
||||
private String displayName;
|
||||
|
||||
Genre(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public String displayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.gamedata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniMusicLevel")
|
||||
@Table(name = "chuni_music_level")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Level implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "music_id")
|
||||
private Music music;
|
||||
|
||||
private boolean enable;
|
||||
|
||||
private int level;
|
||||
|
||||
private int levelDecimal;
|
||||
|
||||
private int diff;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.gamedata;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniMusic")
|
||||
@Table(name = "chuni_music")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Music implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
private int musicId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String sortName;
|
||||
|
||||
// Copyright info
|
||||
private String copyright;
|
||||
|
||||
private String artistName;
|
||||
|
||||
private Genre genre;
|
||||
|
||||
private String releaseVersion;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "music")
|
||||
@MapKey(name = "diff")
|
||||
private Map<Integer, Level> levels;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.response;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CodeResp {
|
||||
private int returnCode;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.response.data.GameSetting;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GetGameSettingResp {
|
||||
|
||||
private GameSetting gameSetting;
|
||||
@JsonProperty("isDumpUpload")
|
||||
private boolean isDumpUpload;
|
||||
@JsonProperty("isAou")
|
||||
private boolean isAou;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserCharacter;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GetUserPreviewResp {
|
||||
|
||||
private String userId;
|
||||
@JsonProperty("isLogin")
|
||||
private boolean isLogin;
|
||||
private LocalDateTime lastLoginDate;
|
||||
private String userName;
|
||||
private int reincarnationNum;
|
||||
private int level;
|
||||
private String exp;
|
||||
private int playerRating;
|
||||
private String lastGameId;
|
||||
private String lastRomVersion;
|
||||
private String lastDataVersion;
|
||||
private LocalDateTime lastPlayDate;
|
||||
private int trophyId;
|
||||
private UserCharacter userCharacter;
|
||||
private int playerLevel;
|
||||
private int rating;
|
||||
private int headphone;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.response.data;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
public class AllMusicMapItem {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.response.data;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GameRanking {
|
||||
private long id;
|
||||
private long point;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.response.data;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GameSale {
|
||||
|
||||
private int orderId;
|
||||
|
||||
private int type;
|
||||
|
||||
private int id;
|
||||
// should be float number??
|
||||
private int rate;
|
||||
|
||||
private LocalDateTime startDate;
|
||||
|
||||
private LocalDateTime endDate;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.response.data;
|
||||
|
||||
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 GameSetting {
|
||||
private int dataVersion;
|
||||
@JsonProperty("isMaintenance")
|
||||
private boolean isMaintenance;
|
||||
private int requestInterval;
|
||||
private int rebootStartTime;
|
||||
private int rebootEndTime;
|
||||
@JsonProperty("isBackgroundDistribute")
|
||||
private boolean isBackgroundDistribute;
|
||||
private int maxCountCharacter;
|
||||
private int maxCountItem;
|
||||
private int maxCountMusic;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.response.data;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserMusicDetail;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserMusicListItem {
|
||||
private int length;
|
||||
private List<UserMusicDetail> userMusicDetailList;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.response.data;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserRecentRating {
|
||||
private int musicId;
|
||||
private int difficultId;
|
||||
private String romVersionCode;
|
||||
private int score;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniUserActivity")
|
||||
@Table(name = "chuni_user_activity", uniqueConstraints = {@UniqueConstraint(columnNames = {"user_id", "kind", "activity_id"})})
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonPropertyOrder({"kind", "id", "sortNumber", "param1", "param2", "param3", "param4"})
|
||||
public class UserActivity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserData user;
|
||||
|
||||
private int kind;
|
||||
|
||||
@JsonProperty("id")
|
||||
@Column(name = "activity_id")
|
||||
private int activityId;
|
||||
|
||||
private int sortNumber;
|
||||
|
||||
private int param1;
|
||||
|
||||
private int param2;
|
||||
|
||||
private int param3;
|
||||
|
||||
private int param4;
|
||||
|
||||
public UserActivity(UserData userData) {
|
||||
user = userData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniUserCharacter")
|
||||
@Table(name = "chuni_user_character")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonPropertyOrder({"characterId", "playCount", "level", "skillId", "friendshipExp", "isValid", "isNewMark", "param1", "param2"})
|
||||
public class UserCharacter implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserData user;
|
||||
|
||||
private int characterId;
|
||||
|
||||
private int playCount;
|
||||
|
||||
private int level;
|
||||
|
||||
private int skillId;
|
||||
|
||||
private int friendshipExp;
|
||||
|
||||
@JsonProperty("isValid")
|
||||
private boolean isValid;
|
||||
|
||||
@JsonProperty("isNewMark")
|
||||
private boolean isNewMark;
|
||||
|
||||
private int param1;
|
||||
|
||||
private int param2;
|
||||
|
||||
public UserCharacter(UserData userData) {
|
||||
user = userData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniUserCharge")
|
||||
@Table(name = "chuni_user_charge")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonPropertyOrder({"chargeId", "stock", "purchaseDate", "validDate", "param1", "param2", "paramDate"})
|
||||
public class UserCharge implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserData user;
|
||||
|
||||
private int chargeId;
|
||||
|
||||
private int stock;
|
||||
|
||||
private LocalDateTime purchaseDate;
|
||||
|
||||
private LocalDateTime validDate;
|
||||
|
||||
private int param1;
|
||||
|
||||
private int param2;
|
||||
|
||||
private LocalDateTime paramDate;
|
||||
|
||||
public UserCharge(UserData user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniUserCourse")
|
||||
@Table(name = "chuni_user_course")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserCourse {
|
||||
|
||||
@Id
|
||||
@JsonIgnore
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserData user;
|
||||
|
||||
private int courseId;
|
||||
|
||||
private int classId;
|
||||
|
||||
private int playCount;
|
||||
|
||||
private int scoreMax;
|
||||
|
||||
@JsonProperty("isFullCombo")
|
||||
private boolean isFullCombo;
|
||||
|
||||
@JsonProperty("isAllJustice")
|
||||
private boolean isAllJustice;
|
||||
|
||||
@JsonProperty("isSuccess")
|
||||
private boolean isSuccess;
|
||||
|
||||
private int scoreRank;
|
||||
|
||||
private int eventId;
|
||||
|
||||
private LocalDateTime lastPlayDate;
|
||||
|
||||
private int param1;
|
||||
|
||||
private int param2;
|
||||
|
||||
private int param3;
|
||||
|
||||
private int param4;
|
||||
|
||||
private int playerRating;
|
||||
|
||||
@JsonProperty("isClear")
|
||||
private boolean isClear;
|
||||
|
||||
public UserCourse(UserData userData) {
|
||||
user = userData;
|
||||
}
|
||||
|
||||
public UserCourse(int classId) {
|
||||
this.classId = classId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import icu.samnyan.aqua.sega.general.model.Card;
|
||||
import icu.samnyan.aqua.sega.util.jackson.AccessCodeSerializer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniUserData")
|
||||
@Table(name = "chuni_user_data")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonPropertyOrder({
|
||||
"accessCode",
|
||||
"userName",
|
||||
"isWebJoin",
|
||||
"webLimitDate", "level",
|
||||
"reincarnationNum",
|
||||
"exp",
|
||||
"point",
|
||||
"totalPoint",
|
||||
"playCount",
|
||||
"multiPlayCount",
|
||||
"multiWinCount",
|
||||
"requestResCount",
|
||||
"acceptResCount",
|
||||
"successResCount",
|
||||
"playerRating",
|
||||
"highestRating",
|
||||
"nameplateId",
|
||||
"frameId",
|
||||
"characterId",
|
||||
"trophyId",
|
||||
"playedTutorialBit",
|
||||
"firstTutorialCancelNum",
|
||||
"masterTutorialCancelNum",
|
||||
"totalRepertoireCount",
|
||||
"totalMapNum",
|
||||
"totalHiScore",
|
||||
"totalBasicHighScore",
|
||||
"totalAdvancedHighScore",
|
||||
"totalExpertHighScore",
|
||||
"totalMasterHighScore",
|
||||
"eventWatchedDate",
|
||||
"friendCount",
|
||||
"isMaimai",
|
||||
"firstGameId",
|
||||
"firstRomVersion",
|
||||
"firstDataVersion",
|
||||
"firstPlayDate",
|
||||
"lastGameId",
|
||||
"lastRomVersion",
|
||||
"lastDataVersion",
|
||||
"lastPlayDate",
|
||||
"lastPlaceId",
|
||||
"lastPlaceName",
|
||||
"lastRegionId",
|
||||
"lastRegionName",
|
||||
"lastAllNetId",
|
||||
"lastClientId"})
|
||||
public class UserData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonSerialize(using = AccessCodeSerializer.class)
|
||||
@JsonProperty(value = "accessCode", access = JsonProperty.Access.READ_ONLY)
|
||||
@OneToOne
|
||||
@JoinColumn(name = "card_id")
|
||||
private Card card;
|
||||
// Access code in card
|
||||
|
||||
private String userName;
|
||||
|
||||
@JsonIgnore
|
||||
private LocalDateTime lastLoginDate;
|
||||
|
||||
@JsonProperty("isWebJoin")
|
||||
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;
|
||||
|
||||
// Currently selected UserCharacter
|
||||
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;
|
||||
|
||||
private String lastClientId;
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniUserDataEx")
|
||||
@Table(name = "chuni_user_data_ex")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonPropertyOrder({
|
||||
"compatibleCmVersion",
|
||||
"medal",
|
||||
"mapIconId",
|
||||
"voiceId",
|
||||
"ext1",
|
||||
"ext2",
|
||||
"ext3",
|
||||
"ext4",
|
||||
"ext5",
|
||||
"ext6",
|
||||
"ext7",
|
||||
"ext8",
|
||||
"ext9",
|
||||
"ext10",
|
||||
"ext11",
|
||||
"ext12",
|
||||
"ext13",
|
||||
"ext14",
|
||||
"ext15",
|
||||
"ext16",
|
||||
"ext17",
|
||||
"ext18",
|
||||
"ext19",
|
||||
"ext20",
|
||||
"extStr1",
|
||||
"extStr2",
|
||||
"extStr3",
|
||||
"extStr4",
|
||||
"extStr5",
|
||||
"extLong1",
|
||||
"extLong2",
|
||||
"extLong3",
|
||||
"extLong4",
|
||||
"extLong5"
|
||||
})
|
||||
public class UserDataEx implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserData user;
|
||||
|
||||
private String compatibleCmVersion;
|
||||
|
||||
private int medal;
|
||||
|
||||
private int mapIconId;
|
||||
|
||||
private int voiceId;
|
||||
|
||||
private int ext1;
|
||||
|
||||
private int ext2;
|
||||
|
||||
private int ext3;
|
||||
|
||||
private int ext4;
|
||||
|
||||
private int ext5;
|
||||
|
||||
private int ext6;
|
||||
|
||||
private int ext7;
|
||||
|
||||
private int ext8;
|
||||
|
||||
private int ext9;
|
||||
|
||||
private int ext10;
|
||||
|
||||
private int ext11;
|
||||
|
||||
private int ext12;
|
||||
|
||||
private int ext13;
|
||||
|
||||
private int ext14;
|
||||
|
||||
private int ext15;
|
||||
|
||||
private int ext16;
|
||||
|
||||
private int ext17;
|
||||
|
||||
private int ext18;
|
||||
|
||||
private int ext19;
|
||||
|
||||
private int ext20;
|
||||
|
||||
private String extStr1;
|
||||
|
||||
private String extStr2;
|
||||
|
||||
private String extStr3;
|
||||
|
||||
private String extStr4;
|
||||
|
||||
private String extStr5;
|
||||
|
||||
private long extLong1;
|
||||
|
||||
private long extLong2;
|
||||
|
||||
private long extLong3;
|
||||
|
||||
private long extLong4;
|
||||
|
||||
private long extLong5;
|
||||
|
||||
|
||||
public UserDataEx(UserData userData) {
|
||||
user = userData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniUserDuel")
|
||||
@Table(name = "chuni_user_duel")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserDuel {
|
||||
|
||||
@Id
|
||||
@JsonIgnore
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserData user;
|
||||
|
||||
private int duelId;
|
||||
|
||||
private int progress;
|
||||
|
||||
private int point;
|
||||
|
||||
@JsonProperty("isClear")
|
||||
private boolean isClear;
|
||||
|
||||
private LocalDateTime lastPlayDate;
|
||||
|
||||
private int param1;
|
||||
|
||||
private int param2;
|
||||
|
||||
private int param3;
|
||||
|
||||
private int param4;
|
||||
|
||||
public UserDuel(UserData userData) {
|
||||
user = userData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniUserGameOption")
|
||||
@Table(name = "chuni_user_game_option")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonPropertyOrder({
|
||||
"bgInfo",
|
||||
"fieldColor",
|
||||
"guideSound",
|
||||
"soundEffect",
|
||||
"guideLine",
|
||||
"speed",
|
||||
"optionSet",
|
||||
"matching",
|
||||
"judgePos",
|
||||
"rating",
|
||||
"judgeJustice",
|
||||
"judgeAttack",
|
||||
"headphone",
|
||||
"playerLevel",
|
||||
"successTap",
|
||||
"successExTap",
|
||||
"successSlideHold",
|
||||
"successAir",
|
||||
"successFlick",
|
||||
"successSkill",
|
||||
"successTapTimbre",
|
||||
"privacy"
|
||||
})
|
||||
public class UserGameOption implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@JsonIgnore
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserData user;
|
||||
|
||||
private int bgInfo;
|
||||
|
||||
private int fieldColor;
|
||||
|
||||
private int guideSound;
|
||||
|
||||
private int soundEffect;
|
||||
|
||||
private int guideLine;
|
||||
|
||||
private int speed;
|
||||
|
||||
private int optionSet;
|
||||
|
||||
private int matching;
|
||||
|
||||
private int judgePos;
|
||||
|
||||
private int rating;
|
||||
|
||||
private int judgeJustice;
|
||||
|
||||
private int judgeAttack;
|
||||
|
||||
private int headphone;
|
||||
|
||||
private int playerLevel;
|
||||
|
||||
private int successTap;
|
||||
|
||||
private int successExTap;
|
||||
|
||||
private int successSlideHold;
|
||||
|
||||
private int successAir;
|
||||
|
||||
private int successFlick;
|
||||
|
||||
private int successSkill;
|
||||
|
||||
private int successTapTimbre;
|
||||
|
||||
private int privacy;
|
||||
|
||||
|
||||
public UserGameOption(UserData userData) {
|
||||
user = userData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniUserGameOptionEx")
|
||||
@Table(name = "chuni_user_game_option_ex")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonPropertyOrder({
|
||||
"ext1",
|
||||
"ext2",
|
||||
"ext3",
|
||||
"ext4",
|
||||
"ext5",
|
||||
"ext6",
|
||||
"ext7",
|
||||
"ext8",
|
||||
"ext9",
|
||||
"ext10",
|
||||
"ext11",
|
||||
"ext12",
|
||||
"ext13",
|
||||
"ext14",
|
||||
"ext15",
|
||||
"ext16",
|
||||
"ext17",
|
||||
"ext18",
|
||||
"ext19",
|
||||
"ext20"
|
||||
})
|
||||
public class UserGameOptionEx implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserData user;
|
||||
|
||||
private int ext1;
|
||||
|
||||
private int ext2;
|
||||
|
||||
private int ext3;
|
||||
|
||||
private int ext4;
|
||||
|
||||
private int ext5;
|
||||
|
||||
private int ext6;
|
||||
|
||||
private int ext7;
|
||||
|
||||
private int ext8;
|
||||
|
||||
private int ext9;
|
||||
|
||||
private int ext10;
|
||||
|
||||
private int ext11;
|
||||
|
||||
private int ext12;
|
||||
|
||||
private int ext13;
|
||||
|
||||
private int ext14;
|
||||
|
||||
private int ext15;
|
||||
|
||||
private int ext16;
|
||||
|
||||
private int ext17;
|
||||
|
||||
private int ext18;
|
||||
|
||||
private int ext19;
|
||||
|
||||
private int ext20;
|
||||
|
||||
|
||||
public UserGameOptionEx(UserData userData) {
|
||||
user = userData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniUserItem")
|
||||
@Table(name = "chuni_user_item")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonPropertyOrder({"itemKind", "itemId", "stock", "isValid"})
|
||||
public class UserItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserData user;
|
||||
|
||||
// Kind ,Type
|
||||
private int itemKind;
|
||||
|
||||
private int itemId;
|
||||
|
||||
private int stock;
|
||||
|
||||
@JsonProperty("isValid")
|
||||
private boolean isValid;
|
||||
|
||||
public UserItem(UserData userData) {
|
||||
user = userData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniUserMap")
|
||||
@Table(name = "chuni_user_map")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonPropertyOrder({
|
||||
"mapId",
|
||||
"position",
|
||||
"isClear",
|
||||
"areaId",
|
||||
"routeNumber",
|
||||
"eventId",
|
||||
"rate",
|
||||
"statusCount",
|
||||
"isValid"
|
||||
})
|
||||
public class UserMap implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserData user;
|
||||
|
||||
private int mapId;
|
||||
|
||||
private int position;
|
||||
|
||||
@JsonProperty("isClear")
|
||||
private boolean isClear;
|
||||
|
||||
private int areaId;
|
||||
|
||||
private int routeNumber;
|
||||
|
||||
private int eventId;
|
||||
|
||||
private int rate;
|
||||
|
||||
private int statusCount;
|
||||
|
||||
@JsonProperty("isValid")
|
||||
private boolean isValid;
|
||||
|
||||
public UserMap(UserData userData) {
|
||||
user = userData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniUserMusicDetail")
|
||||
@Table(name = "chuni_user_music_detail")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonPropertyOrder({
|
||||
"musicId",
|
||||
"level",
|
||||
"playCount",
|
||||
"scoreMax",
|
||||
"resRequestCount",
|
||||
"resAcceptCount",
|
||||
"resSuccessCount",
|
||||
"missCount",
|
||||
"maxComboCount",
|
||||
"isFullCombo",
|
||||
"isAllJustice",
|
||||
"isSuccess",
|
||||
"fullChain",
|
||||
"maxChain",
|
||||
"scoreRank",
|
||||
"isLock"
|
||||
})
|
||||
public class UserMusicDetail implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserData user;
|
||||
|
||||
private int musicId;
|
||||
|
||||
private int level;
|
||||
|
||||
private int playCount;
|
||||
|
||||
private int 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;
|
||||
|
||||
@JsonProperty("isLock")
|
||||
private boolean isLock;
|
||||
|
||||
|
||||
public UserMusicDetail(UserData userData) {
|
||||
user = userData;
|
||||
}
|
||||
|
||||
public UserMusicDetail(int musicId, int level, int playCount, int scoreMax, int resRequestCount, int resAcceptCount, int resSuccessCount, int missCount, int maxComboCount, boolean isFullCombo, boolean isAllJustice, boolean isSuccess, int fullChain, int maxChain, int scoreRank, boolean isLock) {
|
||||
this.musicId = musicId;
|
||||
this.level = level;
|
||||
this.playCount = playCount;
|
||||
this.scoreMax = scoreMax;
|
||||
this.resRequestCount = resRequestCount;
|
||||
this.resAcceptCount = resAcceptCount;
|
||||
this.resSuccessCount = resSuccessCount;
|
||||
this.missCount = missCount;
|
||||
this.maxComboCount = maxComboCount;
|
||||
this.isFullCombo = isFullCombo;
|
||||
this.isAllJustice = isAllJustice;
|
||||
this.isSuccess = isSuccess;
|
||||
this.fullChain = fullChain;
|
||||
this.maxChain = maxChain;
|
||||
this.scoreRank = scoreRank;
|
||||
this.isLock = isLock;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "ChuniUserPlaylog")
|
||||
@Table(name = "chuni_user_playlog")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserPlaylog implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserData user;
|
||||
|
||||
private int orderId;
|
||||
|
||||
private int sortNumber;
|
||||
|
||||
private int placeId;
|
||||
|
||||
private LocalDateTime playDate;
|
||||
|
||||
private LocalDateTime userPlayDate;
|
||||
|
||||
private int musicId;
|
||||
|
||||
private int level;
|
||||
|
||||
private int customId;
|
||||
|
||||
private int playedUserId1;
|
||||
|
||||
private int playedUserId2;
|
||||
|
||||
private int playedUserId3;
|
||||
|
||||
private String playedUserName1;
|
||||
|
||||
private String playedUserName2;
|
||||
|
||||
private String playedUserName3;
|
||||
|
||||
private int playedMusicLevel1;
|
||||
|
||||
private int playedMusicLevel2;
|
||||
|
||||
private int playedMusicLevel3;
|
||||
|
||||
private int 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 eventId;
|
||||
|
||||
private int playerRating;
|
||||
|
||||
@JsonProperty("isNewRecord")
|
||||
private boolean isNewRecord;
|
||||
|
||||
@JsonProperty("isFullCombo")
|
||||
private boolean isFullCombo;
|
||||
|
||||
private int fullChainKind;
|
||||
|
||||
@JsonProperty("isAllJustice")
|
||||
private boolean isAllJustice;
|
||||
|
||||
@JsonProperty("isContinue")
|
||||
private boolean isContinue;
|
||||
|
||||
@JsonProperty("isFreeToPlay")
|
||||
private boolean isFreeToPlay;
|
||||
|
||||
private int characterId;
|
||||
|
||||
private int skillId;
|
||||
|
||||
private int playKind;
|
||||
|
||||
@JsonProperty("isClear")
|
||||
private boolean isClear;
|
||||
|
||||
private int skillLevel;
|
||||
|
||||
private int skillEffect;
|
||||
|
||||
private String placeName;
|
||||
|
||||
@JsonProperty("isMaimai")
|
||||
private boolean isMaimai;
|
||||
|
||||
|
||||
public UserPlaylog(UserData userData) {
|
||||
user = userData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.service;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.dao.gamedata.GameMusicRepository;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.gamedata.Music;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
public class GameMusicService {
|
||||
|
||||
private final GameMusicRepository gameMusicRepository;
|
||||
|
||||
@Autowired
|
||||
public GameMusicService(GameMusicRepository gameMusicRepository) {
|
||||
this.gameMusicRepository = gameMusicRepository;
|
||||
}
|
||||
|
||||
public Music save(Music music) {
|
||||
return gameMusicRepository.save(music);
|
||||
}
|
||||
|
||||
public List<Music> saveAll(List<Music> musicList) {
|
||||
return gameMusicRepository.saveAll(musicList);
|
||||
}
|
||||
|
||||
@Cacheable("music")
|
||||
public List<Music> getAll() {
|
||||
return gameMusicRepository.findAll();
|
||||
}
|
||||
|
||||
public Map<Integer, Music> getIdMap() {
|
||||
Map<Integer, Music> musicMap = new LinkedHashMap<>();
|
||||
getAll().forEach(music -> musicMap.put(music.getMusicId(), music));
|
||||
return musicMap;
|
||||
}
|
||||
|
||||
public Optional<Music> getById(String musicId) {
|
||||
return getById(Integer.parseInt(musicId));
|
||||
}
|
||||
|
||||
public Optional<Music> getById(int musicId) {
|
||||
return gameMusicRepository.findByMusicId(musicId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.service;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.dao.userdata.UserActivityRepository;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserActivity;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
public class UserActivityService {
|
||||
|
||||
private final UserActivityRepository userActivityRepository;
|
||||
|
||||
@Autowired
|
||||
public UserActivityService(UserActivityRepository userActivityRepository) {
|
||||
this.userActivityRepository = userActivityRepository;
|
||||
}
|
||||
|
||||
public UserActivity save(UserActivity userActivity) {
|
||||
return userActivityRepository.save(userActivity);
|
||||
}
|
||||
|
||||
public List<UserActivity> saveAll(List<UserActivity> userActivityList) {
|
||||
return userActivityRepository.saveAll(userActivityList);
|
||||
}
|
||||
|
||||
public Optional<UserActivity> getByUserAndActivityIdAndKind(UserData user, String activityId, String kind) {
|
||||
return userActivityRepository.findTopByUserAndActivityIdAndKindOrderByIdDesc(user, Integer.parseInt(activityId), Integer.parseInt(kind));
|
||||
}
|
||||
|
||||
public List<UserActivity> getAllByUserIdAndKind(String userId, String kind) {
|
||||
return userActivityRepository.findAllByUser_Card_ExtIdAndKindOrderBySortNumberDesc(Long.parseLong(userId), Integer.parseInt(kind));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.service;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.dao.userdata.UserCharacterRepository;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserCharacter;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
public class UserCharacterService {
|
||||
|
||||
private final UserCharacterRepository userCharacterRepository;
|
||||
|
||||
@Autowired
|
||||
public UserCharacterService(UserCharacterRepository userCharacterRepository) {
|
||||
this.userCharacterRepository = userCharacterRepository;
|
||||
}
|
||||
|
||||
public Optional<UserCharacter> getByUserAndCharacterId(UserData user, String characterId) {
|
||||
return getByUserAndCharacterId(user, Integer.parseInt(characterId));
|
||||
}
|
||||
|
||||
public Optional<UserCharacter> getByUserAndCharacterId(UserData user, int characterId) {
|
||||
return userCharacterRepository.findTopByUserAndCharacterIdOrderByIdDesc(user, characterId);
|
||||
}
|
||||
|
||||
public UserCharacter save(UserCharacter userCharacter) {
|
||||
return userCharacterRepository.save(userCharacter);
|
||||
}
|
||||
|
||||
public List<UserCharacter> saveAll(Iterable<UserCharacter> userCharacter) {
|
||||
return userCharacterRepository.saveAll(userCharacter);
|
||||
}
|
||||
|
||||
public Page<UserCharacter> getByUser(String userId, int pageNumber, int maxCount) {
|
||||
Pageable pageable = PageRequest.of(pageNumber, maxCount);
|
||||
return userCharacterRepository.findByUser_Card_ExtId(Long.parseLong(userId), pageable);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.service;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.dao.userdata.UserChargeRepository;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserCharge;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
public class UserChargeService {
|
||||
|
||||
private final UserChargeRepository userChargeRepository;
|
||||
|
||||
public UserChargeService(UserChargeRepository userChargeRepository) {
|
||||
this.userChargeRepository = userChargeRepository;
|
||||
}
|
||||
|
||||
public UserCharge save(UserCharge userCharge) {
|
||||
return userChargeRepository.save(userCharge);
|
||||
}
|
||||
|
||||
public List<UserCharge> getByUserId(String userId) {
|
||||
return userChargeRepository.findByUser_Card_ExtId(Long.parseLong(userId));
|
||||
}
|
||||
|
||||
public Optional<UserCharge> getByUserAndChargeId(UserData user, String chargeId) {
|
||||
return userChargeRepository.findByUserAndChargeId(user, Integer.parseInt(chargeId));
|
||||
}
|
||||
|
||||
public List<UserCharge> saveAll(List<UserCharge> newUserChargeList) {
|
||||
return userChargeRepository.saveAll(newUserChargeList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.service;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.dao.userdata.UserCourseRepository;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserCourse;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
public class UserCourseService {
|
||||
|
||||
private final UserCourseRepository userCourseRepository;
|
||||
|
||||
@Autowired
|
||||
public UserCourseService(UserCourseRepository userCourseRepository) {
|
||||
this.userCourseRepository = userCourseRepository;
|
||||
}
|
||||
|
||||
public Optional<UserCourse> getByUserAndCourseId(UserData user, String courseId) {
|
||||
return userCourseRepository.findTopByUserAndCourseIdOrderByIdDesc(user, Integer.parseInt(courseId));
|
||||
}
|
||||
|
||||
public UserCourse save(UserCourse userCourse) {
|
||||
return userCourseRepository.save(userCourse);
|
||||
}
|
||||
|
||||
public List<UserCourse> saveAll(Iterable<UserCourse> userMusicDetail) {
|
||||
return userCourseRepository.saveAll(userMusicDetail);
|
||||
}
|
||||
|
||||
public List<UserCourse> getByUser(String userId) {
|
||||
return userCourseRepository.findByUser_Card_ExtId(Long.parseLong(userId));
|
||||
}
|
||||
|
||||
public Page<UserCourse> getByUser(String userId, int pageNum, int maxCount) {
|
||||
Pageable page = PageRequest.of(pageNum, maxCount);
|
||||
return userCourseRepository.findByUser_Card_ExtId(Long.parseLong(userId), page);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.service;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.dao.userdata.UserDataExRepository;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserDataEx;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
public class UserDataExService {
|
||||
|
||||
private final UserDataExRepository userDataExRepository;
|
||||
|
||||
@Autowired
|
||||
public UserDataExService(UserDataExRepository userDataExRepository) {
|
||||
this.userDataExRepository = userDataExRepository;
|
||||
}
|
||||
|
||||
public Optional<UserDataEx> getByUser(UserData user) {
|
||||
return userDataExRepository.findByUser(user);
|
||||
}
|
||||
|
||||
public UserDataEx save(UserDataEx userDataEx) {
|
||||
return userDataExRepository.save(userDataEx);
|
||||
}
|
||||
|
||||
public Optional<UserDataEx> getUserByExtId(String userId) {
|
||||
return userDataExRepository.findByUser_Card_ExtId(Long.parseLong(userId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.service;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.dao.userdata.UserDataRepository;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
public class UserDataService {
|
||||
|
||||
private final UserDataRepository userDataRepository;
|
||||
|
||||
@Autowired
|
||||
public UserDataService(UserDataRepository userDataRepository) {
|
||||
this.userDataRepository = userDataRepository;
|
||||
}
|
||||
|
||||
public Optional<UserData> getUserByExtId(String aimeId) {
|
||||
return userDataRepository.findByCard_ExtId(Long.parseLong(aimeId));
|
||||
}
|
||||
|
||||
public String updateLoginTime(UserData userData) {
|
||||
userData.setLastLoginDate(LocalDateTime.now());
|
||||
|
||||
try {
|
||||
userDataRepository.save(userData);
|
||||
return "1";
|
||||
} catch (Exception e) {
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
|
||||
public UserData saveUserData(UserData userData) {
|
||||
return userDataRepository.save(userData);
|
||||
}
|
||||
|
||||
public UserData saveAndFlushUserData(UserData userData) {
|
||||
return userDataRepository.saveAndFlush(userData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.service;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.dao.userdata.UserDuelRepository;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserDuel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
public class UserDuelService {
|
||||
|
||||
private final UserDuelRepository userDuelRepository;
|
||||
|
||||
@Autowired
|
||||
public UserDuelService(UserDuelRepository userDuelRepository) {
|
||||
this.userDuelRepository = userDuelRepository;
|
||||
}
|
||||
|
||||
public Optional<UserDuel> getByUserAndDuelId(UserData user, String duelId) {
|
||||
return userDuelRepository.findTopByUserAndDuelIdOrderByIdDesc(user, Integer.parseInt(duelId));
|
||||
}
|
||||
|
||||
public UserDuel save(UserDuel userDuel) {
|
||||
return userDuelRepository.save(userDuel);
|
||||
}
|
||||
|
||||
public List<UserDuel> saveAll(Iterable<UserDuel> userDuel) {
|
||||
return userDuelRepository.saveAll(userDuel);
|
||||
}
|
||||
|
||||
public List<UserDuel> getByUser(String userId) {
|
||||
return userDuelRepository.findByUser_Card_ExtId(Long.parseLong(userId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.service;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.dao.userdata.UserGameOptionExRepository;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserGameOptionEx;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
public class UserGameOptionExService {
|
||||
|
||||
private final UserGameOptionExRepository userGameOptionExRepository;
|
||||
|
||||
@Autowired
|
||||
public UserGameOptionExService(UserGameOptionExRepository userGameOptionExRepository) {
|
||||
this.userGameOptionExRepository = userGameOptionExRepository;
|
||||
}
|
||||
|
||||
public Optional<UserGameOptionEx> getByUser(UserData userData) {
|
||||
return userGameOptionExRepository.findByUser(userData);
|
||||
}
|
||||
|
||||
public UserGameOptionEx save(UserGameOptionEx userGameOptionEx) {
|
||||
return userGameOptionExRepository.save(userGameOptionEx);
|
||||
}
|
||||
|
||||
public Optional<UserGameOptionEx> getByUserId(String userId) {
|
||||
return userGameOptionExRepository.findByUser_Card_ExtId(Long.parseLong(userId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.service;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.dao.userdata.UserGameOptionRepository;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserGameOption;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
public class UserGameOptionService {
|
||||
|
||||
private final UserGameOptionRepository userGameOptionRepository;
|
||||
|
||||
@Autowired
|
||||
public UserGameOptionService(UserGameOptionRepository userGameOptionRepository) {
|
||||
this.userGameOptionRepository = userGameOptionRepository;
|
||||
}
|
||||
|
||||
public Optional<UserGameOption> getByUserId(String userId) {
|
||||
return userGameOptionRepository.findByUser_Card_ExtId(Long.parseLong(userId));
|
||||
}
|
||||
|
||||
public Optional<UserGameOption> getByUser(UserData user) {
|
||||
return userGameOptionRepository.findByUser(user);
|
||||
}
|
||||
|
||||
public UserGameOption save(UserGameOption userGameOption) {
|
||||
return userGameOptionRepository.save(userGameOption);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.service;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.dao.userdata.UserItemRepository;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserItem;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
public class UserItemService {
|
||||
private final UserItemRepository userItemRepository;
|
||||
|
||||
@Autowired
|
||||
public UserItemService(UserItemRepository userItemRepository) {
|
||||
this.userItemRepository = userItemRepository;
|
||||
}
|
||||
|
||||
|
||||
public Optional<UserItem> getByUserAndItemId(UserData user, String itemId) {
|
||||
return userItemRepository.findTopByUserAndItemIdOrderByIdDesc(user, Integer.parseInt(itemId));
|
||||
}
|
||||
|
||||
public UserItem save(UserItem userItem) {
|
||||
return userItemRepository.save(userItem);
|
||||
}
|
||||
|
||||
public List<UserItem> saveAll(Iterable<UserItem> userItem) {
|
||||
return userItemRepository.saveAll(userItem);
|
||||
}
|
||||
|
||||
public Page<UserItem> getByUserAndItemKind(String userId, int kind, int pageNumber, int maxCount) {
|
||||
Pageable page = PageRequest.of(pageNumber, maxCount);
|
||||
return userItemRepository.findAllByUser_Card_ExtIdAndItemKind(Long.parseLong(userId), kind, page);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.service;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.dao.userdata.UserMapRepository;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
public class UserMapService {
|
||||
|
||||
private final UserMapRepository userMapRepository;
|
||||
|
||||
@Autowired
|
||||
public UserMapService(UserMapRepository userMapRepository) {
|
||||
this.userMapRepository = userMapRepository;
|
||||
}
|
||||
|
||||
public List<UserMap> getByUser(UserData user) {
|
||||
return userMapRepository.findAllByUser(user);
|
||||
}
|
||||
|
||||
public List<UserMap> getByUser(String userId) {
|
||||
return userMapRepository.findAllByUser_Card_ExtId(Long.parseLong(userId));
|
||||
}
|
||||
|
||||
public Optional<UserMap> getByUserAndMapId(UserData user, String mapId) {
|
||||
return userMapRepository.findTopByUserAndMapIdOrderByIdDesc(user, Integer.parseInt(mapId));
|
||||
}
|
||||
|
||||
public UserMap save(UserMap userMap) {
|
||||
return userMapRepository.save(userMap);
|
||||
}
|
||||
|
||||
public List<UserMap> saveAll(Iterable<UserMap> userMap) {
|
||||
return userMapRepository.saveAll(userMap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.service;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.dao.userdata.UserMusicDetailRepository;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserMusicDetail;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
public class UserMusicDetailService {
|
||||
|
||||
private final UserMusicDetailRepository userMusicDetailRepository;
|
||||
|
||||
@Autowired
|
||||
public UserMusicDetailService(UserMusicDetailRepository userMusicDetailRepository) {
|
||||
this.userMusicDetailRepository = userMusicDetailRepository;
|
||||
}
|
||||
|
||||
public Optional<UserMusicDetail> getByUserAndMusicIdAndLevel(UserData user, String musicId, String level) {
|
||||
return userMusicDetailRepository.findTopByUserAndMusicIdAndLevelOrderByIdDesc(user, Integer.parseInt(musicId), Integer.parseInt(level));
|
||||
}
|
||||
|
||||
public UserMusicDetail save(UserMusicDetail userMusicDetail) {
|
||||
return userMusicDetailRepository.save(userMusicDetail);
|
||||
}
|
||||
|
||||
public List<UserMusicDetail> saveAll(Iterable<UserMusicDetail> userMusicDetail) {
|
||||
return userMusicDetailRepository.saveAll(userMusicDetail);
|
||||
}
|
||||
|
||||
public List<UserMusicDetail> getByUser(String userId) {
|
||||
return userMusicDetailRepository.findByUser_Card_ExtId(Long.parseLong(userId));
|
||||
}
|
||||
|
||||
public Page<UserMusicDetail> getByUser(String userId, int pageNum, int maxCount) {
|
||||
Pageable page = PageRequest.of(pageNum, maxCount);
|
||||
return userMusicDetailRepository.findByUser_Card_ExtId(Long.parseLong(userId), page);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package icu.samnyan.aqua.sega.chunithm.service;
|
||||
|
||||
import icu.samnyan.aqua.sega.chunithm.dao.userdata.UserPlaylogRepository;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserPlaylog;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Service
|
||||
public class UserPlaylogService {
|
||||
|
||||
private final UserPlaylogRepository userPlaylogRepository;
|
||||
|
||||
@Autowired
|
||||
public UserPlaylogService(UserPlaylogRepository userPlaylogRepository) {
|
||||
this.userPlaylogRepository = userPlaylogRepository;
|
||||
}
|
||||
|
||||
public UserPlaylog save(UserPlaylog userPlaylog) {
|
||||
return userPlaylogRepository.save(userPlaylog);
|
||||
}
|
||||
|
||||
public List<UserPlaylog> saveAll(List<UserPlaylog> userPlaylogList) {
|
||||
return userPlaylogRepository.saveAll(userPlaylogList);
|
||||
}
|
||||
|
||||
public List<UserPlaylog> getRecent30Plays(String userId) {
|
||||
Pageable page = PageRequest.of(0, 30, Sort.by(Sort.Direction.DESC, "userPlayDate"));
|
||||
return userPlaylogRepository.findByUser_Card_ExtIdAndLevelNot(Long.parseLong(userId), 4, page);
|
||||
}
|
||||
|
||||
public List<UserPlaylog> getRecentPlays(String userId) {
|
||||
Pageable page = PageRequest.of(0, 50, Sort.by(Sort.Direction.DESC, "userPlayDate"));
|
||||
return userPlaylogRepository.findByUser_Card_ExtId(Long.parseLong(userId), page);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user