eduardo.dicarde 2016-07-05 13:50:06 +00:00
parent 9e2a045fa2
commit 45f4d932c4
4 changed files with 249 additions and 376 deletions

View File

@ -34,7 +34,6 @@ 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.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
@ -163,10 +162,35 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
private Tab tabTipoPuntoVenta;
private Tab tabCategoria;
private final int ROW_CABECALHO = 0;
private final int ROW_PEDAGIO = 16;
private final int ROW_TXEMBARQUE = 18;
private final int ROW_SEGURO = 19;
//INDICES PLANILHA
private final int IDX_CELL_ID = 0;
private final int IDX_CELL_MARCA = 1;
private final int IDX_CELL_NUMLINHA = 2;
private final int IDX_CELL_DESCLINHA = 3;
private final int IDX_CELL_TIPOCLASSE = 4;
private final int IDX_CELL_TRECHO = 5;
private final int IDX_CELL_ORIGEM = 6;
private final int IDX_CELL_DESTINO = 7;
private final int IDX_CELL_TARIFAORIGINAL = 8;
private final int IDX_CELL_TARIFAATUAL = 9;
private final int IDX_CELL_TARIFA_SIMULADA = 10;
private final int IDX_CELL_PEDAGIOATUAL = 11;
private final int IDX_CELL_PEDAGIOSIMULADO = 12;
private final int IDX_CELL_TXEMBARQUEATUAL = 13;
private final int IDX_CELL_TXEMBARQUESIMULADO = 14;
private final int IDX_CELL_SEGUROATUAL = 15;
private final int IDX_CELL_SEGUROSIMULADO = 16;
private final int IDX_CELL_ORGAOCONCEDENTE = 17;
private final int IDX_CELL_PREFIXO = 18;
private final int IDX_CELL_VIGENCIA = 19;
private final int IDX_CELL_MOEDA = 20;
private final int IDX_CELL_SENTIDO = 21;
private static Logger log = Logger.getLogger(ModificacionMasivaTarifasController.class);
public List<ClaseServicio> getLsClaseServico() {
@ -359,9 +383,9 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
if (!lsRutaCombinacion.isEmpty()) {
if (radAgrupamentoLinhasSim.isChecked()){
gerarExcelComAgrupamento(lsRutaCombinacion,wb,estilo,coeficiente);
gerarExcelComAgrupamento(lsRutaCombinacion, wb, estilo, coeficiente);
} else {
gerarExcelSemAgrupamento(lsRutaCombinacion,wb,estilo,coeficiente);
gerarExcelSemAgrupamento(lsRutaCombinacion, wb, estilo, coeficiente);
}
String nomeArquivo =
@ -638,7 +662,7 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
this.lsOrgaoConcedente = lsOrgaoConcedente;
}
private void gerarExcelSemAgrupamento(List<Object> lsRutaCombinacion, HSSFWorkbook wb, HSSFCellStyle estilo, BigDecimal coeficiente){
private void gerarExcelSemAgrupamento(List<Object> lsRutaCombinacion, HSSFWorkbook wb, HSSFCellStyle estilo, BigDecimal coeficiente){
HSSFSheet sheet1 = null;
String ruta = "";
int contRow = 0;
@ -660,185 +684,11 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
sheet1 = wb.createSheet(sheetName);
contRow = 1;
HSSFRow rowCabecalho = sheet1.createRow(0);
HSSFCell cell = rowCabecalho.createCell(0);
cell.setCellValue(Labels.getLabel("busquedaTarifaController.lhId.label"));
cell.setCellStyle(estilo);
HSSFCell cell0 = rowCabecalho.createCell(1);
cell0.setCellValue(Labels.getLabel("busquedaTarifaController.lhTramo.label"));
cell0.setCellStyle(estilo);
HSSFCell cell1 = rowCabecalho.createCell(2);
cell1.setCellValue(Labels.getLabel("busquedaTarifaController.lhOrigen.label"));
cell1.setCellStyle(estilo);
HSSFCell cell2 = rowCabecalho.createCell(3);
cell2.setCellValue(Labels.getLabel("busquedaTarifaController.lhDestino.label"));
cell2.setCellStyle(estilo);
HSSFCell cell3 = rowCabecalho.createCell(4);
cell3.setCellValue(Labels.getLabel("busquedaTarifaController.lhRuta.label"));
cell3.setCellStyle(estilo);
HSSFCell cell4 = rowCabecalho.createCell(5);
cell4.setCellValue(Labels.getLabel("busquedaTarifaController.lhMarca.label"));
cell4.setCellStyle(estilo);
HSSFCell cell5 = rowCabecalho.createCell(6);
cell5.setCellValue(Labels.getLabel("busquedaTarifaController.lhClaseServicio.label"));
cell5.setCellStyle(estilo);
HSSFCell cell6 = rowCabecalho.createCell(7);
cell6.setCellValue(Labels.getLabel("busquedaTarifaController.lhFeciniciovigencia.label"));
cell6.setCellStyle(estilo);
HSSFCell cell7 = rowCabecalho.createCell(8);
cell7.setCellValue(Labels.getLabel("busquedaTarifaController.lhMoneda.label"));
cell7.setCellStyle(estilo);
HSSFCell cell8 = rowCabecalho.createCell(9);
cell8.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioOriginal.label"));
cell8.setCellStyle(estilo);
HSSFCell cell9 = rowCabecalho.createCell(10);
cell9.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioExcel.label"));
cell9.setCellStyle(estilo);
HSSFCell cell10 = rowCabecalho.createCell(11);
cell10.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioNuevo.label"));
cell10.setCellStyle(estilo);
HSSFCell cell12 = rowCabecalho.createCell(12);
cell12.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioPedagio.label"));
cell12.setCellStyle(estilo);
HSSFCell cell13 = rowCabecalho.createCell(13);
cell13.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioPedagioNuevo.label"));
cell13.setCellStyle(estilo);
HSSFCell cell14 = rowCabecalho.createCell(14);
cell14.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioTxEmbarque.label"));
cell14.setCellStyle(estilo);
HSSFCell cell15 = rowCabecalho.createCell(15);
cell15.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioTxEmbarqueSimulado.label"));
cell15.setCellStyle(estilo);
HSSFCell cell16 = rowCabecalho.createCell(16);
cell16.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioSeguroAtual.label"));
cell16.setCellStyle(estilo);
HSSFCell cell17 = rowCabecalho.createCell(17);
cell17.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioSeguroSimulado.label"));
cell17.setCellStyle(estilo);
HSSFCell cell18 = rowCabecalho.createCell(18);
cell18.setCellValue(Labels.getLabel("busquedaTarifaController.lhOrgaoLabel.label"));
cell18.setCellStyle(estilo);
}
HSSFRow row = sheet1.createRow(contRow++);
row.createCell(0).setCellValue(Integer.parseInt(obj[0].toString()));
row.createCell(1).setCellValue(obj[1].toString());
row.createCell(2).setCellValue(obj[2].toString());
row.createCell(3).setCellValue(obj[3].toString());
row.createCell(4).setCellValue(obj[4].toString().concat(" (").concat(obj[12].toString()).concat(")"));
row.createCell(5).setCellValue(obj[5].toString());
row.createCell(6).setCellValue(obj[6].toString());
DateFormat sfFormatada = new SimpleDateFormat("dd/MM/yyyy");
Date dataIni = (Date) obj[7];
Date dataFim = (Date) obj[8];
row.createCell(7).setCellValue(sfFormatada.format(dataIni) + " - " + sfFormatada.format(dataFim));
row.createCell(8).setCellValue(obj[9].toString());
String ori = getStringImporteSafe(obj[10]);
BigDecimal original = BigDecimal.valueOf(Double.valueOf(ori));
String atu = getStringImporteSafe(obj[11]);
BigDecimal atual = BigDecimal.valueOf(Double.valueOf(atu));
row.createCell(9).setCellValue(original.setScale(2).doubleValue());
row.createCell(10).setCellValue(atual.setScale(2).doubleValue());
String ped = getStringImporteSafe(obj[16]);
BigDecimal pedVal = BigDecimal.valueOf(Double.valueOf(ped));
row.createCell(12).setCellValue(pedVal.setScale(2).doubleValue());
String txEmbarque = getStringImporteSafe(obj[18]);
BigDecimal txEmbarqueVal = BigDecimal.valueOf(Double.valueOf(txEmbarque));
row.createCell(14).setCellValue(txEmbarqueVal.setScale(2).doubleValue());
String seguro = getStringImporteSafe(obj[19]);
BigDecimal seguroVal = BigDecimal.valueOf(Double.valueOf(seguro));
row.createCell(16).setCellValue(seguroVal.setScale(2).doubleValue());
row.createCell(18).setCellValue(obj[17].toString());
// novo preco:
BigDecimal novoPrecio = null;
if (cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TARIFA.getDescricao()) ||
cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TODOS.getDescricao())){
novoPrecio = atual;
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
HSSFCell cellNovoPrecio = row.createCell(11);//celula alterada
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
cellNovoPrecio.setCellStyle(estilo);
}
if (cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.PEDAGIO.getDescricao())||
cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TODOS.getDescricao())){
if (!validarComponente(obj, ROW_PEDAGIO)){
continue;
}
novoPrecio = BigDecimal.valueOf(Double.valueOf(getStringImporteSafe(obj[16])));
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
HSSFCell cellNovoPrecio = row.createCell(13); //celula alterada
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
cellNovoPrecio.setCellStyle(estilo);
criarCabecalhoExcel(sheet1, estilo);
}
if (cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TX_EMBARQUE.getDescricao())||
cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TODOS.getDescricao())){
if (!validarComponente(obj, ROW_TXEMBARQUE)){
continue;
}
novoPrecio = BigDecimal.valueOf(Double.valueOf(getStringImporteSafe(obj[18])));
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
HSSFCell cellNovoPrecio = row.createCell(15); //celula alterada
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
cellNovoPrecio.setCellStyle(estilo);
}
if (cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.SEGURO.getDescricao())||
cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TODOS.getDescricao())){
if (!validarComponente(obj, ROW_SEGURO)){
continue;
}
novoPrecio = BigDecimal.valueOf(Double.valueOf(getStringImporteSafe(obj[19])));
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
HSSFCell cellNovoPrecio = row.createCell(17); //celula alterada
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
cellNovoPrecio.setCellStyle(estilo);
}
popularPlanilha(sheet1, obj, estilo, coeficiente, contRow++);
}
}
@ -853,7 +703,6 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
Object[] obj = (Object[]) lsRutaCombinacion.get(i);
if (!ruta.equals(obj[4].toString().concat(obj[12].toString()))) {
int contCell = 0;
ruta = obj[4].toString().concat(obj[12].toString());
String linha = "";
@ -870,195 +719,13 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
contRow = 0;
}
if (contRow > 0){
HSSFRow rowLinhaBranco = sheet1.createRow(contRow++);
HSSFCell cellLinhaBranco = rowLinhaBranco.createCell(0);
sheet1.addMergedRegion(new CellRangeAddress(rowLinhaBranco.getRowNum(), rowLinhaBranco.getRowNum(), 0, 16));
cellLinhaBranco.setCellValue("");
cellLinhaBranco.setCellStyle(estilo);
if (contRow == 0){
criarCabecalhoExcel(sheet1, estilo);
++contRow;
}
HSSFRow rowTituloLinha = sheet1.createRow(contRow++);
HSSFCell cellTituloLinha = rowTituloLinha.createCell(0);
sheet1.addMergedRegion(new CellRangeAddress(rowTituloLinha.getRowNum(), rowTituloLinha.getRowNum(), 0, 16));
cellTituloLinha.setCellValue(linha);
cellTituloLinha.setCellStyle(estilo);
HSSFRow rowCabecalho = sheet1.createRow(contRow++);
HSSFCell cell = rowCabecalho.createCell(contCell++);
cell.setCellValue(Labels.getLabel("busquedaTarifaController.lhId.label"));
cell.setCellStyle(estilo);
HSSFCell cell0 = rowCabecalho.createCell(contCell++);
cell0.setCellValue(Labels.getLabel("busquedaTarifaController.lhTramo.label"));
cell0.setCellStyle(estilo);
HSSFCell cell1 = rowCabecalho.createCell(contCell++);
cell1.setCellValue(Labels.getLabel("busquedaTarifaController.lhOrigen.label"));
cell1.setCellStyle(estilo);
HSSFCell cell2 = rowCabecalho.createCell(contCell++);
cell2.setCellValue(Labels.getLabel("busquedaTarifaController.lhDestino.label"));
cell2.setCellStyle(estilo);
HSSFCell cell3 = rowCabecalho.createCell(contCell++);
cell3.setCellValue(Labels.getLabel("busquedaTarifaController.lhRuta.label"));
cell3.setCellStyle(estilo);
HSSFCell cell4 = rowCabecalho.createCell(contCell++);
cell4.setCellValue(Labels.getLabel("busquedaTarifaController.lhMarca.label"));
cell4.setCellStyle(estilo);
HSSFCell cell5 = rowCabecalho.createCell(contCell++);
cell5.setCellValue(Labels.getLabel("busquedaTarifaController.lhClaseServicio.label"));
cell5.setCellStyle(estilo);
HSSFCell cell6 = rowCabecalho.createCell(contCell++);
cell6.setCellValue(Labels.getLabel("busquedaTarifaController.lhFeciniciovigencia.label"));
cell6.setCellStyle(estilo);
HSSFCell cell7 = rowCabecalho.createCell(contCell++);
cell7.setCellValue(Labels.getLabel("busquedaTarifaController.lhMoneda.label"));
cell7.setCellStyle(estilo);
HSSFCell cell8 = rowCabecalho.createCell(contCell++);
cell8.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioOriginal.label"));
cell8.setCellStyle(estilo);
HSSFCell cell9 = rowCabecalho.createCell(contCell++);
cell9.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioExcel.label"));
cell9.setCellStyle(estilo);
HSSFCell cell10 = rowCabecalho.createCell(contCell++);
cell10.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioNuevo.label"));
cell10.setCellStyle(estilo);
HSSFCell cell12 = rowCabecalho.createCell(contCell++);
cell12.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioPedagio.label"));
cell12.setCellStyle(estilo);
HSSFCell cell13 = rowCabecalho.createCell(contCell++);
cell13.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioPedagioNuevo.label"));
cell13.setCellStyle(estilo);
HSSFCell cell14 = rowCabecalho.createCell(contCell++);
cell14.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioTxEmbarque.label"));
cell14.setCellStyle(estilo);
HSSFCell cell15 = rowCabecalho.createCell(contCell++);
cell15.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioTxEmbarqueSimulado.label"));
cell15.setCellStyle(estilo);
HSSFCell cell16 = rowCabecalho.createCell(contCell++);
cell16.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioSeguroAtual.label"));
cell16.setCellStyle(estilo);
HSSFCell cell17 = rowCabecalho.createCell(contCell++);
cell17.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioSeguroSimulado.label"));
cell17.setCellStyle(estilo);
HSSFCell cell18 = rowCabecalho.createCell(contCell++);
cell18.setCellValue(Labels.getLabel("busquedaTarifaController.lhOrgaoLabel.label"));
cell18.setCellStyle(estilo);
}
HSSFRow row = sheet1.createRow(contRow++);
row.createCell(0).setCellValue(Integer.parseInt(obj[0].toString()));
row.createCell(1).setCellValue(obj[1].toString());
row.createCell(2).setCellValue(obj[2].toString());
row.createCell(3).setCellValue(obj[3].toString());
row.createCell(4).setCellValue(obj[4].toString().concat(" (").concat(obj[12].toString()).concat(")"));
row.createCell(5).setCellValue(obj[5].toString());
row.createCell(6).setCellValue(obj[6].toString());
DateFormat sfFormatada = new SimpleDateFormat("dd/MM/yyyy");
Date dataIni = (Date) obj[7];
Date dataFim = (Date) obj[8];
row.createCell(7).setCellValue(sfFormatada.format(dataIni) + " - " + sfFormatada.format(dataFim));
row.createCell(8).setCellValue(obj[9].toString());
String ori = getStringImporteSafe(obj[10]);
BigDecimal original = BigDecimal.valueOf(Double.valueOf(ori));
String atu = getStringImporteSafe(obj[11]);
BigDecimal atual = BigDecimal.valueOf(Double.valueOf(atu));
row.createCell(9).setCellValue(original.setScale(2).doubleValue());
row.createCell(10).setCellValue(atual.setScale(2).doubleValue());
String ped = getStringImporteSafe(obj[16]);
BigDecimal pedVal = BigDecimal.valueOf(Double.valueOf(ped));
row.createCell(12).setCellValue(pedVal.setScale(2).doubleValue());
String txEmbarque = getStringImporteSafe(obj[18]);
BigDecimal txEmbarqueVal = BigDecimal.valueOf(Double.valueOf(txEmbarque));
row.createCell(14).setCellValue(txEmbarqueVal.setScale(2).doubleValue());
String seguro = getStringImporteSafe(obj[19]);
BigDecimal seguroVal = BigDecimal.valueOf(Double.valueOf(seguro));
row.createCell(16).setCellValue(seguroVal.setScale(2).doubleValue());
row.createCell(18).setCellValue(obj[17].toString());
// novo preco:
BigDecimal novoPrecio = null;
if (cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TARIFA.getDescricao()) ||
cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TODOS.getDescricao())){
novoPrecio = atual;
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
HSSFCell cellNovoPrecio = row.createCell(11);//celula alterada
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
cellNovoPrecio.setCellStyle(estilo);
}
if (cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.PEDAGIO.getDescricao()) ||
cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TODOS.getDescricao())) {
if (validarComponente(obj, ROW_PEDAGIO)){
novoPrecio = BigDecimal.valueOf(Double.valueOf(getStringImporteSafe(obj[16])));
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
HSSFCell cellNovoPrecio = row.createCell(13);//celula alterada
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
cellNovoPrecio.setCellStyle(estilo);
}
}
if (cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TX_EMBARQUE.getDescricao()) ||
cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TODOS.getDescricao())) {
if (validarComponente(obj, ROW_TXEMBARQUE)){
novoPrecio = BigDecimal.valueOf(Double.valueOf(getStringImporteSafe(obj[18])));
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
HSSFCell cellNovoPrecio = row.createCell(15);//celula alterada
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
cellNovoPrecio.setCellStyle(estilo);
}
}
if (cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.SEGURO.getDescricao()) ||
cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TODOS.getDescricao())) {
if (validarComponente(obj, ROW_SEGURO)){
novoPrecio = BigDecimal.valueOf(Double.valueOf(getStringImporteSafe(obj[19])));
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
HSSFCell cellNovoPrecio = row.createCell(17);//celula alterada
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
cellNovoPrecio.setCellStyle(estilo);
}
}
popularPlanilha(sheet1, obj, estilo, coeficiente, contRow++);
}
}
@ -1069,4 +736,208 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
return true;
}
private void criarCabecalhoExcel(HSSFSheet sheet, HSSFCellStyle estilo) {
HSSFRow rowCabecalho = sheet.createRow(ROW_CABECALHO);
HSSFCell cellId = rowCabecalho.createCell(IDX_CELL_ID);
cellId.setCellValue(Labels.getLabel("busquedaTarifaController.lhId.label"));
cellId.setCellStyle(estilo);
HSSFCell cellMarca = rowCabecalho.createCell(IDX_CELL_MARCA);
cellMarca.setCellValue(Labels.getLabel("busquedaTarifaController.lhMarca.label"));
cellMarca.setCellStyle(estilo);
HSSFCell cellNumLinha = rowCabecalho.createCell(IDX_CELL_NUMLINHA);
cellNumLinha.setCellValue(Labels.getLabel("busquedaTarifaController.lhNumLinha.label"));
cellNumLinha.setCellStyle(estilo);
HSSFCell cellDescLinha = rowCabecalho.createCell(IDX_CELL_DESCLINHA);
cellDescLinha.setCellValue(Labels.getLabel("busquedaTarifaController.lhDescLinha.label"));
cellDescLinha.setCellStyle(estilo);
HSSFCell cellTipoClasse = rowCabecalho.createCell(IDX_CELL_TIPOCLASSE);
cellTipoClasse.setCellValue(Labels.getLabel("busquedaTarifaController.lhClaseServicio.label"));
cellTipoClasse.setCellStyle(estilo);
HSSFCell cellTrecho = rowCabecalho.createCell(IDX_CELL_TRECHO);
cellTrecho.setCellValue(Labels.getLabel("busquedaTarifaController.lhTramo.label"));
cellTrecho.setCellStyle(estilo);
HSSFCell cellOrigem = rowCabecalho.createCell(IDX_CELL_ORIGEM);
cellOrigem.setCellValue(Labels.getLabel("busquedaTarifaController.lhOrigen.label"));
cellOrigem.setCellStyle(estilo);
HSSFCell cellDestino = rowCabecalho.createCell(IDX_CELL_DESTINO);
cellDestino.setCellValue(Labels.getLabel("busquedaTarifaController.lhDestino.label"));
cellDestino.setCellStyle(estilo);
HSSFCell cellTarifaOriginal = rowCabecalho.createCell(IDX_CELL_TARIFAORIGINAL);
cellTarifaOriginal.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioOriginal.label"));
cellTarifaOriginal.setCellStyle(estilo);
HSSFCell cellTarifaAtual = rowCabecalho.createCell(IDX_CELL_TARIFAATUAL);
cellTarifaAtual.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioExcel.label"));
cellTarifaAtual.setCellStyle(estilo);
HSSFCell cellTarifaSimulada = rowCabecalho.createCell(IDX_CELL_TARIFA_SIMULADA);
cellTarifaSimulada.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioNuevo.label"));
cellTarifaSimulada.setCellStyle(estilo);
HSSFCell cellPedagioAtual = rowCabecalho.createCell(IDX_CELL_PEDAGIOATUAL);
cellPedagioAtual.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioPedagio.label"));
cellPedagioAtual.setCellStyle(estilo);
HSSFCell cellPedagioSimulado = rowCabecalho.createCell(IDX_CELL_PEDAGIOSIMULADO);
cellPedagioSimulado.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioPedagioNuevo.label"));
cellPedagioSimulado.setCellStyle(estilo);
HSSFCell cellTxEmbarqueAtual = rowCabecalho.createCell(IDX_CELL_TXEMBARQUEATUAL);
cellTxEmbarqueAtual.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioTxEmbarque.label"));
cellTxEmbarqueAtual.setCellStyle(estilo);
HSSFCell cellTxEmbarqueSimulado = rowCabecalho.createCell(IDX_CELL_TXEMBARQUESIMULADO);
cellTxEmbarqueSimulado.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioTxEmbarqueSimulado.label"));
cellTxEmbarqueSimulado.setCellStyle(estilo);
HSSFCell cellSeguroAtual = rowCabecalho.createCell(IDX_CELL_SEGUROATUAL);
cellSeguroAtual.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioSeguroAtual.label"));
cellSeguroAtual.setCellStyle(estilo);
HSSFCell cellSeguroSimulado = rowCabecalho.createCell(IDX_CELL_SEGUROSIMULADO);
cellSeguroSimulado.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioSeguroSimulado.label"));
cellSeguroSimulado.setCellStyle(estilo);
HSSFCell cellOrgaoConcedente = rowCabecalho.createCell(IDX_CELL_ORGAOCONCEDENTE);
cellOrgaoConcedente.setCellValue(Labels.getLabel("busquedaTarifaController.lhOrgaoLabel.label"));
cellOrgaoConcedente.setCellStyle(estilo);
HSSFCell cellPrefixo = rowCabecalho.createCell(IDX_CELL_PREFIXO);
cellPrefixo.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrefixo.label"));
cellPrefixo.setCellStyle(estilo);
HSSFCell cellVigencia = rowCabecalho.createCell(IDX_CELL_VIGENCIA);
cellVigencia.setCellValue(Labels.getLabel("busquedaTarifaController.lhFeciniciovigencia.label"));
cellVigencia.setCellStyle(estilo);
HSSFCell cellMoeda = rowCabecalho.createCell(IDX_CELL_MOEDA);
cellMoeda.setCellValue(Labels.getLabel("busquedaTarifaController.lhMoneda.label"));
cellMoeda.setCellStyle(estilo);
HSSFCell 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);
//IDXs das coluna diferente dos IDXs do obj
row.createCell(IDX_CELL_ID).setCellValue(Integer.parseInt(obj[0].toString()));
row.createCell(IDX_CELL_TRECHO).setCellValue(obj[1].toString());
row.createCell(IDX_CELL_ORIGEM).setCellValue(obj[2].toString());
row.createCell(IDX_CELL_DESTINO).setCellValue(obj[3].toString());
row.createCell(IDX_CELL_DESCLINHA).setCellValue(obj[4].toString().concat(" (").concat(obj[12].toString()).concat(")"));
row.createCell(IDX_CELL_MARCA).setCellValue(obj[5].toString());
row.createCell(IDX_CELL_TIPOCLASSE).setCellValue(obj[6].toString());
DateFormat sfFormatada = new SimpleDateFormat("dd/MM/yyyy");
Date dataIni = (Date) obj[7];
Date dataFim = (Date) obj[8];
row.createCell(IDX_CELL_VIGENCIA).setCellValue(sfFormatada.format(dataIni) + " - " + sfFormatada.format(dataFim));
row.createCell(IDX_CELL_MOEDA).setCellValue(obj[9].toString());
String ori = getStringImporteSafe(obj[10]);
BigDecimal original = BigDecimal.valueOf(Double.valueOf(ori));
String atu = getStringImporteSafe(obj[11]);
BigDecimal atual = BigDecimal.valueOf(Double.valueOf(atu));
row.createCell(IDX_CELL_TARIFAORIGINAL).setCellValue(original.setScale(2).doubleValue());
row.createCell(IDX_CELL_TARIFAATUAL).setCellValue(atual.setScale(2).doubleValue());
String ped = getStringImporteSafe(obj[16]);
BigDecimal pedVal = BigDecimal.valueOf(Double.valueOf(ped));
row.createCell(IDX_CELL_PEDAGIOATUAL).setCellValue(pedVal.setScale(2).doubleValue());
String txEmbarque = getStringImporteSafe(obj[18]);
BigDecimal txEmbarqueVal = BigDecimal.valueOf(Double.valueOf(txEmbarque));
row.createCell(IDX_CELL_TXEMBARQUEATUAL).setCellValue(txEmbarqueVal.setScale(2).doubleValue());
String seguro = getStringImporteSafe(obj[19]);
BigDecimal seguroVal = BigDecimal.valueOf(Double.valueOf(seguro));
row.createCell(IDX_CELL_SEGUROATUAL).setCellValue(seguroVal.setScale(2).doubleValue());
row.createCell(IDX_CELL_ORGAOCONCEDENTE).setCellValue(obj[17].toString());
row.createCell(IDX_CELL_NUMLINHA).setCellValue(obj[20].toString());
row.createCell(IDX_CELL_PREFIXO).setCellValue(obj[21].toString());
String sentido = obj[22].toString();
row.createCell(IDX_CELL_SENTIDO).setCellValue(sentido.equals("1") ? "IDA" : "VOLTA");
// novo preco:
BigDecimal novoPrecio = null;
if (cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TARIFA.getDescricao()) ||
cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TODOS.getDescricao())){
novoPrecio = atual;
novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP);
HSSFCell cellNovoPrecio = row.createCell(IDX_CELL_TARIFA_SIMULADA);//celula alterada
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
cellNovoPrecio.setCellStyle(estilo);
}
if (cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.PEDAGIO.getDescricao())||
cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TODOS.getDescricao())){
if (!validarComponente(obj, ROW_PEDAGIO)){
return false;
}
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
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
cellNovoPrecio.setCellStyle(estilo);
}
if (cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TX_EMBARQUE.getDescricao())||
cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TODOS.getDescricao())){
if (!validarComponente(obj, ROW_TXEMBARQUE)){
return false;
}
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
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
cellNovoPrecio.setCellStyle(estilo);
}
if (cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.SEGURO.getDescricao())||
cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TODOS.getDescricao())){
if (!validarComponente(obj, ROW_SEGURO)){
return false;
}
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
cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue());
cellNovoPrecio.setCellStyle(estilo);
}
return true;
}
}

View File

@ -60,11 +60,11 @@ public class ModificacionMasivaTarifasUploadController extends MyGenericForwardC
private static final long serialVersionUID = 1L;
private final Integer CELL_ID_TARIFA = 0;
private final Integer CELL_NOVO_PRECIO = 11;
private final Integer CELL_NOVO_PRECIO = 10;
// private final Integer CELL_PEAJE = 12;
private final Integer CELL_NOVO_PEAJE = 13;
private final Integer CELL_NOVO_TX_EMBARQUE = 15;
private final Integer CELL_NOVO_SEGURO = 17;
private final Integer CELL_NOVO_PEAJE = 12;
private final Integer CELL_NOVO_TX_EMBARQUE = 14;
private final Integer CELL_NOVO_SEGURO = 16;
@Autowired
private TarifaService tarifaService;

View File

@ -2514,9 +2514,9 @@ modificacionMasivaAliasTarifasController.msg.registroSalvos = registro(s) proces
modificacionMasivaAliasTarifasController.msg.formatoInvalido = Formato deve ser '.xls' ou '.xlsx'.
modificacionMasivaAliasTarifasController.msg.planilhaInvalida = Planilha inválida: colunas não esperadas/faltando.
modificacionMasivaAliasTarifasController.erro.title = Erro
modificacionMasivaAliasTarifasController.lhTipoClasse.label = Tipo de Classe
modificacionMasivaAliasTarifasController.lhOrgao.label = Orgão Concendente
modificacionMasivaAliasTarifasController.lhPrefixo.label = Prefixo
modificacionMasivaAliasTarifasController.lhTipoClasse.label = Tipo de la clase
modificacionMasivaAliasTarifasController.lhOrgao.label = órgano Concendente
modificacionMasivaAliasTarifasController.lhPrefixo.label = Prefijo
# Modificação Massiva Pricing Especifico
@ -6478,7 +6478,6 @@ busquedaImportacionFiscalRelatorioVoucherController.window.title=Impressão Fisc
busquedaImportacionFiscalEcfPendenciaController.window.title=Impressão Fiscal :: Pendência ECF
busquedaImportacionFiscalEcfPendenciaReducaoZController.window.title=Impressão Fiscal :: Pendência Redução Z
busquedaImportacionFiscalEcfReducaoZController.window.title=Impressão Fiscal :: ECF Integrado c/ Redução Z
busquedaImportacionFiscalRelatorioVoucherCanceladosController.window.title=Impressão Fiscal :: Relatório Voucher Cancelados
#OCD
busquedaOCDParamController.empresa.label=Empresa

View File

@ -2256,6 +2256,9 @@ busquedaTarifaController.MSG.categoria = Não foi encontrado nenhum registro com
busquedaTarifaController.MSG.tipoPuntoVenta = Não foi encontrado nenhum registro com esse canal de Venda
busquedaTarifaController.MSG.dadosVazios= Não foram encontrados dados para gerar o arquivo Excel
busquedaTarifaController.lhTodos.label = Todos
busquedaTarifaController.lhSentido.label = Sentido
busquedaTarifaController.lhPrefixo.label = Prefixo
busquedaTarifaController.lhDescLinha.label = Desc. Linha
# Editar Tarifa:
editarTarifaController.window.title = Tarifa