fixes bug#24703

AL-1236
qua:
dev:Valdir

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@113903 d1611594-4594-4d17-8e1d-87c2c4800839
master
valdevir 2022-08-18 20:05:02 +00:00
parent 113fe7319d
commit 1b0e1430ce
1 changed files with 19 additions and 8 deletions

View File

@ -207,23 +207,34 @@ public class ModificacionMasivaPricingEspecificoUploadController extends MyGener
private Date getDatePorRow(Row row, int numeroCell, StringBuilder erro) throws ParseException { private Date getDatePorRow(Row row, int numeroCell, StringBuilder erro) throws ParseException {
Cell cell = row.getCell(numeroCell); Cell cell = row.getCell(numeroCell);
String nome = getNomeCell(numeroCell); String nome = getNomeCell(numeroCell);
Date date =null;
try { try {
if (cell == null) { if (cell == null) {
return null; return null;
} }
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
date = cell.getDateCellValue();
}else{
if (cell.getStringCellValue() == null) { if (cell.getStringCellValue() == null) {
return null; return null;
} }
DateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); DateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
Date date = format.parse(cell.getStringCellValue()); date = format.parse(cell.getStringCellValue());
return date; }
} catch (Exception ex) {
} catch (ParseException ex) {
erro.append("Coluna '" + nome + "' da linha " + row.getRowNum() + " está fora do formato.\n"); erro.append("Coluna '" + nome + "' da linha " + row.getRowNum() + " está fora do formato.\n");
return null; return null;
} catch (IllegalStateException ex) {
erro.append("Coluna '" + nome + "' da linha " + row.getRowNum() + ". Tipo da coluna divergente com dado informado. Ex.: Número no lugar do texto\n");
return null;
} catch (Exception ex) {
erro.append("Coluna '" + nome + "' da linha " + row.getRowNum() + ". Erro desconhecido\n");
return null;
} }
return date;
} }
private Boolean isCancelar(Row row) { private Boolean isCancelar(Row row) {