0010918: ESPEC01- Restrição Venda Internet por Valor

fixes bug#0010918
dev:Leo
qua:Wally

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@85919 d1611594-4594-4d17-8e1d-87c2c4800839
master
daniel.zauli 2018-10-04 18:00:13 +00:00
parent ed4c772d47
commit 491da87ec8
5 changed files with 188 additions and 0 deletions

View File

@ -0,0 +1,7 @@
package com.rjconsultores.ventaboletos.dao;
import com.rjconsultores.ventaboletos.entidad.ConfRestricaoVendaWeb;
public interface ConfRestricaoVendaWebDAO extends GenericDAO<ConfRestricaoVendaWeb, Integer> {
}

View File

@ -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<ConfRestricaoVendaWeb, Integer>
implements ConfRestricaoVendaWebDAO {
@Autowired
public ConfRestricaoVendaWebHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
setSessionFactory(factory);
}
@Override
public List<ConfRestricaoVendaWeb> obtenerTodos() {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
return c.list();
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,7 @@
package com.rjconsultores.ventaboletos.service;
import com.rjconsultores.ventaboletos.entidad.ConfRestricaoVendaWeb;
public interface ConfRestricaoVendaWebService extends GenericService<ConfRestricaoVendaWeb, Integer> {
}

View File

@ -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<ConfRestricaoVendaWeb> 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);
}
}