| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- <?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\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\Jobs\UpdateCompoundPrice;
-
- class StoreCompoundEPBT implements ShouldQueue
- {
- use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
- protected $request, $kpd, $no_badan, $enf_nama, $kesalahan;
-
- /**
- * Create a new job instance.
- *
- * @return void
- */
- public function __construct(array $request_, $kpd_, $enf_nama_, $no_badan_, $kesalahan_)
- {
- $this->request = $request_;
- $this->kpd = $kpd_;
- $this->enf_nama = $enf_nama_;
- $this->no_badan = $no_badan_;
- $this->kesalahan= $kesalahan_;
- }
-
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle()
- {
- // $faulty = Faulty::with('DeedLaw', 'Department')->where('_id', $this->seksyen_kesalahan)->first();
- $compound = Compound::with('Department','DeedLaw','Faulty')->where('kpd',$this->kpd)->first();
-
- //get ePBT MBIP faulty lists
- $client = new \GuzzleHttp\Client();
- $result = $client->request('GET', 'http://218.208.81.239:81/appsepbtkompaun_ws/getinfokompaun/infokompaun?infokompaun[]=352405067769401&infokompaun[]=ekpn_kesalahan');
- $response = json_decode($result->getBody()->getContents());
- $now = Carbon::now()->toDateTimeString();
-
-
- if(!empty($response))
- {
- $k = [];
- foreach($response as $key => $r)
- {
-
- //if($this->kesalahan == $r->kesalahan)
- if($this->kesalahan == $this->kesalahan)
- {
- if($compound->jenis == 'Parkir')
- {
- array_push($k,
- $this->kpd, //no kompaun
- 'KPD', //jenis kompaun
- $r->fk_akta, //kod akta
- strtoupper($r->kesalahan), //keterangan kesalahan
- $compound->created_at->toDateString(), //tarikh
- $compound->created_at->toTimeString(), //masa
- 14, //tempoh
- $compound->nama_jalan .' , '. $compound->nama_taman,//namajalan, namataman
- 10,//kodbandar
- 'K',//jenis
- strtoupper($compound->plate_no), //no plat
- $compound->jumlah_asal_kompaun, //jumlah kompaun
- strtoupper($this->no_badan), //no badan
- '-', //no pembantu penguatkuasa
- strtoupper($this->enf_nama), //nama enforcer
- $now, //time created epbt
- $r->kod, //kod kesalahan
- $compound->nama, //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
- 'NULL', //latitud
- 'NULL', //longitud
- 'NULL', //device
- strtoupper($compound->no_cukai_jalan), //mo cukai jalan
- strtoupper($compound->plate_no), //no plat
- 'NULL', //no kupon
- strtoupper($compound->jenis_kenderaan), //jenis kenderaan
- strtoupper($compound->warna_kenderaan), //warna kenderaan
- strtoupper($compound->no_parking), //no petak parking
- 'NULL' //kod petak
-
- );
- }
- elseif($compound->jenis == 'Pelbagai_KT')
- {
- array_push($k,
- $this->kpd, //no kompaun
- 'KPD', //jenis kompaun
- $r->fk_akta, //kod akta
- strtoupper($r->kesalahan), //keterangan kesalahan
- $compound->created_at->toDateString(), //tarikh
- $compound->created_at->toTimeString(), //masa
- 14, //tempoh
- $compound->nama_jalan .' , '. $compound->nama_taman,//namajalan, namataman
- 10,//kodbandar
- 'K',//jenis
- strtoupper($compound->plate_no), //no plat
- $compound->jumlah_asal_kompaun, //jumlah kompaun
- strtoupper($this->no_badan), //no badan
- '-', //no pembantu penguatkuasa
- strtoupper($this->enf_nama), //nama enforcer
- $now, //time created epbt
- $r->kod, //kod kesalahan
- $compound->nama, //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
- 'NULL', //latitud
- 'NULL', //longitud
- 'NULL', //device
- strtoupper($compound->no_cukai_jalan), //mo cukai jalan
- strtoupper($compound->plate_no), //no plat
- 'NULL', //no kupon
- strtoupper($compound->jenis_kenderaan), //jenis kenderaan
- strtoupper($compound->warna_kenderaan), //warna kenderaan
- strtoupper($compound->no_parking), //no petak parking
- 'NULL' //kod petak
-
- );
- }
- elseif($compound->jenis == 'Pelbagai_JPB')
- {
- array_push($k,
- $this->kpd, //no kompaun
- 'KPD', //jenis kompaun
- $r->fk_akta, //kod akta
- strtoupper($r->kesalahan), //keterangan kesalahan
- $compound->created_at->toDateString(), //tarikh
- $compound->created_at->toTimeString(), //masa
- 14, //tempoh
- $compound->nama_jalan .' , '. $compound->nama_taman,//namajalan, namataman
- 10,//kodbandar
- 'K',//jenis
- strtoupper($compound->plate_no), //no plat
- $compound->jumlah_asal_kompaun, //jumlah kompaun
- strtoupper($this->no_badan), //no badan
- '-', //no pembantu penguatkuasa
- strtoupper($this->enf_nama), //nama enforcer
- $now, //time created epbt
- $r->kod, //kod kesalahan
- $compound->nama, //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
- 'NULL', //latitud
- 'NULL', //longitud
- 'NULL', //device
- strtoupper($compound->no_cukai_jalan), //mo cukai jalan
- strtoupper($compound->plate_no), //no plat
- 'NULL', //no kupon
- strtoupper($compound->jenis_kenderaan), //jenis kenderaan
- strtoupper($compound->warna_kenderaan), //warna kenderaan
- strtoupper($compound->no_parking), //no petak parking
- 'NULL' //kod petak
-
- );
- }
- elseif($compound->jenis == 'Pelbagai_PA')
- {
- array_push($k,
- $this->kpd, //no kompaun
- 'KPD', //jenis kompaun
- $r->fk_akta, //kod akta
- strtoupper($r->kesalahan), //keterangan kesalahan
- $compound->created_at->toDateString(), //tarikh
- $compound->created_at->toTimeString(), //masa
- 14, //tempoh
- $compound->nama_jalan .' , '. $compound->nama_taman,//namajalan, namataman
- 10,//kodbandar
- 'K',//jenis
- strtoupper($compound->plate_no), //no plat
- $compound->jumlah_asal_kompaun, //jumlah kompaun
- strtoupper($this->no_badan), //no badan
- '-', //no pembantu penguatkuasa
- strtoupper($this->enf_nama), //nama enforcer
- $now, //time created epbt
- $r->kod, //kod kesalahan
- $compound->nama, //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
- 'NULL', //latitud
- 'NULL', //longitud
- 'NULL', //device
- strtoupper($compound->no_cukai_jalan), //mo cukai jalan
- strtoupper($compound->plate_no), //no plat
- 'NULL', //no kupon
- strtoupper($compound->jenis_kenderaan), //jenis kenderaan
- strtoupper($compound->warna_kenderaan), //warna kenderaan
- strtoupper($compound->no_parking), //no petak parking
- 'NULL' //kod petak
-
- );
- }
- elseif($compound->jenis == 'Pelbagai_LESEN')
- {
- array_push($k,
- $this->kpd, //no kompaun
- 'KPD', //jenis kompaun
- $r->fk_akta, //kod akta
- strtoupper($r->kesalahan), //keterangan kesalahan
- $compound->created_at->toDateString(), //tarikh
- $compound->created_at->toTimeString(), //masa
- 14, //tempoh
- $compound->nama_jalan .' , '. $compound->nama_taman,//namajalan, namataman
- 10,//kodbandar
- 'K',//jenis
- strtoupper($compound->plate_no), //no plat
- $compound->jumlah_asal_kompaun, //jumlah kompaun
- strtoupper($this->no_badan), //no badan
- '-', //no pembantu penguatkuasa
- strtoupper($this->enf_nama), //nama enforcer
- $now, //time created epbt
- $r->kod, //kod kesalahan
- $compound->nama, //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
- 'NULL', //latitud
- 'NULL', //longitud
- 'NULL', //device
- strtoupper($compound->no_cukai_jalan), //mo cukai jalan
- strtoupper($compound->plate_no), //no plat
- 'NULL', //no kupon
- strtoupper($compound->jenis_kenderaan), //jenis kenderaan
- strtoupper($compound->warna_kenderaan), //warna kenderaan
- strtoupper($compound->no_parking), //no petak parking
- 'NULL' //kod petak
-
- );
- }
-
- $urlQueryString = '';
-
- for ($i=0; $i < count($k); $i++) {
-
- if($i == 0)
- {
- $urlQueryString = $urlQueryString . '?';
- }
- else
- {
- $urlQueryString = $urlQueryString . '&';
- }
-
- $urlQueryString = $urlQueryString . 'KompaunDetails[]=' . $k[$i];
- // bla/bla/my/registerkompaunDetails?KompaunDetails[]=KP45&KompaunDetails[]=ayu
- }
-
- try {
- $client = new \GuzzleHttp\Client();
- $result = $client->request('GET', 'http://218.208.81.239:81/appsepbtkompaun_ws/registerkompaun/registerkompaunDetails' . $urlQueryString);
- } catch (Throwable $e) {
- report($e);
-
- return true;
- }
-
- }
- else
- {
- Log::info("Rekod kesalahan tidak dijumpai!");
- }
-
- }
-
- }
- else
- {
- Log::info("Gagal untuk mendapatkan senarai kesalahan ePBT MBIP!");
- }
-
-
- }
-
- }
|