327915 - Modifica flussi Cubo Saldi Netti (Consumer e Business) - Fine -
This commit is contained in:
@@ -21,8 +21,8 @@ check_rc=`$THIS_PATH/is_Running_Script.sh $THIS $$`
|
||||
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo '****** elaborazione DHWE2E Report Saldi Netti file CO e BU ' $adesso Start DWHE2E_REPORT >> $LOG
|
||||
$THIS_PATH/ProcessExecutor.sh it.valueteam.gnp.internalflow.in.Dwhe2eRepoSaldiNettiIn>> $LOG
|
||||
echo '****** elaborazione DHWE2E Report Saldi Netti file. L argomento è CO oppure BU ' $adesso Start DWHE2E_REPORT >> $LOG
|
||||
$THIS_PATH/ProcessExecutor.sh it.valueteam.gnp.internalflow.in.Dwhe2eRepoSaldiNettiIn $1>> $LOG
|
||||
else
|
||||
echo " (WARNING) $(date) Esecuzione non avvenuta per presenza processo precedente : $prog" >> $LOG
|
||||
fi
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
45 3 * * 1-6 /gnpapp/script/Dwhe2eRepoSaldiNettiIn.sh
|
||||
0 16 * * 0 /gnpapp/script/Dwhe2eRepoSaldiNettiIn.sh
|
||||
45 3 * * 1-6 /gnpapp/script/Dwhe2eRepoSaldiNettiIn.sh CO
|
||||
0 16 * * 0 /gnpapp/script/Dwhe2eRepoSaldiNettiIn.sh CO
|
||||
|
||||
45 3 * * 1-6 /gnpapp/script/Dwhe2eRepoSaldiNettiIn.sh BU
|
||||
0 16 * * 0 /gnpapp/script/Dwhe2eRepoSaldiNettiIn.sh BU
|
||||
|
||||
@@ -73,7 +73,8 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
||||
log.write("9999", "Start EXECUTE Dwhe2eRepoSaldiNettiIn ");
|
||||
|
||||
try {
|
||||
readFile();
|
||||
if(args[0].equalsIgnoreCase(this.CONSUMER)|| args[0].equalsIgnoreCase(this.BUSINESS))
|
||||
readFile(args[0]);
|
||||
} catch (Exception ex) {
|
||||
//0003 C - PROCESSO TERMINATO CON ECCEZIONI
|
||||
log.write("0003", "" + ex.toString());
|
||||
@@ -86,12 +87,12 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
||||
}
|
||||
|
||||
|
||||
private void readFile() throws Exception{
|
||||
private void readFile(String argsPiattaforma) throws Exception{
|
||||
|
||||
log.write("9999", "Start readFile");
|
||||
|
||||
List<String> listFileName;
|
||||
try {
|
||||
|
||||
if (argsPiattaforma.equalsIgnoreCase(this.CONSUMER)){
|
||||
//leggo i file da cartella CO
|
||||
listFileName = getListFileName(Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_CON_IN());
|
||||
readFilesAndStore(listFileName);
|
||||
@@ -103,8 +104,18 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
||||
|
||||
//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();
|
||||
String dataFileOut;
|
||||
|
||||
//replica della data del file di IN per il file di OUT
|
||||
Pattern pattern = Pattern.compile("_(\\d{8})\\.csv$");
|
||||
Matcher matcher = pattern.matcher(fileName);
|
||||
if (matcher.find()) {
|
||||
dataFileOut= matcher.group(1);
|
||||
} else {
|
||||
dataFileOut = DateUtils.toString(new Date(),Resources.getDWHE2E_REPOSALDINETTI_DATA_FILENAME());
|
||||
}
|
||||
|
||||
nomeFileOut += dataFileOut + Resources.getDWHE2E_REPOSALDINETTI_FILENAME_EXT();
|
||||
generaFileOut(generaRecordAndStoreOut(fileName,nomeFileOut),
|
||||
nomeFileOut,
|
||||
Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_CON_OUT());
|
||||
@@ -121,48 +132,51 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
||||
}
|
||||
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.write("9999", "Eccezione: " + e.getMessage());
|
||||
log.write("9999", "Eccezione generica nell'elaborazione de file CO. Continuo con BU!");
|
||||
}
|
||||
}else {
|
||||
//leggo i file da cartella BU
|
||||
listFileName = getListFileName(Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_BUS_IN());
|
||||
readFilesAndStore(listFileName);
|
||||
//per ogni nome file, se .csv allora prendine il nome assoluto DWHE2E_DBCFX_USCITE_BUS_aaaammgg
|
||||
for(String fileName : listFileName){
|
||||
|
||||
String estensioneFname = fileName.substring(fileName.lastIndexOf("."),fileName.length());
|
||||
if (estensioneFname.equals(Resources.getDWHE2E_REPOSALDINETTI_FILENAME_EXT())) {
|
||||
|
||||
//leggo i file da cartella BU
|
||||
listFileName = getListFileName(Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_BUS_IN());
|
||||
readFilesAndStore(listFileName);
|
||||
//per ogni nome file, se .csv allora prendine il nome assoluto DWHE2E_DBCFX_USCITE_BUS_aaaammgg
|
||||
for(String fileName : listFileName){
|
||||
//aggiungo a DBCFX_DWHE2E_USCITE_XXX_ + yyyymmdd.csv al nome file
|
||||
String nomeFileOut = Resources.getDWHE2E_REPOSALDINETTI_NOME_FILE_BUS_OUT();
|
||||
String dataFileOut;
|
||||
|
||||
String estensioneFname = fileName.substring(fileName.lastIndexOf("."),fileName.length());
|
||||
if (estensioneFname.equals(Resources.getDWHE2E_REPOSALDINETTI_FILENAME_EXT())) {
|
||||
//replica della data del file di IN per il file di OUT
|
||||
Pattern pattern = Pattern.compile("_(\\d{8})\\.csv$");
|
||||
Matcher matcher = pattern.matcher(fileName);
|
||||
if (matcher.find()) {
|
||||
dataFileOut= matcher.group(1);
|
||||
} else {
|
||||
dataFileOut = DateUtils.toString(new Date(),Resources.getDWHE2E_REPOSALDINETTI_DATA_FILENAME());
|
||||
}
|
||||
|
||||
//aggiungo a DBCFX_DWHE2E_USCITE_XXX_ + yyyymmdd.csv al nome file
|
||||
String nomeFileOut = Resources.getDWHE2E_REPOSALDINETTI_NOME_FILE_BUS_OUT();
|
||||
nomeFileOut += DateUtils.toString(new Date(), Resources.getDWHE2E_REPOSALDINETTI_DATA_FILENAME()) + Resources.getDWHE2E_REPOSALDINETTI_FILENAME_EXT();
|
||||
nomeFileOut += dataFileOut + Resources.getDWHE2E_REPOSALDINETTI_FILENAME_EXT();
|
||||
generaFileOut(generaRecordAndStoreOut(fileName,nomeFileOut),
|
||||
nomeFileOut,
|
||||
Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_BUS_OUT());
|
||||
|
||||
generaFileOut(generaRecordAndStoreOut(fileName,nomeFileOut),
|
||||
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 = ((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;
|
||||
numRowFile = 0;
|
||||
rowError = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
log.write("9999", "End readFile");
|
||||
|
||||
|
||||
|
||||
}//chiude metodo
|
||||
|
||||
/**
|
||||
* Ritorna la lista dei nomi file presenti in folderName
|
||||
* Metodo che ritorna la lista dei nomi file presenti in folderName
|
||||
*
|
||||
* @param folderName
|
||||
*/
|
||||
@@ -192,7 +206,7 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
||||
}
|
||||
|
||||
/**
|
||||
* Scorre i file, crea la lista di oggetti formati dalle righe del .csv,
|
||||
* Metodo che scorre i file, crea la lista di oggetti formati dalle righe del .csv,
|
||||
* popola i parametri aggiuntivi e salva nel DB
|
||||
*
|
||||
* @param listFileName
|
||||
@@ -226,7 +240,7 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
||||
}
|
||||
|
||||
/**
|
||||
* Legge il file e ritorna una lista di oggetti che rappresentano le righe
|
||||
* Metodo che legge il fileName e ritorna una lista di oggetti che rappresentano le righe
|
||||
* del .csv
|
||||
*
|
||||
* @param fileName
|
||||
@@ -325,6 +339,14 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
||||
inFile.delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Metodo che ritorna l'oggetto GnpDwhe2eSaldinettiIn recuperato da una singola
|
||||
* linea di .csv
|
||||
*
|
||||
* @param line
|
||||
* @param nomeFile
|
||||
* @param piattaforma
|
||||
*/
|
||||
private GnpDwhe2eSaldinettiIn getDataFromLine(String line, String nomeFile, String piattaforma) throws Exception {
|
||||
|
||||
Pattern p = Pattern.compile(this.REGEXP_SALDINETTI_LINE);
|
||||
@@ -376,12 +398,15 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
||||
if (9<parts.length)
|
||||
gnpDwhe2eSaldinettiIn.setE2eDimensione5(parts[9]);
|
||||
|
||||
|
||||
|
||||
return gnpDwhe2eSaldinettiIn;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Metodo che aggiunge le info DBCFX alla lista e salva a DB
|
||||
*
|
||||
* @param gnpDwhe2eSaldinettiIn
|
||||
*/
|
||||
private void aggiungiInfoAndSave(List<GnpDwhe2eSaldinettiIn> gnpDwhe2eSaldinettiIn) throws Exception {
|
||||
log.write("9999", "Start aggiungiInfoAndSave");
|
||||
//istanzia le classi DAO
|
||||
@@ -459,7 +484,12 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
||||
log.write("9999", "End aggiungiInfoAndSave");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Metodo che genera i record aggregati e li salva nella GnpDwhe2eSaldinettiOut
|
||||
*
|
||||
* @param fileNameIn
|
||||
* @param fileNameOut
|
||||
*/
|
||||
private List<GnpDwhe2eSaldinettiOut> generaRecordAndStoreOut(String fileNameIn, String fileNameOut) throws Exception {
|
||||
log.write("9999", "Start generaRecordAndStoreOut");
|
||||
|
||||
@@ -509,7 +539,14 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
||||
return listSaldinettiOut;
|
||||
}
|
||||
|
||||
//TODO
|
||||
/**
|
||||
* Metodo che genera il file di OUT e se la scrittura del file di OUT riesce,
|
||||
* allora setta il FLAG_ELABORATO = 'Y' per tutti i record elaborati dal DB
|
||||
*
|
||||
* @param results
|
||||
* @param nomeFileOut
|
||||
* @param pathFileDwhe2eOut
|
||||
*/
|
||||
private void generaFileOut(List<GnpDwhe2eSaldinettiOut> results, String nomeFileOut, String pathFileDwhe2eOut ){
|
||||
log.write("9999", "Start generaFileOut");
|
||||
// DAO out
|
||||
|
||||
Reference in New Issue
Block a user