From 0abba6cfc9eb2f43c4a0985f76a6ffe75bf8ddc6 Mon Sep 17 00:00:00 2001 From: wilian Date: Thu, 21 May 2015 20:06:58 +0000 Subject: [PATCH] fixes bug #6332 git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@44257 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../ventaboletos/dao/ColoniaDAO.java | 2 + .../ventaboletos/dao/HotelDAO.java | 10 ++ .../ventaboletos/dao/PrecoApanheDAO.java | 10 ++ .../dao/hibernate/ColoniaHibernateDAO.java | 13 ++ .../dao/hibernate/HotelHibernateDAO.java | 39 +++++ .../hibernate/PrecoApanheHibernateDAO.java | 52 ++++++ .../ventaboletos/entidad/Colonia.java | 4 +- .../ventaboletos/entidad/Hotel.java | 165 ++++++++++++++++++ .../ventaboletos/entidad/PrecoApanhe.java | 123 +++++++++++++ .../ventaboletos/service/ColoniaService.java | 2 + .../ventaboletos/service/HotelService.java | 10 ++ .../service/PrecoApanheService.java | 10 ++ .../service/impl/ColoniaServiceImpl.java | 8 + .../service/impl/HotelServiceImpl.java | 59 +++++++ .../service/impl/PrecoApanheServiceImpl.java | 59 +++++++ 15 files changed, 565 insertions(+), 1 deletion(-) create mode 100644 src/com/rjconsultores/ventaboletos/dao/HotelDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PrecoApanheDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/HotelHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PrecoApanheHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Hotel.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PrecoApanhe.java create mode 100644 src/com/rjconsultores/ventaboletos/service/HotelService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PrecoApanheService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/HotelServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PrecoApanheServiceImpl.java diff --git a/src/com/rjconsultores/ventaboletos/dao/ColoniaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ColoniaDAO.java index 7ba18dbd6..b6d858a1f 100644 --- a/src/com/rjconsultores/ventaboletos/dao/ColoniaDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/ColoniaDAO.java @@ -6,6 +6,7 @@ package com.rjconsultores.ventaboletos.dao; import com.rjconsultores.ventaboletos.entidad.Ciudad; import com.rjconsultores.ventaboletos.entidad.Colonia; + import java.util.List; /** @@ -16,5 +17,6 @@ public interface ColoniaDAO extends GenericDAO { public List buscar(String desccolonia); public List buscarPorCiudad(Ciudad ciudad); + public List buscaLike(String desccolonia); public List buscarPorCodMun(Ciudad ciudad, String desccolonia); } diff --git a/src/com/rjconsultores/ventaboletos/dao/HotelDAO.java b/src/com/rjconsultores/ventaboletos/dao/HotelDAO.java new file mode 100644 index 000000000..749daeb3d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/HotelDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Hotel; + +public interface HotelDAO extends GenericDAO { + + public List buscar(String deschotel); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PrecoApanheDAO.java b/src/com/rjconsultores/ventaboletos/dao/PrecoApanheDAO.java new file mode 100644 index 000000000..e545a2fbc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PrecoApanheDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PrecoApanhe; + +public interface PrecoApanheDAO extends GenericDAO { + + public List buscar(String deschotel, String desccolonia, String nombciudad); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ColoniaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ColoniaHibernateDAO.java index 6d24c303e..0391cd98c 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/ColoniaHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ColoniaHibernateDAO.java @@ -7,7 +7,10 @@ package com.rjconsultores.ventaboletos.dao.hibernate; import com.rjconsultores.ventaboletos.dao.ColoniaDAO; import com.rjconsultores.ventaboletos.entidad.Ciudad; import com.rjconsultores.ventaboletos.entidad.Colonia; + import java.util.List; + +import org.hibernate.criterion.MatchMode; import org.hibernate.criterion.Order; import org.hibernate.Criteria; import org.hibernate.SessionFactory; @@ -53,6 +56,16 @@ public class ColoniaHibernateDAO extends GenericHibernateDAO return c.list(); } + @Override + public List buscaLike(String desccolonia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.like("desccolonia", desccolonia, MatchMode.START)); + c.addOrder(Order.asc("desccolonia")); + + return c.list(); + } + @Override public List buscarPorCodMun(Ciudad ciudad, String desccolonia) { Criteria c = getSession().createCriteria(getPersistentClass()); diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/HotelHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/HotelHibernateDAO.java new file mode 100644 index 000000000..0b0b34a1d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/HotelHibernateDAO.java @@ -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.HotelDAO; +import com.rjconsultores.ventaboletos.entidad.Hotel; + +@Repository("hotelDAO") +public class HotelHibernateDAO extends GenericHibernateDAO implements HotelDAO { + + @Autowired + public HotelHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String deschotel) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("deschotel", deschotel)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecoApanheHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecoApanheHibernateDAO.java new file mode 100644 index 000000000..5def1d8eb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecoApanheHibernateDAO.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.apache.commons.lang.StringUtils; +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.PrecoApanheDAO; +import com.rjconsultores.ventaboletos.entidad.PrecoApanhe; + +@Repository("precoApanheDAO") +public class PrecoApanheHibernateDAO extends GenericHibernateDAO implements PrecoApanheDAO { + + @Autowired + public PrecoApanheHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @SuppressWarnings("unchecked") + public List buscar(String deschotel, String desccolonia, String nombciudad) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if(StringUtils.isNotBlank(deschotel)) { + c.add(Restrictions.eq("hotel.deschotel", deschotel)); + } + + if(StringUtils.isNotBlank(desccolonia)) { + c.add(Restrictions.eq("colonia.desccolonia", desccolonia)); + } + + if(StringUtils.isNotBlank(nombciudad)) { + c.add(Restrictions.eq("ciudad.nombciudad", nombciudad)); + } + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Colonia.java b/src/com/rjconsultores/ventaboletos/entidad/Colonia.java index db03f8b60..467c88f54 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Colonia.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Colonia.java @@ -6,9 +6,11 @@ package com.rjconsultores.ventaboletos.entidad; import java.io.Serializable; import java.util.Date; + import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @@ -47,7 +49,7 @@ public class Colonia implements Serializable { private Date fecmodif; @Column(name = "USUARIO_ID") private Integer usuarioId; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "CIUDAD_ID") private Ciudad ciudad; diff --git a/src/com/rjconsultores/ventaboletos/entidad/Hotel.java b/src/com/rjconsultores/ventaboletos/entidad/Hotel.java new file mode 100644 index 000000000..cd7171dd2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Hotel.java @@ -0,0 +1,165 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +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.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "HOTEL") +@SequenceGenerator(name = "HOTEL_SEQ", sequenceName = "HOTEL_SEQ", allocationSize = 1) +public class Hotel implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "HOTEL_SEQ") + @Column(name = "HOTEL_ID") + private Long hotelId; + + @Column(name = "DESCHOTEL") + private String deschotel; + + @Column(name = "CEP") + private String cep; + + @Column(name = "ENDERECO") + private String endereco; + + @Column(name = "NUMERO") + private String numero; + + @Column(name = "COMPLEMENTO") + private String complemento; + + @Column(name = "BAIRRO") + private String bairro; + + @Column(name = "CIDADE") + private String cidade; + + @Column(name = "ESTADO") + private String estado; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.DATE) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getHotelId() { + return hotelId; + } + + public void setHotelId(Long hotelId) { + this.hotelId = hotelId; + } + + public String getDeschotel() { + return deschotel; + } + + public void setDeschotel(String deschotel) { + this.deschotel = deschotel; + } + + public String getCep() { + return cep; + } + + public void setCep(String cep) { + this.cep = cep; + } + + public String getEndereco() { + return endereco; + } + + public void setEndereco(String endereco) { + this.endereco = endereco; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public String getComplemento() { + return complemento; + } + + public void setComplemento(String complemento) { + this.complemento = complemento; + } + + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + public String getCidade() { + return cidade; + } + + public void setCidade(String cidade) { + this.cidade = cidade; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + 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 String toString() { + return getDeschotel(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PrecoApanhe.java b/src/com/rjconsultores/ventaboletos/entidad/PrecoApanhe.java new file mode 100644 index 000000000..dd3598b4b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PrecoApanhe.java @@ -0,0 +1,123 @@ +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.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 +@Table(name = "PRECO_APANHE") +@SequenceGenerator(name = "PRECO_APANHE_SEQ", sequenceName = "PRECO_APANHE_SEQ", allocationSize = 1) +public class PrecoApanhe implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRECO_APANHE_SEQ") + @Column(name = "PRECOAPANHE_ID") + private Long precoapanheId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "HOTEL_ID") + private Hotel hotel; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "COLONIA_ID") + private Colonia colonia; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CIUDAD_ID") + private Ciudad ciudad; + + @Column(name = "PRECO", columnDefinition = "NUMBER(5,2)") + private BigDecimal preco; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.DATE) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getPrecoapanheId() { + return precoapanheId; + } + + public void setPrecoapanheId(Long precoapanheId) { + this.precoapanheId = precoapanheId; + } + + public Hotel getHotel() { + return hotel; + } + + public void setHotel(Hotel hotel) { + this.hotel = hotel; + } + + public Colonia getColonia() { + return colonia; + } + + public void setColonia(Colonia colonia) { + this.colonia = colonia; + } + + public Ciudad getCiudad() { + return ciudad; + } + + public void setCiudad(Ciudad ciudad) { + this.ciudad = ciudad; + } + + public BigDecimal getPreco() { + return preco; + } + + public void setPreco(BigDecimal preco) { + this.preco = preco; + } + + 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; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ColoniaService.java b/src/com/rjconsultores/ventaboletos/service/ColoniaService.java index 21c7e925f..a63e11d5c 100644 --- a/src/com/rjconsultores/ventaboletos/service/ColoniaService.java +++ b/src/com/rjconsultores/ventaboletos/service/ColoniaService.java @@ -6,6 +6,7 @@ package com.rjconsultores.ventaboletos.service; import com.rjconsultores.ventaboletos.entidad.Ciudad; import com.rjconsultores.ventaboletos.entidad.Colonia; + import java.util.List; /** @@ -16,5 +17,6 @@ public interface ColoniaService extends GenericService { public List buscar(String desccolonia); public List buscarPorCiudad(Ciudad ciudad); + public List buscaLike(String desccolonia); public List buscarPorCodMun(Ciudad ciudad, String desccolonia); } diff --git a/src/com/rjconsultores/ventaboletos/service/HotelService.java b/src/com/rjconsultores/ventaboletos/service/HotelService.java new file mode 100644 index 000000000..bcb5fab0e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/HotelService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Hotel; + +public interface HotelService extends GenericService { + + public List buscar(String deschotel); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PrecoApanheService.java b/src/com/rjconsultores/ventaboletos/service/PrecoApanheService.java new file mode 100644 index 000000000..0c4a7be10 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PrecoApanheService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PrecoApanhe; + +public interface PrecoApanheService extends GenericService { + + public List buscar(String deschotel, String desccolonia, String nombciudad); +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ColoniaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ColoniaServiceImpl.java index 96fe40a34..b4ce8beba 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ColoniaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ColoniaServiceImpl.java @@ -9,9 +9,12 @@ import com.rjconsultores.ventaboletos.entidad.Ciudad; import com.rjconsultores.ventaboletos.entidad.Colonia; import com.rjconsultores.ventaboletos.service.ColoniaService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + import org.springframework.stereotype.Service; + import java.util.Calendar; import java.util.List; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; @@ -68,6 +71,11 @@ public class ColoniaServiceImpl implements ColoniaService { return coloniaDAO.buscarPorCiudad(ciudad); } + @Override + public List buscaLike(String desccolonia) { + return coloniaDAO.buscaLike(desccolonia); + } + @Override public List buscarPorCodMun(Ciudad ciudad, String desccolonia) { return coloniaDAO.buscarPorCodMun(ciudad, desccolonia); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/HotelServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/HotelServiceImpl.java new file mode 100644 index 000000000..2f3baca89 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/HotelServiceImpl.java @@ -0,0 +1,59 @@ +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.HotelDAO; +import com.rjconsultores.ventaboletos.entidad.Hotel; +import com.rjconsultores.ventaboletos.service.HotelService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("hotelService") +public class HotelServiceImpl implements HotelService { + + @Autowired + private HotelDAO hotelDAO; + + public List obtenerTodos() { + return hotelDAO.obtenerTodos(); + } + + public Hotel obtenerID(Integer id) { + return hotelDAO.obtenerID(id); + } + + @Transactional + public Hotel suscribir(Hotel entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return hotelDAO.suscribir(entidad); + } + + @Transactional + public Hotel actualizacion(Hotel entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return hotelDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Hotel entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + hotelDAO.actualizacion(entidad); + } + + public List buscar(String deschotel) { + return hotelDAO.buscar(deschotel); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PrecoApanheServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PrecoApanheServiceImpl.java new file mode 100644 index 000000000..47470d92f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PrecoApanheServiceImpl.java @@ -0,0 +1,59 @@ +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.PrecoApanheDAO; +import com.rjconsultores.ventaboletos.entidad.PrecoApanhe; +import com.rjconsultores.ventaboletos.service.PrecoApanheService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("precoApanheService") +public class PrecoApanheServiceImpl implements PrecoApanheService { + + @Autowired + private PrecoApanheDAO precoApanheDAO; + + public List obtenerTodos() { + return precoApanheDAO.obtenerTodos(); + } + + public PrecoApanhe obtenerID(Integer id) { + return precoApanheDAO.obtenerID(id); + } + + @Transactional + public PrecoApanhe suscribir(PrecoApanhe entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return precoApanheDAO.suscribir(entidad); + } + + @Transactional + public PrecoApanhe actualizacion(PrecoApanhe entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return precoApanheDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PrecoApanhe entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + precoApanheDAO.actualizacion(entidad); + } + + public List buscar(String deschotel, String desccolonia, String nombciudad) { + return precoApanheDAO.buscar(deschotel, desccolonia, nombciudad); + } +}