我有一个非常复杂的屏幕,直到最近才开始工作,但现在当我输入它时,它永远不会安装并发出以下错误:
ERROR 08-06-2018 11:39:59 [GrailsExceptionResolver]: MissingPropertyException occurred when processing request: [GET] /expedicao/listaremessa
No such property: status for class: java.lang.String. Stacktrace follows:
org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error processing GroovyPageView: No such property: status for class: java.lang.String
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:200)
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
at grails.plugin.multitenant.core.servlet.CurrentTenantServletFilter.doFilter(CurrentTenantServletFilter.java:53)
at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.java:53)
at com.odobo.grails.plugin.springsecurity.rest.RestAuthenticationFilter.doFilter(RestAuthenticationFilter.groovy:108)
at grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter.doFilter(RequestHolderAuthenticationFilter.java:49)
at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:82)
at com.odobo.grails.plugin.springsecurity.rest.RestLogoutFilter.doFilter(RestLogoutFilter.groovy:63)
at com.brandseye.cors.CorsFilter.doFilter(CorsFilter.java:82)
Caused by: groovy.lang.MissingPropertyException: No such property: status for class: java.lang.String
at gsp_wms_expedicaolistaremessa_gsp$_run_closure2.doCall(gsp_wms_expedicaolistaremessa_gsp.groovy:295)
at gsp_wms_expedicaolistaremessa_gsp.run(gsp_wms_expedicaolistaremessa_gsp.groovy:331)
生成屏幕的代码摘录如下:
@Secured(['ROLE_EXPEDICAO_REMESSAS'])
def listaremessa() {
log.info '* Method: listaremessa'
log.debug "* Params: ${params}"
log.debug "* Date Start: ${new Date()}"
def dataPesquisada
def valor
params.max = Math.min(params.max ? params.int('max') : 10, 100)
params.sort = params.sort ?: 'dataInicio'
params.order = params.order ?: 'desc'
try {
event('hook_expedicao_busca_multi', params.filter, [fork: false])
} catch (Exception e) {
log.error (e.message, e)
flashMessage("Erro na comunicação com CRM - Mercanet", params.filter)
}
def results = Expedicao.createCriteria().list(max: params.max, offset: params.offset ?: 0) {
if (params['filter']) {
or {
ilike("codigo", "%${params.filter}%")
ilike("numeroSAP", "%${params.filter}%")
ilike("numeroCRM", "%${params.filter}%")
ilike("bairroDestinatario", "%${params.filter}%")
ilike("cidadeDestinatario", "%${params.filter}%")
ilike("ufDestinatario", "%${params.filter}%")
cliente {
or {
ilike ("codigo", "%${params.filter}%")
ilike ("nome", "%${params.filter}%")
}
}
}
}
if(params?.dataInicio_value != null && params?.dataInicio_value !=""){
def format = new SimpleDateFormat("dd/MM/yyyy")
dataPesquisada = format.parse(params?.dataInicio_value)
log.debug "dataPesquisada: " + dataPesquisada
between('dataInicio', dataPesquisada, dataPesquisada + 1)
}
if(params?.valor != null && params?.valor !="" ){
if(params?.operador != null && params?.valor !="") {
log.debug "valor: " + params.valor
log.debug "operador: " + params.operador
valor = params.valor
valor = valor.replace(".", "")
valor = valor.replace(",", ".")
if(params.operador == '>=') {
ge('valorBruto', valor.toFloat())
}
else if (params.operador == '<') {
lt('valorBruto', valor.toFloat())
}
else {
eq('valorBruto', valor.toFloat())
}
}
}
if((params['aba']) && (params['aba'] == 'Pendente')) {
'in'("status",["em_aberto", "obtendo_forma_de_envio", "a_imprimir"])
}
else if(params['aba'] == 'Separacao') {
'in'("status",["aguardando_separacao", "em_separacao", "picking_finalizado"])
}
else if(params['aba'] == 'Faturamento') {
'in'("status",["aguardando_faturamento", "faturamento_OK", "faturamento_Erro", "cancelado"])
}
not {'in'("status",["despachado"])}
if (params.order) {
order(params.sort, params.order)
}
}
log.debug "* Date Finish: ${new Date()}"
[expedicaoList: results, expedicaoTotal: results.totalCount, aba:params.aba?:'',dataInicio_value:params?.dataInicio_value, valor:params?.valor, operador:params?.operador]
}
根据我对此错误消息的理解,这有一个问题,即找不到属性&#34; status&#34;在我的字符串课中,这很明显,它没有,但为什么它发现我的&#34;远征&#34;对象是一个字符串?我该如何纠正这个?
以下是gsp指出此错误的要点:
258 <g:each status="i" in="${expedicaoList}" var="expedicao">
...
290 <g:if test="${expedicao?.status =='obtendo_forma_de_envio' || expedicao?.status =='a_imprimir' || expedicao?.status == ''}">
291 <g:hiddenField name="expedicao_${i}" value="${expedicao.id}" id="expedicao_${i}" />
292 <g:select id="formaenvio_${i}" name="formaEnvio" from="${Transportadora.list()}" optionKey="id" value="${expedicao?.formaDeEnvio?.id}" optionValue="codigo" onchange="habilitaSelect(${i},this.value)" noSelection="['null': '']"/>
293 </g:if>
294 <g:else>
295 <g:select name="expedicao_${i}" from="${Transportadora.list()}" optionKey="id" value="${expedicao?.formaDeEnvio?.id}" optionValue="codigo" disabled="disabled" id="expedicao_${i}"/>
296 </g:else>
...
331 <g:if test="${expedicao.numeroCRM}">
332 <b><g:message code="expedicao.numeroCRM.label" default="Número CRM: " /></b>
333 ${fieldValue(bean: expedicao, field: "numeroCRM")}
334 </g:if>
让我怀疑的是,第295行中的错误指控,但是错误是在第290行中使用的status属性。最奇怪的是这段代码停止工作,没有任何改变这些衣服