From f054d414dae7cf6d5eec0e1ea1e8c4948a56c18d Mon Sep 17 00:00:00 2001 From: "igor.rodrigo" Date: Tue, 26 Jul 2016 17:20:37 +0000 Subject: [PATCH] =?UTF-8?q?fixes=20bug=207755=20-=20Altera=C3=A7=C3=A3o=20?= =?UTF-8?q?para=20deixar=20URL=20do=20Web=20Service=20configurada=20em=20b?= =?UTF-8?q?anco?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@58283 d1611594-4594-4d17-8e1d-87c2c4800839 --- ...RelatorioErrosIntegracaoBGMController.java | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioErrosIntegracaoBGMController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioErrosIntegracaoBGMController.java index 1fb8a4e8a..c6675993e 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioErrosIntegracaoBGMController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioErrosIntegracaoBGMController.java @@ -3,6 +3,8 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.net.MalformedURLException; +import java.net.URL; import java.text.SimpleDateFormat; import java.util.List; @@ -12,6 +14,7 @@ import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.PropertyException; +import javax.xml.namespace.QName; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; @@ -28,6 +31,7 @@ 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.Constante; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.service.ConstanteService; @@ -88,14 +92,14 @@ public class RelatorioErrosIntegracaoBGMController extends MyGenericForwardCompo 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(); + + configurarWebService(); + Bilhetes bilhetesInconsistentes = new Bilhetes(); - List bilhesteInconsistentesWebService = bilheteService.buscarBilhetesInconsistente(dataInicio, dataFim, + List bilhetesInconsistentesWebService = bilheteService.buscarBilhetesInconsistente(dataInicio, dataFim, puntoVentaInicial, puntoVentaFinal, COD_EMPRESA_GRUPO, empresa, ""); - if(bilhesteInconsistentesWebService != null && bilhesteInconsistentesWebService.get(bilhesteInconsistentesWebService.size()-1).getRegistros() > 0){ - bilhetesInconsistentes.setBilhetes(bilhesteInconsistentesWebService); + if(bilhetesInconsistentesWebService != null && bilhetesInconsistentesWebService.get(bilhetesInconsistentesWebService.size()-1).getRegistros() > 0){ + bilhetesInconsistentes.setBilhetes(bilhetesInconsistentesWebService); String fileName = gerarArquivoXML(bilhetesInconsistentes); baixarArquivo(fileName); }else{ @@ -110,6 +114,14 @@ public class RelatorioErrosIntegracaoBGMController extends MyGenericForwardCompo } + private void configurarWebService() throws MalformedURLException { + URL baseUrl = com.rjconsultores.hstcajservice.ws.BilheteServiceService.class.getResource("."); + URL url = new URL(baseUrl, getUrlWebService()); + BilheteServiceService bilheteServiceService = new BilheteServiceService( + url, new QName("http://ws.hstcajservice.rjconsultores.com/", "BilheteServiceService")); + bilheteService = bilheteServiceService.getBilheteServicePort(); + } + private void baixarArquivo(String fileName) throws FileNotFoundException { FileInputStream inputStream; File filez = new File(fileName); @@ -130,6 +142,14 @@ public class RelatorioErrosIntegracaoBGMController extends MyGenericForwardCompo jaxbMarshaller.marshal(bilhetesInconsistentes, new File(fileName)); return fileName; } + + private String getUrlWebService() { + Constante constante = constanteService.buscarPorNomeConstante("WS_BGM"); + if (constante == null) { + return ""; + } + return constante.getValorconstante(); + } public void onClick$btnExecutarRelatorio(Event ev) throws Exception{ executarRelatorio();