dbms_init...1

This commit is contained in:
choi.jh 2025-07-08 13:54:17 +09:00
parent f4faa2bd9a
commit 5a351c107a
5 changed files with 34 additions and 79 deletions

View File

@ -6,18 +6,21 @@ use App\Entities\Customer\ClientEntity;
use App\Services\CommonService; use App\Services\CommonService;
use App\Services\Customer\ClientService; 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\CpuService;
use App\Services\Equipment\Part\DefenceService; 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\LineService;
use App\Services\Equipment\Part\RamService; use App\Services\Equipment\Part\RamService;
use App\Services\Equipment\Part\SoftwareService; use App\Services\Equipment\Part\SoftwareService;
use App\Services\Equipment\Part\StorageService; use App\Services\Equipment\Part\StorageService;
use App\Services\Equipment\ServerService;
use App\Services\UserService;
abstract class CustomerService extends CommonService abstract class CustomerService extends CommonService
{ {
private $_clientOptions = [];
private ?UserService $_userService = null;
private ?ClientService $_clientService = null; private ?ClientService $_clientService = null;
private $_equipmentService = []; private $_equipmentService = [];
public function __construct() public function __construct()
@ -32,7 +35,20 @@ abstract class CustomerService extends CommonService
} }
return $this->_clientService; 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에서 사용 //ServiceItemController,ServiceController에서 사용
final public function getServiceItemLinkService(string $key): mixed final public function getServiceItemLinkService(string $key): mixed
{ {
@ -89,6 +105,13 @@ abstract class CustomerService extends CommonService
} }
return $this->_equipmentService[$key]; return $this->_equipmentService[$key];
} }
final public function getClientOptions(): array
{
if ($this->_clientOptions === null) {
$this->_clientOptions = $this->getClientService()->getEntities();
}
return $this->_clientOptions;
}
//기본기능 //기본기능
//FieldForm관련용 //FieldForm관련용
public function getFormFieldOption(string $field, array $options = []): array public function getFormFieldOption(string $field, array $options = []): array
@ -96,7 +119,13 @@ abstract class CustomerService extends CommonService
switch ($field) { switch ($field) {
case 'clientinfo_uid': case 'clientinfo_uid':
case 'ownerinfo_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; break;
default: default:
$options = parent::getFormFieldOption($field, $options); $options = parent::getFormFieldOption($field, $options);

View File

@ -4,11 +4,9 @@ namespace App\Services\Customer;
use App\Entities\Customer\ServiceHistoryEntity; use App\Entities\Customer\ServiceHistoryEntity;
use App\Models\Customer\ServiceHistoryModel; use App\Models\Customer\ServiceHistoryModel;
use App\Services\Customer\ServiceService;
class ServiceHistoryService extends CustomerService class ServiceHistoryService extends CustomerService
{ {
private ?ServiceService $_serviceService = null;
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
@ -22,13 +20,6 @@ class ServiceHistoryService extends CustomerService
{ {
return new ServiceHistoryEntity(); return new ServiceHistoryEntity();
} }
public function getServiceService(): ServiceService
{
if (!$this->_serviceService) {
$this->_serviceService = new ServiceService();
}
return $this->_serviceService;
}
public function getFormFields(): array public function getFormFields(): array
{ {
return [ return [
@ -50,16 +41,4 @@ class ServiceHistoryService extends CustomerService
return ['serviceinfo_uid', 'title', 'status', 'created_at']; return ['serviceinfo_uid', 'title', 'status', 'created_at'];
} }
//FieldForm관련용 //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;
}
} }

View File

@ -7,12 +7,10 @@ use App\Entities\Equipment\Part\IpEntity;
use App\Models\Customer\ServiceItemModel; use App\Models\Customer\ServiceItemModel;
use App\Services\Customer\CustomerService; use App\Services\Customer\CustomerService;
use App\Services\Customer\ServicePaymentService; use App\Services\Customer\ServicePaymentService;
use App\Services\Customer\ServiceService;
use App\Services\Equipment\Part\IpService; use App\Services\Equipment\Part\IpService;
class ServiceItemService extends CustomerService class ServiceItemService extends CustomerService
{ {
private ?ServiceService $_serviceService = null;
private ?ServicePaymentService $_servicePaymentService = null; private ?ServicePaymentService $_servicePaymentService = null;
private ?IpService $_ipService = null; private ?IpService $_ipService = null;
public function __construct() public function __construct()
@ -28,13 +26,6 @@ class ServiceItemService extends CustomerService
{ {
return new ServiceItemEntity(); return new ServiceItemEntity();
} }
public function getServiceService(): ServiceService
{
if (!$this->_serviceService) {
$this->_serviceService = new ServiceService();
}
return $this->_serviceService;
}
public function getIpService(): IpService public function getIpService(): IpService
{ {
if (!$this->_ipService) { if (!$this->_ipService) {
@ -76,18 +67,6 @@ class ServiceItemService extends CustomerService
} }
//Entity의 관련객체정의용 //Entity의 관련객체정의용
//FieldForm관련용 //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 public function create(array $formDatas): ServiceItemEntity
{ {
$entity = parent::create($formDatas); $entity = parent::create($formDatas);

View File

@ -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']; 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 public function setServiceItemEntity(ServiceItemEntity $entity): void
{ {
$this->_serviceItemEntity = $entity; $this->_serviceItemEntity = $entity;
@ -84,15 +70,6 @@ class ServicePaymentService extends CustomerService
public function getFormFieldOption(string $field, array $options = []): array public function getFormFieldOption(string $field, array $options = []): array
{ {
switch ($field) { 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': case 'item_uid':
$options = []; $options = [];
break; break;

View File

@ -10,11 +10,9 @@ use App\Models\Customer\ServiceModel;
use App\Services\Customer\ServiceItemService; use App\Services\Customer\ServiceItemService;
use App\Services\Equipment\CodeService; use App\Services\Equipment\CodeService;
use App\Services\Equipment\SwitchService; use App\Services\Equipment\SwitchService;
use App\Services\UserService;
class ServiceService extends CustomerService class ServiceService extends CustomerService
{ {
private ?UserService $_userService = null;
private ?CodeService $_codeService = null; private ?CodeService $_codeService = null;
private ?SwitchService $_switchService = null; private ?SwitchService $_switchService = null;
private ?ServiceItemService $_serviceItemService = 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']; 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 public function getCodeService(): CodeService
{ {
if (!$this->_codeService) { if (!$this->_codeService) {