fix service sync simbg upsert integrations
This commit is contained in:
@@ -61,9 +61,15 @@ class ServiceSIMBG
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function syncIndexIntegration($uuid, $token)
|
public function syncIndexIntegration($uuids, $token)
|
||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
|
if(empty($uuids)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$integrations = [];
|
||||||
|
foreach($uuids as $uuid){
|
||||||
$url = "/api/pbg/v1/detail/" . $uuid . "/retribution/indeks-terintegrasi/";
|
$url = "/api/pbg/v1/detail/" . $uuid . "/retribution/indeks-terintegrasi/";
|
||||||
|
|
||||||
$headers = [
|
$headers = [
|
||||||
@@ -84,9 +90,8 @@ class ServiceSIMBG
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$resultData = PbgTaskIndexIntegrations::updateOrCreate(
|
$integrations[] = [
|
||||||
['pbg_task_uid' => $uuid],
|
'pbg_task_uid' => $uuid,
|
||||||
[
|
|
||||||
'indeks_fungsi_bangunan' => $data['indeks_fungsi_bangunan'] ?? null,
|
'indeks_fungsi_bangunan' => $data['indeks_fungsi_bangunan'] ?? null,
|
||||||
'indeks_parameter_kompleksitas' => $data['indeks_parameter_kompleksitas'] ?? null,
|
'indeks_parameter_kompleksitas' => $data['indeks_parameter_kompleksitas'] ?? null,
|
||||||
'indeks_parameter_permanensi' => $data['indeks_parameter_permanensi'] ?? null,
|
'indeks_parameter_permanensi' => $data['indeks_parameter_permanensi'] ?? null,
|
||||||
@@ -94,8 +99,24 @@ class ServiceSIMBG
|
|||||||
'faktor_kepemilikan' => $data['faktor_kepemilikan'] ?? null,
|
'faktor_kepemilikan' => $data['faktor_kepemilikan'] ?? null,
|
||||||
'indeks_terintegrasi' => $data['indeks_terintegrasi'] ?? null,
|
'indeks_terintegrasi' => $data['indeks_terintegrasi'] ?? null,
|
||||||
'total' => $data['total'] ?? null,
|
'total' => $data['total'] ?? null,
|
||||||
]
|
];
|
||||||
);
|
}
|
||||||
|
|
||||||
|
PbgTaskIndexIntegrations::upsert($integrations, ['pbg_task_uid'], ['indeks_fungsi_bangunan',
|
||||||
|
'indeks_parameter_kompleksitas', 'indeks_parameter_permanensi', 'indeks_parameter_ketinggian', 'faktor_kepemilikan', 'indeks_terintegrasi', 'total']);
|
||||||
|
|
||||||
|
// $resultData = PbgTaskIndexIntegrations::updateOrCreate(
|
||||||
|
// ['pbg_task_uid' => $uuid],
|
||||||
|
// [
|
||||||
|
// 'indeks_fungsi_bangunan' => $data['indeks_fungsi_bangunan'] ?? null,
|
||||||
|
// 'indeks_parameter_kompleksitas' => $data['indeks_parameter_kompleksitas'] ?? null,
|
||||||
|
// 'indeks_parameter_permanensi' => $data['indeks_parameter_permanensi'] ?? null,
|
||||||
|
// 'indeks_parameter_ketinggian' => $data['indeks_parameter_ketinggian'] ?? null,
|
||||||
|
// 'faktor_kepemilikan' => $data['faktor_kepemilikan'] ?? null,
|
||||||
|
// 'indeks_terintegrasi' => $data['indeks_terintegrasi'] ?? null,
|
||||||
|
// 'total' => $data['total'] ?? null,
|
||||||
|
// ]
|
||||||
|
// );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}catch (Exception $e){
|
}catch (Exception $e){
|
||||||
@@ -190,7 +211,7 @@ class ServiceSIMBG
|
|||||||
'created_at' => now(),
|
'created_at' => now(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->syncIndexIntegration($item['uid'], $token);
|
// $this->syncIndexIntegration($item['uid'], $token);
|
||||||
|
|
||||||
$this->syncTaskDetailSubmit($item['uid'], $token);
|
$this->syncTaskDetailSubmit($item['uid'], $token);
|
||||||
|
|
||||||
@@ -209,6 +230,10 @@ class ServiceSIMBG
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$uuids = array_column($tasksCollective, 'uuid');
|
||||||
|
|
||||||
|
$this->syncIndexIntegration($uuids, $token);
|
||||||
|
|
||||||
PbgTask::upsert($tasksCollective, ['uuid'], [
|
PbgTask::upsert($tasksCollective, ['uuid'], [
|
||||||
'name', 'owner_name', 'application_type', 'application_type_name', 'condition',
|
'name', 'owner_name', 'application_type', 'application_type_name', 'condition',
|
||||||
'registration_number', 'document_number', 'address', 'status', 'status_name',
|
'registration_number', 'document_number', 'address', 'status', 'status_name',
|
||||||
|
|||||||
Reference in New Issue
Block a user