diff --git a/app/Cells/Equipment/PartCell.php b/app/Cells/Part/DISKCell.php similarity index 58% rename from app/Cells/Equipment/PartCell.php rename to app/Cells/Part/DISKCell.php index 737de66..c7748ec 100644 --- a/app/Cells/Equipment/PartCell.php +++ b/app/Cells/Part/DISKCell.php @@ -2,29 +2,28 @@ namespace App\Cells\Equipment; -use App\Services\Equipment\PartService; +use App\Services\Part\DISKService; -class PartCell extends EquipmentCell +class DISKCell extends EquipmentCell { public function __construct() { - parent::__construct(new PartService()); + parent::__construct(new DISKService()); } - public function parttable(array $params): string + public function stock(array $params): string { $this->getService()->setAction(__FUNCTION__); $this->getService()->setFormFields(); $this->getService()->setFormFilters(); $this->getService()->setFormRules(); $this->getService()->setFormOptions(); - $types = array_key_exists('types', $params) ? $params['types'] : SERVERPART['STOCK_PARTTYPES']; - $template = array_key_exists('template', $params) ? $params['template'] : __FUNCTION__; + $template = array_key_exists('template', $params) ? $params['template'] : 'disk_stock'; return view('cells/part/' . $template, [ 'partCellDatas' => [ 'control' => $this->getService()->getControlDatas(), 'service' => $this->getService(), - 'entities' => $this->getService()->getEntities("type IN (" . "'" . implode("','", $types) . "'" . ")"), + 'entities' => $this->getService()->getEntities(), ], ]); } diff --git a/app/Cells/Part/RAMCell.php b/app/Cells/Part/RAMCell.php new file mode 100644 index 0000000..dd5175d --- /dev/null +++ b/app/Cells/Part/RAMCell.php @@ -0,0 +1,30 @@ +getService()->setAction(__FUNCTION__); + $this->getService()->setFormFields(); + $this->getService()->setFormFilters(); + $this->getService()->setFormRules(); + $this->getService()->setFormOptions(); + $template = array_key_exists('template', $params) ? $params['template'] : 'ram_stock'; + return view('cells/part/' . $template, [ + 'partCellDatas' => [ + 'control' => $this->getService()->getControlDatas(), + 'service' => $this->getService(), + 'entities' => $this->getService()->getEntities(), + ], + ]); + } +} diff --git a/app/Config/Constants.php b/app/Config/Constants.php index 6bcbf12..98d6182 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -234,7 +234,7 @@ define('ICONS', [ 'SERVER_ITEM_CPU' => '', 'SERVER_ITEM_RAM' => '', 'SERVER_ITEM_DISK' => '', - 'SERVER_ITEM_SWITCH' => '', + 'SERVER_ITEM_Switch' => '', 'SERVER_ITEM_OS' => '', 'SERVER_ITEM_DB' => '', 'SERVER_ITEM_SOFTWARE' => '', @@ -404,7 +404,7 @@ define("SERVICE", [ //서버파트 관련 define("SERVERPART", [ "CNT_RANGE" => array_combine(range(1, 10), range(1, 10)), - "STOCK_PARTTYPES" => ['CPU', 'RAM', 'DISK'], + "STOCK_PARTTYPES" => ['RAM', 'DISK'], "SERVER_PARTTYPES" => ['CPU', 'RAM', 'DISK'], "SERVICE_PARTTYPES" => ['Switch', 'IP', 'OS', 'SOFTWARE', 'CS'], "ALL_PARTTYPES" => ['CPU', 'RAM', 'DISK', 'OS', 'SOFTWARE', 'Switch', 'IP', 'CS'], diff --git a/app/Controllers/Admin/Customer/ClientController.php b/app/Controllers/Admin/Customer/ClientController.php index 980bdc8..67efc66 100644 --- a/app/Controllers/Admin/Customer/ClientController.php +++ b/app/Controllers/Admin/Customer/ClientController.php @@ -29,22 +29,6 @@ class ClientController extends CustomerController return $this->_service; } //Index,FieldForm관련 - //생성관련 - protected function create_process(array $formDatas): ClientEntity - { - //생성 전처리, 관리자 UID는 현재 인증된 사용자로 설정 - $formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo(); - //생성처리 - return parent::create_process($formDatas); - } - //수정관련 - protected function modify_process(mixed $entity, array $formDatas): ClientEntity - { - //수정 전처리, 관리자 UID는 현재 인증된 사용자로 설정 - $formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo(); - //수정처리 - return parent::modify_process($entity, $formDatas); - } protected function doValidation(Validation $validation, string $field, string $rule): Validation { switch ($field) { diff --git a/app/Controllers/Admin/Customer/CouponController.php b/app/Controllers/Admin/Customer/CouponController.php index 5e191b2..4c342e9 100644 --- a/app/Controllers/Admin/Customer/CouponController.php +++ b/app/Controllers/Admin/Customer/CouponController.php @@ -29,17 +29,4 @@ class CouponController extends CustomerController return $this->_service; } //Index,FieldForm관련. - protected function create_process(array $formDatas): CouponEntity - { - // 관리자 UID는 현재 인증된 사용자로 설정 - $formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo(); - return parent::create_process($formDatas); - } - //수정관련 - protected function modify_process(mixed $entity, array $formDatas): CouponEntity - { - // 관리자 UID는 현재 인증된 사용자로 설정 - $formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo(); - return parent::modify_process($entity, $formDatas); - } } diff --git a/app/Controllers/Admin/Customer/PaymentController.php b/app/Controllers/Admin/Customer/PaymentController.php index af310d5..f1f3796 100644 --- a/app/Controllers/Admin/Customer/PaymentController.php +++ b/app/Controllers/Admin/Customer/PaymentController.php @@ -59,20 +59,6 @@ class PaymentController extends CustomerController return $result; } //Index,FieldForm관련 - //생성관련 - protected function create_process(array $formDatas): PaymentEntity - { - // 관리자 UID는 현재 인증된 사용자로 설정 - $formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo(); - return parent::create_process($formDatas); - } - //수정관련 - protected function modify_process(mixed $entity, array $formDatas): PaymentEntity - { - // 관리자 UID는 현재 인증된 사용자로 설정 - $formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo(); - return parent::modify_process($entity, $formDatas); - } //Invoice 관련 private function invoice_process(): array { diff --git a/app/Controllers/Admin/Customer/PointController.php b/app/Controllers/Admin/Customer/PointController.php index efcb3ee..8873be3 100644 --- a/app/Controllers/Admin/Customer/PointController.php +++ b/app/Controllers/Admin/Customer/PointController.php @@ -29,17 +29,4 @@ class PointController extends CustomerController return $this->_service; } //Index,FieldForm관련. - protected function create_process(array $formDatas): PointEntity - { - // 관리자 UID는 현재 인증된 사용자로 설정 - $formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo(); - return parent::create_process($formDatas); - } - //수정관련 - protected function modify_process(mixed $entity, array $formDatas): PointEntity - { - // 관리자 UID는 현재 인증된 사용자로 설정 - $formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo(); - return parent::modify_process($entity, $formDatas); - } } diff --git a/app/Controllers/Admin/Customer/ServiceController.php b/app/Controllers/Admin/Customer/ServiceController.php index ba594bb..1adf854 100644 --- a/app/Controllers/Admin/Customer/ServiceController.php +++ b/app/Controllers/Admin/Customer/ServiceController.php @@ -78,19 +78,6 @@ class ServiceController extends CustomerController $this->getService()->setFormDatas($formDatas); parent::create_form_process(); } - protected function create_process(array $formDatas): ServiceEntity - { - // 관리자 UID는 현재 인증된 사용자로 설정 - $formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo(); - return parent::create_process($formDatas); - } - //수정관련 - protected function modify_process(mixed $entity, array $formDatas): ServiceEntity - { - // 관리자 UID는 현재 인증된 사용자로 설정 - $formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo(); - return parent::modify_process($entity, $formDatas); - } //List 관련 protected function index_process(array $entities = []): array { diff --git a/app/Entities/Equipment/ServerPartEntity.php b/app/Entities/Equipment/ServerPartEntity.php index eee9018..a75059d 100644 --- a/app/Entities/Equipment/ServerPartEntity.php +++ b/app/Entities/Equipment/ServerPartEntity.php @@ -57,7 +57,7 @@ class ServerPartEntity extends EquipmentEntity { return $this->getPartEntity() !== null ? $this->getPartEntity()->getPrice() : 0; } - public function getCaculatedAmount(): int + public function getTotalAmount(): int { return $this->getAmount() * $this->getCnt(); } diff --git a/app/Models/CommonModel.php b/app/Models/CommonModel.php index ac2ebda..37a01aa 100644 --- a/app/Models/CommonModel.php +++ b/app/Models/CommonModel.php @@ -3,10 +3,10 @@ namespace App\Models; use CodeIgniter\Model; -use App\Libraries\LogCollector; abstract class CommonModel extends Model { + private $_myAuth = null; protected $table = ''; protected $primaryKey = ''; protected $useAutoIncrement = true; @@ -65,6 +65,13 @@ abstract class CommonModel extends Model // protected $beforeInsert = ['generateUUID']; // allowedFields에는 PK넣으면 않됨, Column Type: CHAR(36) // + final public function getMyAuth(): mixed + { + if (!$this->_myAuth) { + $this->_myAuth = service('myauth'); + } + return $this->_myAuth; + } final protected function generateUUID(): string { $data = random_bytes(16); @@ -73,12 +80,6 @@ abstract class CommonModel extends Model $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // variant 10 return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); } - // final public function getLastestCode(string $format, int $default): string - // { - // $entity = $this->selectMax($this->primaryKey)->first(); - // $pk = (int) ($entity->getPK() ?? $default); // 정수로 강제 변환 - // return sprintf($format, date('ymd'), $pk + 1); - // } public function getFormRule(string $action, string $field): string { if (is_array($field)) { diff --git a/app/Models/Customer/AccountModel.php b/app/Models/Customer/AccountModel.php index 33a75f0..c61e377 100644 --- a/app/Models/Customer/AccountModel.php +++ b/app/Models/Customer/AccountModel.php @@ -53,4 +53,18 @@ class AccountModel extends CustomerModel } return $rule; } + + final public function create(array $formDatas): AccountEntity + { + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); + return parent::create($formDatas); + } + //수정 + final public function modify(mixed $entity, array $formDatas): AccountEntity + { + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); + return parent::modify($entity, $formDatas); + } } diff --git a/app/Models/Customer/ClientModel.php b/app/Models/Customer/ClientModel.php index a9fc735..350a1ef 100644 --- a/app/Models/Customer/ClientModel.php +++ b/app/Models/Customer/ClientModel.php @@ -68,9 +68,18 @@ class ClientModel extends CustomerModel return $rule; } //입력전 코드처리 - public function create(array $formDatas): ClientEntity + final public function create(array $formDatas): ClientEntity { $formDatas['code'] = $formDatas['site'] . "_c" . uniqid(); + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); return parent::create($formDatas); } + //수정 + final public function modify(mixed $entity, array $formDatas): ClientEntity + { + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); + return parent::modify($entity, $formDatas); + } } diff --git a/app/Models/Customer/CouponModel.php b/app/Models/Customer/CouponModel.php index c78219f..362de58 100644 --- a/app/Models/Customer/CouponModel.php +++ b/app/Models/Customer/CouponModel.php @@ -45,4 +45,17 @@ class CouponModel extends CustomerModel } return $rule; } + final public function create(array $formDatas): CouponEntity + { + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); + return parent::create($formDatas); + } + //수정 + final public function modify(mixed $entity, array $formDatas): CouponEntity + { + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); + return parent::modify($entity, $formDatas); + } } diff --git a/app/Models/Customer/PointModel.php b/app/Models/Customer/PointModel.php index 0a07539..f66e998 100644 --- a/app/Models/Customer/PointModel.php +++ b/app/Models/Customer/PointModel.php @@ -45,4 +45,17 @@ class PointModel extends CustomerModel } return $rule; } + final public function create(array $formDatas): PointEntity + { + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); + return parent::create($formDatas); + } + //수정 + final public function modify(mixed $entity, array $formDatas): PointEntity + { + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); + return parent::modify($entity, $formDatas); + } } diff --git a/app/Models/Customer/ServiceModel.php b/app/Models/Customer/ServiceModel.php index c892b8e..921968e 100644 --- a/app/Models/Customer/ServiceModel.php +++ b/app/Models/Customer/ServiceModel.php @@ -77,9 +77,18 @@ class ServiceModel extends CustomerModel return $rule; } //입력전 코드처리 - public function create(array $formDatas): ServiceEntity + final public function create(array $formDatas): ServiceEntity { $formDatas['code'] = $formDatas['site'] . "_s" . uniqid(); + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); return parent::create($formDatas); } + //수정 + final public function modify(mixed $entity, array $formDatas): ServiceEntity + { + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); + return parent::modify($entity, $formDatas); + } } diff --git a/app/Models/PaymentModel.php b/app/Models/PaymentModel.php index 151f6e7..98e6acc 100644 --- a/app/Models/PaymentModel.php +++ b/app/Models/PaymentModel.php @@ -61,4 +61,18 @@ class PaymentModel extends CommonModel } return $rule; } + + final public function create(array $formDatas): PaymentEntity + { + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); + return parent::create($formDatas); + } + //수정 + final public function modify(mixed $entity, array $formDatas): PaymentEntity + { + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); + return parent::modify($entity, $formDatas); + } } diff --git a/app/Services/CommonService.php b/app/Services/CommonService.php index 6f3d6f2..d00da43 100644 --- a/app/Services/CommonService.php +++ b/app/Services/CommonService.php @@ -142,7 +142,7 @@ abstract class CommonService $this->setControlDatas('field_optons', $options); } //Entity별로 작업처리시 - protected function getEntity_process(object $entity): mixed + protected function getEntity_process(mixed $entity): mixed { return $entity; } diff --git a/app/Services/Customer/AccountService.php b/app/Services/Customer/AccountService.php index 06d4950..4f3f036 100644 --- a/app/Services/Customer/AccountService.php +++ b/app/Services/Customer/AccountService.php @@ -65,19 +65,9 @@ class AccountService extends CustomerService //생성 public function create(array $formDatas): AccountEntity { - // 관리자 UID는 현재 인증된 사용자로 설정 - $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); $this->setBalance($formDatas); return parent::create($formDatas); } - //수정 - public function modify(mixed $entity, array $formDatas): AccountEntity - { - // 관리자 UID는 현재 인증된 사용자로 설정 - $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); - $this->setBalance($formDatas); - return parent::modify($entity, $formDatas); - } //List 검색용 public function index_condition_filterWord(string $word): void { diff --git a/app/Services/Customer/Service/PaymentService.php b/app/Services/Customer/Service/PaymentService.php index b8862b4..ca7bd07 100644 --- a/app/Services/Customer/Service/PaymentService.php +++ b/app/Services/Customer/Service/PaymentService.php @@ -28,7 +28,7 @@ class PaymentService extends ParentService implements ServiceInterface public function createService(ServiceEntity $serviceEntity): ServiceEntity { //필수정보처리 후 결제정보등록 - $entity = parent::create($this->action_process($serviceEntity)); + $entity = $this->getModel()->create($this->action_process($serviceEntity)); //서비스정보 Entity에 결제정보 설정 return $serviceEntity->setPaymentEntity($entity); } @@ -44,7 +44,7 @@ class PaymentService extends ParentService implements ServiceInterface throw new \Exception(__METHOD__ . "에서 오류발생: 완료된 결제는 수정이 불가합니다."); } //필수정보처리 후 결제정보수정 - $entity = parent::modify($entity, $this->action_process($serviceEntity)); + $entity = $this->getModel()->modify($entity, $this->action_process($serviceEntity)); //서비스정보 Entity에 결제정보 설정 return $serviceEntity->setPaymentEntity($entity); } diff --git a/app/Services/Customer/Service/ServerService.php b/app/Services/Customer/Service/ServerService.php index 2cb5c0a..78b439b 100644 --- a/app/Services/Customer/Service/ServerService.php +++ b/app/Services/Customer/Service/ServerService.php @@ -13,7 +13,6 @@ class ServerService extends ParentService implements ServiceInterface { parent::__construct(); } - private function action_process(ServiceEntity $serviceEntity, array $formDatas = []): ServerEntity { if (!array_key_exists('status', $formDatas)) { @@ -25,7 +24,7 @@ class ServerService extends ParentService implements ServiceInterface throw new \Exception(__METHOD__ . "에서 오류발생: 서비스정보[{$serviceEntity->getPK()}]에 해당하는 서버정보를 찾을수없습니다."); } //서버정보 수정 - return parent::modify($entity, $formDatas); + return $this->getModel()->modify($entity, $formDatas); } public function createService(ServiceEntity $serviceEntity): ServiceEntity { diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php index a741790..7eff8e9 100644 --- a/app/Services/Customer/ServiceService.php +++ b/app/Services/Customer/ServiceService.php @@ -212,20 +212,16 @@ class ServiceService extends CustomerService ) WHERE billing_at = ? AND status = ?"; return $this->getModel()->query($sql, [$billing_at, $status]); } - final public function getCaculatedAmount(int $uid): int + final public function getCaculatedAmount(ServiceEntity $entity): int { - $entity = $this->getEntity($uid); - if (!$entity instanceof ServiceEntity) { - throw new \Exception(__METHOD__ . "에서 오류발생:[{$uid}]에 대한 서비스정보를 찾을수 없습니다."); - } - $summary_amount = $entity->getRack() + $entity->getLine() + $entity->getServerEntity()->getPrice(); //기본:상면비+회선비+서버금액(price)+서버파트연결(월비용) + $caculatedAmount = $entity->getRack() + $entity->getLine() + $entity->getServerEntity()->getPrice(); //기본:상면비+회선비+서버금액(price)+서버파트연결(월비용) //해당 서비스(서버) 관련 결제방식(Billing)이 Month인 ServerPart 전체를 다시 검사하여 월청구액을 합산한다. foreach ($this->getServerPartService()->getEntities(['serverinfo_uid' => $entity->getServerEntity()->getPK()]) as $serverPartEntity) { if ($serverPartEntity->getBilling() === PAYMENT['BILLING']['MONTH']) { //월비용일때만 적용 - $summary_amount += $serverPartEntity->getCaculatedAmount(); //단가*Cnt + $caculatedAmount += $serverPartEntity->getTotalAmount(); //단가*Cnt } } - return $summary_amount; + return $caculatedAmount; } //기본 기능부분 //FieldForm관련용 @@ -280,10 +276,7 @@ class ServiceService extends CustomerService $entity->getServerService()->deleteService($entity); } //수정작업(월청구액계산 확인 후 서비스정보에 수정) - $entity = parent::modify( - $entity, - ['amount' => $this->getCaculatedAmount($entity->getPK())] - ); + $entity = parent::modify($entity, ['amount' => $this->getCaculatedAmount($entity)]); //후처리작업 return $this->action_process($entity, __FUNCTION__ . 'Service'); } diff --git a/app/Services/Equipment/Server/ServerPartService.php b/app/Services/Equipment/Server/ServerPartService.php index a86d177..4fef878 100644 --- a/app/Services/Equipment/Server/ServerPartService.php +++ b/app/Services/Equipment/Server/ServerPartService.php @@ -28,7 +28,7 @@ class ServerPartService extends ParentService implements ServerInterface { //기존 ServerPart정보 삭제 foreach ($this->getEntities(['serverinfo_uid' => $serverEntity->getPK()]) as $serverPartEntity) { - parent::delete($serverPartEntity); + $this->getModel()->delete($serverPartEntity); } return $serverEntity; } diff --git a/app/Services/Equipment/Server/ServiceService.php b/app/Services/Equipment/Server/ServiceService.php index c162fca..6f61a80 100644 --- a/app/Services/Equipment/Server/ServiceService.php +++ b/app/Services/Equipment/Server/ServiceService.php @@ -22,7 +22,7 @@ class ServiceService extends ParentService implements ServerInterface throw new \Exception("[{$serverEntity->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다."); } //서비스금액은 modify 함수내에서 재계산을 하므로 여기서는 modify만 호출함 - return parent::modify($entity, []); + return $this->getModel()->modify($entity, []); } public function createServer(ServerEntity $serverEntity): ServerEntity { diff --git a/app/Services/Equipment/ServerPart/CPUService.php b/app/Services/Equipment/ServerPart/CPUService.php index ed0f594..3640662 100644 --- a/app/Services/Equipment/ServerPart/CPUService.php +++ b/app/Services/Equipment/ServerPart/CPUService.php @@ -33,7 +33,7 @@ class CPUService extends ParentService implements ServerPartInterface } $formDatas['stock'] = $entity->getStock() - $serverPartEntity->getCnt(); } - return parent::modify($entity, $formDatas); + return $this->getModel()->modify($entity, $formDatas); } public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity diff --git a/app/Services/Equipment/ServerPart/CSService.php b/app/Services/Equipment/ServerPart/CSService.php index 467e2d9..646dee2 100644 --- a/app/Services/Equipment/ServerPart/CSService.php +++ b/app/Services/Equipment/ServerPart/CSService.php @@ -26,7 +26,7 @@ class CSService extends ParentService implements ServerPartInterface throw new \Exception("{$serverPartEntity->getPartUID()}에 해당하는 CS정보를 찾을수없습니다."); } //CS정보 수정 - return parent::modify($entity, $formDatas); + return $this->getModel()->modify($entity, $formDatas); } public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity { diff --git a/app/Services/Equipment/ServerPart/DISKService.php b/app/Services/Equipment/ServerPart/DISKService.php index 55b9ab5..77d35a2 100644 --- a/app/Services/Equipment/ServerPart/DISKService.php +++ b/app/Services/Equipment/ServerPart/DISKService.php @@ -33,7 +33,7 @@ class DISKService extends ParentService implements ServerPartInterface } $formDatas['stock'] = $entity->getStock() - $serverPartEntity->getCnt(); } - return parent::modify($entity, $formDatas); + return $this->getModel()->modify($entity, $formDatas); } public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity diff --git a/app/Services/Equipment/ServerPart/IPService.php b/app/Services/Equipment/ServerPart/IPService.php index 36b9451..c9512c3 100644 --- a/app/Services/Equipment/ServerPart/IPService.php +++ b/app/Services/Equipment/ServerPart/IPService.php @@ -26,7 +26,7 @@ class IPService extends ParentService implements ServerPartInterface throw new \Exception("{$serverPartEntity->getPartUID()}에 해당하는 IP정보를 찾을수없습니다."); } //IP정보 수정 - return parent::modify($entity, $formDatas); + return $this->getModel()->modify($entity, $formDatas); } public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity { diff --git a/app/Services/Equipment/ServerPart/OSService.php b/app/Services/Equipment/ServerPart/OSService.php index 9a89061..38edec1 100644 --- a/app/Services/Equipment/ServerPart/OSService.php +++ b/app/Services/Equipment/ServerPart/OSService.php @@ -33,7 +33,7 @@ class OSService extends ParentService implements ServerPartInterface } $formDatas['stock'] = $entity->getStock() - $serverPartEntity->getCnt(); } - return parent::modify($entity, $formDatas); + return $this->getModel()->modify($entity, $formDatas); } public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity diff --git a/app/Services/Equipment/ServerPart/PaymentService.php b/app/Services/Equipment/ServerPart/PaymentService.php index 310374c..2c0e82d 100644 --- a/app/Services/Equipment/ServerPart/PaymentService.php +++ b/app/Services/Equipment/ServerPart/PaymentService.php @@ -29,7 +29,7 @@ class PaymentService extends ParentService implements ServerPartInterface $formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID(); //서버연결정보 수정시에 필요함 //타이틀은 기타의 경우 직접작성한 제목을 등록하고 아닌경우는 Part의 Title을 사용한다. $formDatas['title'] = $serverPartEntity->getPartEntity()->getTitle(); - $formDatas['amount'] = $serverPartEntity->getCaculatedAmount(); //단가*cnt + $formDatas['amount'] = $serverPartEntity->getTotalAmount(); //단가*cnt $formDatas['billing'] = $serverPartEntity->getBilling(); return $formDatas; } @@ -40,7 +40,7 @@ class PaymentService extends ParentService implements ServerPartInterface //당일결체일로 설정 $formDatas['billing_at'] = date("Y-m-d"); //결제정보등록 - $entity = parent::create($formDatas); + $entity = $this->getModel()->create($formDatas); //서버연결정보 Entity에 결제정보 설정 return $serverPartEntity->setPaymentEntity($entity); } @@ -58,7 +58,7 @@ class PaymentService extends ParentService implements ServerPartInterface //필수정보처리 후 FormData 가져오기 $formDatas = $this->action_process($serverPartEntity); //결제정보수정 - $entity = parent::modify($entity, $formDatas); + $entity = $this->getModel()->modify($entity, $formDatas); //서버연결정보 Entity에 결제정보 설정 return $serverPartEntity->setPaymentEntity($entity); } diff --git a/app/Services/Equipment/ServerPart/RAMService.php b/app/Services/Equipment/ServerPart/RAMService.php index a1401a5..f34347b 100644 --- a/app/Services/Equipment/ServerPart/RAMService.php +++ b/app/Services/Equipment/ServerPart/RAMService.php @@ -33,7 +33,7 @@ class RAMService extends ParentService implements ServerPartInterface } $formDatas['stock'] = $entity->getStock() - $serverPartEntity->getCnt(); } - return parent::modify($entity, $formDatas); + return $this->getModel()->modify($entity, $formDatas); } public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity diff --git a/app/Services/Equipment/ServerPart/SOFTWAREService.php b/app/Services/Equipment/ServerPart/SOFTWAREService.php index bdd3f46..d028405 100644 --- a/app/Services/Equipment/ServerPart/SOFTWAREService.php +++ b/app/Services/Equipment/ServerPart/SOFTWAREService.php @@ -33,7 +33,7 @@ class SOFTWAREService extends ParentService implements ServerPartInterface } $formDatas['stock'] = $entity->getStock() - $serverPartEntity->getCnt(); } - return parent::modify($entity, $formDatas); + return $this->getModel()->modify($entity, $formDatas); } public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity diff --git a/app/Services/Equipment/ServerPart/ServiceService.php b/app/Services/Equipment/ServerPart/ServiceService.php index f4cf2d6..3adb323 100644 --- a/app/Services/Equipment/ServerPart/ServiceService.php +++ b/app/Services/Equipment/ServerPart/ServiceService.php @@ -22,7 +22,7 @@ class ServiceService extends ParentService implements ServerPartInterface throw new \Exception("[{$serverPartEntity->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다."); } //서비스금액은 modify 함수내에서 재계산을 하므로 여기서는 modify만 호출함 - return parent::modify($entity, []); + return $this->getModel()->modify($entity, []); } public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity { diff --git a/app/Services/Equipment/ServerPart/SwitchService.php b/app/Services/Equipment/ServerPart/SwitchService.php index 561e5bd..1cd9ab4 100644 --- a/app/Services/Equipment/ServerPart/SwitchService.php +++ b/app/Services/Equipment/ServerPart/SwitchService.php @@ -26,7 +26,7 @@ class SwitchService extends ParentService implements ServerPartInterface throw new \Exception("{$serverPartEntity->getPartUID()}에 해당하는 Switch정보를 찾을수없습니다."); } //Switch정보 수정 - return parent::modify($entity, $formDatas); + return $this->getModel()->modify($entity, $formDatas); } public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity { diff --git a/app/Services/PaymentService.php b/app/Services/PaymentService.php index a359a06..ee6bf32 100644 --- a/app/Services/PaymentService.php +++ b/app/Services/PaymentService.php @@ -131,20 +131,6 @@ class PaymentService extends CommonService return $options; } //Action 기능 - //생성 - final public function create(array $formDatas): PaymentEntity - { - // 관리자 UID는 현재 인증된 사용자로 설정 - $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); - return parent::create($formDatas); - } - //수정 - final public function modify(mixed $entity, array $formDatas): PaymentEntity - { - // 관리자 UID는 현재 인증된 사용자로 설정 - $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); - return parent::modify($entity, $formDatas); - } //List 검색용 //OrderBy 처리 final public function setOrderBy(mixed $field = null, mixed $value = null): void diff --git a/app/Views/admin/welcome/stock.php b/app/Views/admin/welcome/stock.php index 1b7ca7e..9ea0d1d 100644 --- a/app/Views/admin/welcome/stock.php +++ b/app/Views/admin/welcome/stock.php @@ -8,6 +8,9 @@
| = $partCellDatas['service']->getHelper()->getFieldView($field, $entity->$field, $partCellDatas) ?> | - - - - -