Merge pull request #96 from witelgroup/feature/CalculateHarimAmount
create new column for harim
This commit is contained in:
@@ -101,4 +101,6 @@ HARIM_ENCRYPTION_IV="1111000011110101"
|
||||
|
||||
CHECKE_LIST_MACHINES_ACTIVITY_URL='fms.141.ir:7030/api/RMS/GetMovingVehicles',
|
||||
CHECKE_LIST_MACHINES_ACTIVITY_PASSWORD=
|
||||
CHECKE_LIST_MACHINES_ACTIVITY_USERNAME=
|
||||
CHECKE_LIST_MACHINES_ACTIVITY_USERNAME=
|
||||
|
||||
HARIM_AMOUNT_PER=1
|
||||
@@ -35,9 +35,9 @@ class GetMachinesInfoListCommand extends Command
|
||||
|
||||
$updatedRows = 0;
|
||||
|
||||
if (isset($response['vw_MachBankFull'])) {
|
||||
if (isset($response['vw_MachBankFull2'])) {
|
||||
|
||||
foreach ($response['vw_MachBankFull'] as $entry) {
|
||||
foreach ($response['vw_MachBankFull2'] as $entry) {
|
||||
// Insert data into the database
|
||||
CMMSMachine::query()->updateOrCreate(
|
||||
[
|
||||
@@ -54,8 +54,12 @@ class GetMachinesInfoListCommand extends Command
|
||||
'car_id' => $entry['Id'],
|
||||
'unit_group' => $entry['UnitGroup'] == [] ? null : $entry['UnitGroup'],
|
||||
'plak_number' => $entry['PlakNumber'] ?? null,
|
||||
'province_id' => $entry['UnitGroupCode'] ?? null,
|
||||
'city_id' => $entry['UnitCode'] ?? null,
|
||||
'station_id' => $entry['Layer3Code'] ?? null,
|
||||
]);
|
||||
$updatedRows += 1;
|
||||
|
||||
++$updatedRows;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -160,6 +160,7 @@ class HarimOfficeController extends Controller
|
||||
'position' => $request->position,
|
||||
'final_area_space' => $request->final_area_space,
|
||||
'road_type' => $request->road_type,
|
||||
'final_plan_space' => $request->final_plan_space,
|
||||
'payment_amount' => $request->payment_amount,
|
||||
]
|
||||
);
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Http\Requests\V3\Dashboard\Harim\HarimOffice;
|
||||
use App\Enums\HarimStates;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
class ComputingPaymentRequest extends FormRequest
|
||||
{
|
||||
@@ -28,9 +29,42 @@ class ComputingPaymentRequest extends FormRequest
|
||||
'traffic' => 'required|numeric|decimal:0,1',
|
||||
'road_type' => 'required|numeric|decimal:0,1',
|
||||
'position' => 'required|numeric|decimal:0,1',
|
||||
'final_area_space' => 'required|numeric|decimal:0,2',
|
||||
'payment_amount' => 'required|numeric|decimal:0,2',
|
||||
'final_area_space' => 'required|numeric|decimal:0,2', //عرصه
|
||||
'final_plan_space' => 'required|numeric|decimal:0,2', // عیان
|
||||
'payment_amount' => 'required|numeric',
|
||||
'expert_description' => 'required|string',
|
||||
];
|
||||
}
|
||||
|
||||
public function after(): array
|
||||
{
|
||||
return [
|
||||
function () {
|
||||
$fe = config('harim_web_services.Harim_Payment.per');
|
||||
$arse = (
|
||||
$this->traffic *
|
||||
$this->road_type *
|
||||
$this->position *
|
||||
$fe*
|
||||
$this->final_area_space
|
||||
);
|
||||
$ayan =(
|
||||
$this->traffic *
|
||||
$this->road_type *
|
||||
$this->position *
|
||||
$fe*
|
||||
$this->final_plan_space
|
||||
);
|
||||
$result = floor($arse + $ayan);
|
||||
|
||||
if ($result !== $this->payment_amount) {
|
||||
$this->validator->errors()->add(
|
||||
'payment_amount',
|
||||
'payment_amount مقادیر بدست امده صحیح نمی باشد.'
|
||||
);
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,24 @@ class ConfirmGuaranteeLetterNeedListener implements ShouldQueue
|
||||
*/
|
||||
public function handle(ConfirmGuaranteeLetterNeedEvent $event, SendAccessRoadStatusService $sendAccessRoadStatusService): void
|
||||
{
|
||||
$sendAccessRoadStatusService->makeInputParameters($event->harim->data);
|
||||
|
||||
$arrayData = json_decode($event->harim->data, true);
|
||||
|
||||
$sendAccessRoadStatusService->makeInputParameters([
|
||||
'data' => [
|
||||
'actionId' => $arrayData['actionId'],
|
||||
'ruleId' => $arrayData['ruleId'],
|
||||
'activityId' => $arrayData['activityId'],
|
||||
'requestId' => $arrayData['requestId'],
|
||||
'taskId' => $arrayData['taskId'],
|
||||
'code' => $event->harim->id,
|
||||
'resultStatus' => 1,
|
||||
'Description' => $event->harim->last_description,
|
||||
],
|
||||
|
||||
'token' => $arrayData['token'],
|
||||
]);
|
||||
|
||||
$sendAccessRoadStatusService->run();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,24 @@ class ConfirmNoRoadAccessNeedListener implements ShouldQueue
|
||||
*/
|
||||
public function handle(ConfirmNoRoadAccessNeedEvent $event, SendAccessRoadStatusService $sendAccessRoadStatusService): void
|
||||
{
|
||||
$sendAccessRoadStatusService->makeInputParameters($event->harim->data);
|
||||
|
||||
$arrayData = json_decode($event->harim->data, true);
|
||||
|
||||
$sendAccessRoadStatusService->makeInputParameters([
|
||||
'data' => [
|
||||
'actionId' => $arrayData['actionId'],
|
||||
'ruleId' => $arrayData['ruleId'],
|
||||
'activityId' => $arrayData['activityId'],
|
||||
'requestId' => $arrayData['requestId'],
|
||||
'taskId' => $arrayData['taskId'],
|
||||
'code' => $event->harim->id,
|
||||
'resultStatus' => 1,
|
||||
'Description' => $event->harim->last_description,
|
||||
],
|
||||
|
||||
'token' => $arrayData['token'],
|
||||
]);
|
||||
|
||||
$sendAccessRoadStatusService->run();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,24 @@ class ConfirmRoadAccessEditNeedListener implements ShouldQueue
|
||||
*/
|
||||
public function handle(ConfirmRoadAccessEditNeedEvent $event, SendAccessRoadStatusService $sendAccessRoadStatusService): void
|
||||
{
|
||||
$sendAccessRoadStatusService->makeInputParameters($event->harim->data);
|
||||
|
||||
$arrayData = json_decode($event->harim->data, true);
|
||||
|
||||
$sendAccessRoadStatusService->makeInputParameters([
|
||||
'data' => [
|
||||
'actionId' => $arrayData['actionId'],
|
||||
'ruleId' => $arrayData['ruleId'],
|
||||
'activityId' => $arrayData['activityId'],
|
||||
'requestId' => $arrayData['requestId'],
|
||||
'taskId' => $arrayData['taskId'],
|
||||
'code' => $event->harim->id,
|
||||
'resultStatus' => 1,
|
||||
'Description' => $event->harim->last_description,
|
||||
],
|
||||
|
||||
'token' => $arrayData['token'],
|
||||
]);
|
||||
|
||||
$sendAccessRoadStatusService->run();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Listeners\V3\Dashboard\Harim;
|
||||
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessNeedEvent;
|
||||
use App\Models\Harim;
|
||||
use App\Services\PanjarehVahed\SendAccessRoadStatusService;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
@@ -25,7 +26,23 @@ class ConfirmRoadAccessNeedListener implements ShouldQueue
|
||||
*/
|
||||
public function handle(ConfirmRoadAccessNeedEvent $event, SendAccessRoadStatusService $sendAccessRoadStatusService): void
|
||||
{
|
||||
$sendAccessRoadStatusService->makeInputParameters($event->harim->data);
|
||||
$arrayData = json_decode($event->harim->data, true);
|
||||
|
||||
$sendAccessRoadStatusService->makeInputParameters([
|
||||
'data' => [
|
||||
'actionId' => $arrayData['actionId'],
|
||||
'ruleId' => $arrayData['ruleId'],
|
||||
'activityId' => $arrayData['activityId'],
|
||||
'requestId' => $arrayData['requestId'],
|
||||
'taskId' => $arrayData['taskId'],
|
||||
'code' => $event->harim->id,
|
||||
'resultStatus' => 1,
|
||||
'Description' => $event->harim->last_description,
|
||||
],
|
||||
|
||||
'token' => $arrayData['token'],
|
||||
]);
|
||||
|
||||
$sendAccessRoadStatusService->run();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,24 @@ class PaymentExecutedListener implements ShouldQueue
|
||||
*/
|
||||
public function handle(PaymentExecutedEvent $event, SendPaymentInfoService $sendPaymentInfoService): void
|
||||
{
|
||||
$sendPaymentInfoService->makeInputParameters($event->harim->data);
|
||||
|
||||
$arrayData = json_decode($event->harim->data, true);
|
||||
|
||||
$sendPaymentInfoService->makeInputParameters([
|
||||
'data' => [
|
||||
'actionId' => $arrayData['actionId'],
|
||||
'ruleId' => $arrayData['ruleId'],
|
||||
'activityId' => $arrayData['activityId'],
|
||||
'requestId' => $arrayData['requestId'],
|
||||
'taskId' => $arrayData['taskId'],
|
||||
'code' => $event->harim->id,
|
||||
'warrantStatus' => $event->harim->need_payment ,
|
||||
'amountPaid' => $arrayData['amountPaid'],
|
||||
],
|
||||
|
||||
'token' => $arrayData['token'],
|
||||
]);
|
||||
|
||||
$sendPaymentInfoService->run();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,24 @@ class RejectRequestListener implements ShouldQueue
|
||||
*/
|
||||
public function handle(RejectRequestEvent $event, SendAccessRoadStatusService $sendAccessRoadStatusService): void
|
||||
{
|
||||
$sendAccessRoadStatusService->makeInputParameters($event->harim->data);
|
||||
|
||||
$arrayData = json_decode($event->harim->data, true);
|
||||
|
||||
$sendAccessRoadStatusService->makeInputParameters([
|
||||
'data' => [
|
||||
'actionId' => $arrayData['actionId'],
|
||||
'ruleId' => $arrayData['ruleId'],
|
||||
'activityId' => $arrayData['activityId'],
|
||||
'requestId' => $arrayData['requestId'],
|
||||
'taskId' => $arrayData['taskId'],
|
||||
'code' => $event->harim->id,
|
||||
'resultStatus' => 3,
|
||||
'Description' => $event->harim->last_description,
|
||||
],
|
||||
|
||||
'token' => $arrayData['token'],
|
||||
]);
|
||||
|
||||
$sendAccessRoadStatusService->run();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,4 +62,11 @@ class Harim extends Model
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
public function latestDescription()
|
||||
{
|
||||
return $this->hasMany(HarimHistory::class)
|
||||
->latestOfMany()
|
||||
->value('expert_description');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,27 +48,11 @@ class SendAccessRoadStatusService
|
||||
->json();
|
||||
}
|
||||
|
||||
public function makeInputParameters($data): void
|
||||
public function makeInputParameters($input): void
|
||||
{
|
||||
$arrayData = json_decode($data, true);
|
||||
|
||||
$inputParameters = [
|
||||
'data' => [
|
||||
'actionId' => $arrayData['actionId'],
|
||||
'ruleId' => $arrayData['ruleId'],
|
||||
'activityId' => $arrayData['activityId'],
|
||||
'requestId' => $arrayData['requestId'],
|
||||
'taskId' => $arrayData['taskId'],
|
||||
'code' => $arrayData['code'],
|
||||
'resultStatus' => $arrayData['resultStatus'],
|
||||
'Description' => $arrayData['Description'],
|
||||
],
|
||||
'token' => $arrayData['token'],
|
||||
];
|
||||
|
||||
$key = config('harim_web_services.Harim_Info.key');
|
||||
$iv = config('harim_web_services.Harim_Info.iv');
|
||||
|
||||
$this->inputParameters = openssl_encrypt(json_encode($inputParameters), 'aes-256-cbc', $key, false, $iv);
|
||||
$this->inputParameters = openssl_encrypt(json_encode($input), 'aes-256-cbc', $key, false, $iv);
|
||||
}
|
||||
}
|
||||
@@ -48,27 +48,11 @@ class SendPaymentInfoService
|
||||
->json();
|
||||
}
|
||||
|
||||
public function makeInputParameters($data): void
|
||||
public function makeInputParameters($input): void
|
||||
{
|
||||
$arrayData = json_decode($data, true);
|
||||
|
||||
$inputParameters = [
|
||||
'data' => [
|
||||
'actionId' => $arrayData['actionId'],
|
||||
'ruleId' => $arrayData['ruleId'],
|
||||
'activityId' => $arrayData['activityId'],
|
||||
'requestId' => $arrayData['requestId'],
|
||||
'taskId' => $arrayData['taskId'],
|
||||
'code' => $arrayData['code'],
|
||||
'warrantStatus' => $arrayData['warrantStatus'],
|
||||
'amountPaid' => $arrayData['amountPaid'],
|
||||
],
|
||||
'token' => $arrayData['token'],
|
||||
];
|
||||
|
||||
$key = config('harim_web_services.Harim_Info.key');
|
||||
$iv = config('harim_web_services.Harim_Info.iv');
|
||||
|
||||
$this->inputParameters = openssl_encrypt(json_encode($inputParameters), 'aes-256-cbc', $key, false, $iv);
|
||||
$this->inputParameters = openssl_encrypt(json_encode($input), 'aes-256-cbc', $key, false, $iv);
|
||||
}
|
||||
}
|
||||
@@ -35,4 +35,8 @@ return [
|
||||
'key' => env('HARIM_ENCRYPTION_KEY'),
|
||||
'iv' => env('HARIM_ENCRYPTION_IV'),
|
||||
],
|
||||
|
||||
'Harim_Payment' => [
|
||||
'per' => env('HARIM_AMOUNT_PER'),
|
||||
]
|
||||
];
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('harims', function (Blueprint $table) {
|
||||
$table->decimal('final_plan_space')->nullable();
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('harims', function (Blueprint $table) {
|
||||
$table->dropColumn('final_plan_space');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('cmms_machines', function (Blueprint $table) {
|
||||
$table->foreignId('province_id')->nullable()->constrained('provinces');
|
||||
$table->foreignId('city_id')->nullable()->constrained('cities');
|
||||
$table->foreignId('station_id')->nullable()->constrained('rahdari_points');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('cmms_machines', function (Blueprint $table) {
|
||||
$table->dropForeign('cmms_machines_province_id_foreign');
|
||||
$table->dropForeign('cmms_machines_city_id_foreign');
|
||||
$table->dropForeign('cmms_machines_station_id_foreign');
|
||||
$table->dropColumn('province_id');
|
||||
$table->dropColumn('city_id');
|
||||
$table->dropColumn('station_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -17,6 +17,7 @@ use App\Http\Controllers\V3\Dashboard\Mission\ControlUnitController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\DetailController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\RequestPortalController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\TransportationUnitController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\ViolationManagementController;
|
||||
use App\Http\Controllers\V3\Dashboard\ObservedItemController;
|
||||
use App\Http\Controllers\V3\Dashboard\OtpManagementController;
|
||||
use App\Http\Controllers\V3\Dashboard\RoadMaintenanceStationController;
|
||||
@@ -520,7 +521,14 @@ Route::prefix('missions')
|
||||
Route::get('/machines/{mission}', 'machines')->name('machines');
|
||||
Route::get('/rahdaran/{mission}', 'rahdaran')->name('rahdaran');
|
||||
});
|
||||
Route::prefix('violation_management')
|
||||
->name('violationManagement.')
|
||||
->controller(ViolationManagementController::class)
|
||||
->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
});
|
||||
});
|
||||
|
||||
Route::prefix('harim')
|
||||
->name('harim.')
|
||||
->group(function () {
|
||||
|
||||
Reference in New Issue
Block a user