From 92df812ce8e4d0c7c8d724223cfd40c982a2c201 Mon Sep 17 00:00:00 2001 From: wilian Date: Wed, 9 Aug 2017 17:38:46 +0000 Subject: [PATCH] fixes bug #9567 git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@72464 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../NotaCreditoVendaPacoteHibernateDAO.java | 21 ++++----- .../entidad/NotaCreditoVendaPacote.java | 44 ++++++++++--------- .../ReembolsoOcdNotaCreditoVO.java | 1 + 3 files changed, 36 insertions(+), 30 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/NotaCreditoVendaPacoteHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/NotaCreditoVendaPacoteHibernateDAO.java index b4ea83cac..cf0af93cd 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/NotaCreditoVendaPacoteHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/NotaCreditoVendaPacoteHibernateDAO.java @@ -34,37 +34,38 @@ public class NotaCreditoVendaPacoteHibernateDAO extends GenericHibernateDAO busquedaDatosReembolsoOcdNotaCreditoRS(Date fecInicial, Date fecFinal, Date fecPagamentoInicial, Date fecPagamentoFinal, Boolean indPago) { Map params = new HashMap(); - String queryString = "SELECT n FROM NotaCreditoVendaPacote n " - + "LEFT JOIN FETCH n.ocdDatosPagamentoList " - + "WHERE 1=1 "; + StringBuilder queryString = new StringBuilder("SELECT n FROM NotaCreditoVendaPacote n "); + queryString.append("LEFT JOIN FETCH n.ocdDatosPagamentoList ") + .append("LEFT JOIN FETCH n.vendapacotecancelamento vpc ") + .append("WHERE 1=1 "); if (fecInicial != null) { - queryString += "AND n.datanotacredito >= :fecInicial "; + queryString.append("AND n.datanotacredito >= :fecInicial "); params.put("fecInicial", fecInicial); } if (fecFinal != null) { - queryString += "AND n.datanotacredito <= :fecFinal "; + queryString.append("AND n.datanotacredito <= :fecFinal "); params.put("fecFinal", fecFinal); } if (fecPagamentoInicial != null) { - queryString += "AND n.datapagamento >= :fecPagamentoInicial "; + queryString.append("AND n.datapagamento >= :fecPagamentoInicial "); params.put("fecPagamentoInicial", fecPagamentoInicial); } if (fecPagamentoFinal != null) { - queryString += "AND n.datapagamento <= :fecPagamentoFinal "; + queryString.append("AND n.datapagamento <= :fecPagamentoFinal "); params.put("fecPagamentoFinal", fecPagamentoFinal); } if (indPago != null) { if (indPago) { - queryString += "AND n.situacao = :indPago "; + queryString.append("AND n.situacao = :indPago "); } else { - queryString += "AND (n.situacao != :indPago OR n.situacao IS NULL) "; + queryString.append("AND (n.situacao != :indPago OR n.situacao IS NULL) "); } params.put("indPago", SituacaoVendaPacote.PAGO.getShortValue()); } - Query query = getSession().createQuery(queryString); + Query query = getSession().createQuery(queryString.toString()); for (String p : query.getNamedParameters()) { query.setParameter(p, params.get(p)); } diff --git a/src/com/rjconsultores/ventaboletos/entidad/NotaCreditoVendaPacote.java b/src/com/rjconsultores/ventaboletos/entidad/NotaCreditoVendaPacote.java index f1f9d6b42..1f023e549 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/NotaCreditoVendaPacote.java +++ b/src/com/rjconsultores/ventaboletos/entidad/NotaCreditoVendaPacote.java @@ -7,6 +7,8 @@ import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Temporal; @@ -25,11 +27,13 @@ public class NotaCreditoVendaPacote implements java.io.Serializable { @Column(name = "MOTIVOCANCELVENDAPACOTE_ID", precision = 7, scale = 0) private Integer motivocancelvendapacoteId; - @Column(name = "VENDAPACOTECANCELAMENTO_ID", precision = 7, scale = 0) - private Integer vendapacotecancelamentoId; + @ManyToOne + @JoinColumn(name = "VENDAPACOTECANCELAMENTO_ID") + private VendaPacote vendapacotecancelamento; - @Column(name = "VENDAPACOTEPAGAMENTO_ID", precision = 7, scale = 0) - private Integer vendapacotepagamentoId; + @ManyToOne + @JoinColumn(name = "VENDAPACOTEPAGAMENTO_ID") + private VendaPacote vendapacotepagamento; @Temporal(TemporalType.DATE) @Column(name = "DATAPAGAMENTO", length = 7) @@ -89,22 +93,6 @@ public class NotaCreditoVendaPacote implements java.io.Serializable { this.motivocancelvendapacoteId = motivocancelvendapacoteId; } - public Integer getVendapacotecancelamentoId() { - return vendapacotecancelamentoId; - } - - public void setVendapacotecancelamentoId(Integer vendapacotecancelamentoId) { - this.vendapacotecancelamentoId = vendapacotecancelamentoId; - } - - public Integer getVendapacotepagamentoId() { - return vendapacotepagamentoId; - } - - public void setVendapacotepagamentoId(Integer vendapacotepagamentoId) { - this.vendapacotepagamentoId = vendapacotepagamentoId; - } - public Date getDatapagamento() { return datapagamento; } @@ -213,4 +201,20 @@ public class NotaCreditoVendaPacote implements java.io.Serializable { return situacao; } + public VendaPacote getVendapacotecancelamento() { + return vendapacotecancelamento; + } + + public void setVendapacotecancelamento(VendaPacote vendapacotecancelamento) { + this.vendapacotecancelamento = vendapacotecancelamento; + } + + public VendaPacote getVendapacotepagamento() { + return vendapacotepagamento; + } + + public void setVendapacotepagamento(VendaPacote vendapacotepagamento) { + this.vendapacotepagamento = vendapacotepagamento; + } + } diff --git a/src/com/rjconsultores/ventaboletos/vo/reembolsoocdnotacredito/ReembolsoOcdNotaCreditoVO.java b/src/com/rjconsultores/ventaboletos/vo/reembolsoocdnotacredito/ReembolsoOcdNotaCreditoVO.java index b4ca2b36c..2c3ff2615 100644 --- a/src/com/rjconsultores/ventaboletos/vo/reembolsoocdnotacredito/ReembolsoOcdNotaCreditoVO.java +++ b/src/com/rjconsultores/ventaboletos/vo/reembolsoocdnotacredito/ReembolsoOcdNotaCreditoVO.java @@ -361,6 +361,7 @@ public class ReembolsoOcdNotaCreditoVO { vo.localizador = String.valueOf(notaCredito.getNotaCreditoVendaPacoteId()); vo.data = notaCredito.getDatanotacredito(); vo.dataPagamento = notaCredito.getDatapagamento(); + vo.numoperacion = notaCredito.getVendapacotecancelamento().getNumoperacion(); if(notaCredito.getSituacao().equals(SituacaoNotaCreditoVendaPacote.UTILIZADA.getValue())) { vo.valor = notaCredito.getValor();