✨ feat(lpj-seeders): Inisialisasi master referensi, migrasi MIG, dan SQL seeding
- Menata LpjDatabaseSeeder untuk orkestrasi batch, aktifkan MigrationGambarInspeksiSeeder . - Migrasi domain MIG → LPJ lengkap dengan parseTimestamp , initializeErrorLog , logError . - Tambah seeders MIG eksternal & tim penilai; normalisasi mapping checkTujuanPenilaian . - Perluasan master: JFK009–JFK014, TP0007–TP00010, hubungan pemilik, KJPP; TeamsSeeder via SQL. - MasterDataSurveyorSeeder eksekusi SQL referensi (20+ tabel) via DB::unprepared . - Tambah puluhan SQL referensi (jenis, kondisi, sarana, posisi, spek, dll). - Normalisasi data inspeksi (duplikasi key dinamis), serialisasi JSON rapi. - Logging seragam ke app log + CSV error untuk audit trail.
This commit is contained in:
@@ -13,24 +13,25 @@ class HubunganPemilikJaminanSeeder extends Seeder
|
|||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
$hubungan_pemilik_jaminan = [
|
$hubungan_pemilik_jaminan = [
|
||||||
[
|
['name' => 'Milik Pribadi'],
|
||||||
'name' => 'Milik Pribadi'
|
['name' => 'Suami'],
|
||||||
],
|
['name' => 'Anak'],
|
||||||
[
|
['name' => 'Saudara'],
|
||||||
'name' => 'Suami/Istri'
|
['name' => 'Ayah'],
|
||||||
],
|
['name' => 'Ibu'],
|
||||||
[
|
['name' => 'Nenek'],
|
||||||
'name' => 'Anak'
|
['name' => 'Penjual/Developer'],
|
||||||
],
|
[ 'name' => 'Kakak/adik kandung'],
|
||||||
[
|
[ 'name' => 'Orang tua'],
|
||||||
'name' => 'Saudara Kandung'
|
[ 'name' => 'Mitra Usaha'],
|
||||||
],
|
[ 'name' => 'Pihak lain'],
|
||||||
[
|
[ 'name' => 'Negara'],
|
||||||
'name' => 'Ayah'
|
[ 'name' => 'Nenek/kakek'],
|
||||||
],
|
[ 'name' => 'Milik Keluarga'],
|
||||||
[
|
[ 'name' => 'Kakak/adik Orangtua'],
|
||||||
'name' => 'Ibu'
|
[ 'name' => 'Istri'],
|
||||||
]
|
[ 'name' => 'Pengurus'],
|
||||||
|
[ 'name' => 'Lain - lain'],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($hubungan_pemilik_jaminan as $hpj) {
|
foreach ($hubungan_pemilik_jaminan as $hpj) {
|
||||||
|
|||||||
@@ -69,6 +69,49 @@ class JenisFasilitasKreditSeeder extends Seeder
|
|||||||
'created_at' => now(),
|
'created_at' => now(),
|
||||||
'updated_at' => now()
|
'updated_at' => now()
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'code' => 'JFK009',
|
||||||
|
'name' => 'UMKM',
|
||||||
|
'status' => 1,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now()
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'code' => 'JFK010',
|
||||||
|
'name' => 'KORPORASI',
|
||||||
|
'status' => 1,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now()
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'code' => 'JFK011',
|
||||||
|
'name' => 'KPR 2',
|
||||||
|
'status' => 1,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now()
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'code' => 'JFK012',
|
||||||
|
'name' => 'KONSUMER',
|
||||||
|
'status' => 1,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now()
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'code' => 'JFK013',
|
||||||
|
'name' => 'KOMERSIL',
|
||||||
|
'status' => 1,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now()
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'code' => 'JFK014',
|
||||||
|
'name' => 'KPR REGULER',
|
||||||
|
'status' => 1,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now()
|
||||||
|
],
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,36 +12,50 @@ class LpjDatabaseSeeder extends Seeder
|
|||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
$this->call([
|
$this->call([
|
||||||
BranchSeeder::class,
|
|
||||||
CurrencySeeder::class,
|
// BranchSeeder::class,
|
||||||
HolidayCalendarSeeder::class,
|
// CurrencySeeder::class,
|
||||||
JenisFasilitasKreditSeeder::class,
|
// HolidayCalendarSeeder::class,
|
||||||
JenisLegalitasJaminanSeeder::class,
|
// JenisFasilitasKreditSeeder::class,
|
||||||
JenisJaminanSeeder::class,
|
// JenisLegalitasJaminanSeeder::class,
|
||||||
JenisDokumenSeeder::class,
|
// JenisJaminanSeeder::class,
|
||||||
TujuanPenilaianSeeder::class,
|
// JenisDokumenSeeder::class,
|
||||||
NilaiPlatformSeeder::class,
|
// TujuanPenilaianSeeder::class,
|
||||||
HubunganPemilikJaminanSeeder::class,
|
// NilaiPlatformSeeder::class,
|
||||||
HubunganPenghuniJaminanSeeder::class,
|
// HubunganPemilikJaminanSeeder::class,
|
||||||
ArahMataAnginSeeder::class,
|
// HubunganPenghuniJaminanSeeder::class,
|
||||||
StatusPermohonanSeeder::class,
|
// ArahMataAnginSeeder::class,
|
||||||
RegionSeeder::class,
|
// StatusPermohonanSeeder::class,
|
||||||
TeamsSeeder::class,
|
// RegionSeeder::class,
|
||||||
TeamUsersSeeder::class,
|
// TeamsSeeder::class,
|
||||||
JenisPenilaianSeeder::class,
|
// TeamUsersSeeder::class,
|
||||||
IjinUsahaSeeder::class,
|
// MasterDataSurveyorSeeder::class
|
||||||
TujuanPenilaianKJPPSeeder::class,
|
// JenisPenilaianSeeder::class,
|
||||||
KJPPSeeder::class,
|
// IjinUsahaSeeder::class,
|
||||||
JenisLaporanSeeder::class,
|
// TujuanPenilaianKJPPSeeder::class,
|
||||||
DebitureSeeder::class,
|
// KJPPSeeder::class,
|
||||||
PemilikJaminanSeeder::class,
|
// JenisLaporanSeeder::class,
|
||||||
DokumenJaminanSeeder::class,
|
// DebitureSeeder::class,
|
||||||
DetailDokumenJaminanSeeder::class,
|
// PemilikJaminanSeeder::class,
|
||||||
PermohonanSeeder::class,
|
// DokumenJaminanSeeder::class,
|
||||||
FotoObjekJaminanSeeder::class,
|
// DetailDokumenJaminanSeeder::class,
|
||||||
|
// PermohonanSeeder::class,
|
||||||
|
// FotoObjekJaminanSeeder::class,
|
||||||
// PenawaranSeeder::class,
|
// PenawaranSeeder::class,
|
||||||
// DetailPenawaranSeeder::class,
|
// DetailPenawaranSeeder::class,
|
||||||
// PenilaianSeeder::class,
|
// PenilaianSeeder::class,
|
||||||
|
// MigrationDebitureSeeder::class,
|
||||||
|
// MigrationPermohonanSeeder::class,
|
||||||
|
// MigrationDokumentJaminanSeeder::class,
|
||||||
|
// MigrationDetailDokumenJaminanSeeder::class,
|
||||||
|
// MigPenilaianAndPenilainTeamSeeder::class,
|
||||||
|
// MigrationInpseksiSeeder::class,
|
||||||
|
MigrationGambarInspeksiSeeder::class,
|
||||||
|
// MigrationPembandingSeeder::class,
|
||||||
|
// MigrationPenilaiSeeder::class
|
||||||
|
|
||||||
|
// ini untuk penilaian external
|
||||||
|
// MigExternalPenawaranSeeder::class,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
45
database/seeders/MasterDataSurveyorSeeder.php
Normal file
45
database/seeders/MasterDataSurveyorSeeder.php
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Lpj\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class MasterDataSurveyorSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
|
||||||
|
$nameTable = [
|
||||||
|
'fasilitas_objek',
|
||||||
|
'gol_mas_sekitar',
|
||||||
|
'jenis_bangunan',
|
||||||
|
'jenis_kapal',
|
||||||
|
'jenis_kendaraan',
|
||||||
|
'jenis_pesawat',
|
||||||
|
'kondisi_bangunan',
|
||||||
|
'kondisi_fisik_tanah',
|
||||||
|
'kontur_tanah',
|
||||||
|
'lalu_lintas_lokasi',
|
||||||
|
'lantai',
|
||||||
|
'merupakan_daerah',
|
||||||
|
'perkerasan_jalan',
|
||||||
|
'sifat_bangunan',
|
||||||
|
'model_alat_berat',
|
||||||
|
'posisi_kavling',
|
||||||
|
'posisi_unit',
|
||||||
|
'tingkat_keramaian',
|
||||||
|
'sarana_pelengkap',
|
||||||
|
'spek_kategori_bangunan',
|
||||||
|
'spek_bangunan',
|
||||||
|
'terletak_diarea',
|
||||||
|
'view_unit'
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($nameTable as $table) {
|
||||||
|
DB::unprepared(file_get_contents(__DIR__ . '/sql/' . $table . '.sql'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
306
database/seeders/MigExternalPenawaranSeeder.php
Normal file
306
database/seeders/MigExternalPenawaranSeeder.php
Normal file
@@ -0,0 +1,306 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Lpj\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Modules\Lpj\Models\Permohonan;
|
||||||
|
use Modules\Lpj\Models\PenawaranTender;
|
||||||
|
use Modules\Usermanagement\Models\User;
|
||||||
|
use Modules\Lpj\Models\Penilaian;
|
||||||
|
use Modules\Lpj\Models\PenilaianTeam;
|
||||||
|
|
||||||
|
class MigExternalPenawaranSeeder extends Seeder
|
||||||
|
{
|
||||||
|
protected $errorLogFile = __DIR__ . '/csv/penawaran/mig_penawaran_external_error.csv';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
// Bersihkan/Inisialisasi file error log
|
||||||
|
$this->initializeErrorLog();
|
||||||
|
// Path ke file csv
|
||||||
|
$filePath = realpath(__DIR__ . '/csv/penawaran/mig_penawaran_external.csv');
|
||||||
|
|
||||||
|
if (!$filePath) {
|
||||||
|
Log::error('File csv tidak ditemukan: ' . __DIR__ . '/csv/permohonan/mig_penawaran_external.csv');
|
||||||
|
$this->command->error('File csv tidak ditemukan.');
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($handle = fopen($filePath, 'r')) === false) {
|
||||||
|
Log::error('Gagal membuka file CSV: ' . $filePath);
|
||||||
|
$this->command->error('Gagal membuka file CSV.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$header = fgetcsv($handle, 0, '~');
|
||||||
|
$rows = [];
|
||||||
|
$batchSize = 500; // Ukuran batch
|
||||||
|
$userDataChace = [];
|
||||||
|
$nomorRegisCahce = [];
|
||||||
|
$errorCount = 0; // Inisialisasi variabel errorCount
|
||||||
|
$errorDebitureIds = []; // Inisialisasi array errorDebitureIds
|
||||||
|
$totalData = 0;
|
||||||
|
|
||||||
|
// Menghitung total data di file CSV
|
||||||
|
while (($data = fgetcsv($handle, 0, '~')) !== false) {
|
||||||
|
$totalData++;
|
||||||
|
}
|
||||||
|
|
||||||
|
rewind($handle); // Reset pointer ke awal file
|
||||||
|
fgetcsv($handle, 0, '~'); // Skip header
|
||||||
|
|
||||||
|
$batchCount = 0;
|
||||||
|
$currentRow = 0;
|
||||||
|
|
||||||
|
while (($data = fgetcsv($handle, 0, '~')) !== false) {
|
||||||
|
if (count($data) != count($header)) {
|
||||||
|
Log::warning('Baris CSV memiliki jumlah kolom yang tidak sesuai: ' . json_encode($data));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows[] = array_combine($header, $data);
|
||||||
|
$currentRow++;
|
||||||
|
|
||||||
|
// Jika sudah mencapai batch size, proses batch
|
||||||
|
if (count($rows) >= $batchSize) {
|
||||||
|
$batchCount++;
|
||||||
|
$this->command->info("Memproses batch ke-{$batchCount} ({$currentRow}/{$totalData})");
|
||||||
|
$this->processBatch($rows, $nomorRegisCahce, $userDataChace, $errorCount, $errorDebitureIds, $totalData, $batchCount, $currentRow);
|
||||||
|
$rows = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Proses sisa data jika ada
|
||||||
|
// print_r($rows[0]);
|
||||||
|
if (!empty($rows)) {
|
||||||
|
$batchCount++;
|
||||||
|
$this->command->info("Memproses batch ke-{$batchCount} ({$currentRow}/{$totalData})");
|
||||||
|
$this->processBatch($rows, $nomorRegisCahce, $userDataChace, $errorCount, $errorDebitureIds, $totalData, $batchCount, $currentRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($handle);
|
||||||
|
|
||||||
|
$this->command->info("Data debiture berhasil dimigrasikan. Total data: {$totalData}, Total batch: {$batchCount}, Total error: {$errorCount}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function processBatch(
|
||||||
|
array $rows,
|
||||||
|
array &$userDataChace,
|
||||||
|
array &$nomorRegisCahce,
|
||||||
|
int &$errorCount,
|
||||||
|
array &$errorDebitureIds,
|
||||||
|
int $totalData,
|
||||||
|
int $batchCount,
|
||||||
|
int $currentRow
|
||||||
|
) {
|
||||||
|
$userData = [];
|
||||||
|
foreach ($rows as $index => $row) {
|
||||||
|
try {
|
||||||
|
// Jalankan setiap baris dengan transaksi sendiri
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
// Cek apakah sudah diproses
|
||||||
|
$existingRecord = PenawaranTender::where('nomor_registrasi', $row['mig_nomor_jaminan'])->first();
|
||||||
|
if ($existingRecord && $existingRecord->created_at) {
|
||||||
|
$this->command->info('Data sudah diproses sebelumnya: ' . $row['mig_nomor_jaminan']);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ambil nomor registrasi
|
||||||
|
$nomor_registrasi = $this->getNomorRegistrasiPermohonan($row['mig_nomor_jaminan'], $nomorRegisCahce);
|
||||||
|
if (!$nomor_registrasi) {
|
||||||
|
throw new \Exception("Nomor registrasi tidak valid");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$userIdUpdate = $this->getUserIdData($row['mig_created_by'] ?? null, $userData)['id'];
|
||||||
|
$userIdOtorisasi = $this->getUserIdData($row['mig_authorized_by'] ?? null, $userData)['id'];
|
||||||
|
|
||||||
|
if (!$userIdUpdate || !$userIdOtorisasi) {
|
||||||
|
// $this->logError($userIdUpdate, 'Salah satu user tidak ditemukan');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mapping field user
|
||||||
|
$mapUser = [
|
||||||
|
'created_by' => $userIdUpdate,
|
||||||
|
'updated_by' => $userIdUpdate,
|
||||||
|
'authorized_by' => $userIdOtorisasi,
|
||||||
|
];
|
||||||
|
|
||||||
|
// create random code
|
||||||
|
|
||||||
|
$tgl = $this->parseTimestamp($row['mig_tgl_penyerahan']);
|
||||||
|
|
||||||
|
// ambil nilai tahun terakhir contoh 2023 maka ambil 23
|
||||||
|
$year = date('y', strtotime($tgl));
|
||||||
|
|
||||||
|
// random code berdasarkan tgl contoh NP2300001
|
||||||
|
|
||||||
|
$code = 'NP' . $year . str_pad(rand(1, 99999), 5, '0', STR_PAD_LEFT); // outputnya NP2300001:
|
||||||
|
// Cek apakah kode sudah ada
|
||||||
|
$existingCode = PenawaranTender::where('code', $code)->first();
|
||||||
|
if ($existingCode) {
|
||||||
|
$code = 'NP' . $year . str_pad(rand(1, 99999), 5, '0', STR_PAD_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Buat penilaian
|
||||||
|
$penilaian = PenawaranTender::create([
|
||||||
|
'code' => $code,
|
||||||
|
'nama_kjpp_sebelumnya' => $row['mig_nama_kjpp'],
|
||||||
|
'biaya_kjpp_sebelumnya' => $row['mig_tot_jasa'],
|
||||||
|
'tanggal_penilaian_sebelumnya' => $this->parseTimestamp($row['mig_tgl_penyerahan']),
|
||||||
|
'nomor_registrasi' => $nomor_registrasi,
|
||||||
|
'tujuan_penilaian_kjpp_id' => $this->checkTujuanPenilaian($row['mig_mst_jaminan_kd_tujuan_seq']),
|
||||||
|
'jenis_laporan_id' => 1,
|
||||||
|
'start_date' => $this->parseTimestamp($row['mig_tgl_penyerahan']),
|
||||||
|
'end_date' => $this->parseTimestamp($row['mig_terima_laporan']),
|
||||||
|
'catatan' => $row['mig_catatan'],
|
||||||
|
'status' => 'spk',
|
||||||
|
'created_at' => $this->parseTimestamp($row['mig_created_at']),
|
||||||
|
'updated_at' => $this->parseTimestamp($row['mig_updated_at']),
|
||||||
|
'authorized_by' => $mapUser['authorized_by'],
|
||||||
|
'created_by' => $mapUser['created_by'],
|
||||||
|
'updated_by' => $mapUser['updated_by'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Commit transaksi
|
||||||
|
DB::commit();
|
||||||
|
$this->command->info('Proses data penilaian ' . $row['mig_nomor_jaminan'] . ' (' . ($index + 1) . '/' . count($rows) . ')');
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Rollback jika ada error
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error('Error pada baris: ' . json_encode($row) . '. Pesan: ' . $e->getMessage());
|
||||||
|
$errorCount++;
|
||||||
|
$errorDebitureIds[] = $row['mig_team_id'] ?? '-';
|
||||||
|
$this->logError($row['mig_team_id'] ?? '-', $e->getMessage());
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->command->info("Batch {$batchCount} selesai. Total error: " . count($errorDebitureIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function getNomorRegistrasiPermohonan($nomor_registrasi_id, $nomorRegisCahce)
|
||||||
|
{
|
||||||
|
if (isset($nomorRegisCahce[$nomor_registrasi_id])) {
|
||||||
|
return $nomorRegisCahce[$nomor_registrasi_id];
|
||||||
|
}
|
||||||
|
|
||||||
|
$nomorRegis = Permohonan::where('nomor_registrasi', $nomor_registrasi_id)->first();
|
||||||
|
|
||||||
|
if (!$nomorRegis) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$nomorRegisCahce[$nomor_registrasi_id] = $nomorRegis->nomor_registrasi;
|
||||||
|
return $nomorRegis->nomor_registrasi;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getUserIdData(?string $code, array &$cache): array
|
||||||
|
{
|
||||||
|
if (!$code) {
|
||||||
|
return ['id' => null, 'branch_id' => null];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($cache[$code])) {
|
||||||
|
return $cache[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = User::where('nik', $code)->first();
|
||||||
|
|
||||||
|
if ($user) {
|
||||||
|
$cache[$code] = ['id' => $user->id, 'branch_id' => $user->branch_id];
|
||||||
|
return $cache[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['id' => null, 'branch_id' => null];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getUserId($mig_user_id, $userDataChace)
|
||||||
|
{
|
||||||
|
if (isset($userDataChace[$mig_user_id])) {
|
||||||
|
return $userDataChace[$mig_user_id];
|
||||||
|
}
|
||||||
|
|
||||||
|
$userId = User::where('nik', $mig_user_id)->first();
|
||||||
|
|
||||||
|
if (!$userId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userDataChace[$mig_user_id] = $userId->id;
|
||||||
|
return $userId->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function parseTimestamp(?string $timestamp): ?string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if ($timestamp) {
|
||||||
|
// Cek jika format hanya tanggal (Y-m-d)
|
||||||
|
if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $timestamp)) {
|
||||||
|
return \Carbon\Carbon::createFromFormat('Y-m-d', $timestamp)
|
||||||
|
->startOfDay()
|
||||||
|
->toDateTimeString();
|
||||||
|
}
|
||||||
|
// Format lengkap (Y-m-d H:i:s)
|
||||||
|
return \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $timestamp)->toDateTimeString();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('Gagal memparsing timestamp: ' . $timestamp . '. Pesan: ' . $e->getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function initializeErrorLog()
|
||||||
|
{
|
||||||
|
// Jika file lama ada, hapus
|
||||||
|
if (file_exists($this->errorLogFile)) {
|
||||||
|
unlink($this->errorLogFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Buat file baru dengan header
|
||||||
|
$handle = fopen($this->errorLogFile, 'w');
|
||||||
|
fputcsv($handle, ['mig_kd_debitur_seq', 'Error']);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function logError(string $kode, string $message)
|
||||||
|
{
|
||||||
|
// Catat ke log
|
||||||
|
Log::error("Error migrasi debiture [$kode]: $message");
|
||||||
|
|
||||||
|
// Tulis ke file error
|
||||||
|
$handle = fopen($this->errorLogFile, 'a');
|
||||||
|
fputcsv($handle, [$kode, $message]);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkTujuanPenilaian($code): int
|
||||||
|
{
|
||||||
|
$mapping = [
|
||||||
|
1 => 7,
|
||||||
|
2 => 5,
|
||||||
|
3 => 8,
|
||||||
|
6 => 6,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $mapping[$code] ?? 7;
|
||||||
|
}
|
||||||
|
}
|
||||||
1036
database/seeders/MigInspeksiHelper.php
Normal file
1036
database/seeders/MigInspeksiHelper.php
Normal file
File diff suppressed because it is too large
Load Diff
350
database/seeders/MigPenilaianAndPenilainTeamSeeder.php
Normal file
350
database/seeders/MigPenilaianAndPenilainTeamSeeder.php
Normal file
@@ -0,0 +1,350 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Lpj\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Modules\Basicdata\Models\Branch;
|
||||||
|
use Modules\Lpj\Models\Penilaian;
|
||||||
|
use Modules\Usermanagement\Models\User;
|
||||||
|
use Modules\Lpj\Models\PenilaianTeam;
|
||||||
|
use Modules\Lpj\Models\Permohonan;
|
||||||
|
|
||||||
|
class MigPenilaianAndPenilainTeamSeeder extends Seeder
|
||||||
|
{
|
||||||
|
protected $errorLogFile = __DIR__ . '/csv/penilaian/penilaian.team.fix.new_20251012_error.csv';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
// Bersihkan/Inisialisasi file error log
|
||||||
|
$this->initializeErrorLog();
|
||||||
|
// Path ke file csv
|
||||||
|
$filePath = realpath(__DIR__ . '/csv/penilaian/penilaian.team.fix.new_20251012.csv');
|
||||||
|
|
||||||
|
if (!$filePath) {
|
||||||
|
Log::error('File csv tidak ditemukan: ' . __DIR__ . '/csv/penilaian/penilaian.team.fix.new_20251012.csv');
|
||||||
|
$this->command->error('File csv tidak ditemukan.');
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($handle = fopen($filePath, 'r')) === false) {
|
||||||
|
Log::error('Gagal membuka file CSV: ' . $filePath);
|
||||||
|
$this->command->error('Gagal membuka file CSV.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$header = fgetcsv($handle, 0, ',');
|
||||||
|
$rows = [];
|
||||||
|
$batchSize = 500; // Ukuran batch
|
||||||
|
$userDataChace = [];
|
||||||
|
$nomorRegisCahce = [];
|
||||||
|
$errorCount = 0; // Inisialisasi variabel errorCount
|
||||||
|
$errorDebitureIds = []; // Inisialisasi array errorDebitureIds
|
||||||
|
$totalData = 0;
|
||||||
|
|
||||||
|
// Menghitung total data di file CSV
|
||||||
|
while (($data = fgetcsv($handle, 0, ',')) !== false) {
|
||||||
|
$totalData++;
|
||||||
|
}
|
||||||
|
|
||||||
|
rewind($handle); // Reset pointer ke awal file
|
||||||
|
fgetcsv($handle, 0, ','); // Skip header
|
||||||
|
|
||||||
|
$batchCount = 0;
|
||||||
|
$currentRow = 0;
|
||||||
|
|
||||||
|
while (($data = fgetcsv($handle, 0, ',')) !== false) {
|
||||||
|
if (count($data) != count($header)) {
|
||||||
|
Log::warning('Baris CSV memiliki jumlah kolom yang tidak sesuai: ' . json_encode($data));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows[] = array_combine($header, $data);
|
||||||
|
$currentRow++;
|
||||||
|
|
||||||
|
// Jika sudah mencapai batch size, proses batch
|
||||||
|
if (count($rows) >= $batchSize) {
|
||||||
|
$batchCount++;
|
||||||
|
$this->command->info("Memproses batch ke-{$batchCount} ({$currentRow}/{$totalData})");
|
||||||
|
$this->processBatch($rows, $nomorRegisCahce, $userDataChace, $errorCount, $errorDebitureIds, $totalData, $batchCount, $currentRow);
|
||||||
|
$rows = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Proses sisa data jika ada
|
||||||
|
// print_r($rows[0]);
|
||||||
|
if (!empty($rows)) {
|
||||||
|
$batchCount++;
|
||||||
|
$this->command->info("Memproses batch ke-{$batchCount} ({$currentRow}/{$totalData})");
|
||||||
|
$this->processBatch($rows, $nomorRegisCahce, $userDataChace, $errorCount, $errorDebitureIds, $totalData, $batchCount, $currentRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($handle);
|
||||||
|
|
||||||
|
$this->command->info("Data debiture berhasil dimigrasikan. Total data: {$totalData}, Total batch: {$batchCount}, Total error: {$errorCount}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private function processBatch(
|
||||||
|
array $rows,
|
||||||
|
array &$userDataChace,
|
||||||
|
array &$nomorRegisCahce,
|
||||||
|
int &$errorCount,
|
||||||
|
array &$errorDebitureIds,
|
||||||
|
int $totalData,
|
||||||
|
int $batchCount,
|
||||||
|
int $currentRow
|
||||||
|
) {
|
||||||
|
$userData = [];
|
||||||
|
foreach ($rows as $index => $row) {
|
||||||
|
try {
|
||||||
|
// Jalankan setiap baris dengan transaksi sendiri
|
||||||
|
//DB::beginTransaction();
|
||||||
|
|
||||||
|
// Cek apakah sudah diproses
|
||||||
|
$existingRecord = Penilaian::where('nomor_registrasi', $row['mig_nomor_registrasi'])->first();
|
||||||
|
if ($existingRecord && $existingRecord->created_at) {
|
||||||
|
$this->command->info('Data sudah diproses sebelumnya: ' . $row['mig_nomor_registrasi']);
|
||||||
|
//continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ambil nomor registrasi
|
||||||
|
$nomor_registrasi = $this->getNomorRegistrasiPermohonan($row['mig_nomor_registrasi'], $nomorRegisCahce);
|
||||||
|
if (!$nomor_registrasi) {
|
||||||
|
throw new \Exception($row['mig_nomor_registrasi']."Nomor registrasi tidak valid");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ambil user ID
|
||||||
|
$userId = $this->getUserId($row['mig_user_id'], $userDataChace);
|
||||||
|
if (!$userId) {
|
||||||
|
// $this->logError($row['mig_user_id'], 'Salah satu user tidak ditemukan');
|
||||||
|
throw new \Exception($row['mig_user_id'] . " User tidak ditemukan");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userIdUpdate = $this->getUserIdData($row['mig_created_by'] ?? null, $userData)['id'];
|
||||||
|
$userIdOtorisasi = $this->getUserIdData($row['mig_authorized_by'] ?? null, $userData)['id'];
|
||||||
|
|
||||||
|
if (!$userIdUpdate || !$userIdOtorisasi) {
|
||||||
|
// $this->logError($userIdUpdate, 'Salah satu user tidak ditemukan');
|
||||||
|
//continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mapping field user
|
||||||
|
$mapUser = [
|
||||||
|
'created_by' => $userIdUpdate,
|
||||||
|
'updated_by' => $userIdUpdate,
|
||||||
|
'authorized_by' => $userIdOtorisasi,
|
||||||
|
];
|
||||||
|
|
||||||
|
// Ambil team ID
|
||||||
|
$teamId = $this->checkTeams($row['mig_team_id']);
|
||||||
|
if (!$teamId) {
|
||||||
|
throw new \Exception("Team tidak ditemukan");
|
||||||
|
}
|
||||||
|
|
||||||
|
$idPenilaian = Penilaian::orderBy('id', 'desc')->first()->id;
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'id' => $idPenilaian+1,
|
||||||
|
'nomor_registrasi' => $nomor_registrasi,
|
||||||
|
'jenis_penilaian_id' => 1,
|
||||||
|
'tanggal_kunjungan' => $this->parseTimestamp($row['mig_tanggal_kunjungan']) ?? now(),
|
||||||
|
'waktu_penilaian' => $this->parseTimestamp($row['mig_waktu_penilaian']),
|
||||||
|
'status' => 'done',
|
||||||
|
'keterangan' => null,
|
||||||
|
'created_at' => $this->parseTimestamp($row['mig_created_at']),
|
||||||
|
'updated_at' => $this->parseTimestamp($row['mig_updated_at']),
|
||||||
|
'authorized_by' => $mapUser['authorized_by'],
|
||||||
|
'created_by' => $mapUser['created_by'],
|
||||||
|
'updated_by' => $mapUser['updated_by']
|
||||||
|
];
|
||||||
|
|
||||||
|
if($nomor_registrasi=='251722'){
|
||||||
|
Log::info("Data penilaian 251722 : ",$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Buat penilaian
|
||||||
|
$penilaian = Penilaian::updateOrCreate([
|
||||||
|
'nomor_registrasi' => $nomor_registrasi
|
||||||
|
],[
|
||||||
|
'id' => $idPenilaian+1,
|
||||||
|
'nomor_registrasi' => $nomor_registrasi,
|
||||||
|
'jenis_penilaian_id' => 1,
|
||||||
|
'tanggal_kunjungan' => $this->parseTimestamp($row['mig_tanggal_kunjungan']) ?? now(),
|
||||||
|
'waktu_penilaian' => $this->parseTimestamp($row['mig_waktu_penilaian']),
|
||||||
|
'status' => 'done',
|
||||||
|
'keterangan' => null,
|
||||||
|
'created_at' => $this->parseTimestamp($row['mig_created_at']),
|
||||||
|
'updated_at' => $this->parseTimestamp($row['mig_updated_at']),
|
||||||
|
'authorized_by' => $mapUser['authorized_by'],
|
||||||
|
'created_by' => $mapUser['created_by'],
|
||||||
|
'updated_by' => $mapUser['updated_by'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
//DB::commit();
|
||||||
|
|
||||||
|
// Buat tim penilaian
|
||||||
|
$roles = ['surveyor', 'penilai'];
|
||||||
|
foreach ($roles as $role) {
|
||||||
|
$idPenilaianTeam = PenilaianTeam::orderBy('id', 'desc')->first()->id;
|
||||||
|
|
||||||
|
PenilaianTeam::updateOrCreate([
|
||||||
|
'penilaian_id' => $penilaian->id
|
||||||
|
],[
|
||||||
|
'id' => $idPenilaianTeam+1,
|
||||||
|
'penilaian_id' => $penilaian->id,
|
||||||
|
'user_id' => $userId,
|
||||||
|
'role' => $role,
|
||||||
|
'team_id' => $teamId,
|
||||||
|
'created_at' => $this->parseTimestamp($row['mig_created_at']),
|
||||||
|
'updated_at' => $this->parseTimestamp($row['mig_updated_at']),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit transaksi
|
||||||
|
//DB::commit();
|
||||||
|
$this->command->info('Proses data penilaian ' . $row['mig_nomor_lpj'] . ' (' . ($index + 1) . '/' . count($rows) . ')');
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Rollback jika ada error
|
||||||
|
//DB::rollBack();
|
||||||
|
|
||||||
|
Log::error('Error pada baris: ' . json_encode($row) . '. Pesan: ' . $e->getMessage());
|
||||||
|
$errorCount++;
|
||||||
|
$errorDebitureIds[] = $row['mig_team_id'] ?? '-';
|
||||||
|
$this->logError($row['mig_team_id'] ?? '-', $e->getMessage());
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->command->info("Batch {$batchCount} selesai. Total error: " . count($errorDebitureIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function getNomorRegistrasiPermohonan($nomor_registrasi_id, $nomorRegisCahce)
|
||||||
|
{
|
||||||
|
if (isset($nomorRegisCahce[$nomor_registrasi_id])) {
|
||||||
|
return $nomorRegisCahce[$nomor_registrasi_id];
|
||||||
|
}
|
||||||
|
|
||||||
|
$nomorRegis = Permohonan::where('nomor_registrasi', $nomor_registrasi_id)->first();
|
||||||
|
|
||||||
|
if (!$nomorRegis) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$nomorRegisCahce[$nomor_registrasi_id] = $nomorRegis->nomor_registrasi;
|
||||||
|
return $nomorRegis->nomor_registrasi;
|
||||||
|
}
|
||||||
|
private function getUserIdData(?string $code, array &$cache): array
|
||||||
|
{
|
||||||
|
if (!$code) {
|
||||||
|
return ['id' => null, 'branch_id' => null];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($cache[$code])) {
|
||||||
|
return $cache[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = User::where('nik', $code)->first();
|
||||||
|
|
||||||
|
if ($user) {
|
||||||
|
$cache[$code] = ['id' => $user->id, 'branch_id' => $user->branch_id];
|
||||||
|
return $cache[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['id' => null, 'branch_id' => null];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getUserId($mig_user_id, $userDataChace)
|
||||||
|
{
|
||||||
|
if (isset($userDataChace[$mig_user_id])) {
|
||||||
|
return $userDataChace[$mig_user_id];
|
||||||
|
}
|
||||||
|
|
||||||
|
$userId = User::where('nik', $mig_user_id)->first();
|
||||||
|
|
||||||
|
if (!$userId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userDataChace[$mig_user_id] = $userId->id;
|
||||||
|
return $userId->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkTeams($code): int
|
||||||
|
{
|
||||||
|
$mapping = [
|
||||||
|
'01' => 1,
|
||||||
|
'02' => 2,
|
||||||
|
'04' => 4,
|
||||||
|
'07' => 5,
|
||||||
|
'06' => 3,
|
||||||
|
];
|
||||||
|
return $mapping[(string)$code] ?? 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function parseTimestamp(?string $timestamp): ?string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if ($timestamp) {
|
||||||
|
// Cek jika format hanya tanggal (Y-m-d)
|
||||||
|
if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $timestamp)) {
|
||||||
|
return \Carbon\Carbon::createFromFormat('Y-m-d', $timestamp)
|
||||||
|
->startOfDay()
|
||||||
|
->toDateTimeString();
|
||||||
|
}
|
||||||
|
// Format lengkap (Y-m-d H:i:s)
|
||||||
|
if (preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/', $timestamp)) {
|
||||||
|
return \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $timestamp)->toDateTimeString();
|
||||||
|
}
|
||||||
|
// Format d/m/Y H:i:s (contoh: 28/4/2017 14:43:43)
|
||||||
|
if (preg_match('/^\d{1,2}\/\d{1,2}\/\d{4} \d{2}:\d{2}:\d{2}$/', $timestamp)) {
|
||||||
|
return \Carbon\Carbon::createFromFormat('d/m/Y H:i:s', $timestamp)->toDateTimeString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('Gagal memparsing timestamp: ' . $timestamp . '. Pesan: ' . $e->getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function initializeErrorLog()
|
||||||
|
{
|
||||||
|
// Jika file lama ada, hapus
|
||||||
|
if (file_exists($this->errorLogFile)) {
|
||||||
|
unlink($this->errorLogFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Buat file baru dengan header
|
||||||
|
$handle = fopen($this->errorLogFile, 'w');
|
||||||
|
fputcsv($handle, ['mig_kd_debitur_seq', 'Error']);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function logError(string $kode, string $message)
|
||||||
|
{
|
||||||
|
// Catat ke log
|
||||||
|
Log::error("Error migrasi debiture [$kode]: $message");
|
||||||
|
|
||||||
|
// Tulis ke file error
|
||||||
|
$handle = fopen($this->errorLogFile, 'a');
|
||||||
|
fputcsv($handle, [$kode, $message]);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
255
database/seeders/MigrationDebitureSeeder.php
Normal file
255
database/seeders/MigrationDebitureSeeder.php
Normal file
@@ -0,0 +1,255 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Lpj\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Modules\Basicdata\Models\Branch;
|
||||||
|
use Modules\Lpj\Models\Debiture;
|
||||||
|
use Modules\Usermanagement\Models\User;
|
||||||
|
|
||||||
|
|
||||||
|
class MigrationDebitureSeeder extends Seeder
|
||||||
|
{
|
||||||
|
protected $errorLogFile = __DIR__ . '/csv/debitures/error_migration.csv';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
// Bersihkan/Inisialisasi file error log
|
||||||
|
$this->initializeErrorLog();
|
||||||
|
|
||||||
|
// Path ke file csv
|
||||||
|
$filePath = realpath(__DIR__ . '/csv/debitures/debitur.latest.csv');
|
||||||
|
|
||||||
|
if (!$filePath) {
|
||||||
|
Log::error('File csv tidak ditemukan: ' . __DIR__ . '/csv/debitures/debitur.latest.csv');
|
||||||
|
$this->command->error('File csv tidak ditemukan.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($handle = fopen($filePath, 'r')) === false) {
|
||||||
|
Log::error('Gagal membuka file CSV: ' . $filePath);
|
||||||
|
$this->command->error('Gagal membuka file CSV.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$header = fgetcsv($handle, 0, '|');
|
||||||
|
$rows = [];
|
||||||
|
$batchSize = 500;
|
||||||
|
$userData = [];
|
||||||
|
$branchCache = [];
|
||||||
|
$totalData = 0;
|
||||||
|
|
||||||
|
// Hitung total baris
|
||||||
|
while (($data = fgetcsv($handle, 0, '|')) !== false) {
|
||||||
|
$totalData++;
|
||||||
|
}
|
||||||
|
|
||||||
|
rewind($handle);
|
||||||
|
fgetcsv($handle, 0, '|'); // Lewati header
|
||||||
|
|
||||||
|
$currentRow = 0;
|
||||||
|
$batchCount = 0;
|
||||||
|
|
||||||
|
while (($data = fgetcsv($handle, 0, '|')) !== false) {
|
||||||
|
if (count($data) != count($header)) {
|
||||||
|
$this->logError($data[0] ?? '-', 'Jumlah kolom tidak sesuai');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows[] = array_combine($header, $data);
|
||||||
|
$currentRow++;
|
||||||
|
|
||||||
|
if (count($rows) >= $batchSize) {
|
||||||
|
$batchCount++;
|
||||||
|
$this->command->info("Memproses batch ke-{$batchCount} ({$currentRow}/{$totalData})");
|
||||||
|
$this->processBatch($rows, $branchCache, $userData);
|
||||||
|
$rows = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// print_r($rows);
|
||||||
|
if (!empty($rows)) {
|
||||||
|
$batchCount++;
|
||||||
|
$this->command->info("Memproses batch ke-{$batchCount} ({$currentRow}/{$totalData})");
|
||||||
|
$this->processBatch($rows, $branchCache, $userData);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($handle);
|
||||||
|
|
||||||
|
$this->command->info("Data debiture berhasil dimigrasikan. Total data: {$totalData}, Total batch: {$batchCount}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function processBatch(array $rows, array &$branchCache, array &$userData)
|
||||||
|
{
|
||||||
|
foreach ($rows as $index => $row) {
|
||||||
|
try {
|
||||||
|
$kode = $row['mig_kd_debitur_seq'] ?? '-';
|
||||||
|
|
||||||
|
// Cek apakah sudah diproses sebelumnya
|
||||||
|
$existingRecord = Debiture::where('mig_kd_debitur_seq', $kode)->first();
|
||||||
|
if ($existingRecord && $existingRecord->processed_at) {
|
||||||
|
$this->command->info("Data sudah diproses sebelumnya: $kode");
|
||||||
|
//continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ambil branch_id
|
||||||
|
$branchId = $this->getBranchId($row['mig_kd_cabang'] ?? null, $branchCache);
|
||||||
|
if (!$branchId) {
|
||||||
|
$this->logError($row['mig_kd_cabang'], 'Cabang tidak ditemukan');
|
||||||
|
//continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ambil user IDs berdasarkan NIK
|
||||||
|
$userIdUpdate = $this->getUserId($row['mig_user_update'] ?? null, $userData)['id'];
|
||||||
|
$userIdOtorisasi = $this->getUserId($row['mig_user_oto'] ?? null, $userData)['id'];
|
||||||
|
|
||||||
|
// if (!$userIdUpdate || !$userIdOtorisasi) {
|
||||||
|
// $this->logError($kode, 'Salah satu user tidak ditemukan');
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Mapping field user
|
||||||
|
$mapUser = [
|
||||||
|
'created_by' => $userIdUpdate,
|
||||||
|
'updated_by' => $userIdUpdate,
|
||||||
|
'authorized_by' => $userIdOtorisasi,
|
||||||
|
];
|
||||||
|
|
||||||
|
// Parsing nomor HP
|
||||||
|
$nomorHp = !empty($row['mig_phone']) ? preg_replace('/[^0-9]/', '', $row['mig_phone']) : null;
|
||||||
|
$email = !empty($row['email']) ? $row['email'] : null;
|
||||||
|
$nomorId = !empty($row['nomor_id']) ? $row['nomor_id'] : null;
|
||||||
|
|
||||||
|
// Parsing waktu
|
||||||
|
$authorizedAt = $this->parseTimestamp($row['mig_tgl_oto'] ?? null);
|
||||||
|
$createdAt = $this->parseTimestamp($row['created_at'] ?? null);
|
||||||
|
$updatedAt = $this->parseTimestamp($row['updated_at'] ?? null);
|
||||||
|
|
||||||
|
if (!$createdAt || !$updatedAt) {
|
||||||
|
$this->logError($kode, 'Gagal parsing created_at / updated_at');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simpan data
|
||||||
|
Debiture::updateOrCreate([
|
||||||
|
'mig_kd_debitur_seq' => (int) strtok($row['mig_kd_debitur_seq'], '.'),
|
||||||
|
], [
|
||||||
|
'branch_id' => $branchId,
|
||||||
|
'name' => $row['name'] ?? '',
|
||||||
|
'cif' => (int) strtok($row['cif'],'.') ?: '0000000000',
|
||||||
|
'phone' => $nomorHp,
|
||||||
|
'nomor_id' => $nomorId,
|
||||||
|
'email' => $email,
|
||||||
|
'npwp' => null,
|
||||||
|
'address' => $row['address'] ?? null,
|
||||||
|
'authorized_at' => $authorizedAt,
|
||||||
|
'authorized_by' => $mapUser['authorized_by'],
|
||||||
|
'created_by' => $mapUser['created_by'] ?? null,
|
||||||
|
'updated_by' => $mapUser['updated_by'] ?? null,
|
||||||
|
'created_at' => $createdAt,
|
||||||
|
'updated_at' => $updatedAt,
|
||||||
|
'mig_kd_debitur_seq' => (int) strtok($row['mig_kd_debitur_seq'], '.'),
|
||||||
|
'processed_at' => now(),
|
||||||
|
'mig_debitur' => json_encode($row),
|
||||||
|
'is_mig' => 1
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->command->info("Proses data debiture $kode (" . ($index + 1) . '/' . count($rows) . ')');
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->logError($row['mig_kd_debitur_seq'] ?? '-', "Error eksepsi: " . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getBranchId(?string $code, array &$cache): ?int
|
||||||
|
{
|
||||||
|
if (!$code) return null;
|
||||||
|
|
||||||
|
if (isset($cache[$code])) {
|
||||||
|
return $cache[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
$branch = Branch::where('code', $code)->first();
|
||||||
|
|
||||||
|
if ($branch) {
|
||||||
|
$cache[$code] = $branch->id;
|
||||||
|
return $branch->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getUserId(?string $code, array &$cache): array
|
||||||
|
{
|
||||||
|
if (!$code) return ['id' => null, 'branch_id' => null];
|
||||||
|
|
||||||
|
if (isset($cache[$code])) {
|
||||||
|
return $cache[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = User::where('nik', $code)->first();
|
||||||
|
|
||||||
|
if ($user) {
|
||||||
|
$cache[$code] = ['id' => $user->id, 'branch_id' => $user->branch_id];
|
||||||
|
return $cache[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['id' => null, 'branch_id' => null];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function parseTimestamp(?string $timestamp): ?string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if ($timestamp) {
|
||||||
|
// Cek jika format hanya tanggal (Y-m-d)
|
||||||
|
if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $timestamp)) {
|
||||||
|
return \Carbon\Carbon::createFromFormat('Y-m-d', $timestamp)
|
||||||
|
->startOfDay()
|
||||||
|
->toDateTimeString();
|
||||||
|
}
|
||||||
|
// Format lengkap (Y-m-d H:i:s)
|
||||||
|
if (preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/', $timestamp)) {
|
||||||
|
return \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $timestamp)->toDateTimeString();
|
||||||
|
}
|
||||||
|
// Format d/m/Y H:i:s (contoh: 28/4/2017 14:43:43)
|
||||||
|
if (preg_match('/^\d{1,2}\/\d{1,2}\/\d{4} \d{2}:\d{2}:\d{2}$/', $timestamp)) {
|
||||||
|
return \Carbon\Carbon::createFromFormat('d/m/Y H:i:s', $timestamp)->toDateTimeString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('Gagal memparsing timestamp: ' . $timestamp . '. Pesan: ' . $e->getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function initializeErrorLog()
|
||||||
|
{
|
||||||
|
// Jika file lama ada, hapus
|
||||||
|
if (file_exists($this->errorLogFile)) {
|
||||||
|
unlink($this->errorLogFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Buat file baru dengan header
|
||||||
|
$handle = fopen($this->errorLogFile, 'w');
|
||||||
|
fputcsv($handle, ['mig_kd_debitur_seq', 'Error']);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function logError(string $kode, string $message)
|
||||||
|
{
|
||||||
|
// Catat ke log
|
||||||
|
Log::error("Error migrasi debiture [$kode]: $message");
|
||||||
|
|
||||||
|
// Tulis ke file error
|
||||||
|
$handle = fopen($this->errorLogFile, 'a');
|
||||||
|
fputcsv($handle, [$kode, $message]);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
356
database/seeders/MigrationDetailDokumenJaminanSeeder.php
Normal file
356
database/seeders/MigrationDetailDokumenJaminanSeeder.php
Normal file
@@ -0,0 +1,356 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Lpj\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Modules\Lpj\Models\Debiture;
|
||||||
|
use Modules\Location\Models\City;
|
||||||
|
use Modules\Location\Models\District;
|
||||||
|
use Modules\Location\Models\Province;
|
||||||
|
use Modules\Location\Models\Village;
|
||||||
|
use Modules\Lpj\Models\DokumenJaminan;
|
||||||
|
use Modules\Lpj\Models\Permohonan;
|
||||||
|
use Modules\Lpj\Models\JenisJaminan;
|
||||||
|
use Modules\Lpj\Models\JenisLegalitasJaminan;
|
||||||
|
use Modules\Lpj\Models\PemilikJaminan;
|
||||||
|
use Modules\Lpj\Models\DetailDokumenJaminan;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class MigrationDetailDokumenJaminanSeeder extends Seeder
|
||||||
|
{
|
||||||
|
protected $errorLogFile = __DIR__ . '/csv/detail.dokumen.jaminan_20251016_error.csv';
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$this->initializeErrorLog();
|
||||||
|
// Path ke file csv
|
||||||
|
$filePath = realpath(__DIR__ . '/csv/detail.dokumen.jaminan_20251016.csv');
|
||||||
|
|
||||||
|
if (!$filePath) {
|
||||||
|
Log::error('File csv tidak ditemukan: ' . __DIR__ . '/csv/detail.dokumen.jaminan_20251016.csv');
|
||||||
|
$this->command->error('File csv tidak ditemukan.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($handle = fopen($filePath, 'r')) === false) {
|
||||||
|
Log::error('Gagal membuka file CSV: ' . $filePath);
|
||||||
|
$this->command->error('Gagal membuka file CSV.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$header = fgetcsv($handle, 0, ',');
|
||||||
|
$rows = [];
|
||||||
|
$batchSize = 1000; // Ukuran batch
|
||||||
|
$permohonanCache = [];
|
||||||
|
$jenisJaminanCache = [];
|
||||||
|
$dokumenJaminanCache = [];
|
||||||
|
$provinceCache = [];
|
||||||
|
$cityCache = [];
|
||||||
|
$districtCache = [];
|
||||||
|
$subdistrictCache = [];
|
||||||
|
$totalData = 0;
|
||||||
|
$errorCount = 0;
|
||||||
|
$errorDebitureIds = [];
|
||||||
|
$hubunganPemilikCache = [];
|
||||||
|
|
||||||
|
// Menghitung total data di file CSV
|
||||||
|
while (($data = fgetcsv($handle, 0, ',')) !== false) {
|
||||||
|
$totalData++;
|
||||||
|
}
|
||||||
|
|
||||||
|
rewind($handle); // Reset pointer ke awal file
|
||||||
|
fgetcsv($handle, 0, ','); // Skip header
|
||||||
|
|
||||||
|
$batchCount = 0;
|
||||||
|
$currentRow = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Membaca setiap baris dalam CSV
|
||||||
|
while (($data = fgetcsv($handle, 0, ',')) !== false) {
|
||||||
|
if (count($data) != count($header)) {
|
||||||
|
Log::warning('Baris CSV memiliki jumlah kolom yang tidak sesuai: ' . json_encode($data));
|
||||||
|
$errorCount++;
|
||||||
|
$errorDebitureIds[] = $data[0] ?? 'ID tidak valid'; // Menyimpan ID yang error
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows[] = array_combine($header, $data);
|
||||||
|
$currentRow++;
|
||||||
|
|
||||||
|
// print_r($rows);
|
||||||
|
|
||||||
|
|
||||||
|
if (count($rows) >= $batchSize) {
|
||||||
|
$errorDebitureIds[] = $data[0] ?? 'ID tidak valid'; // Menyimpan ID yang error
|
||||||
|
$this->processBatch($rows, $permohonanCache, $jenisJaminanCache, $dokumenJaminanCache, $batchCount, $currentRow, $totalData, $errorCount, $errorDebitureIds);
|
||||||
|
$rows = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// print_r($rows[0]);
|
||||||
|
if (!empty($rows)) {
|
||||||
|
$this->processBatch($rows, $permohonanCache, $jenisJaminanCache, $dokumenJaminanCache, $batchCount, $currentRow, $totalData, $errorCount, $errorDebitureIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($handle);
|
||||||
|
|
||||||
|
$this->command->info('Data debiture berhasil dimigrasikan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function processBatch(
|
||||||
|
array $rows,
|
||||||
|
array &$permohonanCache,
|
||||||
|
array &$jenisJaminanCache,
|
||||||
|
array &$dokumenJaminanCache,
|
||||||
|
int $batchCount,
|
||||||
|
int $currentRow,
|
||||||
|
int $totalData,
|
||||||
|
int &$errorCount,
|
||||||
|
array &$errorDebitureIds
|
||||||
|
) {
|
||||||
|
$groupedRows = $this->groupRowsByNomorLaporanAndKeterangan($rows);
|
||||||
|
|
||||||
|
// print_r($groupedRows);
|
||||||
|
|
||||||
|
foreach ($groupedRows as $nomorLaporan => $dataPerGrup) {
|
||||||
|
|
||||||
|
// print_r($dataPerGrup);
|
||||||
|
try {
|
||||||
|
// Ambil salah satu baris untuk referensi (misal baris pertama dari grup)
|
||||||
|
$firstRow = reset($dataPerGrup)['details'] ? reset($dataPerGrup) : reset($dataPerGrup);
|
||||||
|
$debiturId = null;
|
||||||
|
$nomorJaminan = null;
|
||||||
|
|
||||||
|
|
||||||
|
// Cari debitur ID dari salah satu field
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
if ($row['mig_nomor_laporan'] == $nomorLaporan) {
|
||||||
|
$debiturId = $row['mig_kd_debitur_seq'] ?? null;
|
||||||
|
$nomorJaminan = $row['mig_nomor_jaminan'] ?? null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$debiturId) {
|
||||||
|
throw new \Exception('Debitur ID tidak ditemukan');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Ambil ID dokumen jaminan
|
||||||
|
$dokumenJaminanId = $this->getDokumenJaminanId($debiturId,$nomorJaminan, $dokumenJaminanCache);
|
||||||
|
if (!$dokumenJaminanId) {
|
||||||
|
throw new \Exception('Dokumen jaminan tidak ditemukan');
|
||||||
|
}
|
||||||
|
|
||||||
|
//dd($debiturId,$nomorJaminan);
|
||||||
|
|
||||||
|
foreach ($dataPerGrup as $groupKey => $rowData) {
|
||||||
|
// Ambil legalitas jaminan ID berdasarkan grup keterangan
|
||||||
|
$legalitasJaminanId = $this->getLegalitasJaminanId($groupKey, $jenisJaminanCache);
|
||||||
|
|
||||||
|
if (!$legalitasJaminanId) {
|
||||||
|
throw new \Exception("Legalitas jaminan tidak ditemukan untuk grup: {$groupKey}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Simpan ke database
|
||||||
|
$detail =DetailDokumenJaminan::updateOrCreate(
|
||||||
|
[
|
||||||
|
'name' => $groupKey,
|
||||||
|
'dokumen_jaminan_id' => $dokumenJaminanId,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'details' => json_encode($rowData['details']),
|
||||||
|
'jenis_legalitas_jaminan_id' => $legalitasJaminanId,
|
||||||
|
'dokumen_jaminan' => !empty($rowData['documents']) ? json_encode($rowData['documents']) : null,
|
||||||
|
'dokumen_nomor' => $nomorLaporan,
|
||||||
|
'keterangan' => $groupKey,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if($nomorJaminan=='253339'){
|
||||||
|
//dd($debiturId,$nomorJaminan,$legalitasJaminanId, $detail, $dokumenJaminanId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info progress
|
||||||
|
$this->command->info("Proses data detail dokumen (Nomor Laporan: {$nomorLaporan}, batch ke: {$batchCount}, total dari: {$currentRow}/{$totalData})");
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error("Error pada nomor laporan {$nomorLaporan}: " . $e->getMessage());
|
||||||
|
$this->logError($debiturId ?? '-', $e->getMessage());
|
||||||
|
$errorDebitureIds[] = $debiturId ?? '-';
|
||||||
|
$errorCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function groupRowsByNomorLaporann(array $rows): array
|
||||||
|
{
|
||||||
|
$grouped = [];
|
||||||
|
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$nomorJaminan = $row['mig_nomor_laporan'] ?? null;
|
||||||
|
if (!empty($nomorJaminan)) {
|
||||||
|
$grouped[$nomorJaminan][] = $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $grouped;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// private function groupRowsByNomorLaporanAndKeterangan(array $rows): array
|
||||||
|
// {
|
||||||
|
// $groupedByNomorLaporan = $this->groupRowsByNomorLaporann($rows);
|
||||||
|
// $finalGrouped = [];
|
||||||
|
|
||||||
|
// foreach ($groupedByNomorLaporan as $nomorLaporan => $rowList) {
|
||||||
|
// $groupedByGrpKeterangan = [];
|
||||||
|
|
||||||
|
// // Urutkan berdasarkan mig_urutan_sub (ascending)
|
||||||
|
// usort($rowList, function ($a, $b) {
|
||||||
|
// return $a['mig_urutan_sub'] <=> $b['mig_urutan_sub'];
|
||||||
|
// });
|
||||||
|
|
||||||
|
// foreach ($rowList as $row) {
|
||||||
|
// $grpKeterangan = $row['mig_grp_keterangan'] ?? 'UNKNOWN_GROUP';
|
||||||
|
|
||||||
|
// if (!isset($groupedByGrpKeterangan[$grpKeterangan])) {
|
||||||
|
// $groupedByGrpKeterangan[$grpKeterangan] = [
|
||||||
|
// 'details' => [],
|
||||||
|
// 'documents' => []
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $keyKeterangan = $row['mig_key_keterangan'] ?? 'UNKNOWN_KEY';
|
||||||
|
// $value = $row['mig_nilai'] ?? null;
|
||||||
|
|
||||||
|
// // Jika belum ada detail, inisialisasi sebagai array asosiatif
|
||||||
|
// if (empty($groupedByGrpKeterangan[$grpKeterangan]['details'])) {
|
||||||
|
// $groupedByGrpKeterangan[$grpKeterangan]['details'][] = [];
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Masukkan ke dalam object tunggal (bukan item baru)
|
||||||
|
// if ($value !== null) {
|
||||||
|
// $lastIndex = count($groupedByGrpKeterangan[$grpKeterangan]['details']) - 1;
|
||||||
|
// $groupedByGrpKeterangan[$grpKeterangan]['details'][$lastIndex][$keyKeterangan] = $value;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Tambahkan dokumen jika ada
|
||||||
|
// $urlFile = $row['mig_url_file'] ?? null;
|
||||||
|
// if (!empty($urlFile)) {
|
||||||
|
// $groupedByGrpKeterangan[$grpKeterangan]['documents'][] = $urlFile;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $finalGrouped[$nomorLaporan] = $groupedByGrpKeterangan;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // print_r($finalGrouped);
|
||||||
|
// return $finalGrouped;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
private function groupRowsByNomorLaporanAndKeterangan(array $rows): array
|
||||||
|
{
|
||||||
|
$groupedByNomorLaporan = $this->groupRowsByNomorLaporann($rows);
|
||||||
|
$finalGrouped = [];
|
||||||
|
|
||||||
|
foreach ($groupedByNomorLaporan as $nomorLaporan => $rowList) {
|
||||||
|
$groupedByGrpKeterangan = [];
|
||||||
|
|
||||||
|
// Urutkan berdasarkan mig_urutan_sub
|
||||||
|
usort($rowList, function ($a, $b) {
|
||||||
|
return $a['mig_urutan_sub'] <=> $b['mig_urutan_sub'];
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach ($rowList as $row) {
|
||||||
|
$grpKeterangan = $row['mig_grp_keterangan'] ?? 'UNKNOWN_GROUP';
|
||||||
|
$keyKeterangan = $row['mig_key_keterangan'] ?? 'UNKNOWN_KEY';
|
||||||
|
$value = $row['mig_nilai'] ?? null;
|
||||||
|
|
||||||
|
if (!isset($groupedByGrpKeterangan[$grpKeterangan])) {
|
||||||
|
$groupedByGrpKeterangan[$grpKeterangan] = [
|
||||||
|
'details' => [],
|
||||||
|
'documents' => []
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Masukkan sebagai object baru ke dalam details
|
||||||
|
if ($value !== null) {
|
||||||
|
$groupedByGrpKeterangan[$grpKeterangan]['details'][] = [
|
||||||
|
$keyKeterangan => $value
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dokumen tetap masuk sebagai array string
|
||||||
|
$urlFile = $row['mig_url_file'] ?? null;
|
||||||
|
if (!empty($urlFile)) {
|
||||||
|
$groupedByGrpKeterangan[$grpKeterangan]['documents'][] = $urlFile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$finalGrouped[$nomorLaporan] = $groupedByGrpKeterangan;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $finalGrouped;
|
||||||
|
}
|
||||||
|
private function getDokumenJaminanId(string $code,string $nomorLaporan, array &$dokumenJaminanCache)
|
||||||
|
{
|
||||||
|
$dokumen = DokumenJaminan::where('mig_kd_debitur_seq', $code)
|
||||||
|
->where('nomor_lpj', $nomorLaporan)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($dokumen) {
|
||||||
|
$dokumenJaminanCache[$code] = $dokumen->id;
|
||||||
|
return $dokumen->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getLegalitasJaminanId(string $code, array &$legalitasJaminanCache)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (isset($legalitasJaminanCache[$code])) {
|
||||||
|
return $legalitasJaminanCache[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
$legalitas = JenisLegalitasJaminan::whereRaw('LOWER(name) = ?', [strtolower($code)])->first();
|
||||||
|
|
||||||
|
if ($legalitas) {
|
||||||
|
$legalitasJaminanCache[$code] = $legalitas->id;
|
||||||
|
return $legalitas->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function initializeErrorLog()
|
||||||
|
{
|
||||||
|
$file = $this->errorLogFile;
|
||||||
|
|
||||||
|
if (file_exists($file)) {
|
||||||
|
unlink($file); // Hapus file lama
|
||||||
|
}
|
||||||
|
|
||||||
|
$handle = fopen($file, 'w');
|
||||||
|
fputcsv($handle, ['mig_kd_debitur_seq', 'Error']);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function logError(string $kode, string $message)
|
||||||
|
{
|
||||||
|
Log::error("Error migrasi dokumen jaminan [$kode]: $message");
|
||||||
|
|
||||||
|
$handle = fopen($this->errorLogFile, 'a');
|
||||||
|
fputcsv($handle, [$kode, $message]);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
508
database/seeders/MigrationDokumentJaminanSeeder.php
Normal file
508
database/seeders/MigrationDokumentJaminanSeeder.php
Normal file
@@ -0,0 +1,508 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Lpj\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Modules\Lpj\Models\Debiture;
|
||||||
|
use Modules\Location\Models\City;
|
||||||
|
use Modules\Location\Models\District;
|
||||||
|
use Modules\Location\Models\Province;
|
||||||
|
use Modules\Location\Models\Village;
|
||||||
|
use Modules\Lpj\Models\DokumenJaminan;
|
||||||
|
use Modules\Lpj\Models\Permohonan;
|
||||||
|
use Modules\Lpj\Models\JenisJaminan;
|
||||||
|
use Modules\Lpj\Models\PemilikJaminan;
|
||||||
|
use Modules\Lpj\Models\HubunganPemilikJaminan;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
|
||||||
|
class MigrationDokumentJaminanSeeder extends Seeder
|
||||||
|
{
|
||||||
|
protected $errorLogFile = __DIR__ . '/csv/dokumen_20251022_error_log.csv';
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$this->initializeErrorLog();
|
||||||
|
// Path ke file csv
|
||||||
|
$filePath = realpath(__DIR__ . '/csv/dokumen_20251022.csv');
|
||||||
|
|
||||||
|
if (!$filePath) {
|
||||||
|
Log::error('File csv tidak ditemukan: ' . __DIR__ . '/csv/dokumen_20251022.csv');
|
||||||
|
$this->command->error('File csv tidak ditemukan.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($handle = fopen($filePath, 'r')) === false) {
|
||||||
|
Log::error('Gagal membuka file CSV: ' . $filePath);
|
||||||
|
$this->command->error('Gagal membuka file CSV.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$header = fgetcsv($handle, 0, ',');
|
||||||
|
$rows = [];
|
||||||
|
$batchSize = 1000; // Ukuran batch
|
||||||
|
$permohonanCache = [];
|
||||||
|
$jenisJaminanCache = [];
|
||||||
|
$pemilikJaminanCache = [];
|
||||||
|
$provinceCache = [];
|
||||||
|
$cityCache = [];
|
||||||
|
$districtCache = [];
|
||||||
|
$subdistrictCache = [];
|
||||||
|
$totalData = 0;
|
||||||
|
$errorCount = 0;
|
||||||
|
$errorDebitureIds = [];
|
||||||
|
$hubunganPemilikCache = [];
|
||||||
|
// Menghitung total data di file CSV
|
||||||
|
while (($data = fgetcsv($handle, 0, ',')) !== false) {
|
||||||
|
$totalData++;
|
||||||
|
}
|
||||||
|
|
||||||
|
rewind($handle); // Reset pointer ke awal file
|
||||||
|
fgetcsv($handle, 0, ','); // Skip header
|
||||||
|
|
||||||
|
$batchCount = 0;
|
||||||
|
$currentRow = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Membaca setiap baris dalam CSV
|
||||||
|
while (($data = fgetcsv($handle, 0, ',')) !== false) {
|
||||||
|
if (count($data) != count($header)) {
|
||||||
|
Log::warning('Baris CSV memiliki jumlah kolom yang tidak sesuai: ' . json_encode($data));
|
||||||
|
$errorCount++;
|
||||||
|
$errorDebitureIds[] = $data[0] ?? 'ID tidak valid'; // Menyimpan ID yang error
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows[] = array_combine($header, $data);
|
||||||
|
$currentRow++;
|
||||||
|
|
||||||
|
// print_r($rows);
|
||||||
|
|
||||||
|
|
||||||
|
if (count($rows) >= $batchSize) {
|
||||||
|
$errorDebitureIds[] = $data[0] ?? 'ID tidak valid'; // Menyimpan ID yang error
|
||||||
|
$this->processBatch($rows, $permohonanCache, $jenisJaminanCache, $pemilikJaminanCache, $provinceCache, $cityCache, $districtCache, $subdistrictCache, $batchCount, $currentRow, $totalData, $errorCount, $errorDebitureIds, $hubunganPemilikCache);
|
||||||
|
$rows = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// print_r($rows[0]);
|
||||||
|
if (!empty($rows)) {
|
||||||
|
$this->processBatch($rows, $permohonanCache, $jenisJaminanCache, $pemilikJaminanCache, $provinceCache, $cityCache, $districtCache, $subdistrictCache, $batchCount, $currentRow, $totalData, $errorCount, $errorDebitureIds, $hubunganPemilikCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($handle);
|
||||||
|
|
||||||
|
$this->command->info('Data debiture berhasil dimigrasikan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Proses batch data.
|
||||||
|
*/
|
||||||
|
|
||||||
|
private function processBatch(
|
||||||
|
array $rows,
|
||||||
|
array &$permohonanCache,
|
||||||
|
array &$jenisJaminanCache,
|
||||||
|
array &$pemilikJaminanCache,
|
||||||
|
array &$provinceCache,
|
||||||
|
array &$cityCache,
|
||||||
|
array &$districtCache,
|
||||||
|
array &$subdistrictCache,
|
||||||
|
int $batchCount,
|
||||||
|
int $currentRow,
|
||||||
|
int $totalData,
|
||||||
|
int &$errorCount,
|
||||||
|
array &$errorDebitureIds,
|
||||||
|
array &$hubunganPemilikCache
|
||||||
|
) {
|
||||||
|
foreach ($rows as $index => $row) {
|
||||||
|
try {
|
||||||
|
// Jalankan transaksi per-baris
|
||||||
|
// DB::beginTransaction();
|
||||||
|
|
||||||
|
// Cari permohonan
|
||||||
|
|
||||||
|
$permohonan = Permohonan::where('nomor_registrasi', $row['mig_nomor_jaminan'])->first();
|
||||||
|
|
||||||
|
if (empty($permohonan)) {
|
||||||
|
throw new \Exception('Missing debiture_id' . $row['mig_nomor_jaminan']);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pastikan permohonan_id belum digunakan di dokumen_jaminan
|
||||||
|
$existingDokumen = DokumenJaminan::where('permohonan_id', $permohonan->id)->first();
|
||||||
|
if ($existingDokumen) {
|
||||||
|
//throw new \Exception("permohonan_id {$permohonan->id} sudah digunakan di dokumen_jaminan");
|
||||||
|
//continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ambil lokasi
|
||||||
|
|
||||||
|
// jika external silahkan matikan ini
|
||||||
|
|
||||||
|
$proviceCode = $this->getProvinceCode($row['mig_province_name'], $provinceCache);
|
||||||
|
$cityCode = $this->getCityCode($row['mig_city_name'], $cityCache);
|
||||||
|
$districtCode = $this->getDistrictCode($row['mig_district_name'], $districtCache);
|
||||||
|
$subdistrict = $this->getSubdistrictCode($row['mig_village_name'], $subdistrictCache, $districtCache);
|
||||||
|
// $hubunganPemilik = $this->getHubunganPemilikJaminanId($row['mig_hubungan_pemilik_jaminan'], $hubunganPemilikCache);
|
||||||
|
|
||||||
|
|
||||||
|
$pemilik_jaminan_name = $this->getDebitureId($row['mig_kd_debitur_seq'], $pemilikJaminanCache);
|
||||||
|
// Buat Pemilik Jaminan
|
||||||
|
$pemilik_jaminan = PemilikJaminan::updateOrCreate([
|
||||||
|
'debiture_id' => $permohonan->debiture_id,
|
||||||
|
'hubungan_pemilik_jaminan_id' => 1,
|
||||||
|
// 'name' => $row['name'],
|
||||||
|
'name' => $pemilik_jaminan_name,
|
||||||
|
'detail_sertifikat' => null,
|
||||||
|
'npwp' => null,
|
||||||
|
'nomor_id' => null,
|
||||||
|
'email' => null,
|
||||||
|
'phone' => null,
|
||||||
|
// jika external silahkan matikan ini
|
||||||
|
'province_code' => $proviceCode,
|
||||||
|
'city_code' => $cityCode,
|
||||||
|
'district_code' => $districtCode,
|
||||||
|
'village_code' => $subdistrict['code'],
|
||||||
|
'postal_code' => $subdistrict['postal_code'],
|
||||||
|
'address' => $row['address'],
|
||||||
|
'created_at' => $this->parseTimestamp($row['created_at']),
|
||||||
|
'updated_at' => $this->parseTimestamp($row['updated_at']),
|
||||||
|
'mig_kd_debitur_seq' => $row['mig_kd_debitur_seq'],
|
||||||
|
'processed_at' => now(),
|
||||||
|
'is_mig' => 1
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
// Buat Dokumen Jaminan
|
||||||
|
$dokumenJaminan = DokumenJaminan::updateOrCreate([
|
||||||
|
'permohonan_id' => $permohonan->id,
|
||||||
|
'mig_kd_debitur_seq' => $row['mig_kd_debitur_seq'],
|
||||||
|
'nomor_lpj' => $row['mig_nomor_jaminan']
|
||||||
|
],[
|
||||||
|
'debiture_id' => $permohonan->debiture_id,
|
||||||
|
'permohonan_id' => $permohonan->id,
|
||||||
|
'jenis_jaminan_id' => $this->getJaminanId($row['mig_jenis_seq']) ?? '',
|
||||||
|
'pemilik_jaminan_id' => $pemilik_jaminan->id,
|
||||||
|
// jika external silahkan matikan ini
|
||||||
|
'province_code' => $proviceCode ?? '',
|
||||||
|
'city_code' => $cityCode ?? '',
|
||||||
|
'district_code' => $districtCode ?? '',
|
||||||
|
'village_code' => $subdistrict['code'] ?? '',
|
||||||
|
'postal_code' => $subdistrict['postal_code'] ?? '',
|
||||||
|
'address' => $row['address'],
|
||||||
|
'created_at' => $this->parseTimestamp($row['created_at']),
|
||||||
|
'updated_at' => $this->parseTimestamp($row['updated_at']),
|
||||||
|
'mig_kd_debitur_seq' => $row['mig_kd_debitur_seq'],
|
||||||
|
'processed_at' => now(),
|
||||||
|
'nomor_lpj' => $row['mig_nomor_jaminan'],
|
||||||
|
'is_mig' => 1
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Commit jika semua sukses
|
||||||
|
// DB::commit();
|
||||||
|
$this->command->info("Proses dokumen jaminan: " . $row['mig_kd_debitur_seq'] . "Batch: {$batchCount} Baris: {$currentRow} Total: {$totalData} Error: {$errorCount}");
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Rollback hanya untuk baris ini
|
||||||
|
Log::error("Error pada baris: " . json_encode($row) . ". Pesan: " . $e->getMessage());
|
||||||
|
$this->logError($row['mig_kd_debitur_seq'] ?? '-', $e->getMessage());
|
||||||
|
$errorDebitureIds[] = $row['mig_kd_debitur_seq'] ?? '-';
|
||||||
|
// DB::rollBack();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->command->info("Batch {$batchCount} selesai. Total error: " . count($errorDebitureIds));
|
||||||
|
}
|
||||||
|
// private function getPermohonanId($code,$cache)
|
||||||
|
// {
|
||||||
|
// if (isset($cache[$code])) {
|
||||||
|
// return $cache[$code];
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $permohonan = Permohonan::where('mig_kd_debitur_seq', $code)->where('nomor_registrasi', $mig_nomor_jaminan)->first();
|
||||||
|
|
||||||
|
// if ($permohonan) {
|
||||||
|
// $cache[$code] = $permohonan;
|
||||||
|
// return $permohonan;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
private function getJaminanId($code): ?int
|
||||||
|
{
|
||||||
|
/*$mapping = [
|
||||||
|
7 => 17,
|
||||||
|
8 => 13,
|
||||||
|
6 => 32,
|
||||||
|
1 => 17,
|
||||||
|
2 => 26,
|
||||||
|
3 => 27,
|
||||||
|
4 => 50,
|
||||||
|
5 => 21,
|
||||||
|
138051314724 => 23,
|
||||||
|
138027243057 => 34,
|
||||||
|
138027664224 => 35,
|
||||||
|
138027738489 => 10,
|
||||||
|
138051485796 => 48,
|
||||||
|
138051492883 => 47,
|
||||||
|
138051515419 => 40,
|
||||||
|
138051753311 => 41,
|
||||||
|
138051754843 => 46,
|
||||||
|
138051759078 => 42,
|
||||||
|
138051480538 => 45,
|
||||||
|
123382184742 => 18,
|
||||||
|
138051483711 => 44,
|
||||||
|
991 => 52
|
||||||
|
];*/
|
||||||
|
|
||||||
|
$mapping = [
|
||||||
|
1 => 1,
|
||||||
|
2 => 17,
|
||||||
|
3 => 19,
|
||||||
|
4 => 15,
|
||||||
|
5 => 18,
|
||||||
|
6 => 26,
|
||||||
|
7 => 26,
|
||||||
|
8 => 26,
|
||||||
|
9 => 26,
|
||||||
|
10 => 24,
|
||||||
|
11 => 28,
|
||||||
|
12 => 29,
|
||||||
|
13 => 32,
|
||||||
|
991001 => 17,
|
||||||
|
121965631354 => 17,
|
||||||
|
122267387302 => 13,
|
||||||
|
122267391891 => 27,
|
||||||
|
123242566528 => 1,
|
||||||
|
123391628912 => 18,
|
||||||
|
123779076991 => 26,
|
||||||
|
123779092232 => 26,
|
||||||
|
123837866231 => 19,
|
||||||
|
124159228236 => 14,
|
||||||
|
124280447242 => 32,
|
||||||
|
124385048902 => 30,
|
||||||
|
124539856281 => 22,
|
||||||
|
124635294016 => 13,
|
||||||
|
124963468687 => 18,
|
||||||
|
125178371127 => 31,
|
||||||
|
125228814911 => 17,
|
||||||
|
125749523699 => 27,
|
||||||
|
126156105725 => 15,
|
||||||
|
127407367039 => 15,
|
||||||
|
132065123922 => 32,
|
||||||
|
138027244724 => 33,
|
||||||
|
138027246193 => 34,
|
||||||
|
138027693348 => 35,
|
||||||
|
138027764236 => 10,
|
||||||
|
138050882693 => 15,
|
||||||
|
138050910670 => 20,
|
||||||
|
138051316169 => 23,
|
||||||
|
138051517359 => 36,
|
||||||
|
138051519318 => 37,
|
||||||
|
138051522331 => 38,
|
||||||
|
138051601738 => 39,
|
||||||
|
138051602831 => 40,
|
||||||
|
138051773783 => 41,
|
||||||
|
138051776693 => 46,
|
||||||
|
138051780489 => 42,
|
||||||
|
164921358499 => 32,
|
||||||
|
165216289979 => 49,
|
||||||
|
165216294371 => 49,
|
||||||
|
173035895092 => 24
|
||||||
|
];
|
||||||
|
|
||||||
|
return $mapping[$code] ?? 17;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getPemilikJaminanId(string $code, array &$cache): ?int
|
||||||
|
{
|
||||||
|
if (isset($cache[$code])) {
|
||||||
|
return $cache[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
$jaminan = PemilikJaminan::where('mig_kd_debitur_seq', $code)->first();
|
||||||
|
|
||||||
|
if ($jaminan) {
|
||||||
|
$cache[$code] = $jaminan->id;
|
||||||
|
return $jaminan->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getDebitureId(string $code, array &$cache): ?string
|
||||||
|
{
|
||||||
|
if (isset($cache[$code])) {
|
||||||
|
return $cache[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
$debiture = Debiture::where('mig_kd_debitur_seq', $code)->first();
|
||||||
|
|
||||||
|
if ($debiture) {
|
||||||
|
$cache[$code] = $debiture->name;
|
||||||
|
return $debiture->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private function getProvinceCode(string $name, array &$cache): ?string
|
||||||
|
{
|
||||||
|
|
||||||
|
$normalizedName = strtolower($name);
|
||||||
|
if (isset($cache[$normalizedName])) {
|
||||||
|
return $cache[$normalizedName];
|
||||||
|
}
|
||||||
|
|
||||||
|
$province = Province::whereRaw('LOWER(name) = ?', [strtolower($name)])->first();
|
||||||
|
|
||||||
|
if ($province) {
|
||||||
|
$cache[$normalizedName] = $province->code;
|
||||||
|
return $province->code;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getCityCode(string $name, array &$cache): ?string
|
||||||
|
{
|
||||||
|
$normalizedName = strtolower($name);
|
||||||
|
if (isset($cache[$normalizedName])) {
|
||||||
|
return $cache[$normalizedName];
|
||||||
|
}
|
||||||
|
|
||||||
|
$city = City::whereRaw('LOWER(name) = ?', [strtolower($name)])->first();
|
||||||
|
|
||||||
|
if ($city) {
|
||||||
|
$cache[$normalizedName] = $city->code;
|
||||||
|
return $city->code;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getDistrictCode(string $name, array &$cache): ?string
|
||||||
|
{
|
||||||
|
$normalizedName = strtolower($name);
|
||||||
|
if (isset($cache[$normalizedName])) {
|
||||||
|
return $cache[$normalizedName];
|
||||||
|
}
|
||||||
|
|
||||||
|
$district = District::whereRaw('LOWER(name) = ?', [strtolower($name)])->first();
|
||||||
|
|
||||||
|
if ($district) {
|
||||||
|
$cache[$normalizedName] = $district->code;
|
||||||
|
return $district->code;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getSubdistrictCode(string $name, array &$cache, array &$districtCache): ?array
|
||||||
|
{
|
||||||
|
$normalizedName = strtolower($name);
|
||||||
|
|
||||||
|
// Pastikan cache menyimpan array, bukan hanya kode
|
||||||
|
if (isset($cache[$normalizedName])) {
|
||||||
|
return $cache[$normalizedName];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ambil subdistrict dari database
|
||||||
|
$subdistrict = Village::whereRaw('LOWER(name) = ?', [$normalizedName])->first();
|
||||||
|
|
||||||
|
// Jika ditemukan, simpan ke dalam cache sebagai array lengkap
|
||||||
|
if ($subdistrict) {
|
||||||
|
$cache[$normalizedName] = [
|
||||||
|
'code' => $subdistrict->code,
|
||||||
|
'postal_code' => $subdistrict->postal_code
|
||||||
|
];
|
||||||
|
return $cache[$normalizedName];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Jika tidak ditemukan, kembalikan null
|
||||||
|
return [
|
||||||
|
'code' => null,
|
||||||
|
'postal_code' => null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function getHubunganPemilikJaminanId(string $code, array &$cache): ?int
|
||||||
|
{
|
||||||
|
if (isset($cache[$code])) {
|
||||||
|
return $cache[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
$jaminan = HubunganPemilikJaminan::whereRaw('LOWER(name) = ?', [strtolower($code)])->first();
|
||||||
|
|
||||||
|
if ($jaminan) {
|
||||||
|
$cache[$code] = $jaminan->id;
|
||||||
|
return $jaminan->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mengonversi nilai TIMESTAMP menjadi format datetime yang valid.
|
||||||
|
*/
|
||||||
|
private function parseTimestamp(?string $timestamp): ?string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if ($timestamp) {
|
||||||
|
// Cek jika format hanya tanggal (Y-m-d)
|
||||||
|
if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $timestamp)) {
|
||||||
|
return \Carbon\Carbon::createFromFormat('Y-m-d', $timestamp)
|
||||||
|
->startOfDay()
|
||||||
|
->toDateTimeString();
|
||||||
|
}
|
||||||
|
// Format lengkap (Y-m-d H:i:s)
|
||||||
|
if (preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/', $timestamp)) {
|
||||||
|
return \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $timestamp)->toDateTimeString();
|
||||||
|
}
|
||||||
|
// Format d/m/Y H:i:s (contoh: 28/4/2017 14:43:43)
|
||||||
|
if (preg_match('/^\d{1,2}\/\d{1,2}\/\d{4} \d{2}:\d{2}:\d{2}$/', $timestamp)) {
|
||||||
|
return \Carbon\Carbon::createFromFormat('d/m/Y H:i:s', $timestamp)->toDateTimeString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('Gagal memparsing timestamp: ' . $timestamp . '. Pesan: ' . $e->getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function initializeErrorLog()
|
||||||
|
{
|
||||||
|
$file = $this->errorLogFile;
|
||||||
|
|
||||||
|
if (file_exists($file)) {
|
||||||
|
unlink($file); // Hapus file lama
|
||||||
|
}
|
||||||
|
|
||||||
|
$handle = fopen($file, 'w');
|
||||||
|
fputcsv($handle, ['mig_kd_debitur_seq', 'Error']);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function logError(string $kode, string $message)
|
||||||
|
{
|
||||||
|
Log::error("Error migrasi dokumen jaminan [$kode]: $message");
|
||||||
|
|
||||||
|
$handle = fopen($this->errorLogFile, 'a');
|
||||||
|
fputcsv($handle, [$kode, $message]);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
297
database/seeders/MigrationGambarInspeksiSeeder.php
Normal file
297
database/seeders/MigrationGambarInspeksiSeeder.php
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Lpj\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Modules\Lpj\Models\Inspeksi;
|
||||||
|
use Modules\Basicdata\Models\Branch;
|
||||||
|
use Modules\Lpj\Models\DokumenJaminan;
|
||||||
|
use Modules\Lpj\Models\Permohonan;
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
|
class MigrationGambarInspeksiSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
protected $errorLogFile = __DIR__ . '/csv/inspeksi/foto_20251014-error.csv';
|
||||||
|
/**
|
||||||
|
* Migrasi data gambar inspeksi dari file csv ke tabel inspeksi_gambar
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$this->initializeErrorLog();
|
||||||
|
// Path ke file csv
|
||||||
|
$filePath = realpath(__DIR__ . '/csv/inspeksi/foto_20251014.csv');
|
||||||
|
|
||||||
|
if (!$filePath) {
|
||||||
|
Log::error('File csv tidak ditemukan: ' . __DIR__ . '/csv/inspeksi/foto_20251014.csv');
|
||||||
|
$this->command->error('File csv tidak ditemukan.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($handle = fopen($filePath, 'r')) === false) {
|
||||||
|
Log::error('Gagal membuka file CSV: ' . $filePath);
|
||||||
|
$this->command->error('Gagal membuka file CSV.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$header = fgetcsv($handle, 0, ',');
|
||||||
|
$rows = [];
|
||||||
|
$batchSize = 500;
|
||||||
|
$userData = [];
|
||||||
|
$branchCache = []; // <-- Gunakan sebagai cache
|
||||||
|
$totalData = 0;
|
||||||
|
|
||||||
|
while (($data = fgetcsv($handle, 0, ',')) !== false) {
|
||||||
|
$totalData++;
|
||||||
|
}
|
||||||
|
|
||||||
|
rewind($handle);
|
||||||
|
fgetcsv($handle, 0, ','); // Skip header
|
||||||
|
|
||||||
|
$batchCount = 0;
|
||||||
|
$currentRow = 0;
|
||||||
|
$errorCount = 0;
|
||||||
|
$errorDebitureIds = [];
|
||||||
|
|
||||||
|
while (($data = fgetcsv($handle, 0, ',')) !== false) {
|
||||||
|
if (count($data) != count($header)) {
|
||||||
|
Log::warning('Baris CSV memiliki jumlah kolom yang tidak sesuai: ' . json_encode($data));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows[] = array_combine($header, $data);
|
||||||
|
$currentRow++;
|
||||||
|
|
||||||
|
if (count($rows) >= $batchSize) {
|
||||||
|
$batchCount++;
|
||||||
|
$this->command->info("Memproses batch ke-{$batchCount} ({$currentRow}/{$totalData})");
|
||||||
|
$this->processBatch($rows, $branchCache, $userData, $errorCount, $errorDebitureIds, $totalData, $batchCount, $currentRow);
|
||||||
|
$rows = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// info_harga_laporan_202505021522.csv
|
||||||
|
// print_r($rows[0]);
|
||||||
|
if (!empty($rows)) {
|
||||||
|
$batchCount++;
|
||||||
|
$this->command->info("Memproses batch ke-{$batchCount} ({$currentRow}/{$totalData})");
|
||||||
|
$this->processBatch($rows, $branchCache, $userData, $errorCount, $errorDebitureIds, $totalData, $batchCount, $currentRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($handle);
|
||||||
|
$this->command->info("Data debiture berhasil dimigrasikan. Total data: {$totalData}, Total batch: {$batchCount}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function processBatch(array $rows, array &$branchCache, array &$userData, int &$errorCount, array &$errorDebitureIds, int $totalData, int $batchCount, int $currentRow)
|
||||||
|
{
|
||||||
|
// Kelompokkan berdasarkan mig_nomor_jaminan
|
||||||
|
$groupedRows = $this->groupRowsByJaminan($rows);
|
||||||
|
|
||||||
|
foreach ($groupedRows as $nomorJaminan => $groupRows) {
|
||||||
|
try {
|
||||||
|
// Ambil informasi permohonan dan dokument_id
|
||||||
|
$nomorRegis = $this->getNomorRegistrasiPermohonan($nomorJaminan, $branchCache);
|
||||||
|
if (!$nomorRegis) {
|
||||||
|
Log::warning("Nomor registrasi tidak ditemukan untuk nomor jaminan: {$nomorJaminan}");
|
||||||
|
$errorCount++;
|
||||||
|
$errorDebitureIds[] = $nomorJaminan;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bangun JSON foto_form
|
||||||
|
$fotoJson = $this->checkFoto($groupRows);
|
||||||
|
|
||||||
|
|
||||||
|
Inspeksi::updateOrCreate(
|
||||||
|
[
|
||||||
|
'permohonan_id' => $nomorRegis['id'],
|
||||||
|
'dokument_id' => $nomorRegis['dokument_id']
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'foto_form' => $fotoJson,
|
||||||
|
'updated_at' => now()
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->command->info("Berhasil update foto_form untuk nomor jaminan: {$nomorJaminan}");
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error("Error pada nomor jaminan {$nomorJaminan}: " . $e->getMessage());
|
||||||
|
$errorCount++;
|
||||||
|
$errorDebitureIds[] = $nomorJaminan;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private function groupRowsByJaminan(array $rows): array
|
||||||
|
{
|
||||||
|
$grouped = [];
|
||||||
|
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$nomorJaminan = $row['mig_nomor_jaminan'] ?? null;
|
||||||
|
|
||||||
|
if (!empty($nomorJaminan)) {
|
||||||
|
$grouped[$nomorJaminan][] = $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $grouped;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private function checkFoto(array $rows)
|
||||||
|
{
|
||||||
|
// Inisialisasi kelompok untuk tiap kategori
|
||||||
|
$kategoriPrioritas = [
|
||||||
|
'PETA LOKASI' => [],
|
||||||
|
'GAMBAR SITUASI / SURAT UKUR' => [],
|
||||||
|
'FOTO JAMINAN' => [],
|
||||||
|
'MAK' => [],
|
||||||
|
'lainnya' => []
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
// Ambil kolom penting
|
||||||
|
$namaFoto = trim($row['mig_nama_gambar'] ?? '');
|
||||||
|
$pathFoto = trim($row['mig_url_gambar'] ?? '');
|
||||||
|
$kategori = trim($row['mig_kategori'] ?? 'lainnya');
|
||||||
|
$urutan = (int)($row['mig_urutan_gambar'] ?? 999);
|
||||||
|
$tgl = trim($row['mig_tgl'] ?? '');
|
||||||
|
$nomorLpj = trim($row['mig_nomor_laporan'] ?? '');
|
||||||
|
|
||||||
|
if (empty($pathFoto) || empty($tgl)) {
|
||||||
|
continue; // Lewati jika tidak lengkap
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$tanggal = \Carbon\Carbon::createFromFormat('d/m/Y H:i:s', $tgl)->startOfDay();
|
||||||
|
if (!$tanggal) {
|
||||||
|
throw new \Exception("Tanggal tidak valid");
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
continue; // Lewati jika tanggal tidak valid
|
||||||
|
}
|
||||||
|
|
||||||
|
$tahun = $tanggal->format('Y');
|
||||||
|
$bulanAngka = $tanggal->format('n');
|
||||||
|
$bulanNama = [
|
||||||
|
1 => 'JANUARI', 2 => 'FEBRUARI', 3 => 'MARET',
|
||||||
|
4 => 'APRIL', 5 => 'MEI', 6 => 'JUNI',
|
||||||
|
7 => 'JULI', 8 => 'AGUSTUS', 9 => 'SEPTEMBER',
|
||||||
|
10 => 'OKTOBER', 11 => 'NOVEMBER', 12 => 'DESEMBER'
|
||||||
|
][(int)$bulanAngka] ?? 'UNKNOWN';
|
||||||
|
|
||||||
|
$tanggalFormat = $tanggal->format('dmY');
|
||||||
|
|
||||||
|
if (empty($namaFoto)) {
|
||||||
|
$namaFoto = basename($pathFoto) ?: 'image.jpg';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gunakan '/' sebagai separator path
|
||||||
|
$finalPath = "surveyor/{$tahun}/{$bulanNama}/{$tanggalFormat}/{$nomorLpj}/{$pathFoto}";
|
||||||
|
|
||||||
|
$fotoItem = [
|
||||||
|
'urutan' => $urutan,
|
||||||
|
'name' => $namaFoto,
|
||||||
|
'path' => $finalPath,
|
||||||
|
'category' => $kategori,
|
||||||
|
'sub' => null,
|
||||||
|
'description' => '',
|
||||||
|
'created_by' => null,
|
||||||
|
'created_at' => null
|
||||||
|
];
|
||||||
|
|
||||||
|
// Masukkan ke dalam kelompok kategori
|
||||||
|
if (isset($kategoriPrioritas[$kategori])) {
|
||||||
|
$kategoriPrioritas[$kategori][] = $fotoItem;
|
||||||
|
} else {
|
||||||
|
$kategoriPrioritas['lainnya'][] = $fotoItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Urutkan masing-masing kategori berdasarkan urutan
|
||||||
|
foreach ($kategoriPrioritas as &$kelompok) {
|
||||||
|
usort($kelompok, function ($a, $b) {
|
||||||
|
return $a['urutan'] <=> $b['urutan'];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gabungkan dengan urutan prioritas: PETA LOKASI -> GAMBAR SITUASI -> FOTO JAMINAN -> lainnya
|
||||||
|
$finalFotos = array_merge(
|
||||||
|
$kategoriPrioritas['PETA LOKASI'],
|
||||||
|
$kategoriPrioritas['GAMBAR SITUASI / SURAT UKUR'],
|
||||||
|
$kategoriPrioritas['FOTO JAMINAN'],
|
||||||
|
$kategoriPrioritas['lainnya']
|
||||||
|
);
|
||||||
|
|
||||||
|
// Hapus indeks 'urutan'
|
||||||
|
$finalFotos = array_map(function ($foto) {
|
||||||
|
unset($foto['urutan']);
|
||||||
|
return $foto;
|
||||||
|
}, $finalFotos);
|
||||||
|
|
||||||
|
return json_encode([
|
||||||
|
'upload_foto' => $finalFotos
|
||||||
|
], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||||
|
}
|
||||||
|
private function getNomorRegistrasiPermohonan($nomor_jaminan_id, array &$cache)
|
||||||
|
{
|
||||||
|
// Cek apakah sudah ada di cache
|
||||||
|
if (isset($cache[$nomor_jaminan_id])) {
|
||||||
|
return $cache[$nomor_jaminan_id];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cari di tabel Permohonan berdasarkan nomor registrasi
|
||||||
|
$permohonan = Permohonan::where('nomor_registrasi', $nomor_jaminan_id)->first();
|
||||||
|
|
||||||
|
if (!$permohonan) {
|
||||||
|
// Tidak ditemukan
|
||||||
|
$cache[$nomor_jaminan_id] = null;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cari dokument jaminan terkait
|
||||||
|
$dokumenJaminan = DokumenJaminan::where('permohonan_id', $permohonan->id)->first();
|
||||||
|
|
||||||
|
// Simpan hasil ke cache
|
||||||
|
$result = [
|
||||||
|
'id' => $permohonan->id,
|
||||||
|
'dokument_id' => $dokumenJaminan ? $dokumenJaminan->id : null
|
||||||
|
];
|
||||||
|
|
||||||
|
$cache[$nomor_jaminan_id] = $result;
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function initializeErrorLog()
|
||||||
|
{
|
||||||
|
$file = $this->errorLogFile;
|
||||||
|
|
||||||
|
if (file_exists($file)) {
|
||||||
|
unlink($file); // Hapus file lama
|
||||||
|
}
|
||||||
|
|
||||||
|
$handle = fopen($file, 'w');
|
||||||
|
fputcsv($handle, ['mig_kd_debitur_seq', 'Error']);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function logError(string $kode, string $message)
|
||||||
|
{
|
||||||
|
Log::error("Error migrasi dokumen jaminan [$kode]: $message");
|
||||||
|
|
||||||
|
$handle = fopen($this->errorLogFile, 'a');
|
||||||
|
fputcsv($handle, [$kode, $message]);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
1001
database/seeders/MigrationInpseksiSeeder.php
Normal file
1001
database/seeders/MigrationInpseksiSeeder.php
Normal file
File diff suppressed because it is too large
Load Diff
16
database/seeders/MigrationLaporanSeeder.php
Normal file
16
database/seeders/MigrationLaporanSeeder.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Lpj\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class MigrationLaporanSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
// $this->call([]);
|
||||||
|
}
|
||||||
|
}
|
||||||
225
database/seeders/MigrationPembandingSeeder.php
Normal file
225
database/seeders/MigrationPembandingSeeder.php
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Lpj\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Modules\Lpj\Models\Inspeksi;
|
||||||
|
use Modules\Basicdata\Models\Branch;
|
||||||
|
use Modules\Lpj\Models\DokumenJaminan;
|
||||||
|
use Modules\Lpj\Models\Permohonan;
|
||||||
|
|
||||||
|
class MigrationPembandingSeeder extends Seeder
|
||||||
|
{
|
||||||
|
protected $errorLogFile = __DIR__ . '/csv/inspeksi/pembanding_20251016_error.csv';
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
// Path ke file csv
|
||||||
|
$filePath = realpath(__DIR__ . '/csv/inspeksi/pembanding_20251016.csv');
|
||||||
|
|
||||||
|
if (!$filePath) {
|
||||||
|
Log::error('File csv tidak ditemukan: ' . __DIR__ . '/csv/inspeksi/pembanding_20251016.csv');
|
||||||
|
$this->command->error('File csv tidak ditemukan.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($handle = fopen($filePath, 'r')) === false) {
|
||||||
|
Log::error('Gagal membuka file CSV: ' . $filePath);
|
||||||
|
$this->command->error('Gagal membuka file CSV.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$header = fgetcsv($handle, 0, ',');
|
||||||
|
$rows = [];
|
||||||
|
$batchSize = 300;
|
||||||
|
$userData = [];
|
||||||
|
$branchCache = []; // <-- Gunakan sebagai cache
|
||||||
|
$totalData = 0;
|
||||||
|
|
||||||
|
while (($data = fgetcsv($handle, 0, ',')) !== false) {
|
||||||
|
$totalData++;
|
||||||
|
}
|
||||||
|
|
||||||
|
rewind($handle);
|
||||||
|
fgetcsv($handle, 0, ','); // Skip header
|
||||||
|
|
||||||
|
$batchCount = 0;
|
||||||
|
$currentRow = 0;
|
||||||
|
$errorCount = 0;
|
||||||
|
$errorDebitureIds = [];
|
||||||
|
|
||||||
|
while (($data = fgetcsv($handle, 0, ',')) !== false) {
|
||||||
|
if (count($data) != count($header)) {
|
||||||
|
Log::warning('Baris CSV memiliki jumlah kolom yang tidak sesuai: ' . json_encode($data));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows[] = array_combine($header, $data);
|
||||||
|
$currentRow++;
|
||||||
|
|
||||||
|
if (count($rows) >= $batchSize) {
|
||||||
|
$batchCount++;
|
||||||
|
$this->command->info("Memproses batch ke-{$batchCount} ({$currentRow}/{$totalData})");
|
||||||
|
$this->processBatch($rows, $branchCache, $userData, $errorCount, $errorDebitureIds, $totalData, $batchCount, $currentRow);
|
||||||
|
$rows = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// info_harga_laporan_202505021522.csv
|
||||||
|
// print_r($rows[0]);
|
||||||
|
if (!empty($rows)) {
|
||||||
|
$batchCount++;
|
||||||
|
$this->command->info("Memproses batch ke-{$batchCount} ({$currentRow}/{$totalData})");
|
||||||
|
$this->processBatch($rows, $branchCache, $userData, $errorCount, $errorDebitureIds, $totalData, $batchCount, $currentRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($handle);
|
||||||
|
$this->command->info("Data debiture berhasil dimigrasikan. Total data: {$totalData}, Total batch: {$batchCount}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function processBatch(array $rows, array &$branchCache, array &$userData, int &$errorCount, array &$errorDebitureIds, int $totalData, int $batchCount, int $currentRow)
|
||||||
|
{
|
||||||
|
// Kelompokkan berdasarkan mig_nomor_lpj
|
||||||
|
$groupedRows = $this->groupRowsByJaminan($rows);
|
||||||
|
|
||||||
|
foreach ($groupedRows as $nomorLpj => $groupRows) {
|
||||||
|
try {
|
||||||
|
// Dapatkan info permohonan untuk update inspeksi
|
||||||
|
$nomorRegis = $this->getNomorRegistrasiPermohonan($nomorLpj, $branchCache);
|
||||||
|
if (!$nomorRegis) {
|
||||||
|
Log::warning("Nomor registrasi tidak ditemukan untuk nomor LPJ: {$nomorLpj}");
|
||||||
|
$errorCount++;
|
||||||
|
$errorDebitureIds[] = $nomorLpj;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bangun JSON data pembanding
|
||||||
|
$pembandingJson = $this->checkPembanding($groupRows);
|
||||||
|
|
||||||
|
// Update ke tabel inspeksi
|
||||||
|
|
||||||
|
// print_r($pembandingJson);
|
||||||
|
$inspeksi = Inspeksi::where('permohonan_id', $nomorRegis['id'])
|
||||||
|
->where('dokument_id', $nomorRegis['dokument_id'])
|
||||||
|
->update([
|
||||||
|
'data_pembanding' => $pembandingJson,
|
||||||
|
'updated_at' => now()
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->command->info("Berhasil update data_pembanding untuk nomor LPJ: {$nomorLpj}");
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error("Error pada nomor LPJ {$nomorLpj}: " . $e->getMessage());
|
||||||
|
$errorCount++;
|
||||||
|
$errorDebitureIds[] = $nomorLpj;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private function groupRowsByJaminan(array $rows): array
|
||||||
|
{
|
||||||
|
$grouped = [];
|
||||||
|
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$nomorJaminan = $row['mig_nomor_lpj'] ?? null;
|
||||||
|
|
||||||
|
if (!empty($nomorJaminan)) {
|
||||||
|
$grouped[$nomorJaminan][] = $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($row['mig_nomor_lpj']=='251936'){
|
||||||
|
dd($grouped);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $grouped;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkPembanding(array $rows)
|
||||||
|
{
|
||||||
|
$pembandingList = [];
|
||||||
|
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
// Pastikan kolom penting tersedia
|
||||||
|
$urutan = (int)($row['mig_urutan'] ?? 999);
|
||||||
|
$pembanding = trim($row['mig_pembanding'] ?? '');
|
||||||
|
|
||||||
|
// CUKUP VALIDASI PEMBANDING SAJA
|
||||||
|
if (empty($pembanding)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pembandingList[] = [
|
||||||
|
'urutan' => $urutan,
|
||||||
|
'keterangan' => $pembanding,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Urutkan berdasarkan urutan
|
||||||
|
usort($pembandingList, function ($a, $b) {
|
||||||
|
return $a['urutan'] <=> $b['urutan'];
|
||||||
|
});
|
||||||
|
|
||||||
|
// Hapus indeks 'urutan'
|
||||||
|
$finalPembanding = array_map(function ($item) {
|
||||||
|
unset($item['urutan']);
|
||||||
|
return $item;
|
||||||
|
}, $pembandingList);
|
||||||
|
|
||||||
|
return json_encode([
|
||||||
|
'data_pembanding' => $finalPembanding
|
||||||
|
], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||||
|
}
|
||||||
|
private function getNomorRegistrasiPermohonan($nomor_jaminan_id, array &$cache)
|
||||||
|
{
|
||||||
|
if (isset($cache[$nomor_jaminan_id])) {
|
||||||
|
return $cache[$nomor_jaminan_id];
|
||||||
|
}
|
||||||
|
|
||||||
|
$permohonan = Permohonan::where('nomor_lpj', $nomor_jaminan_id)->first();
|
||||||
|
|
||||||
|
if (!$permohonan) {
|
||||||
|
$cache[$nomor_jaminan_id] = null;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dokumenJaminan = DokumenJaminan::where('permohonan_id', $permohonan->id)->first();
|
||||||
|
|
||||||
|
$result = [
|
||||||
|
'id' => $permohonan->id,
|
||||||
|
'dokument_id' => $dokumenJaminan ? $dokumenJaminan->id : null
|
||||||
|
];
|
||||||
|
|
||||||
|
$cache[$nomor_jaminan_id] = $result;
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function initializeErrorLog()
|
||||||
|
{
|
||||||
|
$file = $this->errorLogFile;
|
||||||
|
|
||||||
|
// Hapus file lama jika ada
|
||||||
|
if (file_exists($file)) {
|
||||||
|
unlink($file);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Buat file baru dengan header
|
||||||
|
$handle = fopen($file, 'w');
|
||||||
|
fputcsv($handle, ['mig_mst_jaminan_nomor_jaminan', 'Error']);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function logError($nomorJaminan, string $message)
|
||||||
|
{
|
||||||
|
Log::error("Error migrasi permohonan [$nomorJaminan]: $message");
|
||||||
|
|
||||||
|
// Tulis ke file error
|
||||||
|
$handle = fopen($this->errorLogFile, 'a');
|
||||||
|
fputcsv($handle, [$nomorJaminan, $message]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
282
database/seeders/MigrationPemilikJaminanSeeder.php
Normal file
282
database/seeders/MigrationPemilikJaminanSeeder.php
Normal file
@@ -0,0 +1,282 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Lpj\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Modules\Lpj\Models\HubunganPemilikJaminan;
|
||||||
|
use Modules\Lpj\Models\Debiture;
|
||||||
|
use Modules\Lpj\Models\PemilikJaminan;
|
||||||
|
use Modules\Basicdata\Models\Branch;
|
||||||
|
use Modules\Usermanagement\Models\User;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Modules\Location\Models\Province;
|
||||||
|
use Modules\Location\Models\City;
|
||||||
|
use Modules\Location\Models\District;
|
||||||
|
use Modules\Location\Models\Village;
|
||||||
|
|
||||||
|
class MigrationPemilikJaminanSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$filePath = realpath(__DIR__ . '/csv/pemilik_20251002.csv');
|
||||||
|
|
||||||
|
if (!$filePath) {
|
||||||
|
Log::error('File CSV tidak ditemukan: ' . __DIR__ . '/csv/pemilik_20251002.csv');
|
||||||
|
$this->command->error('File CSV tidak ditemukan.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($handle = fopen($filePath, 'r')) === false) {
|
||||||
|
Log::error('Gagal membuka file CSV: ' . $filePath);
|
||||||
|
$this->command->error('Gagal membuka file CSV.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$header = fgetcsv($handle, 0, ',');
|
||||||
|
$rows = [];
|
||||||
|
$batchSize = 100; // Ukuran batch
|
||||||
|
$branchCache = [];
|
||||||
|
$debitureCache = [];
|
||||||
|
$hubunganPemilikCache = [];
|
||||||
|
$provinceCache = [];
|
||||||
|
$cityCache = [];
|
||||||
|
$districtCache = [];
|
||||||
|
$subdistrictCache = [];
|
||||||
|
|
||||||
|
while (($data = fgetcsv($handle, 0, ',')) !== false) {
|
||||||
|
if (count($data) != count($header)) {
|
||||||
|
Log::warning('Baris CSV memiliki jumlah kolom yang tidak sesuai: ' . json_encode($data));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows[] = array_combine($header, $data);
|
||||||
|
|
||||||
|
if (count($rows) >= $batchSize) {
|
||||||
|
$this->processBatch($rows, $branchCache, $debitureCache, $hubunganPemilikCache, $provinceCache, $cityCache, $districtCache, $subdistrictCache);
|
||||||
|
$rows = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// print_r($rows);
|
||||||
|
if (!empty($rows)) {
|
||||||
|
$this->processBatch($rows, $branchCache, $debitureCache, $hubunganPemilikCache, $provinceCache, $cityCache, $districtCache, $subdistrictCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($handle);
|
||||||
|
|
||||||
|
$this->command->info('Data permohonan berhasil dimigrasikan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function processBatch(array $rows, array &$branchCache, array &$debitureCache, array &$hubunganPemilikCache, array &$provinceCache, array &$cityCache, array &$districtCache, array &$subdistrictCache)
|
||||||
|
{
|
||||||
|
foreach ($rows as $index => $row) {
|
||||||
|
$debitureId = $this->getDebiturId($row['mig_kd_debitur_seq'], $debitureCache);
|
||||||
|
|
||||||
|
if (!$debitureId) {
|
||||||
|
Log::warning('Debitur tidak ditemukan untuk kode: ' . $row['mig_kd_debitur_seq']);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$hubunganPemilik = $this->getHubunganPemilikId($row['mig_hubungan_pemilik_jaminan'], $hubunganPemilikCache);
|
||||||
|
|
||||||
|
|
||||||
|
$proviceCode = $this->getProvinceCode($row['mig_province_name'], $provinceCache);
|
||||||
|
$cityCode = $this->getCityCode($row['mig_city_name'], $cityCache);
|
||||||
|
$districtCode = $this->getDistrictCode($row['mig_district_name'], $districtCache);
|
||||||
|
|
||||||
|
$subdistrictCode = $this->getSubdistrictCode($row['mig_village_name'], $subdistrictCache, $districtCache);
|
||||||
|
|
||||||
|
|
||||||
|
PemilikJaminan::updateOrCreate([
|
||||||
|
'mig_kd_debitur_seq' => $row['mig_kd_debitur_seq'],
|
||||||
|
],[
|
||||||
|
'debiture_id' => $debitureId,
|
||||||
|
'hubungan_pemilik_jaminan_id' => $hubunganPemilik,
|
||||||
|
'name' => $row['name'],
|
||||||
|
'detail_sertifikat' => null,
|
||||||
|
'npwp' => null,
|
||||||
|
'nomor_id' => null,
|
||||||
|
'email' => null,
|
||||||
|
'phone' => null,
|
||||||
|
'province_code' => $proviceCode,
|
||||||
|
'city_code' => $cityCode,
|
||||||
|
'district_code' => $districtCode,
|
||||||
|
'village_code' => $subdistrictCode['code'],
|
||||||
|
'postal_code' => $subdistrictCode['postal_code'],
|
||||||
|
'address' => $row['address'],
|
||||||
|
'created_at' => $this->parseTimestamp($row['created_at']),
|
||||||
|
'updated_at' => $this->parseTimestamp($row['updated_at']),
|
||||||
|
'mig_kd_debitur_seq' => $row['mig_kd_debitur_seq'],
|
||||||
|
'processed_at' => now(),
|
||||||
|
'is_mig' => 1
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->command->info('Proses data Pemilik Jaminan ' . $row['name'] . ' (' . ($index + 1) . '/' . count($rows) . ')');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getDebiturId(string $code, array &$cache): ?int
|
||||||
|
{
|
||||||
|
if (isset($cache[$code])) {
|
||||||
|
return $cache[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
$debitur = Debiture::where('mig_kd_debitur_seq', $code)->first();
|
||||||
|
|
||||||
|
if ($debitur) {
|
||||||
|
$cache[$code] = $debitur->id;
|
||||||
|
return $debitur->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getHubunganPemilikId(string $name, array &$cache): ?int
|
||||||
|
{
|
||||||
|
// Normalisasi nama
|
||||||
|
$normalizedName = strtolower(trim($name));
|
||||||
|
|
||||||
|
// Cek cache untuk menghindari query berulang
|
||||||
|
if (isset($cache[$normalizedName])) {
|
||||||
|
return $cache[$normalizedName];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Query database dengan pengamanan tambahan
|
||||||
|
$hubunganPemilik = HubunganPemilikJaminan::whereRaw('LOWER(name) = ?', [$normalizedName])
|
||||||
|
->whereNull('deleted_at') // Tambahkan ini jika Anda menggunakan soft deletes
|
||||||
|
->first();
|
||||||
|
|
||||||
|
// Jika data ditemukan, simpan dalam cache
|
||||||
|
if ($hubunganPemilik) {
|
||||||
|
$cache[$normalizedName] = $hubunganPemilik->id;
|
||||||
|
return $hubunganPemilik->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default jika data tidak ditemukan
|
||||||
|
$cache[$normalizedName] = 1; // Cache nilai default untuk menghindari query berulang
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function getProvinceCode(string $name, array &$cache): ?string
|
||||||
|
{
|
||||||
|
|
||||||
|
$normalizedName = strtolower($name);
|
||||||
|
if (isset($cache[$normalizedName])) {
|
||||||
|
return $cache[$normalizedName];
|
||||||
|
}
|
||||||
|
|
||||||
|
$province = Province::whereRaw('LOWER(name) = ?', [strtolower($name)])->first();
|
||||||
|
|
||||||
|
if ($province) {
|
||||||
|
$cache[$normalizedName] = $province->code;
|
||||||
|
return $province->code;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getCityCode(string $name, array &$cache): ?string
|
||||||
|
{
|
||||||
|
$normalizedName = strtolower($name);
|
||||||
|
if (isset($cache[$normalizedName])) {
|
||||||
|
return $cache[$normalizedName];
|
||||||
|
}
|
||||||
|
|
||||||
|
$city = City::whereRaw('LOWER(name) = ?', [strtolower($name)])->first();
|
||||||
|
|
||||||
|
if ($city) {
|
||||||
|
$cache[$normalizedName] = $city->code;
|
||||||
|
return $city->code;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getDistrictCode(string $name, array &$cache): ?string
|
||||||
|
{
|
||||||
|
$normalizedName = strtolower($name);
|
||||||
|
if (isset($cache[$normalizedName])) {
|
||||||
|
return $cache[$normalizedName];
|
||||||
|
}
|
||||||
|
|
||||||
|
$district = District::whereRaw('LOWER(name) = ?', [strtolower($name)])->first();
|
||||||
|
|
||||||
|
if ($district) {
|
||||||
|
$cache[$normalizedName] = $district->code;
|
||||||
|
return $district->code;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getSubdistrictCode(string $name, array &$cache, array &$districtCache): ?array
|
||||||
|
{
|
||||||
|
$normalizedName = strtolower($name);
|
||||||
|
|
||||||
|
// Pastikan cache menyimpan array, bukan hanya kode
|
||||||
|
if (isset($cache[$normalizedName])) {
|
||||||
|
return $cache[$normalizedName];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ambil subdistrict dari database
|
||||||
|
$subdistrict = Village::whereRaw('LOWER(name) = ?', [$normalizedName])->first();
|
||||||
|
|
||||||
|
// Jika ditemukan, simpan ke dalam cache sebagai array lengkap
|
||||||
|
if ($subdistrict) {
|
||||||
|
$cache[$normalizedName] = [
|
||||||
|
'code' => $subdistrict->code,
|
||||||
|
'postal_code' => $subdistrict->postal_code
|
||||||
|
];
|
||||||
|
return $cache[$normalizedName];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Jika tidak ditemukan, kembalikan null
|
||||||
|
return [
|
||||||
|
'code' => null,
|
||||||
|
'postal_code' => null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function parseDate(?string $date): ?string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return $date ? \Carbon\Carbon::createFromFormat('Y-m-d', $date)->toDateString() : null;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('Gagal memparsing tanggal: ' . $date);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function parseTimestamp(?string $timestamp): ?string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if ($timestamp) {
|
||||||
|
// Cek jika format hanya tanggal (Y-m-d)
|
||||||
|
if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $timestamp)) {
|
||||||
|
return \Carbon\Carbon::createFromFormat('Y-m-d', $timestamp)
|
||||||
|
->startOfDay()
|
||||||
|
->toDateTimeString();
|
||||||
|
}
|
||||||
|
// Format lengkap (Y-m-d H:i:s)
|
||||||
|
if (preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/', $timestamp)) {
|
||||||
|
return \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $timestamp)->toDateTimeString();
|
||||||
|
}
|
||||||
|
// Format d/m/Y H:i:s (contoh: 28/4/2017 14:43:43)
|
||||||
|
if (preg_match('/^\d{1,2}\/\d{1,2}\/\d{4} \d{2}:\d{2}:\d{2}$/', $timestamp)) {
|
||||||
|
return \Carbon\Carbon::createFromFormat('d/m/Y H:i:s', $timestamp)->toDateTimeString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('Gagal memparsing timestamp: ' . $timestamp . '. Pesan: ' . $e->getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
505
database/seeders/MigrationPenilaiSeeder.php
Normal file
505
database/seeders/MigrationPenilaiSeeder.php
Normal file
@@ -0,0 +1,505 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Lpj\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Modules\Lpj\Models\DokumenJaminan;
|
||||||
|
use Modules\Lpj\Models\Permohonan;
|
||||||
|
use Modules\Lpj\Models\Penilai;
|
||||||
|
use Modules\Lpj\Models\Laporan;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class MigrationPenilaiSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
protected $errorLogFile = __DIR__ . '/csv/penilaian/penilai.fix.latest_error.csv';
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$this->initializeErrorLog();
|
||||||
|
// Path ke file csv
|
||||||
|
$filePath = realpath(__DIR__ . '/csv/penilaian/penilai.fix.latest_20251011.csv');
|
||||||
|
|
||||||
|
if (!$filePath) {
|
||||||
|
Log::error('File csv tidak ditemukan: ' . __DIR__ . '/csv/penilaian/penilai.fix.latest_20251011.csv');
|
||||||
|
$this->command->error('File csv tidak ditemukan.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($handle = fopen($filePath, 'r')) === false) {
|
||||||
|
Log::error('Gagal membuka file CSV: ' . $filePath);
|
||||||
|
$this->command->error('Gagal membuka file CSV.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$header = fgetcsv($handle, 0, ',');
|
||||||
|
$rows = [];
|
||||||
|
$batchSize = 500;
|
||||||
|
$userData = [];
|
||||||
|
$branchCache = []; // <-- Gunakan sebagai cache
|
||||||
|
$totalData = 0;
|
||||||
|
|
||||||
|
while (($data = fgetcsv($handle, 0, ',')) !== false) {
|
||||||
|
$totalData++;
|
||||||
|
}
|
||||||
|
|
||||||
|
rewind($handle);
|
||||||
|
fgetcsv($handle, 0, ','); // Skip header
|
||||||
|
|
||||||
|
$batchCount = 0;
|
||||||
|
$currentRow = 0;
|
||||||
|
$errorCount = 0;
|
||||||
|
$errorDebitureIds = [];
|
||||||
|
|
||||||
|
while (($data = fgetcsv($handle, 0, ',')) !== false) {
|
||||||
|
if (count($data) != count($header)) {
|
||||||
|
Log::warning('Baris CSV memiliki jumlah kolom yang tidak sesuai: ' . json_encode($data));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows[] = array_combine($header, $data);
|
||||||
|
$currentRow++;
|
||||||
|
|
||||||
|
if (count($rows) >= $batchSize) {
|
||||||
|
$batchCount++;
|
||||||
|
$this->command->info("Memproses batch ke-{$batchCount} ({$currentRow}/{$totalData})");
|
||||||
|
$this->processBatch($rows, $branchCache, $userData, $errorCount, $errorDebitureIds, $totalData, $batchCount, $currentRow);
|
||||||
|
$rows = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// info_harga_laporan_202505021522.csv
|
||||||
|
// print_r($rows);
|
||||||
|
if (!empty($rows)) {
|
||||||
|
$batchCount++;
|
||||||
|
$this->command->info("Memproses batch ke-{$batchCount} ({$currentRow}/{$totalData})");
|
||||||
|
$this->processBatch($rows, $branchCache, $userData, $errorCount, $errorDebitureIds, $totalData, $batchCount, $currentRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($handle);
|
||||||
|
$this->command->info("Data debiture berhasil dimigrasikan. Total data: {$totalData}, Total batch: {$batchCount}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function processBatch(array $rows, array &$branchCache, array &$userData, int &$errorCount, array &$errorDebitureIds, int $totalData, int $batchCount, int $currentRow)
|
||||||
|
{
|
||||||
|
// Kelompokkan berdasarkan mig_nomor_lpj
|
||||||
|
$groupedRows = $this->groupRowsByLpj($rows);
|
||||||
|
|
||||||
|
foreach ($groupedRows as $nomorLpj => $groupRows) {
|
||||||
|
try {
|
||||||
|
// Ambil informasi permohonan dan dokument_id
|
||||||
|
$nomorRegis = $this->getNomorRegistrasiPermohonan($nomorLpj, $branchCache);
|
||||||
|
if (!$nomorRegis) {
|
||||||
|
Log::warning("Nomor registrasi tidak ditemukan untuk nomor LPJ: {$nomorLpj}");
|
||||||
|
$errorCount++;
|
||||||
|
$errorDebitureIds[] = $nomorLpj;
|
||||||
|
//continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dapatkan type_penilai (misal: standar, sederhana)
|
||||||
|
$firstRow = reset($groupRows);
|
||||||
|
|
||||||
|
$typePenilai = $this->checkTypePenilai($firstRow['mig_kode_jenis_laporan'] ?? '');
|
||||||
|
|
||||||
|
if (!$typePenilai) {
|
||||||
|
Log::warning("Tidak ada jenis laporan valid untuk nomor LPJ: {$nomorLpj}");
|
||||||
|
$errorCount++;
|
||||||
|
$errorDebitureIds[] = $nomorLpj;
|
||||||
|
//continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bangun JSON type_penilai
|
||||||
|
$penilaiJson = $this->cekJenisPenilai($groupRows);
|
||||||
|
|
||||||
|
// Simpan ke tabel Penilai
|
||||||
|
|
||||||
|
// print_r(json_decode($penilaiJson, true));
|
||||||
|
|
||||||
|
// Mapping field JSON berdasarkan tipe penilaian
|
||||||
|
$fillableFieldMap = [
|
||||||
|
'memo' => 'memo',
|
||||||
|
'standar' => 'lpj',
|
||||||
|
'sederhana' => 'lpj',
|
||||||
|
'call_report' => 'call_report',
|
||||||
|
'rap' => 'rap',
|
||||||
|
'resume' => 'resume'
|
||||||
|
];
|
||||||
|
|
||||||
|
$fieldToUpdate = $fillableFieldMap[$typePenilai] ?? null;
|
||||||
|
|
||||||
|
if (!$fieldToUpdate) {
|
||||||
|
Log::warning("Field tidak dikenali untuk tipe: {$typePenilai}");
|
||||||
|
$errorCount++;
|
||||||
|
$errorDebitureIds[] = $nomorLpj;
|
||||||
|
//continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NO: 001/241917/LPJ/PJ-2251/VII/24
|
||||||
|
// 001 => kode cabang
|
||||||
|
// 241917 => nomor lpj
|
||||||
|
// LPJ => jenis laporan
|
||||||
|
// PJ-2251 => nomor registrasi ambil nilai akhirnnya 242251
|
||||||
|
// VII => bulan
|
||||||
|
// 24 => tahun
|
||||||
|
|
||||||
|
// Generate nomor_laporan
|
||||||
|
$mig_permohonan = json_decode($nomorRegis['mig_permohonan'],true) ?? '';
|
||||||
|
$tanggal = $mig_permohonan['mig_mst_lpj_tgl_laporan'] ?? $mig_permohonan['mig_mst_lpj_tgl_oto'] ?? $firstRow['mig_created_at'];
|
||||||
|
|
||||||
|
//$tanggal = $firstRow['mig_created_at'];
|
||||||
|
$nomorD = $nomorRegis['nomor_registrasi'];
|
||||||
|
$nomorRegistrasi = "PJ-{$nomorD}";
|
||||||
|
$nomorLaporan = $this->generateNomorLaporan($typePenilai, $nomorLpj, $nomorRegistrasi, $tanggal, $nomorRegis['id']);
|
||||||
|
// Simpan atau update ke tabel Penilai
|
||||||
|
$penilaiLP = Penilai::updateOrCreate(
|
||||||
|
[
|
||||||
|
'permohonan_id' => $nomorRegis['id'],
|
||||||
|
'dokument_id' => $nomorRegis['dokument_id']
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'type' => $typePenilai,
|
||||||
|
$fieldToUpdate => $penilaiJson,
|
||||||
|
'type_penilai' => $typePenilai,
|
||||||
|
'created_at' => $this->parseTimestamp($tanggal),
|
||||||
|
'updated_at' => $this->parseTimestamp($tanggal),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Simpan ke tabel Laporan
|
||||||
|
Laporan::updateOrCreate(
|
||||||
|
[
|
||||||
|
'permohonan_id' => $penilaiLP->permohonan_id,
|
||||||
|
'dokumen_jaminan_id' => $penilaiLP->dokument_id
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'nomor_laporan' => $nomorLaporan,
|
||||||
|
'created_at' => $this->parseTimestamp($tanggal),
|
||||||
|
'updated_at' => $this->parseTimestamp($tanggal)
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
$this->command->info("Berhasil simpan data penilai untuk nomor LPJ: {$nomorLpj}");
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error("Error pada nomor LPJ {$nomorLpj}: " . $e->getMessage());
|
||||||
|
$errorCount++;
|
||||||
|
$errorDebitureIds[] = $nomorLpj;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function getNomorRegistrasiPermohonan($nomorLpj, array &$cache)
|
||||||
|
{
|
||||||
|
if (isset($cache[$nomorLpj])) {
|
||||||
|
return $cache[$nomorLpj];
|
||||||
|
}
|
||||||
|
|
||||||
|
$permohonan = Permohonan::where('nomor_lpj', $nomorLpj)->first();
|
||||||
|
|
||||||
|
if (!$permohonan) {
|
||||||
|
$cache[$nomorLpj] = null;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dokumenJaminan = DokumenJaminan::where('permohonan_id', $permohonan->id)->first();
|
||||||
|
|
||||||
|
$result = [
|
||||||
|
'id' => $permohonan->id,
|
||||||
|
'dokument_id' => $dokumenJaminan ? $dokumenJaminan->id : null,
|
||||||
|
'nomor_registrasi' => $permohonan->nomor_registrasi,
|
||||||
|
'mig_permohonan' => $permohonan->mig_permohonan
|
||||||
|
];
|
||||||
|
|
||||||
|
$cache[$nomorLpj] = $result;
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
private function groupRowsByLpj(array $rows): array
|
||||||
|
{
|
||||||
|
$grouped = [];
|
||||||
|
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$nomorLpj = $row['mig_nomor_lpj'] ?? null;
|
||||||
|
|
||||||
|
if (!empty($nomorLpj)) {
|
||||||
|
$grouped[$nomorLpj][] = $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $grouped;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkTypePenilai($type)
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'MAK' => 'memo',
|
||||||
|
'STD' => 'standar',
|
||||||
|
'SPL' => 'sederhana',
|
||||||
|
'RHP' => 'call-report',
|
||||||
|
'RAP' => 'rap',
|
||||||
|
'PRG' => 'resume',
|
||||||
|
];
|
||||||
|
|
||||||
|
return $data[$type];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private function cekJenisPenilai(array $groupRows)
|
||||||
|
{
|
||||||
|
// Urutkan grup berdasarkan mig_urutan_seq
|
||||||
|
usort($groupRows, function ($a, $b) {
|
||||||
|
return ($a['mig_urutan_seq'] ?? 999) <=> ($b['mig_urutan_seq'] ?? 999);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Inisialisasi struktur JSON
|
||||||
|
$penilaiJson = [
|
||||||
|
'luas_bangunan' => null,
|
||||||
|
'luas_tanah' => null,
|
||||||
|
'nilai_tanah_1' => null,
|
||||||
|
'nilai_tanah_2' => null,
|
||||||
|
'sarana_pelengkap_penilai' => null,
|
||||||
|
'nilai_sarana_pelengkap_1' => null,
|
||||||
|
'nilai_sarana_pelengkap_2' => null,
|
||||||
|
'total_nilai_pasar_wajar' => null,
|
||||||
|
'likuidasi' => null,
|
||||||
|
'likuidasi_nilai_1' => null,
|
||||||
|
'likuidasi_nilai_2' => null,
|
||||||
|
'asuransi_luas_bangunan' => null,
|
||||||
|
'asuransi_nilai_1' => null,
|
||||||
|
'asuransi_nilai_2' => "0",
|
||||||
|
'npw_tambahan' => []
|
||||||
|
];
|
||||||
|
|
||||||
|
// Ambil mainRow (urutan pertama)
|
||||||
|
$mainRow = null;
|
||||||
|
foreach ($groupRows as $row) {
|
||||||
|
if (($row['mig_urutan_seq'] ?? '') == 1) {
|
||||||
|
$mainRow = $row;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Jika tidak ada mainRow, ambil baris pertama sebagai fallback
|
||||||
|
if (!$mainRow && !empty($groupRows[0])) {
|
||||||
|
$mainRow = $groupRows[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mainRow) {
|
||||||
|
$penilaiJson['total_nilai_pasar_wajar'] = $mainRow['mig_nilai_total_nilai_pasar'] ?? null;
|
||||||
|
$penilaiJson['likuidasi'] = $mainRow['mig_nilai_likudasi'] ?? null;
|
||||||
|
|
||||||
|
// Hitung likuidasi nilai 2 jika ada total dan persen likuidasi
|
||||||
|
$totalPasarWajar = (int)str_replace('.', '', $mainRow['mig_nilai_total_nilai_pasar'] ?? 0);
|
||||||
|
$persenLikuidasi = (int)($mainRow['mig_nilai_likudasi'] ?? 0);
|
||||||
|
$penilaiJson['likuidasi_nilai_1'] = $mainRow['mig_nilai_total_nilai_pasar'] ?? null;
|
||||||
|
$penilaiJson['likuidasi_nilai_2'] = number_format(
|
||||||
|
$totalPasarWajar * ($persenLikuidasi / 100),
|
||||||
|
0,
|
||||||
|
'',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
|
// Isi data utama hanya untuk urutan 1
|
||||||
|
$penilaiJson['luas_tanah'] = $mainRow['mig_nilai_satuan'] ?? null;
|
||||||
|
$penilaiJson['nilai_tanah_1'] = $mainRow['mig_harga_satuan'] ?? null;
|
||||||
|
$penilaiJson['nilai_tanah_2'] = number_format(
|
||||||
|
(int)str_replace('.', '', $mainRow['mig_nilai_satuan'] ?? 0) *
|
||||||
|
(int)str_replace('.', '', $mainRow['mig_harga_satuan'] ?? 0),
|
||||||
|
0,
|
||||||
|
'',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Proses tambahan (urutan > 1)
|
||||||
|
foreach ($groupRows as $row) {
|
||||||
|
// Hanya proses jika mig_urutan_seq ada
|
||||||
|
$urutan = $row['mig_urutan_seq'] ?? '';
|
||||||
|
if (empty($urutan)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tambahkan ke npw_tambahan
|
||||||
|
$penilaiJson['npw_tambahan'][] = [
|
||||||
|
'name' => $row['mig_keterangan'] ?? 'Luas Bangunan Tambahan',
|
||||||
|
'luas' => $row['mig_nilai_satuan'] ?? null,
|
||||||
|
'nilai_1' => $row['mig_harga_satuan'] ?? null,
|
||||||
|
'nilai_2' => number_format(
|
||||||
|
(int)str_replace('.', '', $row['mig_nilai_satuan'] ?? 0) *
|
||||||
|
(int)str_replace('.', '', $row['mig_harga_satuan'] ?? 0),
|
||||||
|
0,
|
||||||
|
'',
|
||||||
|
''
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kosongkan npw_tambahan jika kosong
|
||||||
|
if (empty($penilaiJson['npw_tambahan'])) {
|
||||||
|
$penilaiJson['npw_tambahan'] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_encode($penilaiJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function convertToRoman($month)
|
||||||
|
{
|
||||||
|
$roman = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X', 'XI', 'XII'];
|
||||||
|
return $month >= 1 && $month <= 12 ? $roman[$month - 1] : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
private function generateNomorLaporan($typePenilai, $nomorLpj, $nomorRegistrasi, $tanggal)
|
||||||
|
{
|
||||||
|
// Mapping type_penilai ke singkatan laporan
|
||||||
|
$laporanMap = [
|
||||||
|
'memo' => 'MEMO',
|
||||||
|
'standar' => 'LPJ',
|
||||||
|
'sederhana' => 'LPJ',
|
||||||
|
'call_report' => 'CALL',
|
||||||
|
'rap' => 'RAP',
|
||||||
|
'resume' => 'RESUME'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Dapatkan tahun dan bulan dari tanggal
|
||||||
|
$tanggal_ = $this->parseTimestamp($tanggal);
|
||||||
|
$date = \Carbon\Carbon::parse($tanggal_);
|
||||||
|
$kodeCabang = '001'; // bisa diambil dari user atau parameter lain jika dinamis
|
||||||
|
$tahun = substr($date->year, -2); // 2024 → 24
|
||||||
|
$bulan = $this->convertToRoman($date->month); // 7 → VII
|
||||||
|
|
||||||
|
// Format akhir nomor registrasi (PJ-XXX)
|
||||||
|
$nomorDebiturAkhir = substr($nomorRegistrasi, -4); // PJ-2251 → 2251
|
||||||
|
|
||||||
|
return sprintf(
|
||||||
|
"%s/%s/%s/%s/%s/%s",
|
||||||
|
$kodeCabang,
|
||||||
|
$nomorLpj,
|
||||||
|
$laporanMap[$typePenilai] ?? strtoupper($typePenilai),
|
||||||
|
"PJ-" . $nomorDebiturAkhir,
|
||||||
|
$bulan,
|
||||||
|
$tahun
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function parseTimestamp(?string $timestamp): ?string
|
||||||
|
{
|
||||||
|
if (!$timestamp) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trim whitespace dan normalize
|
||||||
|
$timestamp = trim($timestamp);
|
||||||
|
|
||||||
|
// Log untuk debugging
|
||||||
|
Log::info('Mencoba parsing timestamp: "' . $timestamp . '"');
|
||||||
|
|
||||||
|
// Parsing dengan DateTime native PHP untuk lebih robust
|
||||||
|
try {
|
||||||
|
// Pattern untuk format d/m/Y H:i:s
|
||||||
|
if (preg_match('/^(\d{1,2})\/(\d{1,2})\/(\d{4})\s+(\d{1,2}):(\d{1,2}):(\d{1,2})$/', $timestamp, $matches)) {
|
||||||
|
$day = (int) $matches[1];
|
||||||
|
$month = (int) $matches[2];
|
||||||
|
$year = (int) $matches[3];
|
||||||
|
$hour = (int) $matches[4];
|
||||||
|
$minute = (int) $matches[5];
|
||||||
|
$second = (int) $matches[6];
|
||||||
|
|
||||||
|
// Validasi nilai
|
||||||
|
if ($day >= 1 && $day <= 31 && $month >= 1 && $month <= 12 && $year >= 1900 && $year <= 2100 &&
|
||||||
|
$hour >= 0 && $hour <= 23 && $minute >= 0 && $minute <= 59 && $second >= 0 && $second <= 59) {
|
||||||
|
|
||||||
|
// Buat DateTime object langsung
|
||||||
|
$dateTime = new \DateTime();
|
||||||
|
$dateTime->setDate($year, $month, $day);
|
||||||
|
$dateTime->setTime($hour, $minute, $second);
|
||||||
|
|
||||||
|
$result = $dateTime->format('Y-m-d H:i:s');
|
||||||
|
Log::info('Berhasil parsing dengan DateTime: ' . $timestamp . ' -> ' . $result);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pattern untuk format d/m/Y tanpa waktu
|
||||||
|
if (preg_match('/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/', $timestamp, $matches)) {
|
||||||
|
$day = (int) $matches[1];
|
||||||
|
$month = (int) $matches[2];
|
||||||
|
$year = (int) $matches[3];
|
||||||
|
|
||||||
|
// Validasi nilai
|
||||||
|
if ($day >= 1 && $day <= 31 && $month >= 1 && $month <= 12 && $year >= 1900 && $year <= 2100) {
|
||||||
|
|
||||||
|
// Buat DateTime object langsung
|
||||||
|
$dateTime = new \DateTime();
|
||||||
|
$dateTime->setDate($year, $month, $day);
|
||||||
|
$dateTime->setTime(0, 0, 0);
|
||||||
|
|
||||||
|
$result = $dateTime->format('Y-m-d H:i:s');
|
||||||
|
Log::info('Berhasil parsing tanpa waktu dengan DateTime: ' . $timestamp . ' -> ' . $result);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('Gagal parsing dengan DateTime: ' . $timestamp . '. Error: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback ke format Carbon standar untuk format lainnya
|
||||||
|
$formats = [
|
||||||
|
'Y-m-d H:i:s',
|
||||||
|
'Y-m-d',
|
||||||
|
'd-m-Y H:i:s',
|
||||||
|
'd-m-Y',
|
||||||
|
'j-n-Y H:i:s',
|
||||||
|
'j-n-Y',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($formats as $format) {
|
||||||
|
try {
|
||||||
|
$carbon = \Carbon\Carbon::createFromFormat($format, $timestamp);
|
||||||
|
|
||||||
|
if ($carbon && $carbon->format($format) === $timestamp) {
|
||||||
|
// Jika format tidak mengandung waktu, set ke awal hari
|
||||||
|
if (!str_contains($format, 'H:i:s')) {
|
||||||
|
$carbon = $carbon->startOfDay();
|
||||||
|
}
|
||||||
|
Log::info('Berhasil parsing dengan format ' . $format . ': ' . $timestamp . ' -> ' . $carbon->toDateTimeString());
|
||||||
|
return $carbon->toDateTimeString();
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Lanjut ke format berikutnya
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Log::error('Tidak dapat memparsing timestamp dengan format apapun: "' . $timestamp . '"');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function initializeErrorLog()
|
||||||
|
{
|
||||||
|
$file = $this->errorLogFile;
|
||||||
|
|
||||||
|
if (file_exists($file)) {
|
||||||
|
unlink($file); // Hapus file lama
|
||||||
|
}
|
||||||
|
|
||||||
|
$handle = fopen($file, 'w');
|
||||||
|
fputcsv($handle, ['mig_kd_debitur_seq', 'Error']);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function logError(string $kode, string $message)
|
||||||
|
{
|
||||||
|
Log::error("Error migrasi dokumen jaminan [$kode]: $message");
|
||||||
|
|
||||||
|
$handle = fopen($this->errorLogFile, 'a');
|
||||||
|
fputcsv($handle, [$kode, $message]);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
414
database/seeders/MigrationPermohonanSeeder.php
Normal file
414
database/seeders/MigrationPermohonanSeeder.php
Normal file
@@ -0,0 +1,414 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Lpj\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Modules\Lpj\Models\Permohonan;
|
||||||
|
use Modules\Lpj\Models\Debiture;
|
||||||
|
use Modules\Basicdata\Models\Branch;
|
||||||
|
use Modules\Usermanagement\Models\User;
|
||||||
|
|
||||||
|
class MigrationPermohonanSeeder extends Seeder
|
||||||
|
{
|
||||||
|
protected $errorLogFile = __DIR__ . '/csv/permohonan/permohonan.2024.2025_error.csv';
|
||||||
|
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
// Bersihkan file error sebelum mulai
|
||||||
|
$this->initializeErrorLog();
|
||||||
|
|
||||||
|
$filePath = realpath(__DIR__ . '/csv/permohonan/permohonan.2024.2025.csv');
|
||||||
|
|
||||||
|
if (!$filePath) {
|
||||||
|
Log::error('File CSV tidak ditemukan: ' . __DIR__ . '/csv/permohonan/permohonan.2024.2025.csv');
|
||||||
|
$this->command->error('File CSV tidak ditemukan.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($handle = fopen($filePath, 'r')) === false) {
|
||||||
|
Log::error('Gagal membuka file CSV: ' . $filePath);
|
||||||
|
$this->command->error('Gagal membuka file CSV.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$header = fgetcsv($handle, 0, ',');
|
||||||
|
$rows = [];
|
||||||
|
$batchSize = 1000;
|
||||||
|
$branchCache = [];
|
||||||
|
$debitureCache = [];
|
||||||
|
$totalData = 0;
|
||||||
|
$currentRow = 0;
|
||||||
|
$batchCount = 0;
|
||||||
|
|
||||||
|
// Hitung total data
|
||||||
|
while (fgetcsv($handle, 0, ',') !== false) {
|
||||||
|
$totalData++;
|
||||||
|
}
|
||||||
|
|
||||||
|
rewind($handle);
|
||||||
|
fgetcsv($handle, 0, ','); // Lewati header
|
||||||
|
|
||||||
|
while (($data = fgetcsv($handle, 0, ',')) !== false) {
|
||||||
|
if (count($data) != count($header)) {
|
||||||
|
$nomorJaminan = $data[array_search('mig_mst_jaminan_nomor_jaminan', $header)] ?? '-';
|
||||||
|
$this->logError($nomorJaminan, count($data).' Jumlah kolom tidak sesuai dengan header. Header: '.count($header));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows[] = array_combine($header, $data);
|
||||||
|
$currentRow++;
|
||||||
|
// print_r($rows);
|
||||||
|
if (count($rows) >= $batchSize) {
|
||||||
|
$batchCount++;
|
||||||
|
$this->command->info("Memproses batch ke-{$batchCount} ({$currentRow}/{$totalData})");
|
||||||
|
$this->processBatch($rows, $branchCache, $debitureCache, $totalData, $batchCount);
|
||||||
|
$rows = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// print_r($rows);
|
||||||
|
|
||||||
|
if (!empty($rows)) {
|
||||||
|
$batchCount++;
|
||||||
|
$this->command->info("Memproses batch ke-{$batchCount} ({$currentRow}/{$totalData})");
|
||||||
|
$this->processBatch($rows, $branchCache, $debitureCache, $totalData, $batchCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($handle);
|
||||||
|
|
||||||
|
$this->command->info("Migrasi selesai. Total data diproses: $totalData.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function processBatch(array $rows, array &$branchCache, array &$debitureCache, int $totalData, int $batchCount)
|
||||||
|
{
|
||||||
|
$userData = [];
|
||||||
|
foreach ($rows as $index => $row) {
|
||||||
|
try {
|
||||||
|
$nomorJaminan = $row['mig_mst_jaminan_nomor_jaminan'] ?? '-';
|
||||||
|
|
||||||
|
// Cek apakah sudah diproses
|
||||||
|
$existingRecord = Permohonan::where('nomor_registrasi', $row['mig_mst_jaminan_nomor_jaminan'])->first();
|
||||||
|
if ($existingRecord && $existingRecord->processed_at) {
|
||||||
|
$this->command->info("Data sudah diproses: $nomorJaminan");
|
||||||
|
//continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ambil branch_id
|
||||||
|
$branchId = $this->getBranchId($row['mig_mst_jaminan_kd_cabang'] ?? null, $branchCache);
|
||||||
|
// if (!$branchId) {
|
||||||
|
// $this->logError($branchId, 'Cabang tidak ditemukan');
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Ambil Debitur ID
|
||||||
|
$debitureId = $this->getDebiturId($row['mig_mst_jaminan_kd_debitur_seq'], $debitureCache);
|
||||||
|
if (!$debitureId) {
|
||||||
|
$this->logError($nomorJaminan, 'Debitur tidak ditemukan');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ambil User IDs
|
||||||
|
$userId = $this->getUserId($row['mig_mst_jaminan_nama_ao'], $branchCache, true);
|
||||||
|
|
||||||
|
// jika external matikan
|
||||||
|
$approved1Id = $this->getUserId($row['mig_mst_lpj_user_approved_1'], $branchCache, false);
|
||||||
|
$approved2Id = $this->getUserId($row['mig_mst_lpj_user_approved_2'], $branchCache, false);
|
||||||
|
$periksaId = $this->getUserId($row['mig_mst_lpj_user_periksa'], $branchCache, false);
|
||||||
|
|
||||||
|
// // Ambil user IDs berdasarkan NIK
|
||||||
|
$userIdUpdate = $this->getUserIdData($row['mig_mst_jaminan_user_create'] ?? null, $userData)['id'];
|
||||||
|
$userIdOtorisasi = $this->getUserIdData($row['mig_mst_jaminan_user_oto'] ?? null, $userData)['id'];
|
||||||
|
|
||||||
|
// jika external matikan
|
||||||
|
// if (!$userIdUpdate || !$userIdOtorisasi) {
|
||||||
|
// $this->logError($userIdUpdate, 'Salah satu user tidak ditemukan');
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Mapping field user
|
||||||
|
$mapUser = [
|
||||||
|
'created_by' => $userIdUpdate,
|
||||||
|
'updated_by' => $userIdUpdate,
|
||||||
|
'authorized_by' => $userIdOtorisasi,
|
||||||
|
];
|
||||||
|
|
||||||
|
// jika external matikan
|
||||||
|
// if (!$userId || !$approved1Id || !$approved2Id) {
|
||||||
|
// $this->logError($userId, 'Salah satu user tidak ditemukan');
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Mapping data
|
||||||
|
$jenisFasilitas = $this->checkJenisFasilitas($row['mig_mst_jaminan_kd_jenis_fas_seq']);
|
||||||
|
$tujuanPenilaian = $this->checkTujuanPenilaian($row['mig_mst_jaminan_kd_tujuan_seq']);
|
||||||
|
$regionId = $this->checkRegion($row['mig_mst_kode_kelompok_region']);
|
||||||
|
|
||||||
|
|
||||||
|
$nomor_lpj = isset($row['mig_mst_lpj_nomor_lpj']) ? $row['mig_mst_lpj_nomor_lpj'] : '';
|
||||||
|
$nomor_lpj = is_numeric($nomor_lpj) ? (int)$nomor_lpj : 0;
|
||||||
|
|
||||||
|
$jenisPenilaian = $row['mig_internal_or_external'] == 1 ? 2 : 1;
|
||||||
|
|
||||||
|
// Simpan data
|
||||||
|
$permohonan = Permohonan::updateOrCreate([
|
||||||
|
'nomor_registrasi' => $nomorJaminan,
|
||||||
|
],[
|
||||||
|
'nomor_registrasi' => $nomorJaminan,
|
||||||
|
'tanggal_permohonan' => $this->parseDate($row['tanggal_permohonan']),
|
||||||
|
'user_id' => $userId['id'],
|
||||||
|
'branch_id' => $branchId,
|
||||||
|
'tujuan_penilaian_id' => $tujuanPenilaian,
|
||||||
|
'debiture_id' => $debitureId,
|
||||||
|
'jenis_fasilitas_kredit_id' => $jenisFasilitas,
|
||||||
|
'nilai_plafond_id' => 2,
|
||||||
|
'status' => 'done',
|
||||||
|
// jika external matikan
|
||||||
|
'approval_eo' => $approved1Id['id'] ?? 0,
|
||||||
|
'approval_eo_at' => $this->parseTimestamp($row['mig_mst_lpj_tgl_approved_1']),
|
||||||
|
'approval_dd' => $approved2Id['id'] ?? 0,
|
||||||
|
'approval_dd_at' => $this->parseTimestamp($row['mig_mst_lpj_tgl_approved_2']),
|
||||||
|
'approval_so' => $periksaId['id'] ?? 0,
|
||||||
|
'approval_so_at' => $this->parseTimestamp($row['mig_mst_lpj_tgl_periksa']),
|
||||||
|
// end external matikan
|
||||||
|
'keterangan' => $row['mig_mst_jaminan_catatan'] ?? null,
|
||||||
|
'status_bayar' => 'sudah_bayar',
|
||||||
|
'created_at' => $this->parseTimestamp($row['mig_mst_jaminan_tgl_create']),
|
||||||
|
'updated_at' => $this->parseTimestamp($row['mig_mst_jaminan_tgl_update']),
|
||||||
|
'mig_kd_debitur_seq' => $row['mig_mst_jaminan_kd_debitur_seq'],
|
||||||
|
'nomor_lpj' => $nomor_lpj,
|
||||||
|
'region_id' => $regionId,
|
||||||
|
'jenis_penilaian_id' => $jenisPenilaian,
|
||||||
|
'authorized_by' => $mapUser['authorized_by'],
|
||||||
|
'created_by' => $mapUser['created_by'],
|
||||||
|
'updated_by' => $mapUser['updated_by'],
|
||||||
|
'mig_nama_ao' => $row['mig_mst_jaminan_nama_ao'],
|
||||||
|
'mig_permohonan' => json_encode($row),
|
||||||
|
'is_mig' => 1
|
||||||
|
]);
|
||||||
|
|
||||||
|
if($permohonan && $nomorJaminan=='253122'){
|
||||||
|
Log::info($permohonan);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->command->info("Proses data permohonan $nomorJaminan (" . ($index + 1) . '/' . count($rows) . " pada batch ke-$batchCount)");
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$nomorJaminan = $row['mig_mst_jaminan_nomor_jaminan'] ?? '-';
|
||||||
|
$this->logError($nomorJaminan, "Error eksepsi: " . $e->getMessage());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getUserIdData(?string $code, array &$cache): array
|
||||||
|
{
|
||||||
|
if (!$code) {
|
||||||
|
return ['id' => null, 'branch_id' => null];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($cache[$code])) {
|
||||||
|
return $cache[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = User::where('nik', $code)->first();
|
||||||
|
|
||||||
|
if ($user) {
|
||||||
|
$cache[$code] = ['id' => $user->id, 'branch_id' => $user->branch_id];
|
||||||
|
return $cache[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['id' => null, 'branch_id' => null];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getUserId(string $value, array &$cache, bool $includeBranch = false): ?array
|
||||||
|
{
|
||||||
|
if (isset($cache[$value])) {
|
||||||
|
return $cache[$value];
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = null;
|
||||||
|
|
||||||
|
if ($includeBranch) {
|
||||||
|
$user = User::whereRaw('LOWER(name) = ?', [strtolower($value)])->first();
|
||||||
|
} else {
|
||||||
|
$user = User::where('nik', $value)->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user) {
|
||||||
|
$result = ['id' => $user->id];
|
||||||
|
if ($includeBranch) {
|
||||||
|
$result['branch_id'] = $user->branch_id;
|
||||||
|
}
|
||||||
|
$cache[$value] = $result;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['id' => null, 'branch_id' => null];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getDebiturId(string $code, array &$cache): ?int
|
||||||
|
{
|
||||||
|
if (isset($cache[$code])) {
|
||||||
|
return $cache[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
$debitur = Debiture::where('mig_kd_debitur_seq', $code)->first();
|
||||||
|
|
||||||
|
if ($debitur) {
|
||||||
|
$cache[$code] = $debitur->id;
|
||||||
|
return $debitur->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
private function getBranchId(?string $code, array &$cache): ?int
|
||||||
|
{
|
||||||
|
if (!$code) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($cache[$code])) {
|
||||||
|
return $cache[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
$branch = Branch::where('code', $code)->first();
|
||||||
|
|
||||||
|
if ($branch) {
|
||||||
|
$cache[$code] = $branch->id;
|
||||||
|
return $branch->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
private function checkJenisFasilitas($code): int
|
||||||
|
{
|
||||||
|
// Extract the integer part before the decimal
|
||||||
|
$intCode = (int) $code;
|
||||||
|
|
||||||
|
$mapping = [
|
||||||
|
161337594516 => 1,
|
||||||
|
161337598118 => 14,
|
||||||
|
155739382483 => 7,
|
||||||
|
2 => 9,
|
||||||
|
153568936592 => 10,
|
||||||
|
155737674431 => 11,
|
||||||
|
161337561199 => 12,
|
||||||
|
1 => 13,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $mapping[$intCode] ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkTujuanPenilaian($code): int
|
||||||
|
{
|
||||||
|
$code = (int) $code;
|
||||||
|
$mapping = [
|
||||||
|
1 => 1,
|
||||||
|
2 => 2,
|
||||||
|
3 => 9,
|
||||||
|
4 => 10,
|
||||||
|
5 => 8,
|
||||||
|
6 => 3,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $mapping[$code] ?? 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkRegion($code): int
|
||||||
|
{
|
||||||
|
$mapping = [
|
||||||
|
'01' => 1,
|
||||||
|
'02' => 2,
|
||||||
|
'04' => 3,
|
||||||
|
'07' => 4,
|
||||||
|
'06' => 5,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $mapping[$code] ?? 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function parseDate(?string $date): ?string
|
||||||
|
{
|
||||||
|
if (!$date) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Coba format d/m/Y terlebih dahulu (contoh: 30/1/2025)
|
||||||
|
return \Carbon\Carbon::createFromFormat('d/m/Y', $date)->toDateString();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
try {
|
||||||
|
// Fallback ke format Y-m-d jika gagal
|
||||||
|
return \Carbon\Carbon::createFromFormat('Y-m-d', $date)->toDateString();
|
||||||
|
} catch (\Exception $e2) {
|
||||||
|
// If both formats fail, try to parse with Carbon::parse as last resort
|
||||||
|
try {
|
||||||
|
return \Carbon\Carbon::parse($date)->toDateString();
|
||||||
|
} catch (\Exception $e3) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function parseTimestamp(?string $timestamp): ?string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (!$timestamp) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cek format d/m/Y H:i:s (contoh: 29/9/2025 17:20:36)
|
||||||
|
if (preg_match('/^\d{1,2}\/\d{1,2}\/\d{4} \d{1,2}:\d{2}:\d{2}$/', $timestamp)) {
|
||||||
|
return \Carbon\Carbon::createFromFormat('d/m/Y H:i:s', $timestamp)->toDateTimeString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cek jika format hanya tanggal (Y-m-d)
|
||||||
|
if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $timestamp)) {
|
||||||
|
return \Carbon\Carbon::createFromFormat('Y-m-d', $timestamp)
|
||||||
|
->startOfDay()
|
||||||
|
->toDateTimeString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format lengkap (Y-m-d H:i:s)
|
||||||
|
if (preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/', $timestamp)) {
|
||||||
|
return \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $timestamp)->toDateTimeString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback: coba parsing dengan createFromFormat tambahan atau gunakan parse
|
||||||
|
return \Carbon\Carbon::parse($timestamp)->toDateTimeString();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error('Gagal memparsing timestamp: ' . $timestamp . '. Pesan: ' . $e->getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private function initializeErrorLog()
|
||||||
|
{
|
||||||
|
$file = $this->errorLogFile;
|
||||||
|
|
||||||
|
// Hapus file lama jika ada
|
||||||
|
if (file_exists($file)) {
|
||||||
|
unlink($file);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Buat file baru dengan header
|
||||||
|
$handle = fopen($file, 'w');
|
||||||
|
fputcsv($handle, ['mig_mst_jaminan_nomor_jaminan', 'Error']);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function logError($nomorJaminan, string $message)
|
||||||
|
{
|
||||||
|
Log::error("Error migrasi permohonan [$nomorJaminan]: $message");
|
||||||
|
|
||||||
|
// Tulis ke file error
|
||||||
|
$handle = fopen($this->errorLogFile, 'a');
|
||||||
|
fputcsv($handle, [$nomorJaminan, $message]);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ namespace Modules\Lpj\Database\Seeders;
|
|||||||
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
use Modules\Lpj\Models\Teams;
|
use Modules\Lpj\Models\Teams;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
class TeamsSeeder extends Seeder
|
class TeamsSeeder extends Seeder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -12,14 +12,6 @@ class TeamsSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
Teams::insert([
|
DB::unprepared(file_get_contents(__DIR__ . '/sql/teams.sql'));
|
||||||
[
|
|
||||||
'regions_id' => 1,
|
|
||||||
'code' => 'T01',
|
|
||||||
'name' => 'Team 1',
|
|
||||||
'created_at' => now(),
|
|
||||||
'updated_at' => now()
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,36 @@ class TujuanPenilaianKJPPSeeder extends Seeder
|
|||||||
'status' => 1,
|
'status' => 1,
|
||||||
'created_at' => now(),
|
'created_at' => now(),
|
||||||
'updated_at' => now()
|
'updated_at' => now()
|
||||||
]
|
],
|
||||||
|
[
|
||||||
|
'code' => 'TPK05',
|
||||||
|
'name' => 'Penilaian Ulang Jaminan / Review Tahunan',
|
||||||
|
'status' => 1,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now()
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'code' => 'TPK06',
|
||||||
|
'name' => 'Lelang',
|
||||||
|
'status' => 1,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now()
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'code' => 'TPK07',
|
||||||
|
'name' => 'Permohonan Baru',
|
||||||
|
'status' => 1,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now()
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'code' => 'TPK08',
|
||||||
|
'name' => 'Penambahan Fasilitas / Jaminan',
|
||||||
|
'status' => 1,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now()
|
||||||
|
],
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,38 @@ class TujuanPenilaianSeeder extends Seeder
|
|||||||
'created_at' => now(),
|
'created_at' => now(),
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
'deleted_at' => null,
|
'deleted_at' => null,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'code' => 'TP0007',
|
||||||
|
'name' => 'Jual Beli',
|
||||||
|
'status' => 1,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now(),
|
||||||
|
'deleted_at' => null,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'code' => 'TP0008',
|
||||||
|
'name' => 'KPR eks BPPN',
|
||||||
|
'status' => 1,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now(),
|
||||||
|
'deleted_at' => null,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'code' => 'TP0009',
|
||||||
|
'name' => 'Penambahan Fasilitas / Jaminan',
|
||||||
|
'status' => 1,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now()
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'code' => 'TP00010',
|
||||||
|
'name' => 'Penukaran Jaminan',
|
||||||
|
'status' => 1,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now()
|
||||||
]
|
]
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
database/seeders/sql/fasilitas_objek.sql
Normal file
10
database/seeders/sql/fasilitas_objek.sql
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
INSERT INTO `fasilitas_objek` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'FU001', 'Tempat Ibadah', 1, NULL, '2024-11-28 18:57:35', '2024-11-28 18:57:35', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'FU002', 'Rumah Sakit', 1, NULL, '2024-11-28 18:57:50', '2024-11-28 18:57:50', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'FU003', 'Sekolah', 1, NULL, '2024-11-28 18:58:05', '2024-11-28 18:58:05', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(4, 'FU004', 'Kantor Pemerintahan', 1, NULL, '2024-11-28 18:58:27', '2024-11-28 18:58:27', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(5, 'FU005', 'Stasiun Kereta', 1, NULL, '2024-11-28 18:58:49', '2024-11-28 18:58:49', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(6, 'FU006', 'Terminal Bus', 1, NULL, '2024-11-28 18:59:09', '2024-11-28 18:59:09', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(7, 'FU007', 'Bandara', 1, NULL, '2024-11-28 18:59:26', '2024-11-28 18:59:26', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(8, 'FU009', 'Pos Polisi', 1, NULL, '2024-11-28 18:59:50', '2024-11-28 18:59:50', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(9, 'FU010', 'Lainnya', 1, NULL, '2024-11-28 19:00:07', '2024-11-28 19:00:07', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
4
database/seeders/sql/gol_mas_sekitar.sql
Normal file
4
database/seeders/sql/gol_mas_sekitar.sql
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
INSERT INTO `gol_mas_sekitar` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'GMS001', 'Menengah', 1, NULL, '2024-11-05 00:36:23', '2024-11-05 00:36:23', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'GMS002', 'Menengah Bawah', 1, NULL, '2024-11-05 00:36:35', '2024-11-05 00:36:35', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'GMS003', 'Menengah Atas', 1, NULL, '2024-11-05 00:36:48', '2024-11-05 00:36:48', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
6
database/seeders/sql/jenis_bangunan.sql
Normal file
6
database/seeders/sql/jenis_bangunan.sql
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
INSERT INTO `jenis_bangunan` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'JB001', 'Rumah', 1, NULL, '2024-11-04 21:43:16', '2024-11-04 21:43:16', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'JB002', 'Ruko', 1, NULL, '2024-11-04 21:43:28', '2024-11-04 21:43:28', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'JB003', 'Gudang', 1, NULL, '2024-11-04 21:43:41', '2024-11-04 21:43:41', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(4, 'JB004', 'Pabrik', 1, NULL, '2024-11-04 21:43:53', '2024-11-04 21:43:53', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(5, 'JB005', 'Lainnya', 1, NULL, '2024-11-04 21:44:08', '2024-11-04 21:44:08', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
@@ -1,29 +1,44 @@
|
|||||||
INSERT INTO jenis_jaminan VALUES
|
|
||||||
(1, 'JJ001', 'Tanah', 'tanah', '[\"tanah\", \"lingkungan\", \"fakta\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ004\",\"JLJ005\",\"JLJ006\",\"JLJ022\"]', 1, '2024-12-06 09:16:02', '2024-12-06 09:16:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
|
||||||
(2, 'JJ002', 'Unit Apartemen', 'unit-apartemen', '[\"apartemen-kantor\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ004\",\"JLJ006\",\"JLJ007\",\"JLJ022\",\"JLJ024\"]', 1, '2024-12-06 09:16:02', '2024-12-06 09:16:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
INSERT INTO `jenis_jaminan` (`id`, `code`, `name`, `slug`, `form_kategori`, `jenis_legalitas_jaminan_id`, `status`, `created_at`, `updated_at`, `authorized_at`, `authorized_status`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`, `authorized_by`) VALUES
|
||||||
(3, 'JJ003', 'Kawasan Industrial / Komersil / Residensial - Perumahan', 'kawasan-industrial-komersil-residensial-perumahan', '[\"tanah\", \"bangunan\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ004\",\"JLJ006\",\"JLJ007\",\"JLJ008\",\"JLJ022\"]', 1, '2024-12-06 09:16:02', '2024-12-06 09:16:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(1, 'JJ001', 'Tanah kosong', 'tanah-kosong', '[\"tanah\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ004\",\"JLJ005\",\"JLJ006\",\"JLJ022\"]', NULL, NULL, '2024-12-20 00:15:07', NULL, 't', NULL, NULL, 1, NULL, NULL),
|
||||||
(4, 'JJ004', 'Mall', 'mall', 'null', '[\"JLJ001\",\"JLJ003\",\"JLJ004\",\"JLJ006\",\"JLJ007\",\"JLJ009\",\"JLJ012\",\"JLJ013\",\"JLJ014\",\"JLJ015\",\"JLJ021\",\"JLJ022\"]', 1, '2024-12-06 09:16:02', '2024-12-06 09:16:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(2, 'JJ002', 'Unit Apartemen', 'unit-apartemen', '[\"apartemen-kantor\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ004\",\"JLJ006\",\"JLJ007\",\"JLJ022\",\"JLJ024\"]', NULL, NULL, '2024-12-03 03:38:02', NULL, 'r', NULL, NULL, 1, NULL, NULL),
|
||||||
(5, 'JJ005', 'Pabrik', 'pabrik', 'null', '[\"JLJ001\",\"JLJ003\",\"JLJ004\",\"JLJ006\",\"JLJ007\",\"JLJ009\",\"JLJ011\"]', 1, '2024-12-06 09:16:02', '2024-12-06 09:16:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(3, 'JJ003', 'Kawasan Industrial / Komersil / Residensial - Perumahan', 'kawasan-industrial-komersil-residensial-perumahan', '[\"tanah\", \"bangunan\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ004\",\"JLJ005\",\"JLJ007\",\"JLJ008\",\"JLJ009\",\"JLJ022\",\"JLJ024\",\"JLJ039\",\"JLJ040\"]', NULL, NULL, '2025-03-10 19:34:58', NULL, 'k', NULL, NULL, 1, NULL, NULL),
|
||||||
(6, 'JJ006', 'Emas dan Perak', 'emas-dan-perak', 'null', '[\"JLJ001\",\"JLJ007\",\"JLJ014\",\"JLJ022\"]', 1, '2024-12-06 09:16:02', '2024-12-06 09:16:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(4, 'JJ004', 'Unit Kios', 'unit-kios', '[\"tanah\", \"bangunan\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ004\",\"JLJ006\",\"JLJ007\",\"JLJ009\",\"JLJ010\",\"JLJ022\"]', NULL, NULL, '2024-12-03 01:57:55', NULL, 'g', '2024-12-03 01:57:55', NULL, 1, 1, NULL),
|
||||||
(7, 'JJ007', 'Alat Berat', 'alat-berat', 'null', '[\"JLJ004\"]', 1, '2024-12-06 09:16:02', '2024-12-06 09:16:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(6, 'JJ005', 'Mall', 'mall', '[\"tanah\", \"bangunan\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ004\",\"JLJ006\",\"JLJ007\",\"JLJ009\",\"JLJ012\",\"JLJ013\",\"JLJ014\",\"JLJ015\",\"JLJ021\",\"JLJ022\"]', 1, '2024-09-11 00:51:36', '2024-12-16 19:48:40', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
(8, 'JJ008', 'Rumah Tinggal', 'rumah-tinggal', '[\"tanah\", \"bangunan\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ004\",\"JLJ006\",\"JLJ007\",\"JLJ009\",\"JLJ024\"]', 1, '2024-12-06 09:16:02', '2024-12-06 09:16:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(7, 'JJ006', 'Pabrik', 'pabrik', '[\"tanah\", \"bangunan\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ004\",\"JLJ006\",\"JLJ007\",\"JLJ009\",\"JLJ011\"]', 1, '2024-10-23 22:27:56', '2024-12-16 19:48:54', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
(9, 'JJ009', 'Full Properti', 'full-properti', '[\"tanah\", \"bangunan\", \"informasi\"]', '[\"JLJ001\",\"JLJ006\",\"JLJ007\",\"JLJ009\"]', 1, '2024-12-06 09:16:02', '2024-12-10 22:07:46', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(8, 'JJ007', 'Emas dan Perak', 'emas-dan-perak', NULL, '[\"JLJ008\",\"JLJ014\",\"JLJ022\"]', 1, '2024-12-02 02:40:42', '2024-12-02 02:40:58', NULL, NULL, '2024-12-02 02:40:58', 4, 4, 4, NULL),
|
||||||
(10, 'JJ010', 'Gudang', 'gudang', '[\"tanah\", \"bangunan\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ007\",\"JLJ009\",\"JLJ024\"]', 1, '2024-12-06 09:16:02', '2024-12-06 09:16:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(9, 'JJ008', 'Emas dan Perak', 'emas-dan-perak', NULL, '[\"JLJ008\",\"JLJ014\",\"JLJ022\"]', 1, '2024-12-02 02:41:39', '2024-12-02 02:47:44', NULL, NULL, '2024-12-02 02:47:44', 4, 4, 4, NULL),
|
||||||
(11, 'JJ011', 'Unit Kios', 'unit-kios', '[\"apartemen-kantor\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ007\",\"JLJ009\",\"JLJ024\"]', 1, '2024-12-06 09:16:02', '2024-12-06 09:16:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(10, 'JJ009', 'Emas dan Perak', 'emas-dan-perak', NULL, '[\"JLJ001\",\"JLJ007\",\"JLJ014\",\"JLJ022\"]', 1, '2024-12-02 02:49:32', '2024-12-02 02:49:32', NULL, NULL, NULL, 4, 4, NULL, NULL),
|
||||||
(12, 'JJ012', 'Gedung Mall', 'gedung-mall', '[\"tanah\", \"bangunan\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ007\",\"JLJ009\"]', 1, '2024-12-06 09:16:02', '2024-12-06 09:16:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(11, 'JJ010', 'Alat Berat', 'alat-berat', 'null', '[\"JLJ004\",\"JLJ011\"]', 1, '2024-12-03 00:59:14', '2024-12-30 23:36:25', NULL, NULL, '2024-12-30 23:36:25', 1, 1, 1, NULL),
|
||||||
(13, 'JJ013', 'Tanah Bangunan', 'tanah-bangunan', '[\"tanah\", \"bangunan\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ005\",\"JLJ007\",\"JLJ009\",\"JLJ022\",\"JLJ024\"]', 1, '2024-12-06 09:16:02', '2024-12-06 09:16:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(12, 'JJ011', 'Rumah Tinggal', 'rumah-tinggal', '[\"tanah\", \"bangunan\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ004\",\"JLJ006\",\"JLJ007\",\"JLJ009\",\"JLJ022\",\"JLJ024\"]', 1, '2024-12-03 01:12:23', '2024-12-19 00:11:01', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
(14, 'JJ014', 'Apartemen', 'apartemen', '[\"apartemen-kantor\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ022\",\"JLJ024\"]', 1, '2024-12-06 09:16:02', '2024-12-06 09:16:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(13, 'JJ012', 'Pabrik', 'pabrik', '[\"tanah\", \"bangunan\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ006\",\"JLJ007\",\"JLJ009\"]', 1, '2024-12-03 01:55:14', '2024-12-03 01:55:14', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
(15, 'JJ015', 'Ruko', 'ruko', '[\"tanah\", \"bangunan\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ007\",\"JLJ022\"]', 1, '2024-12-06 09:16:02', '2024-12-06 09:16:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(14, 'JJ013', 'Gudang', 'gudang', '[\"tanah\", \"bangunan\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ007\",\"JLJ009\",\"JLJ022\",\"JLJ024\"]', 1, '2024-12-03 01:56:09', '2025-01-22 02:13:30', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
(16, 'JJ016', 'Mesin Tekstil', 'mesin-tekstil', '[\"mesin\"]', '[\"JLJ011\",\"JLJ022\"]', 1, '2024-12-06 09:16:02', '2024-12-06 09:16:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(15, 'JJ014', 'Unit Kios', 'unit-kios', '[\"apartemen-kantor\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ007\",\"JLJ009\",\"JLJ024\"]', 1, '2024-12-03 01:58:32', '2024-12-03 04:20:22', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
(17, 'JJ017', 'Mesin', 'mesin', '[\"mesin\"]', '[\"JLJ011\",\"JLJ022\"]', 1, '2024-12-06 09:16:02', '2024-12-06 09:16:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(16, 'JJ015', 'Gedung Mall', 'gedung-mall', '[\"tanah\", \"bangunan\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ007\",\"JLJ009\"]', 1, '2024-12-03 01:59:41', '2024-12-03 01:59:41', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
(18, 'JJ018', 'Mesin Tenun Tekstil', 'mesin-tenun-tekstil', '[\"mesin\"]', '[\"JLJ011\",\"JLJ022\"]', 1, '2024-12-06 09:16:02', '2024-12-06 09:16:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(17, 'JJ016', 'Tanah Bangunan', 'tanah-bangunan', '[\"tanah\", \"bangunan\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ005\",\"JLJ007\",\"JLJ009\",\"JLJ022\",\"JLJ024\",\"JLJ039\",\"JLJ040\"]', 1, '2024-12-03 02:01:20', '2025-03-10 19:35:15', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
(19, 'JJ019', 'Penilaian Bisnis', 'penilaian-bisnis', '[\"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ007\",\"JLJ014\"]', 1, '2024-12-10 02:34:01', '2024-12-10 02:34:01', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(18, 'JJ017', 'Apartemen', 'apartemen', '[\"apartemen-kantor\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ022\",\"JLJ024\"]', 1, '2024-12-03 04:24:14', '2024-12-03 22:35:05', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
(20, 'JJ020', 'Penilaian Tanah dan Bangunan', 'penilaian-tanah-dan-bangunan', '[\"tanah\", \"bangunan\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ007\"]', 1, '2024-12-10 02:34:54', '2024-12-10 02:34:54', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(19, 'JJ018', 'Ruko/Rukan', 'rukorukan', '[\"tanah\", \"bangunan\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ007\",\"JLJ022\"]', 1, '2024-12-03 19:33:17', '2024-12-16 01:54:36', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
(21, 'JJ021', 'Penilaian Mesin', 'penilaian-mesin', '[\"mesin\"]', '[\"JLJ011\",\"JLJ022\"]', 1, '2024-12-10 03:00:13', '2024-12-10 03:00:13', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(20, 'JJ019', 'Unit Kantor', 'unit-kantor', '[\"apartemen-kantor\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ005\"]', 1, '2024-12-16 01:56:38', '2024-12-16 19:51:00', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
(22, 'JJ022', 'Penilian Kapal dan Pesawat', 'penilian-kapal-dan-pesawat', '[\"kapal\", \"pesawat\"]', '[\"JLJ011\",\"JLJ022\"]', 1, '2024-12-10 03:01:00', '2024-12-10 03:01:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(21, 'JJ020', 'Pesawat', 'pesawat', '[\"pesawat\"]', '[\"JLJ001\",\"JLJ004\"]', 1, '2024-12-16 01:58:21', '2024-12-16 01:58:21', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
(23, 'JJ023', 'Tanah Kosong', 'tanah-kosong', '[\"tanah\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ007\",\"JLJ022\"]', 1, '2024-12-10 03:18:24', '2024-12-10 03:18:24', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(22, 'JJ021', 'SPBU', 'spbu', '[\"tanah\", \"bangunan\", \"lingkungan\", \"fakta\", \"informasi\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ005\"]', 1, '2024-12-16 01:59:22', '2024-12-16 01:59:22', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
(24, 'JJ024', 'Tanah Kosong untuk dikembangkan', 'tanah-kosong-untuk-dikembangkan', '[\"tanah\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ007\",\"JLJ022\"]', 1, '2024-12-10 03:19:03', '2024-12-10 03:19:03', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(23, 'JJ022', 'Alat Berat', 'alat-berat', '[\"alat-berat\"]', '[\"JLJ004\",\"JLJ006\",\"JLJ011\"]', 1, '2024-12-30 23:37:10', '2024-12-30 23:45:54', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
(25, 'JJ025', 'Bisnis', 'bisnis', '[\"informasi\", \"lingkungan\"]', '[\"JLJ001\",\"JLJ007\"]', 1, '2024-12-10 22:09:26', '2024-12-10 22:09:26', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(24, 'JJ023', 'Lainnya', 'lainnya', '[\"tanah\", \"bangunan\"]', '[\"JLJ001\",\"JLJ007\"]', 1, '2025-03-05 21:30:11', '2025-03-05 21:30:11', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
(26, 'JJ026', 'Properti Sederhana', 'properti-sederhana', '[\"lingkungan\", \"tanah\"]', '[\"JLJ001\",\"JLJ007\"]', 1, '2024-12-10 22:10:01', '2024-12-10 22:10:01', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(25, 'JJ024', 'Hotel', 'hotel', '[\"bangunan\", \"tanah\"]', '[\"JLJ001\",\"JLJ003\",\"JLJ006\",\"JLJ007\",\"JLJ008\",\"JLJ009\",\"JLJ011\",\"JLJ013\",\"JLJ014\",\"JLJ015\",\"JLJ016\",\"JLJ017\",\"JLJ020\",\"JLJ021\",\"JLJ022\",\"JLJ024\",\"JLJ028\",\"JLJ036\"]', 1, '2025-03-09 02:01:45', '2025-03-09 02:01:45', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
(27, 'JJ027', 'Bangunan', 'bangunan', '[\"bangunan\"]', '[\"JLJ003\",\"JLJ007\"]', 1, '2024-12-12 08:13:41', '2024-12-12 08:13:41', NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
(26, 'JJ025', 'Kendaraan', 'kendaraan', '[\"kendaraan\"]', 'null', 1, '2025-04-18 05:42:13', '2025-04-18 05:42:13', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
(28, 'JJ028', 'Kendaraan Bermotor', 'kendaraan-bermotor', '[\"kendaraan\"]', '[\"JLJ022\"]', 1, '2024-12-12 08:15:51', '2024-12-12 08:15:51', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
(27, 'JJ026', 'Mesin', 'mesin', 'null', 'null', 1, '2025-04-18 05:45:21', '2025-04-18 05:45:21', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
|
(28, 'JJ027', 'Barang Elektronik', 'barang-elektronik', 'null', 'null', 1, '2025-04-18 05:47:28', '2025-04-18 05:47:28', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
|
(29, 'JJ028', 'Furniture', 'furniture', 'null', 'null', 1, '2025-04-18 05:49:22', '2025-04-18 05:49:22', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
|
(30, 'JJ029', 'Perlengkapan', 'perlengkapan', 'null', 'null', 1, '2025-04-18 05:51:00', '2025-04-18 05:51:00', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
|
(31, 'JJ030', 'Persediaan Barang', 'persediaan-barang', 'null', 'null', 1, '2025-04-18 05:52:08', '2025-04-18 05:52:08', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
|
(32, 'JJ031', 'Kapal', 'kapal', 'null', 'null', 1, '2025-04-18 05:53:26', '2025-04-18 05:53:26', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
|
(33, 'JJ032', 'Deposito Berjangka', 'deposito-berjangka', 'null', 'null', 1, '2025-04-18 05:57:44', '2025-04-18 05:57:44', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
|
(34, 'JJ033', 'Sertifikat Deposito', 'sertifikat-deposito', 'null', 'null', 1, '2025-04-18 05:58:57', '2025-04-18 05:58:57', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
|
(35, 'JJ034', 'Rekening Giro / Tabungan', 'rekening-giro-tabungan', 'null', 'null', 1, '2025-04-18 05:59:56', '2025-04-18 05:59:56', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
|
(36, 'JJ035', 'Barang Dagangan', 'barang-dagangan', 'null', 'null', 1, '2025-04-18 06:03:51', '2025-04-18 06:03:51', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
|
(37, 'JJ036', 'Piutang Dagang', 'piutang-dagang', 'null', 'null', 1, '2025-04-18 06:04:59', '2025-04-18 06:04:59', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
|
(38, 'JJ037', 'Jaminan Pribadi', 'jaminan-pribadi', 'null', 'null', 1, '2025-04-18 06:05:57', '2025-04-18 06:05:57', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
|
(39, 'JJ038', 'Jaminan Perusahaan', 'jaminan-perusahaan', 'null', 'null', 1, '2025-04-18 06:06:53', '2025-04-18 06:06:53', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
|
(40, 'JJ039', 'Resi Gudang', 'resi-gudang', 'null', 'null', 1, '2025-04-18 06:07:41', '2025-04-18 06:07:41', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
|
(41, 'JJ040', 'Surat Berharga dan Saham', 'surat-berharga-dan-saham', 'null', 'null', 1, '2025-04-18 06:08:32', '2025-04-18 06:08:32', NULL, NULL, NULL, 1, 1, NULL, NULL),
|
||||||
|
(42, 'JJ041', 'Tanah Kavling (Kerjasama)', 'tanah-kavling-kerjasama', 'null', 'null', 1, '2025-04-18 06:09:31', '2025-04-18 06:09:31', NULL, NULL, NULL, 1, 1, NULL, NULL);
|
||||||
|
|||||||
10
database/seeders/sql/jenis_kapal.sql
Normal file
10
database/seeders/sql/jenis_kapal.sql
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
INSERT INTO `jenis_kapal` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'JK001', 'Fishing Boat', 1, NULL, '2024-11-28 18:33:01', '2024-11-28 18:33:01', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'JK002', 'Tugboat', 1, NULL, '2024-11-28 18:33:55', '2024-11-28 18:33:55', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'JK003', 'Tongkang', 1, NULL, '2024-11-28 18:34:15', '2024-11-28 18:34:15', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(4, 'JK004', 'Self Propelled Oil Barge', 1, NULL, '2024-11-28 18:34:30', '2024-11-28 18:34:30', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(5, 'JK005', 'Dredger', 1, NULL, '2024-11-28 18:34:49', '2024-11-28 18:34:49', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(6, 'JK006', 'General Cargo', 1, NULL, '2024-11-28 18:35:09', '2024-11-28 18:35:09', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(7, 'JK007', 'Container Ship', 1, NULL, '2024-11-28 18:35:35', '2024-11-28 18:35:35', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(8, 'JK008', 'Oli Tangker', 1, NULL, '2024-11-28 18:36:04', '2024-11-28 18:36:04', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(9, 'JK009', 'Passenger Ship', 1, NULL, '2024-11-28 18:36:40', '2024-11-28 18:36:40', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
7
database/seeders/sql/jenis_kendaraan.sql
Normal file
7
database/seeders/sql/jenis_kendaraan.sql
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
INSERT INTO `jenis_kendaraan` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'JK001', 'Mobil Penumpang', 1, NULL, '2024-11-28 02:18:01', '2024-11-28 02:18:01', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'JK002', 'Mobil Bus', 1, NULL, '2024-11-28 02:18:15', '2024-11-28 02:18:15', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'JK003', 'Mobil Barang', 1, NULL, '2024-11-28 02:18:36', '2024-11-28 02:18:36', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(4, 'JK004', 'Sepeda Motor', 1, NULL, '2024-11-28 02:18:51', '2024-11-28 02:18:51', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(5, 'JK005', 'Kendaraan Khusus', 1, NULL, '2024-11-28 02:19:18', '2024-11-28 02:19:18', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(6, 'JK006', 'Truk', 1, NULL, '2024-11-28 02:19:34', '2024-11-28 02:19:34', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
@@ -21,4 +21,33 @@ INSERT INTO `jenis_legalitas_jaminan` (`code`, `created_at`, `custom_field`, `cu
|
|||||||
('JLJ020', '2024-12-06 09:04:50', NULL, NULL, NULL, 'Rate Kamar pertipe, Jumlah Kamar, Luas Kamar Pertipe', 'rate-kamar-pertipe-jumlah-kamar-luas-kamar-pertipe', 1, '2024-12-06 09:04:50'),
|
('JLJ020', '2024-12-06 09:04:50', NULL, NULL, NULL, 'Rate Kamar pertipe, Jumlah Kamar, Luas Kamar Pertipe', 'rate-kamar-pertipe-jumlah-kamar-luas-kamar-pertipe', 1, '2024-12-06 09:04:50'),
|
||||||
('JLJ021', '2024-12-06 09:04:50', NULL, NULL, NULL, 'Analisis Kompetitor', 'analisis-kompetitor', 1, '2024-12-06 09:04:50'),
|
('JLJ021', '2024-12-06 09:04:50', NULL, NULL, NULL, 'Analisis Kompetitor', 'analisis-kompetitor', 1, '2024-12-06 09:04:50'),
|
||||||
('JLJ022', '2024-12-06 09:04:50', NULL, NULL, NULL, 'Bukti Bayar', 'bukti-bayar', 1, '2024-12-06 09:04:50'),
|
('JLJ022', '2024-12-06 09:04:50', NULL, NULL, NULL, 'Bukti Bayar', 'bukti-bayar', 1, '2024-12-06 09:04:50'),
|
||||||
('JLJ024', '2024-12-06 09:04:50', NULL, NULL, NULL, 'PPJB', 'ppjb', 1, '2024-12-06 09:04:50');
|
('JLJ024', '2024-12-06 09:04:50', NULL, NULL, NULL, 'PPJB', 'ppjb', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ025', '2024-12-06 09:04:50', NULL, NULL, NULL, 'LOKASI JAMINAN', 'lokasi-jaminan', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ026', '2024-12-06 09:04:50', NULL, NULL, NULL, 'KEPEMILIKAN', 'kepemilikan', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ027', '2024-12-06 09:04:50', NULL, NULL, NULL, 'STATUS KEPEMILIKAN, HUBUNGAN DAN PENGHUNI', 'status-kepemilikan-hubungan-dan-penghuni', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ028', '2024-12-06 09:04:50', NULL, NULL, NULL, 'ANALISA TANAH DAN BANGUNAN', 'analisa-tanah-dan-bangunan', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ029', '2024-12-06 09:04:50', NULL, NULL, NULL, 'SARANA PELENGKAP DAN LINGKUNGAN', 'sarana-pelengkap-dan-lingkungan', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ030', '2024-12-06 09:04:50', NULL, NULL, NULL, 'STATUS PEMILIKAN', 'status-pemilikan', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ031', '2024-12-06 09:04:50', NULL, NULL, NULL, 'KONDISI DAN SARANA PELENGKAP KENDARAAN', 'kondisi-dan-sarana-pelengkap-kendaraan', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ032', '2024-12-06 09:04:50', NULL, NULL, NULL, 'BARANG YANG DIPERIKSA', 'barang-yang-diperiksa', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ033', '2024-12-06 09:04:50', NULL, NULL, NULL, 'LOKASI, TEMPAT DAN STATUS TEMPAT PENYIMPANAN BARANG', 'lokasi-tempat-dan-status-tempat-penyimpanan-barang', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ034', '2024-12-06 09:04:50', NULL, NULL, NULL, 'KONDISI DAN DOKUMENTASI PENYIMPANAN BARANG', 'kondisi-dan-dokumentasi-penyimpanan-barang', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ035', '2024-12-06 09:04:50', NULL, NULL, NULL, 'KONDISI / SISTEM PENGAMANAN DAN LINGKUNGAN TEMPAT PENYIMPANAN BARANG', 'kondisi-sistem-pengamanan-dan-lingkungan-tempat-penyimpanan-barang', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ036', '2024-12-06 09:04:50', NULL, NULL, NULL, 'KONDISI MESIN', 'kondisi-mesin', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ037', '2024-12-06 09:04:50', NULL, NULL, NULL, 'CATATAN', 'catatan', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ038', '2024-12-06 09:04:50', NULL, NULL, NULL, 'EMAS', 'emas', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ039', '2024-12-06 09:04:50', NULL, NULL, NULL, 'ALAT BERAT', 'alat-berat', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ040', '2024-12-06 09:04:50', NULL, NULL, NULL, 'DEPOSITO', 'deposito', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ041', '2024-12-06 09:04:50', NULL, NULL, NULL, 'BARANG DAGANGAN', 'barang-dagangan', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ042', '2024-12-06 09:04:50', NULL, NULL, NULL, 'PIUTANG DAGANG', 'piutang-dagang', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ043', '2024-12-06 09:04:50', NULL, NULL, NULL, 'JAMINAN PRIBADI', 'jaminan-pribadi', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ044', '2024-12-06 09:04:50', NULL, NULL, NULL, 'JAMINAN PERUSAHAAN', 'jaminan-perusahaan', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ045', '2024-12-06 09:04:50', NULL, NULL, NULL, 'RESI GUDANG', 'resi-gudang', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ046', '2024-12-06 09:04:50', NULL, NULL, NULL, 'Surat Berharga dan Saham', 'surat-berharga-dan-saham', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ047', '2024-12-06 09:04:50', NULL, NULL, NULL, 'Tanah dan Bangunan (Kerjasama)', 'tanah-dan-bangunan-kerjasama', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ048', '2024-12-06 09:04:50', NULL, NULL, NULL, 'Tanah Kavling (Kerjasama)', 'tanah-kavling-kerjasama', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ049', '2024-12-06 09:04:50', NULL, NULL, NULL, 'JENIS KAPAL DAN STATUS KEPEMILIKAN', 'jenis-kapal-dan-status-kepemilikan', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ050', '2024-12-06 09:04:50', NULL, NULL, NULL, 'KONDISI DAN SARANA PELENGKAP KAPAL', 'kondisi-dan-sarana-pelengkap-kapal', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ051', '2024-12-06 09:04:50', NULL, NULL, NULL, 'REKENING GIRO / TABUNGAN', 'rekening-giro-tabungan', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ052', '2024-12-06 09:04:50', NULL, NULL, NULL, 'DATA TANAH', 'data-tanah', 1, '2024-12-06 09:04:50'),
|
||||||
|
('JLJ053', '2024-12-06 09:04:50', NULL, NULL, NULL, 'DATA BANGUNAN', 'data-bangunan', 1, '2024-12-06 09:04:50');
|
||||||
|
|||||||
7
database/seeders/sql/jenis_pesawat.sql
Normal file
7
database/seeders/sql/jenis_pesawat.sql
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
INSERT INTO `jenis_pesawat` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'JP001', 'Penumpang Komersil', 1, NULL, '2024-11-28 18:37:59', '2024-11-28 18:37:59', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'JP002', 'Milliter', 1, NULL, '2024-11-28 18:38:13', '2024-11-28 18:38:13', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'JP003', 'Cargo', 1, NULL, '2024-11-28 18:38:26', '2024-11-28 18:38:26', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(4, 'JP004', 'Helikopter', 1, NULL, '2024-11-28 18:38:39', '2024-11-28 18:38:39', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(5, 'JP005', 'Pribadi', 1, NULL, '2024-11-28 18:38:56', '2024-11-28 18:38:56', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(6, 'JP006', 'Lainnya', 1, NULL, '2024-11-28 18:39:13', '2024-11-28 18:39:13', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
2
database/seeders/sql/jenis_unit.sql
Normal file
2
database/seeders/sql/jenis_unit.sql
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
INSERT INTO `jenis_unit` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'JU001', 'H', 1, NULL, '2024-11-28 18:54:44', '2024-11-28 18:54:44', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
5
database/seeders/sql/ketinggian_tanah.sql
Normal file
5
database/seeders/sql/ketinggian_tanah.sql
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
INSERT INTO `ketinggian_tanah` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(2, 'KT001', 'Sama Dengan Jalan', 1, NULL, '2024-11-05 00:28:23', '2024-11-05 00:28:23', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'KT002', 'Lebih Tinggi', 1, NULL, '2024-11-05 00:28:50', '2024-11-25 21:20:57', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(4, 'KT004', 'Lebih Rendah', 1, NULL, '2024-11-05 00:31:20', '2024-11-25 21:21:05', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(5, 'KT005', 'Bervariasi', 1, NULL, '2024-11-05 00:31:48', '2024-11-05 00:31:48', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
7
database/seeders/sql/kondisi_bangunan.sql
Normal file
7
database/seeders/sql/kondisi_bangunan.sql
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
INSERT INTO `kondisi_bangunan` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(2, 'KB001', 'Cukup Terawat', 1, NULL, '2024-11-05 00:32:53', '2024-11-05 00:32:53', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'KB002', 'Kurang Terawat', 1, NULL, '2024-11-05 00:33:08', '2024-11-05 00:33:08', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(4, 'KB003', 'Tidak Terawat', 1, NULL, '2024-11-05 00:33:24', '2024-11-05 00:33:24', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(5, 'KB004', 'Hancur/Tidak Layak Ditinggali', 1, NULL, '2024-11-05 00:33:55', '2024-11-05 00:33:55', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(6, 'KB005', 'Terawat', 1, NULL, '2025-03-07 02:47:03', '2025-03-07 02:47:03', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
5
database/seeders/sql/kondisi_fisik_tanah.sql
Normal file
5
database/seeders/sql/kondisi_fisik_tanah.sql
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
INSERT INTO `kondisi_fisik_tanah` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'KFT001', 'Tanah Darat', 1, NULL, '2024-11-04 21:41:58', '2024-11-04 21:41:58', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'KFT002', 'Sawah', 1, NULL, '2024-11-04 21:42:11', '2024-11-04 21:42:11', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'KFT003', 'Urukan', 1, NULL, '2024-11-04 21:42:24', '2024-11-04 21:42:24', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(4, 'KFT004', 'Bukit', 1, NULL, '2024-11-04 21:42:38', '2024-11-04 21:42:38', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
5
database/seeders/sql/kontur_tanah.sql
Normal file
5
database/seeders/sql/kontur_tanah.sql
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
INSERT INTO `kontur_tanah` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'KT001', 'Rata', 1, NULL, '2024-11-04 21:31:11', '2024-11-04 21:31:11', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'KT002', 'Tidak Rata', 1, NULL, '2024-11-04 21:31:25', '2024-11-04 21:31:25', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'KT003', 'Berbukit', 1, NULL, '2024-11-04 21:37:07', '2024-11-04 21:37:07', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(4, 'KT004', 'Bergelombang', 1, NULL, '2024-11-04 21:37:27', '2024-11-04 21:37:27', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
4
database/seeders/sql/lalu_lintas_lokasi.sql
Normal file
4
database/seeders/sql/lalu_lintas_lokasi.sql
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
INSERT INTO `lalu_lintas_lokasi` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'LD001', 'Satu Arah', 1, NULL, '2025-01-22 23:23:31', '2025-01-22 23:23:31', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'LD002', 'Dua Arah - Satu Jalur', 1, NULL, '2025-01-22 23:23:46', '2025-01-22 23:23:46', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'LD003', 'Dua Arah - Dua Jalur', 1, NULL, '2025-01-22 23:24:04', '2025-01-22 23:24:04', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
4
database/seeders/sql/lantai.sql
Normal file
4
database/seeders/sql/lantai.sql
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
INSERT INTO `lantai` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'LU001', 'Rendah', 1, NULL, '2024-11-05 02:06:00', '2024-11-05 02:06:00', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'LU003', 'Tinggi', 1, NULL, '2024-11-05 02:06:35', '2024-11-05 02:06:35', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(4, 'LU002', 'Menengah', 1, NULL, '2024-11-05 02:07:02', '2024-11-05 02:07:02', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
4
database/seeders/sql/merupakan_daerah.sql
Normal file
4
database/seeders/sql/merupakan_daerah.sql
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
INSERT INTO `merupakan_daerah` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'MD001', 'Bebas Banjir', 1, NULL, '2024-11-28 18:56:17', '2024-11-28 18:56:17', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'MD002', 'Rawan Banjir', 1, NULL, '2024-11-28 18:56:37', '2024-11-28 18:56:37', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'MD003', 'Sering Banjir', 1, NULL, '2024-11-28 18:56:56', '2024-11-28 18:56:56', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
3
database/seeders/sql/model_alat_berat.sql
Normal file
3
database/seeders/sql/model_alat_berat.sql
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
INSERT INTO `model_alat_berat` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'MA001', 'Excavator', 1, NULL, '2024-11-28 02:13:48', '2024-11-28 02:13:48', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'MA002', 'Grader', 1, NULL, '2024-11-28 02:14:02', '2024-11-28 02:14:02', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
8
database/seeders/sql/perkerasan_jalan.sql
Normal file
8
database/seeders/sql/perkerasan_jalan.sql
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
INSERT INTO `perkerasan_jalan` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'PJ001', 'Aspal', 1, NULL, '2024-12-09 02:25:15', '2024-12-09 02:25:15', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'PJ002', 'Beton', 1, NULL, '2024-12-09 02:25:28', '2024-12-09 02:25:28', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'PJ003', 'Conblock', 1, NULL, '2024-12-09 02:25:44', '2024-12-09 02:25:44', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(4, 'PJ004', 'Sirtu', 1, NULL, '2024-12-09 02:25:56', '2024-12-09 02:25:56', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(5, 'PJ006', 'Belum ada perkerasan', 1, NULL, '2024-12-09 02:26:13', '2024-12-09 02:26:13', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(6, 'PJ007', 'Semen', 1, NULL, '2024-12-20 00:23:31', '2024-12-20 00:23:31', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(7, 'PJ008', 'Lainnya', 1, NULL, '2024-12-20 00:23:45', '2024-12-20 00:23:45', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
6
database/seeders/sql/posisi_kavling.sql
Normal file
6
database/seeders/sql/posisi_kavling.sql
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
INSERT INTO `posisi_kavling` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'PK001', 'Badan', 1, NULL, '2024-11-04 21:38:18', '2024-11-04 21:38:18', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'PK002', 'Pojok', 1, NULL, '2024-11-04 21:38:29', '2024-11-04 21:38:29', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'PK003', 'Hook', 1, NULL, '2024-11-04 21:38:38', '2024-11-04 21:38:38', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(4, 'PK004', 'Kuldesak', 1, NULL, '2024-11-04 21:38:59', '2024-11-04 21:38:59', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(5, 'PK005', 'Lainnya', 1, NULL, '2024-11-04 21:39:47', '2024-11-04 21:39:47', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
4
database/seeders/sql/posisi_unit.sql
Normal file
4
database/seeders/sql/posisi_unit.sql
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
INSERT INTO `posisi_unit` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'PU001', 'Tengah/Badan', 1, NULL, '2024-12-09 18:28:41', '2024-12-09 18:28:41', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'PU002', 'Pojok', 1, NULL, '2024-12-09 18:28:58', '2024-12-09 18:28:58', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'PU003', 'Tusuk Sate', 1, NULL, '2024-12-09 18:29:14', '2024-12-09 18:29:14', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
10
database/seeders/sql/sarana_pelengkap.sql
Normal file
10
database/seeders/sql/sarana_pelengkap.sql
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
INSERT INTO `sarana_pelengkap` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'SP001', 'Pagar', 1, NULL, '2024-11-04 21:53:34', '2024-11-04 21:53:34', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'SP002', 'Perkerasan', 1, NULL, '2024-11-04 21:53:50', '2024-11-04 21:53:50', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'SP003', 'Kanopi', 1, NULL, '2024-11-04 21:54:13', '2024-11-04 21:54:13', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(5, 'SP004', 'Air', 1, NULL, '2024-11-04 21:54:57', '2024-11-04 21:54:57', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(6, 'SP005', 'Listrik', 1, NULL, '2024-11-04 21:55:13', '2024-11-04 21:55:13', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(7, 'SP006', 'kolam renang', 1, NULL, '2024-12-15 19:25:09', '2024-12-15 19:25:09', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(8, 'SP007', 'carport', 1, NULL, '2024-12-15 19:25:58', '2024-12-15 19:25:58', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(9, 'SP008', 'teras', 1, NULL, '2024-12-15 19:26:38', '2024-12-15 19:26:38', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(10, 'SP009', 'Lainnya', 1, NULL, '2024-12-15 19:26:50', '2024-12-15 19:26:50', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
4
database/seeders/sql/sifat_bangunan.sql
Normal file
4
database/seeders/sql/sifat_bangunan.sql
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
INSERT INTO `sifat_bangunan` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'SB001', 'Permanen', 1, NULL, '2024-11-05 00:09:46', '2024-11-05 00:09:46', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'SB002', 'Semi Permanen', 1, NULL, '2024-11-05 00:10:03', '2024-11-05 00:10:03', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'SB003', 'Tidak Permanen', 1, NULL, '2024-11-05 00:10:22', '2024-11-05 00:10:22', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
70
database/seeders/sql/spek_bangunan.sql
Normal file
70
database/seeders/sql/spek_bangunan.sql
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
INSERT INTO `spek_bangunan` (`id`, `code`, `name`, `spek_kategori_bangunan_id`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'SPB001', 'Tapak Beton', 3, 1, NULL, '2024-11-05 20:22:33', '2024-11-05 20:22:33', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(4, 'SPB002', 'Batu Kali', 3, 1, NULL, '2024-11-05 20:39:42', '2024-11-05 20:39:42', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(5, 'SPB003', 'Lainnya', 3, 1, NULL, '2024-11-05 20:39:58', '2024-11-05 20:39:58', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(6, 'SPB004', 'Beton Bertulang', 4, 1, NULL, '2024-11-05 20:40:43', '2024-11-05 20:40:43', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(7, 'SPB005', 'Lainnya', 4, 1, NULL, '2024-11-05 20:41:01', '2024-11-05 20:41:01', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(8, 'SPB006', 'Dak Beton', 5, 1, NULL, '2024-11-05 20:42:12', '2024-11-05 20:42:12', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(9, 'SPB007', 'Kayu (Atap Asbes)', 5, 1, NULL, '2024-11-05 21:25:05', '2024-11-05 21:25:05', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(10, 'SPB008', 'Kayu (Atap Genteng)', 5, 1, NULL, '2024-11-05 21:25:36', '2024-11-05 21:25:36', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(11, 'SPB009', 'Baja Ringan (Atap Asbes)', 5, 1, NULL, '2024-11-05 21:26:28', '2024-11-05 21:26:28', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(12, 'SPB010', 'Baja Ringan (Atap Genteng)', 5, 1, NULL, '2024-11-05 21:28:43', '2024-11-05 21:28:43', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(13, 'SPB011', 'Lainnya', 5, 1, NULL, '2024-11-05 21:29:07', '2024-11-05 21:29:07', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(15, 'SPB012', 'Asbes', 6, 1, NULL, '2024-11-05 21:30:39', '2024-11-05 21:30:39', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(16, 'SPB013', 'Dak Beton', 6, 1, NULL, '2024-11-05 21:39:28', '2024-11-05 21:39:28', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(17, 'SPB014', 'Fibreglass', 6, 1, NULL, '2024-11-05 21:42:05', '2024-11-05 21:42:05', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(18, 'SPB015', 'Ganteng Tanah Liat', 6, 1, NULL, '2024-11-05 21:42:27', '2024-11-05 21:42:27', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(19, 'SPB016', 'Genteng Beton', 6, 1, NULL, '2024-11-05 21:42:46', '2024-11-05 21:42:46', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(20, 'SPB017', 'Genteng Metal', 6, 1, NULL, '2024-11-05 21:43:16', '2024-11-05 21:43:16', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(21, 'SPB018', 'Seng Gelombang', 6, 1, NULL, '2024-11-05 21:43:48', '2024-11-05 21:43:48', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(22, 'SPB019', 'Spandek', 6, 1, NULL, '2024-11-05 21:44:21', '2024-11-05 21:44:21', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(23, 'SPB020', 'PVC', 6, 1, NULL, '2024-11-05 21:44:37', '2024-11-05 21:44:37', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(24, 'SPB021', 'Genteng Keramik', 6, 1, NULL, '2024-11-05 21:44:58', '2024-11-05 21:44:58', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(25, 'SPB022', 'Lainnya', 6, 1, NULL, '2024-11-05 21:45:15', '2024-11-05 21:45:15', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(26, 'SPB023', 'Asbes', 7, 1, NULL, '2024-11-05 21:45:57', '2024-11-05 21:45:57', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(27, 'SPB024', 'Beton Ekspos', 7, 1, NULL, '2024-11-05 21:46:30', '2024-11-05 21:46:30', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(28, 'SPB025', 'GRC', 7, 1, NULL, '2024-11-05 21:46:46', '2024-11-05 21:46:46', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(29, 'SPB026', 'Gypsum', 7, 1, NULL, '2024-11-05 21:46:59', '2024-11-05 21:46:59', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(30, 'SPB027', 'Triplek', 7, 1, NULL, '2024-11-05 21:47:19', '2024-11-05 21:47:19', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(31, 'SPB028', 'Lambreserring', 7, 1, NULL, '2024-11-05 21:47:57', '2024-11-05 21:47:57', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(32, 'SPB029', 'Lainnya', 7, 1, NULL, '2024-11-05 21:48:11', '2024-11-05 21:48:11', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(34, 'SPB031', 'Batako', 8, 1, NULL, '2024-11-05 21:49:34', '2024-11-05 21:49:34', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(35, 'SPB032', 'Bata Merah', 8, 1, NULL, '2024-11-05 21:49:49', '2024-11-05 21:49:49', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(36, 'SPB033', 'Bata Ringan', 8, 1, NULL, '2024-11-05 21:50:06', '2024-11-05 21:50:06', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(37, 'SPB034', 'Gypsumboard 2 Muka', 8, 1, NULL, '2024-11-05 21:50:39', '2024-11-05 21:50:39', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(38, 'SPB035', 'Rooster Bata', 8, 1, NULL, '2024-11-05 21:50:58', '2024-11-05 21:50:58', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(39, 'SPB036', 'Lainnya', 8, 1, NULL, '2024-11-05 21:51:37', '2024-11-05 21:51:37', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(41, 'SPB038', 'Dilapisi Cat', 9, 1, NULL, '2024-11-05 21:52:34', '2024-11-05 21:52:34', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(42, 'SPB039', 'Dilapis Batu Alam', 9, 1, NULL, '2024-11-05 21:53:02', '2024-11-05 21:53:02', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(43, 'SPB040', 'Dilapis Keramik', 9, 1, NULL, '2024-11-05 21:54:44', '2024-11-05 21:54:44', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(44, 'SPB041', 'Dilapis Marmer Lokal', 9, 1, NULL, '2024-11-05 21:55:04', '2024-11-05 21:55:04', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(45, 'SPB042', 'Dilapis Marmer Import', 9, 1, NULL, '2024-11-05 21:55:26', '2024-11-05 21:55:26', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(46, 'SPB043', 'Dilapis Granit', 9, 1, NULL, '2024-11-05 21:57:24', '2024-11-05 21:57:24', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(47, 'SPB044', 'Dilapis Wallpaper', 9, 1, NULL, '2024-11-05 21:57:43', '2024-11-05 21:57:43', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(48, 'SPB045', 'Lainnya', 9, 1, NULL, '2024-11-05 21:58:00', '2024-11-05 21:58:00', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(49, 'SPB046', 'Pintu Panil', 10, 1, NULL, '2024-11-05 21:58:32', '2024-11-05 21:58:32', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(50, 'SPB048', 'Pintu Kayu Panil', 10, 1, NULL, '2024-11-05 21:59:45', '2024-11-05 21:59:45', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(51, 'SPB049', 'Pntu Kayu Double Triplek', 10, 1, NULL, '2024-11-05 22:00:16', '2024-11-05 22:00:16', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(52, 'SPB050', 'Pntu Kaca RK Alumunium', 10, 1, NULL, '2024-11-05 22:01:13', '2024-11-05 22:01:13', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(53, 'SPB051', 'Pntu Kaca RK Alumunium', 10, 1, NULL, '2024-11-05 23:08:03', '2024-11-05 23:08:03', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(54, 'SPB052', 'Pintu Kaca Tempered Floor', 10, 1, NULL, '2024-11-05 23:08:39', '2024-11-05 23:08:39', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(55, 'SPB053', 'Pntu KM UPVC/PVC', 10, 1, NULL, '2024-11-05 23:09:10', '2024-11-05 23:09:10', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(56, 'SPB054', 'Pintu Garasi Kayu', 10, 1, NULL, '2024-11-05 23:09:46', '2024-11-05 23:09:46', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(57, 'SPB055', 'Pintu Garasi Besi', 10, 1, NULL, '2024-11-05 23:10:09', '2024-11-05 23:10:09', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(58, 'SPB056', 'Jendela Kaca RK Kayu', 10, 1, NULL, '2024-11-05 23:10:39', '2024-11-05 23:10:39', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(59, 'SPB057', 'Jendela Kaca RK Alumunium', 10, 1, NULL, '2024-11-05 23:13:05', '2024-11-05 23:13:05', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(60, 'SPB058', 'Jendela Kaca Stopsol 8mm Curtail w All', 10, 1, NULL, '2024-11-05 23:14:32', '2024-11-05 23:14:32', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(61, 'SPB059', 'Jendela Kaca Tempered Frameless', 10, 1, NULL, '2024-11-05 23:15:57', '2024-11-05 23:15:57', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(62, 'SPB060', 'Lainnya', 10, 1, NULL, '2024-11-05 23:20:37', '2024-11-05 23:20:37', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(63, 'SPB061', 'Granit/Homogenus Tile', 11, 1, NULL, '2024-11-05 23:21:51', '2024-11-05 23:21:51', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(64, 'SPB062', 'Granit Import', 11, 1, NULL, '2024-11-05 23:22:19', '2024-11-05 23:22:19', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(65, 'SPB063', 'Karpet', 11, 1, NULL, '2024-11-05 23:22:41', '2024-11-05 23:22:41', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(66, 'SPB064', 'Keramik', 11, 1, NULL, '2024-11-05 23:23:11', '2024-11-05 23:23:11', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(67, 'SPB065', 'Marmer Import', 11, 1, NULL, '2024-11-05 23:24:26', '2024-11-05 23:24:26', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(68, 'SPB066', 'Mozaik', 11, 1, NULL, '2024-11-05 23:24:43', '2024-11-05 23:24:43', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(69, 'SPB067', 'Rabat Beton (Semen Ekspose)', 11, 1, NULL, '2024-11-05 23:25:10', '2024-11-05 23:25:10', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(70, 'SPB068', 'Parkit Jati', 11, 1, NULL, '2024-11-05 23:27:59', '2024-11-05 23:27:59', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(71, 'SPB069', 'Teraso', 11, 1, NULL, '2024-11-05 23:28:14', '2024-11-05 23:28:14', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(72, 'SPB070', 'Vynil', 11, 1, NULL, '2024-11-05 23:28:42', '2024-11-05 23:28:42', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(73, 'SPB071', 'Lainnya', 11, 1, NULL, '2024-11-05 23:29:29', '2024-11-05 23:29:29', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(74, 'SPB030', 'Baja', 4, 1, NULL, '2024-12-29 21:45:39', '2024-12-29 21:45:39', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
10
database/seeders/sql/spek_kategori_bangunan.sql
Normal file
10
database/seeders/sql/spek_kategori_bangunan.sql
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
INSERT INTO `spek_kategori_bangunan` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(3, 'KB001', 'Pondasi', 1, NULL, '2024-11-05 01:10:30', '2024-11-05 01:10:30', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(4, 'KB002', 'Struktur', 1, NULL, '2024-11-05 01:10:56', '2024-11-05 01:10:56', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(5, 'KB003', 'Rangka Atap', 1, NULL, '2024-11-05 01:11:20', '2024-11-05 01:11:20', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(6, 'KB004', 'Tutup Atap', 1, NULL, '2024-11-05 01:11:38', '2024-11-05 01:11:38', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(7, 'KB005', 'Plafond', 1, NULL, '2024-11-05 01:11:56', '2024-11-05 01:11:56', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(8, 'KB006', 'Dinding', 1, NULL, '2024-11-05 01:45:06', '2024-11-05 01:45:06', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(9, 'KB007', 'Pelapis Dinding', 1, NULL, '2024-11-05 01:45:36', '2024-11-05 01:45:36', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(10, 'KB008', 'Pintu Jendela', 1, NULL, '2024-11-05 01:46:06', '2024-11-05 01:46:06', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(11, 'KB009', 'Lantai', 1, NULL, '2024-11-05 01:46:46', '2024-11-05 01:46:46', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
6
database/seeders/sql/teams.sql
Normal file
6
database/seeders/sql/teams.sql
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
INSERT INTO `teams` (`id`, `regions_id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 1, 'T01', 'Team 1', NULL, NULL, '2024-09-18 23:48:39', '2024-09-18 23:48:39', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 2, 'T02', 'Team 2', NULL, NULL, '2024-10-30 20:41:34', '2024-10-30 20:41:34', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 5, 'T05', 'Tim 5', NULL, NULL, '2024-10-30 22:09:17', '2024-10-30 23:44:26', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(4, 3, 'T03', 'Team 3', NULL, NULL, '2024-10-30 23:24:56', '2024-10-30 23:24:56', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(5, 4, 'T04', 'Team 4', NULL, NULL, '2024-10-30 23:42:27', '2024-10-30 23:42:27', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
5
database/seeders/sql/terletak_area.sql
Normal file
5
database/seeders/sql/terletak_area.sql
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
INSERT INTO `terletak_area` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'TA001', 'Perumahan', 1, NULL, '2024-11-28 18:30:19', '2024-11-28 18:30:19', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'TA002', 'Pemukiman', 1, NULL, '2024-11-28 18:30:35', '2024-11-28 18:30:35', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'TA003', 'Komersil', 1, NULL, '2024-11-28 18:30:54', '2024-11-28 18:30:54', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(4, 'TA004', 'Lainnya', 1, NULL, '2024-11-28 18:31:09', '2024-11-28 18:31:09', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
4
database/seeders/sql/tingkat_keramaian.sql
Normal file
4
database/seeders/sql/tingkat_keramaian.sql
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
INSERT INTO `tingkat_keramaian` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'TK001', 'Ramai', 1, NULL, '2024-11-05 00:30:18', '2024-11-05 00:30:18', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'TK002', 'Cukup Ramai', 1, NULL, '2024-11-05 00:31:12', '2024-11-05 00:31:12', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'TK003', 'Sepi', 1, NULL, '2024-11-05 00:32:17', '2024-11-05 00:32:17', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
6
database/seeders/sql/view_unit.sql
Normal file
6
database/seeders/sql/view_unit.sql
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
INSERT INTO `view_unit` (`id`, `code`, `name`, `status`, `authorized_status`, `created_at`, `updated_at`, `authorized_at`, `authorized_by`, `deleted_at`, `created_by`, `updated_by`, `deleted_by`) VALUES
|
||||||
|
(1, 'VU001', 'Kota', 1, NULL, '2024-11-05 02:08:37', '2024-11-05 02:08:37', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(2, 'VU002', 'Laut', 1, NULL, '2024-11-05 02:09:44', '2024-11-05 02:09:44', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(3, 'VU003', 'Kolam Renang', 1, NULL, '2024-11-05 02:10:04', '2024-11-05 02:10:04', NULL, NULL, NULL, NULL, NULL, NULL),
|
||||||
|
(4, 'VU004', 'Lainnya', 1, NULL, '2024-11-05 02:10:19', '2024-11-05 02:10:19', NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
Reference in New Issue
Block a user