sistemare la procedura di apulia affinchè possa lavorare in ascolto sulla directory

This commit is contained in:
2024-09-20 15:22:18 +02:00
parent 663acfee7e
commit efeacadb33
3 changed files with 15 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ package it.integry.ems_model.utility;
import it.integry.ems.Import.dto.ImportRequestDTO;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellUtil;
@@ -9,6 +10,8 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Iterator;
@@ -94,7 +97,16 @@ public class UtilityExcel {
* @throws Exception if an error occurs while reading the file or if the file is empty
*/
public static Iterator<Row> readXlsxFile(ImportRequestDTO requestDTO, boolean ignoreHeader) throws Exception {
InputStream stream = new ByteArrayInputStream(Base64.decodeBase64(requestDTO.getRawContentB64()));
InputStream stream = null;
if (requestDTO.getRawContentB64() != null )
stream = new ByteArrayInputStream(Base64.decodeBase64(requestDTO.getRawContentB64()));
else if (requestDTO.getRawContent() != null ) {
File file = new File(requestDTO.getPathFile());
stream = Files.newInputStream(file.toPath());
}
//stream = IOUtils.toInputStream(requestDTO.getRawContent(), StandardCharsets.UTF_8);
else
throw new Exception("Errore nella lettura del file");
return readXlsxFile(stream,ignoreHeader);
}

View File

@@ -24,6 +24,7 @@ import it.integry.ems_model.entity.common.DtbBaseDocT;
import it.integry.ems_model.service.SetupGest;
import it.integry.ems_model.types.OperationType;
import it.integry.ems_model.utility.*;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;

View File

@@ -756,7 +756,7 @@ public class SystemController {
if (!UtilityString.isNullOrEmpty(emailAssegnatoA)) {
if (UtilityString.isNullOrEmpty(emailTo) )
emailTo = UtilityString.emptyStr2Null(emailAssegnatoA);
emailTo = UtilityString.streNull(emailAssegnatoA);
else
listEmailCcn.add( emailAssegnatoA );
}