bug #6010: Boleto - Fechamento automático por agência par todas empresas
Descrição 1) Fechamento automático de acordo a agência: Parametrizar no cadastro de Agência esse valor. Deve ser em qtd de dias. git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@41052 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
e6b3c5693f
commit
cad25f2d64
|
@ -0,0 +1,13 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.FechamentoParamptovta;
|
||||||
|
|
||||||
|
public interface FechamentoParamptovtaDAO extends GenericDAO<FechamentoParamptovta, Long> {
|
||||||
|
|
||||||
|
public List<FechamentoParamptovta> buscaParametrosPorEmpresas(List<Integer> empresasId);
|
||||||
|
public List<FechamentoParamptovta> buscaParametrosPorEmpresa(Integer empresasId);
|
||||||
|
public FechamentoParamptovta buscaParametrosPorPuntoventa(Integer puntoventaId);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
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.FechamentoParamptovtaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.FechamentoParamptovta;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@Repository("fechamentoParamptovtaDAO")
|
||||||
|
public class FechamentoParamptovtaHibernateDAO extends GenericHibernateDAO<FechamentoParamptovta, Long> implements FechamentoParamptovtaDAO {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public FechamentoParamptovtaHibernateDAO(
|
||||||
|
@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FechamentoParamptovta> buscaParametrosPorEmpresas(List<Integer> empresasId) {
|
||||||
|
Criteria query = getSession().createCriteria(getPersistentClass());
|
||||||
|
query.createAlias("empresa", "emp");
|
||||||
|
query.add(Restrictions.in("emp.empresaId", empresasId));
|
||||||
|
query.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
|
||||||
|
return (List<FechamentoParamptovta>)query.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FechamentoParamptovta> obtenerTodos() {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
|
||||||
|
return (List<FechamentoParamptovta>)c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FechamentoParamptovta> buscaParametrosPorEmpresa(Integer empresaId) {
|
||||||
|
Criteria query = getSession().createCriteria(getPersistentClass());
|
||||||
|
query.createAlias("empresa", "emp");
|
||||||
|
query.add(Restrictions.eq("emp.empresaId", empresaId));
|
||||||
|
query.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
|
||||||
|
return (List<FechamentoParamptovta>)query.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void borrar(FechamentoParamptovta entity) {
|
||||||
|
entity.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entity.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entity.setActivo(Boolean.FALSE);
|
||||||
|
actualizacion(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FechamentoParamptovta buscaParametrosPorPuntoventa(Integer puntoventaId) {
|
||||||
|
Criteria query = getSession().createCriteria(getPersistentClass());
|
||||||
|
query.createAlias("puntoventa", "ptovta");
|
||||||
|
query.add(Restrictions.eq("ptovta.puntoventaId", puntoventaId));
|
||||||
|
query.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
|
||||||
|
return (FechamentoParamptovta)query.uniqueResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,122 @@
|
||||||
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "FECHAMENTO_PARAMPTOVTA")
|
||||||
|
public class FechamentoParamptovta implements Serializable {
|
||||||
|
|
||||||
|
private Long fechamentoparamptovtaId;
|
||||||
|
private PuntoVenta puntoventa;
|
||||||
|
private Empresa empresa;
|
||||||
|
private Integer intervalofechamento;
|
||||||
|
private Date fecmodif;
|
||||||
|
private Integer usuarioId;
|
||||||
|
private Boolean activo;
|
||||||
|
|
||||||
|
public FechamentoParamptovta() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public FechamentoParamptovta( PuntoVenta puntoventa, Empresa empresa, Integer usuarioId) {
|
||||||
|
this.puntoventa = puntoventa;
|
||||||
|
this.empresa = empresa;
|
||||||
|
|
||||||
|
this.fecmodif = new Date();
|
||||||
|
this.usuarioId = usuarioId;
|
||||||
|
this.activo = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FechamentoParamptovta(
|
||||||
|
PuntoVenta puntoventa, Empresa empresa, Integer intervalofechamento,
|
||||||
|
Date fecmodif, Integer usuarioId, Boolean activo) {
|
||||||
|
this.puntoventa = puntoventa;
|
||||||
|
this.empresa = empresa;
|
||||||
|
this.intervalofechamento = intervalofechamento;
|
||||||
|
this.fecmodif = fecmodif;
|
||||||
|
this.usuarioId = usuarioId;
|
||||||
|
this.activo = activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SequenceGenerator(name = "FECHAMENTO_PARAMPTOVTA_SEQ", sequenceName = "FECHAMENTO_PARAMPTOVTA_SEQ", allocationSize = 1)
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "FECHAMENTO_PARAMPTOVTA_SEQ")
|
||||||
|
@Column(name = "FECHAMENTOPARAMPTOVTA_ID", unique = true, nullable = false, precision = 15, scale = 0)
|
||||||
|
public Long getFechamentoparamptovtaId() {
|
||||||
|
return this.fechamentoparamptovtaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFechamentoparamptovtaId(Long fechamentoparamptovtaId) {
|
||||||
|
this.fechamentoparamptovtaId = fechamentoparamptovtaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIntervalofechamento(Integer intervalofechamento) {
|
||||||
|
this.intervalofechamento = intervalofechamento;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
@Column(name = "FECMODIF", length = 7)
|
||||||
|
public Date getFecmodif() {
|
||||||
|
return fecmodif;
|
||||||
|
}
|
||||||
|
public void setFecmodif(Date fecmodif) {
|
||||||
|
this.fecmodif = fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Column(name = "USUARIO_ID", precision = 7, scale = 0)
|
||||||
|
public Integer getUsuarioId() {
|
||||||
|
return usuarioId;
|
||||||
|
}
|
||||||
|
public void setUsuarioId(Integer usuarioId) {
|
||||||
|
this.usuarioId = usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Column(name = "ACTIVO", precision = 1, scale = 0)
|
||||||
|
public Boolean getActivo() {
|
||||||
|
return activo;
|
||||||
|
}
|
||||||
|
public void setActivo(Boolean activo) {
|
||||||
|
this.activo = activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JoinColumn(name = "PUNTOVENTA_ID")
|
||||||
|
@ManyToOne
|
||||||
|
public PuntoVenta getPuntoventa() {
|
||||||
|
return puntoventa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPuntoventa(PuntoVenta puntoventa) {
|
||||||
|
this.puntoventa = puntoventa;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JoinColumn(name = "EMPRESA_ID")
|
||||||
|
@ManyToOne
|
||||||
|
public Empresa getEmpresa() {
|
||||||
|
return empresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresa(Empresa empresa) {
|
||||||
|
this.empresa = empresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Column(name = "INTERVALOFECHAMENTO", length = 2)
|
||||||
|
public Integer getIntervalofechamento() {
|
||||||
|
return intervalofechamento;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -2,10 +2,9 @@ package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.GenericDAO;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.FechamentoParamgeral;
|
import com.rjconsultores.ventaboletos.entidad.FechamentoParamgeral;
|
||||||
|
|
||||||
public interface FechamentoParamgeralService extends GenericDAO<FechamentoParamgeral, Long> {
|
public interface FechamentoParamgeralService extends GenericService<FechamentoParamgeral, Long> {
|
||||||
|
|
||||||
public List<FechamentoParamgeral> buscaParametrosPorEmpresas(List<Integer> empresasId);
|
public List<FechamentoParamgeral> buscaParametrosPorEmpresas(List<Integer> empresasId);
|
||||||
public List<FechamentoParamgeral> buscaParametrosPorEmpresa(Integer empresasId);
|
public List<FechamentoParamgeral> buscaParametrosPorEmpresa(Integer empresasId);
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.FechamentoParamptovta;
|
||||||
|
|
||||||
|
public interface FechamentoParamptovtaService extends GenericService<FechamentoParamptovta, Long> {
|
||||||
|
|
||||||
|
public List<FechamentoParamptovta> buscaParametrosPorEmpresas(List<Integer> empresasId);
|
||||||
|
public List<FechamentoParamptovta> buscaParametrosPorEmpresa(Integer empresasId);
|
||||||
|
public FechamentoParamptovta suscribirOrActualizacion(FechamentoParamptovta FechamentoParamptovta);
|
||||||
|
public FechamentoParamptovta buscaParametrosPorPuntoventa(Integer puntoventaId);
|
||||||
|
|
||||||
|
}
|
|
@ -45,7 +45,7 @@ public class FechamentoParamgeralServiceImpl implements FechamentoParamgeralServ
|
||||||
fechamentoParamgeralDAO.borrar(entidad);
|
fechamentoParamgeralDAO.borrar(entidad);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long count(String campo, Object o) {
|
public Long count(String campo, Object o) {
|
||||||
return fechamentoParamgeralDAO.count(campo, o);
|
return fechamentoParamgeralDAO.count(campo, o);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
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.FechamentoParamptovtaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.FechamentoParamptovta;
|
||||||
|
import com.rjconsultores.ventaboletos.service.FechamentoParamptovtaService;
|
||||||
|
|
||||||
|
@Service("fechamentoParamptovtaService")
|
||||||
|
public class FechamentoParamptovtaServiceImpl implements FechamentoParamptovtaService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FechamentoParamptovtaDAO fechamentoParamptovtaDAO;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FechamentoParamptovta> obtenerTodos() {
|
||||||
|
return fechamentoParamptovtaDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FechamentoParamptovta obtenerID(Long id) {
|
||||||
|
return fechamentoParamptovtaDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public FechamentoParamptovta suscribir(FechamentoParamptovta entidad) {
|
||||||
|
return fechamentoParamptovtaDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public FechamentoParamptovta actualizacion(FechamentoParamptovta entidad) {
|
||||||
|
return fechamentoParamptovtaDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void borrar(FechamentoParamptovta entidad) {
|
||||||
|
fechamentoParamptovtaDAO.borrar(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Long count(String campo, Object o) {
|
||||||
|
return fechamentoParamptovtaDAO.count(campo, o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FechamentoParamptovta> buscaParametrosPorEmpresas(List<Integer> empresasId) {
|
||||||
|
return fechamentoParamptovtaDAO.buscaParametrosPorEmpresas(empresasId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FechamentoParamptovta> buscaParametrosPorEmpresa(Integer empresasId) {
|
||||||
|
return fechamentoParamptovtaDAO.buscaParametrosPorEmpresa(empresasId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public FechamentoParamptovta suscribirOrActualizacion(FechamentoParamptovta FechamentoParamptovta) {
|
||||||
|
if(FechamentoParamptovta != null && FechamentoParamptovta.getFechamentoparamptovtaId() == null) {
|
||||||
|
return suscribir(FechamentoParamptovta);
|
||||||
|
} else if(FechamentoParamptovta != null && FechamentoParamptovta.getFechamentoparamptovtaId() != null) {
|
||||||
|
return actualizacion(FechamentoParamptovta);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FechamentoParamptovta buscaParametrosPorPuntoventa(Integer puntoventaId) {
|
||||||
|
FechamentoParamptovta params = fechamentoParamptovtaDAO.buscaParametrosPorPuntoventa(puntoventaId);
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue