Aggiunta eccezione in caso di file vuoto in importazione bulk file
This commit is contained in:
@@ -27,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
@@ -424,10 +425,15 @@ public class ImportListiniAcquistoApuliaCarrefourService {
|
||||
String[] elencoFile = files.split("\\|");
|
||||
|
||||
//INSERIMENTO DATI IN TABELLE DI APPOGGIO
|
||||
for (int i = 0; i < elencoFile.length; i++) {
|
||||
String fileName = elencoFile[i];
|
||||
for (String fileName : elencoFile) {
|
||||
//Controllo se il file esiste e se non è vuoto
|
||||
File file = new File(pathFile + "/" + fileName + ".csv");
|
||||
|
||||
String fileNamePart = UtilityString.left(elencoFile[i], 3).toUpperCase();
|
||||
if (!file.exists() || !file.isFile() || file.length() <= 0) {
|
||||
throw new Exception("Il file è vuoto o non esiste.");
|
||||
}
|
||||
|
||||
String fileNamePart = UtilityString.left(fileName, 3).toUpperCase();
|
||||
|
||||
switch (fileNamePart) {
|
||||
case "LIS":
|
||||
@@ -503,8 +509,8 @@ public class ImportListiniAcquistoApuliaCarrefourService {
|
||||
ps.close();
|
||||
} catch (SQLException e) {
|
||||
throw new Exception("Impossibile importare il file " + fileName + CommonConstants.A_CAPO + "." +
|
||||
e.getMessage() + CommonConstants.A_CAPO + "." +
|
||||
"Verificare il file, potrebbe essere corrotto o incompleto.");
|
||||
e.getMessage() + CommonConstants.A_CAPO + "." +
|
||||
"Verificare il file, potrebbe essere corrotto o incompleto.");
|
||||
}
|
||||
|
||||
UtilityDB.trimTableColumn(conn, tableName, null);
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package it.integry.ems.retail.wms.dto;
|
||||
|
||||
import it.integry.ems_model.entity.MtbColt;
|
||||
|
||||
public class DuplicateUDSDTO {
|
||||
|
||||
private MtbColt mtbColt;
|
||||
|
||||
public MtbColt getMtbColt() {
|
||||
return mtbColt;
|
||||
}
|
||||
|
||||
public DuplicateUDSDTO setMtbColt(MtbColt mtbColt) {
|
||||
this.mtbColt = mtbColt;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package it.integry.ems.retail.wms.dto;public class DuplicateUDSResponseDTO {
|
||||
}
|
||||
Reference in New Issue
Block a user