[chusan]add support for luminous

pull/23/head
HoshimiRIN 2024-03-06 17:13:13 +08:00
parent 7a7076b174
commit 95b9871f7f
15 changed files with 482 additions and 67 deletions

View File

@ -49,6 +49,9 @@ public class ChusanServletController {
private final GetGameGachaHandler getGameGachaHandler;
private final GetGameGachaCardByIdHandler getGameGachaCardByIdHandler;
private final GetUserCardPrintErrorHandler getUserCardPrintErrorHandler;
private final GetUserCMissionHandler getUserCMissionHandler;
private final GetGameMapAreaConditionHandler getGameMapAreaConditionHandler;
private final GetUserNetBattleRankingInfoHandler getUserNetBattleRankingInfoHandler;
private final CMGetUserPreviewHandler cmGetUserPreviewHandler;
private final CMGetUserDataHandler cmGetUserDataHandler;
private final CMGetUserCharacterHandler cmGetUserCharacterHandler;
@ -59,6 +62,7 @@ public class ChusanServletController {
private final CMUpsertUserGachaHandler cmUpsertUserGachaHandler;
private final CMUpsertUserPrintSubtractHandler cmUpsertUserPrintSubtractHandler;
private final CMUpsertUserPrintCancelHandler cmUpsertUserPrintCancelHandler;
private final GetUserCtoCPlayHandler getUserCtoCPlayHandler;
private final BeginMatchingHandler beginMatchingHandler;
private final EndMatchingHandler endMatchingHandler;
private final GetMatchingStateHandler getMatchingStateHandler;
@ -66,29 +70,29 @@ public class ChusanServletController {
@Autowired
public ChusanServletController(GameLoginHandler gameLoginHandler, GameLogoutHandler gameLogoutHandler,
GetGameChargeHandler getGameChargeHandler, GetGameEventHandler getGameEventHandler,
GetGameIdlistHandler getGameIdlistHandler, GetGameRankingHandler getGameRankingHandler,
GetGameSettingHandler getGameSettingHandler, GetTeamCourseRuleHandler getTeamCourseRuleHandler,
GetTeamCourseSettingHandler getTeamCourseSettingHandler, GetUserActivityHandler getUserActivityHandler,
GetUserCharacterHandler getUserCharacterHandler, GetUserChargeHandler getUserChargeHandler,
GetUserCourseHandler getUserCourseHandler, GetUserDataHandler getUserDataHandler,
GetUserDuelHandler getUserDuelHandler, GetUserFavoriteItemHandler getUserFavoriteItemHandler,
GetUserItemHandler getUserItemHandler, GetUserLoginBonusHandler getUserLoginBonusHandler,
GetUserMapAreaHandler getUserMapAreaHandler, GetUserMusicHandler getUserMusicHandler,
GetUserOptionHandler getUserOptionHandler, GetUserPreviewHandler getUserPreviewHandler,
GetUserRecentRatingHandler getUserRecentRatingHandler, GetUserRegionHandler getUserRegionHandler,
GetUserRivalDataHandler getUserRivalDataHandler, GetUserRivalMusicHandler getUserRivalMusicHandler,
GetUserTeamHandler getUserTeamHandler, UpsertUserAllHandler upsertUserAllHandler,
UpsertUserChargelogHandler upsertUserChargelogHandler, GetUserSymbolChatSettingHandler getUserSymbolChatSettingHandler,
GetUserNetBattleDataHandler getUserNetBattleDataHandler, GetGameGachaHandler getGameGachaHandler,
GetGameGachaCardByIdHandler getGameGachaCardByIdHandler, GetUserCardPrintErrorHandler getUserCardPrintErrorHandler,
CMGetUserPreviewHandler cmGetUserPreviewHandler, CMGetUserDataHandler cmGetUserDataHandler,
CMGetUserCharacterHandler cmGetUserCharacterHandler, GetUserGachaHandler getUserGachaHandler,
GetUserPrintedCardHandler getUserPrintedCardHandler, CMGetUserItemHandler cmGetUserItemHandler,
RollGachaHandler rollGachaHandler, CMUpsertUserGachaHandler cmUpsertUserGachaHandler,
CMUpsertUserPrintSubtractHandler cmUpsertUserPrintSubtractHandler, CMUpsertUserPrintCancelHandler cmUpsertUserPrintCancelHandler,
BeginMatchingHandler beginMatchingHandler, EndMatchingHandler endMatchingHandler,
GetMatchingStateHandler getMatchingStateHandler, RemoveMatchingMemberHandler removeMatchingMemberHandler) {
GetGameChargeHandler getGameChargeHandler, GetGameEventHandler getGameEventHandler,
GetGameIdlistHandler getGameIdlistHandler, GetGameRankingHandler getGameRankingHandler,
GetGameSettingHandler getGameSettingHandler, GetTeamCourseRuleHandler getTeamCourseRuleHandler,
GetTeamCourseSettingHandler getTeamCourseSettingHandler, GetUserActivityHandler getUserActivityHandler,
GetUserCharacterHandler getUserCharacterHandler, GetUserChargeHandler getUserChargeHandler,
GetUserCourseHandler getUserCourseHandler, GetUserDataHandler getUserDataHandler,
GetUserDuelHandler getUserDuelHandler, GetUserFavoriteItemHandler getUserFavoriteItemHandler,
GetUserItemHandler getUserItemHandler, GetUserLoginBonusHandler getUserLoginBonusHandler,
GetUserMapAreaHandler getUserMapAreaHandler, GetUserMusicHandler getUserMusicHandler,
GetUserOptionHandler getUserOptionHandler, GetUserPreviewHandler getUserPreviewHandler,
GetUserRecentRatingHandler getUserRecentRatingHandler, GetUserRegionHandler getUserRegionHandler,
GetUserRivalDataHandler getUserRivalDataHandler, GetUserRivalMusicHandler getUserRivalMusicHandler,
GetUserTeamHandler getUserTeamHandler, UpsertUserAllHandler upsertUserAllHandler,
UpsertUserChargelogHandler upsertUserChargelogHandler, GetUserSymbolChatSettingHandler getUserSymbolChatSettingHandler,
GetUserNetBattleDataHandler getUserNetBattleDataHandler, GetGameGachaHandler getGameGachaHandler,
GetGameGachaCardByIdHandler getGameGachaCardByIdHandler, GetUserCardPrintErrorHandler getUserCardPrintErrorHandler,
GetUserCMissionHandler getUserCMissionHandler, GetGameMapAreaConditionHandler getGameMapAreaConditionHandler, GetUserNetBattleRankingInfoHandler getUserNetBattleRankingInfoHandler, CMGetUserPreviewHandler cmGetUserPreviewHandler, CMGetUserDataHandler cmGetUserDataHandler,
CMGetUserCharacterHandler cmGetUserCharacterHandler, GetUserGachaHandler getUserGachaHandler,
GetUserPrintedCardHandler getUserPrintedCardHandler, CMGetUserItemHandler cmGetUserItemHandler,
RollGachaHandler rollGachaHandler, CMUpsertUserGachaHandler cmUpsertUserGachaHandler,
CMUpsertUserPrintSubtractHandler cmUpsertUserPrintSubtractHandler, CMUpsertUserPrintCancelHandler cmUpsertUserPrintCancelHandler,
BeginMatchingHandler beginMatchingHandler, EndMatchingHandler endMatchingHandler,
GetMatchingStateHandler getMatchingStateHandler, RemoveMatchingMemberHandler removeMatchingMemberHandler) {
this.gameLoginHandler = gameLoginHandler;
this.gameLogoutHandler = gameLogoutHandler;
this.getGameChargeHandler = getGameChargeHandler;
@ -123,6 +127,9 @@ public class ChusanServletController {
this.getGameGachaHandler = getGameGachaHandler;
this.getGameGachaCardByIdHandler = getGameGachaCardByIdHandler;
this.getUserCardPrintErrorHandler = getUserCardPrintErrorHandler;
this.getUserCMissionHandler = getUserCMissionHandler;
this.getGameMapAreaConditionHandler = getGameMapAreaConditionHandler;
this.getUserNetBattleRankingInfoHandler = getUserNetBattleRankingInfoHandler;
this.cmGetUserPreviewHandler = cmGetUserPreviewHandler;
this.cmGetUserDataHandler = cmGetUserDataHandler;
this.cmGetUserCharacterHandler = cmGetUserCharacterHandler;
@ -133,212 +140,228 @@ public class ChusanServletController {
this.cmUpsertUserGachaHandler = cmUpsertUserGachaHandler;
this.cmUpsertUserPrintSubtractHandler = cmUpsertUserPrintSubtractHandler;
this.cmUpsertUserPrintCancelHandler = cmUpsertUserPrintCancelHandler;
this.getUserCtoCPlayHandler = getUserCtoCPlayHandler;
this.beginMatchingHandler = beginMatchingHandler;
this.endMatchingHandler = endMatchingHandler;
this.getMatchingStateHandler = getMatchingStateHandler;
this.removeMatchingMemberHandler = removeMatchingMemberHandler;
}
@PostMapping("GameLoginApi")
@PostMapping({"GameLoginApi", "GameLoginApiC3Exp"})
String gameLogin(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return gameLoginHandler.handle(request);
}
@PostMapping("GameLogoutApi")
@PostMapping({"GameLogoutApi", "GameLogoutApiC3Exp"})
String gameLogout(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return gameLogoutHandler.handle(request);
}
@PostMapping("GetGameChargeApi")
@PostMapping({"GetGameChargeApi", "GetGameChargeApiC3Exp"})
String getGameCharge(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getGameChargeHandler.handle(request);
}
@PostMapping("GetGameEventApi")
@PostMapping({"GetGameEventApi", "GetGameEventApiC3Exp"})
String getGameEvent(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getGameEventHandler.handle(request);
}
@PostMapping("GetGameIdlistApi")
@PostMapping({"GetGameIdlistApi", "GetGameIdlistApiC3Exp"})
String getGameIdList(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getGameIdlistHandler.handle(request);
}
@PostMapping("GetGameRankingApi")
@PostMapping({"GetGameRankingApi", "GetGameRankingApiC3Exp"})
String getGameRanking(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getGameRankingHandler.handle(request);
}
@PostMapping("GetGameSettingApi")
@PostMapping({"GetGameSettingApi", "GetGameSettingApiC3Exp"})
String getGameSetting(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getGameSettingHandler.handle(request);
}
@PostMapping("GetTeamCourseRuleApi")
@PostMapping({"GetTeamCourseRuleApi", "GetTeamCourseRuleApiC3Exp"})
String getTeamCourseRule(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getTeamCourseRuleHandler.handle(request);
}
@PostMapping("GetTeamCourseSettingApi")
@PostMapping({"GetTeamCourseSettingApi", "GetTeamCourseSettingApiC3Exp"})
String getTeamCourseSetting(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getTeamCourseSettingHandler.handle(request);
}
@PostMapping("GetUserActivityApi")
@PostMapping({"GetUserActivityApi", "GetUserActivityApiC3Exp"})
String getUserActivity(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserActivityHandler.handle(request);
}
@PostMapping("GetUserCharacterApi")
@PostMapping({"GetUserCharacterApi", "GetUserCharacterApiC3Exp"})
String getUserCharacter(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserCharacterHandler.handle(request);
}
@PostMapping("GetUserChargeApi")
@PostMapping({"GetUserChargeApi", "GetUserChargeApiC3Exp"})
String getUserCharge(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserChargeHandler.handle(request);
}
@PostMapping("GetUserCourseApi")
@PostMapping({"GetUserCourseApi", "GetUserCourseApiC3Exp"})
String getUserCourse(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserCourseHandler.handle(request);
}
@PostMapping("GetUserDataApi")
@PostMapping({"GetUserDataApi", "GetUserDataApiC3Exp"})
String getUserData(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserDataHandler.handle(request);
}
@PostMapping("GetUserDuelApi")
@PostMapping({"GetUserDuelApi", "GetUserDuelApiC3Exp"})
String getUserDuel(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserDuelHandler.handle(request);
}
@PostMapping("GetUserFavoriteItemApi")
@PostMapping({"GetUserFavoriteItemApi", "GetUserFavoriteItemApiC3Exp"})
String getUserFavoriteItem(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserFavoriteItemHandler.handle(request);
}
@PostMapping("GetUserItemApi")
@PostMapping({"GetUserItemApi", "GetUserItemApiC3Exp"})
String getUserItem(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserItemHandler.handle(request);
}
@PostMapping("GetUserLoginBonusApi")
@PostMapping({"GetUserLoginBonusApi", "GetUserLoginBonusApiC3Exp"})
String getUserLoginBonus(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserLoginBonusHandler.handle(request);
}
@PostMapping("GetUserMapAreaApi")
@PostMapping({"GetUserMapAreaApi", "GetUserMapAreaApiC3Exp"})
String getUserMap(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserMapAreaHandler.handle(request);
}
@PostMapping("GetUserMusicApi")
String getUserMusic(@ModelAttribute Map<String, Object> request, @PathVariable String version) throws JsonProcessingException {
request.put("version", version);
@PostMapping({"GetUserMusicApi", "GetUserMusicApiC3Exp"})
String getUserMusic(@ModelAttribute Map<String, Object> request, @PathVariable String ROM_VERSION) throws JsonProcessingException {
request.put("ROM_VERSION", ROM_VERSION);
return getUserMusicHandler.handle(request);
}
@PostMapping("GetUserOptionApi")
@PostMapping({"GetUserOptionApi", "GetUserOptionApiC3Exp"})
String getUserOption(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserOptionHandler.handle(request);
}
// Call when login. Return null if no profile exist
@PostMapping("GetUserPreviewApi")
@PostMapping({"GetUserPreviewApi", "GetUserPreviewApiC3Exp"})
String getUserPreview(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserPreviewHandler.handle(request);
}
@PostMapping("GetUserRecentRatingApi")
@PostMapping({"GetUserRecentRatingApi", "GetUserRecentRatingApiC3Exp"})
String getUserRecentRating(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserRecentRatingHandler.handle(request);
}
@PostMapping("GetUserRegionApi")
@PostMapping({"GetUserRegionApi", "GetUserRegionApiC3Exp"})
String getUserRegion(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserRegionHandler.handle(request);
}
@PostMapping("GetUserRivalDataApi")
@PostMapping({"GetUserRivalDataApi", "GetUserRivalDataApiC3Exp"})
String getUserRivalData(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserRivalDataHandler.handle(request);
}
@PostMapping("GetUserRivalMusicApi")
@PostMapping({"GetUserRivalMusicApi", "GetUserRivalMusicApiC3EXP"})
String getUserRivalMusic(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserRivalMusicHandler.handle(request);
}
@PostMapping("GetUserTeamApi")
@PostMapping({"GetUserTeamApi", "GetUserTeamApiC3Exp"})
String getUserTeam(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserTeamHandler.handle(request);
}
@PostMapping("GetUserSymbolChatSettingApi")
@PostMapping({"GetUserSymbolChatSettingApi", "GetUserSymbolChatSettingApiC3Exp"})
String getUserSymbolChatSetting(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserSymbolChatSettingHandler.handle(request);
}
@PostMapping("GetUserNetBattleDataApi")
@PostMapping({"GetUserNetBattleDataApi", "GetUserNetBattleDataApiC3Exp"})
String getUserNetBattleData(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserNetBattleDataHandler.handle(request);
}
@PostMapping("UpsertClientBookkeepingApi")
@PostMapping({"UpsertClientBookkeepingApi", "UpsertClientBookkeepingApiC3Exp"})
String upsertClientBookkeeping(@ModelAttribute Map<String, Object> request) {
return "{\"returnCode\":\"1\"}";
}
@PostMapping("UpsertClientDevelopApi")
@PostMapping({"UpsertClientDevelopApi", "UpsertClientDevelopApiC3Exp"})
String upsertClientDevelop(@ModelAttribute Map<String, Object> request) {
return "{\"returnCode\":\"1\"}";
}
@PostMapping("UpsertClientErrorApi")
@PostMapping({"UpsertClientErrorApi", "UpsertClientErrorApiC3Exp"})
String upsertClientError(@ModelAttribute Map<String, Object> request) {
return "{\"returnCode\":\"1\"}";
}
@PostMapping("UpsertClientSettingApi")
@PostMapping({"UpsertClientSettingApi", "UpsertClientSettingApiC3Exp"})
String upsertClientSetting(@ModelAttribute Map<String, Object> request) {
return "{\"returnCode\":\"1\"}";
}
@PostMapping("UpsertClientTestmodeApi")
@PostMapping({"UpsertClientTestmodeApi", "UpsertClientTestmodeApiC3Exp"})
String upsertClientTestmode(@ModelAttribute Map<String, Object> request) {
return "{\"returnCode\":\"1\"}";
}
@PostMapping("UpsertUserAllApi")
@PostMapping({"UpsertUserAllApi", "UpsertUserAllApiC3Exp"})
String upsertUserAll(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return upsertUserAllHandler.handle(request);
}
@PostMapping("UpsertUserChargelogApi")
@PostMapping({"UpsertUserChargelogApi", "UpsertUserChargelogApiC3Exp"})
String upsertUserChargelog(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return upsertUserChargelogHandler.handle(request);
}
@PostMapping("CreateTokenApi")
@PostMapping({"CreateTokenApi", "CreateTokenApiC3Exp"})
String createToken(@ModelAttribute Map<String, Object> request) {
return "{\"returnCode\":\"1\"}";
}
@PostMapping("RemoveTokenApi")
@PostMapping({"RemoveTokenApi", "RemoveTokenApiC3Exp"})
String removeToken(@ModelAttribute Map<String, Object> request) {
return "{\"returnCode\":\"1\"}";
}
@PostMapping("UpsertClientUploadApi")
@PostMapping({"UpsertClientUploadApi", "UpsertClientUploadApiC3Exp"})
String upsertClientUpload(@ModelAttribute Map<String, Object> request) {
return "{\"returnCode\":\"1\"}";
}
// Matching endpoints
@PostMapping({"GetUserCMissionApi"})
String getUserCMission(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserCMissionHandler.handle(request);
}
@PostMapping("MatchingServer/Ping")
@PostMapping({"GetGameMapAreaConditionApi"})
String getUserGameMapAreaCondition(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getGameMapAreaConditionHandler.handle(request);
}
@PostMapping({"GetUserNetBattleRankingInfoApi"})
String getUserNetBattleRankingInfo(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserNetBattleRankingInfoHandler.handle(request);
}
//Matching endpoints
@PostMapping({"MatchingServer/Ping", "Ping"})
String ping(@ModelAttribute Map<String, Object> request) {
return "{\"returnCode\":\"1\"}";
}

View File

@ -0,0 +1,15 @@
package icu.samnyan.aqua.sega.chusan.dao.userdata;
import icu.samnyan.aqua.sega.chusan.model.userdata.UserCMissionProgress;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
@Repository("ChusanUserCMissionProgressRepository")
public interface UserCMissionProgressRepository extends JpaRepository<UserCMissionProgress, Long> {
List<UserCMissionProgress> findByUser_Card_ExtIdAndMissionId(Long extId, int missionId);
Optional<UserCMissionProgress> findByUser_Card_ExtIdAndMissionIdAndOrder(Long extId, int missionId, int order);
}

View File

@ -0,0 +1,12 @@
package icu.samnyan.aqua.sega.chusan.dao.userdata;
import icu.samnyan.aqua.sega.chusan.model.userdata.UserCMission;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository("ChusanUserCMissionRepository")
public interface UserCMissionRepository extends JpaRepository<UserCMission, Long> {
Optional<UserCMission> findByUser_Card_ExtIdAndMissionId(Long extId, int missionId);
}

View File

@ -0,0 +1,36 @@
package icu.samnyan.aqua.sega.chusan.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.chusan.handler.BaseHandler;
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.LinkedHashMap;
import java.util.Map;
@Component("ChusanGetGameMapAreaConditionHandler")
public class GetGameMapAreaConditionHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetGameMapAreaConditionHandler.class);
private final StringMapper mapper;
@Autowired
public GetGameMapAreaConditionHandler(StringMapper mapper) {
this.mapper = mapper;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
logger.info("MapAreaCondition Dummy Handler");
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("mapAreaConditionList", new LinkedHashMap<>());
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,63 @@
package icu.samnyan.aqua.sega.chusan.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.chusan.dao.userdata.UserCMissionProgressRepository;
import icu.samnyan.aqua.sega.chusan.dao.userdata.UserCMissionRepository;
import icu.samnyan.aqua.sega.chusan.handler.BaseHandler;
import icu.samnyan.aqua.sega.chusan.model.response.data.UserCMissionProgressResp;
import icu.samnyan.aqua.sega.chusan.model.response.data.UserCMissionResp;
import icu.samnyan.aqua.sega.chusan.model.userdata.UserCMission;
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@Component("ChusanGetUserCMissionHandler")
public class GetUserCMissionHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserCMissionHandler.class);
private final StringMapper mapper;
private final UserCMissionProgressRepository userCMissionProgressRepository;
private final UserCMissionRepository userCMissionRepository;
@Autowired
public GetUserCMissionHandler(StringMapper mapper, UserCMissionProgressRepository userCMissionProgressRepository, UserCMissionRepository userCMissionRepository) {
this.mapper = mapper;
this.userCMissionProgressRepository = userCMissionProgressRepository;
this.userCMissionRepository = userCMissionRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
long userId = Long.parseLong((String) request.get("userId"));
int missionId = Integer.parseInt((String) request.get("missionId"));
UserCMissionResp userCMissionResp = new UserCMissionResp();
userCMissionResp.setUserId(userId);
userCMissionResp.setMissionId(missionId);
Optional<UserCMission> userCMissionOptional = userCMissionRepository.findByUser_Card_ExtIdAndMissionId(userId, missionId);
if (userCMissionOptional.isPresent()) {
userCMissionResp.setPoint(userCMissionOptional.get().getPoint());
List<UserCMissionProgressResp> userCMissionProgressRespList = userCMissionProgressRepository.findByUser_Card_ExtIdAndMissionId(userId, missionId).stream()
.map(userCMissionProgress -> {
UserCMissionProgressResp userCMissionProgressResp = new UserCMissionProgressResp();
userCMissionProgressResp.setOrder(userCMissionProgress.getOrder());
userCMissionProgressResp.setProgress(userCMissionProgress.getProgress());
userCMissionProgressResp.setStage(userCMissionProgress.getStage());
return userCMissionProgressResp;
}).toList();
userCMissionResp.setUserCMissionProgressList(userCMissionProgressRespList);
}
String json = mapper.write(userCMissionResp);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,38 @@
package icu.samnyan.aqua.sega.chusan.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.chusan.handler.BaseHandler;
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.LinkedHashMap;
import java.util.Map;
@Component("ChusanGetUserNetBattleRankingInfoHandler")
public class GetUserNetBattleRankingInfoHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserNetBattleRankingInfoHandler.class);
private final StringMapper mapper;
@Autowired
public GetUserNetBattleRankingInfoHandler(StringMapper mapper) {
this.mapper = mapper;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
logger.info("UserNetBattleRankingInfo Dummy Handler");
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", request.get("userId"));
resultMap.put("length", 0);
resultMap.put("userNetBattleRankingInfoList", new LinkedHashMap<>());
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -1,6 +1,8 @@
package icu.samnyan.aqua.sega.chusan.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.chusan.dao.userdata.UserCMissionProgressRepository;
import icu.samnyan.aqua.sega.chusan.dao.userdata.UserCMissionRepository;
import icu.samnyan.aqua.sega.chusan.handler.BaseHandler;
import icu.samnyan.aqua.sega.chusan.model.request.UpsertUserAll;
import icu.samnyan.aqua.sega.chusan.model.response.CodeResp;
@ -46,6 +48,8 @@ public class UpsertUserAllHandler implements BaseHandler {
private final UserDuelService userDuelService;
private final UserGeneralDataService userGeneralDataService;
private final UserLoginBonusService userLoginBonusService;
private final UserCMissionRepository userCMissionRepository;
private final UserCMissionProgressRepository userCMissionProgressRepository;
@Autowired
public UpsertUserAllHandler(StringMapper mapper,
@ -62,7 +66,8 @@ public class UpsertUserAllHandler implements BaseHandler {
UserCourseService userCourseService,
UserDuelService userDuelService,
UserGeneralDataService userGeneralDataService,
UserLoginBonusService userLoginBonusService) {
UserLoginBonusService userLoginBonusService,
UserCMissionRepository userCMissionRepository, UserCMissionProgressRepository userCMissionProgressRepository) {
this.mapper = mapper;
this.cardService = cardService;
this.userDataService = userDataService;
@ -78,6 +83,8 @@ public class UpsertUserAllHandler implements BaseHandler {
this.userDuelService = userDuelService;
this.userGeneralDataService = userGeneralDataService;
this.userLoginBonusService = userLoginBonusService;
this.userCMissionRepository = userCMissionRepository;
this.userCMissionProgressRepository = userCMissionProgressRepository;
}
@ -336,6 +343,45 @@ public class UpsertUserAllHandler implements BaseHandler {
userLoginBonusService.saveAll(newUserLoginBonusMap.values());
}
// userCMissionList
if (upsertUserAll.getUserCMissionList() != null){
List<Map<String, Object>> userCMissionList = upsertUserAll.getUserCMissionList();
userCMissionList.forEach(userCMission -> {
int missionId = Integer.parseInt((String) userCMission.get("missionId"));
int point = Integer.parseInt((String) userCMission.get("point"));
List<Map<String, Object>> userCMissionProgressList = (List<Map<String, Object>>) userCMission.get("userCMissionProgressList");
userCMissionRepository.findByUser_Card_ExtIdAndMissionId(Long.parseLong(userId), missionId).ifPresentOrElse(userCMission1 -> {
userCMission1.setPoint(point);
userCMissionRepository.save(userCMission1);
}, () -> {
UserCMission userCMission1 = new UserCMission();
userCMission1.setMissionId(missionId);
userCMission1.setPoint(point);
userCMission1.setUser(userData);
userCMissionRepository.save(userCMission1);
});
userCMissionProgressList.forEach(userCMissionProgress -> {
int order = Integer.parseInt((String) userCMissionProgress.get("order"));
int progress = Integer.parseInt((String) userCMissionProgress.get("progress"));
int stage = Integer.parseInt((String) userCMissionProgress.get("stage"));
userCMissionProgressRepository.findByUser_Card_ExtIdAndMissionIdAndOrder(Long.parseLong(userId), missionId, order).ifPresentOrElse(userCMissionProgress1 -> {
userCMissionProgress1.setProgress(progress);
userCMissionProgress1.setStage(stage);
userCMissionProgressRepository.save(userCMissionProgress1);
}, () -> {
UserCMissionProgress userCMissionProgress1 = new UserCMissionProgress();
userCMissionProgress1.setMissionId(missionId);
userCMissionProgress1.setOrder(order);
userCMissionProgress1.setProgress(progress);
userCMissionProgress1.setStage(stage);
userCMissionProgress1.setUser(userData);
userCMissionProgressRepository.save(userCMissionProgress1);
});
});
});
}
String json = mapper.write(new CodeResp(1));
logger.info("Response: " + json);
return json;

View File

@ -83,6 +83,9 @@ public class UpsertUserAll implements Serializable {
@Nullable
private List<Map<String, Object>> userNetBattleData;
@Nullable
private List<Map<String, Object>> userCMissionList;
@Nullable
@JsonProperty("isNewCharacterList")
private String isNewCharacterList;
@ -107,4 +110,8 @@ public class UpsertUserAll implements Serializable {
@JsonProperty("isNewMapAreaList")
private String isNewMapAreaList;
@Nullable
@JsonProperty("isNewCMissionList")
private String isNewCMissionList;
}

View File

@ -0,0 +1,16 @@
package icu.samnyan.aqua.sega.chusan.model.response.data;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserCMissionProgressResp implements Serializable {
private int order;
private int stage;
private int progress;
}

View File

@ -0,0 +1,19 @@
package icu.samnyan.aqua.sega.chusan.model.response.data;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserCMissionResp implements Serializable {
private long userId;
private int missionId;
private int point;
private List<UserCMissionProgressResp> userCMissionProgressList;
}

View File

@ -0,0 +1,30 @@
package icu.samnyan.aqua.sega.chusan.model.userdata;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity(name = "ChusanUserCMission")
@Table(name = "chusan_user_cmission")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserCMission {
@Id
@JsonIgnore
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@JsonIgnore
@ManyToOne
@JoinColumn(name = "user_id")
private UserData user;
@Column(name = "mission_id")
private int missionId;
@Column(name = "point")
private int point;
}

View File

@ -0,0 +1,34 @@
package icu.samnyan.aqua.sega.chusan.model.userdata;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity(name = "ChusanUserCMissionProgress")
@Table(name = "chusan_user_cmission_progress", uniqueConstraints = {@UniqueConstraint(columnNames = {"user_id", "mission_id", "order"})})
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserCMissionProgress {
@Id
@JsonIgnore
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@JsonIgnore
@ManyToOne
@JoinColumn(name = "user_id")
private UserData user;
@Column(name = "mission_id")
private int missionId;
@Column(name = "`order`")
private int order;
private int stage;
private int progress;
}

View File

@ -0,0 +1,28 @@
CREATE TABLE chusan_user_cmission
(
id BIGINT AUTO_INCREMENT NOT NULL,
user_id BIGINT NULL,
mission_id INT NULL,
point INT NULL,
CONSTRAINT pk_chusan_user_cmission PRIMARY KEY (id)
);
ALTER TABLE chusan_user_cmission
ADD CONSTRAINT FK_CHUSAN_USER_CMISSION_ON_USER FOREIGN KEY (user_id) REFERENCES chusan_user_data (id);
CREATE TABLE chusan_user_cmission_progress
(
id BIGINT AUTO_INCREMENT NOT NULL,
user_id BIGINT NULL,
mission_id INT NULL,
`order` INT NOT NULL,
stage INT NULL,
progress INT NULL,
CONSTRAINT pk_chusan_user_cmission_progress PRIMARY KEY (id)
);
ALTER TABLE chusan_user_cmission_progress
ADD CONSTRAINT uc_6ab791e9e8fee2b3fab35d3d2 UNIQUE (user_id, mission_id, `order`);
ALTER TABLE chusan_user_cmission_progress
ADD CONSTRAINT FK_CHUSAN_USER_CMISSION_PROGRESS_ON_USER FOREIGN KEY (user_id) REFERENCES chusan_user_data (id);

View File

@ -0,0 +1,28 @@
CREATE TABLE chusan_user_cmission
(
id BIGINT AUTO_INCREMENT NOT NULL,
user_id BIGINT NULL,
mission_id INT NULL,
point INT NULL,
CONSTRAINT pk_chusan_user_cmission PRIMARY KEY (id)
);
ALTER TABLE chusan_user_cmission
ADD CONSTRAINT FK_CHUSAN_USER_CMISSION_ON_USER FOREIGN KEY (user_id) REFERENCES chusan_user_data (id);
CREATE TABLE chusan_user_cmission_progress
(
id BIGINT AUTO_INCREMENT NOT NULL,
user_id BIGINT NULL,
mission_id INT NULL,
`order` INT NOT NULL,
stage INT NULL,
progress INT NULL,
CONSTRAINT pk_chusan_user_cmission_progress PRIMARY KEY (id)
);
ALTER TABLE chusan_user_cmission_progress
ADD CONSTRAINT uc_6ab791e9e8fee2b3fab35d3d2 UNIQUE (user_id, mission_id, `order`);
ALTER TABLE chusan_user_cmission_progress
ADD CONSTRAINT FK_CHUSAN_USER_CMISSION_PROGRESS_ON_USER FOREIGN KEY (user_id) REFERENCES chusan_user_data (id);

View File

@ -0,0 +1,20 @@
CREATE TABLE chusan_user_cmission
(
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
user_id INTEGER,
mission_id INTEGER,
point INTEGER,
FOREIGN KEY(user_id) REFERENCES chusan_user_data(id)
);
CREATE TABLE chusan_user_cmission_progress
(
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
user_id INTEGER,
mission_id INTEGER,
`order` INTEGER NOT NULL,
stage INTEGER,
progress INTEGER,
UNIQUE(user_id, mission_id, `order`),
FOREIGN KEY(user_id) REFERENCES chusan_user_data(id)
);