- Ajustes nos filtros do RDA
- Tela de cadastramento de comissão - Calculo de comissão - Melhoria, padronização do percentual - Outros ajustes git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@29370 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
8e0d1f1bab
commit
1ca9b30890
|
@ -7,6 +7,8 @@ package com.rjconsultores.ventaboletos.dao;
|
|||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Estado;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -23,4 +25,6 @@ public interface EmpresaDAO extends GenericDAO<Empresa, Integer> {
|
|||
public List<Empresa> buscar(String nombempresa, Boolean indExterna, Short indTipo);
|
||||
|
||||
public List<Empresa> obtenerIndTipo2();
|
||||
|
||||
public List<Empresa> buscarNotInPuntoVtaComissao(PuntoVenta puntoVenta);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* 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.GrupoRuta;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Bruno H. G. Gouvêa <bruno@rjconsultores.com.br>
|
||||
*
|
||||
*/
|
||||
public interface GrupoRutaDAO extends GenericDAO<GrupoRuta, Integer> {
|
||||
|
||||
public List<GrupoRuta> buscarPorNome(String descgrupo);
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.dao;
|
|||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.PtovtaComissao;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
|
||||
|
||||
|
||||
|
@ -10,5 +11,6 @@ public interface PtovtaComissaoDAO extends GenericDAO<PtovtaComissao, Integer> {
|
|||
|
||||
public List<PtovtaComissao> buscar(int id);
|
||||
|
||||
public List<PtovtaComissao> buscarByPuntaVenta(PuntoVenta puntaVenta);
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.criterion.Order;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
|
@ -17,6 +18,8 @@ import org.springframework.stereotype.Repository;
|
|||
|
||||
import com.rjconsultores.ventaboletos.dao.EmpresaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Estado;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -100,4 +103,28 @@ public class EmpresaHibernateDAO extends GenericHibernateDAO<Empresa, Integer>
|
|||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
|
||||
public List<Empresa> buscarNotInPuntoVtaComissao(PuntoVenta puntoVenta){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(" select em ");
|
||||
sb.append(" from Empresa em ");
|
||||
sb.append(" where em.activo = 1 ");
|
||||
sb.append(" and em.empresaId not in ( ");
|
||||
sb.append(" select pc.empresaId.empresaId from PtovtaComissao pc ");
|
||||
sb.append(" where pc.activo = 1 and pc.puntoventaId.puntoventaId = :puntoventaId ");
|
||||
sb.append(" )");
|
||||
sb.append(" order by em.nombempresa");
|
||||
|
||||
|
||||
Query query = getSession().createQuery(sb.toString());
|
||||
query.setParameter("puntoventaId", puntoVenta.getPuntoventaId());
|
||||
|
||||
List<Empresa> lsEmpresa = query.list();
|
||||
|
||||
|
||||
return lsEmpresa;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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 com.rjconsultores.ventaboletos.dao.GrupoRutaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||
import com.rjconsultores.ventaboletos.entidad.GrupoRuta;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Bruno H. G. Gouvêa <bruno@rjconsultores.com.br>
|
||||
*
|
||||
*/
|
||||
@Repository("grupoRutaDAO")
|
||||
public class GrupoRutaHibernateDAO extends GenericHibernateDAO<GrupoRuta, Integer>
|
||||
implements GrupoRutaDAO {
|
||||
|
||||
@Autowired
|
||||
public GrupoRutaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
public List<GrupoRuta> buscarPorNome(String descgrupo) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
c.add(Restrictions.eq("descgrupo", descgrupo));
|
||||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
}
|
|
@ -12,7 +12,10 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
|||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.PtovtaComissaoDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.EmpresaImposto;
|
||||
import com.rjconsultores.ventaboletos.entidad.PtovtaComissao;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
|
||||
|
||||
@Repository("ptovtaComissaoDAO")
|
||||
|
@ -42,6 +45,16 @@ public class PtovtaComissaoHibernateDAO extends GenericHibernateDAO<PtovtaComiss
|
|||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
public List<PtovtaComissao> buscarByPuntaVenta(PuntoVenta puntaVenta) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
c.add(Restrictions.eq("puntoventaId", puntaVenta));
|
||||
|
||||
c.addOrder(Order.asc("empresaId"));
|
||||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
* 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.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.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Bruno H. G. Gouvêa <bruno@rjconsultores.com.br>
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@SequenceGenerator(name = "GRUPO_RUTA_SEQ", sequenceName = "GRUPO_RUTA_SEQ", allocationSize = 1)
|
||||
@Table(name = "GRUPO_RUTA")
|
||||
public class GrupoRuta implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "GRUPO_RUTA_SEQ")
|
||||
@Column(name = "GRUPORUTA_ID")
|
||||
private Integer grupoRutaId;
|
||||
@Column(name = "DESCGRUPO")
|
||||
private String descgrupo;
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
||||
|
||||
public GrupoRuta() {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the grupoRutaId
|
||||
*/
|
||||
public Integer getGrupoRutaId() {
|
||||
return grupoRutaId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param grupoRutaId
|
||||
* the grupoRutaId to set
|
||||
*/
|
||||
public void setGrupoRutaId(Integer grupoRutaId) {
|
||||
this.grupoRutaId = grupoRutaId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the descGrupo
|
||||
*/
|
||||
public String getDescGrupo() {
|
||||
return descgrupo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param descGrupo the descGrupo to set
|
||||
*/
|
||||
public void setDescGrupo(String descgrupo) {
|
||||
this.descgrupo = descgrupo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final GrupoRuta other = (GrupoRuta) obj;
|
||||
if (!this.getGrupoRutaId().equals(other.getGrupoRutaId())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 59 * hash + (this.getGrupoRutaId() != null ? this.getGrupoRutaId().hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "com.rjconsultores.ventaboletos.entidad.CategoriaClase[grupoRutaId=" + grupoRutaId + "]";
|
||||
}
|
||||
}
|
|
@ -124,6 +124,10 @@ public class PtovtaComissao implements Serializable {
|
|||
@JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID")
|
||||
@ManyToOne
|
||||
private PuntoVenta puntoventaId;
|
||||
|
||||
@JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID")
|
||||
@ManyToOne
|
||||
private Empresa empresaId;
|
||||
|
||||
public PtovtaComissao() {
|
||||
}
|
||||
|
@ -429,7 +433,21 @@ public class PtovtaComissao implements Serializable {
|
|||
|
||||
//
|
||||
|
||||
@Override
|
||||
/**
|
||||
* @return the empresaId
|
||||
*/
|
||||
public Empresa getEmpresaId() {
|
||||
return empresaId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param empresaId the empresaId to set
|
||||
*/
|
||||
public void setEmpresaId(Empresa empresaId) {
|
||||
this.empresaId = empresaId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (ptovtaComissaoId != null ? ptovtaComissaoId.hashCode() : 0);
|
||||
|
|
|
@ -53,6 +53,9 @@ public class Ruta implements Serializable {
|
|||
@JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID")
|
||||
@ManyToOne
|
||||
private ClaseServicio claseServicio;
|
||||
@JoinColumn(name = "GRUPORUTA_ID", referencedColumnName = "GRUPORUTA_ID")
|
||||
@ManyToOne
|
||||
private GrupoRuta grupoRuta;
|
||||
@OneToMany(mappedBy = "ruta")
|
||||
private List<RutaSecuencia> rutaSecuenciaList;
|
||||
@OneToMany(mappedBy = "ruta")
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -26,4 +27,6 @@ public interface EmpresaService extends GenericService<Empresa, Integer> {
|
|||
public List<Empresa> obtenerIndTipo2();
|
||||
// public List<Empresa> obtenerEmpresaU()
|
||||
|
||||
public List<Empresa> buscarNotInPuntoVtaComissao(PuntoVenta puntoVenta);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* 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.GrupoRuta;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Bruno H. G. Gouvêa <bruno@rjconsultores.com.br>
|
||||
*
|
||||
*/
|
||||
public interface GrupoRutaService extends GenericService<GrupoRuta, Integer> {
|
||||
|
||||
public List<GrupoRuta> buscarPorNome(String descgrupo);
|
||||
|
||||
}
|
|
@ -7,6 +7,7 @@ package com.rjconsultores.ventaboletos.service;
|
|||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.PtovtaComissao;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
|
||||
|
||||
|
||||
|
@ -15,6 +16,8 @@ import com.rjconsultores.ventaboletos.entidad.PtovtaComissao;
|
|||
public interface PtovtaComissaoService extends GenericService<PtovtaComissao, Integer> {
|
||||
|
||||
public List<PtovtaComissao> buscar(int id);
|
||||
|
||||
public List<PtovtaComissao> buscarByPuntaVenta(PuntoVenta puntaVenta);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import com.rjconsultores.ventaboletos.dao.EmpresaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
|
@ -80,4 +81,13 @@ public class EmpresaServiceImpl implements EmpresaService {
|
|||
public List<Empresa> obtenerIndTipo2() {
|
||||
return empresaDAO.obtenerIndTipo2();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.rjconsultores.ventaboletos.service.EmpresaService#buscarNotInPuntoVtaComissao(com.rjconsultores.ventaboletos.entidad.PuntoVenta)
|
||||
*/
|
||||
@Override
|
||||
public List<Empresa> buscarNotInPuntoVtaComissao(PuntoVenta puntoVenta) {
|
||||
return empresaDAO.buscarNotInPuntoVtaComissao(puntoVenta);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.GrupoRutaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.GrupoRuta;
|
||||
import com.rjconsultores.ventaboletos.service.GrupoRutaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Bruno H. G. Gouvêa <bruno@rjconsultores.com.br>
|
||||
*
|
||||
*/
|
||||
@Service("grupoRutaService")
|
||||
public class GrupoRutaServiceImpl implements GrupoRutaService {
|
||||
|
||||
@Autowired
|
||||
private GrupoRutaDAO grupoRutaDAO;
|
||||
|
||||
public List<GrupoRuta> obtenerTodos() {
|
||||
return grupoRutaDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
public GrupoRuta obtenerID(Integer id) {
|
||||
return grupoRutaDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public GrupoRuta suscribir(GrupoRuta entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return grupoRutaDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public GrupoRuta actualizacion(GrupoRuta entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return grupoRutaDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void borrar(GrupoRuta entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.FALSE);
|
||||
|
||||
grupoRutaDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
public List<GrupoRuta> buscarPorNome(String descgrupo) {
|
||||
return grupoRutaDAO.buscarPorNome(descgrupo);
|
||||
}
|
||||
|
||||
}
|
|
@ -7,6 +7,7 @@ package com.rjconsultores.ventaboletos.service.impl;
|
|||
|
||||
import com.rjconsultores.ventaboletos.dao.PtovtaComissaoDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.PtovtaComissao;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.service.PtovtaComissaoService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import java.util.Calendar;
|
||||
|
@ -64,6 +65,10 @@ public class PtovtaComissaoServiceImpl implements PtovtaComissaoService {
|
|||
public List<PtovtaComissao> buscar(int id) {
|
||||
return ptovtaComissaoDAO.buscar(id);
|
||||
}
|
||||
|
||||
public List<PtovtaComissao> buscarByPuntaVenta(PuntoVenta puntaVenta){
|
||||
return ptovtaComissaoDAO.buscarByPuntaVenta(puntaVenta);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue