Atendimento inicial da demanda 6401
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@45378 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
6548545979
commit
d45d6c6755
|
@ -0,0 +1,13 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TarifaKm;
|
||||||
|
|
||||||
|
public interface TarifaKmDAO extends GenericDAO<TarifaKm, Integer>{
|
||||||
|
|
||||||
|
public List<TarifaKm> buscarPorOrgaoAndClasse(OrgaoConcedente orgaoconcedenteId, ClaseServicio claseId);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
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.TarifaKmDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TarifaKm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author daniel.zauli
|
||||||
|
*/
|
||||||
|
@Repository("tarifaKmDAO")
|
||||||
|
public class TarifaKmHibernateDAO extends GenericHibernateDAO<TarifaKm, Integer>
|
||||||
|
implements TarifaKmDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public TarifaKmHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TarifaKm> buscarPorOrgaoAndClasse(OrgaoConcedente orgaoconcedenteId, ClaseServicio claseId) {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
c.add(Restrictions.eq("orgaoconcedenteId", orgaoconcedenteId));
|
||||||
|
c.add(Restrictions.eq("claseServicio", claseId));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -22,6 +22,7 @@ import javax.persistence.TemporalType;
|
||||||
public class OrgaoConcedente implements Serializable {
|
public class OrgaoConcedente implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
public final static Integer CODIGO_ARTESP = 21;
|
||||||
@Id
|
@Id
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "ORGAO_CONCEDENTE_SEQ")
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "ORGAO_CONCEDENTE_SEQ")
|
||||||
|
|
|
@ -0,0 +1,157 @@
|
||||||
|
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;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author daniel.zauli
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@SequenceGenerator(name = "TARIFA_KM_SEQ", sequenceName = "TARIFA_KM_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "TARIFA_KM")
|
||||||
|
public class TarifaKm implements Serializable, Comparable<TarifaKm>{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_KM_SEQ")
|
||||||
|
@Column(name = "TARIFAKM_ID")
|
||||||
|
private Integer tarifakmId;
|
||||||
|
|
||||||
|
@JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID")
|
||||||
|
@ManyToOne
|
||||||
|
private OrgaoConcedente orgaoconcedenteId;
|
||||||
|
|
||||||
|
@Column(name = "KMATE")
|
||||||
|
private Integer kmate;
|
||||||
|
|
||||||
|
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
|
||||||
|
@Column(name = "VALORTAXA") // tarifa
|
||||||
|
private BigDecimal valortaxa;
|
||||||
|
|
||||||
|
@JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID")
|
||||||
|
@ManyToOne
|
||||||
|
private ClaseServicio claseServicio;
|
||||||
|
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
public TarifaKm(){}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 0;
|
||||||
|
hash += (tarifakmId != null ? tarifakmId.hashCode() : 0);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object object) {
|
||||||
|
// TODO: Warning - this method won't work in the case the id fields are not set
|
||||||
|
if (!(object instanceof TarifaKm)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
TarifaKm other = (TarifaKm) object;
|
||||||
|
if ((this.tarifakmId == null && other.tarifakmId != null) || (this.tarifakmId != null && !this.tarifakmId.equals(other.tarifakmId))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "com.rjconsultores.ventaboletos.entidad.TarifaKm[ tarifakmId=" + tarifakmId + " ]";
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getTarifakmId() {
|
||||||
|
return tarifakmId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTarifakmId(Integer tarifakmId) {
|
||||||
|
this.tarifakmId = tarifakmId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrgaoConcedente getOrgaoconcedenteId() {
|
||||||
|
return orgaoconcedenteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrgaoconcedenteId(OrgaoConcedente orgaoconcedenteId) {
|
||||||
|
this.orgaoconcedenteId = orgaoconcedenteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getKmate() {
|
||||||
|
return kmate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKmate(Integer kmate) {
|
||||||
|
this.kmate = kmate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getValortaxa() {
|
||||||
|
return valortaxa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValortaxa(BigDecimal valortaxa) {
|
||||||
|
this.valortaxa = valortaxa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClaseServicio getClaseServicio() {
|
||||||
|
return claseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClaseServicio(ClaseServicio claseServicio) {
|
||||||
|
this.claseServicio = claseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 compareTo(TarifaKm tkm) {
|
||||||
|
return this.getKmate() - tkm.getKmate();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TarifaKm;
|
||||||
|
|
||||||
|
public interface TarifaKmService extends GenericService<TarifaKm, Integer>{
|
||||||
|
|
||||||
|
public List<TarifaKm> buscarPorOrgaoAndClasse(OrgaoConcedente orgaoconcedenteId, ClaseServicio claseId);
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.TarifaKmDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.TaxaEmbarqueKmDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TarifaKm;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueKm;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TarifaKmService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@Service("tarifaKmService")
|
||||||
|
public class TarifaKmServiceImpl implements TarifaKmService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TarifaKmDAO tarifaKmDAO;
|
||||||
|
|
||||||
|
public List<TarifaKm> buscarPorOrgaoAndClasse(OrgaoConcedente orgaoconcedenteId, ClaseServicio claseId) {
|
||||||
|
return tarifaKmDAO.buscarPorOrgaoAndClasse( orgaoconcedenteId, claseId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TarifaKm> obtenerTodos() {
|
||||||
|
return tarifaKmDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TarifaKm obtenerID(Integer id) {
|
||||||
|
return tarifaKmDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public TarifaKm actualizacion(TarifaKm entidad) {
|
||||||
|
return tarifaKmDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public TarifaKm suscribir(TarifaKm entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return tarifaKmDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void borrar(TarifaKm entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
tarifaKmDAO.borrar(entidad);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue