eduardo.dicarde 2017-05-16 22:09:14 +00:00
parent b44b127d1c
commit 920de3bb40
1 changed files with 42 additions and 42 deletions

View File

@ -24,16 +24,16 @@ import java.util.Map;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;
import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFFont;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
@ -366,12 +366,12 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
}
//Estilo padrão para os dois tipos de relatórios
HSSFWorkbook wb = new HSSFWorkbook();
XSSFWorkbook wb = new XSSFWorkbook ();
// fonte em negrito:
HSSFFont fonte = wb.createFont();
XSSFFont fonte = wb.createFont();
fonte.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
HSSFCellStyle estilo = wb.createCellStyle();
XSSFCellStyle estilo = wb.createCellStyle();
estilo.setFont(fonte);
List<Object> lsRutaCombinacion = rutaCombinacionService.pesquisaTarifaObj(lsAddRmvMonedas, lsAddRmvMarcas,
@ -659,8 +659,8 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
this.lsOrgaoConcedente = lsOrgaoConcedente;
}
private void gerarExcelSemAgrupamento(List<Object> lsRutaCombinacion, HSSFWorkbook wb, HSSFCellStyle estilo, BigDecimal coeficiente){
HSSFSheet sheet1 = null;
private void gerarExcelSemAgrupamento(List<Object> lsRutaCombinacion, XSSFWorkbook wb, XSSFCellStyle estilo, BigDecimal coeficiente){
XSSFSheet sheet1 = null;
String ruta = "";
int contRow = 0;
@ -699,9 +699,9 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
}
}
private void gerarExcelComAgrupamento(List<Object> lsRutaCombinacion, HSSFWorkbook wb, HSSFCellStyle estilo, BigDecimal coeficiente) {
private void gerarExcelComAgrupamento(List<Object> lsRutaCombinacion, XSSFWorkbook wb, XSSFCellStyle estilo, BigDecimal coeficiente) {
HSSFSheet sheet1 = null;
XSSFSheet sheet1 = null;
String ruta = "";
int contRow = 0;
@ -744,101 +744,101 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
return true;
}
private void criarCabecalhoExcel(HSSFSheet sheet, HSSFCellStyle estilo) {
private void criarCabecalhoExcel(XSSFSheet sheet1, XSSFCellStyle estilo) {
HSSFRow rowCabecalho = sheet.createRow(ROW_CABECALHO);
XSSFRow rowCabecalho = sheet1.createRow(ROW_CABECALHO);
HSSFCell cellId = rowCabecalho.createCell(IDX_CELL_ID);
XSSFCell cellId = rowCabecalho.createCell(IDX_CELL_ID);
cellId.setCellValue(Labels.getLabel("busquedaTarifaController.lhId.label"));
cellId.setCellStyle(estilo);
HSSFCell cellMarca = rowCabecalho.createCell(IDX_CELL_MARCA);
XSSFCell cellMarca = rowCabecalho.createCell(IDX_CELL_MARCA);
cellMarca.setCellValue(Labels.getLabel("busquedaTarifaController.lhMarca.label"));
cellMarca.setCellStyle(estilo);
HSSFCell cellNumLinha = rowCabecalho.createCell(IDX_CELL_NUMLINHA);
XSSFCell cellNumLinha = rowCabecalho.createCell(IDX_CELL_NUMLINHA);
cellNumLinha.setCellValue(Labels.getLabel("busquedaTarifaController.lhNumLinha.label"));
cellNumLinha.setCellStyle(estilo);
HSSFCell cellDescLinha = rowCabecalho.createCell(IDX_CELL_DESCLINHA);
XSSFCell cellDescLinha = rowCabecalho.createCell(IDX_CELL_DESCLINHA);
cellDescLinha.setCellValue(Labels.getLabel("busquedaTarifaController.lhDescLinha.label"));
cellDescLinha.setCellStyle(estilo);
HSSFCell cellTipoClasse = rowCabecalho.createCell(IDX_CELL_TIPOCLASSE);
XSSFCell cellTipoClasse = rowCabecalho.createCell(IDX_CELL_TIPOCLASSE);
cellTipoClasse.setCellValue(Labels.getLabel("busquedaTarifaController.lhClaseServicio.label"));
cellTipoClasse.setCellStyle(estilo);
HSSFCell cellTrecho = rowCabecalho.createCell(IDX_CELL_TRECHO);
XSSFCell cellTrecho = rowCabecalho.createCell(IDX_CELL_TRECHO);
cellTrecho.setCellValue(Labels.getLabel("busquedaTarifaController.lhTramo.label"));
cellTrecho.setCellStyle(estilo);
HSSFCell cellOrigem = rowCabecalho.createCell(IDX_CELL_ORIGEM);
XSSFCell cellOrigem = rowCabecalho.createCell(IDX_CELL_ORIGEM);
cellOrigem.setCellValue(Labels.getLabel("busquedaTarifaController.lhOrigen.label"));
cellOrigem.setCellStyle(estilo);
HSSFCell cellDestino = rowCabecalho.createCell(IDX_CELL_DESTINO);
XSSFCell cellDestino = rowCabecalho.createCell(IDX_CELL_DESTINO);
cellDestino.setCellValue(Labels.getLabel("busquedaTarifaController.lhDestino.label"));
cellDestino.setCellStyle(estilo);
HSSFCell cellTarifaOriginal = rowCabecalho.createCell(IDX_CELL_TARIFAORIGINAL);
XSSFCell cellTarifaOriginal = rowCabecalho.createCell(IDX_CELL_TARIFAORIGINAL);
cellTarifaOriginal.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioOriginal.label"));
cellTarifaOriginal.setCellStyle(estilo);
HSSFCell cellTarifaAtual = rowCabecalho.createCell(IDX_CELL_TARIFAATUAL);
XSSFCell cellTarifaAtual = rowCabecalho.createCell(IDX_CELL_TARIFAATUAL);
cellTarifaAtual.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioExcel.label"));
cellTarifaAtual.setCellStyle(estilo);
HSSFCell cellTarifaSimulada = rowCabecalho.createCell(IDX_CELL_TARIFA_SIMULADA);
XSSFCell cellTarifaSimulada = rowCabecalho.createCell(IDX_CELL_TARIFA_SIMULADA);
cellTarifaSimulada.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioNuevo.label"));
cellTarifaSimulada.setCellStyle(estilo);
HSSFCell cellPedagioAtual = rowCabecalho.createCell(IDX_CELL_PEDAGIOATUAL);
XSSFCell cellPedagioAtual = rowCabecalho.createCell(IDX_CELL_PEDAGIOATUAL);
cellPedagioAtual.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioPedagio.label"));
cellPedagioAtual.setCellStyle(estilo);
HSSFCell cellPedagioSimulado = rowCabecalho.createCell(IDX_CELL_PEDAGIOSIMULADO);
XSSFCell cellPedagioSimulado = rowCabecalho.createCell(IDX_CELL_PEDAGIOSIMULADO);
cellPedagioSimulado.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioPedagioNuevo.label"));
cellPedagioSimulado.setCellStyle(estilo);
HSSFCell cellTxEmbarqueAtual = rowCabecalho.createCell(IDX_CELL_TXEMBARQUEATUAL);
XSSFCell cellTxEmbarqueAtual = rowCabecalho.createCell(IDX_CELL_TXEMBARQUEATUAL);
cellTxEmbarqueAtual.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioTxEmbarque.label"));
cellTxEmbarqueAtual.setCellStyle(estilo);
HSSFCell cellTxEmbarqueSimulado = rowCabecalho.createCell(IDX_CELL_TXEMBARQUESIMULADO);
XSSFCell cellTxEmbarqueSimulado = rowCabecalho.createCell(IDX_CELL_TXEMBARQUESIMULADO);
cellTxEmbarqueSimulado.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioTxEmbarqueSimulado.label"));
cellTxEmbarqueSimulado.setCellStyle(estilo);
HSSFCell cellSeguroAtual = rowCabecalho.createCell(IDX_CELL_SEGUROATUAL);
XSSFCell cellSeguroAtual = rowCabecalho.createCell(IDX_CELL_SEGUROATUAL);
cellSeguroAtual.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioSeguroAtual.label"));
cellSeguroAtual.setCellStyle(estilo);
HSSFCell cellSeguroSimulado = rowCabecalho.createCell(IDX_CELL_SEGUROSIMULADO);
XSSFCell cellSeguroSimulado = rowCabecalho.createCell(IDX_CELL_SEGUROSIMULADO);
cellSeguroSimulado.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioSeguroSimulado.label"));
cellSeguroSimulado.setCellStyle(estilo);
HSSFCell cellOrgaoConcedente = rowCabecalho.createCell(IDX_CELL_ORGAOCONCEDENTE);
XSSFCell cellOrgaoConcedente = rowCabecalho.createCell(IDX_CELL_ORGAOCONCEDENTE);
cellOrgaoConcedente.setCellValue(Labels.getLabel("busquedaTarifaController.lhOrgaoLabel.label"));
cellOrgaoConcedente.setCellStyle(estilo);
HSSFCell cellPrefixo = rowCabecalho.createCell(IDX_CELL_PREFIXO);
XSSFCell cellPrefixo = rowCabecalho.createCell(IDX_CELL_PREFIXO);
cellPrefixo.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrefixo.label"));
cellPrefixo.setCellStyle(estilo);
HSSFCell cellVigencia = rowCabecalho.createCell(IDX_CELL_VIGENCIA);
XSSFCell cellVigencia = rowCabecalho.createCell(IDX_CELL_VIGENCIA);
cellVigencia.setCellValue(Labels.getLabel("busquedaTarifaController.lhFeciniciovigencia.label"));
cellVigencia.setCellStyle(estilo);
HSSFCell cellMoeda = rowCabecalho.createCell(IDX_CELL_MOEDA);
XSSFCell cellMoeda = rowCabecalho.createCell(IDX_CELL_MOEDA);
cellMoeda.setCellValue(Labels.getLabel("busquedaTarifaController.lhMoneda.label"));
cellMoeda.setCellStyle(estilo);
HSSFCell cellSentido = rowCabecalho.createCell(IDX_CELL_SENTIDO);
XSSFCell cellSentido = rowCabecalho.createCell(IDX_CELL_SENTIDO);
cellSentido.setCellValue(Labels.getLabel("busquedaTarifaController.lhSentido.label"));
cellSentido.setCellStyle(estilo);
}
private boolean popularPlanilha(HSSFSheet sheet,Object[] obj, HSSFCellStyle estilo, BigDecimal coeficiente, int rowNum){
HSSFRow row = sheet.createRow(rowNum);
private boolean popularPlanilha(XSSFSheet sheet1,Object[] obj, XSSFCellStyle estilo, BigDecimal coeficiente, int rowNum){
XSSFRow row = sheet1.createRow(rowNum);
//IDXs das coluna diferente dos IDXs do obj
row.createCell(IDX_CELL_ID).setCellValue(Integer.parseInt(obj[0].toString()));
@ -895,7 +895,7 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
novoPrecio = atual;
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
HSSFCell cellNovoPrecio = row.createCell(IDX_CELL_TARIFA_SIMULADA);//celula alterada
XSSFCell cellNovoPrecio = row.createCell(IDX_CELL_TARIFA_SIMULADA);//celula alterada
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
cellNovoPrecio.setCellStyle(estilo);
}
@ -910,7 +910,7 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
novoPrecio = BigDecimal.valueOf(Double.valueOf(getStringImporteSafe(obj[16])));
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
HSSFCell cellNovoPrecio = row.createCell(IDX_CELL_PEDAGIOSIMULADO); //celula alterada
XSSFCell cellNovoPrecio = row.createCell(IDX_CELL_PEDAGIOSIMULADO); //celula alterada
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
cellNovoPrecio.setCellStyle(estilo);
}
@ -925,7 +925,7 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
novoPrecio = BigDecimal.valueOf(Double.valueOf(getStringImporteSafe(obj[18])));
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
HSSFCell cellNovoPrecio = row.createCell(IDX_CELL_TXEMBARQUESIMULADO); //celula alterada
XSSFCell cellNovoPrecio = row.createCell(IDX_CELL_TXEMBARQUESIMULADO); //celula alterada
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
cellNovoPrecio.setCellStyle(estilo);
}
@ -940,7 +940,7 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
novoPrecio = BigDecimal.valueOf(Double.valueOf(getStringImporteSafe(obj[19])));
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
HSSFCell cellNovoPrecio = row.createCell(IDX_CELL_SEGUROSIMULADO); //celula alterada
XSSFCell cellNovoPrecio = row.createCell(IDX_CELL_SEGUROSIMULADO); //celula alterada
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
cellNovoPrecio.setCellStyle(estilo);
}