From 5a351c107a569f0cbecf859764ffb3edfa4caad9 Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Tue, 8 Jul 2025 13:54:17 +0900 Subject: [PATCH] dbms_init...1 --- app/Services/Customer/CustomerService.php | 39 ++++++++++++++++--- .../Customer/ServiceHistoryService.php | 21 ---------- app/Services/Customer/ServiceItemService.php | 21 ---------- .../Customer/ServicePaymentService.php | 23 ----------- app/Services/Customer/ServiceService.php | 9 ----- 5 files changed, 34 insertions(+), 79 deletions(-) diff --git a/app/Services/Customer/CustomerService.php b/app/Services/Customer/CustomerService.php index 103447f..b4a547b 100644 --- a/app/Services/Customer/CustomerService.php +++ b/app/Services/Customer/CustomerService.php @@ -6,18 +6,21 @@ use App\Entities\Customer\ClientEntity; use App\Services\CommonService; use App\Services\Customer\ClientService; -use App\Services\Equipment\ServerService; -use App\Services\Equipment\Part\DomainService; -use App\Services\Equipment\Part\IpService; use App\Services\Equipment\Part\CpuService; use App\Services\Equipment\Part\DefenceService; +use App\Services\Equipment\Part\DomainService; +use App\Services\Equipment\Part\IpService; use App\Services\Equipment\Part\LineService; use App\Services\Equipment\Part\RamService; use App\Services\Equipment\Part\SoftwareService; use App\Services\Equipment\Part\StorageService; +use App\Services\Equipment\ServerService; +use App\Services\UserService; abstract class CustomerService extends CommonService { + private $_clientOptions = []; + private ?UserService $_userService = null; private ?ClientService $_clientService = null; private $_equipmentService = []; public function __construct() @@ -32,7 +35,20 @@ abstract class CustomerService extends CommonService } return $this->_clientService; } - + final public function getUSerService(): UserService + { + if (!$this->_userService) { + $this->_userService = new UserService(); + } + return $this->_userService; + } + final public function getServiceService(): ServiceService + { + if (!$this->_serviceService) { + $this->_serviceService = new ServiceService(); + } + return $this->_serviceService; + } //ServiceItemController,ServiceController에서 사용 final public function getServiceItemLinkService(string $key): mixed { @@ -89,6 +105,13 @@ abstract class CustomerService extends CommonService } return $this->_equipmentService[$key]; } + final public function getClientOptions(): array + { + if ($this->_clientOptions === null) { + $this->_clientOptions = $this->getClientService()->getEntities(); + } + return $this->_clientOptions; + } //기본기능 //FieldForm관련용 public function getFormFieldOption(string $field, array $options = []): array @@ -96,7 +119,13 @@ abstract class CustomerService extends CommonService switch ($field) { case 'clientinfo_uid': case 'ownerinfo_uid': - $options = $this->getClientService()->getEntities(); + $options = $this->getClientOptions(); + break; + case 'serviceinfo_uid': + $options = $this->getServiceService()->getEntities(); + break; + case 'user_uid': + $options = $this->getUserService()->getEntities(); break; default: $options = parent::getFormFieldOption($field, $options); diff --git a/app/Services/Customer/ServiceHistoryService.php b/app/Services/Customer/ServiceHistoryService.php index 4bd2f5a..6296f1c 100644 --- a/app/Services/Customer/ServiceHistoryService.php +++ b/app/Services/Customer/ServiceHistoryService.php @@ -4,11 +4,9 @@ namespace App\Services\Customer; use App\Entities\Customer\ServiceHistoryEntity; use App\Models\Customer\ServiceHistoryModel; -use App\Services\Customer\ServiceService; class ServiceHistoryService extends CustomerService { - private ?ServiceService $_serviceService = null; public function __construct() { parent::__construct(); @@ -22,13 +20,6 @@ class ServiceHistoryService extends CustomerService { return new ServiceHistoryEntity(); } - public function getServiceService(): ServiceService - { - if (!$this->_serviceService) { - $this->_serviceService = new ServiceService(); - } - return $this->_serviceService; - } public function getFormFields(): array { return [ @@ -50,16 +41,4 @@ class ServiceHistoryService extends CustomerService return ['serviceinfo_uid', 'title', 'status', 'created_at']; } //FieldForm관련용 - public function getFormFieldOption(string $field, array $options = []): array - { - switch ($field) { - case 'serviceinfo_uid': - $options = $this->getServiceService()->getEntities(); - break; - default: - $options = parent::getFormFieldOption($field, $options); - break; - } - return $options; - } } diff --git a/app/Services/Customer/ServiceItemService.php b/app/Services/Customer/ServiceItemService.php index 4ff1a9e..e1e6de0 100644 --- a/app/Services/Customer/ServiceItemService.php +++ b/app/Services/Customer/ServiceItemService.php @@ -7,12 +7,10 @@ use App\Entities\Equipment\Part\IpEntity; use App\Models\Customer\ServiceItemModel; use App\Services\Customer\CustomerService; use App\Services\Customer\ServicePaymentService; -use App\Services\Customer\ServiceService; use App\Services\Equipment\Part\IpService; class ServiceItemService extends CustomerService { - private ?ServiceService $_serviceService = null; private ?ServicePaymentService $_servicePaymentService = null; private ?IpService $_ipService = null; public function __construct() @@ -28,13 +26,6 @@ class ServiceItemService extends CustomerService { return new ServiceItemEntity(); } - public function getServiceService(): ServiceService - { - if (!$this->_serviceService) { - $this->_serviceService = new ServiceService(); - } - return $this->_serviceService; - } public function getIpService(): IpService { if (!$this->_ipService) { @@ -76,18 +67,6 @@ class ServiceItemService extends CustomerService } //Entity의 관련객체정의용 //FieldForm관련용 - public function getFormFieldOption(string $field, array $options = []): array - { - switch ($field) { - case 'serviceinfo_uid': - $options = $this->getServiceService()->getEntities(); - break; - default: - $options = parent::getFormFieldOption($field, $options); - break; - } - return $options; - } public function create(array $formDatas): ServiceItemEntity { $entity = parent::create($formDatas); diff --git a/app/Services/Customer/ServicePaymentService.php b/app/Services/Customer/ServicePaymentService.php index 9721371..9ecaff8 100644 --- a/app/Services/Customer/ServicePaymentService.php +++ b/app/Services/Customer/ServicePaymentService.php @@ -53,20 +53,6 @@ class ServicePaymentService extends CustomerService { return ['serviceinfo_uid', "ownerinfo_uid", 'item_type', 'item_uid', 'billing_cycle', 'amount', 'billing_at', 'issue_at', 'countdown', 'status', 'user_uid']; } - public function getUSerService(): UserService - { - if (!$this->_userService) { - $this->_userService = new UserService(); - } - return $this->_userService; - } - public function getServiceService(): ServiceService - { - if (!$this->_serviceService) { - $this->_serviceService = new ServiceService(); - } - return $this->_serviceService; - } public function setServiceItemEntity(ServiceItemEntity $entity): void { $this->_serviceItemEntity = $entity; @@ -84,15 +70,6 @@ class ServicePaymentService extends CustomerService public function getFormFieldOption(string $field, array $options = []): array { switch ($field) { - case 'serviceinfo_uid': - $options = $this->getServiceService()->getEntities(); - break; - case 'ownerinfo_uid': - $options = $this->getClientService()->getEntities(); - break; - case 'user_uid': - $options = $this->getUserService()->getEntities(); - break; case 'item_uid': $options = []; break; diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php index b4aa0fe..358ec72 100644 --- a/app/Services/Customer/ServiceService.php +++ b/app/Services/Customer/ServiceService.php @@ -10,11 +10,9 @@ use App\Models\Customer\ServiceModel; use App\Services\Customer\ServiceItemService; use App\Services\Equipment\CodeService; use App\Services\Equipment\SwitchService; -use App\Services\UserService; class ServiceService extends CustomerService { - private ?UserService $_userService = null; private ?CodeService $_codeService = null; private ?SwitchService $_switchService = null; private ?ServiceItemService $_serviceItemService = null; @@ -60,13 +58,6 @@ class ServiceService extends CustomerService { return ['clientinfo_uid', 'ownerinfo_uid', 'type', 'location', 'switchinfo_uid', 'codeinfo_uid', 'raid', 'billing_at', 'start_at', 'updated_at', 'status', 'user_uid']; } - public function getUSerService(): UserService - { - if (!$this->_userService) { - $this->_userService = new UserService(); - } - return $this->_userService; - } public function getCodeService(): CodeService { if (!$this->_codeService) {