dbmsv4 init...4
This commit is contained in:
parent
daf9e0a894
commit
3c9d6d78d1
@ -31,4 +31,8 @@ class UserSNSEntity extends CommonEntity
|
|||||||
{
|
{
|
||||||
return $this->attributes['email'];
|
return $this->attributes['email'];
|
||||||
}
|
}
|
||||||
|
public function getParent(): int|string
|
||||||
|
{
|
||||||
|
return $this->attributes['user_uid'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,7 +92,8 @@ abstract class CommonForm
|
|||||||
}
|
}
|
||||||
final public function setIndexFilters(array $fields): void
|
final public function setIndexFilters(array $fields): void
|
||||||
{
|
{
|
||||||
$this->_indexFilters = $fields;;
|
$this->_indexFilters = $fields;
|
||||||
|
;
|
||||||
}
|
}
|
||||||
final public function getIndexFilters(): array
|
final public function getIndexFilters(): array
|
||||||
{
|
{
|
||||||
@ -100,7 +101,8 @@ abstract class CommonForm
|
|||||||
}
|
}
|
||||||
final public function setBatchjobFilters(array $fields): void
|
final public function setBatchjobFilters(array $fields): void
|
||||||
{
|
{
|
||||||
$this->_batchjobFilters = $fields;;
|
$this->_batchjobFilters = $fields;
|
||||||
|
;
|
||||||
}
|
}
|
||||||
final public function getBatchjobFilters(): array
|
final public function getBatchjobFilters(): array
|
||||||
{
|
{
|
||||||
@ -136,12 +138,18 @@ abstract class CommonForm
|
|||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: Validation 서비스가 초기화되지 않았습니다.");
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: Validation 서비스가 초기화되지 않았습니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$dynamicRules = [];
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$dynamicRules = [];
|
||||||
|
|
||||||
|
// 0. Ensure all scalar inputs are strings to prevent trim() error on PHP 8.1+
|
||||||
|
foreach ($formDatas as $key => $value) {
|
||||||
|
if (is_scalar($value) && !is_string($value)) {
|
||||||
|
$formDatas[$key] = (string) $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
// 1. 현재 서비스의 필드 라벨 정보 로드 (언어 파일 기반)
|
// 1. 현재 서비스의 필드 라벨 정보 로드 (언어 파일 기반)
|
||||||
$formFields = $this->getFormFields();
|
$formFields = $this->getFormFields();
|
||||||
$formRules = $this->getFormRules();
|
$formRules = $this->getFormRules();
|
||||||
|
|
||||||
if (empty($formRules)) {
|
if (empty($formRules)) {
|
||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 지정된 Form RULE이 없습니다.");
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 지정된 Form RULE이 없습니다.");
|
||||||
@ -222,11 +230,11 @@ abstract class CommonForm
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case $this->getAttribute('title_field'):
|
case $this->getAttribute('title_field'):
|
||||||
$formRules[$field] = sprintf("required|trim|string%s", in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->getAttribute('table')}.{$field}]" : "");
|
$formRules[$field] = sprintf("required|trim|string%s", in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->getAttribute('table')}.{$field}]" : "");
|
||||||
break;
|
break;
|
||||||
case "code":
|
case "code":
|
||||||
// a-zA-Z → 영문 대소문자,0-9 → 숫자,가-힣 → 한글 완성형,\- → 하이픈
|
// a-zA-Z → 영문 대소문자,0-9 → 숫자,가-힣 → 한글 완성형,\- → 하이픈
|
||||||
$formRules[$field] = sprintf("required|regex_match[/^[a-zA-Z0-9가-힣\-\_]+$/]|min_length[4]%s", in_array($action, ["create"]) ? "|is_unique[{$this->getAttribute('table')}.{$field}]" : "");
|
$formRules[$field] = sprintf("required|regex_match[/^[a-zA-Z0-9가-힣\-\_]+$/]|min_length[4]%s", in_array($action, ["create"]) ? "|is_unique[{$this->getAttribute('table')}.{$field}]" : "");
|
||||||
break;
|
break;
|
||||||
case "user_uid":
|
case "user_uid":
|
||||||
$formRules[$field] = "required|numeric";
|
$formRules[$field] = "required|numeric";
|
||||||
@ -234,18 +242,18 @@ abstract class CommonForm
|
|||||||
case "clientinfo_uid":
|
case "clientinfo_uid":
|
||||||
case "serviceinfo_uid":
|
case "serviceinfo_uid":
|
||||||
case "serverinfo_uid":
|
case "serverinfo_uid":
|
||||||
$formRules[$field] = "permit_empty|numeric";
|
$formRules[$field] = "permit_empty|numeric";
|
||||||
break;
|
break;
|
||||||
case 'picture':
|
case 'picture':
|
||||||
$formRules[$field] = "is_image[{$field}]|mime_in[{$field},image/jpg,image/jpeg,image/gif,image/png,image/webp]|max_size[{$field},300]|max_dims[{$field},2048,768]";
|
$formRules[$field] = "is_image[{$field}]|mime_in[{$field},image/jpg,image/jpeg,image/gif,image/png,image/webp]|max_size[{$field},300]|max_dims[{$field},2048,768]";
|
||||||
break;
|
break;
|
||||||
case "updated_at":
|
case "updated_at":
|
||||||
case "created_at":
|
case "created_at":
|
||||||
case "deleted_at":
|
case "deleted_at":
|
||||||
$formRules[$field] = "permit_empty|trim|valid_date";
|
$formRules[$field] = "permit_empty|trim|valid_date";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$formRules[$field] = "permit_empty|trim|string";
|
$formRules[$field] = "permit_empty|trim|string";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $formRules;
|
return $formRules;
|
||||||
@ -257,9 +265,9 @@ abstract class CommonForm
|
|||||||
default:
|
default:
|
||||||
if (in_array($action, ['create_form', 'modify_form', 'alternative_create_form'])) {
|
if (in_array($action, ['create_form', 'modify_form', 'alternative_create_form'])) {
|
||||||
if (array_key_exists($field, $formDatas)) {
|
if (array_key_exists($field, $formDatas)) {
|
||||||
$where = sprintf("status = '%s' OR %s='%s'", STATUS['AVAILABLE'], $this->getAttribute('pk_field'), $formDatas[$field]);
|
$where = sprintf("status = '%s' OR %s='%s'", STATUS['AVAILABLE'], $this->getAttribute('pk_field'), $formDatas[$field]);
|
||||||
} else {
|
} else {
|
||||||
$where = sprintf("status = '%s'", STATUS['AVAILABLE']);
|
$where = sprintf("status = '%s'", STATUS['AVAILABLE']);
|
||||||
}
|
}
|
||||||
$entities = $service->getEntities([$where => null]);
|
$entities = $service->getEntities([$where => null]);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -23,13 +23,14 @@ abstract class PartForm extends CommonForm
|
|||||||
break;
|
break;
|
||||||
case "price":
|
case "price":
|
||||||
case "stock":
|
case "stock":
|
||||||
|
case "used":
|
||||||
$formRules[$field] = "required|numeric";
|
$formRules[$field] = "required|numeric";
|
||||||
break;
|
break;
|
||||||
case "status":
|
case "status":
|
||||||
$formRules[$field] = "permit_empty|trim|string";
|
$formRules[$field] = "permit_empty|trim|string";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$formRules = parent::getFormRule($action, $field, $formRules);
|
$formRules = parent::getFormRule($action, $field, $formRules);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $formRules;
|
return $formRules;
|
||||||
|
|||||||
@ -11,7 +11,8 @@ use App\Services\CommonService;
|
|||||||
|
|
||||||
abstract class AuthService extends CommonService
|
abstract class AuthService extends CommonService
|
||||||
{
|
{
|
||||||
private $_helper = null;
|
protected string $helperClass = AuthHelper::class;
|
||||||
|
|
||||||
protected function __construct(CommonModel $model)
|
protected function __construct(CommonModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -21,22 +22,9 @@ abstract class AuthService extends CommonService
|
|||||||
{
|
{
|
||||||
return UserEntity::class;
|
return UserEntity::class;
|
||||||
}
|
}
|
||||||
abstract public function getFormService(): mixed;
|
|
||||||
final public function getHelper(): AuthHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new AuthHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//로그인
|
//로그인
|
||||||
abstract protected function login_process(array $formDatas): UserEntity;
|
abstract protected function login_process(array $formDatas): UserEntity;
|
||||||
final public function login(LocalDTO|GoogleDTO $dto): UserEntity
|
final public function login(LocalDTO|GoogleDTO $dto): UserEntity
|
||||||
{
|
{
|
||||||
$entity = $this->login_process($dto->toArray());
|
$entity = $this->login_process($dto->toArray());
|
||||||
//인증 세션처리
|
//인증 세션처리
|
||||||
|
|||||||
@ -11,7 +11,8 @@ use CodeIgniter\Exceptions\PageNotFoundException;
|
|||||||
|
|
||||||
class GoogleService extends AuthService
|
class GoogleService extends AuthService
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = GoogleForm::class;
|
||||||
|
|
||||||
public function __construct(UserModel $model, private CURL $socket)
|
public function __construct(UserModel $model, private CURL $socket)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -25,20 +26,6 @@ class GoogleService extends AuthService
|
|||||||
{
|
{
|
||||||
return GoogleDTO::class;
|
return GoogleDTO::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): GoogleForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new GoogleForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
protected function getEntity_process(mixed $entity): UserEntity
|
protected function getEntity_process(mixed $entity): UserEntity
|
||||||
{
|
{
|
||||||
return $entity;
|
return $entity;
|
||||||
|
|||||||
@ -10,7 +10,8 @@ use RuntimeException;
|
|||||||
|
|
||||||
class LocalService extends AuthService
|
class LocalService extends AuthService
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = LocalForm::class;
|
||||||
|
|
||||||
public function __construct(UserModel $model)
|
public function __construct(UserModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -24,20 +25,6 @@ class LocalService extends AuthService
|
|||||||
{
|
{
|
||||||
return LocalDTO::class;
|
return LocalDTO::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): LocalForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new LocalForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
protected function getEntity_process(mixed $entity): UserEntity
|
protected function getEntity_process(mixed $entity): UserEntity
|
||||||
{
|
{
|
||||||
return $entity;
|
return $entity;
|
||||||
|
|||||||
@ -10,8 +10,9 @@ use App\DTOs\BoardDTO;
|
|||||||
|
|
||||||
class BoardService extends CommonService
|
class BoardService extends CommonService
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = BoardForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = BoardHelper::class;
|
||||||
|
|
||||||
public function __construct(BoardModel $model)
|
public function __construct(BoardModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -29,47 +30,11 @@ class BoardService extends CommonService
|
|||||||
{
|
{
|
||||||
return BoardEntity::class;
|
return BoardEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): BoardForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new BoardForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->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->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
protected function getEntity_process(mixed $entity): BoardEntity
|
protected function getEntity_process(mixed $entity): BoardEntity
|
||||||
{
|
{
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
protected function create_process(array $formDatas): BoardEntity
|
|
||||||
{
|
|
||||||
return parent::create_process($formDatas);
|
|
||||||
}
|
|
||||||
protected function modify_process($entity, array $formDatas): BoardEntity
|
|
||||||
{
|
|
||||||
return parent::modify_process($entity, $formDatas);
|
|
||||||
}
|
|
||||||
//List 검색용
|
//List 검색용
|
||||||
//FormFilter 조건절 처리
|
//FormFilter 조건절 처리
|
||||||
//검색어조건절처리
|
//검색어조건절처리
|
||||||
|
|||||||
@ -18,12 +18,80 @@ abstract class CommonService
|
|||||||
private ?AuthContext $_authContext = null;
|
private ?AuthContext $_authContext = null;
|
||||||
private array $_classPaths = [];
|
private array $_classPaths = [];
|
||||||
protected $title = null;
|
protected $title = null;
|
||||||
protected function __construct(protected CommonModel $model) {}
|
|
||||||
|
protected ?object $_form = null;
|
||||||
|
protected ?object $_helper = null;
|
||||||
|
|
||||||
|
protected string $formClass = '';
|
||||||
|
protected string $helperClass = '';
|
||||||
|
|
||||||
|
protected function __construct(protected CommonModel $model)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
abstract public function getDTOClass(): string;
|
abstract public function getDTOClass(): string;
|
||||||
abstract public function createDTO(array $formDatas): CommonDTO;
|
abstract public function createDTO(array $formDatas): CommonDTO;
|
||||||
abstract public function getEntityClass(): string;
|
abstract public function getEntityClass(): string;
|
||||||
abstract public function getFormService(): mixed;
|
|
||||||
abstract public function getHelper(): mixed;
|
/**
|
||||||
|
* 공통 트랜잭션 래퍼
|
||||||
|
*/
|
||||||
|
final protected function dbTransaction(callable $callback, string $functionName = ''): mixed
|
||||||
|
{
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
try {
|
||||||
|
$db->transException(true)->transStart();
|
||||||
|
$result = $callback($db);
|
||||||
|
$db->transComplete();
|
||||||
|
return $result;
|
||||||
|
} catch (DatabaseException $e) {
|
||||||
|
$errorMessage = sprintf(
|
||||||
|
"\n----[%s]에서 트랜잭션 실패: DB 오류----\n%s\n%s\n------------------------------\n",
|
||||||
|
static::class . '->' . ($functionName ?: 'dbTransaction'),
|
||||||
|
$this->model->getLastQuery() ?? "No Query Available",
|
||||||
|
$e->getMessage()
|
||||||
|
);
|
||||||
|
log_message('error', $errorMessage);
|
||||||
|
throw new RuntimeException($errorMessage, $e->getCode(), $e);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
$db->transRollback();
|
||||||
|
throw new RuntimeException($e->getMessage(), $e->getCode(), $e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFormService(): mixed
|
||||||
|
{
|
||||||
|
if ($this->_form === null && $this->formClass) {
|
||||||
|
$this->_form = new $this->formClass();
|
||||||
|
if (method_exists($this->_form, 'setAttributes')) {
|
||||||
|
$this->_form->setAttributes([
|
||||||
|
'pk_field' => $this->getPKField(),
|
||||||
|
'title_field' => $this->getTitleField(),
|
||||||
|
'table' => $this->model->getTable(),
|
||||||
|
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
||||||
|
'class_path' => $this->getClassPaths(false)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->_form;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHelper(): mixed
|
||||||
|
{
|
||||||
|
if ($this->_helper === null && $this->helperClass) {
|
||||||
|
$this->_helper = new $this->helperClass();
|
||||||
|
if (method_exists($this->_helper, 'setAttributes')) {
|
||||||
|
$this->_helper->setAttributes([
|
||||||
|
'pk_field' => $this->getPKField(),
|
||||||
|
'title_field' => $this->getTitleField(),
|
||||||
|
'table' => $this->model->getTable(),
|
||||||
|
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
||||||
|
'class_path' => $this->getClassPaths(false)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->_helper;
|
||||||
|
}
|
||||||
final public function getAuthContext(): AuthContext
|
final public function getAuthContext(): AuthContext
|
||||||
{
|
{
|
||||||
if ($this->_authContext === null) {
|
if ($this->_authContext === null) {
|
||||||
@ -37,11 +105,11 @@ abstract class CommonService
|
|||||||
}
|
}
|
||||||
final public function getPKField(): string
|
final public function getPKField(): string
|
||||||
{
|
{
|
||||||
return $this->model->getPKField();
|
return $this->model->getPKField();
|
||||||
}
|
}
|
||||||
final public function getTitleField(): string
|
final public function getTitleField(): string
|
||||||
{
|
{
|
||||||
return $this->model->getTitleField();
|
return $this->model->getTitleField();
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function getClassPaths($isArray = true, $delimeter = DIRECTORY_SEPARATOR): array|string
|
final public function getClassPaths($isArray = true, $delimeter = DIRECTORY_SEPARATOR): array|string
|
||||||
@ -50,9 +118,9 @@ abstract class CommonService
|
|||||||
}
|
}
|
||||||
final public function getNextPK(): int
|
final public function getNextPK(): int
|
||||||
{
|
{
|
||||||
$pkField = $this->getPKField();
|
$pkField = $this->getPKField();
|
||||||
$row = $this->model->selectMax($pkField)->get()->getRow();
|
$row = $this->model->selectMax($pkField)->get()->getRow();
|
||||||
return isset($row->{$pkField}) ? ((int)$row->{$pkField} + 1) : 1;
|
return isset($row->{$pkField}) ? ((int) $row->{$pkField} + 1) : 1;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 단일 엔티티를 조회합니다.
|
* 단일 엔티티를 조회합니다.
|
||||||
@ -149,9 +217,9 @@ abstract class CommonService
|
|||||||
if ($insertID > 0) {
|
if ($insertID > 0) {
|
||||||
$pk = $insertID;
|
$pk = $insertID;
|
||||||
}
|
}
|
||||||
} elseif ($this->model->useAutoIncrement() && is_numeric($result) && (int)$result > 0) {
|
} elseif ($this->model->useAutoIncrement() && is_numeric($result) && (int) $result > 0) {
|
||||||
// save()가 성공적인 INSERT 후 PK를 반환하는 경우를 대비 (CI4의 동작)
|
// save()가 성공적인 INSERT 후 PK를 반환하는 경우를 대비 (CI4의 동작)
|
||||||
$pk = (int)$result;
|
$pk = (int) $result;
|
||||||
}
|
}
|
||||||
// 최종적으로 PK가 유효한지 확인합니다.
|
// 최종적으로 PK가 유효한지 확인합니다.
|
||||||
if (empty($pk)) {
|
if (empty($pk)) {
|
||||||
@ -179,10 +247,10 @@ abstract class CommonService
|
|||||||
protected function create_process(array $formDatas): CommonEntity
|
protected function create_process(array $formDatas): CommonEntity
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->getFormService()->action_init_process('create', $formDatas);
|
if ($formService = $this->getFormService()) {
|
||||||
// 데이터 검증
|
$formService->action_init_process('create', $formDatas);
|
||||||
$this->getFormService()->validate($formDatas);
|
$formService->validate($formDatas);
|
||||||
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
|
}
|
||||||
$entityClass = $this->getEntityClass();
|
$entityClass = $this->getEntityClass();
|
||||||
$entity = new $entityClass($formDatas);
|
$entity = new $entityClass($formDatas);
|
||||||
if (!$entity instanceof $entityClass) {
|
if (!$entity instanceof $entityClass) {
|
||||||
@ -193,44 +261,29 @@ abstract class CommonService
|
|||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:" . $e->getMessage());
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:" . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function create(array $formDatas): CommonEntity
|
final public function create(array $formDatas): CommonEntity
|
||||||
{
|
{
|
||||||
$db = \Config\Database::connect();
|
return $this->dbTransaction(function () use ($formDatas) {
|
||||||
try {
|
|
||||||
//트랜잭션 도중 DB 오류가 발생하면 DatabaseException을 던지도록 설정
|
|
||||||
$db->transException(true)->transStart();
|
|
||||||
//관리자 정보추가용
|
|
||||||
$formDatas['user_uid'] = $this->getAuthContext()->getUID();
|
$formDatas['user_uid'] = $this->getAuthContext()->getUID();
|
||||||
$entity = $this->create_process($formDatas);
|
return $this->create_process($formDatas);
|
||||||
$db->transComplete();
|
}, __FUNCTION__);
|
||||||
return $entity;
|
|
||||||
} catch (DatabaseException $e) {
|
|
||||||
// DatabaseException을 포착하면 자동으로 롤백 처리됨
|
|
||||||
throw new RuntimeException(sprintf(
|
|
||||||
"\n----[%s]에서 트랜잭션 실패: DB 오류----\n%s\n%s\n------------------------------\n",
|
|
||||||
static::class . '->' . __FUNCTION__,
|
|
||||||
$this->model->getLastQuery(),
|
|
||||||
$e->getMessage()
|
|
||||||
), $e->getCode(), $e);
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
$db->transRollback(); // 예외 발생 시 수동으로 롤백
|
|
||||||
throw new RuntimeException($e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//수정용
|
//수정용
|
||||||
protected function modify_process($entity, array $formDatas): CommonEntity
|
protected function modify_process($entity, array $formDatas): CommonEntity
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->getFormService()->action_init_process('modify', $formDatas);
|
if ($formService = $this->getFormService()) {
|
||||||
// 2. 사용자 입력값(formDatas)을 Entity에 주입
|
$formService->action_init_process('modify', $formDatas);
|
||||||
// fill()을 사용하면 Entity 내부에서 어떤 값이 변경되었는지(Dirty) 추적 시작
|
}
|
||||||
$entity->fill($formDatas);
|
$entity->fill($formDatas);
|
||||||
if (!$entity->hasChanged()) {
|
if (!$entity->hasChanged()) {
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
// 데이터 검증
|
if ($formService = $this->getFormService()) {
|
||||||
$this->getFormService()->validate($entity->toArray());
|
$formService->validate($entity->toArray());
|
||||||
|
}
|
||||||
return $this->save_process($entity);
|
return $this->save_process($entity);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:" . $e->getMessage() . "\n" . var_export($entity));
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:" . $e->getMessage() . "\n" . var_export($entity));
|
||||||
@ -239,31 +292,14 @@ abstract class CommonService
|
|||||||
|
|
||||||
final public function modify(string|int $uid, array $formDatas): CommonEntity
|
final public function modify(string|int $uid, array $formDatas): CommonEntity
|
||||||
{
|
{
|
||||||
$db = \Config\Database::connect();
|
return $this->dbTransaction(function () use ($uid, $formDatas) {
|
||||||
try {
|
|
||||||
$db->transException(true)->transStart();
|
|
||||||
$entity = $this->getEntity($uid);
|
$entity = $this->getEntity($uid);
|
||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
|
||||||
}
|
}
|
||||||
//관리자 정보추가용
|
|
||||||
$formDatas['user_uid'] = $this->getAuthContext()->getUID();
|
$formDatas['user_uid'] = $this->getAuthContext()->getUID();
|
||||||
$entity = $this->modify_process($entity, $formDatas);
|
return $this->modify_process($entity, $formDatas);
|
||||||
// 트랜잭션 완료 및 커밋
|
}, __FUNCTION__);
|
||||||
$db->transComplete();
|
|
||||||
return $entity;
|
|
||||||
} catch (DatabaseException $e) {
|
|
||||||
// DatabaseException을 포착하면 자동으로 롤백 처리됨
|
|
||||||
throw new RuntimeException(sprintf(
|
|
||||||
"\n----[%s]에서 트랜잭션 실패: DB 오류----\n%s\n%s\n------------------------------\n",
|
|
||||||
static::class . '->' . __FUNCTION__,
|
|
||||||
$this->model->getLastQuery(),
|
|
||||||
$e->getMessage()
|
|
||||||
), $e->getCode(), $e);
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
$db->transRollback(); // 예외 발생 시 수동으로 롤백
|
|
||||||
throw new RuntimeException($e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//배치 작업용 수정
|
//배치 작업용 수정
|
||||||
@ -274,30 +310,22 @@ abstract class CommonService
|
|||||||
}
|
}
|
||||||
final public function batchjob(array $uids, array $formDatas): array
|
final public function batchjob(array $uids, array $formDatas): array
|
||||||
{
|
{
|
||||||
$db = \Config\Database::connect();
|
return $this->dbTransaction(function () use ($uids, $formDatas) {
|
||||||
try {
|
|
||||||
//트랜잭션 도중 DB 오류가 발생하면 DatabaseException을 던지도록 설정
|
|
||||||
$db->transException(true)->transStart();
|
|
||||||
$entities = [];
|
$entities = [];
|
||||||
foreach ($uids as $uid) {
|
foreach ($uids as $uid) {
|
||||||
$entity = $this->getEntity($uid);
|
$entity = $this->getEntity($uid);
|
||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
|
||||||
}
|
}
|
||||||
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
|
|
||||||
$entityClass = $this->getEntityClass();
|
$entityClass = $this->getEntityClass();
|
||||||
if (!$entity instanceof $entityClass) {
|
if (!$entity instanceof $entityClass) {
|
||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
||||||
}
|
}
|
||||||
//관리자 정보추가용
|
|
||||||
$formDatas['user_uid'] = $this->getAuthContext()->getUID();
|
$formDatas['user_uid'] = $this->getAuthContext()->getUID();
|
||||||
$entities[] = $this->batchjob_process($entity, $formDatas);
|
$entities[] = $this->batchjob_process($entity, $formDatas);
|
||||||
}
|
}
|
||||||
return $entities;
|
return $entities;
|
||||||
} catch (\Throwable $e) {
|
}, __FUNCTION__);
|
||||||
$db->transRollback(); // 예외 발생 시 수동으로 롤백
|
|
||||||
throw new RuntimeException($e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//삭제용 (일반)
|
//삭제용 (일반)
|
||||||
@ -314,8 +342,7 @@ abstract class CommonService
|
|||||||
}
|
}
|
||||||
final public function delete(string|int $uid): CommonEntity
|
final public function delete(string|int $uid): CommonEntity
|
||||||
{
|
{
|
||||||
$db = \Config\Database::connect();
|
return $this->dbTransaction(function () use ($uid) {
|
||||||
try {
|
|
||||||
if (!$uid) {
|
if (!$uid) {
|
||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 삭제에 필요한 PrimaryKey 가 정의 되지 않았습니다.");
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 삭제에 필요한 PrimaryKey 가 정의 되지 않았습니다.");
|
||||||
}
|
}
|
||||||
@ -323,28 +350,12 @@ abstract class CommonService
|
|||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
|
||||||
}
|
}
|
||||||
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
|
|
||||||
$entityClass = $this->getEntityClass();
|
$entityClass = $this->getEntityClass();
|
||||||
if (!$entity instanceof $entityClass) {
|
if (!$entity instanceof $entityClass) {
|
||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
||||||
}
|
}
|
||||||
$db->transException(true)->transStart();
|
return $this->delete_process($entity);
|
||||||
$entity = $this->delete_process($entity);
|
}, __FUNCTION__);
|
||||||
// 트랜잭션 완료 및 커밋
|
|
||||||
$db->transComplete();
|
|
||||||
return $entity;
|
|
||||||
} catch (DatabaseException $e) {
|
|
||||||
// DatabaseException을 포착하면 자동으로 롤백 처리됨
|
|
||||||
throw new RuntimeException(sprintf(
|
|
||||||
"\n----[%s]에서 트랜잭션 실패: DB 오류----\n%s\n%s\n------------------------------\n",
|
|
||||||
__FUNCTION__,
|
|
||||||
$this->model->getLastQuery(),
|
|
||||||
$e->getMessage()
|
|
||||||
), $e->getCode(), $e);
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
$db->transRollback(); // 예외 발생 시 수동으로 롤백
|
|
||||||
throw new RuntimeException($e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//삭제용 (배치 작업)
|
//삭제용 (배치 작업)
|
||||||
@ -356,38 +367,21 @@ abstract class CommonService
|
|||||||
|
|
||||||
final public function batchjob_delete(array $uids): array
|
final public function batchjob_delete(array $uids): array
|
||||||
{
|
{
|
||||||
$db = \Config\Database::connect();
|
return $this->dbTransaction(function () use ($uids) {
|
||||||
try {
|
|
||||||
$db->transException(true)->transStart();
|
|
||||||
//일괄작업처리
|
|
||||||
$entities = [];
|
$entities = [];
|
||||||
foreach ($uids as $uid) {
|
foreach ($uids as $uid) {
|
||||||
$entity = $this->getEntity($uid);
|
$entity = $this->getEntity($uid);
|
||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
|
||||||
}
|
}
|
||||||
// 💡 동적으로 가져온 Entity 클래스 이름으로 instanceof 검사
|
|
||||||
$entityClass = $this->getEntityClass();
|
$entityClass = $this->getEntityClass();
|
||||||
if (!$entity instanceof $entityClass) {
|
if (!$entity instanceof $entityClass) {
|
||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
||||||
}
|
}
|
||||||
$entities[] = $this->batchjob_delete_process($entity);
|
$entities[] = $this->batchjob_delete_process($entity);
|
||||||
}
|
}
|
||||||
// 트랜잭션 완료 및 커밋
|
|
||||||
$db->transComplete();
|
|
||||||
return $entities;
|
return $entities;
|
||||||
} catch (DatabaseException $e) {
|
}, __FUNCTION__);
|
||||||
// DatabaseException을 포착하면 자동으로 롤백 처리됨
|
|
||||||
throw new RuntimeException(sprintf(
|
|
||||||
"\n----[%s]에서 트랜잭션 실패: DB 오류----\n%s\n%s\n------------------------------\n",
|
|
||||||
__FUNCTION__,
|
|
||||||
$this->model->getLastQuery(),
|
|
||||||
$e->getMessage()
|
|
||||||
), $e->getCode(), $e);
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
$db->transRollback(); // 예외 발생 시 수동으로 롤백
|
|
||||||
throw new RuntimeException($e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Index용
|
//Index용
|
||||||
@ -430,7 +424,7 @@ abstract class CommonService
|
|||||||
if ($field !== null && $value !== null) {
|
if ($field !== null && $value !== null) {
|
||||||
$this->model->orderBy(sprintf("%s.%s %s", $this->model->getTable(), $field, $value));
|
$this->model->orderBy(sprintf("%s.%s %s", $this->model->getTable(), $field, $value));
|
||||||
} else {
|
} else {
|
||||||
$this->model->orderBy(sprintf("%s.%s %s", $this->model->getTable(), $this->getPKField(), "DESC"));
|
$this->model->orderBy(sprintf("%s.%s %s", $this->model->getTable(), $this->getPKField(), "DESC"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,8 +12,9 @@ use RuntimeException;
|
|||||||
|
|
||||||
class ClientService extends CustomerService
|
class ClientService extends CustomerService
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = ClientForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = ClientHelper::class;
|
||||||
|
|
||||||
public function __construct(ClientModel $model)
|
public function __construct(ClientModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -31,34 +32,6 @@ class ClientService extends CustomerService
|
|||||||
{
|
{
|
||||||
return ClientEntity::class;
|
return ClientEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): ClientForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new ClientForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): ClientHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new ClientHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
protected function getEntity_process(mixed $entity): ClientEntity
|
protected function getEntity_process(mixed $entity): ClientEntity
|
||||||
{
|
{
|
||||||
|
|||||||
@ -13,8 +13,9 @@ use RuntimeException;
|
|||||||
|
|
||||||
class ServiceService extends CustomerService
|
class ServiceService extends CustomerService
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = ServiceForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = ServiceHelper::class;
|
||||||
|
|
||||||
public function __construct(ServiceModel $model)
|
public function __construct(ServiceModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -32,34 +33,6 @@ class ServiceService extends CustomerService
|
|||||||
{
|
{
|
||||||
return ServiceEntity::class;
|
return ServiceEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): ServiceForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new ServiceForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->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->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//추가 기능
|
//추가 기능
|
||||||
//interval을 기준으로 최근 신규 서비스정보 가져오기
|
//interval을 기준으로 최근 신규 서비스정보 가져오기
|
||||||
final public function getNewServiceEntities(int $interval, string $status = STATUS['AVAILABLE']): array
|
final public function getNewServiceEntities(int $interval, string $status = STATUS['AVAILABLE']): array
|
||||||
@ -90,17 +63,17 @@ class ServiceService extends CustomerService
|
|||||||
// 입력된 날짜를 DateTime 객체로 변환
|
// 입력된 날짜를 DateTime 객체로 변환
|
||||||
$date = new DateTimeImmutable($entity->getBillingAt(), new DateTimeZone('Asia/Tokyo'));
|
$date = new DateTimeImmutable($entity->getBillingAt(), new DateTimeZone('Asia/Tokyo'));
|
||||||
// 현재 일(day)을 저장
|
// 현재 일(day)을 저장
|
||||||
$day = (int)$date->format('d');
|
$day = (int) $date->format('d');
|
||||||
// 다음달로 이동 (DateInterval 사용)
|
// 다음달로 이동 (DateInterval 사용)
|
||||||
$date->modify('first day of next month');
|
$date->modify('first day of next month');
|
||||||
// 다음달의 마지막 날 계산
|
// 다음달의 마지막 날 계산
|
||||||
$lastDayOfNextMonth = (int)$date->format('t');
|
$lastDayOfNextMonth = (int) $date->format('t');
|
||||||
// 현재 날짜가 다음달의 마지막 날보다 크면 -> 마지막 날로 설정
|
// 현재 날짜가 다음달의 마지막 날보다 크면 -> 마지막 날로 설정
|
||||||
if ($day > $lastDayOfNextMonth) {
|
if ($day > $lastDayOfNextMonth) {
|
||||||
$day = $lastDayOfNextMonth;
|
$day = $lastDayOfNextMonth;
|
||||||
}
|
}
|
||||||
// 일(day)을 설정
|
// 일(day)을 설정
|
||||||
$date->setDate((int)$date->format('Y'), (int)$date->format('m'), $day);
|
$date->setDate((int) $date->format('Y'), (int) $date->format('m'), $day);
|
||||||
// 최종 결과 리턴 (YYYY-MM-DD)
|
// 최종 결과 리턴 (YYYY-MM-DD)
|
||||||
return $date->format('Y-m-d');
|
return $date->format('Y-m-d');
|
||||||
}
|
}
|
||||||
@ -109,7 +82,7 @@ class ServiceService extends CustomerService
|
|||||||
{
|
{
|
||||||
//총 서비스금액 구하기
|
//총 서비스금액 구하기
|
||||||
$server_amount = service('equipment_serverservice')->getCalculatedAmount($serverinfo_uid);
|
$server_amount = service('equipment_serverservice')->getCalculatedAmount($serverinfo_uid);
|
||||||
return (int)$server_amount + $rack_price + $line_price - $sale_price;
|
return (int) $server_amount + $rack_price + $line_price - $sale_price;
|
||||||
}
|
}
|
||||||
final public function updateAmount(ServiceEntity $entity): ServiceEntity
|
final public function updateAmount(ServiceEntity $entity): ServiceEntity
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,8 +14,9 @@ use RuntimeException;
|
|||||||
class AccountService extends WalletService
|
class AccountService extends WalletService
|
||||||
{
|
{
|
||||||
const CLIENTINFO_BALANCE_FIELD = 'account_balance';
|
const CLIENTINFO_BALANCE_FIELD = 'account_balance';
|
||||||
private $_form = null;
|
protected string $formClass = AccountForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = AccountHelper::class;
|
||||||
|
|
||||||
public function __construct(AccountModel $model)
|
public function __construct(AccountModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -33,34 +34,6 @@ class AccountService extends WalletService
|
|||||||
{
|
{
|
||||||
return AccountEntity::class;
|
return AccountEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): AccountForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new AccountForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): AccountHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new AccountHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
protected function getEntity_process(mixed $entity): AccountEntity
|
protected function getEntity_process(mixed $entity): AccountEntity
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,8 +14,9 @@ use RuntimeException;
|
|||||||
class CouponService extends WalletService
|
class CouponService extends WalletService
|
||||||
{
|
{
|
||||||
const CLIENTINFO_BALANCE_FIELD = 'coupon_balance';
|
const CLIENTINFO_BALANCE_FIELD = 'coupon_balance';
|
||||||
private $_form = null;
|
protected string $formClass = CouponForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = CouponHelper::class;
|
||||||
|
|
||||||
public function __construct(CouponModel $model)
|
public function __construct(CouponModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -33,34 +34,6 @@ class CouponService extends WalletService
|
|||||||
{
|
{
|
||||||
return CouponEntity::class;
|
return CouponEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): CouponForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new CouponForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): CouponHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new CouponHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
protected function getEntity_process(mixed $entity): CouponEntity
|
protected function getEntity_process(mixed $entity): CouponEntity
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,8 +14,9 @@ use RuntimeException;
|
|||||||
class PointService extends WalletService
|
class PointService extends WalletService
|
||||||
{
|
{
|
||||||
const CLIENTINFO_BALANCE_FIELD = 'point_balance';
|
const CLIENTINFO_BALANCE_FIELD = 'point_balance';
|
||||||
private $_form = null;
|
protected string $formClass = PointForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = PointHelper::class;
|
||||||
|
|
||||||
public function __construct(PointModel $model)
|
public function __construct(PointModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -33,34 +34,6 @@ class PointService extends WalletService
|
|||||||
{
|
{
|
||||||
return PointEntity::class;
|
return PointEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): PointForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new PointForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): PointHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new PointHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
protected function getEntity_process(mixed $entity): PointEntity
|
protected function getEntity_process(mixed $entity): PointEntity
|
||||||
{
|
{
|
||||||
|
|||||||
@ -13,8 +13,9 @@ use RuntimeException;
|
|||||||
|
|
||||||
class CHASSISService extends EquipmentService
|
class CHASSISService extends EquipmentService
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = CHASSISForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = CHASSISHelper::class;
|
||||||
|
|
||||||
public function __construct(CHASSISModel $model)
|
public function __construct(CHASSISModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -32,34 +33,6 @@ class CHASSISService extends EquipmentService
|
|||||||
{
|
{
|
||||||
return CHASSISEntity::class;
|
return CHASSISEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): CHASSISForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new CHASSISForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): CHASSISHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new CHASSISHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
protected function getEntity_process(mixed $entity): CHASSISEntity
|
protected function getEntity_process(mixed $entity): CHASSISEntity
|
||||||
{
|
{
|
||||||
@ -91,7 +64,7 @@ class CHASSISService extends EquipmentService
|
|||||||
/** @var CHASSISEntity $entity IDE에 entity type알려주기*/
|
/** @var CHASSISEntity $entity IDE에 entity type알려주기*/
|
||||||
$entity = $this->getEntity($serverEntity->getChassisInfoUid());
|
$entity = $this->getEntity($serverEntity->getChassisInfoUid());
|
||||||
//파트정보의 사용가능한 갯수 , 사용갯수 비교
|
//파트정보의 사용가능한 갯수 , 사용갯수 비교
|
||||||
if ($entity->getAvailable() < 1) {
|
if ($entity->getAvailable() < 1) {
|
||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 현재 사용가능한 {$serverEntity->getTitle()} 샷시가 없습니다.");
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 현재 사용가능한 {$serverEntity->getTitle()} 샷시가 없습니다.");
|
||||||
}
|
}
|
||||||
$formDatas['used'] = $entity->getUsed() + 1;
|
$formDatas['used'] = $entity->getUsed() + 1;
|
||||||
|
|||||||
@ -13,8 +13,9 @@ use RuntimeException;
|
|||||||
class LineService extends EquipmentService
|
class LineService extends EquipmentService
|
||||||
{
|
{
|
||||||
use UtilTrait;
|
use UtilTrait;
|
||||||
private $_form = null;
|
protected string $formClass = LineForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = LineHelper::class;
|
||||||
|
|
||||||
public function __construct(LineModel $model)
|
public function __construct(LineModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -32,34 +33,6 @@ class LineService extends EquipmentService
|
|||||||
{
|
{
|
||||||
return LineEntity::class;
|
return LineEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): LineForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new LineForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): LineHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new LineHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
protected function getEntity_process(mixed $entity): LineEntity
|
protected function getEntity_process(mixed $entity): LineEntity
|
||||||
{
|
{
|
||||||
|
|||||||
@ -16,8 +16,9 @@ use RuntimeException;
|
|||||||
|
|
||||||
class ServerPartService extends EquipmentService
|
class ServerPartService extends EquipmentService
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = ServerPartForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = ServerPartHelper::class;
|
||||||
|
|
||||||
public function __construct(ServerPartModel $model)
|
public function __construct(ServerPartModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -35,34 +36,6 @@ class ServerPartService extends EquipmentService
|
|||||||
{
|
{
|
||||||
return ServerPartEntity::class;
|
return ServerPartEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): ServerPartForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new ServerPartForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): ServerPartHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new ServerPartHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//각 파트별 서비스
|
//각 파트별 서비스
|
||||||
private function getPartService(string $type): PartService
|
private function getPartService(string $type): PartService
|
||||||
{
|
{
|
||||||
@ -103,7 +76,7 @@ class ServerPartService extends EquipmentService
|
|||||||
if (!$serviceEntity instanceof ServiceEntity) {
|
if (!$serviceEntity instanceof ServiceEntity) {
|
||||||
}
|
}
|
||||||
//해당 파트정보에 고객번호,서비스번호 설정
|
//해당 파트정보에 고객번호,서비스번호 설정
|
||||||
$formDatas['clientinfo_uid'] = $serverEntity->getClientInfoUid();
|
$formDatas['clientinfo_uid'] = $serverEntity->getClientInfoUid();
|
||||||
$formDatas['serviceinfo_uid'] = $serverEntity->getServiceInfoUid();
|
$formDatas['serviceinfo_uid'] = $serverEntity->getServiceInfoUid();
|
||||||
//해당 파트정보의 Title을 서버파트정보의 Titlte 설정
|
//해당 파트정보의 Title을 서버파트정보의 Titlte 설정
|
||||||
$formDatas['title'] = $partEntity->getTitle();
|
$formDatas['title'] = $partEntity->getTitle();
|
||||||
|
|||||||
@ -13,8 +13,9 @@ use RuntimeException;
|
|||||||
|
|
||||||
class ServerService extends EquipmentService
|
class ServerService extends EquipmentService
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = ServerForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = ServerHelper::class;
|
||||||
|
|
||||||
public function __construct(ServerModel $model)
|
public function __construct(ServerModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -32,34 +33,6 @@ class ServerService extends EquipmentService
|
|||||||
{
|
{
|
||||||
return ServerEntity::class;
|
return ServerEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): ServerForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new ServerForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): ServerHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new ServerHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
final public function getTotalServiceCount(array $where = []): array
|
final public function getTotalServiceCount(array $where = []): array
|
||||||
{
|
{
|
||||||
$totalCounts = [
|
$totalCounts = [
|
||||||
@ -217,10 +190,10 @@ class ServerService extends EquipmentService
|
|||||||
}
|
}
|
||||||
$formDatas['serviceinfo_uid'] = $serviceEntity->getPK();
|
$formDatas['serviceinfo_uid'] = $serviceEntity->getPK();
|
||||||
$formDatas["clientinfo_uid"] = $serviceEntity->getClientInfoUid();
|
$formDatas["clientinfo_uid"] = $serviceEntity->getClientInfoUid();
|
||||||
$formDatas['status'] = $formDatas['status'] ?? STATUS['OCCUPIED'];
|
$formDatas['status'] = $formDatas['status'] ?? STATUS['OCCUPIED'];
|
||||||
parent::modify_process($entity, $formDatas);
|
parent::modify_process($entity, $formDatas);
|
||||||
}
|
}
|
||||||
public function modifyByService(ServiceENtity $oldServiceEntity, ServiceEntity $serviceEntity): void
|
public function modifyByService(ServiceENtity $oldServiceEntity, ServiceEntity $serviceEntity): void
|
||||||
{
|
{
|
||||||
//기존 메인서버 정보
|
//기존 메인서버 정보
|
||||||
$oldEntity = $this->getEntity($oldServiceEntity->getServerInfoUid());
|
$oldEntity = $this->getEntity($oldServiceEntity->getServerInfoUid());
|
||||||
|
|||||||
@ -12,8 +12,9 @@ use App\DTOs\MylogDTO;
|
|||||||
|
|
||||||
class MylogService extends CommonService implements PipelineStepInterface
|
class MylogService extends CommonService implements PipelineStepInterface
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = MylogForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = MylogHelper::class;
|
||||||
|
|
||||||
public function __construct(MylogModel $model)
|
public function __construct(MylogModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -31,34 +32,6 @@ class MylogService extends CommonService implements PipelineStepInterface
|
|||||||
{
|
{
|
||||||
return MylogEntity::class;
|
return MylogEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): MylogForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new MylogForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): MylogHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new MylogHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* LogService는 START/SUCCESS/FAILURE 로그를 기록합니다.
|
* LogService는 START/SUCCESS/FAILURE 로그를 기록합니다.
|
||||||
* LogService는 파이프라인의 시작과 끝에서만 Executor에 의해 직접 호출됩니다.
|
* LogService는 파이프라인의 시작과 끝에서만 Executor에 의해 직접 호출됩니다.
|
||||||
@ -72,9 +45,9 @@ class MylogService extends CommonService implements PipelineStepInterface
|
|||||||
}
|
}
|
||||||
log_message('debug', $message);
|
log_message('debug', $message);
|
||||||
$this->create([
|
$this->create([
|
||||||
'title' => "{$context->action} 작업 {$status} 로그",
|
'title' => "{$context->action} 작업 {$status} 로그",
|
||||||
'content' => $message,
|
'content' => $message,
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
'user_uid' => $context->auth->getUID(),
|
'user_uid' => $context->auth->getUID(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -90,12 +63,4 @@ class MylogService extends CommonService implements PipelineStepInterface
|
|||||||
{
|
{
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
protected function create_process(array $formDatas): MylogEntity
|
|
||||||
{
|
|
||||||
return parent::create_process($formDatas);
|
|
||||||
}
|
|
||||||
protected function modify_process($entity, array $formDatas): MylogEntity
|
|
||||||
{
|
|
||||||
return parent::modify_process($entity, $formDatas);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,8 +12,9 @@ use RuntimeException;
|
|||||||
|
|
||||||
class CPUService extends PartType1Service
|
class CPUService extends PartType1Service
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = CPUForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = CPUHelper::class;
|
||||||
|
|
||||||
public function __construct(CPUModel $model)
|
public function __construct(CPUModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -31,34 +32,6 @@ class CPUService extends PartType1Service
|
|||||||
{
|
{
|
||||||
return CPUEntity::class;
|
return CPUEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): CPUForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new CPUForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): CPUHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new CPUHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
protected function getEntity_process(mixed $entity): CPUEntity
|
protected function getEntity_process(mixed $entity): CPUEntity
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,8 +12,9 @@ use App\DTOs\Part\CSDTO;
|
|||||||
|
|
||||||
class CSService extends PartType2Service
|
class CSService extends PartType2Service
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = CSForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = CSHelper::class;
|
||||||
|
|
||||||
public function __construct(CSModel $model)
|
public function __construct(CSModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -31,34 +32,6 @@ class CSService extends PartType2Service
|
|||||||
{
|
{
|
||||||
return CSEntity::class;
|
return CSEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): CSForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new CSForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): CSHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new CSHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
protected function getEntity_process(mixed $entity): CSEntity
|
protected function getEntity_process(mixed $entity): CSEntity
|
||||||
{
|
{
|
||||||
|
|||||||
@ -13,8 +13,9 @@ use App\DTOs\Part\DISKDTO;
|
|||||||
|
|
||||||
class DISKService extends PartType1Service
|
class DISKService extends PartType1Service
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = DISKForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = DISKHelper::class;
|
||||||
|
|
||||||
public function __construct(DISKModel $model)
|
public function __construct(DISKModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -32,34 +33,6 @@ class DISKService extends PartType1Service
|
|||||||
{
|
{
|
||||||
return DISKEntity::class;
|
return DISKEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): DISKForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new DISKForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): DISKHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new DISKHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
protected function getEntity_process(mixed $entity): DISKEntity
|
protected function getEntity_process(mixed $entity): DISKEntity
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,8 +14,9 @@ use RuntimeException;
|
|||||||
|
|
||||||
class IPService extends PartType3Service
|
class IPService extends PartType3Service
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = IPForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = IPHelper::class;
|
||||||
|
|
||||||
public function __construct(IPModel $model)
|
public function __construct(IPModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -33,34 +34,6 @@ class IPService extends PartType3Service
|
|||||||
{
|
{
|
||||||
return IPEntity::class;
|
return IPEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): IPForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new IPForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): IPHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new IPHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
protected function getEntity_process(mixed $entity): IPEntity
|
protected function getEntity_process(mixed $entity): IPEntity
|
||||||
{
|
{
|
||||||
@ -93,8 +66,8 @@ class IPService extends PartType3Service
|
|||||||
{
|
{
|
||||||
$entity = $this->create_process([
|
$entity = $this->create_process([
|
||||||
'lineinfo_uid' => $lineEntity->getPK(),
|
'lineinfo_uid' => $lineEntity->getPK(),
|
||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'status' => STATUS['AVAILABLE'],
|
'status' => STATUS['AVAILABLE'],
|
||||||
]);
|
]);
|
||||||
if (!$entity instanceof IPEntity) {
|
if (!$entity instanceof IPEntity) {
|
||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$lineEntity->getTitle()}의 {$ip} 생성을 실패하였습니다.");
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 {$lineEntity->getTitle()}의 {$ip} 생성을 실패하였습니다.");
|
||||||
|
|||||||
@ -12,8 +12,9 @@ use App\DTOs\Part\RAMDTO;
|
|||||||
|
|
||||||
class RAMService extends PartType1Service
|
class RAMService extends PartType1Service
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = RAMForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = RAMHelper::class;
|
||||||
|
|
||||||
public function __construct(RAMModel $model)
|
public function __construct(RAMModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -31,34 +32,6 @@ class RAMService extends PartType1Service
|
|||||||
{
|
{
|
||||||
return RAMEntity::class;
|
return RAMEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): RAMForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new RAMForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): RAMHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new RAMHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
protected function getEntity_process(mixed $entity): RAMEntity
|
protected function getEntity_process(mixed $entity): RAMEntity
|
||||||
{
|
{
|
||||||
|
|||||||
@ -13,8 +13,9 @@ use App\DTOs\Part\SOFTWAREDTO;
|
|||||||
|
|
||||||
class SOFTWAREService extends PartType1Service
|
class SOFTWAREService extends PartType1Service
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = SOFTWAREForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = SOFTWAREHelper::class;
|
||||||
|
|
||||||
public function __construct(SOFTWAREModel $model)
|
public function __construct(SOFTWAREModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -32,34 +33,6 @@ class SOFTWAREService extends PartType1Service
|
|||||||
{
|
{
|
||||||
return SOFTWAREEntity::class;
|
return SOFTWAREEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): SOFTWAREForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new SOFTWAREForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): SOFTWAREHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new SOFTWAREHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
protected function getEntity_process(mixed $entity): SOFTWAREEntity
|
protected function getEntity_process(mixed $entity): SOFTWAREEntity
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,8 +14,9 @@ use App\DTOs\Part\SWITCHDTO;
|
|||||||
|
|
||||||
class SWITCHService extends PartType3Service
|
class SWITCHService extends PartType3Service
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = SWITCHForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = SWITCHHelper::class;
|
||||||
|
|
||||||
public function __construct(SWITCHModel $model)
|
public function __construct(SWITCHModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -33,34 +34,6 @@ class SWITCHService extends PartType3Service
|
|||||||
{
|
{
|
||||||
return SWITCHEntity::class;
|
return SWITCHEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): SWITCHForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new SWITCHForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): SWITCHHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new SWITCHHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
protected function getEntity_process(mixed $entity): SWITCHEntity
|
protected function getEntity_process(mixed $entity): SWITCHEntity
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,8 +18,9 @@ use RuntimeException;
|
|||||||
|
|
||||||
class PaymentService extends CommonService
|
class PaymentService extends CommonService
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = PaymentForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = PaymentHelper::class;
|
||||||
|
|
||||||
public function __construct(PaymentModel $model)
|
public function __construct(PaymentModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -37,34 +38,6 @@ class PaymentService extends CommonService
|
|||||||
{
|
{
|
||||||
return new PaymentDTO($formDatas);
|
return new PaymentDTO($formDatas);
|
||||||
}
|
}
|
||||||
public function getFormService(): PaymentForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new PaymentForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): PaymentHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new PaymentHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//총 미납건수, 금액
|
//총 미납건수, 금액
|
||||||
final public function getUnPaids(string $group, array $where = []): array
|
final public function getUnPaids(string $group, array $where = []): array
|
||||||
{
|
{
|
||||||
@ -125,7 +98,7 @@ class PaymentService extends CommonService
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$pay}는 지정되지 않은 지불방식입니다.");
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$pay}는 지정되지 않은 지불방식입니다.");
|
||||||
// break;
|
// break;
|
||||||
}
|
}
|
||||||
return $walletService;
|
return $walletService;
|
||||||
}
|
}
|
||||||
@ -146,7 +119,8 @@ class PaymentService extends CommonService
|
|||||||
}
|
}
|
||||||
//지불이 완료된경우 지불처리
|
//지불이 완료된경우 지불처리
|
||||||
if ($entity->getStatus() === STATUS['PAID']) {
|
if ($entity->getStatus() === STATUS['PAID']) {
|
||||||
$this->getWalletService($entity->getPay())->withdrawalByPayment($entity);;
|
$this->getWalletService($entity->getPay())->withdrawalByPayment($entity);
|
||||||
|
;
|
||||||
}
|
}
|
||||||
//선결제인경우 서비스정보에 결제일 변경용
|
//선결제인경우 서비스정보에 결제일 변경용
|
||||||
if ($entity->getBilling() === PAYMENT['BILLING']['PREPAYMENT']) {
|
if ($entity->getBilling() === PAYMENT['BILLING']['PREPAYMENT']) {
|
||||||
@ -171,7 +145,8 @@ class PaymentService extends CommonService
|
|||||||
}
|
}
|
||||||
//지불이 된경우 지불처리
|
//지불이 된경우 지불처리
|
||||||
if ($entity->getStatus() === STATUS['PAID']) {
|
if ($entity->getStatus() === STATUS['PAID']) {
|
||||||
$this->getWalletService($entity->getPay())->withdrawalByPayment($entity);;
|
$this->getWalletService($entity->getPay())->withdrawalByPayment($entity);
|
||||||
|
;
|
||||||
}
|
}
|
||||||
//선결제인경우 서비스정보에 결제일 변경용
|
//선결제인경우 서비스정보에 결제일 변경용
|
||||||
if ($entity->getBilling() === PAYMENT['BILLING']['PREPAYMENT']) {
|
if ($entity->getBilling() === PAYMENT['BILLING']['PREPAYMENT']) {
|
||||||
@ -192,9 +167,9 @@ class PaymentService extends CommonService
|
|||||||
{
|
{
|
||||||
if (!array_key_exists($clientEntity->getPK(), $rows)) {
|
if (!array_key_exists($clientEntity->getPK(), $rows)) {
|
||||||
$rows[$clientEntity->getPK()] = [
|
$rows[$clientEntity->getPK()] = [
|
||||||
'name' => $clientEntity->getName(),
|
'name' => $clientEntity->getName(),
|
||||||
'total_amount' => 0,
|
'total_amount' => 0,
|
||||||
'services' => [],
|
'services' => [],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if (!array_key_exists($serviceEntity->getPK(), $rows[$clientEntity->getPK()]['services'])) {
|
if (!array_key_exists($serviceEntity->getPK(), $rows[$clientEntity->getPK()]['services'])) {
|
||||||
@ -203,10 +178,10 @@ class PaymentService extends CommonService
|
|||||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:[{$serviceEntity->getServerInfoUid()}]에 대한 서버정보를 찾을 수 없습니다.");
|
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:[{$serviceEntity->getServerInfoUid()}]에 대한 서버정보를 찾을 수 없습니다.");
|
||||||
}
|
}
|
||||||
$rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()] = [
|
$rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()] = [
|
||||||
'ip' => $serverEntity->getIP(),
|
'ip' => $serverEntity->getIP(),
|
||||||
'billing_at' => $serviceEntity->getBillingAt(),
|
'billing_at' => $serviceEntity->getBillingAt(),
|
||||||
'amount' => 0,
|
'amount' => 0,
|
||||||
'items' => [],
|
'items' => [],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
//entities에 총 결제금액 설정
|
//entities에 총 결제금액 설정
|
||||||
@ -224,12 +199,12 @@ class PaymentService extends CommonService
|
|||||||
{
|
{
|
||||||
$formDatas['serviceinfo_uid'] = $serviceEntity->getPK();
|
$formDatas['serviceinfo_uid'] = $serviceEntity->getPK();
|
||||||
$formDatas["clientinfo_uid"] = $serviceEntity->getClientInfoUid();
|
$formDatas["clientinfo_uid"] = $serviceEntity->getClientInfoUid();
|
||||||
$formDatas['amount'] = $serviceEntity->getAmount();
|
$formDatas['amount'] = $serviceEntity->getAmount();
|
||||||
$formDatas['billing'] = $formDatas['billing'] ?? PAYMENT['BILLING']['MONTH'];
|
$formDatas['billing'] = $formDatas['billing'] ?? PAYMENT['BILLING']['MONTH'];
|
||||||
$formDatas['billing_at'] = $serviceEntity->getBillingAt();
|
$formDatas['billing_at'] = $serviceEntity->getBillingAt();
|
||||||
$formDatas['pay'] = $formDatas['pay'] ?? PAYMENT['PAY']['ACCOUNT'];
|
$formDatas['pay'] = $formDatas['pay'] ?? PAYMENT['PAY']['ACCOUNT'];
|
||||||
$formDatas['status'] = $formDatas['status'] ?? STATUS['UNPAID'];
|
$formDatas['status'] = $formDatas['status'] ?? STATUS['UNPAID'];
|
||||||
$formDatas['title'] = sprintf(
|
$formDatas['title'] = sprintf(
|
||||||
"%s %s 서비스비용",
|
"%s %s 서비스비용",
|
||||||
$formDatas['title'] ?? $serviceEntity->getTitle(),
|
$formDatas['title'] ?? $serviceEntity->getTitle(),
|
||||||
DateTime::createFromFormat('Y-m-d', $formDatas['billing_at'])->format('Y년 m월')
|
DateTime::createFromFormat('Y-m-d', $formDatas['billing_at'])->format('Y년 m월')
|
||||||
@ -247,8 +222,8 @@ class PaymentService extends CommonService
|
|||||||
$entity = $this->getEntity([
|
$entity = $this->getEntity([
|
||||||
'serviceinfo_uid' => $oldServiceEntity->getPK(),
|
'serviceinfo_uid' => $oldServiceEntity->getPK(),
|
||||||
'billing' => PAYMENT['BILLING']['MONTH'],
|
'billing' => PAYMENT['BILLING']['MONTH'],
|
||||||
'billing_at' => $oldServiceEntity->getBillingAt(),
|
'billing_at' => $oldServiceEntity->getBillingAt(),
|
||||||
'status' => STATUS['UNPAID']
|
'status' => STATUS['UNPAID']
|
||||||
]);
|
]);
|
||||||
if (!$entity instanceof PaymentEntity) { //해당조건에 맞는게 없으면 생성
|
if (!$entity instanceof PaymentEntity) { //해당조건에 맞는게 없으면 생성
|
||||||
log_message('error', sprintf(
|
log_message('error', sprintf(
|
||||||
@ -272,12 +247,12 @@ class PaymentService extends CommonService
|
|||||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUid();
|
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUid();
|
||||||
$formDatas["clientinfo_uid"] = $serverPartEntity->getClientInfoUid();
|
$formDatas["clientinfo_uid"] = $serverPartEntity->getClientInfoUid();
|
||||||
$formDatas["serverpartinfo_uid"] = $serverPartEntity->getPK();
|
$formDatas["serverpartinfo_uid"] = $serverPartEntity->getPK();
|
||||||
$formDatas['amount'] = $serverPartEntity->getCalculatedAmount();
|
$formDatas['amount'] = $serverPartEntity->getCalculatedAmount();
|
||||||
$formDatas['billing'] = $formDatas['billing'] ?? PAYMENT['BILLING']['ONETIME'];
|
$formDatas['billing'] = $formDatas['billing'] ?? PAYMENT['BILLING']['ONETIME'];
|
||||||
$formDatas['billing_at'] = $serverPartEntity->getBillingAt();
|
$formDatas['billing_at'] = $serverPartEntity->getBillingAt();
|
||||||
$formDatas['pay'] = $formDatas['pay'] ?? PAYMENT['PAY']['ACCOUNT'];
|
$formDatas['pay'] = $formDatas['pay'] ?? PAYMENT['PAY']['ACCOUNT'];
|
||||||
$formDatas['status'] = $formDatas['status'] ?? STATUS['UNPAID'];
|
$formDatas['status'] = $formDatas['status'] ?? STATUS['UNPAID'];
|
||||||
$formDatas['title'] = sprintf("%s 일회성비용", $formDatas['title'] ?? $serverPartEntity->getCustomTitle());
|
$formDatas['title'] = sprintf("%s 일회성비용", $formDatas['title'] ?? $serverPartEntity->getCustomTitle());
|
||||||
return $formDatas;
|
return $formDatas;
|
||||||
}
|
}
|
||||||
public function createByServerPart(ServerPartEntity $serverPartEntity): PaymentEntity
|
public function createByServerPart(ServerPartEntity $serverPartEntity): PaymentEntity
|
||||||
@ -299,7 +274,7 @@ class PaymentService extends CommonService
|
|||||||
'serviceinfo_uid' => $oldServerPartEntity->getServiceInfoUid(),
|
'serviceinfo_uid' => $oldServerPartEntity->getServiceInfoUid(),
|
||||||
'billing' => $oldServerPartEntity->getBilling(),
|
'billing' => $oldServerPartEntity->getBilling(),
|
||||||
'billing_at' => $oldServerPartEntity->getBillingAt(),
|
'billing_at' => $oldServerPartEntity->getBillingAt(),
|
||||||
'status' => STATUS['UNPAID']
|
'status' => STATUS['UNPAID']
|
||||||
]);
|
]);
|
||||||
if (!$entity instanceof PaymentEntity) { //해당조건에 맞는게 없으면 생성
|
if (!$entity instanceof PaymentEntity) { //해당조건에 맞는게 없으면 생성
|
||||||
log_message('error', sprintf(
|
log_message('error', sprintf(
|
||||||
|
|||||||
@ -12,8 +12,9 @@ use App\DTOs\UserDTO;
|
|||||||
|
|
||||||
class UserService extends CommonService
|
class UserService extends CommonService
|
||||||
{
|
{
|
||||||
private $_form = null;
|
protected string $formClass = UserForm::class;
|
||||||
private $_helper = null;
|
protected string $helperClass = UserHelper::class;
|
||||||
|
|
||||||
public function __construct(UserModel $model)
|
public function __construct(UserModel $model)
|
||||||
{
|
{
|
||||||
parent::__construct($model);
|
parent::__construct($model);
|
||||||
@ -31,34 +32,6 @@ class UserService extends CommonService
|
|||||||
{
|
{
|
||||||
return UserEntity::class;
|
return UserEntity::class;
|
||||||
}
|
}
|
||||||
public function getFormService(): UserForm
|
|
||||||
{
|
|
||||||
if ($this->_form === null) {
|
|
||||||
$this->_form = new UserForm();
|
|
||||||
$this->_form->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_form;
|
|
||||||
}
|
|
||||||
public function getHelper(): UserHelper
|
|
||||||
{
|
|
||||||
if ($this->_helper === null) {
|
|
||||||
$this->_helper = new UserHelper();
|
|
||||||
$this->_helper->setAttributes([
|
|
||||||
'pk_field' => $this->getPKField(),
|
|
||||||
'title_field' => $this->getTitleField(),
|
|
||||||
'table' => $this->model->getTable(),
|
|
||||||
'useAutoIncrement' => $this->model->useAutoIncrement(),
|
|
||||||
'class_path' => $this->getClassPaths(false)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return $this->_helper;
|
|
||||||
}
|
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
protected function getEntity_process(mixed $entity): UserEntity
|
protected function getEntity_process(mixed $entity): UserEntity
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user