refactor(webstatement): Migrasi ke StagingController dan ubah storage disk ke local 'staging'
Perubahan yang dilakukan: - Hapus file `MigrasiController.php` yang tidak lagi digunakan - Ganti referensi controller dari `MigrasiController` menjadi `StagingController` di `ProcessDailyMigration.php` - Update semua Job class untuk menggunakan disk `staging` menggantikan `sftpStatement` - Ganti konstanta `DISK_NAME` di class berikut: * `ProcessAccountDataJob` * `ProcessArrangementDataJob` * `ProcessAtmTransactionJob` * `ProcessBillDetailDataJob` * `ProcessCategoryDataJob` * `ProcessCompanyDataJob` * `ProcessCustomerDataJob` * `ProcessDataCaptureDataJob` * `ProcessFtTxnTypeConditionJob` * `ProcessFundsTransferDataJob` * `ProcessProvinceDataJob` - Komentari sementara `array_pop()` di `ProcessDataCaptureDataJob` untuk debugging - Rapikan whitespace dan formatting di `GenerateClosingBalanceReportCommand` - Sesuaikan konfigurasi storage agar menggunakan local filesystem (`disk: staging`) - Konsolidasikan penamaan dan penggunaan disk untuk environment `staging` - Hilangkan ketergantungan terhadap koneksi SFTP dalam proses development/staging Manfaat: - Mempercepat proses development dan debugging dengan akses file lokal - Menyederhanakan konfigurasi untuk staging environment - Meningkatkan konsistensi dan maintainability kode - Mengurangi potensi error akibat koneksi eksternal (SFTP)
This commit is contained in:
@@ -4,7 +4,7 @@ namespace Modules\Webstatement\Console;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Modules\Webstatement\Http\Controllers\MigrasiController;
|
use Modules\Webstatement\Http\Controllers\StagingController;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class ProcessDailyMigration extends Command
|
class ProcessDailyMigration extends Command
|
||||||
@@ -46,7 +46,7 @@ class ProcessDailyMigration extends Command
|
|||||||
$this->info('Period: ' . ($period ?? '-1 day (default)'));
|
$this->info('Period: ' . ($period ?? '-1 day (default)'));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$controller = app(MigrasiController::class);
|
$controller = app(StagingController::class);
|
||||||
$response = $controller->index($processParameter, $period);
|
$response = $controller->index($processParameter, $period);
|
||||||
|
|
||||||
$responseData = json_decode($response->getContent(), true);
|
$responseData = json_decode($response->getContent(), true);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
ProcessProvinceDataJob,
|
ProcessProvinceDataJob,
|
||||||
ProcessStmtEntryDetailDataJob};
|
ProcessStmtEntryDetailDataJob};
|
||||||
|
|
||||||
class MigrasiController extends Controller
|
class StagingController extends Controller
|
||||||
{
|
{
|
||||||
private const PROCESS_TYPES = [
|
private const PROCESS_TYPES = [
|
||||||
'transaction' => ProcessTransactionDataJob::class,
|
'transaction' => ProcessTransactionDataJob::class,
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
'period' => $period
|
'period' => $period
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$disk = Storage::disk('sftpStatement');
|
$disk = Storage::disk('staging');
|
||||||
|
|
||||||
if ($processParameter) {
|
if ($processParameter) {
|
||||||
Log::info('Processing parameter data');
|
Log::info('Processing parameter data');
|
||||||
@@ -20,7 +20,7 @@ class ProcessAccountDataJob implements ShouldQueue
|
|||||||
private const CSV_DELIMITER = '~';
|
private const CSV_DELIMITER = '~';
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.ACCOUNT.csv';
|
private const FILENAME = 'ST.ACCOUNT.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
||||||
|
|
||||||
private string $period = '';
|
private string $period = '';
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
private const CSV_DELIMITER = '~';
|
private const CSV_DELIMITER = '~';
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.AA.ARRANGEMENT.csv';
|
private const FILENAME = 'ST.AA.ARRANGEMENT.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
||||||
|
|
||||||
private string $period = '';
|
private string $period = '';
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
private const CSV_DELIMITER = '~';
|
private const CSV_DELIMITER = '~';
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.ATM.TRANSACTION.csv';
|
private const FILENAME = 'ST.ATM.TRANSACTION.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
||||||
private const HEADER_MAP = [
|
private const HEADER_MAP = [
|
||||||
'id' => 'transaction_id',
|
'id' => 'transaction_id',
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
private const CSV_DELIMITER = '~';
|
private const CSV_DELIMITER = '~';
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.AA.BILL.DETAILS.csv';
|
private const FILENAME = 'ST.AA.BILL.DETAILS.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
||||||
|
|
||||||
private string $period = '';
|
private string $period = '';
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
private const CSV_DELIMITER = '~';
|
private const CSV_DELIMITER = '~';
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.CATEGORY.csv';
|
private const FILENAME = 'ST.CATEGORY.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
private const HEADER_MAP = [
|
private const HEADER_MAP = [
|
||||||
'id' => 'id_category',
|
'id' => 'id_category',
|
||||||
'date_time' => 'date_time',
|
'date_time' => 'date_time',
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
private const CSV_DELIMITER = '~';
|
private const CSV_DELIMITER = '~';
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.COMPANY.csv';
|
private const FILENAME = 'ST.COMPANY.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
private const FIELD_MAP = [
|
private const FIELD_MAP = [
|
||||||
'id' => null, // Not mapped to model
|
'id' => null, // Not mapped to model
|
||||||
'date_time' => null, // Not mapped to model
|
'date_time' => null, // Not mapped to model
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
private const CSV_DELIMITER = '~';
|
private const CSV_DELIMITER = '~';
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.CUSTOMER.csv';
|
private const FILENAME = 'ST.CUSTOMER.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
||||||
|
|
||||||
private string $period = '';
|
private string $period = '';
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
private const CSV_DELIMITER = '~';
|
private const CSV_DELIMITER = '~';
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.DATA.CAPTURE.csv';
|
private const FILENAME = 'ST.DATA.CAPTURE.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
||||||
private const CSV_HEADERS = [
|
private const CSV_HEADERS = [
|
||||||
'id',
|
'id',
|
||||||
@@ -187,7 +187,7 @@
|
|||||||
{
|
{
|
||||||
// Exclude the last field from CSV
|
// Exclude the last field from CSV
|
||||||
if (count($row) > 0) {
|
if (count($row) > 0) {
|
||||||
array_pop($row);
|
//array_pop($row);
|
||||||
Log::info("Excluded last field from row $rowCount. New column count: " . count($row));
|
Log::info("Excluded last field from row $rowCount. New column count: " . count($row));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
];
|
];
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.FT.TXN.TYPE.CONDITION.csv';
|
private const FILENAME = 'ST.FT.TXN.TYPE.CONDITION.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
|
|
||||||
private string $period = '';
|
private string $period = '';
|
||||||
private int $processedCount = 0;
|
private int $processedCount = 0;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
private const CSV_DELIMITER = '~';
|
private const CSV_DELIMITER = '~';
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.FUNDS.TRANSFER.csv';
|
private const FILENAME = 'ST.FUNDS.TRANSFER.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
|
|
||||||
private string $period = '';
|
private string $period = '';
|
||||||
private int $processedCount = 0;
|
private int $processedCount = 0;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class ProcessProvinceDataJob implements ShouldQueue
|
|||||||
private const CSV_DELIMITER = '~';
|
private const CSV_DELIMITER = '~';
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.PROVINCE.csv';
|
private const FILENAME = 'ST.PROVINCE.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
|
|
||||||
private string $period = '';
|
private string $period = '';
|
||||||
private int $processedCount = 0;
|
private int $processedCount = 0;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class ProcessSectorDataJob implements ShouldQueue
|
|||||||
private const CSV_DELIMITER = '~';
|
private const CSV_DELIMITER = '~';
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.SECTOR.csv';
|
private const FILENAME = 'ST.SECTOR.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
|
|
||||||
private string $period = '';
|
private string $period = '';
|
||||||
private int $processedCount = 0;
|
private int $processedCount = 0;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
private const CSV_DELIMITER = '~';
|
private const CSV_DELIMITER = '~';
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.STMT.ENTRY.csv';
|
private const FILENAME = 'ST.STMT.ENTRY.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
||||||
|
|
||||||
private string $period = '';
|
private string $period = '';
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class ProcessStmtEntryDetailDataJob implements ShouldQueue
|
|||||||
private const CSV_DELIMITER = '~';
|
private const CSV_DELIMITER = '~';
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.STMT.ENTRY.DETAIL.csv';
|
private const FILENAME = 'ST.STMT.ENTRY.DETAIL.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
||||||
|
|
||||||
private string $period = '';
|
private string $period = '';
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
private const CSV_DELIMITER = '~';
|
private const CSV_DELIMITER = '~';
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.STMT.NARR.FORMAT.csv';
|
private const FILENAME = 'ST.STMT.NARR.FORMAT.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
|
|
||||||
private string $period = '';
|
private string $period = '';
|
||||||
private int $processedCount = 0;
|
private int $processedCount = 0;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
private const CSV_DELIMITER = '~';
|
private const CSV_DELIMITER = '~';
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.STMT.NARR.PARAM.csv';
|
private const FILENAME = 'ST.STMT.NARR.PARAM.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
|
|
||||||
private string $period = '';
|
private string $period = '';
|
||||||
private int $processedCount = 0;
|
private int $processedCount = 0;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
private const CSV_DELIMITER = '~';
|
private const CSV_DELIMITER = '~';
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.TELLER.csv';
|
private const FILENAME = 'ST.TELLER.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
private const CHUNK_SIZE = 1000; // Process data in chunks to reduce memory usage
|
||||||
private const HEADER_MAP = [
|
private const HEADER_MAP = [
|
||||||
'id' => 'id_teller',
|
'id' => 'id_teller',
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
private const CSV_DELIMITER = '~';
|
private const CSV_DELIMITER = '~';
|
||||||
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
private const MAX_EXECUTION_TIME = 86400; // 24 hours in seconds
|
||||||
private const FILENAME = 'ST.TRANSACTION.csv';
|
private const FILENAME = 'ST.TRANSACTION.csv';
|
||||||
private const DISK_NAME = 'sftpStatement';
|
private const DISK_NAME = 'staging';
|
||||||
|
|
||||||
private string $period = '';
|
private string $period = '';
|
||||||
private int $processedCount = 0;
|
private int $processedCount = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user