Skip to content

Commit

Permalink
Merge pull request #149 from WE-ARE-RACCOONS/develop
Browse files Browse the repository at this point in the history
RAC-304 deploy : 운영 반영
  • Loading branch information
ywj9811 authored Mar 2, 2024
2 parents b1462d1 + 887e542 commit d176809
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ public void updateAutoCancel() {
@Transactional
public void updateCancelWithAuto(Mentoring mentoring) {
try {
mentoringUpdateService.updateStatus(mentoring, CANCEL);
Mentoring cancelMentoring = mentoringGetService.byMentoringId(mentoring.getMentoringId());
mentoringUpdateService.updateStatus(cancelMentoring, CANCEL);
Refuse refuse = RefuseMapper.mapToRefuse(mentoring);
refuseSaveService.save(refuse);
paymentManageUseCase.refundPayByUser(mentoring.getUser(), mentoring.getPayment().getOrderId());
Expand Down Expand Up @@ -174,7 +175,8 @@ public void updateAutoDone() {
@Transactional
public void updateDoneWithAuto(Mentoring mentoring) {
try {
mentoringUpdateService.updateStatus(mentoring, DONE);
Mentoring doneMentoring = mentoringGetService.byMentoringId(mentoring.getMentoringId());
mentoringUpdateService.updateStatus(doneMentoring, DONE);
Senior senior = mentoring.getSenior();
Salary salary = salaryGetService.bySenior(senior);
salaryUpdateService.updateTotalAmount(salary);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ public interface MentoringDslRepository {
Page<Mentoring> findAllBySearchPayment(String search, Pageable pageable);

List<Mentoring> findAllByStatusAndCreatedAtIsBefore(Status status, LocalDateTime now);

List<Mentoring> findAllByStatus(Status status);
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,16 @@ public List<Mentoring> findAllByStatusAndCreatedAtIsBefore(Status status, LocalD
.where(mentoring.status.eq(status), mentoring.createdAt.before(now))
.fetch();
}

@Override
public List<Mentoring> findAllByStatus(Status status) {
return queryFactory.selectFrom(mentoring)
.distinct()
.join(mentoring.senior, senior)
.fetchJoin()
.join(mentoring.payment.salary, salary)
.fetchJoin()
.where(mentoring.status.eq(status))
.fetch();
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package com.postgraduate.domain.mentoring.domain.repository;

import com.postgraduate.domain.mentoring.domain.entity.Mentoring;
import com.postgraduate.domain.mentoring.domain.entity.constant.Status;
import com.postgraduate.domain.payment.domain.entity.Payment;
import org.springframework.data.jpa.repository.JpaRepository;

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

public interface MentoringRepository extends JpaRepository<Mentoring, Long>, MentoringDslRepository {
List<Mentoring> findAllByStatus(Status status);
Optional<Mentoring> findByPayment(Payment payment);
}

0 comments on commit d176809

Please sign in to comment.