Penambahan Sementara Pengajuan Presensi WhatsApp

This commit is contained in:
Ariyutta
2026-09-15 14:42:01 +07:00
parent 88d27ef207
commit ffcfdd3579
23 changed files with 1257 additions and 384 deletions
@@ -264,8 +264,6 @@ class CheckPegawaiBaruCommand extends Command
*/
private function updatePegawai(array $newDosen, array $newTendik, DawaiService $dawaiService): void
{
DB::beginTransaction();
try {
$insertedDosen = 0;
$updatedDosen = 0;
@@ -296,7 +294,7 @@ class CheckPegawaiBaruCommand extends Command
foreach ($newDosen as $dosen) {
try {
$result = $this->insertDosen($dosen, $dawaiService, $periode, $dosenMap, $tendikMap, $dosenByIdDawai);
$result = DB::transaction(fn () => $this->insertDosen($dosen, $dawaiService, $periode, $dosenMap, $tendikMap, $dosenByIdDawai));
match ($result) {
'inserted' => $insertedDosen++,
@@ -335,7 +333,7 @@ class CheckPegawaiBaruCommand extends Command
foreach ($newTendik as $tendik) {
try {
$result = $this->insertTendik($tendik, $dawaiService, $periode, $dosenMap, $tendikMap, $tendikByIdDawai);
$result = DB::transaction(fn () => $this->insertTendik($tendik, $dawaiService, $periode, $dosenMap, $tendikMap, $tendikByIdDawai));
match ($result) {
'inserted' => $insertedTendik++,
@@ -366,8 +364,6 @@ class CheckPegawaiBaruCommand extends Command
}
}
DB::commit();
$this->newLine();
$this->info('========== HASIL PROSES ==========');
$this->info("Total dosen baru ditambahkan: {$insertedDosen}");
@@ -387,7 +383,6 @@ class CheckPegawaiBaruCommand extends Command
}
$this->info('Proses selesai!');
} catch (Exception $e) {
DB::rollBack();
$this->error('Terjadi error saat proses: '.$e->getMessage());
Log::error('Error saat proses pegawai', [
'error' => $e->getMessage(),
@@ -615,6 +610,7 @@ class CheckPegawaiBaruCommand extends Command
'tubel_kembali' => ($dosen['detail']['status'] ?? '') === 'tubel' ? $validateDate($dosen['detail']['tst'] ?? null) : null,
'npwp' => $dosen['npwp'] ?? $existing->npwp,
'nomor_rekening' => $dosen['nomor_rekening'] ?? $existing->nomor_rekening,
'no_hp' => $dosen['privasi']['no_hp'] ?? $existing->no_hp,
]);
return $nipChanged ? 'nip_changed' : 'updated';
@@ -653,6 +649,7 @@ class CheckPegawaiBaruCommand extends Command
'wafat' => ($dosen['detail']['status'] ?? '') === 'wafat' ? now()->format('Y-m-d') : null,
'npwp' => $dosen['npwp'] ?? null,
'nomor_rekening' => $dosen['nomor_rekening'] ?? null,
'no_hp' => $dosen['privasi']['no_hp'] ?? null,
]);
return $changedType ? 'changed_type' : 'inserted';
@@ -732,6 +729,7 @@ class CheckPegawaiBaruCommand extends Command
'tubel_kembali' => ($tendik['detail']['status'] ?? '') === 'tubel' ? $validateDate($tendik['detail']['tst'] ?? null) : null,
'npwp' => $tendik['npwp'] ?? $existing->npwp,
'nomor_rekening' => $tendik['nomor_rekening'] ?? $existing->nomor_rekening,
'no_hp' => $tendik['privasi']['no_hp'] ?? $existing->no_hp,
]);
return $nipChanged ? 'nip_changed' : 'updated';
@@ -770,6 +768,7 @@ class CheckPegawaiBaruCommand extends Command
'wafat' => ($tendik['detail']['status'] ?? '') === 'wafat' ? now()->format('Y-m-d') : null,
'npwp' => $tendik['npwp'] ?? null,
'nomor_rekening' => $tendik['nomor_rekening'] ?? null,
'no_hp' => $tendik['privasi']['no_hp'] ?? null,
]);
return $changedType ? 'changed_type' : 'inserted';