dev add new action
Test Workflow / test (push) Has been cancelled

This commit is contained in:
2026-04-22 12:16:37 +07:00
parent 572255c066
commit bb96e3ac93
4 changed files with 48 additions and 1 deletions
@@ -25,6 +25,7 @@ import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Component
@Slf4j
@@ -115,11 +116,21 @@ public class ViolationHandler implements RequestHandler {
violationRequest.getPage(), violationRequest.getSize(), violationRequest.getSortDirection()
);
}
ViolationResponse.ViolationDto firstShowViolation = null;
List<Violation> content = violationPage.getContent();
List<ViolationResponse.ViolationDto> violationDtos = new ArrayList<>();
if ("getByViolationId".equals(violationRequest.getAction())) {
Violation violation = violationService.getById(violationRequest.getViolationId());
if (violation != null) {
firstShowViolation = ViolationResponse.ViolationDto.fromEntity(violation);
violationDtos.add(firstShowViolation);
}
}
for (Violation violation : content) {
if (firstShowViolation != null && Objects.equals(firstShowViolation.getId(), violation.getId())) continue;
ViolationResponse.ViolationDto violationDto = ViolationResponse.ViolationDto.fromEntity(violation);
violationDto.setCountry(geoCountryService.getCountryName(violation.getPageUrl()));
violationDto.setCountryCode(geoCountryService.getCountryCode(violation.getPageUrl()));