Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

63 rindas
2.2KB

  1. <?php
  2. namespace App\Jobs\SeasonTicketContract\Selection;
  3. use App\Codes\QueueName;
  4. use App\Jobs\BaseJob;
  5. use App\Kintone\Models\DropDown\SeasonTicketContractSelection\SelectionStatus;
  6. use App\Logic\SeasonTicketContractSelectionManager;
  7. use App\Util\LoggingUtil;
  8. use Exception;
  9. use Illuminate\Database\Eloquent\ModelNotFoundException;
  10. class SetResult extends BaseJob
  11. {
  12. /**
  13. * Create a new job instance.
  14. *
  15. * @return void
  16. */
  17. public function __construct(
  18. private int $recordNo
  19. ) {
  20. $this->onQueue(QueueName::JOB->value);
  21. }
  22. protected function handleJob()
  23. {
  24. try {
  25. $manager = new SeasonTicketContractSelectionManager($this->recordNo);
  26. $manager->makeResult()
  27. ->save();
  28. $selection = $manager->getSelection();
  29. // 以下ログ出力処理
  30. if ($selection->status === SelectionStatus::RESULT_DECISION) {
  31. foreach ($selection->resultList as $result) {
  32. info(sprintf(
  33. "選考結果設定 駐車場:%s 選考レコード番号:%d 締日:%s 氏名:%s 申込番号:%s",
  34. $selection->parkingName,
  35. $selection->getRecordId(),
  36. $selection->selectionFinalDate ? $selection->selectionFinalDate->format('Y/m/d') : "-",
  37. $result->name,
  38. $result->entryNo,
  39. ));
  40. }
  41. } else if ($selection->status === SelectionStatus::FAILED) {
  42. info(sprintf(
  43. "選考不調 駐車場:%s 選考レコード番号:%d 締日:%s",
  44. $selection->parkingName,
  45. $selection->getRecordId(),
  46. $selection->selectionFinalDate ? $selection->selectionFinalDate->format('Y/m/d') : "-",
  47. ));
  48. }
  49. } catch (ModelNotFoundException $e) {
  50. LoggingUtil::errorException($e, sprintf("データ存在なし削除 %s", self::class));
  51. } catch (Exception $e) {
  52. LoggingUtil::errorException($e, sprintf("ジョブ失敗->削除 %s", self::class));
  53. }
  54. }
  55. }