Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 998dc0f887 | |||
| cd3d717c33 |
@@ -13,6 +13,7 @@ use App\Models\Verifikator\PengajuanPresensi;
|
|||||||
use App\Models\Verifikator\Tendik;
|
use App\Models\Verifikator\Tendik;
|
||||||
use App\Models\Verifikator\View\Pegawai;
|
use App\Models\Verifikator\View\Pegawai;
|
||||||
use App\Services\DawaiService;
|
use App\Services\DawaiService;
|
||||||
|
use App\Services\SenjaService;
|
||||||
use App\Services\GoogleDriveService;
|
use App\Services\GoogleDriveService;
|
||||||
use App\Services\VerifikasiAbsenLinkService;
|
use App\Services\VerifikasiAbsenLinkService;
|
||||||
use App\Services\VerifikatorWebhookService;
|
use App\Services\VerifikatorWebhookService;
|
||||||
@@ -950,6 +951,12 @@ class PengajuanAbsenController extends Controller
|
|||||||
|
|
||||||
Log::info("Hapus Pengajuan Tugas / Dinas: ID $id - NIP $pengajuan->nip - DAWAI ID $pengajuan->dawai_id");
|
Log::info("Hapus Pengajuan Tugas / Dinas: ID $id - NIP $pengajuan->nip - DAWAI ID $pengajuan->dawai_id");
|
||||||
|
|
||||||
|
$mulai = Carbon::parse($pengajuan->tanggal_mulai)->format('Y-m-d');
|
||||||
|
$selesai = Carbon::parse($pengajuan->tanggal_selesai ?: $pengajuan->tanggal_mulai)->format('Y-m-d');
|
||||||
|
if (! (new SenjaService)->resetJamKerja($pengajuan->nip, $mulai, $selesai)) {
|
||||||
|
Log::warning("Hapus Tugas / Dinas: reset jam kerja di SENJA gagal: ID $id - NIP $pengajuan->nip");
|
||||||
|
}
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class SenjaService
|
||||||
|
{
|
||||||
|
private const URL = 'http://172.16.40.168:9123';
|
||||||
|
|
||||||
|
private const PIN = 'UntanUltra-2026';
|
||||||
|
|
||||||
|
public const JAM_MASUK_DEFAULT = '07:30:00';
|
||||||
|
|
||||||
|
public const JAM_PULANG_DEFAULT = '16:30:00';
|
||||||
|
|
||||||
|
public function simpanIndex(string $nip, string $tanggalMulai, string $tanggalSelesai, string $jenisAbsen, string $jam): bool
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$response = Http::timeout(15)->asMultipart()->post(self::URL.'/api/simpan-index2026', [
|
||||||
|
['name' => 'start_date', 'contents' => $tanggalMulai],
|
||||||
|
['name' => 'end_date', 'contents' => $tanggalSelesai],
|
||||||
|
['name' => 'jenis_absen', 'contents' => $jenisAbsen],
|
||||||
|
['name' => 'jam', 'contents' => $jam],
|
||||||
|
['name' => 'nip', 'contents' => $nip],
|
||||||
|
['name' => 'pin', 'contents' => self::PIN],
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($response->failed()) {
|
||||||
|
Log::error("SENJA simpan-index2026 gagal ($nip $tanggalMulai s/d $tanggalSelesai $jenisAbsen $jam): HTTP {$response->status()} ".$response->body());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} catch (Throwable $th) {
|
||||||
|
Log::error('SENJA simpan-index2026: '.$th->getMessage());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resetJamKerja(string $nip, string $tanggalMulai, ?string $tanggalSelesai = null): bool
|
||||||
|
{
|
||||||
|
$tanggalSelesai = $tanggalSelesai ?: $tanggalMulai;
|
||||||
|
|
||||||
|
$masuk = $this->simpanIndex($nip, $tanggalMulai, $tanggalSelesai, 'masuk', self::JAM_MASUK_DEFAULT);
|
||||||
|
$pulang = $this->simpanIndex($nip, $tanggalMulai, $tanggalSelesai, 'pulang', self::JAM_PULANG_DEFAULT);
|
||||||
|
|
||||||
|
return $masuk && $pulang;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user