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

@ -427,13 +427,14 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
if (!ruta.equals(obj[4].toString().concat(obj[12].toString()))) {
ruta = obj[4].toString().concat(obj[12].toString());
ruta = obj[4].toString().concat(obj[12].toString());
String sheetName = "";
if (obj[4].toString().length() > 26) {
sheetName = (obj[4].toString().substring(0, 26).concat(" (").concat(obj[12].toString()).concat(")"));
} else {
sheetName = (obj[4].toString().concat(" (").concat(obj[12].toString()).concat(")"));
}
sheetName = sheetName.replaceAll( "/", "-" );
log.debug("Aba: " + sheetName);
sheet1 = wb.createSheet(sheetName);
contRow = 1;
@ -598,7 +599,20 @@ public class ModificacionMasivaTarifasController extends MyGenericForwardCompose
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) {
Comboitem cbiClaseServicio = cmbClaseServicio.getSelectedItem();

View File

@ -16,11 +16,10 @@ import java.util.Calendar;
import java.util.List;
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.Row;
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.context.annotation.Scope;
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.ClaseServicio;
import com.rjconsultores.ventaboletos.entidad.MercadoCompetido;
import com.rjconsultores.ventaboletos.entidad.Moneda;
import com.rjconsultores.ventaboletos.entidad.Parada;
import com.rjconsultores.ventaboletos.entidad.Plaza;
@ -63,11 +61,7 @@ import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
public class ModificacionMasivaTarifasUploadController extends MyGenericForwardComposer {
private final Integer CELL_ID_TARIFA = 0;
private final Integer CELL_NOVO_PRECIO = 8;
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;
private final Integer CELL_NOVO_PRECIO = 11;
@Autowired
private TarifaService tarifaService;
@Autowired
@ -140,7 +134,8 @@ public class ModificacionMasivaTarifasUploadController extends MyGenericForwardC
if (opcao.equals(Messagebox.YES)) {
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++) {
Sheet sheet = wb.getSheetAt(k);
@ -202,6 +197,7 @@ public class ModificacionMasivaTarifasUploadController extends MyGenericForwardC
tarifaNueva.setOrgaoConcedente(tarifa.getOrgaoConcedente());
Comboitem cbiVt = cmbVigenciaTarifa.getSelectedItem();
VigenciaTarifa nuevaVigencia = (VigenciaTarifa) cbiVt.getValue();
tarifaNueva.setVigenciaTarifa(nuevaVigencia);
@ -212,7 +208,7 @@ public class ModificacionMasivaTarifasUploadController extends MyGenericForwardC
if (!existeTarifa) {
strDuplicidade = strDuplicidade + Labels.getLabel("modificacionMasivaTarifasController.MSG.tarifaExiste") + " (" + tarifa.getTarifaId() + "). \n";
} else {
tarifa = tarifaService.suscribir(tarifaNueva);
tarifa = tarifaService.suscribir(tarifaNueva);
}
} else {
@ -374,7 +370,7 @@ public class ModificacionMasivaTarifasUploadController extends MyGenericForwardC
public void vigenciaTarifa() throws IOException, InterruptedException {
try {
InputStream isMExcel = mExcel.getStreamData();
Workbook wb = new XSSFWorkbook(isMExcel);
HSSFWorkbook wb = new HSSFWorkbook(isMExcel);
for (int k = 0; k < wb.getNumberOfSheets(); k++) {
Sheet sheet = wb.getSheetAt(k);