fixes bug #7288
fixes bug #7287 git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@54283 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
134cf97d5e
commit
3529bc704e
|
@ -6,6 +6,7 @@ import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.sql.Connection;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -26,6 +27,7 @@ import org.zkoss.zul.Filedownload;
|
||||||
|
|
||||||
import com.rjconsultores.integracaoreceitadespesa.Arquivo;
|
import com.rjconsultores.integracaoreceitadespesa.Arquivo;
|
||||||
import com.rjconsultores.integracaoreceitadespesa.dao.Totalbus;
|
import com.rjconsultores.integracaoreceitadespesa.dao.Totalbus;
|
||||||
|
import com.rjconsultores.integracaoreceitadespesa.entidades.DespesaReceita;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEmpresa;
|
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEmpresa;
|
||||||
|
@ -73,11 +75,15 @@ public class RelatorioArquivoBGMController extends MyGenericForwardComposer {
|
||||||
// seta dia e mês finais para limite da iteração
|
// seta dia e mês finais para limite da iteração
|
||||||
int diaFinal = calFinal.get(Calendar.DAY_OF_MONTH);
|
int diaFinal = calFinal.get(Calendar.DAY_OF_MONTH);
|
||||||
int mesFinal = calFinal.get(Calendar.MONTH);
|
int mesFinal = calFinal.get(Calendar.MONTH);
|
||||||
|
Connection con = null;
|
||||||
|
try{
|
||||||
|
con = dataSource.getConnection();
|
||||||
|
|
||||||
while (cal.get(Calendar.DAY_OF_MONTH) <= diaFinal && cal.get(Calendar.MONTH) <= mesFinal) {
|
while (cal.get(Calendar.DAY_OF_MONTH) <= diaFinal && cal.get(Calendar.MONTH) <= mesFinal) {
|
||||||
String fileName = System.getProperty("jboss.server.log.dir") + "/BGM-" + cal.get(Calendar.YEAR) + "" + (cal.get(Calendar.MONTH) + 1) + "" + cal.get(Calendar.DAY_OF_MONTH) + ".txt";
|
String fileName = System.getProperty("jboss.server.log.dir") + "/BGM-" + cal.get(Calendar.YEAR) + "" + DespesaReceita.lpad(Integer.toString(cal.get(Calendar.MONTH) + 1), "0", 2) + "" + DespesaReceita.lpad(Integer.toString(cal.get(Calendar.DAY_OF_MONTH)), "0", 2) + ".txt";
|
||||||
File file = new File(fileName);
|
File file = new File(fileName);
|
||||||
|
|
||||||
Totalbus totalbus = new Totalbus(dataSource.getConnection());
|
Totalbus totalbus = new Totalbus(con);
|
||||||
|
|
||||||
log.debug("gerando arquivo...");
|
log.debug("gerando arquivo...");
|
||||||
Arquivo.GravaArquivo(file.getAbsolutePath(), totalbus.getDespesasReceitas(
|
Arquivo.GravaArquivo(file.getAbsolutePath(), totalbus.getDespesasReceitas(
|
||||||
|
@ -103,6 +109,10 @@ public class RelatorioArquivoBGMController extends MyGenericForwardComposer {
|
||||||
Filedownload.save(inputStream, new MimetypesFileTypeMap().getContentType(filez), filez.getName());
|
Filedownload.save(inputStream, new MimetypesFileTypeMap().getContentType(filez), filez.getName());
|
||||||
}
|
}
|
||||||
filez.delete();
|
filez.delete();
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
con.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void compactarArquivo(String arqSaida,String arqEntrada) throws IOException{
|
public static void compactarArquivo(String arqSaida,String arqEntrada) throws IOException{
|
||||||
|
|
Loading…
Reference in New Issue