bug #7127
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@52998 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
9c543afa4d
commit
f4e6b0289d
|
@ -62,12 +62,20 @@ public class Conferencia implements Serializable {
|
|||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "FECMODIF")
|
||||
private Date fecmodif;
|
||||
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "DATAMALOTE")
|
||||
private Date datamalote;
|
||||
|
||||
@Column(name = "USUARIO_MALOTE_ID")
|
||||
private Integer usuarioMaloteId;
|
||||
|
||||
@Transient
|
||||
private CoresConferencia cor;
|
||||
|
||||
|
@ -218,4 +226,20 @@ public class Conferencia implements Serializable {
|
|||
this.numfoliosistema = numfoliosistema;
|
||||
}
|
||||
|
||||
public Date getDatamalote() {
|
||||
return datamalote;
|
||||
}
|
||||
|
||||
public void setDatamalote(Date datamalote) {
|
||||
this.datamalote = datamalote;
|
||||
}
|
||||
|
||||
public Integer getUsuarioMaloteId() {
|
||||
return usuarioMaloteId;
|
||||
}
|
||||
|
||||
public void setUsuarioMaloteId(Integer usuarioMaloteId) {
|
||||
this.usuarioMaloteId = usuarioMaloteId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.rjconsultores.ventaboletos.enums.comissao.BoletoStatusComissao;
|
|||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.EtiquetaMalote;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.EventosFinanceirosVO;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.LogConferenciaVO;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.OcdVO;
|
||||
|
@ -59,4 +60,8 @@ public interface ConferenciaComissaoService extends GenericService<Conferencia,
|
|||
BigDecimal totalBilhetesDevolvidos, BigDecimal totalBilhetesGap, BigDecimal totalBilhetesGapCancelados, BigDecimal totalBilhetesGapDevolvidos,
|
||||
BigDecimal totalCreditosEventoFinanceiros, BigDecimal totalDebitosEventoFinanceiros, OcdVO totalOcd) throws BusinessException;
|
||||
|
||||
public EtiquetaMalote decodificarEtiquetaMalote(String codigoBarras) throws BusinessException;
|
||||
|
||||
public void confirmarChegadaMalote(EtiquetaMalote etiquetaMalote) throws BusinessException;
|
||||
|
||||
}
|
||||
|
|
|
@ -6,11 +6,14 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.rjconsultores.ventaboletos.constantes.Constantes;
|
||||
import com.rjconsultores.ventaboletos.dao.ConferenciaComissaoDAO;
|
||||
import com.rjconsultores.ventaboletos.dao.EmpresaDAO;
|
||||
import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Conferencia;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.LogConferencia;
|
||||
|
@ -19,9 +22,12 @@ import com.rjconsultores.ventaboletos.enums.IndStatusBoleto;
|
|||
import com.rjconsultores.ventaboletos.enums.comissao.BoletoStatusComissao;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.service.ConferenciaComissaoService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||
import com.rjconsultores.ventaboletos.utilerias.LocaleUtil;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.EtiquetaMalote;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.EventosFinanceirosVO;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.FormapagoVO;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.LogConferenciaVO;
|
||||
|
@ -31,9 +37,17 @@ import com.rjconsultores.ventaboletos.vo.comissao.ResumoComissao;
|
|||
@Service("conferenciaComissaoService")
|
||||
public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoService {
|
||||
|
||||
private static Logger log = Logger.getLogger(ConferenciaComissaoService.class);
|
||||
|
||||
@Autowired
|
||||
private ConferenciaComissaoDAO conferenciaComissaoDAO;
|
||||
|
||||
@Autowired
|
||||
private EmpresaDAO empresaDAO;
|
||||
|
||||
@Autowired
|
||||
private PuntoVentaDAO puntoVentaDAO;
|
||||
|
||||
@Override
|
||||
public List<Conferencia> obtenerTodos() {
|
||||
return conferenciaComissaoDAO.obtenerTodos();
|
||||
|
@ -72,11 +86,16 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|||
|
||||
@Override
|
||||
public Conferencia confirmarChegadaMalote(Conferencia conferencia) throws BusinessException {
|
||||
conferencia.setDatamalote(new Date());
|
||||
conferencia.setUsuarioMaloteId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
return conferenciaComissaoDAO.confirmarChegadaMalote(conferencia);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Conferencia suscribirOrActualizacion(Conferencia entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
return conferenciaComissaoDAO.suscribirOrActualizacion(entidad);
|
||||
}
|
||||
|
||||
|
@ -345,4 +364,79 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
|
|||
resumoComissao.setTotalFormapago(totalFormapagos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EtiquetaMalote decodificarEtiquetaMalote(String codigoBarras) throws BusinessException {
|
||||
try {
|
||||
EtiquetaMalote etiquetaMalote = new EtiquetaMalote();
|
||||
log.debug("Empresa: " + codigoBarras.substring(0,4));
|
||||
etiquetaMalote.setEmpresaId(Integer.valueOf(codigoBarras.substring(0,4)));
|
||||
log.debug("Punto Venta: " + codigoBarras.substring(4,9));
|
||||
etiquetaMalote.setPuntoventaId(Integer.valueOf(codigoBarras.substring(4,9)));
|
||||
log.debug("Numero Malote: " + codigoBarras.substring(9,19));
|
||||
etiquetaMalote.setNumeroMalote(codigoBarras.substring(9,19));
|
||||
log.debug("Data inicial: " + codigoBarras.substring(19,27));
|
||||
etiquetaMalote.setDataInicial(DateUtil.getDateFromString(codigoBarras.substring(19,27), "ddMMyyyy"));
|
||||
log.debug("Data final: " + codigoBarras.substring(27,35));
|
||||
etiquetaMalote.setDataFinal(DateUtil.getDateFromString(codigoBarras.substring(27,35), "ddMMyyyy"));
|
||||
|
||||
Empresa empresa = empresaDAO.obtenerID(etiquetaMalote.getEmpresaId());
|
||||
if(empresa == null) {
|
||||
throw new BusinessException("recebimentoMaloteController.msg.erro.empresaNaoLocalizada");
|
||||
}
|
||||
etiquetaMalote.setNombempresa(empresa.getNombempresa());
|
||||
PuntoVenta puntoVenta = puntoVentaDAO.obtenerID(etiquetaMalote.getPuntoventaId());
|
||||
if(puntoVenta == null) {
|
||||
throw new BusinessException("recebimentoMaloteController.msg.erro.puntoVentaNaoLocalizado");
|
||||
}
|
||||
etiquetaMalote.setNombpuntoventa(puntoVenta.getNombpuntoventa());
|
||||
|
||||
return etiquetaMalote;
|
||||
} catch (BusinessException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmarChegadaMalote(EtiquetaMalote etiquetaMalote) throws BusinessException {
|
||||
try {
|
||||
Calendar cDataInicial = Calendar.getInstance(LocaleUtil.getLocale());
|
||||
cDataInicial.setTime(DateUtil.normalizar(etiquetaMalote.getDataInicial()));
|
||||
|
||||
Calendar cDataFinal = Calendar.getInstance(LocaleUtil.getLocale());
|
||||
cDataFinal.setTime(DateUtil.normalizar(etiquetaMalote.getDataFinal()));
|
||||
|
||||
Empresa empresa = empresaDAO.obtenerID(etiquetaMalote.getEmpresaId());
|
||||
PuntoVenta puntoVenta = puntoVentaDAO.obtenerID(etiquetaMalote.getPuntoventaId());
|
||||
|
||||
while (cDataInicial.compareTo(cDataFinal) <= 0) {
|
||||
Conferencia conferencia = obtenerConferenciaDataMovimento(cDataInicial.getTime(), etiquetaMalote.getPuntoventaId(), etiquetaMalote.getEmpresaId());
|
||||
if(conferencia == null) {
|
||||
conferencia = new Conferencia();
|
||||
conferencia.setDatamovimento(cDataInicial.getTime());
|
||||
conferencia.setEmpresa(empresa);
|
||||
conferencia.setPuntoVenta(puntoVenta);
|
||||
|
||||
conferencia = suscribirOrActualizacion(conferencia);
|
||||
} else if(conferencia != null && conferencia.getIndmaloterecebido()) {
|
||||
continue;
|
||||
}
|
||||
confirmarChegadaMalote(conferencia);
|
||||
|
||||
cDataInicial.add(Calendar.DAY_OF_MONTH, 1);
|
||||
|
||||
}
|
||||
|
||||
} catch (BusinessException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
package com.rjconsultores.ventaboletos.vo.comissao;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||
|
||||
public class EtiquetaMalote {
|
||||
|
||||
private Integer empresaId;
|
||||
private String nombempresa;
|
||||
private Integer puntoventaId;
|
||||
private String nombpuntoventa;
|
||||
|
||||
private String numeroMalote;
|
||||
private Date dataInicial;
|
||||
private Date dataFinal;
|
||||
|
||||
public Integer getEmpresaId() {
|
||||
return empresaId;
|
||||
}
|
||||
|
||||
public void setEmpresaId(Integer empresaId) {
|
||||
this.empresaId = empresaId;
|
||||
}
|
||||
|
||||
public String getNombempresa() {
|
||||
return nombempresa;
|
||||
}
|
||||
|
||||
public void setNombempresa(String nombempresa) {
|
||||
this.nombempresa = nombempresa;
|
||||
}
|
||||
|
||||
public Integer getPuntoventaId() {
|
||||
return puntoventaId;
|
||||
}
|
||||
|
||||
public void setPuntoventaId(Integer puntoventaId) {
|
||||
this.puntoventaId = puntoventaId;
|
||||
}
|
||||
|
||||
public String getNombpuntoventa() {
|
||||
return nombpuntoventa;
|
||||
}
|
||||
|
||||
public void setNombpuntoventa(String nombpuntoventa) {
|
||||
this.nombpuntoventa = nombpuntoventa;
|
||||
}
|
||||
|
||||
public String getNumeroMalote() {
|
||||
return numeroMalote;
|
||||
}
|
||||
|
||||
public void setNumeroMalote(String numeroMalote) {
|
||||
this.numeroMalote = numeroMalote;
|
||||
}
|
||||
|
||||
public Date getDataInicial() {
|
||||
return dataInicial;
|
||||
}
|
||||
|
||||
public void setDataInicial(Date dataInicial) {
|
||||
this.dataInicial = dataInicial;
|
||||
}
|
||||
|
||||
public Date getDataFinal() {
|
||||
return dataFinal;
|
||||
}
|
||||
|
||||
public void setDataFinal(Date dataFinal) {
|
||||
this.dataFinal = dataFinal;
|
||||
}
|
||||
|
||||
public String getDatasMalote() {
|
||||
return DateUtil.getStringDate(getDataInicial(), "dd/MM/yyyy") + " - " + DateUtil.getStringDate(getDataFinal(), "dd/MM/yyyy");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue