This commit is contained in:
parent
ab8ef5b90e
commit
18c87beafe
3 changed files with 22 additions and 4 deletions
|
|
@ -9,6 +9,8 @@ import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
||||||
|
import org.springframework.web.multipart.MultipartException;
|
||||||
|
import ru.nbch.credit_tracker.component.SimpleMessageResolver;
|
||||||
import ru.nbch.credit_tracker.config.settings.CreditTrackerSettings;
|
import ru.nbch.credit_tracker.config.settings.CreditTrackerSettings;
|
||||||
import ru.nbch.credit_tracker.entities.user_response.errors.CommonError;
|
import ru.nbch.credit_tracker.entities.user_response.errors.CommonError;
|
||||||
import ru.nbch.credit_tracker.entities.user_response.errors.MonitoringActivePackagesError;
|
import ru.nbch.credit_tracker.entities.user_response.errors.MonitoringActivePackagesError;
|
||||||
|
|
@ -21,7 +23,7 @@ import ru.nbch.credit_tracker.enums.SignalError;
|
||||||
import ru.nbch.credit_tracker.exceptions.SignalClientException;
|
import ru.nbch.credit_tracker.exceptions.SignalClientException;
|
||||||
import ru.nbch.credit_tracker.exceptions.SignalException;
|
import ru.nbch.credit_tracker.exceptions.SignalException;
|
||||||
import ru.nbch.credit_tracker.exceptions.SignalServerException;
|
import ru.nbch.credit_tracker.exceptions.SignalServerException;
|
||||||
import ru.nbch.credit_tracker.component.SimpleMessageResolver;
|
import ru.nbch.credit_tracker.utils.error.ExceptionUtils;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestControllerAdvice
|
@RestControllerAdvice
|
||||||
|
|
@ -49,6 +51,20 @@ public class GlobalExceptionHandler {
|
||||||
return new ResponseEntity<>(error, headers, HttpStatus.BAD_REQUEST);
|
return new ResponseEntity<>(error, headers, HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(value = MultipartException.class, produces = MediaType.APPLICATION_XML_VALUE)
|
||||||
|
public ResponseEntity<CommonError> handleSpecialException(MultipartException ex) {
|
||||||
|
log.warn("Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception " +
|
||||||
|
"[Request processing failed: {}", ExceptionUtils.getStackTrace(ex));
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(new MediaType("application", "xml", Charset.forName(encoding)));
|
||||||
|
|
||||||
|
MonitoringError error = new MonitoringError();
|
||||||
|
error.setStatus("error");
|
||||||
|
error.setErrorCode(SignalError.ERROR_028.getCode());
|
||||||
|
error.setErrorText(SignalError.ERROR_028.getKey());
|
||||||
|
return new ResponseEntity<>(error, headers, HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
@ExceptionHandler(value = SignalClientException.class, produces = MediaType.APPLICATION_XML_VALUE)
|
@ExceptionHandler(value = SignalClientException.class, produces = MediaType.APPLICATION_XML_VALUE)
|
||||||
public ResponseEntity<CommonError> handleClientException(SignalClientException ex) {
|
public ResponseEntity<CommonError> handleClientException(SignalClientException ex) {
|
||||||
CommonError err = getCommonError(ex);
|
CommonError err = getCommonError(ex);
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ public enum SignalError implements IEnumKeyCode {
|
||||||
ERROR_025("025", "Пакет {} уже был удален ранее, удаление невозможно."),
|
ERROR_025("025", "Пакет {} уже был удален ранее, удаление невозможно."),
|
||||||
ERROR_026("026", "Пакет {} обновляется. Удаление невозможно. Дождитесь завершения обновления и повторите попытку."),
|
ERROR_026("026", "Пакет {} обновляется. Удаление невозможно. Дождитесь завершения обновления и повторите попытку."),
|
||||||
ERROR_027("027", "Недопустимое значение в элементе SignalTypes"),
|
ERROR_027("027", "Недопустимое значение в элементе SignalTypes"),
|
||||||
|
ERROR_028("028", "Некорректный формат запроса: в теле ожидается ZIP-архив"),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,12 @@ update signals_user_packages set external_package_name = concat(substring(member
|
||||||
|
|
||||||
INSERT
|
INSERT
|
||||||
INTO signals_phones_map
|
INTO signals_phones_map
|
||||||
(fid, phone, flag_90_12, flag_debt5000, calculated_at)
|
(fid, phone, flag_90_12, flag_debt5000, calculated_at, searched_at)
|
||||||
SELECT distinct on (phone::bigint) fid::int,
|
SELECT distinct on (phone_l) fid::int,
|
||||||
phone::bigint,
|
phone_l,
|
||||||
flag_90_12,
|
flag_90_12,
|
||||||
flag_debt5000,
|
flag_debt5000,
|
||||||
|
calculated_at,
|
||||||
'2025-01-01'
|
'2025-01-01'
|
||||||
FROM signals_phone_fid_map where fid is not null
|
FROM signals_phone_fid_map where fid is not null
|
||||||
order by phone, calculated_at desc;
|
order by phone, calculated_at desc;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue