mantis #6989
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@52647 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
5983115a0d
commit
4cbd5de4e9
|
@ -11,6 +11,7 @@ import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
|||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
import com.rjconsultores.ventaboletos.entidad.Plaza;
|
||||
import com.rjconsultores.ventaboletos.entidad.TarifaMinima;
|
||||
import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
@ -45,4 +46,9 @@ public interface TarifaMinimaDAO extends GenericDAO<TarifaMinima, Integer> {
|
|||
|
||||
public List<TarifaMinima> buscarPorClaseServicioMoneda(ClaseServicio claseServicio,
|
||||
Moneda moneda);
|
||||
|
||||
public TarifaMinimaCategoria adicionarTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria);
|
||||
|
||||
public void removerTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria);
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
|||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
import com.rjconsultores.ventaboletos.entidad.Plaza;
|
||||
import com.rjconsultores.ventaboletos.entidad.TarifaMinima;
|
||||
import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
@ -24,6 +25,7 @@ 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 org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -203,4 +205,17 @@ public class TarifaMinimaHibernateDAO extends GenericHibernateDAO<TarifaMinima,
|
|||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public TarifaMinimaCategoria adicionarTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria) {
|
||||
getSession().save(tarifaMinimaCategoria);
|
||||
return tarifaMinimaCategoria;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void removerTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria) {
|
||||
getSession().merge(tarifaMinimaCategoria);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@ package com.rjconsultores.ventaboletos.entidad;
|
|||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
@ -14,11 +16,14 @@ import javax.persistence.GeneratedValue;
|
|||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -66,6 +71,10 @@ public class TarifaMinima implements Serializable {
|
|||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
||||
@OneToMany(mappedBy = "tarifaMinima")
|
||||
@Where(clause = "ACTIVO = 1")
|
||||
private List<TarifaMinimaCategoria> tarifaMinimaCategorias;
|
||||
|
||||
public TarifaMinima() {
|
||||
}
|
||||
|
||||
|
@ -193,4 +202,12 @@ public class TarifaMinima implements Serializable {
|
|||
public String toString() {
|
||||
return "com.rjconsultores.ventaboletos.entidad.TarifaMinima[tarifaminimaId=" + tarifaminimaId + "]";
|
||||
}
|
||||
|
||||
public java.util.List<TarifaMinimaCategoria> getTarifaMinimaCategorias() {
|
||||
return tarifaMinimaCategorias;
|
||||
}
|
||||
|
||||
public void setTarifaMinimaCategorias(java.util.List<TarifaMinimaCategoria> tarifaMinimaCategorias) {
|
||||
this.tarifaMinimaCategorias = tarifaMinimaCategorias;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
package com.rjconsultores.ventaboletos.entidad;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
@Entity
|
||||
@SequenceGenerator(name = "TARIFA_MINIMA_CATEGORIA_SEQ", sequenceName = "TARIFA_MINIMA_CATEGORIA_SEQ", allocationSize = 1)
|
||||
@Table(name = "TARIFA_MINIMA_CATEGORIA")
|
||||
public class TarifaMinimaCategoria implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Column(name = "TARIFAMINIMACATEGORIA_ID")
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_MINIMA_CATEGORIA_SEQ")
|
||||
private Long tarifaminimacategoriaId;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "CATEGORIA_ID")
|
||||
private Categoria categoria;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "TARIFAMINIMA_ID")
|
||||
private TarifaMinima tarifaMinima;
|
||||
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
||||
public Long getTarifaminimacategoriaId() {
|
||||
return tarifaminimacategoriaId;
|
||||
}
|
||||
|
||||
public void setTarifaminimacategoriaId(Long tarifaminimacategoriaId) {
|
||||
this.tarifaminimacategoriaId = tarifaminimacategoriaId;
|
||||
}
|
||||
|
||||
public Categoria getCategoria() {
|
||||
return categoria;
|
||||
}
|
||||
|
||||
public void setCategoria(Categoria categoria) {
|
||||
this.categoria = categoria;
|
||||
}
|
||||
|
||||
public TarifaMinima getTarifaMinima() {
|
||||
return tarifaMinima;
|
||||
}
|
||||
|
||||
public void setTarifaMinima(TarifaMinima tarifaMinima) {
|
||||
this.tarifaMinima = tarifaMinima;
|
||||
}
|
||||
|
||||
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() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((tarifaminimacategoriaId == null) ? 0 : tarifaminimacategoriaId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
TarifaMinimaCategoria other = (TarifaMinimaCategoria) obj;
|
||||
if (tarifaminimacategoriaId == null) {
|
||||
if (other.tarifaminimacategoriaId != null)
|
||||
return false;
|
||||
} else if (!tarifaminimacategoriaId.equals(other.tarifaminimacategoriaId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -11,6 +11,7 @@ import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
|||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
import com.rjconsultores.ventaboletos.entidad.Plaza;
|
||||
import com.rjconsultores.ventaboletos.entidad.TarifaMinima;
|
||||
import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
@ -42,4 +43,9 @@ public interface TarifaMinimaService extends GenericService<TarifaMinima, Intege
|
|||
public List<TarifaMinima> buscarPorMarca(Marca marca, Moneda moneda);
|
||||
|
||||
public List<TarifaMinima> buscarPorClaseServico(ClaseServicio claseServicio, Moneda moneda);
|
||||
|
||||
public TarifaMinimaCategoria adicionarTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria);
|
||||
|
||||
public void removerTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria);
|
||||
|
||||
}
|
||||
|
|
|
@ -12,11 +12,13 @@ import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
|||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
import com.rjconsultores.ventaboletos.entidad.Plaza;
|
||||
import com.rjconsultores.ventaboletos.entidad.TarifaMinima;
|
||||
import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria;
|
||||
import com.rjconsultores.ventaboletos.service.TarifaMinimaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -112,4 +114,20 @@ public class TarifaMinimaServiceImpl implements TarifaMinimaService {
|
|||
public List<TarifaMinima> buscarPorPlazaMoneda(Plaza plaza, Moneda moneda) {
|
||||
return tarifaMinimaDAO.buscarPorPlazaMoneda(plaza, moneda);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TarifaMinimaCategoria adicionarTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria) {
|
||||
tarifaMinimaCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
tarifaMinimaCategoria.setFecmodif(new Date());
|
||||
tarifaMinimaCategoria.setActivo(Boolean.TRUE);
|
||||
return tarifaMinimaDAO.adicionarTarifaMinimaCategoria(tarifaMinimaCategoria);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removerTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria) {
|
||||
tarifaMinimaCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
tarifaMinimaCategoria.setFecmodif(new Date());
|
||||
tarifaMinimaCategoria.setActivo(Boolean.FALSE);
|
||||
tarifaMinimaDAO.removerTarifaMinimaCategoria(tarifaMinimaCategoria);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue