From 491da87ec8ef0db1f022615362bb3cfaacf5b6c0 Mon Sep 17 00:00:00 2001 From: "daniel.zauli" Date: Thu, 4 Oct 2018 18:00:13 +0000 Subject: [PATCH] =?UTF-8?q?0010918:=20ESPEC01-=20Restri=C3=A7=C3=A3o=20Ven?= =?UTF-8?q?da=20Internet=20por=20Valor=20fixes=20bug#0010918=20dev:Leo=20q?= =?UTF-8?q?ua:Wally?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@85919 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../dao/ConfRestricaoVendaWebDAO.java | 7 ++ .../ConfRestricaoVendaWebHibernateDAO.java | 33 ++++++++ .../entidad/ConfRestricaoVendaWeb.java | 80 +++++++++++++++++++ .../service/ConfRestricaoVendaWebService.java | 7 ++ .../ConfRestricaoVendaWebServiceImpl.java | 61 ++++++++++++++ 5 files changed, 188 insertions(+) create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConfRestricaoVendaWebDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoVendaWebHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoVendaWeb.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConfRestricaoVendaWebService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoVendaWebServiceImpl.java diff --git a/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoVendaWebDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoVendaWebDAO.java new file mode 100644 index 000000000..62cc2c65a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoVendaWebDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoVendaWeb; + +public interface ConfRestricaoVendaWebDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoVendaWebHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoVendaWebHibernateDAO.java new file mode 100644 index 000000000..7e5ef1b9f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoVendaWebHibernateDAO.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +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.ConfRestricaoVendaWebDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoVendaWeb; +import com.rjconsultores.ventaboletos.entidad.Constante; + +@Repository("confRestricaoVendaWebDAO") +public class ConfRestricaoVendaWebHibernateDAO extends GenericHibernateDAO + implements ConfRestricaoVendaWebDAO { + + @Autowired + public ConfRestricaoVendaWebHibernateDAO(@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(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoVendaWeb.java b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoVendaWeb.java new file mode 100644 index 000000000..0f3f78e7e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoVendaWeb.java @@ -0,0 +1,80 @@ +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.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONF_RESTRICAO_VENDAWEB_SEQ", sequenceName = "CONF_RESTRICAO_VENDAWEB_SEQ", allocationSize = 1) +@Table(name = "CONF_RESTRICAO_VENDAWEB") +public class ConfRestricaoVendaWeb implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_RESTRICAO_VENDAWEB_SEQ") + @Column(name = "CONFRESTRICAOVENDAWEB_ID") + private Integer confRestricaoVendaWebId; + @ManyToOne + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "valor") + private Double valor; + + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getConfRestricaoVendaWebId() { + return confRestricaoVendaWebId; + } + public void setConfRestricaoVendaWebId(Integer confRestricaoVendaWebId) { + this.confRestricaoVendaWebId = confRestricaoVendaWebId; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public Double getValor() { + return valor; + } + public void setValor(Double valor) { + this.valor = valor; + } + 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/ConfRestricaoVendaWebService.java b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoVendaWebService.java new file mode 100644 index 000000000..63cd1054b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoVendaWebService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoVendaWeb; + +public interface ConfRestricaoVendaWebService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoVendaWebServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoVendaWebServiceImpl.java new file mode 100644 index 000000000..969f2bf2b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoVendaWebServiceImpl.java @@ -0,0 +1,61 @@ +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.ConfRestricaoVendaWebDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoVendaWeb; +import com.rjconsultores.ventaboletos.service.ConfRestricaoVendaWebService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + + +@Service("confRestricaoVendaWebService") +public class ConfRestricaoVendaWebServiceImpl implements ConfRestricaoVendaWebService{ + + @Autowired + ConfRestricaoVendaWebDAO confRestricaoVendaWebDAO; + + @Override + @Transactional + public ConfRestricaoVendaWeb suscribir(ConfRestricaoVendaWeb entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoVendaWebDAO.suscribir(entidad); + } + + @Override + public ConfRestricaoVendaWeb obtenerID(Integer id) { + return confRestricaoVendaWebDAO.obtenerID(id); + } + + @Override + public List obtenerTodos() { + return confRestricaoVendaWebDAO.obtenerTodos(); + } + + @Override + @Transactional + public void borrar(ConfRestricaoVendaWeb entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + confRestricaoVendaWebDAO.actualizacion(entidad); + } + + @Override + @Transactional + public ConfRestricaoVendaWeb actualizacion(ConfRestricaoVendaWeb entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoVendaWebDAO.actualizacion(entidad); + } +}