mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-07 01:27:28 +08:00
[ongeki]
Save UserMissionPoint, UserTrainingRoom, UserGeneralData Add GamePoint, GamePresent, GameReward to database Add custom maintenance time to database Save the battle point and rating info send by the game to database [api] Read user_general_data table
This commit is contained in:
@@ -43,10 +43,11 @@ public class ApiOngekiPlayerDataController {
|
||||
private final UserMusicDetailRepository userMusicDetailRepository;
|
||||
private final UserOptionRepository userOptionRepository;
|
||||
private final UserPlaylogRepository userPlaylogRepository;
|
||||
private final UserGeneralDataRepository userGeneralDataRepository;
|
||||
|
||||
private final GameCardRepository gameCardRepository;
|
||||
|
||||
public ApiOngekiPlayerDataController(ApiMapper mapper, UserActivityRepository userActivityRepository, UserCardRepository userCardRepository, UserCharacterRepository userCharacterRepository, UserDataRepository userDataRepository, UserDeckRepository userDeckRepository, UserEventPointRepository userEventPointRepository, UserItemRepository userItemRepository, UserMusicDetailRepository userMusicDetailRepository, UserOptionRepository userOptionRepository, UserPlaylogRepository userPlaylogRepository, GameCardRepository gameCardRepository) {
|
||||
public ApiOngekiPlayerDataController(ApiMapper mapper, UserActivityRepository userActivityRepository, UserCardRepository userCardRepository, UserCharacterRepository userCharacterRepository, UserDataRepository userDataRepository, UserDeckRepository userDeckRepository, UserEventPointRepository userEventPointRepository, UserItemRepository userItemRepository, UserMusicDetailRepository userMusicDetailRepository, UserOptionRepository userOptionRepository, UserPlaylogRepository userPlaylogRepository, UserGeneralDataRepository userGeneralDataRepository, GameCardRepository gameCardRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userActivityRepository = userActivityRepository;
|
||||
this.userCardRepository = userCardRepository;
|
||||
@@ -58,6 +59,7 @@ public class ApiOngekiPlayerDataController {
|
||||
this.userMusicDetailRepository = userMusicDetailRepository;
|
||||
this.userOptionRepository = userOptionRepository;
|
||||
this.userPlaylogRepository = userPlaylogRepository;
|
||||
this.userGeneralDataRepository = userGeneralDataRepository;
|
||||
this.gameCardRepository = gameCardRepository;
|
||||
}
|
||||
|
||||
@@ -280,4 +282,11 @@ public class ApiOngekiPlayerDataController {
|
||||
public UserOption getOptions(@RequestParam Integer aimeId) {
|
||||
return userOptionRepository.findByUser_Card_ExtId(aimeId).orElseThrow();
|
||||
}
|
||||
|
||||
@GetMapping("general")
|
||||
public ResponseEntity<Object> getGeneralData(@RequestParam Integer aimeId, @RequestParam String key) {
|
||||
Optional<UserGeneralData> userGeneralDataOptional = userGeneralDataRepository.findByUser_Card_ExtIdAndPropertyKey(aimeId,key);
|
||||
return userGeneralDataOptional.<ResponseEntity<Object>>map(ResponseEntity::ok)
|
||||
.orElseGet(() -> ResponseEntity.status(HttpStatus.NOT_FOUND).body(new MessageResponse("User or value not found.")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GamePoint;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiGamePointRepository")
|
||||
public interface GamePointRepository extends JpaRepository<GamePoint, Long> {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GamePoint;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GamePresent;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiGamePresentRepository")
|
||||
public interface GamePresentRepository extends JpaRepository<GamePresent, Long> {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GamePresent;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GameReward;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiGameRewardRepository")
|
||||
public interface GameRewardRepository extends JpaRepository<GameReward, Long> {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserGeneralData;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Repository("OngekiUserGeneralDataRepository")
|
||||
public interface UserGeneralDataRepository extends JpaRepository<UserGeneralData, Long> {
|
||||
Optional<UserGeneralData> findByUserAndPropertyKey(UserData user, String key);
|
||||
Optional<UserGeneralData> findByUser_Card_ExtIdAndPropertyKey(int aimeId, String key);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserEventPoint;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserMissionPoint;
|
||||
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("OngekiUserMissionPointRepository")
|
||||
public interface UserMissionPointRepository extends JpaRepository<UserMissionPoint, Long> {
|
||||
Optional<UserMissionPoint> findByUserAndEventId(UserData userData, int eventId);
|
||||
|
||||
List<UserMissionPoint> findByUser_Card_ExtId(int userId);
|
||||
}
|
||||
@@ -1,12 +1,19 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserTrainingRoom;
|
||||
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("OngekiUserTrainingRoomRepository")
|
||||
public interface UserTrainingRoomRepository extends JpaRepository<UserTrainingRoom, Long> {
|
||||
Optional<UserTrainingRoom> findByUserAndRoomId(UserData user, int roomId);
|
||||
|
||||
List<UserTrainingRoom> findByUser_Card_ExtId(int userId);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class GetGameEventHandler implements BaseHandler {
|
||||
x.getId(),
|
||||
type,
|
||||
"2005-01-01 00:00:00.0",
|
||||
"2099-01-01 00:00:00.0"
|
||||
"2099-01-01 05:00:00.0"
|
||||
));
|
||||
});
|
||||
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.dao.PropertyEntryRepository;
|
||||
import icu.samnyan.aqua.sega.general.model.PropertyEntry;
|
||||
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.response.data.GameIdListItem;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.response.data.GameRankingItem;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
@@ -22,32 +23,56 @@ public class GetGameIdlistHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetGameIdlistHandler.class);
|
||||
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final PropertyEntryRepository propertyEntryRepository;
|
||||
|
||||
@Autowired
|
||||
public GetGameIdlistHandler(BasicMapper mapper) {
|
||||
public GetGameIdlistHandler(BasicMapper mapper, PropertyEntryRepository propertyEntryRepository) {
|
||||
this.mapper = mapper;
|
||||
this.propertyEntryRepository = propertyEntryRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
Integer type = (Integer) request.get("type");
|
||||
|
||||
List<GameIdListItem> idList = new ArrayList<>();
|
||||
Optional<PropertyEntry> propertyEntryOptional;
|
||||
if(type == 1) {
|
||||
for (int i = 1; i <= 230; i++) {
|
||||
idList.add(new GameIdListItem(i,type));
|
||||
}
|
||||
for (int i = 8000; i <= 8050; i++) {
|
||||
idList.add(new GameIdListItem(i,type));
|
||||
}
|
||||
propertyEntryOptional = propertyEntryRepository.findByPropertyKey("ongeki_music_ng_list");
|
||||
} else if(type == 2) {
|
||||
propertyEntryOptional = propertyEntryRepository.findByPropertyKey("ongeki_music_recommend_list");
|
||||
} else {
|
||||
propertyEntryOptional = Optional.empty();
|
||||
}
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("type", type);
|
||||
resultMap.put("length", idList.size());
|
||||
resultMap.put("gameIdlistList", idList);
|
||||
|
||||
if (propertyEntryOptional.isPresent()) {
|
||||
String value = propertyEntryOptional.get().getPropertyValue();
|
||||
|
||||
if(StringUtils.isNotBlank(value) && value.contains(",")) {
|
||||
String[] ids = value.split(",");
|
||||
List<GameIdListItem> idList = new LinkedList<>();
|
||||
|
||||
for (String id : ids) {
|
||||
try {
|
||||
idList.add(new GameIdListItem(Integer.parseInt(id), type));
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
}
|
||||
resultMap.put("length", idList.size());
|
||||
resultMap.put("gameIdlistList", idList);
|
||||
|
||||
} else {
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("gameIdlistList", new List[]{});
|
||||
}
|
||||
} else {
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("gameIdlistList", new List[]{});
|
||||
}
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.ongeki.dao.gamedata.GamePointRepository;
|
||||
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.common.GpProductID;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GamePoint;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -22,19 +26,26 @@ public class GetGamePointHandler implements BaseHandler {
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final GamePointRepository gamePointRepository;
|
||||
|
||||
@Autowired
|
||||
public GetGamePointHandler(BasicMapper mapper) {
|
||||
public GetGamePointHandler(BasicMapper mapper, GamePointRepository gamePointRepository) {
|
||||
this.mapper = mapper;
|
||||
this.gamePointRepository = gamePointRepository;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
// This value is always false
|
||||
Boolean isAllGP = (Boolean) request.get("isAllGP");
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("gamePointList", new List[]{});
|
||||
|
||||
List<GamePoint> gpList = gamePointRepository.findAll();
|
||||
|
||||
resultMap.put("length", gpList.size());
|
||||
resultMap.put("gamePointList", gpList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.ongeki.dao.gamedata.GamePresentRepository;
|
||||
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GamePresent;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -22,19 +25,24 @@ public class GetGamePresentHandler implements BaseHandler {
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final GamePresentRepository gamePresentRepository;
|
||||
|
||||
@Autowired
|
||||
public GetGamePresentHandler(BasicMapper mapper) {
|
||||
public GetGamePresentHandler(BasicMapper mapper, GamePresentRepository gamePresentRepository) {
|
||||
this.mapper = mapper;
|
||||
this.gamePresentRepository = gamePresentRepository;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
// Boolean isAllGP = (Boolean) request.get("isAllReward");
|
||||
Boolean isAllPresent = (Boolean) request.get("isAllPresent");
|
||||
|
||||
List<GamePresent> presentList = gamePresentRepository.findAll();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("gamePresentList", new List[]{});
|
||||
resultMap.put("length", presentList.size());
|
||||
resultMap.put("gamePresentList", presentList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.dao.PropertyEntryRepository;
|
||||
import icu.samnyan.aqua.sega.general.model.PropertyEntry;
|
||||
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.response.data.GameRankingItem;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* Get game music hot ranking list.
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("OngekiGetGameRankingHandler")
|
||||
@@ -20,22 +23,59 @@ public class GetGameRankingHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetGameRankingHandler.class);
|
||||
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final PropertyEntryRepository propertyEntryRepository;
|
||||
|
||||
@Autowired
|
||||
public GetGameRankingHandler(BasicMapper mapper) {
|
||||
public GetGameRankingHandler(BasicMapper mapper, PropertyEntryRepository propertyEntryRepository) {
|
||||
this.mapper = mapper;
|
||||
this.propertyEntryRepository = propertyEntryRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
// 1 is current, 2 is old
|
||||
// See ADT_Ranking.cs
|
||||
Integer type = (Integer) request.get("type");
|
||||
Optional<PropertyEntry> propertyEntryOptional;
|
||||
if(type == 1) {
|
||||
propertyEntryOptional = propertyEntryRepository.findByPropertyKey("ongeki_music_ranking_current");
|
||||
} else if(type == 2) {
|
||||
propertyEntryOptional = propertyEntryRepository.findByPropertyKey("ongeki_music_ranking_old");
|
||||
} else {
|
||||
propertyEntryOptional = Optional.empty();
|
||||
}
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("type", type);
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("gameRankingList", new List[]{});
|
||||
|
||||
if (propertyEntryOptional.isPresent()) {
|
||||
String value = propertyEntryOptional.get().getPropertyValue();
|
||||
|
||||
if(StringUtils.isNotBlank(value) && value.contains(",")) {
|
||||
String[] ids = value.split(",");
|
||||
List<GameRankingItem> list = new LinkedList<>();
|
||||
|
||||
for (String id : ids) {
|
||||
try {
|
||||
list.add(new GameRankingItem(Integer.parseInt(id), 0, ""));
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
// in ADT_Ranking.cs, the game read this array and expected it has 10 value here.
|
||||
while (list.size() < 10) {
|
||||
list.add(new GameRankingItem(0, 0, ""));
|
||||
}
|
||||
}
|
||||
|
||||
resultMap.put("gameRankingList", list);
|
||||
|
||||
} else {
|
||||
resultMap.put("gameRankingList", new List[]{});
|
||||
}
|
||||
} else {
|
||||
resultMap.put("gameRankingList", new List[]{});
|
||||
}
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.ongeki.dao.gamedata.GameRewardRepository;
|
||||
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.common.ItemType;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.gamedata.GameReward;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -22,9 +26,12 @@ public class GetGameRewardHandler implements BaseHandler {
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final GameRewardRepository gameRewardRepository;
|
||||
|
||||
@Autowired
|
||||
public GetGameRewardHandler(BasicMapper mapper) {
|
||||
public GetGameRewardHandler(BasicMapper mapper, GameRewardRepository gameRewardRepository) {
|
||||
this.mapper = mapper;
|
||||
this.gameRewardRepository = gameRewardRepository;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,9 +39,11 @@ public class GetGameRewardHandler implements BaseHandler {
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
Boolean isAllGP = (Boolean) request.get("isAllReward");
|
||||
|
||||
List<GameReward> rewardList = gameRewardRepository.findAll();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("gameRewardList", new List[]{});
|
||||
resultMap.put("length", rewardList.size());
|
||||
resultMap.put("gameRewardList", rewardList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.dao.PropertyEntryRepository;
|
||||
import icu.samnyan.aqua.sega.general.model.PropertyEntry;
|
||||
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.response.GetGameSettingResp;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.response.data.GameSetting;
|
||||
@@ -10,7 +12,6 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -23,23 +24,29 @@ public class GetGameSettingHandler implements BaseHandler {
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final PropertyEntryRepository propertyEntryRepository;
|
||||
|
||||
@Autowired
|
||||
public GetGameSettingHandler(BasicMapper mapper) {
|
||||
public GetGameSettingHandler(BasicMapper mapper, PropertyEntryRepository propertyEntryRepository) {
|
||||
this.mapper = mapper;
|
||||
this.propertyEntryRepository = propertyEntryRepository;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
|
||||
PropertyEntry start = propertyEntryRepository.findByPropertyKey("reboot_start_time")
|
||||
.orElseGet(() -> new PropertyEntry("reboot_start_time", "2020-01-01 23:59:00.0"));
|
||||
PropertyEntry end = propertyEntryRepository.findByPropertyKey("reboot_end_time")
|
||||
.orElseGet(() -> new PropertyEntry("reboot_end_time", "2020-01-01 23:59:00.0"));
|
||||
|
||||
GameSetting gameSetting = new GameSetting(
|
||||
"1.05.00",
|
||||
false,
|
||||
10,
|
||||
// So I test the game code that the game just
|
||||
// can't run over 24 hour? Patch the isAutoRebootNeeded return false instead.
|
||||
LocalDateTime.now().minusMinutes(1).minusSeconds(1),
|
||||
LocalDateTime.now().minusMinutes(1),
|
||||
start.getPropertyValue(),
|
||||
end.getPropertyValue(),
|
||||
false,
|
||||
300,
|
||||
300,
|
||||
|
||||
@@ -3,13 +3,18 @@ package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserEventPointRepository;
|
||||
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.response.data.UserEventRankingItem;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserEventPoint;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -36,10 +41,25 @@ public class GetUserEventRankingHandler implements BaseHandler {
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
Integer userId = (Integer) request.get("userId");
|
||||
|
||||
String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.0"));
|
||||
|
||||
// TODO: query ranking from database
|
||||
List<UserEventPoint> eventPointList = userEventPointRepository.findByUser_Card_ExtId(userId);
|
||||
List<UserEventRankingItem> rankingItemList = new LinkedList<>();
|
||||
eventPointList.forEach(x -> {
|
||||
rankingItemList.add(new UserEventRankingItem(
|
||||
x.getEventId(),
|
||||
1, // Type 1 is latest ranking
|
||||
time,
|
||||
1,
|
||||
x.getPoint()
|
||||
));
|
||||
});
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("userEventRankingList", new List[]{});
|
||||
resultMap.put("length", rankingItemList.size());
|
||||
resultMap.put("userEventRankingList", rankingItemList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserMissionPointRepository;
|
||||
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserMissionPoint;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -22,9 +24,12 @@ public class GetUserMissionPointHandler implements BaseHandler {
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final UserMissionPointRepository userMissionPointRepository;
|
||||
|
||||
@Autowired
|
||||
public GetUserMissionPointHandler(BasicMapper mapper) {
|
||||
public GetUserMissionPointHandler(BasicMapper mapper, UserMissionPointRepository userMissionPointRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userMissionPointRepository = userMissionPointRepository;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,10 +37,12 @@ public class GetUserMissionPointHandler implements BaseHandler {
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
Integer userId = (Integer) request.get("userId");
|
||||
|
||||
List<UserMissionPoint> missionPointList = userMissionPointRepository.findByUser_Card_ExtId(userId);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("userMissionPointList", new List[]{});
|
||||
resultMap.put("length", missionPointList.size());
|
||||
resultMap.put("userMissionPointList", missionPointList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ public class GetUserRecentRatingHandler implements BaseHandler {
|
||||
List<UserRecentRating> ratingList = playlogList.stream().map(log -> new UserRecentRating(log.getMusicId(), log.getLevel(), "1000000", log.getTechScore()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("length", ratingList.size());
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The game doesn't send this to save
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("OngekiGetUserRegionHandler")
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserTrainingRoomRepository;
|
||||
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserTrainingRoom;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -22,9 +24,12 @@ public class GetUserTrainingRoomByKeyHandler implements BaseHandler {
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final UserTrainingRoomRepository userTrainingRoomRepository;
|
||||
|
||||
@Autowired
|
||||
public GetUserTrainingRoomByKeyHandler(BasicMapper mapper) {
|
||||
public GetUserTrainingRoomByKeyHandler(BasicMapper mapper, UserTrainingRoomRepository userTrainingRoomRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userTrainingRoomRepository = userTrainingRoomRepository;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,10 +37,12 @@ public class GetUserTrainingRoomByKeyHandler implements BaseHandler {
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
Integer userId = (Integer) request.get("userId");
|
||||
|
||||
List<UserTrainingRoom> trainingRoomList = userTrainingRoomRepository.findByUser_Card_ExtId(userId);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("userTrainingRoomList", new List[]{});
|
||||
resultMap.put("length", trainingRoomList.size());
|
||||
resultMap.put("userTrainingRoomList", trainingRoomList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.response.data.UserRecentRating;
|
||||
import icu.samnyan.aqua.sega.general.model.Card;
|
||||
import icu.samnyan.aqua.sega.general.service.CardService;
|
||||
import icu.samnyan.aqua.sega.ongeki.dao.userdata.*;
|
||||
@@ -48,10 +50,13 @@ public class UpsertUserAllHandler implements BaseHandler {
|
||||
private final UserMusicItemRepository userMusicItemRepository;
|
||||
private final UserLoginBonusRepository userLoginBonusRepository;
|
||||
private final UserEventPointRepository userEventPointRepository;
|
||||
private final UserMissionPointRepository userMissionPointRepository;
|
||||
private final UserTrainingRoomRepository userTrainingRoomRepository;
|
||||
private final UserGeneralDataRepository userGeneralDataRepository;
|
||||
|
||||
@Autowired
|
||||
public UpsertUserAllHandler(BasicMapper mapper,
|
||||
CardService cardService, UserDataRepository userDataRepository, UserOptionRepository userOptionRepository, UserPlaylogRepository userPlaylogRepository, UserActivityRepository userActivityRepository, UserMusicDetailRepository userMusicDetailRepository, UserCharacterRepository userCharacterRepository, UserCardRepository userCardRepository, UserDeckRepository userDeckRepository, UserStoryRepository userStoryRepository, UserChapterRepository userChapterRepository, UserItemRepository userItemRepository, UserMusicItemRepository userMusicItemRepository, UserLoginBonusRepository userLoginBonusRepository, UserEventPointRepository userEventPointRepository) {
|
||||
CardService cardService, UserDataRepository userDataRepository, UserOptionRepository userOptionRepository, UserPlaylogRepository userPlaylogRepository, UserActivityRepository userActivityRepository, UserMusicDetailRepository userMusicDetailRepository, UserCharacterRepository userCharacterRepository, UserCardRepository userCardRepository, UserDeckRepository userDeckRepository, UserStoryRepository userStoryRepository, UserChapterRepository userChapterRepository, UserItemRepository userItemRepository, UserMusicItemRepository userMusicItemRepository, UserLoginBonusRepository userLoginBonusRepository, UserEventPointRepository userEventPointRepository, UserMissionPointRepository userMissionPointRepository, UserTrainingRoomRepository userTrainingRoomRepository, UserGeneralDataRepository userGeneralDataRepository) {
|
||||
this.mapper = mapper;
|
||||
this.cardService = cardService;
|
||||
this.userDataRepository = userDataRepository;
|
||||
@@ -68,6 +73,9 @@ public class UpsertUserAllHandler implements BaseHandler {
|
||||
this.userMusicItemRepository = userMusicItemRepository;
|
||||
this.userLoginBonusRepository = userLoginBonusRepository;
|
||||
this.userEventPointRepository = userEventPointRepository;
|
||||
this.userMissionPointRepository = userMissionPointRepository;
|
||||
this.userTrainingRoomRepository = userTrainingRoomRepository;
|
||||
this.userGeneralDataRepository = userGeneralDataRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,7 +93,7 @@ public class UpsertUserAllHandler implements BaseHandler {
|
||||
|
||||
Optional<UserData> userOptional = userDataRepository.findByCard_ExtId(userId);
|
||||
|
||||
if(userOptional.isPresent()) {
|
||||
if (userOptional.isPresent()) {
|
||||
userData = userOptional.get();
|
||||
} else {
|
||||
userData = new UserData();
|
||||
@@ -139,7 +147,7 @@ public class UpsertUserAllHandler implements BaseHandler {
|
||||
Integer kind = (Integer) userActivityMap.get("kind");
|
||||
Integer id = (Integer) userActivityMap.get("id");
|
||||
|
||||
if(kind != 0 && id!=0) {
|
||||
if (kind != 0 && id != 0) {
|
||||
Optional<UserActivity> activityOptional = userActivityRepository.findByUserAndKindAndActivityId(newUserData, kind, id);
|
||||
UserActivity userActivity = activityOptional.orElseGet(() -> new UserActivity(newUserData));
|
||||
|
||||
@@ -149,21 +157,54 @@ public class UpsertUserAllHandler implements BaseHandler {
|
||||
newUserActivityList.add(newUserActivity);
|
||||
}
|
||||
}
|
||||
newUserActivityList.sort((a, b) -> Integer.compare(b.getSortNumber(), a.getSortNumber()));
|
||||
userActivityRepository.saveAll(newUserActivityList);
|
||||
}
|
||||
|
||||
// UserRecentRatingList
|
||||
// This doesn't need to save. It can get from playlog
|
||||
|
||||
// UserBpBaseList
|
||||
// From UserBatterPoint.cs, the game doesn't use the value here. So it doesn't need to save.
|
||||
/*
|
||||
* The rating and battle point calculation is little bit complex.
|
||||
* So I just create a UserGeneralData class to store this value
|
||||
* into a csv format for convenience
|
||||
*/
|
||||
// UserBpBaseList (For calculating Battle point)
|
||||
if (upsertUserAll.containsKey("userBpBaseList")) {
|
||||
this.saveGeneralData(upsertUserAll, newUserData, "userBpBaseList", "battle_point_base");
|
||||
}
|
||||
|
||||
// userRatingBaseBestNewList
|
||||
// This is the best rating of all charts. Best 30 + 10 after that.
|
||||
// userRatingBaseBestList
|
||||
// userRatingBaseHotList
|
||||
// userRatingBaseNextNewList
|
||||
if (upsertUserAll.containsKey("userRatingBaseBestList")) {
|
||||
this.saveGeneralData(upsertUserAll, newUserData, "userRatingBaseBestList", "rating_base_best");
|
||||
}
|
||||
// userRatingBaseNextList
|
||||
if (upsertUserAll.containsKey("userRatingBaseNextList")) {
|
||||
this.saveGeneralData(upsertUserAll, newUserData, "userRatingBaseNextList", "rating_base_next");
|
||||
}
|
||||
|
||||
|
||||
// This is the best rating of new charts. Best 15 + 10 after that.
|
||||
// New chart means same version
|
||||
// userRatingBaseBestNewList
|
||||
if (upsertUserAll.containsKey("userRatingBaseBestNewList")) {
|
||||
this.saveGeneralData(upsertUserAll, newUserData, "userRatingBaseBestNewList", "rating_base_new_best");
|
||||
}
|
||||
// userRatingBaseNextNewList
|
||||
if (upsertUserAll.containsKey("userRatingBaseNextNewList")) {
|
||||
this.saveGeneralData(upsertUserAll, newUserData, "userRatingBaseBestNewList", "rating_base_new_next");
|
||||
}
|
||||
|
||||
// This is the recent best
|
||||
// userRatingBaseHotList
|
||||
if (upsertUserAll.containsKey("userRatingBaseHotList")) {
|
||||
this.saveGeneralData(upsertUserAll, newUserData, "userRatingBaseHotList", "rating_base_hot_best");
|
||||
}
|
||||
// userRatingBaseHotNextList
|
||||
if (upsertUserAll.containsKey("userRatingBaseHotNextList")) {
|
||||
this.saveGeneralData(upsertUserAll, newUserData, "userRatingBaseHotNextList", "rating_base_hot_next");
|
||||
}
|
||||
|
||||
// UserMusicDetailList
|
||||
if (upsertUserAll.containsKey("userMusicDetailList")) {
|
||||
@@ -242,7 +283,25 @@ public class UpsertUserAllHandler implements BaseHandler {
|
||||
userDeckRepository.saveAll(newUserDeckList);
|
||||
}
|
||||
|
||||
// TODO: userTrainingRoomList
|
||||
// userTrainingRoomList
|
||||
if (upsertUserAll.containsKey("userTrainingRoomList")) {
|
||||
List<Map<String, Object>> userTrainingRoomList = ((List<Map<String, Object>>) upsertUserAll.get("userTrainingRoomList"));
|
||||
List<UserTrainingRoom> newUserTrainingRoomList = new ArrayList<>();
|
||||
|
||||
for (Map<String, Object> userTrainingRoomMap : userTrainingRoomList) {
|
||||
Integer roomId = (Integer) userTrainingRoomMap.get("roomId");
|
||||
|
||||
Optional<UserTrainingRoom> trainingRoomOptional = userTrainingRoomRepository.findByUserAndRoomId(newUserData, roomId);
|
||||
UserTrainingRoom trainingRoom = trainingRoomOptional.orElseGet(() -> new UserTrainingRoom(newUserData));
|
||||
|
||||
UserTrainingRoom newUserTrainingRoom = mapper.convert(userTrainingRoomMap, UserTrainingRoom.class);
|
||||
newUserTrainingRoom.setId(trainingRoom.getId());
|
||||
newUserTrainingRoom.setUser(newUserData);
|
||||
newUserTrainingRoomList.add(newUserTrainingRoom);
|
||||
}
|
||||
userTrainingRoomRepository.saveAll(newUserTrainingRoomList);
|
||||
}
|
||||
|
||||
|
||||
// UserStoryList
|
||||
if (upsertUserAll.containsKey("userStoryList")) {
|
||||
@@ -363,13 +422,51 @@ public class UpsertUserAllHandler implements BaseHandler {
|
||||
}
|
||||
|
||||
// UserMissionPointList
|
||||
if (upsertUserAll.containsKey("userMissionPointList")) {
|
||||
List<Map<String, Object>> userMissionPointList = ((List<Map<String, Object>>) upsertUserAll.get("userMissionPointList"));
|
||||
List<UserMissionPoint> newUserMissionPointList = new ArrayList<>();
|
||||
|
||||
// UserRatinglogList
|
||||
for (Map<String, Object> userMissionPointMap : userMissionPointList) {
|
||||
Integer eventId = (Integer) userMissionPointMap.get("eventId");
|
||||
|
||||
Optional<UserMissionPoint> userMissionPointOptional = userMissionPointRepository.findByUserAndEventId(newUserData, eventId);
|
||||
UserMissionPoint userMissionPoint = userMissionPointOptional.orElseGet(() -> new UserMissionPoint(newUserData));
|
||||
|
||||
UserMissionPoint newUserEventPoint = mapper.convert(userMissionPointMap, UserMissionPoint.class);
|
||||
newUserEventPoint.setId(userMissionPoint.getId());
|
||||
newUserEventPoint.setUser(newUserData);
|
||||
newUserMissionPointList.add(newUserEventPoint);
|
||||
}
|
||||
userMissionPointRepository.saveAll(newUserMissionPointList);
|
||||
}
|
||||
|
||||
// UserRatinglogList (For the highest rating of each version)
|
||||
|
||||
|
||||
String json = mapper.write(new CodeResp(1,"upsertUserAll"));
|
||||
String json = mapper.write(new CodeResp(1, "upsertUserAll"));
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
|
||||
}
|
||||
|
||||
private void saveGeneralData(Map<String, Object> upsertUserAll, UserData newUserData, String jsonName, String key) {
|
||||
List<Map<String, Object>> recordList = ((List<Map<String, Object>>) upsertUserAll.get(jsonName));
|
||||
// User this recent rating class from chunithm
|
||||
List<UserRecentRating> itemList = mapper.convert(recordList, new TypeReference<>() {
|
||||
});
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// Convert to a string
|
||||
for (UserRecentRating item :
|
||||
itemList) {
|
||||
sb.append(item.getMusicId()).append(":").append(item.getDifficultId()).append(":").append(item.getScore());
|
||||
sb.append(",");
|
||||
}
|
||||
if(sb.length() > 0) {
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
}
|
||||
Optional<UserGeneralData> uOptional = userGeneralDataRepository.findByUserAndPropertyKey(newUserData, key);
|
||||
UserGeneralData userGeneralData = uOptional.orElseGet(() -> new UserGeneralData(newUserData, key));
|
||||
userGeneralData.setPropertyValue(sb.toString());
|
||||
userGeneralDataRepository.save(userGeneralData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.model.common;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
public enum GpProductID {
|
||||
A_Credit1(0),
|
||||
A_Credit2(1),
|
||||
A_Credit3(2),
|
||||
B_Credit1(3),
|
||||
B_Credit2(4),
|
||||
B_Credit3(5),
|
||||
End(6);
|
||||
|
||||
private int value;
|
||||
|
||||
GpProductID(int i) { this.value = i; }
|
||||
|
||||
@JsonValue
|
||||
public int getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.model.common;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
public enum IdListType {
|
||||
Invalid,
|
||||
NgMusic,
|
||||
Recommend;
|
||||
|
||||
@JsonValue
|
||||
public int toValue() {
|
||||
return ordinal();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.model.common;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
public enum ItemType {
|
||||
None,
|
||||
Card,
|
||||
NamePlate,
|
||||
Trophy,
|
||||
LimitBreakItem,
|
||||
AlmightyJewel,
|
||||
Money,
|
||||
Music,
|
||||
ProfileVoice,
|
||||
Present,
|
||||
ChapterJewel,
|
||||
GachaTicket,
|
||||
Max;
|
||||
|
||||
@JsonValue
|
||||
public int toValue() {
|
||||
return ordinal();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.model.gamedata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.common.GpProductID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "OngekiGamePoint")
|
||||
@Table(name = "ongeki_game_point", uniqueConstraints = {@UniqueConstraint(columnNames = {"type"})})
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class GamePoint implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@Enumerated(EnumType.ORDINAL)
|
||||
private GpProductID type;
|
||||
|
||||
private int cost;
|
||||
|
||||
private String startDate = "2000-01-01 05:00:00.0";
|
||||
|
||||
private String endDate = "2099-01-01 05:00:00.0";
|
||||
|
||||
public GamePoint(GpProductID type, int cost) {
|
||||
this.type = type;
|
||||
this.cost = cost;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.model.gamedata;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "OngekiGamePresent")
|
||||
@Table(name = "ongeki_game_present")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class GamePresent implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
private long presentId;
|
||||
|
||||
private String presentName;
|
||||
|
||||
private int rewardId;
|
||||
|
||||
// count
|
||||
private int stock;
|
||||
|
||||
// acquisitionCondition
|
||||
private String message;
|
||||
|
||||
private String startDate = "2000-01-01 05:00:00.0";
|
||||
|
||||
private String endDate = "2099-01-01 05:00:00.0";
|
||||
|
||||
public GamePresent(int presentId, String presentName, int rewardId, int stock, String message) {
|
||||
this.presentId = presentId;
|
||||
this.presentName = presentName;
|
||||
this.rewardId = rewardId;
|
||||
this.stock = stock;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.model.gamedata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import icu.samnyan.aqua.sega.ongeki.model.common.ItemType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "OngekiGameReward")
|
||||
@Table(name = "ongeki_game_reward")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class GameReward implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
private long rewardId;
|
||||
|
||||
@Enumerated(EnumType.ORDINAL)
|
||||
private ItemType itemKind;
|
||||
|
||||
private int itemId;
|
||||
|
||||
public GameReward(int rewardId, ItemType itemKind, int itemId) {
|
||||
this.rewardId = rewardId;
|
||||
this.itemKind = itemKind;
|
||||
this.itemId = itemId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.model.response.data;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Fro getGameRanking request
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GameRankingItem {
|
||||
private long id;
|
||||
// this 2 field never use in game code,
|
||||
// maybe for the future update like in game player ranking
|
||||
private long point;
|
||||
private String userName;
|
||||
}
|
||||
@@ -18,8 +18,8 @@ public class GameSetting {
|
||||
@JsonProperty("isMaintenance")
|
||||
private boolean isMaintenance;
|
||||
private int requestInterval;
|
||||
private LocalDateTime rebootStartTime;
|
||||
private LocalDateTime rebootEndTime;
|
||||
private String rebootStartTime;
|
||||
private String rebootEndTime;
|
||||
@JsonProperty("isBackgroundDistribute")
|
||||
private boolean isBackgroundDistribute;
|
||||
private int maxCountCharacter;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.model.response.data;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserEventRankingItem {
|
||||
private int eventId;
|
||||
private int type;
|
||||
private String date;
|
||||
private int rank;
|
||||
private long point;
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* For chapter event.
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "OngekiUserEventPoint")
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* This is for storing some data only use in aqua
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "OngekiUserGeneralData")
|
||||
@Table(name = "ongeki_user_general_data")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserGeneralData 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 propertyKey;
|
||||
|
||||
private String propertyValue;
|
||||
|
||||
public UserGeneralData(UserData userData, String key) {
|
||||
this.user = userData;
|
||||
this.propertyKey = key;
|
||||
this.propertyValue = "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package icu.samnyan.aqua.sega.ongeki.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* For mission event
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Entity(name = "OngekiUserMissionPoint")
|
||||
@Table(name = "ongeki_user_mission_point")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserMissionPoint implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@JsonIgnore
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserData user;
|
||||
|
||||
private int eventId;
|
||||
|
||||
private long point;
|
||||
|
||||
public UserMissionPoint(UserData userData) {
|
||||
this.user = userData;
|
||||
}
|
||||
}
|
||||
@@ -38,4 +38,7 @@ public class UserTrainingRoom implements Serializable {
|
||||
|
||||
public String valueDate;
|
||||
|
||||
public UserTrainingRoom(UserData userData) {
|
||||
this.user = userData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,10 +39,14 @@ public class BasicMapper {
|
||||
|
||||
}
|
||||
|
||||
public <T> T convert(Map<String, Object> map, Class<T> toClass) {
|
||||
public <T> T convert(Object map, Class<T> toClass) {
|
||||
return mapper.convertValue(map, toClass);
|
||||
}
|
||||
|
||||
public <T> T convert(Object map, TypeReference<T> toValueTypeRef) {
|
||||
return mapper.convertValue(map, toValueTypeRef);
|
||||
}
|
||||
|
||||
public LinkedHashMap<String, Object> toMap(Object object) {
|
||||
return mapper.convertValue(object, new TypeReference<>() {
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user