327915 - Modifica flussi Cubo Saldi Netti (Consumer e Business) - Parte 1 - DWHE2E->DBCFX - FINE

This commit is contained in:
manuelstefanile
2025-01-14 15:15:15 +01:00
parent 0cb313cdb4
commit ec4e78ff91
8 changed files with 648 additions and 78 deletions

View File

@@ -13,12 +13,15 @@
ricordarsi di inserire cascade="all" nei file xml generati per ricordarsi di inserire cascade="all" nei file xml generati per
il campo di tipo "set" il campo di tipo "set"
********************************************************************** **********************************************************************
--> -->
<table-filter match-name="GNP_RICHIESTE_DONOR" /> <table-filter match-name="GNP_DWHE2E_SALDINETTI_IN" />
<!-- <!--
Il <table-filter> definisce un filtro per selezionare quali tabelle del database devono essere incluse
(o escluse, se configurato diversamente) durante la generazione automatica delle entità Hibernate.
<table-filter match-name="GNP_RICHIESTE_DONOR" />
<table-filter match-name="GNP_NOW_XDSL_SCARTI_IN" /> <table-filter match-name="GNP_NOW_XDSL_SCARTI_IN" />
<table-filter match-name="GNP_NOW_XDSL_RICHIESTE_IN" /> <table-filter match-name="GNP_NOW_XDSL_RICHIESTE_IN" />
<table-filter match-name="GNP_NOW_XDSL_SCARTI_RICH_IN" /> <table-filter match-name="GNP_NOW_XDSL_SCARTI_RICH_IN" />

View File

@@ -1,9 +1,9 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 10-gen-2018 17.34.20 by Hibernate Tools 3.2.0.CR1 --> <!-- Generated 13-gen-2025 14.59.10 by Hibernate Tools 3.2.0.CR1 -->
<hibernate-mapping> <hibernate-mapping>
<class name="it.valueteam.gnp.dao.db.hb.GnpDwhe2eSaldiNettiIn" table="GNP_DWHE2E_SALDINETTI_IN"> <class name="it.valueteam.gnp.dao.db.hb.GnpDwhe2eSaldinettiIn" table="GNP_DWHE2E_SALDINETTI_IN">
<id name="uniqueId" type="java.lang.Long"> <id name="uniqueId" type="java.lang.Long">
<column name="UNIQUE_ID" precision="22" scale="0" /> <column name="UNIQUE_ID" precision="22" scale="0" />
<generator class="sequence"> <generator class="sequence">
@@ -17,36 +17,35 @@
<column name="CRM" length="2" /> <column name="CRM" length="2" />
</property> </property>
<property name="idRichiesta" type="java.lang.Long"> <property name="idRichiesta" type="java.lang.Long">
<column name="ID_RICHIESTA" precision="22" scale="0" /> <column name="ID_RICHIESTA" precision="22" scale="0" not-null="true" />
</property> </property>
<property name="linea" type="string"> <property name="linea" type="string">
<column name="LINEA" length="15" /> <column name="LINEA" length="15" />
</property> </property>
<property name="cor" type="string"> <property name="cor" type="string">
<column name="COR" length="50" /> <column name="COR" length="50" />
</property> </property>
<property name="dataCessazione" type="date"> <property name="e2eDataCessazione" type="date">
<column name="E2E_DATA_CESSAZIONE" length="7" /> <column name="E2E_DATA_CESSAZIONE" length="7" />
</property> </property>
<property name="servizioAccesso" type="string"> <property name="e2eServizioAccesso" type="string">
<column name="E2E_SERVIZIO_ACCESSO" length="12" /> <column name="E2E_SERVIZIO_ACCESSO" length="12" />
</property> </property>
<property name="dimensione1" type="string"> <property name="e2eDimensione1" type="string">
<column name="E2E_DIMENSIONE_1" length="10" /> <column name="E2E_DIMENSIONE_1" length="10" />
</property> </property>
<property name="dimensione2" type="string"> <property name="e2eDimensione2" type="string">
<column name="E2E_DIMENSIONE_2" length="50" /> <column name="E2E_DIMENSIONE_2" length="50" />
</property> </property>
<property name="dimensione3" type="string"> <property name="e2eDimensione3" type="string">
<column name="E2E_DIMENSIONE_3" length="1000" /> <column name="E2E_DIMENSIONE_3" length="1000" />
</property> </property>
<property name="dimensione4" type="string"> <property name="e2eDimensione4" type="string">
<column name="E2E_DIMENSIONE_4" length="1000" /> <column name="E2E_DIMENSIONE_4" length="1000" />
</property> </property>
<property name="dimensione5" type="string"> <property name="e2eDimensione5" type="string">
<column name="E2E_DIMENSIONE_5" length="1000" /> <column name="E2E_DIMENSIONE_5" length="1000" />
</property> </property>
<property name="dbcfxDimCodiceOlo" type="string"> <property name="dbcfxDimCodiceOlo" type="string">
<column name="DBCFX_DIM_CODICE_OLO" length="3" /> <column name="DBCFX_DIM_CODICE_OLO" length="3" />
</property> </property>

View File

@@ -0,0 +1,194 @@
package it.valueteam.gnp.dao.db.hb;
// Generated 13-gen-2025 14.59.11 by Hibernate Tools 3.2.0.CR1
import java.util.Date;
/**
* GnpDwhe2eSaldinettiIn generated by hbm2java
*/
public class GnpDwhe2eSaldinettiIn implements java.io.Serializable {
private Long uniqueId;
private String nomeFile;
private String crm;
private Long idRichiesta;
private String linea;
private String cor;
private Date e2eDataCessazione;
private String e2eServizioAccesso;
private String e2eDimensione1;
private String e2eDimensione2;
private String e2eDimensione3;
private String e2eDimensione4;
private String e2eDimensione5;
private String dbcfxDimCodiceOlo;
private String dbcfxDimTipoUscita;
private String dbcfxDimDelibera;
public GnpDwhe2eSaldinettiIn() {
}
public GnpDwhe2eSaldinettiIn(Long idRichiesta) {
this.idRichiesta = idRichiesta;
}
public GnpDwhe2eSaldinettiIn(String nomeFile, String crm, Long idRichiesta, String linea, String cor, Date e2eDataCessazione, String e2eServizioAccesso, String e2eDimensione1, String e2eDimensione2, String e2eDimensione3, String e2eDimensione4, String e2eDimensione5, String dbcfxDimCodiceOlo, String dbcfxDimTipoUscita, String dbcfxDimDelibera) {
this.nomeFile = nomeFile;
this.crm = crm;
this.idRichiesta = idRichiesta;
this.linea = linea;
this.cor = cor;
this.e2eDataCessazione = e2eDataCessazione;
this.e2eServizioAccesso = e2eServizioAccesso;
this.e2eDimensione1 = e2eDimensione1;
this.e2eDimensione2 = e2eDimensione2;
this.e2eDimensione3 = e2eDimensione3;
this.e2eDimensione4 = e2eDimensione4;
this.e2eDimensione5 = e2eDimensione5;
this.dbcfxDimCodiceOlo = dbcfxDimCodiceOlo;
this.dbcfxDimTipoUscita = dbcfxDimTipoUscita;
this.dbcfxDimDelibera = dbcfxDimDelibera;
}
public Long getUniqueId() {
return this.uniqueId;
}
public void setUniqueId(Long uniqueId) {
this.uniqueId = uniqueId;
}
public String getNomeFile() {
return this.nomeFile;
}
public void setNomeFile(String nomeFile) {
this.nomeFile = nomeFile;
}
public String getCrm() {
return this.crm;
}
public void setCrm(String crm) {
this.crm = crm;
}
public Long getIdRichiesta() {
return this.idRichiesta;
}
public void setIdRichiesta(Long idRichiesta) {
this.idRichiesta = idRichiesta;
}
public String getLinea() {
return this.linea;
}
public void setLinea(String linea) {
this.linea = linea;
}
public String getCor() {
return this.cor;
}
public void setCor(String cor) {
this.cor = cor;
}
public Date getE2eDataCessazione() {
return this.e2eDataCessazione;
}
public void setE2eDataCessazione(Date e2eDataCessazione) {
this.e2eDataCessazione = e2eDataCessazione;
}
public String getE2eServizioAccesso() {
return this.e2eServizioAccesso;
}
public void setE2eServizioAccesso(String e2eServizioAccesso) {
this.e2eServizioAccesso = e2eServizioAccesso;
}
public String getE2eDimensione1() {
return this.e2eDimensione1;
}
public void setE2eDimensione1(String e2eDimensione1) {
this.e2eDimensione1 = e2eDimensione1;
}
public String getE2eDimensione2() {
return this.e2eDimensione2;
}
public void setE2eDimensione2(String e2eDimensione2) {
this.e2eDimensione2 = e2eDimensione2;
}
public String getE2eDimensione3() {
return this.e2eDimensione3;
}
public void setE2eDimensione3(String e2eDimensione3) {
this.e2eDimensione3 = e2eDimensione3;
}
public String getE2eDimensione4() {
return this.e2eDimensione4;
}
public void setE2eDimensione4(String e2eDimensione4) {
this.e2eDimensione4 = e2eDimensione4;
}
public String getE2eDimensione5() {
return this.e2eDimensione5;
}
public void setE2eDimensione5(String e2eDimensione5) {
this.e2eDimensione5 = e2eDimensione5;
}
public String getDbcfxDimCodiceOlo() {
return this.dbcfxDimCodiceOlo;
}
public void setDbcfxDimCodiceOlo(String dbcfxDimCodiceOlo) {
this.dbcfxDimCodiceOlo = dbcfxDimCodiceOlo;
}
public String getDbcfxDimTipoUscita() {
return this.dbcfxDimTipoUscita;
}
public void setDbcfxDimTipoUscita(String dbcfxDimTipoUscita) {
this.dbcfxDimTipoUscita = dbcfxDimTipoUscita;
}
public String getDbcfxDimDelibera() {
return this.dbcfxDimDelibera;
}
public void setDbcfxDimDelibera(String dbcfxDimDelibera) {
this.dbcfxDimDelibera = dbcfxDimDelibera;
}
public void popolaAggiuntiviFX(String codiceOloRecipient, String tipologiaUscita, String delibera) {
this.setDbcfxDimCodiceOlo(codiceOloRecipient);
this.setDbcfxDimTipoUscita(tipologiaUscita);
this.setDbcfxDimDelibera(delibera);
}
}

View File

@@ -0,0 +1,186 @@
package it.valueteam.gnp.dao.db.hb;
// Generated 13-gen-2025 14.59.39 by Hibernate Tools Customizzato per GNP da C.A. 3.2.0.CR1
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import static org.hibernate.criterion.Example.create;
/**
* DAO object for domain model class GnpDwhe2eSaldinettiIn.
* @see .GnpDwhe2eSaldinettiIn
* @author C.A.
*/
import org.hibernate.Query;
import org.hibernate.criterion.Criterion;
import org.hibernate.Criteria;
import java.util.*;
public class GnpDwhe2eSaldinettiInDAO extends BaseHibernateDAO{
protected static final Log log = LogFactory.getLog(GnpDwhe2eSaldinettiInDAO.class);
public void save(GnpDwhe2eSaldinettiIn transientInstance) {
log.debug("saving GnpDwhe2eSaldinettiIn instance");
try {
getSession().save(transientInstance);
log.debug("save successful");
}
catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding GnpDwhe2eSaldinettiIn instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "select model from GnpDwhe2eSaldinettiIn model where model."
+ propertyName + "= ?";
Query queryObject = getSession().createQuery(queryString);
queryObject.setParameter(0, value);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
finally {
closeSession();
}
}
public List findAll() {
log.debug("finding all GnpDwhe2eSaldinettiIn ");
try {
String queryString = " from GnpDwhe2eSaldinettiIn";
Query queryObject = getSession().createQuery(queryString);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find all name failed", re);
throw re;
}finally {
closeSession();
}
}
public void attachDirty(GnpDwhe2eSaldinettiIn instance) {
log.debug("attaching dirty GnpDwhe2eSaldinettiIn instance");
try {
getSession().saveOrUpdate(instance);
log.debug("attach successful");
}
catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(GnpDwhe2eSaldinettiIn instance) {
log.debug("attaching clean GnpDwhe2eSaldinettiIn instance");
try {
getSession().lock(instance, LockMode.NONE);
log.debug("attach successful");
}
catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void delete(GnpDwhe2eSaldinettiIn persistentInstance) {
log.debug("deleting GnpDwhe2eSaldinettiIn instance");
try {
getSession().delete(persistentInstance);
log.debug("delete successful");
}
catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public GnpDwhe2eSaldinettiIn merge(GnpDwhe2eSaldinettiIn detachedInstance) {
log.debug("merging GnpDwhe2eSaldinettiIn instance");
try {
GnpDwhe2eSaldinettiIn result = (GnpDwhe2eSaldinettiIn) getSession().merge(detachedInstance);
log.debug("merge successful");
flush();
return result;
}
catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public List findByCriteria(List criterion) {
log.debug("finding GnpDwhe2eSaldinettiIn instance by criteria");
try {
Criteria crit = getSession() .createCriteria("it.valueteam.gnp.dao.db.hb.GnpDwhe2eSaldinettiIn");
Iterator iter = criterion.iterator();
while (iter.hasNext()) {
crit.add((Criterion) iter.next());
}
List results = crit.list();
log.debug("find by criteria successful, result size: "
+ results.size());
return results;
} catch (RuntimeException e) {
log.error("find by criteria failed", e);
throw e;
} finally {
closeSession();
}
}
public GnpDwhe2eSaldinettiIn findById( java.lang.Long id) {
log.debug("getting GnpDwhe2eSaldinettiIn instance with id: " + id);
try {
GnpDwhe2eSaldinettiIn instance = (GnpDwhe2eSaldinettiIn) getSession()
.get("it.valueteam.gnp.dao.db.hb.GnpDwhe2eSaldinettiIn", id);
if (instance==null) {
log.debug("get successful, no instance found");
}
else {
log.debug("get successful, instance found");
}
return instance;
}
catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
finally {
closeSession();
}
}
public List<GnpDwhe2eSaldinettiIn> findByExample(GnpDwhe2eSaldinettiIn instance) {
log.debug("finding GnpDwhe2eSaldinettiIn instance by example");
try {
List<GnpDwhe2eSaldinettiIn> results = (List<GnpDwhe2eSaldinettiIn>) getSession()
.createCriteria("it.valueteam.gnp.dao.db.hb.GnpDwhe2eSaldinettiIn")
.add( create(instance) )
.list();
log.debug("find by example successful, result size: " + results.size());
return results;
}
catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
finally {
closeSession();
}
}
}

View File

@@ -370,5 +370,65 @@ public class GnpRichiesteCsNpg103DAO extends BaseHibernateDAO{
closeSession(); closeSession();
} }
} }
/**
*
* @param
* @return
*/
private GnpRichiesteCsNpg103 getRichiesteSaldiNetti(Long idRichiesta, String resourceParam, String piattaforma, String processo)
{
String condizioneDate = "";
// Condizioni aggiuntive basate su `resourceParam`
if ("FULL".equalsIgnoreCase(resourceParam)) {
condizioneDate = "AND A.DATA_RICEZIONE >= TO_DATE(:resourceParam, 'DD/MM/YYYY') ";
} else {
condizioneDate = "AND A.DATA_RICEZIONE >= SYSDATE - :resourceParam ";
}
// Costruzione della query SQL
String sqlQuery = "SELECT " +
"A.PIATTAFORMA_COMPETENZA, A.COD_OP_RECIPIENT " +
"FROM GNP_RICHIESTE_CS_NPG103 A " +
"WHERE A.ID_RICHIESTA = :idRichiesta "+
"AND A.STATO = 5 " +
"AND A.COD_OP_RECIPIENT = :piattaforma " +
"AND A.PROCESSO = :processo " +
condizioneDate +
"ORDER BY A.DATA_RICEZIONE DESC";
try
{
// Creazione della query
Query hqlQuery = getSession().createSQLQuery(sqlQuery)
.addEntity(GnpRichiesteCsNpg103.class) // Mappa il risultato alla classe
.setParameter("idRichiesta", idRichiesta)
.setParameter("resourceParam", resourceParam)
.setParameter("piattaforma", piattaforma)
.setParameter("processo", processo);
// RestituiscO il risultato univoco
return (GnpRichiesteCsNpg103) hqlQuery.uniqueResult();
}
catch (RuntimeException re)
{
log.error("find by custom query failed", re);
throw re;
} finally
{
closeSession();
}
}
public GnpRichiesteCsNpg103 getRichiesteSaldiNettiNativiOlo (Long idRichiesta, String resourceParam, String piattaforma) {
log.debug("GnpRichiesteCsNpg103DAO.getRichiesteSaldiNettiNativiOlo(), Id_richiesta =" + idRichiesta +
" resourceParam = " + resourceParam + " piattaforma = " + piattaforma);
return this.getRichiesteSaldiNetti(idRichiesta,resourceParam,piattaforma,"DONOR_NAT_OLO");
}
public GnpRichiesteCsNpg103 getRichiesteSaldiNettiStdVoip (Long idRichiesta, String resourceParam, String piattaforma) {
log.debug("GnpRichiesteCsNpg103DAO.getRichiesteSaldiNettiNativiOlo(), Id_richiesta =" + idRichiesta +
" resourceParam = " + resourceParam + " piattaforma = " + piattaforma);
return this.getRichiesteSaldiNetti(idRichiesta,resourceParam,piattaforma,"CSNPg103");
}
} }

View File

@@ -541,5 +541,60 @@ public class GnpRichiesteDonor82DAO extends BaseHibernateDAO{
} }
} }
/**
*
* @param
* @return
*/
public GnpRichiesteDonor82 getRichiesteSaldiNetti(Long idRichiesta, String resourceParam, String piattaforma)
{
log.debug("GnpRichiesteDonor82DAO.getRichiesteSaldiNetti(), Id_richiesta =" + idRichiesta +
" resourceParam = " + resourceParam + " piattaforma = " + piattaforma);
String condizioneDate = "";
// Condizioni aggiuntive basate su `resourceParam`
if ("FULL".equalsIgnoreCase(resourceParam)) {
condizioneDate = "AND B.DATA_ESPLETAMENTO >= TO_DATE(:resourceParam, 'DD/MM/YYYY') ";
} else {
condizioneDate = "AND B.DATA_ESPLETAMENTO >= SYSDATE - :resourceParam ";
}
// Costruzione della query SQL
String sqlQuery = "SELECT " +
"A.CRM_COMPETENZA, A.COW_RECIPIENT " +
"FROM GNP_RICHIESTE_D82 A " +
"WHERE A.ID_RICHIESTA IN ( " +
" SELECT B.ID_RICHIESTA_D82 " +
" FROM GNP_NOW_D82_RICHIESTE_IN B " +
" WHERE B.DATA_ESPLETAMENTO IS NOT NULL " +
condizioneDate +
") " +
"AND A.ID_RICHIESTA = :idRichiesta " +
"AND A.CRM_COMPETENZA = :piattaforma " +
"ORDER BY A.DATA_RICEZIONE DESC";
try
{
// Creazione della query
Query hqlQuery = getSession().createSQLQuery(sqlQuery)
.addEntity(GnpRichiesteDonor82.class) // Mappa il risultato alla classe Del82Entity
.setParameter("idRichiesta", idRichiesta)
.setParameter("resourceParam", resourceParam)
.setParameter("piattaforma", piattaforma);
// RestituiscO il risultato univoco
return (GnpRichiesteDonor82) hqlQuery.uniqueResult();
}
catch (RuntimeException re)
{
log.error("find by custom query failed", re);
throw re;
} finally
{
closeSession();
}
}
} }

View File

@@ -510,5 +510,53 @@ public class GnpRichiesteDonorDAO extends BaseHibernateDAO{
closeSession(); closeSession();
} }
} }
/**
*
* @param
* @return
*/
public GnpRichiesteDonor getRichiesteSaldiNettiDel274(Long idRichiesta, String resourceParam, String piattaforma)
{
log.debug("GnpRichiesteDonorDAO.getRichiesteSaldiNettiDel274(), Id_richiesta =" + idRichiesta +
" resourceParam = " + resourceParam + " piattaforma = " + piattaforma);
String condizioneDate = "";
// Condizioni aggiuntive basate su `resourceParam`
if ("FULL".equalsIgnoreCase(resourceParam)) {
condizioneDate = "AND A.DATA_RICEZIONE >= TO_DATE(:resourceParam, 'DD/MM/YYYY') ";
} else {
condizioneDate = "AND A.DATA_RICEZIONE >= SYSDATE - :resourceParam ";
}
// Costruzione della query SQL
String sqlQuery = "SELECT " +
"A.CRM_COMPETENZA, A.COW_RECIPIENT " +
"FROM GNP_RICHIESTE_DONOR A " +
"WHERE A.ID_RICHIESTA = :idRichiesta "+
"AND A.STATO = 4 " +
"AND A.CRM_COMPETENZA = :piattaforma " +
condizioneDate +
"ORDER BY A.DATA_RICEZIONE DESC";
try
{
// Creazione della query
Query hqlQuery = getSession().createSQLQuery(sqlQuery)
.addEntity(GnpRichiesteDonor.class) // Mappa il risultato alla classe
.setParameter("idRichiesta", idRichiesta)
.setParameter("resourceParam", resourceParam)
.setParameter("piattaforma", piattaforma);
// RestituiscO il risultato univoco
return (GnpRichiesteDonor) hqlQuery.uniqueResult();
}
catch (RuntimeException re)
{
log.error("find by custom query failed", re);
throw re;
} finally
{
closeSession();
}
}
} }

View File

@@ -1,14 +1,16 @@
package it.valueteam.gnp.internalflow.in; package it.valueteam.gnp.internalflow.in;
import it.valueteam.crontab.processexecutor.ProcessIF; import it.valueteam.crontab.processexecutor.ProcessIF;
import it.valueteam.gnp.dao.db.hb.GnpVerificaCsWhitelist; import it.valueteam.gnp.dao.db.hb.*;
import it.valueteam.gnp.log.Loggable; import it.valueteam.gnp.log.Loggable;
import it.valueteam.gnp.log.ProcessLogger; import it.valueteam.gnp.log.ProcessLogger;
import it.valueteam.gnp.obj.LogInfo; import it.valueteam.gnp.obj.LogInfo;
import it.valueteam.gnp.obj.LogProcess; import it.valueteam.gnp.obj.LogProcess;
import it.valueteam.gnp.utility.DateUtils;
import it.valueteam.gnp.utility.Resources; import it.valueteam.gnp.utility.Resources;
import java.io.File; import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Scanner; import java.util.Scanner;
@@ -16,7 +18,7 @@ import java.util.Scanner;
public class Dwhe2eRepoSaldiNettiIn implements Loggable, ProcessIF { public class Dwhe2eRepoSaldiNettiIn implements Loggable, ProcessIF {
private ProcessLogger log; private ProcessLogger log;
//TODO EDL verificare il codice processo //TODO verificare il codice processo
private static final String codiceProcesso = "IG"; private static final String codiceProcesso = "IG";
private static final String versione = "1.0.0"; private static final String versione = "1.0.0";
private String separator = ";"; private String separator = ";";
@@ -24,6 +26,16 @@ public class Dwhe2eRepoSaldiNettiIn implements Loggable, ProcessIF {
private static final String ESTRAZIONE_DELTA = "DELTA"; private static final String ESTRAZIONE_DELTA = "DELTA";
private static final String CONSUMER = "CO"; private static final String CONSUMER = "CO";
private static final String BUSINESS = "BU"; private static final String BUSINESS = "BU";
private static final String DEL_82 = "Del. 82";
private static final String DEL_82_TIPOUSCITA = "Uscite FTTH OF";
private static final String DEL_274 = "Del. 274";
private static final String DEL_274_TIPOUSCITA = "Fonia o Dati senza NP";
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");
@@ -49,13 +61,13 @@ public class Dwhe2eRepoSaldiNettiIn implements Loggable, ProcessIF {
* @param args String[] * @param args String[]
*/ */
public void execute(String[] args) throws Exception { public void execute(String[] args) throws Exception {
log.write("9999", " CRMB "); log.write("9999", " EXECUTE Dwhe2eRepoSaldiNettiIn ");
try { try {
if (args.length == 1 && (ESTRAZIONE_FULL.equalsIgnoreCase(args[0]) || ESTRAZIONE_DELTA.equalsIgnoreCase(args [0]))) { if (args.length == 1 && (ESTRAZIONE_FULL.equalsIgnoreCase(args[0]) || ESTRAZIONE_DELTA.equalsIgnoreCase(args [0]))) {
readFile(args[0]); readFile(args[0]);
} else { } else {
log.write("9999", "Creazione file non eseguita. Inserire parametro (FULL o DELTA) e (DONOR)"); log.write("9999", "Creazione file non eseguita. Inserire parametro (FULL o DELTA) ");
} }
} catch (Exception ex) { } catch (Exception ex) {
//0003 C - PROCESSO TERMINATO CON ECCEZIONI //0003 C - PROCESSO TERMINATO CON ECCEZIONI
@@ -70,7 +82,7 @@ public class Dwhe2eRepoSaldiNettiIn implements Loggable, ProcessIF {
private void readFile(String arg) throws Exception{ private void readFile(String arg) throws Exception{
//argomento full o delta //argomento full o delta
log.write("9999", "Start Dwhe2eRepoSaldiNettiIn"); log.write("9999", "Start readFile");
String resourceParam; String resourceParam;
if(ESTRAZIONE_FULL.equalsIgnoreCase(arg)) { if(ESTRAZIONE_FULL.equalsIgnoreCase(arg)) {
resourceParam = Resources.getDWHE2E_REPOSALDINETTI_FULL(); resourceParam = Resources.getDWHE2E_REPOSALDINETTI_FULL();
@@ -80,19 +92,13 @@ public class Dwhe2eRepoSaldiNettiIn implements Loggable, ProcessIF {
List<String> listFileName = getListFileName(Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_IN()); List<String> listFileName = getListFileName(Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_IN());
readFilesAndStore(listFileName,resourceParam); readFilesAndStore(listFileName,resourceParam);
log.write("9999", "End readFileAndGetList"); log.write("9999", "End readFile");
/*
*/
}//chiude metodo }//chiude metodo
private List<String> getListFileName(String folderName) throws Exception { private List<String> getListFileName(String folderName) throws Exception {
log.write("9999", "Start getFiles for folder "+folderName); log.write("9999", "Start getListFileName folder IN locale name "+folderName);
List<String> listFileName = new ArrayList<String>(); List<String> listFileName = new ArrayList<String>();
try { try {
@@ -101,7 +107,7 @@ public class Dwhe2eRepoSaldiNettiIn implements Loggable, ProcessIF {
for (File file : listOfFiles) { for (File file : listOfFiles) {
if (file.isFile()) { if (file.isFile()) {
log.write("9999", "file presente "+file.getName()); log.write("9999", "file presente con nome: "+file.getName());
listFileName.add(file.getName()); listFileName.add(file.getName());
} }
} }
@@ -110,14 +116,13 @@ public class Dwhe2eRepoSaldiNettiIn implements Loggable, ProcessIF {
throw ex; throw ex;
} }
log.write("9999", "END getFiles"); log.write("9999", "END getListFileName");
return listFileName; return listFileName;
} }
private void readFilesAndStore(List<String> listFileName, String resourceParam) throws Exception { private void readFilesAndStore(List<String> listFileName, String resourceParam) throws Exception {
log.write("9999", "Start readFiles"); log.write("9999", "Start readFilesAndStore");
for(String fileName : listFileName) { for(String fileName : listFileName) {
@@ -130,10 +135,10 @@ public class Dwhe2eRepoSaldiNettiIn implements Loggable, ProcessIF {
piattaforma = this.BUSINESS; piattaforma = this.BUSINESS;
//lista di oggetti tabella in senza i dati di FX //lista di oggetti tabella in senza i dati di FX
List<GnpVerificaCsWhitelist> listForFile = readFileAndGetList(fileName); List<GnpDwhe2eSaldinettiIn> listForFile = readFileAndGetList(fileName,piattaforma);
//AGGIUNGI ad ogni oggetto i dati di FX ricercando in tabelle //AGGIUNGI ad ogni oggetto i dati di FX ricercandoli nelle tabelle
// e salva nel db. Per evitare di scorrere la lista 2 volte! // e salva nel db. 2 in 1 per evitare di scorrere la lista 2 volte!
this.aggiungiInfoAndSave(listForFile,resourceParam,piattaforma); this.aggiungiInfoAndSave(listForFile,resourceParam,piattaforma);
} }
@@ -144,12 +149,10 @@ public class Dwhe2eRepoSaldiNettiIn implements Loggable, ProcessIF {
} }
private List<GnpDwhe2eSaldinettiIn> readFileAndGetList(String fileName, String piattaforma) throws Exception {
// TODO MODIFICA LE CLASSI una volta generate dai file HB
private List<GnpVerificaCsWhitelist> readFileAndGetList(String fileName) throws Exception {
log.write("9999", "Start readFileAndGetList"); log.write("9999", "Start readFileAndGetList");
List<GnpVerificaCsWhitelist> listForFile = new ArrayList<GnpVerificaCsWhitelist>(); List<GnpDwhe2eSaldinettiIn> listForFile = new ArrayList<GnpDwhe2eSaldinettiIn>();
try { try {
log.write("9999", "file da elaborare "+Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_IN()+fileName); log.write("9999", "file da elaborare "+Resources.getPATH_FILE_DWHE2E_REPOSALDINETTI_IN()+fileName);
@@ -161,12 +164,13 @@ public class Dwhe2eRepoSaldiNettiIn implements Loggable, ProcessIF {
int firstRowHeader= 0; int firstRowHeader= 0;
while (reader.hasNextLine()) { while (reader.hasNextLine()) {
//salto l'header del file
if(row == firstRowHeader) { if(row == firstRowHeader) {
reader.nextLine(); reader.nextLine();
}else { }else {
//passo file name per inserirlo nella tabella //passo FILE_NAME e PIATTAFORMA per inserirli nella tabella
GnpVerificaCsWhitelist gnpVerificaCsWhitelist = getDataFromLine(reader.nextLine(),fileName); GnpDwhe2eSaldinettiIn gnpDwhe2eSaldinettiIn = getDataFromLine(reader.nextLine(),fileName,piattaforma);
listForFile.add(gnpVerificaCsWhitelist); listForFile.add(gnpDwhe2eSaldinettiIn);
} }
row++; row++;
} }
@@ -177,6 +181,7 @@ public class Dwhe2eRepoSaldiNettiIn implements Loggable, ProcessIF {
log.write("9999", "exception in readFileAndGetList "+e.getMessage()); log.write("9999", "exception in readFileAndGetList "+e.getMessage());
throw e; throw e;
} }
log.write("9999", "End readFileAndGetList");
return listForFile; return listForFile;
} }
@@ -186,62 +191,82 @@ public class Dwhe2eRepoSaldiNettiIn implements Loggable, ProcessIF {
wlFile.renameTo(new File(Resources.getDWHE2E_REPOSALDINETTI_BACKUP_IN()+"backup_"+fileName)); wlFile.renameTo(new File(Resources.getDWHE2E_REPOSALDINETTI_BACKUP_IN()+"backup_"+fileName));
log.write("9999", "Backup effettuato "+Resources.getDWHE2E_REPOSALDINETTI_BACKUP_IN()+fileName); log.write("9999", "Backup effettuato "+Resources.getDWHE2E_REPOSALDINETTI_BACKUP_IN()+fileName);
log.write("9999", "End backup file");
} }
private GnpVerificaCsWhitelist getDataFromLine(String line, String nomeFile) { private GnpDwhe2eSaldinettiIn getDataFromLine(String line, String nomeFile, String piattaforma) throws Exception {
log.write("9999", "start getDataFromLine line= "+line); log.write("9999", "start getDataFromLine line= "+line);
String[] parts = line.split(separator); String[] parts = line.split(separator);
GnpVerificaCsWhitelist gnpVerificaCsWhitelist = new GnpVerificaCsWhitelist(); GnpDwhe2eSaldinettiIn gnpDwhe2eSaldinettiIn = new GnpDwhe2eSaldinettiIn();
// TODO non dimenticare filename gnpDwhe2eSaldinettiIn.setNomeFile(nomeFile);
/* aggiungi i dati provenienti dal file in SENZA i dati fx gnpDwhe2eSaldinettiIn.setCrm(piattaforma);
gnpVerificaCsWhitelist.setNumeroTelefono(parts[0]); gnpDwhe2eSaldinettiIn.setIdRichiesta(Long.valueOf(parts[0]));
gnpVerificaCsWhitelist.setCodiceSegreto(parts[1]); gnpDwhe2eSaldinettiIn.setLinea(parts[1]);
gnpVerificaCsWhitelist.setCodiceFiscalePartitaIva(parts[2]); gnpDwhe2eSaldinettiIn.setCor(parts[2]);
gnpVerificaCsWhitelist.setSistComp(parts[3]); gnpDwhe2eSaldinettiIn.setE2eDataCessazione(DateUtils.toDate(parts[3],DATACESSAZIONE_FORMAT));
gnpVerificaCsWhitelist.setFlagVerificaCs(parts[4]); gnpDwhe2eSaldinettiIn.setE2eServizioAccesso(parts[4]);
gnpDwhe2eSaldinettiIn.setE2eDimensione1(parts[5]);
gnpDwhe2eSaldinettiIn.setE2eDimensione2(parts[6]);
gnpDwhe2eSaldinettiIn.setE2eDimensione3(parts[7]);
gnpDwhe2eSaldinettiIn.setE2eDimensione4(parts[8]);
gnpDwhe2eSaldinettiIn.setE2eDimensione5(parts[9]);
*/ log.write("9999", "Oggetto creato gnpVerificaCsWhitelist = "+gnpDwhe2eSaldinettiIn.toString());
log.write("9999", "Created obj gnpVerificaCsWhitelist "+gnpVerificaCsWhitelist.toString());
log.write("9999", "End getDataFromLine"); log.write("9999", "End getDataFromLine");
return gnpVerificaCsWhitelist; return gnpDwhe2eSaldinettiIn;
} }
// TODO // TODO
private void aggiungiInfoAndSave(List<GnpVerificaCsWhitelist> listadwhe2ein,String resourceParam, String piattaforma){ private void aggiungiInfoAndSave(List<GnpDwhe2eSaldinettiIn> gnpDwhe2eSaldinettiIn,String resourceParam, String piattaforma){
//instanzia la classe DAO log.write("9999", "Start aggiungiInfoAndSave");
//daodel82 d82dao = new daodel82(); //instanzia le classi DAO
//daodel274 d274dao = new daodel274(); //del.82
//DAO per il save IN GnpRichiesteDonor82DAO daoRichiesteD82 = new GnpRichiesteDonor82DAO();
// daodwhe2e daodwhe2e = new daodwhe2e() //del 274
GnpRichiesteDonorDAO daoRichiesteDonor = new GnpRichiesteDonorDAO();
//del. 103
GnpRichiesteCsNpg103DAO daoCsNpg103 = new GnpRichiesteCsNpg103DAO();
//effettua la ricerca nelle tabelle sfruttando resourceParam DELTA/FULL e piattaforma e aggiorna i campi dbcfx //DAO per storare le richieste IN
/* GnpDwhe2eSaldinettiInDAO dwhe2eSaldinettiInDAO = new GnpDwhe2eSaldinettiInDAO();
for(oggettodwhe2ein : listadwhe2ein){
del82Entity dent82 = d82dao.find(oggettodwhe2ein.getid(), resourcesParam, piattaforma) //effettua la ricerca nelle tabelle sfruttando resourceParam DELTA/FULL e piattaforma per poi aggiorna i campi dbcfx
if (dent82!=null){ for(GnpDwhe2eSaldinettiIn dwhe2eItem : gnpDwhe2eSaldinettiIn ){
oggettodwhe2ein.popolaAggiuntDBCFX(del82.getcodiceOlo(),del82.getTipoUscita,del82.getDelibera) // del. 82
daodwhe2e.save(oggettodwhe2ein); GnpRichiesteDonor82 gnpRichiestaDonor82 = daoRichiesteD82.getRichiesteSaldiNetti(dwhe2eItem.getIdRichiesta(), resourceParam, piattaforma);
if(gnpRichiestaDonor82!=null){
dwhe2eItem.popolaAggiuntiviFX(gnpRichiestaDonor82.getCowRecipient(),this.DEL_82_TIPOUSCITA, this.DEL_82);
dwhe2eSaldinettiInDAO.save(dwhe2eItem);
continue; continue;
} }
del274Entity del274 = d274dao.find(oggettodwhe2ein.getid(), resourcesParam, piattaforma) // del. 274
if (del274!=null){ GnpRichiesteDonor gnpRichiestaDonor274 = daoRichiesteDonor.getRichiesteSaldiNettiDel274(dwhe2eItem.getIdRichiesta(), resourceParam, piattaforma);
oggettodwhe2ein.popolaAggiuntDBCFX(del274.getcodiceOlo(),del274.getTipoUscita,del274.getDelibera) if(gnpRichiestaDonor274!=null){
daodwhe2e.save(oggettodwhe2ein); dwhe2eItem.popolaAggiuntiviFX(gnpRichiestaDonor274.getCowRecipient(),this.DEL_274_TIPOUSCITA, this.DEL_274);
dwhe2eSaldinettiInDAO.save(dwhe2eItem);
continue; continue;
} }
... // del. 103 uscite Donor nativi olo
GnpRichiesteCsNpg103 gnpRichiesteCsNpg103NativiOlo = daoCsNpg103.getRichiesteSaldiNettiNativiOlo(dwhe2eItem.getIdRichiesta(), resourceParam, piattaforma);
if(gnpRichiesteCsNpg103NativiOlo!=null){
dwhe2eItem.popolaAggiuntiviFX(gnpRichiesteCsNpg103NativiOlo.getCodOpRecipient(),this.DEL_103_NATOLO_TIPOUSCITA, this.DEL_103);
dwhe2eSaldinettiInDAO.save(dwhe2eItem);
continue;
}
// del. 103 uscite Donor nativi olo
GnpRichiesteCsNpg103 gnpRichiesteCsNpg103StdVoip = daoCsNpg103.getRichiesteSaldiNettiStdVoip(dwhe2eItem.getIdRichiesta(), resourceParam, piattaforma);
if(gnpRichiesteCsNpg103StdVoip!=null){
dwhe2eItem.popolaAggiuntiviFX(gnpRichiesteCsNpg103StdVoip.getCodOpRecipient(),this.DEL_103_STD_VOIP_TIPOUSCITA, this.DEL_103);
dwhe2eSaldinettiInDAO.save(dwhe2eItem);
}
} }
*/ log.write("9999", "End aggiungiInfoAndSave");
} }
/** /**