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 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
echo '****** elaborazione DHWE2E Report Saldi Netti file CO e BU ' $adesso Start DWHE2E_REPORT >> $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>> $LOG
|
$THIS_PATH/ProcessExecutor.sh it.valueteam.gnp.internalflow.in.Dwhe2eRepoSaldiNettiIn $1>> $LOG
|
||||||
else
|
else
|
||||||
echo " (WARNING) $(date) Esecuzione non avvenuta per presenza processo precedente : $prog" >> $LOG
|
echo " (WARNING) $(date) Esecuzione non avvenuta per presenza processo precedente : $prog" >> $LOG
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,2 +1,5 @@
|
|||||||
45 3 * * 1-6 /gnpapp/script/Dwhe2eRepoSaldiNettiIn.sh
|
45 3 * * 1-6 /gnpapp/script/Dwhe2eRepoSaldiNettiIn.sh CO
|
||||||
0 16 * * 0 /gnpapp/script/Dwhe2eRepoSaldiNettiIn.sh
|
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 ");
|
log.write("9999", "Start EXECUTE Dwhe2eRepoSaldiNettiIn ");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
readFile();
|
if(args[0].equalsIgnoreCase(this.CONSUMER)|| args[0].equalsIgnoreCase(this.BUSINESS))
|
||||||
|
readFile(args[0]);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
//0003 C - PROCESSO TERMINATO CON ECCEZIONI
|
//0003 C - PROCESSO TERMINATO CON ECCEZIONI
|
||||||
log.write("0003", "" + ex.toString());
|
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");
|
log.write("9999", "Start readFile");
|
||||||
|
|
||||||
List<String> listFileName;
|
List<String> listFileName;
|
||||||
try {
|
|
||||||
|
if (argsPiattaforma.equalsIgnoreCase(this.CONSUMER)){
|
||||||
//leggo i file da cartella CO
|
//leggo i file da cartella CO
|
||||||
listFileName = getListFileName(Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_CON_IN());
|
listFileName = getListFileName(Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_CON_IN());
|
||||||
readFilesAndStore(listFileName);
|
readFilesAndStore(listFileName);
|
||||||
@@ -103,8 +104,18 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|||||||
|
|
||||||
//aggiungo a DBCFX_DWHE2E_USCITE_XXX_ + yyyymmdd.csv al nome file
|
//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_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),
|
generaFileOut(generaRecordAndStoreOut(fileName,nomeFileOut),
|
||||||
nomeFileOut,
|
nomeFileOut,
|
||||||
Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_CON_OUT());
|
Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_CON_OUT());
|
||||||
@@ -121,48 +132,51 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}else {
|
||||||
log.write("9999", "Eccezione: " + e.getMessage());
|
//leggo i file da cartella BU
|
||||||
log.write("9999", "Eccezione generica nell'elaborazione de file CO. Continuo con 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
|
//aggiungo a DBCFX_DWHE2E_USCITE_XXX_ + yyyymmdd.csv al nome file
|
||||||
listFileName = getListFileName(Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_BUS_IN());
|
String nomeFileOut = Resources.getDWHE2E_REPOSALDINETTI_NOME_FILE_BUS_OUT();
|
||||||
readFilesAndStore(listFileName);
|
String dataFileOut;
|
||||||
//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());
|
//replica della data del file di IN per il file di OUT
|
||||||
if (estensioneFname.equals(Resources.getDWHE2E_REPOSALDINETTI_FILENAME_EXT())) {
|
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
|
nomeFileOut += dataFileOut + Resources.getDWHE2E_REPOSALDINETTI_FILENAME_EXT();
|
||||||
String nomeFileOut = Resources.getDWHE2E_REPOSALDINETTI_NOME_FILE_BUS_OUT();
|
generaFileOut(generaRecordAndStoreOut(fileName,nomeFileOut),
|
||||||
nomeFileOut += DateUtils.toString(new Date(), Resources.getDWHE2E_REPOSALDINETTI_DATA_FILENAME()) + Resources.getDWHE2E_REPOSALDINETTI_FILENAME_EXT();
|
nomeFileOut,
|
||||||
|
Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_BUS_OUT());
|
||||||
|
|
||||||
generaFileOut(generaRecordAndStoreOut(fileName,nomeFileOut),
|
numRowFile = ((numRowFile==-1)?0:numRowFile);
|
||||||
nomeFileOut,
|
log.write("9999", "--------- Report summary BU nomeFile: " + fileName + " ---------");
|
||||||
Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_BUS_OUT());
|
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);
|
numRowFile = 0;
|
||||||
log.write("9999", "--------- Report summary BU nomeFile: " + fileName + " ---------");
|
rowError = 0;
|
||||||
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");
|
log.write("9999", "End readFile");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}//chiude metodo
|
}//chiude metodo
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ritorna la lista dei nomi file presenti in folderName
|
* Metodo che ritorna la lista dei nomi file presenti in folderName
|
||||||
*
|
*
|
||||||
* @param 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
|
* popola i parametri aggiuntivi e salva nel DB
|
||||||
*
|
*
|
||||||
* @param listFileName
|
* @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
|
* del .csv
|
||||||
*
|
*
|
||||||
* @param fileName
|
* @param fileName
|
||||||
@@ -325,6 +339,14 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|||||||
inFile.delete();
|
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 {
|
private GnpDwhe2eSaldinettiIn getDataFromLine(String line, String nomeFile, String piattaforma) throws Exception {
|
||||||
|
|
||||||
Pattern p = Pattern.compile(this.REGEXP_SALDINETTI_LINE);
|
Pattern p = Pattern.compile(this.REGEXP_SALDINETTI_LINE);
|
||||||
@@ -376,12 +398,15 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|||||||
if (9<parts.length)
|
if (9<parts.length)
|
||||||
gnpDwhe2eSaldinettiIn.setE2eDimensione5(parts[9]);
|
gnpDwhe2eSaldinettiIn.setE2eDimensione5(parts[9]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return gnpDwhe2eSaldinettiIn;
|
return gnpDwhe2eSaldinettiIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Metodo che aggiunge le info DBCFX alla lista e salva a DB
|
||||||
|
*
|
||||||
|
* @param gnpDwhe2eSaldinettiIn
|
||||||
|
*/
|
||||||
private void aggiungiInfoAndSave(List<GnpDwhe2eSaldinettiIn> gnpDwhe2eSaldinettiIn) throws Exception {
|
private void aggiungiInfoAndSave(List<GnpDwhe2eSaldinettiIn> gnpDwhe2eSaldinettiIn) throws Exception {
|
||||||
log.write("9999", "Start aggiungiInfoAndSave");
|
log.write("9999", "Start aggiungiInfoAndSave");
|
||||||
//istanzia le classi DAO
|
//istanzia le classi DAO
|
||||||
@@ -459,7 +484,12 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|||||||
log.write("9999", "End aggiungiInfoAndSave");
|
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 {
|
private List<GnpDwhe2eSaldinettiOut> generaRecordAndStoreOut(String fileNameIn, String fileNameOut) throws Exception {
|
||||||
log.write("9999", "Start generaRecordAndStoreOut");
|
log.write("9999", "Start generaRecordAndStoreOut");
|
||||||
|
|
||||||
@@ -509,7 +539,14 @@ public class Dwhe2eRepoSaldiNettiIn extends InternalSenderProcess implements Log
|
|||||||
return listSaldinettiOut;
|
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 ){
|
private void generaFileOut(List<GnpDwhe2eSaldinettiOut> results, String nomeFileOut, String pathFileDwhe2eOut ){
|
||||||
log.write("9999", "Start generaFileOut");
|
log.write("9999", "Start generaFileOut");
|
||||||
// DAO out
|
// DAO out
|
||||||
|
|||||||
Reference in New Issue
Block a user