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 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 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);
|
public Conferencia cancelarChegadaMalote(Conferencia conferencia);
|
||||||
|
|
||||||
|
|
|
@ -81,16 +81,26 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
||||||
try {
|
try {
|
||||||
con = getConnection();
|
con = getConnection();
|
||||||
|
|
||||||
List<ConferenciaComissaoVO> lsConferencias = new ArrayList<ConferenciaComissaoVO>();
|
List<ConferenciaComissaoVO> lsConferenciasFiltro = new ArrayList<ConferenciaComissaoVO>();
|
||||||
|
carregarPuntoVentas(lsConferenciasFiltro, competencia, empresa, puntoVenta, dataMovimento);
|
||||||
|
List<ConferenciaComissaoVO> lsConferenciasTodos = new ArrayList<ConferenciaComissaoVO>();
|
||||||
|
|
||||||
carregarPuntoVentas(lsConferencias, competencia, empresa, puntoVenta, dataMovimento);
|
for (ConferenciaComissaoVO lsConferenciasTmp : lsConferenciasFiltro) {
|
||||||
carregarConferenciasRegistradas(lsConferencias, competencia, empresa, puntoVenta, dataMovimento, null);
|
List<ConferenciaComissaoVO> lsConferencias = new ArrayList<ConferenciaComissaoVO>();
|
||||||
carregarMovimentoVendas(con, lsConferencias, competencia, empresa, puntoVenta, dataMovimento, null, null);
|
lsConferencias.add(lsConferenciasTmp);
|
||||||
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);
|
||||||
|
|
||||||
|
lsConferenciasTodos.addAll(lsConferencias);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Collections.sort(lsConferenciasTodos);
|
||||||
|
|
||||||
Collections.sort(lsConferencias);
|
return lsConferenciasTodos;
|
||||||
|
|
||||||
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);
|
||||||
|
@ -112,15 +122,15 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
||||||
con = getConnection();
|
con = getConnection();
|
||||||
|
|
||||||
List<ConferenciaComissaoVO> lsConferencias = new ArrayList<ConferenciaComissaoVO>();
|
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");
|
SimpleDateFormat format = new SimpleDateFormat("MM/yyyy");
|
||||||
String competencia = format.format(dataInicial);
|
String competencia = format.format(dataInicial);
|
||||||
|
|
||||||
carregarPuntoVentas(lsConferencias, dataInicial, dataFinal, empresa, puntoVenta, dataMovimento);
|
carregarPuntoVentas(lsConferencias, dataInicial, dataFinal, empresa, puntoVenta, dataMovimento);
|
||||||
carregarConferenciasRegistradas(lsConferencias, null, empresa, puntoVenta, dataMovimento, parametros);
|
carregarConferenciasRegistradas(lsConferencias, null, empresa, puntoVenta.getPuntoventaId(), dataMovimento, parametros);
|
||||||
carregarMovimentoVendas(con, lsConferencias, null, empresa, puntoVenta, dataMovimento, dataInicial, dataFinal);
|
carregarMovimentoVendas(con, lsConferencias, null, empresa, puntoVenta.getPuntoventaId(), dataMovimento, dataInicial, dataFinal);
|
||||||
carregarDiasSemMovimento(lsConferencias, competencia, empresa, puntoVenta, dataMovimento);
|
carregarDiasSemMovimento(lsConferencias, competencia, empresa, puntoVenta.getPuntoventaId(), dataMovimento);
|
||||||
|
|
||||||
return lsConferencias;
|
return lsConferencias;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -202,7 +212,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
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, Integer 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);
|
||||||
|
@ -245,7 +255,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
||||||
}
|
}
|
||||||
|
|
||||||
private void carregarMovimentoVendas(Connection con, List<ConferenciaComissaoVO> lsConferencias,
|
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 {
|
throws BusinessException, SQLException {
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rset = null;
|
ResultSet rset = null;
|
||||||
|
@ -280,7 +290,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
||||||
if (parametros.containsKey("empresaId")) {
|
if (parametros.containsKey("empresaId")) {
|
||||||
stmt.setInt(idxParametro++, (Integer) parametros.get("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"));
|
stmt.setInt(idxParametro++, (Integer) parametros.get("puntoventaId"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,7 +442,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
||||||
}
|
}
|
||||||
|
|
||||||
private void carregarDiasSemMovimento(List<ConferenciaComissaoVO> lsConferencias,
|
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 (ConferenciaComissaoVO conferenciaComissao : lsConferencias) {
|
||||||
for (Integer diaSemMovimento : conferenciaComissao.getDiasSemMovimentos()) {
|
for (Integer diaSemMovimento : conferenciaComissao.getDiasSemMovimentos()) {
|
||||||
DiaConferenciaComissaoVO diaConferenciaComissao = new DiaConferenciaComissaoVO();
|
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,
|
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>();
|
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");
|
||||||
|
@ -462,8 +472,8 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
||||||
if (empresa != null) {
|
if (empresa != null) {
|
||||||
parametros.put("empresaId", empresa.getEmpresaId());
|
parametros.put("empresaId", empresa.getEmpresaId());
|
||||||
}
|
}
|
||||||
if (puntoVenta != null && puntoVenta.getPuntoventaId() > -1) {
|
if (puntoVenta != null && puntoVenta > -1) {
|
||||||
parametros.put("puntoventaId", puntoVenta.getPuntoventaId());
|
parametros.put("puntoventaId", puntoVenta);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (datamovimento != null) {
|
if (datamovimento != null) {
|
||||||
|
@ -547,7 +557,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
||||||
private boolean isMovimentoDiarioBoletoGerado(Conferencia conferencia)
|
private boolean isMovimentoDiarioBoletoGerado(Conferencia conferencia)
|
||||||
throws BusinessException {
|
throws BusinessException {
|
||||||
try {
|
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()
|
StringBuilder sQuery = new StringBuilder()
|
||||||
.append("SELECT FECHAMENTOCNTCORRENTE_ID ")
|
.append("SELECT FECHAMENTOCNTCORRENTE_ID ")
|
||||||
.append("FROM FECHAMENTO_CNTCORRENTE ")
|
.append("FROM FECHAMENTO_CNTCORRENTE ")
|
||||||
|
@ -586,7 +596,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
||||||
throws BusinessException {
|
throws BusinessException {
|
||||||
try {
|
try {
|
||||||
Map<String, Object> parametros = carregarParametros(null, null, conferencia.getCompetencia(), conferencia.getEmpresa(),
|
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()
|
StringBuilder sQuery = new StringBuilder()
|
||||||
.append("SELECT EE.BOLETO_ID AS \"boletoId\", EE.EVENTOEXTRA_ID AS \"eventoextraId\", EE.NUMDOCUMENTO AS \"numdocumento\", ")
|
.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\", ")
|
.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 {
|
throws BusinessException {
|
||||||
try {
|
try {
|
||||||
Map<String, Object> parametros = carregarParametros(null, null, conferencia.getCompetencia(), conferencia.getEmpresa(),
|
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()
|
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\", ")
|
.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 {
|
public List<OcdVO> carregarOcds(Conferencia conferencia) throws BusinessException {
|
||||||
try {
|
try {
|
||||||
Map<String, Object> parametros = carregarParametros(null, null, null, conferencia.getEmpresa(),
|
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()
|
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\", ")
|
.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
|
@Override
|
||||||
public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa,
|
public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa,
|
||||||
PuntoVenta puntoVenta) throws BusinessException {
|
Integer puntoVenta) throws BusinessException {
|
||||||
try {
|
try {
|
||||||
List<ConferenciaComissaoVO> lsConferencias = new ArrayList<ConferenciaComissaoVO>();
|
List<ConferenciaComissaoVO> lsConferencias = new ArrayList<ConferenciaComissaoVO>();
|
||||||
|
|
||||||
|
@ -1138,7 +1148,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento,
|
public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento,
|
||||||
Empresa empresa, PuntoVenta puntoVenta) throws BusinessException {
|
Empresa empresa, Integer puntoVenta) throws BusinessException {
|
||||||
try {
|
try {
|
||||||
String competencia = DateUtil.getStringDate(datamovimento, "MM/yyyy");
|
String competencia = DateUtil.getStringDate(datamovimento, "MM/yyyy");
|
||||||
Map<String, Object> parametros = carregarParametros(null, null, competencia, empresa, puntoVenta, datamovimento, false);
|
Map<String, Object> parametros = carregarParametros(null, null, competencia, empresa, puntoVenta, datamovimento, false);
|
||||||
|
|
|
@ -734,7 +734,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException {
|
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
|
@Override
|
||||||
|
@ -749,7 +749,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException {
|
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
|
@Override
|
||||||
|
@ -844,7 +844,6 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean validaConferencia(Conferencia conferencia ) {
|
private boolean validaConferencia(Conferencia conferencia ) {
|
||||||
|
|
Loading…
Reference in New Issue