From d942fed62dc356d5e2efa954487c3789671c199c Mon Sep 17 00:00:00 2001 From: "go.unhi" Date: Thu, 23 Oct 2025 20:36:31 +0900 Subject: [PATCH] =?UTF-8?q?app/Console/Commands/ShjFourCCommand.php=20?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/ShjFourCCommand.php | 157 ----------------------- 1 file changed, 157 deletions(-) delete mode 100644 app/Console/Commands/ShjFourCCommand.php diff --git a/app/Console/Commands/ShjFourCCommand.php b/app/Console/Commands/ShjFourCCommand.php deleted file mode 100644 index 4d84407..0000000 --- a/app/Console/Commands/ShjFourCCommand.php +++ /dev/null @@ -1,157 +0,0 @@ -shjFourCService = $shjFourCService; - } - - /** - * コンソールコマンドを実行 - * - * 処理フロー: - * 1. パラメータ取得と検証 - * 2. ゾーン情報取得処理 - * 3. 割当判定処理 - * 4. バッチログ作成 - * 5. 処理結果返却 - * - * @return int - */ - public function handle() - { - try { - // 開始ログ出力 - $startTime = now(); - $this->info('SHJ-4C 室割当処理を開始します。'); - Log::info('SHJ-4C 室割当処理開始', [ - 'start_time' => $startTime, - 'park_id' => $this->argument('park_id'), - 'ptype_id' => $this->argument('ptype_id'), - 'psection_id' => $this->argument('psection_id') - ]); - - // 引数取得 - $parkId = $this->argument('park_id'); - $ptypeId = $this->argument('ptype_id'); - $psectionId = $this->argument('psection_id'); - - // パラメータ検証 - if (!$this->validateParameters($parkId, $ptypeId, $psectionId)) { - $this->error('パラメータが不正です。'); - return self::FAILURE; - } - - // SHJ-4C処理実行 - $result = $this->shjFourCService->executeRoomAllocation($parkId, $ptypeId, $psectionId); - - // 処理結果確認 - if ($result['success']) { - $endTime = now(); - $this->info('SHJ-4C 室割当処理が正常に完了しました。'); - $this->info("処理時間: {$startTime->diffInSeconds($endTime)}秒"); - - Log::info('SHJ-4C 室割当処理完了', [ - 'end_time' => $endTime, - 'duration_seconds' => $startTime->diffInSeconds($endTime), - 'result' => $result - ]); - - return self::SUCCESS; - } else { - $this->error('SHJ-4C 室割当処理でエラーが発生しました: ' . $result['message']); - Log::error('SHJ-4C 室割当処理エラー', [ - 'error' => $result['message'], - 'details' => $result['details'] ?? null - ]); - - return self::FAILURE; - } - - } catch (\Exception $e) { - $this->error('SHJ-4C 室割当処理で予期しないエラーが発生しました: ' . $e->getMessage()); - Log::error('SHJ-4C 室割当処理例外エラー', [ - 'exception' => $e->getMessage(), - 'trace' => $e->getTraceAsString() - ]); - - return self::FAILURE; - } - } - - /** - * パラメータの妥当性を検証 - * - * @param mixed $parkId 駐輪場ID - * @param mixed $ptypeId 駐輪分類ID - * @param mixed $psectionId 車種区分ID - * @return bool 検証結果 - */ - private function validateParameters($parkId, $ptypeId, $psectionId): bool - { - // 必須パラメータチェック - if (empty($parkId) || empty($ptypeId) || empty($psectionId)) { - $this->error('全てのパラメータは必須です。'); - return false; - } - - // 数値形式チェック - if (!is_numeric($parkId) || !is_numeric($ptypeId) || !is_numeric($psectionId)) { - $this->error('全てのパラメータは数値である必要があります。'); - return false; - } - - // 正の整数チェック - if ($parkId <= 0 || $ptypeId <= 0 || $psectionId <= 0) { - $this->error('全てのパラメータは正の整数である必要があります。'); - return false; - } - - return true; - } -}