dbms_primeidc_init...1

This commit is contained in:
최준흠 2025-04-11 14:25:56 +09:00
parent 2a6ab7bf01
commit cb97b79e84
13 changed files with 210 additions and 163 deletions

View File

@ -76,3 +76,51 @@ define('DBMS_SERVICE_LINE', [
'vpn' => 'VPN',
'event' => '이벤트',
]);
define('DBMS_GEARLIST_PROCESS_TYPES', [
'',
'COLOCATION',
'XEON Single',
'CUSTOM',
'INS-일회성',
'NEHALEM',
'Cisco Router',
]);
define('DBMS_GEARLIST_CPU_TYPES', [
'',
'X6-Q',
'C2800',
'C2600',
'COL',
'CUS',
'NX227',
'NX20',
'NX21',
'DQ28',
'DQ26',
'DQ31',
'DQ18',
'DQ23',
'DQ20',
'DX34',
'DX38',
'DX28',
'DX32',
'DX36',
'DX30',
'MD32',
'MD30',
'Q16R',
'Q316',
'Q310',
'Q283',
'Q266',
'Q25R',
'Q213',
'Q20R',
'Q186',
'Q24',
'Q20',
'Q240',
'DX3',
'DQ233'
]);

View File

@ -8,6 +8,7 @@ use lib\Controllers\DBMS\Client\OnetimeController;
use lib\Controllers\DBMS\Client\PaymentController;
use lib\Controllers\DBMS\DashboardController;
use lib\Controllers\DBMS\DefenceController;
use lib\Controllers\DBMS\GearlistController;
use lib\Controllers\DBMS\NavigatorController;
use lib\Controllers\DBMS\ServerController;
use lib\Controllers\DBMS\ServiceController;
@ -150,10 +151,10 @@ $router->group('dbms/service', function (Router $router) {
});
});
$router->group('dbms/server', function (Router $router) {
$router->add('GET', 'use', function ($params) {
$controller = new ServerController();
return $controller->use($params);
$router->group('dbms/gearlist', function (Router $router) {
$router->add('GET', 'index', function ($params) {
$controller = new GearlistController();
return $controller->index($params);
// Response::view($result);
});
});

View File

@ -73,7 +73,7 @@ class PaymentController extends ClientController
$this->mode = $mode;
$this->curPage = intval($params['curPage'] ?? $this->request->get('curPage') ?? 1);
$this->perPage = intval($params['perPage'] ?? $this->request->get('perPage') ?? VIEW_LIST_PERPAGE);
[$this->total, $this->entities] = $this->getServiceService()->getNonPaymentEntitiesByMode($this->curPage, $this->perPage, $mode, $exclude_clients);
[$this->total, $this->entities] = $this->getServiceService()->getEntitiesForNonPayment($this->curPage, $this->perPage, $mode, $exclude_clients);
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
return $this->render(path: __FUNCTION__);
}

View File

@ -0,0 +1,55 @@
<?php
namespace lib\Controllers\DBMS;
use lib\Entities\GearlistEntity;
use lib\Services\GearlistService;
class GearlistController extends DBMSController
{
private ?GearlistService $_serverService = null;
public function __construct()
{
parent::__construct();
$this->getView()->setPath('gearlist');
} //
public function getGearlistService(): GearlistService
{
if ($this->_serverService === null) {
$this->_serverService = new GearlistService();
}
return $this->_serverService;
}
//가용장비 현황 server_use.php
//CLI 접속방법 : php index.php site/server/use
//WEB 접속방법 : http://localhost site/server/use
private function setMode(GearlistEntity $entity): GearlistEntity
{
$lineup_explode = explode('.', $entity->getSpec());
$spec = $lineup_explode[0];
$cpu = $entity->getCPUName();
$entity->all = $this->getGearlistService()->getCountByMode("all", $cpu, $spec);
$entity->use = $this->getGearlistService()->getCountByMode("use", $cpu, $spec);
$entity->empty = $this->getGearlistService()->getCountByMode("empty", $cpu, $spec);
$entity->format = $this->getGearlistService()->getCountByMode("format", $cpu, $spec);
return $entity;
}
public function index(array $params): string
{
$entities = $this->getGearlistService()->getEntitiesForLineUp();
foreach ($entities as $idx => $entity) {
$entity = $this->setMode($entity);
}
$oldGearlists = [
['process' => "INTEL i5(구세대)", 'spec' => "i5-2.xx", "cpuname" => "i5-2", 'price' => "23"],
['process' => "INTEL i7(구세대)", 'spec' => "i7-2.xx", "cpuname" => "i7-2", 'price' => "45"],
['process' => "INTEL i7(4세대)", 'spec' => "i7-4.xx", "cpuname" => "i7-4", 'price' => "45"],
];
foreach ($oldGearlists as $oldGearlist) {
$entities[] = $this->setMode(new GearlistEntity($oldGearlist));
}
$this->entities = $entities;
return $this->render(__FUNCTION__);
}
} //Class

View File

@ -2,8 +2,9 @@
namespace lib\Controllers\DBMS;
use lib\Services\ClientService;
use lib\Helpers\ServiceHelper;
use lib\Services\ClientService;
use lib\Utils\Pagination;
class NavigatorController extends DBMSController
{
@ -28,22 +29,18 @@ class NavigatorController extends DBMSController
//WEB 접속방법 : http://localhost/site/navigator/ipsearch
public function ipsearch(array $params): string
{
$ip = array_key_exists('ip', $params) ? $params['ip'] : null;
$ip = array_key_exists('ip', $params) ?? null;
if (!$ip) {
$ip = $this->request->get('ip') ?? null;
}
//전체 고객정보
$this->clients = $this->getClientService()->getEntities();
//IP형식이 ipv4인지 확인 후 값가져오기
$services = [];
if ($ip && $this->helper->isIPAddress($ip)) {
$this->getServiceService()->getModel()->where('service_ip', $ip);
$services[] = $this->getServiceService()->getEntity();
} elseif ($ip) {
$this->getServiceService()->getModel()->like('service_ip', $ip);
$services = $this->getServiceService()->getEntities();
} else {
$services = $this->getServiceService()->getEntities();
}
$this->curPage = intval($params['curPage'] ?? $this->request->get('curPage') ?? 1);
$this->perPage = intval($params['perPage'] ?? $this->request->get('perPage') ?? VIEW_LIST_PERPAGE);
[$this->total, $this->entities] = $this->getServiceService()->getEntitiesForIpSearch($this->curPage, $this->perPage, $ip, $this->helper->isIPAddress($ip));
$this->ip = $ip;
$this->services = $services;
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
return $this->render(__FUNCTION__);
}
} //Class

View File

@ -2,14 +2,12 @@
namespace lib\Controllers\DBMS;
use lib\Entities\GearlistEntity;
use lib\Services\GearlistService;
use lib\Entities\ServerEntity;
use lib\Services\ServerService;
class ServerController extends DBMSController
{
private ?ServerService $_serverService = null;
private ?GearlistService $_gearlistService = null;
public function __construct()
{
parent::__construct();
@ -22,55 +20,4 @@ class ServerController extends DBMSController
}
return $this->_serverService;
}
public function getGearlistSrvice(): GearlistService
{
if ($this->_gearlistService === null) {
$this->_gearlistService = new GearlistService();
}
return $this->_gearlistService;
}
//방어 server_use.php
//CLI 접속방법 : php index.php site/server/use
//WEB 접속방법 : http://localhost site/server/use
private function use_getGearlistEntity(GearlistEntity $entity): GearlistEntity
{
$lineup_explode = explode('.', $entity->getSpec());
$spec = $lineup_explode[0];
$cpu = $entity->getCPUName();
$this->getServerService()->getModel()->like(["server_cpuname" => "%$cpu%", "server_spec" => "%$spec%"]);
$entity->all = $this->getServerService()->getCount();
$this->getServerService()->getModel()->where("server_use_status", "n");
$this->getServerService()->getModel()->like(["server_cpuname" => "%$cpu%", "server_spec" => "%$spec%"]);
$entity->use = $this->getServerService()->getCount();
$this->getServerService()->getModel()->where("server_use_status", "y");
$this->getServerService()->getModel()->like(["server_cpuname" => "%$cpu%", "server_spec" => "%$spec%"]);
$entity->empty = $this->getServerService()->getCount();
$this->getServerService()->getModel()->where("server_use_status", "y");
$this->getServerService()->getModel()->where("server_fomat_date !='NULL'");
$this->getServerService()->getModel()->like(["server_cpuname" => "%$cpu%"]);
$entity->format = $this->getServerService()->getCount();
return $entity;
}
public function use(array $params): string
{
$temps = [];
$gearlineupEntities = $this->getGearlistSrvice()->getLineUpEntities();
foreach ($gearlineupEntities as $idx => $entity) {
$entity = $this->use_getGearlistEntity($entity);
}
$oldServers = [
['process' => "INTEL i5(구세대)", 'spec' => "i5-2.xx", "cpuname" => "i5-2", 'price' => "23"],
['process' => "INTEL i7(구세대)", 'spec' => "i7-2.xx", "cpuname" => "i7-2", 'price' => "45"],
['process' => "INTEL i7(4세대)", 'spec' => "i7-4.xx", "cpuname" => "i7-4", 'price' => "45"],
];
foreach ($oldServers as $oldServer) {
$temps[] = $this->use_getGearlistEntity(new GearlistEntity($oldServer));
}
$this->gearlineupEntities = $temps;
return $this->render(__FUNCTION__);
}
} //Class

View File

@ -2,8 +2,9 @@
namespace lib\Controllers\DBMS;
use lib\Services\ClientService;
use lib\Services\AddDbService;
use lib\Services\ClientService;
use lib\Utils\Pagination;
class ServiceController extends DBMSController
{
@ -42,20 +43,21 @@ class ServiceController extends DBMSController
$adddb_code = urldecode($params['adddb_code']);
//해당 부가서비스의 services_code 목록 가져오기
//segment의 값이 한글인경우 urldecode가 필요
$addDbEntities = $this->$this->getAddDbService()->getEntitiesByCode($adddb_code);
$service_codes = [];
$this->getAddDbService()->getModel()->where('addDB_code', $adddb_code);
$entitys = $this->getAddDbService()->getEntities();
foreach ($entitys as $entity) {
foreach ($addDbEntities as $entity) {
$service_codes[] = $entity->getServiceCode();
}
if (!count($service_codes)) {
throw new \Exception("[{$adddb_code}] 값에 해당하는 부가서비스정보가 존재하지 않습니다.");
}
//부가서비스용 서비스목록 가져오기
$this->getServiceService()->getModel()->whereIn('service_code', $service_codes);
$this->services = $this->getServiceService()->getEntities();
//전체 사용자정보
$this->clients = $this->getClientService()->getEntities();
//부가서비스용 서비스목록 가져오기
$this->curPage = intval($params['curPage'] ?? $this->request->get('curPage') ?? 1);
$this->perPage = intval($params['perPage'] ?? $this->request->get('perPage') ?? VIEW_LIST_PERPAGE);
[$this->total, $this->entities] = $this->getServiceService()->getEntitiesForExtra($this->curPage, $this->perPage, $service_codes);
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
return $this->render(__FUNCTION__);
}
} //Class

View File

@ -32,4 +32,9 @@ class AddDbService extends CommonService
$this->getModel()->where('addDB_code', $key);
return $this->getEntity();
}
public function getEntitiesByCode(string $key): array
{
$this->getModel()->where('addDB_code', $key);
return $this->getEntities();
}
}

View File

@ -28,57 +28,36 @@ class GearlistService extends CommonService
return Entity::class;
}
public function getLineUpEntities(): array
public function getEntitiesForLineUp(): array
{
$this->getModel()->whereNotIn("process", [
'',
'COLOCATION',
'XEON Single',
'CUSTOM',
'INS-일회성',
'NEHALEM',
'Cisco Router',
]);
$this->getModel()->whereNotIn("cpuname", [
'',
'X6-Q',
'C2800',
'C2600',
'COL',
'CUS',
'NX227',
'NX20',
'NX21',
'DQ28',
'DQ26',
'DQ31',
'DQ18',
'DQ23',
'DQ20',
'DX34',
'DX38',
'DX28',
'DX32',
'DX36',
'DX30',
'MD32',
'MD30',
'Q16R',
'Q316',
'Q310',
'Q283',
'Q266',
'Q25R',
'Q213',
'Q20R',
'Q186',
'Q24',
'Q20',
'Q240',
'DX3',
'DQ233'
]);
$this->getModel()->whereNotIn("process", DBMS_GEARLIST_PROCESS_TYPES);
$this->getModel()->whereNotIn("cpuname", DBMS_GEARLIST_CPU_TYPES);
$this->getModel()->orderBy(["process" => "ASC", "price" => "ASC", "cpuname" => "asc"]);
return $this->getEntities();
}
public function getCountByMode(string $mode, string $cpu, ?string $spec = null): int
{
switch ($mode) {
case 'all':
$this->getModel()->like(["server_cpuname" => "%$cpu%", "server_spec" => "%$spec%"]);
break;
case 'use':
$this->getModel()->where("server_use_status", "n");
$this->getModel()->like(["server_cpuname" => "%$cpu%", "server_spec" => "%$spec%"]);
break;
case 'empty':
$this->getModel()->where("server_use_status", "y");
$this->getModel()->like(["server_cpuname" => "%$cpu%", "server_spec" => "%$spec%"]);
break;
case 'format':
$this->getModel()->where("server_use_status", "y");
$this->getModel()->where("server_fomat_date !='NULL'");
$this->getModel()->like(["server_cpuname" => "%$cpu%"]);
break;
default:
throw new \InvalidArgumentException("Invalid mode: $mode");
}
return $this->getCount();
}
}

View File

@ -36,6 +36,7 @@ class ServiceService extends CommonService
$this->getModel()->where('service_code', $key);
return $this->getEntity();
}
//사용자별 서비스리스트트
public function getEntitiesByClient(int $curPage, int $perPage, string $client_code): array
{
@ -51,7 +52,7 @@ class ServiceService extends CommonService
}
//미지급금 리스트
public function getNonPaymentEntitiesByMode(int $curPage, int $perPage, string $mode, array $exclude_clients): array
public function getEntitiesForNonPayment(int $curPage, int $perPage, string $mode, array $exclude_clients): array
{
switch ($mode) {
case 'today':
@ -88,6 +89,36 @@ class ServiceService extends CommonService
return [$total, $this->getEntities()];
}
//미지급금 리스트
public function getEntitiesForIpSearch(int $curPage, int $perPage, ?string $ip = null, $isIPV4 = true): array
{
if ($ip && $isIPV4) {
$this->getModel()->where('service_ip', $ip);
} elseif ($ip) {
$this->getModel()->like('service_ip', $ip);
}
//Query문 Rest여부 -> 같은조건에 Count 받고, 결과값을 받고 싶을때는 continue()
$this->getModel()->setContinue(true);
$total = $this->getCount();
//limit, offset 설정
$this->getModel()->limit($perPage);
$this->getModel()->offset(($curPage - 1) * $perPage);
return [$total, $this->getEntities()];
}
//부가서비스스
public function getEntitiesForExtra(int $curPage, int $perPage, array $service_codes): array
{
$this->getModel()->whereIn('service_code', $service_codes);
//Query문 Rest여부 -> 같은조건에 Count 받고, 결과값을 받고 싶을때는 continue()
$this->getModel()->setContinue(true);
$total = $this->getCount();
//limit, offset 설정
$this->getModel()->limit($perPage);
$this->getModel()->offset(($curPage - 1) * $perPage);
return [$total, $this->getEntities()];
}
//최근 $day일간 신규서비스 카운트
public function getLatestCount(int $day, array $excepts): int|string
{

View File

@ -1,12 +1,4 @@
* CPU 명칭 :
싱글 코어 = 1 코어 /
듀얼 코어 = 2 코어 /
트리플 코어 = 3 코어 /
쿼드 코어(Q) = 4 코어 /
헥사 코어(H) = 6 코어 /
옥타 코어(O) = 8 코어 /
도데카(D) = 12 코어 <!--(AMD CPU일 경우 옵테론 코어)--> /
헥사데시멀 코어 = 16개코어<br>
* CPU 명칭 : 싱글 코어 = 1 코어 / 듀얼 코어 = 2 코어 / 트리플 코어 = 3 코어 / 쿼드 코어(Q) = 4 코어 / 헥사 코어(H) = 6 코어 / 옥타 코어(O) = 8 코어 / 도데카(D) = 12 코어 <!--(AMD CPU일 경우 옵테론 코어)--> / 헥사데시멀 코어 = 16개코어<br>
* 도쿄 회선 + 1U상면비 : 60만원 (50+10) / 치바 회선 + 1U상면비 : 40만원 (30+10)<br>
* HDD : 1단위당 일회성 10만원 / 메모리 : 2G당 1회성 5만원 / 방어서비스 : CS방어 40만원 , BL상시 60만원 , CS-Pre상시 300만원 , CF방어 도메인당 40만원 , 인증방어 사이트당 80만원(+유동CS4개 기본)
<table class="table table-bordered table-hover table-striped" style="text-align:center;">
@ -24,7 +16,7 @@
</thead>
<tbody>
<?php
foreach ($this->gearlineupEntities as $entity) {
foreach ($this->entities as $entity) {
?>
<tr>
<td><?= $entity->getProcess() ?></td>
@ -40,16 +32,5 @@
</tr>
<?php } ?>
</tbody>
<tfoot>
<tr>
<td colspan="1">합계</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
<div align='center'><?= $this->pagination->render(DBMS_SITE_URL . "/usableServerList.ser", ['curPage' => $this->curPage, 'perPage' => $this->perPage]) ?></div>

View File

@ -102,18 +102,19 @@
</tr>
</thead>
<tbody>
<?php foreach ($this->services as $service) { ?>
<?php foreach ($this->entities as $entity) { ?>
<tr>
<td><?= $service->getClientCode() ?></td>
<td><?= $this->clients[$service->getClientCode()]->getTitle() ?></td>
<td><?= $service->getServerCode() ?></td>
<td><?= $service->service_ip ?></td>
<td><?= $service->service_os ?></td>
<td><?= $service->service_sw ?></td>
<td><?= $this->clients[$service->getClientCode()]->getPhone() ?></td>
<td><?= $this->clients[$service->getClientCode()]->getEmail() ?></td>
<td><?= $entity->getClientCode() ?></td>
<td><?= $this->clients[$entity->getClientCode()]->getTitle() ?></td>
<td><?= $entity->getServerCode() ?></td>
<td><?= $entity->entity_ip ?></td>
<td><?= $entity->entity_os ?></td>
<td><?= $entity->entity_sw ?></td>
<td><?= $this->clients[$entity->getClientCode()]->getPhone() ?></td>
<td><?= $this->clients[$entity->getClientCode()]->getEmail() ?></td>
</tr>
<?php } ?>
</tbody>
<tfoot></tfoot>
</table>
<div align='center'><?= $this->pagination->render(DBMS_SITE_URL . "/usableServerList.ser", ['ip' => $this->ip, 'curPage' => $this->curPage, 'perPage' => $this->perPage]) ?></div>

View File

@ -16,7 +16,7 @@
</div>
</div>
<!-- row -->
<div class="table-responsive"><c:import url="${phpurl}/dbms/server/use"/></div>
<div class="table-responsive"><c:import url="${phpurl}/dbms/gearlist/index"/></div>
<!-- table-responsive -->
</div>
<!-- panel-body -->