fixes bug#10756
dev:thiago qua:junia git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@80453 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
04e2e3b53f
commit
e2dc453306
|
@ -128,7 +128,7 @@ public class AuditInterceptor extends EmptyInterceptor {
|
|||
}
|
||||
|
||||
private boolean getAuditModuleService(final Session session) {
|
||||
if (AuditManager.getINSTANCE().getAuditar() == null) {
|
||||
if (AuditManager.getINSTANCE() != null && AuditManager.getINSTANCE().getAuditar() == null) {
|
||||
Criteria criteriaAuditar = session.createCriteria(Constante.class);
|
||||
criteriaAuditar.add(Restrictions.eq("nombconstante", "AUDITAR_SISTEMA"));
|
||||
criteriaAuditar.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
|
@ -147,7 +147,7 @@ public class AuditInterceptor extends EmptyInterceptor {
|
|||
AuditManager.getINSTANCE().setAuditar(auditar);
|
||||
}
|
||||
|
||||
if (AuditManager.getINSTANCE().getAuditar() == null || !AuditManager.getINSTANCE().getAuditar()) {
|
||||
if (AuditManager.getINSTANCE() == null || AuditManager.getINSTANCE().getAuditar() == null || !AuditManager.getINSTANCE().getAuditar()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,4 +95,6 @@ public class Constantes {
|
|||
|
||||
public static String CLAVE_EDITAR_ALTERA_EXIBECANCEL = "COM.RJCONSULTORES.ADMINISTRACION.GUI.CONFIGURACIONECCOMERCIALES.MOTIVOCANCELACION.ALTERAEXIBECANCEL";
|
||||
|
||||
public static final String QTDE_MAX_DIAS_RETENCAO_DIARIA_COMISSAO = "QTDE_MAX_DIAS_RETENCAO_DIARIA_COMISSAO";
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.ComissaoReceita;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
|
||||
public interface ComissaoReceitaDAO extends GenericDAO<ComissaoReceita, Integer> {
|
||||
|
||||
public List<ComissaoReceita> recuperarComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal);
|
||||
|
||||
public void limparComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal) throws BusinessException;
|
||||
|
||||
}
|
|
@ -72,4 +72,6 @@ public interface EmpresaDAO {
|
|||
*/
|
||||
public void gerarSeqNumFolioSistema(Integer idEmpresa, String cveEstado) throws RuntimeException;
|
||||
|
||||
public List<Empresa> buscarEmpresaPtoVtaComissao();
|
||||
|
||||
}
|
||||
|
|
|
@ -37,4 +37,6 @@ public interface PuntoVentaDAO extends GenericDAO<PuntoVenta, Integer> {
|
|||
public List<PuntoVenta> buscarPuntoVentaPorTipoEstoque(PtovtaTipoEstoque tipoEstoque);
|
||||
|
||||
public List<String> quantidadeECFPorPuntoVenta(Conferencia conferencia);
|
||||
|
||||
public List<PuntoVenta> buscarPuntoVentaPtoVtaComissao(List<Integer> empresas);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.ComissaoReceitaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.ComissaoReceita;
|
||||
|
||||
@Repository("comissaoReceitaHibernateDAO")
|
||||
public class ComissaoReceitaHibernateDAO extends GenericHibernateDAO<ComissaoReceita, Integer> implements ComissaoReceitaDAO {
|
||||
|
||||
@Autowired
|
||||
public ComissaoReceitaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<ComissaoReceita> recuperarComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal) {
|
||||
StringBuilder hql = new StringBuilder();
|
||||
hql.append("select c from ComissaoReceita c ")
|
||||
.append("where c.activo = 1 ")
|
||||
.append(" AND c.puntoVenta.puntoventaId = :puntoventaId ")
|
||||
.append(" AND c.empresa.empresaId = :empresaId ")
|
||||
.append(" AND c.datamovimento between :dataInicial and :dataFinal ")
|
||||
.append("order by c.empresa.nombempresa, c.puntoVenta.nombpuntoventa, c.datamovimento");
|
||||
|
||||
Query query = getSession().createQuery(hql.toString());
|
||||
query.setDate("dataInicial", dataInicial);
|
||||
query.setDate("dataFinal", dataFinal);
|
||||
query.setInteger("puntoventaId", puntoVentaId);
|
||||
query.setInteger("empresaId", empresaId);
|
||||
|
||||
return query.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void limparComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal) {
|
||||
StringBuilder hql = new StringBuilder();
|
||||
hql.append("delete from ComissaoReceita c ");
|
||||
hql.append("where c.activo = 1 ");
|
||||
hql.append(" AND c.puntoVenta.puntoventaId = :puntoventaId ");
|
||||
hql.append(" AND c.empresa.empresaId = :empresaId ");
|
||||
hql.append(" AND c.datamovimento between :dataInicial and :dataFinal ");
|
||||
|
||||
Query query = getSession().createQuery(hql.toString());
|
||||
query.setDate("dataInicial", dataInicial);
|
||||
query.setDate("dataFinal", dataFinal);
|
||||
query.setInteger("puntoventaId", puntoVentaId);
|
||||
query.setInteger("empresaId", empresaId);
|
||||
|
||||
query.executeUpdate();
|
||||
}
|
||||
|
||||
}
|
|
@ -811,7 +811,12 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
.append("C.INDCANCELACION AS \"indCancelacion\", C.INDREIMPRESION AS \"indreimpresion\", C.FECCORTE AS \"feccorte\", C.TRANSACAOORIGINAL_ID AS \"transacaoOriginalId\", ")
|
||||
.append("EI.ICMS as \"icmsBase\", EST.ESTADO_ID as \"estadoId\", ")
|
||||
.append("CASE WHEN C.PTOVTAVENTA_ID = C.PUNTOVENTA_ID OR C.PTOVTAVENTA_ID IS NULL THEN 1 ELSE 0 END AS ptoVtaOrigem, ")
|
||||
.append("M.EMPRESA_ID AS empresaId, C.TRANSACAO_ID AS \"transacaoId\" ")
|
||||
.append("M.EMPRESA_ID AS empresaId, C.TRANSACAO_ID AS \"transacaoId\", ")
|
||||
.append("CASE WHEN LOG.CONFERENCIA_ID IS NOT NULL OR ")
|
||||
.append(" (C.INDSTATUSBOLETO = 'E' ")
|
||||
.append(" AND LOG.LOGCONFERENCIA_ID IS NULL ")
|
||||
.append(" AND (SELECT LC.LOGCONFERENCIA_ID FROM LOG_CONFERENCIA LC WHERE LC.ACTIVO = 1 AND LC.TRANSACAOORIGINAL_ID = C.TRANSACAOORIGINAL_ID) IS NOT NULL) ")
|
||||
.append(" THEN 1 ELSE 0 END AS \"conferidoEntrega\" ")
|
||||
.append("FROM CAJA C ")
|
||||
.append("LEFT JOIN PARADA ORI ON ORI.PARADA_ID = C.ORIGEN_ID ")
|
||||
.append("LEFT JOIN CIUDAD CID ON CID.CIUDAD_ID = ORI.CIUDAD_ID ")
|
||||
|
@ -906,6 +911,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
.addScalar("valorbase", Hibernate.BIG_DECIMAL)
|
||||
.addScalar("empresaId", Hibernate.INTEGER)
|
||||
.addScalar("transacaoId", Hibernate.LONG)
|
||||
.addScalar("conferidoEntrega", Hibernate.BOOLEAN)
|
||||
.setResultTransformer(Transformers.aliasToBean(BoletoComissao.class));
|
||||
|
||||
parametros.put("motivoCancelacionGeracaoOcd", Constantes.MVO_CANCEL_GERACAO_OCD.intValue());
|
||||
|
@ -915,13 +921,9 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
List<BoletoComissao> auxLsBoletoComissao = qr.list();
|
||||
for (BoletoComissao boletoComissao : auxLsBoletoComissao) {
|
||||
|
||||
if(boletoComissao.isStatusEntregue() && boletoComissao.getLogconferenciaId() == null) {
|
||||
boolean conferidoVenta = isConferidoVenta(boletoComissao);
|
||||
boletoComissao.setConferido(conferidoVenta);
|
||||
|
||||
if(conferidoVenta && boletoComissao.getStatus() == null ) {
|
||||
boletoComissao.setStatus(StatusLogConferencia.CONFERIDO.getValue());
|
||||
}
|
||||
if(boletoComissao.getStatus() == null && boletoComissao.getConferidoEntrega() != null && boletoComissao.getConferidoEntrega()) {
|
||||
boletoComissao.setConferido(true);
|
||||
boletoComissao.setStatus(StatusLogConferencia.CONFERIDO.getValue());
|
||||
}
|
||||
|
||||
if (boletoComissao.getFormapagos() == null) {
|
||||
|
@ -929,7 +931,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
boletoComissao.setConferencia(conferencia);
|
||||
}
|
||||
if(boletoComissao.getImporteFp() == null){
|
||||
boletoComissao.setImporteFp(new BigDecimal(0));
|
||||
boletoComissao.setImporteFp(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
if (lsBoletoComissao.contains(boletoComissao)) {
|
||||
|
|
|
@ -21,6 +21,9 @@ import org.hibernate.SessionFactory;
|
|||
import org.hibernate.criterion.MatchMode;
|
||||
import org.hibernate.criterion.Order;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.hibernate.type.BooleanType;
|
||||
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;
|
||||
|
@ -34,6 +37,7 @@ import com.rjconsultores.ventaboletos.entidad.ComEmpTipoEventoExtra;
|
|||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.InscricaoEstadual;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosEmpresaResultTransformer;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -291,4 +295,22 @@ public class EmpresaHibernateDAO extends GenericHibernateDAO<Empresa, Integer> i
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Empresa> buscarEmpresaPtoVtaComissao() {
|
||||
StringBuilder sQuery = new StringBuilder("SELECT DISTINCT em.EMPRESA_ID, em.NOMBEMPRESA, em.ACTIVO ");
|
||||
sQuery.append("FROM PTOVTA_COMISSAO ptovta ")
|
||||
.append("JOIN EMPRESA em ON em.empresa_id = ptovta.empresa_id ")
|
||||
.append("WHERE ptovta.activo = 1 ")
|
||||
.append("AND em.activo = 1");
|
||||
|
||||
Query qr = getSession().createSQLQuery(sQuery.toString())
|
||||
.addScalar("EMPRESA_ID", IntegerType.INSTANCE)
|
||||
.addScalar("NOMBEMPRESA", StringType.INSTANCE)
|
||||
.addScalar("ACTIVO", BooleanType.INSTANCE)
|
||||
.setResultTransformer(new DatosEmpresaResultTransformer());
|
||||
|
||||
return qr.list();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
|
@ -16,6 +15,7 @@ import org.hibernate.criterion.MatchMode;
|
|||
import org.hibernate.criterion.Order;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.hibernate.transform.AliasToBeanResultTransformer;
|
||||
import org.hibernate.type.BooleanType;
|
||||
import org.hibernate.type.IntegerType;
|
||||
import org.hibernate.type.StringType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -31,6 +31,7 @@ import com.rjconsultores.ventaboletos.entidad.PtovtaTipoEstoque;
|
|||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVentaVO;
|
||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||
import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosPuntoVentaResultTransformer;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -265,4 +266,27 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
|
|||
|
||||
return q.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<PuntoVenta> buscarPuntoVentaPtoVtaComissao(List<Integer> empresas) {
|
||||
StringBuilder sQuery = new StringBuilder("SELECT DISTINCT pv.PUNTOVENTA_ID, pv.NOMBPUNTOVENTA, pv.ACTIVO ");
|
||||
sQuery.append("FROM PTOVTA_COMISSAO ptovta ")
|
||||
.append("JOIN PUNTO_VENTA pv ON pv.puntoventa_id = ptovta.puntoventa_id ")
|
||||
.append("JOIN EMPRESA em ON em.empresa_id = ptovta.empresa_id ")
|
||||
.append("WHERE ptovta.activo = 1 ")
|
||||
.append("AND pv.activo = 1 ")
|
||||
.append("AND em.activo = 1 ")
|
||||
.append("AND em.empresa_id in (:empresas)");
|
||||
|
||||
Query qr = getSession().createSQLQuery(sQuery.toString())
|
||||
.addScalar("PUNTOVENTA_ID", IntegerType.INSTANCE)
|
||||
.addScalar("NOMBPUNTOVENTA", StringType.INSTANCE)
|
||||
.addScalar("ACTIVO", BooleanType.INSTANCE)
|
||||
.setResultTransformer(new DatosPuntoVentaResultTransformer());
|
||||
|
||||
qr.setParameterList("empresas", empresas);
|
||||
|
||||
return qr.list();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,377 @@
|
|||
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.FetchType;
|
||||
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 = "COMISSAO_RECEITA_SEQ", sequenceName = "COMISSAO_RECEITA_SEQ", allocationSize = 1)
|
||||
@Table(name = "COMISSAO_RECEITA")
|
||||
public class ComissaoReceita implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "COMISSAO_RECEITA_SEQ")
|
||||
@Column(name = "COMISSAORECEITA_ID")
|
||||
private Integer comissaoreceitaId;
|
||||
|
||||
@Column(name = "DATAMOVIMENTO")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date datamovimento;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "PUNTOVENTA_ID")
|
||||
private PuntoVenta puntoVenta;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "EMPRESA_ID")
|
||||
private Empresa empresa;
|
||||
|
||||
@Column(name = "BPR")
|
||||
private BigDecimal bpr;
|
||||
|
||||
@Column(name = "GAP")
|
||||
private BigDecimal gap;
|
||||
|
||||
@Column(name = "IMPGAP")
|
||||
private BigDecimal impgap;
|
||||
|
||||
@Column(name = "INTERNET")
|
||||
private BigDecimal internet;
|
||||
|
||||
@Column(name = "CANCELADOS")
|
||||
private BigDecimal cancelados;
|
||||
|
||||
@Column(name = "CANCELGAP")
|
||||
private BigDecimal cancelgap;
|
||||
|
||||
@Column(name = "DEVOLVIDOS")
|
||||
private BigDecimal devolvidos;
|
||||
|
||||
@Column(name = "DEVOLVIDOS_ORIGEM")
|
||||
private BigDecimal devolvidosOrigem;
|
||||
|
||||
@Column(name = "DEVOLVIDOS_ORIGEM_GAP")
|
||||
private BigDecimal devolvidosOrigemGap;
|
||||
|
||||
@Column(name = "DEVGAP")
|
||||
private BigDecimal devgap;
|
||||
|
||||
@Column(name = "EXCESSO_BAGAGEM")
|
||||
private BigDecimal excessoBagagem;
|
||||
|
||||
@Column(name = "SEG_OPCIONAL")
|
||||
private BigDecimal segOpcional;
|
||||
|
||||
@Column(name = "RECEITA_OUTROS")
|
||||
private BigDecimal receitaOutros;
|
||||
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
||||
@Column(name = "COMISSAO_BPR")
|
||||
private BigDecimal comissaoBpr;
|
||||
|
||||
@Column(name = "COMISSAO_ENTREGA_PASSAGEM")
|
||||
private BigDecimal comissaoEntregaPassagem;
|
||||
|
||||
@Column(name = "COMISSAO_ENTREGA_BAGAGEM")
|
||||
private BigDecimal comissaoExcessoBagagem;
|
||||
|
||||
@Column(name = "COMISSAO_SEG_OPCIONAL")
|
||||
private BigDecimal comissaoSegOpcional;
|
||||
|
||||
@Column(name = "COMISSAO_OUTROS")
|
||||
private BigDecimal comissaoOutros;
|
||||
|
||||
@Column(name = "QTDE_IMPGAP")
|
||||
private Integer qtdeImpgap;
|
||||
|
||||
public ComissaoReceita() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ComissaoReceita(com.rjconsultores.ventaboletos.vo.comissao.ComissaoReceita comissaoReceitaVO) {
|
||||
this();
|
||||
this.activo = Boolean.TRUE;
|
||||
this.fecmodif = new Date();
|
||||
this.datamovimento = comissaoReceitaVO.getData();
|
||||
this.bpr = comissaoReceitaVO.getReceitaBPR();
|
||||
this.gap = comissaoReceitaVO.getReceitaGAP();
|
||||
this.impgap = comissaoReceitaVO.getGapImpressa();
|
||||
this.qtdeImpgap = comissaoReceitaVO.getContImpressa();
|
||||
this.internet = comissaoReceitaVO.getInternet();
|
||||
this.cancelados = comissaoReceitaVO.getCancelados();
|
||||
this.cancelgap = comissaoReceitaVO.getCanceladosGAP();
|
||||
this.devolvidos = comissaoReceitaVO.getDevolvidos();
|
||||
this.devgap = comissaoReceitaVO.getDevolvidosGAP();
|
||||
this.excessoBagagem = comissaoReceitaVO.getReceitaExcessoBagagem();
|
||||
this.segOpcional = comissaoReceitaVO.getReceitaSeguroOpcional();
|
||||
this.receitaOutros = comissaoReceitaVO.getReceitaSeguroOutros();
|
||||
this.devolvidosOrigem = comissaoReceitaVO.getDevolucoesOrigem();
|
||||
this.devolvidosOrigemGap = comissaoReceitaVO.getDevolucoesOrigemGAP();
|
||||
|
||||
this.comissaoBpr = comissaoReceitaVO.getComissaoBPRDiaria();
|
||||
this.comissaoEntregaPassagem = comissaoReceitaVO.getComissaoEntregaPassagemDiaria();
|
||||
this.comissaoExcessoBagagem = comissaoReceitaVO.getComissaoExcessoBagagemDiaria();
|
||||
this.comissaoSegOpcional = comissaoReceitaVO.getComissaoSegOpcionalDiaria();
|
||||
this.comissaoOutros = comissaoReceitaVO.getComissaoOutrosDiaria();
|
||||
}
|
||||
|
||||
public Integer getComissaoreceitaId() {
|
||||
return comissaoreceitaId;
|
||||
}
|
||||
|
||||
public void setComissaoreceitaId(Integer comissaoreceitaId) {
|
||||
this.comissaoreceitaId = comissaoreceitaId;
|
||||
}
|
||||
|
||||
public Date getDatamovimento() {
|
||||
return datamovimento;
|
||||
}
|
||||
|
||||
public void setDatamovimento(Date datamovimento) {
|
||||
this.datamovimento = datamovimento;
|
||||
}
|
||||
|
||||
public PuntoVenta getPuntoVenta() {
|
||||
return puntoVenta;
|
||||
}
|
||||
|
||||
public void setPuntoVenta(PuntoVenta puntoVenta) {
|
||||
this.puntoVenta = puntoVenta;
|
||||
}
|
||||
|
||||
public BigDecimal getBpr() {
|
||||
return bpr;
|
||||
}
|
||||
|
||||
public void setBpr(BigDecimal bpr) {
|
||||
this.bpr = bpr;
|
||||
}
|
||||
|
||||
public BigDecimal getGap() {
|
||||
return gap;
|
||||
}
|
||||
|
||||
public void setGap(BigDecimal gap) {
|
||||
this.gap = gap;
|
||||
}
|
||||
|
||||
public BigDecimal getImpgap() {
|
||||
return impgap;
|
||||
}
|
||||
|
||||
public void setImpgap(BigDecimal impgap) {
|
||||
this.impgap = impgap;
|
||||
}
|
||||
|
||||
public BigDecimal getInternet() {
|
||||
return internet;
|
||||
}
|
||||
|
||||
public void setInternet(BigDecimal internet) {
|
||||
this.internet = internet;
|
||||
}
|
||||
|
||||
public BigDecimal getCancelados() {
|
||||
return cancelados;
|
||||
}
|
||||
|
||||
public void setCancelados(BigDecimal cancelados) {
|
||||
this.cancelados = cancelados;
|
||||
}
|
||||
|
||||
public BigDecimal getCancelgap() {
|
||||
return cancelgap;
|
||||
}
|
||||
|
||||
public void setCancelgap(BigDecimal cancelgap) {
|
||||
this.cancelgap = cancelgap;
|
||||
}
|
||||
|
||||
public BigDecimal getDevolvidos() {
|
||||
return devolvidos;
|
||||
}
|
||||
|
||||
public void setDevolvidos(BigDecimal devolvidos) {
|
||||
this.devolvidos = devolvidos;
|
||||
}
|
||||
|
||||
public BigDecimal getDevgap() {
|
||||
return devgap;
|
||||
}
|
||||
|
||||
public void setDevgap(BigDecimal devgap) {
|
||||
this.devgap = devgap;
|
||||
}
|
||||
|
||||
public BigDecimal getExcessoBagagem() {
|
||||
return excessoBagagem;
|
||||
}
|
||||
|
||||
public void setExcessoBagagem(BigDecimal excessoBagagem) {
|
||||
this.excessoBagagem = excessoBagagem;
|
||||
}
|
||||
|
||||
public BigDecimal getSegOpcional() {
|
||||
return segOpcional;
|
||||
}
|
||||
|
||||
public void setSegOpcional(BigDecimal segOpcional) {
|
||||
this.segOpcional = segOpcional;
|
||||
}
|
||||
|
||||
public BigDecimal getReceitaOutros() {
|
||||
return receitaOutros;
|
||||
}
|
||||
|
||||
public void setReceitaOutros(BigDecimal receitaOutros) {
|
||||
this.receitaOutros = receitaOutros;
|
||||
}
|
||||
|
||||
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 BigDecimal getDevolvidosOrigem() {
|
||||
return devolvidosOrigem;
|
||||
}
|
||||
|
||||
public void setDevolvidosOrigem(BigDecimal devolvidosOrigem) {
|
||||
this.devolvidosOrigem = devolvidosOrigem;
|
||||
}
|
||||
|
||||
public BigDecimal getDevolvidosOrigemGap() {
|
||||
return devolvidosOrigemGap;
|
||||
}
|
||||
|
||||
public void setDevolvidosOrigemGap(BigDecimal devolvidosOrigemGap) {
|
||||
this.devolvidosOrigemGap = devolvidosOrigemGap;
|
||||
}
|
||||
|
||||
public BigDecimal getComissaoBpr() {
|
||||
return comissaoBpr;
|
||||
}
|
||||
|
||||
public void setComissaoBpr(BigDecimal comissaoBpr) {
|
||||
this.comissaoBpr = comissaoBpr;
|
||||
}
|
||||
|
||||
public BigDecimal getComissaoEntregaPassagem() {
|
||||
return comissaoEntregaPassagem;
|
||||
}
|
||||
|
||||
public void setComissaoEntregaPassagem(BigDecimal comissaoEntregaPassagem) {
|
||||
this.comissaoEntregaPassagem = comissaoEntregaPassagem;
|
||||
}
|
||||
|
||||
public BigDecimal getComissaoExcessoBagagem() {
|
||||
return comissaoExcessoBagagem;
|
||||
}
|
||||
|
||||
public void setComissaoExcessoBagagem(BigDecimal comissaoExcessoBagagem) {
|
||||
this.comissaoExcessoBagagem = comissaoExcessoBagagem;
|
||||
}
|
||||
|
||||
public BigDecimal getComissaoSegOpcional() {
|
||||
return comissaoSegOpcional;
|
||||
}
|
||||
|
||||
public void setComissaoSegOpcional(BigDecimal comissaoSegOpcional) {
|
||||
this.comissaoSegOpcional = comissaoSegOpcional;
|
||||
}
|
||||
|
||||
public BigDecimal getComissaoOutros() {
|
||||
return comissaoOutros;
|
||||
}
|
||||
|
||||
public void setComissaoOutros(BigDecimal comissaoOutros) {
|
||||
this.comissaoOutros = comissaoOutros;
|
||||
}
|
||||
|
||||
public Integer getQtdeImpgap() {
|
||||
return qtdeImpgap;
|
||||
}
|
||||
|
||||
public void setQtdeImpgap(Integer qtdeImpgap) {
|
||||
this.qtdeImpgap = qtdeImpgap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((comissaoreceitaId == null) ? 0 : comissaoreceitaId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (!(obj instanceof ComissaoReceita))
|
||||
return false;
|
||||
ComissaoReceita other = (ComissaoReceita) obj;
|
||||
if (comissaoreceitaId == null) {
|
||||
if (other.comissaoreceitaId != null)
|
||||
return false;
|
||||
} else if (!comissaoreceitaId.equals(other.comissaoreceitaId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public Empresa getEmpresa() {
|
||||
return empresa;
|
||||
}
|
||||
|
||||
public void setEmpresa(Empresa empresa) {
|
||||
this.empresa = empresa;
|
||||
}
|
||||
|
||||
}
|
|
@ -12,15 +12,15 @@ import com.rjconsultores.ventaboletos.vo.comissao.RegistroCalculo;
|
|||
|
||||
public interface CalculoComissaoService {
|
||||
|
||||
public RegistroCalculo relatorioCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo) throws ComissaoException, BusinessException;
|
||||
public RegistroCalculo relatorioCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo) throws ComissaoException, BusinessException;
|
||||
|
||||
public void registrarCalculoComissao(PuntoVenta puntoVenta, Empresa empresa, Date periodo, boolean ignorarComissaoGerada) throws ComissaoException;
|
||||
public void registrarCalculoComissao(PuntoVenta puntoVenta, Empresa empresa, Date periodo, boolean ignorarComissaoGerada, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo) throws ComissaoException;
|
||||
|
||||
public void cancelarCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo) throws ComissaoException;
|
||||
|
||||
public List<RegistroCalculo> relatorioCalculoComissao(Integer empresaId, Date periodo) throws ComissaoException, BusinessException;
|
||||
public List<RegistroCalculo> relatorioCalculoComissao(Integer empresaId, Date periodo, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo) throws ComissaoException, BusinessException;
|
||||
|
||||
public void registrarCalculoComissao(Empresa empresa, Date periodo, boolean ignorarComissaoGerada) throws ComissaoException;
|
||||
public void registrarCalculoComissao(Empresa empresa, Date periodo, boolean ignorarComissaoGerada, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo) throws ComissaoException;
|
||||
|
||||
public void cancelarCalculoComissao(Integer empresaId, Date periodo) throws ComissaoException;
|
||||
|
||||
|
@ -28,4 +28,6 @@ public interface CalculoComissaoService {
|
|||
|
||||
public void enviarEmailReciboComissao(HistoricoComissao historicoComissao, byte[] recibo);
|
||||
|
||||
public void registrarCalculoComissao(PuntoVenta puntoVenta, Empresa empresa, Date dataInicial, Date dataFinal, Integer usuarioId) throws ComissaoException, BusinessException;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.ComissaoReceita;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
|
||||
public interface ComissaoReceitaService extends GenericService<ComissaoReceita, Integer> {
|
||||
|
||||
public void reterComissaoReceitaDiaria(Integer empresaId, Integer puntoVentaId, Integer usuarioId, List<com.rjconsultores.ventaboletos.vo.comissao.ComissaoReceita> receitas) throws BusinessException;
|
||||
|
||||
public List<com.rjconsultores.ventaboletos.vo.comissao.ComissaoReceita> recuperarComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal);
|
||||
|
||||
public void limparComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal) throws BusinessException;
|
||||
|
||||
}
|
|
@ -62,4 +62,6 @@ public interface EmpresaService {
|
|||
|
||||
public ComEmpConferencia suscribirOrActualizacion(ComEmpConferencia comEmpConferencia);
|
||||
|
||||
public List<Empresa> buscarEmpresaPtoVtaComissao();
|
||||
|
||||
}
|
||||
|
|
|
@ -46,4 +46,6 @@ public interface PuntoVentaService {
|
|||
public List<PuntoVenta> buscarPuntosVentaPorUsuario(Usuario usuario);
|
||||
|
||||
public List<PuntoVentaVO> buscaPuntoVentaEmpresaSemECF(Empresa empresa);
|
||||
|
||||
List<PuntoVenta> buscarPuntoVentaPtoVtaComissao(List<Empresa> empresas);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.zkoss.util.resource.Labels;
|
||||
|
||||
import com.rjconsultores.ventaboletos.constantes.Constantes;
|
||||
|
@ -37,6 +38,7 @@ import com.rjconsultores.ventaboletos.enums.MimeType;
|
|||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.exception.ComissaoException;
|
||||
import com.rjconsultores.ventaboletos.service.CalculoComissaoService;
|
||||
import com.rjconsultores.ventaboletos.service.ComissaoReceitaService;
|
||||
import com.rjconsultores.ventaboletos.service.ComissaoService;
|
||||
import com.rjconsultores.ventaboletos.service.ConferenciaComissaoService;
|
||||
import com.rjconsultores.ventaboletos.service.ConstanteService;
|
||||
|
@ -84,6 +86,9 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
@Autowired
|
||||
private ConstanteService constanteService;
|
||||
|
||||
@Autowired
|
||||
private ComissaoReceitaService comissaoReceitaService;
|
||||
|
||||
public boolean validaCompetencia(Date periodo) {
|
||||
Calendar calendario = Calendar.getInstance();
|
||||
calendario.setTime(periodo);
|
||||
|
@ -108,7 +113,8 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void registrarCalculoComissao(PuntoVenta puntoVenta, Empresa empresa, Date periodo, boolean ignorarComissaoGerada) throws ComissaoException {
|
||||
@Transactional
|
||||
public void registrarCalculoComissao(PuntoVenta puntoVenta, Empresa empresa, Date periodo, boolean ignorarComissaoGerada, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo) throws ComissaoException {
|
||||
|
||||
try {
|
||||
|
||||
|
@ -116,11 +122,11 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
|
||||
String competencia = DateUtil.getStringDate(periodo, "MM/yyyy");
|
||||
|
||||
if(conferenciaComissaoService.isConferenciaCompetenciaEncerrada(competencia, empresa, puntoVenta)) {
|
||||
if(isRetencaoDiaria || conferenciaComissaoService.isConferenciaCompetenciaEncerrada(competencia, empresa, puntoVenta)) {
|
||||
Comissao comissaoCadastrada = comissaoDAO.buscaComissaoVigencia(puntoVenta.getPuntoventaId(), empresa.getEmpresaId(), competencia);
|
||||
if (comissaoCadastrada == null) {
|
||||
|
||||
RegistroCalculo rc = realizarCalculoComissao(puntoVenta.getPuntoventaId(), empresa.getEmpresaId(), periodo);
|
||||
RegistroCalculo rc = realizarCalculoComissao(puntoVenta.getPuntoventaId(), empresa.getEmpresaId(), periodo, isRetencaoDiaria, usuarioId, isRefazerCalculo);
|
||||
|
||||
Comissao comissao = new Comissao();
|
||||
comissao.setCompetencia(competencia);
|
||||
|
@ -172,6 +178,7 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
}
|
||||
|
||||
} catch (ComissaoException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
|
@ -193,8 +200,8 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public RegistroCalculo relatorioCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo) throws ComissaoException, BusinessException {
|
||||
return realizarCalculoComissao(puntoVentaId, empresaId, periodo);
|
||||
public RegistroCalculo relatorioCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo) throws ComissaoException, BusinessException {
|
||||
return realizarCalculoComissao(puntoVentaId, empresaId, periodo, isRetencaoDiaria, usuarioId, isRefazerCalculo);
|
||||
}
|
||||
|
||||
private BigDecimal calculoComisssaoBPR(boolean isAltaTemporada, PtovtaComissao ptovtaComissao, BigDecimal bpr, BigDecimal gap) {
|
||||
|
@ -298,8 +305,7 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
return respDescontos;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public RegistroCalculo realizarCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo) throws ComissaoException, BusinessException {
|
||||
public RegistroCalculo realizarCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo, Boolean isRetencaoDiaria, Integer usuarioId, Boolean isRefazerCalculo) throws ComissaoException, BusinessException {
|
||||
|
||||
PtovtaComissao ptovtaComissao = ptovtaComissaoService.buscarPuntaVentaEmpresa(puntoVentaId, empresaId);
|
||||
if (ptovtaComissao != null) {
|
||||
|
@ -310,19 +316,78 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
Conferencia conferencia = new Conferencia();
|
||||
conferencia.setPuntoVenta(new PuntoVenta(puntoVentaId));
|
||||
conferencia.setEmpresa(new Empresa(empresaId));
|
||||
conferencia.setCompetencia(DateUtil.getStringDate(periodo, "MM/yyyy"));
|
||||
List<BoletoComissao> receitasBoleto = conferenciaComissaoDAO.carregarBilhetesComissao(conferencia, true, consideraBilhetesDevolvidosEmOutraAgencia);
|
||||
List<EventosFinanceirosVO> eventosFinanceirosVOs = conferenciaComissaoDAO.carregarEventosFinanceiros(conferencia);
|
||||
|
||||
Calendar calendario = Calendar.getInstance();
|
||||
calendario.setTime(periodo);
|
||||
|
||||
int ultimodia = calendario.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||
int mes = calendario.get(Calendar.MONTH) + 1;
|
||||
int diaInicial = -1;
|
||||
int diaFinal = -1;
|
||||
int mes = calendario.get(Calendar.MONTH);
|
||||
int ano = calendario.get(Calendar.YEAR);
|
||||
|
||||
List<ComissaoReceita> receitas = calculaReceitaComissao(empresaId, ptovtaComissao, receitasBoleto, ultimodia, mes, ano, eventosFinanceirosVOs);
|
||||
if(isRetencaoDiaria) {
|
||||
conferencia.setDatamovimento(periodo);
|
||||
diaInicial = calendario.get(Calendar.DAY_OF_MONTH);
|
||||
diaFinal = calendario.get(Calendar.DAY_OF_MONTH);
|
||||
} else {
|
||||
conferencia.setCompetencia(DateUtil.getStringDate(periodo, "MM/yyyy"));
|
||||
diaInicial = calendario.getActualMinimum(Calendar.DAY_OF_MONTH);
|
||||
diaFinal = calendario.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||
}
|
||||
|
||||
Date dataInicial = getDate(diaInicial, mes, ano);
|
||||
Date dataFinal = getDate(diaFinal, mes, ano);
|
||||
|
||||
List<ComissaoReceita> receitas = null;
|
||||
|
||||
if(isRefazerCalculo) {
|
||||
comissaoReceitaService.limparComissaoReceita(empresaId, puntoVentaId, dataInicial, dataFinal);
|
||||
List<BoletoComissao> receitasBoleto = conferenciaComissaoDAO.carregarBilhetesComissao(conferencia, true, consideraBilhetesDevolvidosEmOutraAgencia);
|
||||
List<EventosFinanceirosVO> eventosFinanceirosVOs = conferenciaComissaoDAO.carregarEventosFinanceiros(conferencia);
|
||||
receitas = calculaReceitaComissao(empresaId, ptovtaComissao, receitasBoleto, diaInicial, diaFinal, mes, ano, eventosFinanceirosVOs);
|
||||
reterComissaoReceitaDiaria(empresaId, puntoVentaId, usuarioId, receitas);
|
||||
} else {
|
||||
receitas = recuperarComissaoReceita(empresaId, puntoVentaId, dataInicial, dataFinal);
|
||||
}
|
||||
|
||||
return calcularRegistroCalculo(ptovtaComissao, puntoVentaId, empresaId, periodo, receitas);
|
||||
} else {
|
||||
if(!isRefazerCalculo) {
|
||||
throw new ComissaoException("busquedaCalculoComissaoController.PtovtaComissao.exception");
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<ComissaoReceita> recuperarComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal) {
|
||||
return comissaoReceitaService.recuperarComissaoReceita(empresaId, puntoVentaId, dataInicial, dataFinal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retem dados para calculo da comissao
|
||||
* @param empresaId
|
||||
* @param puntoVentaId
|
||||
* @param usuarioId
|
||||
* @param receitas
|
||||
* @throws BusinessException
|
||||
*/
|
||||
private void reterComissaoReceitaDiaria(Integer empresaId, Integer puntoVentaId, Integer usuarioId, List<ComissaoReceita> receitas) throws BusinessException {
|
||||
comissaoReceitaService.reterComissaoReceitaDiaria(empresaId, puntoVentaId, usuarioId, receitas);
|
||||
}
|
||||
|
||||
/**
|
||||
* Carrega os dados de registro de calculo, conforme receitas
|
||||
* @param ptovtaComissao
|
||||
* @param puntoVentaId
|
||||
* @param empresaId
|
||||
* @param periodo
|
||||
* @param receitas
|
||||
* @return
|
||||
* @throws BusinessException
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private RegistroCalculo calcularRegistroCalculo(PtovtaComissao ptovtaComissao, Integer puntoVentaId, Integer empresaId, Date periodo, List<ComissaoReceita> receitas) throws BusinessException {
|
||||
try {
|
||||
RegistroCalculo rc = new RegistroCalculo();
|
||||
rc.setNombpuntoventa(ptovtaComissao.getPuntoventaId().getNombpuntoventa());
|
||||
rc.setNumPuntoVenta(ptovtaComissao.getPuntoventaId().getNumPuntoVenta());
|
||||
|
@ -394,8 +459,9 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
rc.setComissaoPagar(comissaoPagar);
|
||||
|
||||
return rc;
|
||||
} else {
|
||||
throw new ComissaoException("busquedaCalculoComissaoController.PtovtaComissao.exception");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new BusinessException(e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -404,7 +470,7 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
|
||||
for (EmpresaImposto ei : impostos) {
|
||||
if (ei.getEstado().getEstadoId().equals(estadoId)) {
|
||||
switch (mes - 1) {
|
||||
switch (mes) {
|
||||
case Calendar.JANUARY:
|
||||
return ei.getIndJaneiro() == null ? false : ei.getIndJaneiro();
|
||||
case Calendar.FEBRUARY:
|
||||
|
@ -438,22 +504,23 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
return false;
|
||||
}
|
||||
|
||||
private List<ComissaoReceita> calculaReceitaComissao(Integer empresaId, PtovtaComissao ptovtaComissao, List<BoletoComissao> receitasBoleto, Integer ultimodia, Integer mes, Integer ano, List<EventosFinanceirosVO> eventosFinanceirosVOs) {
|
||||
private List<ComissaoReceita> calculaReceitaComissao(Integer empresaId, PtovtaComissao ptovtaComissao, List<BoletoComissao> receitasBoleto, Integer diaInicial, Integer diaFinal, Integer mes, Integer ano, List<EventosFinanceirosVO> eventosFinanceirosVOs) {
|
||||
|
||||
List<EmpresaImposto> impostos = empresaImpostoService.buscarEmpresaImposto(empresaId);
|
||||
|
||||
List<ComissaoReceita> receitas = new ArrayList<ComissaoReceita>();
|
||||
for (int dia = 1; dia <= ultimodia; dia++) {
|
||||
for (int dia = diaInicial; dia <= diaFinal; dia++) {
|
||||
Calendar cDataRegistro = Calendar.getInstance();
|
||||
cDataRegistro.set(Calendar.DAY_OF_MONTH, dia);
|
||||
cDataRegistro.set(Calendar.MONTH, mes);
|
||||
cDataRegistro.set(Calendar.YEAR, ano);
|
||||
|
||||
List<BoletoComissao> list = verificaCalculoComissaoProDia(receitasBoleto, dia, mes);
|
||||
Date dataRegistro = DateUtil.normalizarToFecha(cDataRegistro.getTime());
|
||||
|
||||
Calendar dataRegistro = Calendar.getInstance();
|
||||
dataRegistro.set(Calendar.DAY_OF_MONTH, dia);
|
||||
dataRegistro.set(Calendar.MONTH, mes - 1);
|
||||
dataRegistro.set(Calendar.YEAR, ano);
|
||||
List<BoletoComissao> list = verificaCalculoComissaoProDia(receitasBoleto, dataRegistro);
|
||||
|
||||
ComissaoReceita cr = new ComissaoReceita();
|
||||
cr.setData(dataRegistro.getTime());
|
||||
cr.setData(dataRegistro);
|
||||
|
||||
BigDecimal receitaComissao = BigDecimal.ZERO;
|
||||
|
||||
|
@ -622,7 +689,7 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
}
|
||||
|
||||
/* Calculando comissão para os eventos extras */
|
||||
List<EventosFinanceirosVO> listEventosFinanceiros = verificaEventoFinanceiroProDia(eventosFinanceirosVOs, dia, mes);
|
||||
List<EventosFinanceirosVO> listEventosFinanceiros = verificaEventoFinanceiroProDia(eventosFinanceirosVOs, dataRegistro);
|
||||
for (EventosFinanceirosVO eventosFinanceiros : listEventosFinanceiros) {
|
||||
boolean isAltaTemporada = validaAltaTemporada(impostos, mes, eventosFinanceiros.getEstadoId());
|
||||
|
||||
|
@ -662,14 +729,10 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
receitaComissao = MoneyHelper.somar(receitaComissao,receitaBPR);
|
||||
receitaComissao = MoneyHelper.somar(receitaComissao,receitaGAP);
|
||||
|
||||
//receitaComissao = MoneyHelper.subtrair(receitaComissao,gapImpressa);
|
||||
//receitaComissao = MoneyHelper.subtrair(receitaComissao,internet);
|
||||
receitaComissao = MoneyHelper.subtrair(receitaComissao,cancelados);
|
||||
receitaComissao = MoneyHelper.subtrair(receitaComissao,devolvidos);
|
||||
receitaComissao = MoneyHelper.subtrair(receitaComissao,devolvidosGAP);
|
||||
receitaComissao = MoneyHelper.subtrair(receitaComissao,canceladosGAP);
|
||||
//receitaComissao = MoneyHelper.subtrair(receitaComissao,devolvidosOrigem);
|
||||
//receitaComissao = MoneyHelper.subtrair(receitaComissao,devolvidosGAPOrigem);
|
||||
|
||||
cr.setReceitaComissao(receitaComissao);
|
||||
|
||||
|
@ -686,32 +749,20 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
|
||||
}
|
||||
|
||||
private List<EventosFinanceirosVO> verificaEventoFinanceiroProDia(List<EventosFinanceirosVO> eventosFinanceirosVOs, Integer dia, Integer mes) {
|
||||
private List<EventosFinanceirosVO> verificaEventoFinanceiroProDia(List<EventosFinanceirosVO> eventosFinanceirosVOs, Date dataRegistro) {
|
||||
List<EventosFinanceirosVO> aux = new ArrayList<EventosFinanceirosVO>();
|
||||
for (EventosFinanceirosVO rcc : eventosFinanceirosVOs) {
|
||||
Calendar calendario = Calendar.getInstance();
|
||||
calendario.setTime(rcc.getFeccorte());
|
||||
|
||||
int diaItem = calendario.get(Calendar.DAY_OF_MONTH);
|
||||
int mesItem = calendario.get(Calendar.MONTH) + 1;
|
||||
|
||||
if (dia.equals(diaItem) && mes.equals(mesItem)) {
|
||||
if (DateUtil.compareOnlyDate(rcc.getFeccorte(), dataRegistro) == 0) {
|
||||
aux.add(rcc);
|
||||
}
|
||||
}
|
||||
return aux;
|
||||
}
|
||||
|
||||
private List<BoletoComissao> verificaCalculoComissaoProDia(List<BoletoComissao> list, Integer dia, Integer mes) {
|
||||
private List<BoletoComissao> verificaCalculoComissaoProDia(List<BoletoComissao> list, Date dataRegistro) {
|
||||
List<BoletoComissao> aux = new ArrayList<BoletoComissao>();
|
||||
for (BoletoComissao rcc : list) {
|
||||
Calendar calendario = Calendar.getInstance();
|
||||
calendario.setTime(rcc.getFeccorte());
|
||||
|
||||
int diaItem = calendario.get(Calendar.DAY_OF_MONTH);
|
||||
int mesItem = calendario.get(Calendar.MONTH) + 1;
|
||||
|
||||
if (dia.equals(diaItem) && mes.equals(mesItem)) {
|
||||
if (DateUtil.compareOnlyDate(rcc.getFeccorte(), dataRegistro) == 0) {
|
||||
aux.add(rcc);
|
||||
}
|
||||
}
|
||||
|
@ -719,11 +770,11 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<RegistroCalculo> relatorioCalculoComissao(Integer empresaId, Date periodo) throws ComissaoException, BusinessException {
|
||||
public List<RegistroCalculo> relatorioCalculoComissao(Integer empresaId, Date periodo, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo) throws ComissaoException, BusinessException {
|
||||
List<RegistroCalculo> registrosCalculo = new ArrayList<RegistroCalculo>();
|
||||
List<PuntoVenta> puntoventas = comissaoDAO.buscaPuntoVentasEmpresaComComissaoParametrizada(empresaId);
|
||||
for (PuntoVenta puntoVenta : puntoventas) {
|
||||
RegistroCalculo registroCalculo = relatorioCalculoComissao(puntoVenta.getPuntoventaId(), empresaId, periodo);
|
||||
RegistroCalculo registroCalculo = relatorioCalculoComissao(puntoVenta.getPuntoventaId(), empresaId, periodo, usuarioId, isRetencaoDiaria, isRefazerCalculo);
|
||||
totalizarRegistroCalculo(registroCalculo);
|
||||
registrosCalculo.add(registroCalculo);
|
||||
}
|
||||
|
@ -765,14 +816,16 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void registrarCalculoComissao(Empresa empresa, Date periodo, boolean ignorarComissaoGerada) throws ComissaoException {
|
||||
@Transactional
|
||||
public void registrarCalculoComissao(Empresa empresa, Date periodo, boolean ignorarComissaoGerada, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo) throws ComissaoException {
|
||||
List<PuntoVenta> puntoventas = comissaoDAO.buscaPuntoVentasEmpresaComComissaoParametrizada(empresa.getEmpresaId());
|
||||
for (PuntoVenta puntoVenta : puntoventas) {
|
||||
registrarCalculoComissao(puntoVenta, empresa, periodo, ignorarComissaoGerada);
|
||||
registrarCalculoComissao(puntoVenta, empresa, periodo, ignorarComissaoGerada, usuarioId, isRetencaoDiaria, isRefazerCalculo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void cancelarCalculoComissao(Integer empresaId, Date periodo) throws ComissaoException {
|
||||
List<PuntoVenta> puntoventas = comissaoDAO.buscaPuntoVentasEmpresaComComissaoParametrizada(empresaId);
|
||||
for (PuntoVenta puntoVenta : puntoventas) {
|
||||
|
@ -785,6 +838,7 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
try {
|
||||
return comissaoDAO.buscaHistoricoComissao(puntoVentaId, empresaId, DateUtil.getDateFromString(competencia, "MM/yyyy"), DateUtil.getDateFromString(competencia, "MM/yyyy"));
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ComissaoException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
@ -839,4 +893,31 @@ public class CalculoComissaoServiceImpl implements CalculoComissaoService {
|
|||
}
|
||||
}
|
||||
|
||||
private Date getDate(int dia, int mes, int ano) {
|
||||
Calendar cData = Calendar.getInstance();
|
||||
cData.set(Calendar.DAY_OF_MONTH, dia);
|
||||
cData.set(Calendar.MONTH, mes);
|
||||
cData.set(Calendar.YEAR, ano);
|
||||
return DateUtil.normalizarToFecha(cData.getTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void registrarCalculoComissao(PuntoVenta puntoVenta, Empresa empresa, Date dataInicial, Date dataFinal, Integer usuarioId) throws ComissaoException, BusinessException {
|
||||
try {
|
||||
Calendar cDataAtual = Calendar.getInstance();
|
||||
cDataAtual.setTime(dataInicial);
|
||||
while(DateUtil.compareOnlyDate(cDataAtual.getTime(), dataFinal) <= 0) {
|
||||
realizarCalculoComissao(puntoVenta.getPuntoventaId(), empresa.getEmpresaId(), cDataAtual.getTime(), true, usuarioId, true);
|
||||
cDataAtual.add(Calendar.DAY_OF_MONTH, 1);
|
||||
}
|
||||
} catch (ComissaoException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new BusinessException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.ComissaoReceitaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.ComissaoReceita;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.service.ComissaoReceitaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.MoneyHelper;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
@Service("comissaoReceitaService")
|
||||
public class ComissaoReceitaServiceImpl implements ComissaoReceitaService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(CalculoComissaoServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private ComissaoReceitaDAO comissaoReceitaDAO;
|
||||
|
||||
@Override
|
||||
public List<ComissaoReceita> obtenerTodos() {
|
||||
return comissaoReceitaDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComissaoReceita obtenerID(Integer id) {
|
||||
return comissaoReceitaDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public ComissaoReceita suscribir(ComissaoReceita entidad) {
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
return comissaoReceitaDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public ComissaoReceita actualizacion(ComissaoReceita entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
return comissaoReceitaDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void borrar(ComissaoReceita entidad) {
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
comissaoReceitaDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void reterComissaoReceitaDiaria(Integer empresaId, Integer puntoVentaId, Integer usuarioId, List<com.rjconsultores.ventaboletos.vo.comissao.ComissaoReceita> receitas) throws BusinessException {
|
||||
try {
|
||||
Empresa empresa = new Empresa(empresaId);
|
||||
PuntoVenta puntoVenta = new PuntoVenta(puntoVentaId);
|
||||
for (com.rjconsultores.ventaboletos.vo.comissao.ComissaoReceita comissaoReceitaVO : receitas) {
|
||||
ComissaoReceita comissaoReceita = new ComissaoReceita(comissaoReceitaVO);
|
||||
comissaoReceita.setEmpresa(empresa);
|
||||
comissaoReceita.setPuntoVenta(puntoVenta);
|
||||
comissaoReceita.setUsuarioId(usuarioId);
|
||||
comissaoReceitaDAO.suscribir(comissaoReceita);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new BusinessException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.rjconsultores.ventaboletos.vo.comissao.ComissaoReceita> recuperarComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal) {
|
||||
|
||||
List<com.rjconsultores.ventaboletos.vo.comissao.ComissaoReceita> lsComissaoReceitasVO = new ArrayList<com.rjconsultores.ventaboletos.vo.comissao.ComissaoReceita>();
|
||||
List<ComissaoReceita> lsComissaoReceitas = comissaoReceitaDAO.recuperarComissaoReceita(empresaId, puntoVentaId, dataInicial, dataFinal);
|
||||
for (ComissaoReceita comissaoReceita : lsComissaoReceitas) {
|
||||
com.rjconsultores.ventaboletos.vo.comissao.ComissaoReceita comissaoReceitaVO = new com.rjconsultores.ventaboletos.vo.comissao.ComissaoReceita();
|
||||
comissaoReceitaVO.setCancelados(comissaoReceita.getCancelados());
|
||||
comissaoReceitaVO.setCanceladosGAP(comissaoReceita.getCancelgap());
|
||||
comissaoReceitaVO.setComissaoBPRDiaria(comissaoReceita.getComissaoBpr());
|
||||
comissaoReceitaVO.setComissaoEntregaPassagemDiaria(comissaoReceita.getComissaoEntregaPassagem());
|
||||
comissaoReceitaVO.setComissaoExcessoBagagemDiaria(comissaoReceita.getComissaoExcessoBagagem());
|
||||
comissaoReceitaVO.setComissaoOutrosDiaria(comissaoReceita.getComissaoOutros());
|
||||
comissaoReceitaVO.setComissaoSegOpcionalDiaria(comissaoReceita.getComissaoSegOpcional());
|
||||
comissaoReceitaVO.setContImpressa(comissaoReceita.getQtdeImpgap());
|
||||
comissaoReceitaVO.setData(comissaoReceita.getDatamovimento());
|
||||
comissaoReceitaVO.setDevolucoesOrigem(comissaoReceita.getDevolvidosOrigem());
|
||||
comissaoReceitaVO.setDevolucoesOrigemGAP(comissaoReceita.getDevolvidosOrigemGap());
|
||||
comissaoReceitaVO.setDevolvidos(comissaoReceita.getDevolvidos());
|
||||
comissaoReceitaVO.setDevolvidosGAP(comissaoReceita.getDevolvidosOrigemGap());
|
||||
comissaoReceitaVO.setGapImpressa(comissaoReceita.getImpgap());
|
||||
comissaoReceitaVO.setInternet(comissaoReceita.getInternet());
|
||||
comissaoReceitaVO.setReceitaBPR(comissaoReceita.getBpr());
|
||||
comissaoReceitaVO.setReceitaExcessoBagagem(comissaoReceita.getExcessoBagagem());
|
||||
comissaoReceitaVO.setReceitaGAP(comissaoReceita.getGap());
|
||||
comissaoReceitaVO.setReceitaSeguroOpcional(comissaoReceita.getSegOpcional());
|
||||
comissaoReceitaVO.setReceitaSeguroOutros(comissaoReceita.getReceitaOutros());
|
||||
|
||||
BigDecimal receitaComissao = BigDecimal.ZERO;
|
||||
receitaComissao = MoneyHelper.somar(receitaComissao,comissaoReceitaVO.getReceitaBPR());
|
||||
receitaComissao = MoneyHelper.somar(receitaComissao,comissaoReceitaVO.getReceitaGAP());
|
||||
|
||||
receitaComissao = MoneyHelper.subtrair(receitaComissao,comissaoReceitaVO.getCancelados());
|
||||
receitaComissao = MoneyHelper.subtrair(receitaComissao,comissaoReceitaVO.getDevolvidos());
|
||||
receitaComissao = MoneyHelper.subtrair(receitaComissao,comissaoReceitaVO.getDevolvidosGAP());
|
||||
receitaComissao = MoneyHelper.subtrair(receitaComissao,comissaoReceitaVO.getCanceladosGAP());
|
||||
|
||||
comissaoReceitaVO.setReceitaComissao(receitaComissao);
|
||||
|
||||
lsComissaoReceitasVO.add(comissaoReceitaVO);
|
||||
|
||||
}
|
||||
|
||||
return lsComissaoReceitasVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void limparComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal) throws BusinessException {
|
||||
try {
|
||||
comissaoReceitaDAO.limparComissaoReceita(empresaId, puntoVentaId, dataInicial, dataFinal);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new BusinessException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -45,7 +45,6 @@ public class ComissaoServiceImpl implements ComissaoService {
|
|||
public Comissao actualizacion(Comissao entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return comissaoDAO.actualizacion(entidad);
|
||||
}
|
||||
|
|
|
@ -216,4 +216,9 @@ public class EmpresaServiceImpl implements EmpresaService {
|
|||
return empresaDAO.actualizacion(comEmpConferencia);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Empresa> buscarEmpresaPtoVtaComissao() {
|
||||
return empresaDAO.buscarEmpresaPtoVtaComissao();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.rmi.RemoteException;
|
|||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.text.Normalizer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -802,4 +803,19 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
|||
return puntoVentaDAO.buscaPuntoVentaEmpresaSemECF(empresa);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PuntoVenta> buscarPuntoVentaPtoVtaComissao(List<Empresa> empresas) {
|
||||
List<Integer> empresasId = new ArrayList<Integer>();
|
||||
if(empresas != null) {
|
||||
for (Empresa empresa : empresas) {
|
||||
empresasId.add(empresa.getEmpresaId());
|
||||
}
|
||||
}
|
||||
if(!empresasId.isEmpty()) {
|
||||
return puntoVentaDAO.buscarPuntoVentaPtoVtaComissao(empresasId);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.transform.ResultTransformer;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
|
||||
public class DatosEmpresaResultTransformer implements ResultTransformer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public List<Empresa> transformList(List mapList) {
|
||||
Map<Integer, Empresa> empresas = new HashMap<Integer, Empresa>();
|
||||
|
||||
for(Object objmap : mapList ){
|
||||
|
||||
Map<String, Object> tupleMap = (Map<String, Object>) objmap;
|
||||
Integer empresaId = (Integer) tupleMap.get("EMPRESA_ID");
|
||||
|
||||
if(!empresas.containsKey(empresaId)){
|
||||
Empresa empresa = new Empresa();
|
||||
empresa.setEmpresaId(empresaId);
|
||||
empresa.setNombempresa((String) tupleMap.get("NOMBEMPRESA"));
|
||||
empresa.setActivo((Boolean) tupleMap.get("ACTIVO"));
|
||||
empresas.put(empresaId, empresa);
|
||||
}
|
||||
}
|
||||
|
||||
List<Empresa> empresaList = new ArrayList<Empresa>();
|
||||
empresaList.addAll(empresas.values());
|
||||
|
||||
return empresaList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object transformTuple(Object[] data, String[] aliases) {
|
||||
Map<String,Object> row = new HashMap<String,Object>();
|
||||
|
||||
for(int index = 0; index < aliases.length; index++){
|
||||
row.put(aliases[index], data[index]);
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.transform.ResultTransformer;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
|
||||
public class DatosPuntoVentaResultTransformer implements ResultTransformer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public List<PuntoVenta> transformList(List mapList) {
|
||||
Map<Integer, PuntoVenta> puntoventas = new HashMap<Integer, PuntoVenta>();
|
||||
|
||||
for(Object objmap : mapList ){
|
||||
|
||||
Map<String, Object> tupleMap = (Map<String, Object>) objmap;
|
||||
Integer puntoventaId = (Integer) tupleMap.get("PUNTOVENTA_ID");
|
||||
|
||||
if(!puntoventas.containsKey(puntoventaId)){
|
||||
PuntoVenta puntoventa = new PuntoVenta();
|
||||
puntoventa.setPuntoventaId(puntoventaId);
|
||||
puntoventa.setNombpuntoventa((String) tupleMap.get("NOMBPUNTOVENTA"));
|
||||
puntoventa.setActivo((Boolean) tupleMap.get("ACTIVO"));
|
||||
puntoventas.put(puntoventaId, puntoventa);
|
||||
}
|
||||
}
|
||||
|
||||
List<PuntoVenta> puntoventaList = new ArrayList<PuntoVenta>();
|
||||
puntoventaList.addAll(puntoventas.values());
|
||||
|
||||
return puntoventaList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object transformTuple(Object[] data, String[] aliases) {
|
||||
Map<String,Object> row = new HashMap<String,Object>();
|
||||
|
||||
for(int index = 0; index < aliases.length; index++){
|
||||
row.put(aliases[index], data[index]);
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
}
|
|
@ -92,6 +92,8 @@ public class BoletoComissao {
|
|||
|
||||
private Long transacaoId;
|
||||
|
||||
private Boolean conferidoEntrega;
|
||||
|
||||
public Integer getEmpresaId() {
|
||||
return empresaId;
|
||||
}
|
||||
|
@ -1060,4 +1062,12 @@ public class BoletoComissao {
|
|||
this.transacaoId = transacaoId;
|
||||
}
|
||||
|
||||
public Boolean getConferidoEntrega() {
|
||||
return conferidoEntrega;
|
||||
}
|
||||
|
||||
public void setConferidoEntrega(Boolean conferidoEntrega) {
|
||||
this.conferidoEntrega = conferidoEntrega;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue