Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] redirect 시, code값 null 나오는 문제 수정중 1 #131

Merged
merged 16 commits into from
Aug 16, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -20,6 +21,7 @@

import java.net.URI;

@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/fcfs")
Expand Down Expand Up @@ -54,6 +56,8 @@ public ResponseEntity<Void> handleFcfs(@Parameter(hidden = true) HttpServletRequ

String fcfsCode = fcfsService.handleFcfsEvent(userId, round, fcfsRequestDto);

log.info("fcfsCode in handleFcfs : {}", fcfsCode);

HttpHeaders headers = new HttpHeaders();
String redirectUrl = "/fcfs/result";

Expand All @@ -74,6 +78,7 @@ public ResponseDto<FcfsResultResponseDto> getFcfsResult(@Parameter(hidden = true
@RequestParam("fcfsWin") Boolean fcfsWin){

String fcfsCode = (String) request.getSession().getAttribute("fcfsCode");
log.info("fcfsCode in getFcfsResult : {}", fcfsCode);
request.getSession().removeAttribute("fcfsCode");

FcfsResultResponseDto fcfsResultResponseDto = fcfsService.getFcfsResult(fcfsWin, fcfsCode);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.softeer.backend.fo_domain.fcfs.dto.result;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
Expand All @@ -8,6 +9,7 @@
@Getter
public class FcfsResultResponseDto {

@JsonProperty("isFcfsWinner")
private boolean isFcfsWinner;

private FcfsResult fcfsResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ private String saveFcfsWinners(int userId, int round) {

long numOfWinners = fcfsRedisUtil.getIntegerSetSize(RedisKeyPrefix.FCFS_LOCK_PREFIX.getPrefix() + round);

if (numOfWinners < fcfsSettingManager.getFcfsWinnerNum()
&& !fcfsRedisUtil.isValueInIntegerSet(RedisKeyPrefix.FCFS_LOCK_PREFIX.getPrefix() + round, userId)) {


// redis에 userId 등록
fcfsRedisUtil.addToIntegerSet(RedisKeyPrefix.FCFS_LOCK_PREFIX.getPrefix() + round, userId);
Expand All @@ -106,9 +105,8 @@ private String saveFcfsWinners(int userId, int round) {
}

return code;
}

return null;

}

private String makeFcfsCode(int round){
Expand Down
Loading