@@ -39,7 +39,7 @@ enum HarimStates: int
|
||||
13 => "تائید عرصه و اعیان ارسال شده توسط اداره حریم",
|
||||
14 => "تائید عرصه و اعیان ارسال شده توسط معاون",
|
||||
15 => "تائید عرصه و اعیان ارسال شده توسط مدیر",
|
||||
16 => " مخالفت با درخواست"
|
||||
16 => "مخالفت با درخواست"
|
||||
];
|
||||
|
||||
return $mapArray[$state];
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\V2\Dashboard;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Jobs\UpdateRoadObservedInfoByNikarayanJob;
|
||||
use App\Services\NikarayanService;
|
||||
use Illuminate\Http\Request;
|
||||
use Hekmatinasser\Verta\Verta;
|
||||
@@ -570,7 +571,8 @@ class RoadObservationController extends Controller
|
||||
// }
|
||||
// $url = "https://riws.rmto.ir/WebServices/NRPTrafficStatus.asmx?wsdl";
|
||||
try {
|
||||
$result = $nikarayanService->updateRoadObservedInfoByNikarayan($request, $roadObserved, $files_path);
|
||||
// $result = $nikarayanService->updateRoadObservedInfoByNikarayan($request->only(['rms-status', 'rms-description']), $roadObserved, $files_path);
|
||||
$result = UpdateRoadObservedInfoByNikarayanJob::dispatch($roadObserved, $files_path)->onQueue('nikarayan');
|
||||
} catch (SoapFault $e) {
|
||||
|
||||
$msg = "error in send to nikarayan at" . date("Y-m-d H:i:s") . "\n" . 'rms: error in get road observation webservice babe!!!!' . "\n";
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\V3\Dashboard\Harim;
|
||||
use App\Enums\HarimStates;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\PanjareVahed\GetAccessRoadRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\PanjareVahed\GetFinalPolygonsRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\PanjareVahed\GetRejectRequest;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\PanjareVahed\ReceiveNewRequest;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
@@ -41,22 +42,24 @@ class PanjareVahedController extends Controller
|
||||
Harim::query()->create([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
'panjare_vahed_id' => $request->id,
|
||||
'panjare_vahed_id' => $request->panjare_vahed_id,
|
||||
'national_id' => $request->national_id,
|
||||
'phone_number' => $request->phone_number,
|
||||
'request_date' => $request->request_date,
|
||||
'province_id' => $city->province_id,
|
||||
'province_name' => $city->province()->first()->name_fa,
|
||||
'city_id' => $city->id,
|
||||
'city_name' => $city->name,
|
||||
'city_name' => $city->name_fa,
|
||||
'edareh_shahri_id' => $city->edarateShahri()->first()->id,
|
||||
'requested_organization' => $request->organization,
|
||||
'requested_organization' => $request->requested_organization,
|
||||
'plan_group' => $request->plan_group,
|
||||
'plan_title' => $request->plan_title,
|
||||
'worksheet_id' => $request->worksheet_id,
|
||||
'response_options' => json_encode($request->response_options),
|
||||
'isic' => $request->isic,
|
||||
'primary_area' => $request->primary_area,
|
||||
'primary_area' => json_encode($request->primary_area),
|
||||
'lat' => $request->lat,
|
||||
'lng' => $request->lng,
|
||||
]);
|
||||
|
||||
return $this->successResponse([
|
||||
@@ -80,6 +83,7 @@ class PanjareVahedController extends Controller
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
|
||||
public function getRejectRequest(GetRejectRequest $request)
|
||||
{
|
||||
$state = HarimStates::MOKHALEFAT_BA_DASTGAH->value;
|
||||
@@ -93,7 +97,9 @@ class PanjareVahedController extends Controller
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
public function getFinalPolygons(GetAccessRoadRequest $request)
|
||||
|
||||
|
||||
public function getFinalPolygons(GetFinalPolygonsRequest $request)
|
||||
{
|
||||
$state = HarimStates::TAEDE_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_DAFTAR_HARIM->value;
|
||||
|
||||
|
||||
@@ -105,13 +105,13 @@ class OperatorController
|
||||
$roadObservedHistoryData['new_files'] = json_encode($files_path);
|
||||
}
|
||||
|
||||
DB::transaction(function () use ($roadObserved, $roadObservedHistoryData, $roadObservedData, $request, $nikarayanService, $files_path) {
|
||||
DB::transaction(function () use ($roadObserved, $roadObservedHistoryData, $roadObservedData, $nikarayanService, $files_path) {
|
||||
$roadObserved->problemHistories()->create($roadObservedHistoryData);
|
||||
$roadObserved->update($roadObservedData);
|
||||
|
||||
auth()->user()->addActivityComplete(1142);
|
||||
|
||||
$nikarayanService->updateRoadObservedInfoByNikarayan($request, $roadObserved, $files_path);
|
||||
$nikarayanService->updateRoadObservedInfoByNikarayan($roadObserved, $files_path);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
@@ -170,13 +170,13 @@ class OperatorController
|
||||
$roadObservedHistoryData['new_files'] = $files;
|
||||
}
|
||||
|
||||
DB::transaction(function () use ($roadObserved, $roadObservedHistoryData, $roadObservedData, $request, $nikarayanService) {
|
||||
DB::transaction(function () use ($roadObserved, $roadObservedHistoryData, $roadObservedData, $files_path, $nikarayanService) {
|
||||
$roadObserved->problemHistories()->create($roadObservedHistoryData);
|
||||
$roadObserved->update($roadObservedData);
|
||||
|
||||
auth()->user()->addActivityComplete(1142);
|
||||
|
||||
$nikarayanService->updateRoadObservedInfoByNikarayan($request, $roadObserved, json_encode($roadObservedHistoryData['new_files']));
|
||||
$nikarayanService->updateRoadObservedInfoByNikarayan($roadObserved, $files_path);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
|
||||
@@ -12,18 +12,18 @@ class GetAccessRoadRequest extends FormRequest
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, ValidationRule|array|string>
|
||||
* @return array<string, ValidationRule|array>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'panjare_vahed_id' => 'required|string',
|
||||
'panjare_vahed_id' => 'required',
|
||||
'access_road' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\Harim\PanjareVahed;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class GetFinalPolygonsRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, ValidationRule|array>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'panjare_vahed_id' => 'required',
|
||||
'final_area' => 'required',
|
||||
'final_plan' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -12,18 +12,18 @@ class GetRejectRequest extends FormRequest
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, ValidationRule|array|string>
|
||||
* @return array<string, ValidationRule|array>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'panjare_vahed_id' => 'required|string',
|
||||
'panjare_vahed_id' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class ReceiveNewRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'panjare_vahed_id' => 'required|integer',
|
||||
'panjare_vahed_id' => 'required|integer|unique:harims,panjare_vahed_id',
|
||||
'national_id' => 'required',
|
||||
'phone_number' => 'required',
|
||||
'request_date' => 'required',
|
||||
@@ -34,6 +34,8 @@ class ReceiveNewRequest extends FormRequest
|
||||
'response_options' => 'required',
|
||||
'isic' => 'required',
|
||||
'primary_area' => 'required',
|
||||
'lat' => 'required',
|
||||
'lng' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
45
app/Jobs/UpdateRoadObservedInfoByNikarayanJob.php
Normal file
45
app/Jobs/UpdateRoadObservedInfoByNikarayanJob.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Models\NikarayanFault;
|
||||
use App\Models\RoadObserved;
|
||||
use App\Services\NikarayanService;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use SoapFault;
|
||||
use Throwable;
|
||||
|
||||
class UpdateRoadObservedInfoByNikarayanJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct(public RoadObserved $roadObserved, public $files) {}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
* @throws SoapFault
|
||||
*/
|
||||
public function handle(NikarayanService $nikarayanService)
|
||||
{
|
||||
return $nikarayanService->updateRoadObservedInfoByNikarayan($this->roadObserved, $this->files);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a job failure.
|
||||
*/
|
||||
public function failed(?Throwable $exception): void
|
||||
{
|
||||
NikarayanFault::query()->create([
|
||||
'road_observed_id' => $this->roadObserved->id,
|
||||
'response' => $exception->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
19
app/Models/NikarayanFault.php
Normal file
19
app/Models/NikarayanFault.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class NikarayanFault extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
public function roadObserved(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(RoadObserved::class);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
@@ -136,4 +137,9 @@ class RoadObserved extends Model
|
||||
'mission_id',
|
||||
);
|
||||
}
|
||||
|
||||
public function nikarayanFaults(): HasMany
|
||||
{
|
||||
return $this->hasMany(NikarayanFault::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class NikarayanService
|
||||
/**
|
||||
* @throws SoapFault
|
||||
*/
|
||||
public function updateRoadObservedInfoByNikarayan(Request $request, RoadObserved $roadObserved, $files)
|
||||
public function updateRoadObservedInfoByNikarayan(RoadObserved $roadObserved, $files)
|
||||
{
|
||||
if (App::isProduction())
|
||||
{
|
||||
@@ -24,8 +24,8 @@ class NikarayanService
|
||||
$array = array('strUserName' => 'vaytelrop',
|
||||
'strPassword' => 'VaYtelROP*2024',
|
||||
'strAutoID' => $roadObserved->fk_RegisteredEventMessage,
|
||||
'strStateID' => ($request->input('rms-status') == 1) ? '2' : '3',
|
||||
'strDescription' => $request->input('rms-description') ?? $roadObserved->rms_description,
|
||||
'strStateID' => ($roadObserved->rms_status == 1) ? '2' : '3',
|
||||
'strDescription' => $roadObserved->rms_description,
|
||||
'strPreviousImageLink' => !empty($files) && isset($files[0]['path']) ? "https://rms.rmto.ir/" . $files[0]['path'] : "",
|
||||
'strNextImageLink' => !empty($files) && isset($files[1]['path']) ? "https://rms.rmto.ir/" . $files[1]['path'] : "",
|
||||
'strRMSDateAndTime' => $roadObserved->updated_at
|
||||
|
||||
Reference in New Issue
Block a user