Fixes bug#AL-4554
parent
ab5d5e7bcf
commit
1d3bf13f0a
|
@ -0,0 +1,168 @@
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.expressos;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Datebox;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.LogAuditoria;
|
||||||
|
import com.rjconsultores.ventaboletos.service.LogAuditoriaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderLogAuditoria;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderLogAuditoriaExpresos;
|
||||||
|
import com.trg.search.Filter;
|
||||||
|
|
||||||
|
import br.com.rjconsultores.auditador.enums.AuditadorTipoAlteracao;
|
||||||
|
|
||||||
|
@Controller("logExpresosController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class LogExpresosController extends MyGenericForwardComposer{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LogAuditoriaService logAuditoriaService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<LogAuditoria> plwLogAuditoria;
|
||||||
|
|
||||||
|
private static Logger log = LogManager.getLogger(LogExpresosController.class);
|
||||||
|
|
||||||
|
private MyComboboxEstandar cmbTipoAlteracao;
|
||||||
|
private MyListbox logAuditoriaList;
|
||||||
|
private Paging pagingLogAuditoria;
|
||||||
|
|
||||||
|
private Datebox dtInicio;
|
||||||
|
private Datebox dtFim;
|
||||||
|
|
||||||
|
private MyTextbox txtCampoAlterado;
|
||||||
|
private MyTextbox txtCveUsuario;
|
||||||
|
private MyTextbox txtValorNovo;
|
||||||
|
private MyTextbox txtValorAnterior;
|
||||||
|
private MyTextbox txtIdAuditado;
|
||||||
|
|
||||||
|
private Map<String, String> nomeTelas;
|
||||||
|
private List<String> lsTela;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
lsTela = recuperarChavesClasse(logAuditoriaService.listarTodasAsTelas());
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
logAuditoriaList.setItemRenderer(new RenderLogAuditoriaExpresos());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista(boolean isGerarRelatorio) throws Exception {
|
||||||
|
HibernateSearchObject<LogAuditoria> sistemaBusqueda = new HibernateSearchObject<LogAuditoria>(LogAuditoria.class, pagingLogAuditoria.getPageSize());
|
||||||
|
|
||||||
|
Date dataInicio = dtInicio.getValue();
|
||||||
|
Date dataFim = dtFim.getValue();
|
||||||
|
|
||||||
|
sistemaBusqueda.addFilterGreaterOrEqual("fecmodif", DateUtil.inicioFecha(dataInicio));
|
||||||
|
sistemaBusqueda.addFilterLessOrEqual("fecmodif", DateUtil.fimFecha(dataFim));
|
||||||
|
|
||||||
|
String campoAlterado = txtCampoAlterado.getText();
|
||||||
|
if (StringUtils.isNotBlank(campoAlterado)) {
|
||||||
|
sistemaBusqueda.addFilterLike("campoAlterado", "%" + campoAlterado.trim().concat("%"));
|
||||||
|
}
|
||||||
|
|
||||||
|
String valorNovo = txtValorNovo.getText();
|
||||||
|
if (StringUtils.isNotBlank(valorNovo)) {
|
||||||
|
sistemaBusqueda.addFilterLike("valorNovo", "%" + valorNovo.trim().concat("%"));
|
||||||
|
}
|
||||||
|
|
||||||
|
String valorAnterior = txtValorAnterior.getText();
|
||||||
|
if (StringUtils.isNotBlank(valorAnterior)) {
|
||||||
|
sistemaBusqueda.addFilterLike("valorAnterior", "%" + valorAnterior.trim().concat("%"));
|
||||||
|
}
|
||||||
|
|
||||||
|
String idAuditado = txtIdAuditado.getValue();
|
||||||
|
if (StringUtils.isNotBlank(idAuditado)) {
|
||||||
|
sistemaBusqueda.addFilterLike("idAuditado", idAuditado + "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
String cveUsuario = txtCveUsuario.getText();
|
||||||
|
if (StringUtils.isNotBlank(cveUsuario)) {
|
||||||
|
sistemaBusqueda.addFilterLike("usuario.claveUsuario", "%" + cveUsuario.trim().concat("%"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//sistemaBusqueda.addFilterEqual("tela", recuperarChaveNomeTela("auditarClasse.SolicitudExpreso"));
|
||||||
|
sistemaBusqueda.addFilterEqual("tela", "auditarClasse.SolicitudExpreso");
|
||||||
|
|
||||||
|
AuditadorTipoAlteracao tipoAlteracao = cmbTipoAlteracao.getSelectedItem() != null ? (AuditadorTipoAlteracao) cmbTipoAlteracao.getSelectedItem().getValue() : null;
|
||||||
|
if(tipoAlteracao != null) {
|
||||||
|
sistemaBusqueda.addFilterEqual("tipoAlteracao", tipoAlteracao.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
sistemaBusqueda.addSortAsc("fecmodif");
|
||||||
|
sistemaBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
|
||||||
|
plwLogAuditoria.init(sistemaBusqueda, logAuditoriaList, pagingLogAuditoria);
|
||||||
|
|
||||||
|
if (logAuditoriaList.getData().length == 0) {
|
||||||
|
if(isGerarRelatorio){
|
||||||
|
throw new Exception(Labels.getLabel("MSG.ningunRegistroRelatorio"));
|
||||||
|
}else{
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),Labels.getLabel("busquedaLogAuditoriaController.window.title"), Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
log.error("", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
//configurarNomesTelas();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> recuperarChavesClasse(List<String> lsTela) {
|
||||||
|
|
||||||
|
nomeTelas = new HashMap<String, String>();
|
||||||
|
List<String> lsTelasAux = new ArrayList<String>();
|
||||||
|
|
||||||
|
for (String tela : lsTela) {
|
||||||
|
lsTelasAux.add(Labels.getLabel(tela, tela));
|
||||||
|
nomeTelas.put(tela, Labels.getLabel(tela, tela));
|
||||||
|
}
|
||||||
|
Collections.sort(lsTelasAux);
|
||||||
|
return lsTelasAux;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String recuperarChaveNomeTela(String tela) {
|
||||||
|
|
||||||
|
String chave = null;
|
||||||
|
for (Entry<String, String> entry : nomeTelas.entrySet()) {
|
||||||
|
if (entry.getValue().equals(tela)) {
|
||||||
|
chave = entry.getKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return chave;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws Exception {
|
||||||
|
refreshLista(false);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.rjconsultores.ventaboletos.web.utilerias.menu.item.expressos;
|
||||||
|
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.PantallaUtileria;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.menu.DefaultItemMenuSistema;
|
||||||
|
|
||||||
|
public class ItemMenuLog extends DefaultItemMenuSistema {
|
||||||
|
public ItemMenuLog() {
|
||||||
|
super("indexController.mniExpressosLog.label");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getClaveMenu() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void ejecutar() {
|
||||||
|
PantallaUtileria.openWindow("/gui/expressos/log.zul",
|
||||||
|
Labels.getLabel("indexController.mniExpressosLog.label"),
|
||||||
|
getArgs(), desktop);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.rjconsultores.ventaboletos.web.utilerias.render;
|
||||||
|
|
||||||
|
import org.zkoss.zul.Listcell;
|
||||||
|
import org.zkoss.zul.Listitem;
|
||||||
|
import org.zkoss.zul.ListitemRenderer;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.LogAuditoria;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
|
|
||||||
|
public class RenderLogAuditoriaExpresos implements ListitemRenderer {
|
||||||
|
|
||||||
|
public void render(Listitem lstm, Object o) throws Exception {
|
||||||
|
LogAuditoria logAuditoria = (LogAuditoria) o;
|
||||||
|
|
||||||
|
Listcell lc = new Listcell(DateUtil.getStringDate(logAuditoria.getFecmodif(), "dd/MM/yyyy HH:mm"));
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
lc = new Listcell(logAuditoria.getIdAuditado() != null ? logAuditoria.getIdAuditado().toString() : "");
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
lc = new Listcell(String.format("%s - %s", logAuditoria.getUsuario().getClaveUsuario(), logAuditoria.getUsuario().getNombusuario()));
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
lc = new Listcell(logAuditoria.getTipoAlteracao());
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
lc = new Listcell(logAuditoria.getCampoAlterado());
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
lc = new Listcell(logAuditoria.getValorNovo());
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
lc = new Listcell(logAuditoria.getValorAnterior());
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
lstm.setAttribute("data", logAuditoria);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<?page contentType="text/html;charset=UTF-8"?>
|
||||||
|
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
||||||
|
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="winLogExpresos"?>
|
||||||
|
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
|
||||||
|
|
||||||
|
<zk xmlns="http://www.zkoss.org/2005/zul">
|
||||||
|
<window id="winLogExpresos" title="${c:l('winLogExpresos.title')}"
|
||||||
|
border="normal" height="484px" width="1095px" position="center" mode="overlapped"
|
||||||
|
apply="${logExpresosController}">
|
||||||
|
<toolbar>
|
||||||
|
<button id="btnCerrar" onClick="winLogExpresos.detach()" image="/gui/img/exit.png" width="35px"
|
||||||
|
tooltiptext="${c:l('busquedaLogAuditoriaController.btnCerrar.tooltiptext')}"/>
|
||||||
|
</toolbar>
|
||||||
|
|
||||||
|
<grid fixedLayout="true">
|
||||||
|
<columns>
|
||||||
|
<column width="17%" />
|
||||||
|
<column width="35%" />
|
||||||
|
<column width="13%" />
|
||||||
|
<column width="35%" />
|
||||||
|
</columns>
|
||||||
|
<rows>
|
||||||
|
<row>
|
||||||
|
<label
|
||||||
|
value="${c:l('lb.dataIni.value')}" />
|
||||||
|
<datebox id="dtInicio" width="40%" mold="rounded"
|
||||||
|
format="dd/MM/yyyy" maxlength="10"
|
||||||
|
constraint="no empty" />
|
||||||
|
<label
|
||||||
|
value="${c:l('lb.dataFin.value')}" />
|
||||||
|
<datebox id="dtFim" width="40%" mold="rounded"
|
||||||
|
format="dd/MM/yyyy" maxlength="10"
|
||||||
|
constraint="no empty" />
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<label
|
||||||
|
value="${c:l('busquedaLogAuditoriaController.lblCampoAlterado')}" />
|
||||||
|
<textbox id="txtCampoAlterado"
|
||||||
|
width="70%"
|
||||||
|
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox" />
|
||||||
|
<label
|
||||||
|
value="${c:l('busquedaLogAuditoriaController.lblValorNovo')}" />
|
||||||
|
<textbox id="txtValorNovo"
|
||||||
|
width="70%"
|
||||||
|
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox" />
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<label value="${c:l('indexController.mniUsuario.label')}"/>
|
||||||
|
<textbox id="txtCveUsuario"
|
||||||
|
width="70%"
|
||||||
|
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox"/>
|
||||||
|
<label
|
||||||
|
value="${c:l('busquedaLogAuditoriaController.lblValorAnterior')}" />
|
||||||
|
<textbox id="txtValorAnterior"
|
||||||
|
width="70%"
|
||||||
|
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox" />
|
||||||
|
</row>
|
||||||
|
<row spans="1, 3">
|
||||||
|
<label value="${c:l('busquedaLogAuditoriaController.lblIdAuditado')}"/>
|
||||||
|
<textbox id="txtIdAuditado"
|
||||||
|
width="40%"
|
||||||
|
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox" />
|
||||||
|
</row>
|
||||||
|
</rows>
|
||||||
|
</grid>
|
||||||
|
<toolbar>
|
||||||
|
<button id="btnPesquisa" image="/gui/img/find.png"
|
||||||
|
label="${c:l('tooltiptext.btnPesquisa')}"/>
|
||||||
|
</toolbar>
|
||||||
|
<paging id="pagingLogAuditoria" pageSize="20" />
|
||||||
|
<listbox id="logAuditoriaList" use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
|
||||||
|
multiple="false" height="50%" vflex="true">
|
||||||
|
<listhead sizable="true">
|
||||||
|
<listheader image="/gui/img/create_doc.gif"
|
||||||
|
label="${c:l('busquedaLogAuditoriaController.lblDtAlteracao')}" width="110px"/>
|
||||||
|
<listheader image="/gui/img/create_doc.gif"
|
||||||
|
label="${c:l('busquedaLogAuditoriaController.lblIdAuditado')}" width="120px"/>
|
||||||
|
<listheader image="/gui/img/create_doc.gif"
|
||||||
|
label="${c:l('indexController.mniUsuario.label')}" width="130px"/>
|
||||||
|
<listheader image="/gui/img/create_doc.gif"
|
||||||
|
label="${c:l('busquedaLogAuditoriaController.lblTipoAlteracao')}" width="110px"/>
|
||||||
|
<listheader image="/gui/img/create_doc.gif"
|
||||||
|
label="${c:l('busquedaLogAuditoriaController.lblCampoAlterado')}" width="120px"/>
|
||||||
|
<listheader image="/gui/img/create_doc.gif"
|
||||||
|
label="${c:l('busquedaLogAuditoriaController.lblValorNovo')}" width="240px"/>
|
||||||
|
<listheader image="/gui/img/create_doc.gif"
|
||||||
|
label="${c:l('busquedaLogAuditoriaController.lblValorAnterior')}" width="240px"/>
|
||||||
|
</listhead>
|
||||||
|
</listbox>
|
||||||
|
</window>
|
||||||
|
</zk>
|
Loading…
Reference in New Issue