Cadastro de convenio transportadora feat bug#AL-4346
parent
4ab4de696b
commit
7c586b8b4e
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>br.com.rjconsultores</groupId>
|
<groupId>br.com.rjconsultores</groupId>
|
||||||
<artifactId>ModelWeb</artifactId>
|
<artifactId>ModelWeb</artifactId>
|
||||||
<version>1.78.0</version>
|
<version>1.79.0</version>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
<repository>
|
<repository>
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TarifaConvenioTransport;
|
||||||
|
|
||||||
|
public interface TarifaConvenioTransportDAO extends GenericDAO<TarifaConvenioTransport, Long>{
|
||||||
|
|
||||||
|
public boolean gravarTarifasConvenio( List<TarifaConvenioTransport> tarifas);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.Criteria;
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.hibernate.criterion.Restrictions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.TarifaConvenioTransportDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TarifaConvenioTransport;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Repository("tarifaConvenioTransportDAO")
|
||||||
|
public class TarifaConvenioTransportHibernateDAO extends GenericHibernateDAO<TarifaConvenioTransport, Long> implements TarifaConvenioTransportDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public TarifaConvenioTransportHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TarifaConvenioTransport> obtenerTodos() {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean gravarTarifasConvenio(List<TarifaConvenioTransport> tarifas) {
|
||||||
|
|
||||||
|
for (TarifaConvenioTransport tarifa : tarifas) {
|
||||||
|
if(tarifa.getTarifaConvenioId() == null) {
|
||||||
|
suscribir(tarifa);
|
||||||
|
}else {
|
||||||
|
actualizacion(tarifa);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,17 +2,23 @@ package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.Where;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
@ -64,5 +70,35 @@ public class ConvenioTransportadora {
|
||||||
@Column(name = "FECMODIF")
|
@Column(name = "FECMODIF")
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
private Date fecModif;
|
private Date fecModif;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "convenioTransportadora", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||||
|
@Where(clause = "ACTIVO=1")
|
||||||
|
private List<TarifaConvenioTransport> tarifasConvenio;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
final ConvenioTransportadora other = (ConvenioTransportadora) obj;
|
||||||
|
return this.getConvenioTransportadoraId().equals(other.getConvenioTransportadoraId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 59 * hash + (this.getConvenioTransportadoraId() != null ? this.getConvenioTransportadoraId().hashCode() : 0);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.getNomeConvenio();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -4,8 +4,10 @@ import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.persistence.Basic;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
@ -16,6 +18,11 @@ import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "TARIFA_CONVENIO_TRANSP")
|
@Table(name = "TARIFA_CONVENIO_TRANSP")
|
||||||
public class TarifaConvenioTransport implements Serializable {
|
public class TarifaConvenioTransport implements Serializable {
|
||||||
|
@ -23,21 +30,21 @@ public class TarifaConvenioTransport implements Serializable {
|
||||||
private static final long serialVersionUID = 4117896818436639147L;
|
private static final long serialVersionUID = 4117896818436639147L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TARIFA_GRUPO_CONTRATO_SEQ")
|
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TARIFA_CONVENIO_TRANSP_SEQ")
|
||||||
@SequenceGenerator(name = "TARIFA_GRUPO_CONTRATO_SEQ", sequenceName = "TARIFA_GRUPO_CONTRATO_SEQ", allocationSize = 1)
|
@SequenceGenerator(name = "TARIFA_CONVENIO_TRANSP_SEQ", sequenceName = "TARIFA_CONVENIO_TRANSP_SEQ", allocationSize = 1)
|
||||||
@Column(name = "TARIFACONVENIO_ID")
|
@Column(name = "TARIFACONVENIO_ID")
|
||||||
private Long tarifaConvenioId;
|
private Long tarifaConvenioId;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "CONVENIOTRANSPORTADORA_ID", referencedColumnName = "CONVENIOTRANSPORTADORA_ID", insertable = false, updatable = false)
|
@JoinColumn(name = "CONVENIOTRANSPORTADORA_ID")
|
||||||
private ConvenioTransportadora convenioTransportadora;
|
private ConvenioTransportadora convenioTransportadora;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID", insertable = false, updatable = false)
|
@JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID")
|
||||||
private Parada origem;
|
private Parada origem;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID", insertable = false, updatable = false)
|
@JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID")
|
||||||
private Parada destino;
|
private Parada destino;
|
||||||
|
|
||||||
@Column(name = "TARIFA")
|
@Column(name = "TARIFA")
|
||||||
|
@ -49,8 +56,9 @@ public class TarifaConvenioTransport implements Serializable {
|
||||||
@Column(name = "ACTIVO")
|
@Column(name = "ACTIVO")
|
||||||
private boolean activo;
|
private boolean activo;
|
||||||
|
|
||||||
|
@Basic(optional = false)
|
||||||
@Column(name = "FECMODIF")
|
@Column(name = "FECMODIF")
|
||||||
@Temporal(TemporalType.DATE)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
private Date fecModif;
|
private Date fecModif;
|
||||||
|
|
||||||
}
|
}
|
|
@ -19,6 +19,11 @@ import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "TARIFA_GRUPO_CONTRATO")
|
@Table(name = "TARIFA_GRUPO_CONTRATO")
|
||||||
public class TarifaGrupoContrato implements Serializable{
|
public class TarifaGrupoContrato implements Serializable{
|
||||||
|
@ -64,84 +69,4 @@ public class TarifaGrupoContrato implements Serializable{
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
private Date fecModif;
|
private Date fecModif;
|
||||||
|
|
||||||
public Integer getTarifaGrupoContratoId() {
|
|
||||||
return tarifaGrupoContratoId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTarifaGrupoContratoId(Integer tarifaGrupoContratoId) {
|
|
||||||
this.tarifaGrupoContratoId = tarifaGrupoContratoId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GrupoContrato getGrupoContrato() {
|
|
||||||
return grupoContrato;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGrupoContrato(GrupoContrato grupoContrato) {
|
|
||||||
this.grupoContrato = grupoContrato;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Parada getOrigem() {
|
|
||||||
return origem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrigem(Parada origem) {
|
|
||||||
this.origem = origem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Parada getDestino() {
|
|
||||||
return destino;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDestino(Parada destino) {
|
|
||||||
this.destino = destino;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClaseServicio getClaseServicio() {
|
|
||||||
return claseServicio;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setClaseServicio(ClaseServicio claseServicio) {
|
|
||||||
this.claseServicio = claseServicio;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getTarifa() {
|
|
||||||
return tarifa;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTarifa(BigDecimal tarifa) {
|
|
||||||
this.tarifa = tarifa;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getUsuarioId() {
|
|
||||||
return usuarioId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsuarioId(Integer usuarioId) {
|
|
||||||
this.usuarioId = usuarioId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isIndCobertura() {
|
|
||||||
return indCobertura;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIndCobertura(boolean indCobertura) {
|
|
||||||
this.indCobertura = indCobertura;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isActivo() {
|
|
||||||
return activo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setActivo(boolean activo) {
|
|
||||||
this.activo = activo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getFecModif() {
|
|
||||||
return fecModif;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFecModif(Date fecModif) {
|
|
||||||
this.fecModif = fecModif;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
package com.rjconsultores.ventaboletos.service;
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.ConvenioTransportadora;
|
import com.rjconsultores.ventaboletos.entidad.ConvenioTransportadora;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TarifaConvenioTransport;
|
||||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
|
|
||||||
public interface ConvenioTransportadoraService extends GenericService<ConvenioTransportadora, Long> {
|
public interface ConvenioTransportadoraService extends GenericService<ConvenioTransportadora, Long> {
|
||||||
|
@ -11,4 +14,6 @@ public interface ConvenioTransportadoraService extends GenericService<ConvenioTr
|
||||||
|
|
||||||
public boolean existe(ConvenioTransportadora convenio);
|
public boolean existe(ConvenioTransportadora convenio);
|
||||||
|
|
||||||
|
public boolean gravarTarifasConvenio(List<TarifaConvenioTransport> lsTarifaConvenioBanco);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,9 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.ConvenioTransportadoraDAO;
|
import com.rjconsultores.ventaboletos.dao.ConvenioTransportadoraDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.TarifaConvenioTransportDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.ConvenioTransportadora;
|
import com.rjconsultores.ventaboletos.entidad.ConvenioTransportadora;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TarifaConvenioTransport;
|
||||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
import com.rjconsultores.ventaboletos.service.ConvenioTransportadoraService;
|
import com.rjconsultores.ventaboletos.service.ConvenioTransportadoraService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
@ -18,6 +20,9 @@ public class ConvenioTransportadoraServiceImpl implements ConvenioTransportadora
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ConvenioTransportadoraDAO convenioTransportadoraDAO;
|
private ConvenioTransportadoraDAO convenioTransportadoraDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TarifaConvenioTransportDAO tarifaConvenioDAO;
|
||||||
|
|
||||||
public List<ConvenioTransportadora> obtenerTodos() {
|
public List<ConvenioTransportadora> obtenerTodos() {
|
||||||
return convenioTransportadoraDAO.obtenerTodos();
|
return convenioTransportadoraDAO.obtenerTodos();
|
||||||
|
@ -73,4 +78,10 @@ public class ConvenioTransportadoraServiceImpl implements ConvenioTransportadora
|
||||||
public boolean existe(ConvenioTransportadora convenio) {
|
public boolean existe(ConvenioTransportadora convenio) {
|
||||||
return convenioTransportadoraDAO.existe(convenio);
|
return convenioTransportadoraDAO.existe(convenio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public boolean gravarTarifasConvenio(List<TarifaConvenioTransport> lsTarifa) {
|
||||||
|
return tarifaConvenioDAO.gravarTarifasConvenio(lsTarifa);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue