dbmsv2 init...1
This commit is contained in:
parent
1abad587a1
commit
a416801940
@ -149,7 +149,7 @@ class ClientController extends CustomerController
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->getService()->history($entity, $this->getService()->getFormDatas());
|
||||
$this->entity = $this->getService()->modify($entity, $this->getService()->getFormDatas());
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess('고객 비고가 수정되었습니다.');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@ -118,7 +118,7 @@ class ServiceController extends CustomerController
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->getService()->history($entity, $this->getService()->getFormDatas());
|
||||
$this->entity = $this->getService()->modify($entity, $this->getService()->getFormDatas());
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess('서비스객 비고가 수정되었습니다.');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@ -4,13 +4,13 @@
|
||||
"settings": {
|
||||
"width": 3000,
|
||||
"height": 3000,
|
||||
"scrollTop": -1069.8503,
|
||||
"scrollLeft": -549.5033,
|
||||
"scrollTop": -1121.7873,
|
||||
"scrollLeft": -1298,
|
||||
"zoomLevel": 0.79,
|
||||
"show": 511,
|
||||
"database": 4,
|
||||
"databaseName": "",
|
||||
"canvasType": "ERD",
|
||||
"canvasType": "@dineug/erd-editor/builtin-schema-sql",
|
||||
"language": 1,
|
||||
"tableNameCase": 4,
|
||||
"columnNameCase": 2,
|
||||
@ -78,7 +78,8 @@
|
||||
"wM3eezHxl6nAo_rtAeJ_s",
|
||||
"FvUQ_UzlR7zPl1ZcdWxRd",
|
||||
"45um-cLGZhGmT2PGzssrQ",
|
||||
"FUgz6MDTR-52RHgp677Hv"
|
||||
"FUgz6MDTR-52RHgp677Hv",
|
||||
"9d86n3A9qrtH9J-RPBi02"
|
||||
],
|
||||
"indexIds": [],
|
||||
"memoIds": []
|
||||
@ -668,6 +669,7 @@
|
||||
"nNWsAWbHfKWqx8EwxvuM1",
|
||||
"Vf3bNvvEPfu1zCs4rcHTU",
|
||||
"N-2m8O_JzS6-sDEcL5zTv",
|
||||
"y6WzFGCw3VEqa06ops3EC",
|
||||
"KpTaAmkIKIhv87_dxw0z8",
|
||||
"1ZM86qoxmCcoKnqOpE2oj",
|
||||
"mIkGBA96-a6Rh6AoRddl7",
|
||||
@ -691,6 +693,7 @@
|
||||
"nNWsAWbHfKWqx8EwxvuM1",
|
||||
"Vf3bNvvEPfu1zCs4rcHTU",
|
||||
"N-2m8O_JzS6-sDEcL5zTv",
|
||||
"y6WzFGCw3VEqa06ops3EC",
|
||||
"KpTaAmkIKIhv87_dxw0z8",
|
||||
"1ZM86qoxmCcoKnqOpE2oj",
|
||||
"mIkGBA96-a6Rh6AoRddl7",
|
||||
@ -743,15 +746,15 @@
|
||||
"2fzVlWt1Skh-391N_z9Ci"
|
||||
],
|
||||
"ui": {
|
||||
"x": 2040.2715,
|
||||
"y": 1063.7785,
|
||||
"x": 1807.3602,
|
||||
"y": 1116.9431,
|
||||
"zIndex": 2395,
|
||||
"widthName": 60,
|
||||
"widthComment": 62,
|
||||
"color": ""
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1758500811195,
|
||||
"updateAt": 1758513287204,
|
||||
"createAt": 1748485662214
|
||||
}
|
||||
},
|
||||
@ -849,15 +852,15 @@
|
||||
"S-_BBM4Qv5LCTvGVKmQQw"
|
||||
],
|
||||
"ui": {
|
||||
"x": 1726.2417,
|
||||
"y": 1843.4613,
|
||||
"x": 1821.1787,
|
||||
"y": 1819.4106,
|
||||
"zIndex": 4045,
|
||||
"widthName": 60,
|
||||
"widthComment": 201,
|
||||
"color": ""
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1757047795862,
|
||||
"updateAt": 1758513193576,
|
||||
"createAt": 1755244574868
|
||||
}
|
||||
},
|
||||
@ -8519,6 +8522,26 @@
|
||||
"updateAt": 1758500942149,
|
||||
"createAt": 1758500929116
|
||||
}
|
||||
},
|
||||
"y6WzFGCw3VEqa06ops3EC": {
|
||||
"id": "y6WzFGCw3VEqa06ops3EC",
|
||||
"tableId": "B8haiEbPc1lRBWTv1g25G",
|
||||
"name": "serverinfo_uid",
|
||||
"comment": "서버정보",
|
||||
"dataType": "INT",
|
||||
"default": "",
|
||||
"options": 8,
|
||||
"ui": {
|
||||
"keys": 2,
|
||||
"widthName": 76,
|
||||
"widthComment": 60,
|
||||
"widthDataType": 60,
|
||||
"widthDefault": 60
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1758513295349,
|
||||
"createAt": 1758513283348
|
||||
}
|
||||
}
|
||||
},
|
||||
"relationshipEntities": {
|
||||
@ -8560,17 +8583,17 @@
|
||||
"columnIds": [
|
||||
"mfHtgzc_Aeocr6xkgwYWh"
|
||||
],
|
||||
"x": 1928.9121,
|
||||
"y": 319.1092666666667,
|
||||
"direction": 2
|
||||
"x": 1802.6621,
|
||||
"y": 368.44259999999997,
|
||||
"direction": 8
|
||||
},
|
||||
"end": {
|
||||
"tableId": "B8haiEbPc1lRBWTv1g25G",
|
||||
"columnIds": [
|
||||
"Vf3bNvvEPfu1zCs4rcHTU"
|
||||
],
|
||||
"x": 2121.8965,
|
||||
"y": 1063.7785,
|
||||
"x": 1889.3602,
|
||||
"y": 1116.9431,
|
||||
"direction": 4
|
||||
},
|
||||
"meta": {
|
||||
@ -8589,7 +8612,7 @@
|
||||
"mfHtgzc_Aeocr6xkgwYWh"
|
||||
],
|
||||
"x": 1928.9121,
|
||||
"y": 220.44260000000003,
|
||||
"y": 294.44259999999997,
|
||||
"direction": 2
|
||||
},
|
||||
"end": {
|
||||
@ -8598,7 +8621,7 @@
|
||||
"s1Az-lXWK0NlVQqFEEK8o"
|
||||
],
|
||||
"x": 2338.5336,
|
||||
"y": 624.633,
|
||||
"y": 575.633,
|
||||
"direction": 1
|
||||
},
|
||||
"meta": {
|
||||
@ -8617,7 +8640,7 @@
|
||||
"mfHtgzc_Aeocr6xkgwYWh"
|
||||
],
|
||||
"x": 1928.9121,
|
||||
"y": 121.77593333333334,
|
||||
"y": 146.4426,
|
||||
"direction": 2
|
||||
},
|
||||
"end": {
|
||||
@ -8644,7 +8667,7 @@
|
||||
"columnIds": [
|
||||
"mfHtgzc_Aeocr6xkgwYWh"
|
||||
],
|
||||
"x": 1676.4121,
|
||||
"x": 1550.1621,
|
||||
"y": 368.44259999999997,
|
||||
"direction": 8
|
||||
},
|
||||
@ -8841,7 +8864,7 @@
|
||||
"V6BuLrtFrGgCWaHSUkSLb"
|
||||
],
|
||||
"x": 1397.4650000000001,
|
||||
"y": 1179.5675,
|
||||
"y": 1142.9008333333334,
|
||||
"direction": 2
|
||||
},
|
||||
"end": {
|
||||
@ -8850,7 +8873,7 @@
|
||||
"8mPFhDdUY8QLPvc8rNw1B"
|
||||
],
|
||||
"x": 2338.5336,
|
||||
"y": 820.633,
|
||||
"y": 869.633,
|
||||
"direction": 1
|
||||
},
|
||||
"meta": {
|
||||
@ -8869,7 +8892,7 @@
|
||||
"V6BuLrtFrGgCWaHSUkSLb"
|
||||
],
|
||||
"x": 1397.4650000000001,
|
||||
"y": 1399.5675,
|
||||
"y": 1289.5675,
|
||||
"direction": 2
|
||||
},
|
||||
"end": {
|
||||
@ -8877,8 +8900,8 @@
|
||||
"columnIds": [
|
||||
"N-2m8O_JzS6-sDEcL5zTv"
|
||||
],
|
||||
"x": 2040.2715,
|
||||
"y": 1149.1118333333332,
|
||||
"x": 1807.3602,
|
||||
"y": 1250.9431,
|
||||
"direction": 1
|
||||
},
|
||||
"meta": {
|
||||
@ -8889,15 +8912,15 @@
|
||||
"S-DADUvespt-XHt1mSG1Q": {
|
||||
"id": "S-DADUvespt-XHt1mSG1Q",
|
||||
"identification": false,
|
||||
"relationshipType": 16,
|
||||
"relationshipType": 8,
|
||||
"startRelationshipType": 2,
|
||||
"start": {
|
||||
"tableId": "B8haiEbPc1lRBWTv1g25G",
|
||||
"columnIds": [
|
||||
"nNWsAWbHfKWqx8EwxvuM1"
|
||||
],
|
||||
"x": 2448.3965,
|
||||
"y": 1063.7785,
|
||||
"x": 2217.3602,
|
||||
"y": 1116.9431,
|
||||
"direction": 4
|
||||
},
|
||||
"end": {
|
||||
@ -8905,12 +8928,12 @@
|
||||
"columnIds": [
|
||||
"vxhl-9RMNJ8zU9oqzEWo8"
|
||||
],
|
||||
"x": 2657.5335999999998,
|
||||
"y": 918.633,
|
||||
"direction": 8
|
||||
"x": 2338.5336,
|
||||
"y": 673.633,
|
||||
"direction": 1
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1755653412891,
|
||||
"updateAt": 1758513183060,
|
||||
"createAt": 1755653412891
|
||||
}
|
||||
},
|
||||
@ -8953,7 +8976,7 @@
|
||||
"RITMHZcQAJ7KvtxkTtMv-"
|
||||
],
|
||||
"x": 1472.7756,
|
||||
"y": 2226.6057,
|
||||
"y": 2272.6057,
|
||||
"direction": 2
|
||||
},
|
||||
"end": {
|
||||
@ -8961,8 +8984,8 @@
|
||||
"columnIds": [
|
||||
"GtBqjKsmtYWvsd0fckBc0"
|
||||
],
|
||||
"x": 1726.2417,
|
||||
"y": 2137.4613,
|
||||
"x": 1821.1787,
|
||||
"y": 2113.4106,
|
||||
"direction": 1
|
||||
},
|
||||
"meta": {
|
||||
@ -8980,9 +9003,9 @@
|
||||
"columnIds": [
|
||||
"nNWsAWbHfKWqx8EwxvuM1"
|
||||
],
|
||||
"x": 2040.2715,
|
||||
"y": 1490.4451666666666,
|
||||
"direction": 1
|
||||
"x": 1889.3602,
|
||||
"y": 1652.9431,
|
||||
"direction": 8
|
||||
},
|
||||
"end": {
|
||||
"tableId": "B4qGh3KZsXHQ3_4EOgwJZ",
|
||||
@ -8990,7 +9013,7 @@
|
||||
"4iRyOhmW3b7kbiZT8lQyY"
|
||||
],
|
||||
"x": 1472.7756,
|
||||
"y": 2103.9390333333336,
|
||||
"y": 2088.6057,
|
||||
"direction": 2
|
||||
},
|
||||
"meta": {
|
||||
@ -9008,7 +9031,7 @@
|
||||
"columnIds": [
|
||||
"V6BuLrtFrGgCWaHSUkSLb"
|
||||
],
|
||||
"x": 953.2983333333333,
|
||||
"x": 997.715,
|
||||
"y": 1509.5675,
|
||||
"direction": 8
|
||||
},
|
||||
@ -9093,7 +9116,7 @@
|
||||
"RITMHZcQAJ7KvtxkTtMv-"
|
||||
],
|
||||
"x": 1472.7756,
|
||||
"y": 2349.2723666666666,
|
||||
"y": 2364.6057,
|
||||
"direction": 2
|
||||
},
|
||||
"end": {
|
||||
@ -9120,8 +9143,8 @@
|
||||
"columnIds": [
|
||||
"nNWsAWbHfKWqx8EwxvuM1"
|
||||
],
|
||||
"x": 2040.2715,
|
||||
"y": 1319.7785,
|
||||
"x": 1807.3602,
|
||||
"y": 1518.9431,
|
||||
"direction": 1
|
||||
},
|
||||
"end": {
|
||||
@ -9148,8 +9171,8 @@
|
||||
"columnIds": [
|
||||
"nNWsAWbHfKWqx8EwxvuM1"
|
||||
],
|
||||
"x": 2285.1465,
|
||||
"y": 1063.7785,
|
||||
"x": 2053.3602,
|
||||
"y": 1116.9431,
|
||||
"direction": 4
|
||||
},
|
||||
"end": {
|
||||
@ -9176,8 +9199,8 @@
|
||||
"columnIds": [
|
||||
"nNWsAWbHfKWqx8EwxvuM1"
|
||||
],
|
||||
"x": 2203.5215,
|
||||
"y": 1575.7785,
|
||||
"x": 2217.3602,
|
||||
"y": 1652.9431,
|
||||
"direction": 8
|
||||
},
|
||||
"end": {
|
||||
@ -9185,8 +9208,8 @@
|
||||
"columnIds": [
|
||||
"7Tqt0jVOln16nire8AE2K"
|
||||
],
|
||||
"x": 1995.2417,
|
||||
"y": 1843.4613,
|
||||
"x": 2090.1787,
|
||||
"y": 1819.4106,
|
||||
"direction": 4
|
||||
},
|
||||
"meta": {
|
||||
@ -9204,8 +9227,8 @@
|
||||
"columnIds": [
|
||||
"nNWsAWbHfKWqx8EwxvuM1"
|
||||
],
|
||||
"x": 2530.0215,
|
||||
"y": 1575.7785,
|
||||
"x": 2381.3602,
|
||||
"y": 1652.9431,
|
||||
"direction": 8
|
||||
},
|
||||
"end": {
|
||||
@ -9213,7 +9236,7 @@
|
||||
"columnIds": [
|
||||
"eu4eV0U7BRaP7Zk-oyBhV"
|
||||
],
|
||||
"x": 2447.1041999999998,
|
||||
"x": 2150.1041999999998,
|
||||
"y": 2348.1309,
|
||||
"direction": 4
|
||||
},
|
||||
@ -9260,17 +9283,17 @@
|
||||
"columnIds": [
|
||||
"V6BuLrtFrGgCWaHSUkSLb"
|
||||
],
|
||||
"x": 1130.965,
|
||||
"y": 1509.5675,
|
||||
"direction": 8
|
||||
"x": 1397.4650000000001,
|
||||
"y": 1436.2341666666669,
|
||||
"direction": 2
|
||||
},
|
||||
"end": {
|
||||
"tableId": "SEgsi7mbM-56Rsx5-qj8K",
|
||||
"columnIds": [
|
||||
"q_IaRBb367b9mgGozh6jB"
|
||||
],
|
||||
"x": 1726.2417,
|
||||
"y": 1941.4613,
|
||||
"x": 1821.1787,
|
||||
"y": 1917.4106,
|
||||
"direction": 1
|
||||
},
|
||||
"meta": {
|
||||
@ -9316,7 +9339,7 @@
|
||||
"columnIds": [
|
||||
"V6BuLrtFrGgCWaHSUkSLb"
|
||||
],
|
||||
"x": 1308.6316666666667,
|
||||
"x": 1264.2150000000001,
|
||||
"y": 1509.5675,
|
||||
"direction": 8
|
||||
},
|
||||
@ -9372,17 +9395,17 @@
|
||||
"columnIds": [
|
||||
"GMPyqxaroK2OjQZnoCRwn"
|
||||
],
|
||||
"x": 2870.2002666666663,
|
||||
"y": 918.633,
|
||||
"direction": 8
|
||||
"x": 2338.5336,
|
||||
"y": 771.633,
|
||||
"direction": 1
|
||||
},
|
||||
"end": {
|
||||
"tableId": "B8haiEbPc1lRBWTv1g25G",
|
||||
"columnIds": [
|
||||
"KpTaAmkIKIhv87_dxw0z8"
|
||||
],
|
||||
"x": 2611.6465,
|
||||
"y": 1063.7785,
|
||||
"x": 2381.3602,
|
||||
"y": 1116.9431,
|
||||
"direction": 4
|
||||
},
|
||||
"meta": {
|
||||
@ -9400,7 +9423,7 @@
|
||||
"columnIds": [
|
||||
"GMPyqxaroK2OjQZnoCRwn"
|
||||
],
|
||||
"x": 2444.8669333333332,
|
||||
"x": 2657.5336,
|
||||
"y": 918.633,
|
||||
"direction": 8
|
||||
},
|
||||
@ -9409,7 +9432,7 @@
|
||||
"columnIds": [
|
||||
"Fo9A9MajgfwBYecToLCoW"
|
||||
],
|
||||
"x": 2150.1041999999998,
|
||||
"x": 2447.1041999999998,
|
||||
"y": 2348.1309,
|
||||
"direction": 4
|
||||
},
|
||||
@ -9417,6 +9440,34 @@
|
||||
"updateAt": 1758500929116,
|
||||
"createAt": 1758500929116
|
||||
}
|
||||
},
|
||||
"9d86n3A9qrtH9J-RPBi02": {
|
||||
"id": "9d86n3A9qrtH9J-RPBi02",
|
||||
"identification": false,
|
||||
"relationshipType": 8,
|
||||
"startRelationshipType": 2,
|
||||
"start": {
|
||||
"tableId": "B4qGh3KZsXHQ3_4EOgwJZ",
|
||||
"columnIds": [
|
||||
"RITMHZcQAJ7KvtxkTtMv-"
|
||||
],
|
||||
"x": 1472.7756,
|
||||
"y": 2180.6057,
|
||||
"direction": 2
|
||||
},
|
||||
"end": {
|
||||
"tableId": "B8haiEbPc1lRBWTv1g25G",
|
||||
"columnIds": [
|
||||
"y6WzFGCw3VEqa06ops3EC"
|
||||
],
|
||||
"x": 2053.3602,
|
||||
"y": 1652.9431,
|
||||
"direction": 8
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1758513283349,
|
||||
"createAt": 1758513283349
|
||||
}
|
||||
}
|
||||
},
|
||||
"indexEntities": {},
|
||||
|
||||
@ -450,6 +450,7 @@ CREATE TABLE `serviceinfo` (
|
||||
`uid` int(11) NOT NULL AUTO_INCREMENT COMMENT '서비스정보',
|
||||
`user_uid` int(11) NOT NULL COMMENT '관리자정보',
|
||||
`clientinfo_uid` int(11) NOT NULL COMMENT '고객정보',
|
||||
`serverinfo_uid` int(11) NOT NULL COMMENT '서버정보',
|
||||
`payment_uid` int(11) DEFAULT NULL,
|
||||
`code` varchar(20) NOT NULL COMMENT '서비스코드',
|
||||
`site` varchar(20) NOT NULL DEFAULT 'prime' COMMENT 'Site구분',
|
||||
@ -471,10 +472,12 @@ CREATE TABLE `serviceinfo` (
|
||||
KEY `FK_user_TO_serviceinfo` (`user_uid`),
|
||||
KEY `FK_clientinfo_TO_serviceinfo` (`clientinfo_uid`),
|
||||
KEY `FK_payment_TO_serviceinfo` (`payment_uid`),
|
||||
KEY `FK_serverinfo_TO_serviceinfo` (`serverinfo_uid`),
|
||||
CONSTRAINT `FK_clientinfo_TO_serviceinfo` FOREIGN KEY (`clientinfo_uid`) REFERENCES `clientinfo` (`uid`),
|
||||
CONSTRAINT `FK_payment_TO_serviceinfo` FOREIGN KEY (`payment_uid`) REFERENCES `payment` (`uid`),
|
||||
CONSTRAINT `FK_serverinfo_TO_serviceinfo` FOREIGN KEY (`serverinfo_uid`) REFERENCES `serverinfo` (`uid`),
|
||||
CONSTRAINT `FK_user_TO_serviceinfo` FOREIGN KEY (`user_uid`) REFERENCES `user` (`uid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COMMENT='서비스정보';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8 COMMENT='서비스정보';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
@ -600,4 +603,4 @@ UNLOCK TABLES;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2025-09-22 11:37:18
|
||||
-- Dump completed on 2025-09-22 13:06:02
|
||||
|
||||
@ -450,6 +450,7 @@ CREATE TABLE `serviceinfo` (
|
||||
`uid` int(11) NOT NULL AUTO_INCREMENT COMMENT '서비스정보',
|
||||
`user_uid` int(11) NOT NULL COMMENT '관리자정보',
|
||||
`clientinfo_uid` int(11) NOT NULL COMMENT '고객정보',
|
||||
`serverinfo_uid` int(11) NOT NULL COMMENT '서버정보',
|
||||
`payment_uid` int(11) DEFAULT NULL,
|
||||
`code` varchar(20) NOT NULL COMMENT '서비스코드',
|
||||
`site` varchar(20) NOT NULL DEFAULT 'prime' COMMENT 'Site구분',
|
||||
@ -471,10 +472,12 @@ CREATE TABLE `serviceinfo` (
|
||||
KEY `FK_user_TO_serviceinfo` (`user_uid`),
|
||||
KEY `FK_clientinfo_TO_serviceinfo` (`clientinfo_uid`),
|
||||
KEY `FK_payment_TO_serviceinfo` (`payment_uid`),
|
||||
KEY `FK_serverinfo_TO_serviceinfo` (`serverinfo_uid`),
|
||||
CONSTRAINT `FK_clientinfo_TO_serviceinfo` FOREIGN KEY (`clientinfo_uid`) REFERENCES `clientinfo` (`uid`),
|
||||
CONSTRAINT `FK_payment_TO_serviceinfo` FOREIGN KEY (`payment_uid`) REFERENCES `payment` (`uid`),
|
||||
CONSTRAINT `FK_serverinfo_TO_serviceinfo` FOREIGN KEY (`serverinfo_uid`) REFERENCES `serverinfo` (`uid`),
|
||||
CONSTRAINT `FK_user_TO_serviceinfo` FOREIGN KEY (`user_uid`) REFERENCES `user` (`uid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COMMENT='서비스정보';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8 COMMENT='서비스정보';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
@ -600,4 +603,4 @@ UNLOCK TABLES;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2025-09-22 11:37:10
|
||||
-- Dump completed on 2025-09-22 13:06:07
|
||||
|
||||
@ -12,7 +12,7 @@ class ServiceEntity extends CustomerEntity
|
||||
const PK = ServiceModel::PK;
|
||||
const TITLE = ServiceModel::TITLE;
|
||||
const DEFAULT_STATUS = STATUS['AVAILABLE'];
|
||||
public function setServerEntity(ServerEntity $entity): ServiceEntity
|
||||
public function setServerEntity(ServerEntity $entity): self
|
||||
{
|
||||
$this->attributes['serverEntity'] = $entity;
|
||||
return $this;
|
||||
@ -21,7 +21,7 @@ class ServiceEntity extends CustomerEntity
|
||||
{
|
||||
return $this->attributes['paymentEntity'];
|
||||
}
|
||||
final public function setPaymentEntity(PaymentEntity $entity): ServiceEntity
|
||||
final public function setPaymentEntity(PaymentEntity $entity): self
|
||||
{
|
||||
$this->attributes['paymentEntity'] = $entity;
|
||||
return $this;
|
||||
@ -38,7 +38,11 @@ class ServiceEntity extends CustomerEntity
|
||||
{
|
||||
return $this->attributes['clientinfo_uid'];
|
||||
}
|
||||
final public function getPaymentInfoUID(): string|null
|
||||
final public function getServerInfoUID(): string
|
||||
{
|
||||
return $this->attributes['serverinfo_uid'];
|
||||
}
|
||||
final public function getPaymentUID(): string|null
|
||||
{
|
||||
return $this->attributes['payment_uid'] ?? null;
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ class ServerPartEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = ServerPartModel::PK;
|
||||
const TITLE = ServerPartModel::TITLE;
|
||||
public function setPartEntity(mixed $entity): ServerPartEntity
|
||||
public function setPartEntity(mixed $entity): self
|
||||
{
|
||||
$this->attributes['partEntity'] = $entity;
|
||||
return $this;
|
||||
@ -19,7 +19,7 @@ class ServerPartEntity extends EquipmentEntity
|
||||
{
|
||||
return $this->attributes['partEntity'] ?? null;
|
||||
}
|
||||
final public function setPaymentEntity(PaymentEntity $entity): ServerPartEntity
|
||||
final public function setPaymentEntity(PaymentEntity $entity): self
|
||||
{
|
||||
$this->attributes['paymentEntity'] = $entity;
|
||||
return $this;
|
||||
@ -48,7 +48,7 @@ class ServerPartEntity extends EquipmentEntity
|
||||
{
|
||||
return $this->attributes['serverinfo_uid'];
|
||||
}
|
||||
final public function getPaymentInfoUID(): string|null
|
||||
final public function getPaymentUID(): string|null
|
||||
{
|
||||
return $this->attributes['payment_uid'] ?? null;
|
||||
}
|
||||
|
||||
@ -6,7 +6,9 @@ use App\Entities\Customer\ServiceEntity;
|
||||
|
||||
interface ServiceInterface extends CustomerInterface
|
||||
{
|
||||
public function createService(ServiceEntity $serviceEntity): ServiceEntity;
|
||||
public function modifyService(ServiceEntity $serviceEntity): ServiceEntity;
|
||||
public function deleteService(ServiceEntity $serviceEntitys): ServiceEntity;
|
||||
public function setServiceEntity(ServiceEntity $entity): self;
|
||||
public function getServiceEntity(): ServiceEntity;
|
||||
public function createService(): ServiceEntity;
|
||||
public function modifyService(): ServiceEntity;
|
||||
public function deleteService(): ServiceEntity;
|
||||
}
|
||||
|
||||
@ -6,7 +6,9 @@ use App\Entities\Equipment\ServerPartEntity;
|
||||
|
||||
interface ServerPartInterface extends EquipmentInterface
|
||||
{
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity;
|
||||
public function modifyServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity;
|
||||
public function deleteServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity;
|
||||
public function setServerPartEntity(ServerPartEntity $entity): self;
|
||||
public function getServerPartEntity(): ServerPartEntity;
|
||||
public function createServerPart(): ServerPartEntity;
|
||||
public function modifyServerPart(): ServerPartEntity;
|
||||
public function deleteServerPart(): ServerPartEntity;
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ class FileStorage extends CommonLibrary
|
||||
{
|
||||
return $this->_fileSize;
|
||||
}
|
||||
public function save(): static
|
||||
public function save(): self
|
||||
{
|
||||
// log_message("notice", __FUNCTION__ . " 원본파일 {$this->getOriginName()} 작업 시작 2");
|
||||
$save_file = $this->getFullPath() . DIRECTORY_SEPARATOR . $this->getOriginName();
|
||||
@ -96,7 +96,7 @@ class FileStorage extends CommonLibrary
|
||||
case "notallow":
|
||||
default:
|
||||
throw new \Exception(__FUNCTION__ . " {$this->getOriginName()} 는 이미 존재하는 파일입니다.");
|
||||
// break;
|
||||
// break;
|
||||
}
|
||||
}
|
||||
//원본이미지 저장
|
||||
|
||||
@ -17,6 +17,7 @@ class ServiceModel extends CustomerModel
|
||||
protected $allowedFields = [
|
||||
"user_uid",
|
||||
"clientinfo_uid",
|
||||
"serverinfo_uid",
|
||||
"payment_uid",
|
||||
"code",
|
||||
"site",
|
||||
@ -44,6 +45,7 @@ class ServiceModel extends CustomerModel
|
||||
switch ($field) {
|
||||
case "user_uid":
|
||||
case "clientinfo_uid":
|
||||
case "serverinfo_uid":
|
||||
case "amount":
|
||||
case "rack":
|
||||
case "line":
|
||||
|
||||
@ -151,10 +151,7 @@ abstract class CommonService
|
||||
return null;
|
||||
}
|
||||
if (is_array($entity)) {
|
||||
var_export($where);
|
||||
echo $this->getModel()->getLastQuery();
|
||||
dd($entity);
|
||||
throw new \Exception("오류결과:\n" . var_export($entity));
|
||||
throw new \Exception(__METHOD__ . "에서 결과값 Array 오류발생:\n" . var_export($entity, true));
|
||||
}
|
||||
return $this->getEntity_process($entity);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@ -8,6 +8,7 @@ use App\Models\Customer\AccountModel;
|
||||
|
||||
class AccountService extends CustomerService
|
||||
{
|
||||
private ?ClientService $_clientService = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new AccountModel(), new AccountHelper());
|
||||
@ -37,6 +38,13 @@ class AccountService extends CustomerService
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
final public function getClientService(): ClientService
|
||||
{
|
||||
if (!$this->_clientService) {
|
||||
$this->_clientService = new ClientService();
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
//기본 기능부분
|
||||
|
||||
//고객예치금처리
|
||||
|
||||
@ -9,6 +9,8 @@ use App\Services\PaymentService;
|
||||
|
||||
class ClientService extends CustomerService
|
||||
{
|
||||
private ?ClientService $_clientService = null;
|
||||
private ?ServiceService $_serviceService = null;
|
||||
private ?PaymentService $_paymentService = null;
|
||||
public function __construct()
|
||||
{
|
||||
@ -53,6 +55,20 @@ class ClientService extends CustomerService
|
||||
{
|
||||
return ['site', 'role', 'status'];
|
||||
}
|
||||
final public function getClientService(): ClientService
|
||||
{
|
||||
if (!$this->_clientService) {
|
||||
$this->_clientService = new ClientService();
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
final public function getServiceService(): ServiceService
|
||||
{
|
||||
if ($this->_serviceService === null) {
|
||||
$this->_serviceService = new ServiceService();
|
||||
}
|
||||
return $this->_serviceService;
|
||||
}
|
||||
final public function getPaymentService(): PaymentService
|
||||
{
|
||||
if (!$this->_paymentService) {
|
||||
@ -162,11 +178,4 @@ class ClientService extends CustomerService
|
||||
$this->getModel()->orderBy("site ASC,name ASC");
|
||||
parent::setOrderBy($field, $value);
|
||||
}
|
||||
//History
|
||||
public function history(mixed $entity, array $formDatas): ClientEntity
|
||||
{
|
||||
//서비스 정보수정
|
||||
$entity = $this->getModel()->modify($entity, $formDatas);
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,84 +7,12 @@ use App\Helpers\CommonHelper;
|
||||
|
||||
use App\Models\CommonModel;
|
||||
use App\Services\CommonService;
|
||||
use App\Services\Customer\ClientService;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use App\Services\Equipment\SwitchService;
|
||||
use App\Services\UserService;
|
||||
|
||||
abstract class CustomerService extends CommonService
|
||||
{
|
||||
private ?UserService $_userService = null;
|
||||
private ?ClientService $_clientService = null;
|
||||
private ?ServiceService $_serviceService = null;
|
||||
private ?ServerService $_serverService = null;
|
||||
private ?SwitchService $_switchService = null;
|
||||
|
||||
private $_equipmentService = [];
|
||||
protected function __construct(CommonModel $model, CommonHelper $helper)
|
||||
{
|
||||
parent::__construct($model, $helper);
|
||||
$this->addClassName('Customer');
|
||||
}
|
||||
public function getClientService(): ClientService
|
||||
{
|
||||
if (!$this->_clientService) {
|
||||
$this->_clientService = new ClientService();
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
public function getUSerService(): UserService
|
||||
{
|
||||
if (!$this->_userService) {
|
||||
$this->_userService = new UserService();
|
||||
}
|
||||
return $this->_userService;
|
||||
}
|
||||
public function getServiceService(): ServiceService
|
||||
{
|
||||
if (!$this->_serviceService) {
|
||||
$this->_serviceService = new ServiceService();
|
||||
}
|
||||
return $this->_serviceService;
|
||||
}
|
||||
public function getServerService(): ServerService
|
||||
{
|
||||
if (!$this->_serverService) {
|
||||
$this->_serverService = new ServerService();
|
||||
}
|
||||
return $this->_serverService;
|
||||
}
|
||||
//ServiceItemController,ServiceController에서 사용
|
||||
//기본기능
|
||||
//FieldForm관련용
|
||||
public function getFormOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
$options = $this->getUserService()->getEntities();
|
||||
break;
|
||||
case 'clientinfo_uid':
|
||||
$options = $this->getClientService()->getEntities();
|
||||
break;
|
||||
case 'serviceinfo_uid':
|
||||
$options = $this->getServiceService()->getEntities();
|
||||
break;
|
||||
case 'serverinfo_uid':
|
||||
$options = $this->getServerService()->getEntities();
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
//ItemType에 따른 FilterOption 설정용
|
||||
final public function getClient(int $uid): ClientEntity
|
||||
{
|
||||
$entity = $this->getClientService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 해당하는 고객정보가 존재하지 않습니다. uid: {$uid}");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ use App\Models\Customer\PointModel;
|
||||
|
||||
class PointService extends CustomerService
|
||||
{
|
||||
private ?ClientService $_clientService = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new PointModel(), new PointHelper());
|
||||
@ -33,8 +34,14 @@ class PointService extends CustomerService
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
final public function getClientService(): ClientService
|
||||
{
|
||||
if (!$this->_clientService) {
|
||||
$this->_clientService = new ClientService();
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
//기본 기능부분
|
||||
|
||||
private function setBalance(array $formDatas): void
|
||||
{
|
||||
//point_balance 체크
|
||||
|
||||
66
app/Services/Customer/Service/PaymentService.php
Normal file
66
app/Services/Customer/Service/PaymentService.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer\Service\Server;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\PaymentEntity;
|
||||
use App\Services\PaymentService as ParentService;
|
||||
use App\Interfaces\Customer\ServiceInterface;
|
||||
|
||||
class PaymentService extends ParentService implements ServiceInterface
|
||||
{
|
||||
private ?ServiceEntity $_serviceEntity = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function setServiceEntity(ServiceEntity $entity): self
|
||||
{
|
||||
$this->_serviceEntity = $entity;
|
||||
return $this;
|
||||
}
|
||||
public function getServiceEntity(): ServiceEntity
|
||||
{
|
||||
if (!$this->_serviceEntity instanceof ServiceEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 서비스정보가 정의되지 않았습니다.");
|
||||
}
|
||||
return $this->_serviceEntity;
|
||||
}
|
||||
|
||||
private function action_process(array $formDatas = []): array
|
||||
{
|
||||
$formDatas['clientinfo_uid'] = $this->getServiceEntity()->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $this->getServiceEntity()->getPK();
|
||||
$formDatas['serverinfo_uid'] = $this->getServiceEntity()->getServerInfoUID();
|
||||
$formDatas['title'] = $this->getServiceEntity()->getServerEntity()->getTitle();
|
||||
$formDatas['amount'] = $this->getServiceEntity()->getAmount();
|
||||
$formDatas['billing'] = PAYMENT['BILLING']['MONTH'];
|
||||
$formDatas['billing_at'] = $this->getServiceEntity()->getBillingAt();
|
||||
return $formDatas;
|
||||
}
|
||||
public function createService(): ServiceEntity
|
||||
{
|
||||
//필수정보처리 후 결제정보등록
|
||||
$entity = $this->create($this->action_process());
|
||||
//서비스정보 Entity에 결제정보 설정
|
||||
return $this->getServiceEntity()->setPaymentEntity($entity);
|
||||
}
|
||||
public function modifyService(): ServiceEntity
|
||||
{
|
||||
//미납상태의 결제정보 가져오기
|
||||
$entity = $this->getEntity(['serviceinfo_uid' => $this->getServiceEntity()->getPK(), 'status' => STATUS['UNPAID']]);
|
||||
if (!$entity instanceof PaymentEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$this->getServiceEntity()->getPK()}에 해당하는 결제정보를 찾을수 없습니다.");
|
||||
}
|
||||
//필수정보처리 후 결제정보수정
|
||||
$entity = $this->modify($entity, $this->action_process());
|
||||
//서비스정보 Entity에 결제정보 설정
|
||||
return $this->getServiceEntity()->setPaymentEntity($entity);
|
||||
}
|
||||
public function deleteService(): ServiceEntity
|
||||
{
|
||||
//삭제시에는 아무것도 하지 않는다.
|
||||
return $this->getServiceEntity();
|
||||
}
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Service;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Interfaces\Equipment\ServerPartInterface;
|
||||
use App\Services\Customer\ServiceService;
|
||||
|
||||
|
||||
class ServerPart extends ServiceService implements ServerPartInterface
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
//월과금은 해당 서비스의 항목별 금액을 총 합산후 청구금액을 설정후 결제정보에 신규등록/수정한다
|
||||
private function action_process(ServerPartEntity $serverPartEntity): ServiceEntity
|
||||
{
|
||||
//Service Entity 가져오기
|
||||
$entity = $this->getEntity($serverPartEntity->getServiceInfoUID());
|
||||
if (!$entity instanceof ServiceEntity) {
|
||||
throw new \Exception("[{$serverPartEntity->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
//서비스금액은 modify 함수내에서 재계산을 하므로 여기서는 modify만 호출함
|
||||
return parent::modify($entity, []);
|
||||
}
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
//필수정보처리 후 FormData 가져오기
|
||||
$this->action_process($serverPartEntity);
|
||||
return $serverPartEntity;
|
||||
}
|
||||
public function modifyServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
return $this->createServerPart($serverPartEntity);
|
||||
}
|
||||
public function deleteServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
return $this->createServerPart($serverPartEntity);
|
||||
}
|
||||
}
|
||||
68
app/Services/Customer/Service/ServerService.php
Normal file
68
app/Services/Customer/Service/ServerService.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer\Service\Server;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
use App\Services\Equipment\ServerService as ParentService;
|
||||
use App\Interfaces\Customer\ServiceInterface;
|
||||
|
||||
class ServerService extends ParentService implements ServiceInterface
|
||||
{
|
||||
private ?ServiceEntity $_serviceEntity = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
final public function setServiceEntity(ServiceEntity $entity): self
|
||||
{
|
||||
$this->_serviceEntity = $entity;
|
||||
return $this;
|
||||
}
|
||||
public function getServiceEntity(): ServiceEntity
|
||||
{
|
||||
if (!$this->_serviceEntity instanceof ServiceEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 서브스정보가 정의되지 않았습니다.");
|
||||
}
|
||||
return $this->_serviceEntity;
|
||||
}
|
||||
|
||||
private function action_process(array $formDatas = []): ServerEntity
|
||||
{
|
||||
if (!array_key_exists('status', $formDatas)) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 서버상태가 설정되지 않았습니다.");
|
||||
}
|
||||
//서버정보 가져오기
|
||||
$entity = $this->getEntity(['serviceinfo_uid' => $this->getServiceEntity()->getPK()]);
|
||||
if (!$entity instanceof ServerEntity) {
|
||||
throw new \Exception("서비스정보[{$this->getServiceEntity()->getPK()}]에 해당하는 서버정보를 찾을수없습니다.");
|
||||
}
|
||||
//서버정보 수정
|
||||
return $this->modify($entity, $formDatas);
|
||||
}
|
||||
public function createService(): ServiceEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = $this->getServiceEntity()->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $this->getServiceEntity()->getPK();
|
||||
$formDatas['status'] = STATUS['OCCUPIED'];
|
||||
$entity = $this->action_process($formDatas);
|
||||
//서비스정보 Entity에 서버정보 설정
|
||||
return $this->getServiceEntity()->setServerEntity($entity);
|
||||
}
|
||||
public function modifyService(): ServiceEntity
|
||||
{
|
||||
return $this->createService();
|
||||
}
|
||||
public function deleteService(): ServiceEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = null;
|
||||
$formDatas['serviceinfo_uid'] = null;
|
||||
$formDatas['status'] = STATUS['AVAILABLE'];
|
||||
$entity = $this->action_process($formDatas);
|
||||
//서비스정보 Entity에 서버정보 설정
|
||||
return $this->getServiceEntity()->setServerEntity($entity);
|
||||
}
|
||||
}
|
||||
@ -7,15 +7,13 @@ use App\Entities\Equipment\ServerEntity;
|
||||
use App\Entities\PaymentEntity;
|
||||
use App\Helpers\Customer\ServiceHelper;
|
||||
use App\Models\Customer\ServiceModel;
|
||||
use App\Services\Equipment\Server\Service as ServerService;
|
||||
use App\Services\Equipment\ServerPartService;
|
||||
use App\Services\Payment\Service as PaymentService;
|
||||
use App\Services\Customer\Service\Server\ServerService;
|
||||
use App\Services\Customer\Service\Server\PaymentService;
|
||||
|
||||
class ServiceService extends CustomerService
|
||||
{
|
||||
private ?ServerService $_serverService = null;
|
||||
private ?PaymentService $_paymentService = null;
|
||||
private ?ServerPartService $_serverPartService = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new ServiceModel(), new ServiceHelper());
|
||||
@ -108,8 +106,8 @@ class ServiceService extends CustomerService
|
||||
$entity->setServerEntity($serverEntity);
|
||||
}
|
||||
//결제정보 정의
|
||||
if ($entity->getPaymentInfoUID()) {
|
||||
$paymentEntity = $this->getPaymentService()->getEntity($entity->getPaymentInfoUID());
|
||||
if ($entity->getPaymentUID()) {
|
||||
$paymentEntity = $this->getPaymentService()->getEntity($entity->getPaymentUID());
|
||||
if ($paymentEntity instanceof PaymentEntity) {
|
||||
$entity->setPaymentEntity($paymentEntity);
|
||||
}
|
||||
@ -130,13 +128,6 @@ class ServiceService extends CustomerService
|
||||
}
|
||||
return $this->_serverService;
|
||||
}
|
||||
public function getServerPartService(): ServerPartService
|
||||
{
|
||||
if (!$this->_serverPartService) {
|
||||
$this->_serverPartService = new ServerPartService();
|
||||
}
|
||||
return $this->_serverPartService;
|
||||
}
|
||||
//기본 기능부분
|
||||
public function getFormOption(string $field, array $options = []): array
|
||||
{
|
||||
@ -219,15 +210,8 @@ class ServiceService extends CustomerService
|
||||
) WHERE billing_at = ? AND status = ?";
|
||||
return $this->getModel()->query($sql, [$billing_at, $status]);
|
||||
}
|
||||
//월청구액 계산값
|
||||
//기본기능
|
||||
private function action_process(ServiceEntity $entity, string $action): ServiceEntity
|
||||
{
|
||||
//서버정보에 서비스정보 등록
|
||||
$entity = $this->getServerService()->$action($entity);
|
||||
$entity = $this->getPaymentService()->$action($entity);
|
||||
return $entity;
|
||||
}
|
||||
//Action 기능
|
||||
//생성
|
||||
public function create(array $formDatas): ServiceEntity
|
||||
{
|
||||
@ -235,10 +219,13 @@ class ServiceService extends CustomerService
|
||||
throw new \Exception("서버가 지정되지 않았습니다.");
|
||||
}
|
||||
//신규등록
|
||||
$entity = parent::create($formDatas);
|
||||
//월청구액계산 후 서비스정보에 수정
|
||||
$entity = parent::modify($entity, ['amount' => $this->getServerService()->getTotalAmount($formDatas['serverinfo_uid'])]);
|
||||
$this->action_process($entity, __FUNCTION__ . 'Service');
|
||||
$entity = $this->getEntity(parent::create($formDatas)->getPK());
|
||||
//신규 서버정보수정
|
||||
$entity->getServerService()->setServiceEntity($entity)->modifyService();
|
||||
//신규 결제정보등록
|
||||
$entity = $this->getPaymentService()->setServiceEntity($entity)->createService();
|
||||
//신규 결제정보PK수정
|
||||
$entity = parent::modify($entity, ['payment_uid' => $entity->getPaymentEntity()->getPK()]);
|
||||
return $entity;
|
||||
}
|
||||
//수정
|
||||
@ -248,25 +235,26 @@ class ServiceService extends CustomerService
|
||||
throw new \Exception("서버가 지정되지 않았습니다.");
|
||||
}
|
||||
//기존 각서버파트정보
|
||||
if ($entity->getServerInfoUID() && $entity->getServerInfoUID() !== $formDatas['serverinfo_uid']) {
|
||||
$this->action_process($entity, 'deleteService');
|
||||
if ($entity->getServerEntity()->getPK() !== $formDatas['serverinfo_uid']) {
|
||||
//기존 서버정보 해지
|
||||
$entity->getServerService()->setServiceEntity($entity)->deleteService();
|
||||
}
|
||||
//수정작업
|
||||
//월청구액계산 후 서비스정보에 수정
|
||||
$entity = parent::modify($entity, ['amount' => $this->getServerService()->getTotalAmount($entity->getServerInfoUID())]);
|
||||
$this->action_process($entity, __FUNCTION__ . 'Service');
|
||||
//월청구액계산 확인 후 서비스정보에 수정
|
||||
$entity = $this->getEntity(parent::modify(
|
||||
$entity,
|
||||
['amount' => $this->getServerService()->getTotalAmount($entity->getServerEntity()->getPK())]
|
||||
)->getPK());
|
||||
//신규 서버정보수정
|
||||
$entity->getServerService()->setServiceEntity($entity)->modifyService();
|
||||
return $entity;
|
||||
}
|
||||
//삭제
|
||||
public function delete(mixed $entity): ServiceEntity
|
||||
{
|
||||
$this->action_process($entity, __FUNCTION__ . 'Service');
|
||||
//서버정보 해지
|
||||
$entity->getServerService()->setServiceEntity($entity)->deleteService();
|
||||
//결제정보는 하지않음
|
||||
return parent::delete($entity);
|
||||
}
|
||||
//History
|
||||
public function history(mixed $entity, array $formDatas): ServiceEntity
|
||||
{
|
||||
//서비스 정보수정
|
||||
return $this->getModel()->modify($entity, $formDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment\CS;
|
||||
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Entities\Equipment\CSEntity;
|
||||
use App\Interfaces\Equipment\ServerPartInterface;
|
||||
use App\Services\Equipment\CSService;
|
||||
|
||||
class ServerPart extends CSService implements ServerPartInterface
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
//서버연결정보용 등록
|
||||
private function action_process(ServerPartEntity $serverPartEntity, array $formDatas = []): CSEntity
|
||||
{
|
||||
if (!array_key_exists('status', $formDatas)) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: CS상태가 설정되지 않았습니다.");
|
||||
}
|
||||
//CS정보가져오기
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
if (!$entity instanceof CSEntity) {
|
||||
throw new \Exception("{$serverPartEntity->getPartUID()}에 해당하는 CS정보를 찾을수없습니다.");
|
||||
}
|
||||
//CS정보 수정
|
||||
return $this->modify($entity, $formDatas);
|
||||
}
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
$formDatas['clientinfo_uid'] = $serverPartEntity->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
||||
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
||||
$formDatas['status'] = STATUS['OCCUPIED'];
|
||||
$entity = $this->action_process($serverPartEntity, $formDatas);
|
||||
return $serverPartEntity->setPartEntity($entity);
|
||||
}
|
||||
public function modifyServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
return $this->createServerPart($serverPartEntity);
|
||||
}
|
||||
public function deleteServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = null;
|
||||
$formDatas['serviceinfo_uid'] = null;
|
||||
$formDatas['serverinfo_uid'] = null;
|
||||
$formDatas['status'] = STATUS['AVAILABLE'];
|
||||
$entity = $this->action_process($serverPartEntity, $formDatas);
|
||||
return $serverPartEntity->setPartEntity($entity);
|
||||
}
|
||||
}
|
||||
@ -7,80 +7,12 @@ use App\Entities\Customer\ClientEntity;
|
||||
use App\Helpers\CommonHelper;
|
||||
use App\Models\CommonModel;
|
||||
use App\Services\CommonService;
|
||||
use App\Services\Customer\ClientService;
|
||||
use App\Services\Customer\ServiceService;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use App\Services\UserService;
|
||||
|
||||
abstract class EquipmentService extends CommonService
|
||||
{
|
||||
private ?UserService $_userService = null;
|
||||
private ?ClientService $_clientService = null;
|
||||
private ?ServiceService $_serviceService = null;
|
||||
private ?ServerService $_serverService = null;
|
||||
protected function __construct(CommonModel $model, CommonHelper $helper)
|
||||
{
|
||||
parent::__construct($model, $helper);
|
||||
$this->addClassName('Equipment');
|
||||
}
|
||||
final public function getClientService(): ClientService
|
||||
{
|
||||
if (!$this->_clientService) {
|
||||
$this->_clientService = new ClientService();
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
final public function getUSerService(): UserService
|
||||
{
|
||||
if (!$this->_userService) {
|
||||
$this->_userService = new UserService();
|
||||
}
|
||||
return $this->_userService;
|
||||
}
|
||||
final public function getServiceService(): ServiceService
|
||||
{
|
||||
if (!$this->_serviceService) {
|
||||
$this->_serviceService = new ServiceService();
|
||||
}
|
||||
return $this->_serviceService;
|
||||
}
|
||||
final public function getServerService(): ServerService
|
||||
{
|
||||
if (!$this->_serverService) {
|
||||
$this->_serverService = new ServerService();
|
||||
}
|
||||
return $this->_serverService;
|
||||
}
|
||||
//기본기능
|
||||
//FieldForm관련용
|
||||
public function getFormOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
$options = $this->getUserService()->getEntities();
|
||||
break;
|
||||
case 'clientinfo_uid':
|
||||
$options = $this->getClientService()->getEntities();
|
||||
break;
|
||||
case 'serviceinfo_uid':
|
||||
$options = $this->getServiceService()->getEntities();
|
||||
break;
|
||||
case 'serverinfo_uid':
|
||||
$options = $this->getServerService()->getEntities();
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
//ItemType에 따른 FilterOption 설정용
|
||||
final public function getClient(int $uid): ClientEntity
|
||||
{
|
||||
$entity = $this->getClientService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 해당하는 고객정보가 존재하지 않습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment\IP;
|
||||
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Entities\Equipment\IPEntity;
|
||||
use App\Interfaces\Equipment\ServerPartInterface;
|
||||
use App\Services\Equipment\IPService;
|
||||
|
||||
class ServerPart extends IPService implements ServerPartInterface
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
//서버연결정보용 등록
|
||||
private function action_process(ServerPartEntity $serverPartEntity, array $formDatas = []): IPEntity
|
||||
{
|
||||
if (!array_key_exists('status', $formDatas)) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: IP상태가 설정되지 않았습니다.");
|
||||
}
|
||||
//IP정보가져오기
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
if (!$entity instanceof IPEntity) {
|
||||
throw new \Exception("{$serverPartEntity->getPartUID()}에 해당하는 IP정보를 찾을수없습니다.");
|
||||
}
|
||||
//IP정보 수정
|
||||
return $this->modify($entity, $formDatas);
|
||||
}
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
$formDatas['clientinfo_uid'] = $serverPartEntity->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
||||
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
||||
$formDatas['status'] = STATUS['OCCUPIED'];
|
||||
$entity = $this->action_process($serverPartEntity, $formDatas);
|
||||
return $serverPartEntity->setPartEntity($entity);
|
||||
}
|
||||
public function modifyServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
return $this->createServerPart($serverPartEntity);
|
||||
}
|
||||
public function deleteServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = null;
|
||||
$formDatas['serviceinfo_uid'] = null;
|
||||
$formDatas['serverinfo_uid'] = null;
|
||||
$formDatas['status'] = STATUS['AVAILABLE'];
|
||||
$entity = $this->action_process($serverPartEntity, $formDatas);
|
||||
return $serverPartEntity->setPartEntity($entity);
|
||||
}
|
||||
}
|
||||
@ -4,12 +4,14 @@ namespace App\Services\Equipment;
|
||||
|
||||
use App\Helpers\Equipment\IPHelper;
|
||||
use App\Models\Equipment\IPModel;
|
||||
use App\Services\Customer\ClientService;
|
||||
use App\Services\Equipment\EquipmentService;
|
||||
use App\Services\Equipment\LineService;
|
||||
|
||||
class IPService extends EquipmentService
|
||||
{
|
||||
private ?LineService $_lineService = null;
|
||||
private ?ClientService $_clientService = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new IPModel(), new IPHelper());
|
||||
@ -58,6 +60,13 @@ class IPService extends EquipmentService
|
||||
}
|
||||
return $this->_lineService;
|
||||
}
|
||||
final public function getClientService(): ClientService
|
||||
{
|
||||
if (!$this->_clientService) {
|
||||
$this->_clientService = new ClientService();
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
//기본기능
|
||||
//FieldForm관련용
|
||||
public function getFormOption(string $field, $options = []): array
|
||||
|
||||
@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment\Part;
|
||||
|
||||
use App\Entities\Equipment\PartEntity;
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Interfaces\Equipment\ServerPartInterface;
|
||||
use App\Services\Equipment\PartService;
|
||||
|
||||
class ServerPart extends PartService implements ServerPartInterface
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
//서버연결정보용 등록
|
||||
private function action_process(ServerPartEntity $serverPartEntity, string $action): PartEntity
|
||||
{
|
||||
//부품정보가져오기
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
if (!$entity instanceof PartEntity) {
|
||||
throw new \Exception("{$serverPartEntity->getPartUID()}에 해당하는 부품정보를 찾을수없습니다.");
|
||||
}
|
||||
//부품정보에 서버정보 설정 및 서비스,고객정보 정의
|
||||
$formDatas = [];
|
||||
if ($action === "return") { //해지된 부품 재고 반납 처리
|
||||
$formDatas['stock'] = $entity->getStock() + $serverPartEntity->getCnt();
|
||||
}
|
||||
if ($action === "use") { //사용된 부품 재고 사용처리
|
||||
if ($entity->getStock() < $serverPartEntity->getCnt()) {
|
||||
throw new \Exception("현재 재고수[{$entity->getStock()}]보다 지정하신 갯수({$serverPartEntity->getCnt()})가 더 많습니다.");
|
||||
}
|
||||
$formDatas['stock'] = $entity->getStock() - $serverPartEntity->getCnt();
|
||||
}
|
||||
return $this->modify($entity, $formDatas);
|
||||
}
|
||||
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
$entity = $this->action_process($serverPartEntity, "use");
|
||||
return $serverPartEntity->setPartEntity($entity);
|
||||
}
|
||||
public function modifyServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
return $this->createServerPart($serverPartEntity);
|
||||
}
|
||||
public function deleteServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
$entity = $this->action_process($serverPartEntity, "return");
|
||||
return $serverPartEntity->setPartEntity($entity);
|
||||
}
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment\Server;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
use App\Interfaces\Customer\ServiceInterface;
|
||||
use App\Services\Equipment\ServerService;
|
||||
|
||||
class Service extends ServerService implements ServiceInterface
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
private function action_process(ServiceEntity $serviceEntity, array $formDatas = []): ServerEntity
|
||||
{
|
||||
if (!array_key_exists('status', $formDatas)) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 서버상태가 설정되지 않았습니다.");
|
||||
}
|
||||
//서버정보 가져오기
|
||||
$entity = $this->getEntity(['serviceinfo_uid' => $serviceEntity->getPK()]);
|
||||
if (!$entity instanceof ServerEntity) {
|
||||
throw new \Exception("서비스정보[{$serviceEntity->getPK()}]에 해당하는 서버정보를 찾을수없습니다.");
|
||||
}
|
||||
//서버정보 수정
|
||||
return $this->modify($entity, $formDatas);
|
||||
}
|
||||
public function createService(ServiceEntity $serviceEntity): ServiceEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $serviceEntity->getPK();
|
||||
$formDatas['status'] = STATUS['OCCUPIED'];
|
||||
$entity = $this->action_process($serviceEntity, $formDatas);
|
||||
//서비스정보 Entity에 서버정보 설정
|
||||
return $serviceEntity->setServerEntity($entity);
|
||||
}
|
||||
public function modifyService(ServiceEntity $serviceEntity): ServiceEntity
|
||||
{
|
||||
return $this->createService($serviceEntity);
|
||||
}
|
||||
public function deleteService(ServiceEntity $serviceEntity): ServiceEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = null;
|
||||
$formDatas['serviceinfo_uid'] = null;
|
||||
$formDatas['status'] = STATUS['AVAILABLE'];
|
||||
$entity = $this->action_process($serviceEntity, $formDatas);
|
||||
//서비스정보 Entity에 서버정보 설정
|
||||
return $serviceEntity->setServerEntity($entity);
|
||||
}
|
||||
}
|
||||
69
app/Services/Equipment/ServerPart/CSService.php
Normal file
69
app/Services/Equipment/ServerPart/CSService.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment\ServerPart;
|
||||
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Entities\Equipment\CSEntity;
|
||||
use App\Interfaces\Equipment\ServerPartInterface;
|
||||
use App\Services\Equipment\CSService as ParentService;
|
||||
|
||||
class CSService extends ParentService implements ServerPartInterface
|
||||
{
|
||||
private ?ServerPartEntity $_serverPartEntity = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function setServerPartEntity(ServerPartEntity $entity): self
|
||||
{
|
||||
$this->_serverPartEntity = $entity;
|
||||
return $this;
|
||||
}
|
||||
public function getServerPartEntity(): ServerPartEntity
|
||||
{
|
||||
if (!$this->_serverPartEntity instanceof ServerPartEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 서버파트정보가 정의되지 않았습니다.");
|
||||
}
|
||||
return $this->_serverPartEntity;
|
||||
}
|
||||
|
||||
//서버연결정보용 등록
|
||||
private function action_process(array $formDatas = []): CSEntity
|
||||
{
|
||||
if (!array_key_exists('status', $formDatas)) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: CS상태가 설정되지 않았습니다.");
|
||||
}
|
||||
//CS정보가져오기
|
||||
$entity = $this->getEntity($this->getServerPartEntity()->getPartUID());
|
||||
if (!$entity instanceof CSEntity) {
|
||||
throw new \Exception("{$this->getServerPartEntity()->getPartUID()}에 해당하는 CS정보를 찾을수없습니다.");
|
||||
}
|
||||
//CS정보 수정
|
||||
return $this->modify($entity, $formDatas);
|
||||
}
|
||||
public function createServerPart(): ServerPartEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = $this->getServerPartEntity()->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $this->getServerPartEntity()->getServiceInfoUID();
|
||||
$formDatas['serverinfo_uid'] = $this->getServerPartEntity()->getServerInfoUID();
|
||||
$formDatas['status'] = STATUS['OCCUPIED'];
|
||||
$entity = $this->action_process($formDatas);
|
||||
return $this->getServerPartEntity()->setPartEntity($entity);
|
||||
}
|
||||
public function modifyServerPart(): ServerPartEntity
|
||||
{
|
||||
return $this->createServerPart();
|
||||
}
|
||||
public function deleteServerPart(): ServerPartEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = null;
|
||||
$formDatas['serviceinfo_uid'] = null;
|
||||
$formDatas['serverinfo_uid'] = null;
|
||||
$formDatas['status'] = STATUS['AVAILABLE'];
|
||||
$entity = $this->action_process($formDatas);
|
||||
return $this->getServerPartEntity()->setPartEntity($entity);
|
||||
}
|
||||
}
|
||||
69
app/Services/Equipment/ServerPart/IPService.php
Normal file
69
app/Services/Equipment/ServerPart/IPService.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment\ServerPart;
|
||||
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Entities\Equipment\IPEntity;
|
||||
use App\Interfaces\Equipment\ServerPartInterface;
|
||||
use App\Services\Equipment\IPService as ParentService;
|
||||
|
||||
class IPService extends ParentService implements ServerPartInterface
|
||||
{
|
||||
private ?ServerPartEntity $_serverPartEntity = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function setServerPartEntity(ServerPartEntity $entity): self
|
||||
{
|
||||
$this->_serverPartEntity = $entity;
|
||||
return $this;
|
||||
}
|
||||
public function getServerPartEntity(): ServerPartEntity
|
||||
{
|
||||
if (!$this->_serverPartEntity instanceof ServerPartEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 서버파트정보가 정의되지 않았습니다.");
|
||||
}
|
||||
return $this->_serverPartEntity;
|
||||
}
|
||||
|
||||
//서버연결정보용 등록
|
||||
private function action_process(array $formDatas = []): IPEntity
|
||||
{
|
||||
if (!array_key_exists('status', $formDatas)) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: IP상태가 설정되지 않았습니다.");
|
||||
}
|
||||
//IP정보가져오기
|
||||
$entity = $this->getEntity($this->getServerPartEntity()->getPartUID());
|
||||
if (!$entity instanceof IPEntity) {
|
||||
throw new \Exception("{$this->getServerPartEntity()->getPartUID()}에 해당하는 IP정보를 찾을수없습니다.");
|
||||
}
|
||||
//IP정보 수정
|
||||
return $this->modify($entity, $formDatas);
|
||||
}
|
||||
public function createServerPart(): ServerPartEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = $this->getServerPartEntity()->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $this->getServerPartEntity()->getServiceInfoUID();
|
||||
$formDatas['serverinfo_uid'] = $this->getServerPartEntity()->getServerInfoUID();
|
||||
$formDatas['status'] = STATUS['OCCUPIED'];
|
||||
$entity = $this->action_process($formDatas);
|
||||
return $this->getServerPartEntity()->setPartEntity($entity);
|
||||
}
|
||||
public function modifyServerPart(): ServerPartEntity
|
||||
{
|
||||
return $this->createServerPart();
|
||||
}
|
||||
public function deleteServerPart(): ServerPartEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = null;
|
||||
$formDatas['serviceinfo_uid'] = null;
|
||||
$formDatas['serverinfo_uid'] = null;
|
||||
$formDatas['status'] = STATUS['AVAILABLE'];
|
||||
$entity = $this->action_process($formDatas);
|
||||
return $this->getServerPartEntity()->setPartEntity($entity);
|
||||
}
|
||||
}
|
||||
66
app/Services/Equipment/ServerPart/PartService.php
Normal file
66
app/Services/Equipment/ServerPart/PartService.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment\ServerPart;
|
||||
|
||||
use App\Entities\Equipment\PartEntity;
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Interfaces\Equipment\ServerPartInterface;
|
||||
use App\Services\Equipment\PartService as ParentService;
|
||||
|
||||
class PartService extends ParentService implements ServerPartInterface
|
||||
{
|
||||
private ?ServerPartEntity $_serverPartEntity = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function setServerPartEntity(ServerPartEntity $entity): self
|
||||
{
|
||||
$this->_serverPartEntity = $entity;
|
||||
return $this;
|
||||
}
|
||||
public function getServerPartEntity(): ServerPartEntity
|
||||
{
|
||||
if (!$this->_serverPartEntity instanceof ServerPartEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 서버파트정보가 정의되지 않았습니다.");
|
||||
}
|
||||
return $this->_serverPartEntity;
|
||||
}
|
||||
//서버연결정보용 등록
|
||||
private function action_process(string $action): PartEntity
|
||||
{
|
||||
//부품정보가져오기
|
||||
$entity = $this->getEntity($this->getServerPartEntity()->getPartUID());
|
||||
if (!$entity instanceof PartEntity) {
|
||||
throw new \Exception("{$this->getServerPartEntity()->getPartUID()}에 해당하는 부품정보를 찾을수없습니다.");
|
||||
}
|
||||
//부품정보에 서버정보 설정 및 서비스,고객정보 정의
|
||||
$formDatas = [];
|
||||
if ($action === "return") { //해지된 부품 재고 반납 처리
|
||||
$formDatas['stock'] = $entity->getStock() + $this->getServerPartEntity()->getCnt();
|
||||
}
|
||||
if ($action === "use") { //사용된 부품 재고 사용처리
|
||||
if ($entity->getStock() < $this->getServerPartEntity()->getCnt()) {
|
||||
throw new \Exception("현재 재고수[{$entity->getStock()}]보다 지정하신 갯수({$this->getServerPartEntity()->getCnt()})가 더 많습니다.");
|
||||
}
|
||||
$formDatas['stock'] = $entity->getStock() - $this->getServerPartEntity()->getCnt();
|
||||
}
|
||||
return $this->modify($entity, $formDatas);
|
||||
}
|
||||
|
||||
public function createServerPart(): ServerPartEntity
|
||||
{
|
||||
$entity = $this->action_process("use");
|
||||
return $this->getServerPartEntity()->setPartEntity($entity);
|
||||
}
|
||||
public function modifyServerPart(): ServerPartEntity
|
||||
{
|
||||
return $this->createServerPart();
|
||||
}
|
||||
public function deleteServerPart(): ServerPartEntity
|
||||
{
|
||||
$entity = $this->action_process("return");
|
||||
return $this->getServerPartEntity()->setPartEntity($entity);
|
||||
}
|
||||
}
|
||||
82
app/Services/Equipment/ServerPart/PaymentService.php
Normal file
82
app/Services/Equipment/ServerPart/PaymentService.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment\ServerPart;
|
||||
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Entities\PaymentEntity;
|
||||
use App\Interfaces\Equipment\ServerPartInterface;
|
||||
use App\Services\PaymentService as ParentService;
|
||||
|
||||
class PaymentService extends ParentService implements ServerPartInterface
|
||||
{
|
||||
private ?ServerPartEntity $_serverPartEntity = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function setServerPartEntity(ServerPartEntity $entity): self
|
||||
{
|
||||
$this->_serverPartEntity = $entity;
|
||||
return $this;
|
||||
}
|
||||
public function getServerPartEntity(): ServerPartEntity
|
||||
{
|
||||
if (!$this->_serverPartEntity instanceof ServerPartEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 서버파트정보가 정의되지 않았습니다.");
|
||||
}
|
||||
return $this->_serverPartEntity;
|
||||
}
|
||||
|
||||
private function action_process(): array
|
||||
{
|
||||
if ($this->getServerPartEntity()->getServiceInfoUID() === null) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 서비스정보가 정의된 후에만 가능합니다.");
|
||||
}
|
||||
//일회인이 아닌경우
|
||||
if ($this->getServerPartEntity()->getBilling() !== PAYMENT['BILLING']['ONETIME']) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: :" . lang("{$this->getClassName()}.BILLING." . PAYMENT['BILLING'][$this->getServerPartEntity()->getBilling()]) . "지급 상품은 처리가 불가, 일회성만 가능합니다.");
|
||||
}
|
||||
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = $this->getServerPartEntity()->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $this->getServerPartEntity()->getServiceInfoUID();
|
||||
$formDatas['serverinfo_uid'] = $this->getServerPartEntity()->getServerInfoUID(); //서버연결정보 수정시에 필요함
|
||||
//타이틀은 기타의 경우 직접작성한 제목을 등록하고 아닌경우는 Part의 Title을 사용한다.
|
||||
$formDatas['title'] = $this->getServerPartEntity()->getType() === 'ETC' ? $this->getServerPartEntity()->getTitle() : $this->getServerPartEntity()->getPartEntity()->getTitle();
|
||||
$formDatas['amount'] = $this->getServerPartEntity()->getAmount();
|
||||
$formDatas['billing'] = $this->getServerPartEntity()->getBilling();
|
||||
return $formDatas;
|
||||
}
|
||||
public function createServerPart(): ServerPartEntity
|
||||
{
|
||||
//필수정보처리 후 FormData 가져오기
|
||||
$formDatas = $this->action_process();
|
||||
//당일결체일로 설정
|
||||
$formDatas['billing_at'] = date("Y-m-d");
|
||||
//결제정보등록
|
||||
$entity = $this->create($formDatas);
|
||||
//서버연결정보 Entity에 결제정보 설정
|
||||
return $this->getServerPartEntity()->setPaymentEntity($entity);
|
||||
}
|
||||
public function modifyServerPart(): ServerPartEntity
|
||||
{
|
||||
//미납상태의 결제정보 가져오기
|
||||
$entity = $this->getEntity(['serverpartinfo_uid' => $this->getServerPartEntity()->getPK(), 'status' => STATUS['UNPAID']]);
|
||||
if (!$entity instanceof PaymentEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$this->getServerPartEntity()->getPK()}에 해당하는 결제정보를 찾을수 없습니다.");
|
||||
}
|
||||
//필수정보처리 후 FormData 가져오기
|
||||
$formDatas = $this->action_process();
|
||||
//결제정보수정
|
||||
$entity = $this->modify($entity, $formDatas);
|
||||
//서버연결정보 Entity에 결제정보 설정
|
||||
return $this->getServerPartEntity()->setPaymentEntity($entity);
|
||||
}
|
||||
|
||||
public function deleteServerPart(): ServerPartEntity
|
||||
{
|
||||
//삭제시에는 아무것도 하지 않는다.
|
||||
return $this->getServerPartEntity();
|
||||
}
|
||||
}
|
||||
57
app/Services/Equipment/ServerPart/ServerService.php
Normal file
57
app/Services/Equipment/ServerPart/ServerService.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment\ServerPart;
|
||||
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Interfaces\Equipment\ServerPartInterface;
|
||||
use App\Services\Equipment\ServerService as ParentService;
|
||||
|
||||
|
||||
class ServerService extends ParentService implements ServerPartInterface
|
||||
{
|
||||
private ?ServerPartEntity $_serverPartEntity = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function setServerPartEntity(ServerPartEntity $entity): self
|
||||
{
|
||||
$this->_serverPartEntity = $entity;
|
||||
return $this;
|
||||
}
|
||||
public function getServerPartEntity(): ServerPartEntity
|
||||
{
|
||||
if (!$this->_serverPartEntity instanceof ServerPartEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 서버파트정보가 정의되지 않았습니다.");
|
||||
}
|
||||
return $this->_serverPartEntity;
|
||||
}
|
||||
|
||||
//월과금은 해당 서비스의 항목별 금액을 총 합산후 청구금액을 설정후 결제정보에 신규등록/수정한다
|
||||
private function action_process(): ServerEntity
|
||||
{
|
||||
//Service Entity 가져오기
|
||||
$entity = $this->getEntity($this->getServerPartEntity()->getServiceInfoUID());
|
||||
if (!$entity instanceof ServerEntity) {
|
||||
throw new \Exception("[{$this->getServerPartEntity()->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
//서비스금액은 modify 함수내에서 재계산을 하므로 여기서는 modify만 호출함
|
||||
return parent::modify($entity, []);
|
||||
}
|
||||
public function createServerPart(): ServerPartEntity
|
||||
{
|
||||
//필수정보처리 후 FormData 가져오기
|
||||
$this->action_process();
|
||||
return $this->getServerPartEntity();
|
||||
}
|
||||
public function modifyServerPart(): ServerPartEntity
|
||||
{
|
||||
return $this->createServerPart();
|
||||
}
|
||||
public function deleteServerPart(): ServerPartEntity
|
||||
{
|
||||
return $this->createServerPart();
|
||||
}
|
||||
}
|
||||
57
app/Services/Equipment/ServerPart/ServiceService.php
Normal file
57
app/Services/Equipment/ServerPart/ServiceService.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment\ServerPart;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Interfaces\Equipment\ServerPartInterface;
|
||||
use App\Services\Customer\ServiceService as ParentService;
|
||||
|
||||
|
||||
class ServiceService extends ParentService implements ServerPartInterface
|
||||
{
|
||||
private ?ServerPartEntity $_serverPartEntity = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function setServerPartEntity(ServerPartEntity $entity): self
|
||||
{
|
||||
$this->_serverPartEntity = $entity;
|
||||
return $this;
|
||||
}
|
||||
public function getServerPartEntity(): ServerPartEntity
|
||||
{
|
||||
if (!$this->_serverPartEntity instanceof ServerPartEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 서버파트정보가 정의되지 않았습니다.");
|
||||
}
|
||||
return $this->_serverPartEntity;
|
||||
}
|
||||
|
||||
//월과금은 해당 서비스의 항목별 금액을 총 합산후 청구금액을 설정후 결제정보에 신규등록/수정한다
|
||||
private function action_process(): ServiceEntity
|
||||
{
|
||||
//Service Entity 가져오기
|
||||
$entity = $this->getEntity($this->getServerPartEntity()->getServiceInfoUID());
|
||||
if (!$entity instanceof ServiceEntity) {
|
||||
throw new \Exception("[{$this->getServerPartEntity()->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
//서비스금액은 modify 함수내에서 재계산을 하므로 여기서는 modify만 호출함
|
||||
return parent::modify($entity, []);
|
||||
}
|
||||
public function createServerPart(): ServerPartEntity
|
||||
{
|
||||
//필수정보처리 후 FormData 가져오기
|
||||
$this->action_process();
|
||||
return $this->getServerPartEntity();
|
||||
}
|
||||
public function modifyServerPart(): ServerPartEntity
|
||||
{
|
||||
return $this->createServerPart();
|
||||
}
|
||||
public function deleteServerPart(): ServerPartEntity
|
||||
{
|
||||
return $this->createServerPart();
|
||||
}
|
||||
}
|
||||
69
app/Services/Equipment/ServerPart/SwitchService.php
Normal file
69
app/Services/Equipment/ServerPart/SwitchService.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment\ServerPart;
|
||||
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Entities\Equipment\SwitchEntity;
|
||||
use App\Interfaces\Equipment\ServerPartInterface;
|
||||
use App\Services\Equipment\SwitchService as ParentService;
|
||||
|
||||
class SwitchService extends ParentService implements ServerPartInterface
|
||||
{
|
||||
private ?ServerPartEntity $_serverPartEntity = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function setServerPartEntity(ServerPartEntity $entity): self
|
||||
{
|
||||
$this->_serverPartEntity = $entity;
|
||||
return $this;
|
||||
}
|
||||
public function getServerPartEntity(): ServerPartEntity
|
||||
{
|
||||
if (!$this->_serverPartEntity instanceof ServerPartEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 서버파트정보가 정의되지 않았습니다.");
|
||||
}
|
||||
return $this->_serverPartEntity;
|
||||
}
|
||||
|
||||
//서버연결정보용 등록
|
||||
private function action_process(array $formDatas = []): SwitchEntity
|
||||
{
|
||||
if (!array_key_exists('status', $formDatas)) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: Switch상태가 설정되지 않았습니다.");
|
||||
}
|
||||
//Switch정보가져오기
|
||||
$entity = $this->getEntity($this->getServerPartEntity()->getPartUID());
|
||||
if (!$entity instanceof SwitchEntity) {
|
||||
throw new \Exception("{$this->getServerPartEntity()->getPartUID()}에 해당하는 Switch정보를 찾을수없습니다.");
|
||||
}
|
||||
//Switch정보 수정
|
||||
return $this->modify($entity, $formDatas);
|
||||
}
|
||||
public function createServerPart(): ServerPartEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = $this->getServerPartEntity()->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $this->getServerPartEntity()->getServiceInfoUID();
|
||||
$formDatas['serverinfo_uid'] = $this->getServerPartEntity()->getServerInfoUID();
|
||||
$formDatas['status'] = STATUS['OCCUPIED'];
|
||||
$entity = $this->action_process($formDatas);
|
||||
return $this->getServerPartEntity()->setPartEntity($entity);
|
||||
}
|
||||
public function modifyServerPart(): ServerPartEntity
|
||||
{
|
||||
return $this->createServerPart();
|
||||
}
|
||||
public function deleteServerPart(): ServerPartEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = null;
|
||||
$formDatas['serviceinfo_uid'] = null;
|
||||
$formDatas['serverinfo_uid'] = null;
|
||||
$formDatas['status'] = STATUS['AVAILABLE'];
|
||||
$entity = $this->action_process($formDatas);
|
||||
return $this->getServerPartEntity()->setPartEntity($entity);
|
||||
}
|
||||
}
|
||||
@ -7,15 +7,19 @@ use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Entities\PaymentEntity;
|
||||
use App\Helpers\Equipment\ServerPartHelper;
|
||||
use App\Models\Equipment\ServerPartModel;
|
||||
use App\Services\Equipment\CS\ServerPart as CSService;
|
||||
use App\Services\Equipment\EquipmentService;
|
||||
use App\Services\Equipment\IP\ServerPart as IPService;
|
||||
use App\Services\Equipment\Part\ServerPart as PartService;
|
||||
use App\Services\Equipment\Switch\ServerPart as SwitchService;
|
||||
use App\Services\Payment\ServerPart as PaymentService;
|
||||
use App\Services\Equipment\ServerPart\ServiceService;
|
||||
use App\Services\Equipment\ServerPart\ServerService;
|
||||
use App\Services\Equipment\ServerPart\CSService;
|
||||
use App\Services\Equipment\ServerPart\IPService;
|
||||
use App\Services\Equipment\ServerPart\PartService;
|
||||
use App\Services\Equipment\ServerPart\SwitchService;
|
||||
use App\Services\Equipment\ServerPart\PaymentService;
|
||||
|
||||
class ServerPartService extends EquipmentService
|
||||
{
|
||||
private ?ServiceService $_serviceService = null;
|
||||
private ?ServerService $_serverService = null;
|
||||
private ?SwitchService $_switchService = null;
|
||||
private ?PartService $_partService = null;
|
||||
private ?IPService $_ipService = null;
|
||||
@ -74,6 +78,20 @@ class ServerPartService extends EquipmentService
|
||||
{
|
||||
return ['billing', 'type'];
|
||||
}
|
||||
final public function getServiceService(): ServiceService
|
||||
{
|
||||
if (!$this->_serviceService) {
|
||||
$this->_serviceService = new ServiceService();
|
||||
}
|
||||
return $this->_serviceService;
|
||||
}
|
||||
final public function getServerService(): ServerService
|
||||
{
|
||||
if (!$this->_serverService) {
|
||||
$this->_serverService = new ServerService();
|
||||
}
|
||||
return $this->_serverService;
|
||||
}
|
||||
final public function getPartService(): PartService
|
||||
{
|
||||
if (!$this->_partService) {
|
||||
@ -102,7 +120,6 @@ class ServerPartService extends EquipmentService
|
||||
}
|
||||
return $this->_csService;
|
||||
}
|
||||
|
||||
final public function getPaymentService(): PaymentService
|
||||
{
|
||||
if (!$this->_paymentService) {
|
||||
@ -136,8 +153,8 @@ class ServerPartService extends EquipmentService
|
||||
break;
|
||||
}
|
||||
//결제정보 정의
|
||||
if ($entity->getPaymentInfoUID()) {
|
||||
$paymentEntity = $this->getPaymentService()->getEntity($entity->getPaymentInfoUID());
|
||||
if ($entity->getPaymentUID()) {
|
||||
$paymentEntity = $this->getPaymentService()->getEntity($entity->getPaymentUID());
|
||||
if ($paymentEntity instanceof PaymentEntity) {
|
||||
$entity->setPaymentEntity($paymentEntity);
|
||||
}
|
||||
|
||||
@ -2,14 +2,15 @@
|
||||
|
||||
namespace App\Services\Equipment;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
use App\Helpers\Equipment\ServerHelper;
|
||||
use App\Models\Equipment\ServerModel;
|
||||
use App\Services\Customer\ServiceService;
|
||||
use App\Services\Equipment\EquipmentService;
|
||||
|
||||
class ServerService extends EquipmentService
|
||||
{
|
||||
private ?ServiceService $_serviceService = null;
|
||||
private ?ServerPartService $_serverPartService = null;
|
||||
public function __construct()
|
||||
{
|
||||
@ -67,6 +68,13 @@ class ServerService extends EquipmentService
|
||||
{
|
||||
return ['clientinfo_uid', 'status'];
|
||||
}
|
||||
final public function getServiceService(): ServiceService
|
||||
{
|
||||
if ($this->_serviceService === null) {
|
||||
$this->_serviceService = new ServiceService();
|
||||
}
|
||||
return $this->_serviceService;
|
||||
}
|
||||
final public function getServerPartService(): ServerPartService
|
||||
{
|
||||
if (!$this->_serverPartService) {
|
||||
@ -74,6 +82,7 @@ class ServerService extends EquipmentService
|
||||
}
|
||||
return $this->_serverPartService;
|
||||
}
|
||||
|
||||
//partEntity 정보 추가
|
||||
protected function getEntity_process(mixed $entity): ServerEntity
|
||||
{
|
||||
@ -97,6 +106,25 @@ class ServerService extends EquipmentService
|
||||
}
|
||||
return $total_amount;
|
||||
}
|
||||
//create용 장비코드 마지막번호 가져오기
|
||||
final public function getLastestCode(string $format, int $default): string
|
||||
{
|
||||
return $this->getModel()->getLastestCode($format, $default);
|
||||
}
|
||||
final public function codeCheck(array $formDatas)
|
||||
{
|
||||
//코드 패턴체크
|
||||
$pattern = env("Server.Prefix.code.pattern", false);
|
||||
if (!$pattern) {
|
||||
throw new \Exception(__METHOD__ . "에서 code의 prefix[Server.Prefix.code.pattern]가 정의되지 않았습니다.");
|
||||
}
|
||||
if (!array_key_exists('code', $formDatas)) {
|
||||
throw new \Exception("Server코드가 정의되지 않았습니다");
|
||||
}
|
||||
if (!preg_match($pattern, $formDatas['code'])) {
|
||||
throw new \Exception("Server코드[{$formDatas['code']}의 형식이 맞지않습니다");
|
||||
}
|
||||
}
|
||||
//기본 기능부분
|
||||
//FieldForm관련용
|
||||
public function setFormData(string $field, array $requestDatas, array $formDatas): array
|
||||
@ -117,47 +145,10 @@ class ServerService extends EquipmentService
|
||||
}
|
||||
return $formDatas;
|
||||
}
|
||||
//create용 장비코드 마지막번호 가져오기
|
||||
final public function getLastestCode(string $format, int $default): string
|
||||
{
|
||||
return $this->getModel()->getLastestCode($format, $default);
|
||||
}
|
||||
final public function codeCheck(array $formDatas)
|
||||
{
|
||||
//코드 패턴체크
|
||||
$pattern = env("Server.Prefix.code.pattern", false);
|
||||
if (!$pattern) {
|
||||
throw new \Exception(__METHOD__ . "에서 code의 prefix[Server.Prefix.code.pattern]가 정의되지 않았습니다.");
|
||||
}
|
||||
if (!array_key_exists('code', $formDatas)) {
|
||||
throw new \Exception("Server코드가 정의되지 않았습니다");
|
||||
}
|
||||
if (!preg_match($pattern, $formDatas['code'])) {
|
||||
throw new \Exception("Server코드[{$formDatas['code']}의 형식이 맞지않습니다");
|
||||
}
|
||||
}
|
||||
// 수정
|
||||
public function modify(mixed $entity, array $formDatas): ServerEntity
|
||||
{
|
||||
//서비스정보가져오기
|
||||
if (!array_key_exists('serviceinfo_uid', $formDatas)) {
|
||||
throw new \Exception("서비스 정보가 지정되지 않았습니다.");
|
||||
}
|
||||
$serviceEntity = $this->getServiceService()->getEntity($formDatas['serviceinfo_uid']);
|
||||
if ($serviceEntity instanceof ServiceEntity) {
|
||||
//서비스상태에 따라
|
||||
if ($formDatas['status'] === STATUS['AVAILABLE']) {
|
||||
//사용가능
|
||||
$formDatas["clientinfo_uid"] = null;
|
||||
$formDatas["serviceinfo_uid"] = null;
|
||||
} else {
|
||||
//사용중 , 일시정지
|
||||
$formDatas["clientinfo_uid"] = $serviceEntity->getClientInfoUID();
|
||||
$formDatas["serviceinfo_uid"] = $serviceEntity->getPK();
|
||||
}
|
||||
}
|
||||
//서버정보수정
|
||||
return $this->getEntity_process(parent::modify($entity, $formDatas));
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
//삭제
|
||||
public function delete(mixed $entity): ServerEntity
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment\Switch;
|
||||
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Entities\Equipment\SwitchEntity;
|
||||
use App\Interfaces\Equipment\ServerPartInterface;
|
||||
use App\Services\Equipment\SwitchService;
|
||||
|
||||
class ServerPart extends SwitchService implements ServerPartInterface
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
//서버연결정보용 등록
|
||||
private function action_process(ServerPartEntity $serverPartEntity, array $formDatas = []): SwitchEntity
|
||||
{
|
||||
if (!array_key_exists('status', $formDatas)) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 스위치상태가 설정되지 않았습니다.");
|
||||
}
|
||||
//스위치정보가져오기
|
||||
$entity = $this->getEntity($serverPartEntity->getPartUID());
|
||||
if (!$entity instanceof SwitchEntity) {
|
||||
throw new \Exception("{$serverPartEntity->getPartUID()}에 해당하는 스위치정보를 찾을수없습니다.");
|
||||
}
|
||||
//스위치정보 수정
|
||||
return $this->modify($entity, $formDatas);
|
||||
}
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
$formDatas['clientinfo_uid'] = $serverPartEntity->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
||||
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID();
|
||||
$formDatas['status'] = STATUS['OCCUPIED'];
|
||||
$entity = $this->action_process($serverPartEntity, $formDatas);
|
||||
return $serverPartEntity->setPartEntity($entity);
|
||||
}
|
||||
public function modifyServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
return $this->createServerPart($serverPartEntity);
|
||||
}
|
||||
public function deleteServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = null;
|
||||
$formDatas['serviceinfo_uid'] = null;
|
||||
$formDatas['serverinfo_uid'] = null;
|
||||
$formDatas['status'] = STATUS['AVAILABLE'];
|
||||
$entity = $this->action_process($serverPartEntity, $formDatas);
|
||||
return $serverPartEntity->setPartEntity($entity);
|
||||
}
|
||||
}
|
||||
@ -1,68 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Payment;
|
||||
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Entities\PaymentEntity;
|
||||
use App\Interfaces\Equipment\ServerPartInterface;
|
||||
use App\Services\PaymentService;
|
||||
|
||||
class ServerPart extends PaymentService implements ServerPartInterface
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
private function action_process(ServerPartEntity $serverPartEntity): array
|
||||
{
|
||||
if ($serverPartEntity->getServiceInfoUID() === null) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: 서비스정보가 정의된 후에만 가능합니다.");
|
||||
}
|
||||
//일회인이 아닌경우
|
||||
if ($serverPartEntity->getBilling() !== PAYMENT['BILLING']['ONETIME']) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: :" . lang("{$this->getClassName()}.BILLING." . PAYMENT['BILLING'][$serverPartEntity->getBilling()]) . "지급 상품은 처리가 불가, 일회성만 가능합니다.");
|
||||
}
|
||||
|
||||
$formDatas = [];
|
||||
$formDatas['clientinfo_uid'] = $serverPartEntity->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $serverPartEntity->getServiceInfoUID();
|
||||
$formDatas['serverinfo_uid'] = $serverPartEntity->getServerInfoUID(); //서버연결정보 수정시에 필요함
|
||||
//타이틀은 기타의 경우 직접작성한 제목을 등록하고 아닌경우는 Part의 Title을 사용한다.
|
||||
$formDatas['title'] = $serverPartEntity->getType() === 'ETC' ? $serverPartEntity->getTitle() : $serverPartEntity->getPartEntity()->getTitle();
|
||||
$formDatas['amount'] = $serverPartEntity->getAmount();
|
||||
$formDatas['billing'] = $serverPartEntity->getBilling();
|
||||
return $formDatas;
|
||||
}
|
||||
public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
//필수정보처리 후 FormData 가져오기
|
||||
$formDatas = $this->action_process($serverPartEntity);
|
||||
//당일결체일로 설정
|
||||
$formDatas['billing_at'] = date("Y-m-d");
|
||||
//결제정보등록
|
||||
$entity = $this->create($formDatas);
|
||||
//서버연결정보 Entity에 결제정보 설정
|
||||
return $serverPartEntity->setPaymentEntity($entity);
|
||||
}
|
||||
public function modifyServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
//미납상태의 결제정보 가져오기
|
||||
$entity = $this->getEntity(['serverpartinfo_uid' => $serverPartEntity->getPK(), 'status' => STATUS['UNPAID']]);
|
||||
if (!$entity instanceof PaymentEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$serverPartEntity->getPK()}에 해당하는 결제정보를 찾을수 없습니다.");
|
||||
}
|
||||
//필수정보처리 후 FormData 가져오기
|
||||
$formDatas = $this->action_process($serverPartEntity);
|
||||
//결제정보수정
|
||||
$entity = $this->modify($entity, $formDatas);
|
||||
//서버연결정보 Entity에 결제정보 설정
|
||||
return $serverPartEntity->setPaymentEntity($entity);
|
||||
}
|
||||
|
||||
public function deleteServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
||||
{
|
||||
//삭제시에는 아무것도 하지 않는다.
|
||||
return $serverPartEntity;
|
||||
}
|
||||
}
|
||||
@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Payment;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\PaymentEntity;
|
||||
use App\Interfaces\Customer\ServiceInterface;
|
||||
use App\Services\PaymentService;
|
||||
|
||||
class Service extends PaymentService implements ServiceInterface
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
private function action_process(ServiceEntity $serviceEntity, array $formDatas = []): array
|
||||
{
|
||||
$formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $serviceEntity->getPK();
|
||||
$formDatas['serverinfo_uid'] = $serviceEntity->getServerInfoUID();
|
||||
$formDatas['title'] = $serviceEntity->getServerEntity()->getTitle();
|
||||
$formDatas['amount'] = $serviceEntity->getAmount();
|
||||
$formDatas['billing'] = PAYMENT['BILLING']['MONTH'];
|
||||
$formDatas['billing_at'] = $serviceEntity->getBillingAt();
|
||||
return $formDatas;
|
||||
}
|
||||
public function createService(ServiceEntity $serviceEntity): ServiceEntity
|
||||
{
|
||||
//필수정보처리 후 결제정보등록
|
||||
$entity = $this->create($this->action_process($serviceEntity));
|
||||
//서비스정보 Entity에 결제정보 설정
|
||||
return $serviceEntity->setPaymentEntity($entity);
|
||||
}
|
||||
public function modifyService(ServiceEntity $serviceEntity): ServiceEntity
|
||||
{
|
||||
//미납상태의 결제정보 가져오기
|
||||
$entity = $this->getEntity(['serviceinfo_uid' => $serviceEntity->getPK(), 'status' => STATUS['UNPAID']]);
|
||||
if (!$entity instanceof PaymentEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$serviceEntity->getPK()}에 해당하는 결제정보를 찾을수 없습니다.");
|
||||
}
|
||||
//필수정보처리 후 결제정보수정
|
||||
$entity = $this->modify($entity, $this->action_process($serviceEntity));
|
||||
//서비스정보 Entity에 결제정보 설정
|
||||
return $serviceEntity->setPaymentEntity($entity);
|
||||
}
|
||||
public function deleteService(ServiceEntity $serviceEntity): ServiceEntity
|
||||
{
|
||||
//삭제시에는 아무것도 하지 않는다.
|
||||
return $serviceEntity;
|
||||
}
|
||||
}
|
||||
@ -2,13 +2,13 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\PaymentEntity;
|
||||
use App\Helpers\PaymentHelper;
|
||||
use App\Models\PaymentModel;
|
||||
use App\Services\CommonService;
|
||||
use App\Services\Customer\ClientService;
|
||||
use App\Services\Customer\ServiceService;
|
||||
use App\Services\Equipment\ServerPartService;
|
||||
use App\Services\UserService;
|
||||
|
||||
class PaymentService extends CommonService
|
||||
@ -16,6 +16,7 @@ class PaymentService extends CommonService
|
||||
private ?UserService $_userService = null;
|
||||
private ?ClientService $_clientService = null;
|
||||
private ?ServiceService $_serviceService = null;
|
||||
private ?ServerPartService $_serverPartService = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new PaymentModel(), new PaymentHelper());
|
||||
@ -88,11 +89,34 @@ class PaymentService extends CommonService
|
||||
}
|
||||
final public function getServiceService(): ServiceService
|
||||
{
|
||||
if (!$this->_serviceService) {
|
||||
if ($this->_serviceService === null) {
|
||||
$this->_serviceService = new ServiceService();
|
||||
}
|
||||
return $this->_serviceService;
|
||||
}
|
||||
final public function getServerPartService(): ServerPartService
|
||||
{
|
||||
if (!$this->_serverPartService) {
|
||||
$this->_serverPartService = new ServerPartService();
|
||||
}
|
||||
return $this->_serverPartService;
|
||||
}
|
||||
|
||||
//당일 기준으로 총 미납건수, 금액
|
||||
final public function getUnPaids(string $group, array $where = []): array
|
||||
{
|
||||
$rows = $this->getModel()->groupBy($group)
|
||||
->select("{$group},COUNT(uid) as cnt, SUM(amount) as amount")
|
||||
->where(['billing_at <=' => date('Y-m-d')])
|
||||
->where(['status' => STATUS['UNPAID']])
|
||||
->where($where)
|
||||
->get()->getResult();
|
||||
$unPaids = [];
|
||||
foreach ($rows as $row) {
|
||||
$unPaids[$row->$group] = ['cnt' => $row->cnt, 'amount' => $row->amount];
|
||||
}
|
||||
return $unPaids;
|
||||
}
|
||||
//기본 기능부분
|
||||
//FieldForm관련용
|
||||
final public function getFormOption(string $field, array $options = []): array
|
||||
@ -113,28 +137,7 @@ class PaymentService extends CommonService
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
//List 검색용
|
||||
//OrderBy 처리
|
||||
final public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||
{
|
||||
$this->getModel()->orderBy('billing_at ASC');
|
||||
parent::setOrderBy($field, $value);
|
||||
}
|
||||
//당일 기준으로 총 미납건수, 금액
|
||||
final public function getUnPaids(string $group, array $where = []): array
|
||||
{
|
||||
$rows = $this->getModel()->groupBy($group)
|
||||
->select("{$group},COUNT(uid) as cnt, SUM(amount) as amount")
|
||||
->where(['billing_at <=' => date('Y-m-d')])
|
||||
->where(['status' => STATUS['UNPAID']])
|
||||
->where($where)
|
||||
->get()->getResult();
|
||||
$unPaids = [];
|
||||
foreach ($rows as $row) {
|
||||
$unPaids[$row->$group] = ['cnt' => $row->cnt, 'amount' => $row->amount];
|
||||
}
|
||||
return $unPaids;
|
||||
}
|
||||
//Action 기능
|
||||
//생성
|
||||
final public function create(array $formDatas): PaymentEntity
|
||||
{
|
||||
@ -149,4 +152,11 @@ class PaymentService extends CommonService
|
||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
//List 검색용
|
||||
//OrderBy 처리
|
||||
final public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||
{
|
||||
$this->getModel()->orderBy('billing_at ASC');
|
||||
parent::setOrderBy($field, $value);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user