diff --git a/app/Console/Commands/SeasonTikcetContractSelectionFillCandidates.php b/app/Console/Commands/SeasonTikcetContractSelectionFillCandidates.php deleted file mode 100644 index ed33ca7..0000000 --- a/app/Console/Commands/SeasonTikcetContractSelectionFillCandidates.php +++ /dev/null @@ -1,90 +0,0 @@ -managers = collect(); - } - - /** - * Execute the console command. - * - * @return int - */ - public function service(): int - { - try { - $db = DBUtil::instance(); - $db->beginTransaction(); - - $this->getName(); - $targets = $this->getTargets(); - - $this->outputInfo(sprintf("取得対象 %d件", $targets->count())); - - // データハンドリング - foreach ($targets as $data) { - $this->handleData($data); - } - - $db->commit(); - } catch (Exception $e) { - $db->rollBack(); - throw $e; - } - - return self::RESULTCODE_SUCCESS; - } - - private function getTargets() - { - $access = SeasonTicketContractSelection::getAccess(); - $query = SeasonTicketContractSelection::getQuery() - ->whereIn(SeasonTicketContractSelection::FIELD_STATUS, [SelectionStatus::START]); - return $access->all($query); - } - - - private function handleData(SeasonTicketContractSelection $data) - { - FillCandidates::dispatch($data->getRecordId()); - } -} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index a21f267..04c151c 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -16,7 +16,6 @@ class Kernel extends ConsoleKernel Schedules\SMBCBankAccountRegisterPoll::register($schedule); Schedules\SMBCPaymentPoll::register($schedule); Schedules\BankAccountRegisterRemaind::register($schedule); - Schedules\SeasonTikcetContractSelectionFillCandidates::register($schedule); Schedules\SeasonTikcetContractSelectionSetResult::register($schedule); Schedules\SeasonTicketContractTerminateComplete::register($schedule); } diff --git a/app/Console/Schedules/SeasonTikcetContractSelectionFillCandidates.php b/app/Console/Schedules/SeasonTikcetContractSelectionFillCandidates.php deleted file mode 100644 index 1f643c9..0000000 --- a/app/Console/Schedules/SeasonTikcetContractSelectionFillCandidates.php +++ /dev/null @@ -1,17 +0,0 @@ -command(Command::class) - ->everyFiveMinutes() - ->description("定期選考申込者一覧設定"); - } -} diff --git a/app/Http/Controllers/Web/SeasonTicketContract/Selection/FillCandidatesController.php b/app/Http/Controllers/Web/SeasonTicketContract/Selection/FillCandidatesController.php new file mode 100644 index 0000000..f0eb3ba --- /dev/null +++ b/app/Http/Controllers/Web/SeasonTicketContract/Selection/FillCandidatesController.php @@ -0,0 +1,48 @@ +param; + + $manager = new SeasonTicketContractSelectionManager($param->recordNo); + $manager->makeCandidates() + ->save(); + + $selection = $manager->getSelection(); + + info(sprintf( + "候補者設定 駐車場:%s 締日:%s 候補者数:%d件", + $selection->parkingName, + $selection->selectionFinalDate ? $selection->selectionFinalDate->format('Y/m/d') : "-", + $selection->candidateList->count(), + )); + + return $this->successResponse(); + } +} diff --git a/app/Http/Controllers/Web/SeasonTicketContract/Selection/FillCandidatesParams.php b/app/Http/Controllers/Web/SeasonTicketContract/Selection/FillCandidatesParams.php new file mode 100644 index 0000000..287d816 --- /dev/null +++ b/app/Http/Controllers/Web/SeasonTicketContract/Selection/FillCandidatesParams.php @@ -0,0 +1,20 @@ + $this->numeric(), + ]; + } +} diff --git a/app/Jobs/SeasonTicketContract/Selection/FillCandidates.php b/app/Jobs/SeasonTicketContract/Selection/FillCandidates.php deleted file mode 100644 index cb585ab..0000000 --- a/app/Jobs/SeasonTicketContract/Selection/FillCandidates.php +++ /dev/null @@ -1,47 +0,0 @@ -onQueue(QueueName::JOB->value); - } - - protected function handleJob() - { - try { - $manager = new SeasonTicketContractSelectionManager($this->recordNo); - $manager->makeCandidates() - ->save(); - - $selection = $manager->getSelection(); - - info(sprintf( - "候補者設定 駐車場:%s 締日:%s 候補者数:%d件", - $selection->parkingName, - $selection->selectionFinalDate ? $selection->selectionFinalDate->format('Y/m/d') : "-", - $selection->candidateList->count(), - )); - } catch (ModelNotFoundException $e) { - LoggingUtil::errorException($e, sprintf("データ存在なし削除 %s", self::class)); - } catch (Exception $e) { - LoggingUtil::errorException($e, sprintf("ジョブ失敗->削除 %s", self::class)); - } - } -} diff --git a/app/Logic/SeasonTicketContractSelectionManager.php b/app/Logic/SeasonTicketContractSelectionManager.php index 56ed0ab..e9017d6 100644 --- a/app/Logic/SeasonTicketContractSelectionManager.php +++ b/app/Logic/SeasonTicketContractSelectionManager.php @@ -231,6 +231,7 @@ class SeasonTicketContractSelectionManager if ($this->selection->entryList->isEmpty()) { $this->selection->status = SelectionStatus::FAILED; $messages->push("契約希望者不在のため、選考不調"); + $this->selection->resultList = $this->selection->resultList->empty(); return $messages; } diff --git a/routes/apiFromKintone.php b/routes/apiFromKintone.php index b1bfce5..c5136d8 100644 --- a/routes/apiFromKintone.php +++ b/routes/apiFromKintone.php @@ -15,6 +15,7 @@ use App\Util\RouteHelper; RouteHelper::post('/email/send', App\Http\Controllers\Web\Email\EmailSendController::class); RouteHelper::post('/season-ticket-contract-selection/notice-to-candidates', App\Http\Controllers\Web\SeasonTicketContract\Selection\NoticeToCandidatesController::class); +RouteHelper::post('/season-ticket-contract-selection/fill-candidates', App\Http\Controllers\Web\SeasonTicketContract\Selection\FillCandidatesController::class); RouteHelper::post('/receipt/create', App\Http\Controllers\Web\Receipt\ReceiptCreateController::class);