dbms_init...1

This commit is contained in:
choi.jh 2025-06-11 17:14:53 +09:00
parent 1f65af8a58
commit df9aee7e84
25 changed files with 778 additions and 284 deletions

View File

@ -132,6 +132,19 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->post('batchjob_delete', 'ServiceHistoryController::batchjob_delete');
$routes->get('download/(:alpha)', 'ServiceHistoryController::download/$1');
});
$routes->group('payment', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
$routes->get('/', 'ServicePaymentController::index', []);
$routes->get('create', 'ServicePaymentController::create_form');
$routes->post('create', 'ServicePaymentController::create');
$routes->get('modify/(:num)', 'ServicePaymentController::modify_form/$1');
$routes->post('modify/(:num)', 'ServicePaymentController::modify/$1');
$routes->get('view/(:num)', 'ServicePaymentController::view/$1');
$routes->get('delete/(:num)', 'ServicePaymentController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'ServicePaymentController::toggle/$1/$2');
$routes->post('batchjob', 'ServicePaymentController::batchjob');
$routes->post('batchjob_delete', 'ServicePaymentController::batchjob_delete');
$routes->get('download/(:alpha)', 'ServicePaymentController::download/$1');
});
});
$routes->group('equipment', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
$routes->group('code', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {

View File

@ -2,16 +2,13 @@
namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\AccountEntity;
use App\Entities\Customer\ClientEntity;
use App\Helpers\Customer\AccountHelper;
use App\Services\Customer\AccountService;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\AccountHelper;
use App\Services\Customer\AccountService;
class AccountController extends CustomerController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
@ -38,26 +35,4 @@ class AccountController extends CustomerController
return $this->_helper;
}
//Index,FieldForm관련.
private function setAccountBalance(array $formDatas): ClientEntity
{
//account_balance 체크
$entity = $this->getClientService()->getEntity($formDatas['clientinfo_uid']);
if (!$entity) {
throw new \Exception("{$formDatas['clientinfo_uid']}에 대한 고객정보를 찾을수 없습니다.");
}
$amount = intval($formDatas['amount']);
if ($formDatas['status'] === DEFAULTS['STATUS']) { //입금, 쿠폰추가
$entity = $this->getClientService()->deposit($entity, 'account_balance', $amount);
} else { // 출금, 쿠폰사용
$entity = $this->getClientService()->withdrawal($entity, 'account_balance', $amount);
}
return $entity;
}
protected function create_process(array $formDatas): AccountEntity
{
$entity = parent::create_process($formDatas);
//고객예치금처리
$this->setAccountBalance($formDatas);
return $entity;
}
}

View File

@ -2,16 +2,13 @@
namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\ClientEntity;
use App\Entities\Customer\CouponEntity;
use App\Helpers\Customer\CouponHelper;
use App\Services\Customer\CouponService;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\CouponHelper;
use App\Services\Customer\CouponService;
class CouponController extends CustomerController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
@ -38,26 +35,4 @@ class CouponController extends CustomerController
return $this->_helper;
}
//Index,FieldForm관련.
private function setCouponBalance(array $formDatas): ClientEntity
{
//coupon_balance 체크
$entity = $this->getClientService()->getEntity($formDatas['clientinfo_uid']);
if (!$entity) {
throw new \Exception("{$formDatas['clientinfo_uid']}에 대한 고객정보를 찾을수 없습니다.");
}
$amount = intval($formDatas['amount']);
if ($formDatas['status'] === DEFAULTS['STATUS']) { //입금, 쿠폰추가
$entity = $this->getClientService()->deposit($entity, 'coupon_balance', $amount);
} else { // 출금, 쿠폰사용
$entity = $this->getClientService()->withdrawal($entity, 'coupon_balance', $amount);
}
return $entity;
}
protected function create_process(array $formDatas): CouponEntity
{
$entity = parent::create_process($formDatas);
//고객쿠폰처리
$this->setCouponBalance($formDatas);
return $entity;
}
}

View File

@ -8,20 +8,10 @@ use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Services\Customer\ClientService;
use App\Services\Equipment\Part\CpuService;
use App\Services\Equipment\Part\DefenceService;
use App\Services\Equipment\Part\StorageService;
use App\Services\Equipment\Part\IpService;
use App\Services\Equipment\Part\LineService;
use App\Services\Equipment\Part\RamService;
use App\Services\Equipment\Part\SoftwareService;
use App\Services\Equipment\ServerService;
use App\Services\Equipment\DomainService;
abstract class CustomerController extends AdminController
{
private ?ClientService $_clientService = null;
private $_equipmentService = [];
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
@ -49,42 +39,4 @@ abstract class CustomerController extends AdminController
return $options;
}
//Index,FieldForm관련
//ServiceItemController,ServiceController에서 사용
final public function getEquipmentService(string $key): mixed
{
if (!array_key_exists($key, $this->_equipmentService)) {
switch ($key) {
case 'SERVER':
$this->_equipmentService[$key] = new ServerService();
break;
case 'CPU':
$this->_equipmentService[$key] = new CpuService();
break;
case 'RAM':
$this->_equipmentService[$key] = new RamService();
break;
case 'STORAGE':
$this->_equipmentService[$key] = new StorageService();
break;
case 'LINE':
$this->_equipmentService[$key] = new LineService();
break;
case 'IP':
$this->_equipmentService[$key] = new IpService();
break;
case 'DEFENCE':
$this->_equipmentService[$key] = new DefenceService();
break;
case 'SOFTWARE':
$this->_equipmentService[$key] = new SoftwareService();
break;
case 'DOMAIN':
$this->_equipmentService[$key] = new DomainService();
break;
default:
throw new \Exception(__FUNCTION__ . "에서 사용하지않는 Service를 요청하였습니다.: {$key}");
}
}
return $this->_equipmentService[$key];
}
}

View File

@ -2,16 +2,13 @@
namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\ClientEntity;
use App\Entities\Customer\PointEntity;
use App\Helpers\Customer\PointHelper;
use App\Services\Customer\PointService;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\PointHelper;
use App\Services\Customer\PointService;
class PointController extends CustomerController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
@ -38,27 +35,4 @@ class PointController extends CustomerController
return $this->_helper;
}
//Index,FieldForm관련.
private function setPointBalance(array $formDatas): ClientEntity
{
//point_balance 체크
$entity = $this->getClientService()->getEntity($formDatas['clientinfo_uid']);
if (!$entity) {
throw new \Exception("{$formDatas['clientinfo_uid']}에 대한 고객정보를 찾을수 없습니다.");
}
$amount = intval($formDatas['amount']);
if ($formDatas['status'] === DEFAULTS['STATUS']) { //입금, 쿠폰추가
$entity = $this->getClientService()->deposit($entity, 'point_balance', $amount);
} else { // 출금, 쿠폰사용
$entity = $this->getClientService()->withdrawal($entity, 'point_balance', $amount);
}
return $entity;
}
protected function create_process(array $formDatas): PointEntity
{
$entity = parent::create_process($formDatas);
//고객포인트처리
$this->setPointBalance($formDatas);
return $entity;
}
}

View File

@ -2,17 +2,17 @@
namespace App\Controllers\Admin\Customer;
use App\Entities\Equipment\CodeEntity;
use App\Helpers\Customer\ServiceHelper;
use App\Services\Customer\ServiceItemService;
use App\Services\Customer\ServiceService;
use App\Services\Equipment\CodeService;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\ServiceHelper;
use App\Services\Customer\ServiceService;
use App\Services\Customer\ServiceItemService;
use App\Entities\Equipment\CodeEntity;
use App\Services\Equipment\CodeService;
class ServiceController extends CustomerController
{
private ?ServiceItemService $_serviceItemService = null;
@ -82,7 +82,7 @@ class ServiceController extends CustomerController
case 'DEFENCE':
case 'SOFTWARE':
case 'DOMAIN':
foreach ($this->getEquipmentService($field)->getEntities() as $entity) {
foreach ($this->getService()->getEquipmentService($field)->getEntities() as $entity) {
$options[$entity->getPK()] = $entity->getTitle();
}
break;
@ -105,29 +105,6 @@ class ServiceController extends CustomerController
return $result;
}
//Index,FieldForm관련
protected function create_process(array $formDatas): mixed
{
//code의 경우 서비스중으로 설정작업
$this->getCodeService()->setStatus($formDatas['code'], CodeEntity::STATUS_OCCUPIED);
return parent::create_process($formDatas);
}
protected function modify_process(mixed $entity, array $formDatas): mixed
{
//code가 기존과 다를경우 //toggle,batchjob의 경우 $formDatas에 code가 없을수도 있음
if (array_key_exists('code', $formDatas) && $formDatas['code'] !== $entity->getCode()) {
//code의 경우 기존code는 사용가능으로 설정작업
$this->getCodeService()->setStatus($entity->getCode(), CodeEntity::STATUS_AVAILABLE);
//coded의 경우 변경된 code는 서비스중으로 설정작업
$this->getCodeService()->setStatus($formDatas['code'], CodeEntity::STATUS_OCCUPIED);
}
return parent::modify_process($entity, $formDatas);
}
protected function delete_process(mixed $entity): mixed
{
//code의 경우 기존code는 사용가능으로 설정작업
$this->getCodeService()->setStatus($entity->getCode(), CodeEntity::STATUS_AVAILABLE);
return parent::delete_process($entity);
}
protected function index_process(): array
{
//추가 Field작업 처리

View File

@ -14,7 +14,6 @@ use App\Services\Customer\ServiceService;
class ServiceHistoryController extends CustomerController
{
private ?ServiceService $_serviceService = null;
private $_equipmentService = [];
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);

View File

@ -14,7 +14,6 @@ use App\Services\Customer\ServiceService;
class ServiceItemController extends CustomerController
{
private ?ServiceService $_serviceService = null;
private $_equipmentService = [];
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
@ -60,7 +59,7 @@ class ServiceItemController extends CustomerController
throw new \Exception(__FUNCTION__ . "에서 item_type이 지정되지 않았습니다.");
}
//$item_type(CPU,RAM,STORAGE등)에 따라 선언된 getFormFieldOption사용 됨
foreach ($this->getEquipmentService($item_type)->getEntities() as $entity) {
foreach ($this->getService()->getEquipmentService($item_type)->getEntities() as $entity) {
$options[$entity->getPK()] = $entity->getTitle();
}
break;
@ -82,22 +81,28 @@ class ServiceItemController extends CustomerController
}
return $result;
}
//Index,FieldForm관련
protected function create_process(array $formDatas): mixed
//도메인의 경우 domaininfo에 등록 후 ServiceItemEntity의 item_uid에 넣고 create해야함
private function createDomain(array $formDatas): array
{
//도메인의 경우 domaininfo에 등록 후 ServiceItemEntity의 item_uid에 넣고 create해야함
$serviceEntity = $this->getServiceService()->getEntity($formDatas['serviceinfo_uid']);
if (!$serviceEntity) {
throw new \Exception("{$formDatas['serviceinfo_uid']}에 대한 서비스정보를 찾을수 없습니다.");
}
$equipmentEntity = $this->getService()->getEquipmentService($formDatas['item_type'])->create([
'clientinfo_uid' => $serviceEntity->getClientUID(),
'domain' => $formDatas['item_uid']
]);
//도메인용 항목의 item_uid로 전달함
$formDatas['item_uid'] = $equipmentEntity->getPK();
return $formDatas;
}
protected function create_process(array $formDatas): RedirectResponse|string
{
// item_type이 도메인의 경우 domaininfo에 등록 후 ServiceItemEntity의 item_uid에 넣고 create해야함
if ($formDatas['item_type'] === 'DOMAIN') {
$serviceEntity = $this->getServiceService()->getEntity($formDatas['serviceinfo_uid']);
if (!$serviceEntity) {
throw new \Exception("{$formDatas['serviceinfo_uid']}에 대한 서비스정보를 찾을수 없습니다.");
}
$equipmentEntity = $this->getEquipmentService($formDatas['item_type'])->create([
'clientinfo_uid' => $serviceEntity->getClientUID(),
'domain' => $formDatas['item_uid']
]);
//도메인용 항목의 item_uid로 전달함
$formDatas['item_uid'] = $equipmentEntity->getPK();
$formDatas = $this->createDomain($formDatas);
}
return parent::create_process($formDatas);
}

View File

@ -0,0 +1,73 @@
<?php
namespace App\Controllers\Admin\Customer;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\ServicePaymentHelper;
use App\Services\Customer\ServicePaymentService;
use App\Services\Customer\ServiceService;
class ServicePaymentController extends CustomerController
{
private ?ServiceService $_serviceService = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->content_title = lang("{$this->getService()->getClassName()}.title");
$this->class_path .= $this->getService()->getClassName();
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
}
public function getService(): ServicePaymentService
{
if (!$this->_service) {
$this->_service = new ServicePaymentService($this->request);
}
return $this->_service;
}
public function getHelper(): ServicePaymentHelper
{
if (!$this->_helper) {
$this->_helper = new ServicePaymentHelper($this->request);
}
return $this->_helper;
}
public function getServiceService(): ServiceService
{
if (!$this->_serviceService) {
$this->_serviceService = new ServiceService($this->request);
}
return $this->_serviceService;
}
protected function getFormFieldOption(string $field, array $options = []): array
{
switch ($field) {
case 'serviceinfo_uid':
foreach ($this->getServiceService()->getEntities() as $entity) {
$options[$entity->getPK()] = $entity->getTitle();
}
break;
case 'item_uid':
//$item_type(CPU,RAM,STORAGE등)에 따라 선언된 getFormFieldOption사용 됨
$item_types = ['LINE', 'IP', 'SERVER', 'CPU', 'RAM', 'STORAGE', 'SOFTWARE', 'DEFENCE', 'DOMAIN'];
foreach ($item_types as $item_type) {
$options[$item_type] = [];
foreach ($this->getService()->getEquipmentService($item_type)->getEntities() as $entity) {
$options[$item_type][$entity->getPK()] = $entity->getTitle();
}
}
break;
default:
$options = parent::getFormFieldOption($field, $options);
break;
}
return $options;
}
//Index,FieldForm관련
}

View File

@ -360,11 +360,6 @@ abstract class CommonController extends BaseController
//Transaction Start
$this->getService()->getModel()->transStart();
try {
//기존 Entity 가져오기
$entity = $this->getService()->getEntity($uid);
if (!$entity) {
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
}
//각 Field 초기화
$this->initAction(__FUNCTION__);
//FieldRule정의
@ -376,7 +371,11 @@ abstract class CommonController extends BaseController
foreach ($this->getFormFields() as $field) {
$formDatas[$field] = $this->request->getPost($field);
}
// dd($formDatas);
//기존 Entity 가져오기
$entity = $this->getService()->getEntity($uid);
if (!$entity) {
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
}
$this->entity = $this->modify_process($entity, $formDatas);
$this->getService()->getModel()->transCommit();
return $this->getResultSuccess();
@ -396,20 +395,18 @@ abstract class CommonController extends BaseController
//Transaction Start
$this->getService()->getModel()->transStart();
try {
//각 Field 초기화:조건항목 Field는 한개만 존재하므로 Field와 Rule을 재정의 필요
$this->setAction(__FUNCTION__);
//Field와 Rule을 재정의
$this->setFormFields([$field]);
$this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field));
//입력값정의
$formDatas = [$field => $this->request->getVar($field)];
//기존 Entity 가져오기
$entity = $this->getService()->getEntity($uid);
if (!$entity) {
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
}
//각 Field 초기화:Field는 한개만 존재하므로 Field와 Rule을 재정의
$this->setAction(__FUNCTION__);
//FormField정의
$this->setFormFields([$field]);
//FieldRule정의
$this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field));
//입력값정의
$formDatas = [$field => $this->request->getVar($field)];
// dd($formDatas);
$this->entity = $this->toggle_process($entity, $formDatas);
$this->getService()->getModel()->transCommit();
return $this->getResultSuccess();
@ -429,33 +426,31 @@ abstract class CommonController extends BaseController
//Transaction Start
$this->getService()->getModel()->transStart();
try {
//변경할 FormField 정의
$fields = [];
//각 Field 초기화: 일괄작업은 선택된 조건항목 Field만 존재하므로 Field와 Rule을 재정의 필요
$this->setAction(__FUNCTION__);
$selectedFields = [];
$formDatas = [];
foreach ($this->getBatchjobFields() as $field) {
$value = $this->request->getVar($field);
foreach ($this->getService()->getBatchJobFields() as $field) {
//입력한 Field,값정의
$value = $this->request->getPost($field);
if ($value) {
$fields[] = $field;
//입력값정의
$formDatas[$field] = $this->request->getVar($field);
$selectedFields[] = $field;
$formDatas[$field] = $value;
}
}
if (!count($fields)) {
throw new \Exception("변경할 정보를 선택하셔야합니다.");
if (!count($selectedFields)) {
throw new \Exception("변경할 조건항목을 선택하셔야합니다.");
}
//변경할 UIDS 정의
$uids = $this->request->getVar('batchjob_uids[]');
if (!is_array($uids) || !count($uids)) {
throw new \Exception("적용할 리스트를 선택하셔야합니다.");
}
//각 Field 초기화:Bachjob의 데이터가 있는경우 Field만 처리하기위해 Field와 Rule을 재정의
$this->setAction(__FUNCTION__);
//FormField정의
$this->setFormFields($fields);
//FieldRule정의
//선택된 Fields와 Rules을 재정의
$this->setFormFields([$field]);
foreach ($this->getFormFields() as $field) {
$this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field));
}
//변경할 UIDS 정의
$uids = $this->request->getPost('batchjob_uids[]');
if (!is_array($uids) || !count($uids)) {
throw new \Exception("적용할 리스트을 선택하셔야합니다.");
}
$entities = [];
foreach ($uids as $uid) {
//기존 Entity 가져오기
@ -466,6 +461,7 @@ abstract class CommonController extends BaseController
$entities[] = $this->batchjob_process($entity, $formDatas);
}
}
$this->entities = $entities;
$this->getService()->getModel()->transCommit();
LogCollector::debug(sprintf("%s에서 총 %s개중 %s개 일괄작업을 완료하였습니다.", __METHOD__, count($uids), count($entities)));
@ -517,7 +513,7 @@ abstract class CommonController extends BaseController
$this->getService()->getModel()->transStart();
try {
//변경할 UIDS
$uids = $this->request->getVar('batchjob_uids[]');
$uids = $this->request->getPost('batchjob_uids[]');
if (!is_array($uids) || !count($uids)) {
throw new \Exception("적용할 리스트를 선택하셔야합니다.");
}

View File

@ -4,9 +4,9 @@
"settings": {
"width": 3000,
"height": 3000,
"scrollTop": -988.0309,
"scrollLeft": -1051.8446,
"zoomLevel": 0.76,
"scrollTop": -961.8844,
"scrollLeft": -401.9322,
"zoomLevel": 0.79,
"show": 511,
"database": 4,
"databaseName": "",
@ -47,9 +47,7 @@
"dnFyz1CSdGeS6mCbfCMO0",
"GRBrbb1hqwKSRMfod3I7U",
"QCNA57Pi6A9dJDgybxS5v",
"8GMPyGUFlx2Mw7BwzizfD",
"B8haiEbPc1lRBWTv1g25G",
"isiA_oaJNIm3F4nYJuLJ1",
"0WXrjcyXXGeoAVM2VB8s2",
"eLGlqJ4z_woGP6CLZEuUr",
"JoMB-mb6p6NoHpiAvjD2y"
@ -61,15 +59,13 @@
"KtdVJCYZ3DMVnPnFGKi3P",
"AH1dyESfueUlhcoiU6KsQ",
"wX0DbZb_RcK85hWv9dxcX",
"w-QYHsd8nVKvDaBO9LDbp",
"19PCL5s4M6NxuV-ePUz50",
"6Gx9n7rUrSbXGbvE39xnm",
"anhMCXytE7rcE_drKBPWz",
"Wma86GpS3BhikEaHSamgX",
"I80TuGxKm3tXIO_EO2PSm",
"o8yw46vm30cC7wl9cRMdo",
"ocWjncqwtYkP02mw4A0-8",
"6oBuPqT-ikPI7X8a05Trv"
"6oBuPqT-ikPI7X8a05Trv",
"Hj5AZkoYGvM_syvnqMeOi"
],
"indexIds": [],
"memoIds": []
@ -336,15 +332,15 @@
"liJON6hIBB9aS-pQgM0Q6"
],
"ui": {
"x": 938.42,
"y": 1458.0408,
"x": 941.0514,
"y": 1471.1988,
"zIndex": 2,
"widthName": 60,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1749008043378,
"updateAt": 1749612916799,
"createAt": 1745819764138
}
},
@ -717,38 +713,45 @@
},
"QCNA57Pi6A9dJDgybxS5v": {
"id": "QCNA57Pi6A9dJDgybxS5v",
"name": "invoiceinfo",
"comment": "청구서정보",
"name": "serviceinfo_payment",
"comment": "결제정보",
"columnIds": [
"GMPyqxaroK2OjQZnoCRwn",
"2Re7GlIDs1MKhwQ1n_5Ty",
"RDhib2G4b-Yqi880m4yME",
"T8UART66GUy4LWDk0yUxl",
"ZWV8iXrgQovfYTm32QGbZ",
"xWCCXo-zVdNuL4E9AhjCN",
"4O3Qit9vqva-izvWHJLTD",
"N-ESuxOk84rEdS2SzpVcx",
"FhnUrn_dOrdhaBe_P3ty-",
"T8UART66GUy4LWDk0yUxl",
"RDhib2G4b-Yqi880m4yME",
"Mr5BhlD6XqcH6mwPZ0jIP",
"YTvLb43yvXQGMq7T4fDUQ",
"vN8DhuVpVf6RJ1T_soB6W"
],
"seqColumnIds": [
"GMPyqxaroK2OjQZnoCRwn",
"ZWV8iXrgQovfYTm32QGbZ",
"2Re7GlIDs1MKhwQ1n_5Ty",
"RDhib2G4b-Yqi880m4yME",
"T8UART66GUy4LWDk0yUxl",
"xWCCXo-zVdNuL4E9AhjCN",
"4O3Qit9vqva-izvWHJLTD",
"N-ESuxOk84rEdS2SzpVcx",
"FhnUrn_dOrdhaBe_P3ty-",
"T8UART66GUy4LWDk0yUxl",
"RDhib2G4b-Yqi880m4yME",
"Mr5BhlD6XqcH6mwPZ0jIP",
"YTvLb43yvXQGMq7T4fDUQ",
"vN8DhuVpVf6RJ1T_soB6W"
],
"ui": {
"x": 918.841,
"y": 619.9814,
"x": 134.6305,
"y": 798.9288,
"zIndex": 2278,
"widthName": 60,
"widthComment": 62,
"widthName": 110,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1748510675618,
"updateAt": 1749616861214,
"createAt": 1748484896313
}
},
@ -858,11 +861,9 @@
"columnIds": [
"YMx_XwTS1PatRlZtoxW8Z",
"1tE_0qGYDjR3udy5-odYS",
"YVqb-AsjUrGwO2OfTLrOY",
"CoJPWxyzPJBARBaOijyTz",
"5cXK6q9-zhiD08pCjjXuW",
"TVw0yqODUSPTpELO89_Dh",
"Y7aavM4QK2DOr1WfKnOXB",
"mkLkPRKSqWPEBbwxKt2Cj"
],
"seqColumnIds": [
@ -874,19 +875,20 @@
"5cXK6q9-zhiD08pCjjXuW",
"TVw0yqODUSPTpELO89_Dh",
"N1z70y9IzSHgCozvR5hKZ",
"uhJTXyt09V-wQHSVkgzUL",
"Y7aavM4QK2DOr1WfKnOXB",
"mkLkPRKSqWPEBbwxKt2Cj"
],
"ui": {
"x": 143.2625,
"y": 1029.6963,
"x": 556.4204,
"y": 607.3278,
"zIndex": 2408,
"widthName": 69,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1748831907917,
"updateAt": 1749616246431,
"createAt": 1748505950663
}
},
@ -5268,20 +5270,20 @@
"T8UART66GUy4LWDk0yUxl": {
"id": "T8UART66GUy4LWDk0yUxl",
"tableId": "QCNA57Pi6A9dJDgybxS5v",
"name": "due_at",
"comment": "지급기한일",
"name": "billing_at",
"comment": "(청구)지급기한일",
"dataType": "DATE",
"default": "",
"options": 0,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 62,
"widthComment": 93,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1748485419209,
"updateAt": 1749616540581,
"createAt": 1748485346073
}
},
@ -5328,20 +5330,20 @@
"2Re7GlIDs1MKhwQ1n_5Ty": {
"id": "2Re7GlIDs1MKhwQ1n_5Ty",
"tableId": "QCNA57Pi6A9dJDgybxS5v",
"name": "clientinfo_uid",
"comment": "",
"name": "ownerinfo_uid",
"comment": "관리자정보",
"dataType": "INT",
"default": "",
"options": 8,
"ui": {
"keys": 2,
"widthName": 73,
"widthComment": 60,
"keys": 0,
"widthName": 77,
"widthComment": 62,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1748485367195,
"updateAt": 1749613292282,
"createAt": 1748485358690
}
},
@ -5368,20 +5370,20 @@
"FhnUrn_dOrdhaBe_P3ty-": {
"id": "FhnUrn_dOrdhaBe_P3ty-",
"tableId": "QCNA57Pi6A9dJDgybxS5v",
"name": "total_amount",
"comment": "금액",
"name": "amount",
"comment": "청구금액",
"dataType": "INT",
"default": "0",
"options": 8,
"ui": {
"keys": 0,
"widthName": 72,
"widthName": 60,
"widthComment": 60,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1748485472922,
"updateAt": 1749613774661,
"createAt": 1748485472922
}
},
@ -5674,7 +5676,7 @@
"default": "",
"options": 8,
"ui": {
"keys": 2,
"keys": 0,
"widthName": 81,
"widthComment": 60,
"widthDataType": 60,
@ -5974,7 +5976,7 @@
"default": "",
"options": 8,
"ui": {
"keys": 2,
"keys": 0,
"widthName": 81,
"widthComment": 60,
"widthDataType": 60,
@ -6149,7 +6151,7 @@
"id": "5OcpSdnrgDxZ9eZ7_pQr9",
"tableId": "0WXrjcyXXGeoAVM2VB8s2",
"name": "billing_cycle",
"comment": "",
"comment": "청구방식",
"dataType": "VARCHAR(20)",
"default": "",
"options": 8,
@ -6161,7 +6163,7 @@
"widthDefault": 60
},
"meta": {
"updateAt": 1748846158655,
"updateAt": 1749614882559,
"createAt": 1748507306328
}
},
@ -6924,6 +6926,106 @@
"updateAt": 1749529387909,
"createAt": 1749527376195
}
},
"uhJTXyt09V-wQHSVkgzUL": {
"id": "uhJTXyt09V-wQHSVkgzUL",
"tableId": "isiA_oaJNIm3F4nYJuLJ1",
"name": "status",
"comment": "상태",
"dataType": "VARCHAR(20)",
"default": "'default'",
"options": 8,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 75,
"widthDefault": 60
},
"meta": {
"updateAt": 1749613648954,
"createAt": 1749613648952
}
},
"xWCCXo-zVdNuL4E9AhjCN": {
"id": "xWCCXo-zVdNuL4E9AhjCN",
"tableId": "QCNA57Pi6A9dJDgybxS5v",
"name": "item_type",
"comment": "",
"dataType": "VARCHAR(20)",
"default": "",
"options": 8,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 75,
"widthDefault": 60
},
"meta": {
"updateAt": 1749613743913,
"createAt": 1749613743913
}
},
"4O3Qit9vqva-izvWHJLTD": {
"id": "4O3Qit9vqva-izvWHJLTD",
"tableId": "QCNA57Pi6A9dJDgybxS5v",
"name": "item_uid",
"comment": "",
"dataType": "INT",
"default": "",
"options": 8,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1749613743913,
"createAt": 1749613743913
}
},
"N-ESuxOk84rEdS2SzpVcx": {
"id": "N-ESuxOk84rEdS2SzpVcx",
"tableId": "QCNA57Pi6A9dJDgybxS5v",
"name": "billing_cycle",
"comment": "청구방식",
"dataType": "VARCHAR(20)",
"default": "",
"options": 8,
"ui": {
"keys": 0,
"widthName": 66,
"widthComment": 60,
"widthDataType": 75,
"widthDefault": 60
},
"meta": {
"updateAt": 1749616591995,
"createAt": 1749614891880
}
},
"ZWV8iXrgQovfYTm32QGbZ": {
"id": "ZWV8iXrgQovfYTm32QGbZ",
"tableId": "QCNA57Pi6A9dJDgybxS5v",
"name": "serviceinfo_uid",
"comment": "서비스정보",
"dataType": "INT",
"default": "",
"options": 8,
"ui": {
"keys": 2,
"widthName": 80,
"widthComment": 62,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1749615248043,
"createAt": 1749615226177
}
}
},
"relationshipEntities": {
@ -7049,8 +7151,8 @@
"columnIds": [
"7B0zaLoZnOoMNW8OHZlrQ"
],
"x": 938.42,
"y": 1594.0408,
"x": 941.0514,
"y": 1607.1988,
"direction": 1
},
"end": {
@ -7086,8 +7188,8 @@
"columnIds": [
"Z2KizkUFrIaV_R_Quv4Ho"
],
"x": 1454.42,
"y": 1594.0408,
"x": 1457.0513999999998,
"y": 1607.1988,
"direction": 2
},
"meta": {
@ -7114,8 +7216,8 @@
"columnIds": [
"2Re7GlIDs1MKhwQ1n_5Ty"
],
"x": 1428.841,
"y": 743.9814,
"x": 1439.4198999999999,
"y": 714.1919,
"direction": 2
},
"meta": {
@ -7134,7 +7236,7 @@
"GMPyqxaroK2OjQZnoCRwn"
],
"x": 918.841,
"y": 681.9814,
"y": 693.9814,
"direction": 1
},
"end": {
@ -7161,18 +7263,18 @@
"columnIds": [
"GMPyqxaroK2OjQZnoCRwn"
],
"x": 918.841,
"y": 805.9814,
"direction": 1
"x": 399.7092,
"y": 773.9289,
"direction": 4
},
"end": {
"tableId": "isiA_oaJNIm3F4nYJuLJ1",
"columnIds": [
"1tE_0qGYDjR3udy5-odYS"
],
"x": 659.2625,
"y": 1153.6963,
"direction": 2
"x": 556.4204,
"y": 707.3278,
"direction": 1
},
"meta": {
"updateAt": 1748506047447,
@ -7190,7 +7292,7 @@
"_AcWUYKzNJd-V0fRHq8Cx"
],
"x": 1615.2084,
"y": 864.0747999999999,
"y": 784.0748,
"direction": 1
},
"end": {
@ -7218,7 +7320,7 @@
"N_yJVoCN4oUEDhYqdzApb"
],
"x": 934.3741,
"y": 1132.673,
"y": 1236.673,
"direction": 1
},
"end": {
@ -7274,7 +7376,7 @@
"_AcWUYKzNJd-V0fRHq8Cx"
],
"x": 1615.2084,
"y": 970.7414666666665,
"y": 944.0748,
"direction": 1
},
"end": {
@ -7302,7 +7404,7 @@
"N_yJVoCN4oUEDhYqdzApb"
],
"x": 934.3741,
"y": 1340.673,
"y": 1375.3396666666667,
"direction": 1
},
"end": {
@ -7346,6 +7448,34 @@
"updateAt": 1749527376196,
"createAt": 1749527376196
}
},
"Hj5AZkoYGvM_syvnqMeOi": {
"id": "Hj5AZkoYGvM_syvnqMeOi",
"identification": false,
"relationshipType": 16,
"startRelationshipType": 2,
"start": {
"tableId": "B8haiEbPc1lRBWTv1g25G",
"columnIds": [
"N_yJVoCN4oUEDhYqdzApb"
],
"x": 934.3741,
"y": 1098.0063333333333,
"direction": 1
},
"end": {
"tableId": "QCNA57Pi6A9dJDgybxS5v",
"columnIds": [
"ZWV8iXrgQovfYTm32QGbZ"
],
"x": 682.6305,
"y": 958.9288,
"direction": 2
},
"meta": {
"updateAt": 1749615226177,
"createAt": 1749615226177
}
}
},
"indexEntities": {},

View File

@ -0,0 +1,27 @@
<?php
namespace App\Entities\Customer;
use App\Models\Customer\ServicePaymentModel;
class ServicePaymentEntity extends CustomerEntity
{
const PK = ServicePaymentModel::PK;
const TITLE = ServicePaymentModel::TITLE;
public function getServiceUid(): int
{
return intval($this->attributes['serviceinfo_uid']);
}
public function getItemUid(): int
{
return intval($this->attributes['item_uid']);
}
public function getAmount(): int
{
return intval($this->attributes['amount']);
}
public function getView_BillingCycle(): string
{
return $this->attributes['billing_cycle'] == "month" ? "" : ICONS['ONETIME'];;
}
}

View File

@ -0,0 +1,53 @@
<?php
namespace App\Helpers\Customer;
use App\Models\Customer\ServicePaymentModel;
use CodeIgniter\HTTP\IncomingRequest;
class ServicePaymentHelper extends CustomerHelper
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
$this->setTitleField(field: ServicePaymentModel::TITLE);
}
//ItemType에 따른 조건부 추가 Index Page
public function getFieldFormByItemType(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
$form = "";
if (in_array($viewDatas['control']['action'], ['create', 'modify', 'create_form', 'modify_form'])) {
$extras = (strpos($viewDatas['control']['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
}
switch ($viewDatas['item_type']) {
case 'DOMAIN':
if (in_array($viewDatas['control']['action'], ['create', 'modify', 'create_form', 'modify_form'])) {
$form = form_input($field, $value ?? "", ["placeholder" => "예)example.com", ...$extras]);
} else {
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
}
break;
default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break;
}
return $form;
}
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
if (in_array($viewDatas['control']['action'], ['create', 'modify', 'create_form', 'modify_form'])) {
$extras = (strpos($viewDatas['control']['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
}
switch ($field) {
case 'item_uid':
$form = $this->getFieldFormByItemType($field, $value, $viewDatas, $extras);
break;
default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break;
}
return $form;
}
}

View File

@ -0,0 +1,42 @@
<?php
return [
'title' => "서비스결제제정보",
'label' => [
'serviceinfo_uid' => "서비스명",
'item_type' => "항목형식",
'item_uid' => "항목",
'billing_cycle' => "청구방식",
'amount' => "결제금액",
'billing_at' => "지급기한일",
'issue_at' => "발행일",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "신청일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'item_type' => "server",
'billing_cycle' => "month",
'status' => 'default'
],
"ITEM_TYPE" => [
"LINE" => "라인",
"IP" => "IP주소",
"SERVER" => "서버",
"CPU" => "CPU",
"RAM" => "메모리",
"STORAGE" => "저장장치",
"SOFTWARE" => "소프트웨어",
"DEFENCE" => "방어(CS)",
"DOMAIN" => "도메인",
],
"BILLING_CYCLE" => [
"month" => "매월",
"onetime" => "일회성",
],
"STATUS" => [
'default' => "미지급",
"paid" => "지급완료",
"delete" => "삭제",
],
];

View File

@ -0,0 +1,56 @@
<?php
namespace App\Models\Customer;
use App\Entities\Customer\ServicePaymentEntity;
class ServicePaymentModel extends CustomerModel
{
const TABLE = "serviceinfo_payment";
const PK = "uid";
const TITLE = "item_type";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = ServicePaymentEntity::class;
protected $allowedFields = [
"serviceinfo_uid",
"item_type",
"item_uid",
"billing_cycle",
"amount",
"billing_at",
"issue_at",
"status",
"updated_at"
];
public function __construct()
{
parent::__construct();
}
public function getFormFieldRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "serviceinfo_uid":
case "item_uid":
case "amount":
$rule = "required|numeric";
break;
case "item_type":
case "billing_cycle":
case "status":
$rule = "required|trim|string";
break;
case "billing_at":
case "issue_at":
$rule = "required|valid_date";
break;
default:
$rule = parent::getFormFieldRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -102,7 +102,7 @@ abstract class CommonService
LogCollector::info("[{$entity->getTitle()}]" . MESSAGES["UPDATED"] . ":");
return $entity;
}
final public function delete(mixed $entity): bool
public function delete(mixed $entity): bool
{
$result = $this->getModel()->delete($entity->getPK());
if (!$result) {

View File

@ -6,6 +6,8 @@ use App\Entities\Customer\AccountEntity;
use App\Models\Customer\AccountModel;
use CodeIgniter\HTTP\IncomingRequest;
use App\Entities\Customer\ClientEntity;
class AccountService extends CustomerService
{
protected ?IncomingRequest $request = null;
@ -40,4 +42,25 @@ class AccountService extends CustomerService
{
return ['status'];
}
//고객예치금처리
private function setBalance(array $formDatas): ClientEntity
{
//account_balance 체크
$entity = $this->getClientService()->getEntity($formDatas['clientinfo_uid']);
if (!$entity) {
throw new \Exception("{$formDatas['clientinfo_uid']}에 대한 고객정보를 찾을수 없습니다.");
}
$amount = intval($formDatas['amount']);
if ($formDatas['status'] === DEFAULTS['STATUS']) { //입금, 쿠폰추가
$entity = $this->getClientService()->deposit($entity, 'account_balance', $amount);
} else { // 출금, 쿠폰사용
$entity = $this->getClientService()->withdrawal($entity, 'account_balance', $amount);
}
return $entity;
}
public function create(array $formDatas, mixed $entity = null): AccountEntity
{
$this->setBalance($formDatas);
return parent::create($entity, $formDatas);
}
}

View File

@ -6,6 +6,8 @@ use App\Entities\Customer\CouponEntity;
use App\Models\Customer\CouponModel;
use CodeIgniter\HTTP\IncomingRequest;
use App\Entities\Customer\ClientEntity;
class CouponService extends CustomerService
{
protected ?IncomingRequest $request = null;
@ -39,4 +41,25 @@ class CouponService extends CustomerService
{
return ['status'];
}
//고객예치금처리
private function setBalance(array $formDatas): ClientEntity
{
//coupon_balance 체크
$entity = $this->getClientService()->getEntity($formDatas['clientinfo_uid']);
if (!$entity) {
throw new \Exception("{$formDatas['clientinfo_uid']}에 대한 고객정보를 찾을수 없습니다.");
}
$amount = intval($formDatas['amount']);
if ($formDatas['status'] === DEFAULTS['STATUS']) { //입금, 쿠폰추가
$entity = $this->getClientService()->deposit($entity, 'coupon_balance', $amount);
} else { // 출금, 쿠폰사용
$entity = $this->getClientService()->withdrawal($entity, 'coupon_balance', $amount);
}
return $entity;
}
public function create(array $formDatas, mixed $entity = null): CouponEntity
{
$this->setBalance($formDatas);
return parent::create($entity, $formDatas);
}
}

View File

@ -6,10 +6,20 @@ use App\Services\CommonService;
use CodeIgniter\HTTP\IncomingRequest;
use App\Services\Customer\ClientService;
use App\Services\Equipment\Part\CpuService;
use App\Services\Equipment\Part\DefenceService;
use App\Services\Equipment\Part\StorageService;
use App\Services\Equipment\Part\IpService;
use App\Services\Equipment\Part\LineService;
use App\Services\Equipment\Part\RamService;
use App\Services\Equipment\Part\SoftwareService;
use App\Services\Equipment\ServerService;
use App\Services\Equipment\DomainService;
abstract class CustomerService extends CommonService
{
private ?ClientService $_clientService = null;
private $_equipmentService = [];
protected function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
@ -22,4 +32,43 @@ abstract class CustomerService extends CommonService
}
return $this->_clientService;
}
//ServiceItemController,ServiceController에서 사용
final public function getEquipmentService(string $key): mixed
{
if (!array_key_exists($key, $this->_equipmentService)) {
switch ($key) {
case 'SERVER':
$this->_equipmentService[$key] = new ServerService();
break;
case 'CPU':
$this->_equipmentService[$key] = new CpuService();
break;
case 'RAM':
$this->_equipmentService[$key] = new RamService();
break;
case 'STORAGE':
$this->_equipmentService[$key] = new StorageService();
break;
case 'LINE':
$this->_equipmentService[$key] = new LineService();
break;
case 'IP':
$this->_equipmentService[$key] = new IpService();
break;
case 'DEFENCE':
$this->_equipmentService[$key] = new DefenceService();
break;
case 'SOFTWARE':
$this->_equipmentService[$key] = new SoftwareService();
break;
case 'DOMAIN':
$this->_equipmentService[$key] = new DomainService();
break;
default:
throw new \Exception(__FUNCTION__ . "에서 사용하지않는 Service를 요청하였습니다.: {$key}");
}
}
return $this->_equipmentService[$key];
}
}

View File

@ -6,6 +6,8 @@ use App\Entities\Customer\PointEntity;
use App\Models\Customer\PointModel;
use CodeIgniter\HTTP\IncomingRequest;
use App\Entities\Customer\ClientEntity;
class PointService extends CustomerService
{
protected ?IncomingRequest $request = null;
@ -39,4 +41,24 @@ class PointService extends CustomerService
{
return ['status'];
}
private function setBalance(array $formDatas): ClientEntity
{
//point_balance 체크
$entity = $this->getClientService()->getEntity($formDatas['clientinfo_uid']);
if (!$entity) {
throw new \Exception("{$formDatas['clientinfo_uid']}에 대한 고객정보를 찾을수 없습니다.");
}
$amount = intval($formDatas['amount']);
if ($formDatas['status'] === DEFAULTS['STATUS']) { //입금, 쿠폰추가
$entity = $this->getClientService()->deposit($entity, 'point_balance', $amount);
} else { // 출금, 쿠폰사용
$entity = $this->getClientService()->withdrawal($entity, 'point_balance', $amount);
}
return $entity;
}
public function create(array $formDatas, mixed $entity = null): PointEntity
{
$this->setBalance($formDatas);
return parent::create($entity, $formDatas);
}
}

View File

@ -6,9 +6,12 @@ use App\Entities\Customer\ServiceItemEntity;
use App\Models\Customer\ServiceItemModel;
use CodeIgniter\HTTP\IncomingRequest;
use App\Services\Customer\ServiceService;
class ServiceItemService extends CustomerService
{
protected ?IncomingRequest $request = null;
private ?ServiceService $_serviceService = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
@ -22,6 +25,13 @@ class ServiceItemService extends CustomerService
{
return new ServiceItemEntity();
}
public function getServiceService(): ServiceService
{
if (!$this->_serviceService) {
$this->_serviceService = new ServiceService($this->request);
}
return $this->_serviceService;
}
public function getFormFields(): array
{
return [

View File

@ -0,0 +1,50 @@
<?php
namespace App\Services\Customer;
use App\Entities\Customer\ServicePaymentEntity;
use App\Models\Customer\ServicePaymentModel;
use CodeIgniter\HTTP\IncomingRequest;
class ServicePaymentService extends CustomerService
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
$this->addClassName('ServicePayment');
}
public function getModelClass(): ServicePaymentModel
{
return new ServicePaymentModel();
}
public function getEntityClass(): ServicePaymentEntity
{
return new ServicePaymentEntity();
}
public function getFormFields(): array
{
return [
"serviceinfo_uid",
"item_type",
"item_uid",
"billing_cycle",
"amount",
"billing_at",
"issue_at",
"status",
];
}
public function getFilterFields(): array
{
return ["serviceinfo_uid", 'item_type', 'item_uid', 'billing_cycle', 'status'];
}
public function getBatchJobFields(): array
{
return ['status'];
}
public function getIndexFields(): array
{
return ['serviceinfo_uid', 'item_type', 'item_uid', 'billing_cycle', 'amount', 'billing_at', 'issue_at', 'status'];
}
}

View File

@ -6,9 +6,13 @@ use App\Entities\Customer\ServiceEntity;
use App\Models\Customer\ServiceModel;
use CodeIgniter\HTTP\IncomingRequest;
use App\Entities\Equipment\CodeEntity;
use App\Services\Equipment\CodeService;
class ServiceService extends CustomerService
{
protected ?IncomingRequest $request = null;
private ?CodeService $_codeService = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
@ -51,4 +55,35 @@ class ServiceService extends CustomerService
{
return ['clientinfo_uid', 'ownerinfo_uid', 'title', 'type', 'location', 'switch', 'code', 'raid', 'billing_at', 'start_at', 'status'];
}
public function getCodeService(): CodeService
{
if (!$this->_codeService) {
$this->_codeService = new CodeService($this->request);
}
return $this->_codeService;
}
public function create(array $formDatas, mixed $entity = null): ServiceEntity
{
//code의 경우 서비스중으로 설정작업
$this->getCodeService()->setStatus($formDatas['code'], CodeEntity::STATUS_OCCUPIED);
return parent::create($entity, $formDatas);
}
public function modify(mixed $entity, array $formDatas): ServiceEntity
{
//code가 기존과 다를경우 //toggle,batchjob의 경우 $formDatas에 code가 없을수도 있음
if (array_key_exists('code', $formDatas) && $formDatas['code'] !== $entity->getCode()) {
//code의 경우 기존code는 사용가능으로 설정작업
$this->getCodeService()->setStatus($entity->getCode(), CodeEntity::STATUS_AVAILABLE);
//coded의 경우 변경된 code는 서비스중으로 설정작업
$this->getCodeService()->setStatus($formDatas['code'], CodeEntity::STATUS_OCCUPIED);
}
return parent::modify($entity, $formDatas);
}
final public function delete(mixed $entity): bool
{
//code의 경우 기존code는 사용가능으로 설정작업
$this->getCodeService()->setStatus($entity->getCode(), CodeEntity::STATUS_AVAILABLE);
return parent::delete($entity);
}
}

View File

@ -21,6 +21,6 @@
<a href="/admin/customer/service"><?= ICONS['CARD'] ?> 서비스내역</a>
</div>
<div class="accordion-item">
<a href="/admin/customer/invoice"><?= ICONS['CARD'] ?> 청구내역</a>
<a href="/admin/customer/payment"><?= ICONS['CARD'] ?> 결제내역</a>
</div>
</div>

View File

@ -373,7 +373,7 @@ CREATE TABLE `logger` (
PRIMARY KEY (`uid`),
KEY `FK_user_TO_logger` (`user_uid`),
CONSTRAINT `FK_user_TO_logger` FOREIGN KEY (`user_uid`) REFERENCES `user` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='작업 기록 로그';
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='작업 기록 로그';
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -382,6 +382,7 @@ CREATE TABLE `logger` (
LOCK TABLES `logger` WRITE;
/*!40000 ALTER TABLE `logger` DISABLE KEYS */;
INSERT INTO `logger` VALUES (1,1,'Customer/ServiceItem','getResultFail','getFormFieldOption에서 item_type이 지정되지 않았습니다.','10:25:57[debug]: getFormFieldOption에서 item_type이 지정되지 않았습니다.','default','2025-06-11 01:25:57'),(2,1,'Customer/ServiceHistory','getResultSuccess','작업이 성공적으로 완료되었습니다.','10:38:31[debug]: 입력내용\n10:38:31[debug]: array (\n &#039;serviceinfo_uid&#039; =&gt; &#039;2&#039;,\n &#039;title&#039; =&gt; &#039;sadfsf&#039;,\n &#039;description&#039; =&gt; &#039;&#039;,\n &#039;status&#039; =&gt; &#039;default&#039;,\n)\n10:38:31[debug]: [5/sadfsf] 입력 후 내용\n10:38:31[debug]: array (\n &#039;serviceinfo_uid&#039; =&gt; &#039;2&#039;,\n &#039;title&#039; =&gt; &#039;sadfsf&#039;,\n &#039;status&#039; =&gt; &#039;default&#039;,\n &#039;uid&#039; =&gt; 5,\n)\n10:38:31[info]: [sadfsf]생성되었습니다.:','default','2025-06-11 01:38:31'),(3,1,'User','getResultFail','Undefined variable $entity','11:09:58[debug]: Undefined variable $entity','default','2025-06-11 02:09:58'),(4,1,'MyLog','getResultFail','Undefined variable $entity','11:12:24[debug]: Undefined variable $entity','default','2025-06-11 02:12:24'),(5,1,'User','getResultFail','Undefined variable $entity','11:12:32[debug]: Undefined variable $entity','default','2025-06-11 02:12:32');
/*!40000 ALTER TABLE `logger` ENABLE KEYS */;
UNLOCK TABLES;
@ -561,7 +562,7 @@ CREATE TABLE `serviceinfo_history` (
PRIMARY KEY (`uid`),
KEY `FK_serviceinfo_TO_serviceinfo_history` (`serviceinfo_uid`),
CONSTRAINT `FK_serviceinfo_TO_serviceinfo_history` FOREIGN KEY (`serviceinfo_uid`) REFERENCES `serviceinfo` (`uid`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='서비스정보_history';
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='서비스정보_history';
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -570,7 +571,7 @@ CREATE TABLE `serviceinfo_history` (
LOCK TABLES `serviceinfo_history` WRITE;
/*!40000 ALTER TABLE `serviceinfo_history` DISABLE KEYS */;
INSERT INTO `serviceinfo_history` VALUES (1,2,'히스토리1111','<p>히스토리1111<br>히스토리1111</p>','default',NULL,'2025-06-10 02:24:48'),(2,2,'히스토리222','<p>히스토리222<br>히스토리222</p>','default',NULL,'2025-06-10 02:25:21'),(3,1,'히스토리12222','<p>히스토리12222<br>히스토리12222</p>','default',NULL,'2025-06-10 02:25:57'),(4,1,'히스토리22222222','<p>히스토리22222222<br>히스토리22222222</p>','default',NULL,'2025-06-10 02:26:18');
INSERT INTO `serviceinfo_history` VALUES (1,2,'히스토리1111','<p>히스토리1111<br>히스토리1111</p>','default',NULL,'2025-06-10 02:24:48'),(2,2,'히스토리222','<p>히스토리222<br>히스토리222</p>','default',NULL,'2025-06-10 02:25:21'),(3,1,'히스토리12222','<p>히스토리12222<br>히스토리12222</p>','default',NULL,'2025-06-10 02:25:57'),(4,1,'히스토리22222222','<p>히스토리22222222<br>히스토리22222222</p>','default',NULL,'2025-06-10 02:26:18'),(5,2,'sadfsf',NULL,'default',NULL,'2025-06-11 01:38:31');
/*!40000 ALTER TABLE `serviceinfo_history` ENABLE KEYS */;
UNLOCK TABLES;
@ -610,6 +611,40 @@ INSERT INTO `serviceinfo_items` VALUES (1,1,'LINE',8,'month',1000000,500000,'202
/*!40000 ALTER TABLE `serviceinfo_items` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `serviceinfo_payment`
--
DROP TABLE IF EXISTS `serviceinfo_payment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `serviceinfo_payment` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`serviceinfo_uid` int(11) NOT NULL COMMENT '서비스정보',
`item_type` varchar(20) NOT NULL,
`item_uid` int(11) NOT NULL,
`billing_cycle` varchar(20) NOT NULL COMMENT '청구방식',
`amount` int(11) NOT NULL DEFAULT 0 COMMENT '청구금액',
`billing_at` date DEFAULT NULL COMMENT '(청구)지급기한일',
`issue_at` date DEFAULT NULL COMMENT '발행일',
`status` varchar(20) NOT NULL DEFAULT 'default' COMMENT '상태',
`updated_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`uid`),
KEY `FK_serviceinfo_TO_serviceinfo_payment` (`serviceinfo_uid`),
CONSTRAINT `FK_serviceinfo_TO_serviceinfo_payment` FOREIGN KEY (`serviceinfo_uid`) REFERENCES `serviceinfo` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='결제정보';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `serviceinfo_payment`
--
LOCK TABLES `serviceinfo_payment` WRITE;
/*!40000 ALTER TABLE `serviceinfo_payment` DISABLE KEYS */;
/*!40000 ALTER TABLE `serviceinfo_payment` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `softwareinfo`
--
@ -711,4 +746,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2025-06-11 9:47:57
-- Dump completed on 2025-06-11 13:55:26