fixes bug#23499
dev: Valdevir qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@109594 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
76264dfe05
commit
1e2e496867
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Repository;
|
||||||
import com.rjconsultores.ventaboletos.dao.SapDAO;
|
import com.rjconsultores.ventaboletos.dao.SapDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.FechamentoCntcorrente;
|
import com.rjconsultores.ventaboletos.entidad.FechamentoCntcorrente;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO;
|
import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO;
|
||||||
|
|
||||||
@Repository("sapDAO")
|
@Repository("sapDAO")
|
||||||
|
@ -57,21 +58,27 @@ public class SapHibernateDAO extends GenericHibernateDAO<FechamentoCntcorrente,
|
||||||
sb.append(" WHERE ");
|
sb.append(" WHERE ");
|
||||||
sb.append(" fc.activo = 1 ");
|
sb.append(" fc.activo = 1 ");
|
||||||
sb.append(" AND fc.fecfechamento BETWEEN :dataDe AND :dataAte ");
|
sb.append(" AND fc.fecfechamento BETWEEN :dataDe AND :dataAte ");
|
||||||
|
|
||||||
|
if( empresa != null ) {
|
||||||
sb.append(" AND fc.EMPRESA_ID = :empresaId ");
|
sb.append(" AND fc.EMPRESA_ID = :empresaId ");
|
||||||
|
}
|
||||||
|
|
||||||
if(!reenviar){
|
if(!reenviar){
|
||||||
sb.append(" AND ( fc.indintegradosap IS NULL OR fc.indintegradosap = 0) ");
|
sb.append(" AND ( fc.indintegradosap IS NULL OR fc.indintegradosap <> 1) ");
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append(" ORDER BY ");
|
sb.append(" ORDER BY ");
|
||||||
sb.append(" pv.nombpuntoventa, fc.fecfechamento ");
|
sb.append(" pv.nombpuntoventa, fc.fecfechamento ");
|
||||||
|
|
||||||
Query query = getSession().createSQLQuery(sb.toString());
|
Query query = getSession().createSQLQuery(sb.toString());
|
||||||
|
|
||||||
|
if( empresa != null ) {
|
||||||
query.setInteger("empresaId", empresa.getEmpresaId());
|
query.setInteger("empresaId", empresa.getEmpresaId());
|
||||||
|
}
|
||||||
|
|
||||||
if(dataDe != null && dataAte != null){
|
if(dataDe != null && dataAte != null){
|
||||||
query.setDate("dataDe", dataDe);
|
query.setDate("dataDe", DateUtil.normalizarToFecha(dataDe));
|
||||||
query.setDate("dataAte", dataAte);
|
query.setDate("dataAte", DateUtil.normalizarToFecha(dataAte));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -104,6 +111,11 @@ public class SapHibernateDAO extends GenericHibernateDAO<FechamentoCntcorrente,
|
||||||
fcc.setMesfechamento(tupla[11].toString());
|
fcc.setMesfechamento(tupla[11].toString());
|
||||||
fcc.setFeclancamento(tupla[12].toString());
|
fcc.setFeclancamento(tupla[12].toString());
|
||||||
|
|
||||||
|
//empresa enviada nula apenas no processo automatico
|
||||||
|
if(empresa == null) {
|
||||||
|
fcc.setEnviar(true);
|
||||||
|
}
|
||||||
|
|
||||||
retorno.add(fcc);
|
retorno.add(fcc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ import java.util.Date;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EnumType;
|
||||||
|
import javax.persistence.Enumerated;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
@ -15,12 +17,12 @@ import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.enums.StatusIntegracaoSap;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "FECHAMENTO_CNTCORRENTE")
|
@Table(name = "FECHAMENTO_CNTCORRENTE")
|
||||||
public class FechamentoCntcorrente {
|
public class FechamentoCntcorrente {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@SequenceGenerator(name = "FECHAMENTO_CNTCORRENTE_SEQ", sequenceName = "FECHAMENTO_CNTCORRENTE_SEQ", allocationSize = 1)
|
@SequenceGenerator(name = "FECHAMENTO_CNTCORRENTE_SEQ", sequenceName = "FECHAMENTO_CNTCORRENTE_SEQ", allocationSize = 1)
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "FECHAMENTO_CNTCORRENTE_SEQ")
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "FECHAMENTO_CNTCORRENTE_SEQ")
|
||||||
|
@ -67,7 +69,8 @@ public class FechamentoCntcorrente {
|
||||||
private Boolean indemailenviado;
|
private Boolean indemailenviado;
|
||||||
|
|
||||||
@Column(name = "INDINTEGRADOSAP")
|
@Column(name = "INDINTEGRADOSAP")
|
||||||
private Boolean integradoSap;
|
@Enumerated(EnumType.ORDINAL)
|
||||||
|
private StatusIntegracaoSap integradoSap;
|
||||||
|
|
||||||
public Long getFechamentocntcorrenteId() {
|
public Long getFechamentocntcorrenteId() {
|
||||||
return fechamentocntcorrenteId;
|
return fechamentocntcorrenteId;
|
||||||
|
@ -165,11 +168,11 @@ public class FechamentoCntcorrente {
|
||||||
this.indemailenviado = indemailenviado;
|
this.indemailenviado = indemailenviado;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getIntegradoSap() {
|
public StatusIntegracaoSap getIntegradoSap() {
|
||||||
return integradoSap;
|
return integradoSap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIntegradoSap(Boolean integradoSap) {
|
public void setIntegradoSap(StatusIntegracaoSap integradoSap) {
|
||||||
this.integradoSap = integradoSap;
|
this.integradoSap = integradoSap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.rjconsultores.ventaboletos.enums;
|
||||||
|
|
||||||
|
public enum StatusIntegracaoSap {
|
||||||
|
INTEGRADO,
|
||||||
|
NAO_INTEGRADO,
|
||||||
|
PENDENTE;
|
||||||
|
}
|
|
@ -13,4 +13,6 @@ public interface SapService extends GenericService<FechamentoCntcorrente, Long>
|
||||||
|
|
||||||
public List<FechamentoCntCorrenteVO> obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar);
|
public List<FechamentoCntCorrenteVO> obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar);
|
||||||
|
|
||||||
|
public void integracaoSapAutomatica() throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,4 +108,13 @@ public class SapServiceImpl implements SapService{
|
||||||
return constante.getValorconstante();
|
return constante.getValorconstante();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void integracaoSapAutomatica() throws Exception {
|
||||||
|
List<FechamentoCntCorrenteVO> listaPendente = obtenerTodosParaRemessa(null, new Date(), new Date(), false);
|
||||||
|
|
||||||
|
if(!listaPendente.isEmpty()) {
|
||||||
|
remessa(listaPendente);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue