From c5ed6eb2de283e8e7c46a2f2ffcc5044f4f5925f Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Wed, 25 Jun 2025 17:27:20 +0900 Subject: [PATCH] dbms_init...1 --- .../Admin/Customer/ServiceController.php | 4 ++++ app/Services/Customer/ServiceService.php | 22 +++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/app/Controllers/Admin/Customer/ServiceController.php b/app/Controllers/Admin/Customer/ServiceController.php index 94c7117..94b1a73 100644 --- a/app/Controllers/Admin/Customer/ServiceController.php +++ b/app/Controllers/Admin/Customer/ServiceController.php @@ -79,11 +79,14 @@ class ServiceController extends CustomerController { //LINE,IP,SERVER등 추가 FilterOption 셋팅용 $this->setFilterOptionsByItemType(); + //각각의 Item항목 정의 return $this->getService()->setItemEntitiesByService($entity); } //Delete 관련 protected function delete_process(mixed $entity): mixed { + //각각의 Item항목 정의 + $entity = $this->getService()->setItemEntitiesByService($entity); return parent::delete_process($entity); } //List 관련 @@ -106,6 +109,7 @@ class ServiceController extends CustomerController $this->setFilterOptionsByItemType(); $entities = []; foreach (parent::index_process() as $entity) { + //각각의 Item항목 정의 $entities[$entity->getPK()] = $this->getService()->setItemEntitiesByService($entity); } return $entities; diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php index 62ce8f3..ab04e7f 100644 --- a/app/Services/Customer/ServiceService.php +++ b/app/Services/Customer/ServiceService.php @@ -4,10 +4,12 @@ namespace App\Services\Customer; use App\Entities\Customer\ServiceEntity; use App\Entities\Equipment\CodeEntity; -use App\Models\Customer\ServiceModel; +use App\Entities\Equipment\Part\IpEntity; +use App\Models\Customer\ServiceModel; use App\Services\Customer\ServiceItemService; use App\Services\Equipment\CodeService; +use App\Services\Equipment\Part\IpService; use App\Services\UserService; class ServiceService extends CustomerService @@ -16,6 +18,7 @@ class ServiceService extends CustomerService private ?CodeService $_codeService = null; private ?ServiceItemService $_serviceItemService = null; private ?ServicePaymentService $_servicePaymentService = null; + private ?IpService $_ipService = null; private ?string $_searchIP = null; public function __construct(mixed $request = null) { @@ -78,6 +81,13 @@ class ServiceService extends CustomerService } return $this->_serviceItemService; } + public function getIpService(): IpService + { + if (!$this->_ipService) { + $this->_ipService = new IpService($this->request); + } + return $this->_ipService; + } public function getServicePaymentService(): ServicePaymentService { if (!$this->_servicePaymentService) { @@ -198,9 +208,9 @@ class ServiceService extends CustomerService { //code가 기존과 다를경우 //toggle,batchjob의 경우 $formDatas에 code가 없을수도 있음 if (array_key_exists('code', $formDatas) && $formDatas['code'] !== $entity->getCode()) { - //code의 경우 기존code는 사용가능으로 설정작업 + //기존 code의 경우 반환처리 $this->getCodeService()->setStatus($entity->getCode(), CodeEntity::STATUS_AVAILABLE); - //coded의 경우 변경된 code는 서비스중으로 설정작업 + //신규 설정된 coded의 경우 서비스중 변경처리 $this->getCodeService()->setStatus($formDatas['code'], CodeEntity::STATUS_OCCUPIED); } //관리자가 바뀐경우 결제쪽에도 결제가 완료되지않은 것은 관리자를 변경해줘야함 @@ -211,8 +221,12 @@ class ServiceService extends CustomerService } public function delete(mixed $entity): ServiceEntity { - //code의 경우 기존code는 사용가능으로 설정작업 + //기존 code의 경우 반환처리 $this->getCodeService()->setStatus($entity->getCode(), CodeEntity::STATUS_AVAILABLE); + //IP의 경우 반환 처리 + foreach ($entity->getItemEntities("IP") as $itemEntity) { + $this->getIpService()->setStatus($itemEntity->getItemUID(), IpEntity::STATUS_AVAILABLE); + } return parent::delete($entity); } }