dbmsv2 init...1

This commit is contained in:
choi.jh 2025-08-27 17:54:08 +09:00
parent eb36d74033
commit 058e3c535e
12 changed files with 411 additions and 276 deletions

View File

@ -365,6 +365,11 @@ define('DEFAULT_LIST_PERPAGE', $_ENV['LIST_PERPAGE'] ?? $_SERVER['LIST_PERPAGE']
//신규서비스 Interval
define('SERVICE_NEW_INTERVAL', $_ENV['SERVICE_NEW_INTERVAL'] ?? $_SERVER['SERVICE_NEW_INTERVAL'] ?? 7);
//서버 PartType
define("SERVER", [
"PARTTYPES" => ['CPU', 'RAM', 'DISK', 'OS']
]);
//결제관련
define("PAYMENT", [
'BILLING' => [

View File

@ -2,20 +2,18 @@
namespace App\Controllers\Admin\Equipment;
use App\Entities\Equipment\IPEntity;
use App\Entities\Equipment\ServerEntity;
use App\Entities\Equipment\ServerPartEntity;
use App\Helpers\Equipment\ServerHelper;
use App\Services\Equipment\ServerPartService;
use App\Services\Equipment\ServerService;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class ServerController extends EquipmentController
{
private ?ServerPartService $_serverPartService = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
@ -41,13 +39,6 @@ class ServerController extends EquipmentController
}
return $this->_helper;
}
final public function getServerPartService(): ServerPartService
{
if (!$this->_serverPartService) {
$this->_serverPartService = new ServerPartService();
}
return $this->_serverPartService;
}
//Index,FieldForm관련
//생성
protected function create_form_process(): void
@ -60,22 +51,39 @@ class ServerController extends EquipmentController
parent::create_form_process();
}
//추가 파트정보 생성
private function createServerParts(ServerEntity $entity): array
private function getFormDatasForServerPartInfo(ServerEntity $entity, string $partType): array
{
$serverPartEntities = [];
foreach (ServerPartService::BaseParts as $basePart) {
$formDatas = [
"partinfo_uid" => $this->request->getPost(["serverpartinfo_{$basePart}_uid"]),
"serverinfo_uid" => $entity->getPK(),
"serviceinfo_uid" => $entity->getServiceInfoUID(),
"billing" => ServerPartENtity::DEFAULT_BILLING,
"amount" => $this->request->getPost("amount") ?? 0,
"cnt" => $this->request->getPost("serverpartinfo_{$basePart}_uid_cnt") ?? 1,
"extra" => $this->request->getPost("serverpartinfo_{$basePart}_uid_extra") ?? ""
];
$serverPartEntities[] = $this->getServerPartService()->create($formDatas);
$formDatas = [
"partinfo_uid" => $this->request->getPost(["serverpartinfo_{$partType}_uid"]),
"serverinfo_uid" => $entity->getPK(),
"serviceinfo_uid" => $entity->getServiceInfoUID(),
"type" => $partType,
"billing" => ServerPartENtity::DEFAULT_BILLING,
"amount" => $this->request->getPost("amount") ?? 0,
"cnt" => $this->request->getPost("serverpartinfo_{$partType}_uid_cnt") ?? 1,
"extra" => $this->request->getPost("serverpartinfo_{$partType}_uid_extra") ?? ""
];
return $formDatas;
}
private function getFormDatasForIPInfo(ServerEntity $entity, string $status): array
{
$formDatas = [
"serverinfo_uid" => $entity->getPK(),
"clientinfo_uid" => $entity->getClientInfoUID(),
"serviceinfo_uid" => $entity->getServiceInfoUID(),
"status" => $status
];
return $formDatas;
}
private function createIpInfo(ServerEntity $entity): IPEntity
{
//기존 Entity 가져오기
$ipinfo_uid = $this->request->getPost("ipinfo_uid");
$ipEntity = $this->getService()->getIPService()->getEntity($ipinfo_uid);
if (!$ipEntity) {
throw new \Exception("{$ipinfo_uid}에 대한 정보를 찾을수 없습니다.");
}
return $serverPartEntities;
return $this->getService()->getIPService()->modify($ipEntity, $this->getFormDatasForIPInfo($entity, $ipEntity::STATUS_OCCUPIED));
}
protected function create_process(array $formDatas): ServerEntity
{
@ -91,19 +99,15 @@ class ServerController extends EquipmentController
throw new \Exception("Server코드[{$formDatas['code']}의 형식이 맞지않습니다");
}
$entity = parent::create_process($formDatas);
//추가 파트정보 생성 후 ServerEntity 에 설정
$entity->setServerParts($this->createServerParts($entity));
//ServerPart정보 생성 후 ServerEntity에 설정
foreach (SERVER['PARTTYPES'] as $partType) {
$serverPartEnty = $this->getService()->getServerPartService()->create(
$this->getFormDatasForServerPartInfo($entity, $partType)
);
$entity->setServerPartEntity($partType, $serverPartEnty);
}
//IP정보 속성 수정후 ServerEntity에 설정
$entity->setIPEntities([$this->createIpInfo($entity)]);
return $entity;
}
protected function index_process(array $entities = []): array
{
foreach (parent::index_process($entities) as $entity) {
//서버 부품정보 정의
$entity->setServerParts($this->getServerPartService()->getEntities(['serverinfo_uid' => $entity->getPK()]));
//서버 IP정보 정의
//서버 CS정보 정의
$entities[] = $entity;
}
return $entities;
}
}

View File

@ -4,13 +4,13 @@
"settings": {
"width": 3000,
"height": 3000,
"scrollTop": -1509.3576,
"scrollLeft": -365.7916,
"scrollTop": -1726.3031,
"scrollLeft": -455.9114,
"zoomLevel": 0.76,
"show": 511,
"database": 4,
"databaseName": "",
"canvasType": "@dineug/erd-editor/builtin-schema-sql",
"canvasType": "ERD",
"language": 1,
"tableNameCase": 4,
"columnNameCase": 2,
@ -113,15 +113,15 @@
"w_EuwbTwtLEPAgYjS1aYq"
],
"ui": {
"x": 1419.5003,
"y": 297.6737,
"x": 1298.9121,
"y": 227.0855,
"zIndex": 2,
"widthName": 60,
"widthComment": 62,
"color": ""
},
"meta": {
"updateAt": 1755653491658,
"updateAt": 1756279440813,
"createAt": 1745819764136
}
},
@ -175,15 +175,15 @@
"JEk5AASiK6MpT9QBRWjMX"
],
"ui": {
"x": 696.3092,
"y": 832.1517,
"x": 1250.1794,
"y": 704.2103,
"zIndex": 2,
"widthName": 60,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1755654904923,
"updateAt": 1756279482646,
"createAt": 1745819764137
}
},
@ -319,15 +319,15 @@
"aY2pn1J3VHF_qV5XFM_zf"
],
"ui": {
"x": 807.5175,
"y": 1997.4168,
"x": 2264.5612,
"y": 1964.677,
"zIndex": 2,
"widthName": 60,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1756086075154,
"updateAt": 1756279464511,
"createAt": 1745819764137
}
},
@ -365,15 +365,15 @@
"xvHi50lODgZs-Ke-lH95g"
],
"ui": {
"x": 2303.7942,
"y": 1764.818,
"x": 66.565,
"y": 2125.8862,
"zIndex": 2,
"widthName": 60,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1755506769168,
"updateAt": 1756279418325,
"createAt": 1745819764138
}
},
@ -418,15 +418,15 @@
"ZgRRNC6OFpn87uomKBHbH"
],
"ui": {
"x": 2303.2041,
"y": 1392.8748,
"x": 62.9566,
"y": 1781.5745,
"zIndex": 2,
"widthName": 60,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1755654240788,
"updateAt": 1756279413496,
"createAt": 1745819764138
}
},
@ -484,15 +484,15 @@
"CX9ODlVw-gFnxgfMJ1JyV"
],
"ui": {
"x": 1612.8983,
"y": 1500.839,
"x": 758.8735,
"y": 1837.6814,
"zIndex": 2,
"widthName": 60,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1756086185204,
"updateAt": 1756279479074,
"createAt": 1745819764138
}
},
@ -639,15 +639,15 @@
"n9ZWAQ9754sZ3MM4IxCAA"
],
"ui": {
"x": 2314.4072,
"y": 644.0365,
"x": 2195.6764,
"y": 573.0616,
"zIndex": 2278,
"widthName": 60,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1755653438046,
"updateAt": 1756279455895,
"createAt": 1748484896313
}
},
@ -728,15 +728,15 @@
"2fzVlWt1Skh-391N_z9Ci"
],
"ui": {
"x": 1526.2804,
"y": 976.8582,
"x": 2160.5683,
"y": 1265.7898,
"zIndex": 2395,
"widthName": 60,
"widthComment": 62,
"color": ""
},
"meta": {
"updateAt": 1755660518169,
"updateAt": 1756279460059,
"createAt": 1748485662214
}
},
@ -777,15 +777,15 @@
"qOLH2re1rmaG-63c08R8x"
],
"ui": {
"x": 74.9689,
"y": 1414.7795,
"x": 46.0215,
"y": 1046.3584,
"zIndex": 2509,
"widthName": 60,
"widthComment": 62,
"color": ""
},
"meta": {
"updateAt": 1755666709923,
"updateAt": 1756279268718,
"createAt": 1750898626895
}
},
@ -832,15 +832,15 @@
"S-_BBM4Qv5LCTvGVKmQQw"
],
"ui": {
"x": 50.1723,
"y": 1816.5969,
"x": 58.067,
"y": 1344.2285,
"zIndex": 4045,
"widthName": 60,
"widthComment": 201,
"color": ""
},
"meta": {
"updateAt": 1756086070863,
"updateAt": 1756279299856,
"createAt": 1755244574868
}
},
@ -853,6 +853,7 @@
"l2g7xess8DY86_ZOm7Ca1",
"IbWdZlEEF70bGqUDkU5ub",
"eu4eV0U7BRaP7Zk-oyBhV",
"czO0QNJkidvlfvj3hL6xs",
"mYEan5gjLS5bBthtFCc6w",
"tmSvn-3Kqlf7oUbiedFDh",
"SioEINPlR0iyL87vqa4N-",
@ -869,6 +870,7 @@
"l2g7xess8DY86_ZOm7Ca1",
"IbWdZlEEF70bGqUDkU5ub",
"eu4eV0U7BRaP7Zk-oyBhV",
"czO0QNJkidvlfvj3hL6xs",
"mYEan5gjLS5bBthtFCc6w",
"tmSvn-3Kqlf7oUbiedFDh",
"SioEINPlR0iyL87vqa4N-",
@ -880,15 +882,15 @@
"kDyVwSigBBYnp_F9MyRAw"
],
"ui": {
"x": 1541.4598,
"y": 1937.3055,
"x": 698.2708,
"y": 2247.9865,
"zIndex": 4514,
"widthName": 101,
"widthComment": 165,
"color": ""
},
"meta": {
"updateAt": 1756083472477,
"updateAt": 1756279409021,
"createAt": 1755476453282
}
},
@ -8193,6 +8195,26 @@
"updateAt": 1756083498528,
"createAt": 1756083498528
}
},
"czO0QNJkidvlfvj3hL6xs": {
"id": "czO0QNJkidvlfvj3hL6xs",
"tableId": "8GYAVBvZGaMFeq3QuXk_B",
"name": "type",
"comment": "형식",
"dataType": "VARCHAR(20)",
"default": "",
"options": 8,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 75,
"widthDefault": 60
},
"meta": {
"updateAt": 1756279042574,
"createAt": 1756279042572
}
}
},
"relationshipEntities": {
@ -8206,18 +8228,18 @@
"columnIds": [
"7B0zaLoZnOoMNW8OHZlrQ"
],
"x": 2303.2041,
"y": 1540.8748,
"direction": 1
"x": 565.9566,
"y": 1929.5745,
"direction": 2
},
"end": {
"tableId": "ZLEpY5EjuZV21718zf-Y1",
"columnIds": [
"f7_MGvRjkwL1xkCWrAgDR"
],
"x": 2144.8983,
"y": 1684.839,
"direction": 2
"x": 758.8735,
"y": 2021.6814,
"direction": 1
},
"meta": {
"updateAt": 1746595277837,
@ -8234,17 +8256,17 @@
"columnIds": [
"mfHtgzc_Aeocr6xkgwYWh"
],
"x": 1672.0003,
"y": 593.6737,
"direction": 8
"x": 1803.9121,
"y": 473.7521666666667,
"direction": 2
},
"end": {
"tableId": "B8haiEbPc1lRBWTv1g25G",
"columnIds": [
"Vf3bNvvEPfu1zCs4rcHTU"
],
"x": 1852.7804,
"y": 976.8582,
"x": 2323.8183,
"y": 1265.7898,
"direction": 4
},
"meta": {
@ -8262,8 +8284,8 @@
"columnIds": [
"mfHtgzc_Aeocr6xkgwYWh"
],
"x": 1924.5003,
"y": 519.6737,
"x": 1803.9121,
"y": 375.0855,
"direction": 2
},
"end": {
@ -8271,8 +8293,8 @@
"columnIds": [
"s1Az-lXWK0NlVQqFEEK8o"
],
"x": 2314.4072,
"y": 705.3698333333333,
"x": 2195.6764,
"y": 665.0616,
"direction": 1
},
"meta": {
@ -8290,8 +8312,8 @@
"columnIds": [
"mfHtgzc_Aeocr6xkgwYWh"
],
"x": 1924.5003,
"y": 371.6737,
"x": 1803.9121,
"y": 276.41883333333334,
"direction": 2
},
"end": {
@ -8318,17 +8340,17 @@
"columnIds": [
"mfHtgzc_Aeocr6xkgwYWh"
],
"x": 1419.5003,
"y": 482.6737,
"direction": 1
"x": 1551.4121,
"y": 523.0855,
"direction": 8
},
"end": {
"tableId": "6ajvOCaGuXU9pzV0Y9jEi",
"columnIds": [
"hrPg0uHAdEjamOj--BVzO"
],
"x": 1140.4758666666667,
"y": 832.1517,
"x": 1516.6794,
"y": 704.2103,
"direction": 4
},
"meta": {
@ -8346,8 +8368,8 @@
"columnIds": [
"mfHtgzc_Aeocr6xkgwYWh"
],
"x": 1419.5003,
"y": 334.6737,
"x": 1298.9121,
"y": 276.41883333333334,
"direction": 1
},
"end": {
@ -8374,8 +8396,8 @@
"columnIds": [
"mfHtgzc_Aeocr6xkgwYWh"
],
"x": 1419.5003,
"y": 408.6737,
"x": 1298.9121,
"y": 375.0855,
"direction": 1
},
"end": {
@ -8402,18 +8424,18 @@
"columnIds": [
"2HB01q46-mugMjuOz85YG"
],
"x": 2303.7942,
"y": 1888.818,
"direction": 1
"x": 563.565,
"y": 2249.8862,
"direction": 2
},
"end": {
"tableId": "8GYAVBvZGaMFeq3QuXk_B",
"columnIds": [
"l2g7xess8DY86_ZOm7Ca1"
],
"x": 2135.4598,
"y": 2085.3055,
"direction": 2
"x": 698.2708,
"y": 2407.9865,
"direction": 1
},
"meta": {
"updateAt": 1755486693704,
@ -8430,8 +8452,8 @@
"columnIds": [
"mfHtgzc_Aeocr6xkgwYWh"
],
"x": 1419.5003,
"y": 556.6737,
"x": 1298.9121,
"y": 473.7521666666667,
"direction": 1
},
"end": {
@ -8458,8 +8480,8 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 696.3092,
"y": 1052.1517,
"x": 1250.1794,
"y": 924.2103,
"direction": 1
},
"end": {
@ -8486,9 +8508,9 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 962.8091999999999,
"y": 832.1517,
"direction": 4
"x": 1250.1794,
"y": 836.2103,
"direction": 1
},
"end": {
"tableId": "jO40Ej5EXImXnadoJo9bn",
@ -8514,9 +8536,9 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 785.1425333333333,
"y": 832.1517,
"direction": 4
"x": 1250.1794,
"y": 748.2103,
"direction": 1
},
"end": {
"tableId": "GDEF0_WuOpaYtsZxjn2zM",
@ -8542,8 +8564,8 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 1229.3092000000001,
"y": 887.1517,
"x": 1783.1794,
"y": 814.2103,
"direction": 2
},
"end": {
@ -8551,8 +8573,8 @@
"columnIds": [
"8mPFhDdUY8QLPvc8rNw1B"
],
"x": 2314.4072,
"y": 828.0364999999999,
"x": 2195.6764,
"y": 849.0616,
"direction": 1
},
"meta": {
@ -8570,8 +8592,8 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 1229.3092000000001,
"y": 997.1517,
"x": 1783.1794,
"y": 1034.2103,
"direction": 2
},
"end": {
@ -8579,8 +8601,8 @@
"columnIds": [
"N-2m8O_JzS6-sDEcL5zTv"
],
"x": 1526.2804,
"y": 1031.8582000000001,
"x": 2160.5683,
"y": 1309.7898,
"direction": 1
},
"meta": {
@ -8598,18 +8620,18 @@
"columnIds": [
"nNWsAWbHfKWqx8EwxvuM1"
],
"x": 2179.2804,
"y": 1196.8582000000001,
"direction": 2
"x": 2650.3183,
"y": 1265.7898,
"direction": 4
},
"end": {
"tableId": "QCNA57Pi6A9dJDgybxS5v",
"columnIds": [
"vxhl-9RMNJ8zU9oqzEWo8"
],
"x": 2314.4072,
"y": 950.7031666666666,
"direction": 1
"x": 2506.1764,
"y": 941.0616,
"direction": 8
},
"meta": {
"updateAt": 1755653412891,
@ -8626,17 +8648,17 @@
"columnIds": [
"RITMHZcQAJ7KvtxkTtMv-"
],
"x": 894.8508333333333,
"y": 1997.4168,
"direction": 4
"x": 2264.5612,
"y": 2082.277,
"direction": 1
},
"end": {
"tableId": "IsMoJXzvtuoOFFt93qS0w",
"columnIds": [
"wi1XbZM3emknh42sOMkYq"
],
"x": 591.9689,
"y": 1641.446166666667,
"x": 563.0215000000001,
"y": 1273.0250666666668,
"direction": 2
},
"meta": {
@ -8654,8 +8676,8 @@
"columnIds": [
"RITMHZcQAJ7KvtxkTtMv-"
],
"x": 807.5175,
"y": 2193.4168,
"x": 2264.5612,
"y": 2160.677,
"direction": 1
},
"end": {
@ -8663,8 +8685,8 @@
"columnIds": [
"GtBqjKsmtYWvsd0fckBc0"
],
"x": 588.1723,
"y": 2143.263566666667,
"x": 596.067,
"y": 1670.895166666667,
"direction": 2
},
"meta": {
@ -8682,17 +8704,17 @@
"columnIds": [
"nNWsAWbHfKWqx8EwxvuM1"
],
"x": 1526.2804,
"y": 1251.8582000000001,
"direction": 1
"x": 2487.0683,
"y": 1705.7898,
"direction": 8
},
"end": {
"tableId": "B4qGh3KZsXHQ3_4EOgwJZ",
"columnIds": [
"4iRyOhmW3b7kbiZT8lQyY"
],
"x": 1244.1841666666667,
"y": 1997.4168,
"x": 2526.5612,
"y": 1964.677,
"direction": 4
},
"meta": {
@ -8710,8 +8732,8 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 1140.4758666666667,
"y": 1272.1517,
"x": 1694.346066666667,
"y": 1144.2103,
"direction": 8
},
"end": {
@ -8719,9 +8741,9 @@
"columnIds": [
"JRdeV7n53lb1iSmmYnhHX"
],
"x": 1069.5175,
"y": 1997.4168,
"direction": 4
"x": 2264.5612,
"y": 2003.877,
"direction": 1
},
"meta": {
"updateAt": 1755653851900,
@ -8738,18 +8760,18 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 1229.3092000000001,
"y": 1107.1517,
"direction": 2
"x": 1339.0127333333335,
"y": 1144.2103,
"direction": 8
},
"end": {
"tableId": "ZLEpY5EjuZV21718zf-Y1",
"columnIds": [
"60w6M5QqxGAvJa3EEMDbR"
],
"x": 1612.8983,
"y": 1562.1723333333334,
"direction": 1
"x": 891.8735,
"y": 1837.6814,
"direction": 4
},
"meta": {
"updateAt": 1755653938445,
@ -8766,18 +8788,18 @@
"columnIds": [
"RITMHZcQAJ7KvtxkTtMv-"
],
"x": 1331.5175,
"y": 2095.4168,
"direction": 2
"x": 2264.5612,
"y": 2239.077,
"direction": 1
},
"end": {
"tableId": "ZLEpY5EjuZV21718zf-Y1",
"columnIds": [
"QznZ6PY_T3OGj3YD4GdOX"
],
"x": 1612.8983,
"y": 1807.505666666667,
"direction": 1
"x": 1290.8735000000001,
"y": 2113.6814,
"direction": 2
},
"meta": {
"updateAt": 1755653979090,
@ -8794,18 +8816,18 @@
"columnIds": [
"RITMHZcQAJ7KvtxkTtMv-"
],
"x": 1331.5175,
"y": 2291.4168,
"direction": 2
"x": 2264.5612,
"y": 2317.4770000000003,
"direction": 1
},
"end": {
"tableId": "8GYAVBvZGaMFeq3QuXk_B",
"columnIds": [
"IbWdZlEEF70bGqUDkU5ub"
],
"x": 1541.4598,
"y": 2085.3055,
"direction": 1
"x": 1292.2708,
"y": 2487.9865,
"direction": 2
},
"meta": {
"updateAt": 1755654048878,
@ -8822,18 +8844,18 @@
"columnIds": [
"nNWsAWbHfKWqx8EwxvuM1"
],
"x": 2016.0304,
"y": 1416.8582000000001,
"direction": 8
"x": 2160.5683,
"y": 1573.7898,
"direction": 1
},
"end": {
"tableId": "ZLEpY5EjuZV21718zf-Y1",
"columnIds": [
"sJfMcwfDgXnsZ89DVVDA2"
],
"x": 1878.8983,
"y": 1500.839,
"direction": 4
"x": 1290.8735000000001,
"y": 1929.6814,
"direction": 2
},
"meta": {
"updateAt": 1755664509604,
@ -8850,8 +8872,8 @@
"columnIds": [
"nNWsAWbHfKWqx8EwxvuM1"
],
"x": 1526.2804,
"y": 1141.8582000000001,
"x": 2160.5683,
"y": 1397.7898,
"direction": 1
},
"end": {
@ -8859,8 +8881,8 @@
"columnIds": [
"E30sHnqJytLlBmfL7ueOG"
],
"x": 591.9689,
"y": 1460.1128333333336,
"x": 563.0215000000001,
"y": 1182.3584,
"direction": 2
},
"meta": {
@ -8878,8 +8900,8 @@
"columnIds": [
"nNWsAWbHfKWqx8EwxvuM1"
],
"x": 1526.2804,
"y": 1361.8582000000001,
"x": 2160.5683,
"y": 1485.7898,
"direction": 1
},
"end": {
@ -8887,8 +8909,8 @@
"columnIds": [
"7Tqt0jVOln16nire8AE2K"
],
"x": 588.1723,
"y": 2012.5969000000002,
"x": 596.067,
"y": 1540.2285000000002,
"direction": 2
},
"meta": {
@ -8906,18 +8928,18 @@
"columnIds": [
"nNWsAWbHfKWqx8EwxvuM1"
],
"x": 1689.5304,
"y": 1416.8582000000001,
"direction": 8
"x": 2160.5683,
"y": 1661.7898,
"direction": 1
},
"end": {
"tableId": "8GYAVBvZGaMFeq3QuXk_B",
"columnIds": [
"eu4eV0U7BRaP7Zk-oyBhV"
],
"x": 1838.4598,
"y": 1937.3055,
"direction": 4
"x": 1292.2708,
"y": 2327.9865,
"direction": 2
},
"meta": {
"updateAt": 1755664858263,
@ -8934,17 +8956,17 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 962.8091999999999,
"y": 1272.1517,
"direction": 8
"x": 1250.1794,
"y": 1012.2103,
"direction": 1
},
"end": {
"tableId": "IsMoJXzvtuoOFFt93qS0w",
"columnIds": [
"9FYinSR3C6jDrEsRsCMpl"
],
"x": 591.9689,
"y": 1550.7795000000003,
"x": 563.0215000000001,
"y": 1091.6917333333333,
"direction": 2
},
"meta": {
@ -8962,17 +8984,17 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 785.1425333333333,
"y": 1272.1517,
"direction": 8
"x": 1250.1794,
"y": 1100.2103,
"direction": 1
},
"end": {
"tableId": "SEgsi7mbM-56Rsx5-qj8K",
"columnIds": [
"q_IaRBb367b9mgGozh6jB"
],
"x": 588.1723,
"y": 1881.9302333333335,
"x": 596.067,
"y": 1409.5618333333334,
"direction": 2
},
"meta": {
@ -8990,18 +9012,18 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 1229.3092000000001,
"y": 1217.1517,
"direction": 2
"x": 1516.6794000000002,
"y": 1144.2103,
"direction": 8
},
"end": {
"tableId": "ZLEpY5EjuZV21718zf-Y1",
"columnIds": [
"4sj8hIYAiLSSF89eeNXdQ"
],
"x": 1612.8983,
"y": 1684.8390000000002,
"direction": 1
"x": 1157.8735000000001,
"y": 1837.6814,
"direction": 4
},
"meta": {
"updateAt": 1755666739577,

View File

@ -406,6 +406,7 @@ CREATE TABLE `serverinfo_partinfo` (
`partinfo_uid` int(11) NOT NULL COMMENT 'PART정보',
`serverinfo_uid` int(11) NOT NULL COMMENT '서버정보',
`serviceinfo_uid` int(11) DEFAULT NULL COMMENT '서비스정보',
`type` varchar(20) NOT NULL COMMENT '형식',
`billing` varchar(20) NOT NULL COMMENT '청구방법(month,onetime)',
`amount` int(11) NOT NULL DEFAULT 0 COMMENT '서비스금액',
`cnt` tinyint(4) NOT NULL DEFAULT 1 COMMENT '갯수',

File diff suppressed because one or more lines are too long

View File

@ -13,13 +13,38 @@ class ServerEntity extends EquipmentEntity
const STATUS_FORBIDDEN = "forbidden";
const DEFAULT_STATUS = self::STATUS_AVAILABLE;
public function setServerParts(array $datas): void
public function setServerPartEntity(string $partType, ServerPartENtity $entity): void
{
$this->attributes['server_parts'] = $datas;
if (!array_key_exists('serverPartEntities', $this->attributes)) {
$this->attributes['serverPartEntities'] = [];
}
$this->attributes['serverPartEntities'][$partType] = $entity;
}
public function getServerParts(): array
public function getServerPartEntity(string $partType): ServerPartENtity|null
{
return $this->attributes['server_parts'] ?? [];
if (!array_key_exists('serverPartEntities', $this->attributes)) {
return null;
}
if (!array_key_exists($partType, $this->attributes['serverPartEntities'])) {
return null;
}
return $this->attributes['serverPartEntities'][$partType];
}
public function setIPEntities(array $entities): void
{
$this->attributes['ipEntities'] = $entities;
}
public function getIPEntities(): array
{
return $this->attributes['ipEntities'] ?? [];
}
public function setCSEntities(array $entities): void
{
$this->attributes['csEntities'] = $entities;
}
public function getCSEntities(): array
{
return $this->attributes['csEntities'] ?? [];
}
//기본기능용
public function getCode(): string

View File

@ -12,21 +12,25 @@ class ServerPartEntity extends EquipmentEntity
public function setPartEntity(PartEntity $entity): void
{
$this->attributes['part'] = $entity;
$this->attributes['partEntity'] = $entity;
}
public function getPartEntity(): PartEntity
{
return $this->attributes['partEntity'];
}
public function getType(): string
{
return $this->getPartEntity()->getType() ?? "";
}
public function getTitle(): string
{
return $this->getPartEntity()->getTitle();
return $this->getPartEntity()->getTitle() ?? "";
}
public function getPrice(): string
public function getPrice(): int
{
return $this->getPartEntity()->getPrice();
return $this->getPartEntity()->getPrice() ?? 0;
}
//기본기능용
public function getPartEntity(): PartEntity
{
return $this->attributes['part'] ?? [];
}
public function getPartInfoUID(): int
{
return $this->attributes['partinfo_uid'];

View File

@ -19,17 +19,18 @@ class ServerHelper extends EquipmentHelper
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender';
$form = form_input($field, $value ?? "", $extras);
break;
case 'serverpartinfo_cpu_uid':
case 'serverpartinfo_ram_uid':
case 'serverpartinfo_disk_uid':
case 'serverpartinfo_software_uid':
case 'serverpartinfo_os_uid':
case 'serverpartinfo_db_uid':
$form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
case 'CPU':
case 'RAM':
case 'SOFTWARE':
case 'OS':
case 'serverpartinfo_DB_uid':
$form = $this->form_dropdown_custom($field, old($field) ?? (array_key_exists('entity', $viewDatas) ? $viewDatas['entity']->getServerPartEntity('CPU')->getPK() : null), $viewDatas, $extras);
$form .= " " . form_dropdown("{$field}_cnt", $viewDatas['serverpartinfo_cnt_range'], old("{$field}_cnt") ?? $viewDatas['entity']->$field ?? 1) . "";
if ($field === 'serverpartinfo_disk_uid') {
$form .= form_dropdown("{$field}_extra", $viewDatas['serverpartinfo_extra_options'], old("{$field}_extra") ?? $viewDatas['entity']->$field ?? 1);
}
break;
case 'DISK':
$form = $this->form_dropdown_custom($field, old($field) ?? (array_key_exists('entity', $viewDatas) ? $viewDatas['entity']->getPartInfoUID() : null), $viewDatas, $extras);
$form .= " " . form_dropdown("{$field}_cnt", $viewDatas['serverpartinfo_cnt_range'], old("{$field}_cnt") ?? $viewDatas['entity']->$field ?? 1) . "";
$form .= form_dropdown("{$field}_extra", $viewDatas['serverpartinfo_extra_options'], old("{$field}_extra") ?? $viewDatas['entity']->$field ?? 1);
break;
case 'ipinfo_uid':
case 'csinfo_uid':
@ -50,16 +51,30 @@ class ServerHelper extends EquipmentHelper
$value = $value ? date("Y-m-d", strtotime($value)) : "";
break;
case 'serverpartinfo':
// dd($viewDatas['entity']);
$value = "";
foreach ($viewDatas['entity']->getServerParts() as $serverPart) {
foreach (SERVER['PARTTYPES'] as $partType) {
$serverPartEntity = $viewDatas['entity']->getServerPartEntity($partType);
$value .= sprintf(
"<div>%s%s %s</div>",
$serverPart->getTitle(),
$serverPart->getCnt() > 1 ? "*" . $serverPart->getCnt() . "" : "",
$serverPart->getExtra() ?? ""
"<div>%s : %s%s %s</div>",
$serverPartEntity->getType(),
$serverPartEntity->getTitle(),
$serverPartEntity->getCnt() > 1 ? "*" . $serverPartEntity->getCnt() . "" : "",
$serverPartEntity->getExtra() ?? ""
);
}
// dd($value);
break;
case 'ipinfo_uid':
$value = "";
foreach ($viewDatas['entity']->getIPEntities() as $ipEntity) {
$value .= sprintf("<div>%s%s %s</div>", $ipEntity->getTitle(), $ipEntity->getAmount());
}
break;
case 'csinfo_uid':
$value = "";
foreach ($viewDatas['entity']->getCSEntities() as $csEntity) {
$value .= sprintf("<div>%s%s %s</div>", $csEntity->getTitle(), $csEntity->getAmount());
}
break;
default:
$value = parent::getFieldView($field, $value, $viewDatas, $extras);

View File

@ -18,12 +18,12 @@ return [
"serverpartinfo" => "부품정보",
"ipinfo_uid" => "IP정보",
"csinfo_uid" => "CS정보",
'serverpartinfo_cpu_uid' => "CPU",
'serverpartinfo_ram_uid' => "RAM",
'serverpartinfo_disk_uid' => "DISK",
'serverpartinfo_os_uid' => "OS",
'serverpartinfo_db_uid' => "DB",
'serverpartinfo_software_uid' => "기타SW",
'CPU' => "CPU",
'RAM' => "RAM",
'DISK' => "DISK",
'OS' => "OS",
'serverpartinfo_DB_uid' => "DB",
'SOFTWARE' => "기타SW",
],
"TITLE" => [
'HP DL360 Gen6' => "HP DL360 Gen6",

View File

@ -72,6 +72,8 @@ abstract class CommonService
if ($where) {
$this->getModel()->where($where);
}
//출력순서 정의
$this->setOrderBy();
$entities = [];
foreach ($this->getModel()->select(implode(',', $columns))->findAll() as $entity) {
$entities[$entity->getPK()] = $this->getEntity_process($entity);

View File

@ -2,12 +2,12 @@
namespace App\Services\Equipment;
use App\Entities\Equipment\ServerPartEntity;
use App\Models\Equipment\ServerPartModel;
use App\Services\Equipment\EquipmentService;
class ServerPartService extends EquipmentService
{
const BaseParts = ['cpu', 'ram', 'disk', 'os'];
private ?PartService $_partService = null;
public function __construct()
{
@ -48,27 +48,33 @@ class ServerPartService extends EquipmentService
}
return $this->_partService;
}
//partEntity 정보 추가
protected function getEntity_process(mixed $entity): ServerPartEntity
{
$entity->setPartEntity($this->getPartService()->getEntity($entity->getPartInfoUID()));
return $entity;
}
//기본 기능부분
//FieldForm관련용
public function getFormFieldOption(string $field, array $options = []): array
{
switch ($field) {
case 'partinfo_cpu_uid':
case 'partinfo_CPU_uid':
$options = $this->getPartService()->getEntities(['type' => 'CPU']);
break;
case 'partinfo_ram_uid':
case 'partinfo_RAM_uid':
$options = $this->getPartService()->getEntities(['type' => 'RAM']);
break;
case 'partinfo_disk_uid':
case 'partinfo_DISK_uid':
$options = $this->getPartService()->getEntities(['type' => 'DISK']);
break;
case 'partinfo_os_uid':
case 'partinfo_OS_uid':
$options = $this->getPartService()->getEntities(['type' => 'OS']);
break;
case 'partinfo_db_uid':
case 'partinfo_DB_uid':
$options = $this->getPartService()->getEntities(['type' => 'DB']);
break;
case 'partinfo_software_uid':
case 'partinfo_SOFTWARE_uid':
$options = $this->getPartService()->getEntities(['type' => 'SOFTWARE']);
break;
case 'partinfo_uid': //수정때문에 전체가 필요
@ -80,10 +86,4 @@ class ServerPartService extends EquipmentService
}
return $options;
}
//partEntity 정보 추가
protected function getEntity_process(mixed $entity): mixed
{
$entity->setPartEntity($this->getPartService()->getEntity($entity->getPartInfoUID()));
return $entity;
}
}

View File

@ -22,10 +22,11 @@ class ServerService extends EquipmentService
"code",
"type",
"title",
"serverpartinfo_cpu_uid",
"serverpartinfo_ram_uid",
"serverpartinfo_disk_uid",
"serverpartinfo_os_uid",
"CPU",
"RAM",
"DISK",
"OS",
"ipinfo_uid",
"price",
"amount",
"manufactur_at",
@ -37,14 +38,42 @@ class ServerService extends EquipmentService
"serviceinfo_uid",
"type",
"title",
"serverpartinfo_cpu_uid",
"serverpartinfo_ram_uid",
"serverpartinfo_disk_uid",
"serverpartinfo_os_uid",
"CPU",
"RAM",
"DISK",
"OS",
"ipinfo_uid",
"status"
],
];
}
public function getViewFields(): array
{
return [
'fields' => [
'clientinfo_uid',
'serviceinfo_uid',
"type",
'title',
'price',
'amount',
"serverpartinfo",
"ipinfo_uid",
"csinfo_uid",
'manufactur_at',
"format_at",
'status'
],
'filters' => [
'clientinfo_uid',
'serviceinfo_uid',
'type',
"ipinfo_uid",
"csinfo_uid",
'status'
],
];
}
public function getIndexFields(): array
{
return [
@ -53,14 +82,23 @@ class ServerService extends EquipmentService
'serviceinfo_uid',
"type",
'title',
"serverpartinfo",
'price',
'amount',
"serverpartinfo",
"ipinfo_uid",
"csinfo_uid",
'manufactur_at',
"format_at",
'status'
],
'filters' => ['clientinfo_uid', 'serviceinfo_uid', 'type', 'status'],
'filters' => [
'clientinfo_uid',
'serviceinfo_uid',
'type',
"ipinfo_uid",
"csinfo_uid",
'status'
],
];
}
public function getBatchjobFields(): array
@ -88,27 +126,43 @@ class ServerService extends EquipmentService
}
return $this->_csService;
}
//partEntity 정보 추가
protected function getEntity_process(mixed $entity): ServerEntity
{
//서버 부품정보 정의
foreach (SERVER['PARTTYPES'] as $partType) {
$serverPartEnty = $this->getServerPartService()->getEntity(['serverinfo_uid' => $entity->getPK(), 'type' => $partType]);
if ($serverPartEnty) {
$entity->setServerPartEntity($partType, $serverPartEnty);
}
}
//서버 IP정보 정의
$entity->setIPEntities($this->getIPService()->getEntities(['serverinfo_uid' => $entity->getPK()]));
//서버 CS정보 정의
$entity->setCSEntities($this->getCSService()->getEntities(['serverinfo_uid' => $entity->getPK()]));
return $entity;
}
//기본 기능부분
public function getFormFieldOption(string $field, array $options = []): array
{
switch ($field) {
case 'serverpartinfo_cpu_uid':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_cpu_uid');
case 'CPU':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_CPU_uid');
break;
case 'serverpartinfo_ram_uid':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_ram_uid');
case 'RAM':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_RAM_uid');
break;
case 'serverpartinfo_disk_uid':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_disk_uid');
case 'DISK':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_DISK_uid');
break;
case 'serverpartinfo_os_uid':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_os_uid');
case 'OS':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_OS_uid');
break;
case 'serverpartinfo_db_uid':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_db_uid');
case 'serverpartinfo_DB_uid':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_DB_uid');
break;
case 'serverpartinfo_software_uid':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_software_uid');
case 'SOFTWARE':
$options = $this->getServerPartService()->getFormFieldOption('partinfo_SOFTWARE_uid');
break;
case 'ipinfo_uid': //수정때문에 전체가 필요
$options = $this->getIPService()->getEntities();