shjThreeService = $shjThreeService; } /** * コンソールコマンドを実行 * * 処理フロー: * 1. 駐輪場マスタ情報取得 * 2. 各駐輪場の実行タイミングチェック * 3. 定期更新対象者取得とリマインダー送信 * 4. バッチログ作成 * 5. 処理結果返却 * * @return int */ public function handle() { try { // 開始ログ出力 $startTime = now(); $this->info('SHJ-3 定期更新リマインダー処理を開始します。'); Log::info('SHJ-3 定期更新リマインダー処理開始', [ 'start_time' => $startTime ]); // SHJ-3メイン処理実行 $result = $this->shjThreeService->executeReminderProcess(); $endTime = now(); $this->info('SHJ-3 定期更新リマインダー処理が完了しました。'); $this->info("処理時間: {$startTime->diffInSeconds($endTime)}秒"); // 処理結果表示 $this->line('=== 処理結果 ==='); $this->line("対象駐輪場数: {$result['processed_parks_count']}"); $this->line("対象者総数: {$result['total_target_users']}"); $this->line("メール送信成功: {$result['mail_success_count']}件"); $this->line("メール送信失敗: {$result['mail_error_count']}件"); $this->line("オペレーターキュー追加: {$result['operator_queue_count']}件"); Log::info('SHJ-3 定期更新リマインダー処理完了', [ 'end_time' => $endTime, 'duration_seconds' => $startTime->diffInSeconds($endTime), 'result' => $result ]); return $result['success'] ? self::SUCCESS : self::FAILURE; } catch (\Exception $e) { $this->error('SHJ-3 定期更新リマインダー処理で予期しないエラーが発生しました: ' . $e->getMessage()); Log::error('SHJ-3 定期更新リマインダー処理例外エラー', [ 'exception' => $e->getMessage(), 'trace' => $e->getTraceAsString() ]); return self::FAILURE; } } }