diff --git a/app/Config/Constants.php b/app/Config/Constants.php index a5f5faa..3a1bfec 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -369,9 +369,11 @@ define('LAYOUTS', [ ], ]); -//List의 Page당 갯수 -define('DEFAULT_LIST_PERPAGE', $_ENV['LIST_PERPAGE'] ?? $_SERVER['LIST_PERPAGE'] ?? 20); - +define("SITES", [ + "prime" => "PRIME", + "itsolution" => "ITSOLUTION", + "gdidc" => "GDIDC", +]); //STATUS define("STATUS", [ 'AVAILABLE' => "available", @@ -390,6 +392,9 @@ define("STATUS_ICONS", [ 'AVAILABLE' => "", 'NOT_AVAILABLE' => "x." ]); +//List의 Page당 갯수 +define('DEFAULT_LIST_PERPAGE', $_ENV['LIST_PERPAGE'] ?? $_SERVER['LIST_PERPAGE'] ?? 20); + //서버 관련 define("SERVER", []); //서비스 관련 diff --git a/app/Controllers/Admin/Customer/ClientController.php b/app/Controllers/Admin/Customer/ClientController.php index a5dcc31..9daff83 100644 --- a/app/Controllers/Admin/Customer/ClientController.php +++ b/app/Controllers/Admin/Customer/ClientController.php @@ -100,7 +100,7 @@ class ClientController extends CustomerController if (!$entity instanceof ClientEntity) { throw new \Exception("{$uid}에 해당하는 고객정보를 찾을수 없습니다."); } - $this->totalCounts = $this->getService()->getServiceService()->getTotalCountsByType(['clientinfo_uid' => $entity->getPK()]); + $this->totalCounts = $this->getService()->getServiceService()->getTotalCountsBySite(['clientinfo_uid' => $entity->getPK()]); $this->totalAmounts = $this->getService()->getServiceService()->getTotalAmounts([ 'clientinfo_uid' => $entity->getPK(), 'status' => STATUS['AVAILABLE'] diff --git a/app/Controllers/Admin/Home.php b/app/Controllers/Admin/Home.php index ab17cec..8d7e54e 100644 --- a/app/Controllers/Admin/Home.php +++ b/app/Controllers/Admin/Home.php @@ -69,7 +69,7 @@ class Home extends AdminController $this->getService()->setFormRules(); $this->getService()->setFormOptions(); //Total 서버 현황 - $this->totalCounts = $this->getService()->getTotalCountsByType(); + $this->totalCounts = $this->getService()->getTotalCountsBySite(); //interval을 기준으로 최근 신규 서비스정보 가져오기 $this->interval = intval($this->request->getVar('interval') ?? SERVICE['NEW_INTERVAL']); $this->newServiceEntities = $this->getService()->getEntitiesByNewService($this->interval); diff --git a/app/Database/dbmsv2_test1.sql b/app/Database/dbmsv2_test1.sql index 943eae8..c370477 100644 --- a/app/Database/dbmsv2_test1.sql +++ b/app/Database/dbmsv2_test1.sql @@ -602,4 +602,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2025-09-24 11:00:23 +-- Dump completed on 2025-09-24 11:30:07 diff --git a/app/Helpers/Customer/ServiceHelper.php b/app/Helpers/Customer/ServiceHelper.php index 7f55d12..dce0fb8 100644 --- a/app/Helpers/Customer/ServiceHelper.php +++ b/app/Helpers/Customer/ServiceHelper.php @@ -80,6 +80,9 @@ class ServiceHelper extends CustomerHelper $value = "" . $viewDatas['control']['field_optons'][$field][$value]->getTitle() . ""; } break; + case 'amount': + $value = number_format($value) . "원"; + break; case 'billing_at': if (array_key_exists('unPaids', $viewDatas)) { if (array_key_exists($viewDatas['entity']->getPK(), $viewDatas['unPaids'])) { diff --git a/app/Helpers/PaymentHelper.php b/app/Helpers/PaymentHelper.php index 6f39255..21f0f65 100644 --- a/app/Helpers/PaymentHelper.php +++ b/app/Helpers/PaymentHelper.php @@ -35,17 +35,19 @@ class PaymentHelper extends CommonHelper $action = ""; break; case 'modify': - $oldBatchJobUids = old("batchjob_uids", null); - $oldBatchJobUids = is_array($oldBatchJobUids) ? $oldBatchJobUids : [$oldBatchJobUids]; - $action = form_checkbox([ - "id" => "checkbox_uid_{$viewDatas['entity']->getPK()}", - "name" => "batchjob_uids[]", - "value" => $viewDatas['entity']->getPK(), - "class" => "batchjobuids_checkboxs", - "checked" => in_array($viewDatas['entity']->getPK(), $oldBatchJobUids) - ]); if ($this->getMyAuth()->isAccessRole(['security'])) { $action = parent::getListButton($action, $label, $viewDatas, $extras); + } else { + $oldBatchJobUids = old("batchjob_uids", null); + $oldBatchJobUids = is_array($oldBatchJobUids) ? $oldBatchJobUids : [$oldBatchJobUids]; + $action = form_checkbox([ + "id" => "checkbox_uid_{$viewDatas['entity']->getPK()}", + "name" => "batchjob_uids[]", + "value" => $viewDatas['entity']->getPK(), + "class" => "batchjobuids_checkboxs", + "checked" => in_array($viewDatas['entity']->getPK(), $oldBatchJobUids) + ]); + $action .= $label; } break; case 'delete': diff --git a/app/Language/en/Customer/Client.php b/app/Language/en/Customer/Client.php index 9192cac..582d51d 100644 --- a/app/Language/en/Customer/Client.php +++ b/app/Language/en/Customer/Client.php @@ -17,11 +17,7 @@ return [ 'created_at' => "등록일", 'deleted_at' => "삭제일", ], - "SITE" => [ - "prime" => "PRIME", - "itsolution" => "ITSOLUTION", - "gdidc" => "GDIDC", - ], + "SITE" => SITES, "ROLE" => [ "user" => "일반회원", "vip" => "VIP회원", diff --git a/app/Language/en/Customer/Service.php b/app/Language/en/Customer/Service.php index 79e6217..b7ece80 100644 --- a/app/Language/en/Customer/Service.php +++ b/app/Language/en/Customer/Service.php @@ -21,11 +21,7 @@ return [ 'created_at' => "신청일", 'deleted_at' => "삭제일", ], - "SITE" => [ - "prime" => "PRIME", - "itsolution" => "ITSOLUTION", - "gdidc" => "GDIDC", - ], + "SITE" => SITES, "LOCATION" => [ "chiba" => "치바", "tokyo" => "도쿄", diff --git a/app/Language/en/Equipment/Server.php b/app/Language/en/Equipment/Server.php index 84d82cf..84c632e 100644 --- a/app/Language/en/Equipment/Server.php +++ b/app/Language/en/Equipment/Server.php @@ -35,6 +35,7 @@ return [ "STATUS" => [ STATUS['AVAILABLE'] => "사용가능", STATUS['OCCUPIED'] => "서비스중", + STATUS['TERMINATED'] => "서비스해지", STATUS['FORBIDDEN'] => "사용불가", ], ]; diff --git a/app/Services/Customer/Service/ServerService.php b/app/Services/Customer/Service/ServerService.php index bf9387d..2cb5c0a 100644 --- a/app/Services/Customer/Service/ServerService.php +++ b/app/Services/Customer/Service/ServerService.php @@ -46,7 +46,8 @@ class ServerService extends ParentService implements ServiceInterface $formDatas = []; $formDatas['clientinfo_uid'] = null; $formDatas['serviceinfo_uid'] = null; - $formDatas['status'] = STATUS['AVAILABLE']; + $formDatas['format_at'] = date("Y-m-d"); + $formDatas['status'] = STATUS['TERMINATED']; $entity = $this->action_process($serviceEntity, $formDatas); //서비스정보 Entity에 서버정보 설정 return $serviceEntity->setServerEntity($entity); diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php index ca751c1..0bf150e 100644 --- a/app/Services/Customer/ServiceService.php +++ b/app/Services/Customer/ServiceService.php @@ -59,8 +59,8 @@ class ServiceService extends CustomerService 'type', 'clientinfo_uid', 'serverinfo_uid', - 'billing_at', 'amount', + 'billing_at', 'status', 'start_at', 'updated_at', @@ -144,36 +144,51 @@ class ServiceService extends CustomerService return $this->getEntities(sprintf("start_at >= NOW()-INTERVAL {$interval} DAY AND status = '%s'", $status)); } //서비스 방식에 따른 서비스별 Count - final public function getTotalCountsByType(array $where = []): array + final public function getTotalCountsBySite(array $where = []): array { - $totalCounts = [ - 'chiba_total' => 0, - 'tokyo_total' => 0, - 'all_total' => 0, - 'normal' => ['chiba' => 0, 'tokyo' => 0, 'total' => 0], - 'defence' => ['chiba' => 0, 'tokyo' => 0, 'total' => 0], - 'dedicated' => ['chiba' => 0, 'tokyo' => 0, 'total' => 0], - 'vpn' => ['chiba' => 0, 'tokyo' => 0, 'total' => 0], - 'event' => ['chiba' => 0, 'tokyo' => 0, 'total' => 0], - 'test' => ['chiba' => 0, 'tokyo' => 0, 'total' => 0], - 'alternative' => ['chiba' => 0, 'tokyo' => 0, 'total' => 0], - ]; - $rows = $this->getModel()->groupBy('type')->select("type, + $rows = $this->getModel()->groupBy(['site', 'type'])->select("site,type, COUNT(CASE WHEN location = 'chiba' THEN 1 END) AS chiba, COUNT(CASE WHEN location = 'tokyo' THEN 1 END) AS tokyo, - COUNT(CASE WHEN location IN ('chiba', 'tokyo') THEN 1 END) AS total") + COUNT(CASE WHEN location IN ('chiba', 'tokyo') THEN 1 END) AS summary") ->where($where) ->get()->getResult(); + // dd($rows); + $totalCounts = [ + 'normal' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0], + 'defence' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0], + 'dedicated' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0], + 'vpn' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0], + 'event' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0], + 'test' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0], + 'alternative' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0] + ]; foreach ($rows as $row) { - $totalCounts[$row->type] = [ - 'chiba' => $row->chiba, - 'tokyo' => $row->tokyo, - 'total' => $row->total, - ]; - $totalCounts['chiba_total'] += $row->chiba; - $totalCounts['tokyo_total'] += $row->tokyo; + // echo "site:{$row->site},type:{$row->type}"; + if (!array_key_exists($row->site, $totalCounts)) { + $totalCounts[$row->site] = [ + 'chiba_summary' => 0, + 'tokyo_summary' => 0, + 'all_summary' => 0, + 'normal' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0], + 'defence' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0], + 'dedicated' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0], + 'vpn' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0], + 'event' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0], + 'test' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0], + 'alternative' => ['chiba' => 0, 'tokyo' => 0, 'summary' => 0], + ]; + } + if (!array_key_exists($row->type, $totalCounts[$row->site])) { + $totalCounts[$row->site][$row->type] = []; + } + $totalCounts[$row->type]['chiba'] += $totalCounts[$row->site][$row->type]['chiba'] = $row->chiba; + $totalCounts[$row->type]['tokyo'] += $totalCounts[$row->site][$row->type]['tokyo'] = $row->tokyo; + $totalCounts[$row->type]['summary'] += $totalCounts[$row->site][$row->type]['summary'] = $row->summary; + $totalCounts[$row->site]['chiba_summary'] += $row->chiba; + $totalCounts[$row->site]['tokyo_summary'] += $row->tokyo; + $totalCounts[$row->site]['all_summary'] = $totalCounts[$row->site]['chiba_summary'] + $totalCounts[$row->site]['tokyo_summary']; } - $totalCounts['all_total'] = $totalCounts['chiba_total'] + $totalCounts['tokyo_total']; + // dd($totalCounts); return $totalCounts; } //서비스별 총 금액 @@ -204,14 +219,14 @@ class ServiceService extends CustomerService if (!$entity instanceof ServiceEntity) { throw new \Exception(__METHOD__ . "에서 오류발생:[{$uid}]에 대한 서비스정보를 찾을수 없습니다."); } - $total_amount = $entity->getRack() + $entity->getLine() + $entity->getServerEntity()->getPrice(); //기본:상면비+회선비+서버금액(price)+서버파트연결(월비용) + $summary_amount = $entity->getRack() + $entity->getLine() + $entity->getServerEntity()->getPrice(); //기본:상면비+회선비+서버금액(price)+서버파트연결(월비용) //해당 서비스(서버) 관련 결제방식(Billing)이 Month인 ServerPart 전체를 다시 검사하여 월청구액을 합산한다. foreach ($this->getServerPartService()->getEntities(['serverinfo_uid' => $entity->getServerEntity()->getPK()]) as $serverPartEntity) { if ($serverPartEntity->getBilling() === PAYMENT['BILLING']['MONTH']) { //월비용일때만 적용 - $total_amount += $serverPartEntity->getCaculatedAmount(); //단가*Cnt + $summary_amount += $serverPartEntity->getCaculatedAmount(); //단가*Cnt } } - return $total_amount; + return $summary_amount; } //기본 기능부분 //FieldForm관련용 diff --git a/app/Services/Equipment/Server/ServerPartService.php b/app/Services/Equipment/Server/ServerPartService.php index 563ff7b..a86d177 100644 --- a/app/Services/Equipment/Server/ServerPartService.php +++ b/app/Services/Equipment/Server/ServerPartService.php @@ -21,7 +21,8 @@ class ServerPartService extends ParentService implements ServerInterface //create와 같은 작업임 public function modifyServer(ServerEntity $serverEntity): ServerEntity { - return $this->createServer($serverEntity); + //아무것도 하지 않음 + return $serverEntity; } public function deleteServer(ServerEntity $serverEntity): ServerEntity { diff --git a/app/Services/Equipment/Server/ServiceService.php b/app/Services/Equipment/Server/ServiceService.php index 5b7996f..c162fca 100644 --- a/app/Services/Equipment/Server/ServiceService.php +++ b/app/Services/Equipment/Server/ServiceService.php @@ -7,7 +7,7 @@ use App\Entities\Equipment\ServerEntity; use App\Interfaces\Equipment\ServerInterface; use App\Services\Customer\ServiceService as ParentService; - +//서버가격이 변한경우 서비스의 가격을 변경하기 위함. class ServiceService extends ParentService implements ServerInterface { public function __construct() @@ -29,17 +29,16 @@ class ServiceService extends ParentService implements ServerInterface //아무것도 하지 않음 return $serverEntity; } - //create와 같은 작업임 public function modifyServer(ServerEntity $serverEntity): ServerEntity { - return $this->createServer($serverEntity); + $this->action_process($serverEntity); + return $serverEntity; } - //create와 같은 작업임 public function deleteServer(ServerEntity $serverEntity): ServerEntity { if ($serverEntity->getServiceInfoUID() !== null || $serverEntity->getStatus() === STATUS['OCCUPIED']) { throw new \Exception("서비스중이 서버는 삭제하실수 없습니다."); } - return $this->createServer($serverEntity); + return $serverEntity; } } diff --git a/app/Services/Equipment/ServerPart/PaymentService.php b/app/Services/Equipment/ServerPart/PaymentService.php index bebc850..304e237 100644 --- a/app/Services/Equipment/ServerPart/PaymentService.php +++ b/app/Services/Equipment/ServerPart/PaymentService.php @@ -7,7 +7,7 @@ use App\Entities\PaymentEntity; use App\Interfaces\Equipment\ServerPartInterface; use App\Services\PaymentService as ParentService; -//이 클래스는 일회성일때만 실행된다. +////서버연결정보 추가나 변경,삭제시 일회성일 경우 실행됨 class PaymentService extends ParentService implements ServerPartInterface { public function __construct() @@ -51,6 +51,10 @@ class PaymentService extends ParentService implements ServerPartInterface if (!$entity instanceof PaymentEntity) { throw new \Exception(__METHOD__ . "에서 오류발생: 서버파트연결정보{$serverPartEntity->getPK()}]에 해당하는 결제정보를 찾을수 없습니다."); } + //미납상태확인 + if ($entity->getStatus() !== STATUS['UNPAID']) { + throw new \Exception(__METHOD__ . "에서 오류발생: 완료된 결제는 수정이 불가합니다."); + } //필수정보처리 후 FormData 가져오기 $formDatas = $this->action_process($serverPartEntity); //결제정보수정 diff --git a/app/Services/Equipment/ServerPart/ServiceService.php b/app/Services/Equipment/ServerPart/ServiceService.php index a811f36..f4cf2d6 100644 --- a/app/Services/Equipment/ServerPart/ServiceService.php +++ b/app/Services/Equipment/ServerPart/ServiceService.php @@ -7,7 +7,7 @@ use App\Entities\Equipment\ServerPartEntity; use App\Interfaces\Equipment\ServerPartInterface; use App\Services\Customer\ServiceService as ParentService; - +//서버연결정보 추가나 변경,삭제시 가격이 변한경우 서비스의 가격을 변경하기 위함. class ServiceService extends ParentService implements ServerPartInterface { public function __construct() diff --git a/app/Services/Equipment/ServerPartService.php b/app/Services/Equipment/ServerPartService.php index ba86250..6203f2d 100644 --- a/app/Services/Equipment/ServerPartService.php +++ b/app/Services/Equipment/ServerPartService.php @@ -299,8 +299,8 @@ class ServerPartService extends EquipmentService //삭제 public function delete(mixed $entity): ServerPartEntity { - //선처리작업 - $entity = $this->action_process($entity, __FUNCTION__ . 'ServerPart'); - return parent::delete($entity); + $entity = parent::delete($entity); + //서비스금액 관련때문에 후처리작업 + return $this->action_process($entity, __FUNCTION__ . 'ServerPart'); } } diff --git a/app/Services/Equipment/ServerService.php b/app/Services/Equipment/ServerService.php index bb94468..d70589d 100644 --- a/app/Services/Equipment/ServerService.php +++ b/app/Services/Equipment/ServerService.php @@ -26,7 +26,6 @@ class ServerService extends EquipmentService "title", "price", "manufactur_at", - "format_at", ]; } public function getFormFilters(): array @@ -129,7 +128,6 @@ class ServerService extends EquipmentService //수정 public function modify(mixed $entity, array $formDatas): ServerEntity { - $entity->getServerService()->deleteService($entity); //서버정보 수정 $entity = parent::modify($entity, $formDatas); //후처리작업 diff --git a/app/Views/admin/service/index.php b/app/Views/admin/service/index.php index c12ca46..800341e 100644 --- a/app/Views/admin/service/index.php +++ b/app/Views/admin/service/index.php @@ -50,10 +50,10 @@ 서버정보
All COPY
- getHelper()->getListLabel('billing_at', lang("{$viewDatas['class_path']}.label.billing_at"), $viewDatas) ?> + getHelper()->getListLabel('amount', lang("{$viewDatas['class_path']}.label.amount"), $viewDatas) ?> - getHelper()->getListLabel('amount', lang("{$viewDatas['class_path']}.label.amount"), $viewDatas) ?> + getHelper()->getListLabel('billing_at', lang("{$viewDatas['class_path']}.label.billing_at"), $viewDatas) ?> getHelper()->getListLabel('status', lang("{$viewDatas['class_path']}.label.status"), $viewDatas) ?> @@ -90,10 +90,10 @@ ]) ?> - getHelper()->getFieldView('billing_at', $entity->billing_at, $viewDatas) ?> + getHelper()->getFieldView('amount', $entity->amount, $viewDatas) ?> - getHelper()->getFieldView('amount', $entity->amount, $viewDatas) ?> + getHelper()->getFieldView('billing_at', $entity->billing_at, $viewDatas) ?> getHelper()->getFieldView('status', $entity->status, $viewDatas) ?> diff --git a/app/Views/admin/welcome/total_service.php b/app/Views/admin/welcome/total_service.php index c5c1a0b..13e786d 100644 --- a/app/Views/admin/welcome/total_service.php +++ b/app/Views/admin/welcome/total_service.php @@ -9,71 +9,67 @@
- + + + + + + + + + + + + + + + + + + + + + + + + + + $label): ?> - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
고객명일반방어전용대체테스트합계
도쿄치바도쿄치바도쿄치바도쿄치바도쿄치바합계도쿄치바합계
고객명일반방어전용대체테스트합계
도쿄치바도쿄치바도쿄치바도쿄치바도쿄치바합계도쿄치바합계
PRIME
총합계00000000000000
총합계00000000000000
\ No newline at end of file