fixed bug #0008306 - Criado o CRUD do MotivoCancelVendaPacote

fixed bug #0008313 - Adicionada a coluna percentual de devolução. percmulta

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@63146 d1611594-4594-4d17-8e1d-87c2c4800839
master
bruno.neves 2016-12-02 18:03:42 +00:00
parent 063965aaab
commit e8cfdede24
5 changed files with 347 additions and 0 deletions

View File

@ -0,0 +1,22 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rjconsultores.ventaboletos.dao;
import java.util.List;
import com.rjconsultores.ventaboletos.entidad.MotivoCancelVendaPacote;
/**
*
* @author Bruno
*/
public interface MotivoCancelVendaPacoteDAO extends GenericDAO<MotivoCancelVendaPacote, Integer> {
public List<MotivoCancelVendaPacote> buscar(String descmotivocancel, String tipomotivocancel);
public List<MotivoCancelVendaPacote> obtenerTodosTipoMotivoCancel();
public List<MotivoCancelVendaPacote> obtenerTodosEspecificos(Integer[] motivos);
}

View File

@ -0,0 +1,67 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
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.MotivoCancelVendaPacoteDAO;
import com.rjconsultores.ventaboletos.entidad.MotivoCancelVendaPacote;
/**
*
* @author Bruno
*/
@Repository("motivoCancelacionVendaPacoteDAO")
public class MotivoCancelVendaPacotelHibernateDAO extends GenericHibernateDAO<MotivoCancelVendaPacote, Integer>
implements MotivoCancelVendaPacoteDAO {
@Autowired
public MotivoCancelVendaPacotelHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
setSessionFactory(factory);
}
@Override
public List<MotivoCancelVendaPacote> obtenerTodos() {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.addOrder(Order.asc("descmotivocancel"));
return c.list();
}
public List<MotivoCancelVendaPacote> buscar(String descmotivocancel, String tipomotivocancel) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("descmotivocancel", descmotivocancel));
c.add(Restrictions.eq("tipomotivocancel", tipomotivocancel));
return c.list();
}
public List<MotivoCancelVendaPacote> obtenerTodosTipoMotivoCancel() {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.addOrder(Order.asc("descmotivocancel"));
return c.list();
}
public List<MotivoCancelVendaPacote> obtenerTodosEspecificos(Integer[] motivos) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.in("motivocancelacionId", motivos));
c.addOrder(Order.asc("descmotivocancel"));
return c.list();
}
}

View File

@ -0,0 +1,149 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
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.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.SequenceGenerator;
/**
*
* @author Bruno
*/
@Entity
@SequenceGenerator(name = "MOTIVO_CANCEL_VENDA_PACOTE_SEQ", sequenceName = "MOTIVO_CANCEL_VENDA_PACOTE_SEQ", allocationSize = 1)
@Table(name = "MOTIVO_CANCEL_VENDA_PACOTE")
public class MotivoCancelVendaPacote implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "MOTIVO_CANCEL_VENDA_PACOTE_SEQ")
@Column(name = "MOTIVOCANCELVENDAPACOTE_ID")
private Integer motivocancelvendapacoteId;
@Column(name = "DESCMOTIVOCANCEL")
private String descmotivocancel;
@Column(name = "ACTIVO")
private Boolean activo;
@Column(name = "FECMODIF")
@Temporal(TemporalType.TIMESTAMP)
private Date fecmodif;
@Column(name = "USUARIO_ID")
private Integer usuarioId;
@Column(name = "TIPOMOTIVOCANCEL")
private String tipomotivocancel;
@Column(name="PORCMULTA")
private BigDecimal porcmulta;
public MotivoCancelVendaPacote() {
}
public Integer getMotivocancelvendapacoteId() {
return motivocancelvendapacoteId;
}
public void setMotivocancelvendapacoteId(Integer motivocancelvendapacoteId) {
this.motivocancelvendapacoteId = motivocancelvendapacoteId;
}
public String getDescmotivocancel() {
return descmotivocancel;
}
public void setDescmotivocancel(String descmotivocancel) {
this.descmotivocancel = descmotivocancel;
}
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;
}
public String getTipomotivocancel() {
return tipomotivocancel;
}
public void setTipomotivocancel(String tipomotivocancel) {
this.tipomotivocancel = tipomotivocancel;
}
public BigDecimal getPorcmulta() {
return porcmulta;
}
public void setPorcmulta(BigDecimal porcmulta) {
this.porcmulta = porcmulta;
}
@Override
public int hashCode() {
int hash = 0;
hash += (motivocancelvendapacoteId != null ? motivocancelvendapacoteId.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 MotivoCancelVendaPacote)) {
return false;
}
MotivoCancelVendaPacote other = (MotivoCancelVendaPacote) object;
if ((this.motivocancelvendapacoteId == null && other.motivocancelvendapacoteId != null) || (this.motivocancelvendapacoteId != null && !this.motivocancelvendapacoteId.equals(other.motivocancelvendapacoteId))) {
return false;
}
return true;
}
@Override
public String toString() {
return this.getDescmotivocancel();
}
}

View File

@ -0,0 +1,25 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rjconsultores.ventaboletos.service;
import java.util.List;
import com.rjconsultores.ventaboletos.entidad.MotivoCancelVendaPacote;
/**
*
* @author Bruno
*
*/
public interface MotivoCancelVendaPacoteService extends GenericService<MotivoCancelVendaPacote, Integer> {
public List<MotivoCancelVendaPacote> buscar(String descmotivocancel, String tipomotivocancel);
public List<MotivoCancelVendaPacote> obtenerTodosTipoMotivoCancel();
public List<MotivoCancelVendaPacote> obtenerTodosEspecificos(Integer[] motivos);
public boolean validaMotivoCancelVendaPacoteConstante(MotivoCancelVendaPacote motivoCancelVendaPacote);
}

View File

@ -0,0 +1,84 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
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.MotivoCancelVendaPacoteDAO;
import com.rjconsultores.ventaboletos.entidad.MotivoCancelVendaPacote;
import com.rjconsultores.ventaboletos.service.MotivoCancelVendaPacoteService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
/**
*
* @author Bruno
*/
@Service("motivoCancelVendaPacoteService")
public class MotivoCancelVendaPacoteServiceImpl implements MotivoCancelVendaPacoteService {
@Autowired
private MotivoCancelVendaPacoteDAO motivoCancelVendaPacoteDAO;
public static final Integer MAX_CONS_MOV_CANCEL = Integer.valueOf(35);
public List<MotivoCancelVendaPacote> obtenerTodos() {
return motivoCancelVendaPacoteDAO.obtenerTodos();
}
public MotivoCancelVendaPacote obtenerID(Integer id) {
return motivoCancelVendaPacoteDAO.obtenerID(id);
}
@Transactional
public MotivoCancelVendaPacote suscribir(MotivoCancelVendaPacote entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
return motivoCancelVendaPacoteDAO.suscribir(entidad);
}
@Transactional
public MotivoCancelVendaPacote actualizacion(MotivoCancelVendaPacote entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
return motivoCancelVendaPacoteDAO.actualizacion(entidad);
}
@Transactional
public void borrar(MotivoCancelVendaPacote entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.FALSE);
motivoCancelVendaPacoteDAO.actualizacion(entidad);
}
public List<MotivoCancelVendaPacote> buscar(String descmotivocancel, String tipomotivocancel) {
return motivoCancelVendaPacoteDAO.buscar(descmotivocancel, tipomotivocancel);
}
public List<MotivoCancelVendaPacote> obtenerTodosTipoMotivoCancel() {
return motivoCancelVendaPacoteDAO.obtenerTodosTipoMotivoCancel();
}
public List<MotivoCancelVendaPacote> obtenerTodosEspecificos(Integer[] motivos) {
return motivoCancelVendaPacoteDAO.obtenerTodosEspecificos(motivos);
}
public boolean validaMotivoCancelVendaPacoteConstante(MotivoCancelVendaPacote motivoCancelVendaPacote) {
if (motivoCancelVendaPacote.getMotivocancelvendapacoteId() <= MAX_CONS_MOV_CANCEL)
return false;
else
return true;
}
}