Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
110 changes: 55 additions & 55 deletions src/main/java/life/mosu/mosuserver/application/admin/AdminService.java
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
//package life.mosu.mosuserver.application.admin;
//
//import java.util.List;
//import life.mosu.mosuserver.domain.admin.ApplicationQueryRepositoryImpl;
//import life.mosu.mosuserver.domain.admin.RefundQueryRepositoryImpl;
//import life.mosu.mosuserver.domain.admin.StudentQueryRepositoryImpl;
//import life.mosu.mosuserver.presentation.admin.dto.ApplicationExcelDto;
//import life.mosu.mosuserver.presentation.admin.dto.ApplicationFilter;
//import life.mosu.mosuserver.presentation.admin.dto.ApplicationListResponse;
//import life.mosu.mosuserver.presentation.admin.dto.RefundListResponse;
//import life.mosu.mosuserver.presentation.admin.dto.SchoolLunchResponse;
//import life.mosu.mosuserver.presentation.admin.dto.StudentExcelDto;
//import life.mosu.mosuserver.presentation.admin.dto.StudentFilter;
//import life.mosu.mosuserver.presentation.admin.dto.StudentListResponse;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.data.domain.Page;
//import org.springframework.data.domain.Pageable;
//import org.springframework.stereotype.Service;
//
//@Slf4j
//@Service
//@RequiredArgsConstructor
//public class AdminService {
//
// private final StudentQueryRepositoryImpl studentQueryRepository;
// private final ApplicationQueryRepositoryImpl applicationQueryRepository;
// private final RefundQueryRepositoryImpl refundQueryRepository;
//
// public Page<StudentListResponse> getStudents(StudentFilter filter, Pageable pageable) {
// return studentQueryRepository.searchAllStudents(filter, pageable);
// }
//
// public List<StudentExcelDto> getStudentExcelData() {
// return studentQueryRepository.searchAllStudentsForExcel();
// }
//
// public List<SchoolLunchResponse> getLunchCounts() {
// return applicationQueryRepository.searchAllSchoolLunches();
// }
//
// public Page<ApplicationListResponse> getApplications(ApplicationFilter filter,
// Pageable pageable) {
// return applicationQueryRepository.searchAllApplications(filter, pageable);
// }
//
// public List<ApplicationExcelDto> getApplicationExcelData() {
// return applicationQueryRepository.searchAllApplicationsForExcel();
// }
//
// public Page<RefundListResponse> getRefunds(Pageable pageable) {
// return refundQueryRepository.searchAllRefunds(pageable);
// }
//
//}
package life.mosu.mosuserver.application.admin;

import java.util.List;
import life.mosu.mosuserver.domain.admin.ApplicationQueryRepositoryImpl;
import life.mosu.mosuserver.domain.admin.RefundQueryRepositoryImpl;
import life.mosu.mosuserver.domain.admin.StudentQueryRepositoryImpl;
import life.mosu.mosuserver.presentation.admin.dto.ApplicationExcelDto;
import life.mosu.mosuserver.presentation.admin.dto.ApplicationFilter;
import life.mosu.mosuserver.presentation.admin.dto.ApplicationListResponse;
import life.mosu.mosuserver.presentation.admin.dto.RefundListResponse;
import life.mosu.mosuserver.presentation.admin.dto.SchoolLunchResponse;
import life.mosu.mosuserver.presentation.admin.dto.StudentExcelDto;
import life.mosu.mosuserver.presentation.admin.dto.StudentFilter;
import life.mosu.mosuserver.presentation.admin.dto.StudentListResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
public class AdminService {

private final StudentQueryRepositoryImpl studentQueryRepository;
private final ApplicationQueryRepositoryImpl applicationQueryRepository;
private final RefundQueryRepositoryImpl refundQueryRepository;

public Page<StudentListResponse> getStudents(StudentFilter filter, Pageable pageable) {
return studentQueryRepository.searchAllStudents(filter, pageable);
}

public List<StudentExcelDto> getStudentExcelData() {
return studentQueryRepository.searchAllStudentsForExcel();
}

public List<SchoolLunchResponse> getLunchCounts() {
return applicationQueryRepository.searchAllSchoolLunches();
}

public Page<ApplicationListResponse> getApplications(ApplicationFilter filter,
Pageable pageable) {
return applicationQueryRepository.searchAllApplications(filter, pageable);
}

public List<ApplicationExcelDto> getApplicationExcelData() {
return applicationQueryRepository.searchAllApplicationsForExcel();
}

public Page<RefundListResponse> getRefunds(Pageable pageable) {
return refundQueryRepository.searchAllRefunds(pageable);
}

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package life.mosu.mosuserver.application.examapplication;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import life.mosu.mosuserver.application.examapplication.dto.RegisterExamApplicationEvent;
import life.mosu.mosuserver.domain.application.ExamTicketImageJpaEntity;
import life.mosu.mosuserver.domain.application.ExamTicketImageJpaRepository;
import life.mosu.mosuserver.domain.application.Subject;
import life.mosu.mosuserver.domain.exam.ExamJpaEntity;
import life.mosu.mosuserver.domain.exam.ExamJpaRepository;
import life.mosu.mosuserver.domain.examapplication.ExamApplicationJpaEntity;
Expand Down Expand Up @@ -34,8 +35,7 @@ public class ExamApplicationService {
private final ProfileJpaRepository profileJpaRepository;
private final ExamJpaRepository examJpaRepository;
private final S3Service s3Service;



@Transactional
public List<ExamApplicationJpaEntity> register(RegisterExamApplicationEvent event) {
List<ExamApplicationJpaEntity> examApplicationEntities = event.toEntity();
Expand All @@ -60,9 +60,9 @@ public ExamTicketResponse getExamTicket(Long userId, Long examApplicationId) {
List<ExamSubjectJpaEntity> examSubjects = examSubjectJpaRepository.findByExamApplicationId(
examApplicationId);

List<Subject> subjects = examSubjects.stream()
.map(es -> es.getSubject())
.toList();
Set<String> subjects = examSubjects.stream()
.map(es -> es.getSubject().getSubjectName())
.collect(Collectors.toSet());

Long applicationId = examApplication.getApplicationId();
ExamTicketImageJpaEntity examTicketImage = examTicketImageJpaRepository.findByApplicationId(
Expand All @@ -78,7 +78,5 @@ public ExamTicketResponse getExamTicket(Long userId, Long examApplicationId) {

return ExamTicketResponse.of(examTicketImgUrl, profile.getUserName(), profile.getBirth(),
examApplication.getExamNumber(), subjects, exam.getSchoolName());


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static RegisterExamApplicationEvent of(
Long applicationId
) {
List<TargetExam> targetExams = examApplicationRequests.stream()
.map(request -> new TargetExam(request.examId(), request.lunchId()))
.map(request -> new TargetExam(request.examId(), request.isLunchChecked()))
.toList();
return new RegisterExamApplicationEvent(targetExams, applicationId);
}
Expand All @@ -24,14 +24,14 @@ public List<ExamApplicationJpaEntity> toEntity() {
.map(targetExam -> ExamApplicationJpaEntity.create(
applicationId,
targetExam.examId(),
targetExam.lunchId()
targetExam.isLunchChecked()
))
.toList();
}

public record TargetExam(
Long examId,
Long lunchId
boolean isLunchChecked
) {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class PaymentFailureHandler {
public void handlePaymentFailure(PaymentEvent event) {
List<PaymentJpaEntity> existingPayments = paymentRepository.findByOrderId(event.orderId());
Set<Long> existingAppIds = existingPayments.stream()
.map(PaymentJpaEntity::getApplicationSchoolId)
.map(PaymentJpaEntity::getApplicationId)
.collect(Collectors.toSet());

List<Long> missingAppSchoolIds = event.applicationSchoolIds().stream()
Expand Down
Loading