Compare commits

...

2 Commits

2 changed files with 47 additions and 10 deletions

View File

@@ -2,6 +2,27 @@ create or replace package body pck_auto_import as
c_log_module constant lg_app_log.log_module%type := 'AUTOMATISCHER_BA_IMPORT'; c_log_module constant lg_app_log.log_module%type := 'AUTOMATISCHER_BA_IMPORT';
PROCEDURE p_create_wv_autonomous(i_swv_bemerkung inkasso.sy_wiedervorlage.swv_bemerkung%TYPE DEFAULT NULL
)
/*Kopf------------------------------------------------------------------------------------------------
-- Beschreibung: Erstellt eine Wiedervorlage innerhalb eine autonomous transaction, damit rollback/commits in Fehlerfällen, diese Wiedervorlage nicht beeinflussen.
------------------------------------------------------------------------------------------------------
-- Parameter: —
------------------------------------------------------------------------------------------------------
-- MA Datum Änderung
-- SCK 2026-04-27 Prozedur erstellt
------------------------------------------------------------------------------------------------Kopf*/
is
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
pck_wiedervorlage.p_wiedervorlage_anlegen (i_swv_stp_id_art => pck_stammdaten.f_get_stp_id_by_programmid('WV_IMPORT_BA_KORRES')
,i_swv_wdatum => sysdate
,i_swv_bemerkung => i_swv_bemerkung --'Bitte manuell Prüfen: Beim automatischen Import der BA-Datei "' || l_filename || '" ist folgende Fehler aufgetreten: "' || SQLERRM || '" (Siehe "' || i_object_key || '").'
,i_swv_mit_id_wsachbearbeiter => pck_system.f_get_par_wert_by_programmid('BA_IMPORT_SB_MIT_ID')
);
COMMIT; -- Nur diese autonome Transaktion
END;
procedure p_run_ba_korrespondenz_dateieingang_automation procedure p_run_ba_korrespondenz_dateieingang_automation
/*Kopf------------------------------------------------------------------------------------------------ /*Kopf------------------------------------------------------------------------------------------------
-- Beschreibung: Einstiegspunkt für die APEX Automation (stündlich). -- Beschreibung: Einstiegspunkt für die APEX Automation (stündlich).
@@ -57,11 +78,13 @@ create or replace package body pck_auto_import as
apex_web_service.g_request_headers.delete; apex_web_service.g_request_headers.delete;
apex_web_service.g_request_headers(1).name := 'X-Api-Key'; apex_web_service.g_request_headers(1).name := 'X-Api-Key';
--dbms_output.put_line(l_api_key);
apex_web_service.g_request_headers(1).value := l_api_key; apex_web_service.g_request_headers(1).value := l_api_key;
l_response := apex_web_service.make_rest_request( l_response := apex_web_service.make_rest_request(
p_url => l_service_url p_url => l_service_url
,p_http_method => 'POST' ,p_http_method => 'POST'
,p_wallet_path => pck_system.f_get_par_wert_by_programmid('NETSTORE_WALLET_PATH')
); );
l_http_status := apex_web_service.g_status_code; l_http_status := apex_web_service.g_status_code;
@@ -142,11 +165,28 @@ create or replace package body pck_auto_import as
,i_object_ref => i_object_key ,i_object_ref => i_object_key
); );
begin
l_return := inkasso.pck_import.f_import_ba_dokument( l_return := inkasso.pck_import.f_import_ba_dokument(
i_datei => i_content i_datei => i_content
,i_dateiname => l_filename ,i_dateiname => l_filename
,i_datei_groesse => l_file_size ,i_datei_groesse => l_file_size
); );
exception when others
then
rollback;
pck_log.p_warn(
i_module => c_log_module
,i_action => l_log_action
,i_message => 'Aufruf von pck_import.f_import_ba_dokument für Datei "' || l_filename || '" hat einen Fehler geworfen (' || SQLERRM || '). Erstelle wiedervorlage...'
,i_object_ref => i_object_key
);
-- Bei einem Import Fehler: Wiedervorlage für Sachbearbeiter erstellen & Fehlermeldung mit in die Wiedervorlage schreiben
p_create_wv_autonomous(i_swv_bemerkung => 'Bitte manuell Prüfen: Beim automatischen Import der BA-Datei "' || l_filename
|| '" ist folgender Fehler aufgetreten: "' || SQLERRM || '" (Siehe "' || i_object_key || '").'
);
raise;
end;
if l_return != 1 if l_return != 1
then then
@@ -158,10 +198,7 @@ create or replace package body pck_auto_import as
); );
-- Wiedervorlage für Sachbearbeiter erstellen -- Wiedervorlage für Sachbearbeiter erstellen
pck_wiedervorlage.p_wiedervorlage_anlegen (i_swv_stp_id_art => pck_stammdaten.f_get_stp_id_by_programmid('WV_IMPORT_DATEV') -- TODO: neue WV Art? z.B. WV_IMPORT_BA_DATEN p_create_wv_autonomous(i_swv_bemerkung => 'Bitte manuell Prüfen: Die BA-Datei "' || l_filename || '" konnte nicht automatisch importiert werden (Siehe "' || i_object_key || '").'
,i_swv_wdatum => sysdate --TODO: welches Datum? sysdate?
,i_swv_bemerkung => 'Bitte manuell Prüfen: Die BA-Datei "' || l_filename || '" konnte nicht automatisch importiert werden (Siehe "' || i_object_key || '").'
,i_swv_mit_id_wsachbearbeiter => pck_system.f_get_par_wert_by_programmid('BA_IMPORT_SB_MIT_ID')
); );
pck_log.p_info( pck_log.p_info(

View File

@@ -42,7 +42,7 @@ public class FileProcessingResource {
//Log.infof("API-key received: %s", apiKey); //Log.infof("API-key received: %s", apiKey);
if (apiKey == null || !config.api().key().equals(apiKey)) { if (apiKey == null || !config.api().key().equals(apiKey)) {
Log.warn("Trigger abgelehnt — ungültiger oder fehlender API-Key"); Log.warnf("Trigger abgelehnt — ungültiger oder fehlender API-Key. Key: %s", apiKey);
return Response.status(Response.Status.UNAUTHORIZED).build(); return Response.status(Response.Status.UNAUTHORIZED).build();
} }