005
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
</cfsilent>
|
||||
|
||||
|
||||
<cffunction name="get" hint="попробуем авторизоваться у элмы">
|
||||
<cffunction name="get" hint="генерирует ошибку 500">
|
||||
<!--- <cfargument name="svcOperationId" required=true hint="int"/> --->
|
||||
<!--- <cftry>
|
||||
<cfset this.helper.validateField(arguments, "svcOperationId", "integer")/>
|
||||
@@ -20,7 +20,7 @@
|
||||
<!--- <cfdump var=#userdata#/><cfabort/> --->
|
||||
|
||||
|
||||
<cfreturn representationOf(fcontent) />
|
||||
<cfreturn representationOf("Some error").withStatus(500) />
|
||||
</cffunction>
|
||||
|
||||
</cfcomponent>
|
||||
@@ -39,7 +39,7 @@
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
|
||||
<!--- <cftry> --->
|
||||
<cftry><!--- *** времянка, пока глотается ошибка 500 --->
|
||||
|
||||
<cfset var maxrows=arguments.pageSize*arguments.page/>
|
||||
<cfset var startrow=arguments.pageSize*(arguments.page-1)+1/>
|
||||
@@ -121,11 +121,10 @@
|
||||
<!---<cfset "out.sql"=#local.result.sql#/>--->
|
||||
<cfreturn representationOf(out)/>
|
||||
|
||||
<!--- <cfcatch type="any">
|
||||
|
||||
<cfcatch type="any">
|
||||
<cfreturn representationOf(cfcatch)/>
|
||||
</cfcatch>
|
||||
</cftry> --->
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
</cffunction>
|
||||
|
||||
|
||||
|
||||
@@ -110,6 +110,8 @@
|
||||
<cfset var maxrows=arguments.pageSize*arguments.page/>
|
||||
<cfset var startrow=arguments.pageSize*(arguments.page-1)+1/>
|
||||
|
||||
<cfset request.locateIamService()/>
|
||||
|
||||
|
||||
<cfquery name="local.qRead" result="local.result">
|
||||
select
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<cfcomponent extends="taffy.core.resource" taffy:uri="/user">
|
||||
|
||||
<cfsilent>
|
||||
<cfimport prefix="m" taglib="../lib"/>
|
||||
<cfset this.helper=CreateObject("component","lib.rest_api_helper")/><!---*** странно, почему мы его видим?---><!---вынести в апп?--->
|
||||
</cfsilent>
|
||||
|
||||
|
||||
|
||||
|
||||
<cffunction name="get" hint="Контрольная информация по текущему пользователю для проверки контекста. Предполагается использовать только для интеграционной отладки. Исключения перехватываются, всегда возвращается код 200, структура ответа при этом не предназначена для разбора">
|
||||
<cftry>
|
||||
|
||||
<cfset var local={}/><!--- *** а точно нужно var? --->
|
||||
<cfset var out=structNew("linked")/>
|
||||
|
||||
<cfset "out.usrId"=#ARGUMENTS.usrId#/>
|
||||
<cfset "out.iamServiceUrl"=request.locateIamService()/>
|
||||
|
||||
<cfset "out.serviceLocationDurationMs"=getTickCount() - request.startTickCount/>
|
||||
|
||||
<cfquery name=local.qSpec>
|
||||
select
|
||||
<m:field_set titleMapOut="local.specTitleMap" lengthOut="local.fieldCount">
|
||||
<m:field cfSqlType="CF_SQL_INTEGER">s.specification_id</m:field>
|
||||
<m:field>s.specification</m:field>
|
||||
<m:field>(select count(*) from specification_item i where i.specification_id=s.specification_id) as specification_item_count</m:field>
|
||||
<m:field>c.contract_id</m:field>
|
||||
<m:field>c.contract</m:field>
|
||||
<m:field>to_char(c.dt_contract, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_contract</m:field>
|
||||
</m:field_set>
|
||||
from specification s
|
||||
join contract c on (s.contract_id=c.contract_id)
|
||||
join usr u on (c.contragent_id=u.contragent_id)
|
||||
where u.usr_id=<cfqueryparam cfsqltype="cf_sql_integer" value=#ARGUMENTS.usrId#/><!--- *** undeclared --->
|
||||
order by specification_id desc limit 1;
|
||||
</cfquery>
|
||||
|
||||
<cfquery name="local.qRead" result="local.result">
|
||||
select
|
||||
<m:field_set titleMapOut="local.titleMap" lengthOut="local.fieldCount">
|
||||
<m:field cfSqlType="CF_SQL_INTEGER">u.usr_id</m:field>
|
||||
<m:field>u.login</m:field>
|
||||
<m:field>k.contragent_id</m:field>
|
||||
<m:field>k.contragent</m:field>
|
||||
</m:field_set>
|
||||
from usr u
|
||||
left outer join contragent k on u.contragent_id=k.contragent_id
|
||||
where u.usr_id=<cfqueryparam cfsqltype="cf_sql_integer" value=#ARGUMENTS.usrId#/>
|
||||
</cfquery>
|
||||
|
||||
|
||||
<cfset "out.queryDurationMs"=getTickCount() - request.startTickCount- out.serviceLocationDurationMs/>
|
||||
|
||||
<cfset var resultSet=[]/>
|
||||
<cfset "out.usr" = (local.qRead.recordCount GT 0) ? this.helper.appendRecord(structNew("linked"), "", local.titleMap, local.qRead, this.helper.snake2camel) : {}/>
|
||||
<cfset "out.defaultSpecification" = (local.qSpec.recordCount GT 0) ? this.helper.appendRecord(structNew("linked"), "", local.specTitleMap, local.qSpec, this.helper.snake2camel) : {}/>
|
||||
|
||||
<cfset "out.runDurationMs"=getTickCount()-request.startTickCount/>
|
||||
<!---<cfset "out.sql"=#local.result.sql#/>--->
|
||||
<cfreturn representationOf(out)/>
|
||||
|
||||
<cfcatch type="any">
|
||||
<cfreturn representationOf(cfcatch)/>
|
||||
</cfcatch>
|
||||
</cftry>
|
||||
|
||||
</cffunction>
|
||||
|
||||
<!--- <cffunction name="get" hint="проверка">
|
||||
<cfreturn representationOf("Проверка связи")/>
|
||||
</cffunction> --->
|
||||
|
||||
</cfcomponent>
|
||||
Reference in New Issue
Block a user