Cadastro Fechamento Conta Corrente. ( fixes bug #5801 )

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@39537 d1611594-4594-4d17-8e1d-87c2c4800839
master
wilian 2014-11-13 13:18:12 +00:00
parent 3cae5205dd
commit 5071d1dfda
5 changed files with 63 additions and 21 deletions

View File

@ -4,7 +4,7 @@ import java.util.List;
import com.rjconsultores.ventaboletos.entidad.FechamentoParamgeral;
public interface FechamentoParamgeralDAO extends GenericDAO<FechamentoParamgeral, Integer> {
public interface FechamentoParamgeralDAO extends GenericDAO<FechamentoParamgeral, Long> {
public List<FechamentoParamgeral> buscaParametrosPorEmpresas(List<Integer> empresasId);
public List<FechamentoParamgeral> buscaParametrosPorEmpresa(Integer empresasId);

View File

@ -1,9 +1,9 @@
package com.rjconsultores.ventaboletos.dao.hibernate;
import java.util.Calendar;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
@ -11,11 +11,11 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import com.rjconsultores.ventaboletos.dao.FechamentoParamgeralDAO;
import com.rjconsultores.ventaboletos.entidad.AbastoCentral;
import com.rjconsultores.ventaboletos.entidad.FechamentoParamgeral;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@Repository("fechamentoParamgeralDAO")
public class FechamentoParamgeralHibernateDAO extends GenericHibernateDAO<FechamentoParamgeral, Integer> implements FechamentoParamgeralDAO {
public class FechamentoParamgeralHibernateDAO extends GenericHibernateDAO<FechamentoParamgeral, Long> implements FechamentoParamgeralDAO {
@Autowired
@ -26,11 +26,6 @@ public class FechamentoParamgeralHibernateDAO extends GenericHibernateDAO<Fecham
@Override
public List<FechamentoParamgeral> buscaParametrosPorEmpresas(List<Integer> empresasId) {
// String queryStr = "from FechamentoParamgeral params where params.activo = true and params.empresa.id in (:empresasId)";
//
// Query query = getSession().createQuery(queryStr);
// query.setParameterList("empresasId", empresasId);
Criteria query = getSession().createCriteria(getPersistentClass());
query.createAlias("empresa", "emp");
query.add(Restrictions.in("emp.empresaId", empresasId));
@ -49,11 +44,6 @@ public class FechamentoParamgeralHibernateDAO extends GenericHibernateDAO<Fecham
@Override
public List<FechamentoParamgeral> buscaParametrosPorEmpresa(Integer empresaId) {
// String queryStr = "from FechamentoParamgeral params where params.activo = true and params.empresa.id = :empresaId";
//
// Query query = getSession().createQuery(queryStr);
// query.setInteger("empresaId", empresaId);
Criteria query = getSession().createCriteria(getPersistentClass());
query.createAlias("empresa", "emp");
query.add(Restrictions.eq("emp.empresaId", empresaId));
@ -61,5 +51,13 @@ public class FechamentoParamgeralHibernateDAO extends GenericHibernateDAO<Fecham
return (List<FechamentoParamgeral>)query.list();
}
@Override
public void borrar(FechamentoParamgeral entity) {
entity.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entity.setFecmodif(Calendar.getInstance().getTime());
entity.setActivo(Boolean.FALSE);
actualizacion(entity);
}
}

View File

@ -18,6 +18,8 @@ import javax.persistence.TemporalType;
@Table(name = "FECHAMENTO_PARAMGERAL")
public class FechamentoParamgeral implements java.io.Serializable {
private static final long serialVersionUID = 1L;
private Long fechamentoparamgeralId;
private Empresa empresa;
private String boletoBancoCod;
@ -32,7 +34,7 @@ public class FechamentoParamgeral implements java.io.Serializable {
private Boolean activo;
public FechamentoParamgeral() {
super();
}
public FechamentoParamgeral(Empresa empresa, String boletoBancoCod,
@ -40,7 +42,7 @@ public class FechamentoParamgeral implements java.io.Serializable {
String boletoBancoContaDigito, String boletoBancoCarteira,
Integer boletoDiasVenc, Date fecmodif, Integer usuarioId,
Boolean activo) {
super();
this();
this.empresa = empresa;
this.boletoBancoCod = boletoBancoCod;
this.boletoBancoAgencia = boletoBancoAgencia;
@ -58,7 +60,7 @@ public class FechamentoParamgeral implements java.io.Serializable {
String boletoBancoAgencia, String boletoBancoConta,
String boletoBancoContaDigito, String boletoBancoCarteira,
Integer boletoDiasVenc, Integer usuarioId) {
super();
this();
this.empresa = empresa;
this.boletoBancoCod = boletoBancoCod;
this.boletoBancoAgencia = boletoBancoAgencia;
@ -120,7 +122,7 @@ public class FechamentoParamgeral implements java.io.Serializable {
public String getBoletoBancoContaDigito() {
return boletoBancoContaDigito;
}
public void setboletoBancoContaDigito(String boletoBancoContaDigito) {
public void setBoletoBancoContaDigito(String boletoBancoContaDigito) {
this.boletoBancoContaDigito = boletoBancoContaDigito;
}
@ -132,7 +134,7 @@ public class FechamentoParamgeral implements java.io.Serializable {
this.boletoBancoCarteira = boletoBancoCarteira;
}
@Column(name = "BOLETO_BANCO_DIAS_VENC", length = 3)
@Column(name = "BOLETO_DIAS_VENC", length = 3)
public Integer getBoletoDiasVenc() {
return boletoDiasVenc;
}
@ -164,4 +166,29 @@ public class FechamentoParamgeral implements java.io.Serializable {
public void setActivo(Boolean activo) {
this.activo = activo;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((fechamentoparamgeralId == null) ? 0 : fechamentoparamgeralId.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof FechamentoParamgeral))
return false;
FechamentoParamgeral other = (FechamentoParamgeral) obj;
if (fechamentoparamgeralId == null) {
if (other.fechamentoparamgeralId != null)
return false;
} else if (!fechamentoparamgeralId.equals(other.fechamentoparamgeralId))
return false;
return true;
}
}

View File

@ -5,9 +5,10 @@ import java.util.List;
import com.rjconsultores.ventaboletos.dao.GenericDAO;
import com.rjconsultores.ventaboletos.entidad.FechamentoParamgeral;
public interface FechamentoParamgeralService extends GenericDAO<FechamentoParamgeral, Integer> {
public interface FechamentoParamgeralService extends GenericDAO<FechamentoParamgeral, Long> {
public List<FechamentoParamgeral> buscaParametrosPorEmpresas(List<Integer> empresasId);
public List<FechamentoParamgeral> buscaParametrosPorEmpresa(Integer empresasId);
public FechamentoParamgeral suscribirOrActualizacion(FechamentoParamgeral fechamentoParamgeral);
}

View File

@ -1,9 +1,11 @@
package com.rjconsultores.ventaboletos.service.impl;
import java.util.Calendar;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.rjconsultores.ventaboletos.dao.FechamentoParamgeralDAO;
import com.rjconsultores.ventaboletos.entidad.FechamentoParamgeral;
@ -21,21 +23,24 @@ public class FechamentoParamgeralServiceImpl implements FechamentoParamgeralServ
}
@Override
public FechamentoParamgeral obtenerID(Integer id) {
public FechamentoParamgeral obtenerID(Long id) {
return fechamentoParamgeralDAO.obtenerID(id);
}
@Override
@Transactional
public FechamentoParamgeral suscribir(FechamentoParamgeral entidad) {
return fechamentoParamgeralDAO.suscribir(entidad);
}
@Override
@Transactional
public FechamentoParamgeral actualizacion(FechamentoParamgeral entidad) {
return fechamentoParamgeralDAO.actualizacion(entidad);
}
@Override
@Transactional
public void borrar(FechamentoParamgeral entidad) {
fechamentoParamgeralDAO.borrar(entidad);
}
@ -54,4 +59,15 @@ public class FechamentoParamgeralServiceImpl implements FechamentoParamgeralServ
public List<FechamentoParamgeral> buscaParametrosPorEmpresa(Integer empresasId) {
return fechamentoParamgeralDAO.buscaParametrosPorEmpresa(empresasId);
}
@Override
@Transactional
public FechamentoParamgeral suscribirOrActualizacion(FechamentoParamgeral fechamentoParamgeral) {
if(fechamentoParamgeral != null && fechamentoParamgeral.getFechamentoparamgeralId() == null) {
return suscribir(fechamentoParamgeral);
} else if(fechamentoParamgeral != null && fechamentoParamgeral.getFechamentoparamgeralId() != null) {
return actualizacion(fechamentoParamgeral);
}
return null;
}
}