diff --git a/src/main/java/com/finfellows/domain/policyinfo/application/PolicyInfoServiceImpl.java b/src/main/java/com/finfellows/domain/policyinfo/application/PolicyInfoServiceImpl.java index ab7d606..99da840 100644 --- a/src/main/java/com/finfellows/domain/policyinfo/application/PolicyInfoServiceImpl.java +++ b/src/main/java/com/finfellows/domain/policyinfo/application/PolicyInfoServiceImpl.java @@ -32,7 +32,10 @@ public Page findPolicyInfos(UserPrincipal userPrincipal, St @Override public PolicyInfoDetailRes findPolicyDetail(UserPrincipal userPrincipal, Long policyId) { - return policyInfoRepository.findPolicyDetail(policyId, userPrincipal.getId()); + if(userPrincipal != null){ + return policyInfoRepository.findPolicyDetailWithAuthorization(policyId, userPrincipal.getId()); + } + return policyInfoRepository.findPolicyDetail(policyId); } @Override diff --git a/src/main/java/com/finfellows/domain/policyinfo/domain/repository/PolicyInfoQueryDslRepository.java b/src/main/java/com/finfellows/domain/policyinfo/domain/repository/PolicyInfoQueryDslRepository.java index f1c9d0a..f1061af 100644 --- a/src/main/java/com/finfellows/domain/policyinfo/domain/repository/PolicyInfoQueryDslRepository.java +++ b/src/main/java/com/finfellows/domain/policyinfo/domain/repository/PolicyInfoQueryDslRepository.java @@ -9,6 +9,7 @@ public interface PolicyInfoQueryDslRepository { Page findPolicyInfos(String searchKeyword, Pageable pageable); Page findPolicyInfosWithAuthorization(String searchKeyword, Pageable pageable, Long userId); - PolicyInfoDetailRes findPolicyDetail(Long policyId, Long userId); + PolicyInfoDetailRes findPolicyDetailWithAuthorization(Long policyId, Long userId); + PolicyInfoDetailRes findPolicyDetail(Long policyId); } diff --git a/src/main/java/com/finfellows/domain/policyinfo/domain/repository/PolicyInfoQueryDslRepositoryImpl.java b/src/main/java/com/finfellows/domain/policyinfo/domain/repository/PolicyInfoQueryDslRepositoryImpl.java index e5208f2..42462d3 100644 --- a/src/main/java/com/finfellows/domain/policyinfo/domain/repository/PolicyInfoQueryDslRepositoryImpl.java +++ b/src/main/java/com/finfellows/domain/policyinfo/domain/repository/PolicyInfoQueryDslRepositoryImpl.java @@ -87,7 +87,7 @@ public Page findPolicyInfos(String searchKeyword, Pageable } @Override - public PolicyInfoDetailRes findPolicyDetail(Long policyId, Long userId) { + public PolicyInfoDetailRes findPolicyDetailWithAuthorization(Long policyId, Long userId) { QPolicyInfoBookmark policyInfoBookmark = QPolicyInfoBookmark.policyInfoBookmark; List result = queryFactory @@ -122,6 +122,39 @@ public PolicyInfoDetailRes findPolicyDetail(Long policyId, Long userId) { return result.get(0); } + @Override + public PolicyInfoDetailRes findPolicyDetail(Long policyId) { + List result = queryFactory + .select(new QPolicyInfoDetailRes( + Expressions.constant(false), + policyInfo.polyBizSjNm, + policyInfo.polyItcnCn, + policyInfo.sporCn, + policyInfo.bizPrdCn, + policyInfo.rqutPrdCn, + policyInfo.sporScvl, + policyInfo.ageInfo, + policyInfo.prcpCn, + policyInfo.accrRqisCn, + policyInfo.majrRqisCn, + policyInfo.empmSttsCn, + policyInfo.splzRlmRqisCn, + policyInfo.aditRscn, + policyInfo.prcpLmttTrgtCn, + policyInfo.rqutProcCn, + policyInfo.jdgnPresCn, + policyInfo.rqutUrla, + policyInfo.pstnPaprCn + )) + .from(policyInfo) + .where( + policyInfo.id.eq(policyId) + ) + .fetch(); + + return result.get(0); + } + private BooleanExpression searchEq(String searchKeyword) { return searchKeyword != null ? policyInfo.polyBizSjNm.contains(searchKeyword).or(policyInfo.polyItcnCn.contains(searchKeyword)) : null; }