12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- from MyUtils.HttpRequestsUtil import *
- url = "https://doimp.persagy.com/"
- energyId_path = "energy-research/common/api/energy/model/project/list"
- rwdId_path = "energy-research/common/api/multi/energy/model/item/list"
- query_data = "dmp-rwd/rwd/ipcal/data/queryIPDataInPeriod?groupCode=YS&projectId=Pj1101080259"
- #1.获取项目属于哪个集团,这里博锐属于散楼,groupCode=YS
- #2.获取项目能耗模型id,根据以上energyId_path获取id,id=1000001
- #3.获取分项树形结构,根据rwdId_path路径和能耗分项item获取rwdId,
- # {itemName:博锐尚格总电耗,itemCode:EI1001,rwdId:Vo1101080259f2481ca3604644399f1dacb84e20adae},
- # {itemName:照明与插座,itemCode:EI1010202001,rwdId:Vo110108025953894df8d4ae4dbeb7c81ced7df3f83e},
- # {itemName:空调末端,itemCode:EI10102010102001,rwdId:Vo11010802590eaef68d3289452d86d89fbee721e6df},
- # {itemName:冷热源,itemCode:EI10102010101001,rwdId:Vo1101080259e6dcf338d9be4bbf826f659b0b5a9ab2},
- #4.获取数据,根据以上query_data路径和rwdId获取数据
- data_url = url + query_data
- def get_query_data(startTime,endTime):
- payload = {
- "objects": [
- {
- "objectId": "Vo1101080259f2481ca3604644399f1dacb84e20adae",
- "infoCodes": [
- "subentryAccConsum"
- ]
- },
- {
- "objectId": "Vo110108025953894df8d4ae4dbeb7c81ced7df3f83e",
- "infoCodes": [
- "subentryAccConsum"
- ]
- },
- {
- "objectId": "Vo11010802590eaef68d3289452d86d89fbee721e6df",
- "infoCodes": [
- "subentryAccConsum"
- ]
- },
- {
- "objectId": "Vo1101080259e6dcf338d9be4bbf826f659b0b5a9ab2",
- "infoCodes": [
- "subentryAccConsum"
- ]
- }
- ],
- "ipType": "1d",
- "startTime": startTime,
- "endTime": endTime,
- "dataStatus": 1
- }
- headers = {
- 'Content-Type': 'application/json'
- }
- res = HttpRequestsUtil.post(data_url,payload,headers)
- data = res["data"]
- return data
- if __name__ == '__main__':
- data = get_query_data("20230701000000","20230702000000")
- print(data)
|