diff --git a/app/Controllers/Admin/Customer/ClientController.php b/app/Controllers/Admin/Customer/ClientController.php index 2f9333c..efc7ff4 100644 --- a/app/Controllers/Admin/Customer/ClientController.php +++ b/app/Controllers/Admin/Customer/ClientController.php @@ -109,7 +109,7 @@ class ClientController extends CustomerController $this->getService()->setFormOptions(); //일괄작업용 Fields정의 $entity = $this->getService()->getEntity($uid); - if (!($entity instanceof ClientEntity)) { + if (!$entity instanceof ClientEntity) { throw new \Exception("{$uid}에 해당하는 고객정보를 찾을수 없습니다."); } $this->totalCounts = $this->getService()->getServiceService()->getTotalCountsByType(['clientinfo_uid' => $entity->getPK()]); diff --git a/app/Database/dbmsv2.vuerd.json b/app/Database/dbmsv2.vuerd.json index 26845bc..28b5622 100644 --- a/app/Database/dbmsv2.vuerd.json +++ b/app/Database/dbmsv2.vuerd.json @@ -4,13 +4,13 @@ "settings": { "width": 3000, "height": 3000, - "scrollTop": -1061.8503, - "scrollLeft": -1473.857, + "scrollTop": -1869.8503, + "scrollLeft": -1623, "zoomLevel": 0.79, "show": 511, "database": 4, "databaseName": "", - "canvasType": "ERD", + "canvasType": "@dineug/erd-editor/builtin-schema-sql", "language": 1, "tableNameCase": 4, "columnNameCase": 2, @@ -76,7 +76,9 @@ "v69SOu4bJ3yPh0LPCs06I", "zEgsZkg-rIZbtF9AWri-c", "wM3eezHxl6nAo_rtAeJ_s", - "FvUQ_UzlR7zPl1ZcdWxRd" + "FvUQ_UzlR7zPl1ZcdWxRd", + "45um-cLGZhGmT2PGzssrQ", + "FUgz6MDTR-52RHgp677Hv" ], "indexIds": [], "memoIds": [] @@ -278,6 +280,7 @@ "4iRyOhmW3b7kbiZT8lQyY", "hPz83FX0cU7HIyVRRr5sl", "3fZMQ9qB1DO8y44eJRKdt", + "6fnpnhwe9G-y5QQ1j30W9", "34psXzS7RLX0sWXZyDGGf", "m77kSp3scTgMhInPBjsc3", "9F6QpQqxeEggZ0FHM81O1", @@ -326,7 +329,7 @@ "color": "" }, "meta": { - "updateAt": 1757309382902, + "updateAt": 1758500902605, "createAt": 1745819764137 } }, @@ -665,6 +668,7 @@ "nNWsAWbHfKWqx8EwxvuM1", "Vf3bNvvEPfu1zCs4rcHTU", "N-2m8O_JzS6-sDEcL5zTv", + "KpTaAmkIKIhv87_dxw0z8", "1ZM86qoxmCcoKnqOpE2oj", "mIkGBA96-a6Rh6AoRddl7", "ptLUIGfIqm89XGRz_V2ww", @@ -687,6 +691,7 @@ "nNWsAWbHfKWqx8EwxvuM1", "Vf3bNvvEPfu1zCs4rcHTU", "N-2m8O_JzS6-sDEcL5zTv", + "KpTaAmkIKIhv87_dxw0z8", "1ZM86qoxmCcoKnqOpE2oj", "mIkGBA96-a6Rh6AoRddl7", "NzxkmndrTbH7xb6fbnGV7", @@ -746,7 +751,7 @@ "color": "" }, "meta": { - "updateAt": 1758256335552, + "updateAt": 1758500811195, "createAt": 1748485662214 } }, @@ -865,6 +870,7 @@ "nlrS7pAK108Hen0g1_yRG", "eu4eV0U7BRaP7Zk-oyBhV", "IbWdZlEEF70bGqUDkU5ub", + "Fo9A9MajgfwBYecToLCoW", "l2g7xess8DY86_ZOm7Ca1", "cHqRVW_Ce77LXwoPpG3OP", "mYEan5gjLS5bBthtFCc6w", @@ -884,6 +890,7 @@ "nlrS7pAK108Hen0g1_yRG", "eu4eV0U7BRaP7Zk-oyBhV", "IbWdZlEEF70bGqUDkU5ub", + "Fo9A9MajgfwBYecToLCoW", "l2g7xess8DY86_ZOm7Ca1", "czO0QNJkidvlfvj3hL6xs", "cHqRVW_Ce77LXwoPpG3OP", @@ -907,7 +914,7 @@ "color": "" }, "meta": { - "updateAt": 1757047817870, + "updateAt": 1758500931857, "createAt": 1755476453282 } }, @@ -3637,7 +3644,7 @@ "id": "GMPyqxaroK2OjQZnoCRwn", "tableId": "QCNA57Pi6A9dJDgybxS5v", "name": "uid", - "comment": "", + "comment": "결제정보", "dataType": "INT", "default": "", "options": 11, @@ -3649,7 +3656,7 @@ "widthDefault": 60 }, "meta": { - "updateAt": 1755483192322, + "updateAt": 1758500765018, "createAt": 1748485346073 } }, @@ -8452,6 +8459,66 @@ "updateAt": 1758256191111, "createAt": 1758255959769 } + }, + "6fnpnhwe9G-y5QQ1j30W9": { + "id": "6fnpnhwe9G-y5QQ1j30W9", + "tableId": "B4qGh3KZsXHQ3_4EOgwJZ", + "name": "payment_uid", + "comment": "결제정보", + "dataType": "INT", + "default": "", + "options": 0, + "ui": { + "keys": 0, + "widthName": 70, + "widthComment": 60, + "widthDataType": 60, + "widthDefault": 60 + }, + "meta": { + "updateAt": 1758500826161, + "createAt": 1758500709806 + } + }, + "KpTaAmkIKIhv87_dxw0z8": { + "id": "KpTaAmkIKIhv87_dxw0z8", + "tableId": "B8haiEbPc1lRBWTv1g25G", + "name": "payment_uid", + "comment": "결제정보", + "dataType": "INT", + "default": "", + "options": 0, + "ui": { + "keys": 2, + "widthName": 70, + "widthComment": 60, + "widthDataType": 60, + "widthDefault": 60 + }, + "meta": { + "updateAt": 1758500821482, + "createAt": 1758500807415 + } + }, + "Fo9A9MajgfwBYecToLCoW": { + "id": "Fo9A9MajgfwBYecToLCoW", + "tableId": "8GYAVBvZGaMFeq3QuXk_B", + "name": "payment_uid", + "comment": "결제정보", + "dataType": "INT", + "default": "", + "options": 0, + "ui": { + "keys": 2, + "widthName": 70, + "widthComment": 60, + "widthDataType": 60, + "widthDefault": 60 + }, + "meta": { + "updateAt": 1758500942149, + "createAt": 1758500929116 + } } }, "relationshipEntities": { @@ -8502,7 +8569,7 @@ "columnIds": [ "Vf3bNvvEPfu1zCs4rcHTU" ], - "x": 2149.1048333333333, + "x": 2121.8965, "y": 1063.7785, "direction": 4 }, @@ -8811,7 +8878,7 @@ "N-2m8O_JzS6-sDEcL5zTv" ], "x": 2040.2715, - "y": 1145.1118333333332, + "y": 1149.1118333333332, "direction": 1 }, "meta": { @@ -8829,7 +8896,7 @@ "columnIds": [ "nNWsAWbHfKWqx8EwxvuM1" ], - "x": 2584.4381666666663, + "x": 2448.3965, "y": 1063.7785, "direction": 4 }, @@ -8838,7 +8905,7 @@ "columnIds": [ "vxhl-9RMNJ8zU9oqzEWo8" ], - "x": 2657.5336, + "x": 2657.5335999999998, "y": 918.633, "direction": 8 }, @@ -8914,7 +8981,7 @@ "nNWsAWbHfKWqx8EwxvuM1" ], "x": 2040.2715, - "y": 1470.4451666666666, + "y": 1490.4451666666666, "direction": 1 }, "end": { @@ -9035,7 +9102,7 @@ "IbWdZlEEF70bGqUDkU5ub" ], "x": 2001.6042, - "y": 2606.1309, + "y": 2624.1309, "direction": 1 }, "meta": { @@ -9054,7 +9121,7 @@ "nNWsAWbHfKWqx8EwxvuM1" ], "x": 2040.2715, - "y": 1307.7785, + "y": 1319.7785, "direction": 1 }, "end": { @@ -9081,7 +9148,7 @@ "columnIds": [ "nNWsAWbHfKWqx8EwxvuM1" ], - "x": 2366.7715, + "x": 2285.1465, "y": 1063.7785, "direction": 4 }, @@ -9110,7 +9177,7 @@ "nNWsAWbHfKWqx8EwxvuM1" ], "x": 2203.5215, - "y": 1551.7785, + "y": 1575.7785, "direction": 8 }, "end": { @@ -9138,7 +9205,7 @@ "nNWsAWbHfKWqx8EwxvuM1" ], "x": 2530.0215, - "y": 1551.7785, + "y": 1575.7785, "direction": 8 }, "end": { @@ -9146,7 +9213,7 @@ "columnIds": [ "eu4eV0U7BRaP7Zk-oyBhV" ], - "x": 2298.6041999999998, + "x": 2447.1041999999998, "y": 2348.1309, "direction": 4 }, @@ -9259,13 +9326,97 @@ "nlrS7pAK108Hen0g1_yRG" ], "x": 2001.6042, - "y": 2434.1309, + "y": 2440.1309, "direction": 1 }, "meta": { "updateAt": 1757047705587, "createAt": 1757047705587 } + }, + "hRJKHAzKFZj_GjTbfDqUC": { + "id": "hRJKHAzKFZj_GjTbfDqUC", + "identification": false, + "relationshipType": 8, + "startRelationshipType": 1, + "start": { + "tableId": "QCNA57Pi6A9dJDgybxS5v", + "columnIds": [ + "GMPyqxaroK2OjQZnoCRwn" + ], + "x": 2338.5336, + "y": 853.2996666666667, + "direction": 1 + }, + "end": { + "tableId": "B4qGh3KZsXHQ3_4EOgwJZ", + "columnIds": [ + "6fnpnhwe9G-y5QQ1j30W9" + ], + "x": 1385.442266666667, + "y": 2042.6057, + "direction": 4 + }, + "meta": { + "updateAt": 1758500709809, + "createAt": 1758500709809 + } + }, + "45um-cLGZhGmT2PGzssrQ": { + "id": "45um-cLGZhGmT2PGzssrQ", + "identification": false, + "relationshipType": 8, + "startRelationshipType": 1, + "start": { + "tableId": "QCNA57Pi6A9dJDgybxS5v", + "columnIds": [ + "GMPyqxaroK2OjQZnoCRwn" + ], + "x": 2870.2002666666663, + "y": 918.633, + "direction": 8 + }, + "end": { + "tableId": "B8haiEbPc1lRBWTv1g25G", + "columnIds": [ + "KpTaAmkIKIhv87_dxw0z8" + ], + "x": 2611.6465, + "y": 1063.7785, + "direction": 4 + }, + "meta": { + "updateAt": 1758500807415, + "createAt": 1758500807415 + } + }, + "FUgz6MDTR-52RHgp677Hv": { + "id": "FUgz6MDTR-52RHgp677Hv", + "identification": false, + "relationshipType": 8, + "startRelationshipType": 1, + "start": { + "tableId": "QCNA57Pi6A9dJDgybxS5v", + "columnIds": [ + "GMPyqxaroK2OjQZnoCRwn" + ], + "x": 2444.8669333333332, + "y": 918.633, + "direction": 8 + }, + "end": { + "tableId": "8GYAVBvZGaMFeq3QuXk_B", + "columnIds": [ + "Fo9A9MajgfwBYecToLCoW" + ], + "x": 2150.1041999999998, + "y": 2348.1309, + "direction": 4 + }, + "meta": { + "updateAt": 1758500929116, + "createAt": 1758500929116 + } } }, "indexEntities": {}, diff --git a/app/Entities/Customer/AccountEntity.php b/app/Entities/Customer/AccountEntity.php index cdee3ed..4291999 100644 --- a/app/Entities/Customer/AccountEntity.php +++ b/app/Entities/Customer/AccountEntity.php @@ -9,6 +9,13 @@ class AccountEntity extends CustomerEntity const PK = AccountModel::PK; const TITLE = AccountModel::TITLE; const DEFAULT_STATUS = STATUS['DEPOSIT']; - //고객정보객체-상속 - //타 객체정의 부분 + final public function getUserUID(): string + { + return $this->attributes['user_uid']; + } + final public function getClientInfoUID(): string + { + return $this->attributes['clientinfo_uid']; + } + //기본기능 } diff --git a/app/Entities/Customer/ClientEntity.php b/app/Entities/Customer/ClientEntity.php index 1635981..0078905 100644 --- a/app/Entities/Customer/ClientEntity.php +++ b/app/Entities/Customer/ClientEntity.php @@ -9,7 +9,11 @@ class ClientEntity extends CustomerEntity const PK = ClientModel::PK; const TITLE = ClientModel::TITLE; const DEFAULT_STATUS = STATUS['AVAILABLE']; - //타 객체정의 부분 + final public function getUserUID(): string + { + return $this->attributes['user_uid']; + } + //기본기능 public function getName(): string { return $this->attributes['name'] ?? ""; diff --git a/app/Entities/Customer/CouponEntity.php b/app/Entities/Customer/CouponEntity.php index 3162c68..5cb6734 100644 --- a/app/Entities/Customer/CouponEntity.php +++ b/app/Entities/Customer/CouponEntity.php @@ -9,6 +9,13 @@ class CouponEntity extends CustomerEntity const PK = CouponModel::PK; const TITLE = CouponModel::TITLE; const DEFAULT_STATUS = STATUS['DEPOSIT']; - //고객정보객체-상속 - //타 객체정의 부분 + final public function getUserUID(): string + { + return $this->attributes['user_uid']; + } + final public function getClientInfoUID(): string + { + return $this->attributes['clientinfo_uid']; + } + //기본기능 } diff --git a/app/Entities/Customer/CustomerEntity.php b/app/Entities/Customer/CustomerEntity.php index 5ecffde..bea2a44 100644 --- a/app/Entities/Customer/CustomerEntity.php +++ b/app/Entities/Customer/CustomerEntity.php @@ -10,20 +10,4 @@ abstract class CustomerEntity extends CommonEntity { parent::__construct($data); } - final public function getUserUID(): int|null - { - return $this->attributes['user_uid']; - } - final public function getClientInfoUID(): int|null - { - return $this->attributes['clientinfo_uid'] ?? null; - } - final public function getServiceInfoUID(): int|null - { - return $this->attributes['serviceinfo_uid'] ?? null; - } - final public function getServerInfoUID(): int|null - { - return $this->attributes['serverinfo_uid'] ?? null; - } } diff --git a/app/Entities/Customer/PointEntity.php b/app/Entities/Customer/PointEntity.php index 78a91dc..fb0badc 100644 --- a/app/Entities/Customer/PointEntity.php +++ b/app/Entities/Customer/PointEntity.php @@ -9,6 +9,13 @@ class PointEntity extends CustomerEntity const PK = PointModel::PK; const TITLE = PointModel::TITLE; const DEFAULT_STATUS = STATUS['DEPOSIT']; - //고객정보객체-상속 - //타 객체정의 부분 + final public function getUserUID(): string + { + return $this->attributes['user_uid']; + } + final public function getClientInfoUID(): string + { + return $this->attributes['clientinfo_uid']; + } + //기본기능 } diff --git a/app/Entities/Customer/ServiceEntity.php b/app/Entities/Customer/ServiceEntity.php index d940687..04f0634 100644 --- a/app/Entities/Customer/ServiceEntity.php +++ b/app/Entities/Customer/ServiceEntity.php @@ -3,6 +3,7 @@ namespace App\Entities\Customer; use App\Entities\Equipment\ServerEntity; +use App\Entities\PaymentEntity; use App\Entities\UserEntity; use App\Models\Customer\ServiceModel; @@ -11,33 +12,42 @@ class ServiceEntity extends CustomerEntity const PK = ServiceModel::PK; const TITLE = ServiceModel::TITLE; const DEFAULT_STATUS = STATUS['AVAILABLE']; - public function setUserEntity(UserEntity $entity): ServiceEntity - { - $this->attributes['userEntity'] = $entity; - return $this; - } - public function getUSerEntity(): UserEntity - { - return $this->attributes['userEntity']; - } - public function setClientEntity(UserEntity $entity): ServiceEntity - { - $this->attributes['clientEntity'] = $entity; - return $this; - } - public function getClientEntity(): ClientEntity - { - return $this->attributes['clientEntity']; - } public function setServerEntity(ServerEntity $entity): ServiceEntity { $this->attributes['serverEntity'] = $entity; return $this; } - public function getServerEntity(): ServerEntity + final public function getServerEntity(): ServerEntity + { + return $this->attributes['paymentEntity']; + } + final public function setPaymentEntity(PaymentEntity $entity): ServiceEntity + { + $this->attributes['paymentEntity'] = $entity; + return $this; + } + final public function getPaymentEntity(): PaymentEntity { return $this->attributes['serverEntity']; } + final public function getUserUID(): string + { + return $this->attributes['user_uid']; + } + final public function getClientInfoUID(): string + { + return $this->attributes['clientinfo_uid']; + } + final public function getPaymentInfoUID(): string|null + { + return $this->attributes['payment_uid'] ?? null; + } + final public function getServerInfoUID(): string + { + return $this->attributes['serverinfo_uid']; + } + //기본기능용 + final public function getSite(): string { return $this->attributes['site'] ?? ""; diff --git a/app/Entities/Equipment/CSEntity.php b/app/Entities/Equipment/CSEntity.php index 8671b3c..cbb9f04 100644 --- a/app/Entities/Equipment/CSEntity.php +++ b/app/Entities/Equipment/CSEntity.php @@ -9,6 +9,19 @@ class CSEntity extends EquipmentEntity const PK = CSModel::PK; const TITLE = CSModel::TITLE; const DEFAULT_STATUS = STATUS['AVAILABLE']; + final public function getClientInfoUID(): string + { + return $this->attributes['clientinfo_uid']; + } + final public function getServiceInfoUID(): string + { + return $this->attributes['serviceinfo_uid']; + } + final public function getServerInfoUID(): string + { + return $this->attributes['serverinfo_uid']; + } + //기본기능 public function getPrice(): int { return $this->attributes['price']; diff --git a/app/Entities/Equipment/EquipmentEntity.php b/app/Entities/Equipment/EquipmentEntity.php index 0622695..29dc7ad 100644 --- a/app/Entities/Equipment/EquipmentEntity.php +++ b/app/Entities/Equipment/EquipmentEntity.php @@ -10,20 +10,4 @@ abstract class EquipmentEntity extends CommonEntity { parent::__construct($data); } - final public function getUserUID(): int|null - { - return $this->attributes['user_uid']; - } - final public function getClientInfoUID(): int|null - { - return $this->attributes['clientinfo_uid'] ?? null; - } - final public function getServiceInfoUID(): int|null - { - return $this->attributes['serviceinfo_uid'] ?? null; - } - final public function getServerInfoUID(): int|null - { - return $this->attributes['serverinfo_uid'] ?? null; - } } diff --git a/app/Entities/Equipment/IPEntity.php b/app/Entities/Equipment/IPEntity.php index 28e6ad9..a24503b 100644 --- a/app/Entities/Equipment/IPEntity.php +++ b/app/Entities/Equipment/IPEntity.php @@ -9,6 +9,27 @@ class IPEntity extends EquipmentEntity const PK = IPModel::PK; const TITLE = IPModel::TITLE; const DEFAULT_STATUS = STATUS['AVAILABLE']; + final public function getClientInfoUID(): string + { + return $this->attributes['clientinfo_uid']; + } + final public function getServiceInfoUID(): string + { + return $this->attributes['serviceinfo_uid']; + } + final public function getServerInfoUID(): string + { + return $this->attributes['serverinfo_uid']; + } + final public function getLineInfoUID(): string + { + return $this->attributes['lineinfo_uid']; + } + final public function getOldClientInfoUID(): string + { + return $this->attributes['old_clientinfo_uid']; + } + //기본기능 public function getIP(): string { return $this->attributes['ip']; diff --git a/app/Entities/Equipment/ServerEntity.php b/app/Entities/Equipment/ServerEntity.php index fe28961..49da456 100644 --- a/app/Entities/Equipment/ServerEntity.php +++ b/app/Entities/Equipment/ServerEntity.php @@ -9,6 +9,18 @@ class ServerEntity extends EquipmentEntity const PK = ServerModel::PK; const TITLE = ServerModel::TITLE; const DEFAULT_STATUS = STATUS['AVAILABLE']; + final public function getUserUID(): string + { + return $this->attributes['user_uid']; + } + final public function getClientInfoUID(): string + { + return $this->attributes['clientinfo_uid']; + } + final public function getServiceInfoUID(): string + { + return $this->attributes['serviceinfo_uid']; + } //기본기능용 public function getCustomTitle(): string { diff --git a/app/Entities/Equipment/ServerPartEntity.php b/app/Entities/Equipment/ServerPartEntity.php index a6bb1bd..3ee4a7b 100644 --- a/app/Entities/Equipment/ServerPartEntity.php +++ b/app/Entities/Equipment/ServerPartEntity.php @@ -2,6 +2,7 @@ namespace App\Entities\Equipment; +use App\Entities\PaymentEntity; use App\Models\Equipment\ServerPartModel; class ServerPartEntity extends EquipmentEntity @@ -13,19 +14,50 @@ class ServerPartEntity extends EquipmentEntity $this->attributes['partEntity'] = $entity; return $this; } + //여러클래스존재가능 public function getPartEntity(): mixed { return $this->attributes['partEntity'] ?? null; } - public function getPrice(): int + final public function setPaymentEntity(PaymentEntity $entity): ServerPartEntity { - return $this->getPartEntity() !== null ? $this->getPartEntity()->getPrice() : 0; + $this->attributes['paymentEntity'] = $entity; + return $this; + } + final public function getPaymentEntity(): PaymentEntity + { + return $this->attributes['paymentEntity']; } - //기본기능용 public function getPartUID(): int { return intval($this->attributes['part_uid']) ?? 0; } + final public function getUserUID(): string + { + return $this->attributes['user_uid']; + } + final public function getClientInfoUID(): string + { + return $this->attributes['clientinfo_uid']; + } + final public function getServiceInfoUID(): string + { + return $this->attributes['serviceinfo_uid']; + } + final public function getServerInfoUID(): string + { + return $this->attributes['serverinfo_uid']; + } + final public function getPaymentInfoUID(): string|null + { + return $this->attributes['payment_uid'] ?? null; + } + //기본기능용 + public function getPrice(): int + { + return $this->getPartEntity() !== null ? $this->getPartEntity()->getPrice() : 0; + } + public function getType(): string { return $this->attributes['type'] ?? ""; diff --git a/app/Entities/Equipment/SwitchEntity.php b/app/Entities/Equipment/SwitchEntity.php index 71efbb5..4c5ae9c 100644 --- a/app/Entities/Equipment/SwitchEntity.php +++ b/app/Entities/Equipment/SwitchEntity.php @@ -9,7 +9,19 @@ class SwitchEntity extends EquipmentEntity const PK = SwitchModel::PK; const TITLE = SwitchModel::TITLE; const DEFAULT_STATUS = STATUS['AVAILABLE']; - + final public function getClientInfoUID(): string + { + return $this->attributes['clientinfo_uid']; + } + final public function getServiceInfoUID(): string + { + return $this->attributes['serviceinfo_uid']; + } + final public function getServerInfoUID(): string + { + return $this->attributes['serverinfo_uid']; + } + //기본기능 public function getPrice(): int { return $this->attributes['price'] ?? 0; diff --git a/app/Entities/PaymentEntity.php b/app/Entities/PaymentEntity.php index c4ce38f..eb15ff1 100644 --- a/app/Entities/PaymentEntity.php +++ b/app/Entities/PaymentEntity.php @@ -22,6 +22,7 @@ class PaymentEntity extends CommonEntity { return $this->attributes['serviceinfo_uid'] ?? null; } + //기본기능 public function getBilling(): string { return $this->attributes['billing'] ?? ""; diff --git a/app/Interfaces/Customer/ServiceInterface.php b/app/Interfaces/Customer/ServiceInterface.php index f62a0d3..770426a 100644 --- a/app/Interfaces/Customer/ServiceInterface.php +++ b/app/Interfaces/Customer/ServiceInterface.php @@ -3,11 +3,10 @@ namespace App\Interfaces\Customer; use App\Entities\Customer\ServiceEntity; -use App\Entities\Equipment\ServerPartEntity; interface ServiceInterface extends CustomerInterface { public function createService(ServiceEntity $serviceEntity): ServiceEntity; public function modifyService(ServiceEntity $serviceEntity): ServiceEntity; - public function deleteService(ServiceEntity $serviceEntity): ServiceEntity; + public function deleteService(ServiceEntity $serviceEntitys): ServiceEntity; } diff --git a/app/Interfaces/Equipment/ServerInterface.php b/app/Interfaces/Equipment/ServerInterface.php new file mode 100644 index 0000000..e64bad0 --- /dev/null +++ b/app/Interfaces/Equipment/ServerInterface.php @@ -0,0 +1,12 @@ +getUserService()->getEntity($entity->getUserUID()); - if (!($userEntity instanceof UserEntity)) { - throw new \Exception("{$entity->getUserUID()}에 해당하는 관리자정보를 찾을수 없습니다."); - } - $entity = $entity->setUserEntity($userEntity); - //고객정보 정의 - $clientEntity = $this->getClientService()->getEntity($entity->getClientInfoUID()); - if (!($clientEntity instanceof ClientEntity)) { - throw new \Exception("{$entity->getClientInfoUID()}에 해당하는 고객정보를 찾을수 없습니다."); - } - $entity = $entity->setUserEntity($userEntity); //서버정보 정의 $serverEntity = $this->getServerService()->getEntity(['serviceinfo_uid' => $entity->getPK()]); - if (!($serverEntity instanceof ServerEntity)) { - $serverEntity = new ServerEntity(); + if ($serverEntity instanceof ServerEntity) { + $entity->setServerEntity($serverEntity); } - return $entity->setServerEntity($serverEntity); + //결제정보 정의 + $paymentEntity = $this->getPaymentService()->getEntity(['uid' => $entity->getPaymentInfoUID()]); + if ($paymentEntity instanceof PaymentEntity) { + $entity->setPaymentEntity($paymentEntity); + } + return $entity; } final public function getPaymentService(): PaymentService { @@ -229,21 +218,6 @@ class ServiceService extends CustomerService return $this->getModel()->query($sql, [$billing_at, $status]); } //월청구액 계산값 - final public function getCalculatedAmount(ServiceEntity $entity): int - { - $serverEntity = $this->getServerService()->getEntity($entity->getServerInfoUID()); - if (!$serverEntity instanceof ServerEntity) { - throw new \Exception(__METHOD__ . "에서 오류발생:[{$entity->getServerInfoUID()}]에 대한 서버정보를 찾을수 없습니다."); - } - $total_amount = $serverEntity->getPrice(); //서버금액(price) - //해당 서비스(서버) 관련 결제방식(Billing)이 Month인 ServerPart 전체를 다시 검사하여 월청구액을 합산한다. - foreach ($this->getServerPartService()->getEntities(['serverinfo_uid' => $serverEntity->getPK()]) as $serverPartEntity) { - if ($serverPartEntity->getBilling() === PAYMENT['BILLING']['MONTH']) { - $total_amount += $serverPartEntity->getAmount(); - } - } - return $total_amount; - } //기본기능 private function action_process(ServiceEntity $entity, string $action): ServiceEntity { @@ -261,7 +235,7 @@ class ServiceService extends CustomerService //신규등록 $entity = parent::create($formDatas); //월청구액계산 후 서비스정보에 수정 - $entity = parent::modify($entity, ['amount' => $this->getCalculatedAmount($entity)]); + $entity = parent::modify($entity, ['amount' => $this->getServerService()->getTotalAmount($entity->getServerInfoUID())]); $this->action_process($entity, __FUNCTION__ . 'Service'); return $entity; } @@ -277,8 +251,7 @@ class ServiceService extends CustomerService } //수정작업 //월청구액계산 후 서비스정보에 수정 - $formDatas['amount'] = $this->getCalculatedAmount($entity->getPK()); - $entity = parent::modify($entity, $formDatas); + $entity = parent::modify($entity, ['amount' => $this->getServerService()->getTotalAmount($entity->getServerInfoUID())]); $this->action_process($entity, __FUNCTION__ . 'Service'); return $entity; } diff --git a/app/Services/Equipment/CS/ServerPart.php b/app/Services/Equipment/CS/ServerPart.php index 9295121..2304723 100644 --- a/app/Services/Equipment/CS/ServerPart.php +++ b/app/Services/Equipment/CS/ServerPart.php @@ -21,7 +21,7 @@ class ServerPart extends CSService implements ServerPartInterface } //CS정보가져오기 $entity = $this->getEntity($serverPartEntity->getPartUID()); - if (!($entity instanceof CSEntity)) { + if (!$entity instanceof CSEntity) { throw new \Exception("{$serverPartEntity->getPartUID()}에 해당하는 CS정보를 찾을수없습니다."); } //CS정보 수정 diff --git a/app/Services/Equipment/IP/ServerPart.php b/app/Services/Equipment/IP/ServerPart.php index 5e4c43a..2894572 100644 --- a/app/Services/Equipment/IP/ServerPart.php +++ b/app/Services/Equipment/IP/ServerPart.php @@ -21,7 +21,7 @@ class ServerPart extends IPService implements ServerPartInterface } //IP정보가져오기 $entity = $this->getEntity($serverPartEntity->getPartUID()); - if (!($entity instanceof IPEntity)) { + if (!$entity instanceof IPEntity) { throw new \Exception("{$serverPartEntity->getPartUID()}에 해당하는 IP정보를 찾을수없습니다."); } //IP정보 수정 diff --git a/app/Services/Equipment/Part/ServerPart.php b/app/Services/Equipment/Part/ServerPart.php index 416dca9..ab5299a 100644 --- a/app/Services/Equipment/Part/ServerPart.php +++ b/app/Services/Equipment/Part/ServerPart.php @@ -18,7 +18,7 @@ class ServerPart extends PartService implements ServerPartInterface { //부품정보가져오기 $entity = $this->getEntity($serverPartEntity->getPartUID()); - if (!($entity instanceof PartEntity)) { + if (!$entity instanceof PartEntity) { throw new \Exception("{$serverPartEntity->getPartUID()}에 해당하는 부품정보를 찾을수없습니다."); } //부품정보에 서버정보 설정 및 서비스,고객정보 정의 diff --git a/app/Services/Equipment/Server/Service.php b/app/Services/Equipment/Server/Service.php index 49e1e16..b446d1a 100644 --- a/app/Services/Equipment/Server/Service.php +++ b/app/Services/Equipment/Server/Service.php @@ -20,7 +20,7 @@ class Service extends ServerService implements ServiceInterface } //서버정보 가져오기 $entity = $this->getEntity($serviceEntity->getServerInfoUID()); - if (!($entity instanceof ServerEntity)) { + if (!$entity instanceof ServerEntity) { throw new \Exception("{$serviceEntity->getServerInfoUID()}에 해당하는 서버정보를 찾을수없습니다."); } //서버정보 수정 diff --git a/app/Services/Equipment/ServerPartService.php b/app/Services/Equipment/ServerPartService.php index 9b93b99..99b5947 100644 --- a/app/Services/Equipment/ServerPartService.php +++ b/app/Services/Equipment/ServerPartService.php @@ -112,7 +112,7 @@ class ServerPartService extends EquipmentService //partEntity 정보 추가 protected function getEntity_process(mixed $entity): ServerPartEntity { - if (!($entity instanceof ServerPartEntity)) { + if (!$entity instanceof ServerPartEntity) { throw new \Exception(__METHOD__ . "에서 형식오류:ServicePartEntity만 허용됩니다."); } switch ($entity->getType()) { @@ -122,23 +122,20 @@ class ServerPartService extends EquipmentService case 'OS': case 'DB': case 'SOFTWARE': - $partService = $this->getPartService(); - $entity->setPartEntity($partService->getEntity($entity->getPartUID())); + $entity->setPartEntity($this->getPartService()->getEntity($entity->getPartUID())); break; case 'SWITCH': - $partService = $this->getSwitchService(); - $entity->setPartEntity($partService->getEntity($entity->getPartUID())); + $entity->setPartEntity($this->getSwitchService()->getEntity($entity->getPartUID())); break; case 'IP': - $partService = $this->getIPService(); - $entity->setPartEntity($partService->getEntity($entity->getPartUID())); + $entity->setPartEntity($this->getIPService()->getEntity($entity->getPartUID())); break; case 'CS': - $partService = $this->getCSService(); - $entity->setPartEntity($partService->getEntity($entity->getPartUID())); + $entity->setPartEntity($this->getCSService()->getEntity($entity->getPartUID())); break; } - return $entity; + //결제정보 정의 + return $entity->setPaymentEntity($this->getPaymentService()->getEntity(['uid' => $entity->getPaymentInfoUID()])); } //기본 기능부분 // FieldForm관련용 @@ -236,7 +233,7 @@ class ServerPartService extends EquipmentService } $serverEntity = $this->getServerService()->getEntity($formDatas['serverinfo_uid']); } - if (!($serverEntity instanceof ServerEntity)) { + if (!$serverEntity instanceof ServerEntity) { throw new \Exception("서버 정보가 지정되지 않았습니다."); } //생성작업 @@ -255,7 +252,7 @@ class ServerPartService extends EquipmentService throw new \Exception("서버 정보가 지정되지 않았습니다."); } $serverEntity = $this->getServerService()->getEntity($formDatas['serverinfo_uid']); - if (!($serverEntity instanceof ServerEntity)) { + if (!$serverEntity instanceof ServerEntity) { throw new \Exception("서버 정보가 지정되지 않았습니다."); } //수정 전 부품연결정보관련 정보처리 diff --git a/app/Services/Equipment/ServerService.php b/app/Services/Equipment/ServerService.php index 92b388d..6619571 100644 --- a/app/Services/Equipment/ServerService.php +++ b/app/Services/Equipment/ServerService.php @@ -77,11 +77,26 @@ class ServerService extends EquipmentService //partEntity 정보 추가 protected function getEntity_process(mixed $entity): ServerEntity { - if (!($entity instanceof ServerEntity)) { + if (!$entity instanceof ServerEntity) { throw new \Exception(__METHOD__ . "에서 형식오류:ServerEntity만 허용됩니다."); } return $entity; } + final public function getTotalAmount(int $uid): int + { + $entity = $this->getEntity($uid); + if (!$entity instanceof ServerEntity) { + throw new \Exception(__METHOD__ . "에서 오류발생:[{$uid}]에 대한 서버정보를 찾을수 없습니다."); + } + $total_amount = $entity->getPrice(); //서버금액(price) + //해당 서비스(서버) 관련 결제방식(Billing)이 Month인 ServerPart 전체를 다시 검사하여 월청구액을 합산한다. + foreach ($this->getServerPartService()->getEntities(['serverinfo_uid' => $entity->getPK()]) as $serverPartEntity) { + if ($serverPartEntity->getBilling() === PAYMENT['BILLING']['MONTH']) { + $total_amount += $serverPartEntity->getAmount(); + } + } + return $total_amount; + } //기본 기능부분 //FieldForm관련용 public function setFormData(string $field, array $requestDatas, array $formDatas): array diff --git a/app/Services/Equipment/Switch/ServerPart.php b/app/Services/Equipment/Switch/ServerPart.php index 8e39a34..b2a6ad4 100644 --- a/app/Services/Equipment/Switch/ServerPart.php +++ b/app/Services/Equipment/Switch/ServerPart.php @@ -21,7 +21,7 @@ class ServerPart extends SwitchService implements ServerPartInterface } //스위치정보가져오기 $entity = $this->getEntity($serverPartEntity->getPartUID()); - if (!($entity instanceof SwitchEntity)) { + if (!$entity instanceof SwitchEntity) { throw new \Exception("{$serverPartEntity->getPartUID()}에 해당하는 스위치정보를 찾을수없습니다."); } //스위치정보 수정 diff --git a/app/Services/Payment/ServerPart.php b/app/Services/Payment/ServerPart.php index aadca84..0bb5b6a 100644 --- a/app/Services/Payment/ServerPart.php +++ b/app/Services/Payment/ServerPart.php @@ -5,25 +5,15 @@ namespace App\Services\Payment; 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 action_process(ServerPartEntity $serverPartEntity): array { if ($serverPartEntity->getServiceInfoUID() === null) { @@ -38,7 +28,6 @@ class ServerPart extends PaymentService implements ServerPartInterface $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(); @@ -52,8 +41,9 @@ class ServerPart extends PaymentService implements ServerPartInterface //당일결체일로 설정 $formDatas['billing_at'] = date("Y-m-d"); //결제정보등록 - $this->create($formDatas); - return $serverPartEntity; + $entity = $this->create($formDatas); + //서버연결정보 Entity에 결제정보 설정 + return $serverPartEntity->setPaymentEntity($entity); } public function modifyServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity { @@ -65,8 +55,9 @@ class ServerPart extends PaymentService implements ServerPartInterface //필수정보처리 후 FormData 가져오기 $formDatas = $this->action_process($serverPartEntity); //결제정보수정 - $this->modify($entity, $formDatas); - return $serverPartEntity; + $entity = $this->modify($entity, $formDatas); + //서버연결정보 Entity에 결제정보 설정 + return $serverPartEntity->setPaymentEntity($entity); } public function deleteServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity diff --git a/app/Services/Payment/Service.php b/app/Services/Payment/Service.php index bb6ce11..fd5c303 100644 --- a/app/Services/Payment/Service.php +++ b/app/Services/Payment/Service.php @@ -2,12 +2,12 @@ namespace App\Services\Payment; -use App\Services\Customer\ServiceService; -use App\Interfaces\Customer\ServiceInterface; -use App\Entities\PaymentEntity; use App\Entities\Customer\ServiceEntity; +use App\Entities\PaymentEntity; +use App\Interfaces\Customer\ServiceInterface; +use App\Services\PaymentService; -class Service extends ServiceService implements ServiceInterface +class Service extends PaymentService implements ServiceInterface { public function __construct() { @@ -27,8 +27,9 @@ class Service extends ServiceService implements ServiceInterface public function createService(ServiceEntity $serviceEntity): ServiceEntity { //필수정보처리 후 결제정보등록 - $this->create($this->action_process($serviceEntity)); - return $serviceEntity; + $entity = $this->create($this->action_process($serviceEntity)); + //서비스정보 Entity에 결제정보 설정 + return $serviceEntity->setPaymentEntity($entity); } public function modifyService(ServiceEntity $serviceEntity): ServiceEntity { @@ -38,8 +39,9 @@ class Service extends ServiceService implements ServiceInterface throw new \Exception(__METHOD__ . "에서 오류발생: {$serviceEntity->getPK()}에 해당하는 결제정보를 찾을수 없습니다."); } //필수정보처리 후 결제정보수정 - $this->modify($entity, $this->action_process($serviceEntity)); - return $serviceEntity; + $entity = $this->modify($entity, $this->action_process($serviceEntity)); + //서비스정보 Entity에 결제정보 설정 + return $serviceEntity->setPaymentEntity($entity); } public function deleteService(ServiceEntity $serviceEntity): ServiceEntity {