dev fix add count
Test Workflow / test (push) Has been cancelled

This commit is contained in:
2026-04-28 14:15:29 +07:00
parent 610ab0977d
commit 284b402cdc
4 changed files with 42 additions and 10 deletions
@@ -1,6 +1,7 @@
package ru.soune.nocopy.service.violation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.data.domain.*;
import org.springframework.stereotype.Service;
@@ -24,6 +25,7 @@ import java.util.stream.Collectors;
@Service
@AllArgsConstructor
@Slf4j
public class ViolationService {
private final ViolationRepository violationRepository;
@@ -220,11 +222,25 @@ public class ViolationService {
Set<String> inProgressStatuses = Set.of(
ViolationStatus.LEGAL_IN_WORK.name(),
ViolationStatus.COMPLAINT_IN_WORK.name(),
ViolationStatus.COMPLAINT_AND_LEGAL_IN_WORK.name()
);
ViolationStatus.COMPLAINT_AND_LEGAL_IN_WORK.name());
List<Long> violationIds = violations.stream().map(Violation::getId).toList();
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!! Violations ids: " + violationIds);
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
long newViolations = violations.stream()
.filter(v -> v.getStatus().equals(ViolationStatus.NEW.name()))
.count();
@@ -237,14 +253,30 @@ public class ViolationService {
.filter(v -> v.getStatus().equals(ViolationStatus.AUTHORIZED_USE.name()))
.count();
int totalComplaints = 0;
int totalLawCases = 0;
Long totalComplaints = 0L;
Long totalLawCases = 0L;
if (!violationIds.isEmpty()) {
totalComplaints = complaintRepository.countComplaintByViolations(violationIds);
totalLawCases = lawCaseRepository.countLawCaseByViolationIds(violationIds);
}
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!! totalLawCases: " + totalLawCases);
log.info("!!!!!!!!!!!!!!!!!!!!!!!!! totalComplaints: " + totalComplaints);
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
log.info("!!!!!!!!!!!!!!!!!!!!!!!!!");
return ViolationStatisticsResponse.builder()
.totalViolations(violations.size())
.newViolations(newViolations)