bug#14533 -- teste de performance II
dev: julio qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@94404 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
22f626e4de
commit
838eab8810
|
@ -2,7 +2,11 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.bpe;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.io.PrintWriter;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -19,6 +23,7 @@ import org.zkoss.zul.Comboitem;
|
||||||
import org.zkoss.zul.Datebox;
|
import org.zkoss.zul.Datebox;
|
||||||
import org.zkoss.zul.Filedownload;
|
import org.zkoss.zul.Filedownload;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.constantes.Constantes;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Estado;
|
import com.rjconsultores.ventaboletos.entidad.Estado;
|
||||||
import com.rjconsultores.ventaboletos.service.BpeService;
|
import com.rjconsultores.ventaboletos.service.BpeService;
|
||||||
|
@ -77,7 +82,9 @@ public class BusquedaBpeExportacaoController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
if (empresa != null && estado != null) {
|
if (empresa != null && estado != null) {
|
||||||
String nomeArquivo = getNomeArquivoExportacaoECF(datInicial.getValue(), estado, "BPE");
|
String nomeArquivo = getNomeArquivoExportacaoECF(datInicial.getValue(), estado, "BPE");
|
||||||
File arquivo = bpeService.buscarArquivoExportacaoBPE(datInicial.getValue(), datFinal.getValue(), empresa, estado, nomeArquivo);
|
String writerExp = bpeService.buscarArquivoExportacaoBPE(datInicial.getValue(), datFinal.getValue(), empresa, estado, nomeArquivo);
|
||||||
|
|
||||||
|
File arquivo = criarArquivo(writerExp, nomeArquivo);
|
||||||
|
|
||||||
if (arquivo == null) {
|
if (arquivo == null) {
|
||||||
Messagebox.show(
|
Messagebox.show(
|
||||||
|
@ -96,6 +103,25 @@ public class BusquedaBpeExportacaoController extends MyGenericForwardComposer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public File criarArquivo(final String writerExp, final String nomeArquivo) {
|
||||||
|
File file = null;
|
||||||
|
PrintWriter writer = null;
|
||||||
|
try {
|
||||||
|
file = File.createTempFile(nomeArquivo + "-", ".fs");
|
||||||
|
writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), Constantes.UTF_8));
|
||||||
|
writer.write(writerExp);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("", e);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
if (writer != null) {
|
||||||
|
writer.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
private String getNomeArquivoExportacaoECF(Date dataInicial, Estado estado, String tipo) {
|
private String getNomeArquivoExportacaoECF(Date dataInicial, Estado estado, String tipo) {
|
||||||
String[] mesano = new SimpleDateFormat("MM/yyyy").format(dataInicial).split("/");
|
String[] mesano = new SimpleDateFormat("MM/yyyy").format(dataInicial).split("/");
|
||||||
|
|
||||||
|
@ -105,19 +131,44 @@ public class BusquedaBpeExportacaoController extends MyGenericForwardComposer {
|
||||||
String nome = "";
|
String nome = "";
|
||||||
|
|
||||||
switch (Integer.valueOf(mes)) {
|
switch (Integer.valueOf(mes)) {
|
||||||
case 1: nome = "Jan"; break;
|
case 1:
|
||||||
case 2: nome = "Fev"; break;
|
nome = "Jan";
|
||||||
case 3: nome = "Mar"; break;
|
break;
|
||||||
case 4: nome = "Abr"; break;
|
case 2:
|
||||||
case 5: nome = "Mai"; break;
|
nome = "Fev";
|
||||||
case 6: nome = "Jun"; break;
|
break;
|
||||||
case 7: nome = "Jul"; break;
|
case 3:
|
||||||
case 8: nome = "Ago"; break;
|
nome = "Mar";
|
||||||
case 9: nome = "Set"; break;
|
break;
|
||||||
case 10: nome = "Out"; break;
|
case 4:
|
||||||
case 11: nome = "Nov"; break;
|
nome = "Abr";
|
||||||
case 12: nome = "Dez"; break;
|
break;
|
||||||
default: break;
|
case 5:
|
||||||
|
nome = "Mai";
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
nome = "Jun";
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
nome = "Jul";
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
nome = "Ago";
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
nome = "Set";
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
nome = "Out";
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
nome = "Nov";
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
nome = "Dez";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
String nomeArquivo = "TotalBus " + estado.getCveestado() + " " + tipo + " " + nome + ano;
|
String nomeArquivo = "TotalBus " + estado.getCveestado() + " " + tipo + " " + nome + ano;
|
||||||
|
|
Loading…
Reference in New Issue