From 04aa465659a9a42d92e31ee540eb568d3f1dcca4 Mon Sep 17 00:00:00 2001 From: thiago Date: Wed, 24 Jan 2018 20:44:30 +0000 Subject: [PATCH] =?UTF-8?q?fixed=20bug=20#10509=20-=20Corre=C3=A7=C3=A3o?= =?UTF-8?q?=20de=20erro=20ao=20copiar=20vig=C3=AAncia,=20e=20modifica?= =?UTF-8?q?=C3=A7=C3=A3o=20massiva=20de=20pre=C3=A7os.=20N=C3=A3o=20buscav?= =?UTF-8?q?a=20o=20TPP.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@78331 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../tarifas/EnumTarifaPedagio.java | 1 + .../ModificacionMasivaTarifasController.java | 48 +++++++++++++++---- ...ficacionMasivaTarifasUploadController.java | 19 ++++++++ web/WEB-INF/i3-label_es_MX.label | 2 + web/WEB-INF/i3-label_pt_BR.label | 2 + 5 files changed, 62 insertions(+), 10 deletions(-) diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/EnumTarifaPedagio.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/EnumTarifaPedagio.java index f3dce05be..6614fd8a2 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/EnumTarifaPedagio.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/EnumTarifaPedagio.java @@ -10,6 +10,7 @@ public enum EnumTarifaPedagio { PEDAGIO(Labels.getLabel("busquedaTarifaController.lhPedagio.label")), TX_EMBARQUE(Labels.getLabel("busquedaTarifaController.lhTaxa.label")), SEGURO(Labels.getLabel("busquedaTarifaController.lhPrecioSeguro.label")), + TPP(Labels.getLabel("busquedaTarifaController.lhPrecioTPP.label")), TODOS(Labels.getLabel("busquedaTarifaController.lhTodos.label")); private String descricao; diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/ModificacionMasivaTarifasController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/ModificacionMasivaTarifasController.java index c30ad4195..715b57494 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/ModificacionMasivaTarifasController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/ModificacionMasivaTarifasController.java @@ -181,12 +181,14 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose 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 final int IDX_CELL_SEGUROSIMULADO = 16; + private final int IDX_CELL_TPPATUAL = 17; + private final int IDX_CELL_TPPSIMULADO = 18; + private final int IDX_CELL_ORGAOCONCEDENTE = 19; + private final int IDX_CELL_PREFIXO = 20; + private final int IDX_CELL_VIGENCIA = 21; + private final int IDX_CELL_MOEDA = 22; + private final int IDX_CELL_SENTIDO = 23; private static Logger log = Logger.getLogger(ModificacionMasivaTarifasController.class); @@ -815,6 +817,14 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose XSSFCell cellSeguroSimulado = rowCabecalho.createCell(IDX_CELL_SEGUROSIMULADO); cellSeguroSimulado.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioSeguroSimulado.label")); cellSeguroSimulado.setCellStyle(estilo); + + XSSFCell cellTPPAtual = rowCabecalho.createCell(IDX_CELL_TPPATUAL); + cellTPPAtual.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioTPPAtual.label")); + cellTPPAtual.setCellStyle(estilo); + + XSSFCell cellTPPSimulado = rowCabecalho.createCell(IDX_CELL_TPPSIMULADO); + cellTPPSimulado.setCellValue(Labels.getLabel("busquedaTarifaController.lhPrecioTPPSimulado.label")); + cellTPPSimulado.setCellStyle(estilo); XSSFCell cellOrgaoConcedente = rowCabecalho.createCell(IDX_CELL_ORGAOCONCEDENTE); cellOrgaoConcedente.setCellValue(Labels.getLabel("busquedaTarifaController.lhOrgaoLabel.label")); @@ -876,14 +886,18 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose 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_SEGUROATUAL).setCellValue(seguroVal.setScale(2).doubleValue()); + + String tpp = getStringImporteSafe(obj[20]); + BigDecimal tppVal = BigDecimal.valueOf(Double.valueOf(tpp)); + row.createCell(IDX_CELL_TPPATUAL).setCellValue(tppVal.setScale(2).doubleValue()); row.createCell(IDX_CELL_ORGAOCONCEDENTE).setCellValue(obj[17].toString()); - row.createCell(IDX_CELL_NUMLINHA).setCellValue(obj[20] == null?"":obj[20].toString()); - row.createCell(IDX_CELL_PREFIXO).setCellValue(obj[21] == null?"":obj[21].toString()); + row.createCell(IDX_CELL_NUMLINHA).setCellValue(obj[21] == null?"":obj[21].toString()); + row.createCell(IDX_CELL_PREFIXO).setCellValue(obj[22] == null?"":obj[22].toString()); - String sentido = obj[22].toString(); + String sentido = obj[23].toString(); row.createCell(IDX_CELL_SENTIDO).setCellValue(sentido.equals("1") ? "IDA" : "VOLTA"); // novo preco: @@ -945,6 +959,20 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose cellNovoPrecio.setCellStyle(estilo); } + if (cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TPP.getDescricao())|| + cmbComponentePreco.getSelectedItem().getValue().equals(EnumTarifaPedagio.TODOS.getDescricao())){ + + if (!validarComponente(obj, IDX_CELL_TPPATUAL)){ + return false; + } + + novoPrecio = BigDecimal.valueOf(Double.valueOf(getStringImporteSafe(obj[20]))); + novoPrecio = novoPrecio.multiply(coeficiente).setScale(2, RoundingMode.HALF_UP); + + XSSFCell cellNovoPrecio = row.createCell(IDX_CELL_TPPSIMULADO); //celula alterada + cellNovoPrecio.setCellValue(novoPrecio.setScale(2).doubleValue()); + cellNovoPrecio.setCellStyle(estilo); + } return true; } } diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/ModificacionMasivaTarifasUploadController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/ModificacionMasivaTarifasUploadController.java index 0519b0b7a..fc18c0b3a 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/ModificacionMasivaTarifasUploadController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/tarifas/ModificacionMasivaTarifasUploadController.java @@ -66,6 +66,7 @@ public class ModificacionMasivaTarifasUploadController extends MyGenericForwardC private final Integer CELL_NOVO_PEAJE = 12; private final Integer CELL_NOVO_TX_EMBARQUE = 14; private final Integer CELL_NOVO_SEGURO = 16; + private final Integer CELL_NOVO_TPP = 18; @Autowired private TarifaService tarifaService; @@ -471,6 +472,15 @@ public class ModificacionMasivaTarifasUploadController extends MyGenericForwardC tarifaNueva.setImporteseguro(novoPrecio); } + + if (componentePreco.equals(EnumTarifaPedagio.TPP.getDescricao()) || + (componentePreco.equals(EnumTarifaPedagio.TODOS.getDescricao()) && row.getCell(CELL_NOVO_TPP) != null)){ + cellNovoPrecio = row.getCell(CELL_NOVO_TPP); + BigDecimal novoPrecio = new BigDecimal(cellNovoPrecio.getNumericCellValue()); + novoPrecio = novoPrecio.setScale(2, RoundingMode.HALF_UP); + + tarifaNueva.setImporteTPP(novoPrecio); + } tarifaNueva.setPrecioredabierto(tarifa.getPrecioredabierto()); tarifaNueva.setStatustarifa("A"); @@ -537,6 +547,15 @@ public class ModificacionMasivaTarifasUploadController extends MyGenericForwardC tarifa.setImporteseguro(novoPrecio); } + + if (componentePreco.equals(EnumTarifaPedagio.TPP.getDescricao()) || + (componentePreco.equals(EnumTarifaPedagio.TODOS.getDescricao()) && row.getCell(CELL_NOVO_TPP) != null)) { + cellNovoPrecio = row.getCell(CELL_NOVO_TPP); + BigDecimal novoPrecio = new BigDecimal(cellNovoPrecio.getNumericCellValue()); + novoPrecio = novoPrecio.setScale(2, RoundingMode.HALF_UP); + + tarifa.setImporteTPP(novoPrecio); + } tarifa.setStatustarifa("A"); diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label index 9b4fdc11e..ab8e9b9e4 100644 --- a/web/WEB-INF/i3-label_es_MX.label +++ b/web/WEB-INF/i3-label_es_MX.label @@ -2491,6 +2491,8 @@ busquedaTarifaController.lhPrecioSeguroAtual.label = Seguro Atual busquedaTarifaController.lhPrecioSeguroSimulado.label = Seguro Simulado busquedaTarifaController.lhPrecioTxEmbarque.label = Tx. Embarque Atual busquedaTarifaController.lhPrecioTxEmbarqueSimulado.label = Tx. Embarque Simulado +busquedaTarifaController.lhPrecioTPPAtual.label = TPP Atual +busquedaTarifaController.lhPrecioTPPSimulado.label = TPP Simulado busquedaTarifaController.lhMarca.label = Marca busquedaTarifaController.lhOrigen.label = Origen busquedaTarifaController.lhDestino.label = Destino diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index 16d609440..78a4cc87f 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -2674,6 +2674,8 @@ busquedaTarifaController.lhPrecioPedagio.label = Pedágio Atual busquedaTarifaController.lhPrecioPedagioNuevo.label = Pedágio Simulado busquedaTarifaController.lhPrecioSeguroAtual.label = Seguro Atual busquedaTarifaController.lhPrecioSeguroSimulado.label = Seguro Simulado +busquedaTarifaController.lhPrecioTPPAtual.label = TPP Atual +busquedaTarifaController.lhPrecioTPPSimulado.label = TPP Simulado busquedaTarifaController.lhPrecioTxEmbarque.label = Tx. Embarque Atual busquedaTarifaController.lhPrecioTxEmbarqueSimulado.label = Tx. Embarque Simulado busquedaTarifaController.lhMarca.label = Marca