walace 2017-10-06 12:12:56 +00:00
parent 6934958da8
commit dfce5b1f25
5 changed files with 162 additions and 142 deletions

View File

@ -18,7 +18,7 @@ import com.rjconsultores.ventaboletos.vo.comissao.OcdVO;
public interface ConferenciaComissaoDAO extends GenericDAO<Conferencia, Long> { public interface ConferenciaComissaoDAO extends GenericDAO<Conferencia, Long> {
public Conferencia suscribirOrActualizacion(Conferencia entidad); public Conferencia suscribirOrActualizacion(Conferencia entidad);
public List<ConferenciaComissaoVO> carregarConferenciaComissao(String competencia, Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento) throws BusinessException; public List<ConferenciaComissaoVO> carregarConferenciaComissao(String competencia, Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento) throws BusinessException;
@ -54,6 +54,8 @@ public interface ConferenciaComissaoDAO extends GenericDAO<Conferencia, Long> {
public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException; public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException;
public Conferencia cancelarChegadaMalote(Conferencia conferencia) ; public Conferencia cancelarChegadaMalote(Conferencia conferencia);
public boolean isConferidoVenta(BoletoComissao boletoComissao);
} }

View File

@ -90,24 +90,20 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
Collections.sort(lsConferencias); Collections.sort(lsConferencias);
return lsConferencias; return lsConferencias;
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(e.getMessage(), e); throw new BusinessException(e.getMessage(), e);
} } finally {
finally {
try { try {
if (con != null && !con.isClosed()) { if (con != null && !con.isClosed()) {
con.close(); con.close();
} }
} } catch (SQLException e) {
catch (SQLException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }
} }
} }
public List<ConferenciaComissaoVO> carregarConferenciaComissao(Date dataInicial, Date dataFinal, public List<ConferenciaComissaoVO> carregarConferenciaComissao(Date dataInicial, Date dataFinal,
Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento) throws BusinessException { Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento) throws BusinessException {
Connection con = null; Connection con = null;
@ -140,7 +136,6 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
} }
} }
private void carregarPuntoVentas(List<ConferenciaComissaoVO> lsConferencias, Date dataInicial, Date dataFinal, private void carregarPuntoVentas(List<ConferenciaComissaoVO> lsConferencias, Date dataInicial, Date dataFinal,
Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento) throws BusinessException { Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento) throws BusinessException {
@ -198,8 +193,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
setParametros(qr, parametros); setParametros(qr, parametros);
processarQueryConferenciaComissao(qr.list(), lsConferencias, competencia, dataMovimento, null, null); processarQueryConferenciaComissao(qr.list(), lsConferencias, competencia, dataMovimento, null, null);
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(e.getMessage(), e); throw new BusinessException(e.getMessage(), e);
} }
@ -209,14 +203,14 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
private void carregarConferenciasRegistradas(List<ConferenciaComissaoVO> lsConferencias, private void carregarConferenciasRegistradas(List<ConferenciaComissaoVO> lsConferencias,
String competencia, Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento, Map<String, Object> parametros) throws BusinessException { String competencia, Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento, Map<String, Object> parametros) throws BusinessException {
try { try {
if(parametros == null){ if (parametros == null) {
parametros = carregarParametros(null, null, competencia, empresa, puntoVenta, dataMovimento, false); parametros = carregarParametros(null, null, competencia, empresa, puntoVenta, dataMovimento, false);
} }
StringBuilder sQuery = new StringBuilder("SELECT co FROM Conferencia co "); StringBuilder sQuery = new StringBuilder("SELECT co FROM Conferencia co ");
sQuery.append("JOIN co.empresa em ") sQuery.append("JOIN co.empresa em ")
.append("JOIN co.puntoVenta pv ") .append("JOIN co.puntoVenta pv ")
.append("WHERE co.activo = 1 ") .append("WHERE co.activo = 1 ")
.append("AND co.datamovimento BETWEEN TO_DATE(:dataInicial,'DD/MM/YYYY HH24:MI') AND TO_DATE(:dataFinal,'DD/MM/YYYY HH24:MI') "); .append("AND co.datamovimento BETWEEN TO_DATE(:dataInicial,'DD/MM/YYYY HH24:MI') AND TO_DATE(:dataFinal,'DD/MM/YYYY HH24:MI') ");
if (parametros.containsKey("empresaId")) { if (parametros.containsKey("empresaId")) {
sQuery.append("AND em.empresaId = :empresaId "); sQuery.append("AND em.empresaId = :empresaId ");
@ -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 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; 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); processarQueryConferencia(qr.list(), lsConferencias, competencia, dataMovimento, dataInicial, dataFinal);
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(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()) { for (Entry<String, Object> parametro : parametros.entrySet()) {
if (parametro.getValue() instanceof Collection) { if (parametro.getValue() instanceof Collection) {
qr.setParameterList(parametro.getKey(), (Collection) parametro.getValue()); 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()); qr.setParameterList(parametro.getKey(), (List) parametro.getValue());
} } else {
else {
qr.setParameter(parametro.getKey(), parametro.getValue()); qr.setParameter(parametro.getKey(), parametro.getValue());
} }
} }
@ -259,7 +250,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
ResultSet rset = null; ResultSet rset = null;
try { try {
Map<String, Object> parametros = carregarParametros(dataInicialDate, dataFinalDate, competencia, empresa, puntoVenta, dataMovimento, false); Map<String, Object> parametros = carregarParametros(dataInicialDate, dataFinalDate, competencia, empresa, puntoVenta, dataMovimento, false);
StringBuilder sQuery = new StringBuilder() StringBuilder sQuery = new StringBuilder()
.append("SELECT PV.PUNTOVENTA_ID AS \"puntoventaId\", PV.NUMPUNTOVENTA as \"numPuntoVenta\", ") .append("SELECT PV.PUNTOVENTA_ID AS \"puntoventaId\", PV.NUMPUNTOVENTA as \"numPuntoVenta\", ")
@ -283,7 +274,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
stmt = con.prepareStatement(sQuery.toString()); stmt = con.prepareStatement(sQuery.toString());
String dataIncial = (String) parametros.get("dataInicial"); String dataIncial = (String) parametros.get("dataInicial");
String dataFinal = (String) parametros.get("dataFinal"); String dataFinal = (String) parametros.get("dataFinal");
stmt.setString(idxParametro++, dataIncial ); stmt.setString(idxParametro++, dataIncial);
stmt.setString(idxParametro++, dataFinal); stmt.setString(idxParametro++, dataFinal);
if (parametros.containsKey("empresaId")) { if (parametros.containsKey("empresaId")) {
stmt.setInt(idxParametro++, (Integer) parametros.get("empresaId")); stmt.setInt(idxParametro++, (Integer) parametros.get("empresaId"));
@ -305,12 +296,10 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
} }
processarQueryConferenciaComissao(movimentos, lsConferencias, competencia, dataMovimento, dataInicialDate, dataFinalDate); processarQueryConferenciaComissao(movimentos, lsConferencias, competencia, dataMovimento, dataInicialDate, dataFinalDate);
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(e.getMessage(), e); throw new BusinessException(e.getMessage(), e);
} } finally {
finally {
if (rset != null && !rset.isClosed()) { if (rset != null && !rset.isClosed()) {
rset.close(); rset.close();
} }
@ -321,8 +310,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
} }
/** /**
* Carrega a {@link ConferenciaComissaoVO} a partir de uma consulta com sql nativo, * Carrega a {@link ConferenciaComissaoVO} a partir de uma consulta com sql nativo, transformando o resultado em uma coleção de {@link ConferenciaComissaoVO}
* transformando o resultado em uma coleção de {@link ConferenciaComissaoVO}
* *
* @param lsQuery * @param lsQuery
* @param lsConferencias * @param lsConferencias
@ -333,7 +321,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
private void processarQueryConferenciaComissao(List<ConferenciaComissaoVO> lsQuery, private void processarQueryConferenciaComissao(List<ConferenciaComissaoVO> lsQuery,
List<ConferenciaComissaoVO> lsConferencias, String competencia, Date dataMovimento, Date dataInicial, Date dataFinal) throws ParseException { List<ConferenciaComissaoVO> lsConferencias, String competencia, Date dataMovimento, Date dataInicial, Date dataFinal) throws ParseException {
Set<Integer> diasSemMovimentos = new TreeSet<Integer>() ; Set<Integer> diasSemMovimentos = new TreeSet<Integer>();
if (dataMovimento != null) { if (dataMovimento != null) {
DateUtil.carregarDiasCompetencia(competencia, dataMovimento); DateUtil.carregarDiasCompetencia(competencia, dataMovimento);
} }
@ -358,9 +346,9 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
DiaConferenciaComissaoVO diaConferenciaComissao = new DiaConferenciaComissaoVO(); DiaConferenciaComissaoVO diaConferenciaComissao = new DiaConferenciaComissaoVO();
diaConferenciaComissao.setDia(dia); diaConferenciaComissao.setDia(dia);
if(competencia!=null){ if (competencia != null) {
diaConferenciaComissao.setData(DateUtil.getDateFromString(dia + "/" + competencia, "dd/MM/yyyy")); diaConferenciaComissao.setData(DateUtil.getDateFromString(dia + "/" + competencia, "dd/MM/yyyy"));
}else{ } else {
diaConferenciaComissao.setData(dataMovimento); diaConferenciaComissao.setData(dataMovimento);
} }
@ -468,7 +456,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
PuntoVenta puntoVenta, Date datamovimento, boolean formatoDataSemHora) throws ParseException { PuntoVenta puntoVenta, Date datamovimento, boolean formatoDataSemHora) throws ParseException {
Map<String, Object> parametros = new HashMap<String, Object>(); Map<String, Object> parametros = new HashMap<String, Object>();
String formatoData = (formatoDataSemHora?"dd/MM/yyyy":"dd/MM/yyyy HH:mm"); String formatoData = (formatoDataSemHora ? "dd/MM/yyyy" : "dd/MM/yyyy HH:mm");
if (empresa != null) { if (empresa != null) {
parametros.put("empresaId", empresa.getEmpresaId()); parametros.put("empresaId", empresa.getEmpresaId());
@ -487,7 +475,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
parametros.put("dataFinal", DateUtil.getStringDate(DateUtil.fimFecha(DateUtil.getDataFinalCompetencia(competencia)), formatoData)); parametros.put("dataFinal", DateUtil.getStringDate(DateUtil.fimFecha(DateUtil.getDataFinalCompetencia(competencia)), formatoData));
} }
if(parametros.get("dataInicial") == null && dataInicial != null){ if (parametros.get("dataInicial") == null && dataInicial != null) {
parametros.put("dataInicial", DateUtil.getStringDate(dataInicial, formatoData)); parametros.put("dataInicial", DateUtil.getStringDate(dataInicial, formatoData));
parametros.put("dataFinal", DateUtil.getStringDate(dataFinal, formatoData)); parametros.put("dataFinal", DateUtil.getStringDate(dataFinal, formatoData));
} }
@ -504,8 +492,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
return encerrarMovimentoDiario(conferencia); return encerrarMovimentoDiario(conferencia);
} }
return suscribirOrActualizacion(conferencia); return suscribirOrActualizacion(conferencia);
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(e.getMessage(), e); throw new BusinessException(e.getMessage(), e);
} }
@ -523,8 +510,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
public Conferencia suscribirOrActualizacion(Conferencia entidad) { public Conferencia suscribirOrActualizacion(Conferencia entidad) {
if (entidad.getConferenciaId() == null) { if (entidad.getConferenciaId() == null) {
return suscribir(entidad); return suscribir(entidad);
} } else {
else {
return actualizacion(entidad); return actualizacion(entidad);
} }
} }
@ -539,8 +525,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
gerarLancamentoContaCorrente(conferencia); gerarLancamentoContaCorrente(conferencia);
return suscribirOrActualizacion(conferencia); return suscribirOrActualizacion(conferencia);
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(e.getMessage(), e); throw new BusinessException(e.getMessage(), e);
} }
@ -552,8 +537,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
try { try {
conferencia.setIndconferido(Boolean.FALSE); conferencia.setIndconferido(Boolean.FALSE);
return suscribirOrActualizacion(conferencia); return suscribirOrActualizacion(conferencia);
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(e.getMessage(), e); throw new BusinessException(e.getMessage(), e);
} }
@ -581,8 +565,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
setParametros(qr, parametros); setParametros(qr, parametros);
return !qr.list().isEmpty(); return !qr.list().isEmpty();
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(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 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("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("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")) { if (parametros.containsKey("empresaId")) {
sQuery.append("AND EE.EMPRESA_ID = :empresaId "); sQuery.append("AND EE.EMPRESA_ID = :empresaId ");
@ -670,13 +652,12 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
List<EventosFinanceirosVO> result = qr.list(); List<EventosFinanceirosVO> result = qr.list();
for(EventosFinanceirosVO e : result){ for (EventosFinanceirosVO e : result) {
e.setConferencia(conferencia); e.setConferencia(conferencia);
} }
return result; return result;
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(e.getMessage(), e); throw new BusinessException(e.getMessage(), e);
} }
@ -712,7 +693,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
.addScalar("logconferenciaId", Hibernate.LONG) .addScalar("logconferenciaId", Hibernate.LONG)
.addScalar("observacao", Hibernate.STRING) .addScalar("observacao", Hibernate.STRING)
.addScalar("preco", Hibernate.BIG_DECIMAL) .addScalar("preco", Hibernate.BIG_DECIMAL)
.addScalar("descComportamentoData",Hibernate.STRING) .addScalar("descComportamentoData", Hibernate.STRING)
.addScalar("status", Hibernate.INTEGER) .addScalar("status", Hibernate.INTEGER)
.addScalar("numfoliosistema", Hibernate.STRING) .addScalar("numfoliosistema", Hibernate.STRING)
.addScalar("tipo", Hibernate.INTEGER) .addScalar("tipo", Hibernate.INTEGER)
@ -733,14 +714,13 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
List<LogConferenciaVO> result = qr.list(); List<LogConferenciaVO> result = qr.list();
for(LogConferenciaVO l : result){ for (LogConferenciaVO l : result) {
l.setConferencia(conferencia); l.setConferencia(conferencia);
} }
return result; return result;
} }
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(e.getMessage(), e); throw new BusinessException(e.getMessage(), e);
} }
@ -759,8 +739,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
getSession().save(logConferencia); getSession().save(logConferencia);
return logConferencia; return logConferencia;
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(e.getMessage(), e); throw new BusinessException(e.getMessage(), e);
} }
@ -779,8 +758,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
contaCorrenteAgenciaDAO.actualizacion(contaCorrentePtoVta); contaCorrenteAgenciaDAO.actualizacion(contaCorrentePtoVta);
} }
getSession().merge(logConferencia); getSession().merge(logConferencia);
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(e.getMessage(), e); throw new BusinessException(e.getMessage(), e);
} }
@ -790,8 +768,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
public LogConferencia obtenerLogConferenciaID(Long logconferenciaId) { public LogConferencia obtenerLogConferenciaID(Long logconferenciaId) {
try { try {
return (LogConferencia) this.getHibernateTemplate().get(LogConferencia.class.getName(), logconferenciaId); return (LogConferencia) this.getHibernateTemplate().get(LogConferencia.class.getName(), logconferenciaId);
} } catch (final HibernateException ex) {
catch (final HibernateException ex) {
throw convertHibernateAccessException(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("(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("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("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("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("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 ") .append("FROM CAJA C ")
@ -868,6 +845,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
Query qr = getSession().createSQLQuery(sQuery.toString()) Query qr = getSession().createSQLQuery(sQuery.toString())
.addScalar("cajaId", Hibernate.LONG) .addScalar("cajaId", Hibernate.LONG)
.addScalar("transacaoOriginalId", Hibernate.LONG)
.addScalar("numAsiento", Hibernate.STRING) .addScalar("numAsiento", Hibernate.STRING)
.addScalar("numAsientoVinculado", Hibernate.STRING) .addScalar("numAsientoVinculado", Hibernate.STRING)
.addScalar("numFolioSistema", Hibernate.STRING) .addScalar("numFolioSistema", Hibernate.STRING)
@ -925,11 +903,11 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
? boletoComissao.getComempformapagoId() : aux.getComempformapagoId()); ? boletoComissao.getComempformapagoId() : aux.getComempformapagoId());
FormapagoVO formapagoVO = new FormapagoVO(boletoComissao.getFormapagoId(), FormapagoVO formapagoVO = new FormapagoVO(boletoComissao.getFormapagoId(),
boletoComissao.getDescpago(), boletoComissao.getDescpago(),
boletoComissao.getIndconferenciafisicacomissao(), boletoComissao.getIndconferenciafisicacomissao(),
boletoComissao.getImporteFp()); boletoComissao.getImporteFp());
if(aux.getFormapagos().contains(formapagoVO)) { if (aux.getFormapagos().contains(formapagoVO)) {
formapagoVO = aux.getFormapagos().get(aux.getFormapagos().indexOf(formapagoVO)); formapagoVO = aux.getFormapagos().get(aux.getFormapagos().indexOf(formapagoVO));
formapagoVO.add(boletoComissao.getImporteFp()); formapagoVO.add(boletoComissao.getImporteFp());
} else { } else {
@ -946,8 +924,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
} }
return lsBoletoComissao; return lsBoletoComissao;
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(e.getMessage(), e); throw new BusinessException(e.getMessage(), e);
} }
@ -1004,13 +981,12 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
List<OcdVO> result = qr.list(); List<OcdVO> result = qr.list();
for(OcdVO ocd : result){ for (OcdVO ocd : result) {
ocd.setConferencia(conferencia); ocd.setConferencia(conferencia);
} }
return result; return result;
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(e.getMessage(), e); throw new BusinessException(e.getMessage(), e);
} }
@ -1033,8 +1009,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
qr.setMaxResults(1); qr.setMaxResults(1);
return (Conferencia) qr.uniqueResult(); return (Conferencia) qr.uniqueResult();
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(e.getMessage(), e); throw new BusinessException(e.getMessage(), e);
} }
@ -1054,9 +1029,9 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
String descOperacion = "CONFERENCIA MOVIMENTO DIA - " + sDataMovimento; String descOperacion = "CONFERENCIA MOVIMENTO DIA - " + sDataMovimento;
for (LogConferencia logConferencia : lsLogConferencia) { for (LogConferencia logConferencia : lsLogConferencia) {
Calendar cal =calHoje; Calendar cal = calHoje;
if(!Boolean.TRUE.equals(logConferencia.getIndmesmodia())){ if (!Boolean.TRUE.equals(logConferencia.getIndmesmodia())) {
cal = calAmanha; cal = calAmanha;
} }
@ -1066,14 +1041,14 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
&& logConferencia.getContaCorrentePtoVta().getActivo())) && logConferencia.getContaCorrentePtoVta().getActivo()))
|| (logConferencia.getPreco() == null || (logConferencia.getPreco() == null
|| logConferencia.getPreco().doubleValue() == 0d) || logConferencia.getPreco().doubleValue() == 0d)
|| logConferencia.isIndcredito().equals((short) 2)) { || logConferencia.isIndcredito().equals((short) 2)) {
continue; continue;
} }
ContaCorrentePtoVta contaCorrentePtoVta = contaCorrenteAgenciaDAO ContaCorrentePtoVta contaCorrentePtoVta = contaCorrenteAgenciaDAO
.gravarContaCorrente(conferencia.getPuntoVenta().getPuntoventaId(), .gravarContaCorrente(conferencia.getPuntoVenta().getPuntoventaId(),
descOperacion, cal.getTime(), conferencia.getUsuarioId(), descOperacion, cal.getTime(), conferencia.getUsuarioId(),
logConferencia.isIndcredito().equals((short)1) ? Constantes.TIPO_OPERACION_CC_PAGO : Constantes.TIPO_OPERACION_CC_LQ, logConferencia.isIndcredito().equals((short) 1) ? Constantes.TIPO_OPERACION_CC_PAGO : Constantes.TIPO_OPERACION_CC_LQ,
conferencia.getEmpresa().getEmpresaId(), conferencia.getEmpresa().getEmpresaId(),
Constantes.TURNO_AUTOMATICO, BigDecimal.ZERO, BigDecimal.ZERO, Constantes.TURNO_AUTOMATICO, BigDecimal.ZERO, BigDecimal.ZERO,
BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO,
@ -1083,8 +1058,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
logConferencia.setContaCorrentePtoVta(contaCorrentePtoVta); logConferencia.setContaCorrentePtoVta(contaCorrentePtoVta);
suscribirLogConferencia(logConferencia); suscribirLogConferencia(logConferencia);
} }
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(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()); Query qr = getSession().createQuery(sQuery.toString());
qr.setParameter("conferenciaId", conferenciaId); qr.setParameter("conferenciaId", conferenciaId);
return qr.list(); return qr.list();
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(e.getMessage(), e); throw new BusinessException(e.getMessage(), e);
} }
@ -1127,8 +1100,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
} }
return true; return true;
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(e.getMessage(), e); throw new BusinessException(e.getMessage(), e);
} }
@ -1186,8 +1158,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
} }
return null; return null;
} } catch (Exception e) {
catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BusinessException(e.getMessage(), e); throw new BusinessException(e.getMessage(), e);
} }
@ -1195,15 +1166,36 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
/** /**
* Recupera a conexão conforme parametrização em application.properties * Recupera a conexão conforme parametrização em application.properties
*
* @return * @return
* @throws SQLException * @throws SQLException
*/ */
public Connection getConnection() throws SQLException { public Connection getConnection() throws SQLException {
if(ApplicationProperties.getInstance().isDataSourceComissaoBancoProducao()) { if (ApplicationProperties.getInstance().isDataSourceComissaoBancoProducao()) {
return dataSource.getConnection(); return dataSource.getConnection();
} else { } else {
return dataSourceRead.getConnection(); return dataSourceRead.getConnection();
} }
} }
@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();
}
} }

View File

@ -74,7 +74,7 @@ public interface ConferenciaComissaoService extends GenericService<Conferencia,
public EtiquetaMalote decodificarEtiquetaMalote(String codigoBarras) throws BusinessException; public EtiquetaMalote decodificarEtiquetaMalote(String codigoBarras) throws BusinessException;
public void confirmarChegadaMalote(EtiquetaMalote etiquetaMalote ) throws BusinessException; public void confirmarChegadaMalote(EtiquetaMalote etiquetaMalote) throws BusinessException;
public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException; public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException;
@ -84,8 +84,10 @@ public interface ConferenciaComissaoService extends GenericService<Conferencia,
public List<String> quantidadeECFPorPuntoVenta(Conferencia conferencia); public List<String> quantidadeECFPorPuntoVenta(Conferencia conferencia);
public void enviarEmailIrregularidadeECF(String email, String msg,String assunto)throws Exception ; public void enviarEmailIrregularidadeECF(String email, String msg, String assunto) throws Exception;
public void generacionAutomaticaConferencia(); public void generacionAutomaticaConferencia();
public boolean isConferidoVenta(BoletoComissao boletoComissao);
} }

View File

@ -977,4 +977,9 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
public Conferencia cancelarChegadaMalote(Conferencia conferencia) { public Conferencia cancelarChegadaMalote(Conferencia conferencia) {
return conferenciaComissaoDAO.cancelarChegadaMalote(conferencia); return conferenciaComissaoDAO.cancelarChegadaMalote(conferencia);
} }
@Override
public boolean isConferidoVenta(BoletoComissao boletoComissao) {
return conferenciaComissaoDAO.isConferidoVenta(boletoComissao);
}
} }

View File

@ -71,6 +71,7 @@ public class BoletoComissao {
private boolean exigeConferenciaAba; private boolean exigeConferenciaAba;
private boolean conferido; private boolean conferido;
private boolean conferidoVenda;
private Date feccorrida; private Date feccorrida;
@ -84,6 +85,8 @@ public class BoletoComissao {
private Long cajaId; private Long cajaId;
private Long transacaoOriginalId;
private Conferencia conferencia; private Conferencia conferencia;
private Date feccorte; private Date feccorte;
@ -1004,6 +1007,14 @@ public class BoletoComissao {
this.cajaId = cajaId; this.cajaId = cajaId;
} }
public Long getTransacaoOriginalId() {
return transacaoOriginalId;
}
public void setTransacaoOriginalId(Long transacaoOriginalId) {
this.transacaoOriginalId = transacaoOriginalId;
}
public Conferencia getConferencia() { public Conferencia getConferencia() {
return conferencia; return conferencia;
} }
@ -1028,4 +1039,12 @@ public class BoletoComissao {
this.valorbase = valorbase; this.valorbase = valorbase;
} }
public boolean isConferidoVenda() {
return conferidoVenda;
}
public void setConferidoVenda(boolean conferidoVenda) {
this.conferidoVenda = conferidoVenda;
}
} }