Files
webstatement/app/Http/Controllers/MigrasiController.php
Daeng Deni Mardaeni c0f32a6e16 feat(jobs): tambahkan job untuk memproses berbagai data
- Menambahkan job untuk memproses data akun.
- Menambahkan job untuk memproses data transaksi.
- Menambahkan job untuk memproses data transfer dana.
- Menambahkan job untuk memproses data format narasi.
- Menambahkan job untuk memproses data parameter narasi.
- Menambahkan job untuk memproses data entry statement.
- Memperbarui metode pengolahan data di MigrasiController.
2025-02-18 16:36:20 +07:00

124 lines
4.4 KiB
PHP

<?php
namespace Modules\Webstatement\Http\Controllers;
use App\Http\Controllers\Controller;
use Exception;
use Log;
use Modules\Webstatement\Jobs\ProcessAccountDataJob;
use Modules\Webstatement\Jobs\ProcessArrangementDataJob;
use Modules\Webstatement\Jobs\ProcessBillDetailDataJob;
use Modules\Webstatement\Jobs\ProcessCustomerDataJob;
use Modules\Webstatement\Jobs\ProcessFundsTransferDataJob;
use Modules\Webstatement\Jobs\ProcessStmtEntryDataJob;
use Modules\Webstatement\Jobs\ProcessStmtNarrFormatDataJob;
use Modules\Webstatement\Jobs\ProcessStmtNarrParamDataJob;
use Modules\Webstatement\Jobs\ProcessTransactionDataJob;
class MigrasiController extends Controller
{
public function processArrangementData()
{
try {
ProcessArrangementDataJob::dispatch();
return response()->json(['message' => 'Data Arrangement processing job has been successfully']);
} catch (Exception $e) {
return response()->json(['error' => $e->getMessage()], 500);
}
}
public function processCustomerData()
{
$filePath = storage_path('app/20240901.ST.CUSTOMER.csv'); // Adjust this path as needed
try {
ProcessCustomerDataJob::dispatch();
return response()->json(['message' => 'Data Customer processing job has been successfully']);
} catch (Exception $e) {
return response()->json(['error' => $e->getMessage()], 500);
}
}
public function processBillDetailData()
{
try {
ProcessBillDetailDataJob::dispatch();
return response()->json(['message' => 'Data Bill Details processing job has been successfully']);
} catch (Exception $e) {
return response()->json(['error' => $e->getMessage()], 500);
}
}
public function processAccountData(){
try{
ProcessAccountDataJob::dispatch();
return response()->json(['message' => 'Data Account processing job has been successfully']);
} catch (Exception $e) {
return response()->json(['error' => $e->getMessage()], 500);
}
}
public function processTransactionData(){
try{
ProcessTransactionDataJob::dispatch();
Log::info('Data Transaction processing job has been successfully');
return response()->json(['message' => 'Data Transaction processing job has been successfully']);
} catch (Exception $e) {
return response()->json(['error' => $e->getMessage()], 500);
}
}
public function processFundsTransferData(){
try{
ProcessFundsTransferDataJob::dispatch();
return response()->json(['message' => 'Data Funds Transfer processing job has been successfully']);
} catch (Exception $e) {
return response()->json(['error' => $e->getMessage()], 500);
}
}
public function processStmtNarrParamData()
{
try {
ProcessStmtNarrParamDataJob::dispatch();
return response()->json(['message' => 'Data TempStmtNarrParam processing job has been successfully']);
} catch (Exception $e) {
return response()->json(['error' => $e->getMessage()], 500);
}
}
public function processStmtNarrFormatData(){
try {
ProcessStmtNarrFormatDataJob::dispatch();
return response()->json(['message' => 'Data TempStmtNarrFormat processing job has been successfully']);
} catch (Exception $e) {
return response()->json(['error' => $e->getMessage()], 500);
}
}
public function processStmtEntryData(){
try {
ProcessStmtEntryDataJob::dispatch();
return response()->json(['message' => 'Data TempStmtEntry processing job has been successfully']);
} catch (Exception $e) {
return response()->json(['error' => $e->getMessage()], 500);
}
}
public function index()
{
$this->processCustomerData();
$this->processAccountData();
$this->processArrangementData();
$this->processBillDetailData();
$this->processTransactionData();
$this->processFundsTransferData();
$this->processStmtNarrParamData();
$this->processStmtNarrFormatData();
$this->processStmtEntryData();
return response()->json(['message' => 'Data processing job has been successfully']);
}
}