diff --git a/app/Controllers/Admin/Customer/ServiceController.php b/app/Controllers/Admin/Customer/ServiceController.php index 0160810..50d8faa 100644 --- a/app/Controllers/Admin/Customer/ServiceController.php +++ b/app/Controllers/Admin/Customer/ServiceController.php @@ -2,20 +2,17 @@ namespace App\Controllers\Admin\Customer; -use App\Entities\Customer\ServiceItemEntity; use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; -use App\Helpers\Customer\ServicePaymentHelper; +use App\Helpers\Customer\ServiceHelper; use App\Services\Customer\ServiceService; -use App\Services\Customer\ServiceItemService; use App\Services\Equipment\CodeService; class ServiceController extends CustomerController { - private ?ServiceItemService $_serviceItemService = null; private ?CodeService $_codeService = null; public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { @@ -33,10 +30,10 @@ class ServiceController extends CustomerController } return $this->_service; } - public function getHelper(): ServicePaymentHelper + public function getHelper(): ServiceHelper { if (!$this->_helper) { - $this->_helper = new ServicePaymentHelper($this->request); + $this->_helper = new ServiceHelper($this->request); } return $this->_helper; } @@ -47,13 +44,6 @@ class ServiceController extends CustomerController } return $this->_codeService; } - public function getServiceItemService(): ServiceItemService - { - if (!$this->_serviceItemService) { - $this->_serviceItemService = new ServiceItemService($this->request); - } - return $this->_serviceItemService; - } protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string { switch ($this->getAction()) { @@ -87,17 +77,6 @@ class ServiceController extends CustomerController $this->setFilterFieldOption($item_type, $options); } // dd($this->getFilterFieldOptions()); - $entities = []; - foreach (parent::index_process() as $entity) { - foreach (SERVICE_ITEM_TYPES as $item_type => $label) { - $entity->setItemEntities( - $item_type, - $this->getServiceItemService()->getEntities(['serviceinfo_uid' => $entity->getPK(), 'item_type' => $item_type]) - ); - } - $entities[] = $entity; - } - // $entities = parent::index_process(); - return $entities; + return parent::index_process(); } } diff --git a/app/Controllers/Admin/Home.php b/app/Controllers/Admin/Home.php index c11351b..6fd539e 100644 --- a/app/Controllers/Admin/Home.php +++ b/app/Controllers/Admin/Home.php @@ -13,7 +13,7 @@ use Psr\Log\LoggerInterface; class Home extends AdminController { private $_service = null; - private ?ServiceService $_serviceService = null; + private ?ServicePaymentService $_servicePaymentService = null; public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { parent::initController($request, $response, $logger); @@ -24,10 +24,10 @@ class Home extends AdminController } - final public function getService(): ServicePaymentService + final public function getService(): ServiceService { if (!$this->_service) { - $this->_service = new ServicePaymentService($this->request); + $this->_service = new ServiceService($this->request); } return $this->_service; } @@ -38,12 +38,12 @@ class Home extends AdminController } return $this->_helper; } - final public function getServiceService(): ServiceService + final public function getServicePaymentService(): ServicePaymentService { - if (!$this->_serviceService) { - $this->_serviceService = new ServiceService($this->request); + if (!$this->_servicePaymentService) { + $this->_servicePaymentService = new ServicePaymentService($this->request); } - return $this->_serviceService; + return $this->_servicePaymentService; } protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string { @@ -64,19 +64,17 @@ class Home extends AdminController } return $result; } - //Index,FieldForm관련 public function index(): RedirectResponse|string { $this->initAction(__FUNCTION__); - //신규서비스정보 - $this->interval = $this->request->getVar('interval') ?? SERVICE_NEW_INTERVAL; - $this->newServiceEntities = $this->getServiceService()->getNewService(intval($this->interval)); + //최근 inverval(default : 7일)일간 신규서버 정보 + $this->interval = intval($this->request->getVar('interval') ?? SERVICE_NEW_INTERVAL); + $this->newServiceEntities = $this->getService()->getEntitiesByNewService($this->interval); $this->newServiceCount = count($this->newServiceEntities); - - //미지금서버Count - $this->item_type = $this->request->getVar('item_type') ?? SERVICE_UNPAID_ITEM_TYPE; - $this->unPaidCount = $this->getService()->getUnPaid($this->item_type); + //미납 서버 정보 + $this->unPaidEntities = $this->getServicePaymentService()->getEntitiesByUnPaid(); + $this->unPaidCount = count($this->unPaidEntities); //LINE,IP,SERVER등 추가 FilterOption 셋팅용 foreach (SERVICE_ITEM_TYPES as $item_type => $label) { $options = $this->getService()->getServiceItemLinkService($item_type)->getEntities(); diff --git a/app/Database/erp2_2.vuerd.json b/app/Database/erp2_2.vuerd.json index 8e1f0a6..d7f6aa3 100644 --- a/app/Database/erp2_2.vuerd.json +++ b/app/Database/erp2_2.vuerd.json @@ -4,13 +4,13 @@ "settings": { "width": 3000, "height": 3000, - "scrollTop": -898.5025, - "scrollLeft": -208.0376, + "scrollTop": -876.1692, + "scrollLeft": -874.0376, "zoomLevel": 0.73, "show": 511, "database": 4, "databaseName": "", - "canvasType": "ERD", + "canvasType": "@dineug/erd-editor/builtin-schema-sql", "language": 1, "tableNameCase": 4, "columnNameCase": 2, @@ -66,7 +66,8 @@ "ocWjncqwtYkP02mw4A0-8", "6oBuPqT-ikPI7X8a05Trv", "Hj5AZkoYGvM_syvnqMeOi", - "dgALp3F5aQw7gy6h_Ejcl" + "dgALp3F5aQw7gy6h_Ejcl", + "cRqZmxohkCGd_FTkg1rhI" ], "indexIds": [], "memoIds": [] @@ -766,6 +767,7 @@ "N_yJVoCN4oUEDhYqdzApb", "NzxkmndrTbH7xb6fbnGV7", "f1hR1JRFHBHwiJSSX34gw", + "Vf3bNvvEPfu1zCs4rcHTU", "O7aGU_LJxCO1NeNVWbB-J", "SGWWOOHjCF81V4O5tUiJu", "uuDbJDSDQLey7Km1W9hlJ", @@ -792,6 +794,7 @@ "GLfHynBuy8Bzby9_5oRkq", "Fx2k158yi9P2l5An09ae1", "f1hR1JRFHBHwiJSSX34gw", + "Vf3bNvvEPfu1zCs4rcHTU", "O7aGU_LJxCO1NeNVWbB-J", "SGWWOOHjCF81V4O5tUiJu", "uuDbJDSDQLey7Km1W9hlJ", @@ -808,7 +811,7 @@ "ocQDEPy6SoxLZr91fT335" ], "ui": { - "x": 934.3741, + "x": 935.744, "y": 1028.673, "zIndex": 2395, "widthName": 60, @@ -816,48 +819,10 @@ "color": "" }, "meta": { - "updateAt": 1749687034731, + "updateAt": 1750645379453, "createAt": 1748485662214 } }, - "isiA_oaJNIm3F4nYJuLJ1": { - "id": "isiA_oaJNIm3F4nYJuLJ1", - "name": "paymentinfo", - "comment": "결제정보", - "columnIds": [ - "YMx_XwTS1PatRlZtoxW8Z", - "1tE_0qGYDjR3udy5-odYS", - "CoJPWxyzPJBARBaOijyTz", - "5cXK6q9-zhiD08pCjjXuW", - "TVw0yqODUSPTpELO89_Dh", - "mkLkPRKSqWPEBbwxKt2Cj" - ], - "seqColumnIds": [ - "YMx_XwTS1PatRlZtoxW8Z", - "iOrJK_1qtvJG0NLZ_92Ap", - "1tE_0qGYDjR3udy5-odYS", - "YVqb-AsjUrGwO2OfTLrOY", - "CoJPWxyzPJBARBaOijyTz", - "5cXK6q9-zhiD08pCjjXuW", - "TVw0yqODUSPTpELO89_Dh", - "N1z70y9IzSHgCozvR5hKZ", - "uhJTXyt09V-wQHSVkgzUL", - "Y7aavM4QK2DOr1WfKnOXB", - "mkLkPRKSqWPEBbwxKt2Cj" - ], - "ui": { - "x": 556.4204, - "y": 607.3278, - "zIndex": 2408, - "widthName": 69, - "widthComment": 60, - "color": "" - }, - "meta": { - "updateAt": 1749616246431, - "createAt": 1748505950663 - } - }, "0WXrjcyXXGeoAVM2VB8s2": { "id": "0WXrjcyXXGeoAVM2VB8s2", "name": "serviceinfo_items", @@ -5672,206 +5637,6 @@ "createAt": 1748489670367 } }, - "YMx_XwTS1PatRlZtoxW8Z": { - "id": "YMx_XwTS1PatRlZtoxW8Z", - "tableId": "isiA_oaJNIm3F4nYJuLJ1", - "name": "uid", - "comment": "", - "dataType": "INT", - "default": "", - "options": 11, - "ui": { - "keys": 1, - "widthName": 60, - "widthComment": 60, - "widthDataType": 60, - "widthDefault": 60 - }, - "meta": { - "updateAt": 1748506042145, - "createAt": 1748506032690 - } - }, - "5cXK6q9-zhiD08pCjjXuW": { - "id": "5cXK6q9-zhiD08pCjjXuW", - "tableId": "isiA_oaJNIm3F4nYJuLJ1", - "name": "amount", - "comment": "결제금액", - "dataType": "INT", - "default": "0", - "options": 8, - "ui": { - "keys": 0, - "widthName": 60, - "widthComment": 60, - "widthDataType": 60, - "widthDefault": 60 - }, - "meta": { - "updateAt": 1748506156258, - "createAt": 1748506032691 - } - }, - "Y7aavM4QK2DOr1WfKnOXB": { - "id": "Y7aavM4QK2DOr1WfKnOXB", - "tableId": "isiA_oaJNIm3F4nYJuLJ1", - "name": "updated_at", - "comment": "", - "dataType": "TIMESTAMP", - "default": "", - "options": 0, - "ui": { - "keys": 0, - "widthName": 62, - "widthComment": 60, - "widthDataType": 65, - "widthDefault": 60 - }, - "meta": { - "updateAt": 1748506032691, - "createAt": 1748506032691 - } - }, - "mkLkPRKSqWPEBbwxKt2Cj": { - "id": "mkLkPRKSqWPEBbwxKt2Cj", - "tableId": "isiA_oaJNIm3F4nYJuLJ1", - "name": "created_at", - "comment": "", - "dataType": "TIMESTAMP", - "default": "CURRENT_TIMESTAMP", - "options": 8, - "ui": { - "keys": 0, - "widthName": 60, - "widthComment": 60, - "widthDataType": 65, - "widthDefault": 122 - }, - "meta": { - "updateAt": 1748506032691, - "createAt": 1748506032691 - } - }, - "N1z70y9IzSHgCozvR5hKZ": { - "id": "N1z70y9IzSHgCozvR5hKZ", - "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": 1748506036222, - "createAt": 1748506036222 - } - }, - "1tE_0qGYDjR3udy5-odYS": { - "id": "1tE_0qGYDjR3udy5-odYS", - "tableId": "isiA_oaJNIm3F4nYJuLJ1", - "name": "invoiceinfo_uid", - "comment": "", - "dataType": "INT", - "default": "", - "options": 8, - "ui": { - "keys": 0, - "widthName": 81, - "widthComment": 60, - "widthDataType": 60, - "widthDefault": 60 - }, - "meta": { - "updateAt": 1748506063289, - "createAt": 1748506047447 - } - }, - "iOrJK_1qtvJG0NLZ_92Ap": { - "id": "iOrJK_1qtvJG0NLZ_92Ap", - "tableId": "isiA_oaJNIm3F4nYJuLJ1", - "name": "clientinfo_uid", - "comment": "", - "dataType": "INT", - "default": "", - "options": 8, - "ui": { - "keys": 0, - "widthName": 73, - "widthComment": 60, - "widthDataType": 60, - "widthDefault": 60 - }, - "meta": { - "updateAt": 1748506109417, - "createAt": 1748506096627 - } - }, - "YVqb-AsjUrGwO2OfTLrOY": { - "id": "YVqb-AsjUrGwO2OfTLrOY", - "tableId": "isiA_oaJNIm3F4nYJuLJ1", - "name": "alias", - "comment": "결제자명", - "dataType": "VARCHAR(50)", - "default": "", - "options": 8, - "ui": { - "keys": 0, - "widthName": 60, - "widthComment": 60, - "widthDataType": 75, - "widthDefault": 60 - }, - "meta": { - "updateAt": 1748506147968, - "createAt": 1748506125504 - } - }, - "TVw0yqODUSPTpELO89_Dh": { - "id": "TVw0yqODUSPTpELO89_Dh", - "tableId": "isiA_oaJNIm3F4nYJuLJ1", - "name": "paid_at", - "comment": "결제일", - "dataType": "DATE", - "default": "", - "options": 0, - "ui": { - "keys": 0, - "widthName": 60, - "widthComment": 60, - "widthDataType": 60, - "widthDefault": 60 - }, - "meta": { - "updateAt": 1748825131724, - "createAt": 1748506173149 - } - }, - "CoJPWxyzPJBARBaOijyTz": { - "id": "CoJPWxyzPJBARBaOijyTz", - "tableId": "isiA_oaJNIm3F4nYJuLJ1", - "name": "type", - "comment": "결제방식", - "dataType": "VARCHAR(20)", - "default": "", - "options": 8, - "ui": { - "keys": 0, - "widthName": 60, - "widthComment": 60, - "widthDataType": 75, - "widthDefault": 60 - }, - "meta": { - "updateAt": 1748831103704, - "createAt": 1748506219155 - } - }, "NzxkmndrTbH7xb6fbnGV7": { "id": "NzxkmndrTbH7xb6fbnGV7", "tableId": "B8haiEbPc1lRBWTv1g25G", @@ -6732,26 +6497,6 @@ "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", @@ -6851,6 +6596,26 @@ "updateAt": 1749700784536, "createAt": 1749700754351 } + }, + "Vf3bNvvEPfu1zCs4rcHTU": { + "id": "Vf3bNvvEPfu1zCs4rcHTU", + "tableId": "B8haiEbPc1lRBWTv1g25G", + "name": "user_uid", + "comment": "관리자정보", + "dataType": "INT", + "default": "", + "options": 8, + "ui": { + "keys": 2, + "widthName": 60, + "widthComment": 62, + "widthDataType": 60, + "widthDefault": 60 + }, + "meta": { + "updateAt": 1750645865952, + "createAt": 1750645375147 + } } }, "relationshipEntities": { @@ -6893,7 +6658,7 @@ "mfHtgzc_Aeocr6xkgwYWh" ], "x": 1584.6636, - "y": 245.7176, + "y": 171.7176, "direction": 1 }, "end": { @@ -7041,8 +6806,8 @@ "columnIds": [ "NzxkmndrTbH7xb6fbnGV7" ], - "x": 1454.3741, - "y": 1098.0063333333333, + "x": 1455.7440000000001, + "y": 1102.0063333333333, "direction": 2 }, "meta": { @@ -7060,8 +6825,8 @@ "columnIds": [ "N_yJVoCN4oUEDhYqdzApb" ], - "x": 934.3741, - "y": 1236.673, + "x": 935.744, + "y": 1248.673, "direction": 1 }, "end": { @@ -7125,8 +6890,8 @@ "columnIds": [ "f1hR1JRFHBHwiJSSX34gw" ], - "x": 1454.3741, - "y": 1236.673, + "x": 1455.7440000000001, + "y": 1248.673, "direction": 2 }, "meta": { @@ -7144,8 +6909,8 @@ "columnIds": [ "N_yJVoCN4oUEDhYqdzApb" ], - "x": 934.3741, - "y": 1375.3396666666667, + "x": 935.744, + "y": 1395.3396666666667, "direction": 1 }, "end": { @@ -7181,8 +6946,8 @@ "columnIds": [ "O7aGU_LJxCO1NeNVWbB-J" ], - "x": 1454.3741, - "y": 1375.3396666666667, + "x": 1455.7440000000001, + "y": 1395.3396666666667, "direction": 2 }, "meta": { @@ -7200,8 +6965,8 @@ "columnIds": [ "N_yJVoCN4oUEDhYqdzApb" ], - "x": 934.3741, - "y": 1098.0063333333333, + "x": 935.744, + "y": 1102.0063333333333, "direction": 1 }, "end": { @@ -7245,6 +7010,34 @@ "updateAt": 1749700754352, "createAt": 1749700754352 } + }, + "cRqZmxohkCGd_FTkg1rhI": { + "id": "cRqZmxohkCGd_FTkg1rhI", + "identification": false, + "relationshipType": 16, + "startRelationshipType": 2, + "start": { + "tableId": "Jq5Qkun2FzQhCGKANIVOZ", + "columnIds": [ + "mfHtgzc_Aeocr6xkgwYWh" + ], + "x": 1584.6636, + "y": 319.7176, + "direction": 1 + }, + "end": { + "tableId": "B8haiEbPc1lRBWTv1g25G", + "columnIds": [ + "Vf3bNvvEPfu1zCs4rcHTU" + ], + "x": 1195.7440000000001, + "y": 1028.673, + "direction": 4 + }, + "meta": { + "updateAt": 1750645375148, + "createAt": 1750645375148 + } } }, "indexEntities": {}, diff --git a/app/Entities/Customer/ServiceEntity.php b/app/Entities/Customer/ServiceEntity.php index bc41fea..7ba975f 100644 --- a/app/Entities/Customer/ServiceEntity.php +++ b/app/Entities/Customer/ServiceEntity.php @@ -13,6 +13,10 @@ class ServiceEntity extends CustomerEntity { return intval($this->attributes['ownerinfo_uid']); } + final public function getUserUID(): int + { + return intval($this->attributes['user_uid']); + } public function getTitle(): string { return "S" . $this->getPK(); diff --git a/app/Helpers/CommonHelper.php b/app/Helpers/CommonHelper.php index fea8660..7df3cc3 100644 --- a/app/Helpers/CommonHelper.php +++ b/app/Helpers/CommonHelper.php @@ -205,7 +205,7 @@ class CommonHelper default: // required가 있으면 class 추가 $extras = (strpos($viewDatas['control']['field_rules'][$field], 'required') !== false) ? ["class" => "text-danger", "required" => "", ...$extras] : $extras; - $label = form_label(lang("{$viewDatas['class_path']}.label.{$field}"), $field, $extras); + $label = form_label(array_key_exists('label', $extras) ? $extras['label'] : lang("{$viewDatas['class_path']}.label.{$field}"), $field, $extras); break; } return $label; diff --git a/app/Helpers/HomeHelper.php b/app/Helpers/HomeHelper.php index e578170..3beef1d 100644 --- a/app/Helpers/HomeHelper.php +++ b/app/Helpers/HomeHelper.php @@ -17,22 +17,39 @@ class HomeHelper extends CommonHelper public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null { switch ($field) { - case "countdown": //결제일Countdown - $value = $viewDatas['entity']->getView_CounDueAt(); - break; case 'item_uid': - // echo "Value:" . $viewDatas['entity']->getItemType() . ":" . $value; - // dd($viewDatas['control']['filter_optons']); $value = $viewDatas['control']['filter_optons'][$viewDatas['entity']->getItemType()][$value]->getTitle(); break; + case 'type': + // echo $value; + // dd($viewDatas['control']['filter_optons'][$field]); + $value = $viewDatas['control']['filter_optons'][$field][$value]->getTitle(); + break; case 'amount': $value = number_format($value) . "원"; break; case 'status': $value = parent::getFieldView($field, $value, $viewDatas, $extras); break; + case "LINE": + case "IP": + case "SERVER": + case "CPU": + case "RAM": + case "STORAGE": + case "SOFTWARE": + case "DEFENCE": + case "DOMAIN": + // if ($field == 'DEFENCE') { + // dd($viewDatas['entity']->getItemEntities($field)); + // } + $temps = []; + foreach ($viewDatas['entity']->getItemEntities($field) as $itemEntity) { + $temps[] = $viewDatas['control']['filter_optons'][$field][$itemEntity->getItemUid()]->getTitle(); + } + $value = implode("
", $temps); + break; default: - dd($viewDatas['entity']); if (in_array($field, $viewDatas['control']['filter_fields'])) { $value = $viewDatas['control']['filter_optons'][$field][$value]->getTitle(); } @@ -44,30 +61,4 @@ class HomeHelper extends CommonHelper } return $value; } - public function getListButton(string $action, array $viewDatas, array $extras = []): string - { - switch ($action) { - case 'modify': - $action = $viewDatas['entity']->getPK(); - break; - case 'invoice': - $action = form_submit($action . "_submit", '청구서 발행', [ - "formaction" => current_url() . '/' . $action, - "class" => "btn btn-outline btn-primary", - // "onclick" => "return submitBatchJob()" - ]); - break; - case 'delete': - if ($viewDatas['entity']->getStatus() !== DEFAULTS['STATUS']) { - $action = ""; - } else { - $action = parent::getListButton($action, $viewDatas, $extras); - } - break; - default: - $action = parent::getListButton($action, $viewDatas, $extras); - break; - } - return $action; - } } diff --git a/app/Language/en/Customer/Service.php b/app/Language/en/Customer/Service.php index 06d42c1..fbdd894 100644 --- a/app/Language/en/Customer/Service.php +++ b/app/Language/en/Customer/Service.php @@ -4,6 +4,7 @@ return [ 'label' => [ 'clientinfo_uid' => "고객", 'ownerinfo_uid' => "관리자", + 'user_uid' => "등록자", 'title' => "서비스명", 'type' => "서비스형식", 'location' => "위치", diff --git a/app/Models/Customer/ServiceModel.php b/app/Models/Customer/ServiceModel.php index 943b493..0f4bb2e 100644 --- a/app/Models/Customer/ServiceModel.php +++ b/app/Models/Customer/ServiceModel.php @@ -15,6 +15,7 @@ class ServiceModel extends CustomerModel protected $allowedFields = [ "clientinfo_uid", "ownerinfo_uid", + "user_uid", "type", "location", "switch", @@ -37,6 +38,7 @@ class ServiceModel extends CustomerModel switch ($field) { case "clientinfo_uid": case "ownerinfo_uid": + case "user_uid": $rule = "required|numeric"; break; case "type": diff --git a/app/Services/Customer/ServicePaymentService.php b/app/Services/Customer/ServicePaymentService.php index f257037..cf11025 100644 --- a/app/Services/Customer/ServicePaymentService.php +++ b/app/Services/Customer/ServicePaymentService.php @@ -75,12 +75,11 @@ class ServicePaymentService extends CustomerService } return $options; } - //미납 Count - final public function getUnPaid(string $item_type, string $status = DEFAULTS['STATUS']): int + //미납서비스 정보 + final public function getEntitiesByUnPaid(): array { - $sql = "SELECT COUNT(*) as CNT FROM serviceinfo_payment WHERE billing_at < NOW() AND item_type = ? AND status = ?"; - $row = $this->getModel()->query($sql, [$item_type, $status])->getRow(); - return intval($row->CNT); + $where = sprintf("billing_at < NOW() AND amount > 0 AND status = '%s'", DEFAULTS['STATUS']); + return $this->getEntities($where); } //ServiceItemService에서 사용 public function createPaymentByServiceItem(ServiceItemEntity $serviceItemEntity): ServicePaymentEntity diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php index 7e2331f..bbbc4a9 100644 --- a/app/Services/Customer/ServiceService.php +++ b/app/Services/Customer/ServiceService.php @@ -6,11 +6,15 @@ use App\Entities\Customer\ServiceEntity; use App\Entities\Equipment\CodeEntity; use App\Models\Customer\ServiceModel; +use App\Services\Customer\ServiceItemService; use App\Services\Equipment\CodeService; +use App\Services\UserService; class ServiceService extends CustomerService { + private ?UserService $_userService = null; private ?CodeService $_codeService = null; + private ?ServiceItemService $_serviceItemService = null; private ?string $_searchIP = null; public function __construct(mixed $request = null) { @@ -30,6 +34,7 @@ class ServiceService extends CustomerService return [ "clientinfo_uid", "ownerinfo_uid", + "user_uid", "type", "location", "switch", @@ -42,7 +47,7 @@ class ServiceService extends CustomerService } public function getFilterFields(): array { - return ["clientinfo_uid", 'ownerinfo_uid', 'type', 'location', 'switch', 'code', 'raid', 'status']; + return ["clientinfo_uid", 'ownerinfo_uid', 'user_uid', 'type', 'location', 'switch', 'code', 'raid', 'status']; } public function getBatchJobFields(): array { @@ -50,7 +55,14 @@ class ServiceService extends CustomerService } public function getIndexFields(): array { - return ['clientinfo_uid', 'ownerinfo_uid', 'type', 'location', 'switch', 'code', 'raid', 'billing_at', 'start_at', 'updated_at', 'status']; + return ['clientinfo_uid', 'ownerinfo_uid', 'type', 'location', 'switch', 'code', 'raid', 'billing_at', 'start_at', 'updated_at', 'status', 'user_uid']; + } + public function getUSerService(): UserService + { + if (!$this->_userService) { + $this->_userService = new UserService($this->request); + } + return $this->_userService; } public function getCodeService(): CodeService { @@ -59,6 +71,13 @@ class ServiceService extends CustomerService } return $this->_codeService; } + public function getServiceItemService(): ServiceItemService + { + if (!$this->_serviceItemService) { + $this->_serviceItemService = new ServiceItemService($this->request); + } + return $this->_serviceItemService; + } //Entity의 관련객체정의용 public function setSearchIp(string $ip): void { @@ -80,6 +99,20 @@ class ServiceService extends CustomerService } return parent::findAllDatas($columns); } + public function getEntities(mixed $where = null, array $columns = ['*']): array + { + $entities = []; + foreach (parent::getEntities($where, $columns) as $entity) { + foreach (SERVICE_ITEM_TYPES as $item_type => $label) { + $entity->setItemEntities( + $item_type, + $this->getServiceItemService()->getEntities(['serviceinfo_uid' => $entity->getPK(), 'item_type' => $item_type]) + ); + } + $entities[$entity->getPK()] = $entity; + } + return $entities; + } // //기본 기능부분 //FieldForm관련용 public function getFormFieldOption(string $field, array $options = []): array @@ -88,6 +121,9 @@ class ServiceService extends CustomerService case 'ownerinfo_uid': $options = $this->getClientService()->getEntities(); break; + case 'user_uid': + $options = $this->getUserService()->getEntities(); + break; case 'code': $options = $this->getCodeService()->getEntities(); break; @@ -98,10 +134,10 @@ class ServiceService extends CustomerService return $options; } //interval을 기준으로 신규서비스 가져오기 - final public function getNewService(int $interval, string $status = DEFAULTS['STATUS']) + final public function getEntitiesByNewService(int $interval, string $status = DEFAULTS['STATUS']) { - $sql = "SELECT * FROM serviceinfo WHERE start_at >= NOW() - INTERVAL ? DAY AND status = ?"; - return $this->getModel()->query($sql, [$interval, $status])->getResult(ServiceEntity::class); + $where = sprintf("start_at >= NOW()-INTERVAL {$interval} DAY AND status = '%s'", DEFAULTS['STATUS']); + return $this->getEntities($where); } //다음 달로 결제일을 연장합니다. final public function extendBillingAt(string $billing_at, string $status): bool diff --git a/app/Views/templates/admin/welcome_banner.php b/app/Views/templates/admin/welcome_banner.php index 1871c3e..de6c486 100644 --- a/app/Views/templates/admin/welcome_banner.php +++ b/app/Views/templates/admin/welcome_banner.php @@ -133,7 +133,7 @@
-
금일 기준 미납 서버
+
금일 기준 미납 서비스
diff --git a/app/Views/templates/admin/welcome_new.php b/app/Views/templates/admin/welcome_new.php index 61c7a4e..436af6d 100644 --- a/app/Views/templates/admin/welcome_new.php +++ b/app/Views/templates/admin/welcome_new.php @@ -19,7 +19,6 @@ IP정보 CS 등록자 - 비고 @@ -32,9 +31,8 @@ getFieldView('code', $entity->getCode(), $viewDatas) ?> getFieldView('switch', $entity->getSwitch(), $viewDatas) ?> getFieldView('IP', null, $viewDatas) ?> - getFieldView('DEFEMCE', null, $viewDatas) ?> - 등록자 - 비고 + getFieldView('DEFENCE', null, $viewDatas) ?> + getFieldView('user_uid', $entity->getUserUID(), $viewDatas) ?>