dev add statistic complaints by status
Test Workflow / test (push) Has been cancelled

This commit is contained in:
2026-05-25 12:38:20 +07:00
parent 1536dbc845
commit 670f14e955
6 changed files with 96 additions and 1 deletions
@@ -0,0 +1,25 @@
package ru.soune.nocopy.service.statistic;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import ru.soune.nocopy.dto.statistic.ComplaintStatisticResponse;
import ru.soune.nocopy.entity.complaint.ComplaintStatus;
import ru.soune.nocopy.repository.ComplaintEntityRepository;
@Service
@RequiredArgsConstructor
public class ComplaintStatisticService {
private final ComplaintEntityRepository complaintEntityRepository;
public ComplaintStatisticResponse complaintStatistic() {
return ComplaintStatisticResponse.builder()
.totalComplaints(complaintEntityRepository.getTotalComplaintsCount())
.totalCancelled(complaintEntityRepository.getTotalComplaintsCountByStatus(ComplaintStatus.CANCELLED.name()))
.totalCreated(complaintEntityRepository.getTotalComplaintsCountByStatus(ComplaintStatus.CREATED.name()))
.totalCompleted(complaintEntityRepository.getTotalComplaintsCountByStatus(ComplaintStatus.COMPLETED.name()))
.totalInWork(complaintEntityRepository.getTotalComplaintsCountByStatus(ComplaintStatus.IN_WORK.name()))
.build();
}
}