-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
129aa84
commit c01fff1
Showing
4 changed files
with
62 additions
and
16 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/main/java/com/t3t/frontserver/pointdetail/adaptor/UserPointDetailAdaptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.t3t.frontserver.pointdetail.adaptor; | ||
|
||
import com.t3t.frontserver.auth.util.SecurityContextUtils; | ||
import com.t3t.frontserver.common.exception.ApiDataFetchException; | ||
import com.t3t.frontserver.model.response.BaseResponse; | ||
import com.t3t.frontserver.pointdetail.client.UserPointDetailApiClient; | ||
import com.t3t.frontserver.pointdetail.model.response.PointDetailResponse; | ||
import feign.FeignException; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
@Slf4j | ||
@Component | ||
@RequiredArgsConstructor | ||
public class UserPointDetailAdaptor { | ||
private final UserPointDetailApiClient userPointDetailApiClient; | ||
|
||
public List<PointDetailResponse> getPointDetailByPointDetailType(Long memberId, String pointDetailType) { | ||
try { | ||
ResponseEntity<BaseResponse<List<PointDetailResponse>>> response = userPointDetailApiClient.getPointDetailByPointDetailType(memberId, pointDetailType); | ||
if (response.getStatusCode() == HttpStatus.OK) { | ||
return Objects.requireNonNull(response.getBody()).getData(); | ||
} | ||
return null; | ||
} catch (FeignException e) { | ||
log.error(e.getMessage()); | ||
throw new ApiDataFetchException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/com/t3t/frontserver/pointdetail/service/UserPointDetailService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.t3t.frontserver.pointdetail.service; | ||
|
||
import com.t3t.frontserver.auth.util.SecurityContextUtils; | ||
import com.t3t.frontserver.pointdetail.adaptor.UserPointDetailAdaptor; | ||
import com.t3t.frontserver.pointdetail.model.response.PointDetailResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class UserPointDetailService { | ||
private final UserPointDetailAdaptor userPointDetailAdaptor; | ||
|
||
public List<PointDetailResponse> getPointDetailByPointDetailType(Long memberId, String pointDetailType) { | ||
return userPointDetailAdaptor.getPointDetailByPointDetailType(memberId, pointDetailType); | ||
} | ||
} |