dbmsv2 init...1
This commit is contained in:
parent
b1c835db05
commit
6db67ae3f8
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Cells\Customer;
|
namespace App\Cells\Customer;
|
||||||
|
|
||||||
use App\Services\Payment\PaymentService;
|
use App\Services\PaymentService;
|
||||||
use App\Services\Customer\ServiceService;
|
use App\Services\Customer\ServiceService;
|
||||||
|
|
||||||
class ServiceCell extends CustomerCell
|
class ServiceCell extends CustomerCell
|
||||||
|
|||||||
@ -6,7 +6,7 @@ use App\Entities\Customer\ClientEntity;
|
|||||||
use App\Entities\PaymentEntity;
|
use App\Entities\PaymentEntity;
|
||||||
use App\Entities\Customer\ServiceEntity;
|
use App\Entities\Customer\ServiceEntity;
|
||||||
use App\Services\Customer\ClientService;
|
use App\Services\Customer\ClientService;
|
||||||
use App\Services\Payment\PaymentService;
|
use App\Services\PaymentService;
|
||||||
use CodeIgniter\HTTP\RedirectResponse;
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
namespace App\Controllers\Admin\Customer;
|
namespace App\Controllers\Admin\Customer;
|
||||||
|
|
||||||
use App\Entities\Customer\ServiceEntity;
|
use App\Entities\Customer\ServiceEntity;
|
||||||
use App\Services\Payment\PaymentService;
|
use App\Services\PaymentService;
|
||||||
use App\Services\Customer\ServiceService;
|
use App\Services\Customer\ServiceService;
|
||||||
use CodeIgniter\HTTP\RedirectResponse;
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
namespace App\Controllers\Admin;
|
namespace App\Controllers\Admin;
|
||||||
|
|
||||||
use App\Services\Customer\ServiceService;
|
use App\Services\Customer\ServiceService;
|
||||||
use App\Services\Payment\PaymentService;
|
use App\Services\PaymentService;
|
||||||
use CodeIgniter\HTTP\RedirectResponse;
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -343,14 +343,6 @@ class CommonHelper
|
|||||||
case 'amount':
|
case 'amount':
|
||||||
$value = number_format($value) . "원";
|
$value = number_format($value) . "원";
|
||||||
break;
|
break;
|
||||||
case 'user_uid':
|
|
||||||
case 'old_clientinfo_uid':
|
|
||||||
case 'clientinfo_uid':
|
|
||||||
case 'serviceinfo_uid':
|
|
||||||
case 'serverinfo_uid':
|
|
||||||
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) &&
|
|
||||||
$viewDatas['control']['field_optons'][$field][$value] ? $viewDatas['control']['field_optons'][$field][$value]->getTitle() : "";
|
|
||||||
break;
|
|
||||||
case 'description':
|
case 'description':
|
||||||
case 'content':
|
case 'content':
|
||||||
case 'history':
|
case 'history':
|
||||||
@ -361,16 +353,21 @@ class CommonHelper
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
||||||
//index 액션에서만 filter_options를 변경시 선택된 값을 변경하는 기능
|
// //index 액션에서만 filter_options를 변경시 선택된 값을 변경하는 기능
|
||||||
if ($viewDatas['control']['action'] == 'index') {
|
// if ($viewDatas['control']['action'] == 'index') {
|
||||||
$extras["onChange"] = sprintf(
|
// $extras["onChange"] = sprintf(
|
||||||
"document.location.href='%s/toggle/%s/%s?%s='+this.options[this.selectedIndex].value",
|
// "document.location.href='%s/toggle/%s/%s?%s='+this.options[this.selectedIndex].value",
|
||||||
current_url(),
|
// current_url(),
|
||||||
$viewDatas['entity']->getPK(),
|
// $viewDatas['entity']->getPK(),
|
||||||
$field,
|
// $field,
|
||||||
$field
|
// $field
|
||||||
);
|
// );
|
||||||
$value = $this->getFieldForm($field, $value, $viewDatas, $extras);
|
// $value = $this->getFieldForm($field, $value, $viewDatas, $extras);
|
||||||
|
// } else {
|
||||||
|
// $value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) ? $viewDatas['control']['field_optons'][$field][$value] : "";
|
||||||
|
// }
|
||||||
|
if (str_contains($field, "_uid")) {
|
||||||
|
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) && $viewDatas['control']['field_optons'][$field][$value] ? $viewDatas['control']['field_optons'][$field][$value]->getTitle() : "";
|
||||||
} else {
|
} else {
|
||||||
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) ? $viewDatas['control']['field_optons'][$field][$value] : "";
|
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) ? $viewDatas['control']['field_optons'][$field][$value] : "";
|
||||||
}
|
}
|
||||||
@ -397,7 +394,7 @@ class CommonHelper
|
|||||||
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
||||||
$filter = $this->getFieldForm($field, $value, $viewDatas, $extras);
|
$filter = $this->getFieldForm($field, $value, $viewDatas, $extras);
|
||||||
} else {
|
} else {
|
||||||
$filter = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) ? $viewDatas['control']['field_optons'][$field][$value]->getTitle() : "";
|
$filter = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) ? $viewDatas['control']['field_optons'][$field][$value] : "";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -444,7 +441,7 @@ class CommonHelper
|
|||||||
$checkbox = form_checkbox([
|
$checkbox = form_checkbox([
|
||||||
"id" => "checkbox_uid_{$viewDatas['entity']->getPK()}",
|
"id" => "checkbox_uid_{$viewDatas['entity']->getPK()}",
|
||||||
"name" => "batchjob_uids[]",
|
"name" => "batchjob_uids[]",
|
||||||
"value" => $label ? $label : $viewDatas['entity']->getPK(),
|
"value" => $viewDatas['entity']->getPK(),
|
||||||
"class" => "batchjobuids_checkboxs",
|
"class" => "batchjobuids_checkboxs",
|
||||||
"checked" => in_array($viewDatas['entity']->getPK(), $oldBatchJobUids)
|
"checked" => in_array($viewDatas['entity']->getPK(), $oldBatchJobUids)
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -11,25 +11,11 @@ class AccountHelper extends CustomerHelper
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->setTitleField(AccountModel::TITLE);
|
$this->setTitleField(AccountModel::TITLE);
|
||||||
}
|
}
|
||||||
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
|
|
||||||
{
|
|
||||||
switch ($field) {
|
|
||||||
default:
|
|
||||||
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
|
||||||
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) ? $viewDatas['control']['field_optons'][$field][$value]->getTitle() : "";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (is_array($value)) {
|
|
||||||
throw new \Exception(__METHOD__ . "에서 오류: {$field}의 값이 Array형태입니다");
|
|
||||||
}
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
|
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'modify':
|
case 'modify':
|
||||||
$action = $viewDatas['entity']->getPK();
|
$action = $label;
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
$action = "";
|
$action = "";
|
||||||
|
|||||||
@ -11,25 +11,11 @@ class CouponHelper extends CustomerHelper
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->setTitleField(CouponModel::TITLE);
|
$this->setTitleField(CouponModel::TITLE);
|
||||||
}
|
}
|
||||||
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
|
|
||||||
{
|
|
||||||
switch ($field) {
|
|
||||||
default:
|
|
||||||
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
|
||||||
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) ? $viewDatas['control']['field_optons'][$field][$value]->getTitle() : "";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (is_array($value)) {
|
|
||||||
throw new \Exception(__METHOD__ . "에서 오류: {$field}의 값이 Array형태입니다");
|
|
||||||
}
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
|
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'modify':
|
case 'modify':
|
||||||
$action = $viewDatas['entity']->getPK();
|
$action = $label;
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
$action = "";
|
$action = "";
|
||||||
|
|||||||
@ -11,26 +11,11 @@ class PointHelper extends CustomerHelper
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->setTitleField(field: PointModel::TITLE);
|
$this->setTitleField(field: PointModel::TITLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
|
|
||||||
{
|
|
||||||
switch ($field) {
|
|
||||||
default:
|
|
||||||
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
|
||||||
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) ? $viewDatas['control']['field_optons'][$field][$value]->getTitle() : "";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (is_array($value)) {
|
|
||||||
throw new \Exception(__METHOD__ . "에서 오류: {$field}의 값이 Array형태입니다");
|
|
||||||
}
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
|
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'modify':
|
case 'modify':
|
||||||
$action = $viewDatas['entity']->getPK();
|
$action = $label;
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
$action = "";
|
$action = "";
|
||||||
|
|||||||
@ -76,7 +76,9 @@ class ServiceHelper extends CustomerHelper
|
|||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'clientinfo_uid':
|
case 'clientinfo_uid':
|
||||||
$value = "<a href=\"/admin/customer/client/detail/{$value}\">" . $viewDatas['control']['field_optons'][$field][$value]->getTitle() . "</a>";
|
if (array_key_exists($value, $viewDatas['control']['field_optons'][$field])) {
|
||||||
|
$value = "<a href=\"/admin/customer/client/detail/{$value}\">" . $viewDatas['control']['field_optons'][$field][$value]->getTitle() . "</a>";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'billing_at':
|
case 'billing_at':
|
||||||
if (array_key_exists('unPaids', $viewDatas)) {
|
if (array_key_exists('unPaids', $viewDatas)) {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Helpers;
|
namespace App\Helpers;
|
||||||
|
|
||||||
use App\Models\Customer\PaymentModel;
|
use App\Models\PaymentModel;
|
||||||
|
|
||||||
class HomeHelper extends CommonHelper
|
class HomeHelper extends CommonHelper
|
||||||
{
|
{
|
||||||
@ -16,7 +16,7 @@ class HomeHelper extends CommonHelper
|
|||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'type':
|
case 'type':
|
||||||
$value = $viewDatas['control']['field_optons'][$field][$value]->getTitle();
|
$value = $viewDatas['control']['field_optons'][$field][$value];
|
||||||
break;
|
break;
|
||||||
case 'amount':
|
case 'amount':
|
||||||
$value = number_format($value) . "원";
|
$value = number_format($value) . "원";
|
||||||
|
|||||||
@ -11,32 +11,11 @@ class MyLogHelper extends CommonHelper
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->setTitleField(MyLogModel::TITLE);
|
$this->setTitleField(MyLogModel::TITLE);
|
||||||
}
|
}
|
||||||
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
|
|
||||||
{
|
|
||||||
switch ($field) {
|
|
||||||
case 'content':
|
|
||||||
$value = nl2br($value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
|
||||||
if (array_key_exists($value, $viewDatas['control']['field_optons'][$field])) {
|
|
||||||
$value = $viewDatas['control']['field_optons'][$field][$value]->getTitle();
|
|
||||||
} else {
|
|
||||||
$value = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (is_array($value)) {
|
|
||||||
throw new \Exception(__METHOD__ . "에서 오류: {$field}의 값이 Array형태입니다");
|
|
||||||
}
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
|
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'modify':
|
case 'modify':
|
||||||
$action = $viewDatas['cnt'];
|
$action = $label;
|
||||||
break;
|
break;
|
||||||
case 'create':
|
case 'create':
|
||||||
case 'delete':
|
case 'delete':
|
||||||
|
|||||||
@ -18,16 +18,6 @@ class PaymentHelper extends CommonHelper
|
|||||||
case "countdown": //결제일Countdown
|
case "countdown": //결제일Countdown
|
||||||
$value = $viewDatas['entity']->getCountDueAt();
|
$value = $viewDatas['entity']->getCountDueAt();
|
||||||
break;
|
break;
|
||||||
case 'serviceinfo_uid':
|
|
||||||
case 'clientinfo_uid':
|
|
||||||
case 'billing_method':
|
|
||||||
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) && $viewDatas['control']['field_optons'][$field][$value] ? $viewDatas['control']['field_optons'][$field][$value]->getTitle() : "";
|
|
||||||
break;
|
|
||||||
case 'billing':
|
|
||||||
case 'pay':
|
|
||||||
case 'status':
|
|
||||||
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) && $viewDatas['control']['field_optons'][$field][$value] ? $viewDatas['control']['field_optons'][$field][$value] : "";
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
|
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
|
||||||
break;
|
break;
|
||||||
@ -50,7 +40,7 @@ class PaymentHelper extends CommonHelper
|
|||||||
$action = form_checkbox([
|
$action = form_checkbox([
|
||||||
"id" => "checkbox_uid_{$viewDatas['entity']->getPK()}",
|
"id" => "checkbox_uid_{$viewDatas['entity']->getPK()}",
|
||||||
"name" => "batchjob_uids[]",
|
"name" => "batchjob_uids[]",
|
||||||
"value" => $label ? $label : $viewDatas['entity']->getPK(),
|
"value" => $viewDatas['entity']->getPK(),
|
||||||
"class" => "batchjobuids_checkboxs",
|
"class" => "batchjobuids_checkboxs",
|
||||||
"checked" => in_array($viewDatas['entity']->getPK(), $oldBatchJobUids)
|
"checked" => in_array($viewDatas['entity']->getPK(), $oldBatchJobUids)
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Interfaces\Customer;
|
namespace App\Interfaces\Customer;
|
||||||
|
|
||||||
|
use App\Entities\Customer\ServiceEntity;
|
||||||
use App\Entities\Equipment\ServerPartEntity;
|
use App\Entities\Equipment\ServerPartEntity;
|
||||||
|
|
||||||
interface ServiceInterface extends CustomerInterface
|
interface ServiceInterface extends CustomerInterface
|
||||||
{
|
{
|
||||||
public function setServiceAmount(array $formDatas): ServerPartEntity;
|
public function setService(string $action, ServiceEntity $serviceEntity, array $serviceDatas);
|
||||||
|
public function setServiceAmount(ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,5 +6,5 @@ use App\Entities\Equipment\ServerPartEntity;
|
|||||||
|
|
||||||
interface ServerPartInterface extends EquipmentInterface
|
interface ServerPartInterface extends EquipmentInterface
|
||||||
{
|
{
|
||||||
public function setServerPart(ServerPartEntity $serverPartEntity, array $formDatas): ServerPartEntity;
|
public function setServerPart(string $action, ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ return [
|
|||||||
'deleted_at' => "삭제일",
|
'deleted_at' => "삭제일",
|
||||||
],
|
],
|
||||||
"STATUS" => [
|
"STATUS" => [
|
||||||
STATUS['DEPOSIT'] => "입금",
|
STATUS['DEPOSIT'] => "추가",
|
||||||
STATUS['WIDTHDRAWAL'] => "출금",
|
STATUS['WIDTHDRAWAL'] => "사용",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -5,7 +5,7 @@ namespace App\Services\Customer;
|
|||||||
use App\Entities\Customer\ClientEntity;
|
use App\Entities\Customer\ClientEntity;
|
||||||
use App\Helpers\Customer\ClientHelper;
|
use App\Helpers\Customer\ClientHelper;
|
||||||
use App\Models\Customer\ClientModel;
|
use App\Models\Customer\ClientModel;
|
||||||
use App\Services\Payment\PaymentService;
|
use App\Services\PaymentService;
|
||||||
|
|
||||||
class ClientService extends CustomerService
|
class ClientService extends CustomerService
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,13 +5,13 @@ namespace App\Services\Customer;
|
|||||||
use App\Entities\Customer\ClientEntity;
|
use App\Entities\Customer\ClientEntity;
|
||||||
use App\Entities\Customer\ServiceEntity;
|
use App\Entities\Customer\ServiceEntity;
|
||||||
use App\Entities\Equipment\ServerEntity;
|
use App\Entities\Equipment\ServerEntity;
|
||||||
use App\Entities\UserEntity;
|
|
||||||
use App\Entities\PaymentEntity;
|
use App\Entities\PaymentEntity;
|
||||||
|
use App\Entities\UserEntity;
|
||||||
use App\Helpers\Customer\ServiceHelper;
|
use App\Helpers\Customer\ServiceHelper;
|
||||||
use App\Models\Customer\ServiceModel;
|
use App\Models\Customer\ServiceModel;
|
||||||
use App\Services\Equipment\ServerService;
|
use App\Services\Equipment\ServerService;
|
||||||
|
use App\Services\Payment\Service as PaymentService;
|
||||||
use App\Traits\IPTrait;
|
use App\Traits\IPTrait;
|
||||||
use App\Services\Payment\PaymentService;
|
|
||||||
|
|
||||||
class ServiceService extends CustomerService
|
class ServiceService extends CustomerService
|
||||||
{
|
{
|
||||||
@ -212,6 +212,7 @@ class ServiceService extends CustomerService
|
|||||||
) WHERE billing_at = ? AND status = ?";
|
) WHERE billing_at = ? AND status = ?";
|
||||||
return $this->getModel()->query($sql, [$billing_at, $status]);
|
return $this->getModel()->query($sql, [$billing_at, $status]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//기본기능
|
//기본기능
|
||||||
//생성
|
//생성
|
||||||
public function create(array $formDatas): ServiceEntity
|
public function create(array $formDatas): ServiceEntity
|
||||||
@ -222,7 +223,7 @@ class ServiceService extends CustomerService
|
|||||||
$entity = parent::create($formDatas);
|
$entity = parent::create($formDatas);
|
||||||
$entity = $entity->setServerEntity($this->getServerService()->setService($entity, $formDatas['serverinfo_uid'], STATUS['OCCUPIED']));
|
$entity = $entity->setServerEntity($this->getServerService()->setService($entity, $formDatas['serverinfo_uid'], STATUS['OCCUPIED']));
|
||||||
// 결제정보에 추가한다.
|
// 결제정보에 추가한다.
|
||||||
$this->getPaymentService()->service($entity);
|
$this->getPaymentService()->setService(__FUNCTION__, $entity);
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
//수정
|
//수정
|
||||||
|
|||||||
44
app/Services/Equipment/CS/ServicePart.php
Normal file
44
app/Services/Equipment/CS/ServicePart.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Equipment\CS;
|
||||||
|
|
||||||
|
use App\Entities\Equipment\CSEntity;
|
||||||
|
use App\Entities\Equipment\ServerPartEntity;
|
||||||
|
use App\Interfaces\Equipment\ServerPartInterface;
|
||||||
|
use App\Services\Equipment\CSService;
|
||||||
|
|
||||||
|
class ServicePart extends CSService implements ServerPartInterface
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
//서버연결정보용 등록
|
||||||
|
public function setServerPart(string $action, ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity
|
||||||
|
{
|
||||||
|
if (!array_key_exists('part_uid', $serverPartDatas)) {
|
||||||
|
throw new \Exception(__METHOD__ . "에서 오류발생: 부품번호가 정의되지 않았습니다.");
|
||||||
|
}
|
||||||
|
if (!array_key_exists('status', $serverPartDatas)) {
|
||||||
|
throw new \Exception(__METHOD__ . "에서 오류발생: 상태가 정의되지 않았습니다.");
|
||||||
|
}
|
||||||
|
$entity = $this->getEntity($serverPartDatas['part_uid']);
|
||||||
|
if (!($entity instanceof CSEntity)) {
|
||||||
|
throw new \Exception("{$serverPartDatas['part_uid']}에 해당하는 CS정보를를 찾을수없습니다.");
|
||||||
|
}
|
||||||
|
//부품정보에 서버정보 설정 및 서비스,고객정보 정의
|
||||||
|
$formDatas = [];
|
||||||
|
if ($serverPartDatas['status'] === STATUS['AVAILABLE']) {
|
||||||
|
//사용가능
|
||||||
|
$formDatas['clientinfo_uid'] = null;
|
||||||
|
$formDatas['serviceinfo_uid'] = null;
|
||||||
|
$formDatas['serverinfo_uid'] = null;
|
||||||
|
} else {
|
||||||
|
$formDatas['clientinfo_uid'] = $serverPartEntity->getClientInfoUID();
|
||||||
|
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
||||||
|
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
||||||
|
}
|
||||||
|
$formDatas['status'] = $serverPartDatas['status'];
|
||||||
|
return $serverPartEntity->setPartEntity($this->modify($entity, $formDatas));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,13 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Services\Equipment;
|
namespace App\Services\Equipment;
|
||||||
|
|
||||||
use App\Entities\Equipment\CSEntity;
|
|
||||||
use App\Entities\Equipment\ServerPartEntity;
|
|
||||||
use App\Helpers\Equipment\CSHelper;
|
use App\Helpers\Equipment\CSHelper;
|
||||||
use App\Interfaces\Equipment\ServerPartInterface;
|
|
||||||
use App\Models\Equipment\CSModel;
|
use App\Models\Equipment\CSModel;
|
||||||
|
|
||||||
class CSService extends EquipmentService implements ServerPartInterface
|
class CSService extends EquipmentService
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -54,34 +51,6 @@ class CSService extends EquipmentService implements ServerPartInterface
|
|||||||
return ['type', 'status'];
|
return ['type', 'status'];
|
||||||
}
|
}
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
//서비스파트 설정
|
|
||||||
public function setServerPart(ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity
|
|
||||||
{
|
|
||||||
if (!array_key_exists('part_uid', $serverPartDatas)) {
|
|
||||||
throw new \Exception(__METHOD__ . "에서 오류발생: 부품번호가 정의되지 않았습니다.");
|
|
||||||
}
|
|
||||||
if (!array_key_exists('status', $serverPartDatas)) {
|
|
||||||
throw new \Exception(__METHOD__ . "에서 오류발생: 상태가 정의되지 않았습니다.");
|
|
||||||
}
|
|
||||||
$entity = $this->getEntity($serverPartDatas['part_uid']);
|
|
||||||
if (!($entity instanceof CSEntity)) {
|
|
||||||
throw new \Exception("{$serverPartDatas['part_uid']}에 해당하는 CS정보를를 찾을수없습니다.");
|
|
||||||
}
|
|
||||||
//부품정보에 서버정보 설정 및 서비스,고객정보 정의
|
|
||||||
$formDatas = [];
|
|
||||||
if ($serverPartDatas['status'] === STATUS['AVAILABLE']) {
|
|
||||||
//사용가능
|
|
||||||
$formDatas['clientinfo_uid'] = null;
|
|
||||||
$formDatas['serviceinfo_uid'] = null;
|
|
||||||
$formDatas['serverinfo_uid'] = null;
|
|
||||||
} else {
|
|
||||||
$formDatas['clientinfo_uid'] = $serverPartEntity->getClientInfoUID();
|
|
||||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
|
||||||
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
|
||||||
}
|
|
||||||
$formDatas['status'] = $serverPartDatas['status'];
|
|
||||||
return $serverPartEntity->setPartEntity($this->modify($entity, $formDatas));
|
|
||||||
}
|
|
||||||
//List 검색용
|
//List 검색용
|
||||||
//OrderBy 처리
|
//OrderBy 처리
|
||||||
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||||
|
|||||||
44
app/Services/Equipment/IP/ServicePart.php
Normal file
44
app/Services/Equipment/IP/ServicePart.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Equipment\IP;
|
||||||
|
|
||||||
|
use App\Entities\Equipment\IPEntity;
|
||||||
|
use App\Entities\Equipment\ServerPartEntity;
|
||||||
|
use App\Interfaces\Equipment\ServerPartInterface;
|
||||||
|
use App\Services\Equipment\IPService;
|
||||||
|
|
||||||
|
class ServicePart extends IPService implements ServerPartInterface
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
//서버연결정보용 등록
|
||||||
|
public function setServerPart(string $action, ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity
|
||||||
|
{
|
||||||
|
if (!array_key_exists('part_uid', $serverPartDatas)) {
|
||||||
|
throw new \Exception(__METHOD__ . "에서 오류발생: 부품번호가 정의되지 않았습니다.");
|
||||||
|
}
|
||||||
|
if (!array_key_exists('status', $serverPartDatas)) {
|
||||||
|
throw new \Exception(__METHOD__ . "에서 오류발생: 상태가 정의되지 않았습니다.");
|
||||||
|
}
|
||||||
|
$entity = $this->getEntity($serverPartDatas['part_uid']);
|
||||||
|
if (!($entity instanceof IPEntity)) {
|
||||||
|
throw new \Exception("{$serverPartDatas['part_uid']}에 해당하는 IP정보를를 찾을수없습니다.");
|
||||||
|
}
|
||||||
|
//부품정보에 서버정보 설정 및 서비스,고객정보 정의
|
||||||
|
$formDatas = [];
|
||||||
|
if ($serverPartDatas['status'] === STATUS['AVAILABLE']) {
|
||||||
|
//사용가능
|
||||||
|
$formDatas['clientinfo_uid'] = null;
|
||||||
|
$formDatas['serviceinfo_uid'] = null;
|
||||||
|
$formDatas['serverinfo_uid'] = null;
|
||||||
|
} else {
|
||||||
|
$formDatas['clientinfo_uid'] = $serverPartEntity->getClientInfoUID();
|
||||||
|
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
||||||
|
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
||||||
|
}
|
||||||
|
$formDatas['status'] = $serverPartDatas['status'];
|
||||||
|
return $serverPartEntity->setPartEntity($this->modify($entity, $formDatas));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,15 +2,12 @@
|
|||||||
|
|
||||||
namespace App\Services\Equipment;
|
namespace App\Services\Equipment;
|
||||||
|
|
||||||
use App\Entities\Equipment\IPEntity;
|
|
||||||
use App\Entities\Equipment\ServerPartEntity;
|
|
||||||
use App\Helpers\Equipment\IPHelper;
|
use App\Helpers\Equipment\IPHelper;
|
||||||
use App\Interfaces\Equipment\ServerPartInterface;
|
|
||||||
use App\Models\Equipment\IPModel;
|
use App\Models\Equipment\IPModel;
|
||||||
use App\Services\Equipment\EquipmentService;
|
use App\Services\Equipment\EquipmentService;
|
||||||
use App\Services\Equipment\LineService;
|
use App\Services\Equipment\LineService;
|
||||||
|
|
||||||
class IPService extends EquipmentService implements ServerPartInterface
|
class IPService extends EquipmentService
|
||||||
{
|
{
|
||||||
private ?LineService $_lineService = null;
|
private ?LineService $_lineService = null;
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -79,34 +76,7 @@ class IPService extends EquipmentService implements ServerPartInterface
|
|||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
//서비스 설정
|
//서비스 설정
|
||||||
//서비스파트 설정
|
|
||||||
public function setServerPart(ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity
|
|
||||||
{
|
|
||||||
if (!array_key_exists('part_uid', $serverPartDatas)) {
|
|
||||||
throw new \Exception(__METHOD__ . "에서 오류발생: 부품번호가 정의되지 않았습니다.");
|
|
||||||
}
|
|
||||||
if (!array_key_exists('status', $serverPartDatas)) {
|
|
||||||
throw new \Exception(__METHOD__ . "에서 오류발생: 상태가 정의되지 않았습니다.");
|
|
||||||
}
|
|
||||||
$entity = $this->getEntity($serverPartDatas['part_uid']);
|
|
||||||
if (!($entity instanceof IPEntity)) {
|
|
||||||
throw new \Exception("{$serverPartDatas['part_uid']}에 해당하는 IP정보를를 찾을수없습니다.");
|
|
||||||
}
|
|
||||||
//부품정보에 서버정보 설정 및 서비스,고객정보 정의
|
|
||||||
$formDatas = [];
|
|
||||||
if ($serverPartDatas['status'] === STATUS['AVAILABLE']) {
|
|
||||||
//사용가능
|
|
||||||
$formDatas['clientinfo_uid'] = null;
|
|
||||||
$formDatas['serviceinfo_uid'] = null;
|
|
||||||
$formDatas['serverinfo_uid'] = null;
|
|
||||||
} else {
|
|
||||||
$formDatas['clientinfo_uid'] = $serverPartEntity->getClientInfoUID();
|
|
||||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
|
||||||
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
|
||||||
}
|
|
||||||
$formDatas['status'] = $serverPartDatas['status'];
|
|
||||||
return $serverPartEntity->setPartEntity($this->modify($entity, $formDatas));
|
|
||||||
}
|
|
||||||
//List 검색용
|
//List 검색용
|
||||||
//OrderBy 처리
|
//OrderBy 처리
|
||||||
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||||
|
|||||||
43
app/Services/Equipment/Part/ServicePart.php
Normal file
43
app/Services/Equipment/Part/ServicePart.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Equipment\Part;
|
||||||
|
|
||||||
|
use App\Entities\Equipment\PartEntity;
|
||||||
|
use App\Entities\Equipment\ServerPartEntity;
|
||||||
|
use App\Interfaces\Equipment\ServerPartInterface;
|
||||||
|
use App\Services\Equipment\PartService;
|
||||||
|
|
||||||
|
class ServicePart extends PartService implements ServerPartInterface
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
//서버연결정보용 등록
|
||||||
|
public function setServerPart(string $action, ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity
|
||||||
|
{
|
||||||
|
if (!array_key_exists('part_uid', $serverPartDatas)) {
|
||||||
|
throw new \Exception(__METHOD__ . "에서 오류발생: 부품번호가 정의되지 않았습니다.");
|
||||||
|
}
|
||||||
|
if (!array_key_exists('status', $serverPartDatas)) {
|
||||||
|
throw new \Exception(__METHOD__ . "에서 오류발생: 상태가 정의되지 않았습니다.");
|
||||||
|
}
|
||||||
|
//부품정보가져오기
|
||||||
|
$entity = $this->getEntity($serverPartDatas['part_uid']);
|
||||||
|
if (!($entity instanceof PartEntity)) {
|
||||||
|
throw new \Exception("{$serverPartDatas['part_uid']}에 해당하는 부품정보를 찾을수없습니다.");
|
||||||
|
}
|
||||||
|
//부품정보에 서버정보 설정 및 서비스,고객정보 정의
|
||||||
|
$formDatas = [];
|
||||||
|
if ($serverPartDatas['status'] === STATUS['AVAILABLE']) { //해지된 부품 재고수를 처리
|
||||||
|
$formDatas['stock'] = $entity->getStock() + $serverPartEntity->getCnt();
|
||||||
|
}
|
||||||
|
if ($serverPartDatas['status'] === STATUS['OCCUPIED']) { //추가된 부품 재고수를 처리
|
||||||
|
if ($entity->getStock() < $serverPartEntity->getCnt()) {
|
||||||
|
throw new \Exception("현재 재고수[{$entity->getStock()}]보다 지정하신 갯수({$serverPartEntity->getCnt()})가 더 많습니다.");
|
||||||
|
}
|
||||||
|
$formDatas['stock'] = $entity->getStock() - $serverPartEntity->getCnt();
|
||||||
|
}
|
||||||
|
return $serverPartEntity->setPartEntity($this->modify($entity, $formDatas));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,12 +3,11 @@
|
|||||||
namespace App\Services\Equipment;
|
namespace App\Services\Equipment;
|
||||||
|
|
||||||
use App\Entities\Equipment\PartEntity;
|
use App\Entities\Equipment\PartEntity;
|
||||||
use App\Entities\Equipment\ServerPartEntity;
|
|
||||||
use App\Helpers\Equipment\PartHelper;
|
use App\Helpers\Equipment\PartHelper;
|
||||||
use App\Models\Equipment\PartModel;
|
use App\Models\Equipment\PartModel;
|
||||||
use App\Interfaces\Equipment\ServerPartInterface;
|
|
||||||
|
|
||||||
class PartService extends EquipmentService implements ServerPartInterface
|
|
||||||
|
class PartService extends EquipmentService
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -48,33 +47,6 @@ class PartService extends EquipmentService implements ServerPartInterface
|
|||||||
}
|
}
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
//FieldForm관련용
|
//FieldForm관련용
|
||||||
//서비스파트 설정
|
|
||||||
public function setServerPart(ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity
|
|
||||||
{
|
|
||||||
if (!array_key_exists('part_uid', $serverPartDatas)) {
|
|
||||||
throw new \Exception(__METHOD__ . "에서 오류발생: 부품번호가 정의되지 않았습니다.");
|
|
||||||
}
|
|
||||||
if (!array_key_exists('status', $serverPartDatas)) {
|
|
||||||
throw new \Exception(__METHOD__ . "에서 오류발생: 상태가 정의되지 않았습니다.");
|
|
||||||
}
|
|
||||||
//부품정보가져오기
|
|
||||||
$entity = $this->getEntity($serverPartDatas['part_uid']);
|
|
||||||
if (!($entity instanceof PartEntity)) {
|
|
||||||
throw new \Exception("{$serverPartDatas['part_uid']}에 해당하는 부품정보를 찾을수없습니다.");
|
|
||||||
}
|
|
||||||
//부품정보에 서버정보 설정 및 서비스,고객정보 정의
|
|
||||||
$formDatas = [];
|
|
||||||
if ($serverPartDatas['status'] === STATUS['AVAILABLE']) { //해지된 부품 재고수를 처리
|
|
||||||
$formDatas['stock'] = $entity->getStock() + $serverPartEntity->getCnt();
|
|
||||||
}
|
|
||||||
if ($serverPartDatas['status'] === STATUS['OCCUPIED']) { //추가된 부품 재고수를 처리
|
|
||||||
if ($entity->getStock() < $serverPartEntity->getCnt()) {
|
|
||||||
throw new \Exception("현재 재고수[{$entity->getStock()}]보다 지정하신 갯수({$serverPartEntity->getCnt()})가 더 많습니다.");
|
|
||||||
}
|
|
||||||
$formDatas['stock'] = $entity->getStock() - $serverPartEntity->getCnt();
|
|
||||||
}
|
|
||||||
return $serverPartEntity->setPartEntity($this->modify($entity, $formDatas));
|
|
||||||
}
|
|
||||||
//OrderBy 처리
|
//OrderBy 처리
|
||||||
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,13 +2,16 @@
|
|||||||
|
|
||||||
namespace App\Services\Equipment;
|
namespace App\Services\Equipment;
|
||||||
|
|
||||||
use App\Services\Equipment\EquipmentService;
|
|
||||||
use App\Entities\Equipment\ServerEntity;
|
use App\Entities\Equipment\ServerEntity;
|
||||||
use App\Entities\Equipment\ServerPartEntity;
|
use App\Entities\Equipment\ServerPartEntity;
|
||||||
use App\Helpers\Equipment\ServerPartHelper;
|
use App\Helpers\Equipment\ServerPartHelper;
|
||||||
use App\Models\Equipment\ServerPartModel;
|
use App\Models\Equipment\ServerPartModel;
|
||||||
use App\Services\Payment\CreatePayment;
|
use App\Services\Equipment\EquipmentService;
|
||||||
use App\Services\Payment\ModifyPayment;
|
use App\Services\Equipment\CS\ServicePart as CSService;
|
||||||
|
use App\Services\Equipment\IP\ServicePart as IPService;
|
||||||
|
use App\Services\Equipment\Part\ServicePart as PartService;
|
||||||
|
use App\Services\Equipment\Switch\ServicePart as SwitchService;
|
||||||
|
use App\Services\Payment\ServicePart as PaymentService;
|
||||||
|
|
||||||
class ServerPartService extends EquipmentService
|
class ServerPartService extends EquipmentService
|
||||||
{
|
{
|
||||||
@ -16,8 +19,7 @@ class ServerPartService extends EquipmentService
|
|||||||
private ?PartService $_partService = null;
|
private ?PartService $_partService = null;
|
||||||
private ?IPService $_ipService = null;
|
private ?IPService $_ipService = null;
|
||||||
private ?CSService $_csService = null;
|
private ?CSService $_csService = null;
|
||||||
private ?CreatePayment $_creatPayment = null;
|
private ?PaymentService $_paymentService = null;
|
||||||
private ?ModifyPayment $_modifyPayment = null;
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct(new ServerPartModel(), new ServerPartHelper());
|
parent::__construct(new ServerPartModel(), new ServerPartHelper());
|
||||||
@ -100,22 +102,12 @@ class ServerPartService extends EquipmentService
|
|||||||
return $this->_csService;
|
return $this->_csService;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function getPaymentService(string $action): CreatePayment|ModifyPayment
|
final public function getPaymentService(): PaymentService
|
||||||
{
|
{
|
||||||
switch ($action) {
|
if (!$this->_paymentService) {
|
||||||
case 'modify':
|
$this->_paymentService = new PaymentService();
|
||||||
if (!$this->_modifyPayment) {
|
|
||||||
$this->_modifyPayment = new ModifyPayment();
|
|
||||||
}
|
|
||||||
$paymentService = $this->_modifyPayment;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (!$this->_creatPayment) {
|
|
||||||
$this->_creatPayment = new CreatePayment();
|
|
||||||
}
|
|
||||||
return $this->_creatPayment;
|
|
||||||
}
|
}
|
||||||
return $paymentService;
|
return $this->_paymentService;
|
||||||
}
|
}
|
||||||
//partEntity 정보 추가
|
//partEntity 정보 추가
|
||||||
protected function getEntity_process(mixed $entity): ServerPartEntity
|
protected function getEntity_process(mixed $entity): ServerPartEntity
|
||||||
@ -192,7 +184,7 @@ class ServerPartService extends EquipmentService
|
|||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
//파트별정보 설정
|
//파트별정보 설정
|
||||||
private function setServerPart(ServerPartEntity $entity, array $formDatas): ServerPartEntity
|
private function setServerPart(string $action, ServerPartEntity $entity, array $formDatas): ServerPartEntity
|
||||||
{
|
{
|
||||||
//Type에 따른 부품서비스 정의
|
//Type에 따른 부품서비스 정의
|
||||||
switch ($entity->getType()) {
|
switch ($entity->getType()) {
|
||||||
@ -202,16 +194,16 @@ class ServerPartService extends EquipmentService
|
|||||||
case 'OS':
|
case 'OS':
|
||||||
case 'DB':
|
case 'DB':
|
||||||
case 'SOFTWARE':
|
case 'SOFTWARE':
|
||||||
$entity = $this->getPartService()->setServerPart($entity, $formDatas);
|
$entity = $this->getPartService()->setServerPart($action, $entity, $formDatas);
|
||||||
break;
|
break;
|
||||||
case 'SWITCH':
|
case 'SWITCH':
|
||||||
$entity = $this->getSwitchService()->setServerPart($entity, $formDatas);
|
$entity = $this->getSwitchService()->setServerPart($action, $entity, $formDatas);
|
||||||
break;
|
break;
|
||||||
case 'IP':
|
case 'IP':
|
||||||
$entity = $this->getIPService()->setServerPart($entity, $formDatas);
|
$entity = $this->getIPService()->setServerPart($action, $entity, $formDatas);
|
||||||
break;
|
break;
|
||||||
case 'CS':
|
case 'CS':
|
||||||
$entity = $this->getCSService()->setServerPart($entity, $formDatas);
|
$entity = $this->getCSService()->setServerPart($action, $entity, $formDatas);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $entity;
|
return $entity;
|
||||||
@ -238,9 +230,9 @@ class ServerPartService extends EquipmentService
|
|||||||
$formDatas["serverinfo_uid"] = $serverEntity->getPK();
|
$formDatas["serverinfo_uid"] = $serverEntity->getPK();
|
||||||
$entity = parent::create($formDatas);
|
$entity = parent::create($formDatas);
|
||||||
//부품정보 설정
|
//부품정보 설정
|
||||||
$entity = $this->setServerPart($entity, ['part_uid' => $formDatas['part_uid'], 'status' => STATUS['OCCUPIED']]);
|
$entity = $this->setServerPart(__FUNCTION__, $entity, ['part_uid' => $formDatas['part_uid'], 'status' => STATUS['OCCUPIED']]);
|
||||||
//결제관련정보 설정
|
//결제관련정보 설정
|
||||||
$entity = $this->getPaymentService(__FUNCTION__)->setServerPart($entity);
|
$entity = $this->getPaymentService()->setServerPart(__FUNCTION__, $entity);
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
//수정
|
//수정
|
||||||
@ -256,7 +248,7 @@ class ServerPartService extends EquipmentService
|
|||||||
}
|
}
|
||||||
//부품연결정보에 부품정보가 변경된 경우(기존것은 AVAILABLE로 변경)
|
//부품연결정보에 부품정보가 변경된 경우(기존것은 AVAILABLE로 변경)
|
||||||
if ($entity->getPartUID() != $formDatas['part_uid']) {
|
if ($entity->getPartUID() != $formDatas['part_uid']) {
|
||||||
$entity = $this->setServerPart($entity, ['part_uid' => $entity->getPartUID(), 'status' => STATUS['AVAILABLE']]);
|
$entity = $this->setServerPart(__FUNCTION__, $entity, ['part_uid' => $entity->getPartUID(), 'status' => STATUS['AVAILABLE']]);
|
||||||
}
|
}
|
||||||
//수정작업
|
//수정작업
|
||||||
$formDatas["clientinfo_uid"] = $serverEntity->getClientInfoUID();
|
$formDatas["clientinfo_uid"] = $serverEntity->getClientInfoUID();
|
||||||
@ -265,17 +257,17 @@ class ServerPartService extends EquipmentService
|
|||||||
$entity = parent::modify($entity, $formDatas);
|
$entity = parent::modify($entity, $formDatas);
|
||||||
//부품연결정보에 부품정보가 변경된 경우 OCCUPIED로 변경
|
//부품연결정보에 부품정보가 변경된 경우 OCCUPIED로 변경
|
||||||
if ($entity->getPartUID() != $formDatas['part_uid']) {
|
if ($entity->getPartUID() != $formDatas['part_uid']) {
|
||||||
$entity = $this->setServerPart($entity, ['part_uid' => $formDatas['part_uid'], 'status' => STATUS['OCCUPIED']]);
|
$entity = $this->setServerPart(__FUNCTION__, $entity, ['part_uid' => $formDatas['part_uid'], 'status' => STATUS['OCCUPIED']]);
|
||||||
}
|
}
|
||||||
//결제관련정보 정의
|
//결제관련정보 정의
|
||||||
$entity = $this->getPaymentService(__FUNCTION__)->setServerPart($entity, ['action' => __FUNCTION__]);
|
$entity = $this->getPaymentService()->setServerPart(__FUNCTION__, $entity);
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
//삭제
|
//삭제
|
||||||
public function delete(mixed $entity): ServerPartEntity
|
public function delete(mixed $entity): ServerPartEntity
|
||||||
{
|
{
|
||||||
//부품연결정보에 부품정보 정의
|
//부품연결정보에 부품정보 정의
|
||||||
$entity = $this->setServerPart($entity, ['part_uid' => $entity->getPartUID(), 'status' => STATUS['AVAILABLE']]);
|
$entity = $this->setServerPart(__FUNCTION__, $entity, ['part_uid' => $entity->getPartUID(), 'status' => STATUS['AVAILABLE']]);
|
||||||
return parent::delete($entity);
|
return parent::delete($entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
45
app/Services/Equipment/Switch/ServicePart.php
Normal file
45
app/Services/Equipment/Switch/ServicePart.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Equipment\Switch;
|
||||||
|
|
||||||
|
use App\Entities\Equipment\ServerPartEntity;
|
||||||
|
use App\Entities\Equipment\SwitchEntity;
|
||||||
|
use App\Interfaces\Equipment\ServerPartInterface;
|
||||||
|
use App\Services\Equipment\SwitchService;
|
||||||
|
|
||||||
|
class ServicePart extends SwitchService implements ServerPartInterface
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
//서버연결정보용 등록
|
||||||
|
public function setServerPart(string $action, ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity
|
||||||
|
{
|
||||||
|
if (!array_key_exists('part_uid', $serverPartDatas)) {
|
||||||
|
throw new \Exception(__METHOD__ . "에서 오류발생: 부품번호가 정의되지 않았습니다.");
|
||||||
|
}
|
||||||
|
if (!array_key_exists('status', $serverPartDatas)) {
|
||||||
|
throw new \Exception(__METHOD__ . "에서 오류발생: 상태가 정의되지 않았습니다.");
|
||||||
|
}
|
||||||
|
$entity = $this->getEntity($serverPartDatas['part_uid']);
|
||||||
|
if (!($entity instanceof SwitchEntity)) {
|
||||||
|
throw new \Exception("{$serverPartDatas['part_uid']}에 해당하는 스위치정보를 찾을수없습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//부품정보에 서버정보 설정 및 서비스,고객정보 정의
|
||||||
|
$formDatas = [];
|
||||||
|
if ($serverPartDatas['status'] === STATUS['AVAILABLE']) {
|
||||||
|
//사용가능
|
||||||
|
$formDatas['clientinfo_uid'] = null;
|
||||||
|
$formDatas['serviceinfo_uid'] = null;
|
||||||
|
$formDatas['serverinfo_uid'] = null;
|
||||||
|
} else {
|
||||||
|
$formDatas['clientinfo_uid'] = $serverPartEntity->getClientInfoUID();
|
||||||
|
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
||||||
|
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
||||||
|
}
|
||||||
|
$formDatas['status'] = $serverPartDatas['status'];
|
||||||
|
return $serverPartEntity->setPartEntity($this->modify($entity, $formDatas));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,14 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Services\Equipment;
|
namespace App\Services\Equipment;
|
||||||
|
|
||||||
use App\Entities\Equipment\ServerPartEntity;
|
|
||||||
use App\Entities\Equipment\SwitchEntity;
|
|
||||||
use App\Helpers\Equipment\SwitchHelper;
|
use App\Helpers\Equipment\SwitchHelper;
|
||||||
use App\Interfaces\Equipment\ServerPartInterface;
|
|
||||||
use App\Models\Equipment\SwitchModel;
|
use App\Models\Equipment\SwitchModel;
|
||||||
use App\Services\Equipment\EquipmentService;
|
use App\Services\Equipment\EquipmentService;
|
||||||
|
|
||||||
class SwitchService extends EquipmentService implements ServerPartInterface
|
class SwitchService extends EquipmentService
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -50,35 +47,6 @@ class SwitchService extends EquipmentService implements ServerPartInterface
|
|||||||
}
|
}
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
//FieldForm관련용
|
//FieldForm관련용
|
||||||
//서비스파트 설정
|
|
||||||
public function setServerPart(ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity
|
|
||||||
{
|
|
||||||
if (!array_key_exists('part_uid', $serverPartDatas)) {
|
|
||||||
throw new \Exception(__METHOD__ . "에서 오류발생: 부품번호가 정의되지 않았습니다.");
|
|
||||||
}
|
|
||||||
if (!array_key_exists('status', $serverPartDatas)) {
|
|
||||||
throw new \Exception(__METHOD__ . "에서 오류발생: 상태가 정의되지 않았습니다.");
|
|
||||||
}
|
|
||||||
$entity = $this->getEntity($serverPartDatas['part_uid']);
|
|
||||||
if (!($entity instanceof SwitchEntity)) {
|
|
||||||
throw new \Exception("{$serverPartDatas['part_uid']}에 해당하는 스위치정보를 찾을수없습니다.");
|
|
||||||
}
|
|
||||||
|
|
||||||
//부품정보에 서버정보 설정 및 서비스,고객정보 정의
|
|
||||||
$formDatas = [];
|
|
||||||
if ($serverPartDatas['status'] === STATUS['AVAILABLE']) {
|
|
||||||
//사용가능
|
|
||||||
$formDatas['clientinfo_uid'] = null;
|
|
||||||
$formDatas['serviceinfo_uid'] = null;
|
|
||||||
$formDatas['serverinfo_uid'] = null;
|
|
||||||
} else {
|
|
||||||
$formDatas['clientinfo_uid'] = $serverPartEntity->getClientInfoUID();
|
|
||||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
|
||||||
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
|
||||||
}
|
|
||||||
$formDatas['status'] = $serverPartDatas['status'];
|
|
||||||
return $serverPartEntity->setPartEntity($this->modify($entity, $formDatas));
|
|
||||||
}
|
|
||||||
//List 검색용
|
//List 검색용
|
||||||
//OrderBy 처리
|
//OrderBy 처리
|
||||||
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||||
|
|||||||
@ -1,24 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Services\Payment;
|
|
||||||
|
|
||||||
use App\Entities\Customer\ServiceEntity;
|
|
||||||
use App\Entities\Equipment\ServerPartEntity;
|
|
||||||
use App\Entities\PaymentEntity;
|
|
||||||
|
|
||||||
class CreatePayment extends PaymentService
|
|
||||||
{
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
//서버연결정보용 등록
|
|
||||||
protected function setServerPart_process(ServerPartEntity $serverPartEntity, ServiceEntity $serviceEntity, array $formDatas): serverPartEntity
|
|
||||||
{
|
|
||||||
$serverPartEntity = parent::setServerPart_process($serverPartEntity, $serviceEntity, $formDatas);
|
|
||||||
//지급기한일 설정
|
|
||||||
$formDatas['billing_at'] = $serverPartEntity->getBilling() === PAYMENT['BILLING']['ONETIME'] ? date("Y-m-d") : $serviceEntity->getBillingAT();
|
|
||||||
$entity = $this->create($formDatas);
|
|
||||||
return $serverPartEntity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Services\Payment;
|
|
||||||
|
|
||||||
use App\Entities\Customer\ServiceEntity;
|
|
||||||
use App\Entities\Equipment\ServerPartEntity;
|
|
||||||
use App\Entities\PaymentEntity;
|
|
||||||
|
|
||||||
class ModifyPayment extends PaymentService
|
|
||||||
{
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
//서버연결정보용 수정
|
|
||||||
protected function setServerPart_process(ServerPartEntity $serverPartEntity, ServiceEntity $serviceEntity, array $formDatas): serverPartEntity
|
|
||||||
{
|
|
||||||
$serverPartEntity = parent::setServerPart_process($serverPartEntity, $serviceEntity, $formDatas);
|
|
||||||
if (!array_key_exists('serverpartinfo_uid', $formDatas)) {
|
|
||||||
throw new \Exception(__METHOD__ . "에서 오류발생: 기존 결제정보가 지정되지 않았습니다.");
|
|
||||||
}
|
|
||||||
$entity = $this->getEntity(['serverpartinfo_uid' => $serverPartEntity->getPK(), 'status' => STATUS['UNPAID']]);
|
|
||||||
if (!$entity instanceof PaymentEntity) {
|
|
||||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$serverPartEntity->getPK()}에 해당하는 결제정보를 찾을수 없습니다.");
|
|
||||||
}
|
|
||||||
$entity = $this->modify($entity, $formDatas);
|
|
||||||
return $serverPartEntity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
35
app/Services/Payment/Service.php
Normal file
35
app/Services/Payment/Service.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Payment;
|
||||||
|
|
||||||
|
use App\Entities\Customer\ServiceEntity;
|
||||||
|
use App\Entities\Equipment\ServerPartEntity;
|
||||||
|
use App\Interfaces\Customer\ServiceInterface;
|
||||||
|
use App\Services\Customer\ServiceService;
|
||||||
|
|
||||||
|
class Service extends ServiceService implements ServiceInterface
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
//서버연결정보용 등록
|
||||||
|
//서비스정보용 등록
|
||||||
|
public function setService(string $action, ServiceEntity $serviceEntity, array $serviceDatas = []): ServiceEntity
|
||||||
|
{
|
||||||
|
$formDatas = [];
|
||||||
|
$formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUID();
|
||||||
|
$formDatas['serviceinfo_uid'] = $serviceEntity->getPK();
|
||||||
|
$formDatas['serverinfo_uid'] = $serviceEntity->getServerInfoUID();
|
||||||
|
$formDatas['title'] = $serviceEntity->getServerEntity()->getTitle();
|
||||||
|
$formDatas['amount'] = $serviceEntity->getAmount();
|
||||||
|
$formDatas['billing'] = PAYMENT['BILLING']['MONTH'];
|
||||||
|
$formDatas['billing_at'] = $serviceEntity->getBillingAt();
|
||||||
|
$this->create($formDatas);
|
||||||
|
return $serviceEntity;
|
||||||
|
}
|
||||||
|
public function setServiceAmount(ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity
|
||||||
|
{
|
||||||
|
return $serverPartEntity;
|
||||||
|
}
|
||||||
|
}
|
||||||
77
app/Services/Payment/ServicePart.php
Normal file
77
app/Services/Payment/ServicePart.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Payment;
|
||||||
|
|
||||||
|
use App\Entities\Equipment\ServerPartEntity;
|
||||||
|
use App\Entities\PaymentEntity;
|
||||||
|
use App\Interfaces\Equipment\ServerPartInterface;
|
||||||
|
use App\Services\PaymentService;
|
||||||
|
|
||||||
|
class ServicePart extends PaymentService implements ServerPartInterface
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
//서버연결정보용 등록
|
||||||
|
public function setServerPart(string $action, ServerPartEntity $serverPartEntity, array $serverPartDatas = []): ServerPartEntity
|
||||||
|
{
|
||||||
|
$formDatas = [];
|
||||||
|
switch ($serverPartEntity->getBilling()) {
|
||||||
|
case PAYMENT['BILLING']['MONTH']:
|
||||||
|
if ($serverPartEntity->getServiceInfoUID() === null) {
|
||||||
|
throw new \Exception(lang("{$this->getClassName()}.BILLING." . PAYMENT['BILLING']['MONTH']) . "지급 상품은 서비스정보가 정의된 후에만 가능합니다.");
|
||||||
|
}
|
||||||
|
//Service Entity 가져오기
|
||||||
|
$serviceEntity = $this->getServiceService()->getEntity($serverPartEntity->getServiceInfoUID());
|
||||||
|
if (!$serviceEntity) {
|
||||||
|
throw new \Exception("[{$serverPartEntity->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다.");
|
||||||
|
}
|
||||||
|
//월비용인경우 서비스 제공가에 서버연결정보 제공가 합산금액으로 설정
|
||||||
|
if ($serverPartEntity->getBilling() === PAYMENT['BILLING']['MONTH']) {
|
||||||
|
$formDatas['serverinfo_uid'] = $serviceEntity->getServerInfoUID();
|
||||||
|
$formDatas['billing_at'] = $serviceEntity->getBillingAt();
|
||||||
|
$formDatas['amount'] = $serviceEntity->getAmount() + $serverPartEntity->getAmount();
|
||||||
|
$this->getServiceService()->modify($serviceEntity, $formDatas);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PAYMENT['BILLING']['ONETIME']:
|
||||||
|
if ($serverPartEntity->getServiceInfoUID() === null) {
|
||||||
|
throw new \Exception(lang("{$this->getClassName()}.BILLING." . PAYMENT['BILLING']['ONETIME']) . "지급 상품은 서비스정보가 정의된 후에만 가능합니다.");
|
||||||
|
}
|
||||||
|
//Service Entity 가져오기
|
||||||
|
$serviceEntity = $this->getServiceService()->getEntity($serverPartEntity->getServiceInfoUID());
|
||||||
|
if (!$serviceEntity) {
|
||||||
|
throw new \Exception("[{$serverPartEntity->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다.");
|
||||||
|
}
|
||||||
|
//일회성인경우
|
||||||
|
if ($serverPartEntity->getBilling() === PAYMENT['BILLING']['ONETIME']) {
|
||||||
|
$formDatas['clientinfo_uid'] = $serverPartEntity->getClientInfoUID();
|
||||||
|
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
||||||
|
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
||||||
|
$formDatas['serverpartinfo_uid'] = $serverPartEntity->getPK();
|
||||||
|
$formDatas['title'] = $serverPartEntity->getType() === 'ETC' ? $serverPartEntity->getTitle() : $serverPartEntity->getPartEntity()->getTitle();
|
||||||
|
$formDatas['amount'] = $serverPartEntity->getAmount();
|
||||||
|
$formDatas['billing'] = $serverPartEntity->getBilling();
|
||||||
|
$formDatas['billing_at'] = $serverPartEntity->getBilling() === PAYMENT['BILLING']['ONETIME'] ? date("Y-m-d") : $serviceEntity->getBillingAT();
|
||||||
|
if ($action === 'create') {
|
||||||
|
//지급기한일 설정
|
||||||
|
$formDatas['billing_at'] = $serverPartEntity->getBilling() === PAYMENT['BILLING']['ONETIME'] ? date("Y-m-d") : $serviceEntity->getBillingAT();
|
||||||
|
$this->create($formDatas);
|
||||||
|
}
|
||||||
|
if ($action === 'modify') {
|
||||||
|
if (!array_key_exists('serverpartinfo_uid', $formDatas)) {
|
||||||
|
throw new \Exception(__METHOD__ . "에서 오류발생: 기존 결제정보가 지정되지 않았습니다.");
|
||||||
|
}
|
||||||
|
$entity = $this->getEntity(['serverpartinfo_uid' => $serverPartEntity->getPK(), 'status' => STATUS['UNPAID']]);
|
||||||
|
if (!$entity instanceof PaymentEntity) {
|
||||||
|
throw new \Exception(__METHOD__ . "에서 오류발생: {$serverPartEntity->getPK()}에 해당하는 결제정보를 찾을수 없습니다.");
|
||||||
|
}
|
||||||
|
$this->modify($entity, $formDatas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $serverPartEntity;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,19 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Services\Payment;
|
namespace App\Services;
|
||||||
|
|
||||||
use App\Entities\Customer\ServiceEntity;
|
use App\Entities\Customer\ServiceEntity;
|
||||||
use App\Entities\Equipment\ServerPartEntity;
|
|
||||||
use App\Entities\PaymentEntity;
|
use App\Entities\PaymentEntity;
|
||||||
use App\Helpers\PaymentHelper;
|
use App\Helpers\PaymentHelper;
|
||||||
use App\Interfaces\Equipment\ServerPartInterface;
|
|
||||||
use App\Models\PaymentModel;
|
use App\Models\PaymentModel;
|
||||||
use App\Services\CommonService;
|
use App\Services\CommonService;
|
||||||
use App\Services\Customer\ClientService;
|
use App\Services\Customer\ClientService;
|
||||||
use App\Services\Customer\ServiceService;
|
use App\Services\Customer\ServiceService;
|
||||||
use App\Services\UserService;
|
use App\Services\UserService;
|
||||||
|
|
||||||
class PaymentService extends CommonService implements ServerPartInterface
|
class PaymentService extends CommonService
|
||||||
{
|
{
|
||||||
private ?UserService $_userService = null;
|
private ?UserService $_userService = null;
|
||||||
private ?ClientService $_clientService = null;
|
private ?ClientService $_clientService = null;
|
||||||
@ -151,66 +149,4 @@ class PaymentService extends CommonService implements ServerPartInterface
|
|||||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||||
return parent::modify($entity, $formDatas);
|
return parent::modify($entity, $formDatas);
|
||||||
}
|
}
|
||||||
protected function setServerPart_process(ServerPartEntity $serverPartEntity, ServiceEntity $serviceEntity, array $formDatas): serverPartEntity
|
|
||||||
{
|
|
||||||
return $serverPartEntity;
|
|
||||||
}
|
|
||||||
public function setServerPart(ServerPartEntity $serverPartEntity, array $formDatas = []): ServerPartEntity
|
|
||||||
{
|
|
||||||
switch ($serverPartEntity->getBilling()) {
|
|
||||||
case PAYMENT['BILLING']['MONTH']:
|
|
||||||
if ($serverPartEntity->getServiceInfoUID() === null) {
|
|
||||||
throw new \Exception(lang("{$this->getClassName()}.BILLING." . PAYMENT['BILLING']['MONTH']) . "지급 상품은 서비스정보가 정의된 후에만 가능합니다.");
|
|
||||||
}
|
|
||||||
//Service Entity 가져오기
|
|
||||||
$serviceEntity = $this->getServiceService()->getEntity($serverPartEntity->getServiceInfoUID());
|
|
||||||
if (!$serviceEntity) {
|
|
||||||
throw new \Exception("[{$serverPartEntity->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다.");
|
|
||||||
}
|
|
||||||
//월비용인경우 서비스 제공가에 서버연결정보 제공가 합산금액으로 설정
|
|
||||||
if ($serverPartEntity->getBilling() === PAYMENT['BILLING']['MONTH']) {
|
|
||||||
$formDatas['serverinfo_uid'] = $serviceEntity->getServerInfoUID();
|
|
||||||
$formDatas['billing_at'] = $serviceEntity->getBillingAt();
|
|
||||||
$formDatas['amount'] = $serviceEntity->getAmount() + $serverPartEntity->getAmount();
|
|
||||||
$this->getServiceService()->modify($serviceEntity, $formDatas);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PAYMENT['BILLING']['ONETIME']:
|
|
||||||
if ($serverPartEntity->getServiceInfoUID() === null) {
|
|
||||||
throw new \Exception(lang("{$this->getClassName()}.BILLING." . PAYMENT['BILLING']['ONETIME']) . "지급 상품은 서비스정보가 정의된 후에만 가능합니다.");
|
|
||||||
}
|
|
||||||
//Service Entity 가져오기
|
|
||||||
$serviceEntity = $this->getServiceService()->getEntity($serverPartEntity->getServiceInfoUID());
|
|
||||||
if (!$serviceEntity) {
|
|
||||||
throw new \Exception("[{$serverPartEntity->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다.");
|
|
||||||
}
|
|
||||||
//일회성인경우
|
|
||||||
if ($serverPartEntity->getBilling() === PAYMENT['BILLING']['ONETIME']) {
|
|
||||||
$formDatas['clientinfo_uid'] = $serverPartEntity->getClientInfoUID();
|
|
||||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
|
||||||
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
|
||||||
$formDatas['serverpartinfo_uid'] = $serverPartEntity->getPK();
|
|
||||||
$formDatas['title'] = $serverPartEntity->getType() === 'ETC' ? $serverPartEntity->getTitle() : $serverPartEntity->getPartEntity()->getTitle();
|
|
||||||
$formDatas['amount'] = $serverPartEntity->getAmount();
|
|
||||||
$formDatas['billing'] = $serverPartEntity->getBilling();
|
|
||||||
$formDatas['billing_at'] = $serverPartEntity->getBilling() === PAYMENT['BILLING']['ONETIME'] ? date("Y-m-d") : $serviceEntity->getBillingAT();
|
|
||||||
$serverPartEntity = $this->setServerPart_process($serverPartEntity, $serviceEntity, $formDatas);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $serverPartEntity;
|
|
||||||
}
|
|
||||||
//서비스정보용 등록
|
|
||||||
public function service(ServiceEntity $serviceEntity, array $formDatas = []): ServiceEntity
|
|
||||||
{
|
|
||||||
$formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUID();
|
|
||||||
$formDatas['serviceinfo_uid'] = $serviceEntity->getPK();
|
|
||||||
$formDatas['serverinfo_uid'] = $serviceEntity->getServerInfoUID();
|
|
||||||
$formDatas['title'] = $serviceEntity->getServerEntity()->getTitle();
|
|
||||||
$formDatas['amount'] = $serviceEntity->getAmount();
|
|
||||||
$formDatas['billing'] = PAYMENT['BILLING']['MONTH'];
|
|
||||||
$formDatas['billing_at'] = $serviceEntity->getBillingAt();
|
|
||||||
$this->create($formDatas);
|
|
||||||
return $serviceEntity;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
22
app/Services/Service/ServicePart.php
Normal file
22
app/Services/Service/ServicePart.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Service;
|
||||||
|
|
||||||
|
use App\Entities\Equipment\ServerPartEntity;
|
||||||
|
use App\Interfaces\Equipment\ServerPartInterface;
|
||||||
|
use App\Services\Customer\ServiceService;
|
||||||
|
|
||||||
|
|
||||||
|
class ServicePart extends ServiceService implements ServerPartInterface
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
//서버연결정보용 등록
|
||||||
|
public function setServerPart(string $action, ServerPartEntity $serverPartEntity, array $serverPartDatas = []): ServerPartEntity
|
||||||
|
{
|
||||||
|
$formDatas = [];
|
||||||
|
return $serverPartEntity;
|
||||||
|
}
|
||||||
|
}
|
||||||
25
app/Views/admin/service/modify_form.php
Normal file
25
app/Views/admin/service/modify_form.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
<?php if ($error = session('error')): echo $viewDatas['service']->getHelper()->alert($error) ?><?php endif ?>
|
||||||
|
<div id="container" class="content">
|
||||||
|
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
|
||||||
|
<?= form_open(current_url(), ['id' => 'action_form', ...$viewDatas['forms']['attributes']], $viewDatas['forms']['hiddens']) ?>
|
||||||
|
<div class="action_form">
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<?php foreach ($viewDatas['control']['actionFields'] as $field): ?>
|
||||||
|
<tr>
|
||||||
|
<th nowrap class="text-end"><?= $viewDatas['service']->getHelper()->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||||
|
<td nowrap class="text-start">
|
||||||
|
<?= $viewDatas['service']->getHelper()->getFieldForm($field, old($field) ?? $viewDatas['entity']->$field ?? null, $viewDatas) ?>
|
||||||
|
<div><?= validation_show_error($field); ?></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
<div class="text-center"><?= form_submit("", '수정', ["class" => "btn btn-outline btn-primary"]) ?></div>
|
||||||
|
<?= form_close(); ?>
|
||||||
|
</div>
|
||||||
|
<div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
|
||||||
|
</div>
|
||||||
|
<script src="/js/admin/service.js"></script>
|
||||||
|
<?= $this->endSection() ?>
|
||||||
Loading…
Reference in New Issue
Block a user