This repository has been archived by the owner on Oct 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from FinFellows/develop
[FEAT]: 정책 상세 정보 API 구현 (#60)
- Loading branch information
Showing
6 changed files
with
188 additions
and
24 deletions.
There are no files selected for viewing
15 changes: 8 additions & 7 deletions
15
src/main/java/com/finfellows/domain/policyinfo/application/PolicyInfoService.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 |
---|---|---|
@@ -1,13 +1,14 @@ | ||
package com.finfellows.domain.policyinfo.application; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
import com.finfellows.domain.policyinfo.dto.PolicyInfoDetailRes; | ||
import com.finfellows.domain.policyinfo.dto.SearchPolicyInfoRes; | ||
import com.finfellows.global.config.security.token.UserPrincipal; | ||
import com.finfellows.global.payload.PagedResponse; | ||
import org.springframework.data.domain.Pageable; | ||
|
||
@RequiredArgsConstructor | ||
@Service | ||
@Transactional(readOnly = true) | ||
public class PolicyInfoService { | ||
public interface PolicyInfoService { | ||
|
||
PagedResponse<SearchPolicyInfoRes> findPolicyInfos(UserPrincipal userPrincipal, String searchKeyword, Pageable pageable); | ||
PolicyInfoDetailRes findPolicyDetail(UserPrincipal userPrincipal, Long policyId); | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/com/finfellows/domain/policyinfo/application/PolicyInfoServiceImpl.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,33 @@ | ||
package com.finfellows.domain.policyinfo.application; | ||
|
||
import com.finfellows.domain.policyinfo.domain.repository.PolicyInfoRepository; | ||
import com.finfellows.domain.policyinfo.dto.PolicyInfoDetailRes; | ||
import com.finfellows.domain.policyinfo.dto.SearchPolicyInfoRes; | ||
import com.finfellows.global.config.security.token.UserPrincipal; | ||
import com.finfellows.global.payload.PagedResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@RequiredArgsConstructor | ||
@Service | ||
@Transactional(readOnly = true) | ||
public class PolicyInfoServiceImpl implements PolicyInfoService { | ||
|
||
private final PolicyInfoRepository policyInfoRepository; | ||
|
||
@Override | ||
public PagedResponse<SearchPolicyInfoRes> findPolicyInfos(UserPrincipal userPrincipal, String searchKeyword, Pageable pageable) { | ||
Page<SearchPolicyInfoRes> policyInfos = policyInfoRepository.findPolicyInfos(searchKeyword, pageable, userPrincipal.getId()); | ||
|
||
return new PagedResponse<>(policyInfos); | ||
} | ||
|
||
@Override | ||
public PolicyInfoDetailRes findPolicyDetail(UserPrincipal userPrincipal, Long policyId) { | ||
return policyInfoRepository.findPolicyDetail(policyId, userPrincipal.getId()); | ||
} | ||
|
||
} |
3 changes: 2 additions & 1 deletion
3
...java/com/finfellows/domain/policyinfo/domain/repository/PolicyInfoQueryDslRepository.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 |
---|---|---|
@@ -1,11 +1,12 @@ | ||
package com.finfellows.domain.policyinfo.domain.repository; | ||
|
||
import com.finfellows.domain.policyinfo.dto.PolicyInfoDetailRes; | ||
import com.finfellows.domain.policyinfo.dto.SearchPolicyInfoRes; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
|
||
public interface PolicyInfoQueryDslRepository { | ||
|
||
Page<SearchPolicyInfoRes> findPolicyInfos(String searchKeyword, Pageable pageable, Long userId); | ||
|
||
PolicyInfoDetailRes findPolicyDetail(Long policyId, Long userId); | ||
} |
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
72 changes: 72 additions & 0 deletions
72
src/main/java/com/finfellows/domain/policyinfo/dto/PolicyInfoDetailRes.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,72 @@ | ||
package com.finfellows.domain.policyinfo.dto; | ||
|
||
import com.querydsl.core.annotations.QueryProjection; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class PolicyInfoDetailRes { | ||
|
||
@Schema(description = "좋아요 여부") | ||
private Boolean isLiked; | ||
@Schema(description = "정책 이름") | ||
private String polyBizSjNm; | ||
@Schema(description = "정책 한 줄 소개") | ||
private String polyItcnCn; | ||
@Schema(description = "정책 내용") | ||
private String sporCn; | ||
@Schema(description = "운영 기간") | ||
private String bizPrdCn; | ||
@Schema(description = "신청 기간") | ||
private String rqutPrdCn; | ||
@Schema(description = "지원 규모") | ||
private String sporScvl; | ||
@Schema(description = "연령") | ||
private String ageInfo; | ||
@Schema(description = "거주지 및 소득") | ||
private String prcpCn; | ||
@Schema(description = "학력") | ||
private String accrRqisCn; | ||
@Schema(description = "전공") | ||
private String majrRquisCn; | ||
@Schema(description = "취업 상태") | ||
private String empmSttsCn; | ||
@Schema(description = "특화 분야") | ||
private String spizRlmRqisCn; | ||
@Schema(description = "추가 단서 사항") | ||
private String aditRscn; | ||
@Schema(description = "참여 제한 대상") | ||
private String prcpLmttTrgtCn; | ||
@Schema(description = "신청 절차") | ||
private String rqutProcCn; | ||
@Schema(description = "심사 및 발표") | ||
private String jdgnPresCn; | ||
@Schema(description = "신청 사이트") | ||
private String rqutUrla; | ||
@Schema(description = "제출 서류") | ||
private String pstnPaprCn; | ||
|
||
@QueryProjection | ||
public PolicyInfoDetailRes(Boolean isLiked, String polyBizSjNm, String polyItcnCn, String sporCn, String bizPrdCn, String rqutPrdCn, String sporScvl, String ageInfo, String prcpCn, String accrRqisCn, String majrRquisCn, String empmSttsCn, String spizRlmRqisCn, String aditRscn, String prcpLmttTrgtCn, String rqutProcCn, String jdgnPresCn, String rqutUrla, String pstnPaprCn) { | ||
this.isLiked = isLiked; | ||
this.polyBizSjNm = polyBizSjNm; | ||
this.polyItcnCn = polyItcnCn; | ||
this.sporCn = sporCn; | ||
this.bizPrdCn = bizPrdCn; | ||
this.rqutPrdCn = rqutPrdCn; | ||
this.sporScvl = sporScvl; | ||
this.ageInfo = ageInfo; | ||
this.prcpCn = prcpCn; | ||
this.accrRqisCn = accrRqisCn; | ||
this.majrRquisCn = majrRquisCn; | ||
this.empmSttsCn = empmSttsCn; | ||
this.spizRlmRqisCn = spizRlmRqisCn; | ||
this.aditRscn = aditRscn; | ||
this.prcpLmttTrgtCn = prcpLmttTrgtCn; | ||
this.rqutProcCn = rqutProcCn; | ||
this.jdgnPresCn = jdgnPresCn; | ||
this.rqutUrla = rqutUrla; | ||
this.pstnPaprCn = pstnPaprCn; | ||
} | ||
|
||
} |
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