fixes bug#al-1726
dev: Celio qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@115202 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
478749e967
commit
c529ac8732
|
@ -10,7 +10,7 @@ import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO;
|
|||
|
||||
public interface SapService extends GenericService<FechamentoCntcorrente, Long> {
|
||||
|
||||
public int remessa(List<FechamentoCntCorrenteVO> fechamentos) throws Exception ;
|
||||
public int remessa(List<FechamentoCntCorrenteVO> fechamentos, boolean processoManual) throws Exception ;
|
||||
|
||||
public List<FechamentoCntCorrenteVO> obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, String status);
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class SapServiceImpl implements SapService{
|
|||
}
|
||||
|
||||
@Override
|
||||
public int remessa(List<FechamentoCntCorrenteVO> fechamentos) throws Exception {
|
||||
public int remessa(List<FechamentoCntCorrenteVO> fechamentos, boolean processoManual) throws Exception {
|
||||
try {
|
||||
int contador = 0;
|
||||
IntegracaoSapRest integracaoSapRest = IntegracaoSapRest.getInstance();
|
||||
|
@ -88,17 +88,21 @@ public class SapServiceImpl implements SapService{
|
|||
if(integrado == null) {
|
||||
atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), StatusIntegracaoSap.NAO_ENVIADO.ordinal());
|
||||
log.error("Erro no envio/retorno da requisicao para integracao SAP do fechamentoID: "+fechamentoCntcorrente.getFechamentocntcorrenteId());
|
||||
if(processoManual) {
|
||||
throw new RuntimeException("Erro no envio/retorno da requisicao para integracao SAP do fechamentoID: "+fechamentoCntcorrente.getFechamentocntcorrenteId());
|
||||
}
|
||||
}else if(integrado.getString("Integration").equals("S")) {
|
||||
atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), StatusIntegracaoSap.INTEGRADO.ordinal());
|
||||
contador++;
|
||||
}else if(integrado.getString("Integration").equals("E")) {
|
||||
atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), StatusIntegracaoSap.RECUSADO.ordinal());
|
||||
log.warn("Retorno enviado pelo SAP: \r\n"+integrado.getString("Message"));
|
||||
if(processoManual) {
|
||||
throw new RuntimeException("Fechamento: "+fechamentoCntcorrente.getFechamentocntcorrenteId()+"\r\nRetorno enviado pelo SAP: \r\n"+integrado.getString("Message"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return contador;
|
||||
}catch(RuntimeException re){
|
||||
|
@ -130,7 +134,7 @@ public class SapServiceImpl implements SapService{
|
|||
log.info("IntegracaoSap: Registro a enviar:"+listaPendente.size());
|
||||
|
||||
try {
|
||||
remessa(listaPendente);
|
||||
remessa(listaPendente, false);
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue