dbmsv2 init...1
This commit is contained in:
parent
97762c858b
commit
9bd48d3f00
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Cells\Customer;
|
namespace App\Cells\Customer;
|
||||||
|
|
||||||
use App\Services\Customer\PaymentService;
|
use App\Services\PaymentService;
|
||||||
use App\Services\Customer\ServiceService;
|
use App\Services\Customer\ServiceService;
|
||||||
|
|
||||||
class ServiceCell extends CustomerCell
|
class ServiceCell extends CustomerCell
|
||||||
|
|||||||
@ -240,6 +240,7 @@ define('ICONS', [
|
|||||||
'SERVER_ITEM_SOFTWARE' => '<i class="bi bi-window-sidebar"></i>',
|
'SERVER_ITEM_SOFTWARE' => '<i class="bi bi-window-sidebar"></i>',
|
||||||
'SERVER_ITEM_IP' => '<i class="bi bi-globe2"></i>',
|
'SERVER_ITEM_IP' => '<i class="bi bi-globe2"></i>',
|
||||||
'SERVER_ITEM_CS' => '<i class="bi bi-shield-check"></i>',
|
'SERVER_ITEM_CS' => '<i class="bi bi-shield-check"></i>',
|
||||||
|
'SERVER_ITEM_ETC' => '<i class="bi bi-patch-question"></i>',
|
||||||
]);
|
]);
|
||||||
//메신저 아이콘
|
//메신저 아이콘
|
||||||
define('MESSENGER_ICONS', [
|
define('MESSENGER_ICONS', [
|
||||||
@ -398,9 +399,9 @@ define("SERVICE", [
|
|||||||
//서버파트 관련
|
//서버파트 관련
|
||||||
define("SERVERPART", [
|
define("SERVERPART", [
|
||||||
"CNT_RANGE" => array_combine(range(1, 10), range(1, 10)),
|
"CNT_RANGE" => array_combine(range(1, 10), range(1, 10)),
|
||||||
"SERVER_PARTTYPES" => ['CPU', 'RAM', 'DISK'],
|
"SERVER_PARTTYPES" => ['CPU', 'RAM', 'DISK', 'ETC'],
|
||||||
"SERVICE_PARTTYPES" => ['SWITCH', 'IP', 'OS', 'SOFTWARE', 'CS'],
|
"SERVICE_PARTTYPES" => ['SWITCH', 'IP', 'OS', 'SOFTWARE', 'CS', 'ETC'],
|
||||||
"ALL_PARTTYPES" => ['CPU', 'RAM', 'DISK', 'OS', 'DB', 'SOFTWARE', 'SWITCH', 'IP', 'CS'],
|
"ALL_PARTTYPES" => ['CPU', 'RAM', 'DISK', 'OS', 'DB', 'SOFTWARE', 'SWITCH', 'IP', 'CS', 'ETC'],
|
||||||
]);
|
]);
|
||||||
//결제 관련
|
//결제 관련
|
||||||
define("PAYMENT", [
|
define("PAYMENT", [
|
||||||
|
|||||||
@ -3,12 +3,12 @@
|
|||||||
namespace App\Controllers\Admin\Customer;
|
namespace App\Controllers\Admin\Customer;
|
||||||
|
|
||||||
use App\Entities\Customer\ClientEntity;
|
use App\Entities\Customer\ClientEntity;
|
||||||
use App\Entities\Customer\PaymentEntity;
|
use App\Entities\PaymentEntity;
|
||||||
use App\Entities\Customer\ServiceEntity;
|
use App\Entities\Customer\ServiceEntity;
|
||||||
use App\Libraries\LogCollector;
|
use App\Libraries\LogCollector;
|
||||||
|
|
||||||
use App\Services\Customer\ClientService;
|
use App\Services\Customer\ClientService;
|
||||||
use App\Services\Customer\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\Customer\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;
|
||||||
|
|||||||
@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Controllers\Admin;
|
namespace App\Controllers\Admin;
|
||||||
|
|
||||||
use App\Helpers\HomeHelper;
|
|
||||||
use App\Services\Customer\ServiceService;
|
use App\Services\Customer\ServiceService;
|
||||||
use App\Services\Customer\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\CLI;
|
namespace App\Controllers\CLI;
|
||||||
|
|
||||||
use App\Controllers\BaseController;
|
use App\Controllers\BaseController;
|
||||||
use App\Entities\Customer\PaymentEntity;
|
use App\Entities\PaymentEntity;
|
||||||
use App\Entities\Customer\ServiceEntity;
|
use App\Entities\Customer\ServiceEntity;
|
||||||
use App\Services\Customer\ServiceService;
|
use App\Services\Customer\ServiceService;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
|
|||||||
@ -4,8 +4,8 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"width": 3000,
|
"width": 3000,
|
||||||
"height": 3000,
|
"height": 3000,
|
||||||
"scrollTop": -1655.4768,
|
"scrollTop": -660.4768,
|
||||||
"scrollLeft": -167,
|
"scrollLeft": -1800,
|
||||||
"zoomLevel": 0.76,
|
"zoomLevel": 0.76,
|
||||||
"show": 511,
|
"show": 511,
|
||||||
"database": 4,
|
"database": 4,
|
||||||
@ -604,6 +604,7 @@
|
|||||||
"s1Az-lXWK0NlVQqFEEK8o",
|
"s1Az-lXWK0NlVQqFEEK8o",
|
||||||
"8mPFhDdUY8QLPvc8rNw1B",
|
"8mPFhDdUY8QLPvc8rNw1B",
|
||||||
"vxhl-9RMNJ8zU9oqzEWo8",
|
"vxhl-9RMNJ8zU9oqzEWo8",
|
||||||
|
"d4HxTQuDbI7SN2qBS84s2",
|
||||||
"vbPIGWHquXROtCfId6RVF",
|
"vbPIGWHquXROtCfId6RVF",
|
||||||
"FhnUrn_dOrdhaBe_P3ty-",
|
"FhnUrn_dOrdhaBe_P3ty-",
|
||||||
"SA3xJ9nRW8EWDCFoMjnj3",
|
"SA3xJ9nRW8EWDCFoMjnj3",
|
||||||
@ -631,6 +632,7 @@
|
|||||||
"8mPFhDdUY8QLPvc8rNw1B",
|
"8mPFhDdUY8QLPvc8rNw1B",
|
||||||
"LRN5qjIRZ18UOhqFbBLuo",
|
"LRN5qjIRZ18UOhqFbBLuo",
|
||||||
"vxhl-9RMNJ8zU9oqzEWo8",
|
"vxhl-9RMNJ8zU9oqzEWo8",
|
||||||
|
"d4HxTQuDbI7SN2qBS84s2",
|
||||||
"vbPIGWHquXROtCfId6RVF",
|
"vbPIGWHquXROtCfId6RVF",
|
||||||
"FhnUrn_dOrdhaBe_P3ty-",
|
"FhnUrn_dOrdhaBe_P3ty-",
|
||||||
"SA3xJ9nRW8EWDCFoMjnj3",
|
"SA3xJ9nRW8EWDCFoMjnj3",
|
||||||
@ -651,7 +653,7 @@
|
|||||||
"color": ""
|
"color": ""
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"updateAt": 1756951965260,
|
"updateAt": 1758175481304,
|
||||||
"createAt": 1748484896313
|
"createAt": 1748484896313
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -8386,6 +8388,26 @@
|
|||||||
"updateAt": 1758087660022,
|
"updateAt": 1758087660022,
|
||||||
"createAt": 1758087641569
|
"createAt": 1758087641569
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"d4HxTQuDbI7SN2qBS84s2": {
|
||||||
|
"id": "d4HxTQuDbI7SN2qBS84s2",
|
||||||
|
"tableId": "QCNA57Pi6A9dJDgybxS5v",
|
||||||
|
"name": "serverpartinfo_uid",
|
||||||
|
"comment": "서버파트연결정보",
|
||||||
|
"dataType": "INT",
|
||||||
|
"default": "",
|
||||||
|
"options": 0,
|
||||||
|
"ui": {
|
||||||
|
"keys": 0,
|
||||||
|
"widthName": 97,
|
||||||
|
"widthComment": 98,
|
||||||
|
"widthDataType": 60,
|
||||||
|
"widthDefault": 60
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"updateAt": 1758175486130,
|
||||||
|
"createAt": 1758175348505
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relationshipEntities": {
|
"relationshipEntities": {
|
||||||
@ -8465,7 +8487,7 @@
|
|||||||
"s1Az-lXWK0NlVQqFEEK8o"
|
"s1Az-lXWK0NlVQqFEEK8o"
|
||||||
],
|
],
|
||||||
"x": 2338.5336,
|
"x": 2338.5336,
|
||||||
"y": 618.633,
|
"y": 624.633,
|
||||||
"direction": 1
|
"direction": 1
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
@ -8717,7 +8739,7 @@
|
|||||||
"8mPFhDdUY8QLPvc8rNw1B"
|
"8mPFhDdUY8QLPvc8rNw1B"
|
||||||
],
|
],
|
||||||
"x": 2338.5336,
|
"x": 2338.5336,
|
||||||
"y": 802.633,
|
"y": 820.633,
|
||||||
"direction": 1
|
"direction": 1
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
@ -8772,8 +8794,8 @@
|
|||||||
"columnIds": [
|
"columnIds": [
|
||||||
"vxhl-9RMNJ8zU9oqzEWo8"
|
"vxhl-9RMNJ8zU9oqzEWo8"
|
||||||
],
|
],
|
||||||
"x": 2649.0336,
|
"x": 2657.5336,
|
||||||
"y": 894.633,
|
"y": 918.633,
|
||||||
"direction": 8
|
"direction": 8
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -24,7 +24,7 @@ class ServerPartEntity extends EquipmentEntity
|
|||||||
//기본기능용
|
//기본기능용
|
||||||
public function getPartUID(): int
|
public function getPartUID(): int
|
||||||
{
|
{
|
||||||
return $this->attributes['part_uid'] ?? 0;
|
return intval($this->attributes['part_uid']) ?? 0;
|
||||||
}
|
}
|
||||||
public function getType(): string
|
public function getType(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,15 +1,27 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Entities\Customer;
|
namespace App\Entities;
|
||||||
|
|
||||||
use App\Models\Customer\PaymentModel;
|
use App\Models\PaymentModel;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
|
||||||
class PaymentEntity extends CustomerEntity
|
class PaymentEntity extends CommonEntity
|
||||||
{
|
{
|
||||||
const PK = PaymentModel::PK;
|
const PK = PaymentModel::PK;
|
||||||
const TITLE = PaymentModel::TITLE;
|
const TITLE = PaymentModel::TITLE;
|
||||||
const DEFAULT_STATUS = STATUS['UNPAID'];
|
const DEFAULT_STATUS = STATUS['UNPAID'];
|
||||||
|
final public function getUserUID(): int|null
|
||||||
|
{
|
||||||
|
return $this->attributes['user_uid'];
|
||||||
|
}
|
||||||
|
final public function getClientInfoUID(): int|null
|
||||||
|
{
|
||||||
|
return $this->attributes['clientinfo_uid'] ?? null;
|
||||||
|
}
|
||||||
|
final public function getServiceInfoUID(): int|null
|
||||||
|
{
|
||||||
|
return $this->attributes['serviceinfo_uid'] ?? null;
|
||||||
|
}
|
||||||
public function getBilling(): string
|
public function getBilling(): string
|
||||||
{
|
{
|
||||||
return $this->attributes['billing'] ?? "";
|
return $this->attributes['billing'] ?? "";
|
||||||
@ -31,7 +31,7 @@ class ServiceHelper extends CustomerHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($attributes as $attribute_name => $attribute_value) {
|
foreach ($attributes as $attribute_name => $attribute_value) {
|
||||||
$attribute = sprintf(" %s=\"%s\"", $attribute_name, $option_value->$attribute_value());
|
$attribute .= sprintf(" %s=\"%s\"", $attribute_name, $option_value->$attribute_value());
|
||||||
}
|
}
|
||||||
$label = $option_value->getStatus() != $option_value::DEFAULT_STATUS ? STATUS_ICONS['NOT_AVAILABLE'] : STATUS_ICONS['AVAILABLE'];
|
$label = $option_value->getStatus() != $option_value::DEFAULT_STATUS ? STATUS_ICONS['NOT_AVAILABLE'] : STATUS_ICONS['AVAILABLE'];
|
||||||
$label .= $option_value->getCustomTitle();
|
$label .= $option_value->getCustomTitle();
|
||||||
|
|||||||
@ -32,7 +32,7 @@ class ServerPartHelper extends EquipmentHelper
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
foreach ($attributes as $attribute_name => $attribute_value) {
|
foreach ($attributes as $attribute_name => $attribute_value) {
|
||||||
$attribute = sprintf(" %s=\"%s\"", $attribute_name, $option_value->$attribute_value());
|
$attribute .= sprintf(" %s=\"%s\"", $attribute_name, $option_value->$attribute_value());
|
||||||
}
|
}
|
||||||
$label = $option_value->getStatus() != $option_value::DEFAULT_STATUS ? STATUS_ICONS['NOT_AVAILABLE'] : STATUS_ICONS['AVAILABLE'];
|
$label = $option_value->getStatus() != $option_value::DEFAULT_STATUS ? STATUS_ICONS['NOT_AVAILABLE'] : STATUS_ICONS['AVAILABLE'];
|
||||||
$label .= $option_value->getCustomTitle();
|
$label .= $option_value->getCustomTitle();
|
||||||
@ -53,8 +53,8 @@ class ServerPartHelper extends EquipmentHelper
|
|||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'part_uid':
|
case 'part_uid':
|
||||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||||
$extras['onChange'] = "document.querySelector('input[name=\'amount\']').value = this.options[this.selectedIndex].getAttribute('data-price')";
|
$extras['onChange'] = "document.querySelector('input[name=\'amount\']').value = this.options[this.selectedIndex].getAttribute('data-price'); document.querySelector('input[name=\'title\']').value = this.options[this.selectedIndex].getAttribute('data-title')";
|
||||||
$attributes = ['data-price' => 'getPrice'];
|
$attributes = ['data-title' => 'getTitle', 'data-price' => 'getPrice'];
|
||||||
$form = $this->form_dropdown_common($field, $value, $viewDatas, $extras, $attributes);
|
$form = $this->form_dropdown_common($field, $value, $viewDatas, $extras, $attributes);
|
||||||
break;
|
break;
|
||||||
case 'extra':
|
case 'extra':
|
||||||
@ -83,8 +83,9 @@ class ServerPartHelper extends EquipmentHelper
|
|||||||
case 'SWITCH':
|
case 'SWITCH':
|
||||||
case 'IP':
|
case 'IP':
|
||||||
case 'CS':
|
case 'CS':
|
||||||
|
case 'ETC':
|
||||||
//파트 Entity
|
//파트 Entity
|
||||||
$title = $viewDatas['entity']->getPartEntity()->getTitle();
|
$title = $field === 'ETC' ? $viewDatas['entity']->getTitle() : $viewDatas['entity']->getPartEntity()->getTitle();
|
||||||
$title .= $viewDatas['entity']->getCnt() > 1 ? "*" . $viewDatas['entity']->getCnt() . "개" : "";
|
$title .= $viewDatas['entity']->getCnt() > 1 ? "*" . $viewDatas['entity']->getCnt() . "개" : "";
|
||||||
$title .= $viewDatas['entity']->getExtra() !== "" ? "[" . $viewDatas['entity']->getExtra() . "]" : "";
|
$title .= $viewDatas['entity']->getExtra() !== "" ? "[" . $viewDatas['entity']->getExtra() . "]" : "";
|
||||||
if (array_key_exists('return', $extras) && $extras['return'] == 'onlyText') {
|
if (array_key_exists('return', $extras) && $extras['return'] == 'onlyText') {
|
||||||
@ -125,6 +126,7 @@ class ServerPartHelper extends EquipmentHelper
|
|||||||
case 'OS':
|
case 'OS':
|
||||||
case 'DB':
|
case 'DB':
|
||||||
case 'SOFTWARE':
|
case 'SOFTWARE':
|
||||||
|
case 'ETC':
|
||||||
$extras = [
|
$extras = [
|
||||||
"class" => "btn btn-sm btn-outline btn-circle",
|
"class" => "btn btn-sm btn-outline btn-circle",
|
||||||
"target" => "_self",
|
"target" => "_self",
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Helpers\Customer;
|
namespace App\Helpers;
|
||||||
|
|
||||||
use App\Models\Customer\PaymentModel;
|
use App\Models\PaymentModel;
|
||||||
|
|
||||||
class PaymentHelper extends CustomerHelper
|
class PaymentHelper extends CommonHelper
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -6,5 +6,5 @@ use App\Entities\Equipment\ServerPartEntity;
|
|||||||
|
|
||||||
interface ServerPartInterface extends EquipmentInterface
|
interface ServerPartInterface extends EquipmentInterface
|
||||||
{
|
{
|
||||||
public function setServerPart(ServerPartEntity $serverPartEntity, mixed $uid, string $status): mixed;
|
public function setServerPart(ServerPartEntity $serverPartEntity, array $formDatas): ServerPartEntity;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,9 +6,10 @@ return [
|
|||||||
'clientinfo_uid' => "고객번호",
|
'clientinfo_uid' => "고객번호",
|
||||||
'serviceinfo_uid' => "서비스번호",
|
'serviceinfo_uid' => "서비스번호",
|
||||||
'serverinfo_uid' => "서버번호",
|
'serverinfo_uid' => "서버번호",
|
||||||
|
'title' => "제목",
|
||||||
'type' => "항목형식",
|
'type' => "항목형식",
|
||||||
'billing' => "결제방식",
|
'billing' => "결제방식",
|
||||||
'amount' => "제공가",
|
'amount' => "제공단가",
|
||||||
'cnt' => "갯수",
|
'cnt' => "갯수",
|
||||||
'extra' => "추가정보",
|
'extra' => "추가정보",
|
||||||
'updated_at' => "수정일",
|
'updated_at' => "수정일",
|
||||||
@ -30,6 +31,7 @@ return [
|
|||||||
"SWITCH" => "스위치",
|
"SWITCH" => "스위치",
|
||||||
"IP" => "IP",
|
"IP" => "IP",
|
||||||
"CS" => "CS",
|
"CS" => "CS",
|
||||||
|
"ETC" => "기타",
|
||||||
],
|
],
|
||||||
"EXTRA" => [
|
"EXTRA" => [
|
||||||
'DISK' => [
|
'DISK' => [
|
||||||
|
|||||||
@ -8,7 +8,7 @@ class ServerPartModel extends EquipmentModel
|
|||||||
{
|
{
|
||||||
const TABLE = "serverpartinfo";
|
const TABLE = "serverpartinfo";
|
||||||
const PK = "uid";
|
const PK = "uid";
|
||||||
const TITLE = "uid";
|
const TITLE = "title";
|
||||||
protected $table = self::TABLE;
|
protected $table = self::TABLE;
|
||||||
protected $primaryKey = self::PK;
|
protected $primaryKey = self::PK;
|
||||||
protected $returnType = ServerPartEntity::class;
|
protected $returnType = ServerPartEntity::class;
|
||||||
@ -17,6 +17,7 @@ class ServerPartModel extends EquipmentModel
|
|||||||
"clientinfo_uid",
|
"clientinfo_uid",
|
||||||
"serverinfo_uid",
|
"serverinfo_uid",
|
||||||
"serviceinfo_uid",
|
"serviceinfo_uid",
|
||||||
|
"title",
|
||||||
"type",
|
"type",
|
||||||
"billing",
|
"billing",
|
||||||
"amount",
|
"amount",
|
||||||
@ -34,16 +35,17 @@ class ServerPartModel extends EquipmentModel
|
|||||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||||
}
|
}
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case "part_uid":
|
|
||||||
case "serverinfo_uid":
|
case "serverinfo_uid":
|
||||||
case "cnt":
|
case "cnt":
|
||||||
case "amount":
|
case "amount":
|
||||||
$rule = "required|numeric";
|
$rule = "required|numeric";
|
||||||
break;
|
break;
|
||||||
|
case "part_uid":
|
||||||
case "clientinfo_uid":
|
case "clientinfo_uid":
|
||||||
case "serviceinfo_uid":
|
case "serviceinfo_uid":
|
||||||
$rule = "permit_empty|numeric";
|
$rule = "permit_empty|numeric";
|
||||||
break;
|
break;
|
||||||
|
case "title":
|
||||||
case "type":
|
case "type":
|
||||||
case "billing":
|
case "billing":
|
||||||
$rule = "required|trim|string";
|
$rule = "required|trim|string";
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Models\Customer;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Entities\Customer\PaymentEntity;
|
use App\Entities\PaymentEntity;
|
||||||
use App\Libraries\LogCollector;
|
|
||||||
|
|
||||||
class PaymentModel extends CustomerModel
|
class PaymentModel extends CommonModel
|
||||||
{
|
{
|
||||||
const TABLE = "payment";
|
const TABLE = "payment";
|
||||||
const PK = "uid";
|
const PK = "uid";
|
||||||
@ -17,6 +16,7 @@ class PaymentModel extends CustomerModel
|
|||||||
"user_uid",
|
"user_uid",
|
||||||
"clientinfo_uid",
|
"clientinfo_uid",
|
||||||
"serviceinfo_uid",
|
"serviceinfo_uid",
|
||||||
|
"serverpartinfo_uid",
|
||||||
"title",
|
"title",
|
||||||
"amount",
|
"amount",
|
||||||
"billing",
|
"billing",
|
||||||
@ -41,6 +41,9 @@ class PaymentModel extends CustomerModel
|
|||||||
case "amount":
|
case "amount":
|
||||||
$rule = "required|numeric";
|
$rule = "required|numeric";
|
||||||
break;
|
break;
|
||||||
|
case "serverpartinfo_uid":
|
||||||
|
$rule = "permit_empty|numeric";
|
||||||
|
break;
|
||||||
case "title":
|
case "title":
|
||||||
case "billing":
|
case "billing":
|
||||||
case "status":
|
case "status":
|
||||||
@ -5,9 +5,11 @@ 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\PaymentService;
|
||||||
|
|
||||||
class ClientService extends CustomerService
|
class ClientService extends CustomerService
|
||||||
{
|
{
|
||||||
|
private ?PaymentService $_paymentService = null;
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct(new ClientModel(), new ClientHelper());
|
parent::__construct(new ClientModel(), new ClientHelper());
|
||||||
@ -51,6 +53,13 @@ class ClientService extends CustomerService
|
|||||||
{
|
{
|
||||||
return ['site', 'role', 'status'];
|
return ['site', 'role', 'status'];
|
||||||
}
|
}
|
||||||
|
final public function getPaymentService(): PaymentService
|
||||||
|
{
|
||||||
|
if (!$this->_paymentService) {
|
||||||
|
$this->_paymentService = new PaymentService();
|
||||||
|
}
|
||||||
|
return $this->_paymentService;
|
||||||
|
}
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
|
|
||||||
//압금(쿠폰:추가)처리
|
//압금(쿠폰:추가)처리
|
||||||
|
|||||||
@ -8,11 +8,9 @@ use App\Helpers\CommonHelper;
|
|||||||
use App\Models\CommonModel;
|
use App\Models\CommonModel;
|
||||||
use App\Services\CommonService;
|
use App\Services\CommonService;
|
||||||
use App\Services\Customer\ClientService;
|
use App\Services\Customer\ClientService;
|
||||||
use App\Services\Customer\PaymentService;
|
|
||||||
use App\Services\Equipment\ServerService;
|
use App\Services\Equipment\ServerService;
|
||||||
use App\Services\Equipment\SwitchService;
|
use App\Services\Equipment\SwitchService;
|
||||||
use App\Services\UserService;
|
use App\Services\UserService;
|
||||||
use CodeIgniter\Model;
|
|
||||||
|
|
||||||
abstract class CustomerService extends CommonService
|
abstract class CustomerService extends CommonService
|
||||||
{
|
{
|
||||||
@ -21,7 +19,6 @@ abstract class CustomerService extends CommonService
|
|||||||
private ?ServiceService $_serviceService = null;
|
private ?ServiceService $_serviceService = null;
|
||||||
private ?ServerService $_serverService = null;
|
private ?ServerService $_serverService = null;
|
||||||
private ?SwitchService $_switchService = null;
|
private ?SwitchService $_switchService = null;
|
||||||
private ?PaymentService $_paymentServiceService = null;
|
|
||||||
|
|
||||||
private $_equipmentService = [];
|
private $_equipmentService = [];
|
||||||
protected function __construct(CommonModel $model, CommonHelper $helper)
|
protected function __construct(CommonModel $model, CommonHelper $helper)
|
||||||
@ -50,20 +47,6 @@ abstract class CustomerService extends CommonService
|
|||||||
}
|
}
|
||||||
return $this->_serviceService;
|
return $this->_serviceService;
|
||||||
}
|
}
|
||||||
final public function getPaymentService(): PaymentService
|
|
||||||
{
|
|
||||||
if (!$this->_paymentServiceService) {
|
|
||||||
$this->_paymentServiceService = new PaymentService();
|
|
||||||
}
|
|
||||||
return $this->_paymentServiceService;
|
|
||||||
}
|
|
||||||
final public function getSwitchService(): SwitchService
|
|
||||||
{
|
|
||||||
if (!$this->_switchService) {
|
|
||||||
$this->_switchService = new SwitchService();
|
|
||||||
}
|
|
||||||
return $this->_switchService;
|
|
||||||
}
|
|
||||||
final public function getServerService(): ServerService
|
final public function getServerService(): ServerService
|
||||||
{
|
{
|
||||||
if (!$this->_serverService) {
|
if (!$this->_serverService) {
|
||||||
|
|||||||
@ -1,129 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Services\Customer;
|
|
||||||
|
|
||||||
use App\Entities\Customer\PaymentEntity;
|
|
||||||
use App\Entities\Customer\ServiceEntity;
|
|
||||||
use App\Entities\Equipment\ServerPartEntity;
|
|
||||||
use App\Helpers\Customer\PaymentHelper;
|
|
||||||
use App\Models\Customer\PaymentModel;
|
|
||||||
|
|
||||||
class PaymentService extends CustomerService
|
|
||||||
{
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct(new PaymentModel(), new PaymentHelper());
|
|
||||||
$this->addClassName('Payment');
|
|
||||||
}
|
|
||||||
public function getModelClass(): PaymentModel
|
|
||||||
{
|
|
||||||
return new PaymentModel();
|
|
||||||
}
|
|
||||||
public function getEntityClass(): PaymentEntity
|
|
||||||
{
|
|
||||||
return new PaymentEntity();
|
|
||||||
}
|
|
||||||
public function getFormFields(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
"clientinfo_uid",
|
|
||||||
"serviceinfo_uid",
|
|
||||||
"title",
|
|
||||||
"amount",
|
|
||||||
"billing",
|
|
||||||
"billing_at",
|
|
||||||
"pay",
|
|
||||||
"status",
|
|
||||||
];
|
|
||||||
}
|
|
||||||
public function getFormFilters(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'clientinfo_uid',
|
|
||||||
"serviceinfo_uid",
|
|
||||||
'billing',
|
|
||||||
'pay',
|
|
||||||
'status',
|
|
||||||
'user_uid',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
public function getIndexFields(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'clientinfo_uid',
|
|
||||||
"serviceinfo_uid",
|
|
||||||
'billing',
|
|
||||||
'title',
|
|
||||||
'amount',
|
|
||||||
'billing_at',
|
|
||||||
'pay',
|
|
||||||
'status',
|
|
||||||
'updated_at',
|
|
||||||
'countdown',
|
|
||||||
'user_uid',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
public function getBatchjobFields(): array
|
|
||||||
{
|
|
||||||
return ['pay', 'status'];
|
|
||||||
}
|
|
||||||
public function getBatchjobButtons(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'batchjob' => '일괄 결제 ',
|
|
||||||
'invoice' => '청구서 발행',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
//기본 기능부분
|
|
||||||
//FieldForm관련용
|
|
||||||
public function getFormOption(string $field, array $options = []): array
|
|
||||||
{
|
|
||||||
switch ($field) {
|
|
||||||
case 'user_uid':
|
|
||||||
$options = $this->getUserService()->getEntities();
|
|
||||||
break;
|
|
||||||
case 'clientinfo_uid':
|
|
||||||
$options = $this->getClientService()->getEntities();
|
|
||||||
break;
|
|
||||||
case 'serviceinfo_uid':
|
|
||||||
$options = $this->getServiceService()->getEntities();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$options = parent::getFormOption($field, $options);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $options;
|
|
||||||
}
|
|
||||||
//List 검색용
|
|
||||||
//OrderBy 처리
|
|
||||||
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
|
||||||
{
|
|
||||||
$this->getModel()->orderBy('billing_at ASC');
|
|
||||||
parent::setOrderBy($field, $value);
|
|
||||||
}
|
|
||||||
//총 미납건수, 금액
|
|
||||||
public function getUnPaids(string $group, array $where = []): array
|
|
||||||
{
|
|
||||||
return $this->getModel()->groupBy($group)
|
|
||||||
->select("serviceinfo_uid,COUNT(uid) as cnt, SUM(amount) as amount")
|
|
||||||
->where(['billing_at <=' => date('Y-m-d')])
|
|
||||||
->where(['status' => STATUS['UNPAID']])
|
|
||||||
->where($where)
|
|
||||||
->get()->getResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
//생성
|
|
||||||
public function create(array $formDatas): PaymentEntity
|
|
||||||
{
|
|
||||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
|
||||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
|
||||||
return parent::create($formDatas);
|
|
||||||
}
|
|
||||||
//수정
|
|
||||||
public function modify(mixed $entity, array $formDatas): PaymentEntity
|
|
||||||
{
|
|
||||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
|
||||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
|
||||||
return parent::modify($entity, $formDatas);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -3,19 +3,21 @@
|
|||||||
namespace App\Services\Customer;
|
namespace App\Services\Customer;
|
||||||
|
|
||||||
use App\Entities\Customer\ClientEntity;
|
use App\Entities\Customer\ClientEntity;
|
||||||
use App\Entities\Customer\PaymentEntity;
|
|
||||||
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\UserEntity;
|
||||||
|
use App\Entities\PaymentEntity;
|
||||||
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\Traits\IPTrait;
|
use App\Traits\IPTrait;
|
||||||
|
use App\Services\PaymentService;
|
||||||
|
|
||||||
class ServiceService extends CustomerService
|
class ServiceService extends CustomerService
|
||||||
{
|
{
|
||||||
use IPTrait;
|
use IPTrait;
|
||||||
private ?ServerService $_serverService = null;
|
private ?ServerService $_serverService = null;
|
||||||
|
private ?PaymentService $_paymentService = null;
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct(new ServiceModel(), new ServiceHelper());
|
parent::__construct(new ServiceModel(), new ServiceHelper());
|
||||||
@ -117,6 +119,13 @@ class ServiceService extends CustomerService
|
|||||||
}
|
}
|
||||||
return $entity->setServerEntity($serverEntity);
|
return $entity->setServerEntity($serverEntity);
|
||||||
}
|
}
|
||||||
|
final public function getPaymentService(): PaymentService
|
||||||
|
{
|
||||||
|
if (!$this->_paymentService) {
|
||||||
|
$this->_paymentService = new PaymentService();
|
||||||
|
}
|
||||||
|
return $this->_paymentService;
|
||||||
|
}
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
public function getFormOption(string $field, array $options = []): array
|
public function getFormOption(string $field, array $options = []): array
|
||||||
{
|
{
|
||||||
@ -209,22 +218,14 @@ 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']));
|
||||||
// 결제정보에 추가한다.
|
// 결제정보에 추가한다.
|
||||||
$paymentDatas = [];
|
$this->getPaymentService()->service($entity);
|
||||||
$paymentDatas['clientinfo_uid'] = $entity->getClientInfoUID();
|
|
||||||
$paymentDatas['serviceinfo_uid'] = $entity->getPK();
|
|
||||||
$paymentDatas['serverinfo_uid'] = $entity->getServerInfoUID();
|
|
||||||
$paymentDatas['title'] = sprintf("[%s] 서비스", $entity->getServerEntity()->getTitle());
|
|
||||||
$paymentDatas['amount'] = $entity->getAmount();
|
|
||||||
$paymentDatas['billing'] = PAYMENT['BILLING']['MONTH'];
|
|
||||||
$paymentDatas['billing_at'] = $entity->getBillingAt();
|
|
||||||
$this->getPaymentService()->create($paymentDatas);
|
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
//수정
|
//수정
|
||||||
public function modify(mixed $entity, array $formDatas): ServiceEntity
|
public function modify(mixed $entity, array $formDatas): ServiceEntity
|
||||||
{
|
{
|
||||||
if (!array_key_exists('serverinfo_uid', $formDatas)) {
|
if (!array_key_exists('serverinfo_uid', $formDatas)) {
|
||||||
throw new \Exception("신규 서버가 지정되지 않았습니다.");
|
throw new \Exception("서버가 지정되지 않았습니다.");
|
||||||
}
|
}
|
||||||
//기존서버정보 사용가능으로 설정
|
//기존서버정보 사용가능으로 설정
|
||||||
if ($entity->getServerInfoUID() && $entity->getServerInfoUID() !== $formDatas['serverinfo_uid']) {
|
if ($entity->getServerInfoUID() && $entity->getServerInfoUID() !== $formDatas['serverinfo_uid']) {
|
||||||
@ -250,7 +251,7 @@ class ServiceService extends CustomerService
|
|||||||
$paymentDatas['clientinfo_uid'] = $entity->getClientInfoUID();
|
$paymentDatas['clientinfo_uid'] = $entity->getClientInfoUID();
|
||||||
$paymentDatas['serviceinfo_uid'] = $entity->getPK();
|
$paymentDatas['serviceinfo_uid'] = $entity->getPK();
|
||||||
$paymentDatas['serverinfo_uid'] = $entity->getServerInfoUID();
|
$paymentDatas['serverinfo_uid'] = $entity->getServerInfoUID();
|
||||||
$paymentDatas['title'] = sprintf("[%s] 서비스", $entity->getServerEntity()->getTitle());
|
$paymentDatas['title'] = $entity->getServerEntity()->getTitle();
|
||||||
$paymentDatas['amount'] = $entity->getAmount();
|
$paymentDatas['amount'] = $entity->getAmount();
|
||||||
$paymentDatas['billing'] = PAYMENT['BILLING']['MONTH'];
|
$paymentDatas['billing'] = PAYMENT['BILLING']['MONTH'];
|
||||||
$paymentDatas['billing_at'] = $entity->getBillingAt();
|
$paymentDatas['billing_at'] = $entity->getBillingAt();
|
||||||
|
|||||||
@ -55,15 +55,21 @@ class CSService extends EquipmentService implements ServerPartInterface
|
|||||||
}
|
}
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
//서비스파트 설정
|
//서비스파트 설정
|
||||||
public function setServerPart(ServerPartEntity $serverPartEntity, mixed $uid, string $status): CSEntity
|
public function setServerPart(ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity
|
||||||
{
|
{
|
||||||
$entity = $this->getEntity($uid);
|
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)) {
|
if (!($entity instanceof CSEntity)) {
|
||||||
throw new \Exception("{$uid}에 해당하는 CS정보를 찾을수없습니다.");
|
throw new \Exception("{$serverPartDatas['part_uid']}에 해당하는 CS정보를를 찾을수없습니다.");
|
||||||
}
|
}
|
||||||
//부품정보에 서버정보 설정 및 서비스,고객정보 정의
|
//부품정보에 서버정보 설정 및 서비스,고객정보 정의
|
||||||
$formDatas = [];
|
$formDatas = [];
|
||||||
if ($status === STATUS['AVAILABLE']) {
|
if ($serverPartDatas['status'] === STATUS['AVAILABLE']) {
|
||||||
//사용가능
|
//사용가능
|
||||||
$formDatas['clientinfo_uid'] = null;
|
$formDatas['clientinfo_uid'] = null;
|
||||||
$formDatas['serviceinfo_uid'] = null;
|
$formDatas['serviceinfo_uid'] = null;
|
||||||
@ -73,8 +79,8 @@ class CSService extends EquipmentService implements ServerPartInterface
|
|||||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
||||||
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
||||||
}
|
}
|
||||||
$formDatas['status'] = $status;
|
$formDatas['status'] = $serverPartDatas['status'];
|
||||||
return $this->modify($entity, $formDatas);
|
return $serverPartEntity->setPartEntity($this->modify($entity, $formDatas));
|
||||||
}
|
}
|
||||||
//List 검색용
|
//List 검색용
|
||||||
//OrderBy 처리
|
//OrderBy 처리
|
||||||
|
|||||||
@ -79,17 +79,22 @@ class IPService extends EquipmentService implements ServerPartInterface
|
|||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
//서비스 설정
|
//서비스 설정
|
||||||
public function setServerPart(ServerPartEntity $serverPartEntity, mixed $uid, string $status): IPEntity
|
//서비스파트 설정
|
||||||
|
public function setServerPart(ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity
|
||||||
{
|
{
|
||||||
$entity = $this->getEntity($uid);
|
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)) {
|
if (!($entity instanceof IPEntity)) {
|
||||||
throw new \Exception("{$uid}에 해당하는 IP정보를 찾을수없습니다.");
|
throw new \Exception("{$serverPartDatas['part_uid']}에 해당하는 IP정보를를 찾을수없습니다.");
|
||||||
}
|
}
|
||||||
//부품정보에 서버정보 설정 및 서비스,고객정보 정의
|
//부품정보에 서버정보 설정 및 서비스,고객정보 정의
|
||||||
$formDatas = [];
|
$formDatas = [];
|
||||||
//기존IP 사용자로 고객정보 설정
|
if ($serverPartDatas['status'] === STATUS['AVAILABLE']) {
|
||||||
$formDatas['old_clientinfo_uid'] = $serverPartEntity->getClientInfoUID();
|
|
||||||
if ($status === STATUS['AVAILABLE']) {
|
|
||||||
//사용가능
|
//사용가능
|
||||||
$formDatas['clientinfo_uid'] = null;
|
$formDatas['clientinfo_uid'] = null;
|
||||||
$formDatas['serviceinfo_uid'] = null;
|
$formDatas['serviceinfo_uid'] = null;
|
||||||
@ -99,8 +104,8 @@ class IPService extends EquipmentService implements ServerPartInterface
|
|||||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
||||||
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
||||||
}
|
}
|
||||||
$formDatas['status'] = $status;
|
$formDatas['status'] = $serverPartDatas['status'];
|
||||||
return $this->modify($entity, $formDatas);
|
return $serverPartEntity->setPartEntity($this->modify($entity, $formDatas));
|
||||||
}
|
}
|
||||||
//List 검색용
|
//List 검색용
|
||||||
//OrderBy 처리
|
//OrderBy 처리
|
||||||
|
|||||||
@ -49,24 +49,31 @@ class PartService extends EquipmentService implements ServerPartInterface
|
|||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
//FieldForm관련용
|
//FieldForm관련용
|
||||||
//서비스파트 설정
|
//서비스파트 설정
|
||||||
public function setServerPart(ServerPartEntity $serverPartEntity, mixed $uid, string $status): PartEntity
|
public function setServerPart(ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity
|
||||||
{
|
{
|
||||||
$entity = $this->getEntity($uid);
|
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)) {
|
if (!($entity instanceof PartEntity)) {
|
||||||
throw new \Exception("{$uid}에 해당하는 부품정보를 찾을수없습니다.");
|
throw new \Exception("{$serverPartDatas['part_uid']}에 해당하는 부품정보를 찾을수없습니다.");
|
||||||
}
|
}
|
||||||
//부품정보에 서버정보 설정 및 서비스,고객정보 정의
|
//부품정보에 서버정보 설정 및 서비스,고객정보 정의
|
||||||
$formDatas = [];
|
$formDatas = [];
|
||||||
if ($status === STATUS['AVAILABLE']) { //해지된 부품 재고수를 처리
|
if ($serverPartDatas['status'] === STATUS['AVAILABLE']) { //해지된 부품 재고수를 처리
|
||||||
$formDatas['stock'] = $entity->getStock() + $serverPartEntity->getCnt();
|
$formDatas['stock'] = $entity->getStock() + $serverPartEntity->getCnt();
|
||||||
}
|
}
|
||||||
if ($status === STATUS['OCCUPIED']) { //추가된 부품 재고수를 처리
|
if ($serverPartDatas['status'] === STATUS['OCCUPIED']) { //추가된 부품 재고수를 처리
|
||||||
if ($entity->getStock() < $serverPartEntity->getCnt()) {
|
if ($entity->getStock() < $serverPartEntity->getCnt()) {
|
||||||
throw new \Exception("현재 재고수[{$entity->getStock()}]보다 지정하신 갯수({$serverPartEntity->getCnt()})가 더 많습니다.");
|
throw new \Exception("현재 재고수[{$entity->getStock()}]보다 지정하신 갯수({$serverPartEntity->getCnt()})가 더 많습니다.");
|
||||||
}
|
}
|
||||||
$formDatas['stock'] = $entity->getStock() - $serverPartEntity->getCnt();
|
$formDatas['stock'] = $entity->getStock() - $serverPartEntity->getCnt();
|
||||||
}
|
}
|
||||||
return $this->modify($entity, $formDatas);
|
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,12 +2,12 @@
|
|||||||
|
|
||||||
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\Customer\PaymentService;
|
use App\Services\PaymentService;
|
||||||
use App\Services\Equipment\EquipmentService;
|
|
||||||
|
|
||||||
class ServerPartService extends EquipmentService
|
class ServerPartService extends EquipmentService
|
||||||
{
|
{
|
||||||
@ -28,6 +28,7 @@ class ServerPartService extends EquipmentService
|
|||||||
"type",
|
"type",
|
||||||
"billing",
|
"billing",
|
||||||
"part_uid",
|
"part_uid",
|
||||||
|
"title",
|
||||||
"cnt",
|
"cnt",
|
||||||
"extra",
|
"extra",
|
||||||
"amount",
|
"amount",
|
||||||
@ -111,20 +112,29 @@ class ServerPartService extends EquipmentService
|
|||||||
throw new \Exception(__METHOD__ . "에서 형식오류:ServicePartEntity만 허용됩니다.");
|
throw new \Exception(__METHOD__ . "에서 형식오류:ServicePartEntity만 허용됩니다.");
|
||||||
}
|
}
|
||||||
switch ($entity->getType()) {
|
switch ($entity->getType()) {
|
||||||
|
case 'CPU':
|
||||||
|
case 'RAM':
|
||||||
|
case 'DISK':
|
||||||
|
case 'OS':
|
||||||
|
case 'DB':
|
||||||
|
case 'SOFTWARE':
|
||||||
|
$partService = $this->getPartService();
|
||||||
|
$entity->setPartEntity($partService->getEntity($entity->getPartUID()));
|
||||||
|
break;
|
||||||
case 'SWITCH':
|
case 'SWITCH':
|
||||||
$partService = $this->getSwitchService();
|
$partService = $this->getSwitchService();
|
||||||
|
$entity->setPartEntity($partService->getEntity($entity->getPartUID()));
|
||||||
break;
|
break;
|
||||||
case 'IP':
|
case 'IP':
|
||||||
$partService = $this->getIPService();
|
$partService = $this->getIPService();
|
||||||
|
$entity->setPartEntity($partService->getEntity($entity->getPartUID()));
|
||||||
break;
|
break;
|
||||||
case 'CS':
|
case 'CS':
|
||||||
$partService = $this->getCSService();
|
$partService = $this->getCSService();
|
||||||
break;
|
$entity->setPartEntity($partService->getEntity($entity->getPartUID()));
|
||||||
default:
|
|
||||||
$partService = $this->getPartService();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $entity->setPartEntity($partService->getEntity($entity->getPartUID()));
|
return $entity;
|
||||||
}
|
}
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
// FieldForm관련용
|
// FieldForm관련용
|
||||||
@ -152,6 +162,9 @@ class ServerPartService extends EquipmentService
|
|||||||
case 'CS':
|
case 'CS':
|
||||||
$partOptions[$partType] = $this->getCSService()->getEntities();
|
$partOptions[$partType] = $this->getCSService()->getEntities();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
$partOptions[$partType] = [];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$options = $partOptions;
|
$options = $partOptions;
|
||||||
@ -166,25 +179,30 @@ class ServerPartService extends EquipmentService
|
|||||||
}
|
}
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
//파트별 정보 수정작업
|
//파트별정보 설정
|
||||||
private function setServerPart(ServerPartEntity $entity, mixed $part_uid, string $status): mixed
|
private function setServerPart(ServerPartEntity $entity, array $formDatas): ServerPartEntity
|
||||||
{
|
{
|
||||||
//Type에 따른 부품서비스 정의
|
//Type에 따른 부품서비스 정의
|
||||||
switch ($entity->getType()) {
|
switch ($entity->getType()) {
|
||||||
|
case 'CPU':
|
||||||
|
case 'RAM':
|
||||||
|
case 'DISK':
|
||||||
|
case 'OS':
|
||||||
|
case 'DB':
|
||||||
|
case 'SOFTWARE':
|
||||||
|
$entity = $this->getPartService()->setServerPart($entity, $formDatas);
|
||||||
|
break;
|
||||||
case 'SWITCH':
|
case 'SWITCH':
|
||||||
$partEntity = $this->getSwitchService()->setServerPart($entity, $part_uid, $status);
|
$entity = $this->getSwitchService()->setServerPart($entity, $formDatas);
|
||||||
break;
|
break;
|
||||||
case 'IP':
|
case 'IP':
|
||||||
$partEntity = $this->getIPService()->setServerPart($entity, $part_uid, $status);
|
$entity = $this->getIPService()->setServerPart($entity, $formDatas);
|
||||||
break;
|
break;
|
||||||
case 'CS':
|
case 'CS':
|
||||||
$partEntity = $this->getCSService()->setServerPart($entity, $part_uid, $status);
|
$entity = $this->getCSService()->setServerPart($entity, $formDatas);
|
||||||
break;
|
|
||||||
default: //CPU/RAM/DISK/OS/DB/SOFTWARE
|
|
||||||
$partEntity = $this->getPartService()->setServerPart($entity, $part_uid, $status);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $partEntity;
|
return $entity;
|
||||||
}
|
}
|
||||||
//부품연결정보생성
|
//부품연결정보생성
|
||||||
public function create(array $formDatas): ServerPartEntity
|
public function create(array $formDatas): ServerPartEntity
|
||||||
@ -202,31 +220,15 @@ class ServerPartService extends EquipmentService
|
|||||||
if (!($serverEntity instanceof ServerEntity)) {
|
if (!($serverEntity instanceof ServerEntity)) {
|
||||||
throw new \Exception("서버 정보가 지정되지 않았습니다.");
|
throw new \Exception("서버 정보가 지정되지 않았습니다.");
|
||||||
}
|
}
|
||||||
|
//생성작업
|
||||||
$formDatas["clientinfo_uid"] = $serverEntity->getClientInfoUID();
|
$formDatas["clientinfo_uid"] = $serverEntity->getClientInfoUID();
|
||||||
$formDatas["serviceinfo_uid"] = $serverEntity->getServiceInfoUID();
|
$formDatas["serviceinfo_uid"] = $serverEntity->getServiceInfoUID();
|
||||||
$formDatas["serverinfo_uid"] = $serverEntity->getPK();
|
$formDatas["serverinfo_uid"] = $serverEntity->getPK();
|
||||||
$entity = parent::create($formDatas);
|
$entity = parent::create($formDatas);
|
||||||
//부품연결정보에 부품정보 정의
|
//부품정보 설정
|
||||||
$entity = $entity->setPartEntity(
|
$entity = $this->setServerPart($entity, ['part_uid' => $formDatas['part_uid'], 'status' => STATUS['OCCUPIED']]);
|
||||||
$this->setServerPart($entity, $formDatas['part_uid'], STATUS['OCCUPIED'])
|
//결제관련정보 설정
|
||||||
);
|
$entity = $this->getPaymentService()->setServerPart($entity);
|
||||||
//기본 부품이 아닌경우 결제정보에 추가한다.
|
|
||||||
if ($entity->getBilling() !== PAYMENT['BILLING']['BASE']) {
|
|
||||||
if ($entity->getBilling() === PAYMENT['BILLING']['ONETIME']) {
|
|
||||||
if ($entity->getServiceInfoUID() === null) {
|
|
||||||
throw new \Exception("일회성 부품 추가는 서비스정보가 정의된 후에만 가능합니다.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$paymentDatas = [];
|
|
||||||
$paymentDatas['clientinfo_uid'] = $entity->getClientInfoUID();
|
|
||||||
$paymentDatas['serviceinfo_uid'] = $entity->getServiceInfoUID();
|
|
||||||
$paymentDatas['serverinfo_uid'] = $entity->getServerInfoUID();
|
|
||||||
$paymentDatas['title'] = sprintf("[%s] 부품정보", $entity->getPartEntity()->getTitle());
|
|
||||||
$paymentDatas['amount'] = $entity->getAmount();
|
|
||||||
$paymentDatas['billing'] = $entity->getBilling();
|
|
||||||
$paymentDatas['billing_at'] = date("Y-m-d"); //일회성은 지급일이 당일기준처리
|
|
||||||
$this->getPaymentService()->create($paymentDatas);
|
|
||||||
}
|
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
//수정
|
//수정
|
||||||
@ -240,26 +242,28 @@ class ServerPartService extends EquipmentService
|
|||||||
if (!($serverEntity instanceof ServerEntity)) {
|
if (!($serverEntity instanceof ServerEntity)) {
|
||||||
throw new \Exception("서버 정보가 지정되지 않았습니다.");
|
throw new \Exception("서버 정보가 지정되지 않았습니다.");
|
||||||
}
|
}
|
||||||
|
//부품연결정보에 부품정보가 변경된 경우(기존것은 AVAILABLE로 변경)
|
||||||
|
if ($entity->getPartUID() != $formDatas['part_uid']) {
|
||||||
|
$entity = $this->setServerPart($entity, ['part_uid' => $entity->getPartUID(), 'status' => STATUS['AVAILABLE']]);
|
||||||
|
}
|
||||||
|
//수정작업
|
||||||
$formDatas["clientinfo_uid"] = $serverEntity->getClientInfoUID();
|
$formDatas["clientinfo_uid"] = $serverEntity->getClientInfoUID();
|
||||||
$formDatas["serviceinfo_uid"] = $serverEntity->getServiceInfoUID();
|
$formDatas["serviceinfo_uid"] = $serverEntity->getServiceInfoUID();
|
||||||
$formDatas["serverinfo_uid"] = $serverEntity->getPK();
|
$formDatas["serverinfo_uid"] = $serverEntity->getPK();
|
||||||
//기존 Part_UID와 신규 Part_UID가 다르면 기존 Part정보 사용가능으로 변경
|
|
||||||
if ($entity->getPartUID() != $formDatas['part_uid']) {
|
|
||||||
$this->setServerPart($entity, $entity->getPartUID(), STATUS['AVAILABLE']);
|
|
||||||
}
|
|
||||||
//기존 정보변경
|
|
||||||
$entity = parent::modify($entity, $formDatas);
|
$entity = parent::modify($entity, $formDatas);
|
||||||
//부품연결정보에 부품정보 정의
|
//부품연결정보에 부품정보가 변경된 경우 OCCUPIED로 변경
|
||||||
if ($entity->getPartUID() != $formDatas['part_uid']) {
|
if ($entity->getPartUID() != $formDatas['part_uid']) {
|
||||||
$entity->setPartEntity($this->setServerPart($entity, $formDatas['part_uid'], STATUS['OCCUPIED']));
|
$entity = $this->setServerPart($entity, ['part_uid' => $formDatas['part_uid'], 'status' => STATUS['OCCUPIED']]);
|
||||||
}
|
}
|
||||||
|
//결제관련정보 정의
|
||||||
|
$entity = $this->getPaymentService()->setServerPart($entity, ['action' => __FUNCTION__]);
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
//삭제
|
//삭제
|
||||||
public function delete(mixed $entity): ServerPartEntity
|
public function delete(mixed $entity): ServerPartEntity
|
||||||
{
|
{
|
||||||
//부품연결정보에 부품정보 정의
|
//부품연결정보에 부품정보 정의
|
||||||
$this->setServerPart($entity, $entity->getPartUID(), STATUS['AVAILABLE']);
|
$entity = $this->setServerPart($entity, ['part_uid' => $entity->getPartUID(), 'status' => STATUS['AVAILABLE']]);
|
||||||
return parent::delete($entity);
|
return parent::delete($entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,15 +51,22 @@ class SwitchService extends EquipmentService implements ServerPartInterface
|
|||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
//FieldForm관련용
|
//FieldForm관련용
|
||||||
//서비스파트 설정
|
//서비스파트 설정
|
||||||
public function setServerPart(ServerPartEntity $serverPartEntity, mixed $uid, string $status): SwitchEntity
|
public function setServerPart(ServerPartEntity $serverPartEntity, array $serverPartDatas): ServerPartEntity
|
||||||
{
|
{
|
||||||
$entity = $this->getEntity($uid);
|
if (!array_key_exists('part_uid', $serverPartDatas)) {
|
||||||
if (!($entity instanceof SwitchEntity)) {
|
throw new \Exception(__METHOD__ . "에서 오류발생: 부품번호가 정의되지 않았습니다.");
|
||||||
throw new \Exception("{$uid}에 해당하는 스위치정보를 찾을수없습니다.");
|
|
||||||
}
|
}
|
||||||
|
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 = [];
|
$formDatas = [];
|
||||||
if ($status === STATUS['AVAILABLE']) {
|
if ($serverPartDatas['status'] === STATUS['AVAILABLE']) {
|
||||||
//사용가능
|
//사용가능
|
||||||
$formDatas['clientinfo_uid'] = null;
|
$formDatas['clientinfo_uid'] = null;
|
||||||
$formDatas['serviceinfo_uid'] = null;
|
$formDatas['serviceinfo_uid'] = null;
|
||||||
@ -69,8 +76,8 @@ class SwitchService extends EquipmentService implements ServerPartInterface
|
|||||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
||||||
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
||||||
}
|
}
|
||||||
$formDatas['status'] = $status;
|
$formDatas['status'] = $serverPartDatas['status'];
|
||||||
return $this->modify($entity, $formDatas);
|
return $serverPartEntity->setPartEntity($this->modify($entity, $formDatas));
|
||||||
}
|
}
|
||||||
//List 검색용
|
//List 검색용
|
||||||
//OrderBy 처리
|
//OrderBy 처리
|
||||||
|
|||||||
206
app/Services/PaymentService.php
Normal file
206
app/Services/PaymentService.php
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services;
|
||||||
|
|
||||||
|
use App\Entities\Customer\ServiceEntity;
|
||||||
|
use App\Entities\Equipment\ServerPartEntity;
|
||||||
|
use App\Entities\PaymentEntity;
|
||||||
|
use App\Helpers\PaymentHelper;
|
||||||
|
use App\Interfaces\Equipment\ServerPartInterface;
|
||||||
|
use App\Models\PaymentModel;
|
||||||
|
use App\Services\Customer\ClientService;
|
||||||
|
use App\Services\Customer\ServiceService;
|
||||||
|
use App\Services\UserService;
|
||||||
|
|
||||||
|
class PaymentService extends CommonService implements ServerPartInterface
|
||||||
|
{
|
||||||
|
private ?UserService $_userService = null;
|
||||||
|
private ?ClientService $_clientService = null;
|
||||||
|
private ?ServiceService $_serviceService = null;
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct(new PaymentModel(), new PaymentHelper());
|
||||||
|
$this->addClassName('Payment');
|
||||||
|
}
|
||||||
|
final public function getFormFields(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
"clientinfo_uid",
|
||||||
|
"serviceinfo_uid",
|
||||||
|
"title",
|
||||||
|
"amount",
|
||||||
|
"billing",
|
||||||
|
"billing_at",
|
||||||
|
"pay",
|
||||||
|
"status",
|
||||||
|
];
|
||||||
|
}
|
||||||
|
final public function getFormFilters(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'clientinfo_uid',
|
||||||
|
"serviceinfo_uid",
|
||||||
|
'billing',
|
||||||
|
'pay',
|
||||||
|
'status',
|
||||||
|
'user_uid',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
final public function getIndexFields(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'clientinfo_uid',
|
||||||
|
"serviceinfo_uid",
|
||||||
|
'billing',
|
||||||
|
'title',
|
||||||
|
'amount',
|
||||||
|
'billing_at',
|
||||||
|
'pay',
|
||||||
|
'status',
|
||||||
|
'updated_at',
|
||||||
|
'countdown',
|
||||||
|
'user_uid',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
final public function getBatchjobFields(): array
|
||||||
|
{
|
||||||
|
return ['pay', 'status'];
|
||||||
|
}
|
||||||
|
final public function getBatchjobButtons(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'batchjob' => '일괄 결제 ',
|
||||||
|
'invoice' => '청구서 발행',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
final public function getClientService(): ClientService
|
||||||
|
{
|
||||||
|
if (!$this->_clientService) {
|
||||||
|
$this->_clientService = new ClientService();
|
||||||
|
}
|
||||||
|
return $this->_clientService;
|
||||||
|
}
|
||||||
|
final public function getUSerService(): UserService
|
||||||
|
{
|
||||||
|
if (!$this->_userService) {
|
||||||
|
$this->_userService = new UserService();
|
||||||
|
}
|
||||||
|
return $this->_userService;
|
||||||
|
}
|
||||||
|
final public function getServiceService(): ServiceService
|
||||||
|
{
|
||||||
|
if (!$this->_serviceService) {
|
||||||
|
$this->_serviceService = new ServiceService();
|
||||||
|
}
|
||||||
|
return $this->_serviceService;
|
||||||
|
}
|
||||||
|
//기본 기능부분
|
||||||
|
//FieldForm관련용
|
||||||
|
final public function getFormOption(string $field, array $options = []): array
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
case 'user_uid':
|
||||||
|
$options = $this->getUserService()->getEntities();
|
||||||
|
break;
|
||||||
|
case 'clientinfo_uid':
|
||||||
|
$options = $this->getClientService()->getEntities();
|
||||||
|
break;
|
||||||
|
case 'serviceinfo_uid':
|
||||||
|
$options = $this->getServiceService()->getEntities();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$options = parent::getFormOption($field, $options);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
//List 검색용
|
||||||
|
//OrderBy 처리
|
||||||
|
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||||
|
{
|
||||||
|
$this->getModel()->orderBy('billing_at ASC');
|
||||||
|
parent::setOrderBy($field, $value);
|
||||||
|
}
|
||||||
|
//총 미납건수, 금액
|
||||||
|
final public function getUnPaids(string $group, array $where = []): array
|
||||||
|
{
|
||||||
|
return $this->getModel()->groupBy($group)
|
||||||
|
->select("serviceinfo_uid,COUNT(uid) as cnt, SUM(amount) as amount")
|
||||||
|
->where(['billing_at <=' => date('Y-m-d')])
|
||||||
|
->where(['status' => STATUS['UNPAID']])
|
||||||
|
->where($where)
|
||||||
|
->get()->getResult();
|
||||||
|
}
|
||||||
|
//생성
|
||||||
|
public function create(array $formDatas): PaymentEntity
|
||||||
|
{
|
||||||
|
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||||
|
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||||
|
return parent::create($formDatas);
|
||||||
|
}
|
||||||
|
//수정
|
||||||
|
public function modify(mixed $entity, array $formDatas): PaymentEntity
|
||||||
|
{
|
||||||
|
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||||
|
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||||
|
return parent::modify($entity, $formDatas);
|
||||||
|
}
|
||||||
|
//서버연결정보용 등록
|
||||||
|
public function setServerPart(ServerPartEntity $serverPartEntity, array $formDatas = []): ServerPartEntity
|
||||||
|
{
|
||||||
|
if ($serverPartEntity->getServiceInfoUID() === null) {
|
||||||
|
throw new \Exception("서비스정보가 정의된 후에만 가능합니다.");
|
||||||
|
}
|
||||||
|
//Service Entity 가져오기
|
||||||
|
$serviceEntity = $this->getServiceService()->getEntity($serverPartEntity->getServiceInfoUID());
|
||||||
|
if (!$serviceEntity) {
|
||||||
|
throw new \Exception("[{$serverPartEntity->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다.");
|
||||||
|
}
|
||||||
|
//수정인경우 기존 결제정보 가져오기
|
||||||
|
if (array_key_exists('action', $formDatas) && $formDatas['action'] === 'modify') {
|
||||||
|
$entity = $this->getEntity(['serverpartinfo_uid' => $serverPartEntity->getPK()]);
|
||||||
|
if (!$entity instanceof PaymentEntity) {
|
||||||
|
throw new \Exception("{$serverPartEntity->getPK()}에 해당하는 결제정보를 찾을수 없습니다.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//월비용인경우 서비스 제공가에 서버연결정보 제공가 합산금액으로 설정
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
//일회성인경우
|
||||||
|
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();
|
||||||
|
if (array_key_exists('action', $formDatas) && $formDatas['action'] === 'modify') {
|
||||||
|
$this->modify($entity, $formDatas);
|
||||||
|
} else {
|
||||||
|
//생성일때만 지급기한일 설정
|
||||||
|
$formDatas['billing_at'] = $serverPartEntity->getBilling() === PAYMENT['BILLING']['ONETIME'] ? date("Y-m-d") : $serviceEntity->getBillingAT();
|
||||||
|
$this->create($formDatas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,7 +4,10 @@
|
|||||||
<?php foreach ($serverPartCellDatas['entities'][$type] as $entities): ?>
|
<?php foreach ($serverPartCellDatas['entities'][$type] as $entities): ?>
|
||||||
<?php foreach ($entities as $entity): ?>
|
<?php foreach ($entities as $entity): ?>
|
||||||
<?php $serverPartCellDatas['entity'] = $entity ?>
|
<?php $serverPartCellDatas['entity'] = $entity ?>
|
||||||
<?php $htmls[$type][] = $serverPartCellDatas['service']->getHelper()->getFieldView($type, $entity->getPK(), $serverPartCellDatas) ?>
|
<?php $htmls[$type][] = [
|
||||||
|
'view' => $serverPartCellDatas['service']->getHelper()->getFieldView($type, $entity->getPK(), $serverPartCellDatas),
|
||||||
|
'amount' => $entity->getAmount() * $entity->getCnt()
|
||||||
|
] ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
@ -12,7 +15,8 @@
|
|||||||
<?php foreach ($serverPartCellDatas['types'] as $type): ?>
|
<?php foreach ($serverPartCellDatas['types'] as $type): ?>
|
||||||
<tr class="m-0 p-0">
|
<tr class="m-0 p-0">
|
||||||
<th class="text-end m-0 p-0" width="15%"><?= $serverPartCellDatas['service']->getHelper()->getListButton($type, '', $serverPartCellDatas) ?></th>
|
<th class="text-end m-0 p-0" width="15%"><?= $serverPartCellDatas['service']->getHelper()->getListButton($type, '', $serverPartCellDatas) ?></th>
|
||||||
<td class="text-start m-0 p-0"><?= implode(",", $htmls[$type]) ?></td>
|
<td class="text-start m-0 p-0"><?php foreach ($htmls[$type] as $html): ?><?= $html['view'] ?>[<?= number_format($html['amount']) ?>원]<BR><?php endforeach ?></td>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</table>
|
</table>
|
||||||
Loading…
Reference in New Issue
Block a user