add backup success sync

This commit is contained in:
arifal hidayat
2025-08-08 00:12:22 +07:00
parent 3902a486f7
commit 588e3ad5e2
7 changed files with 37715 additions and 19 deletions

View File

@@ -3,11 +3,12 @@
namespace App\Console\Commands;
use App\Models\PbgTask;
use App\Models\PbgTaskAttachment;
use App\Models\PbgTaskDetail;
use App\Models\PbgTaskIndexIntegrations;
use App\Models\PbgTaskPrasarana;
use App\Models\PbgTaskRetributions;
use DB;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class TruncatePBGTable extends Command
{
@@ -32,9 +33,10 @@ class TruncatePBGTable extends Command
{
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
PbgTask::truncate();
PbgTaskAttachment::truncate();
PbgTaskRetributions::truncate();
PbgTaskDetail::truncate();
PbgTaskIndexIntegrations::truncate();
PbgTaskPrasarana::truncate();
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
}
}

View File

@@ -11,7 +11,7 @@ use Barryvdh\DomPDF\Facade\Pdf;
use Illuminate\Support\Facades\DB;
use Exception;
use Illuminate\Http\Request;
use Log;
use Illuminate\Support\Facades\Log;
use Maatwebsite\Excel\Facades\Excel;
class RequestAssignmentController extends Controller
@@ -24,8 +24,7 @@ class RequestAssignmentController extends Controller
$query = PbgTask::with([
'attachments' => function ($q) {
$q->whereIn('pbg_type', ['berita_acara', 'bukti_bayar']);
},
'googleSheet'
}
])->orderBy('id', 'desc');
if ($request->has('filter') && !empty($request->get('filter'))) {
@@ -36,10 +35,8 @@ class RequestAssignmentController extends Controller
$query->where(function ($q) {
$q->where(function ($q2) {
$q2->whereRaw("LOWER(function_type) != ?", ['sebagai tempat usaha'])
->whereRaw("status != ?", 20)
->orWhereNull('function_type');
})
->whereDoesntHave('googleSheet', function ($sub) {
$sub->whereRaw("LOWER(status_verifikasi) = ?", ['selesai verifikasi']);
});
});
break;
@@ -47,24 +44,17 @@ class RequestAssignmentController extends Controller
case 'business':
$query->where(function ($q) {
$q->whereRaw("LOWER(function_type) = ?", ['sebagai tempat usaha'])
->whereDoesntHave('googleSheet', function ($sub) {
$sub->whereRaw("LOWER(status_verifikasi) = ?", ['selesai verifikasi']);
});
->whereRaw("status != ?", 20);
});
break;
case 'verified':
$query->whereHas('googleSheet', function ($q) {
$q->whereRaw("LOWER(status_verifikasi) = ?", ['selesai verifikasi']);
});
$query->whereRaw("status = ?", 20);
break;
case 'non-verified':
$query->where(function ($q) {
$q->whereDoesntHave('googleSheet')
->orWhereHas('googleSheet', function ($q2) {
$q2->whereRaw("LOWER(status_verifikasi) != ?", ['selesai verifikasi'])->orWhereNull('status_verifikasi');
});
$q->whereRaw("status != ?", 20);
});
break;
}