bug#10822

dev:valdevir
qua:

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@81073 d1611594-4594-4d17-8e1d-87c2c4800839
master
valdevir 2018-04-17 20:55:28 +00:00
parent 46a14cd76f
commit ec5b7c8876
10 changed files with 464 additions and 329 deletions

View File

@ -5,6 +5,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.rjconsultores.ventaboletos.entidad.Caja; import com.rjconsultores.ventaboletos.entidad.Caja;
import com.rjconsultores.ventaboletos.entidad.Marca;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.exception.BusinessException;
import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoException; import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoException;
import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoFormapagoException; import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoFormapagoException;
import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaCajaException; import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaCajaException;
@ -27,4 +30,6 @@ public interface CajaDAO {
Map<String, List<Caja>> buscarCajaYTarjeta(String... numoperacion); Map<String, List<Caja>> buscarCajaYTarjeta(String... numoperacion);
public Integer atualizaCajasIntegracaoTotvs(Marca marca, Date dataIncial, Date dataFinal, PuntoVenta puntoVenta) throws BusinessException;
} }

View File

@ -16,12 +16,14 @@ import com.rjconsultores.ventaboletos.entidad.Usuario;
*/ */
public interface MarcaDAO extends GenericDAO<Marca, Short> { public interface MarcaDAO extends GenericDAO<Marca, Short> {
public List<Marca> buscarPorNome(String nomeMarca); public List<Marca> buscarPorNome(String nomeMarca);
public List<Marca> buscarTodosExceto(Usuario usuario,Integer... idMarca); public List<Marca> buscarTodosExceto(Usuario usuario, Integer... idMarca);
public List<Marca> buscarDescricaoIdMarca(); public List<Marca> buscarDescricaoIdMarca();
public List<Marca> buscarMarcaPorEmpresa(List<Empresa> empresa); public List<Marca> buscarMarcaPorEmpresa(List<Empresa> empresa);
public Marca buscarMarcaPorEmpresa(Empresa empresa);
} }

View File

@ -19,7 +19,6 @@ import com.rjconsultores.ventaboletos.entidad.PuntoVentaVO;
*/ */
public interface PuntoVentaDAO extends GenericDAO<PuntoVenta, Integer> { public interface PuntoVentaDAO extends GenericDAO<PuntoVenta, Integer> {
public List<PuntoVenta> buscaLike(String strEstacion, boolean sinTodos); public List<PuntoVenta> buscaLike(String strEstacion, boolean sinTodos);
public List<PuntoVenta> busca(String nomPuntoVenta, String numPuntoVenta); public List<PuntoVenta> busca(String nomPuntoVenta, String numPuntoVenta);
@ -39,4 +38,6 @@ public interface PuntoVentaDAO extends GenericDAO<PuntoVenta, Integer> {
public List<String> quantidadeECFPorPuntoVenta(Conferencia conferencia); public List<String> quantidadeECFPorPuntoVenta(Conferencia conferencia);
public List<PuntoVenta> buscarPuntoVentaPtoVtaComissao(List<Integer> empresas); public List<PuntoVenta> buscarPuntoVentaPtoVtaComissao(List<Integer> empresas);
public List<PuntoVenta> buscaPuntoVentaEmpresa(Empresa empresa);
} }

View File

@ -2,7 +2,6 @@ package com.rjconsultores.ventaboletos.dao.hibernate;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -28,8 +27,10 @@ import org.springframework.transaction.annotation.Transactional;
import com.rjconsultores.ventaboletos.dao.CajaDAO; import com.rjconsultores.ventaboletos.dao.CajaDAO;
import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder;
import com.rjconsultores.ventaboletos.enums.TipoFormapago;
import com.rjconsultores.ventaboletos.entidad.Caja; import com.rjconsultores.ventaboletos.entidad.Caja;
import com.rjconsultores.ventaboletos.entidad.Marca;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.enums.TipoFormapago;
import com.rjconsultores.ventaboletos.exception.BusinessException; import com.rjconsultores.ventaboletos.exception.BusinessException;
import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoException; import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoException;
import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoFormapagoException; import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoFormapagoException;
@ -117,6 +118,7 @@ public class CajaHibernateDAO extends GenericHibernateDAO<Object, Long> implemen
return list; return list;
} }
@Override @Override
public List<CajaDetalleVO> buscarDetalleCaja(Date fechaDesde, Date fechaHasta, Boolean sembilhetesPacote) { public List<CajaDetalleVO> buscarDetalleCaja(Date fechaDesde, Date fechaHasta, Boolean sembilhetesPacote) {
@ -188,7 +190,7 @@ public class CajaHibernateDAO extends GenericHibernateDAO<Object, Long> implemen
sql.setResultTransformer(new AliasToBeanResultTransformer(CajaDetalleVO.class)); sql.setResultTransformer(new AliasToBeanResultTransformer(CajaDetalleVO.class));
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<CajaDetalleVO> lsBusca = (List<CajaDetalleVO>)sql.list(); List<CajaDetalleVO> lsBusca = sql.list();
List<CajaDetalleVO> lsResultado = new ArrayList<CajaDetalleVO>(); List<CajaDetalleVO> lsResultado = new ArrayList<CajaDetalleVO>();
@ -198,72 +200,71 @@ public class CajaHibernateDAO extends GenericHibernateDAO<Object, Long> implemen
CajaDetalleVO cajaDetalleVO = null; CajaDetalleVO cajaDetalleVO = null;
if (indexOf != -1){ if (indexOf != -1) {
cajaDetalleVO = lsResultado.get(indexOf); cajaDetalleVO = lsResultado.get(indexOf);
}else{ } else {
cajaDetalleVO = cd; cajaDetalleVO = cd;
} }
if (cajaDetalleVO.getFormaspagamento() == null){ if (cajaDetalleVO.getFormaspagamento() == null) {
cajaDetalleVO.setFormaspagamento(new ArrayList<PagamentoVO>()); cajaDetalleVO.setFormaspagamento(new ArrayList<PagamentoVO>());
} }
if(!cd.getDescPago().equalsIgnoreCase("TROCA DE PASSAGEM")){ if (!cd.getDescPago().equalsIgnoreCase("TROCA DE PASSAGEM")) {
PagamentoVO pagamentoVO = new PagamentoVO(); PagamentoVO pagamentoVO = new PagamentoVO();
pagamentoVO.setFormapagamento(cd.getDescPago()); pagamentoVO.setFormapagamento(cd.getDescPago());
pagamentoVO.setMoeda("R$"); pagamentoVO.setMoeda("R$");
pagamentoVO.setValor(cd.getVlrFormaPago()); pagamentoVO.setValor(cd.getVlrFormaPago());
pagamentoVO.setIdentificacaoEmpresa(cd.getCvesecretaria()); pagamentoVO.setIdentificacaoEmpresa(cd.getCvesecretaria());
pagamentoVO.setRazaoSocial(cd.getDescsecretaria()); pagamentoVO.setRazaoSocial(cd.getDescsecretaria());
if (cd.getNotacreditovendapacoteId() != null) {
NotaCreditoVendaPacoteVO notacredito = new NotaCreditoVendaPacoteVO();
notacredito.setVouchernotacredito(cd.getNotacreditovendapacoteId().toString());
pagamentoVO.setNotacredito(notacredito);
}
if(cd.getNotacreditovendapacoteId() != null) { if (cd.getOcdId() != null) {
NotaCreditoVendaPacoteVO notacredito = new NotaCreditoVendaPacoteVO(); NotaCreditoVendaPacoteVO notacredito = new NotaCreditoVendaPacoteVO();
notacredito.setVouchernotacredito(cd.getNotacreditovendapacoteId().toString()); notacredito.setVouchernotacredito(OcdUtil.generaLocalizadorOCD(cd.getNumoperacionOcd(), cd.getOcdId()));
pagamentoVO.setNotacredito(notacredito); pagamentoVO.setNotacredito(notacredito);
}
if (StringUtils.isNotBlank(cd.getNumAutorizacion())) {
PagamentoCartaoVO cartao = new PagamentoCartaoVO();
cartao.setNumautorizacao(cd.getNumAutorizacion());
cartao.setBandeira(cd.getTipotarjeta());
cartao.setDatapagamento(cd.getFecoperacion());
cartao.setNumcartao(cd.getNumtarjeta());
cartao.setParcelas(cd.getCantparcelas());
cartao.setTitular(cd.getNombtitular());
cartao.setOperadoracartao(cd.getOperadoracartao());
pagamentoVO.setCartao(cartao);
}
cajaDetalleVO.getFormaspagamento().add(pagamentoVO);
if (pagamentoVO.getDadosBancarios() == null) {
pagamentoVO.setDadosBancarios(new ArrayList<DadosBancarioVO>());
}
if (isPagamentoDeposito(TipoFormapago.getTipoFormapagoByValor(cd.getTipoPago()))) {
pagamentoVO.getDadosBancarios().addAll(carregarDadosDeposito(cd.getCajaId(), cd.getFormaPagoId()));
}
if (pagamentoVO.getDadosBancarios().isEmpty()) {
pagamentoVO.setDadosBancarios(null);
}
} }
if (indexOf == -1) {
if(cd.getOcdId() != null) {
NotaCreditoVendaPacoteVO notacredito = new NotaCreditoVendaPacoteVO();
notacredito.setVouchernotacredito(OcdUtil.generaLocalizadorOCD(cd.getNumoperacionOcd(), cd.getOcdId()));
pagamentoVO.setNotacredito(notacredito);
}
if (StringUtils.isNotBlank(cd.getNumAutorizacion())){
PagamentoCartaoVO cartao = new PagamentoCartaoVO();
cartao.setNumautorizacao(cd.getNumAutorizacion());
cartao.setBandeira(cd.getTipotarjeta());
cartao.setDatapagamento(cd.getFecoperacion());
cartao.setNumcartao(cd.getNumtarjeta());
cartao.setParcelas(cd.getCantparcelas());
cartao.setTitular(cd.getNombtitular());
cartao.setOperadoracartao(cd.getOperadoracartao());
pagamentoVO.setCartao(cartao);
}
cajaDetalleVO.getFormaspagamento().add(pagamentoVO);
if(pagamentoVO.getDadosBancarios() == null) {
pagamentoVO.setDadosBancarios(new ArrayList<DadosBancarioVO>());
}
if(isPagamentoDeposito(TipoFormapago.getTipoFormapagoByValor(cd.getTipoPago()))) {
pagamentoVO.getDadosBancarios().addAll(carregarDadosDeposito(cd.getCajaId(), cd.getFormaPagoId()));
}
if(pagamentoVO.getDadosBancarios().isEmpty()) {
pagamentoVO.setDadosBancarios(null);
}
}
if (indexOf == -1){
lsResultado.add(cajaDetalleVO); lsResultado.add(cajaDetalleVO);
} }
} }
List<CajaDetalleVO> filtrados = new ArrayList<CajaDetalleVO>(); List<CajaDetalleVO> filtrados = new ArrayList<CajaDetalleVO>();
for(CajaDetalleVO c : lsResultado){ for (CajaDetalleVO c : lsResultado) {
if(c.getFormaspagamento() != null && !c.getFormaspagamento().isEmpty() && !existeApenasFpReserva(c)){ if (c.getFormaspagamento() != null && !c.getFormaspagamento().isEmpty() && !existeApenasFpReserva(c)) {
filtrados.add(c); filtrados.add(c);
} }
} }
@ -271,15 +272,16 @@ public class CajaHibernateDAO extends GenericHibernateDAO<Object, Long> implemen
return filtrados; return filtrados;
} }
private Boolean existeApenasFpReserva(CajaDetalleVO c){ private Boolean existeApenasFpReserva(CajaDetalleVO c) {
if(c.getFormaspagamento().size() == 1 if (c.getFormaspagamento().size() == 1
&& c.getFormaspagamento().get(0).getFormapagamento().equals("RESERVA")){ && c.getFormaspagamento().get(0).getFormapagamento().equals("RESERVA")) {
return true; return true;
} }
return false; return false;
} }
@Override
public List<UsuarioVO> buscarCajaCerrado(Date fecha, String cveusuario, String turnoid) { public List<UsuarioVO> buscarCajaCerrado(Date fecha, String cveusuario, String turnoid) {
return buscarCajaCerrado(fecha, cveusuario, turnoid, false); return buscarCajaCerrado(fecha, cveusuario, turnoid, false);
} }
@ -351,7 +353,7 @@ public class CajaHibernateDAO extends GenericHibernateDAO<Object, Long> implemen
.addScalar("precio", BigDecimalType.INSTANCE) .addScalar("precio", BigDecimalType.INSTANCE)
.addScalar("tipoEvento", StringType.INSTANCE); .addScalar("tipoEvento", StringType.INSTANCE);
sql.setResultTransformer(new AliasToBeanResultTransformer(ReceitaDespesaVO.class)); sql.setResultTransformer(new AliasToBeanResultTransformer(ReceitaDespesaVO.class));
u.setDiversos((List<ReceitaDespesaVO>) sql.list()); u.setDiversos(sql.list());
} }
return usuarios; return usuarios;
} catch (Exception e) { } catch (Exception e) {
@ -362,7 +364,7 @@ public class CajaHibernateDAO extends GenericHibernateDAO<Object, Long> implemen
} }
@Override @Override
@Transactional(rollbackFor={BusinessException.class,VendaEmbarcadaBoletoException.class,VendaEmbarcadaBoletoFormapagoException.class,VendaEmbarcadaCajaException.class,VendaEmbarcadaCajaFormapagoException.class}) @Transactional(rollbackFor = { BusinessException.class, VendaEmbarcadaBoletoException.class, VendaEmbarcadaBoletoFormapagoException.class, VendaEmbarcadaCajaException.class, VendaEmbarcadaCajaFormapagoException.class })
public void gerarVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaBoletoException, VendaEmbarcadaBoletoFormapagoException, VendaEmbarcadaCajaException, VendaEmbarcadaCajaFormapagoException { public void gerarVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaBoletoException, VendaEmbarcadaBoletoFormapagoException, VendaEmbarcadaCajaException, VendaEmbarcadaCajaFormapagoException {
inserirBoletoVendaEmbarcada(vendaEmbarcada); inserirBoletoVendaEmbarcada(vendaEmbarcada);
inserirBoletoFormaPagoVendaEmbarcada(vendaEmbarcada); inserirBoletoFormaPagoVendaEmbarcada(vendaEmbarcada);
@ -370,7 +372,7 @@ public class CajaHibernateDAO extends GenericHibernateDAO<Object, Long> implemen
inserirCajaFormaPagoVendaEmbarcada(vendaEmbarcada); inserirCajaFormaPagoVendaEmbarcada(vendaEmbarcada);
} }
private void inserirCajaVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaCajaException{ private void inserirCajaVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaCajaException {
try { try {
@ -382,26 +384,26 @@ public class CajaHibernateDAO extends GenericHibernateDAO<Object, Long> implemen
query.setString("numAsiento", vendaEmbarcada.getNumAsiento()); query.setString("numAsiento", vendaEmbarcada.getNumAsiento());
query.setInteger("categoriaId", vendaEmbarcada.getCategoriaId()); query.setInteger("categoriaId", vendaEmbarcada.getCategoriaId());
query.setInteger("claseServicioId", vendaEmbarcada.getClaseServicioId()); query.setInteger("claseServicioId", vendaEmbarcada.getClaseServicioId());
query.setInteger("marcaId",vendaEmbarcada.getMarcaId()); query.setInteger("marcaId", vendaEmbarcada.getMarcaId());
query.setInteger("origemId",vendaEmbarcada.getOrigemId()); query.setInteger("origemId", vendaEmbarcada.getOrigemId());
query.setInteger("destinoId",vendaEmbarcada.getDestinoId()); query.setInteger("destinoId", vendaEmbarcada.getDestinoId());
query.setInteger("corridaId",vendaEmbarcada.getCorridaId()); query.setInteger("corridaId", vendaEmbarcada.getCorridaId());
query.setDate("fecCorrida",vendaEmbarcada.getFecCorrida()); query.setDate("fecCorrida", vendaEmbarcada.getFecCorrida());
query.setBigDecimal("precioBase",vendaEmbarcada.getPrecio()); query.setBigDecimal("precioBase", vendaEmbarcada.getPrecio());
query.setBigDecimal("precioPagado",vendaEmbarcada.getPrecio()); query.setBigDecimal("precioPagado", vendaEmbarcada.getPrecio());
query.setInteger("tipoVentaId",vendaEmbarcada.getTipoVentaId()); query.setInteger("tipoVentaId", vendaEmbarcada.getTipoVentaId());
query.setDate("fechorViaje",vendaEmbarcada.getFechorViaje()); query.setDate("fechorViaje", vendaEmbarcada.getFechorViaje());
query.setDate("fechorVenta",vendaEmbarcada.getFechorVenta()); query.setDate("fechorVenta", vendaEmbarcada.getFechorVenta());
query.setInteger("puntoVentaId",vendaEmbarcada.getPuntoVentaId()); query.setInteger("puntoVentaId", vendaEmbarcada.getPuntoVentaId());
query.setString("numOperacion",vendaEmbarcada.getNumOperacion()); query.setString("numOperacion", vendaEmbarcada.getNumOperacion());
query.setBigInteger("empresaPuntoVentaId",vendaEmbarcada.getEmpresaId()); query.setBigInteger("empresaPuntoVentaId", vendaEmbarcada.getEmpresaId());
query.setBigInteger("empresaCorridaId",vendaEmbarcada.getEmpresaId()); query.setBigInteger("empresaCorridaId", vendaEmbarcada.getEmpresaId());
query.setInteger("estacionId",vendaEmbarcada.getEstacionId()); query.setInteger("estacionId", vendaEmbarcada.getEstacionId());
query.setInteger("usuarioId",vendaEmbarcada.getUsuarioId()); query.setInteger("usuarioId", vendaEmbarcada.getUsuarioId());
query.setBigDecimal("importeTaxaEmbarque",vendaEmbarcada.getImporteTaxaEmbarque()); query.setBigDecimal("importeTaxaEmbarque", vendaEmbarcada.getImporteTaxaEmbarque());
query.setBigDecimal("importePedagio",vendaEmbarcada.getImportePedagio()); query.setBigDecimal("importePedagio", vendaEmbarcada.getImportePedagio());
query.setBigDecimal("importeOutros",vendaEmbarcada.getImporteOutros()); query.setBigDecimal("importeOutros", vendaEmbarcada.getImporteOutros());
query.setBigDecimal("importeSeguro",vendaEmbarcada.getImporteSeguro()); query.setBigDecimal("importeSeguro", vendaEmbarcada.getImporteSeguro());
query.setDate("fecCreacion", vendaEmbarcada.getFechorVenta()); query.setDate("fecCreacion", vendaEmbarcada.getFechorVenta());
query.setInteger("rutaId", vendaEmbarcada.getRutaId()); query.setInteger("rutaId", vendaEmbarcada.getRutaId());
query.setTimestamp("fecModIf", vendaEmbarcada.getFecModIf()); query.setTimestamp("fecModIf", vendaEmbarcada.getFecModIf());
@ -454,8 +456,8 @@ public class CajaHibernateDAO extends GenericHibernateDAO<Object, Long> implemen
query.setBigInteger("empresaCorridaId", vendaEmbarcada.getEmpresaId()); query.setBigInteger("empresaCorridaId", vendaEmbarcada.getEmpresaId());
query.setInteger("destinoId", vendaEmbarcada.getDestinoId()); query.setInteger("destinoId", vendaEmbarcada.getDestinoId());
query.setInteger("tipoVentaId",vendaEmbarcada.getTipoVentaId()); query.setInteger("tipoVentaId", vendaEmbarcada.getTipoVentaId());
query.setInteger("categoriaId",vendaEmbarcada.getCategoriaId()); query.setInteger("categoriaId", vendaEmbarcada.getCategoriaId());
query.setInteger("corridaId", vendaEmbarcada.getCorridaId()); query.setInteger("corridaId", vendaEmbarcada.getCorridaId());
query.setInteger("claseServicioId", vendaEmbarcada.getClaseServicioId()); query.setInteger("claseServicioId", vendaEmbarcada.getClaseServicioId());
query.setDate("fecCorrida", vendaEmbarcada.getFecCorrida()); query.setDate("fecCorrida", vendaEmbarcada.getFecCorrida());
@ -468,7 +470,7 @@ public class CajaHibernateDAO extends GenericHibernateDAO<Object, Long> implemen
query.setDate("fechorViaje", vendaEmbarcada.getFechorViaje()); query.setDate("fechorViaje", vendaEmbarcada.getFechorViaje());
query.setDate("fechorVenta", vendaEmbarcada.getFechorVenta()); query.setDate("fechorVenta", vendaEmbarcada.getFechorVenta());
query.setString("numOperacion", vendaEmbarcada.getNumOperacion()); query.setString("numOperacion", vendaEmbarcada.getNumOperacion());
query.setInteger("usuarioId",vendaEmbarcada.getUsuarioId()); query.setInteger("usuarioId", vendaEmbarcada.getUsuarioId());
query.setBigDecimal("precioBase", vendaEmbarcada.getPrecio()); query.setBigDecimal("precioBase", vendaEmbarcada.getPrecio());
query.setInteger("estacionId", vendaEmbarcada.getEstacionId()); query.setInteger("estacionId", vendaEmbarcada.getEstacionId());
query.setBigDecimal("importeTaxaEmbarque", vendaEmbarcada.getImporteTaxaEmbarque()); query.setBigDecimal("importeTaxaEmbarque", vendaEmbarcada.getImporteTaxaEmbarque());
@ -494,7 +496,7 @@ public class CajaHibernateDAO extends GenericHibernateDAO<Object, Long> implemen
} }
} }
private void inserirBoletoFormaPagoVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaBoletoFormapagoException{ private void inserirBoletoFormaPagoVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaBoletoFormapagoException {
try { try {
SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLInserirBoletoFormaPagoVendaEmbarcada()); SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLInserirBoletoFormaPagoVendaEmbarcada());
@ -518,44 +520,44 @@ public class CajaHibernateDAO extends GenericHibernateDAO<Object, Long> implemen
} }
} }
private BigDecimal obterIdBoletoFormaPago(){ private BigDecimal obterIdBoletoFormaPago() {
SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceBoletoFormaPago()); SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceBoletoFormaPago());
return gerarChave((BigDecimal)sql.uniqueResult()); return gerarChave((BigDecimal) sql.uniqueResult());
} }
private BigDecimal obterIdCajaFormaPago(){ private BigDecimal obterIdCajaFormaPago() {
SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceCajaFormaPago()); SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceCajaFormaPago());
return gerarChave((BigDecimal)sql.uniqueResult()); return gerarChave((BigDecimal) sql.uniqueResult());
} }
private BigDecimal obterIdBoleto(){ private BigDecimal obterIdBoleto() {
SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceCajaFormaPago()); SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceCajaFormaPago());
return gerarChave((BigDecimal)sql.uniqueResult()); return gerarChave((BigDecimal) sql.uniqueResult());
} }
private BigDecimal obterIdCaja(){ private BigDecimal obterIdCaja() {
SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceCaja()); SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceCaja());
return gerarChave((BigDecimal)sql.uniqueResult()); return gerarChave((BigDecimal) sql.uniqueResult());
} }
private BigDecimal obterNumOperacion(){ private BigDecimal obterNumOperacion() {
SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenciaNumOperacion()); SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenciaNumOperacion());
return gerarChave((BigDecimal)sql.uniqueResult()); return gerarChave((BigDecimal) sql.uniqueResult());
} }
private BigDecimal gerarChave(BigDecimal seq){ private BigDecimal gerarChave(BigDecimal seq) {
Integer tamChave = 13; Integer tamChave = 13;
String chave = "1"; String chave = "1";
--tamChave; --tamChave;
while ((seq.toString().length() + chave.length()) <= (tamChave)){ while ((seq.toString().length() + chave.length()) <= (tamChave)) {
chave += "0"; chave += "0";
} }
@ -566,16 +568,16 @@ public class CajaHibernateDAO extends GenericHibernateDAO<Object, Long> implemen
private List<DadosBancarioVO> carregarDadosDeposito(Long cajaId, Integer formapagoId) { private List<DadosBancarioVO> carregarDadosDeposito(Long cajaId, Integer formapagoId) {
StringBuilder sQuery = new StringBuilder(); StringBuilder sQuery = new StringBuilder();
sQuery.append("SELECT CDDP.IDENTIFICACAO_DEPOSITO, CDDP.IMPORTE, CDDP.FECDEPOSITO ") sQuery.append("SELECT CDDP.IDENTIFICACAO_DEPOSITO, CDDP.IMPORTE, CDDP.FECDEPOSITO ")
.append("FROM CAJA_DET_DEPOSITO_PAGO CDDP ") .append("FROM CAJA_DET_DEPOSITO_PAGO CDDP ")
.append("JOIN CAJA_FORMAPAGO CFP ON CFP.CAJAFORMAPAGO_ID = CDDP.CAJAFORMAPAGO_ID ") .append("JOIN CAJA_FORMAPAGO CFP ON CFP.CAJAFORMAPAGO_ID = CDDP.CAJAFORMAPAGO_ID ")
.append("WHERE CDDP.ACTIVO = 1 ") .append("WHERE CDDP.ACTIVO = 1 ")
.append("AND CFP.CAJA_ID = :cajaId ") .append("AND CFP.CAJA_ID = :cajaId ")
.append("AND CFP.FORMAPAGO_ID = :formapagoId "); .append("AND CFP.FORMAPAGO_ID = :formapagoId ");
SQLQuery query = getSession().createSQLQuery(sQuery.toString()) SQLQuery query = getSession().createSQLQuery(sQuery.toString())
.addScalar("IDENTIFICACAO_DEPOSITO", StringType.INSTANCE) .addScalar("IDENTIFICACAO_DEPOSITO", StringType.INSTANCE)
.addScalar("IMPORTE", BigDecimalType.INSTANCE) .addScalar("IMPORTE", BigDecimalType.INSTANCE)
.addScalar("FECDEPOSITO", DateType.INSTANCE); .addScalar("FECDEPOSITO", DateType.INSTANCE);
query.setResultTransformer(new DatosDadosBancarioResultTransformer()); query.setResultTransformer(new DatosDadosBancarioResultTransformer());
query.setParameter("cajaId", cajaId); query.setParameter("cajaId", cajaId);
@ -617,4 +619,28 @@ public class CajaHibernateDAO extends GenericHibernateDAO<Object, Long> implemen
} }
@Override
@Transactional(rollbackFor = { BusinessException.class })
public Integer atualizaCajasIntegracaoTotvs(Marca marca, Date dataIncial, Date dataFinal, PuntoVenta puntoVenta) throws BusinessException {
// update caja set integradototvs = 0 where PUNTOVENTA_ID = 269 and FECHORVENTA >= '30/03/2018' and FECHORVENTA <= '01/04/2018';
StringBuilder sb = new StringBuilder();
sb.append(" update caja set integradototvs = 0 ");
sb.append(" where FECHORVENTA >= :fechorInicial ");
sb.append(" and FECHORVENTA <= :fechorFinal ");
sb.append(" and PUNTOVENTA_ID = :puntoVentaId ");
if (marca != null) {
sb.append(" and MARCA_ID = :marcaId ");
}
SQLQuery query = getSession().createSQLQuery(sb.toString());
if (marca != null) {
query.setInteger("marcaId", marca.getMarcaId());
}
query.setInteger("puntoVentaId", puntoVenta.getPuntoventaId());
query.setTimestamp("fechorInicial", dataIncial);
query.setTimestamp("fechorFinal", dataFinal);
Integer result = query.executeUpdate();
return result;
}
} }

View File

@ -49,6 +49,7 @@ public class MarcaHibernateDAO extends GenericHibernateDAO<Marca, Short>
} }
@Override
public List<Marca> buscarPorNome(String nomeMarca) { public List<Marca> buscarPorNome(String nomeMarca) {
Criteria c = getSession().createCriteria(getPersistentClass()); Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE)); c.add(Restrictions.eq("activo", Boolean.TRUE));
@ -57,6 +58,7 @@ public class MarcaHibernateDAO extends GenericHibernateDAO<Marca, Short>
return c.list(); return c.list();
} }
@Override
public List<Marca> buscarTodosExceto(Usuario usuario, Integer... idMarca) { public List<Marca> buscarTodosExceto(Usuario usuario, Integer... idMarca) {
String hql = " select new com.rjconsultores.ventaboletos.entidad.Marca(marca.marcaId, marca.descmarca) from Marca marca, UsuarioEmpresa ue" + String hql = " select new com.rjconsultores.ventaboletos.entidad.Marca(marca.marcaId, marca.descmarca) from Marca marca, UsuarioEmpresa ue" +
" where marca.empresa = ue.empresa and ue.usuarioLog = :usuarioId "; " where marca.empresa = ue.empresa and ue.usuarioLog = :usuarioId ";
@ -78,6 +80,7 @@ public class MarcaHibernateDAO extends GenericHibernateDAO<Marca, Short>
return lsMarca; return lsMarca;
} }
@Override
public List<Marca> buscarMarcaPorEmpresa(List<Empresa> empresa) { public List<Marca> buscarMarcaPorEmpresa(List<Empresa> empresa) {
if ((empresa == null) || (empresa.isEmpty())) { if ((empresa == null) || (empresa.isEmpty())) {
return Collections.emptyList(); return Collections.emptyList();
@ -98,4 +101,16 @@ public class MarcaHibernateDAO extends GenericHibernateDAO<Marca, Short>
return c.list(); return c.list();
} }
@Override
public Marca buscarMarcaPorEmpresa(Empresa empresa) {
Criteria c = makeCriteria();
c.add(Restrictions.eq("activo", true));
c.add(Restrictions.eq("empresa", empresa));
List<Marca> marcas = c.list();
if (marcas != null && !marcas.isEmpty()) {
return marcas.get(0);
}
return null;
}
} }

View File

@ -61,6 +61,7 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
return c.list(); return c.list();
} }
@Override
public List<PuntoVenta> buscaLike(String strEstacion, boolean sinTodos) { public List<PuntoVenta> buscaLike(String strEstacion, boolean sinTodos) {
Criteria c = getSession().createCriteria(getPersistentClass()); Criteria c = getSession().createCriteria(getPersistentClass());
@ -85,6 +86,7 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
return c.list(); return c.list();
} }
@Override
public List<PuntoVenta> busca(String nomPuntoVenta, String numPuntoVenta) { public List<PuntoVenta> busca(String nomPuntoVenta, String numPuntoVenta) {
Criteria c = getSession().createCriteria(getPersistentClass()); Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE)); c.add(Restrictions.eq("activo", Boolean.TRUE));
@ -95,6 +97,7 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
return c.list(); return c.list();
} }
@Override
public List<PuntoVenta> buscaPuntoVenta(String numPuntoVenta) { public List<PuntoVenta> buscaPuntoVenta(String numPuntoVenta) {
Criteria c = getSession().createCriteria(getPersistentClass()); Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE)); c.add(Restrictions.eq("activo", Boolean.TRUE));
@ -103,6 +106,16 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
return c.list(); return c.list();
} }
@Override
public List<PuntoVenta> buscaPuntoVentaEmpresa(Empresa empresa) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("empresa", empresa));
return c.list();
}
@Override
public List<PuntoVenta> buscaPuntoVentaParada(Parada parada) { public List<PuntoVenta> buscaPuntoVentaParada(Parada parada) {
Criteria c = getSession().createCriteria(getPersistentClass()); Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE)); c.add(Restrictions.eq("activo", Boolean.TRUE));
@ -112,6 +125,7 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
return c.list(); return c.list();
} }
@Override
public List<PuntoVentaVO> buscaPuntoVentaEmpresaSemECF(Empresa empresa) { public List<PuntoVentaVO> buscaPuntoVentaEmpresaSemECF(Empresa empresa) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(" select "); sb.append(" select ");
@ -188,6 +202,7 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
return puntosVenta; return puntosVenta;
} }
@Override
public List<PuntoVenta> buscarPuntoVentaPorTipoEstoque(PtovtaTipoEstoque tipoEstoque) { public List<PuntoVenta> buscarPuntoVentaPorTipoEstoque(PtovtaTipoEstoque tipoEstoque) {
Criteria c = getSession().createCriteria(getPersistentClass()); Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("ptovtaTipoEstoque", tipoEstoque)); c.add(Restrictions.eq("ptovtaTipoEstoque", tipoEstoque));
@ -261,8 +276,8 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
q.setInteger("puntoVentaId", conferencia.getPuntoVenta().getPuntoventaId()); q.setInteger("puntoVentaId", conferencia.getPuntoVenta().getPuntoventaId());
q.setInteger("empresaId", conferencia.getEmpresa().getEmpresaId()); q.setInteger("empresaId", conferencia.getEmpresa().getEmpresaId());
q.setTimestamp("dataInicio", DateUtil.inicioFecha((java.util.Date) conferencia.getDatamovimento())); q.setTimestamp("dataInicio", DateUtil.inicioFecha(conferencia.getDatamovimento()));
q.setTimestamp("dataFim", DateUtil.fimFecha((java.util.Date) conferencia.getDatamovimento())); q.setTimestamp("dataFim", DateUtil.fimFecha(conferencia.getDatamovimento()));
return q.list(); return q.list();
} }
@ -272,18 +287,18 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
public List<PuntoVenta> buscarPuntoVentaPtoVtaComissao(List<Integer> empresas) { public List<PuntoVenta> buscarPuntoVentaPtoVtaComissao(List<Integer> empresas) {
StringBuilder sQuery = new StringBuilder("SELECT DISTINCT pv.PUNTOVENTA_ID, pv.NOMBPUNTOVENTA, pv.ACTIVO "); StringBuilder sQuery = new StringBuilder("SELECT DISTINCT pv.PUNTOVENTA_ID, pv.NOMBPUNTOVENTA, pv.ACTIVO ");
sQuery.append("FROM PTOVTA_COMISSAO ptovta ") sQuery.append("FROM PTOVTA_COMISSAO ptovta ")
.append("JOIN PUNTO_VENTA pv ON pv.puntoventa_id = ptovta.puntoventa_id ") .append("JOIN PUNTO_VENTA pv ON pv.puntoventa_id = ptovta.puntoventa_id ")
.append("JOIN EMPRESA em ON em.empresa_id = ptovta.empresa_id ") .append("JOIN EMPRESA em ON em.empresa_id = ptovta.empresa_id ")
.append("WHERE ptovta.activo = 1 ") .append("WHERE ptovta.activo = 1 ")
.append("AND pv.activo = 1 ") .append("AND pv.activo = 1 ")
.append("AND em.activo = 1 ") .append("AND em.activo = 1 ")
.append("AND em.empresa_id in (:empresas)"); .append("AND em.empresa_id in (:empresas)");
Query qr = getSession().createSQLQuery(sQuery.toString()) Query qr = getSession().createSQLQuery(sQuery.toString())
.addScalar("PUNTOVENTA_ID", IntegerType.INSTANCE) .addScalar("PUNTOVENTA_ID", IntegerType.INSTANCE)
.addScalar("NOMBPUNTOVENTA", StringType.INSTANCE) .addScalar("NOMBPUNTOVENTA", StringType.INSTANCE)
.addScalar("ACTIVO", BooleanType.INSTANCE) .addScalar("ACTIVO", BooleanType.INSTANCE)
.setResultTransformer(new DatosPuntoVentaResultTransformer()); .setResultTransformer(new DatosPuntoVentaResultTransformer());
qr.setParameterList("empresas", empresas); qr.setParameterList("empresas", empresas);

View File

@ -0,0 +1,5 @@
package com.rjconsultores.ventaboletos.entidad;
public class IntegracaoTotvs {
}

View File

@ -0,0 +1,15 @@
package com.rjconsultores.ventaboletos.service;
import java.util.Date;
import java.util.List;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.exception.BusinessException;
public interface IntegracaoTotvsService {
public Integer atualizaStstausBilhetesIntegrar(Empresa empresa, Date dataIncial, Date dataFinal, PuntoVenta puntoVenta) throws BusinessException;
public List<PuntoVenta> buscaPuntoVentaEmpresa(Empresa empresa) throws Exception;
}

View File

@ -11,7 +11,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -123,7 +123,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
@Override @Override
public Conferencia confirmarChegadaMalote(Conferencia conferencia) throws BusinessException { public Conferencia confirmarChegadaMalote(Conferencia conferencia) throws BusinessException {
conferencia.setDatamalote(new Date()); conferencia.setDatamalote(new Date());
if(conferencia.getUsuarioId()==null || conferencia.getUsuarioId() < 1){ if (conferencia.getUsuarioId() == null || conferencia.getUsuarioId() < 1) {
conferencia.setUsuarioMaloteId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); conferencia.setUsuarioMaloteId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
} }
return conferenciaComissaoDAO.confirmarChegadaMalote(conferencia); return conferenciaComissaoDAO.confirmarChegadaMalote(conferencia);
@ -139,7 +139,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
@Override @Override
public Conferencia encerrarMovimentoDiario(Conferencia conferencia) throws BusinessException { public Conferencia encerrarMovimentoDiario(Conferencia conferencia) throws BusinessException {
if(conferencia.getUsuarioId()==null || conferencia.getUsuarioId() < 1){ if (conferencia.getUsuarioId() == null || conferencia.getUsuarioId() < 1) {
conferencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); conferencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
} }
conferencia.setFecmodif(Calendar.getInstance().getTime()); conferencia.setFecmodif(Calendar.getInstance().getTime());
@ -179,7 +179,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
for (Conferencia c : conferencias) { for (Conferencia c : conferencias) {
if(retornar){ if (retornar) {
return retorno; return retorno;
} }
@ -187,7 +187,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
boletoComissaos = conferenciaComissaoDAO.carregarBilhetesComissao(c, false, false); boletoComissaos = conferenciaComissaoDAO.carregarBilhetesComissao(c, false, false);
} }
if(boletoStatusComissao == null){ if (boletoStatusComissao == null) {
retorno.addAll(boletoComissaos); retorno.addAll(boletoComissaos);
boletoComissaos = null; boletoComissaos = null;
continue; continue;
@ -230,7 +230,6 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
return retorno; return retorno;
} }
@Override @Override
public List<BoletoComissao> carregarBilhetesComissao(List<BoletoComissao> boletoComissaos, Conferencia conferencia, BoletoStatusComissao boletoStatusComissao, boolean carregarDadosFaltantes) throws BusinessException { public List<BoletoComissao> carregarBilhetesComissao(List<BoletoComissao> boletoComissaos, Conferencia conferencia, BoletoStatusComissao boletoStatusComissao, boolean carregarDadosFaltantes) throws BusinessException {
if (boletoComissaos == null) { if (boletoComissaos == null) {
@ -299,7 +298,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
if (comEmpConferencia != null) { if (comEmpConferencia != null) {
boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetevendido()); boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetevendido());
} }
if(boletoComissao.isQuitacaoOCD()){ if (boletoComissao.isQuitacaoOCD()) {
continue; continue;
} }
boletos.add(boletoComissao); boletos.add(boletoComissao);
@ -425,7 +424,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
public boolean isEventosFinanceirosSemConferencia(List<EventosFinanceirosVO> lsEventosFinanceiros) throws BusinessException { public boolean isEventosFinanceirosSemConferencia(List<EventosFinanceirosVO> lsEventosFinanceiros) throws BusinessException {
for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) { for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) {
if ((eventosFinanceiros.isExigeConferencia() || eventosFinanceiros.getExigeConferenciaAba()) && if ((eventosFinanceiros.isExigeConferencia() || eventosFinanceiros.getExigeConferenciaAba()) &&
(!eventosFinanceiros.isConferido() && eventosFinanceiros.getLogconferenciaId() == null)) { (!eventosFinanceiros.isConferido() && eventosFinanceiros.getLogconferenciaId() == null)) {
return true; return true;
} }
} }
@ -442,13 +441,13 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
BigDecimal total = BigDecimal.ZERO; BigDecimal total = BigDecimal.ZERO;
if (lsBoletoComissao != null) { if (lsBoletoComissao != null) {
for (BoletoComissao boletoComissao : lsBoletoComissao) { for (BoletoComissao boletoComissao : lsBoletoComissao) {
if(boletoComissao.isNotSomarBilhete()) { if (boletoComissao.isNotSomarBilhete()) {
continue; continue;
} }
if ((lStatusBilhete == null || lStatusBilhete.contains(boletoComissao.getIndstatusboletoEnum())) && if ((lStatusBilhete == null || lStatusBilhete.contains(boletoComissao.getIndstatusboletoEnum())) &&
!boletoComissao.isVendaBilheteConfirmaAberto(boletoComissao.getTipoVenta())) { !boletoComissao.isVendaBilheteConfirmaAberto(boletoComissao.getTipoVenta())) {
//log.info(boletoComissao.toString()); // log.info(boletoComissao.toString());
total = total.add(boletoComissao.getTotal()); total = total.add(boletoComissao.getTotal());
} }
} }
@ -463,7 +462,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
BigDecimal totalOcd = BigDecimal.ZERO; BigDecimal totalOcd = BigDecimal.ZERO;
if (lsBoletoComissao != null) { if (lsBoletoComissao != null) {
for (BoletoComissao boletoComissao : lsBoletoComissao) { for (BoletoComissao boletoComissao : lsBoletoComissao) {
if(boletoComissao.isNotSomarBilhete()) { if (boletoComissao.isNotSomarBilhete()) {
continue; continue;
} }
if (boletoComissao.isOcd()) { if (boletoComissao.isOcd()) {
@ -487,7 +486,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
BigDecimal total = BigDecimal.ZERO; BigDecimal total = BigDecimal.ZERO;
if (lsEventosFinanceiros != null) { if (lsEventosFinanceiros != null) {
for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) { for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) {
/*total = total.add(eventosFinanceiros.getImpingreso());*/ /* total = total.add(eventosFinanceiros.getImpingreso()); */
if (eventosFinanceiros.isCredito()) { if (eventosFinanceiros.isCredito()) {
total = MoneyHelper.somar(total, eventosFinanceiros.getImpingreso()); total = MoneyHelper.somar(total, eventosFinanceiros.getImpingreso());
} else if (eventosFinanceiros.isDebito()) { } else if (eventosFinanceiros.isDebito()) {
@ -536,6 +535,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
/** /**
* Calcula o total de deposito * Calcula o total de deposito
*
* @param resumoComissao * @param resumoComissao
* @param boletoComissaos * @param boletoComissaos
* @param lsEventosFinanceiros * @param lsEventosFinanceiros
@ -543,26 +543,26 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
*/ */
private void carregarTotalDeposito(ResumoComissao resumoComissao, List<BoletoComissao> boletoComissaos, List<EventosFinanceirosVO> lsEventosFinanceiros) { private void carregarTotalDeposito(ResumoComissao resumoComissao, List<BoletoComissao> boletoComissaos, List<EventosFinanceirosVO> lsEventosFinanceiros) {
List<Integer> formaspagosDeposito = new ArrayList<Integer>(Arrays.asList(Constantes.FORMA_PAGO_DINHEIRO.intValue(), List<Integer> formaspagosDeposito = new ArrayList<Integer>(Arrays.asList(Constantes.FORMA_PAGO_DINHEIRO.intValue(),
Constantes.FORMA_PAGO_TROCA_PASSAGEM.intValue())); Constantes.FORMA_PAGO_TROCA_PASSAGEM.intValue()));
BigDecimal totalDeposito = BigDecimal.ZERO; BigDecimal totalDeposito = BigDecimal.ZERO;
for (BoletoComissao boletoComissao : boletoComissaos) { for (BoletoComissao boletoComissao : boletoComissaos) {
if (!boletoComissao.isNotSomarBilhete()) { if (!boletoComissao.isNotSomarBilhete()) {
for (FormapagoVO formapago : boletoComissao.getFormapagos()) { for (FormapagoVO formapago : boletoComissao.getFormapagos()) {
if(formaspagosDeposito.contains(formapago.getFormapagoId())) { if (formaspagosDeposito.contains(formapago.getFormapagoId())) {
//subtraindo as quitacoes de ocd // subtraindo as quitacoes de ocd
if(boletoComissao.isMotivocancelacionQuitacaoOcd()) { if (boletoComissao.isMotivocancelacionQuitacaoOcd()) {
totalDeposito = MoneyHelper.subtrair(totalDeposito, formapago.getImporte()); totalDeposito = MoneyHelper.subtrair(totalDeposito, formapago.getImporte());
//somando as vendas // somando as vendas
} else if(boletoComissao.isAbaBilheteVendido() || boletoComissao.isAbaGapVendido() || boletoComissao.isAbaBilheteManual()) { } else if (boletoComissao.isAbaBilheteVendido() || boletoComissao.isAbaGapVendido() || boletoComissao.isAbaBilheteManual()) {
totalDeposito = MoneyHelper.somar(totalDeposito, formapago.getImporte()); totalDeposito = MoneyHelper.somar(totalDeposito, formapago.getImporte());
//subtraindo os cancelamentos // subtraindo os cancelamentos
} else if(boletoComissao.isAbaBilheteCancelado() || boletoComissao.isAbaGapCancelado()) { } else if (boletoComissao.isAbaBilheteCancelado() || boletoComissao.isAbaGapCancelado()) {
totalDeposito = MoneyHelper.subtrair(totalDeposito, formapago.getImporte()); totalDeposito = MoneyHelper.subtrair(totalDeposito, formapago.getImporte());
//subtraindo as trocas e devolucoes // subtraindo as trocas e devolucoes
} else if(boletoComissao.isAbaBilheteDevolvido() || boletoComissao.isAbaGapDevolvido()) { } else if (boletoComissao.isAbaBilheteDevolvido() || boletoComissao.isAbaGapDevolvido()) {
if(boletoComissao.isMotivocancelacionTrocado() || boletoComissao.isMotivocancelacionDevolvido()) { if (boletoComissao.isMotivocancelacionTrocado() || boletoComissao.isMotivocancelacionDevolvido()) {
totalDeposito = MoneyHelper.subtrair(totalDeposito, formapago.getImporte()); totalDeposito = MoneyHelper.subtrair(totalDeposito, formapago.getImporte());
} }
} }
@ -571,9 +571,9 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
} }
} }
//calculando os movimentos financeiros // calculando os movimentos financeiros
for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) { for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) {
if(formaspagosDeposito.contains(eventosFinanceiros.getFormapagoId())) { if (formaspagosDeposito.contains(eventosFinanceiros.getFormapagoId())) {
if (eventosFinanceiros.isCredito()) { if (eventosFinanceiros.isCredito()) {
totalDeposito = MoneyHelper.somar(totalDeposito, eventosFinanceiros.getImpingreso()); totalDeposito = MoneyHelper.somar(totalDeposito, eventosFinanceiros.getImpingreso());
} else if (eventosFinanceiros.isDebito()) { } else if (eventosFinanceiros.isDebito()) {
@ -590,6 +590,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
* Totaliza os valores conforme o forma pago, apenas do bilhetes que geraram registros em caixa<br> * Totaliza os valores conforme o forma pago, apenas do bilhetes que geraram registros em caixa<br>
* (+) Abas: Bilhetes Manual, Bilhetes, Gap Venda<br> * (+) Abas: Bilhetes Manual, Bilhetes, Gap Venda<br>
* (-) Abas: Bilhetes Cancelados, Bilhetes Devolvidos, Gap Cancelados, Gap Devolvidos<br> * (-) Abas: Bilhetes Cancelados, Bilhetes Devolvidos, Gap Cancelados, Gap Devolvidos<br>
*
* @param resumoComissao * @param resumoComissao
* @param boletoComissaos * @param boletoComissaos
* @param lsEventosFinanceiros * @param lsEventosFinanceiros
@ -607,18 +608,18 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
totalFormapagos.add(formapago); totalFormapagos.add(formapago);
} }
//subtraindo as quitacoes de ocd // subtraindo as quitacoes de ocd
if(boletoComissao.isMotivocancelacionQuitacaoOcd()) { if (boletoComissao.isMotivocancelacionQuitacaoOcd()) {
formapago.subtract(formapagoBoleto.getImporte()); formapago.subtract(formapagoBoleto.getImporte());
//somando as vendas // somando as vendas
} else if (boletoComissao.isAbaBilheteVendido() || boletoComissao.isAbaGapVendido() || boletoComissao.isAbaBilheteManual()) { } else if (boletoComissao.isAbaBilheteVendido() || boletoComissao.isAbaGapVendido() || boletoComissao.isAbaBilheteManual()) {
formapago.add(formapagoBoleto.getImporte()); formapago.add(formapagoBoleto.getImporte());
//subtraindo os cancelamentos // subtraindo os cancelamentos
} else if (boletoComissao.isAbaBilheteCancelado() || boletoComissao.isAbaGapCancelado()) { } else if (boletoComissao.isAbaBilheteCancelado() || boletoComissao.isAbaGapCancelado()) {
formapago.subtract(formapagoBoleto.getImporte()); formapago.subtract(formapagoBoleto.getImporte());
//subtraindo as trocas e devolucoes // subtraindo as trocas e devolucoes
} else if(boletoComissao.isAbaBilheteDevolvido() || boletoComissao.isAbaGapDevolvido()) { } else if (boletoComissao.isAbaBilheteDevolvido() || boletoComissao.isAbaGapDevolvido()) {
if(boletoComissao.isMotivocancelacionTrocado() || boletoComissao.isMotivocancelacionDevolvido() || boletoComissao.isMotivocancelacionQuitacaoOcd()) { if (boletoComissao.isMotivocancelacionTrocado() || boletoComissao.isMotivocancelacionDevolvido() || boletoComissao.isMotivocancelacionQuitacaoOcd()) {
formapago.subtract(formapagoBoleto.getImporte()); formapago.subtract(formapagoBoleto.getImporte());
} }
} }
@ -775,11 +776,12 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
} }
} }
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS) @Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public void generacionAutomaticaConferencia() { public void generacionAutomaticaConferencia() {
List<PuntoVentaVO> lsPuntoVenta; List<PuntoVentaVO> lsPuntoVenta;
List<ConferenciaComissaoVO> lsConferenciaComissao; List<ConferenciaComissaoVO> lsConferenciaComissao;
Conferencia conferencia; Conferencia conferencia;
// Perocorrer todas as empresas cadastradas // Perocorrer todas as empresas cadastradas
List<Empresa> lsEmpresa = empresaService.obtenerTodos(); List<Empresa> lsEmpresa = empresaService.obtenerTodos();
for (Empresa empresa : lsEmpresa) { for (Empresa empresa : lsEmpresa) {
@ -789,7 +791,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
PuntoVenta puntoVenta = new PuntoVenta(puntoVentaVO.getPuntoventaId(), puntoVentaVO.getNombpuntoventa()); PuntoVenta puntoVenta = new PuntoVenta(puntoVentaVO.getPuntoventaId(), puntoVentaVO.getNombpuntoventa());
// Busca o Movimento para o dia de ontem, caso não exista aborta para este ponto de venda // Busca o Movimento para o dia de ontem, caso não exista aborta para este ponto de venda
lsConferenciaComissao = carregarConferenciaComissao(null, empresa, puntoVenta, DateUtil.getYesterdayDate()); lsConferenciaComissao = carregarConferenciaComissao(null, empresa, puntoVenta, DateUtil.getYesterdayDate());
if ((CollectionUtils.isEmpty(lsConferenciaComissao)) || (!CollectionUtils.isEmpty(lsConferenciaComissao.get(0).getDias()) && lsConferenciaComissao.get(0).getDias().size() < 1)) { if ((CollectionUtils.isEmpty(lsConferenciaComissao)) || (!CollectionUtils.isEmpty(lsConferenciaComissao.get(0).getDias()) && lsConferenciaComissao.get(0).getDias().size() < 1)) {
log.info("Não há conferência para o Ponto de Venda " + puntoVentaVO.getNombpuntoventa() + " da empresa " + empresa.getNombempresa() + " no dia " + DateUtil.getYesterdayDateString()); log.info("Não há conferência para o Ponto de Venda " + puntoVentaVO.getNombpuntoventa() + " da empresa " + empresa.getNombempresa() + " no dia " + DateUtil.getYesterdayDateString());
continue; continue;
} }
@ -802,24 +804,23 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
conferencia.setFecmodif(new Date()); conferencia.setFecmodif(new Date());
conferencia.setUsuarioId(1); conferencia.setUsuarioId(1);
conferencia.setEmpresa(empresa); conferencia.setEmpresa(empresa);
conferencia.setPuntoVenta(new PuntoVenta( puntoVentaVO.getPuntoventaId())); conferencia.setPuntoVenta(new PuntoVenta(puntoVentaVO.getPuntoventaId()));
conferencia.setDatamovimento(DateUtil.getYesterdayDate()); conferencia.setDatamovimento(DateUtil.getYesterdayDate());
} } else {
else{ // Se existe a conferência com status conferido para esta empresa e ponto de venda no dia de ontem, aborta.
//Se existe a conferência com status conferido para esta empresa e ponto de venda no dia de ontem, aborta. if (Boolean.TRUE == conferencia.getIndconferido()) {
if(Boolean.TRUE == conferencia.getIndconferido()){
log.info("Já existe conferência com status conferido para o Ponto de Venda " + puntoVentaVO.getNombpuntoventa() + " da empresa " + empresa.getNombempresa() + " no dia " + DateUtil.getYesterdayDateString()); log.info("Já existe conferência com status conferido para o Ponto de Venda " + puntoVentaVO.getNombpuntoventa() + " da empresa " + empresa.getNombempresa() + " no dia " + DateUtil.getYesterdayDateString());
continue; continue;
} }
} }
//Valida se existe alguma pendência que impede o fechamento. // Valida se existe alguma pendência que impede o fechamento.
if(!validaConferencia(conferencia)){ if (!validaConferencia(conferencia)) {
log.info("Não há bilhetes para conferir ou será necessário realizar Conferência Manual para o Ponto de Venda " + puntoVentaVO.getNombpuntoventa() + " da empresa " + empresa.getNombempresa() + " no dia " + DateUtil.getYesterdayDateString()); log.info("Não há bilhetes para conferir ou será necessário realizar Conferência Manual para o Ponto de Venda " + puntoVentaVO.getNombpuntoventa() + " da empresa " + empresa.getNombempresa() + " no dia " + DateUtil.getYesterdayDateString());
continue; continue;
} }
//Confirma chegada do malote // Confirma chegada do malote
conferencia = confirmarChegadaMalote(conferencia); conferencia = confirmarChegadaMalote(conferencia);
log.info("Realizado confirmação de chegada do malote para o Ponto de Venda " + puntoVentaVO.getNombpuntoventa() + " da empresa " + empresa.getNombempresa() + " no dia " + DateUtil.getYesterdayDateString()); log.info("Realizado confirmação de chegada do malote para o Ponto de Venda " + puntoVentaVO.getNombpuntoventa() + " da empresa " + empresa.getNombempresa() + " no dia " + DateUtil.getYesterdayDateString());
@ -834,47 +835,47 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
} }
} }
private boolean validaConferencia(Conferencia conferencia ) { private boolean validaConferencia(Conferencia conferencia) {
try { try {
List<BoletoComissao> boletosComissaos = carregarBilhetesComissao(null, conferencia, null, false); List<BoletoComissao> boletosComissaos = carregarBilhetesComissao(null, conferencia, null, false);
if(boletosComissaos ==null || CollectionUtils.isEmpty(boletosComissaos)){ if (boletosComissaos == null || CollectionUtils.isEmpty(boletosComissaos)) {
return false; return false;
} }
if(!validaBilhetesManual(boletosComissaos, conferencia)){ if (!validaBilhetesManual(boletosComissaos, conferencia)) {
return false; return false;
} }
if(!validaBilhetesVendidos(boletosComissaos, conferencia)){ if (!validaBilhetesVendidos(boletosComissaos, conferencia)) {
return false; return false;
} }
if(!validaBilhetesCancelados(boletosComissaos, conferencia)){ if (!validaBilhetesCancelados(boletosComissaos, conferencia)) {
return false; return false;
} }
if(!validaBilhetesDevolvidos(boletosComissaos, conferencia)){ if (!validaBilhetesDevolvidos(boletosComissaos, conferencia)) {
return false; return false;
} }
if(!validaBilhetesGap(boletosComissaos, conferencia)){ if (!validaBilhetesGap(boletosComissaos, conferencia)) {
return false; return false;
} }
if(!validaBilhetesGapCancelados(boletosComissaos, conferencia)){ if (!validaBilhetesGapCancelados(boletosComissaos, conferencia)) {
return false; return false;
} }
if(!validaBilhetesGapDevolvidos(boletosComissaos, conferencia)){ if (!validaBilhetesGapDevolvidos(boletosComissaos, conferencia)) {
return false; return false;
} }
if(!validaEventosFinanceiros(boletosComissaos, conferencia)){ if (!validaEventosFinanceiros(boletosComissaos, conferencia)) {
return false; return false;
} }
if(!validaOcds(conferencia)){ if (!validaOcds(conferencia)) {
return false; return false;
} }
return true; return true;
@ -884,76 +885,82 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
} }
} }
private boolean validaBilhetesManual(List<BoletoComissao> boletosComissaos, Conferencia conferencia ) throws BusinessException { private boolean validaBilhetesManual(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException {
List<BoletoComissao> lsBilhetesManual = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_MANUAL, false); List<BoletoComissao> lsBilhetesManual = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_MANUAL, false);
if(!CollectionUtils.isEmpty(lsBilhetesManual) && isBilhetesSemConferencia(lsBilhetesManual)){ if (!CollectionUtils.isEmpty(lsBilhetesManual) && isBilhetesSemConferencia(lsBilhetesManual)) {
return false; return false;
}else{ } else {
return true; return true;
} }
} }
private boolean validaBilhetesVendidos(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException { private boolean validaBilhetesVendidos(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException {
List<BoletoComissao> lsBilhetes = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETOS_VENDIDOS, false); List<BoletoComissao> lsBilhetes = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETOS_VENDIDOS, false);
if(!CollectionUtils.isEmpty(lsBilhetes) && isBilhetesSemConferencia(lsBilhetes)){ if (!CollectionUtils.isEmpty(lsBilhetes) && isBilhetesSemConferencia(lsBilhetes)) {
return false; return false;
}else{ } else {
return true; return true;
} }
} }
private boolean validaBilhetesCancelados(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException { private boolean validaBilhetesCancelados(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException {
List<BoletoComissao> lsBilhetesCancelados = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_CANCELADO, false); List<BoletoComissao> lsBilhetesCancelados = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_CANCELADO, false);
if(!CollectionUtils.isEmpty(lsBilhetesCancelados) && isBilhetesSemConferencia(lsBilhetesCancelados)){ if (!CollectionUtils.isEmpty(lsBilhetesCancelados) && isBilhetesSemConferencia(lsBilhetesCancelados)) {
return false; return false;
}else{ } else {
return true; return true;
} }
} }
private boolean validaBilhetesDevolvidos(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException { private boolean validaBilhetesDevolvidos(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException {
List<BoletoComissao> lsBilhetesDevolvidos = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_DEVOLVIDO, false); List<BoletoComissao> lsBilhetesDevolvidos = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_DEVOLVIDO, false);
if(!CollectionUtils.isEmpty(lsBilhetesDevolvidos) && isBilhetesSemConferencia(lsBilhetesDevolvidos)){ if (!CollectionUtils.isEmpty(lsBilhetesDevolvidos) && isBilhetesSemConferencia(lsBilhetesDevolvidos)) {
return false; return false;
}else{ } else {
return true; return true;
} }
} }
private boolean validaBilhetesGap(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException { private boolean validaBilhetesGap(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException {
List<BoletoComissao> lsBilhetesGap = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_VENDIDOS, false); List<BoletoComissao> lsBilhetesGap = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_VENDIDOS, false);
if(!CollectionUtils.isEmpty(lsBilhetesGap) && isBilhetesSemConferencia(lsBilhetesGap)){ if (!CollectionUtils.isEmpty(lsBilhetesGap) && isBilhetesSemConferencia(lsBilhetesGap)) {
return false; return false;
}else{ } else {
return true; return true;
} }
} }
private boolean validaBilhetesGapCancelados(List<BoletoComissao> boletosComissaos, Conferencia conferencia ) throws BusinessException {
private boolean validaBilhetesGapCancelados(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException {
List<BoletoComissao> lsBilhetesGapCancelados = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_CANCELADO, false); List<BoletoComissao> lsBilhetesGapCancelados = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_CANCELADO, false);
if(!CollectionUtils.isEmpty(lsBilhetesGapCancelados) && isBilhetesSemConferencia(lsBilhetesGapCancelados)){ if (!CollectionUtils.isEmpty(lsBilhetesGapCancelados) && isBilhetesSemConferencia(lsBilhetesGapCancelados)) {
return false; return false;
}else{ } else {
return true; return true;
} }
} }
private boolean validaBilhetesGapDevolvidos(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException { private boolean validaBilhetesGapDevolvidos(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException {
List<BoletoComissao> lsBilhetesGapDevolvidos = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_DEVOLVIDO, false); List<BoletoComissao> lsBilhetesGapDevolvidos = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_DEVOLVIDO, false);
if(!CollectionUtils.isEmpty(lsBilhetesGapDevolvidos) && isBilhetesSemConferencia(lsBilhetesGapDevolvidos)){ if (!CollectionUtils.isEmpty(lsBilhetesGapDevolvidos) && isBilhetesSemConferencia(lsBilhetesGapDevolvidos)) {
return false;
}else{
return true;
}
}
private boolean validaEventosFinanceiros(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException {
List<EventosFinanceirosVO>lsEventosFinanceiros = carregarEventosFinanceiros(conferencia);
if(!CollectionUtils.isEmpty(lsEventosFinanceiros) && isEventosFinanceirosSemConferencia(lsEventosFinanceiros)) {
return false; return false;
} else { } else {
return true; return true;
} }
} }
private boolean validaEventosFinanceiros(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException {
List<EventosFinanceirosVO> lsEventosFinanceiros = carregarEventosFinanceiros(conferencia);
if (!CollectionUtils.isEmpty(lsEventosFinanceiros) && isEventosFinanceirosSemConferencia(lsEventosFinanceiros)) {
return false;
} else {
return true;
}
}
private boolean validaOcds(Conferencia conferencia) throws BusinessException { private boolean validaOcds(Conferencia conferencia) throws BusinessException {
List<OcdVO> lsOcds = carregarOcds(conferencia); List<OcdVO> lsOcds = carregarOcds(conferencia);
if(!CollectionUtils.isEmpty(lsOcds) && isOcdSemConferencia(lsOcds)) { if (!CollectionUtils.isEmpty(lsOcds) && isOcdSemConferencia(lsOcds)) {
return false; return false;
} else { } else {
return true; return true;

View File

@ -0,0 +1,44 @@
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.CajaDAO;
import com.rjconsultores.ventaboletos.dao.MarcaDAO;
import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Marca;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.exception.BusinessException;
import com.rjconsultores.ventaboletos.service.IntegracaoTotvsService;
@Service("integracaoTotvsService")
public class IntegracaoTotvsServiceImpl implements IntegracaoTotvsService {
@Autowired
CajaDAO cajaDao;
@Autowired
PuntoVentaDAO puntoVentaDao;
@Autowired
MarcaDAO marcaDao;
@Override
public Integer atualizaStstausBilhetesIntegrar(Empresa empresa, Date dataIncial, Date dataFinal, PuntoVenta puntoVenta) throws BusinessException {
Marca marca = null;
if (empresa != null) {
marca = marcaDao.buscarMarcaPorEmpresa(empresa);
}
return cajaDao.atualizaCajasIntegracaoTotvs(marca, dataIncial, dataFinal, puntoVenta);
}
@Override
public List<PuntoVenta> buscaPuntoVentaEmpresa(Empresa empresa) {
return puntoVentaDao.buscaPuntoVentaEmpresa(empresa);
}
}