|
|
|
@@ -164,7 +164,8 @@ class StateGridDataClient:
|
|
|
|
|
elif _Q in A and C in A[_Q]:B=A[_Q][C]
|
|
|
|
|
elif D in A:B=A[D]
|
|
|
|
|
else:B=json_dumps(A)
|
|
|
|
|
LOGGER.error(api+': '+B);LOGGER.error(json_dumps(A));return B
|
|
|
|
|
if E.is_debug:LOGGER.error(api+': '+B);LOGGER.error(json_dumps(A))
|
|
|
|
|
return B
|
|
|
|
|
async def __fetch_safe(C,api,data):
|
|
|
|
|
B=await C.__fetch(api,data)
|
|
|
|
|
if _H not in B:return B
|
|
|
|
@@ -270,22 +271,16 @@ class StateGridDataClient:
|
|
|
|
|
if _H in B and B[_H]==1 and _A in B and _u in B[_A]:
|
|
|
|
|
D=B[_A][_u]
|
|
|
|
|
if len(D)!=0:D=D[0];E['ladder']=D
|
|
|
|
|
async def __get_door_mouth_bill(F,door_account,monthBill):
|
|
|
|
|
S='pointList';K=monthBill;J='amtList';I='readList';H='quantity';G='priceName';B=door_account;L=datetime.datetime.strptime(K[_AN],'%Y%m');T=f"{L.year}-{L.month:02d}";U={_A:{_I:configuration[_V][_I],_D:configuration[_V][_D],_T:configuration[_V][_T],_e:configuration[_V][_e],_q:B[_g],_d:B[_U],_Y:B[_Y],_Av:T,_AV:B[_U],_AL:B[_AW],_AI:F.userInfo[_R],_N:'',_L:'',_A4:F.userInfo[_AB],_A3:F.userInfo[_R]},_C:configuration[_V][_C],_E:configuration[_V][_E],_S:B[_U]};C=await F.__fetch(get_door_ladder_api,U);W=F.handle_request_result_message(_Aw,C)
|
|
|
|
|
async def __get_door_mouth_bill(E,door_account,monthBill):
|
|
|
|
|
O='pointList';H=monthBill;G='quantity';F='priceName';B=door_account;I=datetime.datetime.strptime(H[_AN],'%Y%m');P=f"{I.year}-{I.month:02d}";Q={_A:{_I:configuration[_V][_I],_D:configuration[_V][_D],_T:configuration[_V][_T],_e:configuration[_V][_e],_q:B[_g],_d:B[_U],_Y:B[_Y],_Av:P,_AV:B[_U],_AL:B[_AW],_AI:E.userInfo[_R],_N:'',_L:'',_A4:E.userInfo[_AB],_A3:E.userInfo[_R]},_C:configuration[_V][_C],_E:configuration[_V][_E],_S:B[_U]};C=await E.__fetch(get_door_ladder_api,Q);S=E.handle_request_result_message(_Aw,C)
|
|
|
|
|
if _H in C and C[_H]==1 and _A in C and _u in C[_A]:
|
|
|
|
|
D=C[_A][_u][0]
|
|
|
|
|
if I in D:M=D[I][0]
|
|
|
|
|
else:M=D[S][0][I][0]
|
|
|
|
|
V=catchFloat(M,'activeCount')
|
|
|
|
|
if J in D:N=D[J]
|
|
|
|
|
else:N=D[S][0]['amtGroupList'][0][J]
|
|
|
|
|
O=0;P=0;Q=0;R=0
|
|
|
|
|
for A in N:
|
|
|
|
|
if A[G]=='峰':O=catchFloat(A,H)
|
|
|
|
|
elif A[G]=='谷':P=catchFloat(A,H)
|
|
|
|
|
elif A[G]=='平':Q=catchFloat(A,H)
|
|
|
|
|
elif A[G]=='尖':R=catchFloat(A,H)
|
|
|
|
|
E={};E[_AX]=normal_round(V,2);E[_AY]=normal_round(O,2);E[_AZ]=normal_round(P,2);E[_Aa]=normal_round(Q,2);E[_Ab]=normal_round(R,2);K[_h]=E
|
|
|
|
|
J=C[_A][_u][0];R=catchFloat(J[O][0]['readList'][0],'activeCount');K=0;L=0;M=0;N=0
|
|
|
|
|
for A in J[O][0]['amtGroupList'][0]['amtList']:
|
|
|
|
|
if A[F]=='峰':K=catchFloat(A,G)
|
|
|
|
|
elif A[F]=='谷':L=catchFloat(A,G)
|
|
|
|
|
elif A[F]=='平':M=catchFloat(A,G)
|
|
|
|
|
elif A[F]=='尖':N=catchFloat(A,G)
|
|
|
|
|
D={};D[_AX]=normal_round(R,2);D[_AY]=normal_round(K,2);D[_AZ]=normal_round(L,2);D[_Aa]=normal_round(M,2);D[_Ab]=normal_round(N,2);H[_h]=D
|
|
|
|
|
async def __get_door_daily_bill(B,door_account,year,start_date,end_date):
|
|
|
|
|
D='sevenEleList';A=door_account;E={'params1':{_C:configuration[_C],_E:configuration[_E],_S:configuration[_S],_K:{_W:configuration[_K][_W],_Z:configuration[_K][_Z],_a:configuration[_K][_a],_X:configuration[_K][_X]},_A1:{_R:B.userInfo[_R]},_p:B.token},'params3':{_A:{_A3:B.userInfo[_R],_q:A[_g],_AL:_c,'endTime':end_date,_Y:A[_Y],_Au:year,_AJ:A.get(_U,A.get(_AK,_F)),_N:'',_L:'','startTime':start_date,_A4:B.userInfo[_AB],_D:configuration[_m][_D],_I:configuration[_m][_I],_e:configuration[_m][_e],_d:configuration[_m][_d],_T:configuration[_m][_T]},_C:configuration[_m][_C],_E:configuration[_m][_E],_S:A.get(_U,A.get(_AK,_F))},'params4':'010103'};C=await B.__fetch_safe(get_door_daily_bill_api,E);F=B.handle_request_result_message('get_door_daily_bill_api',C)
|
|
|
|
|
if _H in C and C[_H]==1 and _A in C and D in C[_A]:A[_A6]=C[_A][D]
|
|
|
|
|