58 lines
2.0 KiB
PHP
58 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Equipment\ServerPart;
|
|
|
|
use App\Entities\Customer\ServiceEntity;
|
|
use App\Entities\Equipment\ServerPartEntity;
|
|
use App\Interfaces\Equipment\ServerPartInterface;
|
|
use App\Services\Customer\ServiceService as ParentService;
|
|
|
|
|
|
class ServiceService extends ParentService implements ServerPartInterface
|
|
{
|
|
private ?ServerPartEntity $_serverPartEntity = null;
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
public function setServerPartEntity(ServerPartEntity $entity): self
|
|
{
|
|
$this->_serverPartEntity = $entity;
|
|
return $this;
|
|
}
|
|
public function getServerPartEntity(): ServerPartEntity
|
|
{
|
|
if (!$this->_serverPartEntity instanceof ServerPartEntity) {
|
|
throw new \Exception(__METHOD__ . "에서 오류발생: 서버파트정보가 정의되지 않았습니다.");
|
|
}
|
|
return $this->_serverPartEntity;
|
|
}
|
|
|
|
//월과금은 해당 서비스의 항목별 금액을 총 합산후 청구금액을 설정후 결제정보에 신규등록/수정한다
|
|
private function action_process(): ServiceEntity
|
|
{
|
|
//Service Entity 가져오기
|
|
$entity = $this->getEntity($this->getServerPartEntity()->getServiceInfoUID());
|
|
if (!$entity instanceof ServiceEntity) {
|
|
throw new \Exception("[{$this->getServerPartEntity()->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다.");
|
|
}
|
|
//서비스금액은 modify 함수내에서 재계산을 하므로 여기서는 modify만 호출함
|
|
return parent::modify($entity, []);
|
|
}
|
|
public function createServerPart(): ServerPartEntity
|
|
{
|
|
//필수정보처리 후 FormData 가져오기
|
|
$this->action_process();
|
|
return $this->getServerPartEntity();
|
|
}
|
|
public function modifyServerPart(): ServerPartEntity
|
|
{
|
|
return $this->createServerPart();
|
|
}
|
|
public function deleteServerPart(): ServerPartEntity
|
|
{
|
|
return $this->createServerPart();
|
|
}
|
|
}
|