dbmsv2 init...1
This commit is contained in:
parent
86e1ebdd52
commit
3c3861c3e3
@ -103,7 +103,7 @@ class ClientController extends CustomerController
|
|||||||
$this->getService()->setFormFilters();
|
$this->getService()->setFormFilters();
|
||||||
$this->getService()->setFormRules();
|
$this->getService()->setFormRules();
|
||||||
//기본값정의
|
//기본값정의
|
||||||
$this->setFormDatas($this->request->getGet());
|
$this->getService()->setFormDatas($this->request->getGet());
|
||||||
$this->getService()->setFormOptions();
|
$this->getService()->setFormOptions();
|
||||||
//일괄작업용 Fields정의
|
//일괄작업용 Fields정의
|
||||||
$entity = $this->getService()->getEntity($uid);
|
$entity = $this->getService()->getEntity($uid);
|
||||||
@ -139,14 +139,14 @@ class ClientController extends CustomerController
|
|||||||
$this->getService()->setFormFilters();
|
$this->getService()->setFormFilters();
|
||||||
$this->getService()->setFormRules();
|
$this->getService()->setFormRules();
|
||||||
//전달값정의
|
//전달값정의
|
||||||
$this->setFormDatas($this->request->getPost());
|
$this->getService()->setFormDatas($this->request->getPost());
|
||||||
$this->doValidations();
|
$this->doValidations();
|
||||||
//기존 Entity 가져오기
|
//기존 Entity 가져오기
|
||||||
$entity = $this->getService()->getEntity($uid);
|
$entity = $this->getService()->getEntity($uid);
|
||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||||
}
|
}
|
||||||
$this->entity = $this->getService()->history($entity, $this->getFormDatas());
|
$this->entity = $this->getService()->history($entity, $this->getService()->getFormDatas());
|
||||||
$db->transCommit();
|
$db->transCommit();
|
||||||
return $this->getResultSuccess('고객 비고가 수정되었습니다.');
|
return $this->getResultSuccess('고객 비고가 수정되었습니다.');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
@ -69,7 +69,7 @@ class ServiceController extends CustomerController
|
|||||||
throw new \Exception(__METHOD__ . "에서 code의 format[Server.Prefix.code.format]이 정의되지 않았습니다.");
|
throw new \Exception(__METHOD__ . "에서 code의 format[Server.Prefix.code.format]이 정의되지 않았습니다.");
|
||||||
}
|
}
|
||||||
//기본값정의
|
//기본값정의
|
||||||
$this->setFormDatas([
|
$this->getService()->setFormDatas([
|
||||||
'location' => 'chiba',
|
'location' => 'chiba',
|
||||||
'type' => 'normal',
|
'type' => 'normal',
|
||||||
'billing_at' => date("Y-m-d"),
|
'billing_at' => date("Y-m-d"),
|
||||||
@ -116,14 +116,14 @@ class ServiceController extends CustomerController
|
|||||||
$this->getService()->setFormFilters();
|
$this->getService()->setFormFilters();
|
||||||
$this->getService()->setFormRules();
|
$this->getService()->setFormRules();
|
||||||
//전달값정의
|
//전달값정의
|
||||||
$this->setFormDatas($this->request->getPost());
|
$this->getService()->setFormDatas($this->request->getPost());
|
||||||
$this->doValidations();
|
$this->doValidations();
|
||||||
//기존 Entity 가져오기
|
//기존 Entity 가져오기
|
||||||
$entity = $this->getService()->getEntity($uid);
|
$entity = $this->getService()->getEntity($uid);
|
||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||||
}
|
}
|
||||||
$this->entity = $this->getService()->history($entity, $this->getFormDatas());
|
$this->entity = $this->getService()->history($entity, $this->getService()->getFormDatas());
|
||||||
$db->transCommit();
|
$db->transCommit();
|
||||||
return $this->getResultSuccess('서비스객 비고가 수정되었습니다.');
|
return $this->getResultSuccess('서비스객 비고가 수정되었습니다.');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
@ -2,14 +2,15 @@
|
|||||||
|
|
||||||
namespace App\Controllers\Admin\Equipment;
|
namespace App\Controllers\Admin\Equipment;
|
||||||
|
|
||||||
use App\Entities\Equipment\LineEntity;
|
use Psr\Log\LoggerInterface;
|
||||||
use App\Helpers\Equipment\LineHelper;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use App\Services\Equipment\IPService;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
|
|
||||||
use App\Services\Equipment\LineService;
|
use App\Services\Equipment\LineService;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use App\Services\Equipment\IPService;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use App\Helpers\Equipment\LineHelper;
|
||||||
use Psr\Log\LoggerInterface;
|
use App\Entities\Equipment\LineEntity;
|
||||||
|
use App\Entities\Equipment\IPEntity;
|
||||||
|
|
||||||
class LineController extends EquipmentController
|
class LineController extends EquipmentController
|
||||||
{
|
{
|
||||||
@ -50,7 +51,11 @@ class LineController extends EquipmentController
|
|||||||
$entity = parent::create_process($formDatas);
|
$entity = parent::create_process($formDatas);
|
||||||
//Prefixed IP to array 자동 등록
|
//Prefixed IP to array 자동 등록
|
||||||
foreach ($this->getService()->getHelper()->cidrToIpRange($formDatas['bandwith']) as $ip) {
|
foreach ($this->getService()->getHelper()->cidrToIpRange($formDatas['bandwith']) as $ip) {
|
||||||
$this->getIPService()->createByLineInfo($entity, $ip);
|
$this->getIPService()->create([
|
||||||
|
'lineinfo_uid' => $entity->getPK(),
|
||||||
|
'ip' => $ip,
|
||||||
|
'status' => IPEntity::DEFAULT_STATUS,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,24 +49,6 @@ class ServerController extends EquipmentController
|
|||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
protected function setFormData(string $field, array $requestDatas, array $formDatas): array
|
|
||||||
{
|
|
||||||
switch ($field) {
|
|
||||||
case 'CPU':
|
|
||||||
case 'RAM':
|
|
||||||
$formDatas[$field] = $requestDatas[$field] ?? null;
|
|
||||||
$formDatas["{$field}_cnt"] = $requestDatas["{$field}_cnt"] ?? null;
|
|
||||||
break;
|
|
||||||
case 'DISK':
|
|
||||||
$formDatas[$field] = $requestDatas[$field] ?? null;
|
|
||||||
$formDatas["{$field}_cnt"] = $requestDatas["{$field}_cnt"] ?? null;
|
|
||||||
$formDatas["{$field}_extra"] = $requestDatas["{$field}_extra"] ?? null;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$formDatas = parent::setFormData($field, $requestDatas, $formDatas);
|
|
||||||
}
|
|
||||||
return $formDatas;
|
|
||||||
}
|
|
||||||
//생성
|
//생성
|
||||||
protected function create_form_process(): void
|
protected function create_form_process(): void
|
||||||
{
|
{
|
||||||
@ -75,7 +57,7 @@ class ServerController extends EquipmentController
|
|||||||
throw new \Exception(__METHOD__ . "에서 code의 format[Server.Prefix.code.format]이 정의되지 않았습니다.");
|
throw new \Exception(__METHOD__ . "에서 code의 format[Server.Prefix.code.format]이 정의되지 않았습니다.");
|
||||||
}
|
}
|
||||||
//기본값정의
|
//기본값정의
|
||||||
$this->setFormDatas([
|
$this->getService()->setFormDatas([
|
||||||
'code' => $this->getService()->getLastestCode(
|
'code' => $this->getService()->getLastestCode(
|
||||||
$format,
|
$format,
|
||||||
(int)env("Server.Default.code", 0)
|
(int)env("Server.Default.code", 0)
|
||||||
|
|||||||
@ -2,10 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Controllers\Admin\Equipment;
|
namespace App\Controllers\Admin\Equipment;
|
||||||
|
|
||||||
use App\Services\Equipment\ServerPartService;
|
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
|
use App\Services\Equipment\ServerPartService;
|
||||||
|
|
||||||
class ServerPartController extends EquipmentController
|
class ServerPartController extends EquipmentController
|
||||||
{
|
{
|
||||||
@ -24,4 +25,30 @@ class ServerPartController extends EquipmentController
|
|||||||
}
|
}
|
||||||
return $this->_service;
|
return $this->_service;
|
||||||
}
|
}
|
||||||
|
//Index,FieldForm관련
|
||||||
|
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||||
|
{
|
||||||
|
switch ($this->getService()->getAction()) {
|
||||||
|
case 'create_form':
|
||||||
|
case 'modify_form':
|
||||||
|
$this->service = $this->getService();
|
||||||
|
$this->control = $this->getService()->getControlDatas();
|
||||||
|
$this->getService()->getHelper()->setViewDatas($this->getViewDatas());
|
||||||
|
$actionTemplate = $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'serverpart';
|
||||||
|
if ($actionTemplate) {
|
||||||
|
$view_file = $this->view_path . $actionTemplate . DIRECTORY_SEPARATOR . $this->getService()->getAction();
|
||||||
|
} else {
|
||||||
|
$view_file = $this->view_path . $this->getService()->getAction();
|
||||||
|
}
|
||||||
|
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
|
||||||
|
break;
|
||||||
|
case 'history':
|
||||||
|
$result = redirect()->to($this->request->getGET('return_url'))->with('error', $message);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,7 +82,7 @@ class UserController extends AdminController
|
|||||||
$this->getService()->setFormRules();
|
$this->getService()->setFormRules();
|
||||||
$this->getService()->setFormOptions();
|
$this->getService()->setFormOptions();
|
||||||
//기본값정의
|
//기본값정의
|
||||||
$this->setFormDatas($this->request->getGet());
|
$this->getService()->setFormDatas($this->request->getGet());
|
||||||
//기존 Entity 가져오기
|
//기존 Entity 가져오기
|
||||||
$entity = $this->getService()->getEntity($uid);
|
$entity = $this->getService()->getEntity($uid);
|
||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
@ -107,14 +107,14 @@ class UserController extends AdminController
|
|||||||
$this->getService()->setFormFilters();
|
$this->getService()->setFormFilters();
|
||||||
$this->getService()->setFormRules();
|
$this->getService()->setFormRules();
|
||||||
//전달값정의
|
//전달값정의
|
||||||
$this->setFormDatas($this->request->getPost());
|
$this->getService()->setFormDatas($this->request->getPost());
|
||||||
$this->doValidations();
|
$this->doValidations();
|
||||||
//기존 Entity 가져오기
|
//기존 Entity 가져오기
|
||||||
$entity = $this->getService()->getEntity($uid);
|
$entity = $this->getService()->getEntity($uid);
|
||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||||
}
|
}
|
||||||
$this->entity = $this->modify_process($entity, $this->getFormDatas());
|
$this->entity = $this->modify_process($entity, $this->getService()->getFormDatas());
|
||||||
$this->_db->transCommit();
|
$this->_db->transCommit();
|
||||||
return $this->getResultSuccess();
|
return $this->getResultSuccess();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
@ -61,7 +61,7 @@ abstract class AuthController extends CommonController
|
|||||||
$this->getService()->setFormRules();
|
$this->getService()->setFormRules();
|
||||||
$this->getService()->setFormOptions();
|
$this->getService()->setFormOptions();
|
||||||
//기본값정의
|
//기본값정의
|
||||||
$this->setFormDatas($this->request->getGet());
|
$this->getService()->setFormDatas($this->request->getGet());
|
||||||
$this->login_form_process();
|
$this->login_form_process();
|
||||||
helper(['form']);
|
helper(['form']);
|
||||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||||
@ -82,9 +82,9 @@ abstract class AuthController extends CommonController
|
|||||||
$this->getService()->setFormFilters();
|
$this->getService()->setFormFilters();
|
||||||
$this->getService()->setFormRules();
|
$this->getService()->setFormRules();
|
||||||
//전달값정의
|
//전달값정의
|
||||||
$this->setFormDatas($this->request->getPost());
|
$this->getService()->setFormDatas($this->request->getPost());
|
||||||
$this->doValidations();
|
$this->doValidations();
|
||||||
$this->entity = $this->login_process($this->getFormDatas());
|
$this->entity = $this->login_process($this->getService()->getFormDatas());
|
||||||
$db->transCommit();
|
$db->transCommit();
|
||||||
return $this->getResultSuccess();
|
return $this->getResultSuccess();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
@ -66,17 +66,6 @@ abstract class CommonController extends BaseController
|
|||||||
}
|
}
|
||||||
//Index,FieldForm관련
|
//Index,FieldForm관련
|
||||||
//FormDatas 전달값,Default값
|
//FormDatas 전달값,Default값
|
||||||
final protected function getFormDatas(): array
|
|
||||||
{
|
|
||||||
return $this->getService()->getControlDatas('form_datas');
|
|
||||||
}
|
|
||||||
final protected function setFormDatas(array $requestDatas, array $formDatas = []): void
|
|
||||||
{
|
|
||||||
foreach ($this->getService()->getControlDatas('actionFields') as $field) {
|
|
||||||
$formDatas = $this->setFormData($field, $requestDatas, $formDatas);
|
|
||||||
}
|
|
||||||
$this->getService()->setControlDatas('form_datas', $formDatas);
|
|
||||||
}
|
|
||||||
//FormDatas 검증
|
//FormDatas 검증
|
||||||
final protected function doValidations(): void
|
final protected function doValidations(): void
|
||||||
{
|
{
|
||||||
@ -85,7 +74,7 @@ abstract class CommonController extends BaseController
|
|||||||
foreach ($this->getService()->getControlDatas('field_rules') as $field => $rule) {
|
foreach ($this->getService()->getControlDatas('field_rules') as $field => $rule) {
|
||||||
$validation = $this->doValidation($validation, $field, $rule);
|
$validation = $this->doValidation($validation, $field, $rule);
|
||||||
}
|
}
|
||||||
if (!$validation->run($this->getFormDatas())) {
|
if (!$validation->run($this->getService()->getFormDatas())) {
|
||||||
throw new \Exception("{$this->getService()->getClassName()} 작업 데이터 검증 오류발생\n" . implode(
|
throw new \Exception("{$this->getService()->getClassName()} 작업 데이터 검증 오류발생\n" . implode(
|
||||||
"\n",
|
"\n",
|
||||||
$validation->getErrors()
|
$validation->getErrors()
|
||||||
@ -94,17 +83,7 @@ abstract class CommonController extends BaseController
|
|||||||
// return $validation->getValidated();
|
// return $validation->getValidated();
|
||||||
}
|
}
|
||||||
//공통 필수기능
|
//공통 필수기능
|
||||||
//FieldForm관련용
|
|
||||||
//FormData Field별 전달값 처리
|
//FormData Field별 전달값 처리
|
||||||
protected function setFormData(string $field, array $requestDatas, array $formDatas): array
|
|
||||||
{
|
|
||||||
switch ($field) {
|
|
||||||
default:
|
|
||||||
$formDatas[$field] = $requestDatas[$field] ?? null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $formDatas;
|
|
||||||
}
|
|
||||||
protected function doValidation(Validation $validation, string $field, string $rule): Validation
|
protected function doValidation(Validation $validation, string $field, string $rule): Validation
|
||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
@ -161,13 +140,14 @@ abstract class CommonController extends BaseController
|
|||||||
public function create_form(): RedirectResponse|string
|
public function create_form(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
//초기화
|
||||||
$this->getService()->setAction(__FUNCTION__);
|
$this->getService()->setAction(__FUNCTION__);
|
||||||
$this->getService()->setFormFields();
|
$this->getService()->setFormFields();
|
||||||
|
//기본전달값정의
|
||||||
|
$this->getService()->setFormDatas($this->request->getGet());
|
||||||
$this->getService()->setFormFilters();
|
$this->getService()->setFormFilters();
|
||||||
$this->getService()->setFormRules();
|
$this->getService()->setFormRules();
|
||||||
$this->getService()->setFormOptions();
|
$this->getService()->setFormOptions();
|
||||||
//기본값정의
|
|
||||||
$this->setFormDatas($this->request->getGet());
|
|
||||||
$this->create_form_process();
|
$this->create_form_process();
|
||||||
helper(['form']);
|
helper(['form']);
|
||||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||||
@ -188,12 +168,12 @@ abstract class CommonController extends BaseController
|
|||||||
try {
|
try {
|
||||||
$this->getService()->setAction(__FUNCTION__);
|
$this->getService()->setAction(__FUNCTION__);
|
||||||
$this->getService()->setFormFields();
|
$this->getService()->setFormFields();
|
||||||
|
//기본전달값정의
|
||||||
|
$this->getService()->setFormDatas($this->request->getPost());
|
||||||
$this->getService()->setFormFilters();
|
$this->getService()->setFormFilters();
|
||||||
$this->getService()->setFormRules();
|
$this->getService()->setFormRules();
|
||||||
//전달값정의
|
|
||||||
$this->setFormDatas($this->request->getPost());
|
|
||||||
$this->doValidations();
|
$this->doValidations();
|
||||||
$this->entity = $this->create_process($this->getFormDatas());
|
$this->entity = $this->create_process($this->getService()->getFormDatas());
|
||||||
$db->transCommit();
|
$db->transCommit();
|
||||||
return $this->getResultSuccess();
|
return $this->getResultSuccess();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -211,11 +191,11 @@ abstract class CommonController extends BaseController
|
|||||||
try {
|
try {
|
||||||
$this->getService()->setAction(__FUNCTION__);
|
$this->getService()->setAction(__FUNCTION__);
|
||||||
$this->getService()->setFormFields();
|
$this->getService()->setFormFields();
|
||||||
|
//기본전달값정의
|
||||||
|
$this->getService()->setFormDatas($this->request->getGet());
|
||||||
$this->getService()->setFormFilters();
|
$this->getService()->setFormFilters();
|
||||||
$this->getService()->setFormRules();
|
$this->getService()->setFormRules();
|
||||||
$this->getService()->setFormOptions();
|
$this->getService()->setFormOptions();
|
||||||
//기본값정의
|
|
||||||
$this->setFormDatas($this->request->getGet());
|
|
||||||
//기존 Entity 가져오기
|
//기존 Entity 가져오기
|
||||||
$entity = $this->getService()->getEntity($uid);
|
$entity = $this->getService()->getEntity($uid);
|
||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
@ -241,17 +221,17 @@ abstract class CommonController extends BaseController
|
|||||||
try {
|
try {
|
||||||
$this->getService()->setAction(__FUNCTION__);
|
$this->getService()->setAction(__FUNCTION__);
|
||||||
$this->getService()->setFormFields();
|
$this->getService()->setFormFields();
|
||||||
|
//기본전달값정의
|
||||||
|
$this->getService()->setFormDatas($this->request->getPost());
|
||||||
$this->getService()->setFormFilters();
|
$this->getService()->setFormFilters();
|
||||||
$this->getService()->setFormRules();
|
$this->getService()->setFormRules();
|
||||||
//전달값정의
|
|
||||||
$this->setFormDatas($this->request->getPost());
|
|
||||||
$this->doValidations();
|
$this->doValidations();
|
||||||
//기존 Entity 가져오기
|
//기존 Entity 가져오기
|
||||||
$entity = $this->getService()->getEntity($uid);
|
$entity = $this->getService()->getEntity($uid);
|
||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||||
}
|
}
|
||||||
$this->entity = $this->modify_process($entity, $this->getFormDatas());
|
$this->entity = $this->modify_process($entity, $this->getService()->getFormDatas());
|
||||||
$db->transCommit();
|
$db->transCommit();
|
||||||
return $this->getResultSuccess();
|
return $this->getResultSuccess();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -272,18 +252,18 @@ abstract class CommonController extends BaseController
|
|||||||
try {
|
try {
|
||||||
$this->getService()->setAction(__FUNCTION__);
|
$this->getService()->setAction(__FUNCTION__);
|
||||||
$this->getService()->setFormFields([$field]);
|
$this->getService()->setFormFields([$field]);
|
||||||
|
//기본전달값정의
|
||||||
|
$this->getService()->setFormDatas($this->request->getGet());
|
||||||
$this->getService()->setFormFilters();
|
$this->getService()->setFormFilters();
|
||||||
$this->getService()->setFormRules();
|
$this->getService()->setFormRules();
|
||||||
$this->getService()->setFormOptions();
|
$this->getService()->setFormOptions();
|
||||||
//기본값정의
|
|
||||||
$this->setFormDatas($this->request->getGet());
|
|
||||||
$this->doValidations();
|
$this->doValidations();
|
||||||
//기존 Entity 가져오기
|
//기존 Entity 가져오기
|
||||||
$entity = $this->getService()->getEntity($uid);
|
$entity = $this->getService()->getEntity($uid);
|
||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||||
}
|
}
|
||||||
$this->entity = $this->toggle_process($entity, $this->getFormDatas());
|
$this->entity = $this->toggle_process($entity, $this->getService()->getFormDatas());
|
||||||
$db->transCommit();
|
$db->transCommit();
|
||||||
return $this->getResultSuccess();
|
return $this->getResultSuccess();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -326,11 +306,11 @@ abstract class CommonController extends BaseController
|
|||||||
$this->getService()->setAction(__FUNCTION__);
|
$this->getService()->setAction(__FUNCTION__);
|
||||||
list($selectedFields, $formDatas, $uids) = $this->batchjob_pre_process();
|
list($selectedFields, $formDatas, $uids) = $this->batchjob_pre_process();
|
||||||
$this->getService()->setFormFields($selectedFields);
|
$this->getService()->setFormFields($selectedFields);
|
||||||
|
//기본전달값정의
|
||||||
|
$this->getService()->setFormDatas($this->request->getPost());
|
||||||
$this->getService()->setFormFilters();
|
$this->getService()->setFormFilters();
|
||||||
$this->getService()->setFormRules();
|
$this->getService()->setFormRules();
|
||||||
$this->getService()->setFormOptions();
|
$this->getService()->setFormOptions();
|
||||||
//기본값정의
|
|
||||||
$this->setFormDatas($this->request->getPost());
|
|
||||||
$this->doValidations();
|
$this->doValidations();
|
||||||
$entities = [];
|
$entities = [];
|
||||||
foreach ($uids as $uid) {
|
foreach ($uids as $uid) {
|
||||||
@ -425,11 +405,11 @@ abstract class CommonController extends BaseController
|
|||||||
try {
|
try {
|
||||||
$this->getService()->setAction(__FUNCTION__);
|
$this->getService()->setAction(__FUNCTION__);
|
||||||
$this->getService()->setFormFields();
|
$this->getService()->setFormFields();
|
||||||
|
//기본전달값정의
|
||||||
|
$this->getService()->setFormDatas($this->request->getGet());
|
||||||
$this->getService()->setFormFilters();
|
$this->getService()->setFormFilters();
|
||||||
$this->getService()->setFormRules();
|
$this->getService()->setFormRules();
|
||||||
$this->getService()->setFormOptions();
|
$this->getService()->setFormOptions();
|
||||||
//기본값정의
|
|
||||||
$this->setFormDatas($this->request->getGet());
|
|
||||||
//기존 Entity 가져오기
|
//기존 Entity 가져오기
|
||||||
$entity = $this->getService()->getEntity($uid);
|
$entity = $this->getService()->getEntity($uid);
|
||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
@ -510,11 +490,11 @@ abstract class CommonController extends BaseController
|
|||||||
try {
|
try {
|
||||||
$this->getService()->setAction(__FUNCTION__);
|
$this->getService()->setAction(__FUNCTION__);
|
||||||
$this->getService()->setFormFields();
|
$this->getService()->setFormFields();
|
||||||
|
//기본전달값정의
|
||||||
|
$this->getService()->setFormDatas($this->request->getGet());
|
||||||
$this->getService()->setFormFilters();
|
$this->getService()->setFormFilters();
|
||||||
$this->getService()->setFormRules();
|
$this->getService()->setFormRules();
|
||||||
$this->getService()->setFormOptions();
|
$this->getService()->setFormOptions();
|
||||||
//기본값정의
|
|
||||||
$this->setFormDatas($this->request->getGet());
|
|
||||||
//일괄작업용 Fields정의
|
//일괄작업용 Fields정의
|
||||||
$this->getService()->setControlDatas('batchjob_fields', $this->getService()->getBatchjobFields());
|
$this->getService()->setControlDatas('batchjob_fields', $this->getService()->getBatchjobFields());
|
||||||
//일괄작업용 버튼정의
|
//일괄작업용 버튼정의
|
||||||
@ -546,7 +526,7 @@ abstract class CommonController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//OUPUT Document 관련
|
//OUPUT Document 관련
|
||||||
private function download_process(string $document_type, mixed $loaded_data): array
|
protected function download_process(string $document_type, mixed $loaded_data): array
|
||||||
{
|
{
|
||||||
$full_path = WRITEPATH . DIRECTORY_SEPARATOR . "excel";
|
$full_path = WRITEPATH . DIRECTORY_SEPARATOR . "excel";
|
||||||
switch ($document_type) {
|
switch ($document_type) {
|
||||||
@ -569,6 +549,8 @@ abstract class CommonController extends BaseController
|
|||||||
try {
|
try {
|
||||||
$this->getService()->setAction(__FUNCTION__);
|
$this->getService()->setAction(__FUNCTION__);
|
||||||
$this->getService()->setFormFields();
|
$this->getService()->setFormFields();
|
||||||
|
//기본전달값정의
|
||||||
|
$this->getService()->setFormDatas($this->request->getGet());
|
||||||
$this->getService()->setFormFilters();
|
$this->getService()->setFormFilters();
|
||||||
$this->getService()->setFormRules();
|
$this->getService()->setFormRules();
|
||||||
$this->getService()->setFormOptions();
|
$this->getService()->setFormOptions();
|
||||||
@ -578,7 +560,10 @@ abstract class CommonController extends BaseController
|
|||||||
case 'excel':
|
case 'excel':
|
||||||
case 'pdf':
|
case 'pdf':
|
||||||
helper(['form']);
|
helper(['form']);
|
||||||
$this->index_process();
|
foreach ($this->getService()->getEntities() as $entity) {
|
||||||
|
$entities[] = $entity;
|
||||||
|
}
|
||||||
|
$this->entities = $entities;
|
||||||
$html = $this->getResultSuccess();
|
$html = $this->getResultSuccess();
|
||||||
//data loading
|
//data loading
|
||||||
$reader = new Html();
|
$reader = new Html();
|
||||||
|
|||||||
@ -191,6 +191,18 @@ abstract class CommonService
|
|||||||
throw new \Exception($message);
|
throw new \Exception($message);
|
||||||
}
|
}
|
||||||
} //
|
} //
|
||||||
|
final public function getFormDatas(): array
|
||||||
|
{
|
||||||
|
return $this->getControlDatas('form_datas');
|
||||||
|
}
|
||||||
|
final public function setFormDatas(array $requestDatas, array $formDatas = []): void
|
||||||
|
{
|
||||||
|
foreach ($this->getControlDatas('actionFields') as $field) {
|
||||||
|
$formDatas = $this->setFormData($field, $requestDatas, $formDatas);
|
||||||
|
}
|
||||||
|
$this->setControlDatas('form_datas', $formDatas);
|
||||||
|
}
|
||||||
|
//기본 기능부분
|
||||||
//FieldForm관련용
|
//FieldForm관련용
|
||||||
public function getViewFields(): array
|
public function getViewFields(): array
|
||||||
{
|
{
|
||||||
@ -250,6 +262,15 @@ abstract class CommonService
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
|
public function setFormData(string $field, array $requestDatas, array $formDatas): array
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
default:
|
||||||
|
$formDatas[$field] = $requestDatas[$field] ?? null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $formDatas;
|
||||||
|
}
|
||||||
//생성
|
//생성
|
||||||
public function create(array $formDatas): mixed
|
public function create(array $formDatas): mixed
|
||||||
{
|
{
|
||||||
|
|||||||
@ -27,6 +27,7 @@ class ServiceService extends CustomerService
|
|||||||
"location",
|
"location",
|
||||||
"type",
|
"type",
|
||||||
"clientinfo_uid",
|
"clientinfo_uid",
|
||||||
|
'serverinfo_uid',
|
||||||
"billing_at",
|
"billing_at",
|
||||||
"amount",
|
"amount",
|
||||||
"start_at",
|
"start_at",
|
||||||
|
|||||||
@ -78,42 +78,6 @@ class IPService extends EquipmentService
|
|||||||
}
|
}
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
//회선정보에 따른 IP생성
|
|
||||||
public function createByLineInfo(LineEntity $entity, string $ip): IPEntity
|
|
||||||
{
|
|
||||||
$formDatas = [
|
|
||||||
'lineinfo_uid' => $entity->getPK(),
|
|
||||||
'ip' => $ip,
|
|
||||||
'status' => IPEntity::DEFAULT_STATUS,
|
|
||||||
];
|
|
||||||
return $this->create($formDatas);
|
|
||||||
}
|
|
||||||
private function getFormDatasByServer(ServerEntity $serverEntity, array $formDatas): array
|
|
||||||
{
|
|
||||||
$temps = [
|
|
||||||
"serverinfo_uid" => $serverEntity->getPK(),
|
|
||||||
"clientinfo_uid" => $serverEntity->getClientInfoUID(),
|
|
||||||
"serviceinfo_uid" => $serverEntity->getServiceInfoUID(),
|
|
||||||
"status" => STATUS['OCCUPIED']
|
|
||||||
];
|
|
||||||
return $temps;
|
|
||||||
}
|
|
||||||
//생성
|
|
||||||
public function createByServer(ServerEntity $serverEntity, array $formDatas): IPEntity
|
|
||||||
{
|
|
||||||
$entity = $this->getEntity($formDatas("ipinfo_uid"));
|
|
||||||
if (!$entity) {
|
|
||||||
throw new \Exception("{$formDatas("ipinfo_uid")}에 대한 IP정보를 찾을수 없습니다.");
|
|
||||||
}
|
|
||||||
$entity = parent::modify(
|
|
||||||
$entity,
|
|
||||||
$this->getFormDatasByServer(
|
|
||||||
$serverEntity,
|
|
||||||
$formDatas
|
|
||||||
)
|
|
||||||
);
|
|
||||||
return $entity;
|
|
||||||
}
|
|
||||||
//List 검색용
|
//List 검색용
|
||||||
//OrderBy 처리
|
//OrderBy 처리
|
||||||
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Services\Equipment;
|
namespace App\Services\Equipment;
|
||||||
|
|
||||||
use App\Entities\Equipment\PartEntity;
|
|
||||||
use App\Entities\Equipment\ServerEntity;
|
use App\Entities\Equipment\ServerEntity;
|
||||||
use App\Entities\Equipment\ServerPartEntity;
|
use App\Entities\Equipment\ServerPartEntity;
|
||||||
use App\Helpers\Equipment\ServerPartHelper;
|
use App\Helpers\Equipment\ServerPartHelper;
|
||||||
@ -41,6 +40,28 @@ class ServerPartService extends EquipmentService
|
|||||||
"billing",
|
"billing",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getIndexFields(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
"serverinfo_uid",
|
||||||
|
"type",
|
||||||
|
"part_uid",
|
||||||
|
"billing",
|
||||||
|
"amount",
|
||||||
|
"cnt",
|
||||||
|
"extra",
|
||||||
|
];
|
||||||
|
}
|
||||||
|
public function getIndexFilters(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
"serverinfo_uid",
|
||||||
|
"type",
|
||||||
|
"part_uid",
|
||||||
|
"billing",
|
||||||
|
];
|
||||||
|
}
|
||||||
public function getBatchjobFields(): array
|
public function getBatchjobFields(): array
|
||||||
{
|
{
|
||||||
return ['billing', 'type'];
|
return ['billing', 'type'];
|
||||||
|
|||||||
@ -84,6 +84,24 @@ class ServerService extends EquipmentService
|
|||||||
}
|
}
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
//FieldForm관련용
|
//FieldForm관련용
|
||||||
|
public function setFormData(string $field, array $requestDatas, array $formDatas): array
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
case 'CPU':
|
||||||
|
case 'RAM':
|
||||||
|
$formDatas[$field] = $requestDatas[$field] ?? null;
|
||||||
|
$formDatas["{$field}_cnt"] = $requestDatas["{$field}_cnt"] ?? null;
|
||||||
|
break;
|
||||||
|
case 'DISK':
|
||||||
|
$formDatas[$field] = $requestDatas[$field] ?? null;
|
||||||
|
$formDatas["{$field}_cnt"] = $requestDatas["{$field}_cnt"] ?? null;
|
||||||
|
$formDatas["{$field}_extra"] = $requestDatas["{$field}_extra"] ?? null;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$formDatas = parent::setFormData($field, $requestDatas, $formDatas);
|
||||||
|
}
|
||||||
|
return $formDatas;
|
||||||
|
}
|
||||||
//create용 장비코드 마지막번호 가져오기
|
//create용 장비코드 마지막번호 가져오기
|
||||||
final public function getLastestCode(string $format, int $default): string
|
final public function getLastestCode(string $format, int $default): string
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||||
<?= $this->section('content') ?>
|
<?= $this->section('content') ?>
|
||||||
<script type="text/javascript" src="/js/admin/serverpart.js"></script>
|
|
||||||
<?php if ($error = session('error')): echo $viewDatas['service']->getHelper()->alert($error) ?><?php endif ?>
|
<?php if ($error = session('error')): echo $viewDatas['service']->getHelper()->alert($error) ?><?php endif ?>
|
||||||
<div id="container" class="content">
|
<div id="container" class="content">
|
||||||
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
|
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
|
||||||
|
|||||||
@ -2,28 +2,36 @@ const typeSelect = document.querySelector("select[name=type]");
|
|||||||
const partSelect = document.querySelector("select[name=part_uid]");
|
const partSelect = document.querySelector("select[name=part_uid]");
|
||||||
const amountInput = document.querySelector("input[name=amount]");
|
const amountInput = document.querySelector("input[name=amount]");
|
||||||
|
|
||||||
// type 선택 시 part_uid 옵션 필터링
|
// 원본 옵션들 저장 (clone 해서 나중에 다시 쓰기)
|
||||||
|
const allOptions = Array.from(partSelect.options).map(opt => opt.cloneNode(true));
|
||||||
|
|
||||||
|
// type 선택 시 part_uid 옵션 재구성
|
||||||
typeSelect.addEventListener("change", function () {
|
typeSelect.addEventListener("change", function () {
|
||||||
let selectedType = this.value;
|
let selectedType = this.value;
|
||||||
|
|
||||||
for (let option of partSelect.options) {
|
// partSelect 초기화
|
||||||
if (option.value === "") {
|
partSelect.innerHTML = "";
|
||||||
option.style.display = ""; // "부품정보 선택"은 항상 표시
|
|
||||||
continue;
|
// "부품정보 선택" 기본 옵션 추가
|
||||||
}
|
let defaultOpt = allOptions.find(opt => opt.value === "");
|
||||||
if (!selectedType || option.dataset.type === selectedType) {
|
if (defaultOpt) {
|
||||||
option.style.display = "";
|
partSelect.appendChild(defaultOpt.cloneNode(true));
|
||||||
} else {
|
|
||||||
option.style.display = "none";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 선택 초기화
|
// 선택된 type 에 맞는 옵션만 추가
|
||||||
|
allOptions.forEach(opt => {
|
||||||
|
if (!opt.value) return; // 기본옵션은 이미 넣음
|
||||||
|
if (!selectedType || opt.dataset.type === selectedType) {
|
||||||
|
partSelect.appendChild(opt.cloneNode(true));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 선택값/금액 초기화
|
||||||
partSelect.value = "";
|
partSelect.value = "";
|
||||||
amountInput.value = "";
|
amountInput.value = "";
|
||||||
});
|
});
|
||||||
|
|
||||||
// part_uid 선택 시 amount 자동 반영
|
// part_uid 선택 시 amount 값 자동 반영
|
||||||
partSelect.addEventListener("change", function () {
|
partSelect.addEventListener("change", function () {
|
||||||
let selectedOption = this.options[this.selectedIndex];
|
let selectedOption = this.options[this.selectedIndex];
|
||||||
let price = selectedOption.getAttribute("data-price") || "";
|
let price = selectedOption.getAttribute("data-price") || "";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user