write webservice for get answer when panjareh vahed get answer
This commit is contained in:
@@ -65,9 +65,13 @@ class PanjareVahedController extends Controller
|
||||
}
|
||||
public function getAccessRoad(GetAccessRoadRequest $request, Harim $harim)
|
||||
{
|
||||
Harim::update([
|
||||
'panjarevahed_id' => $request->panjarevahed_id,
|
||||
'polygon' => $request->polygon,
|
||||
$state = HarimStates::BARESI_FILE_APLODE_SHODE_TAVASOTE_DAFTAR_HARIM->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
'panjare_vahed_id' => $request->panjare_vahed_id,
|
||||
'access_road' => $request->access_road,
|
||||
]);
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ class GetAccessRoadRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'panjarevahed_id'=> 'required|string',
|
||||
'polygon' => 'required|string',
|
||||
'panjare_vahed_id' => 'required|string',
|
||||
'access_road' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class OperatorService
|
||||
return DB::select("
|
||||
WITH edareh_data AS (
|
||||
SELECT
|
||||
e.id AS edareh_id,
|
||||
e.id AS edare_id,
|
||||
a.id AS axis_type_id,
|
||||
COALESCE(SUM(t.step = 1), 0) AS s1,
|
||||
COALESCE(SUM(t.step = 2), 0) AS s2,
|
||||
@@ -105,21 +105,21 @@ class OperatorService
|
||||
GROUP BY e.id, a.id
|
||||
)
|
||||
SELECT
|
||||
edareh_id,
|
||||
edare_id,
|
||||
axis_type_id,
|
||||
s1,
|
||||
s2,
|
||||
s3,
|
||||
COALESCE(
|
||||
SUM(s1 + s2 + s3)
|
||||
OVER (PARTITION BY edareh_id), 0
|
||||
OVER (PARTITION BY edare_id), 0
|
||||
) AS total_sum
|
||||
FROM edareh_data
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
-1 AS edareh_id,
|
||||
-1 AS edare_id,
|
||||
axis_type_id,
|
||||
COALESCE(SUM(s1), 0) AS s1,
|
||||
COALESCE(SUM(s2), 0) AS s2,
|
||||
@@ -130,7 +130,7 @@ class OperatorService
|
||||
FROM edareh_data
|
||||
GROUP BY axis_type_id
|
||||
|
||||
ORDER BY edareh_id , axis_type_id
|
||||
ORDER BY edare_id , axis_type_id
|
||||
", [
|
||||
'provinceId' => $province_id,
|
||||
'infoId' => $info_id,
|
||||
|
||||
@@ -565,7 +565,7 @@ Route::prefix('harim')
|
||||
->name('panjarevahed.')
|
||||
->controller(PanjarevahedController::class)
|
||||
->group(function () {
|
||||
Route::post('/get_access_road','getAccessRoad')->name('getAccessRoad');
|
||||
Route::post('/get_access_road/{harim}','getAccessRoad')->name('getAccessRoad');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user