dbmsv2 init...1

This commit is contained in:
choi.jh 2025-09-16 18:47:48 +09:00
parent 09530b370f
commit 090a01de92
15 changed files with 100 additions and 60 deletions

View File

@ -29,17 +29,4 @@ class AccountController extends CustomerController
return $this->_service;
}
//Index,FieldForm관련.
protected function create_process(array $formDatas): AccountEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::create_process($formDatas);
}
//수정관련
protected function modify_process(mixed $entity, array $formDatas): AccountEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::modify_process($entity, $formDatas);
}
}

View File

@ -35,7 +35,7 @@ class ClientController extends CustomerController
protected function create_process(array $formDatas): ClientEntity
{
//생성 전처리, 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
//생성처리
$entity = parent::create_process($formDatas);
// 생성 후처리, Client 코드값 재정의
@ -53,7 +53,7 @@ class ClientController extends CustomerController
protected function modify_process(mixed $entity, array $formDatas): ClientEntity
{
//수정 전처리, 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
//수정처리
return parent::modify_process($entity, $formDatas);
}

View File

@ -32,14 +32,14 @@ class CouponController extends CustomerController
protected function create_process(array $formDatas): CouponEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
return parent::create_process($formDatas);
}
//수정관련
protected function modify_process(mixed $entity, array $formDatas): CouponEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
return parent::modify_process($entity, $formDatas);
}
}

View File

@ -4,9 +4,6 @@ namespace App\Controllers\Admin\Customer;
use App\Entities\Customer\ClientEntity;
use App\Entities\Customer\PaymentEntity;
use App\Entities\Customer\ServiceEntity;
use App\Helpers\Customer\PaymentHelper;
use App\Libraries\LogCollector;
use App\Services\Customer\ClientService;
@ -67,14 +64,14 @@ class PaymentController extends CustomerController
protected function create_process(array $formDatas): PaymentEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
return parent::create_process($formDatas);
}
//수정관련
protected function modify_process(mixed $entity, array $formDatas): PaymentEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
return parent::modify_process($entity, $formDatas);
}
//Invoice 관련

View File

@ -32,14 +32,14 @@ class PointController extends CustomerController
protected function create_process(array $formDatas): PointEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
return parent::create_process($formDatas);
}
//수정관련
protected function modify_process(mixed $entity, array $formDatas): PointEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
return parent::modify_process($entity, $formDatas);
}
}

View File

@ -77,14 +77,14 @@ class ServiceController extends CustomerController
protected function create_process(array $formDatas): ServiceEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
return parent::create_process($formDatas);
}
//수정관련
protected function modify_process(mixed $entity, array $formDatas): ServiceEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
$formDatas['user_uid'] = $this->getService()->getMyAuth()->getUIDByAuthInfo();
return parent::modify_process($entity, $formDatas);
}
//List 관련

View File

@ -50,7 +50,7 @@ class UserController extends AdminController
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
break;
case 'profile_modify':
$this->getMyLogService()->save($this->getService()->getClassName(), $this->getService()->getAction(), $message, $this->getMyAuth()->getUIDByAuthInfo());
$this->getMyLogService()->save($this->getService()->getClassName(), $this->getService()->getAction(), $message, $this->getService()->getMyAuth()->getUIDByAuthInfo());
$result = $this->view($this->entity->getPK());
break;
default:

View File

@ -29,13 +29,13 @@ abstract class AuthController extends CommonController
if ($this->request->getMethod() === 'POST') {
return redirect()->back()->withInput()->with('error', $message);
}
return redirect()->to($this->getMyAuth()->popPreviousUrl())->with('error', $message);
return redirect()->to($this->getService()->getMyAuth()->popPreviousUrl())->with('error', $message);
}
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
{
switch ($this->getService()->getAction()) {
case 'create': //Login처리
$result = redirect()->to($this->getMyAuth()->popPreviousUrl())->with('error', $message);
$result = redirect()->to($this->getService()->getMyAuth()->popPreviousUrl())->with('error', $message);
break;
default:
$result = parent::getResultSuccess($message, $actionTemplate);

View File

@ -20,7 +20,6 @@ use Psr\Log\LoggerInterface;
abstract class CommonController extends BaseController
{
private $_myAuth = null;
private ?MyLogService $_myLogService = null;
private $_viewDatas = [];
abstract public function getService(): mixed;
@ -29,10 +28,10 @@ abstract class CommonController extends BaseController
parent::initController($request, $response, $logger);
$this->isLoggedIn = false;
$this->uri = $request->getUri();
if ($this->getMyAuth()->isLoggedIn()) {
if ($this->getService()->getMyAuth()->isLoggedIn()) {
$this->isLoggedIn = true;
$this->myAuthName = $this->getMyAuth()->getNameByAuthInfo();
$this->myAuthUID = $this->getMyAuth()->getUIDByAuthInfo();
$this->myAuthName = $this->getService()->getMyAuth()->getNameByAuthInfo();
$this->myAuthUID = $this->getService()->getMyAuth()->getUIDByAuthInfo();
}
}
final public function __get($name)
@ -46,13 +45,6 @@ abstract class CommonController extends BaseController
{
$this->_viewDatas[$name] = $value;
}
final protected function getMyAuth(): mixed
{
if (!$this->_myAuth) {
$this->_myAuth = service('myauth');
}
return $this->_myAuth;
}
final protected function getViewDatas(): array
{
return $this->_viewDatas;
@ -96,11 +88,11 @@ abstract class CommonController extends BaseController
//Process Result처리
protected function getResultFail(string $message = MESSAGES["FAILED"]): RedirectResponse
{
// $this->getMyLogService()->save($this->getService()->getClassName(), $this->getAction(), $message, $this->getMyAuth()->getUIDByAuthInfo());
// $this->getMyLogService()->save($this->getService()->getClassName(), $this->getAction(), $message, $this->getService()->getMyAuth()->getUIDByAuthInfo());
if ($this->request->getMethod() === 'POST') {
return redirect()->back()->withInput()->with('error', $message);
}
return redirect()->to($this->getMyAuth()->popPreviousUrl())->with('error', $message);
return redirect()->to($this->getService()->getMyAuth()->popPreviousUrl())->with('error', $message);
}
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
{
@ -108,7 +100,7 @@ abstract class CommonController extends BaseController
switch ($this->getService()->getControlDatas('action')) {
case 'create':
case 'modify':
// $this->getMyLogService()->save($this->getService()->getClassName(), $this->getAction(), $message, $this->getMyAuth()->getUIDByAuthInfo());
// $this->getMyLogService()->save($this->getService()->getClassName(), $this->getAction(), $message, $this->getService()->getMyAuth()->getUIDByAuthInfo());
$result = $this->view($this->entity->getPK());
break;
case 'create_form':
@ -129,7 +121,7 @@ abstract class CommonController extends BaseController
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
break;
default:
$result = redirect()->to($this->getMyAuth()->popPreviousUrl())->with('error', $message);
$result = redirect()->to($this->getService()->getMyAuth()->popPreviousUrl())->with('error', $message);
break;
}
return $result;
@ -500,7 +492,7 @@ abstract class CommonController extends BaseController
$this->getService()->setControlDatas('batchjob_buttions', $this->getService()->getBatchjobButtons());
helper(['form']);
//Return Url정의
$this->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
$this->getService()->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
//조건절 처리
$this->index_condition_process();
//TotalCount (SoftDelete적용이 되려면 countAllResults를 사용해야함)

View File

@ -4,9 +4,9 @@
"settings": {
"width": 3000,
"height": 3000,
"scrollTop": -621.5228,
"scrollLeft": -933.8609,
"zoomLevel": 0.73,
"scrollTop": -624.4768,
"scrollLeft": -1686,
"zoomLevel": 0.76,
"show": 511,
"database": 4,
"databaseName": "",

File diff suppressed because one or more lines are too long

View File

@ -8,6 +8,7 @@ use App\Helpers\CommonHelper;
abstract class CommonService
{
private $_myAuth = null;
private $_model = null;
private $_helper = null;
@ -20,6 +21,13 @@ abstract class CommonService
}
abstract public function getFormFields(): array;
abstract public function getFormFilters(): array;
final public function getMyAuth(): mixed
{
if (!$this->_myAuth) {
$this->_myAuth = service('myauth');
}
return $this->_myAuth;
}
final public function getHelper(): mixed
{
if (!$this->_helper) {

View File

@ -54,11 +54,22 @@ class AccountService extends CustomerService
$entity = $this->getClientService()->withdrawal($entity, 'account_balance', $amount);
}
}
//생성
public function create(array $formDatas): AccountEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
$this->setBalance($formDatas);
return parent::create($formDatas);
}
//수정
public function modify(mixed $entity, array $formDatas): AccountEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
$this->setBalance($formDatas);
return parent::modify($entity, $formDatas);
}
//List 검색용
public function index_condition_filterWord(string $word): void
{

View File

@ -107,4 +107,20 @@ class PaymentService extends CustomerService
->get()->getResult();
return $rows;
}
//생성
public function create(array $formDatas): PaymentEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
dd($formDatas);
return parent::create($formDatas);
}
//수정
public function modify(mixed $entity, array $formDatas): PaymentEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::modify($entity, $formDatas);
}
}

View File

@ -2,10 +2,12 @@
namespace App\Services\Equipment;
use App\Entities\Customer\PaymentEntity;
use App\Entities\Equipment\ServerEntity;
use App\Entities\Equipment\ServerPartEntity;
use App\Helpers\Equipment\ServerPartHelper;
use App\Models\Equipment\ServerPartModel;
use App\Services\Customer\PaymentService;
use App\Services\Equipment\EquipmentService;
class ServerPartService extends EquipmentService
@ -14,6 +16,7 @@ class ServerPartService extends EquipmentService
private ?PartService $_partService = null;
private ?IPService $_ipService = null;
private ?CSService $_csService = null;
private ?PaymentService $_paymentService = null;
public function __construct()
{
parent::__construct(new ServerPartModel(), new ServerPartHelper());
@ -94,6 +97,14 @@ class ServerPartService extends EquipmentService
}
return $this->_csService;
}
final public function getPaymentService(): PaymentService
{
if (!$this->_paymentService) {
$this->_paymentService = new PaymentService();
}
return $this->_paymentService;
}
//partEntity 정보 추가
protected function getEntity_process(mixed $entity): ServerPartEntity
{
@ -156,6 +167,7 @@ class ServerPartService extends EquipmentService
}
return $options;
}
//파트별 정보 수정작업
private function setPart_process(ServerPartEntity $entity, mixed $part_uid, string $status): mixed
{
//Type에 따른 부품서비스 정의
@ -203,6 +215,20 @@ class ServerPartService extends EquipmentService
}
return $partEntity;
}
//일회성 결제 추가 처리
private function setPayment_process(ServerPartEntity $entity): PaymentEntity
{
$formDatas = [];
$formDatas['clientinfo_uid'] = $entity->getClientInfoUID();
$formDatas['serviceinfo_uid'] = $entity->getServiceInfoUID();
$formDatas['serverinfo_uid'] = $entity->getServerInfoUID();
$formDatas['title'] = sprintf("부품정보 [%s]에 대한 일회성 추가", $entity->getPartEntity()->getTitle());
$formDatas['amount'] = $entity->getAmount();
$formDatas['billing'] = $entity->getBilling();
$formDatas['billing_at'] = date("Y-m-d"); //일회성은 지급일이 당일기준처리
return $this->getPaymentService()->create($formDatas);
}
//부품연결정보생성
public function create(array $formDatas): ServerPartEntity
{
@ -224,11 +250,14 @@ class ServerPartService extends EquipmentService
$formDatas["serverinfo_uid"] = $serverEntity->getPK();
$entity = parent::create($formDatas);
//부품연결정보에 부품정보 정의
return $entity->setPartEntity($this->setPart_process(
$entity,
$formDatas['part_uid'],
STATUS['OCCUPIED']
));
$entity = $entity->setPartEntity(
$this->setPart_process($entity, $formDatas['part_uid'], STATUS['OCCUPIED'])
);
//일회성인경우 결제정보에 추가한다.
if ($entity->getBilling() === PAYMENT['BILLING']['ONETIME']) {
$paymentEntity = $this->setPayment_process($entity);
}
return $entity;
}
//수정
public function modify(mixed $entity, array $formDatas): ServerPartEntity