Files
no-copy/src/main/java/ru/soune/nocopy/handler/StatisticViolationHandler.java
T
backdev ced8768332
Test Workflow / test (push) Has been cancelled
dev add check for change status
2026-04-27 13:56:52 +07:00

33 lines
1.0 KiB
Java

package ru.soune.nocopy.handler;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import ru.soune.nocopy.dto.BaseRequest;
import ru.soune.nocopy.dto.BaseResponse;
import ru.soune.nocopy.dto.MessageCode;
import ru.soune.nocopy.dto.statistic.ViolationStatisticResponse;
import ru.soune.nocopy.service.statistic.ViolationStatisticService;
@Component
@RequiredArgsConstructor
@Slf4j
public class StatisticViolationHandler implements RequestHandler {
private final ViolationStatisticService statisticService;
@Override
public BaseResponse handle(BaseRequest request) throws Exception {
log.debug("Handling violation statistic request, msgId: {}", request.getMsgId());
ViolationStatisticResponse statistics = statisticService.getViolationStatistics();
return new BaseResponse(
request.getMsgId(),
MessageCode.SUCCESS.getCode(),
MessageCode.SUCCESS.getDescription(),
statistics
);
}
}