Alteração na classe ModificaionMasivaTarifasController e ModificaionMasivaTarifasUploadController, correção do upload

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@23050 d1611594-4594-4d17-8e1d-87c2c4800839
master
carla 2012-12-10 12:53:50 +00:00
parent 5d08e0e984
commit 21d451b985
2 changed files with 23 additions and 13 deletions

View File

@ -434,6 +434,7 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
} else { } else {
sheetName = (obj[4].toString().concat(" (").concat(obj[12].toString()).concat(")")); sheetName = (obj[4].toString().concat(" (").concat(obj[12].toString()).concat(")"));
} }
sheetName = sheetName.replaceAll( "/", "-" );
log.debug("Aba: " + sheetName); log.debug("Aba: " + sheetName);
sheet1 = wb.createSheet(sheetName); sheet1 = wb.createSheet(sheetName);
contRow = 1; contRow = 1;
@ -598,6 +599,19 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
return v; return v;
} }
public void onClick$btnUpLoadExcel(Event ev) throws InterruptedException,IOException {
Media mExcel = Fileupload.get();
if (mExcel != null) {
Map args = new HashMap();
args.put("mExcel", mExcel);
openWindow("/gui/tarifas/modificacionMasivaTarifasUpload.zul",
Labels.getLabel("modificacionMasivaTarifasController.window.title"), args, MODAL);
}
}
public void onClick$btnAdicionarClaseServicio(Event ev) { public void onClick$btnAdicionarClaseServicio(Event ev) {

View File

@ -16,11 +16,10 @@ import java.util.Calendar;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -38,7 +37,6 @@ import org.zkoss.zul.Radio;
import com.rjconsultores.ventaboletos.entidad.Ciudad; import com.rjconsultores.ventaboletos.entidad.Ciudad;
import com.rjconsultores.ventaboletos.entidad.ClaseServicio; import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
import com.rjconsultores.ventaboletos.entidad.MercadoCompetido;
import com.rjconsultores.ventaboletos.entidad.Moneda; import com.rjconsultores.ventaboletos.entidad.Moneda;
import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.Parada;
import com.rjconsultores.ventaboletos.entidad.Plaza; import com.rjconsultores.ventaboletos.entidad.Plaza;
@ -63,11 +61,7 @@ import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
public class ModificacionMasivaTarifasUploadController extends MyGenericForwardComposer { public class ModificacionMasivaTarifasUploadController extends MyGenericForwardComposer {
private final Integer CELL_ID_TARIFA = 0; private final Integer CELL_ID_TARIFA = 0;
private final Integer CELL_NOVO_PRECIO = 8; private final Integer CELL_NOVO_PRECIO = 11;
private final Integer CELL_ID_CATEGORIA = 10;
private final Integer CELL_NOVO_PRECIO_CATEGORIA = 12;
private final Integer CELL_ID_TIPO_PUNTO = 14;
private final Integer CELL_NOVO_PRECIO_TIPO_PUNTO = 16;
@Autowired @Autowired
private TarifaService tarifaService; private TarifaService tarifaService;
@Autowired @Autowired
@ -140,7 +134,8 @@ public class ModificacionMasivaTarifasUploadController extends MyGenericForwardC
if (opcao.equals(Messagebox.YES)) { if (opcao.equals(Messagebox.YES)) {
InputStream isMExcel = mExcel.getStreamData(); InputStream isMExcel = mExcel.getStreamData();
Workbook wb = new XSSFWorkbook(isMExcel); HSSFWorkbook wb = new HSSFWorkbook(isMExcel);
// Workbook wb = new XSSFWorkbook(isMExcel);
for (int k = 0; k < wb.getNumberOfSheets(); k++) { for (int k = 0; k < wb.getNumberOfSheets(); k++) {
Sheet sheet = wb.getSheetAt(k); Sheet sheet = wb.getSheetAt(k);
@ -202,6 +197,7 @@ public class ModificacionMasivaTarifasUploadController extends MyGenericForwardC
tarifaNueva.setOrgaoConcedente(tarifa.getOrgaoConcedente()); tarifaNueva.setOrgaoConcedente(tarifa.getOrgaoConcedente());
Comboitem cbiVt = cmbVigenciaTarifa.getSelectedItem(); Comboitem cbiVt = cmbVigenciaTarifa.getSelectedItem();
VigenciaTarifa nuevaVigencia = (VigenciaTarifa) cbiVt.getValue(); VigenciaTarifa nuevaVigencia = (VigenciaTarifa) cbiVt.getValue();
tarifaNueva.setVigenciaTarifa(nuevaVigencia); tarifaNueva.setVigenciaTarifa(nuevaVigencia);
@ -212,7 +208,7 @@ public class ModificacionMasivaTarifasUploadController extends MyGenericForwardC
if (!existeTarifa) { if (!existeTarifa) {
strDuplicidade = strDuplicidade + Labels.getLabel("modificacionMasivaTarifasController.MSG.tarifaExiste") + " (" + tarifa.getTarifaId() + "). \n"; strDuplicidade = strDuplicidade + Labels.getLabel("modificacionMasivaTarifasController.MSG.tarifaExiste") + " (" + tarifa.getTarifaId() + "). \n";
} else { } else {
tarifa = tarifaService.suscribir(tarifaNueva); tarifa = tarifaService.suscribir(tarifaNueva);
} }
} else { } else {
@ -374,7 +370,7 @@ public class ModificacionMasivaTarifasUploadController extends MyGenericForwardC
public void vigenciaTarifa() throws IOException, InterruptedException { public void vigenciaTarifa() throws IOException, InterruptedException {
try { try {
InputStream isMExcel = mExcel.getStreamData(); InputStream isMExcel = mExcel.getStreamData();
Workbook wb = new XSSFWorkbook(isMExcel); HSSFWorkbook wb = new HSSFWorkbook(isMExcel);
for (int k = 0; k < wb.getNumberOfSheets(); k++) { for (int k = 0; k < wb.getNumberOfSheets(); k++) {
Sheet sheet = wb.getSheetAt(k); Sheet sheet = wb.getSheetAt(k);