dbms_init...1
This commit is contained in:
parent
9b667afc11
commit
a0d5fa9a1c
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceItemEntity;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
@ -85,6 +86,7 @@ class ServiceController extends CustomerController
|
||||
$options = $this->getService()->getServiceItemLinkService($item_type)->getEntities();
|
||||
$this->setFilterFieldOption($item_type, $options);
|
||||
}
|
||||
// dd($this->getFilterFieldOptions());
|
||||
$entities = [];
|
||||
foreach (parent::index_process() as $entity) {
|
||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||
@ -95,7 +97,7 @@ class ServiceController extends CustomerController
|
||||
}
|
||||
$entities[] = $entity;
|
||||
}
|
||||
// $this->modal_type = 'modal_fetch_v2'; //기본은 modal_iframe임
|
||||
// $entities = parent::index_process();
|
||||
return $entities;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,8 @@ use App\Libraries\LogCollector;
|
||||
|
||||
use App\Services\Customer\ServicePaymentService;
|
||||
use App\Services\Customer\ServiceService;
|
||||
use App\Services\Customer\ClientService;
|
||||
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
@ -18,6 +20,7 @@ use Psr\Log\LoggerInterface;
|
||||
class ServicePaymentController extends CustomerController
|
||||
{
|
||||
private ?ServiceService $_serviceService = null;
|
||||
private ?ClientService $_clientService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -26,7 +29,6 @@ class ServicePaymentController extends CustomerController
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
public function getService(): ServicePaymentService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
@ -48,6 +50,13 @@ class ServicePaymentController extends CustomerController
|
||||
}
|
||||
return $this->_serviceService;
|
||||
}
|
||||
public function getClientService(): ClientService
|
||||
{
|
||||
if (!$this->_clientService) {
|
||||
$this->_clientService = new ClientService($this->request);
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getAction()) {
|
||||
@ -72,6 +81,7 @@ class ServicePaymentController extends CustomerController
|
||||
return $result;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
protected function index_process(): array
|
||||
{
|
||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||
@ -79,9 +89,9 @@ class ServicePaymentController extends CustomerController
|
||||
$options = $this->getService()->getServiceItemLinkService($item_type)->getEntities();
|
||||
$this->setFilterFieldOption($item_type, $options);
|
||||
}
|
||||
// dd($this->getFilterFieldOptions());
|
||||
return parent::index_process();
|
||||
}
|
||||
|
||||
private function getOwnersForInvoice(ClientEntity $ownerEntity): array
|
||||
{
|
||||
$temps = [
|
||||
@ -102,10 +112,9 @@ class ServicePaymentController extends CustomerController
|
||||
}
|
||||
private function getItemsForInvoice(ServicePaymentEntity $entity): array
|
||||
{
|
||||
// dd($this->getFilterFieldOptions());
|
||||
$temps = [
|
||||
'item_type' => SERVICE_ITEM_TYPES[$entity->getItemType()],
|
||||
'item_uid' => $this->getFilterFieldOption($entity->getItemType())[$entity->getItemUid()],
|
||||
'item_uid' => $this->getFilterFieldOption($entity->getItemType())[$entity->getItemUid()]->getTitle(),
|
||||
'amount' => $entity->getAmount()
|
||||
];
|
||||
return $temps;
|
||||
@ -117,17 +126,19 @@ class ServicePaymentController extends CustomerController
|
||||
if (!is_array($uids) || !count($uids)) {
|
||||
throw new \Exception("청구서에 적용될 리스트를 선택하셔야합니다.");
|
||||
}
|
||||
$this->item_fields = ['item_type', 'ammount', 'biiling_cycle'];
|
||||
$owner_pk = false;
|
||||
$entities = [];
|
||||
foreach ($uids as $uid) {
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
LogCollector::debug(__METHOD__ . "에서 {$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
LogCollector::debug(__METHOD__ . "에서 {$uid}에 대한 결제정보를 찾을수 없습니다.");
|
||||
}
|
||||
//entities에 관리자 설정
|
||||
$ownerEntity = $entity->getOwner();
|
||||
$ownerEntity = $this->getClientService()->getEntity($entity->getOwnerUID());
|
||||
if (!$ownerEntity) {
|
||||
LogCollector::debug(__METHOD__ . "에서 {$entity->getOwnerUID()}에 대한 관라자정보를 찾을수 없습니다.");
|
||||
}
|
||||
if ($ownerEntity->getPK() !== $owner_pk) {
|
||||
if (!array_key_exists($ownerEntity->getPK(), $entities)) {
|
||||
$entities[$ownerEntity->getPK()] = $this->getOwnersForInvoice($ownerEntity);
|
||||
@ -135,7 +146,10 @@ class ServicePaymentController extends CustomerController
|
||||
$owner_pk = $ownerEntity->getPK();
|
||||
}
|
||||
//entities에 서비스 설정
|
||||
$serviceEntity = $entity->getService();
|
||||
$serviceEntity = $this->getServiceService()->getEntity($entity->getServiceUid());
|
||||
if (!$serviceEntity) {
|
||||
LogCollector::debug(__METHOD__ . "에서 {$entity->getServiceUid()}에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
if (!array_key_exists($serviceEntity->getPK(), $entities[$owner_pk]['services'])) {
|
||||
$entities[$owner_pk]['services'][$serviceEntity->getPK()] = $this->getServicesForInvoice($serviceEntity);
|
||||
}
|
||||
@ -153,6 +167,11 @@ class ServicePaymentController extends CustomerController
|
||||
{
|
||||
try {
|
||||
$this->initAction(__FUNCTION__);
|
||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||
$options = $this->getService()->getServiceItemLinkService($item_type)->getEntities();
|
||||
$this->setFilterFieldOption($item_type, $options);
|
||||
}
|
||||
$this->entities = $this->invoice_process();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
namespace App\Entities\Customer;
|
||||
|
||||
use App\Entities\CommonEntity;
|
||||
use App\Entities\Customer\ClientEntity;
|
||||
|
||||
abstract class CustomerEntity extends CommonEntity
|
||||
{
|
||||
@ -17,13 +16,4 @@ abstract class CustomerEntity extends CommonEntity
|
||||
{
|
||||
return intval($this->attributes['clientinfo_uid']);
|
||||
}
|
||||
final public function getClient(): ClientEntity|null
|
||||
{
|
||||
return $this->_clientEntity;
|
||||
}
|
||||
final public function setClient(ClientEntity $clientEntity): void
|
||||
{
|
||||
$this->_clientEntity = $clientEntity;
|
||||
}
|
||||
//타 객체정의 부분
|
||||
}
|
||||
|
||||
@ -9,22 +9,10 @@ class ServiceEntity extends CustomerEntity
|
||||
{
|
||||
const PK = ServiceModel::PK;
|
||||
const TITLE = ServiceModel::TITLE;
|
||||
private ?ClientEntity $_ownerEntity = null;
|
||||
//고객정보객체-상속
|
||||
//관리자정보객체
|
||||
final public function getOwnerUID(): int
|
||||
{
|
||||
return intval($this->attributes['ownerinfo_uid']);
|
||||
}
|
||||
final public function getOwner(): ClientEntity|null
|
||||
{
|
||||
return $this->_ownerEntity;
|
||||
}
|
||||
final public function setOwner(ClientEntity $ownerEntity): void
|
||||
{
|
||||
$this->_ownerEntity = $ownerEntity;
|
||||
}
|
||||
//타 객체정의 부분
|
||||
public function getTitle(): string
|
||||
{
|
||||
return "S" . $this->getPK();
|
||||
|
||||
@ -2,26 +2,14 @@
|
||||
|
||||
namespace App\Entities\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Models\Customer\ServiceHistoryModel;
|
||||
|
||||
class ServiceHistoryEntity extends CustomerEntity
|
||||
{
|
||||
const PK = ServiceHistoryModel::PK;
|
||||
const TITLE = ServiceHistoryModel::TITLE;
|
||||
private ?ServiceEntity $_serviceEntity = null;
|
||||
//서비스정보객체
|
||||
public function getServiceUid(): int
|
||||
{
|
||||
return intval($this->attributes['serviceinfo_uid']);
|
||||
}
|
||||
final public function getService(): ServiceEntity|null
|
||||
{
|
||||
return $this->_serviceEntity;
|
||||
}
|
||||
final public function setService(ServiceEntity $serviceEntity): void
|
||||
{
|
||||
$this->_serviceEntity = $serviceEntity;
|
||||
}
|
||||
//타 객체정의 부분
|
||||
}
|
||||
|
||||
@ -2,29 +2,17 @@
|
||||
|
||||
namespace App\Entities\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Models\Customer\ServiceItemModel;
|
||||
|
||||
class ServiceItemEntity extends CustomerEntity
|
||||
{
|
||||
const PK = ServiceItemModel::PK;
|
||||
const TITLE = ServiceItemModel::TITLE;
|
||||
private ?ServiceEntity $_serviceEntity = null;
|
||||
//서비스정보객체
|
||||
final public function getServiceUid(): int
|
||||
{
|
||||
return intval($this->attributes['serviceinfo_uid']);
|
||||
}
|
||||
final public function getService(): ServiceEntity|null
|
||||
{
|
||||
return $this->_serviceEntity;
|
||||
}
|
||||
final public function setService(ServiceEntity $serviceEntity): void
|
||||
{
|
||||
$this->_serviceEntity = $serviceEntity;
|
||||
}
|
||||
//타 객체정의 부분
|
||||
|
||||
public function getItemType(): string
|
||||
{
|
||||
return $this->attributes['item_type'];
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Entities\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Models\Customer\ServicePaymentModel;
|
||||
use DateTime;
|
||||
|
||||
@ -10,23 +9,11 @@ class ServicePaymentEntity extends CustomerEntity
|
||||
{
|
||||
const PK = ServicePaymentModel::PK;
|
||||
const TITLE = ServicePaymentModel::TITLE;
|
||||
private ?ServiceEntity $_serviceEntity = null;
|
||||
private ?ClientEntity $_ownerEntity = null;
|
||||
//고객정보객체-상속
|
||||
//관리자정보객체
|
||||
final public function getOwnerUID(): int
|
||||
{
|
||||
return intval($this->attributes['ownerinfo_uid']);
|
||||
}
|
||||
final public function getOwner(): ClientEntity|null
|
||||
{
|
||||
return $this->_ownerEntity;
|
||||
}
|
||||
final public function setOwner(ClientEntity $ownerEntity): void
|
||||
{
|
||||
$this->_ownerEntity = $ownerEntity;
|
||||
}
|
||||
//서비스정보객체
|
||||
final public function getServiceUid(): int
|
||||
{
|
||||
return intval($this->attributes['serviceinfo_uid']);
|
||||
|
||||
@ -37,7 +37,10 @@ class ServiceItemHelper extends CustomerHelper
|
||||
$form_temps = ["<select name=\"{$field}\" class=\"select-field\"" . (isset($extras['onChange']) ? " onChange=\"{$extras['onChange']}\"" : "") . ">"];
|
||||
$form_temps[] = "<option value=\"\">" . lang($viewDatas['class_path'] . '.label.' . $item_type) . " 선택</option>";
|
||||
foreach ($viewDatas['control']['filter_optons'][$item_type] as $key => $filterEntity) {
|
||||
$disabled = "";
|
||||
if (!array_key_exists('index_content_top_filter', $extras)) {
|
||||
$disabled = in_array($filterEntity->getStatus(), [DomainEntity::STATUS_OCCUPIED, DomainEntity::STATUS_FORBIDDEN]) ? 'disabled="disabled"' : '';
|
||||
}
|
||||
$selected = ($value === $key) ? 'selected="selected"' : '';
|
||||
$form_temps[] = "<option value=\"{$key}\"{$selected} {$disabled}>{$filterEntity->getTitle()}</option>";
|
||||
}
|
||||
@ -75,7 +78,10 @@ class ServiceItemHelper extends CustomerHelper
|
||||
$form_temps = ["<select name=\"{$field}\" class=\"select-field\"" . (isset($extras['onChange']) ? " onChange=\"{$extras['onChange']}\"" : "") . ">"];
|
||||
$form_temps[] = "<option value=\"\">" . lang($viewDatas['class_path'] . '.label.' . $item_type) . " 선택</option>";
|
||||
foreach ($viewDatas['control']['filter_optons'][$item_type] as $key => $filterEntity) {
|
||||
$disabled = "";
|
||||
if (!array_key_exists('index_content_top_filter', $extras)) {
|
||||
$disabled = in_array($filterEntity->getStatus(), [IpEntity::STATUS_OCCUPIED, IpEntity::STATUS_FORBIDDEN]) ? 'disabled="disabled"' : '';
|
||||
}
|
||||
$selected = ($value === $key) ? 'selected="selected"' : '';
|
||||
$form_temps[] = "<option value=\"{$key}\"{$selected} {$disabled}>{$filterEntity->getTitle()}</option>";
|
||||
}
|
||||
|
||||
@ -20,9 +20,6 @@ class ServicePaymentHelper extends CustomerHelper
|
||||
case "countdown": //결제일Countdown
|
||||
$value = $viewDatas['entity']->getView_CounDueAt();
|
||||
break;
|
||||
case 'item_uid':
|
||||
$value = $viewDatas['control']['filter_optons'][$viewDatas['entity']->getItemType()][$value]->getTitle();
|
||||
break;
|
||||
case 'amount':
|
||||
$value = number_format($value);
|
||||
break;
|
||||
|
||||
@ -58,18 +58,13 @@ abstract class CommonService
|
||||
}
|
||||
return $this->_model;
|
||||
}
|
||||
//Entity의 관련객체정의용
|
||||
protected function setRelatedEntity(mixed $entity): mixed
|
||||
{
|
||||
return $entity;
|
||||
}
|
||||
public function getEntity(mixed $where, ?string $message = null): mixed
|
||||
{
|
||||
$entity = is_array($where) ? $this->getModel()->where($where)->first() : $this->getModel()->find($where);
|
||||
if (!$entity) {
|
||||
throw new \Exception($message ?? __METHOD__ . "에서 해당 정보가 존재하지 않습니다");
|
||||
}
|
||||
return $this->setRelatedEntity($entity);
|
||||
return $entity;
|
||||
}
|
||||
protected function findAllDatas(array $columns = ['*']): mixed
|
||||
{
|
||||
@ -82,7 +77,7 @@ abstract class CommonService
|
||||
}
|
||||
$entities = [];
|
||||
foreach ($this->findAllDatas($columns) as $entity) {
|
||||
$entities[$entity->getPK()] = $this->setRelatedEntity($entity);
|
||||
$entities[$entity->getPK()] = $entity;
|
||||
}
|
||||
if (env('app.debug.index')) {
|
||||
echo $this->getModel()->getLastQuery() . "<BR>";
|
||||
@ -100,12 +95,12 @@ abstract class CommonService
|
||||
foreach (lang($this->getClassName() . '.' . strtoupper($field)) as $key => $value) {
|
||||
$options[$key] = new FormOptionEntity(['uid' => $key, 'title' => $value]);
|
||||
}
|
||||
// dd($options);
|
||||
break;
|
||||
}
|
||||
if (!is_array($options)) {
|
||||
throw new \Exception(__FUNCTION__ . "에서 field의 options 값이 array가 아닙니다.\n" . var_export($options, true));
|
||||
}
|
||||
// dd($options);
|
||||
return $options;
|
||||
}
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
|
||||
@ -39,13 +39,6 @@ class AccountService extends CustomerService
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
//Entity의 관련객체정의용
|
||||
protected function setRelatedEntity(mixed $entity): AccountEntity
|
||||
{
|
||||
//고객정보정의
|
||||
$entity->setClient($this->getClient($entity->getClientUID()));
|
||||
return parent::setRelatedEntity($entity);
|
||||
}
|
||||
//기본 기능부분
|
||||
|
||||
//고객예치금처리
|
||||
|
||||
@ -38,13 +38,6 @@ class CouponService extends CustomerService
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
//Entity의 관련객체정의용
|
||||
protected function setRelatedEntity(mixed $entity): CouponEntity
|
||||
{
|
||||
//고객정보정의
|
||||
$entity->setClient($this->getClient($entity->getClientUID()));
|
||||
return parent::setRelatedEntity($entity);
|
||||
}
|
||||
//기본 기능부분
|
||||
|
||||
//고객예치금처리
|
||||
|
||||
@ -38,13 +38,6 @@ class PointService extends CustomerService
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
//Entity의 관련객체정의용
|
||||
protected function setRelatedEntity(mixed $entity): PointEntity
|
||||
{
|
||||
//고객정보정의
|
||||
$entity->setClient($this->getClient($entity->getClientUID()));
|
||||
return parent::setRelatedEntity($entity);
|
||||
}
|
||||
//기본 기능부분
|
||||
|
||||
private function setBalance(array $formDatas): ClientEntity
|
||||
|
||||
@ -49,15 +49,6 @@ class ServiceHistoryService extends CustomerService
|
||||
{
|
||||
return ['serviceinfo_uid', 'title', 'status', 'created_at'];
|
||||
}
|
||||
//Entity의 관련객체정의용
|
||||
protected function setRelatedEntity(mixed $entity): ServiceHistoryEntity
|
||||
{
|
||||
//서비스정보정의
|
||||
$entity->setService($this->getServiceService()->getEntity($entity->getServiceUid()));
|
||||
return parent::setRelatedEntity($entity);
|
||||
}
|
||||
//기본 기능부분
|
||||
|
||||
//FieldForm관련용
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
|
||||
@ -64,13 +64,6 @@ class ServiceItemService extends CustomerService
|
||||
return ['serviceinfo_uid', 'item_type', 'item_uid', 'billing_cycle', 'price', 'amount', 'start_at', 'updated_at', 'status'];
|
||||
}
|
||||
//Entity의 관련객체정의용
|
||||
protected function setRelatedEntity(mixed $entity): ServiceItemEntity
|
||||
{
|
||||
//서비스정보정의
|
||||
$entity->setService($this->getServiceService()->getEntity($entity->getServiceUid()));
|
||||
return parent::setRelatedEntity($entity);
|
||||
}
|
||||
//기본 기능부분
|
||||
//FieldForm관련용
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
|
||||
@ -58,14 +58,6 @@ class ServicePaymentService extends CustomerService
|
||||
return $this->_serviceService;
|
||||
}
|
||||
//Entity의 관련객체정의용
|
||||
protected function setRelatedEntity(mixed $entity): ServicePaymentEntity
|
||||
{
|
||||
//서비스정보정의
|
||||
$entity->setService($this->getServiceService()->getEntity($entity->getServiceUid()));
|
||||
//관리자정보정의
|
||||
$entity->setOwner($this->getClient($entity->getOwnerUID()));
|
||||
return parent::setRelatedEntity($entity);
|
||||
}
|
||||
//기본 기능부분
|
||||
//FieldForm관련용
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
|
||||
@ -60,14 +60,6 @@ class ServiceService extends CustomerService
|
||||
return $this->_codeService;
|
||||
}
|
||||
//Entity의 관련객체정의용
|
||||
protected function setRelatedEntity(mixed $entity): ServiceEntity
|
||||
{
|
||||
//고객정보정의
|
||||
$entity->setClient($this->getClient($entity->getClientUID()));
|
||||
//관리자정보정의
|
||||
$entity->setOwner($this->getClient($entity->getOwnerUID()));
|
||||
return parent::setRelatedEntity($entity);
|
||||
}
|
||||
public function setSearchIp(string $ip): void
|
||||
{
|
||||
$this->_searchIP = $ip;
|
||||
|
||||
@ -67,7 +67,6 @@ class MyLogService extends CommonService
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
// dd($options);
|
||||
return $options;
|
||||
}
|
||||
public function save($service, string $method, AuthService $myauth, string $title): MyLogEntity
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<nav class="condition nav">
|
||||
조건:
|
||||
<?php foreach ($viewDatas['control']['filter_fields'] as $field): ?>
|
||||
<?= $viewDatas['helper']->getFieldForm($field, $viewDatas[$field] ? $viewDatas[$field] : old($field), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm($field, $viewDatas[$field] ? $viewDatas[$field] : old($field), $viewDatas, ['index_content_top_filter' => 'true']) ?>
|
||||
<?php endforeach ?>
|
||||
<button class="btn btn-outline-primary" type="submit">검색</button>
|
||||
</nav>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user