dbmsv4 init...1

This commit is contained in:
최준흠 2025-11-21 17:50:55 +09:00
parent 224bcb11a6
commit a21ad6be09
53 changed files with 248 additions and 498 deletions

View File

@ -30,7 +30,7 @@ abstract class AbstractCRUDController extends AbstractWebController
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate')); return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate'));
} }
final public function create_form(): string|RedirectResponse public function create_form(): string|RedirectResponse
{ {
try { try {
$action = __FUNCTION__; $action = __FUNCTION__;

View File

@ -23,4 +23,19 @@ class ServerPartController extends EquipmentController
} }
//기본 함수 작업 //기본 함수 작업
//Custom 추가 함수 //Custom 추가 함수
protected function create_form_process(array $formDatas = []): array
{
// Form Default값 설정 (오버라이드 포인트)
$formDatas = parent::create_form_process($formDatas);
$formDatas['serverinfo_uid'] = $this->request->getVar('serverinfo_uid') ?? throw new \Exception("ServerPart는 반드시 서버정보가 필요합니다.");
$formDatas['type'] = $this->request->getVar('type') ?? throw new \Exception("ServerPart는 반드시 파트형식 필요합니다.");
//type : CS,IP이면 월비용 기본처리
switch ($formDatas['type']) {
case 'CS':
case 'IP':
$formDatas['billing'] = PAYMENT['BILLING']['MONTH'];
break;
}
return $formDatas;
}
} }

View File

@ -146,6 +146,7 @@ abstract class CommonController extends AbstractCRUDController
{ {
// Filter조건절 처리 // Filter조건절 처리
$index_filters = []; $index_filters = [];
// dd($this->service->getFormService()->getIndexFilters($action));
foreach ($this->service->getFormService()->getIndexFilters($action) as $field) { foreach ($this->service->getFormService()->getIndexFilters($action) as $field) {
$value = $this->request->getVar($field) ?? null; $value = $this->request->getVar($field) ?? null;
if ($value) { if ($value) {

View File

@ -9,7 +9,6 @@ class BoardEntity extends CommonEntity
{ {
const PK = Model::PK; const PK = Model::PK;
const TITLE = Model::TITLE; const TITLE = Model::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE'];
final public function getUserUID(): int|null final public function getUserUID(): int|null
{ {
return $this->attributes['user_uid'] ?? null; return $this->attributes['user_uid'] ?? null;

View File

@ -8,7 +8,6 @@ class AccountEntity extends CustomerEntity
{ {
const PK = AccountModel::PK; const PK = AccountModel::PK;
const TITLE = AccountModel::TITLE; const TITLE = AccountModel::TITLE;
const DEFAULT_STATUS = STATUS['DEPOSIT'];
final public function getUserUID(): int|null final public function getUserUID(): int|null
{ {
return $this->attributes['user_uid'] ?? null; return $this->attributes['user_uid'] ?? null;

View File

@ -8,7 +8,6 @@ class ClientEntity extends CustomerEntity
{ {
const PK = ClientModel::PK; const PK = ClientModel::PK;
const TITLE = ClientModel::TITLE; const TITLE = ClientModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE'];
final public function getUserUID(): int|null final public function getUserUID(): int|null
{ {
return $this->attributes['user_uid'] ?? null; return $this->attributes['user_uid'] ?? null;

View File

@ -8,7 +8,6 @@ class CouponEntity extends CustomerEntity
{ {
const PK = CouponModel::PK; const PK = CouponModel::PK;
const TITLE = CouponModel::TITLE; const TITLE = CouponModel::TITLE;
const DEFAULT_STATUS = STATUS['DEPOSIT'];
final public function getUserUID(): int|null final public function getUserUID(): int|null
{ {
return $this->attributes['user_uid'] ?? null; return $this->attributes['user_uid'] ?? null;

View File

@ -8,7 +8,6 @@ class PointEntity extends CustomerEntity
{ {
const PK = PointModel::PK; const PK = PointModel::PK;
const TITLE = PointModel::TITLE; const TITLE = PointModel::TITLE;
const DEFAULT_STATUS = STATUS['DEPOSIT'];
final public function getUserUID(): int|null final public function getUserUID(): int|null
{ {
return $this->attributes['user_uid']; return $this->attributes['user_uid'];

View File

@ -8,7 +8,6 @@ class ServiceEntity extends CustomerEntity
{ {
const PK = ServiceModel::PK; const PK = ServiceModel::PK;
const TITLE = ServiceModel::TITLE; const TITLE = ServiceModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE'];
final public function getUserUID(): int|null final public function getUserUID(): int|null
{ {
return $this->attributes['user_uid'] ?? null; return $this->attributes['user_uid'] ?? null;

View File

@ -8,7 +8,6 @@ class LineEntity extends EquipmentEntity
{ {
const PK = LineModel::PK; const PK = LineModel::PK;
const TITLE = LineModel::TITLE; const TITLE = LineModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE'];
public function getBandwith(): string public function getBandwith(): string
{ {
return $this->attributes['bandwith']; return $this->attributes['bandwith'];

View File

@ -8,7 +8,6 @@ class ServerEntity extends EquipmentEntity
{ {
const PK = ServerModel::PK; const PK = ServerModel::PK;
const TITLE = ServerModel::TITLE; const TITLE = ServerModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE'];
final public function getClientInfoUID(): int|null final public function getClientInfoUID(): int|null
{ {
return $this->attributes['clientinfo_uid'] ?? null; return $this->attributes['clientinfo_uid'] ?? null;

View File

@ -53,9 +53,4 @@ class ServerPartEntity extends EquipmentEntity
{ {
return $this->attributes['extra']; return $this->attributes['extra'];
} }
//리스트에서 상태표시용
public function getStatus(): string
{
return self::DEFAULT_STATUS;
}
} }

View File

@ -8,7 +8,6 @@ class CPUEntity extends PartEntity
{ {
const PK = CPUModel::PK; const PK = CPUModel::PK;
const TITLE = CPUModel::TITLE; const TITLE = CPUModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE'];
//기본기능 //기본기능
final public function getUsed(): int final public function getUsed(): int
{ {

View File

@ -8,7 +8,6 @@ class CSEntity extends PartEntity
{ {
const PK = CSModel::PK; const PK = CSModel::PK;
const TITLE = CSModel::TITLE; const TITLE = CSModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE'];
//기본기능 //기본기능
public function getIP(): string public function getIP(): string
{ {

View File

@ -8,7 +8,6 @@ class DISKEntity extends PartEntity
{ {
const PK = DISKModel::PK; const PK = DISKModel::PK;
const TITLE = DISKModel::TITLE; const TITLE = DISKModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE'];
//기본기능 //기본기능
final public function getUsed(): int final public function getUsed(): int
{ {

View File

@ -8,7 +8,6 @@ class IPEntity extends PartEntity
{ {
const PK = IPModel::PK; const PK = IPModel::PK;
const TITLE = IPModel::TITLE; const TITLE = IPModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE'];
final public function getLineInfoUID(): int|null final public function getLineInfoUID(): int|null
{ {
return $this->attributes['lineinfo_uid'] ?? null; return $this->attributes['lineinfo_uid'] ?? null;

View File

@ -8,7 +8,6 @@ class RAMEntity extends PartEntity
{ {
const PK = RAMModel::PK; const PK = RAMModel::PK;
const TITLE = RAMModel::TITLE; const TITLE = RAMModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE'];
//기본기능 //기본기능
final public function getUsed(): int final public function getUsed(): int
{ {

View File

@ -8,7 +8,6 @@ class SOFTWAREEntity extends PartEntity
{ {
const PK = SOFTWAREModel::PK; const PK = SOFTWAREModel::PK;
const TITLE = SOFTWAREModel::TITLE; const TITLE = SOFTWAREModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE'];
//기본기능 //기본기능
final public function getUsed(): int final public function getUsed(): int
{ {

View File

@ -8,8 +8,6 @@ class SWITCHEntity extends PartEntity
{ {
const PK = SWITCHModel::PK; const PK = SWITCHModel::PK;
const TITLE = SWITCHModel::TITLE; const TITLE = SWITCHModel::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE'];
final public function getCode(): string final public function getCode(): string
{ {
return $this->attributes['code'] ?? ""; return $this->attributes['code'] ?? "";

View File

@ -9,7 +9,6 @@ class PaymentEntity extends CommonEntity
{ {
const PK = PaymentModel::PK; const PK = PaymentModel::PK;
const TITLE = PaymentModel::TITLE; const TITLE = PaymentModel::TITLE;
const DEFAULT_STATUS = STATUS['UNPAID'];
final public function getUserUID(): int|null final public function getUserUID(): int|null
{ {
return $this->attributes['user_uid'] ?? null; return $this->attributes['user_uid'] ?? null;
@ -46,7 +45,7 @@ class PaymentEntity extends CommonEntity
public function getCountDueAt(): string public function getCountDueAt(): string
{ {
$result = ""; $result = "";
if ($this->getStatus() === self::DEFAULT_STATUS) { if ($this->getStatus() === STATUS['UNPAID']) {
$now = new DateTime(); // 오늘 날짜 $now = new DateTime(); // 오늘 날짜
$due = new DateTime($this->getBillingAt()); $due = new DateTime($this->getBillingAt());
if ($due < $now) { if ($due < $now) {

View File

@ -9,7 +9,6 @@ class UserSNSEntity extends CommonEntity
{ {
const PK = Model::PK; const PK = Model::PK;
const TITLE = Model::TITLE; const TITLE = Model::TITLE;
const DEFAULT_STATUS = STATUS['AVAILABLE'];
//Common Function //Common Function
public function getParent(): int|null public function getParent(): int|null
{ {

View File

@ -49,7 +49,7 @@ class BoardForm extends CommonForm
$tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"];
switch ($field) { switch ($field) {
case 'worker_uid': case 'worker_uid':
foreach (service('userservice')->getEntities() as $entity) { foreach (service('userservice')->getEntities(['status' => STATUS['AVAILABLE']]) as $entity) {
$tempOptions[$entity->getPK()] = $entity->getTitle(); $tempOptions[$entity->getPK()] = $entity->getTitle();
// $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
} }

View File

@ -188,14 +188,14 @@ abstract class CommonForm
$tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"];
switch ($field) { switch ($field) {
case 'user_uid': case 'user_uid':
foreach (service('userservice')->getEntities() as $entity) { foreach (service('userservice')->getEntities(['status' => STATUS['AVAILABLE']]) as $entity) {
$tempOptions[$entity->getPK()] = $entity->getTitle(); $tempOptions[$entity->getPK()] = $entity->getTitle();
// $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
} }
$options['options'] = $tempOptions; $options['options'] = $tempOptions;
break; break;
case 'clientinfo_uid': case 'clientinfo_uid':
foreach (service('customer_clientservice')->getEntities() as $entity) { foreach (service('customer_clientservice')->getEntities(['status' => STATUS['AVAILABLE']]) as $entity) {
$tempOptions[$entity->getPK()] = $entity->getTitle(); $tempOptions[$entity->getPK()] = $entity->getTitle();
// $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
} }

View File

@ -45,4 +45,23 @@ class ServerForm extends EquipmentForm
} }
return $rule; return $rule;
} }
public function getFormOption(string $field, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
{
$tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"];
switch ($field) {
case 'serviceinfo_uid':
foreach (
service('customer_serviceservice')->getEntities(['status' => STATUS['AVAILABLE']]) as $entity
) {
$tempOptions[$entity->getPK()] = $entity->getTitle();
// $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
}
$options['options'] = $tempOptions;
break;
default:
$options = parent::getFormOption($field, $options);
break;
}
return $options;
}
} }

View File

@ -2,6 +2,8 @@
namespace App\Forms\Equipment; namespace App\Forms\Equipment;
use App\Services\CommonService;
class ServerPartForm extends EquipmentForm class ServerPartForm extends EquipmentForm
{ {
public function __construct() public function __construct()
@ -36,19 +38,38 @@ class ServerPartForm extends EquipmentForm
} }
return $rule; return $rule;
} }
private function getPartService(string $type): CommonService
{
return service('part_' . strtolower($type) . 'service');
}
public function getFormOption(string $field, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array public function getFormOption(string $field, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
{ {
$tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"];
switch ($field) { switch ($field) {
case 'part_uid': case 'part_uid':
foreach (service('equipment_serverpartservice')->getEntities() as $entity) { foreach (SERVERPART['ALL_PARTTYPES'] as $type) {
$partService = $this->getPartService($type);
$tempOptions[$type] = [lang("{$this->getAttribute('class_path')}.TYPE.{$type}") . " 선택"];
foreach ($partService->getEntities(['status' => STATUS['AVAILABLE']]) as $entity) {
$tempOptions[$type][$entity->getPK()] = $entity->getTitle();
// $options['attributes'][$type][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
}
}
$options['options'] = $tempOptions;
break;
case 'serverinfo_uid':
foreach (
service('equipment_serverservice')->getEntities(['status' => STATUS['AVAILABLE']]) as $entity
) {
$tempOptions[$entity->getPK()] = $entity->getTitle(); $tempOptions[$entity->getPK()] = $entity->getTitle();
// $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
} }
$options['options'] = $tempOptions; $options['options'] = $tempOptions;
break; break;
case 'serverinfo_uid': case 'serviceinfo_uid':
foreach (service('equipment_serverservice')->getEntities() as $entity) { foreach (
service('customer_serviceservice')->getEntities(['status' => STATUS['AVAILABLE']]) as $entity
) {
$tempOptions[$entity->getPK()] = $entity->getTitle(); $tempOptions[$entity->getPK()] = $entity->getTitle();
// $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
} }

View File

@ -31,21 +31,4 @@ class CSForm extends PartForm
} }
return $rule; return $rule;
} }
public function getFormOption(string $field, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
{
$tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"];
switch ($field) {
case 'serverinfo_uid':
foreach (service('equipment_serverservice')->getEntities() as $entity) {
$tempOptions[$entity->getPK()] = $entity->getTitle();
// $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
}
$options['options'] = $tempOptions;
break;
default:
$options = parent::getFormOption($field, $options);
break;
}
return $options;
}
} }

View File

@ -46,13 +46,6 @@ class IPForm extends PartForm
// dd($tempOptions); // dd($tempOptions);
$options['options'] = $tempOptions; $options['options'] = $tempOptions;
break; break;
case 'serverinfo_uid':
foreach (service('equipment_serverservice')->getEntities() as $entity) {
$tempOptions[$entity->getPK()] = $entity->getTitle();
// $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
}
$options['options'] = $tempOptions;
break;
default: default:
$options = parent::getFormOption($field, $options); $options = parent::getFormOption($field, $options);
break; break;

View File

@ -35,4 +35,28 @@ abstract class PartForm extends CommonForm
} }
return $rule; return $rule;
} }
public function getFormOption(string $field, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
{
$tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"];
switch ($field) {
case 'serviceinfo_uid':
foreach (service('customer_serviceservice')->getEntities(['status' => STATUS['AVAILABLE']]) as $entity) {
$tempOptions[$entity->getPK()] = $entity->getTitle();
// $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
}
$options['options'] = $tempOptions;
break;
case 'serverinfo_uid':
foreach (service('equipment_serverservice')->getEntities(['status' => STATUS['AVAILABLE']]) as $entity) {
$tempOptions[$entity->getPK()] = $entity->getTitle();
// $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
}
$options['options'] = $tempOptions;
break;
default:
$options = parent::getFormOption($field, $options);
break;
}
return $options;
}
} }

View File

@ -20,28 +20,4 @@ class SWITCHForm extends PartForm
} }
return $rule; return $rule;
} }
public function getFormOption(string $field, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
{
$tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"];
switch ($field) {
case 'serviceinfo_uid':
foreach (service('customer_serviceservice')->getEntities() as $entity) {
$tempOptions[$entity->getPK()] = $entity->getTitle();
// $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
}
$options['options'] = $tempOptions;
break;
case 'serverinfo_uid':
foreach (service('equipment_serverservice')->getEntities() as $entity) {
$tempOptions[$entity->getPK()] = $entity->getTitle();
// $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
}
$options['options'] = $tempOptions;
break;
default:
$options = parent::getFormOption($field, $options);
break;
}
return $options;
}
} }

View File

@ -122,6 +122,7 @@ abstract class CommonHelper
break; break;
case 'status': case 'status':
$forms = []; $forms = [];
// dd($viewDatas['formOptions']);
array_shift($viewDatas['formOptions'][$field]['options']); array_shift($viewDatas['formOptions'][$field]['options']);
foreach ($viewDatas['formOptions'][$field]['options'] as $key => $label) foreach ($viewDatas['formOptions'][$field]['options'] as $key => $label)
$forms[] = form_radio($field, $key, $key == $value, $extras) . $label; $forms[] = form_radio($field, $key, $key == $value, $extras) . $label;

View File

@ -78,7 +78,7 @@ class ServiceHelper extends CustomerHelper
$label ? $label : ICONS['ONETIME'], $label ? $label : ICONS['ONETIME'],
$action, $action,
[ [
"data-src" => "/admin/customer/payment/create?serviceinfo_uid={$viewDatas['entity']->getPK()}", "data-src" => "/admin/payment/create?serviceinfo_uid={$viewDatas['entity']->getPK()}",
"data-bs-toggle" => "modal", "data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form", "data-bs-target" => "#modal_action_form",
"class" => "btn btn-sm form-label-sm", "class" => "btn btn-sm form-label-sm",

View File

@ -11,19 +11,23 @@ class ServerPartHelper extends EquipmentHelper
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
{ {
switch ($field) { switch ($field) {
case 'billing':
$forms = [];
// dd($viewDatas['formOptions']);
array_shift($viewDatas['formOptions'][$field]['options']);
foreach ($viewDatas['formOptions'][$field]['options'] as $key => $label)
$forms[] = form_radio($field, $key, $key == $value, $extras) . $label;
$form = implode(" ", $forms);
break;
case 'part_uid': case 'part_uid':
// dd($viewDatas);
$type = array_key_exists('entity', $viewDatas) ? $viewDatas['entity']->getType() : $viewDatas['formDatas']['type'];
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$extras['onChange'] = "document.querySelector('input[name=\'title\']').value = this.options[this.selectedIndex].getAttribute('data-title'); document.querySelector('input[name=\'amount\']').value = this.options[this.selectedIndex].getAttribute('data-price')"; $extras['onChange'] = "document.querySelector('input[name=\'title\']').value = this.options[this.selectedIndex].getAttribute('data-title'); document.querySelector('input[name=\'amount\']').value = this.options[this.selectedIndex].getAttribute('data-price')";
// $attributes = ['data-title' => 'title', 'data-price' => 'price']; if (array_key_exists('extras', $viewDatas['formOptions'][$field])) {
$form = form_dropdown($field, $value, $viewDatas, $extras); $extras = array_merge($extras, $viewDatas['formOptions'][$field]['extras']);
break;
case 'extra':
if (array_key_exists('type', $viewDatas['control']['form_datas']) && $viewDatas['control']['form_datas']['type'] === 'DISK') {
$options = ["" => lang("{$viewDatas['class_path']}.label.{$field}") . " 선택", ...lang("{$viewDatas['class_path']}.EXTRA.{$viewDatas['control']['form_datas']['type']}")];
$form = form_dropdown($field, $options, $value, $extras);
} else {
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);;
} }
$form = form_dropdown($field, $viewDatas['formOptions'][$field]['options'][$type], $value, $extras);
break; break;
default: default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras); $form = parent::getFieldForm($field, $value, $viewDatas, $extras);

View File

@ -7,7 +7,6 @@ use App\Entities\BoardEntity;
use App\Forms\BoardForm; use App\Forms\BoardForm;
use App\Helpers\BoardHelper; use App\Helpers\BoardHelper;
use App\Models\BoardModel; use App\Models\BoardModel;
use RuntimeException;
class BoardService extends CommonService class BoardService extends CommonService
{ {
@ -18,6 +17,10 @@ class BoardService extends CommonService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('Board'); $this->addClassPaths('Board');
} }
protected function getDTOClass(): string
{
return BOARDDTO::class;
}
public function createDTO(array $formDatas): BoardDTO public function createDTO(array $formDatas): BoardDTO
{ {
return new BoardDTO($formDatas); return new BoardDTO($formDatas);
@ -121,24 +124,10 @@ class BoardService extends CommonService
{ {
return new BoardEntity($formDatas); return new BoardEntity($formDatas);
} }
public function create(object $dto): BoardEntity
{
if (!$dto instanceof BoardDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
return parent::create($dto);
}
protected function modify_process($uid, array $formDatas): BoardEntity protected function modify_process($uid, array $formDatas): BoardEntity
{ {
return parent::modify_process($uid, $formDatas); return parent::modify_process($uid, $formDatas);
} }
public function modify($uid, object $dto): BoardEntity
{
if (!$dto instanceof BoardDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
return parent::modify($uid, $dto);
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
//검색어조건절처리 //검색어조건절처리

View File

@ -9,11 +9,16 @@ use CodeIgniter\Database\Exceptions\DatabaseException;
use CodeIgniter\Validation\Exceptions\ValidationException; use CodeIgniter\Validation\Exceptions\ValidationException;
use RuntimeException; use RuntimeException;
/**
* @template TEntity of CommonEntity
* @template TDto of CommonDTO
*/
abstract class CommonService abstract class CommonService
{ {
private array $_classPaths = []; private array $_classPaths = [];
protected $title = null; protected $title = null;
protected function __construct(protected CommonModel $model) {} protected function __construct(protected CommonModel $model) {}
abstract protected function getDTOClass(): string;
abstract public function createDTO(array $formDatas): CommonDTO; abstract public function createDTO(array $formDatas): CommonDTO;
abstract public function getFormService(): mixed; abstract public function getFormService(): mixed;
abstract public function getHelper(): mixed; abstract public function getHelper(): mixed;
@ -59,7 +64,7 @@ abstract class CommonService
throw new \Exception($errorMessage, $e->getCode(), $e); throw new \Exception($errorMessage, $e->getCode(), $e);
} }
} }
final public function getEntities(mixed $where = null, array $columns = ['*']): array final public function getEntities(?array $where = null, array $columns = ['*']): array
{ {
try { try {
$entities = $this->getEntities_process($where, $columns); $entities = $this->getEntities_process($where, $columns);
@ -158,8 +163,14 @@ abstract class CommonService
//생성용 //생성용
abstract protected function create_process(array $formDatas): CommonEntity; abstract protected function create_process(array $formDatas): CommonEntity;
public function create(object $dto): CommonEntity final public function create(object $dto): CommonEntity
{ {
//DTO 타입 체크 로직을 일반화
$dtoClass = $this->getDTOClass();
if (!$dto instanceof $dtoClass) {
throw new RuntimeException(__METHOD__ . "에서 오류발생: " . get_class($dto) . "는 사용할 수 없습니다. ({$dtoClass} 필요)");
}
$formDatas = $dto->toArray(); $formDatas = $dto->toArray();
if (!$this->getFormService()->validate($formDatas)) { if (!$this->getFormService()->validate($formDatas)) {
throw new ValidationException(implode("\n", service('validation')->getErrors())); throw new ValidationException(implode("\n", service('validation')->getErrors()));
@ -201,8 +212,14 @@ abstract class CommonService
return $entity; return $entity;
} }
public function modify(string|int $uid, object $dto): CommonEntity final public function modify(string|int $uid, object $dto): CommonEntity
{ {
//DTO 타입 체크 로직을 일반화
$dtoClass = $this->getDTOClass();
if (!$dto instanceof $dtoClass) {
throw new RuntimeException(__METHOD__ . "에서 오류발생: " . get_class($dto) . "는 사용할 수 없습니다. ({$dtoClass} 필요)");
}
$formDatas = $dto->toArray(); $formDatas = $dto->toArray();
if (!$this->getFormService()->validate($formDatas)) { if (!$this->getFormService()->validate($formDatas)) {
throw new ValidationException(implode("\n", service('validation')->getErrors())); throw new ValidationException(implode("\n", service('validation')->getErrors()));
@ -218,8 +235,14 @@ abstract class CommonService
$entity = $this->modify_process($uid, $formDatas); $entity = $this->modify_process($uid, $formDatas);
return $entity; return $entity;
} }
public function batchjob(string|int $uid, object $dto): CommonEntity final public function batchjob(string|int $uid, object $dto): CommonEntity
{ {
//DTO 타입 체크 로직을 일반화
$dtoClass = $this->getDTOClass();
if (!$dto instanceof $dtoClass) {
throw new RuntimeException(__METHOD__ . "에서 오류발생: " . get_class($dto) . "는 사용할 수 없습니다. ({$dtoClass} 필요)");
}
$formDatas = $dto->toArray(); $formDatas = $dto->toArray();
if (!$this->getFormService()->validate($formDatas)) { if (!$this->getFormService()->validate($formDatas)) {
throw new ValidationException(implode("\n", service('validation')->getErrors())); throw new ValidationException(implode("\n", service('validation')->getErrors()));

View File

@ -18,6 +18,10 @@ class AccountService extends CustomerService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('Account'); $this->addClassPaths('Account');
} }
protected function getDTOClass(): string
{
return AccountDTO::class;
}
public function createDTO(array $formDatas): AccountDTO public function createDTO(array $formDatas): AccountDTO
{ {
return new AccountDTO($formDatas); return new AccountDTO($formDatas);
@ -101,17 +105,6 @@ class AccountService extends CustomerService
{ {
return new AccountEntity($formDatas); return new AccountEntity($formDatas);
} }
public function create(object $dto): AccountEntity
{
if (!$dto instanceof AccountDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof AccountEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 AccountEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): AccountEntity protected function modify_process($uid, array $formDatas): AccountEntity
{ {
$entity = parent::modify_process($uid, $formDatas); $entity = parent::modify_process($uid, $formDatas);
@ -120,17 +113,6 @@ class AccountService extends CustomerService
} }
return $entity; return $entity;
} }
public function modify($uid, object $dto): AccountEntity
{
if (!$dto instanceof AccountDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof AccountEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 AccountEntity만 가능");
}
return $entity;
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
//검색어조건절처리 //검색어조건절처리

View File

@ -18,6 +18,10 @@ class ClientService extends CustomerService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('Client'); $this->addClassPaths('Client');
} }
protected function getDTOClass(): string
{
return ClientDTO::class;
}
public function createDTO(array $formDatas): ClientDTO public function createDTO(array $formDatas): ClientDTO
{ {
return new ClientDTO($formDatas); return new ClientDTO($formDatas);
@ -110,17 +114,6 @@ class ClientService extends CustomerService
{ {
return new ClientEntity($formDatas); return new ClientEntity($formDatas);
} }
public function create(object $dto): ClientEntity
{
if (!$dto instanceof ClientDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof ClientEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ClientEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): ClientEntity protected function modify_process($uid, array $formDatas): ClientEntity
{ {
$entity = parent::modify_process($uid, $formDatas); $entity = parent::modify_process($uid, $formDatas);
@ -129,17 +122,6 @@ class ClientService extends CustomerService
} }
return $entity; return $entity;
} }
public function modify($uid, object $dto): ClientEntity
{
if (!$dto instanceof ClientDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof ClientEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ClientEntity만 가능");
}
return $entity;
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
//검색어조건절처리 //검색어조건절처리

View File

@ -18,6 +18,10 @@ class CouponService extends CustomerService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('Coupon'); $this->addClassPaths('Coupon');
} }
protected function getDTOClass(): string
{
return CouponDTO::class;
}
public function createDTO(array $formDatas): CouponDTO public function createDTO(array $formDatas): CouponDTO
{ {
return new CouponDTO($formDatas); return new CouponDTO($formDatas);
@ -95,17 +99,6 @@ class CouponService extends CustomerService
{ {
return new CouponEntity($formDatas); return new CouponEntity($formDatas);
} }
public function create(object $dto): CouponEntity
{
if (!$dto instanceof CouponDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof CouponEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CouponEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): CouponEntity protected function modify_process($uid, array $formDatas): CouponEntity
{ {
$entity = parent::modify_process($uid, $formDatas); $entity = parent::modify_process($uid, $formDatas);
@ -114,17 +107,6 @@ class CouponService extends CustomerService
} }
return $entity; return $entity;
} }
public function modify($uid, object $dto): CouponEntity
{
if (!$dto instanceof CouponDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof CouponEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CouponEntity만 가능");
}
return $entity;
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
//검색어조건절처리 //검색어조건절처리

View File

@ -18,6 +18,10 @@ class PointService extends CustomerService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('Point'); $this->addClassPaths('Point');
} }
protected function getDTOClass(): string
{
return PointDTO::class;
}
public function createDTO(array $formDatas): PointDTO public function createDTO(array $formDatas): PointDTO
{ {
return new PointDTO($formDatas); return new PointDTO($formDatas);
@ -95,17 +99,6 @@ class PointService extends CustomerService
{ {
return new PointEntity($formDatas); return new PointEntity($formDatas);
} }
public function create(object $dto): PointEntity
{
if (!$dto instanceof PointDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof PointEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PointEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): PointEntity protected function modify_process($uid, array $formDatas): PointEntity
{ {
$entity = parent::modify_process($uid, $formDatas); $entity = parent::modify_process($uid, $formDatas);
@ -114,17 +107,6 @@ class PointService extends CustomerService
} }
return $entity; return $entity;
} }
public function modify($uid, object $dto): PointEntity
{
if (!$dto instanceof PointDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof PointEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PointEntity만 가능");
}
return $entity;
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
//검색어조건절처리 //검색어조건절처리

View File

@ -20,6 +20,10 @@ class ServiceService extends CustomerService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('Service'); $this->addClassPaths('Service');
} }
protected function getDTOClass(): string
{
return ServiceDTO::class;
}
public function createDTO(array $formDatas): ServiceDTO public function createDTO(array $formDatas): ServiceDTO
{ {
return new ServiceDTO($formDatas); return new ServiceDTO($formDatas);
@ -125,17 +129,6 @@ class ServiceService extends CustomerService
{ {
return new ServiceEntity($formDatas); return new ServiceEntity($formDatas);
} }
public function create(object $dto): ServiceEntity
{
if (!$dto instanceof ServiceDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof ServiceEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServiceEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): ServiceEntity protected function modify_process($uid, array $formDatas): ServiceEntity
{ {
$entity = parent::modify_process($uid, $formDatas); $entity = parent::modify_process($uid, $formDatas);
@ -144,25 +137,14 @@ class ServiceService extends CustomerService
} }
return $entity; return $entity;
} }
public function modify($uid, object $dto): ServiceEntity
{
if (!$dto instanceof ServiceDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof ServiceEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServiceEntity만 가능");
}
return $entity;
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
//검색어조건절처리 //검색어조건절처리
//추가 기능 //추가 기능
//interval을 기준으로 최근 신규 서비스정보 가져오기 //interval을 기준으로 최근 신규 서비스정보 가져오기
final public function getNewServiceEntities(int $interval, string $status = ServiceEntity::DEFAULT_STATUS): array final public function getNewServiceEntities(int $interval, string $status = STATUS['AVAILABLE']): array
{ {
return $this->getEntities(sprintf("start_at >= NOW()-INTERVAL {$interval} DAY AND status = '%s'", $status)); return $this->getEntities(["start_at >= NOW()-INTERVAL {$interval} DAY" => null, "status" => $status]);
} }
//서비스별 총 금액 //서비스별 총 금액
final public function getTotalAmounts($where = []): array final public function getTotalAmounts($where = []): array

View File

@ -18,6 +18,10 @@ class LineService extends EquipmentService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('Line'); $this->addClassPaths('Line');
} }
protected function getDTOClass(): string
{
return LineDTO::class;
}
public function createDTO(array $formDatas): LineDTO public function createDTO(array $formDatas): LineDTO
{ {
return new LineDTO($formDatas); return new LineDTO($formDatas);
@ -96,17 +100,6 @@ class LineService extends EquipmentService
{ {
return new LineEntity($formDatas); return new LineEntity($formDatas);
} }
public function create(object $dto): LineEntity
{
if (!$dto instanceof LineDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof LineEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 LineEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): LineEntity protected function modify_process($uid, array $formDatas): LineEntity
{ {
$entity = parent::modify_process($uid, $formDatas); $entity = parent::modify_process($uid, $formDatas);
@ -115,17 +108,6 @@ class LineService extends EquipmentService
} }
return $entity; return $entity;
} }
public function modify($uid, object $dto): LineEntity
{
if (!$dto instanceof LineDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof LineEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 LineEntity만 가능");
}
return $entity;
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
//검색어조건절처리 //검색어조건절처리

View File

@ -3,10 +3,12 @@
namespace App\Services\Equipment; namespace App\Services\Equipment;
use App\DTOs\Equipment\ServerPartDTO; use App\DTOs\Equipment\ServerPartDTO;
use App\DTOs\UserDTO;
use App\Entities\Equipment\ServerPartEntity; use App\Entities\Equipment\ServerPartEntity;
use App\Forms\Equipment\ServerPartForm; use App\Forms\Equipment\ServerPartForm;
use App\Helpers\Equipment\ServerPartHelper; use App\Helpers\Equipment\ServerPartHelper;
use App\Models\Equipment\ServerPartModel; use App\Models\Equipment\ServerPartModel;
use App\Services\CommonService;
use RuntimeException; use RuntimeException;
class ServerPartService extends EquipmentService class ServerPartService extends EquipmentService
@ -18,6 +20,10 @@ class ServerPartService extends EquipmentService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('ServerPart'); $this->addClassPaths('ServerPart');
} }
protected function getDTOClass(): string
{
return ServerPartDTO::class;
}
public function createDTO(array $formDatas): ServerPartDTO public function createDTO(array $formDatas): ServerPartDTO
{ {
return new ServerPartDTO($formDatas); return new ServerPartDTO($formDatas);
@ -57,7 +63,6 @@ class ServerPartService extends EquipmentService
"type", "type",
"billing", "billing",
"part_uid", "part_uid",
"title",
"cnt", "cnt",
"extra", "extra",
"amount", "amount",
@ -68,21 +73,24 @@ class ServerPartService extends EquipmentService
"part_uid", "part_uid",
"billing", "billing",
]; ];
$indexFilter = $filters; $indexFilter = [
"serverinfo_uid",
"type",
"billing",
];
$batchjobFilters = ['billing', 'type']; $batchjobFilters = ['billing', 'type'];
switch ($action) { switch ($action) {
case 'create': case 'create':
case 'create_form': case 'create_form':
case 'modify': case 'modify':
case 'modify_form': case 'modify_form':
$fields = [...$fields, 'status'];
break; break;
case 'view': case 'view':
$fields = [...$fields, 'status', 'created_at']; $fields = [...$fields, 'created_at'];
break; break;
case 'index': case 'index':
case 'download': case 'download':
$fields = [...$fields, 'status', 'created_at']; $fields = [...$fields, 'created_at'];
break; break;
} }
$this->getFormService()->setFormFields($fields); $this->getFormService()->setFormFields($fields);
@ -93,44 +101,38 @@ class ServerPartService extends EquipmentService
$this->getFormService()->setBatchjobFilters($batchjobFilters); $this->getFormService()->setBatchjobFilters($batchjobFilters);
} }
//기본 기능부분 //기본 기능부분
private function getPartService(string $type): CommonService
{
return service('part_' . strtolower($type) . 'service');
}
protected function getEntity_process(mixed $entity): ServerPartEntity protected function getEntity_process(mixed $entity): ServerPartEntity
{ {
return $entity; return $entity;
} }
protected function create_process(array $formDatas): ServerPartEntity protected function create_process(array $formDatas): ServerPartEntity
{ {
if (!array_key_exists('title', $formDatas)) {
if (!array_key_exists('type', $formDatas)) {
throw new \Exception(__METHOD__ . "에서 오류발생:부품형식이 지정되지 않았습니다.");
}
$formDatas['title'] = $this->getPartService($formDatas['type']->getTitle());
}
return new ServerPartEntity($formDatas); return new ServerPartEntity($formDatas);
} }
public function create(object $dto): ServerPartEntity
{
if (!$dto instanceof ServerPartDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof ServerPartEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerPartEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): ServerPartEntity protected function modify_process($uid, array $formDatas): ServerPartEntity
{ {
if (!array_key_exists('title', $formDatas)) {
if (!array_key_exists('type', $formDatas)) {
throw new \Exception(__METHOD__ . "에서 오류발생:부품형식이 지정되지 않았습니다.");
}
$formDatas['title'] = $this->getPartService($formDatas['type']->getTitle());
}
$entity = parent::modify_process($uid, $formDatas); $entity = parent::modify_process($uid, $formDatas);
if (!$entity instanceof ServerPartEntity) { if (!$entity instanceof ServerPartEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerPartEntity만 가능"); throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerPartEntity만 가능");
} }
return $entity; return $entity;
} }
public function modify($uid, object $dto): ServerPartEntity
{
if (!$dto instanceof ServerPartDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof ServerPartEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerPartEntity만 가능");
}
return $entity;
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
//검색어조건절처리 //검색어조건절처리

View File

@ -18,6 +18,10 @@ class ServerService extends EquipmentService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('Server'); $this->addClassPaths('Server');
} }
protected function getDTOClass(): string
{
return ServerDTO::class;
}
public function createDTO(array $formDatas): ServerDTO public function createDTO(array $formDatas): ServerDTO
{ {
return new ServerDTO($formDatas); return new ServerDTO($formDatas);
@ -103,17 +107,6 @@ class ServerService extends EquipmentService
{ {
return new ServerEntity($formDatas); return new ServerEntity($formDatas);
} }
public function create(object $dto): ServerEntity
{
if (!$dto instanceof ServerDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof ServerEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): ServerEntity protected function modify_process($uid, array $formDatas): ServerEntity
{ {
$entity = parent::modify_process($uid, $formDatas); $entity = parent::modify_process($uid, $formDatas);
@ -122,17 +115,6 @@ class ServerService extends EquipmentService
} }
return $entity; return $entity;
} }
public function modify($uid, object $dto): ServerEntity
{
if (!$dto instanceof ServerDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof ServerEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerEntity만 가능");
}
return $entity;
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
//검색어조건절처리 //검색어조건절처리

View File

@ -20,6 +20,10 @@ class MylogService extends CommonService implements PipelineStepInterface
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('Mylog'); $this->addClassPaths('Mylog');
} }
protected function getDTOClass(): string
{
return MylogDTO::class;
}
public function createDTO(array $formDatas): MylogDTO public function createDTO(array $formDatas): MylogDTO
{ {
return new MylogDTO($formDatas); return new MylogDTO($formDatas);
@ -111,22 +115,8 @@ class MylogService extends CommonService implements PipelineStepInterface
{ {
return new MylogEntity($formDatas); return new MylogEntity($formDatas);
} }
public function create(object $dto): MylogEntity
{
if (!$dto instanceof MylogDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
return parent::create($dto);
}
protected function modify_process($uid, array $formDatas): MyLogEntity protected function modify_process($uid, array $formDatas): MyLogEntity
{ {
return parent::modify_process($uid, $formDatas); return parent::modify_process($uid, $formDatas);
} }
public function modify($uid, object $dto): MyLogEntity
{
if (!$dto instanceof MylogDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
return parent::modify($uid, $dto);
}
} }

View File

@ -18,6 +18,10 @@ class CPUService extends PartService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('CPU'); $this->addClassPaths('CPU');
} }
protected function getDTOClass(): string
{
return CPUDTO::class;
}
public function createDTO(array $formDatas): CPUDTO public function createDTO(array $formDatas): CPUDTO
{ {
return new CPUDTO($formDatas); return new CPUDTO($formDatas);
@ -93,17 +97,6 @@ class CPUService extends PartService
{ {
return new CPUEntity($formDatas); return new CPUEntity($formDatas);
} }
public function create(object $dto): CPUEntity
{
if (!$dto instanceof CPUDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof CPUEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CPUEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): CPUEntity protected function modify_process($uid, array $formDatas): CPUEntity
{ {
$entity = parent::modify_process($uid, $formDatas); $entity = parent::modify_process($uid, $formDatas);
@ -112,17 +105,6 @@ class CPUService extends PartService
} }
return $entity; return $entity;
} }
public function modify($uid, object $dto): CPUEntity
{
if (!$dto instanceof CPUDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof CPUEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CPUEntity만 가능");
}
return $entity;
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
//검색어조건절처리 //검색어조건절처리

View File

@ -18,6 +18,10 @@ class CSService extends PartService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('CS'); $this->addClassPaths('CS');
} }
protected function getDTOClass(): string
{
return CSDTO::class;
}
public function createDTO(array $formDatas): CSDTO public function createDTO(array $formDatas): CSDTO
{ {
return new CSDTO($formDatas); return new CSDTO($formDatas);
@ -120,17 +124,6 @@ class CSService extends PartService
{ {
return new CSEntity($formDatas); return new CSEntity($formDatas);
} }
public function create(object $dto): CSEntity
{
if (!$dto instanceof CSDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof CSEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CSEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): CSEntity protected function modify_process($uid, array $formDatas): CSEntity
{ {
$entity = parent::modify_process($uid, $formDatas); $entity = parent::modify_process($uid, $formDatas);
@ -139,18 +132,13 @@ class CSService extends PartService
} }
return $entity; return $entity;
} }
public function modify($uid, object $dto): CSEntity
{
if (!$dto instanceof CSDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof CSEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CSEntity만 가능");
}
return $entity;
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
//검색어조건절처리 //검색어조건절처리
//OrderBy 처리(INET_ATON() 함수를 사용)
public function setOrderBy(mixed $field = null, mixed $value = null): void
{
$this->model->orderBy("INET_ATON(ip) ASC");
parent::setOrderBy($field, $value);
}
} }

View File

@ -18,6 +18,10 @@ class DISKService extends PartService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('DISK'); $this->addClassPaths('DISK');
} }
protected function getDTOClass(): string
{
return DISKDTO::class;
}
public function createDTO(array $formDatas): DISKDTO public function createDTO(array $formDatas): DISKDTO
{ {
return new DISKDTO($formDatas); return new DISKDTO($formDatas);
@ -95,17 +99,6 @@ class DISKService extends PartService
{ {
return new DISKEntity($formDatas); return new DISKEntity($formDatas);
} }
public function create(object $dto): DISKEntity
{
if (!$dto instanceof DISKDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof DISKEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 DISKEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): DISKEntity protected function modify_process($uid, array $formDatas): DISKEntity
{ {
$entity = parent::modify_process($uid, $formDatas); $entity = parent::modify_process($uid, $formDatas);
@ -114,17 +107,6 @@ class DISKService extends PartService
} }
return $entity; return $entity;
} }
public function modify($uid, object $dto): DISKEntity
{
if (!$dto instanceof DISKDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof DISKEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 DISKEntity만 가능");
}
return $entity;
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
//검색어조건절처리 //검색어조건절처리

View File

@ -18,6 +18,10 @@ class IPService extends PartService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('IP'); $this->addClassPaths('IP');
} }
protected function getDTOClass(): string
{
return IPDTO::class;
}
public function createDTO(array $formDatas): IPDTO public function createDTO(array $formDatas): IPDTO
{ {
return new IPDTO($formDatas); return new IPDTO($formDatas);
@ -111,17 +115,6 @@ class IPService extends PartService
{ {
return new IPEntity($formDatas); return new IPEntity($formDatas);
} }
public function create(object $dto): IPEntity
{
if (!$dto instanceof IPDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof IPEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 IPEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): IPEntity protected function modify_process($uid, array $formDatas): IPEntity
{ {
$entity = parent::modify_process($uid, $formDatas); $entity = parent::modify_process($uid, $formDatas);
@ -130,18 +123,13 @@ class IPService extends PartService
} }
return $entity; return $entity;
} }
public function modify($uid, object $dto): IPEntity
{
if (!$dto instanceof IPDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof IPEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 IPEntity만 가능");
}
return $entity;
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
//검색어조건절처리 //검색어조건절처리
//OrderBy 처리(INET_ATON() 함수를 사용)
public function setOrderBy(mixed $field = null, mixed $value = null): void
{
$this->model->orderBy("INET_ATON(ip) ASC");
parent::setOrderBy($field, $value);
}
} }

View File

@ -18,6 +18,10 @@ class RAMService extends PartService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('RAM'); $this->addClassPaths('RAM');
} }
protected function getDTOClass(): string
{
return RAMDTO::class;
}
public function createDTO(array $formDatas): RAMDTO public function createDTO(array $formDatas): RAMDTO
{ {
return new RAMDTO($formDatas); return new RAMDTO($formDatas);
@ -93,17 +97,6 @@ class RAMService extends PartService
{ {
return new RAMEntity($formDatas); return new RAMEntity($formDatas);
} }
public function create(object $dto): RAMEntity
{
if (!$dto instanceof RAMDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof RAMEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 RAMEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): RAMEntity protected function modify_process($uid, array $formDatas): RAMEntity
{ {
$entity = parent::modify_process($uid, $formDatas); $entity = parent::modify_process($uid, $formDatas);
@ -112,17 +105,6 @@ class RAMService extends PartService
} }
return $entity; return $entity;
} }
public function modify($uid, object $dto): RAMEntity
{
if (!$dto instanceof RAMDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof RAMEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 RAMEntity만 가능");
}
return $entity;
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
//검색어조건절처리 //검색어조건절처리

View File

@ -18,6 +18,10 @@ class SOFTWAREService extends PartService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('SOFTWARE'); $this->addClassPaths('SOFTWARE');
} }
protected function getDTOClass(): string
{
return SOFTWAREDTO::class;
}
public function createDTO(array $formDatas): SOFTWAREDTO public function createDTO(array $formDatas): SOFTWAREDTO
{ {
return new SOFTWAREDTO($formDatas); return new SOFTWAREDTO($formDatas);
@ -93,17 +97,6 @@ class SOFTWAREService extends PartService
{ {
return new SOFTWAREEntity($formDatas); return new SOFTWAREEntity($formDatas);
} }
public function create(object $dto): SOFTWAREEntity
{
if (!$dto instanceof SOFTWAREDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof SOFTWAREEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SOFTWAREEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): SOFTWAREEntity protected function modify_process($uid, array $formDatas): SOFTWAREEntity
{ {
$entity = parent::modify_process($uid, $formDatas); $entity = parent::modify_process($uid, $formDatas);
@ -112,17 +105,6 @@ class SOFTWAREService extends PartService
} }
return $entity; return $entity;
} }
public function modify($uid, object $dto): SOFTWAREEntity
{
if (!$dto instanceof SOFTWAREDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof SOFTWAREEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SOFTWAREEntity만 가능");
}
return $entity;
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
//검색어조건절처리 //검색어조건절처리

View File

@ -18,6 +18,10 @@ class SWITCHService extends PartService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('SWITCH'); $this->addClassPaths('SWITCH');
} }
protected function getDTOClass(): string
{
return SWITCHDTO::class;
}
public function createDTO(array $formDatas): SWITCHDTO public function createDTO(array $formDatas): SWITCHDTO
{ {
return new SWITCHDTO($formDatas); return new SWITCHDTO($formDatas);
@ -112,17 +116,6 @@ class SWITCHService extends PartService
{ {
return new SWITCHEntity($formDatas); return new SWITCHEntity($formDatas);
} }
public function create(object $dto): SWITCHEntity
{
if (!$dto instanceof SWITCHDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::create($dto);
if (!$entity instanceof SWITCHEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SWITCHEntity만 가능");
}
return $entity;
}
protected function modify_process($uid, array $formDatas): SWITCHEntity protected function modify_process($uid, array $formDatas): SWITCHEntity
{ {
$entity = parent::modify_process($uid, $formDatas); $entity = parent::modify_process($uid, $formDatas);
@ -131,17 +124,6 @@ class SWITCHService extends PartService
} }
return $entity; return $entity;
} }
public function modify($uid, object $dto): SWITCHEntity
{
if (!$dto instanceof SWITCHDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
$entity = parent::modify($uid, $dto);
if (!$entity instanceof SWITCHEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SWITCHEntity만 가능");
}
return $entity;
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
//검색어조건절처리 //검색어조건절처리

View File

@ -18,6 +18,10 @@ class PaymentService extends CommonService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('Payment'); $this->addClassPaths('Payment');
} }
protected function getDTOClass(): string
{
return PaymentDTO::class;
}
public function createDTO(array $formDatas): PaymentDTO public function createDTO(array $formDatas): PaymentDTO
{ {
return new PaymentDTO($formDatas); return new PaymentDTO($formDatas);
@ -61,7 +65,7 @@ class PaymentService extends CommonService
"content", "content",
]; ];
$filters = ['user_uid', 'clientinfo_uid', 'serviceinfo_uid', 'status', 'billing', 'pay']; $filters = ['user_uid', 'clientinfo_uid', 'serviceinfo_uid', 'status', 'billing', 'pay'];
$indexFilter = ['serviceinfo_uid', 'status', 'billing']; $indexFilter = ['clientinfo_uid', 'serviceinfo_uid', 'status', 'billing'];
$batchjobFilters = ['status']; $batchjobFilters = ['status'];
switch ($action) { switch ($action) {
case 'create': case 'create':
@ -129,34 +133,12 @@ class PaymentService extends CommonService
} }
protected function create_process(array $formDatas): PaymentEntity protected function create_process(array $formDatas): PaymentEntity
{ {
//confirmpassword 필드는 Entity에 필요없으므로 제거
if (isset($formDatas['confirmpassword'])) {
unset($formDatas['confirmpassword']);
}
return new PaymentEntity($formDatas); return new PaymentEntity($formDatas);
} }
public function create(object $dto): PaymentEntity
{
if (!$dto instanceof PaymentDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
return parent::create($dto);
}
protected function modify_process($uid, array $formDatas): PaymentEntity protected function modify_process($uid, array $formDatas): PaymentEntity
{ {
//confirmpassword 필드는 Entity에 필요없으므로 제거
if (isset($formDatas['confirmpassword'])) {
unset($formDatas['confirmpassword']);
}
return parent::modify_process($uid, $formDatas); return parent::modify_process($uid, $formDatas);
} }
public function modify($uid, object $dto): PaymentEntity
{
if (!$dto instanceof PaymentDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
return parent::modify($uid, $dto);
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
public function setFilter(string $field, mixed $filter_value): void public function setFilter(string $field, mixed $filter_value): void

View File

@ -18,6 +18,10 @@ class UserService extends CommonService
parent::__construct($model); parent::__construct($model);
$this->addClassPaths('User'); $this->addClassPaths('User');
} }
protected function getDTOClass(): string
{
return UserDTO::class;
}
public function createDTO(array $formDatas): UserDTO public function createDTO(array $formDatas): UserDTO
{ {
return new UserDTO($formDatas); return new UserDTO($formDatas);
@ -100,13 +104,6 @@ class UserService extends CommonService
} }
return new UserEntity($formDatas); return new UserEntity($formDatas);
} }
public function create(object $dto): UserEntity
{
if (!$dto instanceof UserDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
return parent::create($dto);
}
protected function modify_process($uid, array $formDatas): UserEntity protected function modify_process($uid, array $formDatas): UserEntity
{ {
//confirmpassword 필드는 Entity에 필요없으므로 제거 //confirmpassword 필드는 Entity에 필요없으므로 제거
@ -115,13 +112,6 @@ class UserService extends CommonService
} }
return parent::modify_process($uid, $formDatas); return parent::modify_process($uid, $formDatas);
} }
public function modify($uid, object $dto): UserEntity
{
if (!$dto instanceof UserDTO) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:" . get_class($dto) . "는 사용할수 없습니다.");
}
return parent::modify($uid, $dto);
}
//List 검색용 //List 검색용
//FormFilter 조건절 처리 //FormFilter 조건절 처리
public function setFilter(string $field, mixed $filter_value): void public function setFilter(string $field, mixed $filter_value): void

View File

@ -38,7 +38,7 @@
"[청구서발행]", "[청구서발행]",
'payment_invoice', 'payment_invoice',
[ [
"data-src" => "/admin/customer/payment?clientinfo_uid=" . $viewDatas['entity']->getPK() . "&ActionTemplate=popup", "data-src" => "/admin/payment?clientinfo_uid=" . $viewDatas['entity']->getPK() . "&ActionTemplate=popup",
"data-bs-toggle" => "modal", "data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form", "data-bs-target" => "#modal_action_form",
"class" => "text-primary form-label-sm", "class" => "text-primary form-label-sm",
@ -97,7 +97,7 @@
sprintf("총:%s건/%s원", $viewDatas['unPaids'][$viewDatas['entity']->getPK()]['cnt'], number_format($viewDatas['unPaids'][$viewDatas['entity']->getPK()]['amount'])), sprintf("총:%s건/%s원", $viewDatas['unPaids'][$viewDatas['entity']->getPK()]['cnt'], number_format($viewDatas['unPaids'][$viewDatas['entity']->getPK()]['amount'])),
'payment_unpaid', 'payment_unpaid',
[ [
"data-src" => "/admin/customer/payment?clientinfo_uid={$viewDatas['entity']->getPK()}&status=unpaid&ActionTemplate=popup", "data-src" => "/admin/payment?clientinfo_uid={$viewDatas['entity']->getPK()}&status=unpaid&ActionTemplate=popup",
"data-bs-toggle" => "modal", "data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form", "data-bs-target" => "#modal_action_form",
"class" => "text-primary form-label-sm", "class" => "text-primary form-label-sm",