[general] Fix all type mismatch with db

This commit is contained in:
samnyan
2020-12-25 14:15:04 +08:00
parent 6152e8ef0a
commit ff5eab48c7
78 changed files with 165 additions and 190 deletions

View File

@@ -1,6 +1,5 @@
package icu.samnyan.aqua.sega.diva.handler.ingame;
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerProfileRepository;
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerPvCustomizeRepository;
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerPvRecordRepository;
import icu.samnyan.aqua.sega.diva.handler.BaseHandler;
@@ -11,6 +10,7 @@ import icu.samnyan.aqua.sega.diva.model.response.ingame.GetPvPdResponse;
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile;
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerPvCustomize;
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerPvRecord;
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService;
import icu.samnyan.aqua.sega.diva.util.DivaDateTimeUtil;
import icu.samnyan.aqua.sega.diva.util.DivaMapper;
import icu.samnyan.aqua.sega.util.URIEncoder;
@@ -31,18 +31,18 @@ public class GetPvPdHandler extends BaseHandler {
private final PlayerPvRecordRepository pvRecordRepository;
private final PlayerPvCustomizeRepository pvCustomizeRepository;
private final PlayerProfileRepository profileRepository;
private final PlayerProfileService playerProfileService;
public GetPvPdHandler(DivaMapper mapper, PlayerPvRecordRepository pvRecordRepository, PlayerPvCustomizeRepository pvCustomizeRepository, PlayerProfileRepository profileRepository) {
public GetPvPdHandler(DivaMapper mapper, PlayerPvRecordRepository pvRecordRepository, PlayerPvCustomizeRepository pvCustomizeRepository, PlayerProfileService playerProfileService) {
super(mapper);
this.pvRecordRepository = pvRecordRepository;
this.pvCustomizeRepository = pvCustomizeRepository;
this.profileRepository = profileRepository;
this.playerProfileService = playerProfileService;
}
public String handle(GetPvPdRequest request) {
Optional<PlayerProfile> profileO = profileRepository.findByPdId(request.getPd_id());
Optional<PlayerProfile> profileO = playerProfileService.findByPdId(request.getPd_id());
StringBuilder pd = new StringBuilder();
for (int pvId :

View File

@@ -1,6 +1,5 @@
package icu.samnyan.aqua.sega.diva.handler.ingame;
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerProfileRepository;
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerPvCustomizeRepository;
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException;
import icu.samnyan.aqua.sega.diva.handler.BaseHandler;
@@ -9,6 +8,7 @@ import icu.samnyan.aqua.sega.diva.model.request.ingame.ShopExitRequest;
import icu.samnyan.aqua.sega.diva.model.response.ingame.ShopExitResponse;
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile;
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerPvCustomize;
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService;
import icu.samnyan.aqua.sega.diva.util.DivaMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -24,19 +24,19 @@ public class ShopExitHandler extends BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(ShopExitHandler.class);
private final PlayerProfileRepository playerProfileRepository;
private final PlayerProfileService playerProfileService;
private final PlayerPvCustomizeRepository pvCustomizeRepository;
public ShopExitHandler(DivaMapper mapper, PlayerProfileRepository playerProfileRepository, PlayerPvCustomizeRepository pvCustomizeRepository) {
public ShopExitHandler(DivaMapper mapper, PlayerProfileService playerProfileService, PlayerPvCustomizeRepository pvCustomizeRepository) {
super(mapper);
this.playerProfileRepository = playerProfileRepository;
this.playerProfileService = playerProfileService;
this.pvCustomizeRepository = pvCustomizeRepository;
}
public String handle(ShopExitRequest request) {
PlayerProfile profile = playerProfileRepository.findByPdId(request.getPd_id()).orElseThrow(ProfileNotFoundException::new);
PlayerProfile profile = playerProfileService.findByPdId(request.getPd_id()).orElseThrow(ProfileNotFoundException::new);
PlayerPvCustomize customize = pvCustomizeRepository.findByPdIdAndPvId(profile, request.getPly_pv_id()).orElseGet(() -> new PlayerPvCustomize(profile, request.getPly_pv_id()));
if (request.getUse_pv_mdl_eqp() == 1) {
@@ -53,7 +53,7 @@ public class ShopExitHandler extends BaseHandler {
profile.setCommonCustomizeItems(arrToCsv(request.getC_itm_eqp_cmn_ary()));
profile.setModuleSelectItemFlag(arrToCsv(request.getMs_itm_flg_cmn_ary()));
playerProfileRepository.save(profile);
playerProfileService.save(profile);
pvCustomizeRepository.save(customize);
ShopExitResponse response = new ShopExitResponse(
request.getCmd(),

View File

@@ -10,6 +10,7 @@ import icu.samnyan.aqua.sega.diva.model.gamedata.Contest;
import icu.samnyan.aqua.sega.diva.model.request.ingame.StageResultRequest;
import icu.samnyan.aqua.sega.diva.model.response.ingame.StageResultResponse;
import icu.samnyan.aqua.sega.diva.model.userdata.*;
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService;
import icu.samnyan.aqua.sega.diva.util.DivaCalculator;
import icu.samnyan.aqua.sega.diva.util.DivaMapper;
import org.apache.commons.lang3.StringUtils;
@@ -32,7 +33,7 @@ public class StageResultHandler extends BaseHandler {
private final GameSessionRepository gameSessionRepository;
private final PlayerPvRecordRepository pvRecordRepository;
private final PlayerProfileRepository profileRepository;
private final PlayerProfileService playerProfileService;
private final PlayLogRepository playLogRepository;
private final ContestRepository contestRepository;
private final PlayerContestRepository playerContestRepository;
@@ -43,11 +44,11 @@ public class StageResultHandler extends BaseHandler {
private PlayerProfile currentProfile = null;
public StageResultHandler(DivaMapper mapper, GameSessionRepository gameSessionRepository, PlayerPvRecordRepository pvRecordRepository, PlayerProfileRepository profileRepository, PlayLogRepository playLogRepository, ContestRepository contestRepository, PlayerContestRepository playerContestRepository, PlayerCustomizeRepository playerCustomizeRepository, PlayerInventoryRepository playerInventoryRepository, DivaCalculator divaCalculator) {
public StageResultHandler(DivaMapper mapper, GameSessionRepository gameSessionRepository, PlayerPvRecordRepository pvRecordRepository, PlayerProfileService playerProfileService, PlayLogRepository playLogRepository, ContestRepository contestRepository, PlayerContestRepository playerContestRepository, PlayerCustomizeRepository playerCustomizeRepository, PlayerInventoryRepository playerInventoryRepository, DivaCalculator divaCalculator) {
super(mapper);
this.gameSessionRepository = gameSessionRepository;
this.pvRecordRepository = pvRecordRepository;
this.profileRepository = profileRepository;
this.playerProfileService = playerProfileService;
this.playLogRepository = playLogRepository;
this.contestRepository = contestRepository;
this.playerContestRepository = playerContestRepository;
@@ -59,7 +60,7 @@ public class StageResultHandler extends BaseHandler {
public String handle(StageResultRequest request) {
StageResultResponse response;
if (request.getPd_id() != -1) {
PlayerProfile profile = profileRepository.findByPdId(request.getPd_id()).orElseThrow(ProfileNotFoundException::new);
PlayerProfile profile = playerProfileService.findByPdId(request.getPd_id()).orElseThrow(ProfileNotFoundException::new);
GameSession session = gameSessionRepository.findByPdId(profile).orElseThrow(SessionNotFoundException::new);
currentProfile = profile;

View File

@@ -1,7 +1,6 @@
package icu.samnyan.aqua.sega.diva.handler.ingame;
import icu.samnyan.aqua.sega.diva.dao.userdata.GameSessionRepository;
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerProfileRepository;
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException;
import icu.samnyan.aqua.sega.diva.exception.SessionNotFoundException;
import icu.samnyan.aqua.sega.diva.handler.BaseHandler;
@@ -9,6 +8,7 @@ import icu.samnyan.aqua.sega.diva.model.request.ingame.StageStartRequest;
import icu.samnyan.aqua.sega.diva.model.response.BaseResponse;
import icu.samnyan.aqua.sega.diva.model.userdata.GameSession;
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile;
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService;
import icu.samnyan.aqua.sega.diva.util.DivaMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -23,17 +23,17 @@ public class StageStartHandler extends BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(StageResultHandler.class);
private final GameSessionRepository gameSessionRepository;
private final PlayerProfileRepository profileRepository;
private final PlayerProfileService playerProfileService;
public StageStartHandler(DivaMapper mapper, GameSessionRepository gameSessionRepository, PlayerProfileRepository profileRepository) {
public StageStartHandler(DivaMapper mapper, GameSessionRepository gameSessionRepository, PlayerProfileService playerProfileService) {
super(mapper);
this.gameSessionRepository = gameSessionRepository;
this.profileRepository = profileRepository;
this.playerProfileService = playerProfileService;
}
public String handle(StageStartRequest request) {
if (request.getPd_id() != -1) {
PlayerProfile profile = profileRepository.findByPdId(request.getPd_id()).orElseThrow(ProfileNotFoundException::new);
PlayerProfile profile = playerProfileService.findByPdId(request.getPd_id()).orElseThrow(ProfileNotFoundException::new);
GameSession session = gameSessionRepository.findByPdId(profile).orElseThrow(SessionNotFoundException::new);
int[] stageArr = request.getStg_ply_pv_id();

View File

@@ -1,6 +1,5 @@
package icu.samnyan.aqua.sega.diva.handler.ingame;
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerProfileRepository;
import icu.samnyan.aqua.sega.diva.dao.userdata.PlayerScreenShotRepository;
import icu.samnyan.aqua.sega.diva.exception.ProfileNotFoundException;
import icu.samnyan.aqua.sega.diva.handler.BaseHandler;
@@ -8,6 +7,7 @@ import icu.samnyan.aqua.sega.diva.model.request.ingame.StoreSsRequest;
import icu.samnyan.aqua.sega.diva.model.response.BaseResponse;
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerProfile;
import icu.samnyan.aqua.sega.diva.model.userdata.PlayerScreenShot;
import icu.samnyan.aqua.sega.diva.service.PlayerProfileService;
import icu.samnyan.aqua.sega.diva.util.DivaMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -31,19 +31,19 @@ public class StoreSsHandler extends BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(StoreSsHandler.class);
private final PlayerProfileRepository profileRepository;
private final PlayerProfileService playerProfileService;
private final PlayerScreenShotRepository screenShotRepository;
public StoreSsHandler(DivaMapper mapper, PlayerProfileRepository profileRepository, PlayerScreenShotRepository screenShotRepository) {
public StoreSsHandler(DivaMapper mapper, PlayerProfileService playerProfileService, PlayerScreenShotRepository screenShotRepository) {
super(mapper);
this.profileRepository = profileRepository;
this.playerProfileService = playerProfileService;
this.screenShotRepository = screenShotRepository;
}
public String handle(StoreSsRequest request, MultipartFile file) {
PlayerProfile profile = profileRepository.findByPdId(request.getPd_id()).orElseThrow(ProfileNotFoundException::new);
PlayerProfile profile = playerProfileService.findByPdId(request.getPd_id()).orElseThrow(ProfileNotFoundException::new);
BaseResponse response;
try {

View File

@@ -5,7 +5,9 @@ import icu.samnyan.aqua.sega.diva.model.common.ChallengeKind;
import icu.samnyan.aqua.sega.diva.model.common.ClearResult;
import icu.samnyan.aqua.sega.diva.model.common.Difficulty;
import icu.samnyan.aqua.sega.diva.model.common.Edition;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
@@ -17,6 +19,8 @@ import java.time.LocalDateTime;
@Entity(name = "DivaPlayLog")
@Table(name = "diva_play_log")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PlayLog implements Serializable {
private static final long serialVersionUID = 1L;
@@ -110,9 +114,6 @@ public class PlayLog implements Serializable {
private LocalDateTime dateTime;
public PlayLog() {
}
public PlayLog(PlayerProfile pdId, int pvId, Difficulty difficulty, Edition edition, int scriptVer, int score, ChallengeKind challengeKind, int challengeResult, ClearResult clearResult, int vp, int coolCount, int coolPercent, int fineCount, int finePercent, int safeCount, int safePercent, int sadCount, int sadPercent, int wrongCount, int wrongPercent, int maxCombo, int chanceTime, int holdScore, int attainPoint, int skinId, int buttonSe, int buttonSeVol, int sliderSe, int chainSlideSe, int sliderTouchSe, String modules, int stageCompletion, int slideScore, int isVocalChange, String customizeItems, String rhythmGameOptions, int screenShotCount, LocalDateTime dateTime) {
this.pdId = pdId;
this.pvId = pvId;