|
|
|
|
@@ -5,6 +5,7 @@ import it.valueteam.gnp.dao.db.hb.*;
|
|
|
|
|
import it.valueteam.gnp.internalflow.out.InternalSenderProcess;
|
|
|
|
|
import it.valueteam.gnp.log.Loggable;
|
|
|
|
|
import it.valueteam.gnp.log.ProcessLogger;
|
|
|
|
|
import java.text.*;
|
|
|
|
|
import it.valueteam.gnp.obj.LogInfo;
|
|
|
|
|
import it.valueteam.gnp.obj.LogProcess;
|
|
|
|
|
import it.valueteam.gnp.utility.DateUtils;
|
|
|
|
|
@@ -18,13 +19,14 @@ import java.io.FileInputStream;
|
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
|
|
public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Loggable, ProcessIF {
|
|
|
|
|
private ProcessLogger log;
|
|
|
|
|
|
|
|
|
|
//TODO verificare il codice processo
|
|
|
|
|
private static final String codiceProcesso = "IG";
|
|
|
|
|
private static final String versione = "1.0.0";
|
|
|
|
|
private final static String codiceProcesso = "ER";
|
|
|
|
|
private final static String versione = "1.0.0";
|
|
|
|
|
private String SEPARATOR = ";";
|
|
|
|
|
|
|
|
|
|
private static final String CTR = ".ctr";
|
|
|
|
|
@@ -39,9 +41,12 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
private static final String DEL_103 = "Del. 103";
|
|
|
|
|
private static final String DEL_103_NATOLO_TIPOUSCITA = "Uscite 103 Donor Nativo OLO";
|
|
|
|
|
private static final String DEL_103_STD_VOIP_TIPOUSCITA = "Uscite 103 Standard o VOIP";
|
|
|
|
|
private static final String DATACESSAZIONE_FORMAT = new String("dd/MM/yyyy");
|
|
|
|
|
private static final String DATACESSAZIONE_FORMAT = new String("yyyy-MM-dd");
|
|
|
|
|
private static final String REGEXP_SALDINETTI_LINE = "^(\\d{1,22});([^;]{0,15});([^;]{0,50});((\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01]))|);([^;]{0,1000});([^;]{0,1000});([^;]{0,1000});([^;]{0,1000});([^;]{0,1000});([^;]{0,1000})$";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int rowError= 0;
|
|
|
|
|
private int numRowFile= 0;
|
|
|
|
|
|
|
|
|
|
public Dwhe2eRepoSaldiNettiIn() throws Exception {
|
|
|
|
|
try {
|
|
|
|
|
@@ -65,7 +70,7 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
* @param args String[]
|
|
|
|
|
*/
|
|
|
|
|
public void execute(String[] args) throws Exception {
|
|
|
|
|
log.write("9999", " EXECUTE Dwhe2eRepoSaldiNettiIn ");
|
|
|
|
|
log.write("9999", "Start EXECUTE Dwhe2eRepoSaldiNettiIn ");
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
readFile();
|
|
|
|
|
@@ -76,6 +81,8 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
//Termino l'esecuzione ritornando un errore a chi mi ha eseguito
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.write("9999", "End EXECUTE Dwhe2eRepoSaldiNettiIn ");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -83,26 +90,43 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
|
|
|
|
|
log.write("9999", "Start readFile");
|
|
|
|
|
|
|
|
|
|
//leggo i file da cartella CO
|
|
|
|
|
List<String> listFileName = getListFileName(Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_CON_IN());
|
|
|
|
|
readFilesAndStore(listFileName);
|
|
|
|
|
//per ogni nome file
|
|
|
|
|
for(String fileName : listFileName){
|
|
|
|
|
List<String> listFileName;
|
|
|
|
|
try {
|
|
|
|
|
//leggo i file da cartella CO
|
|
|
|
|
listFileName = getListFileName(Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_CON_IN());
|
|
|
|
|
readFilesAndStore(listFileName);
|
|
|
|
|
//per ogni nome file
|
|
|
|
|
for(String fileName : listFileName){
|
|
|
|
|
|
|
|
|
|
String estensioneFname = fileName.substring(fileName.lastIndexOf("."),fileName.length());
|
|
|
|
|
if (estensioneFname.equals(Resources.getDWHE2E_REPOSALDINETTI_FILENAME_EXT())) {
|
|
|
|
|
String estensioneFname = fileName.substring(fileName.lastIndexOf("."),fileName.length());
|
|
|
|
|
if (estensioneFname.equals(Resources.getDWHE2E_REPOSALDINETTI_FILENAME_EXT())) {
|
|
|
|
|
|
|
|
|
|
//aggiungo a DBCFX_DWHE2E_USCITE_XXX_ + yyyymmdd.csv al nome file
|
|
|
|
|
String nomeFileOut = Resources.getDWHE2E_REPOSALDINETTI_NOME_FILE_CON_OUT();
|
|
|
|
|
nomeFileOut += DateUtils.toString(new Date(), Resources.getDWHE2E_REPOSALDINETTI_DATA_FILENAME()) + Resources.getDWHE2E_REPOSALDINETTI_FILENAME_EXT();
|
|
|
|
|
//aggiungo a DBCFX_DWHE2E_USCITE_XXX_ + yyyymmdd.csv al nome file
|
|
|
|
|
String nomeFileOut = Resources.getDWHE2E_REPOSALDINETTI_NOME_FILE_CON_OUT();
|
|
|
|
|
nomeFileOut += DateUtils.toString(new Date(), Resources.getDWHE2E_REPOSALDINETTI_DATA_FILENAME()) + Resources.getDWHE2E_REPOSALDINETTI_FILENAME_EXT();
|
|
|
|
|
|
|
|
|
|
generaFileOut(generaRecordAndStoreOut(fileName,nomeFileOut),
|
|
|
|
|
nomeFileOut,
|
|
|
|
|
Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_CON_OUT());
|
|
|
|
|
|
|
|
|
|
numRowFile = ((numRowFile==-1)?0:numRowFile);
|
|
|
|
|
log.write("9999", "--------- Report summary CO nomeFile: " + fileName + " ---------");
|
|
|
|
|
log.write("9999", "Numero righe totali: " + numRowFile);
|
|
|
|
|
log.write("9999", "Numero righe elaborate correttamente: " + (numRowFile - rowError));
|
|
|
|
|
log.write("9999", "Numero righe in errore: " + rowError);
|
|
|
|
|
log.write("9999", "--------- Report summary CO fine ---------");
|
|
|
|
|
|
|
|
|
|
numRowFile = 0;
|
|
|
|
|
rowError = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
generaFileOut(generaRecordAndStoreOut(fileName,nomeFileOut),
|
|
|
|
|
nomeFileOut,
|
|
|
|
|
Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_CON_OUT(),
|
|
|
|
|
fileName);
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
log.write("9999", "Eccezione: " + e.getMessage());
|
|
|
|
|
log.write("9999", "Eccezione generica nell'elaborazione de file CO. Continuo con BU!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//leggo i file da cartella BU
|
|
|
|
|
listFileName = getListFileName(Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_BUS_IN());
|
|
|
|
|
readFilesAndStore(listFileName);
|
|
|
|
|
@@ -113,22 +137,37 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
if (estensioneFname.equals(Resources.getDWHE2E_REPOSALDINETTI_FILENAME_EXT())) {
|
|
|
|
|
|
|
|
|
|
//aggiungo a DBCFX_DWHE2E_USCITE_XXX_ + yyyymmdd.csv al nome file
|
|
|
|
|
String nomeFileOut = Resources.getDWHE2E_REPOSALDINETTI_NOME_FILE_CON_OUT();
|
|
|
|
|
String nomeFileOut = Resources.getDWHE2E_REPOSALDINETTI_NOME_FILE_BUS_OUT();
|
|
|
|
|
nomeFileOut += DateUtils.toString(new Date(), Resources.getDWHE2E_REPOSALDINETTI_DATA_FILENAME()) + Resources.getDWHE2E_REPOSALDINETTI_FILENAME_EXT();
|
|
|
|
|
|
|
|
|
|
generaFileOut(generaRecordAndStoreOut(fileName,nomeFileOut),
|
|
|
|
|
Resources.getDWHE2E_REPOSALDINETTI_NOME_FILE_BUS_OUT(),
|
|
|
|
|
Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_BUS_OUT(),
|
|
|
|
|
fileName);
|
|
|
|
|
nomeFileOut,
|
|
|
|
|
Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_BUS_OUT());
|
|
|
|
|
|
|
|
|
|
numRowFile = ((numRowFile==-1)?0:numRowFile);
|
|
|
|
|
log.write("9999", "--------- Report summary BU nomeFile: " + fileName + " ---------");
|
|
|
|
|
log.write("9999", "Numero righe totali: " + numRowFile);
|
|
|
|
|
log.write("9999", "Numero righe elaborate correttamente: " + (numRowFile - rowError));
|
|
|
|
|
log.write("9999", "Numero righe in errore: " + rowError);
|
|
|
|
|
log.write("9999", "--------- Report summary BU fine ---------");
|
|
|
|
|
|
|
|
|
|
numRowFile = 0;
|
|
|
|
|
rowError = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
log.write("9999", "End readFile");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}//chiude metodo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Ritorna la lista dei nomi file presenti in folderName
|
|
|
|
|
*
|
|
|
|
|
* @param folderName
|
|
|
|
|
*/
|
|
|
|
|
private List<String> getListFileName(String folderName) throws Exception {
|
|
|
|
|
log.write("9999", "Start getListFileName folder IN locale name "+folderName);
|
|
|
|
|
log.write("9999", "Start getListFileName. Prelevo i nomi file da: "+folderName);
|
|
|
|
|
List<String> listFileName = new ArrayList<String>();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
@@ -142,7 +181,8 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch(Exception ex) {
|
|
|
|
|
log.write("9999", "Excetpion in getListFileName " +ex.getMessage());
|
|
|
|
|
log.write("9999", "Exception in getListFileName per la lettura dei fileName al path:" + folderName);
|
|
|
|
|
log.write("9999", "Exception: " +ex.getMessage());
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -151,6 +191,12 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
return listFileName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Scorre i file, crea la lista di oggetti formati dalle righe del .csv,
|
|
|
|
|
* popola i parametri aggiuntivi e salva nel DB
|
|
|
|
|
*
|
|
|
|
|
* @param listFileName
|
|
|
|
|
*/
|
|
|
|
|
private void readFilesAndStore(List<String> listFileName) throws Exception {
|
|
|
|
|
log.write("9999", "Start readFilesAndStore");
|
|
|
|
|
|
|
|
|
|
@@ -179,6 +225,13 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Legge il file e ritorna una lista di oggetti che rappresentano le righe
|
|
|
|
|
* del .csv
|
|
|
|
|
*
|
|
|
|
|
* @param fileName
|
|
|
|
|
* @param piattaforma
|
|
|
|
|
*/
|
|
|
|
|
private List<GnpDwhe2eSaldinettiIn> readFileAndGetList(String fileName, String piattaforma) throws Exception {
|
|
|
|
|
log.write("9999", "Start readFileAndGetList");
|
|
|
|
|
|
|
|
|
|
@@ -190,7 +243,7 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
String pathBackupFile = (piattaforma == this.CONSUMER) ? Resources.getDWHE2E_REPOSALDINETTI_CON_BACKUP_IN()
|
|
|
|
|
: Resources.getDWHE2E_REPOSALDINETTI_BUS_BACKUP_IN();
|
|
|
|
|
|
|
|
|
|
log.write("9999", "file da elaborare "+pathLetturaFile+fileName);
|
|
|
|
|
log.write("9999", "file da elaborare "+ pathLetturaFile + fileName);
|
|
|
|
|
File wlFile = new File(pathLetturaFile+fileName);
|
|
|
|
|
|
|
|
|
|
Scanner reader = new Scanner(wlFile);
|
|
|
|
|
@@ -202,15 +255,29 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
//salto l'header del file
|
|
|
|
|
if(row == firstRowHeader) {
|
|
|
|
|
reader.nextLine();
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
//passo FILE_NAME e PIATTAFORMA per inserirli nella tabella
|
|
|
|
|
GnpDwhe2eSaldinettiIn gnpDwhe2eSaldinettiIn = getDataFromLine(reader.nextLine(),fileName,piattaforma);
|
|
|
|
|
listForFile.add(gnpDwhe2eSaldinettiIn);
|
|
|
|
|
String nextLine = reader.nextLine();
|
|
|
|
|
|
|
|
|
|
//gestisco con try catch, se non riesco a creare l'oggetto allora non lo inserisco
|
|
|
|
|
try {
|
|
|
|
|
//passo FILE_NAME e PIATTAFORMA per inserirli nella tabella
|
|
|
|
|
GnpDwhe2eSaldinettiIn gnpDwhe2eSaldinettiIn = getDataFromLine(nextLine,fileName,piattaforma);
|
|
|
|
|
if(gnpDwhe2eSaldinettiIn!=null)
|
|
|
|
|
listForFile.add(gnpDwhe2eSaldinettiIn);
|
|
|
|
|
else {
|
|
|
|
|
rowError++;
|
|
|
|
|
log.write("9999", "Errore record nel formato della linea " + (row +1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
log.write("9999", "Errore generico alla linea " + (row + 1) +" : "+nextLine);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
row++;
|
|
|
|
|
}
|
|
|
|
|
reader.close();
|
|
|
|
|
|
|
|
|
|
numRowFile= row - 1;
|
|
|
|
|
//arrivato qui, è andato tutto a buon fine, allora sposto .csv e .ctr
|
|
|
|
|
//Creo la directory (se non esite) dove spostare tutti i file
|
|
|
|
|
File copiaBk = new File(pathBackupFile);
|
|
|
|
|
@@ -226,7 +293,6 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
// TODO gestisci gli errori
|
|
|
|
|
log.write("9999", "exception in readFileAndGetList "+e.getMessage());
|
|
|
|
|
throw e;
|
|
|
|
|
}
|
|
|
|
|
@@ -234,10 +300,16 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
return listForFile;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sposta inFile in sDir
|
|
|
|
|
*
|
|
|
|
|
* @param sDir
|
|
|
|
|
* @param inFile
|
|
|
|
|
*/
|
|
|
|
|
private void spostaFile(String sDir, File inFile) throws Exception
|
|
|
|
|
{
|
|
|
|
|
log.write("9999", "Start spostaFile");
|
|
|
|
|
log.write("9999","Sposto il file : " + inFile.getName());
|
|
|
|
|
log.write("9999","Sposto il file : " + inFile.getName() + " al path: " + sDir);
|
|
|
|
|
File out = new File(sDir + inFile.getName() );
|
|
|
|
|
FileInputStream fis = new FileInputStream(inFile);
|
|
|
|
|
FileOutputStream fos = new FileOutputStream(out);
|
|
|
|
|
@@ -249,23 +321,26 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
//chiudo i canali
|
|
|
|
|
fis.close();
|
|
|
|
|
fos.close();
|
|
|
|
|
log.write("9999","Cancello file : " + inFile.getName());
|
|
|
|
|
log.write("9999", "End spostaFile");
|
|
|
|
|
inFile.delete();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private GnpDwhe2eSaldinettiIn getDataFromLine(String line, String nomeFile, String piattaforma) throws Exception {
|
|
|
|
|
log.write("9999", "start getDataFromLine line= "+line);
|
|
|
|
|
|
|
|
|
|
Pattern p = Pattern.compile(this.REGEXP_SALDINETTI_LINE);
|
|
|
|
|
Matcher m = p.matcher(line);
|
|
|
|
|
|
|
|
|
|
// se la linea non è formattata correttamente allora la skippo, e proseguo con la prossima linea
|
|
|
|
|
if(!m.matches()){
|
|
|
|
|
return null ;
|
|
|
|
|
}
|
|
|
|
|
String[] parts = line.split(this.SEPARATOR);
|
|
|
|
|
|
|
|
|
|
GnpDwhe2eSaldinettiIn gnpDwhe2eSaldinettiIn = new GnpDwhe2eSaldinettiIn();
|
|
|
|
|
gnpDwhe2eSaldinettiIn.setNomeFile(nomeFile);
|
|
|
|
|
gnpDwhe2eSaldinettiIn.setCrm(piattaforma);
|
|
|
|
|
|
|
|
|
|
//se manca l' ID_RICHIESTA, si romper il parse e non calcola il record
|
|
|
|
|
if (0<parts.length)
|
|
|
|
|
gnpDwhe2eSaldinettiIn.setIdRichiesta(Long.valueOf(parts[0]));
|
|
|
|
|
|
|
|
|
|
@@ -275,8 +350,13 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
if (2<parts.length)
|
|
|
|
|
gnpDwhe2eSaldinettiIn.setCor(parts[2]);
|
|
|
|
|
|
|
|
|
|
if (3<parts.length)
|
|
|
|
|
gnpDwhe2eSaldinettiIn.setE2eDataCessazione(DateUtils.toDate(parts[3],DATACESSAZIONE_FORMAT));
|
|
|
|
|
if (3<parts.length){
|
|
|
|
|
try{
|
|
|
|
|
gnpDwhe2eSaldinettiIn.setE2eDataCessazione(DateUtils.toDate(parts[3],DATACESSAZIONE_FORMAT));
|
|
|
|
|
} catch (ParseException e){
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (4<parts.length)
|
|
|
|
|
gnpDwhe2eSaldinettiIn.setE2eServizioAccesso(parts[4]);
|
|
|
|
|
@@ -296,9 +376,7 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
if (9<parts.length)
|
|
|
|
|
gnpDwhe2eSaldinettiIn.setE2eDimensione5(parts[9]);
|
|
|
|
|
|
|
|
|
|
log.write("9999", "Oggetto creato GnpDwhe2eSaldinettiIn = "+gnpDwhe2eSaldinettiIn.toString());
|
|
|
|
|
|
|
|
|
|
log.write("9999", "End getDataFromLine");
|
|
|
|
|
|
|
|
|
|
return gnpDwhe2eSaldinettiIn;
|
|
|
|
|
}
|
|
|
|
|
@@ -326,7 +404,7 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
//effettua la ricerca nelle tabelle sfruttando ID_RICHIESTA per poi aggiorna i campi dbcfx
|
|
|
|
|
//effettua la ricerca nelle tabelle sfruttando ID_RICHIESTA, aggiorna i campi dbcfx e SE trova allora salva
|
|
|
|
|
for(GnpDwhe2eSaldinettiIn dwhe2eItem : gnpDwhe2eSaldinettiIn ){
|
|
|
|
|
// del. 82
|
|
|
|
|
GnpRichiesteDonor82 gnpRichiestaDonor82 = daoRichiesteD82.findById(dwhe2eItem.getIdRichiesta());
|
|
|
|
|
@@ -353,7 +431,13 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
if(gnpRichiesteCsNpg!=null && gnpRichiesteCsNpg.getProcesso().equalsIgnoreCase("CSNPg103")){
|
|
|
|
|
dwhe2eItem.popolaAggiuntiviFX(gnpRichiesteCsNpg.getCodOpRecipient(),this.DEL_103_STD_VOIP_TIPOUSCITA, this.DEL_103);
|
|
|
|
|
dwhe2eSaldinettiInDAO.save(dwhe2eItem);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//se soon arrivato qui, allora non c'è corrispondenza nel DB dell'ID_RICHIESTA
|
|
|
|
|
log.write("9999", "ID_RICHIESTA non trovato a DB: " + dwhe2eItem.getIdRichiesta());
|
|
|
|
|
//aggiungo errori legati alla mancata presenza dell'ID_RICHIESTA tra le varie delibere
|
|
|
|
|
rowError++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UserTransactionUtility.endUserTransaction(utx, true);
|
|
|
|
|
@@ -375,8 +459,9 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
log.write("9999", "End aggiungiInfoAndSave");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//TODO
|
|
|
|
|
|
|
|
|
|
private List<GnpDwhe2eSaldinettiOut> generaRecordAndStoreOut(String fileNameIn, String fileNameOut) throws Exception {
|
|
|
|
|
log.write("9999", "Start generaRecordAndStoreOut");
|
|
|
|
|
|
|
|
|
|
UserTransaction utx;
|
|
|
|
|
try {
|
|
|
|
|
@@ -386,7 +471,6 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
throw e;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.write("9999", "Start generaRecordAndStoreOut");
|
|
|
|
|
GnpDwhe2eSaldinettiOutDAO saldinettiOutDAO =new GnpDwhe2eSaldinettiOutDAO();
|
|
|
|
|
GnpDwhe2eSaldinettiInDAO saldinettiInDAO =new GnpDwhe2eSaldinettiInDAO();
|
|
|
|
|
|
|
|
|
|
@@ -396,13 +480,14 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
List<GnpDwhe2eSaldinettiOut> listSaldinettiOut = saldinettiInDAO.groupBy(fileNameIn);
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
log.write("9999", "Inizio salvataggio in GNP_DWHE2E_SALDINETTI_OUT per i record che POPOLERANNO il file " + fileNameOut);
|
|
|
|
|
//salva i record nella tabella di out
|
|
|
|
|
for(GnpDwhe2eSaldinettiOut itemOut : listSaldinettiOut){
|
|
|
|
|
itemOut.setNomeFile(fileNameOut);
|
|
|
|
|
saldinettiOutDAO.save(itemOut);
|
|
|
|
|
}
|
|
|
|
|
UserTransactionUtility.endUserTransaction(utx, true);
|
|
|
|
|
|
|
|
|
|
log.write("9999", "Fine salvataggio");
|
|
|
|
|
}catch (Exception ex) {
|
|
|
|
|
try {
|
|
|
|
|
log.write("9999", "UserTransactionUtility.endUserTransaction rollback");
|
|
|
|
|
@@ -425,15 +510,13 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//TODO
|
|
|
|
|
private void generaFileOut(List<GnpDwhe2eSaldinettiOut> results, String nomeFileOut, String pathFileDwhe2eOut, String nomeFileIn ){
|
|
|
|
|
private void generaFileOut(List<GnpDwhe2eSaldinettiOut> results, String nomeFileOut, String pathFileDwhe2eOut ){
|
|
|
|
|
log.write("9999", "Start generaFileOut");
|
|
|
|
|
// DAO out
|
|
|
|
|
GnpDwhe2eSaldinettiOutDAO saldinettiOutDAO =new GnpDwhe2eSaldinettiOutDAO();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
log.write("9999", "TROVATI " + results.size() + " RECORD DA INSERIRE NEL FILE PER DWHE2E SALDI NETTI - FILENAME: " + nomeFileOut);
|
|
|
|
|
log.write("9999", "TROVATI " + results.size() + " RECORD AGGREGATI da inserire nel file di output - FILENAME: " + nomeFileOut);
|
|
|
|
|
if (results.isEmpty()) {
|
|
|
|
|
log.write("9999", "NESSUN DATO RECUPERATO PER DWHE2E SALDI NETTI ");
|
|
|
|
|
return;
|
|
|
|
|
@@ -502,17 +585,15 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|
|
|
|
*/
|
|
|
|
|
private String generaRecord(List<String> campi) {
|
|
|
|
|
String record = "";
|
|
|
|
|
/* l'ultimo campo è senza ;
|
|
|
|
|
|
|
|
|
|
for(int i=0; i<campi.size();i++){
|
|
|
|
|
if(i<campi.size()-1)
|
|
|
|
|
if(i < campi.size()-1)
|
|
|
|
|
record +=campi.get(i) + SEPARATOR;
|
|
|
|
|
else
|
|
|
|
|
// l'ultimo campo è senza ;
|
|
|
|
|
record +=campi.get(i) ;
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
for (String campo : campi) {
|
|
|
|
|
record += campo + SEPARATOR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return record;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|