diff --git a/.config/psysh/psysh_history b/.config/psysh/psysh_history new file mode 100644 index 0000000..f84a832 --- /dev/null +++ b/.config/psysh/psysh_history @@ -0,0 +1,11 @@ +PbgTask::truncate(); +exit +(new App\Jobs\ScrapingDataJob())->handle(); +(new App\Jobs\ScrapingDataJob())->handle(); +(new App\Jobs\ScrapingDataJob())->handle(); +exit +(new App\Jobs\ScrapingDataJob())->handle(); +exit +(new App\Jobs\ScrapingDataJob())->handle(); +(new App\Jobs\ScrapingDataJob())->handle(); +exit diff --git a/.lesshst b/.lesshst new file mode 100644 index 0000000..4d1c30b --- /dev/null +++ b/.lesshst @@ -0,0 +1 @@ +.less-history-file: diff --git a/app/Console/Commands/TruncatePBGTable.php b/app/Console/Commands/TruncatePBGTable.php new file mode 100644 index 0000000..b5a7470 --- /dev/null +++ b/app/Console/Commands/TruncatePBGTable.php @@ -0,0 +1,40 @@ +whereRaw("LOWER(function_type) != ?", ['sebagai tempat usaha'])->orWhereNull('function_type'); + $query->where(function ($q) { + $q->where(function ($q2) { + $q2->whereRaw("LOWER(function_type) != ?", ['sebagai tempat usaha']) + ->orWhereNull('function_type'); + }) + ->whereDoesntHave('googleSheet', function ($sub) { + $sub->whereRaw("LOWER(status_verifikasi) = ?", ['selesai verifikasi']); + }); + }); break; case 'business': - $query->whereRaw("LOWER(function_type) = ?", ['sebagai tempat usaha']); + $query->where(function ($q) { + $q->whereRaw("LOWER(function_type) = ?", ['sebagai tempat usaha']) + ->whereDoesntHave('googleSheet', function ($sub) { + $sub->whereRaw("LOWER(status_verifikasi) = ?", ['selesai verifikasi']); + }); + }); break; case 'verified': diff --git a/app/Jobs/ScrapingDataJob.php b/app/Jobs/ScrapingDataJob.php index a013ba3..1a207d2 100644 --- a/app/Jobs/ScrapingDataJob.php +++ b/app/Jobs/ScrapingDataJob.php @@ -50,8 +50,8 @@ class ScrapingDataJob implements ShouldQueue ]); // Run the scraping services - $service_google_sheet->run_service(); - $service_pbg_task->run_service(); + // $service_google_sheet->run_service(); + // $service_pbg_task->run_service(); try{ $service_tab_pbg_task->run_service(); }catch(\Exception $e){ diff --git a/app/Models/PbgTask.php b/app/Models/PbgTask.php index 06177d4..2986747 100644 --- a/app/Models/PbgTask.php +++ b/app/Models/PbgTask.php @@ -43,7 +43,7 @@ class PbgTask extends Model } public function googleSheet(){ - return $this->hasOne(PbgTaskGoogleSheet::class, 'no_registrasi', 'registration_number'); + return $this->hasOne(PbgTaskGoogleSheet::class, 'formatted_registration_number', 'registration_number'); } public function taskAssignments() diff --git a/app/Services/ServicePbgTask.php b/app/Services/ServicePbgTask.php index d96a7e5..2a221fa 100644 --- a/app/Services/ServicePbgTask.php +++ b/app/Services/ServicePbgTask.php @@ -106,7 +106,7 @@ class ServicePbgTask }; do { - $url = "{$this->simbg_host}/api/pbg/v1/list/?page={$currentPage}&size={$this->fetch_per_page}&sort=ASC"; + $url = "{$this->simbg_host}/api/pbg/v1/list/?page={$currentPage}&size={$this->fetch_per_page}&sort=ASC&date&search&status&slf_status&type&sort_by=created_at&application_type=1&start_date&end_date"; $fetch_data = $fetchData($url); if (!$fetch_data) { @@ -123,6 +123,8 @@ class ServicePbgTask $data = $response['data']; $totalPage = isset($response['total_page']) ? (int) $response['total_page'] : 1; + Log::info("Total data scraping {$totalPage}"); + $saved_data = []; foreach ($data as $item) { $saved_data[] = [ diff --git a/app/Services/ServiceTabPbgTask.php b/app/Services/ServiceTabPbgTask.php index 85574d6..aefcb58 100644 --- a/app/Services/ServiceTabPbgTask.php +++ b/app/Services/ServiceTabPbgTask.php @@ -55,7 +55,7 @@ class ServiceTabPbgTask try{ $this->current_uuid = $pbg_task->uuid; $this->scraping_task_details($pbg_task->uuid); - $this->scraping_task_assignments($pbg_task->uuid); + // $this->scraping_task_assignments($pbg_task->uuid); $this->scraping_task_retributions($pbg_task->uuid); $this->scraping_task_integrations($pbg_task->uuid); }catch(\Exception $e){ @@ -98,6 +98,8 @@ class ServiceTabPbgTask $data = $responseData['data']; + Log::info("Executed uid : {$uuid}"); + // Use the static method from PbgTaskDetail model to create/update PbgTaskDetail::createFromApiResponse($data, $uuid); diff --git a/database/migrations/2025_08_07_210105_make_some_nullable_in_pbg_task_details_table.php b/database/migrations/2025_08_07_210105_make_some_nullable_in_pbg_task_details_table.php new file mode 100644 index 0000000..7c176eb --- /dev/null +++ b/database/migrations/2025_08_07_210105_make_some_nullable_in_pbg_task_details_table.php @@ -0,0 +1,36 @@ +string("nik")->nullable()->change(); + $table->string("type_card")->nullable()->change(); + $table->string("basement")->nullable()->change(); + $table->decimal('latitude', 15, 8)->nullable()->change(); + $table->decimal('longitude', 15, 8)->nullable()->change(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('pbg_task_details', function (Blueprint $table) { + $table->string("nik")->nullable()->change(); + $table->string("type_card")->nullable()->change(); + $table->string("basement")->nullable()->change(); + $table->decimal('latitude', 15, 8)->nullable()->change(); + $table->decimal('longitude', 15, 8)->nullable()->change(); + }); + } +}; diff --git a/database/seeders/GlobalSettingSeeder.php b/database/seeders/GlobalSettingSeeder.php index d2c97c1..f798ec5 100644 --- a/database/seeders/GlobalSettingSeeder.php +++ b/database/seeders/GlobalSettingSeeder.php @@ -25,7 +25,7 @@ class GlobalSettingSeeder extends Seeder ], [ "key" => "SIMBG_PASSWORD", - "value" => "Simbg123", + "value" => "LogitechG29", "type" => "string", "description" => "Password SIMBG", "created_at" => Carbon::now()->format("Y-m-d H:i:s"), diff --git a/database/seeders/MenuSeeder.php b/database/seeders/MenuSeeder.php index 317db38..98361c7 100644 --- a/database/seeders/MenuSeeder.php +++ b/database/seeders/MenuSeeder.php @@ -32,7 +32,7 @@ class MenuSeeder extends Seeder "sort_order" => 2, "children" => [ [ - "name" => "Dashboard Pimpinan SIMBG", + "name" => "Dashboard Pimpinan (PBG)", "url" => "dashboard.home", "icon" => null, "sort_order" => 1,