Compare commits

...
2 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
6 changed files with 35 additions and 37 deletions
+22 -9
View File
@@ -28,6 +28,8 @@
<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.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.crm_cache_host = "elma-cache.adl.nubes.ru"/><!--- *** почему-то приходится устанавливать серт sslCertificateInstall, иначе не коннектится --->
<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_WRITE=2/>
<!--- <cfset request.UNDEFINED_USR_ID=-1/>
<cfset request.ANONYMOUS_USR_ID=2/>
<cfset request.GUEST_USR_ID=3/> --->
<!--- 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#/>
<cfset request.STAND=getStand()/>
@@ -117,10 +116,6 @@
<!--- 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 = {} />
@@ -455,7 +450,25 @@
<cfreturn ""/>
</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
name="getDS"
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
+2 -1
View File
@@ -1,4 +1,5 @@
component {
/*0.04 precision fix DECIMAL(128,32) maybe too memory consumable*/
/*0.03 precision fix*/
/*0.02 timestamp support*/
/**
@@ -71,7 +72,7 @@ component {
case "BIGINT": return "BIGINT";
case "DOUBLE": case "FLOAT": case "REAL": return "DOUBLE";
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";
default: return "LONGVARCHAR"; // И тут тоже
}
+4 -4
View File
@@ -87,7 +87,7 @@
<!--- Важно: если в периоде было 2+ цены, то строки должны быть замножены, а цена за период перестает иметь смысл (не показывать же среднее арифметическое, это неправильно) --->
<!--- Left Outer Join with Free Tier --->
<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.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
@@ -98,7 +98,7 @@
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.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
@@ -107,9 +107,9 @@
WHERE s.fullCode NOT IN (<cfqueryparam value="#ValueList(qFreeTier.code)#" cfsqltype="cf_sql_varchar" list="true">)
AND s.serviceType = 3
</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/>
</cfloop>
</cfloop> --->
<cfif (ATTRIBUTES.debug)>
qSpec (Left Outer Join with Free Tier)
+2 -1
View File
@@ -97,7 +97,8 @@
priceWVat=local.component.priceWVat,
componentDiscount=local.component.discount,
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>
-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