157 lines
6.0 KiB
Plaintext
157 lines
6.0 KiB
Plaintext
<cfsilent>
|
|
<cfimport prefix="m" taglib="lib"/>
|
|
<cfimport prefix="c" taglib="lib/controls"/>
|
|
<cfimport prefix="d" taglib="lib/data"/>
|
|
<cfimport prefix="layout" taglib="layout"/>
|
|
</cfsilent><m:silent silent="No">
|
|
|
|
<cffunction name="hideNonPositive">
|
|
<cfargument name="a"/>
|
|
<cfreturn (a GT 0)? a : ""/>
|
|
</cffunction>
|
|
|
|
<m:prepare_ls entity="s3_user" accessObject="" pageInfoOut="pageInfo" trackOut="tr"/>
|
|
|
|
<!--- <m:filter_settings target="#pageInfo.entity#_ls">
|
|
<m:filterparam filter=#filter# param="quickfilter" ftype="string" prefix="%" suffix="%" expression="((p.project like ?) OR (p.customer like ?) OR (p.customer_alias like ?) OR (p.contragent_class_type like ?) OR (p.division like ?) OR (p.performer_short like ?))" default=""/>
|
|
</m:filter_settings> --->
|
|
<!--- <cfset pageInfo.settings.filter=#filter#/> --->
|
|
|
|
<!--- <cftry> --->
|
|
<cfquery name="qS3" datasource="billing-s3">
|
|
select
|
|
<d:field_set titleMapOut="titleMap" lengthOut="fieldCount">
|
|
u.id
|
|
,u.owner
|
|
,(select count(*) from s3billing.bucket_stat b where b.timestamp_addition=t.timestamp_addition AND b.owner=u.owner) as bucket_cnt
|
|
,(select sum(b.usage_rgw_main_size_actual) from s3billing.bucket_stat b where b.timestamp_addition=t.timestamp_addition AND b.owner=u.owner) as size_byte
|
|
,(select STRING_AGG(i.name ||'['||
|
|
case
|
|
when ( p.name = 'default-placement') then 'HOT'
|
|
else p.name
|
|
end || ']', ', ' order by i.name)
|
|
from s3billing.bucket_stat b
|
|
join s3billing.bucket_info i on (b.bucket_id= i.id)
|
|
join s3billing.placement p on (i.placement_id = p.id)
|
|
where b.timestamp_addition=t.timestamp_addition AND b.owner=u.owner
|
|
) as buckets
|
|
,'WZ' || lpad(u.name, 5, '0') as wz
|
|
from s3billing.user_info u
|
|
cross join (select max(timestamp_addition) as timestamp_addition from s3billing.bucket_stat) t
|
|
</cfquery>
|
|
<!--- <cfdump var=#qRead#/> --->
|
|
|
|
<!--- <cfcatch type="database">
|
|
<m:ls_catch catch=#cfcatch# status=#pageInfo.status#/>
|
|
</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,
|
|
c.__name as responsible, c.email as responsible_email, c.__status_status as responsible_status
|
|
from elma.companies k
|
|
LEFT OUTER JOIN elma.comp_users_ext c on (k.responsible=c.__id)
|
|
where k."__deletedAt" IS NULL
|
|
</cfquery>
|
|
|
|
<cfset db = new MemoryDbHelper()/>
|
|
<cfset db.register("qS3", qS3, "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="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>
|
|
<d:field title="Бакеты">s.buckets</d:field>
|
|
<d:field title="WZ">c.wz</d:field>
|
|
<d:field title="Контрагент">c.contragent</d:field>
|
|
<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_set>
|
|
from qS3 s
|
|
left outer join qContragent c on (s.wz=c.wz)
|
|
where 1=1 <m:filter_build filter=#pageInfo.settings.filter#/>
|
|
order by <m:order_build sortArray=#pageInfo.settings.sort.sortArray# fieldCount=#fieldCount#/>
|
|
</cfquery>
|
|
|
|
</m:silent><!---
|
|
-----------------------------------------------------------------------------------------
|
|
-----------------------------------------------------------------------------------------
|
|
-----------------------------------------------------------------------------------------
|
|
---><cfif isDefined("output_xls")>
|
|
<layout:xml qRead=#qRead# titleMap=#titleMap# filename="#pageInfo.entity#.xml"/>
|
|
<cfabort/>
|
|
</cfif><cfif isDefined("output_json")>
|
|
<layout:json qRead=#qRead# titleMap=#titleMap# filename="#pageInfo.entity#.json"/>
|
|
<cfabort/>
|
|
</cfif><!---
|
|
---><layout:page section="header" pageInfo=#pageInfo#>
|
|
|
|
<layout:attribute name="title">
|
|
<cfoutput><b>Учетки S3</b></cfoutput>
|
|
</layout:attribute>
|
|
<!--- <layout:attribute name="controls"></layout:attribute> --->
|
|
</layout:page>
|
|
|
|
<cfif pageInfo.readPermitted() AND !pageInfo.status.errorState>
|
|
|
|
<layout:grid_summary
|
|
recordCount=#qRead.recordCount#
|
|
totalCount=#qCountTotal.cnt#
|
|
footerOut="gridFooter"
|
|
excelLink="Yes"
|
|
jsonLink="Yes"
|
|
/>
|
|
|
|
|
|
<table class="worktable">
|
|
<thead>
|
|
<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="bucket_cnt"/></th>
|
|
<th width="3%"><layout:column_head name="size_byte"/></th>
|
|
<th width="60%"><layout:column_head name="buckets"/></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">#bucket_cnt#</td>
|
|
<td class="r">#size_byte#</td>
|
|
<td>#buckets#</td>
|
|
</tr>
|
|
</cfoutput>
|
|
</table>
|
|
|
|
<cfoutput>#gridFooter#</cfoutput>
|
|
|
|
</cfif>
|
|
<layout:page section="footer"/>
|