fixes bug 7755 - Alteração para deixar URL do Web Service configurada em banco

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@58283 d1611594-4594-4d17-8e1d-87c2c4800839
master
igor.rodrigo 2016-07-26 17:20:37 +00:00
parent 629b448798
commit f054d414da
1 changed files with 26 additions and 6 deletions

View File

@ -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<ExportaIntegracaoWS> bilhesteInconsistentesWebService = bilheteService.buscarBilhetesInconsistente(dataInicio, dataFim,
List<ExportaIntegracaoWS> 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();