From c7874595bd91d4ba8a2836a99071d998e4e4759e Mon Sep 17 00:00:00 2001 From: julio Date: Wed, 15 Jun 2016 21:10:01 +0000 Subject: [PATCH] fixes bug #7500 git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@56988 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../relatorios/impl/RelatorioECFReducaoZ.java | 92 ++++++++ .../RelatorioECFReducaoZ_es.properties | 2 + .../RelatorioECFReducaoZ_pt_BR.properties | 2 + .../templates/RelatorioAnaliticoVoucher.jrxml | 2 +- .../templates/RelatorioECFReducaoZ.jasper | Bin 0 -> 35088 bytes .../templates/RelatorioECFReducaoZ.jrxml | 202 ++++++++++++++++++ .../relatorios/utilitarios/ECFReducaoZVO.java | 93 ++++++++ .../relatorios/utilitarios/ItemECFVO.java | 41 ++++ .../BusquedaImportacionFiscalController.java | 49 ++++- 9 files changed, 477 insertions(+), 6 deletions(-) create mode 100644 src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioECFReducaoZ.java create mode 100644 src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioECFReducaoZ_es.properties create mode 100644 src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioECFReducaoZ_pt_BR.properties create mode 100644 src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioECFReducaoZ.jasper create mode 100644 src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioECFReducaoZ.jrxml create mode 100644 src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/ECFReducaoZVO.java create mode 100644 src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/ItemECFVO.java diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioECFReducaoZ.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioECFReducaoZ.java new file mode 100644 index 000000000..ccf367db5 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioECFReducaoZ.java @@ -0,0 +1,92 @@ +package com.rjconsultores.ventaboletos.relatorios.impl; + +import java.math.BigDecimal; +import java.sql.Connection; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.ECFReducaoZVO; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.ItemECFVO; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalReducaoZVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ItemFiscalVO; + +import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; + +public class RelatorioECFReducaoZ extends Relatorio { + + private List lsDadosRelatorio; + + public RelatorioECFReducaoZ(final Map parametros, Connection conexao) throws Exception { + super(parametros, conexao); + + lsDadosRelatorio = new ArrayList(); + + this.setCustomDataSource(new DataSource(this) { + @SuppressWarnings("unchecked") + @Override + public void initDados() throws Exception { + + List ecfInvalidos = (List) parametros.get("ecfInvalidos"); + List redZInvalido = (List) parametros.get("redZInvalido"); + + for (ImportacionFiscalReducaoZVO irz : redZInvalido) { + ECFReducaoZVO zvo = new ECFReducaoZVO("REDUÇÃO Z", irz.getAliquota(), padronizaData(irz.getDatamov()), + irz.getNumserie20(), null, padronizaValor(irz.getVendabrutadiaria())); + lsDadosRelatorio.add(zvo); + } + + for (ImportacionFiscalVO ecf : ecfInvalidos) { + ECFReducaoZVO ecfvo = new ECFReducaoZVO("ECF", null, padronizaData(ecf.getDataEmissao()), ecf.getNumImpressora(), + ecf.getCoo(), UtiliteriasFiscal.arredondar(UtiliteriasFiscal.valorTotalItensECF(ecf))); + + List list = new ArrayList(); + for (ItemFiscalVO ifi : ecf.getItensFiscais()) { + list.add(new ItemECFVO(ifi.getNumItem(), ifi.getCodProduto(), padronizaValor(ifi.getValorItem()))); + } + + ecfvo.setItens(list); + lsDadosRelatorio.add(ecfvo); + } + + setLsDadosRelatorio(lsDadosRelatorio); + + Collections.sort(lsDadosRelatorio, new Comparator() { + @Override + public int compare(ECFReducaoZVO b1, ECFReducaoZVO b2) { + if (b1.getDatamov().equals(b2.getDatamov())) { + return b1.getNumserie20().compareTo(b2.getNumserie20()); + } else { + return b1.getDatamov().compareTo(b2.getDatamov()); + } + } + }); + } + }); + } + + private BigDecimal padronizaValor(BigDecimal valor) { + return valor.divide(UtiliteriasFiscal.CEM); + } + + private String padronizaData(String data) { + return DateUtil.changeFormatStringDate(data, "yyyyMMdd", "dd/MM/yyyy"); + } + + public void setLsDadosRelatorio(List lsDadosRelatorio) { + this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio)); + this.lsDadosRelatorio = lsDadosRelatorio; + } + + @Override + protected void processaParametros() throws Exception { + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioECFReducaoZ_es.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioECFReducaoZ_es.properties new file mode 100644 index 000000000..57daa3700 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioECFReducaoZ_es.properties @@ -0,0 +1,2 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioECFReducaoZ_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioECFReducaoZ_pt_BR.properties new file mode 100644 index 000000000..57daa3700 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioECFReducaoZ_pt_BR.properties @@ -0,0 +1,2 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioAnaliticoVoucher.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioAnaliticoVoucher.jrxml index 4c732cded..f395006e8 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioAnaliticoVoucher.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioAnaliticoVoucher.jrxml @@ -1,7 +1,7 @@ - + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioECFReducaoZ.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioECFReducaoZ.jasper new file mode 100644 index 0000000000000000000000000000000000000000..cd8522b6b086a351116736269546b45b43f339be GIT binary patch literal 35088 zcmeHw33Ob=v36Zaw#M>Uwq;|R#Y8N|wroq@0h`5It+7W7BY8mv5P9T62NLU;K2`1)G2m!)#UV_6GATMMiyaY(Xd4GWSRd?T|XRfXW{{Q49 z=R6%x-+Qb2c2`$dS65e8U+?-Ojmo5HRwA0M&h%EF9?qnq>2x%eOlLFI(ZuFhB3ivl z07C*u;&0~uA}S8j*q&s6Di)76gtOr+O$nYJ-WslnC2KmO=~y@(J2Si~9$g-!i7H!b zxIfx4(Aygu%u*L`}<_tQQiU!j(&x^KA;S2~2)!~v$ zU{!z)Z0~4X)6mx4(HIKU2D{fbhB^Xmt=($^4FU3RN@lak{+4hWjSO&G;sgDO`s6?& z8(>QKsUsEc0cjR?T`ZFA>!Jy<&52|>+8)N6;cP6K=%PunOjA4=&en_fnv%(EG|d?^ z9RvOS;q*{zbQ`iqyQtCvt&3&*7}gvON22N4M8tfnJeKKwo}Lvu$Y<4f4~R!EEZ7Y%*n*R=%w-nrKaO4|Wcv zqCqO#6zMvUFq+ysydh)@X83Bjuuo*`A1?-^NRBHN?`<9wsYGi#%VmF|?#U+8L$-v2<*|M- z-a4Y$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$W9Hi z3XrdAkRTxUXpmMw?$sdefZVS^LV$c-gLDG&fCgC$$Tu~}dO#l1AYFF%od)xl;0CRL z8}vxHL6^b}+6*^n7p;Y>bRAr!>me*B!_U719=Tx{#PlKzp8?MrgMkR%f zg|x|NpdMo_MT|apG0vo3;|kggQGk`Ggy|vW)jSUbJ)#KOy@z)5K$=tWm9ZSuIMfNj+gSl`=aKMKEroNxnKEc<7L6Z3&4Ssc-mg^ zA4tyuY_XLiS@AYtF~BxHO264doNoi3PO+X^@N}B>bRwR5#nbPQbHU^Ehm!&66Ocdd zrauA54&{jT0y~s9sVC)7W?lX*?gVJpBDxap{2gHTwUDbXf#o+~v*;GE{Z_h!?gZv8 zxRSpL_TP=C`_KjV!)^Qky5T|kHU`;KxO*C&(C6UR`w4vyUGgM+r+d*YPs7G|23_+b z`ZGMOe}|{_6WWI^`l&IBUP3qRHzv`m=&IL@!{|+P*IRHDzKt&Xjd48v0p0eF5u!gC zr_!H|jr12|3w;F9`Sbq@QbB_BfhI`mNePmAQi6o196iYK$^M#ss6o zm}IOo4mH*rhZ(0BbB$At8Y65hGd3B=8@)!Gu^G9x02((o8Y$cjLXiIQzk*bdApN5? zl5qh9X*&ezVhGYD5Tq+0NLNCTc0iD>g&=(if^-7}=@tmmtq`O;AxL*YkiH5*x*LLY z9|Y-s2+{)(qz55L4?~b1fgn8wLHZ5^>3a~QCm~3CAxKX{ke-1c{Ro2eJOt?l2+}?X z(oZ2sFF}y@Ly%sDAiV}bdJ}^576j>S2-0sLNPmDJy$?b9E3_!g`Yavb8kCA}hI^f; QvjTTlA&8_$h1aJ48?WUkxc~qF literal 0 HcmV?d00001 diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioECFReducaoZ.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioECFReducaoZ.jrxml new file mode 100644 index 000000000..882514966 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioECFReducaoZ.jrxml @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + <band height="66" splitType="Stretch"> + <textField pattern="dd/MM/yyyy HH:mm"> + <reportElement x="276" y="0" width="279" height="20" uuid="7c609e0b-e3d8-4bde-b3f3-2e245b88e566"/> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> + </textField> + <staticText> + <reportElement x="0" y="0" width="276" height="20" uuid="5cf84d9b-ccd2-43b7-b52f-8340c8d9a718"/> + <textElement verticalAlignment="Middle"> + <font size="14" isBold="true"/> + </textElement> + <text><![CDATA[ANALITICO DE PENDENCIAS]]></text> + </staticText> + <textField pattern="dd/MM/yyyy"> + <reportElement x="186" y="20" width="369" height="20" uuid="ed1eec37-acea-40b9-8a2b-fd4cc82f3c54"/> + <textElement verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{fim}]]></textFieldExpression> + </textField> + <staticText> + <reportElement x="0" y="40" width="84" height="23" uuid="eaf57bd2-6e34-43a9-8bf4-2a325b059982"/> + <textElement verticalAlignment="Middle"> + <font isBold="true"/> + </textElement> + <text><![CDATA[Empresa:]]></text> + </staticText> + <textField> + <reportElement x="84" y="40" width="471" height="23" uuid="849b040c-719b-41b3-857f-ec1501d775de"/> + <textElement verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{empresa}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="158" y="20" width="28" height="20" uuid="c6ba87cc-89f1-407b-8e70-64a313494b3d"/> + <textElement verticalAlignment="Middle"> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[" a "]]></textFieldExpression> + </textField> + <textField pattern="dd/MM/yyyy"> + <reportElement x="80" y="20" width="78" height="20" uuid="da239a2a-35fe-4f17-83c3-a3bb1df689da"/> + <textElement textAlignment="Left" verticalAlignment="Middle"/> + <textFieldExpression><![CDATA[$P{inicio}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="0" y="20" width="80" height="20" uuid="c23507a8-46b7-4e58-9b9d-66d5a1422b62"/> + <textElement verticalAlignment="Middle"> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA["Período: "]]></textFieldExpression> + </textField> + </band> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/ECFReducaoZVO.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/ECFReducaoZVO.java new file mode 100644 index 000000000..e6c81820e --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/ECFReducaoZVO.java @@ -0,0 +1,93 @@ +package com.rjconsultores.ventaboletos.relatorios.utilitarios; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import com.rjconsultores.ventaboletos.vo.impressaofiscal.TipoPendencia; + +public class ECFReducaoZVO { + + private String tipo; + private String pendenciaRedZ; + private String datamov; + private String numserie20; + private String coo; + private BigDecimal valorTotal; + private List itens; + + public ECFReducaoZVO(String tipo, String pendenciaRedZ, String datamov, String numserie20, String coo, BigDecimal valorTotal) { + super(); + this.tipo = tipo; + this.datamov = datamov; + this.numserie20 = numserie20; + this.coo = coo; + this.valorTotal = valorTotal; + this.itens = new ArrayList(); + + if (pendenciaRedZ == null) { + this.pendenciaRedZ = null; + } else if (pendenciaRedZ.equals(TipoPendencia.DIF_RED.toString())) { + this.pendenciaRedZ = "Redução Z maior que ECF"; + } else if (pendenciaRedZ.equals(TipoPendencia.DIF_ECF.toString())) { + this.pendenciaRedZ = "ECF maior que Redução Z"; + } + } + + public String getDatamov() { + return datamov; + } + + public void setDatamov(String datamov) { + this.datamov = datamov; + } + + public String getNumserie20() { + return numserie20; + } + + public void setNumserie20(String numserie20) { + this.numserie20 = numserie20; + } + + public String getCoo() { + return coo; + } + + public void setCoo(String coo) { + this.coo = coo; + } + + public BigDecimal getValorTotal() { + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } + + public List getItens() { + return itens; + } + + public void setItens(List itens) { + this.itens = itens; + } + + public String getTipo() { + return tipo; + } + + public void setTipo(String tipo) { + this.tipo = tipo; + } + + public String getPendenciaRedZ() { + return pendenciaRedZ; + } + + public void setPendenciaRedZ(String pendenciaRedZ) { + this.pendenciaRedZ = pendenciaRedZ; + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/ItemECFVO.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/ItemECFVO.java new file mode 100644 index 000000000..5380149cf --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/ItemECFVO.java @@ -0,0 +1,41 @@ +package com.rjconsultores.ventaboletos.relatorios.utilitarios; + +import java.math.BigDecimal; + +public class ItemECFVO { + + private String numItem; + private String codProduto; + private BigDecimal valorItem; + + public ItemECFVO(String numItem, String codProduto, BigDecimal valorItem) { + super(); + this.numItem = numItem; + this.codProduto = codProduto; + this.valorItem = valorItem; + } + + public String getNumItem() { + return numItem; + } + + public void setNumItem(String numItem) { + this.numItem = numItem; + } + + public String getCodProduto() { + return codProduto; + } + + public void setCodProduto(String codProduto) { + this.codProduto = codProduto; + } + + public BigDecimal getValorItem() { + return valorItem; + } + + public void setValorItem(BigDecimal valorItem) { + this.valorItem = valorItem; + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/BusquedaImportacionFiscalController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/BusquedaImportacionFiscalController.java index bde957310..d15aced5c 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/BusquedaImportacionFiscalController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/BusquedaImportacionFiscalController.java @@ -1,7 +1,10 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.impressaofiscal; +import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; import java.io.InputStream; import java.sql.SQLException; import java.util.Calendar; @@ -12,10 +15,12 @@ import java.util.Map; import javax.sql.DataSource; +import org.apache.commons.io.IOUtils; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; +import org.zkoss.util.media.AMedia; import org.zkoss.util.resource.Labels; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Executions; @@ -31,10 +36,14 @@ import org.zkoss.zul.Textbox; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioAnaliticoFinanceiro; import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioAnaliticoVoucher; +import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioECFReducaoZ; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.SaidaRelatorio; import com.rjconsultores.ventaboletos.service.EmpresaService; import com.rjconsultores.ventaboletos.service.FiscalService; import com.rjconsultores.ventaboletos.utilerias.DateUtil; import com.rjconsultores.ventaboletos.utilerias.ZipUtil; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalReducaoZVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO; import com.rjconsultores.ventaboletos.web.utilerias.MaskUtil; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; @@ -162,6 +171,7 @@ public class BusquedaImportacionFiscalController extends MyGenericForwardCompose } + @SuppressWarnings({ "unchecked" }) public void onClick$btnExeImportacionEcfRedZ(Event ev) throws InterruptedException { Empresa empresa = null; @@ -171,13 +181,42 @@ public class BusquedaImportacionFiscalController extends MyGenericForwardCompose } try { - List txts = fiscalService.importacionFiscalECFValidaReducaoZ(datInicial.getValue(), datFinal.getValue(), empresa); + HashMap retorno = fiscalService.importacionFiscalECFValidaReducaoZ(datInicial.getValue(), datFinal.getValue(), empresa); + + Map parametros = new HashMap(); + parametros.put("ecfInvalidos", (List) retorno.get("ecfInvalidos")); + parametros.put("redZInvalido", (List) retorno.get("redZInvalido")); + parametros.put("inicio", datInicial.getValue()); + parametros.put("fim", datFinal.getValue()); + parametros.put("empresa", empresa.getNombempresa()); + + RelatorioECFReducaoZ relatorio = new RelatorioECFReducaoZ(parametros, dataSourceRead.getConnection()); + final InputStream mediais = new ByteArrayInputStream(relatorio.getConteudo(SaidaRelatorio.PDF)); + AMedia conteudoRelatorioPDF = new AMedia("RelatorioECFReducaoZ" + ".pdf", "pdf", null, mediais); + + List txts = (List) retorno.get("arquivos"); + txts.add(inpuStreamToFile(conteudoRelatorioPDF.getStreamData(), "RelatorioECFReducaoZ_0", ".pdf")); + downloadListaArquivos(txts); + } catch (Exception e) { log.error("", e); } } + private File inpuStreamToFile(InputStream in, String prefix, String suffix) { + try { + File tempFile = File.createTempFile(prefix, suffix); + tempFile.deleteOnExit(); + FileOutputStream out = new FileOutputStream(tempFile); + IOUtils.copy(in, out); + return tempFile; + } catch (IOException e) { + log.error("", e); + } + return null; + } + public void onClick$btnExeImportacionManual(Event ev) throws InterruptedException { Empresa empresa = null; @@ -258,16 +297,16 @@ public class BusquedaImportacionFiscalController extends MyGenericForwardCompose } } - private void downloadListaArquivos(List txts) throws Exception { + private void downloadListaArquivos(List files) throws Exception { String extensao = ".zip"; String contentType = "application/zip"; File arquivoDownload = new File(System.getProperty("jboss.server.log.dir") + File.separator + "fiscal_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmm") + extensao); - ZipUtil.compactarArquivos(arquivoDownload, txts); + ZipUtil.compactarArquivos(arquivoDownload, files); InputStream isFile = new FileInputStream(arquivoDownload); String nomeArquivo = arquivoDownload.getName(); - Filedownload.save(isFile, contentType, nomeArquivo + extensao); + Filedownload.save(isFile, contentType, nomeArquivo); if (arquivoDownload != null) { arquivoDownload.delete(); @@ -300,7 +339,7 @@ public class BusquedaImportacionFiscalController extends MyGenericForwardCompose nomeArquivo = arquivoTxt.getName(); } - Filedownload.save(isFile, contentType, nomeArquivo + extensao); + Filedownload.save(isFile, contentType, nomeArquivo); if (arquivoTxt != null) { arquivoTxt.delete();