Seguro Tarifa
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@20998 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
4ee9e59926
commit
b74a6c5275
|
@ -1,12 +1,18 @@
|
||||||
package com.rjconsultores.ventaboletos.dao;
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.SeguroTarifa;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface SeguroTarifaDAO {
|
public interface SeguroTarifaDAO extends GenericDAO<SeguroTarifa, Integer> {
|
||||||
/**
|
|
||||||
* Indica se existe seguroTarifa para o orgaoConcedenteId informado
|
/**
|
||||||
*
|
* Indica se existe seguroTarifa para o orgaoConcedenteId informado
|
||||||
* @param orgaoConcedenteId
|
*
|
||||||
* @return
|
* @param orgaoConcedenteId
|
||||||
*/
|
* @return
|
||||||
public boolean existe(Integer orgaoConcedenteId);
|
*/
|
||||||
|
public boolean existe(Integer orgaoConcedenteId);
|
||||||
|
|
||||||
|
public List<SeguroTarifa> buscarPorOrgao(OrgaoConcedente orgao);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,25 +9,34 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.SeguroTarifaDAO;
|
import com.rjconsultores.ventaboletos.dao.SeguroTarifaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
import com.rjconsultores.ventaboletos.entidad.SeguroTarifa;
|
import com.rjconsultores.ventaboletos.entidad.SeguroTarifa;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Repository("seguroTarifaDAO")
|
@Repository("seguroTarifaDAO")
|
||||||
public class SeguroTarifaHibernateDAO extends GenericHibernateDAO<SeguroTarifa, Integer> implements SeguroTarifaDAO {
|
public class SeguroTarifaHibernateDAO extends GenericHibernateDAO<SeguroTarifa, Integer> implements SeguroTarifaDAO {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public SeguroTarifaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
public SeguroTarifaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
setSessionFactory(factory);
|
setSessionFactory(factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean existe(Integer orgaoConcedenteId) {
|
public boolean existe(Integer orgaoConcedenteId) {
|
||||||
Criteria c= makeCriteria();
|
Criteria c = makeCriteria();
|
||||||
c.add(Restrictions.eq("orgaoconcedente.orgaoConcedenteId", orgaoConcedenteId));
|
c.add(Restrictions.eq("orgaoconcedente.orgaoConcedenteId", orgaoConcedenteId));
|
||||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
c.setProjection(Projections.rowCount());
|
c.setProjection(Projections.rowCount());
|
||||||
|
|
||||||
|
|
||||||
return HibernateFix.count(c.list()) > 0;
|
return HibernateFix.count(c.list()) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<SeguroTarifa> buscarPorOrgao(OrgaoConcedente orgao) {
|
||||||
|
Criteria c = makeCriteria();
|
||||||
|
c.add(Restrictions.eq("orgaoconcedente", orgao));
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,12 @@ import java.util.Date;
|
||||||
import javax.persistence.Basic;
|
import javax.persistence.Basic;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
|
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;
|
||||||
|
@ -23,14 +26,17 @@ import javax.persistence.TemporalType;
|
||||||
* @author gleimar
|
* @author gleimar
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
|
@SequenceGenerator(name = "SEGURO_TARIFA_SEQ", sequenceName = "SEGURO_TARIFA_SEQ", allocationSize = 1)
|
||||||
@Table(name = "SEGURO_TARIFA")
|
@Table(name = "SEGURO_TARIFA")
|
||||||
public class SeguroTarifa implements Serializable {
|
public class SeguroTarifa implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@Id
|
@Id
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEGURO_TARIFA_SEQ")
|
||||||
@Column(name = "SEGUROTARIFA_ID")
|
@Column(name = "SEGUROTARIFA_ID")
|
||||||
private Integer segurotarifaId;
|
private Integer segurotarifaId;
|
||||||
@Column(name = "VALORTARIFA")
|
@Column(name = "VALORTAXA")
|
||||||
private BigDecimal valortarifa;
|
private BigDecimal valortarifa;
|
||||||
@Column(name = "VALORTARIFAATE")
|
@Column(name = "VALORTARIFAATE")
|
||||||
private BigDecimal valortarifaate;
|
private BigDecimal valortarifaate;
|
||||||
|
@ -68,8 +74,6 @@ public class SeguroTarifa implements Serializable {
|
||||||
this.valortarifa = valortarifa;
|
this.valortarifa = valortarifa;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 0;
|
int hash = 0;
|
||||||
|
@ -95,44 +99,43 @@ public class SeguroTarifa implements Serializable {
|
||||||
return "com.rjconsultores.ventaboletos.entidad.SeguroTarifa[ segurotarifaId=" + segurotarifaId + " ]";
|
return "com.rjconsultores.ventaboletos.entidad.SeguroTarifa[ segurotarifaId=" + segurotarifaId + " ]";
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getValortarifaate() {
|
public BigDecimal getValortarifaate() {
|
||||||
return valortarifaate;
|
return valortarifaate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValortarifaate(BigDecimal valortarifaate) {
|
public void setValortarifaate(BigDecimal valortarifaate) {
|
||||||
this.valortarifaate = valortarifaate;
|
this.valortarifaate = valortarifaate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrgaoConcedente getOrgaoconcedente() {
|
public OrgaoConcedente getOrgaoconcedente() {
|
||||||
return orgaoconcedente;
|
return orgaoconcedente;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOrgaoconcedente(OrgaoConcedente orgaoconcedente) {
|
public void setOrgaoconcedente(OrgaoConcedente orgaoconcedente) {
|
||||||
this.orgaoconcedente = orgaoconcedente;
|
this.orgaoconcedente = orgaoconcedente;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getActivo() {
|
public Boolean getActivo() {
|
||||||
return activo;
|
return activo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActivo(Boolean activo) {
|
public void setActivo(Boolean activo) {
|
||||||
this.activo = activo;
|
this.activo = activo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getFecmodif() {
|
public Date getFecmodif() {
|
||||||
return fecmodif;
|
return fecmodif;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFecmodif(Date fecmodif) {
|
public void setFecmodif(Date fecmodif) {
|
||||||
this.fecmodif = fecmodif;
|
this.fecmodif = fecmodif;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getUsuarioId() {
|
public Integer getUsuarioId() {
|
||||||
return usuarioId;
|
return usuarioId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsuarioId(Integer usuarioId) {
|
|
||||||
this.usuarioId = usuarioId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public void setUsuarioId(Integer usuarioId) {
|
||||||
|
this.usuarioId = usuarioId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
package com.rjconsultores.ventaboletos.service;
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.SeguroTarifa;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface SeguroTarifaService {
|
|
||||||
|
public interface SeguroTarifaService extends GenericService<SeguroTarifa, Integer>{
|
||||||
|
|
||||||
|
public List<SeguroTarifa> buscarPorOrgao(OrgaoConcedente orgao);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,56 @@
|
||||||
package com.rjconsultores.ventaboletos.service.impl;
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.SeguroTarifa;
|
||||||
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.SeguroTarifaDAO;
|
import com.rjconsultores.ventaboletos.dao.SeguroTarifaDAO;
|
||||||
import com.rjconsultores.ventaboletos.service.SeguroTarifaService;
|
import com.rjconsultores.ventaboletos.service.SeguroTarifaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Service("seguroTarifaService")
|
@Service("seguroTarifaService")
|
||||||
public class SeguroTarifaServiceImpl implements SeguroTarifaService {
|
public class SeguroTarifaServiceImpl implements SeguroTarifaService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SeguroTarifaDAO seguroTarifaDAO;
|
private SeguroTarifaDAO seguroTarifaDAO;
|
||||||
|
|
||||||
|
public List<SeguroTarifa> obtenerTodos() {
|
||||||
|
return seguroTarifaDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SeguroTarifa obtenerID(Integer id) {
|
||||||
|
return seguroTarifaDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public SeguroTarifa suscribir(SeguroTarifa entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
return seguroTarifaDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public SeguroTarifa actualizacion(SeguroTarifa entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
return seguroTarifaDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void borrar(SeguroTarifa entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
seguroTarifaDAO.borrar(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SeguroTarifa> buscarPorOrgao(OrgaoConcedente orgao) {
|
||||||
|
return seguroTarifaDAO.buscarPorOrgao(orgao);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue