bug #6669
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@48652 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
0105346ada
commit
d8ad4dfe39
|
@ -0,0 +1,12 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.vo.comissao.RetornoCalculoComissao;
|
||||||
|
|
||||||
|
public interface ComissaoDAO {
|
||||||
|
|
||||||
|
public List<RetornoCalculoComissao> buscarReceitaComissao(Integer puntoVentaId, Integer empresaId, Date periodo);
|
||||||
|
|
||||||
|
}
|
|
@ -5,12 +5,12 @@ import java.util.List;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PtovtaComissao;
|
import com.rjconsultores.ventaboletos.entidad.PtovtaComissao;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public interface PtovtaComissaoDAO extends GenericDAO<PtovtaComissao, Integer> {
|
public interface PtovtaComissaoDAO extends GenericDAO<PtovtaComissao, Integer> {
|
||||||
|
|
||||||
public List<PtovtaComissao> buscar(int id);
|
public List<PtovtaComissao> buscar(int id);
|
||||||
|
|
||||||
public List<PtovtaComissao> buscarByPuntaVenta(PuntoVenta puntaVenta);
|
public List<PtovtaComissao> buscarByPuntaVenta(PuntoVenta puntaVenta);
|
||||||
|
|
||||||
|
public PtovtaComissao buscarPuntaVentaEmpresa(Integer puntaVentaId, Integer empresaId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.Query;
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.hibernate.transform.AliasToBeanResultTransformer;
|
||||||
|
import org.hibernate.type.BigDecimalType;
|
||||||
|
import org.hibernate.type.IntegerType;
|
||||||
|
import org.hibernate.type.StringType;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.ComissaoDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Comissao;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.comissao.RetornoCalculoComissao;
|
||||||
|
|
||||||
|
@Repository("comissaoHibernateDAO")
|
||||||
|
public class ComissaoHibernateDAO extends GenericHibernateDAO<Comissao, Integer> implements ComissaoDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ComissaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public List<RetornoCalculoComissao> buscarReceitaComissao(Integer puntoVentaId, Integer empresaId, Date periodo) {
|
||||||
|
|
||||||
|
StringBuffer sql = new StringBuffer();
|
||||||
|
sql.append("select ");
|
||||||
|
sql.append("b.marca_id as empresaId, b.puntoventa_id as puntoVentaId, ");
|
||||||
|
sql.append("to_char(b.fechorventa, 'dd-mm-yyyy') as datavenda, ");
|
||||||
|
sql.append("b.tipoventa_id as tipoVenta, b.motivocancelacion_id as motivoCancelacionId, ");
|
||||||
|
sql.append("sum(b.preciopagado) as valorpagado, sum(b.importeseguro) as seguro, ");
|
||||||
|
sql.append("sum(b.importepedagio) as pedagio, sum(b.importetaxaembarque) as embarque, ");
|
||||||
|
sql.append("coalesce(sum(case when ee.tipoeventoextra_id = 1 then ee.impingreso else 0 end), 0) as excessoBagagem, ");
|
||||||
|
sql.append("coalesce(sum(case when ee.tipoeventoextra_id = 21 then ee.impingreso else 0 end), 0) as seguroOpcional, ");
|
||||||
|
sql.append("coalesce(sum(case when ee.tipoeventoextra_id <> 21 or ee.tipoeventoextra_id <> 1 then ee.impingreso else 0 end), 0) as seguroOutros ");
|
||||||
|
sql.append("from boleto b ");
|
||||||
|
sql.append("left join evento_extra ee on ee.boleto_id = b.boleto_id ");
|
||||||
|
sql.append("where ");
|
||||||
|
sql.append("to_char(b.fechorventa, 'mmyyyy') = to_char(:periodo, 'mmyyyy') ");
|
||||||
|
sql.append("and b.marca_id = :empresaId and b.puntoventa_id = :puntoventaId ");
|
||||||
|
sql.append("group by b.marca_id, b.puntoventa_id, to_char(b.fechorventa, 'dd-mm-yyyy'), ");
|
||||||
|
sql.append("b.tipoventa_id, b.motivocancelacion_id ");
|
||||||
|
sql.append("order by datavenda ");
|
||||||
|
|
||||||
|
Query query = getSession().createSQLQuery(sql.toString())
|
||||||
|
.addScalar("empresaId", IntegerType.INSTANCE)
|
||||||
|
.addScalar("puntoVentaId", IntegerType.INSTANCE)
|
||||||
|
.addScalar("datavenda", StringType.INSTANCE)
|
||||||
|
.addScalar("tipoVenta", IntegerType.INSTANCE)
|
||||||
|
.addScalar("motivoCancelacionId", IntegerType.INSTANCE)
|
||||||
|
.addScalar("valorpagado", BigDecimalType.INSTANCE)
|
||||||
|
.addScalar("seguro", BigDecimalType.INSTANCE)
|
||||||
|
.addScalar("pedagio", BigDecimalType.INSTANCE)
|
||||||
|
.addScalar("embarque", BigDecimalType.INSTANCE)
|
||||||
|
.addScalar("excessoBagagem", BigDecimalType.INSTANCE)
|
||||||
|
.addScalar("seguroOpcional", BigDecimalType.INSTANCE)
|
||||||
|
.addScalar("seguroOutros", BigDecimalType.INSTANCE)
|
||||||
|
.setResultTransformer(new AliasToBeanResultTransformer(RetornoCalculoComissao.class));
|
||||||
|
|
||||||
|
query.setTimestamp("periodo", periodo);
|
||||||
|
query.setInteger("puntoventaId", puntoVentaId);
|
||||||
|
query.setInteger("empresaId", empresaId);
|
||||||
|
|
||||||
|
return query.list();
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,50 +12,58 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.PtovtaComissaoDAO;
|
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.PtovtaComissao;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
|
||||||
|
|
||||||
@Repository("ptovtaComissaoDAO")
|
@Repository("ptovtaComissaoDAO")
|
||||||
public class PtovtaComissaoHibernateDAO extends GenericHibernateDAO<PtovtaComissao, Integer>
|
public class PtovtaComissaoHibernateDAO extends GenericHibernateDAO<PtovtaComissao, Integer>
|
||||||
implements PtovtaComissaoDAO {
|
implements PtovtaComissaoDAO {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public PtovtaComissaoHibernateDAO(
|
public PtovtaComissaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
@Qualifier("sessionFactory") SessionFactory factory) {
|
setSessionFactory(factory);
|
||||||
setSessionFactory(factory);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PtovtaComissao> obtenerTodos() {
|
public List<PtovtaComissao> obtenerTodos() {
|
||||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
c.addOrder(Order.asc("id"));
|
c.addOrder(Order.asc("id"));
|
||||||
|
|
||||||
return c.list();
|
return c.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PtovtaComissao> buscar(int id) {
|
public List<PtovtaComissao> buscar(int id) {
|
||||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
c.add(Restrictions.eq("id", id));
|
c.add(Restrictions.eq("id", id));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
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));
|
||||||
|
|
||||||
public List<PtovtaComissao> buscarByPuntaVenta(PuntoVenta puntaVenta) {
|
c.addOrder(Order.asc("empresaId"));
|
||||||
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();
|
||||||
|
}
|
||||||
|
|
||||||
return c.list();
|
@Override
|
||||||
}
|
public PtovtaComissao buscarPuntaVentaEmpresa(Integer puntaVentaId, Integer empresaId) {
|
||||||
|
|
||||||
|
StringBuilder sql = new StringBuilder();
|
||||||
|
sql.append("from PtovtaComissao pc ");
|
||||||
|
sql.append("where pc.puntoventaId.puntoventaId = :puntoventaId ");
|
||||||
|
sql.append(" and pc.empresaId.empresaId = :empresaId ");
|
||||||
|
|
||||||
|
Query query = getSession().createQuery(sql.toString());
|
||||||
|
query.setInteger("puntoventaId", puntaVentaId);
|
||||||
|
query.setInteger("empresaId", empresaId);
|
||||||
|
|
||||||
|
return (PtovtaComissao) query.uniqueResult();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,211 @@
|
||||||
|
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.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@SequenceGenerator(name = "COMISSAO_SEQ", sequenceName = "COMISSAO_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "COMISSAO")
|
||||||
|
public class Comissao implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "COMISSAO_SEQ")
|
||||||
|
@Column(name = "COMISSAO_ID")
|
||||||
|
private Integer comissaoId;
|
||||||
|
@Column(name = "COMPETENCIA")
|
||||||
|
private String competencia;
|
||||||
|
@Column(name = "DATAPAGAMENTO")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date dataPagamento;
|
||||||
|
@Column(name = "INDPAGO")
|
||||||
|
private Boolean indPago;
|
||||||
|
@Column(name = "COMISSAO_BPR")
|
||||||
|
private BigDecimal comissaoBpr;
|
||||||
|
@Column(name = "RECEITA_EXCESSOBAGAGEM")
|
||||||
|
private BigDecimal receitaExcessobagagem;
|
||||||
|
@Column(name = "RECEITA_SEGUROOPCIONAL")
|
||||||
|
private BigDecimal receitaSeguroopcional;
|
||||||
|
@Column(name = "DESCONTOS_EVENTUAIS")
|
||||||
|
private BigDecimal descontosEventuais;
|
||||||
|
@Column(name = "ROYATIES")
|
||||||
|
private BigDecimal royaties;
|
||||||
|
@Column(name = "ISS_RETIDO")
|
||||||
|
private BigDecimal issRetido;
|
||||||
|
@Column(name = "BONIFICACAO_METAS")
|
||||||
|
private BigDecimal bonificacaoMetas;
|
||||||
|
@Column(name = "ENTREGAS_PASSAGEM")
|
||||||
|
private BigDecimal entregasPassagem;
|
||||||
|
@Column(name = "USUARIOPAGAMENTO_ID")
|
||||||
|
private Integer usuarioPagamentoId;
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
@Column(name = "PUNTOVENTA_ID")
|
||||||
|
private Integer puntoVentaId;
|
||||||
|
@Column(name = "EMPRESA_ID")
|
||||||
|
private Integer empresaId;
|
||||||
|
|
||||||
|
public Integer getComissaoId() {
|
||||||
|
return comissaoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComissaoId(Integer comissaoId) {
|
||||||
|
this.comissaoId = comissaoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCompetencia() {
|
||||||
|
return competencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompetencia(String competencia) {
|
||||||
|
this.competencia = competencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataPagamento() {
|
||||||
|
return dataPagamento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataPagamento(Date dataPagamento) {
|
||||||
|
this.dataPagamento = dataPagamento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIndPago() {
|
||||||
|
return indPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndPago(Boolean indPago) {
|
||||||
|
this.indPago = indPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getComissaoBpr() {
|
||||||
|
return comissaoBpr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComissaoBpr(BigDecimal comissaoBpr) {
|
||||||
|
this.comissaoBpr = comissaoBpr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getReceitaExcessobagagem() {
|
||||||
|
return receitaExcessobagagem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReceitaExcessobagagem(BigDecimal receitaExcessobagagem) {
|
||||||
|
this.receitaExcessobagagem = receitaExcessobagagem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getReceitaSeguroopcional() {
|
||||||
|
return receitaSeguroopcional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReceitaSeguroopcional(BigDecimal receitaSeguroopcional) {
|
||||||
|
this.receitaSeguroopcional = receitaSeguroopcional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getDescontosEventuais() {
|
||||||
|
return descontosEventuais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescontosEventuais(BigDecimal descontosEventuais) {
|
||||||
|
this.descontosEventuais = descontosEventuais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getRoyaties() {
|
||||||
|
return royaties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoyaties(BigDecimal royaties) {
|
||||||
|
this.royaties = royaties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getIssRetido() {
|
||||||
|
return issRetido;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIssRetido(BigDecimal issRetido) {
|
||||||
|
this.issRetido = issRetido;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getBonificacaoMetas() {
|
||||||
|
return bonificacaoMetas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBonificacaoMetas(BigDecimal bonificacaoMetas) {
|
||||||
|
this.bonificacaoMetas = bonificacaoMetas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getEntregasPassagem() {
|
||||||
|
return entregasPassagem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntregasPassagem(BigDecimal entregasPassagem) {
|
||||||
|
this.entregasPassagem = entregasPassagem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getUsuarioPagamentoId() {
|
||||||
|
return usuarioPagamentoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsuarioPagamentoId(Integer usuarioPagamentoId) {
|
||||||
|
this.usuarioPagamentoId = usuarioPagamentoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 Integer getPuntoVentaId() {
|
||||||
|
return puntoVentaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPuntoVentaId(Integer puntoVentaId) {
|
||||||
|
this.puntoVentaId = puntoVentaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getEmpresaId() {
|
||||||
|
return empresaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresaId(Integer empresaId) {
|
||||||
|
this.empresaId = empresaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -99,7 +99,7 @@ public class PtovtaComissao implements Serializable {
|
||||||
private Boolean taxaDev;
|
private Boolean taxaDev;
|
||||||
|
|
||||||
@Column(name = "PEDAGIODEV")
|
@Column(name = "PEDAGIODEV")
|
||||||
private Boolean pegagioDev;
|
private Boolean pedagioDev;
|
||||||
|
|
||||||
@Column(name = "ACTIVO")
|
@Column(name = "ACTIVO")
|
||||||
private Boolean activo;
|
private Boolean activo;
|
||||||
|
@ -181,7 +181,7 @@ public class PtovtaComissao implements Serializable {
|
||||||
this.tarifaDev = tarifaDev;
|
this.tarifaDev = tarifaDev;
|
||||||
this.seguroDev = seguroDev;
|
this.seguroDev = seguroDev;
|
||||||
this.taxaDev = taxaDev;
|
this.taxaDev = taxaDev;
|
||||||
this.pegagioDev = pegagioDev;
|
this.pedagioDev = pegagioDev;
|
||||||
this.activo = activo;
|
this.activo = activo;
|
||||||
this.fecmodif = fecmodif;
|
this.fecmodif = fecmodif;
|
||||||
this.usuarioId = usuarioId;
|
this.usuarioId = usuarioId;
|
||||||
|
@ -357,12 +357,12 @@ public class PtovtaComissao implements Serializable {
|
||||||
this.taxaDev = taxaDev;
|
this.taxaDev = taxaDev;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getPegagioDev() {
|
public Boolean getPedagioDev() {
|
||||||
return pegagioDev;
|
return pedagioDev;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPegagioDev(Boolean pegagioDev) {
|
public void setPedagioDev(Boolean pegagioDev) {
|
||||||
this.pegagioDev = pegagioDev;
|
this.pedagioDev = pegagioDev;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getActivo() {
|
public Boolean getActivo() {
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public interface CalculoComissaoService {
|
||||||
|
|
||||||
|
public void buscaParametrosComissao(Integer puntoVentaId, Integer empresaId, Date periodo);
|
||||||
|
}
|
|
@ -9,15 +9,12 @@ import java.util.List;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PtovtaComissao;
|
import com.rjconsultores.ventaboletos.entidad.PtovtaComissao;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public interface PtovtaComissaoService extends GenericService<PtovtaComissao, Integer> {
|
public interface PtovtaComissaoService extends GenericService<PtovtaComissao, Integer> {
|
||||||
|
|
||||||
public List<PtovtaComissao> buscar(int id);
|
public List<PtovtaComissao> buscar(int id);
|
||||||
|
|
||||||
public List<PtovtaComissao> buscarByPuntaVenta(PuntoVenta puntaVenta);
|
public List<PtovtaComissao> buscarByPuntaVenta(PuntoVenta puntaVenta);
|
||||||
|
|
||||||
|
public PtovtaComissao buscarPuntaVentaEmpresa(Integer puntaVentaId, Integer empresaId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.ComissaoDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PtovtaComissao;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CalculoComissaoService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.PtovtaComissaoService;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.comissao.RetornoCalculoComissao;
|
||||||
|
|
||||||
|
@Service("calculoComissaoService")
|
||||||
|
public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PtovtaComissaoService ptovtaComissaoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ComissaoDAO comissaoDAO;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* a) Receita BPR + Receita GAP - GapImpressa - Internet - Cancelados - Devoluções Origem - Cancelados GAP - Devoluções GAP Origem = Receita Comissão b) Receita Comissão * (% Com BPR) = Comissão BPR c) Receita Excesso Bagagem * (% Com. Exc. Bag) = Comissão Excesso c) Receita Seguro Opcional * (% Com. Seg. Pol) = Comissão Seg. Opcional d) Comissão BPR + Comissão Excesso Bagagem + Comissão Seg. Opcional - Descontos (Fixos e Eventuais) - Royaties - ISS retido + Bonificação
|
||||||
|
* Metas + Internet(EntregaPassagem) = Comissão à pagar
|
||||||
|
*/
|
||||||
|
public void buscaParametrosComissao(Integer puntoVentaId, Integer empresaId, Date periodo) {
|
||||||
|
|
||||||
|
PtovtaComissao ptovtaComissao = ptovtaComissaoService.buscarPuntaVentaEmpresa(puntoVentaId, empresaId);
|
||||||
|
|
||||||
|
// Receita Comissão
|
||||||
|
List<RetornoCalculoComissao> list = comissaoDAO.buscarReceitaComissao(puntoVentaId, empresaId, periodo);
|
||||||
|
for (RetornoCalculoComissao retorno : list) {
|
||||||
|
|
||||||
|
if (ptovtaComissao.getTarifaReceita()) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ptovtaComissao.getTaxaReceita();
|
||||||
|
ptovtaComissao.getSeguroReceita();
|
||||||
|
ptovtaComissao.getPedagioReceita();
|
||||||
|
|
||||||
|
ptovtaComissao.getTarifaDev();
|
||||||
|
ptovtaComissao.getTaxaDev();
|
||||||
|
ptovtaComissao.getSeguroDev();
|
||||||
|
ptovtaComissao.getPedagioDev();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -4,17 +4,17 @@
|
||||||
*/
|
*/
|
||||||
package com.rjconsultores.ventaboletos.service.impl;
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.PtovtaComissaoDAO;
|
import com.rjconsultores.ventaboletos.dao.PtovtaComissaoDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PtovtaComissao;
|
import com.rjconsultores.ventaboletos.entidad.PtovtaComissao;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
import com.rjconsultores.ventaboletos.service.PtovtaComissaoService;
|
import com.rjconsultores.ventaboletos.service.PtovtaComissaoService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,51 +24,55 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
@Service("ptovtaComissaoService")
|
@Service("ptovtaComissaoService")
|
||||||
public class PtovtaComissaoServiceImpl implements PtovtaComissaoService {
|
public class PtovtaComissaoServiceImpl implements PtovtaComissaoService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PtovtaComissaoDAO ptovtaComissaoDAO;
|
private PtovtaComissaoDAO ptovtaComissaoDAO;
|
||||||
|
|
||||||
public List<PtovtaComissao> obtenerTodos() {
|
public List<PtovtaComissao> obtenerTodos() {
|
||||||
return ptovtaComissaoDAO.obtenerTodos();
|
return ptovtaComissaoDAO.obtenerTodos();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PtovtaComissao obtenerID(Integer id) {
|
public PtovtaComissao obtenerID(Integer id) {
|
||||||
return ptovtaComissaoDAO.obtenerID(id);
|
return ptovtaComissaoDAO.obtenerID(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public PtovtaComissao suscribir(PtovtaComissao entidad) {
|
public PtovtaComissao suscribir(PtovtaComissao entidad) {
|
||||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
entidad.setActivo(Boolean.TRUE);
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
return ptovtaComissaoDAO.suscribir(entidad);
|
return ptovtaComissaoDAO.suscribir(entidad);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public PtovtaComissao actualizacion(PtovtaComissao entidad) {
|
public PtovtaComissao actualizacion(PtovtaComissao entidad) {
|
||||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
entidad.setActivo(Boolean.TRUE);
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
return ptovtaComissaoDAO.actualizacion(entidad);
|
return ptovtaComissaoDAO.actualizacion(entidad);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void borrar(PtovtaComissao entidad) {
|
public void borrar(PtovtaComissao entidad) {
|
||||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
entidad.setActivo(Boolean.FALSE);
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
ptovtaComissaoDAO.actualizacion(entidad);
|
ptovtaComissaoDAO.actualizacion(entidad);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PtovtaComissao> buscar(int id) {
|
public List<PtovtaComissao> buscar(int id) {
|
||||||
return ptovtaComissaoDAO.buscar(id);
|
return ptovtaComissaoDAO.buscar(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PtovtaComissao> buscarByPuntaVenta(PuntoVenta puntaVenta){
|
public List<PtovtaComissao> buscarByPuntaVenta(PuntoVenta puntaVenta) {
|
||||||
return ptovtaComissaoDAO.buscarByPuntaVenta(puntaVenta);
|
return ptovtaComissaoDAO.buscarByPuntaVenta(puntaVenta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PtovtaComissao buscarPuntaVentaEmpresa(Integer puntaVentaId, Integer empresaId) {
|
||||||
|
return ptovtaComissaoDAO.buscarPuntaVentaEmpresa(puntaVentaId, empresaId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,116 @@
|
||||||
|
package com.rjconsultores.ventaboletos.vo.comissao;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class RetornoCalculoComissao {
|
||||||
|
|
||||||
|
private Integer empresaId;
|
||||||
|
private Integer puntoVentaId;
|
||||||
|
private String datavenda;
|
||||||
|
private Integer tipoVenta;
|
||||||
|
private Integer motivoCancelacionId;
|
||||||
|
private BigDecimal valorpagado;
|
||||||
|
private BigDecimal seguro;
|
||||||
|
private BigDecimal pedagio;
|
||||||
|
private BigDecimal embarque;
|
||||||
|
private BigDecimal excessoBagagem;
|
||||||
|
private BigDecimal seguroOpcional;
|
||||||
|
private BigDecimal seguroOutros;
|
||||||
|
|
||||||
|
public Integer getEmpresaId() {
|
||||||
|
return empresaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresaId(Integer empresaId) {
|
||||||
|
this.empresaId = empresaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPuntoVentaId() {
|
||||||
|
return puntoVentaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPuntoVentaId(Integer puntoVentaId) {
|
||||||
|
this.puntoVentaId = puntoVentaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDatavenda() {
|
||||||
|
return datavenda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDatavenda(String datavenda) {
|
||||||
|
this.datavenda = datavenda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getTipoVenta() {
|
||||||
|
return tipoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoVenta(Integer tipoVenta) {
|
||||||
|
this.tipoVenta = tipoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMotivoCancelacionId() {
|
||||||
|
return motivoCancelacionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotivoCancelacionId(Integer motivoCancelacionId) {
|
||||||
|
this.motivoCancelacionId = motivoCancelacionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getValorpagado() {
|
||||||
|
return valorpagado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValorpagado(BigDecimal valorpagado) {
|
||||||
|
this.valorpagado = valorpagado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getSeguro() {
|
||||||
|
return seguro;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSeguro(BigDecimal seguro) {
|
||||||
|
this.seguro = seguro;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getPedagio() {
|
||||||
|
return pedagio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPedagio(BigDecimal pedagio) {
|
||||||
|
this.pedagio = pedagio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getEmbarque() {
|
||||||
|
return embarque;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmbarque(BigDecimal embarque) {
|
||||||
|
this.embarque = embarque;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getExcessoBagagem() {
|
||||||
|
return excessoBagagem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExcessoBagagem(BigDecimal excessoBagagem) {
|
||||||
|
this.excessoBagagem = excessoBagagem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getSeguroOpcional() {
|
||||||
|
return seguroOpcional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSeguroOpcional(BigDecimal seguroOpcional) {
|
||||||
|
this.seguroOpcional = seguroOpcional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getSeguroOutros() {
|
||||||
|
return seguroOutros;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSeguroOutros(BigDecimal seguroOutros) {
|
||||||
|
this.seguroOutros = seguroOutros;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue