Adição de reintegração e padronizado hibernate fix bug#AL-2540

master
Fabio Faria 2023-05-11 10:51:44 -03:00
parent e593f2f86a
commit 941a07bbb1
3 changed files with 6 additions and 15 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>br.com.rjconsultores</groupId> <groupId>br.com.rjconsultores</groupId>
<artifactId>ModelWeb</artifactId> <artifactId>ModelWeb</artifactId>
<version>1.3.1</version> <version>1.3.2</version>
<distributionManagement> <distributionManagement>
<repository> <repository>
<id>rj-releases</id> <id>rj-releases</id>

View File

@ -153,12 +153,12 @@ public class SapHibernateDAO extends GenericHibernateDAO<FechamentoCntcorrente,
@Override @Override
@Transactional @Transactional
public synchronized boolean atualizaFechamento(Long fechamentocntcorrenteId, int status) throws Exception { public boolean atualizaFechamento(Long fechamentocntcorrenteId, int status) throws Exception {
if(fechamentocntcorrenteId == null ) { if(fechamentocntcorrenteId == null ) {
return false; return false;
} }
/*
getSession().flush(); getSession().flush();
StringBuilder qry = new StringBuilder(); StringBuilder qry = new StringBuilder();
@ -171,16 +171,7 @@ public class SapHibernateDAO extends GenericHibernateDAO<FechamentoCntcorrente,
query.setLong("fechamentoId", fechamentocntcorrenteId); query.setLong("fechamentoId", fechamentocntcorrenteId);
query.executeUpdate(); query.executeUpdate();
*/
//é feito update manualmente porque o hibernate utiliza sco_read e nao tem permissao de escrita no banco
try(Connection con = scoDs.getConnection();
Statement stmt = con.createStatement()){
stmt.addBatch("UPDATE FECHAMENTO_CNTCORRENTE SET INDINTEGRADOSAP = "+ status
+" WHERE FECHAMENTOCNTCORRENTE_ID = " + fechamentocntcorrenteId);
stmt.executeBatch();
}
return Boolean.TRUE; return Boolean.TRUE;
} }

View File

@ -81,7 +81,7 @@ public class SapServiceImpl implements SapService{
String credenciais = buscaConstante(INTEGRACAO_SAP_CREDENCIAL); String credenciais = buscaConstante(INTEGRACAO_SAP_CREDENCIAL);
String url = buscaConstante(INTEGRACAO_SAP_URL); String url = buscaConstante(INTEGRACAO_SAP_URL);
for (FechamentoCntCorrenteVO fechamentoCntcorrente : fechamentos) { for (FechamentoCntCorrenteVO fechamentoCntcorrente : fechamentos) {
if( fechamentoCntcorrente.isEnviar()) { if( fechamentoCntcorrente.isEnviar()) {
log.debug("Enviando fechamento:"+ fechamentoCntcorrente.getFechamentocntcorrenteId()); log.debug("Enviando fechamento:"+ fechamentoCntcorrente.getFechamentocntcorrenteId());
JSONObject integrado = integracaoSapRest.enviarIntegracaoSap(fechamentoCntcorrente, url, credenciais); JSONObject integrado = integracaoSapRest.enviarIntegracaoSap(fechamentoCntcorrente, url, credenciais);
@ -106,7 +106,7 @@ public class SapServiceImpl implements SapService{
private void tratarProcessoManual(boolean processoManual, String mensagem, FechamentoCntCorrenteVO fechamentoCntcorrente) { private void tratarProcessoManual(boolean processoManual, String mensagem, FechamentoCntCorrenteVO fechamentoCntcorrente) {
if(processoManual) { if(processoManual) {
throw new BusinessRuntimeException( mensagem, fechamentoCntcorrente.getFechamentocntcorrenteId()); throw new BusinessRuntimeException( String.format(mensagem, fechamentoCntcorrente.getFechamentocntcorrenteId()) );
} }
} }