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")
|
||||
public class BusquedaUsuarioController extends MyGenericForwardComposer {
|
||||
|
||||
@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 static final long serialVersionUID = 1L;
|
||||
|
||||
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<PuntoVenta> lsPuntoVenta;
|
||||
private MyComboboxPuntoVenta cmbPuntoVenta;
|
||||
|
||||
public Textbox getTxtCveUsuario() {
|
||||
return txtCveUsuario;
|
||||
}
|
||||
public Textbox getTxtCveUsuario() {
|
||||
return txtCveUsuario;
|
||||
}
|
||||
|
||||
public void setTxtCveUsuario(Textbox txtCveUsuario) {
|
||||
this.txtCveUsuario = txtCveUsuario;
|
||||
}
|
||||
public void setTxtCveUsuario(Textbox txtCveUsuario) {
|
||||
this.txtCveUsuario = txtCveUsuario;
|
||||
}
|
||||
|
||||
public List<Perfil> getLsPerfil() {
|
||||
return lsPerfil;
|
||||
}
|
||||
public List<Perfil> getLsPerfil() {
|
||||
return lsPerfil;
|
||||
}
|
||||
|
||||
public void setLsPerfil(List<Perfil> lsPerfil) {
|
||||
this.lsPerfil = lsPerfil;
|
||||
}
|
||||
public void setLsPerfil(List<Perfil> lsPerfil) {
|
||||
this.lsPerfil = lsPerfil;
|
||||
}
|
||||
|
||||
public Combobox getCmbPerfil() {
|
||||
return cmbPerfil;
|
||||
}
|
||||
public Combobox getCmbPerfil() {
|
||||
return cmbPerfil;
|
||||
}
|
||||
|
||||
public void setCmbPerfil(Combobox cmbPerfil) {
|
||||
this.cmbPerfil = cmbPerfil;
|
||||
}
|
||||
public void setCmbPerfil(Combobox cmbPerfil) {
|
||||
this.cmbPerfil = cmbPerfil;
|
||||
}
|
||||
|
||||
public Paging getPagingUsuario() {
|
||||
return pagingUsuario;
|
||||
}
|
||||
public Paging getPagingUsuario() {
|
||||
return pagingUsuario;
|
||||
}
|
||||
|
||||
public void setPagingUsuario(Paging pagingUsuario) {
|
||||
this.pagingUsuario = pagingUsuario;
|
||||
}
|
||||
public void setPagingUsuario(Paging pagingUsuario) {
|
||||
this.pagingUsuario = pagingUsuario;
|
||||
}
|
||||
|
||||
public Textbox getTxtNombMaterno() {
|
||||
return txtNombMaterno;
|
||||
}
|
||||
|
||||
public Textbox getTxtNombMaterno() {
|
||||
return txtNombMaterno;
|
||||
}
|
||||
public void setTxtNombMaterno(Textbox txtNombMaterno) {
|
||||
this.txtNombMaterno = txtNombMaterno;
|
||||
}
|
||||
|
||||
public void setTxtNombMaterno(Textbox txtNombMaterno) {
|
||||
this.txtNombMaterno = txtNombMaterno;
|
||||
}
|
||||
public Textbox getTxtNombPaterno() {
|
||||
return txtNombPaterno;
|
||||
}
|
||||
|
||||
public Textbox getTxtNombPaterno() {
|
||||
return txtNombPaterno;
|
||||
}
|
||||
public void setTxtNombPaterno(Textbox txtNombPaterno) {
|
||||
this.txtNombPaterno = txtNombPaterno;
|
||||
}
|
||||
|
||||
public void setTxtNombPaterno(Textbox txtNombPaterno) {
|
||||
this.txtNombPaterno = txtNombPaterno;
|
||||
}
|
||||
public Textbox getTxtNombUsuario() {
|
||||
return txtNombUsuario;
|
||||
}
|
||||
|
||||
public Textbox getTxtNombUsuario() {
|
||||
return txtNombUsuario;
|
||||
}
|
||||
public void setTxtNombUsuario(Textbox txtNombUsuario) {
|
||||
this.txtNombUsuario = txtNombUsuario;
|
||||
}
|
||||
|
||||
public void setTxtNombUsuario(Textbox txtNombUsuario) {
|
||||
this.txtNombUsuario = txtNombUsuario;
|
||||
}
|
||||
public MyListbox getUsuarioList() {
|
||||
return usuarioList;
|
||||
}
|
||||
|
||||
public MyListbox getUsuarioList() {
|
||||
return usuarioList;
|
||||
}
|
||||
public void setUsuarioList(MyListbox usuarioList) {
|
||||
this.usuarioList = usuarioList;
|
||||
}
|
||||
|
||||
public void setUsuarioList(MyListbox usuarioList) {
|
||||
this.usuarioList = usuarioList;
|
||||
}
|
||||
public Textbox getTxtCveEmpleado() {
|
||||
return txtCveEmpleado;
|
||||
}
|
||||
|
||||
public Textbox getTxtCveEmpleado() {
|
||||
return txtCveEmpleado;
|
||||
}
|
||||
public void setTxtCveEmpleado(Textbox txtCveEmpleado) {
|
||||
this.txtCveEmpleado = txtCveEmpleado;
|
||||
}
|
||||
|
||||
public void setTxtCveEmpleado(Textbox txtCveEmpleado) {
|
||||
this.txtCveEmpleado = txtCveEmpleado;
|
||||
}
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
lsPerfil = perfilService.obtenerTodos();
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
lsPerfil = perfilService.obtenerTodos();
|
||||
|
||||
lsEmpresas = UsuarioLogado.getUsuarioLogado().getEmpresa();
|
||||
lsEmpresas = UsuarioLogado.getUsuarioLogado().getEmpresa();
|
||||
setLsPuntoVenta(new ArrayList<PuntoVenta>());
|
||||
|
||||
super.doAfterCompose(comp);
|
||||
super.doAfterCompose(comp);
|
||||
|
||||
usuarioList.setItemRenderer(new RenderUsuario());
|
||||
usuarioList.addEventListener("onDoubleClick", new EventListener() {
|
||||
usuarioList.setItemRenderer(new RenderUsuario());
|
||||
usuarioList.addEventListener("onDoubleClick", new EventListener() {
|
||||
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
Usuario s = (Usuario) usuarioList.getSelected();
|
||||
verUsuario(s);
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
Usuario s = (Usuario) usuarioList.getSelected();
|
||||
verUsuario(s);
|
||||
}
|
||||
});
|
||||
|
||||
refreshLista();
|
||||
refreshLista();
|
||||
|
||||
txtCveEmpleado.focus();
|
||||
}
|
||||
txtCveEmpleado.focus();
|
||||
}
|
||||
|
||||
private void verUsuario(Usuario u) {
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
private void verUsuario(Usuario u) {
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Map args = new HashMap();
|
||||
args.put("usuario", u);
|
||||
args.put("usuarioList", usuarioList);
|
||||
args.put("usrAdmin", Boolean.TRUE);
|
||||
Map args = new HashMap();
|
||||
args.put("usuario", u);
|
||||
args.put("usuarioList", usuarioList);
|
||||
args.put("usrAdmin", Boolean.TRUE);
|
||||
|
||||
openWindow("/gui/seguridad/editarUsuario.zul",
|
||||
Labels.getLabel("editarUsuarioController.window.title"), args, MODAL);
|
||||
openWindow("/gui/seguridad/editarUsuario.zul",
|
||||
Labels.getLabel("editarUsuarioController.window.title"), args, MODAL);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
private void refreshLista() {
|
||||
HibernateSearchObject<Usuario> sistemaBusqueda =
|
||||
new HibernateSearchObject<Usuario>(Usuario.class,
|
||||
pagingUsuario.getPageSize());
|
||||
HibernateSearchObject<Usuario> sistemaBusqueda =
|
||||
new HibernateSearchObject<Usuario>(Usuario.class,
|
||||
pagingUsuario.getPageSize());
|
||||
|
||||
String nombUsuario = txtNombUsuario.getText();
|
||||
if (!nombUsuario.equals("")) {
|
||||
sistemaBusqueda.addFilterLike("nombusuario", "%" + nombUsuario.trim().concat("%"));
|
||||
}
|
||||
String nombUsuario = txtNombUsuario.getText();
|
||||
if (!nombUsuario.equals("")) {
|
||||
sistemaBusqueda.addFilterILike("nombusuario", "%" + nombUsuario.trim().concat("%"));
|
||||
}
|
||||
|
||||
String nombPaterno = txtNombPaterno.getText();
|
||||
if (!nombPaterno.equals("")) {
|
||||
sistemaBusqueda.addFilterLike("nombpaterno", "%" + nombPaterno.trim().concat("%"));
|
||||
}
|
||||
String nombPaterno = txtNombPaterno.getText();
|
||||
if (!nombPaterno.equals("")) {
|
||||
sistemaBusqueda.addFilterILike("nombpaterno", "%" + nombPaterno.trim().concat("%"));
|
||||
}
|
||||
|
||||
String nombMaterno = txtNombMaterno.getText();
|
||||
if (!nombMaterno.equals("")) {
|
||||
sistemaBusqueda.addFilterLike("nombmaterno", "%" + nombMaterno.trim().concat("%"));
|
||||
}
|
||||
String nombMaterno = txtNombMaterno.getText();
|
||||
if (!nombMaterno.equals("")) {
|
||||
sistemaBusqueda.addFilterILike("nombmaterno", "%" + nombMaterno.trim().concat("%"));
|
||||
}
|
||||
|
||||
String cveUsuario = txtCveUsuario.getText();
|
||||
if (cveUsuario != null) {
|
||||
sistemaBusqueda.addFilterLike("claveUsuario", "%" + cveUsuario.trim().concat("%"));
|
||||
}
|
||||
String cveUsuario = txtCveUsuario.getText();
|
||||
if (cveUsuario != null) {
|
||||
sistemaBusqueda.addFilterLike("claveUsuario", "%" + cveUsuario.trim().concat("%"));
|
||||
}
|
||||
|
||||
String cveEmpleado = txtCveEmpleado.getText();
|
||||
if (!cveEmpleado.equals("")) {
|
||||
sistemaBusqueda.addFilterEqual("empleado.cveEmpleado", cveEmpleado.trim());
|
||||
}
|
||||
String cveEmpleado = txtCveEmpleado.getText();
|
||||
if (!cveEmpleado.equals("")) {
|
||||
sistemaBusqueda.addFilterEqual("empleado.cveEmpleado", cveEmpleado.trim());
|
||||
}
|
||||
|
||||
Comboitem comboItem = cmbPerfil.getSelectedItem();
|
||||
if (comboItem != null) {
|
||||
Perfil perfil = (Perfil) comboItem.getValue();
|
||||
Comboitem comboItem = cmbPerfil.getSelectedItem();
|
||||
if (comboItem != null) {
|
||||
Perfil perfil = (Perfil) comboItem.getValue();
|
||||
|
||||
sistemaBusqueda.addFilterSome("usuarioPerfilList",
|
||||
Filter.and(Filter.equal("perfil", perfil),
|
||||
Filter.equal("activo", true)));
|
||||
}
|
||||
sistemaBusqueda.addFilterSome("usuarioPerfilList",
|
||||
Filter.and(Filter.equal("perfil", perfil),
|
||||
Filter.equal("activo", true)));
|
||||
}
|
||||
|
||||
List<Empresa> lsEmpresaTmp =null;
|
||||
List<Empresa> lsEmpresaTmp = null;
|
||||
|
||||
Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
|
||||
Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
|
||||
if (itemEmpresa != null) {
|
||||
Empresa empresa = (Empresa) itemEmpresa.getValue();
|
||||
lsEmpresaTmp = new ArrayList<Empresa>();
|
||||
lsEmpresaTmp.add(empresa);
|
||||
}else{
|
||||
} else {
|
||||
lsEmpresaTmp = lsEmpresas;
|
||||
}
|
||||
|
||||
sistemaBusqueda.addFilter(Filter.and(Filter.or(
|
||||
Filter.some("usuarioEmpresaList",
|
||||
Filter.and(Filter.in("empresa", lsEmpresaTmp),
|
||||
Filter.equal("activo", true))),
|
||||
Filter.not(Filter.some("usuarioEmpresaList", Filter.equal("activo", true))))));
|
||||
|
||||
|
||||
Filter.some("usuarioEmpresaList",
|
||||
Filter.and(Filter.in("empresa", lsEmpresaTmp),
|
||||
Filter.equal("activo", true))),
|
||||
Filter.not(Filter.some("usuarioEmpresaList", Filter.equal("activo", true))))));
|
||||
|
||||
Comboitem puntoVentaSeleccionada = cmbPuntoVenta.getSelectedItem();
|
||||
|
||||
if(puntoVentaSeleccionada != null){
|
||||
PuntoVenta puntoVenta = (PuntoVenta)puntoVentaSeleccionada.getValue();
|
||||
if (puntoVentaSeleccionada != null) {
|
||||
PuntoVenta puntoVenta = (PuntoVenta) puntoVentaSeleccionada.getValue();
|
||||
sistemaBusqueda.addFilterSome("usuarioUbicacionList",
|
||||
Filter.and(Filter.equal("puntoVenta", puntoVenta),
|
||||
Filter.equal("activo", Boolean.TRUE)));
|
||||
Filter.and(Filter.equal("puntoVenta", puntoVenta),
|
||||
Filter.equal("activo", Boolean.TRUE)));
|
||||
}
|
||||
|
||||
sistemaBusqueda.addSortAsc("claveUsuario");
|
||||
sistemaBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||
sistemaBusqueda.addSortAsc("claveUsuario");
|
||||
sistemaBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||
|
||||
plwFormaPago.init(sistemaBusqueda, usuarioList, pagingUsuario);
|
||||
plwFormaPago.init(sistemaBusqueda, usuarioList, pagingUsuario);
|
||||
|
||||
if (usuarioList.getData().length == 0) {
|
||||
try {
|
||||
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||
Labels.getLabel("busquedaUsuarioController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (usuarioList.getData().length == 0) {
|
||||
try {
|
||||
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||
Labels.getLabel("busquedaUsuarioController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onClick$btnPesquisa(Event ev) {
|
||||
refreshLista();
|
||||
}
|
||||
public void onClick$btnPesquisa(Event ev) {
|
||||
refreshLista();
|
||||
}
|
||||
|
||||
public void onClick$btnRefresh(Event ev) {
|
||||
refreshLista();
|
||||
}
|
||||
public void onClick$btnRefresh(Event ev) {
|
||||
refreshLista();
|
||||
}
|
||||
|
||||
public void onClick$btnNovo(Event ev) {
|
||||
verUsuario(new Usuario());
|
||||
}
|
||||
public void onClick$btnNovo(Event ev) {
|
||||
verUsuario(new Usuario());
|
||||
}
|
||||
|
||||
public List<PuntoVenta> getLsPuntoVenta() {
|
||||
return lsPuntoVenta;
|
||||
|
|
Loading…
Reference in New Issue