fixes bug 7755
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@58243 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
573057bfb3
commit
beb994cb9f
|
@ -0,0 +1,185 @@
|
|||
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
import javax.activation.MimetypesFileTypeMap;
|
||||
import javax.sql.DataSource;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import javax.xml.bind.PropertyException;
|
||||
|
||||
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.Combobox;
|
||||
import org.zkoss.zul.Datebox;
|
||||
import org.zkoss.zul.Filedownload;
|
||||
|
||||
import com.rjconsultores.hstcajservice.ws.BilheteService;
|
||||
import com.rjconsultores.hstcajservice.ws.BilheteServiceService;
|
||||
import com.rjconsultores.hstcajservice.ws.Bilhetes;
|
||||
import com.rjconsultores.hstcajservice.ws.ExportaIntegracaoWS;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.service.ConstanteService;
|
||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||
|
||||
@Controller("relatorioErrosIntegracaoBGMController")
|
||||
@Scope("prototype")
|
||||
public class RelatorioErrosIntegracaoBGMController extends MyGenericForwardComposer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Datebox dataInicial;
|
||||
private Datebox dataFinal;
|
||||
private MyComboboxEstandar cmbEmpresa;
|
||||
private Combobox cmbPuntoVentaInicial;
|
||||
private Combobox cmbPuntoVentaFinal;
|
||||
private List<Empresa> lsEmpresa;
|
||||
private MyTextbox txtNombrePuntoVentaInicial;
|
||||
|
||||
private BilheteService bilheteService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private EmpresaService empresaService;
|
||||
@Autowired
|
||||
private ConstanteService constanteService;
|
||||
@Autowired
|
||||
private DataSource dataSourceRead;
|
||||
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
lsEmpresa = empresaService.obtenerTodos();
|
||||
super.doAfterCompose(comp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
private void executarRelatorio() throws Exception {
|
||||
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
final Integer COD_EMPRESA_GRUPO = 1;
|
||||
|
||||
dataInicial.getValue();
|
||||
dataFinal.getValue();
|
||||
cmbEmpresa.getValue();
|
||||
cmbPuntoVentaInicial.getValue();
|
||||
cmbPuntoVentaFinal.getValue();
|
||||
|
||||
String dataInicio= format.format(dataInicial.getValue());
|
||||
String dataFim = format.format(dataFinal.getValue());
|
||||
String puntoVentaInicial = ((PuntoVenta)cmbPuntoVentaInicial.getSelectedItem().getValue()).getNumPuntoVenta();
|
||||
String puntoVentaFinal= ((PuntoVenta)cmbPuntoVentaFinal.getSelectedItem().getValue()).getNumPuntoVenta();
|
||||
String empresa= ((Empresa)cmbEmpresa.getSelectedItem().getValue()).getEmpresaId().toString();
|
||||
|
||||
BilheteServiceService b = new BilheteServiceService();
|
||||
bilheteService = b.getBilheteServicePort();
|
||||
Bilhetes bilhetesInconsistentes = new Bilhetes();
|
||||
List<ExportaIntegracaoWS> bilhesteInconsistentesWebService = bilheteService.buscarBilhetesInconsistente(dataInicio, dataFim,
|
||||
puntoVentaInicial, puntoVentaFinal, COD_EMPRESA_GRUPO, empresa, "");
|
||||
if(bilhesteInconsistentesWebService != null && bilhesteInconsistentesWebService.get(bilhesteInconsistentesWebService.size()-1).getRegistros() > 0){
|
||||
bilhetesInconsistentes.setBilhetes(bilhesteInconsistentesWebService);
|
||||
String fileName = gerarArquivoXML(bilhetesInconsistentes);
|
||||
baixarArquivo(fileName);
|
||||
}else{
|
||||
try {
|
||||
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||
Labels.getLabel("relatorioErrosIntegracaoBGMController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
} catch (InterruptedException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void baixarArquivo(String fileName) throws FileNotFoundException {
|
||||
FileInputStream inputStream;
|
||||
File filez = new File(fileName);
|
||||
if (filez.exists()) {
|
||||
inputStream = new FileInputStream(filez);
|
||||
Filedownload.save(inputStream, new MimetypesFileTypeMap().getContentType(filez), filez.getName());
|
||||
}
|
||||
filez.delete();
|
||||
}
|
||||
|
||||
private String gerarArquivoXML(Bilhetes bilhetesInconsistentes) throws JAXBException, PropertyException {
|
||||
JAXBContext jaxbContext = JAXBContext.newInstance(Bilhetes.class);
|
||||
String BILHETES_INCONSISTENTES = "Bilhetes Inconsistentes.xml";
|
||||
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
|
||||
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
|
||||
String diretorio = System.getProperty("jboss.server.log.dir");
|
||||
String fileName = diretorio + File.separator + " " + BILHETES_INCONSISTENTES;
|
||||
jaxbMarshaller.marshal(bilhetesInconsistentes, new File(fileName));
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void onClick$btnExecutarRelatorio(Event ev) throws Exception{
|
||||
executarRelatorio();
|
||||
}
|
||||
|
||||
private void executarPesquisa() {
|
||||
|
||||
}
|
||||
|
||||
public void onClick$btnPesquisa(Event ev) {
|
||||
executarPesquisa();
|
||||
}
|
||||
|
||||
public List<Empresa> getLsEmpresa() {
|
||||
return lsEmpresa;
|
||||
}
|
||||
|
||||
public void setLsEmpresa(List<Empresa> lsEmpresa) {
|
||||
this.lsEmpresa = lsEmpresa;
|
||||
}
|
||||
|
||||
public MyComboboxEstandar getCmbEmpresa() {
|
||||
return cmbEmpresa;
|
||||
}
|
||||
|
||||
public void setCmbEmpresa(MyComboboxEstandar cmbEmpresa) {
|
||||
this.cmbEmpresa = cmbEmpresa;
|
||||
}
|
||||
|
||||
public Combobox getCmbPuntoVentaInicial() {
|
||||
return cmbPuntoVentaInicial;
|
||||
}
|
||||
|
||||
public void setCmbPuntoVentaInicial(Combobox cmbPuntoVentaInicial) {
|
||||
this.cmbPuntoVentaInicial = cmbPuntoVentaInicial;
|
||||
}
|
||||
|
||||
public Combobox getCmbPuntoVentaFinal() {
|
||||
return cmbPuntoVentaFinal;
|
||||
}
|
||||
|
||||
public void setCmbPuntoVentaFinal(Combobox cmbPuntoVentaFinal) {
|
||||
this.cmbPuntoVentaFinal = cmbPuntoVentaFinal;
|
||||
}
|
||||
|
||||
public MyTextbox getTxtNombrePuntoVentaInicial() {
|
||||
return txtNombrePuntoVentaInicial;
|
||||
}
|
||||
|
||||
public void setTxtNombrePuntoVentaInicial(MyTextbox txtNombrePuntoVentaInicial) {
|
||||
this.txtNombrePuntoVentaInicial = txtNombrePuntoVentaInicial;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios;
|
||||
|
||||
import org.zkoss.util.resource.Labels;
|
||||
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.PantallaUtileria;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.menu.DefaultItemMenuSistema;
|
||||
|
||||
public class ItemMenuRelatorioErrosIntegracaoBGM extends DefaultItemMenuSistema {
|
||||
|
||||
public ItemMenuRelatorioErrosIntegracaoBGM() {
|
||||
super("indexController.mniRelatorioErrosIntegracaoBGMController.label");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClaveMenu() {
|
||||
return "COM.RJCONSULTORES.ADMINISTRACION.GUI.ERROS.BGM";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ejecutar() {
|
||||
PantallaUtileria.openWindow("/gui/relatorios/filtroRelatorioErrosIntegracaoBGM.zul",
|
||||
Labels.getLabel("relatorioErrosIntegracaoBGMController.window.title"), getArgs(), desktop);
|
||||
|
||||
}
|
||||
}
|
|
@ -270,6 +270,7 @@ indexController.mniRelatorioObservacaoBilhetes.label = Reporte Observación Pasa
|
|||
indexController.mniRelatorioObservacaoEventosFinanceiros.label = Reporte Observación Eventos Financieros
|
||||
indexController.mniRecebimentoMalote.label = Recebimento Malote
|
||||
indexController.mniRelatorioObservacaoConferenciaMovimento.label = Reporte Observación Conferencia Movimientos
|
||||
indexController.mniRelatorioErrosIntegracaoBGMController.label = Listar Erros BGM
|
||||
|
||||
indexController.mnSubMenuImpressaoFiscal.label=Impresión Fiscal
|
||||
indexController.mnSubMenuRelatorioImpressaoFiscal.label=Importação Fiscal
|
||||
|
@ -6542,3 +6543,14 @@ relatorioConferenciaFormularioFisicoController.lbPuntoVenta.value = Agencia
|
|||
relatorioConferenciaFormularioFisicoController.msg.erro.puntoventa = El Campo Agencia es Obligatório!
|
||||
relatorioConferenciaFormularioFisicoController.msg.erro.empresa = El Campo Empresa es Obligatório
|
||||
|
||||
# Relatorio(XML - Erros ws integração bgm)
|
||||
relatorioErrosIntegracaoBGMController.window.title = Erros ws integração bgm
|
||||
relatorioErrosIntegracaoBGMController.datainicial.value = Data Inicial
|
||||
relatorioErrosIntegracaoBGMController.dataFinal.value = Data Final
|
||||
relatorioErrosIntegracaoBGMController.lbPuntoVentaInicial.value = Agência Inicial
|
||||
relatorioErrosIntegracaoBGMController.lbPuntoVentaFinal.value = Agência Final
|
||||
relatorioErrosIntegracaoBGMController.lbEmpresa.value = Empresa
|
||||
relatorioErrosIntegracaoBGMController.btnPesquisa.label = Buscar
|
||||
relatorioErrosIntegracaoBGMController.btnLimpar.label = Limpar
|
||||
relatorioErrosIntegracaoBGMController.lbNumero.value = Número Agência
|
||||
|
||||
|
|
|
@ -275,6 +275,7 @@ indexController.mniRelatorioObservacaoBilhetes.label = Relatório Observação B
|
|||
indexController.mniRelatorioObservacaoEventosFinanceiros.label = Relatório Observação Eventos Financeiros
|
||||
indexController.mniRecebimentoMalote.label = Recebimento Malote
|
||||
indexController.mniRelatorioObservacaoConferenciaMovimento.label = Relatório Observação Conferência Movimentos
|
||||
indexController.mniRelatorioErrosIntegracaoBGMController.label = Listar Erros BGM
|
||||
|
||||
indexController.mnSubMenuImpressaoFiscal.label=Impressão Fiscal
|
||||
indexController.mnSubMenuRelatorioImpressaoFiscal.label=Importação Fiscal
|
||||
|
@ -6679,3 +6680,17 @@ relatorioReceitaEmbarcadaServicoController.lbCidadeDestino.value = Localidade De
|
|||
relatorioReceitaEmbarcadaServicoController.lbEmpresa.value = Empresa
|
||||
relatorioReceitaEmbarcadaServicoController.lbClase.value = Classe
|
||||
relatorioReceitaEmbarcadaServicoController.lbServico.value = N. Serviço
|
||||
|
||||
# Relatorio(XML - Erros ws integração bgm)
|
||||
relatorioErrosIntegracaoBGMController.window.title = Erros ws integração bgm
|
||||
relatorioErrosIntegracaoBGMController.datainicial.value = Data Inicial
|
||||
relatorioErrosIntegracaoBGMController.dataFinal.value = Data Final
|
||||
relatorioErrosIntegracaoBGMController.lbPuntoVentaInicial.value = Agência Inicial
|
||||
relatorioErrosIntegracaoBGMController.lbPuntoVentaFinal.value = Agência Final
|
||||
relatorioErrosIntegracaoBGMController.lbEmpresa.value = Empresa
|
||||
relatorioErrosIntegracaoBGMController.btnPesquisa.label = Buscar
|
||||
relatorioErrosIntegracaoBGMController.btnLimpar.label = Limpar
|
||||
relatorioErrosIntegracaoBGMController.lbNumero.value = Número Agência
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
<?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="winFiltroRelatorioErrosIntegracaoBGM"?>
|
||||
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
|
||||
|
||||
<zk xmlns="http://www.zkoss.org/2005/zul">
|
||||
<window id="winFiltroRelatorioErrosIntegracaoBGM"
|
||||
apply="${relatorioErrosIntegracaoBGMController}" contentStyle="overflow:auto"
|
||||
height="190px" width="550px" border="normal">
|
||||
<grid fixedLayout="true">
|
||||
<columns>
|
||||
<column width="25%" />
|
||||
<column width="30%" />
|
||||
<column width="15%" />
|
||||
<column width="30%" />
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label
|
||||
value="${c:l('relatorioErrosIntegracaoBGMController.datainicial.value')}" />
|
||||
<datebox id="dataInicial" format="dd/MM/yyyy"
|
||||
width="90%" lenient="true" constraint="no empty"
|
||||
maxlength="10" />
|
||||
|
||||
<label
|
||||
value="${c:l('relatorioErrosIntegracaoBGMController.dataFinal.value')}" />
|
||||
<datebox id="dataFinal" format="dd/MM/yyyy"
|
||||
width="90%" lenient="true" constraint="no empty"
|
||||
maxlength="10" />
|
||||
</row>
|
||||
<row spans="1,3">
|
||||
<label value="${c:l('relatorioErrosIntegracaoBGMController.lbEmpresa.value')}" />
|
||||
<combobox id="cmbEmpresa"
|
||||
buttonVisible="true"
|
||||
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
|
||||
model="@{winFiltroRelatorioErrosIntegracaoBGM$composer.lsEmpresa}"
|
||||
width="100%"
|
||||
constraint="no empty"
|
||||
mold="rounded" />
|
||||
</row>
|
||||
<row spans="1,3">
|
||||
<label value="${c:l('relatorioErrosIntegracaoBGMController.lbPuntoVentaInicial.value')}"/>
|
||||
<combobox id="cmbPuntoVentaInicial"
|
||||
buttonVisible="true"
|
||||
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta"
|
||||
width="100%"
|
||||
constraint="no empty"
|
||||
mold="rounded" />
|
||||
</row>
|
||||
<row spans="1,3">
|
||||
<label value="${c:l('relatorioErrosIntegracaoBGMController.lbPuntoVentaFinal.value')}"/>
|
||||
<combobox id="cmbPuntoVentaFinal"
|
||||
buttonVisible="true"
|
||||
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta"
|
||||
width="100%"
|
||||
constraint="no empty"
|
||||
mold="rounded" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<toolbar>
|
||||
<button id="btnExecutarRelatorio" image="/gui/img/find.png"
|
||||
label="${c:l('relatorio.lb.btnExecutarRelatorio')}" />
|
||||
</toolbar>
|
||||
</window>
|
||||
</zk>
|
||||
|
Loading…
Reference in New Issue