mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-09 16:27:32 +08:00
[general] Refactoring chunithm UpsertUserAll request and some clean up
This commit is contained in:
@@ -33,10 +33,9 @@ public class AimeDbDecoder extends ByteToMessageDecoder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Decrypt the incoming request including frame management
|
* Decrypt the incoming request including frame management
|
||||||
*
|
* @param ctx ChannelHandlerContext
|
||||||
* @param ctx
|
* @param in ByteBuf in
|
||||||
* @param in
|
* @param out List<Object>
|
||||||
* @param out
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package icu.samnyan.aqua.sega.aimedb;
|
package icu.samnyan.aqua.sega.aimedb;
|
||||||
|
|
||||||
import icu.samnyan.aqua.sega.aimedb.handler.Impl.*;
|
import icu.samnyan.aqua.sega.aimedb.handler.impl.*;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package icu.samnyan.aqua.sega.aimedb;
|
package icu.samnyan.aqua.sega.aimedb;
|
||||||
|
|
||||||
import icu.samnyan.aqua.sega.aimedb.handler.Impl.*;
|
import icu.samnyan.aqua.sega.aimedb.handler.impl.*;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.socket.SocketChannel;
|
import io.netty.channel.socket.SocketChannel;
|
||||||
@@ -40,7 +40,7 @@ public class AimeDbServerInitializer extends ChannelInitializer<SocketChannel> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(SocketChannel ch) throws Exception {
|
protected void initChannel(SocketChannel ch) {
|
||||||
ChannelPipeline pipeline = ch.pipeline();
|
ChannelPipeline pipeline = ch.pipeline();
|
||||||
pipeline.addLast("encoder", new AimeDbEncoder());
|
pipeline.addLast("encoder", new AimeDbEncoder());
|
||||||
pipeline.addLast("decoder", new AimeDbDecoder());
|
pipeline.addLast("decoder", new AimeDbDecoder());
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package icu.samnyan.aqua.sega.aimedb.handler.Impl;
|
package icu.samnyan.aqua.sega.aimedb.handler.impl;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import icu.samnyan.aqua.sega.aimedb.handler.BaseHandler;
|
import icu.samnyan.aqua.sega.aimedb.handler.BaseHandler;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package icu.samnyan.aqua.sega.aimedb.handler.Impl;
|
package icu.samnyan.aqua.sega.aimedb.handler.impl;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import icu.samnyan.aqua.sega.aimedb.handler.BaseHandler;
|
import icu.samnyan.aqua.sega.aimedb.handler.BaseHandler;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package icu.samnyan.aqua.sega.aimedb.handler.Impl;
|
package icu.samnyan.aqua.sega.aimedb.handler.impl;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package icu.samnyan.aqua.sega.aimedb.handler.Impl;
|
package icu.samnyan.aqua.sega.aimedb.handler.impl;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import icu.samnyan.aqua.sega.aimedb.handler.BaseHandler;
|
import icu.samnyan.aqua.sega.aimedb.handler.BaseHandler;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package icu.samnyan.aqua.sega.aimedb.handler.Impl;
|
package icu.samnyan.aqua.sega.aimedb.handler.impl;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import icu.samnyan.aqua.sega.aimedb.handler.BaseHandler;
|
import icu.samnyan.aqua.sega.aimedb.handler.BaseHandler;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package icu.samnyan.aqua.sega.aimedb.handler.Impl;
|
package icu.samnyan.aqua.sega.aimedb.handler.impl;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import icu.samnyan.aqua.sega.aimedb.handler.BaseHandler;
|
import icu.samnyan.aqua.sega.aimedb.handler.BaseHandler;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package icu.samnyan.aqua.sega.aimedb.handler.Impl;
|
package icu.samnyan.aqua.sega.aimedb.handler.impl;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import icu.samnyan.aqua.sega.aimedb.handler.BaseHandler;
|
import icu.samnyan.aqua.sega.aimedb.handler.BaseHandler;
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
package icu.samnyan.aqua.sega.aimedb.handler.Impl;
|
package icu.samnyan.aqua.sega.aimedb.handler.impl;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import icu.samnyan.aqua.sega.aimedb.handler.BaseHandler;
|
import icu.samnyan.aqua.sega.aimedb.handler.BaseHandler;
|
||||||
import icu.samnyan.aqua.sega.aimedb.util.AimeDbUtil;
|
import icu.samnyan.aqua.sega.aimedb.util.AimeDbUtil;
|
||||||
import icu.samnyan.aqua.sega.aimedb.util.LogMapper;
|
import icu.samnyan.aqua.sega.aimedb.util.LogMapper;
|
||||||
import icu.samnyan.aqua.sega.general.dao.CardRepository;
|
|
||||||
import icu.samnyan.aqua.sega.general.model.Card;
|
import icu.samnyan.aqua.sega.general.model.Card;
|
||||||
import icu.samnyan.aqua.sega.general.service.CardService;
|
import icu.samnyan.aqua.sega.general.service.CardService;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
@@ -14,11 +14,10 @@ import org.springframework.stereotype.Component;
|
|||||||
public class LogMapper {
|
public class LogMapper {
|
||||||
|
|
||||||
private final ObjectMapper mapper;
|
private final ObjectMapper mapper;
|
||||||
private final SimpleModule module;
|
|
||||||
|
|
||||||
public LogMapper() {
|
public LogMapper() {
|
||||||
mapper = new ObjectMapper();
|
mapper = new ObjectMapper();
|
||||||
module = new SimpleModule();
|
SimpleModule module = new SimpleModule();
|
||||||
module.addSerializer(ByteBuf.class, new ByteBufSerializer());
|
module.addSerializer(ByteBuf.class, new ByteBufSerializer());
|
||||||
mapper.registerModule(module);
|
mapper.registerModule(module);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class AllNetController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/sys/servlet/PowerOn", produces = "text/plain")
|
@PostMapping(value = "/sys/servlet/PowerOn", produces = "text/plain")
|
||||||
String powerOn(InputStream dataStream) throws DataFormatException, IOException {
|
public String powerOn(InputStream dataStream) throws IOException {
|
||||||
|
|
||||||
byte[] bytes = dataStream.readAllBytes();
|
byte[] bytes = dataStream.readAllBytes();
|
||||||
Map<String, String> reqMap = Decoder.decode(bytes);
|
Map<String, String> reqMap = Decoder.decode(bytes);
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public class ChuniServletController {
|
|||||||
/**
|
/**
|
||||||
* The game start up request
|
* The game start up request
|
||||||
*
|
*
|
||||||
* @return
|
* @return json of GameSetting object
|
||||||
*/
|
*/
|
||||||
@PostMapping("GetGameSettingApi")
|
@PostMapping("GetGameSettingApi")
|
||||||
String getGameSetting(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
String getGameSetting(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import org.springframework.data.domain.Page;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Response:
|
* Response:
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||||
import icu.samnyan.aqua.sega.chunithm.model.response.data.UserRecentRating;
|
import icu.samnyan.aqua.sega.general.model.response.UserRecentRating;
|
||||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserPlaylog;
|
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserPlaylog;
|
||||||
import icu.samnyan.aqua.sega.chunithm.service.UserPlaylogService;
|
import icu.samnyan.aqua.sega.chunithm.service.UserPlaylogService;
|
||||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package icu.samnyan.aqua.sega.chunithm.handler.impl;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||||
|
import icu.samnyan.aqua.sega.chunithm.model.requet.UpsertUserAll;
|
||||||
import icu.samnyan.aqua.sega.chunithm.model.response.CodeResp;
|
import icu.samnyan.aqua.sega.chunithm.model.response.CodeResp;
|
||||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.*;
|
import icu.samnyan.aqua.sega.chunithm.model.userdata.*;
|
||||||
import icu.samnyan.aqua.sega.chunithm.service.*;
|
import icu.samnyan.aqua.sega.chunithm.service.*;
|
||||||
@@ -67,21 +68,20 @@ public class UpsertUserAllHandler implements BaseHandler {
|
|||||||
@Override
|
@Override
|
||||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||||
String userId = (String) request.get("userId");
|
String userId = (String) request.get("userId");
|
||||||
Map<String, Object> upsertUserAll = (Map<String, Object>) request.get("upsertUserAll");
|
UpsertUserAll upsertUserAll = mapper.convert(request.get("upsertUserAll"), UpsertUserAll.class);
|
||||||
|
|
||||||
// Not all field will be sent. Check if they are exist first.
|
// Not all field will be sent. Check if they are exist first.
|
||||||
|
|
||||||
UserData userData;
|
UserData userData;
|
||||||
UserData newUserData;
|
UserData newUserData;
|
||||||
// UserData
|
// UserData
|
||||||
if (!upsertUserAll.containsKey("userData")) {
|
if (upsertUserAll.getUserData() == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
Map<String, Object> userDataMap = ((List<Map<String, Object>>) upsertUserAll.get("userData")).get(0);
|
newUserData = upsertUserAll.getUserData().get(0);
|
||||||
|
|
||||||
Optional<UserData> userOptional = userDataService.getUserByExtId(userId);
|
Optional<UserData> userOptional = userDataService.getUserByExtId(userId);
|
||||||
|
|
||||||
|
|
||||||
if (userOptional.isPresent()) {
|
if (userOptional.isPresent()) {
|
||||||
userData = userOptional.get();
|
userData = userOptional.get();
|
||||||
} else {
|
} else {
|
||||||
@@ -90,9 +90,6 @@ public class UpsertUserAllHandler implements BaseHandler {
|
|||||||
userData.setCard(card);
|
userData.setCard(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map the map to object
|
|
||||||
newUserData = mapper.convert(userDataMap, UserData.class);
|
|
||||||
|
|
||||||
newUserData.setId(userData.getId());
|
newUserData.setId(userData.getId());
|
||||||
newUserData.setCard(userData.getCard());
|
newUserData.setCard(userData.getCard());
|
||||||
|
|
||||||
@@ -107,30 +104,26 @@ public class UpsertUserAllHandler implements BaseHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// userGameOption
|
// userGameOption
|
||||||
if (upsertUserAll.containsKey("userGameOption")) {
|
if (upsertUserAll.getUserGameOption() != null) {
|
||||||
Map<String, Object> userGameOptionMap = ((List<Map<String, Object>>) upsertUserAll.get("userGameOption")).get(0);
|
UserGameOption newUserGameOption = upsertUserAll.getUserGameOption().get(0);
|
||||||
|
|
||||||
Optional<UserGameOption> userGameOptionOptional = userGameOptionService.getByUser(newUserData);
|
Optional<UserGameOption> userGameOptionOptional = userGameOptionService.getByUser(newUserData);
|
||||||
|
|
||||||
UserGameOption userGameOption = userGameOptionOptional.orElseGet(() -> new UserGameOption(newUserData));
|
UserGameOption userGameOption = userGameOptionOptional.orElseGet(() -> new UserGameOption(newUserData));
|
||||||
|
|
||||||
UserGameOption newUserGameOption = mapper.convert(userGameOptionMap, UserGameOption.class);
|
|
||||||
newUserGameOption.setId(userGameOption.getId());
|
newUserGameOption.setId(userGameOption.getId());
|
||||||
newUserGameOption.setUser(userGameOption.getUser());
|
newUserGameOption.setUser(userGameOption.getUser());
|
||||||
|
|
||||||
userGameOptionService.save(newUserGameOption);
|
userGameOptionService.save(newUserGameOption);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// userGameOptionEx
|
// userGameOptionEx
|
||||||
if (upsertUserAll.containsKey("userGameOptionEx")) {
|
if (upsertUserAll.getUserGameOptionEx() != null) {
|
||||||
Map<String, Object> userGameOptionExMap = ((List<Map<String, Object>>) upsertUserAll.get("userGameOptionEx")).get(0);
|
UserGameOptionEx newUserGameOptionEx = upsertUserAll.getUserGameOptionEx().get(0);
|
||||||
|
|
||||||
Optional<UserGameOptionEx> userGameOptionExOptional = userGameOptionExService.getByUser(newUserData);
|
Optional<UserGameOptionEx> userGameOptionExOptional = userGameOptionExService.getByUser(newUserData);
|
||||||
UserGameOptionEx userGameOptionEx = userGameOptionExOptional.orElseGet(() -> new UserGameOptionEx(newUserData));
|
UserGameOptionEx userGameOptionEx = userGameOptionExOptional.orElseGet(() -> new UserGameOptionEx(newUserData));
|
||||||
|
|
||||||
UserGameOptionEx newUserGameOptionEx = mapper.convert(userGameOptionExMap, UserGameOptionEx.class);
|
|
||||||
newUserGameOptionEx.setId(userGameOptionEx.getId());
|
newUserGameOptionEx.setId(userGameOptionEx.getId());
|
||||||
newUserGameOptionEx.setUser(userGameOptionEx.getUser());
|
newUserGameOptionEx.setUser(userGameOptionEx.getUser());
|
||||||
|
|
||||||
@@ -138,43 +131,35 @@ public class UpsertUserAllHandler implements BaseHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// userMapList
|
// userMapList
|
||||||
if (upsertUserAll.containsKey("userMapList")) {
|
if (upsertUserAll.getUserMapList() != null) {
|
||||||
|
List<UserMap> userMapList = upsertUserAll.getUserMapList();
|
||||||
|
Map<Integer, UserMap> newUserMapMap = new HashMap<>();
|
||||||
|
|
||||||
int mapPos = 0;
|
userMapList.forEach(newUserMap -> {
|
||||||
|
int mapId = newUserMap.getMapId();
|
||||||
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;
|
UserMap userMap;
|
||||||
Optional<UserMap> userMapOptional = userMapService.getByUserAndMapId(newUserData, mapId);
|
Optional<UserMap> userMapOptional = userMapService.getByUserAndMapId(newUserData, mapId);
|
||||||
userMap = userMapOptional.orElseGet(() -> new UserMap(newUserData));
|
userMap = userMapOptional.orElseGet(() -> new UserMap(newUserData));
|
||||||
|
|
||||||
|
|
||||||
UserMap newUserMap = mapper.convert(userMapListMap, UserMap.class);
|
|
||||||
newUserMap.setId(userMap.getId());
|
newUserMap.setId(userMap.getId());
|
||||||
newUserMap.setUser(userMap.getUser());
|
newUserMap.setUser(userMap.getUser());
|
||||||
|
|
||||||
newUserMapMap.put(mapId, newUserMap);
|
newUserMapMap.put(mapId, newUserMap);
|
||||||
|
|
||||||
});
|
});
|
||||||
userMapService.saveAll(newUserMapMap.values());
|
userMapService.saveAll(newUserMapMap.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
// userCharacterList
|
// userCharacterList
|
||||||
if (upsertUserAll.containsKey("userCharacterList")) {
|
if (upsertUserAll.getUserCharacterList() != null) {
|
||||||
|
List<UserCharacter> userCharacterList = upsertUserAll.getUserCharacterList();
|
||||||
|
Map<Integer, UserCharacter> newCharacterMap = new HashMap<>();
|
||||||
|
|
||||||
List<Map<String, Object>> userCharacterList = (List<Map<String, Object>>) upsertUserAll.get("userCharacterList");
|
userCharacterList.forEach(newUserCharacter -> {
|
||||||
Map<String, UserCharacter> newCharacterMap = new HashMap<>();
|
int characterId = newUserCharacter.getCharacterId();
|
||||||
|
|
||||||
userCharacterList.forEach(userCharacterMap -> {
|
|
||||||
String characterId = (String) userCharacterMap.get("characterId");
|
|
||||||
|
|
||||||
Optional<UserCharacter> userCharacterOptional = userCharacterService.getByUserAndCharacterId(newUserData, characterId);
|
Optional<UserCharacter> userCharacterOptional = userCharacterService.getByUserAndCharacterId(newUserData, characterId);
|
||||||
UserCharacter userCharacter = userCharacterOptional.orElseGet(() -> new UserCharacter(newUserData));
|
UserCharacter userCharacter = userCharacterOptional.orElseGet(() -> new UserCharacter(newUserData));
|
||||||
|
|
||||||
UserCharacter newUserCharacter = mapper.convert(userCharacterMap, UserCharacter.class);
|
|
||||||
newUserCharacter.setId(userCharacter.getId());
|
newUserCharacter.setId(userCharacter.getId());
|
||||||
newUserCharacter.setUser(userCharacter.getUser());
|
newUserCharacter.setUser(userCharacter.getUser());
|
||||||
|
|
||||||
@@ -184,20 +169,18 @@ public class UpsertUserAllHandler implements BaseHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// userItemList
|
// userItemList
|
||||||
if (upsertUserAll.containsKey("userItemList")) {
|
if (upsertUserAll.getUserItemList() != null) {
|
||||||
|
List<UserItem> userItemList = upsertUserAll.getUserItemList();
|
||||||
List<Map<String, Object>> userItemList = (List<Map<String, Object>>) upsertUserAll.get("userItemList");
|
|
||||||
Map<String, UserItem> newUserItemMap = new HashMap<>();
|
Map<String, UserItem> newUserItemMap = new HashMap<>();
|
||||||
|
|
||||||
userItemList.forEach(userItemMap -> {
|
userItemList.forEach(newUserItem -> {
|
||||||
String itemId = (String) userItemMap.get("itemId");
|
int itemId = newUserItem.getItemId();
|
||||||
String itemKind = (String) userItemMap.get("itemKind");
|
int itemKind = newUserItem.getItemKind();
|
||||||
|
|
||||||
|
|
||||||
Optional<UserItem> userItemOptional = userItemService.getByUserAndItemId(newUserData, itemId, itemKind);
|
Optional<UserItem> userItemOptional = userItemService.getByUserAndItemIdAndKind(newUserData, itemId, itemKind);
|
||||||
UserItem userItem = userItemOptional.orElseGet(() -> new UserItem(newUserData));
|
UserItem userItem = userItemOptional.orElseGet(() -> new UserItem(newUserData));
|
||||||
|
|
||||||
UserItem newUserItem = mapper.convert(userItemMap, UserItem.class);
|
|
||||||
newUserItem.setId(userItem.getId());
|
newUserItem.setId(userItem.getId());
|
||||||
newUserItem.setUser(userItem.getUser());
|
newUserItem.setUser(userItem.getUser());
|
||||||
|
|
||||||
@@ -207,100 +190,92 @@ public class UpsertUserAllHandler implements BaseHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// userMusicDetailList
|
// userMusicDetailList
|
||||||
if (upsertUserAll.containsKey("userMusicDetailList")) {
|
if (upsertUserAll.getUserMusicDetailList() != null) {
|
||||||
|
|
||||||
List<Map<String, Object>> userMusicDetailList = (List<Map<String, Object>>) upsertUserAll.get("userMusicDetailList");
|
List<UserMusicDetail> userMusicDetailList = upsertUserAll.getUserMusicDetailList();
|
||||||
Map<String, UserMusicDetail> newUserMusicDetailMap = new HashMap<>();
|
Map<String, UserMusicDetail> newUserMusicDetailMap = new HashMap<>();
|
||||||
|
|
||||||
userMusicDetailList.forEach(userMusicDetailMap -> {
|
userMusicDetailList.forEach(newUserMusicDetail -> {
|
||||||
String musicId = (String) userMusicDetailMap.get("musicId");
|
int musicId = newUserMusicDetail.getMusicId();
|
||||||
String level = (String) userMusicDetailMap.get("level");
|
int level = newUserMusicDetail.getLevel();
|
||||||
|
|
||||||
Optional<UserMusicDetail> userMusicDetailOptional = userMusicDetailService.getByUserAndMusicIdAndLevel(newUserData, musicId, level);
|
Optional<UserMusicDetail> userMusicDetailOptional = userMusicDetailService.getByUserAndMusicIdAndLevel(newUserData, musicId, level);
|
||||||
UserMusicDetail userMusicDetail = userMusicDetailOptional.orElseGet(() -> new UserMusicDetail(newUserData));
|
UserMusicDetail userMusicDetail = userMusicDetailOptional.orElseGet(() -> new UserMusicDetail(newUserData));
|
||||||
|
|
||||||
UserMusicDetail newUserMusicDetail = mapper.convert(userMusicDetailMap, UserMusicDetail.class);
|
|
||||||
newUserMusicDetail.setId(userMusicDetail.getId());
|
newUserMusicDetail.setId(userMusicDetail.getId());
|
||||||
newUserMusicDetail.setUser(userMusicDetail.getUser());
|
newUserMusicDetail.setUser(userMusicDetail.getUser());
|
||||||
|
|
||||||
newUserMusicDetailMap.put(musicId + "," + level, newUserMusicDetail);
|
newUserMusicDetailMap.put(musicId + "-" + level, newUserMusicDetail);
|
||||||
|
|
||||||
});
|
});
|
||||||
userMusicDetailService.saveAll(newUserMusicDetailMap.values());
|
userMusicDetailService.saveAll(newUserMusicDetailMap.values());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// userActivityList
|
// userActivityList
|
||||||
if (upsertUserAll.containsKey("userActivityList")) {
|
if (upsertUserAll.getUserActivityList() != null) {
|
||||||
|
List<UserActivity> userActivityList = upsertUserAll.getUserActivityList();
|
||||||
|
List<UserActivity> newUserActivityList = new LinkedList<>();
|
||||||
|
|
||||||
List<Map<String, Object>> userActivityList = (List<Map<String, Object>>) upsertUserAll.get("userActivityList");
|
userActivityList.forEach(newUserActivity -> {
|
||||||
userActivityList.forEach(userActivityMap -> {
|
|
||||||
// No need to rename to activityId. jackson auto handle that
|
// No need to rename to activityId. jackson auto handle that
|
||||||
String activityId = (String) userActivityMap.get("id");
|
int activityId = newUserActivity.getActivityId();
|
||||||
String kind = (String) userActivityMap.get("kind");
|
int kind = newUserActivity.getKind();
|
||||||
|
|
||||||
Optional<UserActivity> userActivityOptional = userActivityService.getByUserAndActivityIdAndKind(newUserData, activityId, kind);
|
Optional<UserActivity> userActivityOptional = userActivityService.getByUserAndActivityIdAndKind(newUserData, activityId, kind);
|
||||||
UserActivity userActivity = userActivityOptional.orElseGet(() -> new UserActivity(newUserData));
|
UserActivity userActivity = userActivityOptional.orElseGet(() -> new UserActivity(newUserData));
|
||||||
|
|
||||||
UserActivity newUserActivity = mapper.convert(userActivityMap, UserActivity.class);
|
|
||||||
newUserActivity.setId(userActivity.getId());
|
newUserActivity.setId(userActivity.getId());
|
||||||
newUserActivity.setUser(userActivity.getUser());
|
newUserActivity.setUser(userActivity.getUser());
|
||||||
|
|
||||||
userActivityService.save(newUserActivity);
|
newUserActivityList.add(newUserActivity);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
userActivityService.saveAll(newUserActivityList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// userRecentRatingList
|
// userRecentRatingList
|
||||||
|
|
||||||
// userChargeList
|
// userChargeList
|
||||||
|
if (upsertUserAll.getUserChargeList() != null) {
|
||||||
if (upsertUserAll.containsKey("userChargeList")) {
|
List<UserCharge> userChargeList = upsertUserAll.getUserChargeList();
|
||||||
List<Map<String, Object>> userChargeList = (List<Map<String, Object>>) upsertUserAll.get("userChargeList");
|
|
||||||
List<UserCharge> newUserChargeList = new ArrayList<>();
|
List<UserCharge> newUserChargeList = new ArrayList<>();
|
||||||
userChargeList.forEach(userChargeMap -> {
|
|
||||||
String chargeId = (String) userChargeMap.get("chargeId");
|
userChargeList.forEach(newUserCharge -> {
|
||||||
|
int chargeId = newUserCharge.getChargeId();
|
||||||
|
|
||||||
Optional<UserCharge> userChargeOptional = userChargeService.getByUserAndChargeId(newUserData, chargeId);
|
Optional<UserCharge> userChargeOptional = userChargeService.getByUserAndChargeId(newUserData, chargeId);
|
||||||
UserCharge userCharge = userChargeOptional.orElseGet(() -> new UserCharge(newUserData));
|
UserCharge userCharge = userChargeOptional.orElseGet(() -> new UserCharge(newUserData));
|
||||||
|
|
||||||
UserCharge newUserCharge = mapper.convert(userChargeMap, UserCharge.class);
|
|
||||||
newUserCharge.setId(userCharge.getId());
|
newUserCharge.setId(userCharge.getId());
|
||||||
newUserCharge.setUser(userCharge.getUser());
|
newUserCharge.setUser(userCharge.getUser());
|
||||||
|
|
||||||
newUserChargeList.add(newUserCharge);
|
newUserChargeList.add(newUserCharge);
|
||||||
});
|
});
|
||||||
|
|
||||||
userChargeService.saveAll(newUserChargeList);
|
userChargeService.saveAll(newUserChargeList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// userPlaylogList
|
// userPlaylogList
|
||||||
if (upsertUserAll.containsKey("userPlaylogList")) {
|
if (upsertUserAll.getUserPlaylogList() != null) {
|
||||||
|
List<UserPlaylog> userPlaylogList = upsertUserAll.getUserPlaylogList();
|
||||||
List<Map<String, Object>> userPlaylogList = (List<Map<String, Object>>) upsertUserAll.get("userPlaylogList");
|
|
||||||
List<UserPlaylog> newUserPlaylogList = new ArrayList<>();
|
List<UserPlaylog> newUserPlaylogList = new ArrayList<>();
|
||||||
userPlaylogList.forEach(userPlayLogMap -> {
|
|
||||||
|
|
||||||
UserPlaylog newUserPlaylog = mapper.convert(userPlayLogMap, UserPlaylog.class);
|
userPlaylogList.forEach(newUserPlaylog -> {
|
||||||
newUserPlaylog.setUser(newUserData);
|
newUserPlaylog.setUser(newUserData);
|
||||||
|
|
||||||
newUserPlaylogList.add(newUserPlaylog);
|
newUserPlaylogList.add(newUserPlaylog);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (newUserPlaylogList.size() > 0) userPlaylogService.saveAll(newUserPlaylogList);
|
if (newUserPlaylogList.size() > 0) userPlaylogService.saveAll(newUserPlaylogList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// userCourseList
|
// userCourseList
|
||||||
if (upsertUserAll.containsKey("userCourseList")) {
|
if (upsertUserAll.getUserCourseList() != null) {
|
||||||
List<Map<String, Object>> userCourseList = (List<Map<String, Object>>) upsertUserAll.get("userCourseList");
|
List<UserCourse> userCourseList = upsertUserAll.getUserCourseList();
|
||||||
|
|
||||||
userCourseList.forEach(userCourseMap -> {
|
userCourseList.forEach(newUserCourse -> {
|
||||||
String courseId = (String) userCourseMap.get("courseId");
|
int courseId = newUserCourse.getCourseId();
|
||||||
|
|
||||||
Optional<UserCourse> userCourseOptional = userCourseService.getByUserAndCourseId(newUserData, courseId);
|
Optional<UserCourse> userCourseOptional = userCourseService.getByUserAndCourseId(newUserData, courseId);
|
||||||
UserCourse userCourse = userCourseOptional.orElseGet(() -> new UserCourse(newUserData));
|
UserCourse userCourse = userCourseOptional.orElseGet(() -> new UserCourse(newUserData));
|
||||||
|
|
||||||
UserCourse newUserCourse = mapper.convert(userCourseMap, UserCourse.class);
|
|
||||||
newUserCourse.setId(userCourse.getId());
|
newUserCourse.setId(userCourse.getId());
|
||||||
newUserCourse.setUser(userCourse.getUser());
|
newUserCourse.setUser(userCourse.getUser());
|
||||||
|
|
||||||
@@ -310,13 +285,12 @@ public class UpsertUserAllHandler implements BaseHandler {
|
|||||||
|
|
||||||
|
|
||||||
// userDataEx
|
// userDataEx
|
||||||
if (upsertUserAll.containsKey("userDataEx")) {
|
if (upsertUserAll.getUserDataEx() != null) {
|
||||||
Map<String, Object> userDataExMap = ((List<Map<String, Object>>) upsertUserAll.get("userDataEx")).get(0);
|
UserDataEx newUserDataEx = upsertUserAll.getUserDataEx().get(0);
|
||||||
|
|
||||||
Optional<UserDataEx> userDataExOptional = userDataExService.getByUser(newUserData);
|
Optional<UserDataEx> userDataExOptional = userDataExService.getByUser(newUserData);
|
||||||
UserDataEx userDataEx = userDataExOptional.orElseGet(() -> new UserDataEx(newUserData));
|
UserDataEx userDataEx = userDataExOptional.orElseGet(() -> new UserDataEx(newUserData));
|
||||||
|
|
||||||
UserDataEx newUserDataEx = mapper.convert(userDataExMap, UserDataEx.class);
|
|
||||||
newUserDataEx.setId(userDataEx.getId());
|
newUserDataEx.setId(userDataEx.getId());
|
||||||
newUserDataEx.setUser(userDataEx.getUser());
|
newUserDataEx.setUser(userDataEx.getUser());
|
||||||
|
|
||||||
@@ -324,23 +298,21 @@ public class UpsertUserAllHandler implements BaseHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// userDuelList
|
// userDuelList
|
||||||
if (upsertUserAll.containsKey("userDuelList")) {
|
if (upsertUserAll.getUserDuelList() != null) {
|
||||||
|
List<UserDuel> userDuelList = upsertUserAll.getUserDuelList();
|
||||||
|
Map<Integer, UserDuel> newUserDuelMap = new HashMap<>();
|
||||||
|
|
||||||
List<Map<String, Object>> userDuelList = (List<Map<String, Object>>) upsertUserAll.get("userDuelList");
|
userDuelList.forEach(newUserDuel -> {
|
||||||
Map<String, UserDuel> newUserDuelMap = new HashMap<>();
|
int duelId = newUserDuel.getDuelId();
|
||||||
userDuelList.forEach(userDuelMap -> {
|
|
||||||
String duelId = (String) userDuelMap.get("duelId");
|
|
||||||
|
|
||||||
Optional<UserDuel> userDuelOptional = userDuelService.getByUserAndDuelId(newUserData, duelId);
|
Optional<UserDuel> userDuelOptional = userDuelService.getByUserAndDuelId(newUserData, duelId);
|
||||||
UserDuel userDuel = userDuelOptional.orElseGet(() -> new UserDuel(newUserData));
|
UserDuel userDuel = userDuelOptional.orElseGet(() -> new UserDuel(newUserData));
|
||||||
|
|
||||||
UserDuel newUserDuel = mapper.convert(userDuelMap, UserDuel.class);
|
|
||||||
newUserDuel.setId(userDuel.getId());
|
newUserDuel.setId(userDuel.getId());
|
||||||
newUserDuel.setUser(userDuel.getUser());
|
newUserDuel.setUser(userDuel.getUser());
|
||||||
|
|
||||||
newUserDuelMap.put(duelId, newUserDuel);
|
newUserDuelMap.put(duelId, newUserDuel);
|
||||||
});
|
});
|
||||||
|
|
||||||
userDuelService.saveAll(newUserDuelMap.values());
|
userDuelService.saveAll(newUserDuelMap.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class UpsertUserChargelogHandler implements BaseHandler {
|
|||||||
String chargeId = (String) userChargeMap.get("chargeId");
|
String chargeId = (String) userChargeMap.get("chargeId");
|
||||||
UserCharge charge = mapper.convert(userChargeMap, UserCharge.class);
|
UserCharge charge = mapper.convert(userChargeMap, UserCharge.class);
|
||||||
|
|
||||||
UserCharge userCharge = userChargeService.getByUserAndChargeId(user, chargeId).orElseGet(() -> new UserCharge(user));
|
UserCharge userCharge = userChargeService.getByUserAndChargeId(user, Integer.parseInt(chargeId)).orElseGet(() -> new UserCharge(user));
|
||||||
userCharge.setChargeId(charge.getChargeId());
|
userCharge.setChargeId(charge.getChargeId());
|
||||||
userCharge.setStock(charge.getStock());
|
userCharge.setStock(charge.getStock());
|
||||||
userCharge.setPurchaseDate(charge.getPurchaseDate());
|
userCharge.setPurchaseDate(charge.getPurchaseDate());
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
package icu.samnyan.aqua.sega.chunithm.model.requet;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import icu.samnyan.aqua.sega.chunithm.model.userdata.*;
|
||||||
|
import icu.samnyan.aqua.sega.general.model.response.UserRecentRating;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author samnyan (privateamusement@protonmail.com)
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class UpsertUserAll implements Serializable {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private List<UserData> userData;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private List<UserGameOption> userGameOption;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private List<UserGameOptionEx> userGameOptionEx;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private List<UserMap> userMapList;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private List<UserCharacter> userCharacterList;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private List<UserItem> userItemList;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private List<UserMusicDetail> userMusicDetailList;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private List<UserActivity> userActivityList;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private List<UserRecentRating> userRecentRatingList;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private List<UserCharge> userChargeList;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private List<UserPlaylog> userPlaylogList;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private List<UserCourse> userCourseList;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private List<UserDataEx> userDataEx;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private List<UserDuel> userDuelList;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@JsonProperty("isNewMapList")
|
||||||
|
private String isNewMapList;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@JsonProperty("isNewCharacterList")
|
||||||
|
private String isNewCharacterList;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@JsonProperty("isNewMusicDetailList")
|
||||||
|
private String isNewMusicDetailList;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@JsonProperty("isNewItemList")
|
||||||
|
private String isNewItemList;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@JsonProperty("isNewCourseList")
|
||||||
|
private String isNewCourseList;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@JsonProperty("isNewDuelList")
|
||||||
|
private String isNewDuelList;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -30,8 +30,8 @@ public class UserActivityService {
|
|||||||
return userActivityRepository.saveAll(userActivityList);
|
return userActivityRepository.saveAll(userActivityList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<UserActivity> getByUserAndActivityIdAndKind(UserData user, String activityId, String kind) {
|
public Optional<UserActivity> getByUserAndActivityIdAndKind(UserData user, int activityId, int kind) {
|
||||||
return userActivityRepository.findTopByUserAndActivityIdAndKindOrderByIdDesc(user, Integer.parseInt(activityId), Integer.parseInt(kind));
|
return userActivityRepository.findTopByUserAndActivityIdAndKindOrderByIdDesc(user, activityId, kind);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserActivity> getAllByUserIdAndKind(String userId, String kind) {
|
public List<UserActivity> getAllByUserIdAndKind(String userId, String kind) {
|
||||||
|
|||||||
@@ -42,10 +42,6 @@ public class UserCharacterService {
|
|||||||
return userCharacterRepository.findByUser_Card_ExtId(Integer.parseInt(userId), pageable);
|
return userCharacterRepository.findByUser_Card_ExtId(Integer.parseInt(userId), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<UserCharacter> getByUserAndCharacterId(UserData user, String characterId) {
|
|
||||||
return getByUserAndCharacterId(user, Integer.parseInt(characterId));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Optional<UserCharacter> getByUserAndCharacterId(UserData user, int characterId) {
|
public Optional<UserCharacter> getByUserAndCharacterId(UserData user, int characterId) {
|
||||||
return userCharacterRepository.findTopByUserAndCharacterIdOrderByIdDesc(user, characterId);
|
return userCharacterRepository.findTopByUserAndCharacterIdOrderByIdDesc(user, characterId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ public class UserChargeService {
|
|||||||
return userChargeRepository.findByUser_Card_ExtId(Integer.parseInt(userId));
|
return userChargeRepository.findByUser_Card_ExtId(Integer.parseInt(userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<UserCharge> getByUserAndChargeId(UserData user, String chargeId) {
|
public Optional<UserCharge> getByUserAndChargeId(UserData user, int chargeId) {
|
||||||
return userChargeRepository.findByUserAndChargeId(user, Integer.parseInt(chargeId));
|
return userChargeRepository.findByUserAndChargeId(user, chargeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class UserCourseService {
|
|||||||
return userCourseRepository.findByUser_Card_ExtId(Integer.parseInt(userId), page);
|
return userCourseRepository.findByUser_Card_ExtId(Integer.parseInt(userId), page);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<UserCourse> getByUserAndCourseId(UserData user, String courseId) {
|
public Optional<UserCourse> getByUserAndCourseId(UserData user, int courseId) {
|
||||||
return userCourseRepository.findTopByUserAndCourseIdOrderByIdDesc(user, Integer.parseInt(courseId));
|
return userCourseRepository.findTopByUserAndCourseIdOrderByIdDesc(user, courseId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ public class UserDuelService {
|
|||||||
this.userDuelRepository = userDuelRepository;
|
this.userDuelRepository = userDuelRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<UserDuel> getByUserAndDuelId(UserData user, String duelId) {
|
public Optional<UserDuel> getByUserAndDuelId(UserData user, int duelId) {
|
||||||
return userDuelRepository.findTopByUserAndDuelIdOrderByIdDesc(user, Integer.parseInt(duelId));
|
return userDuelRepository.findTopByUserAndDuelIdOrderByIdDesc(user, duelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserDuel save(UserDuel userDuel) {
|
public UserDuel save(UserDuel userDuel) {
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ public class UserItemService {
|
|||||||
return userItemRepository.findAllByUser_Card_ExtId(Integer.parseInt(userId));
|
return userItemRepository.findAllByUser_Card_ExtId(Integer.parseInt(userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<UserItem> getByUserAndItemId(UserData user, String itemId, String itemKind) {
|
public Optional<UserItem> getByUserAndItemIdAndKind(UserData user, int itemId, int itemKind) {
|
||||||
return userItemRepository.findTopByUserAndItemIdAndItemKindOrderByIdDesc(user, Integer.parseInt(itemId), Integer.parseInt(itemKind));
|
return userItemRepository.findTopByUserAndItemIdAndItemKindOrderByIdDesc(user, itemId, itemKind);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<UserItem> getByUserAndItemKind(String userId, int kind, int pageNumber, int maxCount) {
|
public Page<UserItem> getByUserAndItemKind(String userId, int kind, int pageNumber, int maxCount) {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class UserMapService {
|
|||||||
return userMapRepository.findAllByUser_Card_ExtId(Integer.parseInt(userId));
|
return userMapRepository.findAllByUser_Card_ExtId(Integer.parseInt(userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<UserMap> getByUserAndMapId(UserData user, String mapId) {
|
public Optional<UserMap> getByUserAndMapId(UserData user, int mapId) {
|
||||||
return userMapRepository.findTopByUserAndMapIdOrderByIdDesc(user, Integer.parseInt(mapId));
|
return userMapRepository.findTopByUserAndMapIdOrderByIdDesc(user, mapId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class UserMusicDetailService {
|
|||||||
return userMusicDetailRepository.findByUser_Card_ExtIdAndMusicId(Integer.parseInt(userId), musicId);
|
return userMusicDetailRepository.findByUser_Card_ExtIdAndMusicId(Integer.parseInt(userId), musicId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<UserMusicDetail> getByUserAndMusicIdAndLevel(UserData user, String musicId, String level) {
|
public Optional<UserMusicDetail> getByUserAndMusicIdAndLevel(UserData user, int musicId, int level) {
|
||||||
return userMusicDetailRepository.findTopByUserAndMusicIdAndLevelOrderByIdDesc(user, Integer.parseInt(musicId), Integer.parseInt(level));
|
return userMusicDetailRepository.findTopByUserAndMusicIdAndLevelOrderByIdDesc(user, musicId, level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ public class DivaController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
@PostMapping(value = "", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
public String fileRequest(@RequestParam String query, @RequestParam(required = false) MultipartFile bin) throws IOException, ServletException {
|
public String fileRequest(@RequestParam String query, @RequestParam(required = false) MultipartFile bin) {
|
||||||
|
|
||||||
Map<String, Object> body = parse(query);
|
Map<String, Object> body = parse(query);
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class DivaCompressionFilter extends OncePerRequestFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean shouldNotFilter(HttpServletRequest request) throws ServletException {
|
protected boolean shouldNotFilter(HttpServletRequest request) {
|
||||||
String path = request.getServletPath();
|
String path = request.getServletPath();
|
||||||
return !path.startsWith("/diva");
|
return !path.startsWith("/diva");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
* @author samnyan (privateamusement@protonmail.com)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package icu.samnyan.aqua.sega.diva.model.gamedata;
|
|||||||
|
|
||||||
import icu.samnyan.aqua.sega.diva.model.common.ContestLeague;
|
import icu.samnyan.aqua.sega.diva.model.common.ContestLeague;
|
||||||
import icu.samnyan.aqua.sega.diva.model.common.ContestNormaType;
|
import icu.samnyan.aqua.sega.diva.model.common.ContestNormaType;
|
||||||
import icu.samnyan.aqua.sega.diva.model.common.ContestStageLimit;
|
|
||||||
import icu.samnyan.aqua.sega.diva.util.DivaDateTimeUtil;
|
import icu.samnyan.aqua.sega.diva.util.DivaDateTimeUtil;
|
||||||
import icu.samnyan.aqua.sega.util.URIEncoder;
|
import icu.samnyan.aqua.sega.util.URIEncoder;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ package icu.samnyan.aqua.sega.diva.util;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.core.json.JsonWriteFeature;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||||
import icu.samnyan.aqua.sega.util.jackson.BooleanNumberDeserializer;
|
import icu.samnyan.aqua.sega.util.jackson.BooleanNumberDeserializer;
|
||||||
@@ -26,17 +28,19 @@ public class DivaMapper {
|
|||||||
private final ObjectMapper mapper;
|
private final ObjectMapper mapper;
|
||||||
|
|
||||||
public DivaMapper() {
|
public DivaMapper() {
|
||||||
mapper = new ObjectMapper().configure(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS, true);
|
|
||||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|
||||||
SimpleModule module = new SimpleModule();
|
SimpleModule module = new SimpleModule();
|
||||||
module.addSerializer(LocalDateTime.class, new DivaDateTimeSerializer());
|
module.addSerializer(LocalDateTime.class, new DivaDateTimeSerializer());
|
||||||
|
module.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.0")));
|
||||||
|
module.addDeserializer(ZonedDateTime.class, new ZonedDateTimeDeserializer());
|
||||||
module.addSerializer(Boolean.class, new BooleanNumberSerializer());
|
module.addSerializer(Boolean.class, new BooleanNumberSerializer());
|
||||||
module.addSerializer(boolean.class, new BooleanNumberSerializer());
|
module.addSerializer(boolean.class, new BooleanNumberSerializer());
|
||||||
module.addDeserializer(Boolean.class, new BooleanNumberDeserializer());
|
module.addDeserializer(Boolean.class, new BooleanNumberDeserializer());
|
||||||
module.addDeserializer(boolean.class, new BooleanNumberDeserializer());
|
module.addDeserializer(boolean.class, new BooleanNumberDeserializer());
|
||||||
|
|
||||||
module.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.0")));
|
mapper = JsonMapper.builder().enable(JsonWriteFeature.WRITE_NUMBERS_AS_STRINGS)
|
||||||
module.addDeserializer(ZonedDateTime.class, new ZonedDateTimeDeserializer());
|
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
||||||
|
.build();
|
||||||
|
|
||||||
mapper.registerModule(module);
|
mapper.registerModule(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
public class CompressRequestWrapper extends HttpServletRequestWrapper {
|
public class CompressRequestWrapper extends HttpServletRequestWrapper {
|
||||||
|
|
||||||
private ByteArrayInputStream input;
|
private final ByteArrayInputStream input;
|
||||||
private ServletInputStream filterInput;
|
private ServletInputStream filterInput;
|
||||||
|
|
||||||
public CompressRequestWrapper(HttpServletRequest request, byte[] input) {
|
public CompressRequestWrapper(HttpServletRequest request, byte[] input) {
|
||||||
@@ -22,7 +22,7 @@ public class CompressRequestWrapper extends HttpServletRequestWrapper {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServletInputStream getInputStream() throws IOException {
|
public ServletInputStream getInputStream() {
|
||||||
if (filterInput == null) {
|
if (filterInput == null) {
|
||||||
filterInput = new ServletInputStream() {
|
filterInput = new ServletInputStream() {
|
||||||
@Override
|
@Override
|
||||||
@@ -41,7 +41,7 @@ public class CompressRequestWrapper extends HttpServletRequestWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int read() throws IOException {
|
public int read() {
|
||||||
return input.read();
|
return input.read();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
public class CompressResponseWrapper extends HttpServletResponseWrapper {
|
public class CompressResponseWrapper extends HttpServletResponseWrapper {
|
||||||
|
|
||||||
private ByteArrayOutputStream output;
|
private final ByteArrayOutputStream output;
|
||||||
private ServletOutputStream filterOutput;
|
private ServletOutputStream filterOutput;
|
||||||
|
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ public class CompressResponseWrapper extends HttpServletResponseWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServletOutputStream getOutputStream() throws IOException {
|
public ServletOutputStream getOutputStream() {
|
||||||
if (filterOutput == null) {
|
if (filterOutput == null) {
|
||||||
filterOutput = new ServletOutputStream() {
|
filterOutput = new ServletOutputStream() {
|
||||||
@Override
|
@Override
|
||||||
@@ -36,7 +36,7 @@ public class CompressResponseWrapper extends HttpServletResponseWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(int b) throws IOException {
|
public void write(int b) {
|
||||||
output.write(b);
|
output.write(b);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class CompressionFilter extends OncePerRequestFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean shouldNotFilter(HttpServletRequest request) throws ServletException {
|
protected boolean shouldNotFilter(HttpServletRequest request) {
|
||||||
String path = request.getServletPath();
|
String path = request.getServletPath();
|
||||||
boolean notFilter = true;
|
boolean notFilter = true;
|
||||||
for (String prefix : filterList) {
|
for (String prefix : filterList) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package icu.samnyan.aqua.sega.chunithm.model.response.data;
|
package icu.samnyan.aqua.sega.general.model.response;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -84,196 +84,196 @@ public class OngekiController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("ExtendLockTimeApi")
|
@PostMapping("ExtendLockTimeApi")
|
||||||
String extendLockTime(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String extendLockTime(@ModelAttribute Map<String, Object> request) {
|
||||||
return "{\"returnCode\":1,\"apiName\":\"extendLockTime\"}";
|
return "{\"returnCode\":1,\"apiName\":\"extendLockTime\"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GameLoginApi")
|
@PostMapping("GameLoginApi")
|
||||||
String gameLogin(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String gameLogin(@ModelAttribute Map<String, Object> request) {
|
||||||
return "{\"returnCode\":1,\"apiName\":\"gameLogin\"}";
|
return "{\"returnCode\":1,\"apiName\":\"gameLogin\"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GameLogoutApi")
|
@PostMapping("GameLogoutApi")
|
||||||
String gameLogout(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String gameLogout(@ModelAttribute Map<String, Object> request) {
|
||||||
return "{\"returnCode\":1,\"apiName\": \"gameLogout\"}";
|
return "{\"returnCode\":1,\"apiName\": \"gameLogout\"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetGameEventApi")
|
@PostMapping("GetGameEventApi")
|
||||||
String getGameEvent(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getGameEvent(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getGameEventHandler.handle(request);
|
return getGameEventHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetGameIdlistApi")
|
@PostMapping("GetGameIdlistApi")
|
||||||
String getGameIdList(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getGameIdList(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getGameIdlistHandler.handle(request);
|
return getGameIdlistHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetGameMessageApi")
|
@PostMapping("GetGameMessageApi")
|
||||||
String getGameMessage(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getGameMessage(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getGameMessageHandler.handle(request);
|
return getGameMessageHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetGamePointApi")
|
@PostMapping("GetGamePointApi")
|
||||||
String getGamePoint(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getGamePoint(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getGamePointHandler.handle(request);
|
return getGamePointHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetGamePresentApi")
|
@PostMapping("GetGamePresentApi")
|
||||||
String getGamePresent(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getGamePresent(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getGamePresentHandler.handle(request);
|
return getGamePresentHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetGameRankingApi")
|
@PostMapping("GetGameRankingApi")
|
||||||
String getGameRanking(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getGameRanking(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getGameRankingHandler.handle(request);
|
return getGameRankingHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetGameRewardApi")
|
@PostMapping("GetGameRewardApi")
|
||||||
String getGameReward(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getGameReward(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getGameRewardHandler.handle(request);
|
return getGameRewardHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetGameSettingApi")
|
@PostMapping("GetGameSettingApi")
|
||||||
String getGameSetting(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getGameSetting(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getGameSettingHandler.handle(request);
|
return getGameSettingHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserActivityApi")
|
@PostMapping("GetUserActivityApi")
|
||||||
String getUserActivity(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserActivity(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserActivityHandler.handle(request);
|
return getUserActivityHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserBpBaseApi")
|
@PostMapping("GetUserBpBaseApi")
|
||||||
String getUserBpBase(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserBpBase(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserBpBaseHandler.handle(request);
|
return getUserBpBaseHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserCardApi")
|
@PostMapping("GetUserCardApi")
|
||||||
String getUserCard(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserCard(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserCardHandler.handle(request);
|
return getUserCardHandler.handle(request);
|
||||||
}
|
}
|
||||||
@PostMapping("GetUserChapterApi")
|
@PostMapping("GetUserChapterApi")
|
||||||
String getUserChapter(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserChapter(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserChapterHandler.handle(request);
|
return getUserChapterHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserCharacterApi")
|
@PostMapping("GetUserCharacterApi")
|
||||||
String getUserCharacter(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserCharacter(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserCharacterHandler.handle(request);
|
return getUserCharacterHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserDataApi")
|
@PostMapping("GetUserDataApi")
|
||||||
String getUserData(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserData(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserDataHandler.handle(request);
|
return getUserDataHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserDeckByKeyApi")
|
@PostMapping("GetUserDeckByKeyApi")
|
||||||
String getUserDeckByKey(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserDeckByKey(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserDeckByKeyHandler.handle(request);
|
return getUserDeckByKeyHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserEventPointApi")
|
@PostMapping("GetUserEventPointApi")
|
||||||
String getUserEventPoint(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserEventPoint(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserEventPointHandler.handle(request);
|
return getUserEventPointHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserEventRankingApi")
|
@PostMapping("GetUserEventRankingApi")
|
||||||
String getUserEventRanking(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserEventRanking(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserEventRankingHandler.handle(request);
|
return getUserEventRankingHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserItemApi")
|
@PostMapping("GetUserItemApi")
|
||||||
String getUserItem(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserItem(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserItemHandler.handle(request);
|
return getUserItemHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserLoginBonusApi")
|
@PostMapping("GetUserLoginBonusApi")
|
||||||
String getUserLoginBonus(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserLoginBonus(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserLoginBonusHandler.handle(request);
|
return getUserLoginBonusHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserMissionPointApi")
|
@PostMapping("GetUserMissionPointApi")
|
||||||
String getUserMissionPoint(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserMissionPoint(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserMissionPointHandler.handle(request);
|
return getUserMissionPointHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserMusicApi")
|
@PostMapping("GetUserMusicApi")
|
||||||
String getUserMusic(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserMusic(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserMusicHandler.handle(request);
|
return getUserMusicHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserMusicItemApi")
|
@PostMapping("GetUserMusicItemApi")
|
||||||
String getUserMusicItem(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserMusicItem(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserMusicItemHandler.handle(request);
|
return getUserMusicItemHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserOptionApi")
|
@PostMapping("GetUserOptionApi")
|
||||||
String getUserOption(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserOption(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserOptionHandler.handle(request);
|
return getUserOptionHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserPreviewApi")
|
@PostMapping("GetUserPreviewApi")
|
||||||
String getUserPreview(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserPreview(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserPreviewHandler.handle(request);
|
return getUserPreviewHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserRatinglogApi")
|
@PostMapping("GetUserRatinglogApi")
|
||||||
String getUserRatinglog(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserRatinglog(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserRatinglogListHandler.handle(request);
|
return getUserRatinglogListHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserRecentRatingApi")
|
@PostMapping("GetUserRecentRatingApi")
|
||||||
String getUserRecentRating(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserRecentRating(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserRecentRatingHandler.handle(request);
|
return getUserRecentRatingHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserRegionApi")
|
@PostMapping("GetUserRegionApi")
|
||||||
String getUserRegion(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserRegion(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserRegionHandler.handle(request);
|
return getUserRegionHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserStoryApi")
|
@PostMapping("GetUserStoryApi")
|
||||||
String getUserStory(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserStory(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserStoryHandler.handle(request);
|
return getUserStoryHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("GetUserTrainingRoomByKeyApi")
|
@PostMapping("GetUserTrainingRoomByKeyApi")
|
||||||
String getUserTrainingRoomByKey(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String getUserTrainingRoomByKey(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return getUserTrainingRoomByKeyHandler.handle(request);
|
return getUserTrainingRoomByKeyHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("UpsertClientBookkeepingApi")
|
@PostMapping("UpsertClientBookkeepingApi")
|
||||||
String upsertClientBookkeeping(@ModelAttribute Map<String, Object> request) {
|
public String upsertClientBookkeeping(@ModelAttribute Map<String, Object> request) {
|
||||||
return "{\"returnCode\":1},\"apiName\":\"upsertClientBookkeeping\"";
|
return "{\"returnCode\":1},\"apiName\":\"upsertClientBookkeeping\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("UpsertClientDevelopApi")
|
@PostMapping("UpsertClientDevelopApi")
|
||||||
String upsertClientDevelop(@ModelAttribute Map<String, Object> request) {
|
public String upsertClientDevelop(@ModelAttribute Map<String, Object> request) {
|
||||||
return "{\"returnCode\":1},\"apiName\":\"upsertClientDevelop\"";
|
return "{\"returnCode\":1},\"apiName\":\"upsertClientDevelop\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("UpsertClientErrorApi")
|
@PostMapping("UpsertClientErrorApi")
|
||||||
String upsertClientError(@ModelAttribute Map<String, Object> request) {
|
public String upsertClientError(@ModelAttribute Map<String, Object> request) {
|
||||||
return "{\"returnCode\":1,\"apiName\":\"upsertClientError\"}";
|
return "{\"returnCode\":1,\"apiName\":\"upsertClientError\"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("UpsertClientSettingApi")
|
@PostMapping("UpsertClientSettingApi")
|
||||||
String upsertClientSetting(@ModelAttribute Map<String, Object> request) {
|
public String upsertClientSetting(@ModelAttribute Map<String, Object> request) {
|
||||||
return "{\"returnCode\":1,\"apiName\":\"upsertClientSetting\"}";
|
return "{\"returnCode\":1,\"apiName\":\"upsertClientSetting\"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("UpsertClientTestmodeApi")
|
@PostMapping("UpsertClientTestmodeApi")
|
||||||
String upsertClientTestmode(@ModelAttribute Map<String, Object> request) {
|
public String upsertClientTestmode(@ModelAttribute Map<String, Object> request) {
|
||||||
return "{\"returnCode\":1,\"apiName\":\"upsertClientTestmode\"}";
|
return "{\"returnCode\":1,\"apiName\":\"upsertClientTestmode\"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("UpsertUserGplogApi")
|
@PostMapping("UpsertUserGplogApi")
|
||||||
String upsertUserGplog(@ModelAttribute Map<String, Object> request) {
|
public String upsertUserGplog(@ModelAttribute Map<String, Object> request) {
|
||||||
return "{\"returnCode\":1,\"apiName\":\"upsertUserGplog\"}";
|
return "{\"returnCode\":1,\"apiName\":\"upsertUserGplog\"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("UpsertUserAllApi")
|
@PostMapping("UpsertUserAllApi")
|
||||||
String upsertUserAll(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
public String upsertUserAll(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
|
||||||
return upsertUserAllHandler.handle(request);
|
return upsertUserAllHandler.handle(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
|
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 icu.samnyan.aqua.sega.ongeki.model.gamedata.GamePresent;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package icu.samnyan.aqua.sega.ongeki.dao.gamedata;
|
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 icu.samnyan.aqua.sega.ongeki.model.gamedata.GameReward;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|||||||
@@ -13,9 +13,11 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
@Repository("OngekiUserActivityRepository")
|
@Repository("OngekiUserActivityRepository")
|
||||||
public interface UserActivityRepository extends JpaRepository<UserActivity, Long> {
|
public interface UserActivityRepository extends JpaRepository<UserActivity, Long> {
|
||||||
|
|
||||||
|
List<UserActivity> findByUser_Card_ExtId(int userId);
|
||||||
|
|
||||||
Optional<UserActivity> findByUserAndKindAndActivityId(UserData userData, int kind, int activityId);
|
Optional<UserActivity> findByUserAndKindAndActivityId(UserData userData, int kind, int activityId);
|
||||||
|
|
||||||
List<UserActivity> findByUser_Card_ExtIdAndKindOrderBySortNumberDesc(int userId, int kind);
|
List<UserActivity> findByUser_Card_ExtIdAndKindOrderBySortNumberDesc(int userId, int kind);
|
||||||
|
|
||||||
List<UserActivity> findByUser_Card_ExtId(int userId);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,9 +14,11 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
@Repository("OngekiUserCardRepository")
|
@Repository("OngekiUserCardRepository")
|
||||||
public interface UserCardRepository extends JpaRepository<UserCard, Long> {
|
public interface UserCardRepository extends JpaRepository<UserCard, Long> {
|
||||||
|
|
||||||
Optional<UserCard> findByUserAndCardId(UserData userData, int cardId);
|
Optional<UserCard> findByUserAndCardId(UserData userData, int cardId);
|
||||||
|
|
||||||
|
Optional<UserCard> findByUser_Card_ExtIdAndCardId(int aimeId, int cardId);
|
||||||
|
|
||||||
Page<UserCard> findByUser_Card_ExtId(int userId, Pageable page);
|
Page<UserCard> findByUser_Card_ExtId(int userId, Pageable page);
|
||||||
|
|
||||||
Optional<UserCard> findByUser_Card_ExtIdAndCardId(int aimeId, int cardId);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
@Repository("OngekiUserChapterRepository")
|
@Repository("OngekiUserChapterRepository")
|
||||||
public interface UserChapterRepository extends JpaRepository<UserChapter, Long> {
|
public interface UserChapterRepository extends JpaRepository<UserChapter, Long> {
|
||||||
Optional<UserChapter> findByUserAndChapterId(UserData userData, int chapterId);
|
|
||||||
|
|
||||||
List<UserChapter> findByUser_Card_ExtId(int userId);
|
List<UserChapter> findByUser_Card_ExtId(int userId);
|
||||||
|
|
||||||
|
Optional<UserChapter> findByUserAndChapterId(UserData userData, int chapterId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
@Repository("OngekiUserCharacterRepository")
|
@Repository("OngekiUserCharacterRepository")
|
||||||
public interface UserCharacterRepository extends JpaRepository<UserCharacter, Long> {
|
public interface UserCharacterRepository extends JpaRepository<UserCharacter, Long> {
|
||||||
Optional<UserCharacter> findByUserAndCharacterId(UserData userData, int characterId);
|
|
||||||
|
|
||||||
Page<UserCharacter> findByUser_Card_ExtId(Integer userId, Pageable page);
|
Page<UserCharacter> findByUser_Card_ExtId(Integer userId, Pageable page);
|
||||||
|
|
||||||
|
Optional<UserCharacter> findByUserAndCharacterId(UserData userData, int characterId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,4 +13,5 @@ import java.util.Optional;
|
|||||||
public interface UserDataRepository extends JpaRepository<UserData, Long> {
|
public interface UserDataRepository extends JpaRepository<UserData, Long> {
|
||||||
|
|
||||||
Optional<UserData> findByCard_ExtId(int aimeId);
|
Optional<UserData> findByCard_ExtId(int aimeId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
@Repository("OngekiUserDeckRepository")
|
@Repository("OngekiUserDeckRepository")
|
||||||
public interface UserDeckRepository extends JpaRepository<UserDeck, Long> {
|
public interface UserDeckRepository extends JpaRepository<UserDeck, Long> {
|
||||||
Optional<UserDeck> findByUserAndDeckId(UserData userData, int deckId);
|
|
||||||
|
|
||||||
List<UserDeck> findByUser_Card_ExtId(int userId);
|
List<UserDeck> findByUser_Card_ExtId(int userId);
|
||||||
|
|
||||||
|
Optional<UserDeck> findByUserAndDeckId(UserData userData, int deckId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
@Repository("OngekiUserEventPointRepository")
|
@Repository("OngekiUserEventPointRepository")
|
||||||
public interface UserEventPointRepository extends JpaRepository<UserEventPoint, Long> {
|
public interface UserEventPointRepository extends JpaRepository<UserEventPoint, Long> {
|
||||||
Optional<UserEventPoint> findByUserAndEventId(UserData userData, int eventId);
|
|
||||||
|
|
||||||
List<UserEventPoint> findByUser_Card_ExtId(int userId);
|
List<UserEventPoint> findByUser_Card_ExtId(int userId);
|
||||||
|
|
||||||
|
Optional<UserEventPoint> findByUserAndEventId(UserData userData, int eventId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
@Repository("OngekiUserGeneralDataRepository")
|
@Repository("OngekiUserGeneralDataRepository")
|
||||||
public interface UserGeneralDataRepository extends JpaRepository<UserGeneralData, Long> {
|
public interface UserGeneralDataRepository extends JpaRepository<UserGeneralData, Long> {
|
||||||
|
|
||||||
Optional<UserGeneralData> findByUserAndPropertyKey(UserData user, String key);
|
Optional<UserGeneralData> findByUserAndPropertyKey(UserData user, String key);
|
||||||
|
|
||||||
Optional<UserGeneralData> findByUser_Card_ExtIdAndPropertyKey(int aimeId, String key);
|
Optional<UserGeneralData> findByUser_Card_ExtIdAndPropertyKey(int aimeId, String key);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,9 +14,11 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
@Repository("OngekiUserItemRepository")
|
@Repository("OngekiUserItemRepository")
|
||||||
public interface UserItemRepository extends JpaRepository<UserItem, Long> {
|
public interface UserItemRepository extends JpaRepository<UserItem, Long> {
|
||||||
|
|
||||||
|
Page<UserItem> findByUser_Card_ExtId(Integer aimeId, Pageable page);
|
||||||
|
|
||||||
Optional<UserItem> findByUserAndItemKindAndItemId(UserData userData, int itemKind, int itemId);
|
Optional<UserItem> findByUserAndItemKindAndItemId(UserData userData, int itemKind, int itemId);
|
||||||
|
|
||||||
Page<UserItem> findByUser_Card_ExtIdAndItemKind(int userId, int kind, Pageable page);
|
Page<UserItem> findByUser_Card_ExtIdAndItemKind(int userId, int kind, Pageable page);
|
||||||
|
|
||||||
Page<UserItem> findByUser_Card_ExtId(Integer aimeId, Pageable page);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ import java.util.Optional;
|
|||||||
* @author samnyan (privateamusement@protonmail.com)
|
* @author samnyan (privateamusement@protonmail.com)
|
||||||
*/
|
*/
|
||||||
public interface UserLoginBonusRepository extends JpaRepository<UserLoginBonus, Long> {
|
public interface UserLoginBonusRepository extends JpaRepository<UserLoginBonus, Long> {
|
||||||
Optional<UserLoginBonus> findByUserAndBonusId(UserData userData, int bonusId);
|
|
||||||
|
|
||||||
List<UserLoginBonus> findByUser_Card_ExtId(int userId);
|
List<UserLoginBonus> findByUser_Card_ExtId(int userId);
|
||||||
|
|
||||||
|
Optional<UserLoginBonus> findByUserAndBonusId(UserData userData, int bonusId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
|
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.UserData;
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserEventPoint;
|
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserMissionPoint;
|
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserMissionPoint;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
@@ -14,7 +13,9 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
@Repository("OngekiUserMissionPointRepository")
|
@Repository("OngekiUserMissionPointRepository")
|
||||||
public interface UserMissionPointRepository extends JpaRepository<UserMissionPoint, Long> {
|
public interface UserMissionPointRepository extends JpaRepository<UserMissionPoint, Long> {
|
||||||
Optional<UserMissionPoint> findByUserAndEventId(UserData userData, int eventId);
|
|
||||||
|
|
||||||
List<UserMissionPoint> findByUser_Card_ExtId(int userId);
|
List<UserMissionPoint> findByUser_Card_ExtId(int userId);
|
||||||
|
|
||||||
|
Optional<UserMissionPoint> findByUserAndEventId(UserData userData, int eventId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,11 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
@Repository("OngekiUserMusicDetailRepository")
|
@Repository("OngekiUserMusicDetailRepository")
|
||||||
public interface UserMusicDetailRepository extends JpaRepository<UserMusicDetail, Long> {
|
public interface UserMusicDetailRepository extends JpaRepository<UserMusicDetail, Long> {
|
||||||
Optional<UserMusicDetail> findByUserAndMusicIdAndLevel(UserData userData, int musicId, int level);
|
|
||||||
|
|
||||||
Page<UserMusicDetail> findByUser_Card_ExtId(int userId, Pageable page);
|
Page<UserMusicDetail> findByUser_Card_ExtId(int userId, Pageable page);
|
||||||
|
|
||||||
List<UserMusicDetail> findByUser_Card_ExtIdAndMusicId(int userId, int id);
|
List<UserMusicDetail> findByUser_Card_ExtIdAndMusicId(int userId, int id);
|
||||||
|
|
||||||
|
Optional<UserMusicDetail> findByUserAndMusicIdAndLevel(UserData userData, int musicId, int level);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
@Repository("OngekiUserMusicItemRepository")
|
@Repository("OngekiUserMusicItemRepository")
|
||||||
public interface UserMusicItemRepository extends JpaRepository<UserMusicItem, Long> {
|
public interface UserMusicItemRepository extends JpaRepository<UserMusicItem, Long> {
|
||||||
|
|
||||||
Optional<UserMusicItem> findByUserAndMusicId(UserData userData, int musicId);
|
Optional<UserMusicItem> findByUserAndMusicId(UserData userData, int musicId);
|
||||||
|
|
||||||
Page<UserMusicItem> findByUser_Card_ExtId(int userId, Pageable page);
|
Page<UserMusicItem> findByUser_Card_ExtId(int userId, Pageable page);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
@Repository("OngekiUserOptionRepository")
|
@Repository("OngekiUserOptionRepository")
|
||||||
public interface UserOptionRepository extends JpaRepository<UserOption, Long> {
|
public interface UserOptionRepository extends JpaRepository<UserOption, Long> {
|
||||||
|
|
||||||
Optional<UserOption> findByUser(UserData userData);
|
Optional<UserOption> findByUser(UserData userData);
|
||||||
|
|
||||||
Optional<UserOption> findByUser_Card_ExtId(int userId);
|
Optional<UserOption> findByUser_Card_ExtId(int userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Repository("OngekiUserPlaylogRepository")
|
@Repository("OngekiUserPlaylogRepository")
|
||||||
public interface UserPlaylogRepository extends JpaRepository<UserPlaylog, Long> {
|
public interface UserPlaylogRepository extends JpaRepository<UserPlaylog, Long> {
|
||||||
|
|
||||||
Page<UserPlaylog> findByUser_Card_ExtId(Integer userId, Pageable page);
|
Page<UserPlaylog> findByUser_Card_ExtId(Integer userId, Pageable page);
|
||||||
|
|
||||||
List<UserPlaylog> findByUser_Card_ExtIdAndMusicIdAndLevel(Integer userId, int musicId, int level);
|
List<UserPlaylog> findByUser_Card_ExtIdAndMusicIdAndLevel(Integer userId, int musicId, int level);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,5 +12,7 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
@Repository("OngekiUserStoryRepository")
|
@Repository("OngekiUserStoryRepository")
|
||||||
public interface UserStoryRepository extends JpaRepository<UserStory, Long> {
|
public interface UserStoryRepository extends JpaRepository<UserStory, Long> {
|
||||||
|
|
||||||
Optional<UserStory> findByUserAndStoryId(UserData userData, int storyId);
|
Optional<UserStory> findByUserAndStoryId(UserData userData, int storyId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
@Repository("OngekiUserTrainingRoomRepository")
|
@Repository("OngekiUserTrainingRoomRepository")
|
||||||
public interface UserTrainingRoomRepository extends JpaRepository<UserTrainingRoom, Long> {
|
public interface UserTrainingRoomRepository extends JpaRepository<UserTrainingRoom, Long> {
|
||||||
|
|
||||||
Optional<UserTrainingRoom> findByUserAndRoomId(UserData user, int roomId);
|
Optional<UserTrainingRoom> findByUserAndRoomId(UserData user, int roomId);
|
||||||
|
|
||||||
List<UserTrainingRoom> findByUser_Card_ExtId(int userId);
|
List<UserTrainingRoom> findByUser_Card_ExtId(int userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,14 +40,12 @@ public class GetGameEventHandler implements BaseHandler {
|
|||||||
|
|
||||||
List<GameEvent> eventIdList = gameEventRepository.findAll();
|
List<GameEvent> eventIdList = gameEventRepository.findAll();
|
||||||
List<GameEventItem> eventList = new ArrayList<>();
|
List<GameEventItem> eventList = new ArrayList<>();
|
||||||
eventIdList.forEach(x -> {
|
eventIdList.forEach(x -> eventList.add(new GameEventItem(
|
||||||
eventList.add(new GameEventItem(
|
x.getId(),
|
||||||
x.getId(),
|
type,
|
||||||
type,
|
"2005-01-01 00:00:00.0",
|
||||||
"2005-01-01 00:00:00.0",
|
"2099-01-01 05:00:00.0"
|
||||||
"2099-01-01 05:00:00.0"
|
)));
|
||||||
));
|
|
||||||
});
|
|
||||||
|
|
||||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||||
resultMap.put("type", type);
|
resultMap.put("type", type);
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import icu.samnyan.aqua.sega.general.dao.PropertyEntryRepository;
|
|||||||
import icu.samnyan.aqua.sega.general.model.PropertyEntry;
|
import icu.samnyan.aqua.sega.general.model.PropertyEntry;
|
||||||
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
|
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.GameIdListItem;
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.response.data.GameRankingItem;
|
|
||||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
|||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import icu.samnyan.aqua.sega.ongeki.dao.gamedata.GamePointRepository;
|
import icu.samnyan.aqua.sega.ongeki.dao.gamedata.GamePointRepository;
|
||||||
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
|
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.ongeki.model.gamedata.GamePoint;
|
||||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -11,7 +10,6 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
|||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import icu.samnyan.aqua.sega.ongeki.dao.gamedata.GameRewardRepository;
|
import icu.samnyan.aqua.sega.ongeki.dao.gamedata.GameRewardRepository;
|
||||||
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
|
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.ongeki.model.gamedata.GameReward;
|
||||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -11,7 +10,6 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|||||||
@@ -46,15 +46,13 @@ public class GetUserEventRankingHandler implements BaseHandler {
|
|||||||
// TODO: query ranking from database
|
// TODO: query ranking from database
|
||||||
List<UserEventPoint> eventPointList = userEventPointRepository.findByUser_Card_ExtId(userId);
|
List<UserEventPoint> eventPointList = userEventPointRepository.findByUser_Card_ExtId(userId);
|
||||||
List<UserEventRankingItem> rankingItemList = new LinkedList<>();
|
List<UserEventRankingItem> rankingItemList = new LinkedList<>();
|
||||||
eventPointList.forEach(x -> {
|
eventPointList.forEach(x -> rankingItemList.add(new UserEventRankingItem(
|
||||||
rankingItemList.add(new UserEventRankingItem(
|
x.getEventId(),
|
||||||
x.getEventId(),
|
1, // Type 1 is latest ranking
|
||||||
1, // Type 1 is latest ranking
|
time,
|
||||||
time,
|
1,
|
||||||
1,
|
x.getPoint()
|
||||||
x.getPoint()
|
)));
|
||||||
));
|
|
||||||
});
|
|
||||||
|
|
||||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||||
resultMap.put("userId", userId);
|
resultMap.put("userId", userId);
|
||||||
|
|||||||
@@ -50,11 +50,9 @@ public class GetUserPreviewHandler implements BaseHandler {
|
|||||||
GetUserPreviewResp resp = new GetUserPreviewResp();
|
GetUserPreviewResp resp = new GetUserPreviewResp();
|
||||||
resp.setUserId(userId);
|
resp.setUserId(userId);
|
||||||
if (userData.isEmpty()) {
|
if (userData.isEmpty()) {
|
||||||
/**
|
// From BaseDialogController.cs
|
||||||
* From BaseDialogController.cs
|
// <code>if (string.IsNullOrEmpty(instance.userPreview.lastPlayDate))</code>
|
||||||
* <code>if (string.IsNullOrEmpty(instance.userPreview.lastPlayDate))</code>
|
// so send a null value will trigger new user register
|
||||||
* so send a null value will trigger new user register
|
|
||||||
*/
|
|
||||||
resp.setLastPlayDate(null);
|
resp.setLastPlayDate(null);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import icu.samnyan.aqua.sega.chunithm.model.response.data.UserRecentRating;
|
import icu.samnyan.aqua.sega.general.model.response.UserRecentRating;
|
||||||
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserPlaylogRepository;
|
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserPlaylogRepository;
|
||||||
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
|
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserPlaylog;
|
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserPlaylog;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package icu.samnyan.aqua.sega.ongeki.handler.impl;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import icu.samnyan.aqua.sega.chunithm.model.response.data.UserRecentRating;
|
import icu.samnyan.aqua.sega.general.model.response.UserRecentRating;
|
||||||
import icu.samnyan.aqua.sega.general.model.Card;
|
import icu.samnyan.aqua.sega.general.model.Card;
|
||||||
import icu.samnyan.aqua.sega.general.service.CardService;
|
import icu.samnyan.aqua.sega.general.service.CardService;
|
||||||
import icu.samnyan.aqua.sega.ongeki.dao.userdata.*;
|
import icu.samnyan.aqua.sega.ongeki.dao.userdata.*;
|
||||||
@@ -21,10 +21,7 @@ import java.util.Map;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The handler for loading basic profile information.
|
* The handler for saving all data of a ONGEKI profile
|
||||||
* <p>
|
|
||||||
* return null if no profile exist
|
|
||||||
*
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
* @author samnyan (privateamusement@protonmail.com)
|
||||||
*/
|
*/
|
||||||
@Component("OngekiUserAllHandler")
|
@Component("OngekiUserAllHandler")
|
||||||
@@ -451,7 +448,7 @@ public class UpsertUserAllHandler implements BaseHandler {
|
|||||||
|
|
||||||
private void saveGeneralData(Map<String, Object> upsertUserAll, UserData newUserData, String jsonName, String key) {
|
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));
|
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<>() {
|
List<UserRecentRating> itemList = mapper.convert(recordList, new TypeReference<>() {
|
||||||
});
|
});
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package icu.samnyan.aqua.sega.ongeki.model.gamedata;
|
package icu.samnyan.aqua.sega.ongeki.model.gamedata;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.common.ItemType;
|
import icu.samnyan.aqua.sega.ongeki.model.common.ItemType;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
* @author samnyan (privateamusement@protonmail.com)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package icu.samnyan.aqua.sega.ongeki.model.userdata;
|
package icu.samnyan.aqua.sega.ongeki.model.userdata;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import org.springframework.stereotype.Component;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
* @author samnyan (privateamusement@protonmail.com)
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ package icu.samnyan.aqua.sega.util.jackson;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.core.json.JsonWriteFeature;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||||
@@ -25,16 +27,17 @@ public class StringMapper {
|
|||||||
private final ObjectMapper mapper;
|
private final ObjectMapper mapper;
|
||||||
|
|
||||||
public StringMapper() {
|
public StringMapper() {
|
||||||
mapper = new ObjectMapper().configure(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS, true);
|
|
||||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|
||||||
mapper.configure(SerializationFeature.WRITE_ENUMS_USING_INDEX, true);
|
|
||||||
SimpleModule module = new SimpleModule();
|
SimpleModule module = new SimpleModule();
|
||||||
module.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
module.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||||
|
module.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||||
module.addSerializer(Boolean.class, new BooleanStringSerializer());
|
module.addSerializer(Boolean.class, new BooleanStringSerializer());
|
||||||
module.addSerializer(boolean.class, new BooleanStringSerializer());
|
module.addSerializer(boolean.class, new BooleanStringSerializer());
|
||||||
|
mapper = JsonMapper.builder()
|
||||||
module.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
.enable(JsonWriteFeature.WRITE_NUMBERS_AS_STRINGS)
|
||||||
mapper.registerModule(module);
|
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
||||||
|
.configure(SerializationFeature.WRITE_ENUMS_USING_INDEX, true)
|
||||||
|
.addModule(module)
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String write(Object o) throws JsonProcessingException {
|
public String write(Object o) throws JsonProcessingException {
|
||||||
@@ -42,7 +45,7 @@ public class StringMapper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
return mapper.convertValue(map, toClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user