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

feat: 요구사항 반영 #211

Merged
merged 152 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
754b1c0
feat: 장바구니 추가 기능 구현
LEEJaeHyeok97 Nov 19, 2024
9c2f259
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 19, 2024
b5de2ba
feat: 장바구니 조회 기능 구현
LEEJaeHyeok97 Nov 19, 2024
ca6b405
Merge branch 'develop' of https://github.com/LEEJaeHyeok97/2024_DANPO…
LEEJaeHyeok97 Nov 19, 2024
5b563b5
Merge branch 'develop' into develop
LEEJaeHyeok97 Nov 19, 2024
b4dbfe4
feat: 상품 주문과 식권 사용 기능 구현
LEEJaeHyeok97 Nov 19, 2024
fc50cd6
Merge branch 'develop' of https://github.com/LEEJaeHyeok97/2024_DANPO…
LEEJaeHyeok97 Nov 19, 2024
d97a8de
Merge branch 'develop' into develop
LEEJaeHyeok97 Nov 19, 2024
74c8af5
style: 포인트트랜잭션 레포지토리명 변경
LEEJaeHyeok97 Nov 19, 2024
25cb8d0
Merge branch 'develop' of https://github.com/LEEJaeHyeok97/2024_DANPO…
LEEJaeHyeok97 Nov 19, 2024
4b89797
Merge branch 'develop' into develop
LEEJaeHyeok97 Nov 19, 2024
5976f75
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 19, 2024
eae3903
deploy: 재배포
LEEJaeHyeok97 Nov 19, 2024
7e1ada5
deploy: 재배포2
LEEJaeHyeok97 Nov 19, 2024
ca608fb
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 20, 2024
63413e0
deploy: 로그인 로직 수정에 따른 재배포
LEEJaeHyeok97 Nov 20, 2024
e20a015
deploy: 로그인 로직 수정에 따른 재배포2
LEEJaeHyeok97 Nov 20, 2024
c627cc2
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 20, 2024
9829a4b
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 20, 2024
2f66ad9
feat: 식권 사용 기능 구현
LEEJaeHyeok97 Nov 20, 2024
163d698
feat: yml 수정 사항 반영
LEEJaeHyeok97 Nov 20, 2024
3de7376
feat: 식권 사용 로직 수정
LEEJaeHyeok97 Nov 20, 2024
ccc6df3
Merge branch 'develop' into develop
LEEJaeHyeok97 Nov 20, 2024
f791988
feat: 주문 로직 수정 완료
LEEJaeHyeok97 Nov 20, 2024
36965a7
Merge branch 'develop' of https://github.com/LEEJaeHyeok97/2024_DANPO…
LEEJaeHyeok97 Nov 20, 2024
6bc0d02
fix: 장바구니에 아무것도 없을 때 주문 시 active 되는 현상 수정
LEEJaeHyeok97 Nov 20, 2024
7ae17ee
feat: 주문 완료 시 리턴 값 수정
LEEJaeHyeok97 Nov 20, 2024
9ca3a35
Merge branch 'develop' into develop
LEEJaeHyeok97 Nov 20, 2024
2ffe327
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 20, 2024
e82f58c
feat: 내 그룹 조회 기능 구현
LEEJaeHyeok97 Nov 20, 2024
a98d6f0
feat: 기본 프로필 이미지 url 추가
LEEJaeHyeok97 Nov 20, 2024
9376ed6
Merge branch 'develop' into develop
LEEJaeHyeok97 Nov 20, 2024
4c73bf5
feat: 그룹 멤버 전체 조회 기능 구현
LEEJaeHyeok97 Nov 21, 2024
125752b
Merge branch 'develop' of https://github.com/LEEJaeHyeok97/2024_DANPO…
LEEJaeHyeok97 Nov 21, 2024
9f89029
Merge branch 'develop' into develop
LEEJaeHyeok97 Nov 21, 2024
32836c3
feat: 1인당 사용 가능 금액 설정 컬럼 추가
LEEJaeHyeok97 Nov 21, 2024
ca2a8dc
Merge branch 'develop' of https://github.com/LEEJaeHyeok97/2024_DANPO…
LEEJaeHyeok97 Nov 21, 2024
16c56a3
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 21, 2024
f30aa7c
feat: 내 지갑 조회 기능 구현
LEEJaeHyeok97 Nov 21, 2024
5ec891e
Merge branch 'develop' of https://github.com/LEEJaeHyeok97/2024_DANPO…
LEEJaeHyeok97 Nov 21, 2024
44827ce
feat: 선결제 기능 구현
LEEJaeHyeok97 Nov 21, 2024
74ca8b0
feat: 유저 홈 화면 조회 기능 구현
LEEJaeHyeok97 Nov 21, 2024
dc09775
Merge branch 'develop' into develop
LEEJaeHyeok97 Nov 21, 2024
2864139
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 22, 2024
aef871a
feat: 그룹 상세 조회 기능 구현
LEEJaeHyeok97 Nov 22, 2024
f19e93f
feat: 가게 상세 조회 쿼리 수정
LEEJaeHyeok97 Nov 23, 2024
d15f3a2
Merge branch 'develop' into develop
LEEJaeHyeok97 Nov 23, 2024
6109e9f
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 23, 2024
47e29b4
deploy: 변경사항 반영을 위한 커밋
LEEJaeHyeok97 Nov 23, 2024
90ba864
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 23, 2024
9400ff1
deploy: 수정 사항 반영 재배포
LEEJaeHyeok97 Nov 23, 2024
8609c35
deploy: rds 교체로 인한 재배포
LEEJaeHyeok97 Nov 23, 2024
3e79389
deploy: rds 교체로 인한 재배포2
LEEJaeHyeok97 Nov 23, 2024
8e7a2a5
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 23, 2024
6aea111
feat: 홈 화면 소속팀 조회 쿼리 제대로 안되던 현상 해결, 대표이미지 반환 추가
LEEJaeHyeok97 Nov 23, 2024
ab8d7d2
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 23, 2024
a53ef21
feat: 그룹 상세 조회 응답 컬럼명 변경
LEEJaeHyeok97 Nov 23, 2024
f4b31c2
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 23, 2024
83c7f69
feat: memberLimit 컬럼 삭제
LEEJaeHyeok97 Nov 23, 2024
25be727
feat: 선결제 시 기존 결제 내역과 멱등성 문제 해결
LEEJaeHyeok97 Nov 23, 2024
afdbfbe
fix: 팀 상세 조회 시 이미지 쿼리가 의미 없이 join 되던 쿼리 수정
LEEJaeHyeok97 Nov 23, 2024
1f65811
feat: 가게 검색 기능 대폭 수정
LEEJaeHyeok97 Nov 23, 2024
08f03f7
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 23, 2024
530ca13
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 23, 2024
5a674fb
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 23, 2024
aae5ff4
feat: 프론트 요구사 반영
LEEJaeHyeok97 Nov 23, 2024
f2ec318
:wq
LEEJaeHyeok97 Nov 23, 2024
47de53b
feat: searchcondition 삭제
LEEJaeHyeok97 Nov 23, 2024
1ca86f0
feat: 팀타입 desription 리턴 하도록 수정
LEEJaeHyeok97 Nov 23, 2024
713efe9
feat: 카테고리별 팀 조회 시 팀 생성일 컬럼 추가
LEEJaeHyeok97 Nov 23, 2024
ef61b17
Merge branch 'develop' into develop
LEEJaeHyeok97 Nov 23, 2024
dcfa727
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 23, 2024
4c7bd3c
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 23, 2024
7f1f36e
feat: 매장찾기_상세 페이지 조회 기능 구현
LEEJaeHyeok97 Nov 23, 2024
906596b
Merge branch 'develop' of https://github.com/LEEJaeHyeok97/2024_DANPO…
LEEJaeHyeok97 Nov 23, 2024
d874384
feat: 비밀 코드 조회 기능 엔드 포인트 수정
LEEJaeHyeok97 Nov 23, 2024
fb598b8
fix: conflict fix
LEEJaeHyeok97 Nov 23, 2024
1caba7e
hotfix: 서버 복구
LEEJaeHyeok97 Nov 25, 2024
eacfa91
hotfix: 서버 복구2
LEEJaeHyeok97 Nov 25, 2024
4204711
Merge branch 'develop' into develop
LEEJaeHyeok97 Nov 25, 2024
6a23c61
feat: Barobill api 연동
LEEJaeHyeok97 Nov 26, 2024
191ccbe
fix: 홈 화면에 같은 데이터가 중복되는 현상 수정
LEEJaeHyeok97 Nov 26, 2024
cbdc42c
infra: ElastiCache 연결을 위한 docker-compose 설정
LEEJaeHyeok97 Nov 27, 2024
1a22d38
infra: cicd script 수정
LEEJaeHyeok97 Nov 27, 2024
05a6fcb
infra: cicd script ec2 주소 설정
LEEJaeHyeok97 Nov 27, 2024
5213ccb
infra: cicd script 수정2
LEEJaeHyeok97 Nov 27, 2024
b3d2fac
infra: cicd script 수정3
LEEJaeHyeok97 Nov 27, 2024
fe275dd
infra: cicd script 수정4
LEEJaeHyeok97 Nov 27, 2024
525bf16
infra: cicd script 수정5
LEEJaeHyeok97 Nov 27, 2024
b096362
infra: cicd script 수정6
LEEJaeHyeok97 Nov 27, 2024
bf19d26
infra: cicd script 수정7
LEEJaeHyeok97 Nov 27, 2024
a54a681
infra: cicd script 수정7
LEEJaeHyeok97 Nov 27, 2024
1218ffd
infra: cicd script 수정8
LEEJaeHyeok97 Nov 27, 2024
1f1b075
infra: cicd script 수정9
LEEJaeHyeok97 Nov 27, 2024
30ff013
infra: cicd script 수정10
LEEJaeHyeok97 Nov 27, 2024
9465c6b
infra: cicd script 수정11
LEEJaeHyeok97 Nov 27, 2024
7dbb131
infra: cicd script 수정12
LEEJaeHyeok97 Nov 27, 2024
30714d3
infra: cicd script 수정13
LEEJaeHyeok97 Nov 27, 2024
dc6994c
infra: cicd script 수정14
LEEJaeHyeok97 Nov 27, 2024
91edd67
infra: cicd script 수정15
LEEJaeHyeok97 Nov 27, 2024
337640b
infra: cicd script 수정16
LEEJaeHyeok97 Nov 27, 2024
eb4ee46
infra: cicd script 수정17
LEEJaeHyeok97 Nov 27, 2024
3b15052
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 27, 2024
1ac7306
infra: cicd script 수정18
LEEJaeHyeok97 Nov 27, 2024
983397a
Merge branch 'develop' of https://github.com/LEEJaeHyeok97/2024_DANPO…
LEEJaeHyeok97 Nov 27, 2024
0f74f33
infra: cicd script 수정19
LEEJaeHyeok97 Nov 27, 2024
34c8a68
infra: cicd script 수정20
LEEJaeHyeok97 Nov 27, 2024
0631975
infra: cicd script 수정21
LEEJaeHyeok97 Nov 27, 2024
7820b6f
infra: cicd script 수정22
LEEJaeHyeok97 Nov 27, 2024
d0d8d7d
fix: 보유금액이 선결제 금액보다 작을 경우 상태값 변경(200->400)
LEEJaeHyeok97 Nov 27, 2024
5177685
feat: 홈화면 가게 별 선결제 디데이 추가, 쿼리문 조정
LEEJaeHyeok97 Nov 27, 2024
b1b37b6
feat: 주문하기 로직 정상화
LEEJaeHyeok97 Nov 28, 2024
9bc9fb9
feat: 장바구니에 다른 가게 물건이 있는지 검증 구현
LEEJaeHyeok97 Nov 28, 2024
9284a82
feat: 장바구니 비우기 기능 구현
LEEJaeHyeok97 Nov 28, 2024
5a3e2c4
deploy: cd retry
LEEJaeHyeok97 Nov 28, 2024
ea9a295
feat: 매장 상세 페이지 조회 메뉴 정렬 조건 추가
LEEJaeHyeok97 Nov 28, 2024
49ecad6
Merge branch 'develop' into develop
LEEJaeHyeok97 Nov 28, 2024
2927839
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 28, 2024
1a2e096
feat: 세금명세서 역발행 기능 추가
LEEJaeHyeok97 Nov 29, 2024
cc01d17
Merge branch 'develop' of https://github.com/LEEJaeHyeok97/2024_DANPO…
LEEJaeHyeok97 Nov 29, 2024
a3757e9
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Nov 29, 2024
9865d11
feat: 거래 타입명 변경
LEEJaeHyeok97 Nov 29, 2024
7788de2
Merge branch 'develop' of https://github.com/LEEJaeHyeok97/2024_DANPO…
LEEJaeHyeok97 Nov 29, 2024
76aeaf0
feat: pointTransaction 금액 음수(-) 표시 추가
LEEJaeHyeok97 Nov 30, 2024
64a49db
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Dec 2, 2024
6c721ec
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Dec 3, 2024
33f1539
feat: 세금계산서 역발행 요청 기능 구현
LEEJaeHyeok97 Dec 3, 2024
bfa15d3
Merge branch 'develop' of https://github.com/LEEJaeHyeok97/2024_DANPO…
LEEJaeHyeok97 Dec 3, 2024
4ae48e8
feat: 팀 조회 시 진행 상태값 반환 추가
LEEJaeHyeok97 Dec 5, 2024
d7f3b65
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Dec 6, 2024
583b33d
feat: 그룹 상세 조회 path storeId 추가
LEEJaeHyeok97 Dec 6, 2024
7ab7ee4
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Dec 6, 2024
0f62fce
feat: 그룹 조회 시 팀 id 조회 추가
LEEJaeHyeok97 Dec 6, 2024
2a3e1f5
Merge branch 'develop' of https://github.com/LEEJaeHyeok97/2024_DANPO…
LEEJaeHyeok97 Dec 6, 2024
24dffbe
Merge branch 'develop' into develop
LEEJaeHyeok97 Dec 6, 2024
38b2e70
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Dec 6, 2024
e319f09
feat: 그룹 상세 조회에서 개별 매장 상세 조회 기능 구현
LEEJaeHyeok97 Dec 6, 2024
bdcc220
feat: 매장 상세 조회 시 menuId 값 반환 추가
LEEJaeHyeok97 Dec 6, 2024
7a99c33
feat: cart 조회 시 menuId, menuImg 반환 추가
LEEJaeHyeok97 Dec 6, 2024
7d0bc26
feat: 장바구니 조회 시 가게 id, name, catrogry 반환 추가
LEEJaeHyeok97 Dec 6, 2024
83eb0ea
feat: storeCategory 이름 한글 표기로 수정
LEEJaeHyeok97 Dec 6, 2024
005f2f4
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Dec 6, 2024
90780f8
feat: 바로빌 세금 계산서 역발행 api 채번 현재 시간 기준으로 수정
LEEJaeHyeok97 Dec 6, 2024
26f2253
Merge branch 'develop' of https://github.com/LEEJaeHyeok97/2024_DANPO…
LEEJaeHyeok97 Dec 6, 2024
85ad25a
chore: 세금계산서 수신 이메일 수정
LEEJaeHyeok97 Dec 6, 2024
c6cc979
Merge branch '9oormthon-univ:develop' into develop
LEEJaeHyeok97 Dec 6, 2024
48629d0
feat: 그룹 상세 조회 리턴 값 추가
LEEJaeHyeok97 Dec 6, 2024
a7fc069
Merge branch 'develop' of https://github.com/LEEJaeHyeok97/2024_DANPO…
LEEJaeHyeok97 Dec 6, 2024
6dec68f
feat: 팀 상세 조회 쿼리 수정
LEEJaeHyeok97 Dec 6, 2024
5026339
Merge branch 'develop' into develop
LEEJaeHyeok97 Dec 6, 2024
8c677b7
feat: 요구사항 반영
LEEJaeHyeok97 Dec 6, 2024
4add58f
Merge branch 'develop' of https://github.com/LEEJaeHyeok97/2024_DANPO…
LEEJaeHyeok97 Dec 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,10 @@ public IndividualStoreDetailsResponse getIndividualStoreDetails(String userId, L
Store store = storeRepository.findById(storeId)
.orElseThrow(() -> new IllegalArgumentException("해당하는 가게를 찾을 수 없습니다."));

boolean isMeLeader = team.getTeamLeader().getUser_id().equals(user.getUserId());

IndividualStoreDetailsResponse individualStoreDetails = teamRepository.findIndividualStoreDetails(
user.getUserId(), team.getId(), store.getId());
user.getUserId(), team.getId(), store.getId(), isMeLeader);

return individualStoreDetails;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ public interface TeamQueryDslRepository {

MyTeamDetailsResponse findMyTeamDetailsAsLeader(Long userId, Long teamId);

IndividualStoreDetailsResponse findIndividualStoreDetails(Long userId, Long teamId, Long storeId);
IndividualStoreDetailsResponse findIndividualStoreDetails(Long userId, Long teamId, Long storeId, boolean isMeLeader);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.jangburich.domain.common.Status;
import com.jangburich.domain.point.domain.TransactionType;
import com.jangburich.domain.store.domain.QStoreTeam;
import com.jangburich.domain.team.domain.Team;
import com.jangburich.domain.team.dto.response.IndividualStoreDetailsResponse;
import com.jangburich.domain.team.dto.response.MyPaymentHistory;
import com.jangburich.domain.team.dto.response.MyTeamDetailsResponse;
Expand All @@ -26,17 +27,21 @@
import com.querydsl.jpa.impl.JPAQueryFactory;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

@Slf4j
@RequiredArgsConstructor
@Repository
public class TeamQueryDslRepositoryImpl implements TeamQueryDslRepository {

private final JPAQueryFactory queryFactory;


LocalDate currentDate = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String formattedDate = currentDate.format(formatter);
Expand Down Expand Up @@ -68,7 +73,7 @@ public MyTeamDetailsResponse findMyTeamDetailsAsMember(Long userId, Long teamId)
List<TodayPayment> todayPayments = queryFactory
.selectDistinct(new QTodayPayment(
Expressions.constant(formattedDate),
pointTransaction.createdAt.stringValue(),
Expressions.stringTemplate("DATE_FORMAT({0}, '%H:%i')", pointTransaction.createdAt),
menu.name,
cart.user.name,
menu.price
Expand Down Expand Up @@ -104,20 +109,16 @@ public MyTeamDetailsResponse findMyTeamDetailsAsMember(Long userId, Long teamId)
.leftJoin(pointTransaction).on(pointTransaction.transactionType.eq(TransactionType.FOOD_PURCHASE),
pointTransaction.user.userId.eq(userId))
.where(storeTeam.team.id.eq(teamId))
.groupBy(
storeTeam.team.id,
storeTeam.team.name,
storeTeam.team.description,
storeTeam.remainPoint,
storeTeam.personalAllocatedPoint
)
.fetchOne();

}

@Override
public MyTeamDetailsResponse findMyTeamDetailsAsLeader(Long userId, Long teamId) {

LocalDateTime startOfToday = LocalDate.now().atStartOfDay();
LocalDateTime endOfToday = LocalDate.now().atTime(LocalTime.NOON);

List<PrepayedStore> prepayedStores = queryFactory
.select(new QPrepayedStore(
store.id,
Expand All @@ -139,7 +140,7 @@ public MyTeamDetailsResponse findMyTeamDetailsAsLeader(Long userId, Long teamId)
List<TodayPayment> todayPayments = queryFactory
.selectDistinct(new QTodayPayment(
Expressions.constant(formattedDate),
pointTransaction.createdAt.stringValue(),
Expressions.stringTemplate("DATE_FORMAT({0}, '%H:%i')", pointTransaction.createdAt),
menu.name,
cart.user.name,
menu.price
Expand All @@ -148,7 +149,7 @@ public MyTeamDetailsResponse findMyTeamDetailsAsLeader(Long userId, Long teamId)
.leftJoin(store).on(store.id.eq(pointTransaction.store.id))
.leftJoin(cart).on(cart.store.id.eq(store.id))
.leftJoin(menu).on(menu.id.eq(cart.menu.id), cart.status.eq(Status.INACTIVE))
.where(pointTransaction.createdAt.between(startOfDay, endOfDay), pointTransaction.transactionType.eq(
.where(pointTransaction.createdAt.between(startOfToday, endOfToday), pointTransaction.transactionType.eq(
TransactionType.FOOD_PURCHASE))
.fetch();

Expand All @@ -175,22 +176,82 @@ public MyTeamDetailsResponse findMyTeamDetailsAsLeader(Long userId, Long teamId)
.leftJoin(pointTransaction).on(pointTransaction.transactionType.eq(TransactionType.FOOD_PURCHASE),
pointTransaction.user.userId.eq(userId))
.where(storeTeam.team.id.eq(teamId))
.groupBy(
storeTeam.team.id,
storeTeam.team.name,
storeTeam.team.description,
storeTeam.point,
storeTeam.remainPoint
)
.fetchOne();

}

@Override
public IndividualStoreDetailsResponse findIndividualStoreDetails(Long userId, Long teamId, Long storeId) {
public IndividualStoreDetailsResponse findIndividualStoreDetails(Long userId, Long teamId, Long storeId, boolean isMeLeader) {
LocalDateTime now = LocalDateTime.now();
LocalDateTime oneMonthAgo = now.minusMonths(1);


if (!isMeLeader) {

List<MyPaymentHistory> myPaymentHistories = queryFactory
.select(new QMyPaymentHistory(
Expressions.stringTemplate(
"DATE_FORMAT({0}, '%m.%d')", pointTransaction.createdAt
),
Expressions.stringTemplate(
"DATE_FORMAT({0}, '%H:%i')", pointTransaction.createdAt
),
menu.name,
menu.price
))
.from(pointTransaction)
.leftJoin(menu).on(pointTransaction.menuId.eq(menu.id))
.where(pointTransaction.store.id.eq(storeId),
pointTransaction.team.id.eq(teamId),
pointTransaction.user.userId.eq(userId),
pointTransaction.createdAt.between(oneMonthAgo, now))
.fetch();

log.info("myPaymentHistories: {}", myPaymentHistories);

Integer totalPrice = queryFactory
.select(pointTransaction.transactionedPoint.sum())
.from(pointTransaction)
.where(pointTransaction.store.id.eq(storeId),
pointTransaction.team.id.eq(teamId),
pointTransaction.user.userId.eq(userId),
pointTransaction.createdAt.between(oneMonthAgo, now))
.fetchOne();

System.out.println("totalPrice = " + totalPrice);

return queryFactory
.selectDistinct(new QIndividualStoreDetailsResponse(
store.id,
Expressions.constant(false),
store.name,
Expressions.constant(false),
storeTeam.remainPoint,
storeTeam.personalAllocatedPoint,
Expressions.constant(totalPrice),
Expressions.nullExpression(),
Expressions.nullExpression(),
Expressions.nullExpression(),
Expressions.stringTemplate(
"DATE_FORMAT({0}, '%y.%m.%d')", oneMonthAgo
),
Expressions.stringTemplate(
"DATE_FORMAT({0}, '%y.%m.%d')", now
),
Expressions.constant(myPaymentHistories)
))
.from(storeTeam)
.leftJoin(store).on(storeTeam.store.id.eq(store.id))
.leftJoin(team).on(team.id.eq(storeTeam.team.id))
.leftJoin(pointTransaction).on(pointTransaction.store.id.eq(storeTeam.store.id),
pointTransaction.transactionType.eq(TransactionType.FOOD_PURCHASE),
pointTransaction.user.userId.eq(userId))
.where(storeTeam.store.id.eq(storeId),
storeTeam.team.id.eq(teamId))
.fetchOne();
}

// 리더일 때
List<MyPaymentHistory> myPaymentHistories = queryFactory
.select(new QMyPaymentHistory(
Expressions.stringTemplate(
Expand All @@ -210,23 +271,20 @@ public IndividualStoreDetailsResponse findIndividualStoreDetails(Long userId, Lo
pointTransaction.createdAt.between(oneMonthAgo, now))
.fetch();

Integer totalPrice = queryFactory
.select(pointTransaction.transactionedPoint.sum())
.from(pointTransaction)
.where(pointTransaction.store.id.eq(storeId),
pointTransaction.team.id.eq(teamId),
pointTransaction.user.userId.eq(userId),
pointTransaction.createdAt.between(oneMonthAgo, now))
.fetchOne();
log.info("myPaymentHistories: {}", myPaymentHistories);

return queryFactory
.selectDistinct(new QIndividualStoreDetailsResponse(
store.id,
Expressions.constant(true),
store.name,
Expressions.constant(false),
storeTeam.remainPoint,
Expressions.nullExpression(),
Expressions.nullExpression(),
Expressions.nullExpression(),
pointTransaction.transactionedPoint.sum(),
team.point,
storeTeam.personalAllocatedPoint,
Expressions.constant(totalPrice),
Expressions.stringTemplate(
"DATE_FORMAT({0}, '%y.%m.%d')", oneMonthAgo
),
Expand All @@ -239,7 +297,7 @@ public IndividualStoreDetailsResponse findIndividualStoreDetails(Long userId, Lo
.leftJoin(store).on(storeTeam.store.id.eq(store.id))
.leftJoin(team).on(team.id.eq(storeTeam.team.id))
.leftJoin(pointTransaction).on(pointTransaction.store.id.eq(storeTeam.store.id),
pointTransaction.transactionType.eq(TransactionType.FOOD_PURCHASE),
pointTransaction.transactionType.eq(TransactionType.POINT_PURCHASE),
pointTransaction.user.userId.eq(userId))
.where(storeTeam.store.id.eq(storeId),
storeTeam.team.id.eq(teamId))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,37 @@

public record IndividualStoreDetailsResponse(
Long storeId,
Boolean isMeLeader,
String storeName,
boolean isLiked,
int remainingAmount,
int availableAmount,
int myUsedAmount,
int totalPrepayedAmount,
int remainingPrepayedAmount,
int personalUsableAmount,
String usageStartDate,
String usageEndDate,
List<MyPaymentHistory> myPaymentHistories
) {

@QueryProjection
public IndividualStoreDetailsResponse(Long storeId, String storeName, boolean isLiked, int remainingAmount,
int availableAmount, int myUsedAmount, String usageStartDate,
String usageEndDate,
public IndividualStoreDetailsResponse(Long storeId, Boolean isMeLeader, String storeName, boolean isLiked,
int remainingAmount, int availableAmount, int myUsedAmount,
int totalPrepayedAmount, int remainingPrepayedAmount,
int personalUsableAmount,
String usageStartDate, String usageEndDate,
List<MyPaymentHistory> myPaymentHistories) {
this.storeId = storeId;
this.isMeLeader = isMeLeader;
this.storeName = storeName;
this.isLiked = isLiked;
this.remainingAmount = remainingAmount;
this.availableAmount = availableAmount;
this.myUsedAmount = myUsedAmount;
this.totalPrepayedAmount = totalPrepayedAmount;
this.remainingPrepayedAmount = remainingPrepayedAmount;
this.personalUsableAmount = personalUsableAmount;
this.usageStartDate = usageStartDate;
this.usageEndDate = usageEndDate;
this.myPaymentHistories = myPaymentHistories;
Expand Down