fix bug #0009037 - corrigido duplicação de preço na geração do preço do pedagio
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@69375 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
490f734bc7
commit
db0b6b31ad
|
@ -10,12 +10,14 @@ import java.util.ArrayList;
|
|||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.velocity.runtime.directive.Foreach;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -150,10 +152,12 @@ public class CalcularPeajeHibernateDAO extends GenericHibernateDAO<String, Strin
|
|||
boolean isOrgaoNull = orgao == null;
|
||||
List<String> updates = new ArrayList<String>();
|
||||
List<PeajeVO> peajes = new ArrayList<PeajeVO>();
|
||||
|
||||
List<ClasseIndicePeaje> classeIndicePeajes = new ArrayList<ClasseIndicePeaje>();
|
||||
if(orgao != null){
|
||||
orgao = orgaoConcedenteService.obtenerID(orgao.getOrgaoConcedenteId());
|
||||
classeIndicePeajes = orgao.getClassesIndicePeaje();
|
||||
isOrgaoNull = orgao == null;
|
||||
}
|
||||
|
||||
log.debug("****** INICIO DO PROCESSO DE CALCULO DE PEDAGIO ******");
|
||||
|
@ -165,14 +169,14 @@ public class CalcularPeajeHibernateDAO extends GenericHibernateDAO<String, Strin
|
|||
|
||||
List<Object> lsObj = buscarCasetasPeajeWithinTramo(ruta);
|
||||
log.debug("****** QTD COMBINAÇÕES DE TRECHOS x QTD PEDAGIOS POR TRECHO: "+lsObj.size()+" ******");
|
||||
|
||||
if(isOrgaoNull){
|
||||
orgao = orgaoConcedenteService.obtenerID(ruta.getOrgaoConcedente().getOrgaoConcedenteId());
|
||||
classeIndicePeajes = orgao.getClassesIndicePeaje();
|
||||
String update = " update peaje set activo = 0 where ruta_id ="+ruta.getRutaId();
|
||||
updates.add(update);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (null != lsObj) {
|
||||
for (Object arrObj : lsObj) {
|
||||
BigDecimal bigKm = new BigDecimal(((Object[]) arrObj)[11].toString()) ;
|
||||
|
@ -187,6 +191,7 @@ public class CalcularPeajeHibernateDAO extends GenericHibernateDAO<String, Strin
|
|||
List<PrecioFixoPedagio> list = precioFixoPedagioService.buscarPrecioFixoPedagio(pfp);
|
||||
|
||||
if(list.size()>=1){
|
||||
|
||||
pvo.importePeaje = list.get(0).getValorFixo();
|
||||
}
|
||||
|
||||
|
@ -196,7 +201,19 @@ public class CalcularPeajeHibernateDAO extends GenericHibernateDAO<String, Strin
|
|||
log.debug("****** FIM LINHA : "+ruta.toString()+" . INSTRUCOES DE INSERT NO BANCO PRONTAS ******");
|
||||
}
|
||||
log.debug("****** FIM DO PROCESSO DE CALCULO DE PEDAGIO ******");
|
||||
|
||||
|
||||
if(peajes.size()>1){
|
||||
for (int i = 0 ; peajes.size()>i;) {
|
||||
int posicao = peajes.lastIndexOf(peajes.get(i));
|
||||
if(posicao != i){
|
||||
peajes.remove(posicao);
|
||||
i=0;
|
||||
}else{
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
StringBuilder updateSql = new StringBuilder();
|
||||
if(isOrgaoNull == false){
|
||||
updateSql = new StringBuilder()
|
||||
|
@ -515,5 +532,92 @@ public class CalcularPeajeHibernateDAO extends GenericHibernateDAO<String, Strin
|
|||
.append(")")
|
||||
.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((activo == null) ? 0 : activo.hashCode());
|
||||
result = prime * result + ((cantAsientos == null) ? 0 : cantAsientos.hashCode());
|
||||
result = prime * result + ((cantEixos == null) ? 0 : cantEixos.hashCode());
|
||||
result = prime * result + ((casetaPeajeId == null) ? 0 : casetaPeajeId.hashCode());
|
||||
result = prime * result + ((destinoId == null) ? 0 : destinoId.hashCode());
|
||||
result = prime * result + ((importePeaje == null) ? 0 : importePeaje.hashCode());
|
||||
result = prime * result + ((indicePeaje == null) ? 0 : indicePeaje.hashCode());
|
||||
result = prime * result + ((orgaoId == null) ? 0 : orgaoId.hashCode());
|
||||
result = prime * result + ((origenId == null) ? 0 : origenId.hashCode());
|
||||
result = prime * result + ((rutaId == null) ? 0 : rutaId.hashCode());
|
||||
result = prime * result + ((usuarioId == null) ? 0 : usuarioId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
PeajeVO other = (PeajeVO) obj;
|
||||
if (activo == null) {
|
||||
if (other.activo != null)
|
||||
return false;
|
||||
} else if (!activo.equals(other.activo))
|
||||
return false;
|
||||
if (cantAsientos == null) {
|
||||
if (other.cantAsientos != null)
|
||||
return false;
|
||||
} else if (!cantAsientos.equals(other.cantAsientos))
|
||||
return false;
|
||||
if (cantEixos == null) {
|
||||
if (other.cantEixos != null)
|
||||
return false;
|
||||
} else if (!cantEixos.equals(other.cantEixos))
|
||||
return false;
|
||||
if (casetaPeajeId == null) {
|
||||
if (other.casetaPeajeId != null)
|
||||
return false;
|
||||
} else if (!casetaPeajeId.equals(other.casetaPeajeId))
|
||||
return false;
|
||||
if (destinoId == null) {
|
||||
if (other.destinoId != null)
|
||||
return false;
|
||||
} else if (!destinoId.equals(other.destinoId))
|
||||
return false;
|
||||
if (importePeaje == null) {
|
||||
if (other.importePeaje != null)
|
||||
return false;
|
||||
} else if (!importePeaje.equals(other.importePeaje))
|
||||
return false;
|
||||
if (indicePeaje == null) {
|
||||
if (other.indicePeaje != null)
|
||||
return false;
|
||||
} else if (!indicePeaje.equals(other.indicePeaje))
|
||||
return false;
|
||||
if (orgaoId == null) {
|
||||
if (other.orgaoId != null)
|
||||
return false;
|
||||
} else if (!orgaoId.equals(other.orgaoId))
|
||||
return false;
|
||||
if (origenId == null) {
|
||||
if (other.origenId != null)
|
||||
return false;
|
||||
} else if (!origenId.equals(other.origenId))
|
||||
return false;
|
||||
if (rutaId == null) {
|
||||
if (other.rutaId != null)
|
||||
return false;
|
||||
} else if (!rutaId.equals(other.rutaId))
|
||||
return false;
|
||||
if (usuarioId == null) {
|
||||
if (other.usuarioId != null)
|
||||
return false;
|
||||
} else if (!usuarioId.equals(other.usuarioId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ package com.rjconsultores.ventaboletos.entidad;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
|
@ -17,6 +18,8 @@ import javax.persistence.ManyToOne;
|
|||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
/**
|
||||
* @author Bruno Neves
|
||||
|
@ -39,19 +42,30 @@ public class PrecioFixoPedagio implements Serializable {
|
|||
private Integer precioFixoId;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "PRACA_PEDAGIO_ID", referencedColumnName = "CASETAPEAJE_ID")
|
||||
@JoinColumn(name = "PRACAPEDAGIO_ID", referencedColumnName = "CASETAPEAJE_ID")
|
||||
private CasetaPeaje pracaPedagioId;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "ORGAO_CONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID")
|
||||
@JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID")
|
||||
private OrgaoConcedente orgaoConcedenteId;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "CLASSE_SERVICO_ID", referencedColumnName = "CLASESERVICIO_ID")
|
||||
@JoinColumn(name = "CLASSESERVICO_ID", referencedColumnName = "CLASESERVICIO_ID")
|
||||
private ClaseServicio classeId;
|
||||
|
||||
@Column(name = "VALOR_FIXO")
|
||||
@Column(name = "VALORFIXO")
|
||||
private BigDecimal valorFixo;
|
||||
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
||||
|
||||
public Integer getPrecioFixoId() {
|
||||
return precioFixoId;
|
||||
|
@ -92,6 +106,31 @@ public class PrecioFixoPedagio implements Serializable {
|
|||
public void setValorFixo(BigDecimal valorFixo) {
|
||||
this.valorFixo = valorFixo;
|
||||
}
|
||||
|
||||
|
||||
public Boolean getActivo() {
|
||||
return activo;
|
||||
}
|
||||
|
||||
public void setActivo(Boolean activo) {
|
||||
this.activo = activo;
|
||||
}
|
||||
|
||||
public Date getFecmodif() {
|
||||
return fecmodif;
|
||||
}
|
||||
|
||||
public void setFecmodif(Date fecmodif) {
|
||||
this.fecmodif = fecmodif;
|
||||
}
|
||||
|
||||
public Integer getUsuarioId() {
|
||||
return usuarioId;
|
||||
}
|
||||
|
||||
public void setUsuarioId(Integer usuarioId) {
|
||||
this.usuarioId = usuarioId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
|
Loading…
Reference in New Issue