dbmsv4 init...5

This commit is contained in:
최준흠 2026-02-23 12:36:09 +09:00
parent dd648e197a
commit 7f1fbccb78
4 changed files with 51 additions and 14 deletions

View File

@ -60,7 +60,7 @@ class ClientController extends CustomerController
if (!$history) { if (!$history) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 비고가 정의되지 않았습니다."); throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 비고가 정의되지 않았습니다.");
} }
$entity = $this->service->modify($uid, ['history' => $history]); $entity = $this->service->history($uid, $history);
$this->addViewDatas('entity', $entity); $this->addViewDatas('entity', $entity);
return $this->action_redirect_process('info', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 비고설정이 완료되었습니다."); return $this->action_redirect_process('info', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 비고설정이 완료되었습니다.");
} catch (\Throwable $e) { } catch (\Throwable $e) {

View File

@ -51,7 +51,7 @@ class ServiceController extends CustomerController
if (!$history) { if (!$history) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 비고가 정의되지 않았습니다."); throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 비고가 정의되지 않았습니다.");
} }
$entity = $this->service->modify($uid, ['history' => $history]); $entity = $this->service->history($uid, $history);
$this->addViewDatas('entity', $entity); $this->addViewDatas('entity', $entity);
return $this->action_redirect_process('info', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 비고설정이 완료되었습니다."); return $this->action_redirect_process('info', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 비고설정이 완료되었습니다.");
} catch (\Throwable $e) { } catch (\Throwable $e) {

View File

@ -2,13 +2,14 @@
namespace App\Services\Customer; namespace App\Services\Customer;
use App\DTOs\Customer\ClientDTO;
use App\Entities\Customer\ClientEntity;
use App\Entities\PaymentEntity;
use App\Forms\Customer\ClientForm;
use App\Helpers\Customer\ClientHelper;
use App\Models\Customer\ClientModel;
use RuntimeException; use RuntimeException;
use App\Entities\CommonEntity;
use App\Entities\PaymentEntity;
use App\DTOs\Customer\ClientDTO;
use App\Forms\Customer\ClientForm;
use App\Models\Customer\ClientModel;
use App\Helpers\Customer\ClientHelper;
use App\Entities\Customer\ClientEntity;
class ClientService extends CustomerService class ClientService extends CustomerService
{ {
@ -69,4 +70,21 @@ class ClientService extends CustomerService
return $formDatas; return $formDatas;
} }
public function history(string|int $uid, string $history): CommonEntity
{
return $this->dbTransaction(function () use ($uid, $history) {
$entity = $this->getEntity($uid);
if (!$entity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
}
$formDatas['user_uid'] = (int) $this->getAuthContext()->getUID();
$formDatas['history'] = $history;
// 검증 통과 후 엔티티 반영
$entity->fill($formDatas);
if (!$entity->hasChanged()) {
return $entity;
}
return $this->save_process($entity);
}, __FUNCTION__);
}
} }

View File

@ -2,14 +2,15 @@
namespace App\Services\Customer; namespace App\Services\Customer;
use App\DTOs\Customer\ServiceDTO;
use App\Entities\Customer\ServiceEntity;
use App\Forms\Customer\ServiceForm;
use App\Helpers\Customer\ServiceHelper;
use App\Models\Customer\ServiceModel;
use DateTimeImmutable;
use DateTimeZone; use DateTimeZone;
use RuntimeException; use RuntimeException;
use DateTimeImmutable;
use App\Entities\CommonEntity;
use App\DTOs\Customer\ServiceDTO;
use App\Forms\Customer\ServiceForm;
use App\Models\Customer\ServiceModel;
use App\Helpers\Customer\ServiceHelper;
use App\Entities\Customer\ServiceEntity;
class ServiceService extends CustomerService class ServiceService extends CustomerService
{ {
@ -189,4 +190,22 @@ class ServiceService extends CustomerService
return $this->recalcAmountAndSyncPaymentByOld($oldEntity, $entity); return $this->recalcAmountAndSyncPaymentByOld($oldEntity, $entity);
} }
public function history(string|int $uid, string $history): CommonEntity
{
return $this->dbTransaction(function () use ($uid, $history) {
$entity = $this->getEntity($uid);
if (!$entity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid}에 해당하는 정보을 찾을수 없습니다.");
}
$formDatas['user_uid'] = (int) $this->getAuthContext()->getUID();
$formDatas['history'] = $history;
// 검증 통과 후 엔티티 반영
$entity->fill($formDatas);
if (!$entity->hasChanged()) {
return $entity;
}
return $this->save_process($entity);
}, __FUNCTION__);
}
} }