Compare commits
2 Commits
6db67ae3f8
...
f41b645166
| Author | SHA1 | Date | |
|---|---|---|---|
| f41b645166 | |||
| 194b3dad43 |
@ -321,7 +321,7 @@ CREATE TABLE `payment` (
|
||||
|
||||
LOCK TABLES `payment` WRITE;
|
||||
/*!40000 ALTER TABLE `payment` DISABLE KEYS */;
|
||||
INSERT INTO `payment` VALUES (3,1,193,11,NULL,'부품정보 [SATA 256G]에 대한 일회성 추가',70000,'onetime','2025-09-17',NULL,'unpaid',NULL,'2025-09-17 01:21:42',NULL),(4,1,585,5,NULL,'[32G] 부품정보 추가',100000,'onetime','2025-09-17',NULL,'unpaid',NULL,'2025-09-17 08:13:21',NULL),(5,1,101,13,NULL,'[HP DL360 Gen8] 서비스',600000,'month','2025-09-26',NULL,'unpaid','2025-09-17 09:33:57','2025-09-17 08:13:58',NULL),(6,1,585,5,NULL,'[13.220.20.3] 부품정보',0,'onetime','2025-09-18',NULL,'unpaid',NULL,'2025-09-17 23:56:25',NULL),(7,1,223,8,NULL,'test.co.kr 구매',50000,'onetime','2025-09-18',NULL,'unpaid',NULL,'2025-09-18 02:26:57',NULL),(8,1,69,9,NULL,'test.111.co.kr',40000,'onetime','2025-09-18',NULL,'unpaid','2025-09-18 02:37:30','2025-09-18 02:34:22',NULL),(10,1,101,13,NULL,'test111',40000,'onetime','2025-09-18',NULL,'unpaid',NULL,'2025-09-18 06:43:11',NULL),(11,1,101,13,NULL,'Test2222',40000,'onetime','2025-09-18',NULL,'unpaid',NULL,'2025-09-18 06:45:29',NULL),(12,1,101,13,NULL,'test333',10000,'onetime','2025-09-18',NULL,'unpaid',NULL,'2025-09-18 06:46:16',NULL),(13,1,101,13,65,'test5555666777',100000,'onetime','2025-09-18',NULL,'unpaid','2025-09-18 10:03:46','2025-09-18 06:49:05',NULL),(14,1,564,14,NULL,'Hitach HA3000',0,'month','2025-09-19',NULL,'unpaid',NULL,'2025-09-19 00:21:19',NULL);
|
||||
INSERT INTO `payment` VALUES (3,1,193,11,NULL,'부품정보 [SATA 256G]에 대한 일회성 추가',70000,'onetime','2025-09-17',NULL,'unpaid',NULL,'2025-09-17 01:21:42',NULL),(4,1,585,5,NULL,'[32G] 부품정보 추가',100000,'onetime','2025-09-17',NULL,'unpaid',NULL,'2025-09-17 08:13:21',NULL),(5,1,101,13,NULL,'[HP DL360 Gen8] 서비스',600000,'month','2025-09-26',NULL,'unpaid','2025-09-17 09:33:57','2025-09-17 08:13:58',NULL),(6,1,585,5,NULL,'[13.220.20.3] 부품정보',0,'onetime','2025-09-18',NULL,'unpaid',NULL,'2025-09-17 23:56:25',NULL),(7,1,223,8,NULL,'test.co.kr 구매',50000,'onetime','2025-09-18',NULL,'unpaid',NULL,'2025-09-18 02:26:57',NULL),(8,1,69,9,54,'test.111.co.kr,test.222.co.kr',80000,'onetime','2025-09-19',NULL,'unpaid','2025-09-19 06:14:01','2025-09-18 02:34:22',NULL),(10,1,101,13,NULL,'test111',40000,'onetime','2025-09-18',NULL,'unpaid',NULL,'2025-09-18 06:43:11',NULL),(11,1,101,13,NULL,'Test2222',40000,'onetime','2025-09-18',NULL,'unpaid',NULL,'2025-09-18 06:45:29',NULL),(12,1,101,13,NULL,'test333',10000,'onetime','2025-09-18',NULL,'unpaid',NULL,'2025-09-18 06:46:16',NULL),(13,1,101,13,65,'test5555666777',100000,'onetime','2025-09-18',NULL,'unpaid','2025-09-18 10:03:46','2025-09-18 06:49:05',NULL),(14,1,564,14,NULL,'Hitach HA3000',0,'month','2025-09-19',NULL,'unpaid',NULL,'2025-09-19 00:21:19',NULL);
|
||||
/*!40000 ALTER TABLE `payment` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@ -434,7 +434,7 @@ CREATE TABLE `serverpartinfo` (
|
||||
|
||||
LOCK TABLES `serverpartinfo` WRITE;
|
||||
/*!40000 ALTER TABLE `serverpartinfo` DISABLE KEYS */;
|
||||
INSERT INTO `serverpartinfo` VALUES (4,NULL,6,4,NULL,'','CPU','',0,4,NULL,NULL,'2025-09-05 00:04:09'),(5,NULL,10,4,NULL,'','RAM','',0,4,NULL,NULL,'2025-09-05 00:04:09'),(6,NULL,22,4,NULL,'','DISK','',0,2,NULL,NULL,'2025-09-05 00:04:09'),(7,NULL,3,5,NULL,'','CPU','',0,3,NULL,NULL,'2025-09-05 00:05:26'),(8,NULL,9,5,NULL,'','RAM','',0,3,NULL,NULL,'2025-09-05 00:05:26'),(9,NULL,14,5,NULL,'','DISK','',0,3,'RAID5',NULL,'2025-09-05 00:05:26'),(13,NULL,5,6,NULL,'','CPU','',0,10,NULL,'2025-09-05 07:37:42','2025-09-05 07:36:21'),(14,NULL,7,6,NULL,'','RAM','base',0,10,'','2025-09-11 03:57:23','2025-09-05 07:36:21'),(15,NULL,26,6,NULL,'','DISK','',0,10,'RAID10',NULL,'2025-09-05 07:36:21'),(16,NULL,10,6,NULL,'','RAM','onetime',100000,2,NULL,NULL,'2025-09-05 07:38:22'),(17,NULL,14,6,NULL,'','DISK','month',10000,2,'RAID1',NULL,'2025-09-05 07:39:26'),(25,NULL,25,4,8,'','SWITCH','base',0,1,NULL,NULL,'2025-09-08 08:13:09'),(26,NULL,1,11,9,'','CPU','base',100000,2,'','2025-09-11 04:48:29','2025-09-09 03:39:10'),(28,NULL,510,12,5,'','SWITCH','base',0,1,NULL,NULL,'2025-09-16 07:48:19'),(29,NULL,259,12,5,'','IP','base',0,1,NULL,NULL,'2025-09-16 07:48:37'),(30,NULL,7,11,9,'','RAM','base',20000,1,NULL,NULL,'2025-09-16 09:22:24'),(34,NULL,14,11,9,'','DISK','base',70000,1,NULL,NULL,'2025-09-17 00:11:51'),(35,69,15,11,9,'','DISK','base',90000,1,NULL,NULL,'2025-09-17 00:17:26'),(38,193,14,10,11,'','DISK','onetime',70000,1,NULL,NULL,'2025-09-17 01:21:42'),(40,585,13,12,5,'','DISK','base',50000,1,NULL,NULL,'2025-09-17 07:47:19'),(41,585,10,12,5,'','RAM','base',60000,1,NULL,NULL,'2025-09-17 07:47:54'),(42,585,1,12,5,'','CPU','base',50000,1,NULL,NULL,'2025-09-17 07:48:14'),(43,NULL,3,13,NULL,'','CPU','base',80000,2,NULL,NULL,'2025-09-17 07:49:12'),(44,NULL,7,13,NULL,'','RAM','base',20000,2,NULL,NULL,'2025-09-17 07:49:35'),(45,NULL,13,13,NULL,'','DISK','base',50000,2,'RAID1',NULL,'2025-09-17 08:09:06'),(46,585,13,12,5,'','DISK','base',50000,2,'RAID1',NULL,'2025-09-17 08:12:30'),(47,585,11,12,5,'','RAM','onetime',100000,1,NULL,NULL,'2025-09-17 08:13:21'),(48,585,260,12,5,'','IP','onetime',0,1,NULL,NULL,'2025-09-17 23:56:25'),(52,223,0,4,8,'test.co.kr 구매','ETC','onetime',40000,1,NULL,'2025-09-18 02:27:53','2025-09-18 02:26:57'),(54,69,0,11,9,'test.111.co.kr','ETC','onetime',40000,1,NULL,'2025-09-18 02:35:08','2025-09-18 02:34:22'),(58,101,43,13,13,'닷디펜더','SOFTWARE','month',100000,1,NULL,'2025-09-18 03:28:03','2025-09-18 03:12:40'),(65,101,0,13,13,'test5555666777','ETC','onetime',100000,4,'test5555666','2025-09-18 10:03:46','2025-09-18 06:49:05'),(68,NULL,1,14,NULL,'Xeon E5530 2.4Ghz 4Core','CPU','base',50000,2,NULL,NULL,'2025-09-19 00:19:26'),(69,NULL,8,14,NULL,'4G','RAM','base',30000,2,NULL,NULL,'2025-09-19 00:19:57'),(70,NULL,14,14,NULL,'SATA 256G','DISK','base',70000,2,'RAID1',NULL,'2025-09-19 00:20:22');
|
||||
INSERT INTO `serverpartinfo` VALUES (4,NULL,6,4,NULL,'','CPU','',0,4,NULL,NULL,'2025-09-05 00:04:09'),(5,NULL,10,4,NULL,'','RAM','',0,4,NULL,NULL,'2025-09-05 00:04:09'),(6,NULL,22,4,NULL,'','DISK','',0,2,NULL,NULL,'2025-09-05 00:04:09'),(7,NULL,3,5,NULL,'','CPU','',0,3,NULL,NULL,'2025-09-05 00:05:26'),(8,NULL,9,5,NULL,'','RAM','',0,3,NULL,NULL,'2025-09-05 00:05:26'),(9,NULL,14,5,NULL,'','DISK','',0,3,'RAID5',NULL,'2025-09-05 00:05:26'),(13,NULL,5,6,NULL,'','CPU','',0,10,NULL,'2025-09-05 07:37:42','2025-09-05 07:36:21'),(14,NULL,7,6,NULL,'','RAM','base',0,10,'','2025-09-11 03:57:23','2025-09-05 07:36:21'),(15,NULL,26,6,NULL,'','DISK','',0,10,'RAID10',NULL,'2025-09-05 07:36:21'),(16,NULL,10,6,NULL,'','RAM','onetime',100000,2,NULL,NULL,'2025-09-05 07:38:22'),(17,NULL,14,6,NULL,'','DISK','month',10000,2,'RAID1',NULL,'2025-09-05 07:39:26'),(25,NULL,25,4,8,'','SWITCH','base',0,1,NULL,NULL,'2025-09-08 08:13:09'),(26,NULL,1,11,9,'','CPU','base',100000,2,'','2025-09-11 04:48:29','2025-09-09 03:39:10'),(28,NULL,510,12,5,'','SWITCH','base',0,1,NULL,NULL,'2025-09-16 07:48:19'),(29,NULL,259,12,5,'','IP','base',0,1,NULL,NULL,'2025-09-16 07:48:37'),(30,NULL,7,11,9,'','RAM','base',20000,1,NULL,NULL,'2025-09-16 09:22:24'),(34,NULL,14,11,9,'','DISK','base',70000,1,NULL,NULL,'2025-09-17 00:11:51'),(35,69,15,11,9,'','DISK','base',90000,1,NULL,NULL,'2025-09-17 00:17:26'),(38,193,14,10,11,'','DISK','onetime',70000,1,NULL,NULL,'2025-09-17 01:21:42'),(40,585,13,12,5,'','DISK','base',50000,1,NULL,NULL,'2025-09-17 07:47:19'),(41,585,10,12,5,'','RAM','base',60000,1,NULL,NULL,'2025-09-17 07:47:54'),(42,585,1,12,5,'','CPU','base',50000,1,NULL,NULL,'2025-09-17 07:48:14'),(43,NULL,3,13,NULL,'','CPU','base',80000,2,NULL,NULL,'2025-09-17 07:49:12'),(44,NULL,7,13,NULL,'','RAM','base',20000,2,NULL,NULL,'2025-09-17 07:49:35'),(45,NULL,13,13,NULL,'','DISK','base',50000,2,'RAID1',NULL,'2025-09-17 08:09:06'),(46,585,13,12,5,'','DISK','base',50000,2,'RAID1',NULL,'2025-09-17 08:12:30'),(47,585,11,12,5,'','RAM','onetime',100000,1,NULL,NULL,'2025-09-17 08:13:21'),(48,585,260,12,5,'','IP','onetime',0,1,NULL,NULL,'2025-09-17 23:56:25'),(52,223,0,4,8,'test.co.kr 구매','ETC','onetime',40000,1,NULL,'2025-09-18 02:27:53','2025-09-18 02:26:57'),(54,69,0,11,9,'test.111.co.kr,test.222.co.kr','ETC','onetime',80000,2,NULL,'2025-09-19 06:14:01','2025-09-18 02:34:22'),(58,101,43,13,13,'닷디펜더','SOFTWARE','month',100000,1,NULL,'2025-09-18 03:28:03','2025-09-18 03:12:40'),(65,101,0,13,13,'test5555666777','ETC','onetime',100000,4,'test5555666','2025-09-18 10:03:46','2025-09-18 06:49:05'),(68,NULL,1,14,NULL,'Xeon E5530 2.4Ghz 4Core','CPU','base',50000,2,NULL,NULL,'2025-09-19 00:19:26'),(69,NULL,8,14,NULL,'4G','RAM','base',30000,2,NULL,NULL,'2025-09-19 00:19:57'),(70,NULL,14,14,NULL,'SATA 256G','DISK','base',70000,2,'RAID1',NULL,'2025-09-19 00:20:22');
|
||||
/*!40000 ALTER TABLE `serverpartinfo` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@ -470,7 +470,7 @@ CREATE TABLE `serviceinfo` (
|
||||
KEY `FK_clientinfo_TO_serviceinfo` (`clientinfo_uid`),
|
||||
CONSTRAINT `FK_clientinfo_TO_serviceinfo` FOREIGN KEY (`clientinfo_uid`) REFERENCES `clientinfo` (`uid`),
|
||||
CONSTRAINT `FK_user_TO_serviceinfo` FOREIGN KEY (`user_uid`) REFERENCES `user` (`uid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='서비스정보';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COMMENT='서비스정보';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
@ -597,4 +597,4 @@ UNLOCK TABLES;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2025-09-19 15:10:01
|
||||
-- Dump completed on 2025-09-19 19:48:53
|
||||
|
||||
@ -3,10 +3,11 @@
|
||||
namespace App\Interfaces\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
|
||||
interface ServiceInterface extends CustomerInterface
|
||||
{
|
||||
public function setService(string $action, ServiceEntity $serviceEntity, array $serviceDatas);
|
||||
public function setService(string $action, ServiceEntity $serviceEntity, array $serviceDatas): ServiceENtity;
|
||||
public function setServiceAmount(ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity;
|
||||
}
|
||||
|
||||
@ -6,5 +6,7 @@ use App\Entities\Equipment\ServerPartEntity;
|
||||
|
||||
interface ServerPartInterface extends EquipmentInterface
|
||||
{
|
||||
public function setServerPart(string $action, ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity;
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity;
|
||||
public function modifyServerPart(ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity;
|
||||
public function deleteServerPart(ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity;
|
||||
}
|
||||
|
||||
@ -26,28 +26,28 @@ abstract class CustomerService extends CommonService
|
||||
parent::__construct($model, $helper);
|
||||
$this->addClassName('Customer');
|
||||
}
|
||||
final public function getClientService(): ClientService
|
||||
public function getClientService(): ClientService
|
||||
{
|
||||
if (!$this->_clientService) {
|
||||
$this->_clientService = new ClientService();
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
final public function getUSerService(): UserService
|
||||
public function getUSerService(): UserService
|
||||
{
|
||||
if (!$this->_userService) {
|
||||
$this->_userService = new UserService();
|
||||
}
|
||||
return $this->_userService;
|
||||
}
|
||||
final public function getServiceService(): ServiceService
|
||||
public function getServiceService(): ServiceService
|
||||
{
|
||||
if (!$this->_serviceService) {
|
||||
$this->_serviceService = new ServiceService();
|
||||
}
|
||||
return $this->_serviceService;
|
||||
}
|
||||
final public function getServerService(): ServerService
|
||||
public function getServerService(): ServerService
|
||||
{
|
||||
if (!$this->_serverService) {
|
||||
$this->_serverService = new ServerService();
|
||||
|
||||
@ -9,7 +9,7 @@ use App\Entities\PaymentEntity;
|
||||
use App\Entities\UserEntity;
|
||||
use App\Helpers\Customer\ServiceHelper;
|
||||
use App\Models\Customer\ServiceModel;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use App\Services\Equipment\Server\Service as ServerService;
|
||||
use App\Services\Payment\Service as PaymentService;
|
||||
use App\Traits\IPTrait;
|
||||
|
||||
@ -130,6 +130,13 @@ class ServiceService extends CustomerService
|
||||
}
|
||||
return $this->_paymentService;
|
||||
}
|
||||
public function getServerService(): ServerService
|
||||
{
|
||||
if (!$this->_serverService) {
|
||||
$this->_serverService = new ServerService();
|
||||
}
|
||||
return $this->_serverService;
|
||||
}
|
||||
//기본 기능부분
|
||||
public function getFormOption(string $field, array $options = []): array
|
||||
{
|
||||
@ -220,8 +227,8 @@ class ServiceService extends CustomerService
|
||||
if (!array_key_exists('serverinfo_uid', $formDatas)) {
|
||||
throw new \Exception("서버가 지정되지 않았습니다.");
|
||||
}
|
||||
$entity = parent::create($formDatas);
|
||||
$entity = $entity->setServerEntity($this->getServerService()->setService($entity, $formDatas['serverinfo_uid'], STATUS['OCCUPIED']));
|
||||
$entity = parent::create(formDatas: $formDatas);
|
||||
$entity = $this->getServerService()->setService(__FUNCTION__, $entity, ['serverinfo_uid' => $formDatas['serverinfo_uid'], 'status' => STATUS['OCCUPIED']]);
|
||||
// 결제정보에 추가한다.
|
||||
$this->getPaymentService()->setService(__FUNCTION__, $entity);
|
||||
return $entity;
|
||||
|
||||
36
app/Services/Equipment/Server/Service.php
Normal file
36
app/Services/Equipment/Server/Service.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment\Server;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Interfaces\Customer\ServiceInterface;
|
||||
use App\Services\Equipment\ServerService;
|
||||
|
||||
class Service extends ServerService implements ServiceInterface
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
//서버연결정보용 등록
|
||||
//서비스정보용 등록
|
||||
public function setService(string $action, ServiceEntity $serviceEntity, array $serviceDatas = []): ServiceENtity
|
||||
{
|
||||
$entity = $this->getEntity($serviceDatas['serverinfo_uid']);
|
||||
if (!($entity instanceof ServerEntity)) {
|
||||
throw new \Exception("{$serviceDatas['serverinfo_uid']}에 해당하는 서버정보를 찾을수없습니다.");
|
||||
}
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $serviceEntity->getPK();
|
||||
$formDatas['status'] = $serviceDatas['status'];
|
||||
$entity = $this->modify($entity, $formDatas);
|
||||
return $serviceEntity->setServerENtity($entity);
|
||||
}
|
||||
public function setServiceAmount(ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity
|
||||
{
|
||||
return $serverPartEntity;
|
||||
}
|
||||
}
|
||||
@ -7,10 +7,10 @@ use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Helpers\Equipment\ServerPartHelper;
|
||||
use App\Models\Equipment\ServerPartModel;
|
||||
use App\Services\Equipment\EquipmentService;
|
||||
use App\Services\Equipment\CS\ServicePart as CSService;
|
||||
use App\Services\Equipment\IP\ServicePart as IPService;
|
||||
use App\Services\Equipment\Part\ServicePart as PartService;
|
||||
use App\Services\Equipment\Switch\ServicePart as SwitchService;
|
||||
use App\Services\Equipment\CS\ServerePart as CSService;
|
||||
use App\Services\Equipment\IP\ServerePart as IPService;
|
||||
use App\Services\Equipment\Part\ServerPart as PartService;
|
||||
use App\Services\Equipment\Switch\ServerPart as SwitchService;
|
||||
use App\Services\Payment\ServicePart as PaymentService;
|
||||
|
||||
class ServerPartService extends EquipmentService
|
||||
@ -194,16 +194,16 @@ class ServerPartService extends EquipmentService
|
||||
case 'OS':
|
||||
case 'DB':
|
||||
case 'SOFTWARE':
|
||||
$entity = $this->getPartService()->setServerPart($action, $entity, $formDatas);
|
||||
$entity = $this->getPartService()->$action($entity, $formDatas);
|
||||
break;
|
||||
case 'SWITCH':
|
||||
$entity = $this->getSwitchService()->setServerPart($action, $entity, $formDatas);
|
||||
$entity = $this->getSwitchService()->$action($entity, $formDatas);
|
||||
break;
|
||||
case 'IP':
|
||||
$entity = $this->getIPService()->setServerPart($action, $entity, $formDatas);
|
||||
$entity = $this->getIPService()->$action($entity, $formDatas);
|
||||
break;
|
||||
case 'CS':
|
||||
$entity = $this->getCSService()->setServerPart($action, $entity, $formDatas);
|
||||
$entity = $this->getCSService()->$action($entity, $formDatas);
|
||||
break;
|
||||
}
|
||||
return $entity;
|
||||
@ -230,9 +230,11 @@ class ServerPartService extends EquipmentService
|
||||
$formDatas["serverinfo_uid"] = $serverEntity->getPK();
|
||||
$entity = parent::create($formDatas);
|
||||
//부품정보 설정
|
||||
$entity = $this->setServerPart(__FUNCTION__, $entity, ['part_uid' => $formDatas['part_uid'], 'status' => STATUS['OCCUPIED']]);
|
||||
//결제관련정보 설정
|
||||
$entity = $this->getPaymentService()->setServerPart(__FUNCTION__, $entity);
|
||||
$entity = $this->setServerPart("createServerPart", $entity, ['part_uid' => $formDatas['part_uid'], 'status' => STATUS['OCCUPIED']]);
|
||||
//결제방식이 기본이 아니면 결제관련정보 설정
|
||||
if ($entity->getBilling() !== PAYMENT['BILLING']['BASE']) {
|
||||
$entity = $this->getPaymentService()->createServerPart($entity);
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
//수정
|
||||
@ -248,7 +250,7 @@ class ServerPartService extends EquipmentService
|
||||
}
|
||||
//부품연결정보에 부품정보가 변경된 경우(기존것은 AVAILABLE로 변경)
|
||||
if ($entity->getPartUID() != $formDatas['part_uid']) {
|
||||
$entity = $this->setServerPart(__FUNCTION__, $entity, ['part_uid' => $entity->getPartUID(), 'status' => STATUS['AVAILABLE']]);
|
||||
$entity = $this->setServerPart("modifyServerPart", $entity, ['part_uid' => $entity->getPartUID(), 'status' => STATUS['AVAILABLE']]);
|
||||
}
|
||||
//수정작업
|
||||
$formDatas["clientinfo_uid"] = $serverEntity->getClientInfoUID();
|
||||
@ -257,17 +259,23 @@ class ServerPartService extends EquipmentService
|
||||
$entity = parent::modify($entity, $formDatas);
|
||||
//부품연결정보에 부품정보가 변경된 경우 OCCUPIED로 변경
|
||||
if ($entity->getPartUID() != $formDatas['part_uid']) {
|
||||
$entity = $this->setServerPart(__FUNCTION__, $entity, ['part_uid' => $formDatas['part_uid'], 'status' => STATUS['OCCUPIED']]);
|
||||
$entity = $this->setServerPart("modifyServerPart", $entity, ['part_uid' => $formDatas['part_uid'], 'status' => STATUS['OCCUPIED']]);
|
||||
}
|
||||
//결제방식이 기본이 아니면 결제관련정보 설정
|
||||
if ($entity->getBilling() !== PAYMENT['BILLING']['BASE']) {
|
||||
$entity = $this->getPaymentService()->modifyeServerPart($entity);
|
||||
}
|
||||
//결제관련정보 정의
|
||||
$entity = $this->getPaymentService()->setServerPart(__FUNCTION__, $entity);
|
||||
return $entity;
|
||||
}
|
||||
//삭제
|
||||
public function delete(mixed $entity): ServerPartEntity
|
||||
{
|
||||
//부품연결정보에 부품정보 정의
|
||||
$entity = $this->setServerPart(__FUNCTION__, $entity, ['part_uid' => $entity->getPartUID(), 'status' => STATUS['AVAILABLE']]);
|
||||
$entity = $this->setServerPart("deleteServerPart", $entity, ['part_uid' => $entity->getPartUID(), 'status' => STATUS['AVAILABLE']]);
|
||||
//결제방식이 기본이 아니면 결제관련정보 설정
|
||||
if ($entity->getBilling() !== PAYMENT['BILLING']['BASE']) {
|
||||
$entity = $this->getPaymentService()->deleteServerPart($entity);
|
||||
}
|
||||
return parent::delete($entity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,20 +121,6 @@ class ServerService extends EquipmentService
|
||||
throw new \Exception("Server코드[{$formDatas['code']}의 형식이 맞지않습니다");
|
||||
}
|
||||
}
|
||||
//서비스 설정
|
||||
public function setService(ServiceEntity $serviceEntity, mixed $uid, string $status): ServerEntity
|
||||
{
|
||||
$entity = $this->getEntity($uid);
|
||||
if (!($entity instanceof ServerEntity)) {
|
||||
throw new \Exception("{$uid}에 해당하는 서버정보를 찾을수없습니다.");
|
||||
}
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $serviceEntity->getPK();
|
||||
$formDatas['status'] = $status;
|
||||
//서버정보 상태수정
|
||||
return $this->modify($entity, $formDatas);
|
||||
}
|
||||
// 수정
|
||||
public function modify(mixed $entity, array $formDatas): ServerEntity
|
||||
{
|
||||
|
||||
101
app/Services/Payment/ServerPart.php
Normal file
101
app/Services/Payment/ServerPart.php
Normal file
@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Payment;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Entities\PaymentEntity;
|
||||
use App\Interfaces\Equipment\ServerPartInterface;
|
||||
use App\Services\Equipment\ServerPartService;
|
||||
use App\Services\PaymentService;
|
||||
|
||||
class ServerPart extends PaymentService implements ServerPartInterface
|
||||
{
|
||||
private ?ServerPartService $_serverPartService = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
final public function getServerPartService(): ServerPartService
|
||||
{
|
||||
if (!$this->_serverPartService) {
|
||||
$this->_serverPartService = new ServerPartService();
|
||||
}
|
||||
return $this->_serverPartService;
|
||||
}
|
||||
|
||||
//월과금은 해당 서비스의 항목별 금액을 총 합산후 청구금액을 설정후 결제정보에 신규등록/수정한다
|
||||
private function serverPart_process_month(ServiceEntity $serviceEntity, ServerPartEntity $serverPartEntity): ServiceEntity
|
||||
{
|
||||
//월비용인경우 서비스 제공가에 서버연결정보 제공가 합산금액으로 설정
|
||||
$serviceFormDatas = [];
|
||||
$serviceFormDatas['serverinfo_uid'] = $serviceEntity->getServerInfoUID();
|
||||
$serviceFormDatas['billing_at'] = $serviceEntity->getBillingAt();
|
||||
//해당 서비스(서버) 관련 경제방식(Billing)이 Month인 ServerPart 전체를 다시 검사하여 월청구액을 수정한다.
|
||||
$serviceFormDatas['amount'] = $serviceEntity->getServerEntity()->getPrice(); //서버금액(price)
|
||||
//월과금용 ServerPartEntity의 금액을 모두 총합산한 금액을 설정한다.
|
||||
foreach ($this->getServerPartService()->getEntities(['serverinfo_uid' => $serviceEntity->getServerInfoUID()]) as $serverPartEntity) {
|
||||
$serviceFormDatas['amount'] += $serverPartEntity->getAmount();
|
||||
}
|
||||
return $this->getServiceService()->modify($serviceEntity, $serviceFormDatas);
|
||||
}
|
||||
private function serverPart_process(ServerPartEntity $serverPartEntity, array $formDatas = []): array
|
||||
{
|
||||
//Service Entity 가져오기
|
||||
$serviceEntity = $this->getServiceService()->getEntity($serverPartEntity->getServiceInfoUID());
|
||||
if (!$serviceEntity) {
|
||||
throw new \Exception("[{$serverPartEntity->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
|
||||
$formDatas['clientinfo_uid'] = $serverPartEntity->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
||||
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID(); //서버연결정보 수정시에 필요함
|
||||
$formDatas['serverpartinfo_uid'] = $serverPartEntity->getPK();
|
||||
//타이틀은 기타의 경우 직접작성한 제목을 등록하고 아닌경우는 Part의 Title을 사용한다.
|
||||
$formDatas['title'] = $serverPartEntity->getType() === 'ETC' ? $serverPartEntity->getTitle() : $serverPartEntity->getPartEntity()->getTitle();
|
||||
$formDatas['amount'] = $serverPartEntity->getAmount();
|
||||
$formDatas['billing'] = $serverPartEntity->getBilling();
|
||||
//월과금인경우
|
||||
if ($serverPartEntity->getBilling() === PAYMENT['BILLING']['MONTH']) {
|
||||
//결제일설정
|
||||
$formDatas['billing_at'] = $serviceEntity->getBillingAt();
|
||||
$this->serverPart_process_month($serviceEntity, $serverPartEntity);
|
||||
}
|
||||
//일회성인경우
|
||||
if ($serverPartEntity->getBilling() === PAYMENT['BILLING']['ONETIME']) {
|
||||
//당일결체일로 설정
|
||||
$formDatas['billing_at'] = date("Y-m-d");
|
||||
}
|
||||
return $formDatas;
|
||||
}
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity, array $serverPartDatas = []): ServerPartEntity
|
||||
{
|
||||
if ($serverPartEntity->getServiceInfoUID() === null) {
|
||||
throw new \Exception(lang("{$this->getClassName()}.BILLING." . PAYMENT['BILLING']['MONTH']) . "지급 상품은 서비스정보가 정의된 후에만 가능합니다.");
|
||||
}
|
||||
//Service Entity 가져오기
|
||||
$serviceEntity = $this->getServiceService()->getEntity($serverPartEntity->getServiceInfoUID());
|
||||
if (!$serviceEntity) {
|
||||
throw new \Exception("[{$serverPartEntity->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
//기본 처리 후 FormData 가져오기
|
||||
$formDatas = $this->serverPart_process($serverPartEntity);
|
||||
//결제정보등록
|
||||
$this->create($formDatas);
|
||||
return $serverPartEntity;
|
||||
}
|
||||
public function modifyServerPart(ServerPartEntity $serverPartEntity, array $serverPartDatas = []): ServerPartEntity
|
||||
{
|
||||
//serverpartinfo_uid에 해당하는 결제정보 가져오기
|
||||
$entity = $this->getEntity(['serverpartinfo_uid' => $serverPartEntity->getPK(), 'status' => STATUS['UNPAID']]);
|
||||
if (!$entity instanceof PaymentEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$serverPartEntity->getPK()}에 해당하는 결제정보를 찾을수 없습니다.");
|
||||
}
|
||||
//기본 처리 후 FormData 가져오기
|
||||
$formDatas = $this->serverPart_process($serverPartEntity);
|
||||
//결제수정등록
|
||||
$this->modify($entity, $formDatas);
|
||||
return $serverPartEntity;
|
||||
}
|
||||
}
|
||||
@ -15,7 +15,7 @@ class Service extends ServiceService implements ServiceInterface
|
||||
}
|
||||
//서버연결정보용 등록
|
||||
//서비스정보용 등록
|
||||
public function setService(string $action, ServiceEntity $serviceEntity, array $serviceDatas = []): ServiceEntity
|
||||
public function setService(string $action, ServiceEntity $serviceEntity, array $serviceDatas = []): ServiceENtity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUID();
|
||||
|
||||
@ -1,77 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Payment;
|
||||
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Entities\PaymentEntity;
|
||||
use App\Interfaces\Equipment\ServerPartInterface;
|
||||
use App\Services\PaymentService;
|
||||
|
||||
class ServicePart extends PaymentService implements ServerPartInterface
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
//서버연결정보용 등록
|
||||
public function setServerPart(string $action, ServerPartEntity $serverPartEntity, array $serverPartDatas = []): ServerPartEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
switch ($serverPartEntity->getBilling()) {
|
||||
case PAYMENT['BILLING']['MONTH']:
|
||||
if ($serverPartEntity->getServiceInfoUID() === null) {
|
||||
throw new \Exception(lang("{$this->getClassName()}.BILLING." . PAYMENT['BILLING']['MONTH']) . "지급 상품은 서비스정보가 정의된 후에만 가능합니다.");
|
||||
}
|
||||
//Service Entity 가져오기
|
||||
$serviceEntity = $this->getServiceService()->getEntity($serverPartEntity->getServiceInfoUID());
|
||||
if (!$serviceEntity) {
|
||||
throw new \Exception("[{$serverPartEntity->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
//월비용인경우 서비스 제공가에 서버연결정보 제공가 합산금액으로 설정
|
||||
if ($serverPartEntity->getBilling() === PAYMENT['BILLING']['MONTH']) {
|
||||
$formDatas['serverinfo_uid'] = $serviceEntity->getServerInfoUID();
|
||||
$formDatas['billing_at'] = $serviceEntity->getBillingAt();
|
||||
$formDatas['amount'] = $serviceEntity->getAmount() + $serverPartEntity->getAmount();
|
||||
$this->getServiceService()->modify($serviceEntity, $formDatas);
|
||||
}
|
||||
break;
|
||||
case PAYMENT['BILLING']['ONETIME']:
|
||||
if ($serverPartEntity->getServiceInfoUID() === null) {
|
||||
throw new \Exception(lang("{$this->getClassName()}.BILLING." . PAYMENT['BILLING']['ONETIME']) . "지급 상품은 서비스정보가 정의된 후에만 가능합니다.");
|
||||
}
|
||||
//Service Entity 가져오기
|
||||
$serviceEntity = $this->getServiceService()->getEntity($serverPartEntity->getServiceInfoUID());
|
||||
if (!$serviceEntity) {
|
||||
throw new \Exception("[{$serverPartEntity->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
//일회성인경우
|
||||
if ($serverPartEntity->getBilling() === PAYMENT['BILLING']['ONETIME']) {
|
||||
$formDatas['clientinfo_uid'] = $serverPartEntity->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
||||
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
||||
$formDatas['serverpartinfo_uid'] = $serverPartEntity->getPK();
|
||||
$formDatas['title'] = $serverPartEntity->getType() === 'ETC' ? $serverPartEntity->getTitle() : $serverPartEntity->getPartEntity()->getTitle();
|
||||
$formDatas['amount'] = $serverPartEntity->getAmount();
|
||||
$formDatas['billing'] = $serverPartEntity->getBilling();
|
||||
$formDatas['billing_at'] = $serverPartEntity->getBilling() === PAYMENT['BILLING']['ONETIME'] ? date("Y-m-d") : $serviceEntity->getBillingAT();
|
||||
if ($action === 'create') {
|
||||
//지급기한일 설정
|
||||
$formDatas['billing_at'] = $serverPartEntity->getBilling() === PAYMENT['BILLING']['ONETIME'] ? date("Y-m-d") : $serviceEntity->getBillingAT();
|
||||
$this->create($formDatas);
|
||||
}
|
||||
if ($action === 'modify') {
|
||||
if (!array_key_exists('serverpartinfo_uid', $formDatas)) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 기존 결제정보가 지정되지 않았습니다.");
|
||||
}
|
||||
$entity = $this->getEntity(['serverpartinfo_uid' => $serverPartEntity->getPK(), 'status' => STATUS['UNPAID']]);
|
||||
if (!$entity instanceof PaymentEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$serverPartEntity->getPK()}에 해당하는 결제정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->modify($entity, $formDatas);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $serverPartEntity;
|
||||
}
|
||||
}
|
||||
@ -14,7 +14,17 @@ class ServicePart extends ServiceService implements ServerPartInterface
|
||||
parent::__construct();
|
||||
}
|
||||
//서버연결정보용 등록
|
||||
public function setServerPart(string $action, ServerPartEntity $serverPartEntity, array $serverPartDatas = []): ServerPartEntity
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity, array $serverPartDatas = []): ServerPartEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
return $serverPartEntity;
|
||||
}
|
||||
public function modifyServerPart(ServerPartEntity $serverPartEntity, array $serverPartDatas = []): ServerPartEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
return $serverPartEntity;
|
||||
}
|
||||
public function deleteServerPart(ServerPartEntity $serverPartEntity, array $serverPartDatas = []): ServerPartEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
return $serverPartEntity;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user