|
@@ -37,12 +37,11 @@ def wrap_json(df, opt):
|
|
|
df['C_TIME'] = df['C_TIME'].dt.strftime('%y%m%d') # 转换成年月日
|
|
|
for i, group in df.groupby('C_TIME'):
|
|
|
dfs.append(group)
|
|
|
- outter_dict = {"electricCapacity": str(opt.installedCapacityActual), "province": opt.provinceDispatch, "formulaType": opt.formulaType, "electricType":opt.stationType, "stationCode": opt.stationCodeExternal}
|
|
|
+ outter_dict = {"electricCapacity": str(opt.cap), "province": opt.province, "formulaType": opt.formulaType, "electricType":opt.electricType, "stationCode": opt.stationCode}
|
|
|
timestamp = int(time.mktime(datetime.datetime.now().timetuple()) * 1000 + datetime.datetime.now().microsecond / 1000.0)
|
|
|
- inner_dict = {"genTime": str(timestamp)+"L", "capacity": str(opt.installedCapacityActual), "openCapacity": str(opt.installedCapacityActual)}
|
|
|
+ inner_dict = {"genTime": str(timestamp)+"L", "capacity": str(opt.cap), "openCapacity": str(opt.cap)}
|
|
|
for df in dfs:
|
|
|
calculationInfoList = df.iloc[:, 1:].to_json(orient='records')
|
|
|
- # print("++++", calculationInfoList)
|
|
|
outter_dict['calculationInfoList'] = [dict(calculation, **inner_dict) for calculation in eval(calculationInfoList)]
|
|
|
jata.append(json.dumps(outter_dict))
|
|
|
return jata
|
|
@@ -63,7 +62,7 @@ def send_reqest(url, jata):
|
|
|
for i in range(len(jata)):
|
|
|
res = requests.post(url, headers=headers, data=jata[i])
|
|
|
if res.json()['code'] == '500':
|
|
|
- print("状态码是:"+ res.json()['code'], "报错信息:"+res.json()['msg'])
|
|
|
+ print("没通过考核标准")
|
|
|
continue
|
|
|
number += 1
|
|
|
acc += float(res.json()['data'][:-1])
|
|
@@ -80,7 +79,6 @@ def calculate_acc(data, opt):
|
|
|
"""
|
|
|
jata = wrap_json(data, opt)
|
|
|
acc = send_reqest(url=url, jata=jata)
|
|
|
-
|
|
|
return acc
|
|
|
|
|
|
|