From 4d2d0c3a0477720d44f8a60939b5f61520f68b74 Mon Sep 17 00:00:00 2001 From: leonardo Date: Mon, 13 Mar 2017 13:49:55 +0000 Subject: [PATCH] bug #7788 git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@66737 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../service/impl/PuntoVentaServiceImpl.java | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java index 96a104798..1198db7c9 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java @@ -155,18 +155,27 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG"); if (empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) { log.debug("iniciando integração com AG"); - integrarClienteAG(entidad); - if (!entidad.getIndIntegradoAG()){ - throw new IntegracionException(entidad.getMotivoNaoIntegradoAG()); - } - integrarFornecedorAG(entidad); - if (!entidad.getIndIntegradoAG()){ - throw new IntegracionException(entidad.getMotivoNaoIntegradoAG()); - } + integraAG(entidad); log.debug("fim da integração com AG"); } return entidad; } + + private void integraAG(PuntoVenta entidad) throws IntegracionException{ + String motivoNaoIntegrado = ""; + integrarClienteAG(entidad); + if (!entidad.getIndIntegradoAG()){ + motivoNaoIntegrado += "Cliente: " + entidad.getMotivoNaoIntegradoAG(); + } + integrarFornecedorAG(entidad); + if (!entidad.getIndIntegradoAG()){ + motivoNaoIntegrado += "Fornecedor: " + entidad.getMotivoNaoIntegradoAG(); + + } + if (!motivoNaoIntegrado.isEmpty()){ + throw new IntegracionException(entidad.getMotivoNaoIntegradoAG()); + } + } private void integrarFornecedorAG(PuntoVenta entidad) { @@ -417,14 +426,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG"); if (empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) { log.debug("iniciando integração com AG"); - integrarClienteAG(entidad); - if (!entidad.getIndIntegradoAG()){ - throw new IntegracionException(entidad.getMotivoNaoIntegradoAG()); - } - integrarFornecedorAG(entidad); - if (!entidad.getIndIntegradoAG()){ - throw new IntegracionException(entidad.getMotivoNaoIntegradoAG()); - } + integraAG(entidad); log.debug("fim da integração com AG"); }