updated README and Postman Collection for API

pull/53/head
13621160019@163.com 2021-07-16 18:56:55 +08:00
parent 443fe4e56e
commit cdc9414c9d
3 changed files with 80 additions and 95 deletions

View File

@ -614,14 +614,7 @@
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/contacts/2",
"host": [
"{{base_url}}"
],
"path": [
"contacts",
"2"
]
"raw": ""
}
},
"response": []
@ -817,15 +810,7 @@
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/costcenters/1/tariffs",
"host": [
"{{base_url}}"
],
"path": [
"costcenters",
"1",
"tariffs"
]
"raw": ""
}
},
"response": []
@ -1345,14 +1330,7 @@
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/emailservers/1",
"host": [
"{{base_url}}"
],
"path": [
"emailservers",
"1"
]
"raw": ""
}
},
"response": []
@ -1382,17 +1360,10 @@
{
"name": "DELETE an Email Server by ID",
"request": {
"method": "DELETE",
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/emailservers/2",
"host": [
"{{base_url}}"
],
"path": [
"emailservers",
"2"
]
"raw": ""
}
},
"response": []
@ -2670,10 +2641,6 @@
"request": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\"data\":{\"serial_port\":\"/dev/ttyS0\",\"baud_rate\":9600}}"
},
"url": {
"raw": "{{base_url}}/gsmmodems/1",
"host": [
@ -4648,14 +4615,14 @@
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/spaces/1/points",
"raw": "{{base_url}}/spaces/1/virtualmeters",
"host": [
"{{base_url}}"
],
"path": [
"spaces",
"1",
"points"
"virtualmeters"
]
}
},
@ -5785,17 +5752,10 @@
{
"name": "DELETE a Tenant by ID",
"request": {
"method": "DELETE",
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/tenants/2",
"host": [
"{{base_url}}"
],
"path": [
"tenants",
"2"
]
"raw": ""
}
},
"response": []
@ -6337,6 +6297,17 @@
},
"response": []
},
{
"name": "GET a Timezone by ID",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": ""
}
},
"response": []
},
{
"name": "PUT Update a Timezone",
"request": {
@ -6358,24 +6329,6 @@
}
},
"response": []
},
{
"name": "GET a Timezone by ID",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/timezones/1",
"host": [
"{{base_url}}"
],
"path": [
"timezones",
"1"
]
}
},
"response": []
}
]
},
@ -6445,28 +6398,6 @@
},
"response": []
},
{
"name": "PUT User Login by Email",
"request": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\"data\":{\"email\":\"administrator@myems.io\", \"password\":\"!MyEMS1\"}}"
},
"url": {
"raw": "{{base_url}}/users/login",
"host": [
"{{base_url}}"
],
"path": [
"users",
"login"
]
}
},
"response": []
},
{
"name": "DELETE User",
"request": {
@ -6668,6 +6599,28 @@
}
},
"response": []
},
{
"name": "PUT User Login by Email",
"request": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\"data\":{\"email\":\"administrator@myems.io\", \"password\":\"!MyEMS1\"}}"
},
"url": {
"raw": "{{base_url}}/users/login",
"host": [
"{{base_url}}"
],
"path": [
"users",
"login"
]
}
},
"response": []
}
]
},
@ -7655,6 +7608,38 @@
},
"response": []
},
{
"name": "GET Equipment Batch Analysis Report",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/reports/equipmentbatch?spaceid=1&reportingperiodstartdatetime=2020-10-01T00:00:00&reportingperiodenddatetime=2020-11-01T00:00:00",
"host": [
"{{base_url}}"
],
"path": [
"reports",
"equipmentbatch"
],
"query": [
{
"key": "spaceid",
"value": "1"
},
{
"key": "reportingperiodstartdatetime",
"value": "2020-10-01T00:00:00"
},
{
"key": "reportingperiodenddatetime",
"value": "2020-11-01T00:00:00"
}
]
}
},
"response": []
},
{
"name": "GET Equipment Cost Report",
"request": {

View File

@ -2092,6 +2092,10 @@ $ curl -i -X GET {{base_url}}/reports/distributionsystem?distributionsystemid=1
```
$ curl -i -X GET {{base_url}}/reports/energyflowdiagram?energyflowdiagramid=1&reportingperiodstartdatetime={reportingperiodstartdatetime}&reportingperiodenddatetime={reportingperiodenddatetime}
```
* GET Equipment Batch Analysis Report
```
$ curl -i -X GET {{base_url}}/reports/equipmentbatch?spaceid=1&reportingperiodstartdatetime=2021-05-01T00:00:00&reportingperiodenddatetime=2021-05-20T11:41:09
```
* GET Equipment Cost Report
```
$ curl -i -X GET {{base_url}}/reports/equipmentcost?equipmentid=1&periodtype=daily&baseperiodstartdatetime=2020-08-01T00:00:00&baseperiodenddatetime=2020-09-01T00:00:00&reportingperiodstartdatetime=2020-09-01T00:00:00&reportingperiodenddatetime=2020-10-01T00:00:00

View File

@ -128,12 +128,8 @@ class Reporting:
" FROM tbl_spaces s, tbl_spaces_equipments se, "
" tbl_equipments e, tbl_cost_centers cc "
" WHERE s.id IN ( " + ', '.join(map(str, space_dict.keys())) + ") "
"AND se.space_id = "
"s.id AND "
"se.equipment_id = "
"e.id AND "
"e.cost_center_id = "
"cc.id ", )
" AND se.space_id = s.id AND se.equipment_id = e.id "
" AND e.cost_center_id = cc.id ", )
rows_equipments = cursor_system_db.fetchall()
if rows_equipments is not None and len(rows_equipments) > 0:
for row in rows_equipments: