fixes bug#22868

dev: Celio
qua:



git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@108569 d1611594-4594-4d17-8e1d-87c2c4800839
master
fabio 2021-08-31 21:30:48 +00:00
parent 56a7576556
commit 53e31c40ae
3 changed files with 31 additions and 4 deletions

View File

@ -10,5 +10,7 @@ import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO;
public interface SapDAO extends GenericDAO<FechamentoCntcorrente, Long> {
public List<FechamentoCntCorrenteVO> obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar);
public boolean atualizaFechamento(Long fechamentocntcorrenteId) throws Exception;
}

View File

@ -1,6 +1,8 @@
package com.rjconsultores.ventaboletos.dao.hibernate;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -108,4 +110,25 @@ public class SapHibernateDAO extends GenericHibernateDAO<FechamentoCntcorrente,
return retorno;
}
@Override
public boolean atualizaFechamento(Long fechamentocntcorrenteId) throws Exception {
if(fechamentocntcorrenteId == null ) {
return false;
}
@SuppressWarnings("deprecation")
Connection con = getSession().connection();
Statement stmt = con.createStatement();
con.setAutoCommit(false);
stmt.addBatch("UPDATE FECHAMENTO_CNTCORRENTE SET INDINTEGRADOSAP = 1 WHERE FECHAMENTOCNTCORRENTE_ID = " + fechamentocntcorrenteId);
stmt.executeBatch();
con.commit();
stmt.close();
return Boolean.TRUE;
}
}

View File

@ -77,10 +77,8 @@ public class SapServiceImpl implements SapService{
if(integrado == null) {
throw new RuntimeException("Erro no envio/retorno da requisicao para integração SAP");
}else if(integrado.getString("Integration").equals("S")) {
FechamentoCntcorrente registro = obtenerID(fechamentoCntcorrente.getFechamentocntcorrenteId());
registro.setIntegradoSap(true);
suscribir(registro);
}else if(integrado.getString("Integration").equals("S")) {
atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId());
contador++;
}else if(integrado.getString("Integration").equals("E")) {
throw new RuntimeException("Retorno enviado pelo SAP: \r\n"+integrado.getString("Message"));
@ -96,6 +94,10 @@ public class SapServiceImpl implements SapService{
}
}
private boolean atualizaFechamento(Long fechamentocntcorrenteId) throws Exception {
return sapDAO.atualizaFechamento( fechamentocntcorrenteId);
}
private String buscaConstante(String constanteString) {
Constante constante = constanteDAO.buscarPorNomeConstante(constanteString);