dbmsv3 init...1

This commit is contained in:
choi.jh 2025-10-02 14:11:50 +09:00
parent 055f6f6731
commit 490ca2bf55

View File

@ -79,33 +79,35 @@ class PaymentController extends CustomerController
if (!$entity instanceof PaymentEntity) {
throw new \Exception(__METHOD__ . "에서 {$uid}에 대한 결제정보를 찾을수 없습니다.");
}
//entities에 고객 설정
$clientEntity = $this->getClientService()->getEntity($entity->getClientInfoUID());
if (!$clientEntity instanceof ClientEntity) {
throw new \Exception(__METHOD__ . "에서 {$entity->getClientInfoUID()}에 대한 고객정보를 찾을수 없습니다.");
if ($entity->getStatus() === STATUS['UNPAID']) { //미지급인경우
//entities에 고객 설정
$clientEntity = $this->getClientService()->getEntity($entity->getClientInfoUID());
if (!$clientEntity instanceof ClientEntity) {
throw new \Exception(__METHOD__ . "에서 {$entity->getClientInfoUID()}에 대한 고객정보를 찾을수 없습니다.");
}
if (!array_key_exists($clientEntity->getPK(), $rows)) {
$rows[$clientEntity->getPK()] = [
'name' => $clientEntity->getName(),
'total_amount' => 0,
'services' => [],
];
}
//entities에 서비스 설정
$serviceEntity = $this->getService()->getServiceService()->getEntity($entity->getServiceInfoUid());
if (!$serviceEntity instanceof ServiceEntity) {
throw new \Exception(__METHOD__ . "에서 {$entity->getServiceInfoUid()}에 대한 서비스정보를 찾을수 없습니다.");
}
if (!array_key_exists($serviceEntity->getPK(), $rows[$clientEntity->getPK()]['services'])) {
$rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()] = [
'code' => $serviceEntity->getCode(),
'billing_at' => $serviceEntity->getBillingAt(),
'items' => [],
];
}
//entities에 총 결제금액 설정
$rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()]['items'][] = ['title' => $entity->getTitle(), 'amount' => $entity->getAmount()];
$rows[$clientEntity->getPK()]['total_amount'] += $entity->getAmount();
}
if (!array_key_exists($clientEntity->getPK(), $rows)) {
$rows[$clientEntity->getPK()] = [
'name' => $clientEntity->getName(),
'total_amount' => 0,
'services' => []
];
}
//entities에 서비스 설정
$serviceEntity = $this->getService()->getServiceService()->getEntity($entity->getServiceInfoUid());
if (!$serviceEntity instanceof ServiceEntity) {
throw new \Exception(__METHOD__ . "에서 {$entity->getServiceInfoUid()}에 대한 서비스정보를 찾을수 없습니다.");
}
if (!array_key_exists($serviceEntity->getPK(), $rows[$clientEntity->getPK()]['services'])) {
$rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()] = [
'code' => $serviceEntity->getCode(),
'billing_at' => $serviceEntity->getBillingAt(),
'items' => []
];
}
//entities에 총 결제금액 설정
$rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()]['items'][] = ['title' => $entity->getTitle(), 'amount' => $entity->getAmount()];
$rows[$clientEntity->getPK()]['total_amount'] += $entity->getAmount();
}
// dd($rows);
$this->rows = $rows;