Skip to content

Commit

Permalink
Merge pull request #323 from WE-ARE-RACCOONS/develop
Browse files Browse the repository at this point in the history
main반영
  • Loading branch information
ywj9811 authored Nov 6, 2024
2 parents b72346f + 689d7d2 commit 557faa1
Show file tree
Hide file tree
Showing 316 changed files with 3,574 additions and 3,946 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ dependencies {
implementation 'org.redisson:redisson-spring-boot-starter:3.18.0'

implementation 'com.github.ywj9811:querydsl-itemreader:v1.0.1'

// flyway 추가
implementation 'org.flywaydb:flyway-mysql'
implementation 'org.flywaydb:flyway-core'
}

tasks.named('test') {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.postgraduate.admin.application.dto.res;

import com.postgraduate.domain.mentoring.domain.entity.constant.Status;
import com.postgraduate.domain.mentoring.domain.entity.constant.MentoringStatus;

import java.time.LocalDateTime;

public record MentoringInfo(
Long mentoringId,
Status status,
MentoringStatus mentoringStatus,
String nickName,
String phoneNumber,
LocalDateTime createdAt,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.postgraduate.admin.application.dto.res;

import com.postgraduate.domain.senior.domain.entity.constant.Status;
import com.postgraduate.domain.member.senior.domain.entity.constant.Status;

public record SeniorInfo(
Long seniorId,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.postgraduate.admin.application.dto.res;

import com.postgraduate.domain.wish.domain.entity.constant.Status;
import com.postgraduate.domain.member.user.domain.entity.constant.Status;

import java.time.LocalDateTime;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@
import com.postgraduate.domain.payment.domain.entity.Payment;
import com.postgraduate.domain.salary.domain.entity.Salary;
import com.postgraduate.domain.salary.domain.entity.SalaryAccount;
import com.postgraduate.domain.senior.domain.entity.Info;
import com.postgraduate.domain.senior.domain.entity.Senior;
import com.postgraduate.domain.user.user.application.utils.UserUtils;
import com.postgraduate.domain.user.user.domain.entity.User;
import com.postgraduate.domain.user.user.domain.entity.constant.Role;
import com.postgraduate.domain.wish.domain.entity.Wish;
import com.postgraduate.domain.member.senior.domain.entity.Info;
import com.postgraduate.domain.member.senior.domain.entity.Senior;
import com.postgraduate.domain.member.user.application.utils.UserUtils;
import com.postgraduate.domain.member.user.domain.entity.User;
import com.postgraduate.domain.member.user.domain.entity.constant.Role;
import com.postgraduate.domain.member.user.domain.entity.Wish;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Optional;

import static com.postgraduate.domain.mentoring.domain.entity.constant.TermUnit.SHORT;

@RequiredArgsConstructor
Expand Down Expand Up @@ -61,9 +59,7 @@ public UserInfo mapToUserInfo(Wish wish) {
}


public SeniorInfo mapToSeniorInfo(SeniorInfoQuery query) {
Salary salary = query.salary();
Optional<Wish> wish = query.wish();
public SeniorInfo mapToSeniorInfo(Salary salary) {
Senior senior = salary.getSenior();
User user = senior.getUser();
return new SeniorInfo(
Expand All @@ -73,7 +69,7 @@ public SeniorInfo mapToSeniorInfo(SeniorInfoQuery query) {
senior.getStatus(),
salary.getTotalAmount(),
user.getMarketingReceive(),
wish.isPresent()
user.isJunior()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,17 @@
import com.postgraduate.admin.application.mapper.AdminMapper;
import com.postgraduate.admin.domain.service.*;
import com.postgraduate.domain.mentoring.domain.entity.Mentoring;
import com.postgraduate.domain.mentoring.domain.service.MentoringGetService;
import com.postgraduate.domain.mentoring.domain.service.MentoringUpdateService;
import com.postgraduate.domain.payment.application.usecase.PaymentManageUseCase;
import com.postgraduate.domain.payment.domain.entity.Payment;
import com.postgraduate.domain.salary.domain.entity.Salary;
import com.postgraduate.domain.salary.domain.service.SalaryGetService;
import com.postgraduate.domain.salary.domain.service.SalaryUpdateService;
import com.postgraduate.domain.senior.domain.entity.Senior;
import com.postgraduate.domain.senior.domain.service.SeniorGetService;
import com.postgraduate.domain.user.user.domain.entity.User;
import com.postgraduate.domain.user.user.domain.service.UserGetService;
import com.postgraduate.domain.member.senior.domain.entity.Senior;
import com.postgraduate.domain.member.user.domain.entity.User;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

import static com.postgraduate.domain.mentoring.domain.entity.constant.Status.DONE;
import static com.postgraduate.domain.mentoring.domain.entity.constant.MentoringStatus.DONE;

@Service
@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
import com.postgraduate.admin.domain.service.AdminPaymentService;
import com.postgraduate.admin.domain.service.AdminSalaryService;
import com.postgraduate.domain.mentoring.domain.entity.Mentoring;
import com.postgraduate.domain.mentoring.domain.entity.constant.Status;
import com.postgraduate.domain.payment.application.usecase.PaymentManageUseCase;
import com.postgraduate.domain.user.user.domain.entity.User;
import com.postgraduate.domain.member.user.domain.entity.User;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

import static com.postgraduate.domain.mentoring.domain.entity.constant.Status.DONE;
import static com.postgraduate.domain.mentoring.domain.entity.constant.MentoringStatus.DONE;

@Service
@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

import com.postgraduate.admin.application.dto.res.CertificationDetailsResponse;
import com.postgraduate.admin.application.dto.res.SeniorInfo;
import com.postgraduate.admin.application.dto.res.SeniorInfoQuery;
import com.postgraduate.admin.application.mapper.AdminMapper;
import com.postgraduate.admin.domain.service.AdminSeniorService;
import com.postgraduate.domain.senior.domain.entity.Senior;
import com.postgraduate.domain.senior.exception.SeniorCertificationException;
import com.postgraduate.domain.salary.domain.entity.Salary;
import com.postgraduate.domain.member.senior.domain.entity.Senior;
import com.postgraduate.domain.member.senior.exception.SeniorCertificationException;
import com.postgraduate.global.bizppurio.application.usecase.BizppurioSeniorMessage;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

import static com.postgraduate.domain.senior.domain.entity.constant.Status.WAITING;
import static com.postgraduate.domain.member.senior.domain.entity.constant.Status.WAITING;

@Service
@Transactional
Expand All @@ -26,7 +26,7 @@ public class AdminSeniorUseCase {

@Transactional(readOnly = true)
public List<SeniorInfo> allSenior() {
List<SeniorInfoQuery> salaries = adminSeniorService.allSeniors();
List<Salary> salaries = adminSeniorService.allSeniors();
return salaries.stream()
.map(adminMapper::mapToSeniorInfo)
.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import com.postgraduate.admin.application.dto.res.WishResponse;
import com.postgraduate.admin.application.mapper.AdminMapper;
import com.postgraduate.admin.domain.service.AdminUserService;
import com.postgraduate.domain.user.user.domain.entity.User;
import com.postgraduate.domain.wish.domain.entity.Wish;
import com.postgraduate.domain.member.user.domain.entity.User;
import com.postgraduate.domain.member.user.domain.entity.Wish;
import com.postgraduate.global.bizppurio.application.dto.req.JuniorMatchingSuccessRequest;
import com.postgraduate.global.bizppurio.application.usecase.BizppurioJuniorMessage;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -39,8 +39,8 @@ public List<UserInfo> userInfos() {

@Transactional(readOnly = true)
public WishResponse wishInfo(Long userId) {
Wish wish = adminUserService.wishByUserId(userId);
return adminMapper.mapToWishResponse(wish);
User user = adminUserService.userByUserId(userId);
return adminMapper.mapToWishResponse(user.getWish());
}

public void wishDone(Long wishId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import java.util.List;
import java.util.Optional;

import static com.postgraduate.domain.member.senior.domain.entity.QSenior.senior;
import static com.postgraduate.domain.member.user.domain.entity.QUser.user;
import static com.postgraduate.domain.mentoring.domain.entity.QMentoring.mentoring;
import static com.postgraduate.domain.payment.domain.entity.QPayment.payment;
import static com.postgraduate.domain.senior.domain.entity.QSenior.senior;
import static com.postgraduate.domain.user.user.domain.entity.QUser.user;
import static java.util.Optional.ofNullable;

@Repository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

import java.util.List;

import static com.postgraduate.domain.member.user.domain.entity.QUser.user;
import static com.postgraduate.domain.mentoring.domain.entity.QMentoring.mentoring;
import static com.postgraduate.domain.payment.domain.entity.QPayment.payment;
import static com.postgraduate.domain.user.user.domain.entity.QUser.user;
import static java.util.Optional.ofNullable;

@RequiredArgsConstructor
Expand All @@ -22,7 +22,7 @@ public List<PaymentWithMentoringQuery> findAllPayment() {
List<Tuple> fetch = queryFactory.select(payment, mentoring)
.from(payment)
.distinct()
.leftJoin(payment.user, user)
.leftJoin(payment.user, user)
.fetchJoin()
.leftJoin(mentoring)
.on(mentoring.payment.eq(payment))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import java.util.List;
import java.util.Optional;

import static com.postgraduate.domain.member.senior.domain.entity.QSenior.senior;
import static com.postgraduate.domain.member.user.domain.entity.QUser.user;
import static com.postgraduate.domain.salary.domain.entity.QSalary.salary;
import static com.postgraduate.domain.senior.domain.entity.QSenior.senior;
import static com.postgraduate.domain.user.user.domain.entity.QUser.user;

@RequiredArgsConstructor
@Repository
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.postgraduate.admin.domain.repository;

import com.postgraduate.admin.application.dto.res.SeniorInfoQuery;
import com.postgraduate.domain.senior.domain.entity.Senior;
import com.postgraduate.domain.salary.domain.entity.Salary;
import com.postgraduate.domain.member.senior.domain.entity.Senior;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
Expand All @@ -10,34 +10,26 @@
import java.util.List;
import java.util.Optional;

import static com.postgraduate.domain.member.senior.domain.entity.QSenior.senior;
import static com.postgraduate.domain.member.user.domain.entity.QUser.user;
import static com.postgraduate.domain.salary.domain.entity.QSalary.salary;
import static com.postgraduate.domain.senior.domain.entity.QSenior.senior;
import static com.postgraduate.domain.user.user.domain.entity.QUser.user;
import static com.postgraduate.domain.wish.domain.entity.QWish.wish;
import static java.util.Optional.ofNullable;

@RequiredArgsConstructor
@Repository
public class AdminSeniorRepository {
private final JPAQueryFactory queryFactory;

public List<SeniorInfoQuery> allSeniorInfo(LocalDate salaryDate) {
return queryFactory.select(salary, wish)
.from(salary)
public List<Salary> allSeniorInfo(LocalDate salaryDate) {
return queryFactory.selectFrom(salary)
.distinct()
.join(salary.senior, senior)
.fetchJoin()
.join(salary.senior.user, user)
.fetchJoin()
.leftJoin(wish)
.on(wish.user.eq(salary.senior.user))
.fetchJoin()
.where(salary.senior.user.isDelete.isFalse(), salary.salaryDate.eq(salaryDate))
.orderBy(salary.senior.createdAt.desc())
.fetch()
.stream()
.map(tuple -> new SeniorInfoQuery(tuple.get(salary), ofNullable(tuple.get(wish))))
.toList();
.fetch();
}

public Optional<Senior> findBySeniorId(Long seniorId) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,31 @@
package com.postgraduate.admin.domain.repository;

import com.postgraduate.domain.user.user.domain.entity.User;
import com.postgraduate.domain.wish.domain.entity.Wish;
import com.postgraduate.domain.member.user.domain.entity.User;
import com.postgraduate.domain.member.user.domain.entity.Wish;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

import static com.postgraduate.domain.user.user.domain.entity.QUser.user;
import static com.postgraduate.domain.wish.domain.entity.QWish.wish;
import static com.postgraduate.domain.member.user.domain.entity.QUser.user;

@RequiredArgsConstructor
@Repository
public class AdminUserRepository {
private final JPAQueryFactory queryFactory;

public List<Wish> findAllJunior() {
return queryFactory.selectFrom(wish)
.join(wish.user, user)
.fetchJoin()
return queryFactory.select(user.wish)
.from(user)
.where(user.wish.isNotNull())
.fetch();
}

public Optional<Wish> findWishByUserId(Long userId) {
return Optional.ofNullable(queryFactory.selectFrom(wish)
.where(
wish.matchingReceive.isTrue(),
wish.user.userId.eq(userId),
wish.user.isDelete.isFalse()
)
.join(wish.user, user)
.fetchJoin()
.fetchOne());
}

public Optional<Wish> findWishByWishId(Long wishId) {
return Optional.ofNullable(queryFactory.selectFrom(wish)
.where(wish.wishId.eq(wishId))
public Optional<User> findUserByWishId(Long wishId) {
return Optional.ofNullable(queryFactory.selectFrom(user)
.where(user.wish.wishId.eq(wishId))
.fetchOne());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import java.util.List;

import static com.postgraduate.domain.mentoring.domain.entity.constant.Status.CANCEL;
import static com.postgraduate.domain.mentoring.domain.entity.constant.MentoringStatus.CANCEL;

@RequiredArgsConstructor
@Service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@

import com.postgraduate.admin.application.dto.res.PaymentWithMentoringQuery;
import com.postgraduate.admin.domain.repository.AdminPaymentRepository;
import com.postgraduate.domain.mentoring.domain.entity.Mentoring;
import com.postgraduate.domain.mentoring.domain.entity.constant.Status;
import com.postgraduate.domain.mentoring.exception.MentoringNotFoundException;
import com.postgraduate.domain.payment.domain.entity.Payment;
import com.postgraduate.domain.payment.exception.PaymentNotFoundException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

import static com.postgraduate.domain.mentoring.domain.entity.constant.Status.CANCEL;

@Service
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.postgraduate.domain.salary.domain.entity.Salary;
import com.postgraduate.domain.salary.exception.SalaryNotFoundException;
import com.postgraduate.domain.salary.util.SalaryUtil;
import com.postgraduate.domain.senior.domain.entity.Senior;
import com.postgraduate.domain.member.senior.domain.entity.Senior;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

Expand Down
Loading

0 comments on commit 557faa1

Please sign in to comment.