092 s3 defects

This commit is contained in:
2026-10-16 11:29:10 +03:00
parent fd88ad9889
commit 1ac73a7be2
2 changed files with 58 additions and 14 deletions
+1 -1
View File
@@ -89,7 +89,7 @@
<!--- global settings --->
<!--- *************************************************************************************************** --->
<cfset request.APP_VERSION="0.00.091"/> <!--- *********************************************************** --->
<cfset request.APP_VERSION="0.00.092"/> <!--- *********************************************************** --->
<!--- *************************************************************************************************** --->
<cfset request.STAND=getStand()/>
<cfset request.RECORDS_PER_PAGE=500/>
+55 -11
View File
@@ -39,6 +39,22 @@
from s3billing.user_info u
cross join (select max(timestamp_addition) as timestamp_addition from s3billing.bucket_stat) t
</cfquery>
<cfquery name="qS3User" datasource="cmdb" cachedWithin=#createTimeSpan(0, 0, 31, 0)#>
WITH current_state AS (
SELECT *, ROW_NUMBER() OVER (PARTITION BY instance_uid ORDER BY version DESC) as rn
FROM instance_state
)
SELECT s.instance_data->'job'->>'contragentCode' as wz, s.instance_data->'job'->>'userId' AS user_id, e.display_name
,k.contragent_id, k.external_code, k.contragent
FROM current_state s
JOIN instance e on (s.instance_uid=e.instance_uid)
left join specification_item i on (e.specification_item_id=i.specification_item_id)
left join specification p on (i.specification_id=p.specification_id)
left join contract d on (p.contract_id=d.contract_id)
left join contragent k on (d.contragent_id=k.contragent_id)
WHERE rn = 1 AND e.service_id=12
</cfquery>
<!--- <cfdump var=#qRead#/> --->
<!--- <cfcatch type="database">
@@ -46,9 +62,6 @@
</cfcatch>
</cftry> --->
<cfquery name="qCountTotal" datasource="billing-s3">
select count(*) as cnt from s3billing.user_info where 1=1
</cfquery>
<cfquery name="qContragent" datasource="dwh">
select upper(trim(k.id_klienta)) as wz, k.__id::text as contragent_uid, k.__name as contragent,
@@ -60,13 +73,14 @@ select count(*) as cnt from s3billing.user_info where 1=1
<cfset db = new MemoryDbHelper()/>
<cfset db.register("qS3", qS3, "inmem")/>
<cfset db.register("qS3User", qS3User, "inmem")/>
<cfset db.register("qContragent", qContragent, "inmem")/>
<cfquery name="qRead" datasource="inmem">
select
<d:field_set titleMapOut="titleMap" lengthOut="fieldCount">
<d:field title="id" cfSqlType="CF_SQL_INTEGER">s.id</d:field>
<d:field title="user info id" cfSqlType="CF_SQL_INTEGER">s.id</d:field>
<d:field title="owner">s.owner</d:field>
<d:field title="Бакетов" cfSqlType="CF_SQL_INTEGER">s.bucket_cnt</d:field>
<d:field title="Объем байт" cfSqlType="CF_SQL_INTEGER">s.size_byte</d:field>
@@ -76,13 +90,27 @@ select
<d:field title="contragent_uid">c.contragent_uid</d:field>
<d:field title="Ответственный">c.responsible</d:field>
<d:field title="Email ответственного">c.responsible_email</d:field>
<d:field title="userId (state)">u.user_id</d:field>
<d:field title="WZ (state)">u.wz as wzs</d:field>
<d:field title="WZ (instance)">u.external_code</d:field>
<d:field title="Контрагент (CMDB)">u.contragent as cmdb_contragent</d:field>
<d:field title="Instance Display Name">u.display_name</d:field>
</d:field_set>
from qS3 s
left outer join qContragent c on (s.wz=c.wz)
full outer join qS3User u on (s.owner=u.user_id)
where 1=1 <m:filter_build filter=#pageInfo.settings.filter#/>
order by <m:order_build sortArray=#pageInfo.settings.sort.sortArray# fieldCount=#fieldCount#/>
</cfquery>
<cfquery name="qCountTotal" datasource="inmem">
select count(*) as cnt
from qS3 s
left outer join qContragent c on (s.wz=c.wz)
full outer join qS3User u on (s.owner=u.user_id)
</cfquery>
</m:silent><!---
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
@@ -97,7 +125,7 @@ order by <m:order_build sortArray=#pageInfo.settings.sort.sortArray# fieldCount=
---><layout:page section="header" pageInfo=#pageInfo#>
<layout:attribute name="title">
<cfoutput><b>Учетки S3</b></cfoutput>
<cfoutput><b>Учетные записи S3 - дефектовка</b></cfoutput>
</layout:attribute>
<!--- <layout:attribute name="controls"></layout:attribute> --->
</layout:page>
@@ -115,37 +143,53 @@ order by <m:order_build sortArray=#pageInfo.settings.sort.sortArray# fieldCount=
<table class="worktable">
<thead>
<tr>
<th colspan="4"></th>
<th colspan="5"><b>Биллинг (из S3 CEPH)</b></th>
<th colspan="99"><b>CMDB</b></th>
</tr>
<layout:grid_head titleMap=#titleMap# sortArray=#pageInfo.settings.sort.sortArray#>
<!--- <tr> --->
<th width="1%"><layout:column_head name="id"/></th>
<th width="10%"><layout:column_head name="owner"/></th>
<th width="2%"><layout:column_head name="wz"/></th>
<th width="10%"><layout:column_head name="contragent"/></th>
<!--- <th width="3%"><layout:column_head name="contragent_uid"/></th> --->
<th width="5%"><layout:column_head name="responsible"/></th>
<th width="5%"><layout:column_head name="responsible_email"/></th>
<th width="1%"><layout:column_head name="id"/></th>
<th width="10%"><layout:column_head name="owner"/></th>
<th width="1%"><layout:column_head name="bucket_cnt"/></th>
<th width="3%"><layout:column_head name="size_byte"/></th>
<th width="60%"><layout:column_head name="buckets"/></th>
<th width="5%"><layout:column_head name="display_name"/></th>
<th width="5%"><layout:column_head name="user_id"/></th>
<th width="5%"><layout:column_head name="wzs"/></th>
<th width="5%"><layout:column_head name="external_code"/></th>
<th width="10%"><layout:column_head name="cmdb_contragent"/></th>
<!--- </tr> --->
</layout:grid_head>
</thead>
<cfoutput query="qRead">
<tr>
<td class="r">#id#</td>
<td<cfif !(isNumeric(owner) AND owner LT 10000)> class="err"</cfif>>#owner#</td>
<td><a href="contragent.cfm?__id=#contragent_uid#&#tr.fwx#">#wz#</a></td>
<td><a href="contragent.cfm?__id=#contragent_uid#&#tr.fwx#">#contragent#</a></td>
<td>#responsible#</td>
<td><a href="mailto:#responsible_email#">#responsible_email#</a></td>
<td class="r">#id#</td>
<td<cfif !(isNumeric(owner) AND owner LT 10000)> class="err"</cfif>>#owner#</td>
<td class="r">#bucket_cnt#</td>
<td class="r">#size_byte#</td>
<td>#buckets#</td>
<td<cfif len(owner) AND NOT len(display_name)> style="background-color:LightCoral"</cfif>>#display_name#</td>
<td>#user_id#</td>
<td<cfif wzs NEQ external_code> style="background-color:LightCoral"</cfif>><a href="contragent.cfm?id_klienta=#wzs#&#tr.fwx#">#wzs#</a></td>
<td><a href="contragent.cfm?id_klienta=#external_code#&#tr.fwx#">#external_code#</a></td>
<td>#cmdb_contragent#</td>
</tr>
</cfoutput>
</table>