frederico 2016-10-19 12:18:03 +00:00
parent ba04075eb2
commit 7c5ea938e5
8 changed files with 275 additions and 21 deletions

View File

@ -0,0 +1,8 @@
package com.rjconsultores.ventaboletos.dao;
import com.rjconsultores.ventaboletos.entidad.TipoInformativoComissao;
public interface TipoInformativoComissaoDAO extends GenericDAO<TipoInformativoComissao, Integer> {
Boolean existeTipoInformativo(TipoInformativoComissao tipo);
}

View File

@ -566,12 +566,13 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
.append("SELECT LOG.LOGCONFERENCIA_ID AS \"logconferenciaId\", LOG.OBSERVACAO AS \"observacao\", LOG.PRECO AS \"preco\", ")
.append("LOG.STATUS AS \"status\", B.NUMFOLIOSISTEMA AS \"numfoliosistema\", LOG.TIPO AS \"tipo\", ")
.append("O.NUMOPERACION AS \"numoperacion\", TEE.DESCTIPOEVENTO AS \"desctipoevento\", U.NOMBUSUARIO AS \"nombusuario\", ")
.append("LOG.FECMODIF AS \"fecmodif\", LOG.INDCREDITO AS \"indcredito\", B.BOLETO_ID AS \"boletoId\", O.OCD_ID AS \"ocdId\", EE.EVENTOEXTRA_ID AS \"eventoextraId\" ")
.append("LOG.FECMODIF AS \"fecmodif\", LOG.INDCREDITO AS \"indcredito\", B.BOLETO_ID AS \"boletoId\", O.OCD_ID AS \"ocdId\", EE.EVENTOEXTRA_ID AS \"eventoextraId\", TI.DESCTIPO AS \"desctipoinformativo\" ")
.append("FROM LOG_CONFERENCIA LOG ")
.append("LEFT JOIN BOLETO B ON B.BOLETO_ID = LOG.BOLETO_ID ")
.append("LEFT JOIN EVENTO_EXTRA EE ON EE.EVENTOEXTRA_ID = LOG.EVENTOEXTRA_ID ")
.append("LEFT JOIN TIPO_EVENTO_EXTRA TEE ON TEE.TIPOEVENTOEXTRA_ID = EE.TIPOEVENTOEXTRA_ID ")
.append("LEFT JOIN OCD O ON O.OCD_ID = LOG.OCD_ID ")
.append("LEFT JOIN TIPO_INFORMATIVO TI ON TI.TIPOINFORMATIVO_ID = LOG.TIPOINFORMATIVOCOMISSAO_ID ")
.append("JOIN USUARIO U ON U.USUARIO_ID = LOG.USUARIO_ID ")
.append("WHERE LOG.ACTIVO = 1 ")
.append("AND LOG.CONFERENCIA_ID = :conferenciaId ");
@ -587,9 +588,10 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
.addScalar("desctipoevento", Hibernate.STRING)
.addScalar("nombusuario", Hibernate.STRING)
.addScalar("fecmodif", Hibernate.TIMESTAMP)
.addScalar("indcredito", Hibernate.BOOLEAN)
.addScalar("indcredito", Hibernate.SHORT)
.addScalar("boletoId", Hibernate.LONG).addScalar("ocdId", Hibernate.LONG)
.addScalar("eventoextraId", Hibernate.LONG)
.addScalar("desctipoinformativo", Hibernate.STRING)
.setResultTransformer(Transformers.aliasToBean(LogConferenciaVO.class));
qr.setParameter("conferenciaId", conferencia.getConferenciaId());
@ -880,14 +882,15 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
&& logConferencia.getContaCorrentePtoVta().getActivo() != null
&& logConferencia.getContaCorrentePtoVta().getActivo()))
|| (logConferencia.getPreco() == null
|| logConferencia.getPreco().doubleValue() == 0d)) {
|| logConferencia.getPreco().doubleValue() == 0d)
|| logConferencia.isIndcredito().equals((short) 2)) {
continue;
}
ContaCorrentePtoVta contaCorrentePtoVta = contaCorrenteAgenciaDAO
.gravarContaCorrente(conferencia.getPuntoVenta().getPuntoventaId(),
descOperacion, cal.getTime(), conferencia.getUsuarioId(),
logConferencia.isIndcredito() ? 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(),
Constantes.TURNO_AUTOMATICO, BigDecimal.ZERO, BigDecimal.ZERO,
BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO,

View File

@ -0,0 +1,45 @@
package com.rjconsultores.ventaboletos.dao.hibernate;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import com.rjconsultores.ventaboletos.dao.TipoInformativoComissaoDAO;
import com.rjconsultores.ventaboletos.entidad.TipoInformativoComissao;
@Repository("tipoInformativoComissaoDAO")
public class TipoInformativoComissaoHibernateDAO extends GenericHibernateDAO<TipoInformativoComissao, Integer>
implements TipoInformativoComissaoDAO {
@Autowired
public TipoInformativoComissaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
setSessionFactory(factory);
}
@SuppressWarnings("unchecked")
@Override
public List<TipoInformativoComissao> obtenerTodos() {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
return c.list();
}
@Override
public Boolean existeTipoInformativo(TipoInformativoComissao tipo) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("desctipo", tipo.getDesctipo()));
c.add(Restrictions.eq("activo", Boolean.TRUE));
if (tipo.getTipoinformativoId() != null) {
c.add(Restrictions.ne("tipoinformativoId", tipo.getTipoinformativoId()));
}
return c.list().isEmpty();
}
}

View File

@ -79,7 +79,11 @@ public class LogConferencia implements Serializable {
private ContaCorrentePtoVta contaCorrentePtoVta;
@Column(name = "INDCREDITO")
private boolean indcredito;
private Short indcredito;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "TIPOINFORMATIVOCOMISSAO_ID")
private TipoInformativoComissao tipoInformativoComissao;
public Long getLogconferenciaId() {
return logconferenciaId;
@ -208,12 +212,25 @@ public class LogConferencia implements Serializable {
this.contaCorrentePtoVta = contaCorrentePtoVta;
}
public boolean isIndcredito() {
/*
* 0 - Débito
* 1 - Crédito
* 2 - Informativo
*/
public Short isIndcredito() {
return indcredito;
}
public void setIndcredito(boolean indcredito) {
public void setIndcredito(Short indcredito) {
this.indcredito = indcredito;
}
public TipoInformativoComissao getTipoInformativoComissao() {
return tipoInformativoComissao;
}
public void setTipoInformativoComissao(TipoInformativoComissao tipoInformativoComissao) {
this.tipoInformativoComissao = tipoInformativoComissao;
}
}

View File

@ -0,0 +1,101 @@
package com.rjconsultores.ventaboletos.entidad;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
@SequenceGenerator(name = "TIPO_INFORMATIVO_SEQ", sequenceName = "TIPO_INFORMATIVO_SEQ", allocationSize = 1)
@Table(name = "TIPO_INFORMATIVO")
public class TipoInformativoComissao implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_INFORMATIVO_SEQ")
@Column(name = "TIPOINFORMATIVO_ID")
private Short tipoinformativoId;
@Column(name = "DESCTIPO")
private String desctipo;
@Column(name = "FECMODIF")
@Temporal(TemporalType.TIMESTAMP)
private Date fecmodif;
@Column(name = "USUARIO_ID")
private Integer usuarioId;
@Column(name = "ACTIVO")
private Boolean activo;
public Short getTipoinformativoId() {
return tipoinformativoId;
}
public void setTipoinformativoId(Short tipoinformativoId) {
this.tipoinformativoId = tipoinformativoId;
}
public String getDesctipo() {
return desctipo;
}
public void setDesctipo(String desctipo) {
this.desctipo = desctipo;
}
public Date getFecmodif() {
return fecmodif;
}
public void setFecmodif(Date fecmodif) {
this.fecmodif = fecmodif;
}
public Integer getUsuarioId() {
return usuarioId;
}
public void setUsuarioId(Integer usuarioId) {
this.usuarioId = usuarioId;
}
public Boolean getActivo() {
return activo;
}
public void setActivo(Boolean activo) {
this.activo = activo;
}
@Override
public int hashCode() {
int hash = 0;
hash += (tipoinformativoId != null ? tipoinformativoId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof TipoInformativoComissao)) {
return false;
}
TipoInformativoComissao other = (TipoInformativoComissao) object;
if ((this.tipoinformativoId == null && other.tipoinformativoId != null) || (this.tipoinformativoId != null && !this.tipoinformativoId.equals(other.tipoinformativoId))) {
return false;
}
return true;
}
@Override
public String toString() {
return desctipo;
}
}

View File

@ -0,0 +1,8 @@
package com.rjconsultores.ventaboletos.service;
import com.rjconsultores.ventaboletos.entidad.TipoInformativoComissao;
public interface TipoInformativoComissaoService extends GenericService<TipoInformativoComissao, Integer> {
Boolean existeTipoInformativo(TipoInformativoComissao tipo);
}

View File

@ -0,0 +1,63 @@
package com.rjconsultores.ventaboletos.service.impl;
import java.util.Calendar;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.rjconsultores.ventaboletos.dao.TipoInformativoComissaoDAO;
import com.rjconsultores.ventaboletos.entidad.TipoInformativoComissao;
import com.rjconsultores.ventaboletos.service.TipoInformativoComissaoService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@Service("tipoInformativoComissaoService")
public class TipoInformativoComissaoServiceImpl implements TipoInformativoComissaoService {
@Autowired
private TipoInformativoComissaoDAO tipoInformativoComissaoDAO;
public List<TipoInformativoComissao> obtenerTodos() {
return tipoInformativoComissaoDAO.obtenerTodos();
}
public TipoInformativoComissao obtenerID(Integer id) {
return tipoInformativoComissaoDAO.obtenerID(id);
}
@Transactional
public TipoInformativoComissao suscribir(TipoInformativoComissao entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
return tipoInformativoComissaoDAO.suscribir(entidad);
}
@Transactional
public TipoInformativoComissao actualizacion(TipoInformativoComissao entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
return tipoInformativoComissaoDAO.actualizacion(entidad);
}
@Transactional
public void borrar(TipoInformativoComissao entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.FALSE);
tipoInformativoComissaoDAO.actualizacion(entidad);
}
@Override
public Boolean existeTipoInformativo(TipoInformativoComissao tipo) {
return tipoInformativoComissaoDAO.existeTipoInformativo(tipo);
}
}

View File

@ -22,13 +22,14 @@ public class LogConferenciaVO {
private String desctipoevento;
private String nombusuario;
private Date fecmodif;
private boolean indcredito;
private Short indcredito;
private String nombempresa;
private String nombpuntoventa;
private Date datamovimento;
private String desccategoria;
private Integer tipoventa;
private String descinfoevento;
private String desctipoinformativo;
public LogConferenciaVO() {
super();
@ -90,7 +91,7 @@ public class LogConferenciaVO {
public String getStatusDescricao() {
StatusLogConferencia statusLogConferencia = StatusLogConferencia.getStatusLogConferencia(status);
if(statusLogConferencia != null) {
if (statusLogConferencia != null) {
return statusLogConferencia.toString();
}
return "";
@ -122,7 +123,7 @@ public class LogConferenciaVO {
public String getTipoDescricao() {
TipoLogConferencia tipoLogConferencia = TipoLogConferencia.getTipoLogConferencia(tipo);
if(tipoLogConferencia != null) {
if (tipoLogConferencia != null) {
return tipoLogConferencia.toString();
}
return "";
@ -191,11 +192,11 @@ public class LogConferenciaVO {
return true;
}
public boolean isIndcredito() {
public Short isIndcredito() {
return indcredito;
}
public void setIndcredito(boolean indcredito) {
public void setIndcredito(Short indcredito) {
this.indcredito = indcredito;
}
@ -232,7 +233,7 @@ public class LogConferenciaVO {
}
public String getDebitoCredito() {
return isIndcredito() ? "C" : "D";
return isIndcredito().equals((short) 0) ? "D" : isIndcredito().equals((short) 1) ? "C" : "I";
}
public Integer getTipoventa() {
@ -256,7 +257,15 @@ public class LogConferenciaVO {
}
public String getDescdebitocredito() {
return isIndcredito() ? "C" : "D";
return isIndcredito().equals((short) 0) ? "D" : isIndcredito().equals((short) 1) ? "C" : "I";
}
public String getDesctipoinformativo() {
return desctipoinformativo;
}
public void setDesctipoinformativo(String desctipoinformativo) {
this.desctipoinformativo = desctipoinformativo;
}
}