Compare commits

...
4 Commits
Author SHA1 Message Date
smishchuk f1c09cd1f8 042 IAM_URL env 2026-10-28 13:02:03 +03:00
smishchuk f94e399cf8 041 inmem decimal fix, -m workaround 2026-10-02 00:29:21 +03:00
smishchuk 00977e66cd 41 memendger 2026-09-30 20:12:35 +03:00
smishchuk 360298213a 248 is_trial 2026-09-26 14:10:32 +03:00
8 changed files with 38 additions and 40 deletions
+22 -9
View File
@@ -27,7 +27,9 @@
<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.iam_url = "https://auth-api.ngcloud.ru/api/v1/auth/user"/> ---> <!--- <cfset this.iam_url = "https://auth-api.ngcloud.ru/api/v1/auth/user"/> --->
<cfset this.iamServiceUrl = "https://auth-api.ngcloud.ru/api/v1/auth/user "/> <cfset this.iamServiceUrl = "https://auth-api.ngcloud.ru/api/v1/auth/user"/>
<cfset this.iamServiceUrl = getFromEnv("IAM_URL", "https://auth-api.ngcloud.ru/api/v1/auth/user")/>
<cfset this.redirect_uri = "https://#CGI.SERVER_NAME##CGI.SCRIPT_NAME#"/><!--- куда возвращаться от IDP ---> <cfset this.redirect_uri = "https://#CGI.SERVER_NAME##CGI.SCRIPT_NAME#"/><!--- куда возвращаться от IDP --->
<cfset this.crm_cache_host = "elma-cache.adl.nubes.ru"/><!--- *** почему-то приходится устанавливать серт sslCertificateInstall, иначе не коннектится ---> <cfset this.crm_cache_host = "elma-cache.adl.nubes.ru"/><!--- *** почему-то приходится устанавливать серт sslCertificateInstall, иначе не коннектится --->
<cfset request.crm_cache_base = "https://#this.crm_cache_host#/contract_ls.cfm"/> <cfset request.crm_cache_base = "https://#this.crm_cache_host#/contract_ls.cfm"/>
@@ -103,13 +105,10 @@
<cfset request.PERMISSION_READ=1/> <cfset request.PERMISSION_READ=1/>
<cfset request.PERMISSION_WRITE=2/> <cfset request.PERMISSION_WRITE=2/>
<!--- <cfset request.UNDEFINED_USR_ID=-1/>
<cfset request.ANONYMOUS_USR_ID=2/>
<cfset request.GUEST_USR_ID=3/> --->
<!--- global settings ---> <!--- global settings --->
<!--- *************************************************************************************************************** ---> <!--- *************************************************************************************************************** --->
<cfset request.APP_VERSION="0.00.040"/><!--- ************************************************************************ ---> <cfset request.APP_VERSION="0.00.042"/><!--- ************************************************************************ --->
<!--- *************************************************************************************************************** ---> <!--- *************************************************************************************************************** --->
<cfheader name="X-Application-Version" value=#request.APP_VERSION#/> <cfheader name="X-Application-Version" value=#request.APP_VERSION#/>
<cfset request.STAND=getStand()/> <cfset request.STAND=getStand()/>
@@ -117,10 +116,6 @@
<!--- application constants ---> <!--- application constants --->
<!---<cfset request.SMTP_SERVER="172.16.16.16"/>
<cfset request.MAIL_FROM_FOR_NOTIFICATION="Pipeline tracker <pipeline@mail.ru>"/>
<cfset request.SUBJECT_PREFIX="[PIPELINE TRACKER] "/>--->
<!---<cfset request.BASE_URL="https://smtest.dtln.local/pipeline/"/>*** сделать нормально. Внимание! При наличии прокси CGI.SERVER_NAME может быть заменено --->
<cfset local = {} /> <cfset local = {} />
@@ -456,6 +451,24 @@
</cffunction> </cffunction>
<cffunction name="getFromEnv"
access="private"
returntype="string"
output="true"
hint="Obtain value from environment, if not found then return default">
<cfargument name="name" type="string" required="true"/>
<cfargument name="default" type="string" required="true"/>
<cftry>
<cfset var value = createObject("java", "java.lang.System").getEnv(arguments.name)/>
<cfreturn isNull(value)? arguments.default : value/>
<cfcatch>
<cfreturn arguments.default/>
</cfcatch>
</cftry>
</cffunction>
<cffunction <cffunction
name="getDS" name="getDS"
access="private" access="private"
+5
View File
@@ -0,0 +1,5 @@
$ git remote -v
origin https://gitea.services.ngcloud.ru/smishchuk/payg-report.git (fetch)
origin https://gitea.services.ngcloud.ru/smishchuk/payg-report.git (push)
$ git push https://gitea.services.ngcloud.ru/smishchuk/payg-report-dev.git master
+1 -1
View File
@@ -54,7 +54,7 @@ function gaussianRound(numeric number, numeric precision = 0) {
<cfset temp.out=[ <cfset temp.out=[
"status"="exception" "status"="exception"
,"message"="Отображение актуальных данных по потреблению временно недоступно. Обратитесь к сервис-мененджеру. Извините за доставленные неудобства." ,"message"="Отображение актуальных данных по потреблению временно недоступно. Обратитесь к сервис-менеджеру. Извините за доставленные неудобства."
,"tenantWzIndex"="#tenant_wz_index#" ,"tenantWzIndex"="#tenant_wz_index#"
,"wz"=#request.auth.wz# ,"wz"=#request.auth.wz#
,"login"=#request.auth.login# ,"login"=#request.auth.login#
+1 -1
View File
@@ -67,7 +67,7 @@
</cfloop> </cfloop>
<cfset var outArray=arrayNew(1)/> <cfset var outArray=arrayNew(1)/>
//copy fields to structure, renaming fields, this preserves data type <!--- //copy fields to structure, renaming fields, this preserves data type --->
<cfloop query=#arguments.qry#> <cfloop query=#arguments.qry#>
<cfset var structRow=structNew()/> <cfset var structRow=structNew()/>
<cfloop index="i" from="1" to=#listLen(columnsOut)#> <cfloop index="i" from="1" to=#listLen(columnsOut)#>
+2 -1
View File
@@ -1,4 +1,5 @@
component { component {
/*0.04 precision fix DECIMAL(128,32) maybe too memory consumable*/
/*0.03 precision fix*/ /*0.03 precision fix*/
/*0.02 timestamp support*/ /*0.02 timestamp support*/
/** /**
@@ -71,7 +72,7 @@ component {
case "BIGINT": return "BIGINT"; case "BIGINT": return "BIGINT";
case "DOUBLE": case "FLOAT": case "REAL": return "DOUBLE"; case "DOUBLE": case "FLOAT": case "REAL": return "DOUBLE";
case "BOOLEAN": case "BIT": return "BIT"; case "BOOLEAN": case "BIT": return "BIT";
case "DECIMAL": case "NUMERIC": return "DECIMAL"; case "DECIMAL": case "NUMERIC": return "DECIMAL(128,32)";
case "TIMESTAMP": case "DATE": case "TIME": return "TIMESTAMP"; case "TIMESTAMP": case "DATE": case "TIME": return "TIMESTAMP";
default: return "LONGVARCHAR"; // И тут тоже default: return "LONGVARCHAR"; // И тут тоже
} }
+4 -4
View File
@@ -87,7 +87,7 @@
<!--- Важно: если в периоде было 2+ цены, то строки должны быть замножены, а цена за период перестает иметь смысл (не показывать же среднее арифметическое, это неправильно) ---> <!--- Важно: если в периоде было 2+ цены, то строки должны быть замножены, а цена за период перестает иметь смысл (не показывать же среднее арифметическое, это неправильно) --->
<!--- Left Outer Join with Free Tier ---> <!--- Left Outer Join with Free Tier --->
<cfquery name="qSpec" dbtype="query"> <cfquery name="qSpec" dbtype="query">
select s.catalogName as svc, s.component, s.serviceCode as service_code, NULL as sku_code, s.fullCode as code, s.measureShort as unit select s.catalogName as svc, s.component, s.serviceCode as service_code, s.fullCode as sku_code, s.fullCode as code, s.measureShort as unit
, s.priceWVat as price , s.priceWVat as price
,s.componentDiscount as component_discount, s.serviceDiscount as service_discount, s.serviceQuantity as service_quantity, s.componentQuantity as component_quantity ,s.componentDiscount as component_discount, s.serviceDiscount as service_discount, s.serviceQuantity as service_quantity, s.componentQuantity as component_quantity
,coalesce(s.serviceQuantity*(100-s.serviceDiscount)/100*s.priceWVat*(100-s.componentDiscount)/100,0) as discounted_price ,coalesce(s.serviceQuantity*(100-s.serviceDiscount)/100*s.priceWVat*(100-s.componentDiscount)/100,0) as discounted_price
@@ -98,7 +98,7 @@
UNION UNION
select s.catalogName as svc, s.component, s.serviceCode as service_code, NULL as sku_code, s.fullCode as code, s.measureShort as unit select s.catalogName as svc, s.component, s.serviceCode as service_code, s.fullCode as sku_code, s.fullCode as code, s.measureShort as unit
, s.priceWVat as price , s.priceWVat as price
,s.componentDiscount as component_discount, s.serviceDiscount as service_discount, s.serviceQuantity as service_quantity, s.componentQuantity as component_quantity ,s.componentDiscount as component_discount, s.serviceDiscount as service_discount, s.serviceQuantity as service_quantity, s.componentQuantity as component_quantity
,coalesce(s.serviceQuantity*(100-s.serviceDiscount)/100*s.priceWVat*(100-s.componentDiscount)/100,0) as discounted_price ,coalesce(s.serviceQuantity*(100-s.serviceDiscount)/100*s.priceWVat*(100-s.componentDiscount)/100,0) as discounted_price
@@ -107,9 +107,9 @@
WHERE s.fullCode NOT IN (<cfqueryparam value="#ValueList(qFreeTier.code)#" cfsqltype="cf_sql_varchar" list="true">) WHERE s.fullCode NOT IN (<cfqueryparam value="#ValueList(qFreeTier.code)#" cfsqltype="cf_sql_varchar" list="true">)
AND s.serviceType = 3 AND s.serviceType = 3
</cfquery> </cfquery>
<cfloop query="qSpec"> <!--- <cfloop query="qSpec">
<cfset qSpec.sku_code = (len(qSpec.code) GT 2) ? qSpec.code.left(qSpec.code.len() - 2) : qSpec.code/> <cfset qSpec.sku_code = (len(qSpec.code) GT 2) ? qSpec.code.left(qSpec.code.len() - 2) : qSpec.code/>
</cfloop> </cfloop> --->
<cfif (ATTRIBUTES.debug)> <cfif (ATTRIBUTES.debug)>
qSpec (Left Outer Join with Free Tier) qSpec (Left Outer Join with Free Tier)
+2 -1
View File
@@ -97,7 +97,8 @@
priceWVat=local.component.priceWVat, priceWVat=local.component.priceWVat,
componentDiscount=local.component.discount, componentDiscount=local.component.discount,
atomicCode=local.component.atomicCode, atomicCode=local.component.atomicCode,
fullCode="#local.component.componentCode#-#listGetAt('i,f,m',local.service.serviceType)#" //fullCode="#local.component.componentCode#-#listGetAt('i,f,m',local.service.serviceType)#"
fullCode="#reReplace(local.component.componentCode, '-.$', '')#" //truncate -m garbage
}])/> }])/>
</cfloop> </cfloop>
</cfloop> </cfloop>
-22
View File
@@ -1,22 +0,0 @@
SQL SELECT
s.code,m.code as m_code,s.service_code as service_code,s.svc,s.component,s.unit,
s.price*(100-s.discount)/100 as discounted_price
,s.price,s.discount,m.raw_metric,m.metric,s.serviceStart,s.serviceEnd,s.serviceHash,s.serviceCustomName,m.dt,s.free_tier,m.dimension_1,m.dimension_1_name ||'x' as dimension_1_name,m.dimension_2,m.dimension_2_name
FROM qSpec as s, qUnifiedMetric as m
WHERE m.wz='62'
AND s.code=m.code
AND s.serviceStart <= m.dt
AND (m.dt <= s.serviceEnd OR s.serviceEnd IS NULL)
UNION ALL
SELECT NULL, m.code, NULL, NULL, NULL, NULL, 0,
NULL, NULL, m.raw_metric, m.metric, NULL, NULL, NULL, NULL, m.dt, 0, m.dimension_1, m.dimension_1_name ||'y', m.dimension_2, m.dimension_2_name
FROM qUnifiedMetric as m where m.code NOT IN ('5','6')
UNION ALL
SELECT s.code, NULL, s.service_code, s.svc, s.component, s.unit, s.price*(100-s.discount)/100 as discounted_price,
s.price, s.discount, NULL, NULL, s.serviceStart, s.serviceEnd, s.serviceHash, s.serviceCustomName, NULL, 0, NULL, NULL, NULL, NULL
FROM qSpec as s where s.code NOT IN ('5','6')
order by m.dt, m.code, dimension_1, dimension_2