Skip to content

Commit

Permalink
Merge branch '3.5.x' of github.com:link-it/govpay into 3.5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
nardil committed Dec 15, 2021
2 parents 1d7b458 + ecf5ad9 commit 4aa37b7
Show file tree
Hide file tree
Showing 34 changed files with 8,779 additions and 69 deletions.

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions jars/orm/src/main/java/it/govpay/bd/BasicBD.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
import it.govpay.orm.dao.IDBVistaPagamentoServiceSearch;
import it.govpay.orm.dao.IDBVistaRendicontazioneServiceSearch;
import it.govpay.orm.dao.IDBVistaRptVersamentoServiceSearch;
import it.govpay.orm.dao.IDBVistaVersamentoNonRendicontatoServiceSearch;
import it.govpay.orm.dao.IDBVistaVersamentoServiceSearch;
import it.govpay.orm.dao.IDocumentoService;
import it.govpay.orm.dao.IDominioService;
Expand Down Expand Up @@ -122,6 +123,7 @@
import it.govpay.orm.dao.IVistaRendicontazioneServiceSearch;
import it.govpay.orm.dao.IVistaRiscossioniServiceSearch;
import it.govpay.orm.dao.IVistaRptVersamentoServiceSearch;
import it.govpay.orm.dao.IVistaVersamentoNonRendicontatoServiceSearch;
import it.govpay.orm.dao.IVistaVersamentoServiceSearch;
import it.govpay.orm.dao.jdbc.JDBCServiceManager;

Expand Down Expand Up @@ -177,6 +179,7 @@ public class BasicBD {
private ITracciatoNotificaPagamentiService tracciatoNotificaPagamentiService;
private IVistaPagamentoServiceSearch vistaPagamentoServiceSearch;
private IVistaVersamentoServiceSearch vistaVersamentoServiceSearch;
private IVistaVersamentoNonRendicontatoServiceSearch vistaVersamentoNonRendicontatoServiceSearch;

private String idTransaction;
private String idModulo;
Expand Down Expand Up @@ -285,6 +288,7 @@ private void setupConnection(String idTransaction, String idModulo) throws Servi
this.tracciatoNotificaPagamentiService = this.serviceManager.getTracciatoNotificaPagamentiService();
this.vistaPagamentoServiceSearch =this.serviceManager.getVistaPagamentoServiceSearch();
this.vistaVersamentoServiceSearch = this.serviceManager.getVistaVersamentoServiceSearch();
this.vistaVersamentoNonRendicontatoServiceSearch = this.serviceManager.getVistaVersamentoNonRendicontatoServiceSearch();
} catch(NotImplementedException e) {
throw new ServiceException(e);
}
Expand Down Expand Up @@ -344,6 +348,7 @@ public void enableSelectForUpdate() throws ServiceException {
((IDBTracciatoNotificaPagamentiService)this.tracciatoNotificaPagamentiService).enableSelectForUpdate();
((IDBVistaPagamentoServiceSearch)this.vistaPagamentoServiceSearch).enableSelectForUpdate();
((IDBVistaVersamentoServiceSearch)this.vistaVersamentoServiceSearch).enableSelectForUpdate();
((IDBVistaVersamentoNonRendicontatoServiceSearch)this.vistaVersamentoNonRendicontatoServiceSearch).enableSelectForUpdate();

this.isSelectForUpdate = true;
} catch(NotImplementedException e) {
Expand Down Expand Up @@ -402,6 +407,7 @@ public void disableSelectForUpdate() throws ServiceException {
((IDBTracciatoNotificaPagamentiService)this.tracciatoNotificaPagamentiService).disableSelectForUpdate();
((IDBVistaPagamentoServiceSearch)this.vistaPagamentoServiceSearch).disableSelectForUpdate();
((IDBVistaVersamentoServiceSearch)this.vistaVersamentoServiceSearch).disableSelectForUpdate();
((IDBVistaVersamentoNonRendicontatoServiceSearch)this.vistaVersamentoNonRendicontatoServiceSearch).disableSelectForUpdate();

this.isSelectForUpdate = false;
} catch(NotImplementedException e) {
Expand Down Expand Up @@ -746,6 +752,13 @@ public IVistaVersamentoServiceSearch getVistaVersamentoServiceSearch() {
}
return this.vistaVersamentoServiceSearch;
}

public IVistaVersamentoNonRendicontatoServiceSearch getVistaVersamentoNonRendicontatoServiceSearch() {
if(this.father != null) {
return this.father.getVistaVersamentoNonRendicontatoServiceSearch();
}
return vistaVersamentoNonRendicontatoServiceSearch;
}

public void setAutoCommit(boolean autoCommit) throws ServiceException {
if(this.father != null) {
Expand Down
82 changes: 82 additions & 0 deletions jars/orm/src/main/java/it/govpay/bd/viste/RendicontazioniBD.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.List;

import org.openspcoop2.generic_project.beans.CustomField;
import org.openspcoop2.generic_project.beans.NonNegativeNumber;
import org.openspcoop2.generic_project.exception.ExpressionException;
import org.openspcoop2.generic_project.exception.ExpressionNotImplementedException;
import org.openspcoop2.generic_project.exception.MultipleResultException;
Expand Down Expand Up @@ -432,4 +434,84 @@ public List<it.govpay.bd.viste.model.Rendicontazione> getFr(String codFlusso, Bo
}
}
}

public List<it.govpay.bd.viste.model.Rendicontazione> ricercaRiscossioniDominio(String codDominio, Date dataRtDa, Date dataRtA, List<String> listaTipiPendenza, Integer offset, Integer limit) throws ServiceException{
try {
if(this.isAtomica()) {
this.setupConnection(this.getIdTransaction());
}

VistaRendicontazioneModel model = it.govpay.orm.VistaRendicontazione.model();
IExpression exp = this.getVistaRendicontazioneServiceSearch().newExpression();
exp.equals(model.FR_COD_DOMINIO, codDominio).and();
if(dataRtDa != null) {
exp.greaterEquals(model.PAG_DATA_PAGAMENTO, dataRtDa);
}
exp.lessEquals(model.PAG_DATA_PAGAMENTO, dataRtA);
// exp.equals(model.STATO, Stato.INCASSATO.toString());
if(listaTipiPendenza != null && !listaTipiPendenza.isEmpty()) {
listaTipiPendenza.removeAll(Collections.singleton(null));
exp.in(model.VRS_ID_TIPO_VERSAMENTO.COD_TIPO_VERSAMENTO, listaTipiPendenza);
}
exp.isNotNull(model.FR_COD_FLUSSO);

IPaginatedExpression pagExp = this.getVistaRendicontazioneServiceSearch().toPaginatedExpression(exp);
pagExp.offset(offset).limit(limit);
pagExp.addOrder(model.PAG_DATA_PAGAMENTO, SortOrder.ASC);

List<Rendicontazione> entratePrevisteLst = new ArrayList<>();
List<VistaRendicontazione> riscossioniVOLst = this.getVistaRendicontazioneServiceSearch().findAll(pagExp);
for(it.govpay.orm.VistaRendicontazione riscossioneVO: riscossioniVOLst) {
entratePrevisteLst.add(RendicontazioneConverter.toDTO(riscossioneVO));
}
return entratePrevisteLst;
} catch(NotImplementedException e) {
throw new ServiceException(e);
} catch (ExpressionNotImplementedException e) {
throw new ServiceException(e);
} catch (ExpressionException e) {
throw new ServiceException(e);
} finally {
if(this.isAtomica()) {
this.closeConnection();
}
}
}

public long countRiscossioniDominio(String codDominio, Date dataRtDa, Date dataRtA, List<String> listaTipiPendenza) throws ServiceException{
try {
if(this.isAtomica()) {
this.setupConnection(this.getIdTransaction());
}

VistaRendicontazioneModel model = it.govpay.orm.VistaRendicontazione.model();
IExpression exp = this.getVistaRendicontazioneServiceSearch().newExpression();
exp.equals(model.FR_COD_DOMINIO, codDominio).and();
if(dataRtDa != null) {
exp.greaterEquals(model.PAG_DATA_PAGAMENTO, dataRtDa);
}
exp.lessEquals(model.PAG_DATA_PAGAMENTO, dataRtA);
// exp.equals(model.STATO, Stato.INCASSATO.toString());
if(listaTipiPendenza != null && !listaTipiPendenza.isEmpty()) {
listaTipiPendenza.removeAll(Collections.singleton(null));
exp.in(model.VRS_ID_TIPO_VERSAMENTO.COD_TIPO_VERSAMENTO, listaTipiPendenza);
}
exp.isNotNull(model.FR_COD_FLUSSO);

NonNegativeNumber count = this.getVistaRendicontazioneServiceSearch().count(exp);

return count.longValue();
} catch(NotImplementedException e) {
throw new ServiceException(e);
} catch (ExpressionNotImplementedException e) {
throw new ServiceException(e);
} catch (ExpressionException e) {
throw new ServiceException(e);
} finally {
if(this.isAtomica()) {
this.closeConnection();
}
}

}
}

0 comments on commit 4aa37b7

Please sign in to comment.