Ver código fonte

latest

master
Siti Rahayu 4 anos atrás
pai
commit
a9374521eb

+ 1
- 0
app/Http/Controllers/Api/LoginController.php Ver arquivo

@@ -22,6 +22,7 @@ use App\Model\Module\Faulty;
use App\Model\User;
use App\Model\UserDetail;
use App\Model\Module\Compound;
use App\Model\Module\CodeMukim;

use App\Jobs\StoreCompound;
use App\Jobs\StoreNotice;

+ 2
- 1
app/Http/Controllers/Main/CompoundController.php Ver arquivo

@@ -30,6 +30,7 @@ use App\Model\Module\ReportOverallCompound;
use App\Jobs\StoreCompound;
use App\Jobs\StoreCompoundManual;
use App\Jobs\StoreCompoundEPBT;
use App\Jobs\EditCompoundEPBT;
use App\Jobs\UpdateCompoundPrice;

class CompoundController extends Controller
@@ -966,7 +967,7 @@ class CompoundController extends Controller

if($compound->modul == '03')
{
// $this->dispatch(new StoreCompoundEPBT($request->all(), $kpd, $staff->StaffDetail->full_name, $staff->StaffDetail->no_badan, $faulty->nama));
// $this->dispatch(new EditCompoundEPBT($request->kpd, $user->id));

return redirect()->back()->with('success_msg', 'Berjaya kemasikini!');
}

+ 224
- 0
app/Jobs/EditCompoundEPBT.php Ver arquivo

@@ -0,0 +1,224 @@
<?php

namespace App\Jobs;

use Carbon\Carbon;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Http\Request;
use App\Jobs\Throwable;
use App\SiteSetting;
use App\Model\Staff;
use App\Model\StaffDetail;
use App\Model\Module\Department;
use App\Model\Module\DeedLaw;
use App\Model\Module\Faulty;
use App\Model\Module\Compound;
use App\Model\Module\ConfidentialFile;
use App\Model\Module\History;
use App\Model\Module\SubHistory;
use App\Model\Module\Memo;
use App\Model\Module\Attachment;
use App\Model\Module\CodeMukim;


class EditCompoundEPBT implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $kpd, $enf_id;

/**
* Create a new job instance.
*
* @return void
*/
public function __construct(array $kpd_,$enf_id_)
{
$this->kpd = $kpd_;
$this->enf_nama = $enf_id_;
}

/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$compound = Compound::with('Department','DeedLaw','Faulty')->where('kpd',$this->kpd)->first();

$staff = Staff::with('StaffDetail')->where('_id', $compound->dikeluarkan)->first();

$now = Carbon::now()->toDateTimeString();

$coordinate = [];
if (!empty($compound->latlong)) {
$coordinate = explode(",",$compound->latlong);
}

//get ePBT MBIP faulty lists
$client = new \GuzzleHttp\Client();
$epbt_faulty_ = $client->request('GET', 'http://218.208.81.239:81/appsepbtkompaun_ws/getinfokompaun/infokompaun?infokompaun[]=352405067769401&infokompaun[]=ekpn_kesalahan');
$epbt_faulty = json_decode($epbt_faulty_->getBody()->getContents());

if(!empty($epbt_faulty)){

$k = [];
$kod_kompaun = '-';
$jenis_kompaun = 'kt';
$no_akaun = '-';
$nama_pesalah = '-';
$no_kereta = '-';
$jenis_kereta = '-';
$no_petak = '-';
$no_cukai_jalan = '-';
$warna_kenderaan = '-';

//search if epbt kesalahan match db kesalahan
$faulty = $compound->Faulty->nama;

foreach($epbt_faulty as $ef)
{
if(strtolower($ef->kesalahan) == strtolower($faulty))
{
$epbt_faulty = true;
break;
}
}

if($epbt_faulty){

$roads = CodeMukim::where('MKM_MNAMA', $compound['nama_kawasan'])->first();

if($compound->jenis == 'Parkir')
{
$kod_kompaun = 'KPD';
$jenis_kompaun = 'K';
$no_akaun = $compound->no_plate;
$nama_pesalah = $compound->no_plate;
$no_kereta = $compound->no_plate;
$jenis_kereta = $compound->model_kenderaan;
$no_petak = $compound->no_parking;
$no_cukai_jalan = $compound->no_cukai_jalan;
$warna_kenderaan= $compound->warna_kenderaan;

}
elseif($compound->jenis == 'Pelbagai_KT'){

$kod_kompaun = 'kt';
$jenis_kompaun = 'P';
$no_akaun = $compound->no_akaun_lesen;
$nama_pesalah = $compound->nama;
}
else if($compound->jenis == 'Pelbagai_JPB'){

$kod_kompaun = 'jpb';
$jenis_kompaun = 'P';
$no_akaun = $compound->no_akaun_lesen;
$nama_pesalah = $compound->nama;
}
elseif ($compound->jenis == 'Pelbagai_LESEN'){

$kod_kompaun = 'KT1';
$jenis_kompaun = 'P';
$no_akaun = $compound->no_akaun_lesen;
$nama_pesalah = $compound->nama;
}

array_push($k,
strtoupper($this->kpd), //no kompaun
$kod_kompaun, //strtoupper($kod_kompaun), //kodKompaun
$compound->Deedlaw->akkod, //kod akta
strtoupper($compound->Faulty->nama), //keterangan kesalahan
$compound->created_at->toDateString(), //tarikh
$compound->created_at->toTimeString(), //masa
14, //tempoh
$compound->nama_jalan .' , '. $compound->nama_taman,//namajalan, namataman
$roads->JLN_MKKOD, //kodbandar
$jenis_kompaun, //jenis
strtoupper($no_akaun), //no akaun (no plat)
$compound->jumlah_asal_kompaun, //jumlah kompaun
// strtoupper($this->no_badan), //no badan
strtoupper($staff->StaffDetail->no_badan), //no badan
'-', //no pembantu penguatkuasa
// strtoupper($this->enf_nama), //nama enforcer
strtoupper($staff->StaffDetail->full_name), //nama enforcer
$now, //time created epbt
$compound->Faulty->itkod, //kod kesalahan
strtoupper($nama_pesalah), //nama pesalah
$compound->nama_jalan, //nama jalan - alamat pesalah
$compound->nama_taman, //nama taman - alamat pesalah
'81300', //postcode
$compound->nama_kawasan, //bandar
'JOHOR', //negeri
'B', //notis
'NULL', //notisamaran
$coordinate[0], //latitud
$coordinate[1], //longitud
'-', //device
$no_cukai_jalan, //no cukai jalan
$no_kereta, //no plat
'NULL', //no kupon
$jenis_kereta, //jenis kenderaan
$warna_kenderaan, //warna kenderaan
$no_petak, //no petak parking
$no_petak //kod petak
);

$urlQueryString = '';

for ($i=0; $i < count($k); $i++){

if($i == 0)
{
$urlQueryString = $urlQueryString . '?';
}
else
{
$urlQueryString = $urlQueryString . '&';
}

$urlQueryString = $urlQueryString . 'KompaunDetails[]=' . $k[$i];
}

try {
$client = new \GuzzleHttp\Client();

//121.120.88.133:8077 ip testing
$result = $client->request('GET', 'http://218.208.81.239:81/appsepbtkompaun_ws/modifykompaun/modifykompaunDetails' . $urlQueryString);

$response = json_decode($result->getBody());

if ($response->status) {

info("Sunting : Berjaya simpan rekod kompaun ke epbt!");
}
else{

info("Sunting : Tidak berjaya simpan rekod kompaun ke epbt!");
}

} catch (\Exception $e) {

report($e);

info($e);

// return true;
}

}
else{
info("Sunting : Kesalahan tiada di dalam epbt");
}
}
else{

info("Sunting : Gagal untuk mendapatkan senarai kesalahan ePBT MBIP!");
}
}
}

Carregando…
Cancelar
Salvar