dbmsv2 init...1

This commit is contained in:
choi.jh 2025-09-22 10:32:24 +09:00
parent 2eccd6d67c
commit 6215425f05
29 changed files with 411 additions and 171 deletions

View File

@ -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()]);

View File

@ -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": {},

View File

@ -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'];
}
//기본기능
}

View File

@ -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'] ?? "";

View File

@ -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'];
}
//기본기능
}

View File

@ -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;
}
}

View File

@ -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'];
}
//기본기능
}

View File

@ -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'] ?? "";

View File

@ -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'];

View File

@ -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;
}
}

View File

@ -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'];

View File

@ -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
{

View File

@ -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'] ?? "";

View File

@ -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;

View File

@ -22,6 +22,7 @@ class PaymentEntity extends CommonEntity
{
return $this->attributes['serviceinfo_uid'] ?? null;
}
//기본기능
public function getBilling(): string
{
return $this->attributes['billing'] ?? "";

View File

@ -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;
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Interfaces\Equipment;
use App\Entities\Equipment\ServerEntity;
interface ServerInterface extends EquipmentInterface
{
public function setServer(ServerPartEntity $serverPartEntity): ServerPartEntity;
public function modifServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity;
public function deleteServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity;
}

View File

@ -17,6 +17,7 @@ class ServiceModel extends CustomerModel
protected $allowedFields = [
"user_uid",
"clientinfo_uid",
"payment_uid",
"code",
"site",
"location",
@ -48,6 +49,9 @@ class ServiceModel extends CustomerModel
case "line":
$rule = "required|numeric";
break;
case "payment_uid":
$rule = "permit_empty|numeric";
break;
case "site":
case "type":
case "location":

View File

@ -17,6 +17,7 @@ class ServerPartModel extends EquipmentModel
"clientinfo_uid",
"serverinfo_uid",
"serviceinfo_uid",
"payment_uid",
"title",
"type",
"billing",
@ -43,6 +44,7 @@ class ServerPartModel extends EquipmentModel
case "part_uid":
case "clientinfo_uid":
case "serviceinfo_uid":
case "payment_uid":
$rule = "permit_empty|numeric";
break;
case "title":

View File

@ -2,21 +2,17 @@
namespace App\Services\Customer;
use App\Traits\IPTrait;
use App\Services\Payment\Service as PaymentService;
use App\Entities\Customer\ServiceEntity;
use App\Entities\Equipment\ServerEntity;
use App\Entities\PaymentEntity;
use App\Helpers\Customer\ServiceHelper;
use App\Models\Customer\ServiceModel;
use App\Services\Equipment\Server\Service as ServerService;
use App\Services\Equipment\ServerPartService;
use App\Models\Customer\ServiceModel;
use App\Helpers\Customer\ServiceHelper;
use App\Entities\UserEntity;
use App\Entities\PaymentEntity;
use App\Entities\Equipment\ServerEntity;
use App\Entities\Customer\ServiceEntity;
use App\Entities\Customer\ClientEntity;
use App\Services\Payment\Service as PaymentService;
class ServiceService extends CustomerService
{
use IPTrait;
private ?ServerService $_serverService = null;
private ?PaymentService $_paymentService = null;
private ?ServerPartService $_serverPartService = null;
@ -103,27 +99,20 @@ class ServiceService extends CustomerService
}
protected function getEntity_process(mixed $entity): ServiceEntity
{
if (!($entity instanceof ServiceEntity)) {
if (!$entity instanceof ServiceEntity) {
throw new \Exception(__METHOD__ . "에서 형식오류:ServiceEntity만 허용됩니다.");
}
//관리자정보 정의
$userEntity = $this->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;
}

View File

@ -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정보 수정

View File

@ -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정보 수정

View File

@ -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()}에 해당하는 부품정보를 찾을수없습니다.");
}
//부품정보에 서버정보 설정 및 서비스,고객정보 정의

View File

@ -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()}에 해당하는 서버정보를 찾을수없습니다.");
}
//서버정보 수정

View File

@ -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("서버 정보가 지정되지 않았습니다.");
}
//수정 전 부품연결정보관련 정보처리

View File

@ -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

View File

@ -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()}에 해당하는 스위치정보를 찾을수없습니다.");
}
//스위치정보 수정

View File

@ -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

View File

@ -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
{