Fixes Bug #0009932 - Foram adicionadas lista auxiliares para impactar menos o código
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@75516 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
bc166d8689
commit
21dd44dc45
|
@ -48,11 +48,11 @@ public interface ConferenciaComissaoDAO extends GenericDAO<Conferencia, Long> {
|
|||
|
||||
public List<LogConferencia> carregarLogConferencia(Long conferenciaId) throws BusinessException;
|
||||
|
||||
public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException;
|
||||
public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa, Integer puntoVenta) throws BusinessException;
|
||||
|
||||
public BigDecimal carregarValorDepositoContaCorrente(Integer empresaId, Integer puntoventaId, Date datamovimento);
|
||||
|
||||
public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException;
|
||||
public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento, Empresa empresa, Integer puntoVenta) throws BusinessException;
|
||||
|
||||
public Conferencia cancelarChegadaMalote(Conferencia conferencia);
|
||||
|
||||
|
|
|
@ -81,16 +81,26 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
try {
|
||||
con = getConnection();
|
||||
|
||||
List<ConferenciaComissaoVO> lsConferenciasFiltro = new ArrayList<ConferenciaComissaoVO>();
|
||||
carregarPuntoVentas(lsConferenciasFiltro, competencia, empresa, puntoVenta, dataMovimento);
|
||||
List<ConferenciaComissaoVO> lsConferenciasTodos = new ArrayList<ConferenciaComissaoVO>();
|
||||
|
||||
for (ConferenciaComissaoVO lsConferenciasTmp : lsConferenciasFiltro) {
|
||||
List<ConferenciaComissaoVO> lsConferencias = new ArrayList<ConferenciaComissaoVO>();
|
||||
lsConferencias.add(lsConferenciasTmp);
|
||||
|
||||
carregarPuntoVentas(lsConferencias, competencia, empresa, puntoVenta, dataMovimento);
|
||||
carregarConferenciasRegistradas(lsConferencias, competencia, empresa, puntoVenta, dataMovimento, null);
|
||||
carregarMovimentoVendas(con, lsConferencias, competencia, empresa, puntoVenta, dataMovimento, null, null);
|
||||
carregarDiasSemMovimento(lsConferencias, competencia, empresa, puntoVenta, dataMovimento);
|
||||
ConferenciaComissaoVO vo = lsConferencias.get(0);
|
||||
carregarConferenciasRegistradas(lsConferencias, competencia, empresa, vo.getPuntoventaId(), dataMovimento, null);
|
||||
carregarMovimentoVendas(con, lsConferencias, competencia, empresa, vo.getPuntoventaId(), dataMovimento, null, null);
|
||||
carregarDiasSemMovimento(lsConferencias, competencia, empresa, vo.getPuntoventaId(), dataMovimento);
|
||||
|
||||
Collections.sort(lsConferencias);
|
||||
lsConferenciasTodos.addAll(lsConferencias);
|
||||
}
|
||||
|
||||
return lsConferencias;
|
||||
|
||||
Collections.sort(lsConferenciasTodos);
|
||||
|
||||
return lsConferenciasTodos;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new BusinessException(e.getMessage(), e);
|
||||
|
@ -112,15 +122,15 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
con = getConnection();
|
||||
|
||||
List<ConferenciaComissaoVO> lsConferencias = new ArrayList<ConferenciaComissaoVO>();
|
||||
Map<String, Object> parametros = carregarParametros(dataInicial, dataFinal, null, empresa, puntoVenta, dataMovimento, false);
|
||||
Map<String, Object> parametros = carregarParametros(dataInicial, dataFinal, null, empresa, puntoVenta.getPuntoventaId(), dataMovimento, false);
|
||||
|
||||
SimpleDateFormat format = new SimpleDateFormat("MM/yyyy");
|
||||
String competencia = format.format(dataInicial);
|
||||
|
||||
carregarPuntoVentas(lsConferencias, dataInicial, dataFinal, empresa, puntoVenta, dataMovimento);
|
||||
carregarConferenciasRegistradas(lsConferencias, null, empresa, puntoVenta, dataMovimento, parametros);
|
||||
carregarMovimentoVendas(con, lsConferencias, null, empresa, puntoVenta, dataMovimento, dataInicial, dataFinal);
|
||||
carregarDiasSemMovimento(lsConferencias, competencia, empresa, puntoVenta, dataMovimento);
|
||||
carregarConferenciasRegistradas(lsConferencias, null, empresa, puntoVenta.getPuntoventaId(), dataMovimento, parametros);
|
||||
carregarMovimentoVendas(con, lsConferencias, null, empresa, puntoVenta.getPuntoventaId(), dataMovimento, dataInicial, dataFinal);
|
||||
carregarDiasSemMovimento(lsConferencias, competencia, empresa, puntoVenta.getPuntoventaId(), dataMovimento);
|
||||
|
||||
return lsConferencias;
|
||||
} catch (Exception e) {
|
||||
|
@ -202,7 +212,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void carregarConferenciasRegistradas(List<ConferenciaComissaoVO> lsConferencias,
|
||||
String competencia, Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento, Map<String, Object> parametros) throws BusinessException {
|
||||
String competencia, Empresa empresa, Integer puntoVenta, Date dataMovimento, Map<String, Object> parametros) throws BusinessException {
|
||||
try {
|
||||
if (parametros == null) {
|
||||
parametros = carregarParametros(null, null, competencia, empresa, puntoVenta, dataMovimento, false);
|
||||
|
@ -245,7 +255,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
}
|
||||
|
||||
private void carregarMovimentoVendas(Connection con, List<ConferenciaComissaoVO> lsConferencias,
|
||||
String competencia, Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento, Date dataInicialDate, Date dataFinalDate)
|
||||
String competencia, Empresa empresa, Integer puntoVenta, Date dataMovimento, Date dataInicialDate, Date dataFinalDate)
|
||||
throws BusinessException, SQLException {
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rset = null;
|
||||
|
@ -280,7 +290,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
if (parametros.containsKey("empresaId")) {
|
||||
stmt.setInt(idxParametro++, (Integer) parametros.get("empresaId"));
|
||||
}
|
||||
if (parametros.containsKey("puntoventaId")) {
|
||||
if (parametros.containsKey("puntoventaId") && ((Integer)parametros.get("puntoventaId")) != -1) {
|
||||
stmt.setInt(idxParametro++, (Integer) parametros.get("puntoventaId"));
|
||||
}
|
||||
|
||||
|
@ -432,7 +442,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
}
|
||||
|
||||
private void carregarDiasSemMovimento(List<ConferenciaComissaoVO> lsConferencias,
|
||||
String competencia, Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento) throws ParseException {
|
||||
String competencia, Empresa empresa, Integer puntoVenta, Date dataMovimento) throws ParseException {
|
||||
for (ConferenciaComissaoVO conferenciaComissao : lsConferencias) {
|
||||
for (Integer diaSemMovimento : conferenciaComissao.getDiasSemMovimentos()) {
|
||||
DiaConferenciaComissaoVO diaConferenciaComissao = new DiaConferenciaComissaoVO();
|
||||
|
@ -454,7 +464,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
}
|
||||
|
||||
private Map<String, Object> carregarParametros(Date dataInicial, Date dataFinal, String competencia, Empresa empresa,
|
||||
PuntoVenta puntoVenta, Date datamovimento, boolean formatoDataSemHora) throws ParseException {
|
||||
Integer puntoVenta, Date datamovimento, boolean formatoDataSemHora) throws ParseException {
|
||||
Map<String, Object> parametros = new HashMap<String, Object>();
|
||||
|
||||
String formatoData = (formatoDataSemHora ? "dd/MM/yyyy" : "dd/MM/yyyy HH:mm");
|
||||
|
@ -462,8 +472,8 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
if (empresa != null) {
|
||||
parametros.put("empresaId", empresa.getEmpresaId());
|
||||
}
|
||||
if (puntoVenta != null && puntoVenta.getPuntoventaId() > -1) {
|
||||
parametros.put("puntoventaId", puntoVenta.getPuntoventaId());
|
||||
if (puntoVenta != null && puntoVenta > -1) {
|
||||
parametros.put("puntoventaId", puntoVenta);
|
||||
}
|
||||
|
||||
if (datamovimento != null) {
|
||||
|
@ -547,7 +557,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
private boolean isMovimentoDiarioBoletoGerado(Conferencia conferencia)
|
||||
throws BusinessException {
|
||||
try {
|
||||
Map<String, Object> parametros = carregarParametros(null, null, null, conferencia.getEmpresa(), conferencia.getPuntoVenta(), null, false);
|
||||
Map<String, Object> parametros = carregarParametros(null, null, null, conferencia.getEmpresa(), conferencia.getPuntoVenta().getPuntoventaId(), null, false);
|
||||
StringBuilder sQuery = new StringBuilder()
|
||||
.append("SELECT FECHAMENTOCNTCORRENTE_ID ")
|
||||
.append("FROM FECHAMENTO_CNTCORRENTE ")
|
||||
|
@ -586,7 +596,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
throws BusinessException {
|
||||
try {
|
||||
Map<String, Object> parametros = carregarParametros(null, null, conferencia.getCompetencia(), conferencia.getEmpresa(),
|
||||
conferencia.getPuntoVenta(), conferencia.getDatamovimento(), true);
|
||||
conferencia.getPuntoVenta().getPuntoventaId(), conferencia.getDatamovimento(), true);
|
||||
StringBuilder sQuery = new StringBuilder()
|
||||
.append("SELECT EE.BOLETO_ID AS \"boletoId\", EE.EVENTOEXTRA_ID AS \"eventoextraId\", EE.NUMDOCUMENTO AS \"numdocumento\", ")
|
||||
.append("CFP.IMPORTE AS \"impingreso\", TEE.DESCTIPOEVENTO AS \"desctipoevento\", EE.DESCINFO AS \"descinfo\", ")
|
||||
|
@ -780,7 +790,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
throws BusinessException {
|
||||
try {
|
||||
Map<String, Object> parametros = carregarParametros(null, null, conferencia.getCompetencia(), conferencia.getEmpresa(),
|
||||
conferencia.getPuntoVenta(), conferencia.getDatamovimento(), true);
|
||||
conferencia.getPuntoVenta().getPuntoventaId(), conferencia.getDatamovimento(), true);
|
||||
|
||||
StringBuilder sQuery = new StringBuilder()
|
||||
.append("SELECT C.CAJA_ID AS \"cajaId\", C.NUMASIENTO AS \"numAsiento\", C.NUMASIENTOVINCULADO AS \"numAsientoVinculado\", C.NUMOPERACION AS \"numoperacion\", C.NUMFOLIOSISTEMA AS \"numFolioSistema\", ")
|
||||
|
@ -947,7 +957,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
public List<OcdVO> carregarOcds(Conferencia conferencia) throws BusinessException {
|
||||
try {
|
||||
Map<String, Object> parametros = carregarParametros(null, null, null, conferencia.getEmpresa(),
|
||||
conferencia.getPuntoVenta(), conferencia.getDatamovimento(), false);
|
||||
conferencia.getPuntoVenta().getPuntoventaId(), conferencia.getDatamovimento(), false);
|
||||
|
||||
StringBuilder sQuery = new StringBuilder()
|
||||
.append("SELECT DISTINCT O.OCD_ID AS \"ocdId\", O.NUMOPERACION AS \"numoperacion\", O.FECINC AS \"fecinc\", O.FECPAGAR AS \"fecpagar\", O.FECPAGO AS \"fecpago\", ")
|
||||
|
@ -1096,7 +1106,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
|
||||
@Override
|
||||
public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa,
|
||||
PuntoVenta puntoVenta) throws BusinessException {
|
||||
Integer puntoVenta) throws BusinessException {
|
||||
try {
|
||||
List<ConferenciaComissaoVO> lsConferencias = new ArrayList<ConferenciaComissaoVO>();
|
||||
|
||||
|
@ -1138,7 +1148,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
|||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento,
|
||||
Empresa empresa, PuntoVenta puntoVenta) throws BusinessException {
|
||||
Empresa empresa, Integer puntoVenta) throws BusinessException {
|
||||
try {
|
||||
String competencia = DateUtil.getStringDate(datamovimento, "MM/yyyy");
|
||||
Map<String, Object> parametros = carregarParametros(null, null, competencia, empresa, puntoVenta, datamovimento, false);
|
||||
|
|
|
@ -734,7 +734,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|||
|
||||
@Override
|
||||
public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException {
|
||||
return conferenciaComissaoDAO.isConferenciaCompetenciaEncerrada(competencia, empresa, puntoVenta);
|
||||
return conferenciaComissaoDAO.isConferenciaCompetenciaEncerrada(competencia, empresa, puntoVenta.getPuntoventaId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -749,7 +749,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|||
|
||||
@Override
|
||||
public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException {
|
||||
return conferenciaComissaoDAO.carregarConferenciaRegistrada(datamovimento, empresa, puntoVenta);
|
||||
return conferenciaComissaoDAO.carregarConferenciaRegistrada(datamovimento, empresa, puntoVenta.getPuntoventaId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -844,7 +844,6 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean validaConferencia(Conferencia conferencia ) {
|
||||
|
|
Loading…
Reference in New Issue