| @@ -6,5 +6,5 @@ enum QueueName: string | |||||
| { | { | ||||
| case EMAIL = 'email'; | case EMAIL = 'email'; | ||||
| case SMS = 'sms'; | case SMS = 'sms'; | ||||
| case OTHER = 'other'; | |||||
| case JOB = 'job'; | |||||
| } | } | ||||
| @@ -0,0 +1,14 @@ | |||||
| <?php | |||||
| namespace App\Events\ReceiptIssuingOrder; | |||||
| /** | |||||
| * 担当変更イベント | |||||
| */ | |||||
| class ChangeHandlerEvent extends ReceiptIssuingOrderEvent | |||||
| { | |||||
| public function getEventName(): string | |||||
| { | |||||
| return "担当者変更"; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,14 @@ | |||||
| <?php | |||||
| namespace App\Events\ReceiptIssuingOrder; | |||||
| /** | |||||
| * 依頼完了イベント | |||||
| */ | |||||
| class CompletedEvent extends ReceiptIssuingOrderEvent | |||||
| { | |||||
| public function getEventName(): string | |||||
| { | |||||
| return "完了"; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,14 @@ | |||||
| <?php | |||||
| namespace App\Events\ReceiptIssuingOrder; | |||||
| /** | |||||
| * 領収証確定イベント | |||||
| */ | |||||
| class ConfirmedEvent extends ReceiptIssuingOrderEvent | |||||
| { | |||||
| public function getEventName(): string | |||||
| { | |||||
| return "領収証確定"; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,14 @@ | |||||
| <?php | |||||
| namespace App\Events\ReceiptIssuingOrder; | |||||
| /** | |||||
| * 新規登録イベント | |||||
| */ | |||||
| class CreatedEvent extends ReceiptIssuingOrderEvent | |||||
| { | |||||
| public function getEventName(): string | |||||
| { | |||||
| return "新規登録"; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,14 @@ | |||||
| <?php | |||||
| namespace App\Events\ReceiptIssuingOrder; | |||||
| /** | |||||
| * 領収証ダウンロードイベント | |||||
| */ | |||||
| class DownloadedEvent extends ReceiptIssuingOrderEvent | |||||
| { | |||||
| public function getEventName(): string | |||||
| { | |||||
| return "ダウンロード"; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,14 @@ | |||||
| <?php | |||||
| namespace App\Events\ReceiptIssuingOrder; | |||||
| /** | |||||
| * 郵送依頼イベント | |||||
| */ | |||||
| class MailOrderEvent extends ReceiptIssuingOrderEvent | |||||
| { | |||||
| public function getEventName(): string | |||||
| { | |||||
| return "郵送依頼"; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,14 @@ | |||||
| <?php | |||||
| namespace App\Events\ReceiptIssuingOrder; | |||||
| /** | |||||
| * 郵送投函イベント | |||||
| */ | |||||
| class MailPostedEvent extends ReceiptIssuingOrderEvent | |||||
| { | |||||
| public function getEventName(): string | |||||
| { | |||||
| return "郵送投函"; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,23 @@ | |||||
| <?php | |||||
| namespace App\Events\ReceiptIssuingOrder; | |||||
| use App\Models\ReceiptIssuingOrder; | |||||
| use Illuminate\Broadcasting\InteractsWithSockets; | |||||
| use Illuminate\Foundation\Events\Dispatchable; | |||||
| use Illuminate\Queue\SerializesModels; | |||||
| /** | |||||
| * 領収証発行依頼の基底イベントクラス | |||||
| */ | |||||
| abstract class ReceiptIssuingOrderEvent | |||||
| { | |||||
| use Dispatchable, InteractsWithSockets, SerializesModels; | |||||
| public function __construct( | |||||
| public ReceiptIssuingOrder $order | |||||
| ) { | |||||
| } | |||||
| abstract public function getEventName(): string; | |||||
| } | |||||
| @@ -41,7 +41,7 @@ class MailOrderController extends WebController | |||||
| $this->manager->initById($param->id) | $this->manager->initById($param->id) | ||||
| ->checkTimestamp($param->timestamp) | ->checkTimestamp($param->timestamp) | ||||
| ->fill( | |||||
| ->mailOrder( | |||||
| [ | [ | ||||
| ...$param->toArray(), | ...$param->toArray(), | ||||
| ReceiptIssuingOrder::COL_NAME_STATUS_ORDER_MAIL_DATETIME => DateUtil::now(), | ReceiptIssuingOrder::COL_NAME_STATUS_ORDER_MAIL_DATETIME => DateUtil::now(), | ||||
| @@ -41,11 +41,7 @@ class MailPostCompleteController extends WebController | |||||
| $this->manager->initById($param->id) | $this->manager->initById($param->id) | ||||
| ->checkTimestamp($param->timestamp) | ->checkTimestamp($param->timestamp) | ||||
| ->fill( | |||||
| [ | |||||
| ReceiptIssuingOrder::COL_NAME_STATUS_MAIL_POST_DATE => $param->statusMailPostDate | |||||
| ] | |||||
| ) | |||||
| ->mailPosted($param->statusMailPostDate) | |||||
| ->update(); | ->update(); | ||||
| return $this->successResponse(); | return $this->successResponse(); | ||||
| @@ -28,7 +28,7 @@ class CacheParkingName implements ShouldQueue | |||||
| private string $customerCode, | private string $customerCode, | ||||
| private string $parkingManagementCode | private string $parkingManagementCode | ||||
| ) { | ) { | ||||
| $this->onQueue(QueueName::OTHER->value); | |||||
| $this->onQueue(QueueName::JOB->value); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -0,0 +1,67 @@ | |||||
| <?php | |||||
| namespace App\Jobs\Other\Custom\HelloTechno; | |||||
| use App\Codes\QueueName; | |||||
| use App\Models\ReceiptIssuingHTParkingCustomOrder; | |||||
| use App\Models\ReceiptIssuingOrder; | |||||
| use App\Util\Custom\HelloTechno\API; | |||||
| use Illuminate\Bus\Queueable; | |||||
| use Illuminate\Contracts\Queue\ShouldQueue; | |||||
| use Illuminate\Foundation\Bus\Dispatchable; | |||||
| use Illuminate\Queue\InteractsWithQueue; | |||||
| use Illuminate\Queue\SerializesModels; | |||||
| class NoticeReceiptIssuingOrder implements ShouldQueue | |||||
| { | |||||
| use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; | |||||
| /** | |||||
| * Create a new job instance. | |||||
| * | |||||
| * @return void | |||||
| */ | |||||
| public function __construct( | |||||
| private ReceiptIssuingOrder $order, | |||||
| private ReceiptIssuingHTParkingCustomOrder $custom, | |||||
| private string $eventName = "", | |||||
| ) { | |||||
| $this->onQueue(QueueName::JOB->value); | |||||
| } | |||||
| /** | |||||
| * Execute the job. | |||||
| * | |||||
| * @return void | |||||
| */ | |||||
| public function handle() | |||||
| { | |||||
| try { | |||||
| API::sendReceiptIssuingOrder($this->order, $this->custom); | |||||
| } catch (Exception $e) { | |||||
| $this->log(false); | |||||
| throw $e; | |||||
| } | |||||
| $this->log(true); | |||||
| } | |||||
| public function log(bool $success) | |||||
| { | |||||
| $log = sprintf( | |||||
| "[HelloTechno]領収証発行依頼情報送信[%s] %s ID:%s C:%s P:%s A:%d", | |||||
| $this->eventName, | |||||
| $success ? "成功" : "失敗", | |||||
| $this->order->id, | |||||
| $this->custom->customer_name, | |||||
| $this->custom->parking_name, | |||||
| $this->custom->adjust_seq_no ?? 0, | |||||
| ); | |||||
| if ($success) { | |||||
| logs()->info($log); | |||||
| } else { | |||||
| logs()->error($log); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,40 @@ | |||||
| <?php | |||||
| namespace App\Listeners\ReceiptIssuingOrder\Custom\HelloTechno; | |||||
| use App\Events\ReceiptIssuingOrder\CompletedEvent; | |||||
| use App\Events\ReceiptIssuingOrder\ConfirmedEvent; | |||||
| use App\Events\ReceiptIssuingOrder\CreatedEvent; | |||||
| use App\Events\ReceiptIssuingOrder\DownloadedEvent; | |||||
| use App\Events\ReceiptIssuingOrder\MailOrderEvent; | |||||
| use App\Events\ReceiptIssuingOrder\MailPostedEvent; | |||||
| use App\Events\ReceiptIssuingOrder\ReceiptIssuingOrderEvent; | |||||
| use App\Jobs\Other\Custom\HelloTechno\NoticeReceiptIssuingOrder; | |||||
| use App\Models\ReceiptIssuingOrder; | |||||
| class NoticeListener | |||||
| { | |||||
| public function handle( | |||||
| CompletedEvent| | |||||
| ConfirmedEvent| | |||||
| CreatedEvent| | |||||
| MailOrderEvent| | |||||
| MailPostedEvent| | |||||
| DownloadedEvent $event | |||||
| ): void { | |||||
| $this->notice($event->order, $event); | |||||
| } | |||||
| /** | |||||
| * Handle the event. | |||||
| */ | |||||
| private function notice(ReceiptIssuingOrder $order, ReceiptIssuingOrderEvent $event) | |||||
| { | |||||
| $htCustom = $order->htCustomOrder; | |||||
| if ($htCustom !== null) { | |||||
| NoticeReceiptIssuingOrder::dispatch($order, $htCustom, $event->getEventName()); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -4,10 +4,12 @@ namespace App\Logic\ReceiptIssuingOrder; | |||||
| use App\Codes\EnvironmentName; | use App\Codes\EnvironmentName; | ||||
| use App\Codes\SMSSendPurpose; | use App\Codes\SMSSendPurpose; | ||||
| use App\Events\ReceiptIssuingOrder\CreatedEvent; | |||||
| use App\Logic\SMS\SMSManager; | use App\Logic\SMS\SMSManager; | ||||
| use App\Models\ReceiptIssuingOrder; | use App\Models\ReceiptIssuingOrder; | ||||
| use App\Util\DateUtil; | use App\Util\DateUtil; | ||||
| use Illuminate\Support\Facades\View; | use Illuminate\Support\Facades\View; | ||||
| use Illuminate\Support\Str; | |||||
| use LogicException; | use LogicException; | ||||
| class CreateManager extends ReceiptIssuingOrderManager | class CreateManager extends ReceiptIssuingOrderManager | ||||
| @@ -22,16 +24,16 @@ class CreateManager extends ReceiptIssuingOrderManager | |||||
| public function init() | public function init() | ||||
| { | { | ||||
| $order = $this->order; | |||||
| $this->initialized = true; | $this->initialized = true; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function id(): string | public function id(): string | ||||
| { | { | ||||
| return $this->order->id ?? ""; | |||||
| if (!$this->order->id) { | |||||
| $this->order->setId(); | |||||
| } | |||||
| return $this->order->id; | |||||
| } | } | ||||
| public function fill(array $attr) | public function fill(array $attr) | ||||
| @@ -67,6 +69,9 @@ class CreateManager extends ReceiptIssuingOrderManager | |||||
| $smsSendOrder = $this->smsManager::makeSMSSendOrder($order, SMSSendPurpose::SEND_RECEIPT_ISSUING_ORDER_FORM, $this->makeSMSContents()); | $smsSendOrder = $this->smsManager::makeSMSSendOrder($order, SMSSendPurpose::SEND_RECEIPT_ISSUING_ORDER_FORM, $this->makeSMSContents()); | ||||
| $smsSendOrder->send(); | $smsSendOrder->send(); | ||||
| // イベント登録 | |||||
| CreatedEvent::dispatch($this->order); | |||||
| return []; | return []; | ||||
| } | } | ||||
| @@ -4,47 +4,42 @@ namespace App\Logic\ReceiptIssuingOrder\Custom\HelloTechno; | |||||
| use App\Jobs\Other\Custom\HelloTechno\CacheParkingName; | use App\Jobs\Other\Custom\HelloTechno\CacheParkingName; | ||||
| use App\Logic\ReceiptIssuingOrder\CreateManager as BaseManager; | use App\Logic\ReceiptIssuingOrder\CreateManager as BaseManager; | ||||
| use App\Logic\SMS\SMSManager; | |||||
| use App\Models\ReceiptIssuingHTParkingCustomOrder; | use App\Models\ReceiptIssuingHTParkingCustomOrder; | ||||
| use App\Models\ReceiptIssuingOrder; | |||||
| class CreateManager | |||||
| class CreateManager extends BaseManager | |||||
| { | { | ||||
| public function __construct( | public function __construct( | ||||
| protected BaseManager $manager, | |||||
| ReceiptIssuingOrder $order, | |||||
| SMSManager $smsManager, | |||||
| private ReceiptIssuingHTParkingCustomOrder $customOrder, | private ReceiptIssuingHTParkingCustomOrder $customOrder, | ||||
| ) { | ) { | ||||
| } | |||||
| public function init(): static | |||||
| { | |||||
| $this->manager->init(); | |||||
| return $this; | |||||
| parent::__construct($order, $smsManager); | |||||
| } | } | ||||
| public function fill(array $attr): static | public function fill(array $attr): static | ||||
| { | { | ||||
| $this->manager->fill($attr); | |||||
| $this->customOrder->fill($attr); | $this->customOrder->fill($attr); | ||||
| return $this; | |||||
| return parent::fill($attr); | |||||
| } | } | ||||
| public function create(): array | public function create(): array | ||||
| { | { | ||||
| $messages = $this->manager->create(); | |||||
| if (count($messages) !== 0) { | |||||
| return $messages; | |||||
| } | |||||
| $this->customOrder->setReceiptIssuingOrder($this->manager->id()); | |||||
| $id = $this->id(); | |||||
| $this->customOrder->setReceiptIssuingOrder($id); | |||||
| $this->customOrder->save(); | $this->customOrder->save(); | ||||
| $messages = parent::create(); | |||||
| if (count($messages) !== 0) { | |||||
| return $messages; | |||||
| } | |||||
| // 駐車場名キャッシュ | // 駐車場名キャッシュ | ||||
| CacheParkingName::dispatch($this->customOrder->customer_code, $this->customOrder->parking_management_code); | CacheParkingName::dispatch($this->customOrder->customer_code, $this->customOrder->parking_management_code); | ||||
| return []; | return []; | ||||
| } | } | ||||
| } | } | ||||
| @@ -2,6 +2,7 @@ | |||||
| namespace App\Logic\ReceiptIssuingOrder; | namespace App\Logic\ReceiptIssuingOrder; | ||||
| use App\Events\ReceiptIssuingOrder\DownloadedEvent; | |||||
| use App\Exceptions\AppCommonException; | use App\Exceptions\AppCommonException; | ||||
| use App\Models\ReceiptIssuingOrder; | use App\Models\ReceiptIssuingOrder; | ||||
| use App\Util\DateUtil; | use App\Util\DateUtil; | ||||
| @@ -33,6 +34,9 @@ class PDFDownLoadManager extends ReceiptIssuingOrderManager | |||||
| if ($order->status_receipt_download_datetime === null) { | if ($order->status_receipt_download_datetime === null) { | ||||
| $order->status_receipt_download_datetime = DateUtil::now(); | $order->status_receipt_download_datetime = DateUtil::now(); | ||||
| // イベント登録 | |||||
| DownloadedEvent::dispatch($this->order); | |||||
| } | } | ||||
| $this->save(); | $this->save(); | ||||
| @@ -40,7 +44,6 @@ class PDFDownLoadManager extends ReceiptIssuingOrderManager | |||||
| } | } | ||||
| public function downlaodLetter() | public function downlaodLetter() | ||||
| { | { | ||||
| $order = $this->order; | |||||
| $data = $this->getPDFData(); | $data = $this->getPDFData(); | ||||
| $pdf = PDF::loadView('pdf/receipt_letter', $data); | $pdf = PDF::loadView('pdf/receipt_letter', $data); | ||||
| // はがきサイズを指定 | // はがきサイズを指定 | ||||
| @@ -48,11 +51,6 @@ class PDFDownLoadManager extends ReceiptIssuingOrderManager | |||||
| ->setOption('page-width', 100) | ->setOption('page-width', 100) | ||||
| ->setOption('encoding', 'utf-8') | ->setOption('encoding', 'utf-8') | ||||
| ->inline(); | ->inline(); | ||||
| if ($order->status_receipt_download_datetime === null) { | |||||
| $order->status_receipt_download_datetime = DateUtil::now(); | |||||
| } | |||||
| $this->save(); | |||||
| return $ret; | return $ret; | ||||
| } | } | ||||
| @@ -2,6 +2,9 @@ | |||||
| namespace App\Logic\ReceiptIssuingOrder; | namespace App\Logic\ReceiptIssuingOrder; | ||||
| use App\Events\ReceiptIssuingOrder\ChangeHandlerEvent; | |||||
| use App\Events\ReceiptIssuingOrder\ConfirmedEvent; | |||||
| use App\Events\ReceiptIssuingOrder\MailOrderEvent; | |||||
| use App\Exceptions\AppCommonException; | use App\Exceptions\AppCommonException; | ||||
| use App\Exceptions\ExclusiveException; | use App\Exceptions\ExclusiveException; | ||||
| use App\Features\InstanceAble; | use App\Features\InstanceAble; | ||||
| @@ -43,25 +46,23 @@ abstract class ReceiptIssuingOrderManager | |||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function changeHandler(User $newHandler) | |||||
| public function getOrder(): array | |||||
| { | { | ||||
| if (!$this->initialized) { | if (!$this->initialized) { | ||||
| throw new LogicException("初期化ミス"); | throw new LogicException("初期化ミス"); | ||||
| } | } | ||||
| if ($this->order->contract_id !== $newHandler->contract_id) { | |||||
| throw new AppCommonException('契約不正'); | |||||
| } | |||||
| $this->order->handler_id = $newHandler->id; | |||||
| return $this; | |||||
| return $this->order->toArray(); | |||||
| } | } | ||||
| public function getOrder(): array | |||||
| public function getOrderModel(): ReceiptIssuingOrder | |||||
| { | { | ||||
| if (!$this->initialized) { | if (!$this->initialized) { | ||||
| throw new LogicException("初期化ミス"); | throw new LogicException("初期化ミス"); | ||||
| } | } | ||||
| return $this->order->toArray(); | |||||
| return $this->order; | |||||
| } | } | ||||
| public function isConfirmed(): bool | public function isConfirmed(): bool | ||||
| @@ -143,7 +144,7 @@ abstract class ReceiptIssuingOrderManager | |||||
| return true; | return true; | ||||
| } | } | ||||
| protected function setStatus(): static | |||||
| private function setStatus(): static | |||||
| { | { | ||||
| $order = $this->order; | $order = $this->order; | ||||
| $order->status_done = false; | $order->status_done = false; | ||||
| @@ -207,17 +208,7 @@ abstract class ReceiptIssuingOrderManager | |||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setConfirm(): static | |||||
| { | |||||
| if ($this->order->receipt_no !== null) { | |||||
| throw new LogicException("領収証確定済み変更検知"); | |||||
| } | |||||
| $this->order->receipt_no = $this->generateReceiptnNo(); | |||||
| $this->order->status_receipt_confirm_datetime = DateUtil::now(); | |||||
| return $this; | |||||
| } | |||||
| private function generateReceiptnNo(): string | |||||
| protected function generateReceiptnNo(): string | |||||
| { | { | ||||
| $count = 0; | $count = 0; | ||||
| @@ -2,9 +2,17 @@ | |||||
| namespace App\Logic\ReceiptIssuingOrder; | namespace App\Logic\ReceiptIssuingOrder; | ||||
| use App\Events\ReceiptIssuingOrder\ChangeHandlerEvent; | |||||
| use App\Events\ReceiptIssuingOrder\ConfirmedEvent; | |||||
| use App\Events\ReceiptIssuingOrder\MailOrderEvent; | |||||
| use App\Events\ReceiptIssuingOrder\MailPostedEvent; | |||||
| use App\Exceptions\AppCommonException; | use App\Exceptions\AppCommonException; | ||||
| use App\Logic\SMS\SMSManager; | use App\Logic\SMS\SMSManager; | ||||
| use App\Models\ReceiptIssuingOrder; | use App\Models\ReceiptIssuingOrder; | ||||
| use App\Models\User; | |||||
| use App\Util\DateUtil; | |||||
| use Illuminate\Support\Carbon; | |||||
| use LogicException; | |||||
| class UpdateManager extends ReceiptIssuingOrderManager | class UpdateManager extends ReceiptIssuingOrderManager | ||||
| { | { | ||||
| @@ -16,6 +24,72 @@ class UpdateManager extends ReceiptIssuingOrderManager | |||||
| parent::__construct($order); | parent::__construct($order); | ||||
| } | } | ||||
| public function changeHandler(User $newHandler) | |||||
| { | |||||
| if (!$this->initialized) { | |||||
| throw new LogicException("初期化ミス"); | |||||
| } | |||||
| if ($this->order->contract_id !== $newHandler->contract_id) { | |||||
| throw new AppCommonException('契約不正'); | |||||
| } | |||||
| $this->order->handler_id = $newHandler->id; | |||||
| ChangeHandlerEvent::dispatch($this->order); | |||||
| return $this; | |||||
| } | |||||
| /** | |||||
| * 郵送依頼 | |||||
| * | |||||
| * @param array $attr | |||||
| * @return static | |||||
| */ | |||||
| public function mailOrder(array $attr): static | |||||
| { | |||||
| $this->fill($attr); | |||||
| // イベント登録 | |||||
| MailOrderEvent::dispatch($this->order); | |||||
| return $this; | |||||
| } | |||||
| /** | |||||
| * 郵送投函完了 | |||||
| * | |||||
| * @param array $attr | |||||
| * @return static | |||||
| */ | |||||
| public function mailPosted(Carbon $postDate): static | |||||
| { | |||||
| $this->order->status_mail_post_date = $postDate; | |||||
| // イベント登録 | |||||
| MailPostedEvent::dispatch($this->order); | |||||
| return $this; | |||||
| } | |||||
| /** | |||||
| * 領収証確定 | |||||
| * | |||||
| * @return static | |||||
| */ | |||||
| public function setConfirm(): static | |||||
| { | |||||
| if ($this->order->receipt_no !== null) { | |||||
| throw new LogicException("領収証確定済み変更検知"); | |||||
| } | |||||
| $this->order->receipt_no = $this->generateReceiptnNo(); | |||||
| $this->order->status_receipt_confirm_datetime = DateUtil::now(); | |||||
| // イベント登録 | |||||
| ConfirmedEvent::dispatch($this->order); | |||||
| return $this; | |||||
| } | |||||
| public function fill(array $attr) | public function fill(array $attr) | ||||
| { | { | ||||
| $this->order->fill($attr); | $this->order->fill($attr); | ||||
| @@ -4,6 +4,7 @@ namespace App\Models; | |||||
| use Illuminate\Database\Eloquent\Concerns\HasUuids; | use Illuminate\Database\Eloquent\Concerns\HasUuids; | ||||
| use Illuminate\Database\Eloquent\SoftDeletes; | use Illuminate\Database\Eloquent\SoftDeletes; | ||||
| use Illuminate\Support\Str; | |||||
| abstract class AppModel extends BaseModel | abstract class AppModel extends BaseModel | ||||
| { | { | ||||
| @@ -19,4 +20,13 @@ abstract class AppModel extends BaseModel | |||||
| { | { | ||||
| return null; | return null; | ||||
| } | } | ||||
| public function setId(?string $uuid = null) | |||||
| { | |||||
| if ($uuid) { | |||||
| $this->id = $uuid; | |||||
| } else { | |||||
| $this->id = Str::uuid(); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -3,6 +3,7 @@ | |||||
| namespace App\Models; | namespace App\Models; | ||||
| use App\Models\Feature\ContractFeature; | use App\Models\Feature\ContractFeature; | ||||
| use Illuminate\Database\Eloquent\Relations\HasOne; | |||||
| class ReceiptIssuingOrder extends AppModel | class ReceiptIssuingOrder extends AppModel | ||||
| { | { | ||||
| @@ -65,4 +66,9 @@ class ReceiptIssuingOrder extends AppModel | |||||
| { | { | ||||
| return "領収証発行依頼"; | return "領収証発行依頼"; | ||||
| } | } | ||||
| public function htCustomOrder(): HasOne | |||||
| { | |||||
| return $this->hasOne(ReceiptIssuingHTParkingCustomOrder::class); | |||||
| } | |||||
| } | } | ||||
| @@ -38,6 +38,8 @@ class AppServiceProvider extends ServiceProvider | |||||
| Log::setDefaultDriver('queue-email'); | Log::setDefaultDriver('queue-email'); | ||||
| } else if ($queueName === QueueName::SMS->value) { | } else if ($queueName === QueueName::SMS->value) { | ||||
| Log::setDefaultDriver('queue-sms'); | Log::setDefaultDriver('queue-sms'); | ||||
| } else if ($queueName === QueueName::JOB->value) { | |||||
| Log::setDefaultDriver('queue-job'); | |||||
| } | } | ||||
| }); | }); | ||||
| @@ -110,7 +110,7 @@ class API | |||||
| $param['sms_phone_number'] = $order->sms_phone_number; | $param['sms_phone_number'] = $order->sms_phone_number; | ||||
| $param['sms_send_success'] = $order->sms_send_success; | $param['sms_send_success'] = $order->sms_send_success; | ||||
| $param['receipt_no'] = $order->receipt_no; | $param['receipt_no'] = $order->receipt_no; | ||||
| $param['receipt_use_date'] = $order->receipt_use_date; | |||||
| $param['receipt_use_date'] = static::formatDateStr($order->receipt_use_date); | |||||
| $param['receipt_shop_name'] = $order->receipt_shop_name; | $param['receipt_shop_name'] = $order->receipt_shop_name; | ||||
| $param['receipt_issuer'] = $order->receipt_issuer; | $param['receipt_issuer'] = $order->receipt_issuer; | ||||
| $param['receipt_purpose'] = $order->receipt_purpose; | $param['receipt_purpose'] = $order->receipt_purpose; | ||||
| @@ -124,7 +124,7 @@ class API | |||||
| $param['mail_address2'] = $order->mail_address2; | $param['mail_address2'] = $order->mail_address2; | ||||
| $param['mail_address3'] = $order->mail_address3; | $param['mail_address3'] = $order->mail_address3; | ||||
| $param['mail_name'] = $order->mail_name; | $param['mail_name'] = $order->mail_name; | ||||
| $param['updated_at'] = $order->updated_at; | |||||
| $param['updated_at'] = static::formatDateStr($order->updated_at); | |||||
| return $param; | return $param; | ||||
| } | } | ||||
| @@ -160,6 +160,14 @@ return [ | |||||
| // 'replace_placeholders' => true, | // 'replace_placeholders' => true, | ||||
| 'permission' => 0666, | 'permission' => 0666, | ||||
| ], | ], | ||||
| 'queue-job' => [ | |||||
| 'driver' => 'daily', | |||||
| 'path' => storage_path('logs/job.log'), | |||||
| 'level' => env('LOG_LEVEL', 'debug'), | |||||
| 'days' => 14, | |||||
| // 'replace_placeholders' => true, | |||||
| 'permission' => 0666, | |||||
| ], | |||||
| ], | ], | ||||
| ]; | ]; | ||||
| @@ -23,7 +23,7 @@ class UserFactory extends Factory | |||||
| 'email' => fake()->unique()->safeEmail(), | 'email' => fake()->unique()->safeEmail(), | ||||
| 'password' => Hash::make("testuser"), | 'password' => Hash::make("testuser"), | ||||
| 'role' => UserRole::NORMAL_ADMIN, | 'role' => UserRole::NORMAL_ADMIN, | ||||
| 'contract_id' => Contract::factory(), | |||||
| // 'contract_id' => Contract::factory(), | |||||
| ]; | ]; | ||||
| } | } | ||||
| } | } | ||||
| @@ -32,7 +32,7 @@ return new class extends Migration | |||||
| return function (Blueprint $table, MigrationHelper $helper) use ($forHistory) { | return function (Blueprint $table, MigrationHelper $helper) use ($forHistory) { | ||||
| $helper->baseColumn() | $helper->baseColumn() | ||||
| ->contractId(); | |||||
| ->contractId(true); | |||||
| $table->string('email')->comment("Email")->nullable(); | $table->string('email')->comment("Email")->nullable(); | ||||
| $table->string('password')->comment("ログインパスワード")->nullable(); | $table->string('password')->comment("ログインパスワード")->nullable(); | ||||
| @@ -41,12 +41,7 @@ return new class extends Migration | |||||
| $helper->index(1, [ColumnName::CONTRACT_ID]); | $helper->index(1, [ColumnName::CONTRACT_ID]); | ||||
| if ($forHistory) { | |||||
| $helper->index(2, ['email']); | |||||
| } else { | |||||
| $helper->unique(1, ['email']); | |||||
| } | |||||
| $helper->index(2, ['email']); | |||||
| }; | }; | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -3,12 +3,9 @@ | |||||
| namespace Database\Seeders; | namespace Database\Seeders; | ||||
| use App\Codes\Custom; | use App\Codes\Custom; | ||||
| use App\Codes\SMSProviderName; | |||||
| use App\Codes\UserRole; | use App\Codes\UserRole; | ||||
| use App\Models\Contract; | use App\Models\Contract; | ||||
| use App\Models\SMSProvider; | |||||
| use App\Models\User; | use App\Models\User; | ||||
| use Illuminate\Database\Console\Seeds\WithoutModelEvents; | |||||
| use Illuminate\Database\Seeder; | use Illuminate\Database\Seeder; | ||||
| class TestUserSeeder extends Seeder | class TestUserSeeder extends Seeder | ||||
| @@ -19,9 +16,9 @@ class TestUserSeeder extends Seeder | |||||
| public function run(): void | public function run(): void | ||||
| { | { | ||||
| $contract = Contract::factory()->create([ | |||||
| Contract::COL_NAME_NAME => 'テスト用契約' | |||||
| ]); | |||||
| // $contract = Contract::factory()->create([ | |||||
| // Contract::COL_NAME_NAME => 'テスト用契約' | |||||
| // ]); | |||||
| $emails = [ | $emails = [ | ||||
| ['normal@aa.com', UserRole::NORMAL_ADMIN], | ['normal@aa.com', UserRole::NORMAL_ADMIN], | ||||
| @@ -31,7 +28,8 @@ class TestUserSeeder extends Seeder | |||||
| foreach ($emails as [$email, $role]) { | foreach ($emails as [$email, $role]) { | ||||
| if (!User::whereEmail($email)->exists()) { | if (!User::whereEmail($email)->exists()) { | ||||
| User::factory()->for($contract)->create([ | |||||
| // User::factory()->for($contract)->create([ | |||||
| User::factory()->create([ | |||||
| User::COL_NAME_EMAIL => $email, | User::COL_NAME_EMAIL => $email, | ||||
| User::COL_NAME_ROLE => $role, | User::COL_NAME_ROLE => $role, | ||||
| User::COL_NAME_NAME => $email . "太郎", | User::COL_NAME_NAME => $email . "太郎", | ||||
| @@ -5,3 +5,6 @@ variables_order = EGPCS | |||||
| [opcache] | [opcache] | ||||
| opcache.enable_cli=1 | opcache.enable_cli=1 | ||||
| [xdebug] | |||||
| xdebug.start_with_request=yes | |||||
| @@ -48,4 +48,22 @@ stderr_logfile=/var/www/html/storage/logs/laravel-sms-worker.error.log | |||||
| stdout_logfile_maxbytes=1000000 | stdout_logfile_maxbytes=1000000 | ||||
| stderr_logfile_maxbytes=1000000 | stderr_logfile_maxbytes=1000000 | ||||
| stdout_logfile_backups=3 | stdout_logfile_backups=3 | ||||
| stderr_logfile_backups=3 | |||||
| [program:laravel-job-worker] | |||||
| process_name=%(program_name)s_%(process_num)02d | |||||
| command=/usr/bin/php /var/www/html/artisan queue:work --queue=job --max-time=60 | |||||
| autostart=true | |||||
| autorestart=true | |||||
| stopasgroup=true | |||||
| killasgroup=true | |||||
| user=sail | |||||
| numprocs=1 | |||||
| redirect_stderr=true | |||||
| stopwaitsecs=100 | |||||
| stdout_logfile=/var/www/html/storage/logs/laravel-other-worker.log | |||||
| stderr_logfile=/var/www/html/storage/logs/laravel-other-worker.error.log | |||||
| stdout_logfile_maxbytes=1000000 | |||||
| stderr_logfile_maxbytes=1000000 | |||||
| stdout_logfile_backups=3 | |||||
| stderr_logfile_backups=3 | stderr_logfile_backups=3 | ||||