009 cfflush
This commit is contained in:
+18
-18
@@ -15,28 +15,27 @@
|
|||||||
<cfset this.mappings = structNew() />
|
<cfset this.mappings = structNew() />
|
||||||
<cfset this.mappings["/mod"] = getDirectoryFromPath(getCurrentTemplatePath()) & "mod/" />
|
<cfset this.mappings["/mod"] = getDirectoryFromPath(getCurrentTemplatePath()) & "mod/" />
|
||||||
<cfset this.customTagPaths = expandPath(getDirectoryFromPath(getCurrentTemplatePath()) & "mod")/>
|
<cfset this.customTagPaths = expandPath(getDirectoryFromPath(getCurrentTemplatePath()) & "mod")/>
|
||||||
<cfset this.datasource = "rpt"/>
|
|
||||||
<!--- SSO --->
|
<!--- SSO --->
|
||||||
<cfset this.client_id = "payg-report.deck.nubes.ru"/>
|
<cfset this.client_id = "payg-report.deck.nubes.ru"/>
|
||||||
<cfset this.auth_endpoint = "https://keycloak.nubes.ru/realms/cloud/protocol/openid-connect/auth" />
|
<cfset this.auth_endpoint = "https://keycloak.nubes.ru/realms/cloud/protocol/openid-connect/auth" />
|
||||||
<cfset this.access_token_endpoint = "https://keycloak.nubes.ru/realms/cloud/protocol/openid-connect/token" />
|
<cfset this.access_token_endpoint = "https://keycloak.nubes.ru/realms/cloud/protocol/openid-connect/token" />
|
||||||
<cfset this.idpCertUrl = "https://keycloak.nubes.ru/realms/cloud/protocol/openid-connect/certs" />
|
<cfset this.idpCertUrl = "https://keycloak.nubes.ru/realms/cloud/protocol/openid-connect/certs" />
|
||||||
<cfset this.client_secret = createObject("java", "java.lang.System").getEnv("IDP_CLIENT_SECRET")/>
|
<cfset this.client_secret = createObject("java", "java.lang.System").getEnv("IDP_CLIENT_SECRET")/>
|
||||||
<!--- <cfset this.client_secret = this.client_secret ?: ""/> --->
|
|
||||||
|
|
||||||
|
|
||||||
|
<cfset this.datasource = "rpt"/>
|
||||||
<cfset this.defaultdatasource = this.datasource/>
|
<cfset this.defaultdatasource = this.datasource/>
|
||||||
<cfset request.DS = "#this.datasource#">
|
<cfset request.DS = "#this.datasource#">
|
||||||
<cfset request.language="">
|
<cfset request.language="">
|
||||||
|
<cfset getDS(this.datasource)/>
|
||||||
<!--- кажется, нужно инициализировать датасорцы в псевдоконструкторе - onRequest не получается --->
|
<!--- кажется, нужно инициализировать датасорцы в псевдоконструкторе - onRequest не получается --->
|
||||||
<!--- *** проверить, что есть - если есть, не создавать --->
|
<!--- *** проверить, что есть - если есть, не создавать --->
|
||||||
<!--- не тут-то было: так не работает --->
|
|
||||||
<!--- <cfif NOT structKeyExists(this.datasources,this.datasource)>
|
|
||||||
</cfif> --->
|
|
||||||
|
|
||||||
<!--- это работает с административно заданным датасорцем, хотя, казалось бы, не должно
|
<!--- это работает с административно заданным датасорцем, хотя, казалось бы, не должно
|
||||||
(без окружения фунекция вернет пустую структуру). Видимо, административный датасорц обнаруживается раньше.
|
(без окружения функция вернет пустую структуру). Видимо, административный датасорц обнаруживается раньше.
|
||||||
Проверять на пустоту не хочется, чтобы не плодить в псевдоконструкторе переменные --->
|
Проверять на пустоту не хочется, чтобы не плодить в псевдоконструкторе переменные --->
|
||||||
<cfset this.datasources["#this.datasource#"]=getDS("#this.datasource#","ds_#this.datasource#")/>
|
|
||||||
<!--- <cfdump var=#variables#/> --->
|
<!--- <cfdump var=#variables#/> --->
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +47,7 @@
|
|||||||
hint="Fires when the application is first created.">
|
hint="Fires when the application is first created.">
|
||||||
|
|
||||||
<!--- *** мы не проверяем срок жизни сертификата и его отзыв--->
|
<!--- *** мы не проверяем срок жизни сертификата и его отзыв--->
|
||||||
Obtain idp certificate OnApplicationStart
|
<!--- Obtain idp certificate OnApplicationStart --->
|
||||||
<cfset application.idpCertificate = getIdpCertificate(this.idpCertUrl)/>
|
<cfset application.idpCertificate = getIdpCertificate(this.idpCertUrl)/>
|
||||||
|
|
||||||
<cfreturn true />
|
<cfreturn true />
|
||||||
@@ -79,7 +78,7 @@
|
|||||||
|
|
||||||
<!--- global settings --->
|
<!--- global settings --->
|
||||||
<cfset request.RECORDS_PER_PAGE=500/>
|
<cfset request.RECORDS_PER_PAGE=500/>
|
||||||
<cfset request.APP_VERSION="0.00.008"/>
|
<cfset request.APP_VERSION="0.00.009"/>
|
||||||
<cfset request.STAND=getStand()/>
|
<cfset request.STAND=getStand()/>
|
||||||
|
|
||||||
<!--- application constants --->
|
<!--- application constants --->
|
||||||
@@ -153,7 +152,7 @@
|
|||||||
<!--- <cfoutput>onRequest:check for cert finished #(getTickCount()-request.startTickCount)#</cfoutput> --->
|
<!--- <cfoutput>onRequest:check for cert finished #(getTickCount()-request.startTickCount)#</cfoutput> --->
|
||||||
|
|
||||||
|
|
||||||
<cfset this.redirect_uri = "https://#CGI.SERVER_NAME#/#CGI.SCRIPT_NAME#" />
|
<cfset this.redirect_uri = "https://#CGI.SERVER_NAME##CGI.SCRIPT_NAME#" />
|
||||||
|
|
||||||
<cfinclude template="inc/functions.cfm"/>
|
<cfinclude template="inc/functions.cfm"/>
|
||||||
|
|
||||||
@@ -339,22 +338,21 @@
|
|||||||
<cffunction
|
<cffunction
|
||||||
name="getDS"
|
name="getDS"
|
||||||
access="private"
|
access="private"
|
||||||
returntype="struct"
|
returntype="void"
|
||||||
output="true"
|
output="true"
|
||||||
hint="Configure data source from environment variables. Convention: data source name is an environment varialble prefix">
|
hint="Configure data source from environment variables (if datasource with the name provided already exists, does nothing). Convention: data source name is an environment varialble prefix">
|
||||||
|
|
||||||
<cfargument name="dsname" type="string" required="true"/>
|
<cfargument name="dsname" type="string" required="true"/>
|
||||||
<cfargument name="prefix" type="string" default=#dsname#/>
|
<cfargument name="prefix" type="string" default=#dsname#/>
|
||||||
|
|
||||||
<cfset var ds={}/>
|
|
||||||
|
|
||||||
<cftry>
|
<cftry>
|
||||||
<cfquery name="qTestDs" datasource=#arguments.dsname#>
|
<cfquery name="qTestDs" datasource=#arguments.dsname#>
|
||||||
select 1;
|
select 1;
|
||||||
</cfquery>
|
</cfquery>
|
||||||
|
|
||||||
<cfcatch type="any">
|
<cfcatch type="any">
|
||||||
<cfset system = createObject("java", "java.lang.System")/>
|
<cfset var ds={}/>
|
||||||
|
<cfset var system = createObject("java", "java.lang.System")/>
|
||||||
|
|
||||||
<cfloop list="class,connectionString,database,driver,dbdriver,host,port,type,url,username,password,bundleName,bundleVersion,connectionLimit,liveTimeout,validate" item="field"><!--- driver vs dbdriver --->
|
<cfloop list="class,connectionString,database,driver,dbdriver,host,port,type,url,username,password,bundleName,bundleVersion,connectionLimit,liveTimeout,validate" item="field"><!--- driver vs dbdriver --->
|
||||||
<cfset var value=system.getEnv("#arguments.prefix#_#field#")/>
|
<cfset var value=system.getEnv("#arguments.prefix#_#field#")/>
|
||||||
@@ -368,8 +366,8 @@
|
|||||||
|
|
||||||
<!--- test datasource (just to get exception if invalid) --->
|
<!--- test datasource (just to get exception if invalid) --->
|
||||||
<cftry>
|
<cftry>
|
||||||
<cfquery name="qTestDs" datasource=#ds#>
|
<cfquery name="qTestDsNextTry" datasource=#ds#>
|
||||||
select 1;
|
select 2;
|
||||||
</cfquery>
|
</cfquery>
|
||||||
|
|
||||||
<cfcatch type="any">
|
<cfcatch type="any">
|
||||||
@@ -379,10 +377,12 @@
|
|||||||
<cfrethrow/>
|
<cfrethrow/>
|
||||||
</cfcatch>
|
</cfcatch>
|
||||||
</cftry>
|
</cftry>
|
||||||
|
|
||||||
|
<cfset this.datasources["#arguments.dsname#"]=#ds#/> <!--- Интересно, доступен ли здесь this --->
|
||||||
</cfcatch>
|
</cfcatch>
|
||||||
</cftry>
|
</cftry>
|
||||||
<!--- <cfdump var=#ds#/> --->
|
<!--- <cfdump var=#ds#/> --->
|
||||||
<cfreturn ds/>
|
<cfreturn/>
|
||||||
</cffunction>
|
</cffunction>
|
||||||
|
|
||||||
<cfscript>
|
<cfscript>
|
||||||
|
|||||||
@@ -14,6 +14,45 @@
|
|||||||
|
|
||||||
<cfset tenant_wz_index=val(mid(request.auth.wz,3,5))/><!--- cut off WZ --->
|
<cfset tenant_wz_index=val(mid(request.auth.wz,3,5))/><!--- cut off WZ --->
|
||||||
|
|
||||||
|
|
||||||
|
<!--- looks like QoQ does not support join syntax, at least of Lucee 5.4--->
|
||||||
|
|
||||||
|
|
||||||
|
<cfif isDefined("output_xls")>
|
||||||
|
<layout:xml qRead=#qCharge# titleMap=#titleMap# filename="#pageInfo.entity#.xml"/>
|
||||||
|
<cfabort/>
|
||||||
|
</cfif><cfif isDefined("output_json")>
|
||||||
|
<layout:json qRead=#qCharge# titleMap=#titleMap# filename="#pageInfo.entity#.json"/>
|
||||||
|
<cfabort/>
|
||||||
|
</cfif><!---
|
||||||
|
---><layout:page section="header" pageInfo=#pageInfo#>
|
||||||
|
|
||||||
|
<layout:attribute name="title">
|
||||||
|
<cfoutput><b>Отчет по PAYG</b> #request.auth.wz#</cfoutput>
|
||||||
|
</layout:attribute>
|
||||||
|
<layout:attribute name="controls">
|
||||||
|
<!---skip filter link, filter is not implemented--->
|
||||||
|
<!---<layout:language_switch/>--->
|
||||||
|
</layout:attribute>
|
||||||
|
</layout:page>
|
||||||
|
|
||||||
|
<!--- Внимание! округление вверх при расчете метрик get, put S3. Расчетные суммы могут содержать погрешности округления, поэтому окончательный расчет стоимости (количество * цену) должен выполняться в бухгалтерской программе.
|
||||||
|
<b>Если у клиента больше 1 действующего допника с услугами PAYG, то данные в отчете могут быть замножены, в этом случае считать вручную</b> --->
|
||||||
|
|
||||||
|
<cfoutput>
|
||||||
|
<form method="post" action="">
|
||||||
|
Период с <input type="text" name="dt_start" value="#dateFormat(dt_start,'YYYY-MM-DD')#"/>
|
||||||
|
по <input type="text" name="dt_finish" value="#dateFormat(dt_finish,'YYYY-MM-DD')#"/>
|
||||||
|
<input type="submit" style="cursor:pointer;"/>
|
||||||
|
<!--- <input type="submit" name="DEBUG" value="DEBUG" style="cursor:pointer;"/> --->
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<cfflush/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--- Для начала выкатываем просто кусок каталога, не фильтруя по спеке (которой иногда нет) --->
|
<!--- Для начала выкатываем просто кусок каталога, не фильтруя по спеке (которой иногда нет) --->
|
||||||
<cfquery name="qSpec">
|
<cfquery name="qSpec">
|
||||||
select * from (
|
select * from (
|
||||||
@@ -266,37 +305,6 @@ FROM qSpec as s, qUnifiedMetric as m
|
|||||||
WHERE m.wz=<cfqueryparam cfsqltype="cf_sql_varchar" value=#request.auth.wz#/> AND s.code=m.code
|
WHERE m.wz=<cfqueryparam cfsqltype="cf_sql_varchar" value=#request.auth.wz#/> AND s.code=m.code
|
||||||
order by s.code
|
order by s.code
|
||||||
</cfquery>
|
</cfquery>
|
||||||
<!--- looks like QoQ does not support join syntax, at least of Lucee 5.4--->
|
|
||||||
|
|
||||||
|
|
||||||
<cfif isDefined("output_xls")>
|
|
||||||
<layout:xml qRead=#qCharge# titleMap=#titleMap# filename="#pageInfo.entity#.xml"/>
|
|
||||||
<cfabort/>
|
|
||||||
</cfif><cfif isDefined("output_json")>
|
|
||||||
<layout:json qRead=#qCharge# titleMap=#titleMap# filename="#pageInfo.entity#.json"/>
|
|
||||||
<cfabort/>
|
|
||||||
</cfif><!---
|
|
||||||
---><layout:page section="header" pageInfo=#pageInfo#>
|
|
||||||
|
|
||||||
<layout:attribute name="title">
|
|
||||||
<cfoutput><b>Отчет по PAYG</b> #request.auth.wz#</cfoutput>
|
|
||||||
</layout:attribute>
|
|
||||||
<layout:attribute name="controls">
|
|
||||||
<!---skip filter link, filter is not implemented--->
|
|
||||||
<!---<layout:language_switch/>--->
|
|
||||||
</layout:attribute>
|
|
||||||
</layout:page>
|
|
||||||
|
|
||||||
<!--- Внимание! округление вверх при расчете метрик get, put S3. Расчетные суммы могут содержать погрешности округления, поэтому окончательный расчет стоимости (количество * цену) должен выполняться в бухгалтерской программе.
|
|
||||||
<b>Если у клиента больше 1 действующего допника с услугами PAYG, то данные в отчете могут быть замножены, в этом случае считать вручную</b> --->
|
|
||||||
|
|
||||||
<cfoutput>
|
|
||||||
<form method="post" action="">
|
|
||||||
Период с <input type="text" name="dt_start" value="#dateFormat(dt_start,'YYYY-MM-DD')#"/>
|
|
||||||
по <input type="text" name="dt_finish" value="#dateFormat(dt_finish,'YYYY-MM-DD')#"/>
|
|
||||||
<input type="submit" style="cursor:pointer;"/>
|
|
||||||
<!--- <input type="submit" name="DEBUG" value="DEBUG" style="cursor:pointer;"/> --->
|
|
||||||
</form>
|
|
||||||
Часов в периоде: <b>#hours#</b> Строк в отчете: <b>#qCharge.recordCount#</b><br/>
|
Часов в периоде: <b>#hours#</b> Строк в отчете: <b>#qCharge.recordCount#</b><br/>
|
||||||
Актуальность данных:
|
Актуальность данных:
|
||||||
VCD Computing: <b>#dateFormat(qComputingAge.dt_load,'YYYY-MM-DD')# #timeFormat(qComputingAge.dt_load,'HH:MM:SS')#</b>
|
VCD Computing: <b>#dateFormat(qComputingAge.dt_load,'YYYY-MM-DD')# #timeFormat(qComputingAge.dt_load,'HH:MM:SS')#</b>
|
||||||
|
|||||||
Reference in New Issue
Block a user