036 left join for json, exceptions

This commit is contained in:
2026-08-28 13:16:10 +03:00
parent 9ed9e7fb83
commit e5dae89a1b
4 changed files with 70 additions and 28 deletions
+56 -25
View File
@@ -38,31 +38,59 @@ function gaussianRound(numeric number, numeric precision = 0) {
</cffunction>
<cfmodule template="mod/compute_payg.cfm"
dt_finish=#dt_finish#
dt_start=#dt_start#
tenant_wz_index=#tenant_wz_index#
output="report"
debug=#isDefined("DEBUG")#
/>
<!--- "dtStart"="#dateFormat(dt_start, "yyyy-mm-dd")#"
,"dtFinish"="#dateFormat(dt_finish, "yyyy-mm-dd")#" --->
<cfset temp.out=[
"dtStart="=#iso8601dtFormat(dt_start)#
,"dtFinish"=#iso8601dtFormat(dt_finish)#
,"hours"=#hours#
,"tenantWzIndex"="#tenant_wz_index#"
,"wz"=#request.auth.wz#
,"login"=#request.auth.login#
,"appVersion"=#request.APP_VERSION#
,"vcdComputingLoadedAt"="#iso8601dtFormat(report.qComputingAge.dt_load)#"
,"vcdStorageLoadedAt"="#iso8601dtFormat(report.qStorageAge.dt_load)#"
,"s3StorageLoadedAt"="#iso8601dtFormat(report.qComputingAge.dt_load)#"
,"s3OpsTrfLoadedAt"="#iso8601dtFormat(report.qS3OpsTrfAge.dt_load)#"
,"records"=#report.qCharge.recordCount#
,"queryDurationMs"=#(getTickCount() - msStartAt)#
,"periods"=[]
]/><!--- using [] instead of {} for struct literals to obtain linked (ordered) structures: keys order preserved --->
<cfif listFind(request.auth.wz,"WZ01112")>
<cfset temp.out=[
"status"="exception"
,"message"="Для провайдера отчетность по потреблению не отображается."
,"tenantWzIndex"="#tenant_wz_index#"
,"wz"=#request.auth.wz#
,"login"=#request.auth.login#
,"appVersion"=#request.APP_VERSION#
,"queryDurationMs"=#(getTickCount() - msStartAt)#
]/>
<cfelseif listFind(request.auth.wz,"WZ01553")>
<cfset temp.out=[
"status"="exception"
,"message"="Отображение актуальных данных по потреблению временно недоступно. Обратитесь к сервис-мененджеру. Извините за доставленные неудобства."
,"tenantWzIndex"="#tenant_wz_index#"
,"wz"=#request.auth.wz#
,"login"=#request.auth.login#
,"appVersion"=#request.APP_VERSION#
,"queryDurationMs"=#(getTickCount() - msStartAt)#
]/>
<cfelse>
<cfmodule template="mod/compute_payg.cfm"
dt_finish=#dt_finish#
dt_start=#dt_start#
tenant_wz_index=#tenant_wz_index#
full_join=false
output="report"
debug=#isDefined("DEBUG")#
/>
<cfset temp.out=[
"status"="success"
,"dtStart"=#iso8601dtFormat(dt_start)#
,"dtFinish"=#iso8601dtFormat(dt_finish)#
,"hours"=#hours#
,"tenantWzIndex"="#tenant_wz_index#"
,"wz"=#request.auth.wz#
,"login"=#request.auth.login#
,"appVersion"=#request.APP_VERSION#
,"vcdComputingLoadedAt"="#iso8601dtFormat(report.qComputingAge.dt_load)#"
,"vcdStorageLoadedAt"="#iso8601dtFormat(report.qStorageAge.dt_load)#"
,"s3StorageLoadedAt"="#iso8601dtFormat(report.qComputingAge.dt_load)#"
,"s3OpsTrfLoadedAt"="#iso8601dtFormat(report.qS3OpsTrfAge.dt_load)#"
,"records"=#report.qCharge.recordCount#
,"queryDurationMs"=#(getTickCount() - msStartAt)#
,"periods"=[]
]/><!--- using [] instead of {} for struct literals to obtain linked (ordered) structures: keys order preserved --->
<!--- beware nulls --->
<cfoutput query="report.qCharge" group="year">
<cfoutput group="month">
@@ -137,6 +165,9 @@ function gaussianRound(numeric number, numeric precision = 0) {
</cfoutput><!--- month --->
</cfoutput><!--- year --->
<cfset "temp.out.durationMs"=(getTickCount()-request.startTickCount)/>
</cfif>
<cfcontent
type="application/json"
/><cfoutput>#serializeJSON(temp.out)#</cfoutput>