059 inmem full join with spec

This commit is contained in:
2026-07-26 23:01:27 +03:00
parent 59bf109ba5
commit 274643ed28
6 changed files with 342 additions and 154 deletions
+25 -19
View File
@@ -62,6 +62,7 @@
<cfif len(d.__id)>
<b>#d.__name#</b>
[#d.__id#]
<b>#d.id_klienta#</b>
</cfif>
</cfoutput>
</layout:attribute>
@@ -235,7 +236,7 @@
<!--- <cfdump var=#qService#/> --->
<cfoutput>
<h3>Услуги по данным CRM (версии строк спецификации, только актуальные на сегодня, сделки с вероятностью от 50% (начиная с тестирования) <!--- (#qService.recordCount#) ---></h3>
<h3>Услуги по данным CRM (из DWH, версии строк спецификации, только актуальные на сегодня, сделки с вероятностью от 50% (начиная с тестирования) <!--- (#qService.recordCount#) ---></h3>
</cfoutput>
@@ -265,7 +266,7 @@
<td class="l">#user_description#</td>
<td style="padding:0; vertical-align:bottom;">
<table class="wide" style="height:100%">
<cfset cost=0/>
<cfset cost = 0/>
<cfoutput group="p_uid">
<cfif p_cnt NEQ 0>
<tr>
@@ -283,7 +284,7 @@
<td class="c">#cnt#</td>
<td class="r">#nFmt(cost*cnt*(100-(isNumeric(discount)?discount:0))/100)#</td>
<td class="c">
<td class="c"<cfif line_pricing_model_id EQ 3> style="background:lightgreen;color:black;"</cfif>>
<cfswitch expression=#line_pricing_model_id#>
<cfcase value=1>install</cfcase>
<cfcase value=2>fix</cfcase>
@@ -301,6 +302,7 @@
</cfoutput>
</table>
<!--- <i>отображаются позиции сделок, начиная с тестирования</i> --->
<h2>Текущее потребление по данным VmReports (VROPS)</h1>
<cfquery name="qCompute">
select
@@ -309,18 +311,19 @@
,c."VDC"
,c."VDC_CPU_Reserv"
,"Cluster"
, round(sum(c."VM_RAM_Allocated")) as ram
, round(sum(CASE WHEN "VM_is_ON" > 0 THEN c."VM_RAM_Allocated" ELSE 0 END)) as ram_on
, round(sum(c."VM_vCPU_count")) as cpu
, round(sum(CASE WHEN "VM_is_ON" > 0 THEN c."VM_vCPU_count" ELSE 0 END)) as cpu_on
, round(avg(c."VDC_CPU_Speed")::numeric,1) as ghz
,round(sum(c."VM_RAM_Allocated")) as ram
,round(sum(CASE WHEN "VM_is_ON" > 0 THEN c."VM_RAM_Allocated" ELSE 0 END)) as ram_on
,round(sum(c."VM_vCPU_count")) as cpu
,round(sum(CASE WHEN "VM_is_ON" > 0 THEN c."VM_vCPU_count" ELSE 0 END)) as cpu_on
,round(avg(c."VDC_CPU_Speed")::numeric,1) as ghz
,min(c.ts) as ts
FROM vmreports.compute c
WHERE ts=(select max(ts) from vmreports.compute)
WHERE c.ts=(select max(ts) from vmreports.compute)
AND lower(c."WZ")=lower(<cfqueryparam cfsqltype="cf_sql_varchar" value="#d.id_klienta#"/>)
GROUP BY c."Organization_UUID", c."Organization", c."VDC", c."VDC_CPU_Reserv", c."Cluster"
</cfquery>
<cfquery name="qCompute_total" dbtype="query">
<cfquery name="qCompute_total" dbtype="query">
select
sum(ram) as ram
,sum(ram_on) as ram_on
@@ -329,7 +332,7 @@
FROM qCompute
</cfquery>
<h3>Compute факт</h3>
<h3>Compute факт <cfif len(qCompute.ts)><cfoutput>#dateFormat(qCompute.ts,'YYYY-MM-DD')# #timeFormat(qCompute.ts,'HH:MM:SS')#</cfoutput></cfif></h3>
<table class="worktable">
<thead>
<tr>
@@ -379,10 +382,11 @@
,"VDC"
,"Cluster"
,"Storage_Policy"
, round(sum(c."Disk_Allocated")) as disk_alloc
, round(sum(c."Disk_Used")) as disk_used
,round(sum(c."Disk_Allocated")) as disk_alloc
,round(sum(c."Disk_Used")) as disk_used
,min(c.ts) as ts
FROM vmreports.storage c
WHERE ts=(select max(ts) from vmreports.storage)
WHERE c.ts=(select max(ts) from vmreports.storage)
AND lower(c."WZ")=lower(<cfqueryparam cfsqltype="cf_sql_varchar" value="#d.id_klienta#"/>)
GROUP BY c."Organization_UUID",c."Organization",c."VDC",c."Cluster",c."Storage_Policy"
</cfquery>
@@ -394,7 +398,7 @@
FROM qStorage
</cfquery>
<h3>Storage факт</h3>
<h3>Storage факт <cfif len(qStorage.ts)><cfoutput>#dateFormat(qStorage.ts,'YYYY-MM-DD')# #timeFormat(qStorage.ts,'HH:MM:SS')#</cfoutput></cfif></h3>
<table class="worktable">
<thead>
<tr>
@@ -435,18 +439,20 @@
,"OrgStatus"
,"OrgVDC"
,(select STRING_AGG(DISTINCT "Cluster",',') FROM vmreports.compute c
WHERE ts=(select max(ts) from vmreports.compute)
AND g."Org"=c."Organization") as org_cluster
WHERE ts=(select max(ts) from vmreports.compute)
AND g."Org"=c."Organization"
) as org_cluster
,"Name"
,"GPU"
,g.ts as ts
FROM vmreports.vm_gpu g
WHERE ts=(select max(ts) from vmreports.vm_gpu)
WHERE g.ts=(select max(ts) from vmreports.vm_gpu)
AND lower(g."ClientID")=lower(<cfqueryparam cfsqltype="cf_sql_varchar" value="#d.id_klienta#"/>)
</cfquery>
<h3>GPU факт</h3>
<h3>GPU факт <cfif len(qGpu.ts)><cfoutput>#dateFormat(qGpu.ts,'YYYY-MM-DD')# #timeFormat(qGpu.ts,'HH:MM:SS')#</cfoutput></cfif></h3>
<table class="worktable">
<thead>
<tr>