bug#10822
dev:valdevir qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@81074 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
91905e6a72
commit
5430d26b8e
|
@ -0,0 +1,233 @@
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.seguridad;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.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.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Datebox;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.service.IntegracaoTotvsService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEmpresa;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author valdevir.pinheiro
|
||||||
|
*/
|
||||||
|
@Controller("integracaoTotvsController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class IntegracaoTotvsController extends MyGenericForwardComposer {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private static Logger log = Logger.getLogger(IntegracaoTotvsController.class);
|
||||||
|
private List<Empresa> lsEmpresas;
|
||||||
|
private MyComboboxEmpresa cmbEmpresa;
|
||||||
|
private MyComboboxPuntoVenta cmbPuntoVenta;
|
||||||
|
private List<PuntoVenta> lsPuntoVenta;
|
||||||
|
private Datebox fecInicioIntervalo;
|
||||||
|
private Datebox fecFinIntervalo;
|
||||||
|
private Date dataDe;
|
||||||
|
private Date dataAte;
|
||||||
|
private Date dataInicioCorrida;
|
||||||
|
private Date dataFimCorrida;
|
||||||
|
private Date dataFimServico;
|
||||||
|
private String numCorrida;
|
||||||
|
private Textbox txtNumCorrida;
|
||||||
|
private Textbox txtNumServico;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IntegracaoTotvsService integracaoTotvsService;
|
||||||
|
|
||||||
|
public Datebox getFecInicioIntervalo() {
|
||||||
|
return fecInicioIntervalo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecInicioIntervalo(Datebox fecInicioIntervalo) {
|
||||||
|
this.fecInicioIntervalo = fecInicioIntervalo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Datebox getFecFinIntervalo() {
|
||||||
|
return fecFinIntervalo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecFinIntervalo(Datebox fecFinIntervalo) {
|
||||||
|
this.fecFinIntervalo = fecFinIntervalo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataDe() {
|
||||||
|
return dataDe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataDe(Date dataDe) {
|
||||||
|
this.dataDe = dataDe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataAte() {
|
||||||
|
return dataAte;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataAte(Date dataAte) {
|
||||||
|
this.dataAte = dataAte;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
dataDe = new Date();
|
||||||
|
dataAte = new Date();
|
||||||
|
lsEmpresas = UsuarioLogado.getUsuarioLogado().getEmpresa();
|
||||||
|
lsPuntoVenta = new ArrayList<PuntoVenta>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Empresa> getLsEmpresas() {
|
||||||
|
return lsEmpresas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsEmpresas(List<Empresa> lsEmpresas) {
|
||||||
|
this.lsEmpresas = lsEmpresas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyComboboxPuntoVenta getCmbPuntoVenta() {
|
||||||
|
return cmbPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbPuntoVenta(MyComboboxPuntoVenta cmbPuntoVenta) {
|
||||||
|
this.cmbPuntoVenta = cmbPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyComboboxEmpresa getCmbEmpresa() {
|
||||||
|
return cmbEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbEmpresa(MyComboboxEmpresa cmbEmpresa) {
|
||||||
|
this.cmbEmpresa = cmbEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PuntoVenta> getLsPuntoVenta() {
|
||||||
|
return lsPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsPuntoVenta(List<PuntoVenta> lsPuntoVenta) {
|
||||||
|
this.lsPuntoVenta = lsPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSolicitarIntegracao(Event ev) throws Exception {
|
||||||
|
dataDe = fecInicioIntervalo.getValue() != null ? DateUtil.inicioFecha(fecInicioIntervalo.getValue()) : null;
|
||||||
|
dataAte = fecFinIntervalo.getValue() != null ? DateUtil.fimFecha(fecFinIntervalo.getValue()) : null;
|
||||||
|
// Período não pode ser vazio.
|
||||||
|
if (dataDe == null || dataAte == null) {
|
||||||
|
IntegracaoTotvsController.log.info("");
|
||||||
|
org.zkoss.zul.Messagebox.show(
|
||||||
|
Labels.getLabel("integracaoTotvsController.MSG.filtrovazio.value"),
|
||||||
|
Labels.getLabel("integracaoTotvsController.window.title"),
|
||||||
|
org.zkoss.zul.Messagebox.OK, org.zkoss.zul.Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Empresa empresa = cmbEmpresa.getSelectedItem() != null ? (Empresa) cmbEmpresa.getSelectedItem().getValue() : null;
|
||||||
|
PuntoVenta puntoVenta = cmbPuntoVenta.getSelectedItem() != null ? (PuntoVenta) cmbPuntoVenta.getSelectedItem().getValue() : null;
|
||||||
|
if (puntoVenta == null) {
|
||||||
|
Integer opcao = org.zkoss.zul.Messagebox.show(Labels.getLabel("integracaoTotvsController.MSG.filtropuntoventavazio.value"),
|
||||||
|
Labels.getLabel("integracaoTotvsController.window.title"),
|
||||||
|
org.zkoss.zul.Messagebox.YES | org.zkoss.zul.Messagebox.NO, org.zkoss.zul.Messagebox.QUESTION);
|
||||||
|
if (opcao.equals(org.zkoss.zul.Messagebox.NO)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Integer retornoUpdate = null;
|
||||||
|
if (empresa == null) {
|
||||||
|
for (Empresa empresaAux : lsEmpresas) {
|
||||||
|
if (puntoVenta == null) {
|
||||||
|
List<PuntoVenta> lsPuntoVentaAux = integracaoTotvsService.buscaPuntoVentaEmpresa(empresaAux);
|
||||||
|
for (PuntoVenta puntoVentaAux : lsPuntoVentaAux) {
|
||||||
|
retornoUpdate = integracaoTotvsService.atualizaStstausBilhetesIntegrar(empresa, dataDe, dataAte, puntoVentaAux);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
retornoUpdate = integracaoTotvsService.atualizaStstausBilhetesIntegrar(empresa, dataDe, dataAte, puntoVenta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (puntoVenta == null) {
|
||||||
|
List<PuntoVenta> lsPuntoVentaAux = integracaoTotvsService.buscaPuntoVentaEmpresa(empresa);
|
||||||
|
for (PuntoVenta puntoVentaAux : lsPuntoVentaAux) {
|
||||||
|
retornoUpdate = integracaoTotvsService.atualizaStstausBilhetesIntegrar(empresa, dataDe, dataAte, puntoVentaAux);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
retornoUpdate = integracaoTotvsService.atualizaStstausBilhetesIntegrar(empresa, dataDe, dataAte, puntoVenta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (retornoUpdate.intValue() >= 1) {
|
||||||
|
org.zkoss.zul.Messagebox.show(
|
||||||
|
Labels.getLabel("integracaoTotvsController.MSG.retornosucesso.value"),
|
||||||
|
Labels.getLabel("integracaoTotvsController.window.title"),
|
||||||
|
org.zkoss.zul.Messagebox.OK, org.zkoss.zul.Messagebox.INFORMATION);
|
||||||
|
} else {
|
||||||
|
if (retornoUpdate.intValue() == 0) {
|
||||||
|
org.zkoss.zul.Messagebox.show(
|
||||||
|
Labels.getLabel("integracaoTotvsController.MSG.retornovazio.value"),
|
||||||
|
Labels.getLabel("integracaoTotvsController.window.title"),
|
||||||
|
org.zkoss.zul.Messagebox.OK, org.zkoss.zul.Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataInicioCorrida(Date dataInicioCorrida) {
|
||||||
|
this.dataInicioCorrida = dataInicioCorrida;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataFimCorrida() {
|
||||||
|
return dataFimCorrida;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataFimCorrida(Date dataFimCorrida) {
|
||||||
|
this.dataFimCorrida = dataFimCorrida;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNumCorrida() {
|
||||||
|
return numCorrida;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumCorrida(String numCorrida) {
|
||||||
|
this.numCorrida = numCorrida;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNumCorrida() {
|
||||||
|
return txtNumCorrida;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNumCorrida(Textbox txtNumCorrida) {
|
||||||
|
this.txtNumCorrida = txtNumCorrida;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNumServico() {
|
||||||
|
return txtNumServico;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNumServico(Textbox txtNumServico) {
|
||||||
|
this.txtNumServico = txtNumServico;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataInicioCorrida() {
|
||||||
|
return dataInicioCorrida;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataFimServico() {
|
||||||
|
return dataFimServico;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataFimServico(Date dataFimServico) {
|
||||||
|
this.dataFimServico = dataFimServico;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.rjconsultores.ventaboletos.web.utilerias.menu.item.seguridad;
|
||||||
|
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.PantallaUtileria;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.menu.DefaultItemMenuSistema;
|
||||||
|
|
||||||
|
public class ItemMenuIntegracaoTotvs extends DefaultItemMenuSistema {
|
||||||
|
public ItemMenuIntegracaoTotvs() {
|
||||||
|
super("indexController.mniIntegracaoTotvs.label");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getClaveMenu() {
|
||||||
|
return "COM.RJCONSULTORES.ADMINISTRACION.GUI.SEGURIDAD.MENU.INTEGRACAOTOTVS";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void ejecutar() {
|
||||||
|
PantallaUtileria.openWindow("/gui/seguridad/integracaoTotvs.zul",
|
||||||
|
Labels.getLabel("integracaoTotvsController.window.title"), getArgs(), desktop);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -228,6 +228,7 @@ seguridad.usuario=com.rjconsultores.ventaboletos.web.utilerias.menu.item.segurid
|
||||||
seguridad.fiscalImpressora=com.rjconsultores.ventaboletos.web.utilerias.menu.item.seguridad.ItemMenuFiscalImpressora
|
seguridad.fiscalImpressora=com.rjconsultores.ventaboletos.web.utilerias.menu.item.seguridad.ItemMenuFiscalImpressora
|
||||||
seguridad.mensaje=com.rjconsultores.ventaboletos.web.utilerias.menu.item.seguridad.ItemMenuMensaje
|
seguridad.mensaje=com.rjconsultores.ventaboletos.web.utilerias.menu.item.seguridad.ItemMenuMensaje
|
||||||
seguridad.auditoria=com.rjconsultores.ventaboletos.web.utilerias.menu.item.seguridad.ItemMenuAuditoria
|
seguridad.auditoria=com.rjconsultores.ventaboletos.web.utilerias.menu.item.seguridad.ItemMenuAuditoria
|
||||||
|
seguridad.integracaototvs=com.rjconsultores.ventaboletos.web.utilerias.menu.item.seguridad.ItemMenuIntegracaoTotvs
|
||||||
seguridad.painelecf=com.rjconsultores.ventaboletos.web.utilerias.menu.item.seguridad.ItemMenuPainelECF
|
seguridad.painelecf=com.rjconsultores.ventaboletos.web.utilerias.menu.item.seguridad.ItemMenuPainelECF
|
||||||
pasajerofrecuente=com.rjconsultores.ventaboletos.web.utilerias.menu.item.pasajerofrecuente.MenuPasajeroFrecuente
|
pasajerofrecuente=com.rjconsultores.ventaboletos.web.utilerias.menu.item.pasajerofrecuente.MenuPasajeroFrecuente
|
||||||
pasajerofrecuente.cliente=com.rjconsultores.ventaboletos.web.utilerias.menu.item.pasajerofrecuente.ItemMenuCliente
|
pasajerofrecuente.cliente=com.rjconsultores.ventaboletos.web.utilerias.menu.item.pasajerofrecuente.ItemMenuCliente
|
||||||
|
|
Loading…
Reference in New Issue