|
|
|
@ -90,24 +90,20 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
Collections.sort(lsConferencias);
|
|
|
|
|
|
|
|
|
|
return lsConferencias;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
|
finally {
|
|
|
|
|
} finally {
|
|
|
|
|
try {
|
|
|
|
|
if (con != null && !con.isClosed()) {
|
|
|
|
|
con.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (SQLException e) {
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<ConferenciaComissaoVO> carregarConferenciaComissao(Date dataInicial, Date dataFinal,
|
|
|
|
|
Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento) throws BusinessException {
|
|
|
|
|
Connection con = null;
|
|
|
|
@ -140,7 +136,6 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void carregarPuntoVentas(List<ConferenciaComissaoVO> lsConferencias, Date dataInicial, Date dataFinal,
|
|
|
|
|
Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento) throws BusinessException {
|
|
|
|
|
|
|
|
|
@ -198,8 +193,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
setParametros(qr, parametros);
|
|
|
|
|
|
|
|
|
|
processarQueryConferenciaComissao(qr.list(), lsConferencias, competencia, dataMovimento, null, null);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -230,8 +224,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
Date dataInicial = parametros.get("dataInicial") != null ? DateUtil.getDateFromString(parametros.get("dataInicial").toString(), "dd/MM/yyyy HH:mm") : null;
|
|
|
|
|
Date dataFinal = parametros.get("dataFinal") != null ? DateUtil.getDateFromString(parametros.get("dataFinal").toString(), "dd/MM/yyyy HH:mm") : null;
|
|
|
|
|
processarQueryConferencia(qr.list(), lsConferencias, competencia, dataMovimento, dataInicial, dataFinal);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -242,11 +235,9 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
for (Entry<String, Object> parametro : parametros.entrySet()) {
|
|
|
|
|
if (parametro.getValue() instanceof Collection) {
|
|
|
|
|
qr.setParameterList(parametro.getKey(), (Collection) parametro.getValue());
|
|
|
|
|
}
|
|
|
|
|
else if (parametro.getValue() instanceof List) {
|
|
|
|
|
} else if (parametro.getValue() instanceof List) {
|
|
|
|
|
qr.setParameterList(parametro.getKey(), (List) parametro.getValue());
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
qr.setParameter(parametro.getKey(), parametro.getValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -305,12 +296,10 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
processarQueryConferenciaComissao(movimentos, lsConferencias, competencia, dataMovimento, dataInicialDate, dataFinalDate);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
|
finally {
|
|
|
|
|
} finally {
|
|
|
|
|
if (rset != null && !rset.isClosed()) {
|
|
|
|
|
rset.close();
|
|
|
|
|
}
|
|
|
|
@ -321,8 +310,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Carrega a {@link ConferenciaComissaoVO} a partir de uma consulta com sql nativo,
|
|
|
|
|
* transformando o resultado em uma coleção de {@link ConferenciaComissaoVO}
|
|
|
|
|
* Carrega a {@link ConferenciaComissaoVO} a partir de uma consulta com sql nativo, transformando o resultado em uma coleção de {@link ConferenciaComissaoVO}
|
|
|
|
|
*
|
|
|
|
|
* @param lsQuery
|
|
|
|
|
* @param lsConferencias
|
|
|
|
@ -504,8 +492,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
return encerrarMovimentoDiario(conferencia);
|
|
|
|
|
}
|
|
|
|
|
return suscribirOrActualizacion(conferencia);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -523,8 +510,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
public Conferencia suscribirOrActualizacion(Conferencia entidad) {
|
|
|
|
|
if (entidad.getConferenciaId() == null) {
|
|
|
|
|
return suscribir(entidad);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
return actualizacion(entidad);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -539,8 +525,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
|
|
|
|
|
gerarLancamentoContaCorrente(conferencia);
|
|
|
|
|
return suscribirOrActualizacion(conferencia);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -552,8 +537,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
try {
|
|
|
|
|
conferencia.setIndconferido(Boolean.FALSE);
|
|
|
|
|
return suscribirOrActualizacion(conferencia);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -581,8 +565,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
setParametros(qr, parametros);
|
|
|
|
|
|
|
|
|
|
return !qr.list().isEmpty();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -631,8 +614,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
.append("LEFT JOIN EMPRESA E ON E.EMPRESA_ID = M.EMPRESA_ID ")
|
|
|
|
|
.append("LEFT JOIN EMPRESA_IMPOSTO EI ON (EI.ESTADO_ID = EST.ESTADO_ID AND EI.EMPRESA_ID = E.EMPRESA_ID AND EI.ACTIVO = 1) ")
|
|
|
|
|
.append("WHERE EE.ACTIVO = 1 ")
|
|
|
|
|
.append("AND CD.FECCORTE BETWEEN TO_DATE(:dataInicial, 'DD/MM/YYYY') AND TO_DATE(:dataFinal, 'DD/MM/YYYY') ")
|
|
|
|
|
;
|
|
|
|
|
.append("AND CD.FECCORTE BETWEEN TO_DATE(:dataInicial, 'DD/MM/YYYY') AND TO_DATE(:dataFinal, 'DD/MM/YYYY') ");
|
|
|
|
|
|
|
|
|
|
if (parametros.containsKey("empresaId")) {
|
|
|
|
|
sQuery.append("AND EE.EMPRESA_ID = :empresaId ");
|
|
|
|
@ -675,8 +657,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -739,8 +720,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -759,8 +739,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
|
|
|
|
|
getSession().save(logConferencia);
|
|
|
|
|
return logConferencia;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -779,8 +758,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
contaCorrenteAgenciaDAO.actualizacion(contaCorrentePtoVta);
|
|
|
|
|
}
|
|
|
|
|
getSession().merge(logConferencia);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -790,8 +768,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
public LogConferencia obtenerLogConferenciaID(Long logconferenciaId) {
|
|
|
|
|
try {
|
|
|
|
|
return (LogConferencia) this.getHibernateTemplate().get(LogConferencia.class.getName(), logconferenciaId);
|
|
|
|
|
}
|
|
|
|
|
catch (final HibernateException ex) {
|
|
|
|
|
} catch (final HibernateException ex) {
|
|
|
|
|
throw convertHibernateAccessException(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -814,7 +791,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
.append("(select max(COMEMPCATEGORIA_ID) from COM_EMP_CATEGORIA where CATEGORIA_ID = C.CATEGORIA_ID AND EMPRESA_ID = M.EMPRESA_ID AND ACTIVO = 1) AS \"comempcategoriaId\", C.NOMBPASAJERO AS \"nombpasajero\", ")
|
|
|
|
|
.append("E.INDCARBOLETOSDEVOLVIDOSCONF AS \"indcarboletosdevolvidosconf\", C.FECCORRIDA AS \"feccorrida\", C.CORRIDA_ID \"corridaId\", ")
|
|
|
|
|
.append("NVL(T.PRECIO,0) + NVL(T.IMPORTEPEDAGIO,0) + NVL(T.IMPORTETAXAEMBARQUE,0) + NVL(T.IMPORTESEGURO,0) + NVL(T.IMPORTEOUTROS,0) AS \"valorTabela\", ")
|
|
|
|
|
.append("C.INDCANCELACION AS \"indCancelacion\", C.INDREIMPRESION AS \"indreimpresion\", C.FECCORTE AS \"feccorte\", ")
|
|
|
|
|
.append("C.INDCANCELACION AS \"indCancelacion\", C.INDREIMPRESION AS \"indreimpresion\", C.FECCORTE AS \"feccorte\", C.TRANSACAOORIGINAL_ID AS \"transacaoOriginalId\", ")
|
|
|
|
|
.append("EI.ICMS as \"icmsBase\", EST.ESTADO_ID as \"estadoId\", ")
|
|
|
|
|
.append("CASE WHEN C.PTOVTAVENTA_ID = C.PUNTOVENTA_ID OR C.PTOVTAVENTA_ID IS NULL THEN 1 ELSE 0 END AS ptoVtaOrigem ")
|
|
|
|
|
.append("FROM CAJA C ")
|
|
|
|
@ -868,6 +845,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
@SuppressWarnings("deprecation")
|
|
|
|
|
Query qr = getSession().createSQLQuery(sQuery.toString())
|
|
|
|
|
.addScalar("cajaId", Hibernate.LONG)
|
|
|
|
|
.addScalar("transacaoOriginalId", Hibernate.LONG)
|
|
|
|
|
.addScalar("numAsiento", Hibernate.STRING)
|
|
|
|
|
.addScalar("numAsientoVinculado", Hibernate.STRING)
|
|
|
|
|
.addScalar("numFolioSistema", Hibernate.STRING)
|
|
|
|
@ -946,8 +924,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return lsBoletoComissao;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -1009,8 +986,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -1033,8 +1009,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
qr.setMaxResults(1);
|
|
|
|
|
return (Conferencia) qr.uniqueResult();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -1083,8 +1058,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
logConferencia.setContaCorrentePtoVta(contaCorrentePtoVta);
|
|
|
|
|
suscribirLogConferencia(logConferencia);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -1102,8 +1076,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
Query qr = getSession().createQuery(sQuery.toString());
|
|
|
|
|
qr.setParameter("conferenciaId", conferenciaId);
|
|
|
|
|
return qr.list();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -1127,8 +1100,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -1186,8 +1158,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
throw new BusinessException(e.getMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -1195,6 +1166,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Recupera a conexão conforme parametrização em application.properties
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
* @throws SQLException
|
|
|
|
|
*/
|
|
|
|
@ -1206,4 +1178,24 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isConferidoVenta(BoletoComissao boletoComissao) {
|
|
|
|
|
|
|
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
sql.append("SELECT * FROM caja c ");
|
|
|
|
|
sql.append("INNER JOIN log_conferencia lc ON (c.CAJA_ID = lc.CAJA_ID) ");
|
|
|
|
|
sql.append("WHERE c.EMPRESACORRIDA_ID = 10 ");
|
|
|
|
|
sql.append(" AND c.INDSTATUSBOLETO LIKE 'V' ");
|
|
|
|
|
sql.append(" AND lc.ACTIVO = 1 ");
|
|
|
|
|
sql.append(" AND c.TRANSACAOORIGINAL_ID =:cajaId ");
|
|
|
|
|
sql.append(" AND c.TIPOVENTA_ID IN (5,12,18,81,41) ");
|
|
|
|
|
|
|
|
|
|
Query qr = getSession().createSQLQuery(sql.toString());
|
|
|
|
|
qr.setParameter("cajaId", boletoComissao.getTransacaoOriginalId());
|
|
|
|
|
|
|
|
|
|
return !qr.list().isEmpty();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|