diff --git a/app/Entities/CommonEntity.php b/app/Entities/CommonEntity.php index f4b16bf..8a77a95 100644 --- a/app/Entities/CommonEntity.php +++ b/app/Entities/CommonEntity.php @@ -24,10 +24,9 @@ abstract class CommonEntity extends Entity $field = constant("static::TITLE"); return $this->attributes[$field] ?? ""; } - final public function getTitleByFormat(string $format, array $fields): string + public function getCustomTitle(): string { - $parameters = array_map(fn($field) => $this->attributes[$field], $fields); - return sprintf($format, ...$parameters); + return $this->getTitle(); } public function getStatus(): string { diff --git a/app/Entities/Equipment/ServerPartEntity.php b/app/Entities/Equipment/ServerPartEntity.php index 6c42a8c..46c25f8 100644 --- a/app/Entities/Equipment/ServerPartEntity.php +++ b/app/Entities/Equipment/ServerPartEntity.php @@ -25,6 +25,10 @@ class ServerPartEntity extends EquipmentEntity return $this->attributes['serviceinfo_uid'] ?? null; } //기본기능용 + public function getCustomTitle(): string + { + return sprintf("%s*%d개[%s]", $this->getTitle(), $this->getCnt(), $this->getExtra()); + } public function getCalculatedAmount(): int { return $this->getAmount() * $this->getCnt(); diff --git a/app/Entities/Part/PartEntity.php b/app/Entities/Part/PartEntity.php index 7d195bc..e242a2b 100644 --- a/app/Entities/Part/PartEntity.php +++ b/app/Entities/Part/PartEntity.php @@ -27,7 +27,7 @@ abstract class PartEntity extends CommonEntity //기본기능용 public function getCustomTitle(mixed $title = null): string { - return sprintf("%s %s원", $title ? $title : $this->getTitle(), number_format($this->getPrice() . "원")); + return sprintf("%s %s원", $title ? $title : $this->getTitle(), number_format($this->getPrice())); } final public function getPrice(): int { diff --git a/app/Entities/PaymentEntity.php b/app/Entities/PaymentEntity.php index c053017..9f3ce21 100644 --- a/app/Entities/PaymentEntity.php +++ b/app/Entities/PaymentEntity.php @@ -22,6 +22,10 @@ class PaymentEntity extends CommonEntity return $this->attributes['serviceinfo_uid'] ?? null; } //기본기능 + public function getCustomTitle(): string + { + return sprintf("%s %s [%s]", $this->getTitle(), $this->getAmount(), $this->getBillingAt()); + } public function getBilling(): string { return $this->attributes['billing']; diff --git a/app/Models/Equipment/ServerPartModel.php b/app/Models/Equipment/ServerPartModel.php index b00a482..d1adf3b 100644 --- a/app/Models/Equipment/ServerPartModel.php +++ b/app/Models/Equipment/ServerPartModel.php @@ -21,6 +21,7 @@ class ServerPartModel extends EquipmentModel "title", "type", "billing", + "billing_at", "amount", "cnt", "extra", diff --git a/app/Services/Equipment/ServerService.php b/app/Services/Equipment/ServerService.php index 4f512f9..b8512e9 100644 --- a/app/Services/Equipment/ServerService.php +++ b/app/Services/Equipment/ServerService.php @@ -254,7 +254,7 @@ class ServerService extends EquipmentService if (!$serviceEntity instanceof ServiceEntity) { throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$entity->getServiceInfoUID()}에 해당하는 서비스정보을 찾을수 없습니다."); } - service('customer_serviceservice')->updateAmount($entity); + service('customer_serviceservice')->updateAmount($serviceEntity); } return $entity; } diff --git a/app/Services/Part/PartType1Service.php b/app/Services/Part/PartType1Service.php index cfabde2..acf3413 100644 --- a/app/Services/Part/PartType1Service.php +++ b/app/Services/Part/PartType1Service.php @@ -23,7 +23,7 @@ abstract class PartType1Service extends PartService $entity = $this->getPartEntityByServerPart($serverPartEntity); //파트정보의 사용가능한 갯수 , 사용갯수 비교 if ($entity->getAvailable() < $serverPartEntity->getCnt()) { - throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 현재 사용가능 갯수[{$entity->getAvailable()}]보다 지정하신 갯수({$serverPartEntity->getCnt()})가 더 많습니다."); + throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 현재 {$entity->getTitle()}는 사용가능 갯수[{$entity->getAvailable()}]보다 지정하신 갯수({$serverPartEntity->getCnt()})가 더 많습니다."); } $formDatas['used'] = $entity->getUsed() + $serverPartEntity->getCnt(); return parent::modify_process($entity, $formDatas); @@ -35,7 +35,7 @@ abstract class PartType1Service extends PartService $entity = $this->getPartEntityByServerPart($serverPartEntity); //파트정보의 사용된 갯수 , 회수용 갯수 비교 if ($entity->getUsed() < $serverPartEntity->getCnt()) { - throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 현재 사용된 갯수[{$entity->getUsed()}]보다 지정하신 갯수({$serverPartEntity->getCnt()})가 더 많습니다."); + throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 현재 {$entity->getTitle()}는 사용된 갯수[{$entity->getUsed()}]보다 지정하신 갯수({$serverPartEntity->getCnt()})가 더 많습니다."); } $formDatas['used'] = $entity->getUsed() - $serverPartEntity->getCnt(); return parent::modify_process($entity, $formDatas); diff --git a/app/Services/PaymentService.php b/app/Services/PaymentService.php index d95703e..7d9c596 100644 --- a/app/Services/PaymentService.php +++ b/app/Services/PaymentService.php @@ -342,12 +342,13 @@ class PaymentService extends CommonService } $formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID(); $formDatas["clientinfo_uid"] = $serverPartEntity->getClientInfoUID(); + $formDatas["serverpartinfo_uid"] = $serverPartEntity->getPK(); $formDatas['amount'] = $serverPartEntity->getAmount(); $formDatas['billing'] = $formDatas['billing'] ?? PAYMENT['BILLING']['ONETIME']; $formDatas['billing_at'] = $serverPartEntity->getBillingAt(); $formDatas['pay'] = $formDatas['pay'] ?? PAYMENT['PAY']['ACCOUNT']; $formDatas['status'] = $formDatas['status'] ?? STATUS['UNPAID']; - $formDatas['title'] = sprintf("%s 일회성비용", $formDatas['title'] ?? $serverPartEntity->getTitle()); + $formDatas['title'] = sprintf("%s 일회성비용", $formDatas['title'] ?? $serverPartEntity->getCustomTitle()); return $formDatas; } public function createByServerPart(ServerPartEntity $serverPartEntity): PaymentEntity @@ -356,6 +357,7 @@ class PaymentService extends CommonService throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 서비스정보가 정의되지 않아 일회성 상품을 설정하실수 없습니다."); } $formDatas = $this->getFormDatasFromServerPart($serverPartEntity); + $this->action_init_process('create', $formDatas); return parent::create_process($formDatas); } public function modifyByServerPart(ServerPartEntity $oldServerPartEntity, ServerPartEntity $serverPartEntity): PaymentEntity @@ -367,7 +369,7 @@ class PaymentService extends CommonService $entity = $this->getEntity([ 'serverpartinfo_uid' => $oldServerPartEntity->getPK(), 'serviceinfo_uid' => $oldServerPartEntity->getServiceInfoUID(), - 'billing' => PAYMENT['BILLING']['ONETIME'], + 'billing' => $oldServerPartEntity->getBilling(), 'billing_at' => $oldServerPartEntity->getBillingAt(), 'status' => STATUS['UNPAID'] ]); diff --git a/app/Views/cells/part/ram_stock.php b/app/Views/cells/part/ram_stock.php index d859fbb..4ee2bd3 100644 --- a/app/Views/cells/part/ram_stock.php +++ b/app/Views/cells/part/ram_stock.php @@ -8,7 +8,7 @@