Pesquisa de Usuário (fixes bug #6600)
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@47536 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
30c113a89c
commit
d80f0a5bd2
|
@ -43,233 +43,231 @@ import com.trg.search.Filter;
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
public class BusquedaUsuarioController extends MyGenericForwardComposer {
|
public class BusquedaUsuarioController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
@Autowired
|
private static final long serialVersionUID = 1L;
|
||||||
private transient PagedListWrapper<Usuario> plwFormaPago;
|
|
||||||
@Autowired
|
|
||||||
private PerfilService perfilService;
|
|
||||||
private List<Perfil> lsPerfil;
|
|
||||||
private MyListbox usuarioList;
|
|
||||||
private Paging pagingUsuario;
|
|
||||||
private Textbox txtNombUsuario;
|
|
||||||
private Textbox txtNombPaterno;
|
|
||||||
private Textbox txtNombMaterno;
|
|
||||||
private Textbox txtCveUsuario;
|
|
||||||
private Textbox txtCveEmpleado;
|
|
||||||
private Combobox cmbPerfil;
|
|
||||||
|
|
||||||
private Combobox cmbEmpresa;
|
@Autowired
|
||||||
|
private transient PagedListWrapper<Usuario> plwFormaPago;
|
||||||
|
@Autowired
|
||||||
|
private PerfilService perfilService;
|
||||||
|
private List<Perfil> lsPerfil;
|
||||||
|
private MyListbox usuarioList;
|
||||||
|
private Paging pagingUsuario;
|
||||||
|
private Textbox txtNombUsuario;
|
||||||
|
private Textbox txtNombPaterno;
|
||||||
|
private Textbox txtNombMaterno;
|
||||||
|
private Textbox txtCveUsuario;
|
||||||
|
private Textbox txtCveEmpleado;
|
||||||
|
private Combobox cmbPerfil;
|
||||||
|
|
||||||
|
private Combobox cmbEmpresa;
|
||||||
private List<Empresa> lsEmpresas;
|
private List<Empresa> lsEmpresas;
|
||||||
|
|
||||||
private List<PuntoVenta> lsPuntoVenta;
|
private List<PuntoVenta> lsPuntoVenta;
|
||||||
private MyComboboxPuntoVenta cmbPuntoVenta;
|
private MyComboboxPuntoVenta cmbPuntoVenta;
|
||||||
|
|
||||||
public Textbox getTxtCveUsuario() {
|
public Textbox getTxtCveUsuario() {
|
||||||
return txtCveUsuario;
|
return txtCveUsuario;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTxtCveUsuario(Textbox txtCveUsuario) {
|
public void setTxtCveUsuario(Textbox txtCveUsuario) {
|
||||||
this.txtCveUsuario = txtCveUsuario;
|
this.txtCveUsuario = txtCveUsuario;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Perfil> getLsPerfil() {
|
public List<Perfil> getLsPerfil() {
|
||||||
return lsPerfil;
|
return lsPerfil;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLsPerfil(List<Perfil> lsPerfil) {
|
public void setLsPerfil(List<Perfil> lsPerfil) {
|
||||||
this.lsPerfil = lsPerfil;
|
this.lsPerfil = lsPerfil;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Combobox getCmbPerfil() {
|
public Combobox getCmbPerfil() {
|
||||||
return cmbPerfil;
|
return cmbPerfil;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCmbPerfil(Combobox cmbPerfil) {
|
public void setCmbPerfil(Combobox cmbPerfil) {
|
||||||
this.cmbPerfil = cmbPerfil;
|
this.cmbPerfil = cmbPerfil;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Paging getPagingUsuario() {
|
public Paging getPagingUsuario() {
|
||||||
return pagingUsuario;
|
return pagingUsuario;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPagingUsuario(Paging pagingUsuario) {
|
public void setPagingUsuario(Paging pagingUsuario) {
|
||||||
this.pagingUsuario = pagingUsuario;
|
this.pagingUsuario = pagingUsuario;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNombMaterno() {
|
||||||
|
return txtNombMaterno;
|
||||||
|
}
|
||||||
|
|
||||||
public Textbox getTxtNombMaterno() {
|
public void setTxtNombMaterno(Textbox txtNombMaterno) {
|
||||||
return txtNombMaterno;
|
this.txtNombMaterno = txtNombMaterno;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTxtNombMaterno(Textbox txtNombMaterno) {
|
public Textbox getTxtNombPaterno() {
|
||||||
this.txtNombMaterno = txtNombMaterno;
|
return txtNombPaterno;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Textbox getTxtNombPaterno() {
|
public void setTxtNombPaterno(Textbox txtNombPaterno) {
|
||||||
return txtNombPaterno;
|
this.txtNombPaterno = txtNombPaterno;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTxtNombPaterno(Textbox txtNombPaterno) {
|
public Textbox getTxtNombUsuario() {
|
||||||
this.txtNombPaterno = txtNombPaterno;
|
return txtNombUsuario;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Textbox getTxtNombUsuario() {
|
public void setTxtNombUsuario(Textbox txtNombUsuario) {
|
||||||
return txtNombUsuario;
|
this.txtNombUsuario = txtNombUsuario;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTxtNombUsuario(Textbox txtNombUsuario) {
|
public MyListbox getUsuarioList() {
|
||||||
this.txtNombUsuario = txtNombUsuario;
|
return usuarioList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MyListbox getUsuarioList() {
|
public void setUsuarioList(MyListbox usuarioList) {
|
||||||
return usuarioList;
|
this.usuarioList = usuarioList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsuarioList(MyListbox usuarioList) {
|
public Textbox getTxtCveEmpleado() {
|
||||||
this.usuarioList = usuarioList;
|
return txtCveEmpleado;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Textbox getTxtCveEmpleado() {
|
public void setTxtCveEmpleado(Textbox txtCveEmpleado) {
|
||||||
return txtCveEmpleado;
|
this.txtCveEmpleado = txtCveEmpleado;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTxtCveEmpleado(Textbox txtCveEmpleado) {
|
@Override
|
||||||
this.txtCveEmpleado = txtCveEmpleado;
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
}
|
lsPerfil = perfilService.obtenerTodos();
|
||||||
|
|
||||||
@Override
|
lsEmpresas = UsuarioLogado.getUsuarioLogado().getEmpresa();
|
||||||
public void doAfterCompose(Component comp) throws Exception {
|
|
||||||
lsPerfil = perfilService.obtenerTodos();
|
|
||||||
|
|
||||||
lsEmpresas = UsuarioLogado.getUsuarioLogado().getEmpresa();
|
|
||||||
setLsPuntoVenta(new ArrayList<PuntoVenta>());
|
setLsPuntoVenta(new ArrayList<PuntoVenta>());
|
||||||
|
|
||||||
super.doAfterCompose(comp);
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
usuarioList.setItemRenderer(new RenderUsuario());
|
usuarioList.setItemRenderer(new RenderUsuario());
|
||||||
usuarioList.addEventListener("onDoubleClick", new EventListener() {
|
usuarioList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
Usuario s = (Usuario) usuarioList.getSelected();
|
Usuario s = (Usuario) usuarioList.getSelected();
|
||||||
verUsuario(s);
|
verUsuario(s);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
refreshLista();
|
refreshLista();
|
||||||
|
|
||||||
txtCveEmpleado.focus();
|
txtCveEmpleado.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verUsuario(Usuario u) {
|
private void verUsuario(Usuario u) {
|
||||||
if (u == null) {
|
if (u == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map args = new HashMap();
|
Map args = new HashMap();
|
||||||
args.put("usuario", u);
|
args.put("usuario", u);
|
||||||
args.put("usuarioList", usuarioList);
|
args.put("usuarioList", usuarioList);
|
||||||
args.put("usrAdmin", Boolean.TRUE);
|
args.put("usrAdmin", Boolean.TRUE);
|
||||||
|
|
||||||
openWindow("/gui/seguridad/editarUsuario.zul",
|
openWindow("/gui/seguridad/editarUsuario.zul",
|
||||||
Labels.getLabel("editarUsuarioController.window.title"), args, MODAL);
|
Labels.getLabel("editarUsuarioController.window.title"), args, MODAL);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("static-access")
|
@SuppressWarnings("static-access")
|
||||||
private void refreshLista() {
|
private void refreshLista() {
|
||||||
HibernateSearchObject<Usuario> sistemaBusqueda =
|
HibernateSearchObject<Usuario> sistemaBusqueda =
|
||||||
new HibernateSearchObject<Usuario>(Usuario.class,
|
new HibernateSearchObject<Usuario>(Usuario.class,
|
||||||
pagingUsuario.getPageSize());
|
pagingUsuario.getPageSize());
|
||||||
|
|
||||||
String nombUsuario = txtNombUsuario.getText();
|
String nombUsuario = txtNombUsuario.getText();
|
||||||
if (!nombUsuario.equals("")) {
|
if (!nombUsuario.equals("")) {
|
||||||
sistemaBusqueda.addFilterLike("nombusuario", "%" + nombUsuario.trim().concat("%"));
|
sistemaBusqueda.addFilterILike("nombusuario", "%" + nombUsuario.trim().concat("%"));
|
||||||
}
|
}
|
||||||
|
|
||||||
String nombPaterno = txtNombPaterno.getText();
|
String nombPaterno = txtNombPaterno.getText();
|
||||||
if (!nombPaterno.equals("")) {
|
if (!nombPaterno.equals("")) {
|
||||||
sistemaBusqueda.addFilterLike("nombpaterno", "%" + nombPaterno.trim().concat("%"));
|
sistemaBusqueda.addFilterILike("nombpaterno", "%" + nombPaterno.trim().concat("%"));
|
||||||
}
|
}
|
||||||
|
|
||||||
String nombMaterno = txtNombMaterno.getText();
|
String nombMaterno = txtNombMaterno.getText();
|
||||||
if (!nombMaterno.equals("")) {
|
if (!nombMaterno.equals("")) {
|
||||||
sistemaBusqueda.addFilterLike("nombmaterno", "%" + nombMaterno.trim().concat("%"));
|
sistemaBusqueda.addFilterILike("nombmaterno", "%" + nombMaterno.trim().concat("%"));
|
||||||
}
|
}
|
||||||
|
|
||||||
String cveUsuario = txtCveUsuario.getText();
|
String cveUsuario = txtCveUsuario.getText();
|
||||||
if (cveUsuario != null) {
|
if (cveUsuario != null) {
|
||||||
sistemaBusqueda.addFilterLike("claveUsuario", "%" + cveUsuario.trim().concat("%"));
|
sistemaBusqueda.addFilterLike("claveUsuario", "%" + cveUsuario.trim().concat("%"));
|
||||||
}
|
}
|
||||||
|
|
||||||
String cveEmpleado = txtCveEmpleado.getText();
|
String cveEmpleado = txtCveEmpleado.getText();
|
||||||
if (!cveEmpleado.equals("")) {
|
if (!cveEmpleado.equals("")) {
|
||||||
sistemaBusqueda.addFilterEqual("empleado.cveEmpleado", cveEmpleado.trim());
|
sistemaBusqueda.addFilterEqual("empleado.cveEmpleado", cveEmpleado.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
Comboitem comboItem = cmbPerfil.getSelectedItem();
|
Comboitem comboItem = cmbPerfil.getSelectedItem();
|
||||||
if (comboItem != null) {
|
if (comboItem != null) {
|
||||||
Perfil perfil = (Perfil) comboItem.getValue();
|
Perfil perfil = (Perfil) comboItem.getValue();
|
||||||
|
|
||||||
sistemaBusqueda.addFilterSome("usuarioPerfilList",
|
sistemaBusqueda.addFilterSome("usuarioPerfilList",
|
||||||
Filter.and(Filter.equal("perfil", perfil),
|
Filter.and(Filter.equal("perfil", perfil),
|
||||||
Filter.equal("activo", true)));
|
Filter.equal("activo", true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Empresa> lsEmpresaTmp =null;
|
List<Empresa> lsEmpresaTmp = null;
|
||||||
|
|
||||||
Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
|
Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
|
||||||
if (itemEmpresa != null) {
|
if (itemEmpresa != null) {
|
||||||
Empresa empresa = (Empresa) itemEmpresa.getValue();
|
Empresa empresa = (Empresa) itemEmpresa.getValue();
|
||||||
lsEmpresaTmp = new ArrayList<Empresa>();
|
lsEmpresaTmp = new ArrayList<Empresa>();
|
||||||
lsEmpresaTmp.add(empresa);
|
lsEmpresaTmp.add(empresa);
|
||||||
}else{
|
} else {
|
||||||
lsEmpresaTmp = lsEmpresas;
|
lsEmpresaTmp = lsEmpresas;
|
||||||
}
|
}
|
||||||
|
|
||||||
sistemaBusqueda.addFilter(Filter.and(Filter.or(
|
sistemaBusqueda.addFilter(Filter.and(Filter.or(
|
||||||
Filter.some("usuarioEmpresaList",
|
Filter.some("usuarioEmpresaList",
|
||||||
Filter.and(Filter.in("empresa", lsEmpresaTmp),
|
Filter.and(Filter.in("empresa", lsEmpresaTmp),
|
||||||
Filter.equal("activo", true))),
|
Filter.equal("activo", true))),
|
||||||
Filter.not(Filter.some("usuarioEmpresaList", Filter.equal("activo", true))))));
|
Filter.not(Filter.some("usuarioEmpresaList", Filter.equal("activo", true))))));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Comboitem puntoVentaSeleccionada = cmbPuntoVenta.getSelectedItem();
|
Comboitem puntoVentaSeleccionada = cmbPuntoVenta.getSelectedItem();
|
||||||
|
|
||||||
if(puntoVentaSeleccionada != null){
|
if (puntoVentaSeleccionada != null) {
|
||||||
PuntoVenta puntoVenta = (PuntoVenta)puntoVentaSeleccionada.getValue();
|
PuntoVenta puntoVenta = (PuntoVenta) puntoVentaSeleccionada.getValue();
|
||||||
sistemaBusqueda.addFilterSome("usuarioUbicacionList",
|
sistemaBusqueda.addFilterSome("usuarioUbicacionList",
|
||||||
Filter.and(Filter.equal("puntoVenta", puntoVenta),
|
Filter.and(Filter.equal("puntoVenta", puntoVenta),
|
||||||
Filter.equal("activo", Boolean.TRUE)));
|
Filter.equal("activo", Boolean.TRUE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
sistemaBusqueda.addSortAsc("claveUsuario");
|
sistemaBusqueda.addSortAsc("claveUsuario");
|
||||||
sistemaBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
sistemaBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
|
||||||
plwFormaPago.init(sistemaBusqueda, usuarioList, pagingUsuario);
|
plwFormaPago.init(sistemaBusqueda, usuarioList, pagingUsuario);
|
||||||
|
|
||||||
if (usuarioList.getData().length == 0) {
|
if (usuarioList.getData().length == 0) {
|
||||||
try {
|
try {
|
||||||
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
Labels.getLabel("busquedaUsuarioController.window.title"),
|
Labels.getLabel("busquedaUsuarioController.window.title"),
|
||||||
Messagebox.OK, Messagebox.INFORMATION);
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick$btnPesquisa(Event ev) {
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
refreshLista();
|
refreshLista();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick$btnRefresh(Event ev) {
|
public void onClick$btnRefresh(Event ev) {
|
||||||
refreshLista();
|
refreshLista();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick$btnNovo(Event ev) {
|
public void onClick$btnNovo(Event ev) {
|
||||||
verUsuario(new Usuario());
|
verUsuario(new Usuario());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PuntoVenta> getLsPuntoVenta() {
|
public List<PuntoVenta> getLsPuntoVenta() {
|
||||||
return lsPuntoVenta;
|
return lsPuntoVenta;
|
||||||
|
|
Loading…
Reference in New Issue