feat(webstatement): update migrasi workflow and optimize period handling
- Menambahkan metode `index_manual` pada `MigrasiController` untuk pemrosesan manual.
- Mengganti implementasi metode `index` di `MigrasiController` agar secara otomatis menentukan dan memproses data dengan periode hari sebelumnya.
- Menambahkan validasi untuk memeriksa keberadaan folder periode pada storage SFTP sebelum melakukan pemrosesan.
- Menyesuaikan logika pemanggilan fungsi-fungsi pemrosesan data sesuai urutan:
- `ProcessCategoryData`
- `ProcessCompanyData`
- `processCustomerData`
- `processAccountData`
- `processStmtEntryData`
- `ProcessDataCaptureData`
- `processFundsTransferData`
- `ProcessTellerData`
- `ProcessAtmTransaction`
- `processArrangementData`
- `processBillDetailData`
- Memodifikasi daftar periode pada metode `listPeriod` di `WebstatementController` untuk secara dinamis mengambil periode hari sebelumnya menggunakan `date('Ymd', strtotime('-1 day'))`.
- Menghapus elemen hardcoded pada daftar periode untuk efisiensi kustomisasi.
Signed-off-by: Daeng Deni Mardaeni <ddeni05@gmail.com>
This commit is contained in:
@@ -173,7 +173,7 @@ class MigrasiController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function index()
|
public function index_manual()
|
||||||
{
|
{
|
||||||
//$disk = Storage::disk('sftpStatement');
|
//$disk = Storage::disk('sftpStatement');
|
||||||
|
|
||||||
@@ -231,6 +231,42 @@ class MigrasiController extends Controller
|
|||||||
$this->processBillDetailData([$period]);
|
$this->processBillDetailData([$period]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return response()->json(['message' => 'Data processing job has been successfully']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process data migration for the previous day's period.
|
||||||
|
*
|
||||||
|
* This method automatically determines the period based on yesterday's date,
|
||||||
|
* checks if the corresponding folder exists in SFTP storage, and then
|
||||||
|
* processes all required data types in the correct sequence.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\JsonResponse A JSON response indicating success or failure
|
||||||
|
* @throws \Exception If the period folder doesn't exist or if any processing job fails
|
||||||
|
*/
|
||||||
|
public function index(){
|
||||||
|
$disk = Storage::disk('sftpStatement');
|
||||||
|
|
||||||
|
$period = date('Ymd', strtotime('-1 day'));
|
||||||
|
if (!$disk->exists($period)) {
|
||||||
|
return response()->json(['message' => 'Period folder not found in SFTP storage'], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->ProcessCategoryData([$period]);
|
||||||
|
$this->ProcessCompanyData([$period]);
|
||||||
|
|
||||||
|
$this->processCustomerData([$period]);
|
||||||
|
$this->processAccountData([$period]);
|
||||||
|
|
||||||
|
$this->processStmtEntryData([$period]);
|
||||||
|
$this->ProcessDataCaptureData([$period]);
|
||||||
|
$this->processFundsTransferData([$period]);
|
||||||
|
$this->ProcessTellerData([$period]);
|
||||||
|
$this->ProcessAtmTransaction([$period]);
|
||||||
|
|
||||||
|
$this->processArrangementData([$period]);
|
||||||
|
$this->processBillDetailData([$period]);
|
||||||
|
|
||||||
return response()->json(['message' => 'Data processing job has been successfully']);
|
return response()->json(['message' => 'Data processing job has been successfully']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,17 +111,7 @@
|
|||||||
|
|
||||||
function listPeriod(){
|
function listPeriod(){
|
||||||
return [
|
return [
|
||||||
'20250512',
|
date('Ymd', strtotime('-1 day'))
|
||||||
'20250513',
|
|
||||||
'20250514',
|
|
||||||
'20250515',
|
|
||||||
'20250516',
|
|
||||||
'20250517',
|
|
||||||
'20250518',
|
|
||||||
'20250519',
|
|
||||||
'20250520',
|
|
||||||
'20250521',
|
|
||||||
'20250522'
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user