dbmsv4 init...1

This commit is contained in:
최준흠 2025-11-19 18:04:14 +09:00
parent fa91de0067
commit 989a8a33ab
37 changed files with 1064 additions and 2823 deletions

View File

@ -401,6 +401,12 @@ define('DEFAULTS', [
'STATUS' => STATUS['AVAILABLE']
]);
#########################
//사이트 선택관련
define("SITES", [
"prime" => "PRIME",
"itsolution" => "ITSOLUTION",
"gdidc" => "GDIDC",
]);
//서비스 관련
define("SERVICE", [
"NEW_INTERVAL" => $_ENV['SERVICE_NEW_INTERVAL'] ?? $_SERVER['SERVICE_NEW_INTERVAL'] ?? 7,

View File

@ -4,10 +4,12 @@ namespace Config;
use App\Services\Auth\GoogleService;
use App\Services\Auth\LocalService;
use App\Services\BoardService;
use App\Services\Customer\AccountService;
use App\Services\Customer\ClientService;
use App\Services\Customer\CouponService;
use App\Services\Customer\PointService;
use App\Services\Customer\ServiceService;
use App\Services\Equipment\LineService;
use App\Services\Equipment\ServerPartService;
use App\Services\Equipment\ServerService;
@ -99,6 +101,15 @@ class Services extends BaseService
new \App\Models\MylogModel(),
);
}
public static function boardservice($getShared = true): BoardService
{
if ($getShared) {
return static::getSharedInstance(__FUNCTION__);
}
return new BoardService(
new \App\Models\BoardModel(),
);
}
public static function paymentservice($getShared = true): PaymentService
{
if ($getShared) {
@ -145,6 +156,15 @@ class Services extends BaseService
new \App\Models\Customer\PointModel(),
);
}
public static function customer_serviceservice($getShared = true): ServiceService
{
if ($getShared) {
return static::getSharedInstance(__FUNCTION__);
}
return new ServiceService(
new \App\Models\Customer\ServiceModel(),
);
}
//Equipment
public static function equipment_lineservice($getShared = true): LineService
{

View File

@ -4,6 +4,8 @@ namespace App\Controllers;
use App\Entities\CommonEntity;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\Validation\Exceptions\ValidationException;
use RuntimeException;
/**
* AbstractCRUDController
@ -11,6 +13,10 @@ use CodeIgniter\HTTP\RedirectResponse;
*/
abstract class AbstractCRUDController extends AbstractWebController
{
// 💡 핵심 1: 각 자식 클래스가 사용할 Entity 클래스 경로를 반환하도록 강제
// 이 메서드는 자식 클래스에서 반드시 구현되어야 합니다.
abstract protected function getEntityClass(): string;
// --- 생성 (Create) ---
protected function create_form_process(array $formDatas = []): array
@ -21,9 +27,20 @@ abstract class AbstractCRUDController extends AbstractWebController
protected function create_form_result_process(string $action): string|RedirectResponse
{
return $this->action_render_process($this->getActionPaths(), $action, $this->getViewDatas());
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate'));
}
final public function create_form(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
protected function create_process(): CommonEntity
{
// POST 데이터를 DTO 객체로 변환 (getPost()는 POST 요청 본문만 가져옵니다.)
@ -38,6 +55,25 @@ abstract class AbstractCRUDController extends AbstractWebController
)->with('message', "{$this->getTitle()}에서 {$entity->getTitle()} 생성이 완료되었습니다.");
}
final public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
$entityClass = $this->getEntityClass();
if (!$entity instanceof $entityClass) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
// --- 수정 (Modify) ---
protected function modify_form_process($uid): CommonEntity
{
@ -53,7 +89,25 @@ abstract class AbstractCRUDController extends AbstractWebController
protected function modify_form_result_process(string $action): string|RedirectResponse
{
return $this->action_render_process($this->getActionPaths(), $action, $this->getViewDatas());
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate'));
}
final public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
$entityClass = $this->getEntityClass();
if (!$entity instanceof $entityClass) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
protected function modify_process($uid): CommonEntity
@ -69,6 +123,25 @@ abstract class AbstractCRUDController extends AbstractWebController
'/' . implode('/', [...$this->getActionPaths(), 'view']) . '/' . $entity->getPK()
)->with('message', "{$this->getTitle()}에서 {$entity->getTitle()} 수정이 완료되었습니다.");
}
final public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
$entityClass = $this->getEntityClass();
if (!$entity instanceof $entityClass) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
// --- 삭제 (Delete) ---
@ -81,6 +154,20 @@ abstract class AbstractCRUDController extends AbstractWebController
{
return $this->action_redirect_process('info', "{$this->getTitle()}에서 {$entity->getTitle()} 삭제가 완료되었습니다.");
}
final public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
$entityClass = $this->getEntityClass();
if (!$entity instanceof $entityClass) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
// --- 상세보기 (View) ---
@ -98,6 +185,24 @@ abstract class AbstractCRUDController extends AbstractWebController
protected function view_result_process(string $action): string
{
return $this->action_render_process($this->getActionPaths(), $action, $this->getViewDatas());
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate'));
}
final public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
$entityClass = $this->getEntityClass();
if (!$entity instanceof $entityClass) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
}

View File

@ -32,7 +32,6 @@ abstract class AbstractWebController extends Controller
{
parent::initController($request, $response, $logger);
}
final protected function getAuthContext(): AuthContext
{
return service('myauth')->getAuthContext();
@ -111,19 +110,18 @@ abstract class AbstractWebController extends Controller
/**
* 경로와 데이터를 이용하여 최종 HTML을 렌더링합니다.
*/
protected function action_render_process(array $view_paths, string $view_file, array $viewDatas): string
protected function action_render_process(string $view_file, array $viewDatas, ?string $template_path = null): string
{
$self_path = array_pop($view_paths);
if ($path = $this->request->getVar('ActionTemplate')) {
$view_paths[] = $path;
$view_path = $viewDatas['layout'];
if ($template_path) {
$view_path .= DIRECTORY_SEPARATOR . $template_path;
}
$full_path = implode(DIRECTORY_SEPARATOR, $view_paths);
$view_datas = [
...$viewDatas,
'forms' => ['attributes' => ['method' => "post",], 'hiddens' => []],
];
helper(['form', __FUNCTION__]);
return view($full_path . DIRECTORY_SEPARATOR . $view_file, ['viewDatas' => $view_datas]);
return view($view_path . DIRECTORY_SEPARATOR . $view_file, ['viewDatas' => $view_datas]);
}
}

View File

@ -0,0 +1,118 @@
<?php
namespace App\Controllers\Admin;
use App\Entities\UserEntity;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class BoardController extends AdminController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
if ($this->service === null) {
$this->service = service('boardservice');
}
$this->addActionPaths('board');
}
//Action작업관련
protected function action_init_process(string $action): void
{
$fields = [
'category',
'worker_uid',
'title',
'status',
'content',
];
$filters = [
'user_uid',
'worker_uid',
'category',
'status',
];
$batchjobFilters = ['user_uid', 'category', 'status'];
// $actionButtons = ['view' => ICONS['SEARCH']];
// $batchjobButtons = [];
switch ($action) {
case 'create':
case 'create_form':
break;
case 'modify':
case 'modify_form':
$fields = [...$fields, 'status'];
break;
case 'view':
$fields = [
'category',
'worker_uid',
'title',
'status',
'created_at',
'content'
];
break;
case 'index':
$fields = [
'category',
'worker_uid',
'title',
'status',
'created_at'
];
break;
case 'download':
$fields = [
'category',
'worker_uid',
'title',
'status',
'created_at',
'content'
];
break;
default:
throw new \Exception("[{$action}] 지원하지 않는 action입니다.");
// break;
}
$this->service->getFormService()->setFormFields($fields);
$this->service->getFormService()->setFormRules($action, $fields);
$this->service->getFormService()->setFormFilters($filters);
$this->service->getFormService()->setFormOptions($filters);
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
// $this->service->getFormService()->setActionButtons($actionButtons);
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
protected function getEntityClass(): string
{
return UserEntity::class;
}
//기본 함수 작업
//Custom 추가 함수
// public function notice(): ResponseInterface
// {
// $this->getService()->setAction(__FUNCTION__);
// $this->getService()->setFormFields();
// //전달값정의
// $this->getService()->setFormDatas($this->request->getGet());
// $formDatas = $this->getSErvice()->getFormDatas();
// return $this->response->setJSON($this->getService()->getLatest(
// array_key_exists('category', $formDatas) && $formDatas['category'] ? $formDatas['category'] : BOARD['CATEGORY']['NOTICE'],
// ));
// }
// public function reqeusttask(): ResponseInterface
// {
// $this->getService()->setAction(__FUNCTION__);
// $this->getService()->setFormFields();
// //전달값정의
// $this->getService()->setFormDatas($this->request->getGet());
// $formDatas = $this->getSErvice()->getFormDatas();
// return $this->response->setJSON($this->getService()->getLatest(
// array_key_exists('category', $formDatas) && $formDatas['category'] ? $formDatas['category'] : BOARD['CATEGORY']['NOTICE'],
// ['worker_uid' => $this->getMyAuth()->getUIDByAuthInfo()]
// ));
// }
}

View File

@ -3,13 +3,9 @@
namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\AccountEntity;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Exceptions\ValidationException;
use Psr\Log\LoggerInterface;
use RuntimeException;
class AccountController extends CustomerController
{
@ -68,163 +64,9 @@ class AccountController extends CustomerController
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
protected function getEntityClass(): string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof AccountEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 AccountEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof AccountEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 AccountEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof AccountEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 AccountEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof AccountEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 AccountEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof AccountEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 AccountEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
return AccountEntity::class;
}
//기본 함수 작업
//Custom 추가 함수

View File

@ -3,13 +3,9 @@
namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\ClientEntity;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Exceptions\ValidationException;
use Psr\Log\LoggerInterface;
use RuntimeException;
class ClientController extends CustomerController
{
@ -77,163 +73,9 @@ class ClientController extends CustomerController
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
protected function getEntityClass(): string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof ClientEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ClientEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof ClientEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ClientEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof ClientEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ClientEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof ClientEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ClientEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof ClientEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ClientEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
return ClientEntity::class;
}
//기본 함수 작업
//Custom 추가 함수

View File

@ -3,13 +3,9 @@
namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\CouponEntity;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Exceptions\ValidationException;
use Psr\Log\LoggerInterface;
use RuntimeException;
class CouponController extends CustomerController
{
@ -21,6 +17,10 @@ class CouponController extends CustomerController
}
$this->addActionPaths('coupon');
}
protected function getEntityClass(): string
{
return CouponEntity::class;
}
protected function action_init_process(string $action): void
{
$fields = [
@ -64,164 +64,6 @@ class CouponController extends CustomerController
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof CouponEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CouponEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof CouponEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CouponEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof CouponEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CouponEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof CouponEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CouponEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof CouponEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CouponEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
}
//기본 함수 작업
//Custom 추가 함수
}

View File

@ -3,13 +3,9 @@
namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\PointEntity;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Exceptions\ValidationException;
use Psr\Log\LoggerInterface;
use RuntimeException;
class PointController extends CustomerController
{
@ -64,163 +60,9 @@ class PointController extends CustomerController
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
protected function getEntityClass(): string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof PointEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PointEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof PointEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PointEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof PointEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PointEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof PointEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PointEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof PointEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PointEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
return PointEntity::class;
}
//기본 함수 작업
//Custom 추가 함수

View File

@ -0,0 +1,98 @@
<?php
namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\ServiceEntity;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class ServiceController extends CustomerController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
if ($this->service === null) {
$this->service = service('customer_serviceservice');
}
$this->addActionPaths('service');
}
protected function action_init_process(string $action): void
{
$fields = [
"site",
"location",
"clientinfo_uid",
'serverinfo_uid',
"rack",
"line",
"title",
"start_at",
"billing_at",
"status",
'sale',
'amount',
"history",
];
$filters = [
'site',
'location',
'clientinfo_uid',
'serverinfo_uid',
'user_uid',
'status',
];
$batchjobFilters = [
'site',
'location',
'clientinfo_uid',
'status'
];
// $actionButtons = ['view' => ICONS['SEARCH']];
$batchjobButtons = ['batchjob' => '일괄 처리 ',];
parent::action_init_process($action);
switch ($action) {
case 'create':
case 'create_form':
case 'modify':
case 'modify_form':
break;
case 'view':
$fields = [...$fields, 'created_at'];
break;
case 'index':
case 'download':
$fields = [
'site',
'location',
'clientinfo_uid',
'serverinfo_uid',
'sale',
'amount',
'billing_at',
'status',
'start_at',
'updated_at',
'created_at'
];
break;
default:
throw new \Exception("[{$action}] 지원하지 않는 action입니다.");
// break;
}
$this->service->getFormService()->setFormFields($fields);
$this->service->getFormService()->setFormRules($action, $fields);
$this->service->getFormService()->setFormFilters($filters);
$this->service->getFormService()->setFormOptions($filters);
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
// $this->service->getFormService()->setActionButtons($actionButtons);
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
protected function getEntityClass(): string
{
return ServiceEntity::class;
}
//기본 함수 작업
//Custom 추가 함수
}

View File

@ -65,163 +65,9 @@ class LineController extends EquipmentController
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
protected function getEntityClass(): string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof LineEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 LineEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof LineEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 LineEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof LineEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 LineEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof LineEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 LineEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof LineEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 LineEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
return LineEntity::class;
}
//기본 함수 작업
//Custom 추가 함수

View File

@ -69,163 +69,9 @@ class ServerController extends EquipmentController
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
protected function getEntityClass(): string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof ServerEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof ServerEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof ServerEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof ServerEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof ServerEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
return ServerEntity::class;
}
//기본 함수 작업
//Custom 추가 함수

View File

@ -71,162 +71,9 @@ class ServerPartController extends EquipmentController
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
protected function getEntityClass(): string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof ServerPartEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerPartEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof ServerPartEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerPartEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof ServerPartEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerPartEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof ServerPartEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerPartEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof ServerPartEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServerPartEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
return ServerPartEntity::class;
}
//기본 함수 작업
//Custom 추가 함수

View File

@ -2,12 +2,12 @@
namespace App\Controllers\Admin;
use App\Controllers\CommonController;
use App\Controllers\AbstractWebController;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class Home extends AdminController
class Home extends AbstractWebController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
@ -19,17 +19,19 @@ class Home extends AdminController
$dashboards = [];
foreach (service('trafficservice')->getEntities(['status' => STATUS['AVAILABLE']]) as $entity)
$dashboards[] = $this->action_render_process(
['admin', 'traffic'],
'dashboard',
['entity' => $entity]
[
'layout' => 'admin',
'entity' => $entity
],
'traffic'
);
return $this->action_render_process(
$this->getActionPaths(),
__FUNCTION__,
[
'authContext' => $this->getAuthContext(),
'classPath' => service('trafficservice')->getClassPaths(false),
'layout' => $this->getLayout(),
'layout' => 'admin',
'dashboards' => $dashboards
]
);

View File

@ -51,162 +51,9 @@ class MylogController extends AdminController
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
protected function getEntityClass(): string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof MylogEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 MylogEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof MylogEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 MylogEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof MylogEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 MylogEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof MylogEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 MylogEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof MylogEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 MylogEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
return MylogEntity::class;
}
//기본 함수 작업
//Custom 추가 함수

View File

@ -62,163 +62,9 @@ class CPUController extends PartController
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
protected function getEntityClass(): string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof CPUEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CPUEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof CPUEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CPUEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof CPUEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CPUEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof CPUEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CPUEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof CPUEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CPUEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
return CPUEntity::class;
}
//기본 함수 작업
//Custom 추가 함수

View File

@ -89,163 +89,9 @@ class CSController extends PartController
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
protected function getEntityClass(): string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof CSEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CSEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof CSEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CSEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof CSEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CSEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof CSEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CSEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof CSEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CSEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
return CSEntity::class;
}
//기본 함수 작업
//Custom 추가 함수

View File

@ -64,162 +64,9 @@ class DISKController extends PartController
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
protected function getEntityClass(): string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof DISKEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 DISKEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof DISKEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 DISKEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof DISKEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 DISKEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof DISKEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 DISKEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof DISKEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 DISKEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
return DISKEntity::class;
}
//기본 함수 작업
//Custom 추가 함수

View File

@ -80,163 +80,9 @@ class IPController extends PartController
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
protected function getEntityClass(): string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof IPEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 IPEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof IPEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 IPEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof IPEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 IPEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof IPEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 IPEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof IPEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 IPEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
return IPEntity::class;
}
//기본 함수 작업
//Custom 추가 함수

View File

@ -63,162 +63,9 @@ class RAMController extends PartController
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
protected function getEntityClass(): string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof RAMEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 RAMEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof RAMEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 RAMEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof RAMEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 RAMEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof RAMEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 RAMEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof RAMEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 RAMEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
return RAMEntity::class;
}
//기본 함수 작업
//Custom 추가 함수

View File

@ -63,162 +63,9 @@ class SOFTWAREController extends PartController
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
protected function getEntityClass(): string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof SOFTWAREEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SOFTWAREEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof SOFTWAREEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SOFTWAREEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof SOFTWAREEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SOFTWAREEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof SOFTWAREEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SOFTWAREEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof SOFTWAREEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SOFTWAREEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
return SOFTWAREEntity::class;
}
//기본 함수 작업
//Custom 추가 함수

View File

@ -84,162 +84,9 @@ class SWITCHController extends PartController
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
protected function getEntityClass(): string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof SWITCHEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SWITCHEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof SWITCHEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SWITCHEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof SWITCHEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SWITCHEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof SWITCHEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SWITCHEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof SWITCHEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 SWITCHEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
return SWITCHEntity::class;
}
//기본 함수 작업
//Custom 추가 함수

View File

@ -69,162 +69,9 @@ class PaymentController extends AdminController
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
protected function getEntityClass(): string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof PaymentEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof PaymentEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof PaymentEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof PaymentEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof PaymentEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
return PaymentEntity::class;
}
//기본 함수 작업
//Custom 추가 함수

View File

@ -3,13 +3,9 @@
namespace App\Controllers\Admin;
use App\Entities\UserEntity;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Exceptions\ValidationException;
use Psr\Log\LoggerInterface;
use RuntimeException;
class UserController extends AdminController
{
@ -65,162 +61,9 @@ class UserController extends AdminController
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
parent::action_init_process($action);
}
public function create_form(): string|RedirectResponse
protected function getEntityClass(): string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->addViewDatas('formDatas', $this->create_form_process());
return $this->create_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
}
}
public function create(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->create_process();
if (!$entity instanceof UserEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 UserEntity만 가능");
}
return $this->create_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
}
}
public function modify_form($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_form_process($uid);
if (!$entity instanceof UserEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 UserEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_form_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
}
}
public function modify($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->modify_process($uid);
if (!$entity instanceof UserEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 UserEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->modify_result_process($entity);
} catch (ValidationException $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
}
}
public function delete($uid): RedirectResponse
{
try {
$entity = $this->delete_process($uid);
if (!$entity instanceof UserEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 UserEntity만 가능");
}
return $this->delete_result_process($entity);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
}
}
public function view($uid): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$entity = $this->view_process($uid);
if (!$entity instanceof UserEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 UserEntity만 가능");
}
$this->addViewDatas('entity', $entity);
return $this->view_result_process($action);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
}
}
public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
public function index(): string|ResponseInterface
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
return $this->index_result_process($action);
}
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
return UserEntity::class;
}
//기본 함수 작업
//Custom 추가 함수

View File

@ -5,6 +5,8 @@ namespace App\Controllers;
use App\Entities\CommonEntity;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Exceptions\ValidationException;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Reader\Html;
use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf;
@ -15,7 +17,128 @@ use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf;
*/
abstract class CommonController extends AbstractCRUDController
{
// --- 목록 (Index / List) 관련 ---
// --- 일괄 작업 (Batch Job) ---
protected function batchjob_pre_process(array $postDatas = []): array
{
$postDatas = $this->request->getPost();
// 1. postDatas에서 선택된 uids 정보 추출
$uids = $postDatas['batchjob_uids'] ?? [];
if (empty($uids)) {
throw new \Exception("적용할 리스트을 선택하셔야합니다.");
}
// 2. 변경할 데이터 추출 및 정리
unset($postDatas['batchjob_uids'], $postDatas['batchjob_submit']);
$formDatas = array_filter($postDatas, fn($value) => $value !== "" && $value !== null);
if (empty($formDatas)) {
throw new \Exception("변경할 조건항목을 선택하셔야합니다.");
}
// 3. 데이터가 있는 필드 추출
$selectedFields = array_keys($formDatas);
return array($uids, $selectedFields, $formDatas);
}
protected function batchjob_process($uid, array $formDatas): CommonEntity
{
// Service 로직 호출 (오버라이드 포인트)
return $this->service->batchjob($uid, $formDatas);
}
protected function batchjob_result_process(array $uids, array $entities, array $errors): string|RedirectResponse
{
return $this->action_redirect_process('info', sprintf(
"%s에서 %s개 처리완료, %s개 오류, 총:%s개 수정이 완료되었습니다.",
$this->getTitle(),
count($entities),
count($errors),
count($uids)
));
}
final public function batchjob(): string|RedirectResponse
{
try {
// 사전작업 및 데이터 추출 초기화
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
$this->service->getFormService()->setFormFields($selectedFields);
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
$this->service->getFormService()->setFormFilters($selectedFields);
$this->service->getFormService()->setFormOptions($selectedFields);
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_process($uid, $formDatas);
} catch (ValidationException $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
$errors[] = $e->getMessage();
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
}
}
// --- 일괄 삭제 (Batch Job Delete) ---
protected function batchjob_delete_pre_process(): array
{
$postDatas = $this->request->getPost();
$uids = $postDatas['batchjob_uids'] ?? [];
if (empty($uids)) {
throw new \Exception("삭제할 리스트을 선택하셔야합니다.");
}
// $uids는 배열로 반환
return $uids;
}
protected function batchjob_delete_result_process(array $uids, array $entities, array $errors): string|RedirectResponse
{
return $this->action_redirect_process('info', sprintf(
"%s에서 %s개 처리완료, %s개 오류, 총:%s개 일괄삭제가 완료되었습니다.",
$this->getTitle(),
count($entities),
count($errors),
count($uids)
));
}
/**
* 단일 삭제 로직을 재사용 (Override 가능)
*/
protected function batchjob_delete_process($uid): CommonEntity
{
return $this->service->delete($uid);
}
final public function batchjob_delete(): string|RedirectResponse
{
try {
$uids = $this->batchjob_delete_pre_process();
$entities = [];
$errors = [];
foreach ($uids as $uid) {
try {
$entities[] = $this->batchjob_delete_process($uid);
} catch (\Exception $e) {
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
$errors[] = $e->getMessage();
}
}
return $this->batchjob_delete_result_process($uids, $entities, $errors);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
}
}
// --- 목록 (Index / List) 관련 ---
/**
* 조건절(필터, 검색어, 날짜, 정렬) 처리합니다. (Override 가능)
@ -95,7 +218,7 @@ abstract class CommonController extends AbstractCRUDController
protected function index_result_process(string $action): string
{
return $this->action_render_process($this->getActionPaths(), $action, $this->getViewDatas());
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate'));
}
/**
@ -133,81 +256,19 @@ abstract class CommonController extends AbstractCRUDController
$this->addViewDatas('formDatas', $this->request->getVar() ?? []);
}
// --- 일괄 작업 (Batch Job) ---
protected function batchjob_pre_process(array $postDatas = []): array
final public function index(): string|ResponseInterface
{
$postDatas = $this->request->getPost();
// 1. postDatas에서 선택된 uids 정보 추출
$uids = $postDatas['batchjob_uids'] ?? [];
if (empty($uids)) {
throw new \Exception("적용할 리스트을 선택하셔야합니다.");
try {
$action = __FUNCTION__;
$this->action_init_process($action);
$this->index_process($action);
$this->index_result_process($action);
} catch (\Exception $e) {
session()->setFlashdata('message', $e->getMessage());
}
// 2. 변경할 데이터 추출 및 정리
unset($postDatas['batchjob_uids'], $postDatas['batchjob_submit']);
$formDatas = array_filter($postDatas, fn($value) => $value !== "" && $value !== null);
if (empty($formDatas)) {
throw new \Exception("변경할 조건항목을 선택하셔야합니다.");
}
// 3. 데이터가 있는 필드 추출
$selectedFields = array_keys($formDatas);
return array($uids, $selectedFields, $formDatas);
return $this->index_result_process($action);
}
protected function batchjob_process($uid, array $formDatas): CommonEntity
{
// Service 로직 호출 (오버라이드 포인트)
return $this->service->batchjob($uid, $formDatas);
}
protected function batchjob_result_process(array $uids, array $entities, array $errors): string|RedirectResponse
{
return $this->action_redirect_process('info', sprintf(
"%s에서 %s개 처리완료, %s개 오류, 총:%s개 수정이 완료되었습니다.",
$this->getTitle(),
count($entities),
count($errors),
count($uids)
));
}
// --- 일괄 삭제 (Batch Job Delete) ---
protected function batchjob_delete_pre_process(): array
{
$postDatas = $this->request->getPost();
$uids = $postDatas['batchjob_uids'] ?? [];
if (empty($uids)) {
throw new \Exception("삭제할 리스트을 선택하셔야합니다.");
}
// $uids는 배열로 반환
return $uids;
}
protected function batchjob_delete_result_process(array $uids, array $entities, array $errors): string|RedirectResponse
{
return $this->action_redirect_process('info', sprintf(
"%s에서 %s개 처리완료, %s개 오류, 총:%s개 일괄삭제가 완료되었습니다.",
$this->getTitle(),
count($entities),
count($errors),
count($uids)
));
}
/**
* 단일 삭제 로직을 재사용 (Override 가능)
*/
protected function batchjob_delete_process($uid): CommonEntity
{
return $this->service->delete($uid);
}
// --- 문서 다운로드 (Download) ---
@ -242,7 +303,7 @@ abstract class CommonController extends AbstractCRUDController
$this->addViewDatas('entities', $this->index_entities_process());
// HTML로 렌더링된 내용을 가져옵니다.
$html = $this->action_render_process($this->getActionPaths(), $action, $this->getViewDatas());
$html = $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate'));
// HTML을 PhpSpreadsheet 객체로 로드합니다.
$reader = new Html();
@ -268,4 +329,14 @@ abstract class CommonController extends AbstractCRUDController
}
return $this->response->download($full_path, null)->setFileName($file_name);
}
final public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
return $this->download_process($action, $output_type, $uid);
} catch (\Exception $e) {
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
}
}
}

24
app/DTOs/BoardDTO.php Normal file
View File

@ -0,0 +1,24 @@
<?php
namespace App\DTOs;
class BoardDTO extends CommonDTO
{
public ?int $uid = null;
public ?int $user_uid = null;
public ?int $worker_uid = null;
public ?string $category = null;
public ?string $title = null;
public ?string $content = null;
public ?string $status = null;
public function __construct(array $datas = [])
{
parent::__construct();
foreach ($datas as $key => $value) {
if (property_exists($this, $key)) {
$this->{$key} = $value;
}
}
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace App\DTOs\Customer;
use App\DTOs\CommonDTO;
class ServiceDTO extends CommonDTO
{
public ?int $uid = null;
public ?int $user_uid = null;
public ?int $clientinfo_uid = null;
public ?int $serverinfo_uid = null;
public ?int $payment_uid = null;
public ?string $code = null;
public ?string $title = null;
public ?string $site = null;
public ?string $location = null;
public ?int $rack = null;
public ?int $line = null;
public ?string $billing_at = null;
public ?int $sale = null;
public ?int $amount = null;
public ?string $start_at = null;
public ?string $end_at = null;
public ?int $history = null;
public ?string $status = null;
public function __construct(array $datas = [])
{
parent::__construct();
foreach ($datas as $key => $value) {
if (property_exists($this, $key)) {
$this->{$key} = $value;
}
}
}
}

63
app/Forms/BoardForm.php Normal file
View File

@ -0,0 +1,63 @@
<?php
namespace App\Forms;
use App\Forms\CommonForm;
class BoardForm extends CommonForm
{
public function __construct()
{
parent::__construct();
}
// protected function getValidationRule(string $field, string $rule): array
// {
// switch ($field) {
// case 'role':
// $field = "{$field}.*";
// break;
// default:
// return parent::getValidationRule($field, $rule);
// // break;
// }
// return array($field, $rule);
// }
public function getFormRule(string $action, string $field): string
{
switch ($field) {
case "category":
case "title":
$rule = "required|trim|string";
break;
case "user_uid":
$rule = "required|numeric";
break;
case "worker_uid":
$rule = "permit_empty|numeric";
break;
case "content":
$rule = "permit_empty|string";
break;
default:
$rule = parent::getFormRule($action, $field);
break;
}
return $rule;
}
public function getFormOption(string $field, array $options = []): array
{
switch ($field) {
case 'worker_uid':
foreach (service('userservice')->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

@ -187,7 +187,7 @@ abstract class CommonForm
$options['options'] = $tempOptions;
break;
case 'clientinfo_uid':
foreach (service('clientervice')->getEntities() as $entity) {
foreach (service('customer_clientservice')->getEntities() as $entity) {
$tempOptions[$entity->getPK()] = $entity->getTitle();
// $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())];
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Forms\Customer;
class ServiceForm extends CustomerForm
{
public function __construct()
{
parent::__construct();
}
public function getFormRule(string $action, string $field): string
{
switch ($field) {
case "user_uid":
case "clientinfo_uid":
case "serverinfo_uid":
case "amount":
case "rack":
case "line":
$rule = "required|numeric";
break;
case "sale":
case "payment_uid":
$rule = "permit_empty|numeric";
break;
case "site":
case "location":
case "status":
$rule = "required|trim|string";
break;
case "billing_at":
case "start_at":
$rule = "required|valid_date";
break;
case "end_at":
$rule = "permit_empty|valid_date";
break;
case 'title':
case "history":
$rule = "permit_empty|trim|string";
break;
default:
$rule = parent::getFormRule($action, $field);
break;
}
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

@ -0,0 +1,11 @@
<?php
namespace App\Helpers;
class BoardHelper extends CommonHelper
{
public function __construct()
{
parent::__construct();
}
}

View File

@ -176,7 +176,7 @@ abstract class CommonHelper
}
return $value ?? "";
}
public function getListFilter(string $field, mixed $value, array $viewDatas, $extras = []): string
public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
switch ($field) {
default:

View File

@ -0,0 +1,112 @@
<?php
namespace App\Helpers\Customer;
class ServiceHelper extends CustomerHelper
{
public function __construct()
{
parent::__construct();
}
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
switch ($field) {
case 'site':
$extras['onChange'] = "$('select[name=\'clientinfo_uid\']').select2('open')";
$form = $this->form_dropdown_common($field, $value, $viewDatas, $extras);
break;
case 'serverinfo_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$attributes = ['data-price' => 'price'];
$form = $this->form_dropdown_common($field, $value, $viewDatas, $extras, $attributes);
break;
case 'amount':
$form = form_input($field, 0, ["readonly" => "readonly", ...$extras]);
break;
default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break;
}
return $form;
}
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
{
switch ($field) {
case 'amount':
case 'sale':
$value = number_format($value) . "";
break;
case 'billing_at':
if (array_key_exists('unPaids', $viewDatas)) {
if (array_key_exists($viewDatas['entity']->getPK(), $viewDatas['unPaids'])) {
$value .= sprintf(
"<div><a href=\"/admin/customer/payment?serviceinfo_uid=%s\"><span style=\"color:red;\">%s개,총 %s원</span></a></div>",
$viewDatas['entity']->getPK(),
$viewDatas['unPaids'][$viewDatas['entity']->getPK()]['cnt'],
number_format($viewDatas['unPaids'][$viewDatas['entity']->getPK()]['amount'])
);
}
}
break;
default:
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
break;
}
if (is_array($value)) {
throw new \Exception(__METHOD__ . "에서 오류: {$field}의 값이 Array형태입니다");
}
return $value;
}
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'modify':
$action = parent::getListButton($action, $label, $viewDatas, $extras);
break;
case 'addServer':
$action = form_label(
$label ? $label : ICONS['REBOOT'],
$action,
[
"data-src" => "/admin/customer/service/addServer/{$viewDatas['entity']->getPK()}",
"data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form",
"class" => "btn btn-sm form-label-sm",
...$extras
]
);
break;
case 'onetime':
$action = form_label(
$label ? $label : ICONS['ONETIME'],
$action,
[
"data-src" => "/admin/customer/payment/create?serviceinfo_uid={$viewDatas['entity']->getPK()}",
"data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form",
"class" => "btn btn-sm form-label-sm",
...$extras
]
);
break;
case 'history':
$action = form_label(
$label ? $label : ICONS['HISTORY'],
$action,
[
"data-src" => "/admin/customer/service/history?serviceinfo_uid={$viewDatas['entity']->getPK()}&serviceinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form",
"class" => "btn btn-sm btn-primary form-label-sm",
...$extras
]
);
break;
default:
$action = parent::getListButton($action, $label, $viewDatas, $extras);
break;
}
return $action;
}
}

View File

@ -26,29 +26,4 @@ class BoardModel extends CommonModel
{
parent::__construct();
}
public function getFormRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "category":
case "title":
$rule = "required|trim|string";
break;
case "user_uid":
$rule = "required|numeric";
break;
case "worker_uid":
$rule = "permit_empty|numeric";
break;
case "content":
$rule = "permit_empty|string";
break;
default:
$rule = parent::getFormRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -39,46 +39,6 @@ class ServiceModel extends CustomerModel
{
parent::__construct();
}
public function getFormRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "user_uid":
case "clientinfo_uid":
case "serverinfo_uid":
case "amount":
case "rack":
case "line":
$rule = "required|numeric";
break;
case "sale":
case "payment_uid":
$rule = "permit_empty|numeric";
break;
case "site":
case "location":
case "status":
$rule = "required|trim|string";
break;
case "billing_at":
case "start_at":
$rule = "required|valid_date";
break;
case "end_at":
$rule = "permit_empty|valid_date";
break;
case 'title':
case "history":
$rule = "permit_empty|trim|string";
break;
default:
$rule = parent::getFormRule($action, $field);
break;
}
return $rule;
}
//입력전 코드처리
final public function create(array $formDatas): ServiceEntity
{

View File

@ -0,0 +1,110 @@
<?php
namespace App\Services;
use App\DTOs\BoardDTO;
use App\Entities\BoardEntity;
use App\Forms\BoardForm;
use App\Helpers\BoardHelper;
use App\Models\BoardModel;
use RuntimeException;
class BoardService extends CommonService
{
private $_form = null;
private $_helper = null;
public function __construct(BoardModel $model)
{
parent::__construct($model);
$this->addClassPaths('Board');
}
public function createDTO(array $formDatas): BoardDTO
{
return new BoardDTO($formDatas);
}
public function getFormService(): BoardForm
{
if ($this->_form === null) {
$this->_form = new BoardForm();
$this->_form->setAttributes([
'pk_field' => $this->model->getPKField(),
'title_field' => $this->model->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): BoardHelper
{
if ($this->_helper === null) {
$this->_helper = new BoardHelper();
$this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(),
'title_field' => $this->model->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): BoardEntity
{
return $entity;
}
protected function create_process(array $formDatas): BoardEntity
{
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
{
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 검색용
//FormFilter 조건절 처리
//검색어조건절처리
//추가기능부분
//Category별 최근 $limit갯수만큼 게시물
public function getLatest(string $category, array $where = []): array
{
//관리자정보
$userEntities = service('userservice')->getEntities();
$datas = [];
foreach ($this->getEntities(['category' => $category, 'status' => STATUS['AVAILABLE'], ...$where]) as $entity) {
$datas[] = [
'title' => "<label for=\"view\" data-src=\"/admin/board/view/{$entity->getPK()}\" data-bs-toggle=\"modal\" data-bs-target=\" #modal_action_form\" class=\"text-primary form-label-sm\">{$entity->getTitle()}</label>",
'created_at' => date('Y-m-d H:m', strtotime($entity->getCreatedAT())),
'user' => $userEntities[$entity->getUserUID()]->getTitle(),
];
}
return $datas;
}
//요청업무 게시물
public function getRequestTaskCount(int $worker_uid): int
{
$where = [
'category' => BOARD['CATEGORY']['REQUESTTASK'],
'worker_uid' => $worker_uid,
'status' => STATUS['AVAILABLE'],
];
return count($this->getEntities($where));
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace App\Services\Customer;
use App\DTOs\Customer\ServiceDTO;
use App\Entities\Customer\ServiceEntity;
use App\Forms\Customer\ServiceForm;
use App\Helpers\Customer\ServiceHelper;
use App\Models\Customer\ServiceModel;
use RuntimeException;
class ServiceService extends CustomerService
{
private $_form = null;
private $_helper = null;
public function __construct(ServiceModel $model)
{
parent::__construct($model);
$this->addClassPaths('Service');
}
public function createDTO(array $formDatas): ServiceDTO
{
return new ServiceDTO($formDatas);
}
public function getFormService(): ServiceForm
{
if ($this->_form === null) {
$this->_form = new ServiceForm();
$this->_form->setAttributes([
'pk_field' => $this->model->getPKField(),
'title_field' => $this->model->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_form;
}
public function getHelper(): ServiceHelper
{
if ($this->_helper === null) {
$this->_helper = new ServiceHelper();
$this->_helper->setAttributes([
'pk_field' => $this->model->getPKField(),
'title_field' => $this->model->getTitleField(),
'table' => $this->model->getTable(),
'useAutoIncrement' => $this->model->useAutoIncrement(),
'class_path' => $this->getClassPaths(false)
]);
}
return $this->_helper;
}
//기본 기능부분
protected function getEntity_process(mixed $entity): ServiceEntity
{
return $entity;
}
protected function create_process(array $formDatas): ServiceEntity
{
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
{
$entity = parent::modify_process($uid, $formDatas);
if (!$entity instanceof ServiceEntity) {
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 ServiceEntity만 가능");
}
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 검색용
//FormFilter 조건절 처리
//검색어조건절처리
}