dev check violation for lawcase,complaint
Test Workflow / test (push) Has been cancelled

This commit is contained in:
2026-05-21 13:15:11 +07:00
parent 5c0a0c146b
commit 0c522e2faf
5 changed files with 24 additions and 2 deletions
@@ -28,6 +28,7 @@ import ru.soune.nocopy.service.register.AuthService;
import ru.soune.nocopy.service.tariff.TariffConstants;
import ru.soune.nocopy.service.tariff.TariffInfoService;
import ru.soune.nocopy.service.violation.ViolationService;
import ru.soune.nocopy.service.violation.ViolationStatus;
import java.io.IOException;
import java.util.*;
@@ -163,12 +164,18 @@ public class LawCaseHandler implements RequestHandler {
private BaseResponse createLawCase(Long userId, LawCaseRequest lawCaseRequest, BaseRequest request) {
validateRequiredParameters(lawCaseRequest, request, userId);
Long violationId = lawCaseRequest.getViolationId();
Violation violation = violationService.getById(violationId);
if (lawCaseService.lawCaseExistByViolationId(violationId)) {
return new BaseResponse(request.getMsgId(), MessageCode.LAW_CASE_ALREADY_EXIST.getCode(),
MessageCode.LAW_CASE_ALREADY_EXIST.getDescription(), "Law case was already exists");
}
if (violation != null && violation.getStatus().equals(ViolationStatus.NOT_OWNER_FILE.name())) {
return new BaseResponse(request.getMsgId(), MessageCode.USER_NOT_HAD_PERMISSION.getCode(),
MessageCode.USER_NOT_HAD_PERMISSION.getDescription(), "Wrong status");
}
try {
tariffInfoService.writeOffTokens(userId, TariffConstants.LEGAL_COST, OperationType.CREATE_LEGAL_CASE);
} catch (TariffNotFoundException e) {